Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F151379565
D47585.id.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D47585.id.diff
View Options
diff --git a/tests/sys/net/routing/test_routing_l3.py b/tests/sys/net/routing/test_routing_l3.py
--- a/tests/sys/net/routing/test_routing_l3.py
+++ b/tests/sys/net/routing/test_routing_l3.py
@@ -86,6 +86,47 @@
nh = [nh for nh in nhops if nh["index"] == nhop_kidx][0]
assert nh["ifa"] == str(second_addr.ip)
+ @pytest.mark.parametrize("family", ["inet", "inet6"])
+ @pytest.mark.require_user("root")
+ def test_add_address_same_prefix_present(self, family):
+ """
+ Tests adding an interface prefix route when a route with the same
+ prefix is already present in the routing table
+ """
+ vnet = self.vnet_map["vnet1"]
+ first_iface = vnet.iface_alias_map["if1"]
+
+ if family == "inet":
+ first_addr = ipaddress.ip_interface("192.0.2.1/24")
+ else:
+ first_addr = ipaddress.ip_interface("2001:db8::1/64")
+
+ # Add a route pointing to the loopback interface
+ ToolsHelper.print_output(
+ f"route add -net -{family} {first_addr.network} -interface lo0"
+ )
+
+ # Verify the route points to the loopback interface
+ routes = ToolsHelper.get_routes(family)
+ px = [
+ r for r in routes if r["destination"] == str(first_addr.network)
+ ][0]
+ assert px["interface-name"] == "lo0"
+
+ # Add an address to the first interface with the same prefix as the
+ # route, and verify switchover
+ first_iface.setup_addr(str(first_addr))
+
+ routes = ToolsHelper.get_routes(family)
+ px = [
+ r for r in routes if r["destination"] == str(first_addr.network)
+ ][0]
+ nhop_kidx = px["nhop"]
+ assert px["interface-name"] == first_iface.name
+ nhops = ToolsHelper.get_nhops(family)
+ nh = [nh for nh in nhops if nh["index"] == nhop_kidx][0]
+ assert nh["ifa"] == str(first_addr.ip)
+
class TestRouteCornerCase1(SingleVnetTestTemplate):
@pytest.mark.parametrize("family", ["inet", "inet6"])
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Apr 9, 12:32 AM (17 h, 11 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
31124192
Default Alt Text
D47585.id.diff (2 KB)
Attached To
Mode
D47585: tests: routing: Add address with same prefix present
Attached
Detach File
Event Timeline
Log In to Comment