fib: only update glean for interface if necessary
Type: improvement
If an interface address is added, the glean adjacency for it's covering
prefix is updated with that address. In the case of multiple addresses
within the same prefix being added, the most recently added one will end
up being used as the sender protocol address for ARP requests.
Similar behavior occurs when an interface address is deleted. The glean
adjacency is updated to some appropriate entry under it's covering
prefix. If there were multiple interface addresses configured, we may
update the address on the adjacency even though the address currently in
use is not the one being deleted.
Add a new value PROVIDES_GLEAN to fib_entry_src_flag_t. The flag
identifies whether a source interface entry is being used as the address
for the glean adjacency for the covering prefix.
Update logic so that the glean is only updated on adding an interface
address if there is not already a sibling entry in use which has the
flag set. Also, only update the glean on deleting an interface address
if the address being deleted has the flag set.
Also update unit test which validates expected behavior in the case
where multiple addresses within a prefix are configured on an interface.
Signed-off-by: Matthew Smith <mgsmith@netgate.com>
Change-Id: I7d918b8dd703735b20ec76e0a60af6d7e571b766
diff --git a/test/test_neighbor.py b/test/test_neighbor.py
index 041d782..403e93f 100644
--- a/test/test_neighbor.py
+++ b/test/test_neighbor.py
@@ -2126,27 +2126,30 @@
#
# add a local address in the same subnet
- # the source addresses are equivalent. VPP happens to
- # choose the last one that was added
+ # the source addresses are equivalent.
+ # VPP leaves the glean address being used for a prefix
+ # in place until that address is deleted.
+ #
conn3 = VppIpInterfaceAddress(self, self.pg1, "10.0.1.2", 24).add_vpp_config()
rxs = self.send_and_expect(self.pg0, [p2], self.pg1)
for rx in rxs:
- self.verify_arp_req(rx, self.pg1.local_mac, "10.0.1.2", "10.0.1.128")
-
- #
- # remove
- #
- conn3.remove_vpp_config()
- rxs = self.send_and_expect(self.pg0, [p2], self.pg1)
- for rx in rxs:
self.verify_arp_req(rx, self.pg1.local_mac, "10.0.1.1", "10.0.1.128")
#
- # add back, this time remove the first one
+ # remove first address, which is currently in use
+ # the second address should be used now
#
- conn3 = VppIpInterfaceAddress(self, self.pg1, "10.0.1.2", 24).add_vpp_config()
+ conn2.remove_vpp_config()
+ rxs = self.send_and_expect(self.pg0, [p2], self.pg1)
+ for rx in rxs:
+ self.verify_arp_req(rx, self.pg1.local_mac, "10.0.1.2", "10.0.1.128")
+ #
+ # add first address back. Second address should continue
+ # being used.
+ #
+ conn2 = VppIpInterfaceAddress(self, self.pg1, "10.0.1.1", 24).add_vpp_config()
rxs = self.send_and_expect(self.pg0, [p2], self.pg1)
for rx in rxs:
self.verify_arp_req(rx, self.pg1.local_mac, "10.0.1.2", "10.0.1.128")