mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-05 06:34:44 +00:00
Merge pull request #11001 from donaldsharp/system_route_recursion
zebra: Allow system routes to recurse through themselves
This commit is contained in:
commit
1258cfcd8c
102
tests/topotests/zebra_multiple_connected/r1/ip_route2.json
Normal file
102
tests/topotests/zebra_multiple_connected/r1/ip_route2.json
Normal file
@ -0,0 +1,102 @@
|
||||
{
|
||||
"10.0.1.0/24":[
|
||||
{
|
||||
"prefix":"10.0.1.0/24",
|
||||
"prefixLen":24,
|
||||
"protocol":"connected",
|
||||
"vrfName":"default",
|
||||
"distance":0,
|
||||
"metric":0,
|
||||
"installed":true,
|
||||
"table":254,
|
||||
"nexthops":[
|
||||
{
|
||||
"fib":true,
|
||||
"directlyConnected":true,
|
||||
"interfaceName":"r1-eth1",
|
||||
"active":true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"prefix":"10.0.1.0/24",
|
||||
"prefixLen":24,
|
||||
"protocol":"connected",
|
||||
"vrfName":"default",
|
||||
"distance":0,
|
||||
"metric":0,
|
||||
"installed":true,
|
||||
"table":254,
|
||||
"nexthops":[
|
||||
{
|
||||
"fib":true,
|
||||
"directlyConnected":true,
|
||||
"interfaceName":"r1-eth0",
|
||||
"active":true
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"10.0.1.30/32":[
|
||||
{
|
||||
"prefix":"10.0.1.30/32",
|
||||
"prefixLen":32,
|
||||
"protocol":"kernel",
|
||||
"vrfName":"default",
|
||||
"distance":0,
|
||||
"metric":0,
|
||||
"installed":true,
|
||||
"table":254,
|
||||
"nexthops":[
|
||||
{
|
||||
"fib":true,
|
||||
"directlyConnected":true,
|
||||
"interfaceName":"r1-eth1",
|
||||
"active":true
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"10.9.9.0/24":[
|
||||
{
|
||||
"prefix":"10.9.9.0/24",
|
||||
"prefixLen":24,
|
||||
"protocol":"kernel",
|
||||
"vrfName":"default",
|
||||
"distance":0,
|
||||
"metric":0,
|
||||
"installed":true,
|
||||
"table":254,
|
||||
"nexthops":[
|
||||
{
|
||||
"fib":true,
|
||||
"ip":"10.0.1.30",
|
||||
"afi":"ipv4",
|
||||
"interfaceName":"r1-eth1",
|
||||
"active":true
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"192.168.1.1/32":[
|
||||
{
|
||||
"prefix":"192.168.1.1/32",
|
||||
"prefixLen":32,
|
||||
"protocol":"kernel",
|
||||
"vrfName":"default",
|
||||
"distance":0,
|
||||
"metric":0,
|
||||
"installed":true,
|
||||
"table":254,
|
||||
"nexthops":[
|
||||
{
|
||||
"fib":true,
|
||||
"ip":"10.0.1.99",
|
||||
"afi":"ipv4",
|
||||
"interfaceName":"r1-eth1",
|
||||
"active":true
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
@ -133,6 +133,30 @@ def test_zebra_connected_multiple():
|
||||
assert result is None, "Kernel route is missing from zebra"
|
||||
|
||||
|
||||
def test_zebra_system_recursion():
|
||||
"Test a system route recursing through another system route"
|
||||
|
||||
tgen = get_topogen()
|
||||
if tgen.routers_have_failure():
|
||||
pytest.skip(tgen.errors)
|
||||
|
||||
router = tgen.gears["r1"]
|
||||
router.run("ip route add 10.0.1.30/32 dev r1-eth1")
|
||||
router.run("ip route add 10.9.9.0/24 via 10.0.1.30 dev r1-eth1")
|
||||
router.run("ip link add dummy2 type dummy")
|
||||
router.run("ip link set dummy2 up")
|
||||
router.run("ip link set dummy2 down")
|
||||
|
||||
routes = "{}/{}/ip_route2.json".format(CWD, router.name)
|
||||
expected = json.loads(open(routes).read())
|
||||
test_func = partial(
|
||||
topotest.router_json_cmp, router, "show ip route json", expected
|
||||
)
|
||||
|
||||
_, result = topotest.run_and_expect(test_func, None, count=20, wait=1)
|
||||
assert result is None, "Kernel route is missing from zebra"
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
args = ["-s"] + sys.argv[1:]
|
||||
sys.exit(pytest.main(args))
|
||||
|
@ -2265,7 +2265,8 @@ static int nexthop_active(struct nexthop *nexthop, struct nhg_hash_entry *nhe,
|
||||
continue;
|
||||
}
|
||||
|
||||
if (match->type == ZEBRA_ROUTE_CONNECT) {
|
||||
if ((match->type == ZEBRA_ROUTE_CONNECT) ||
|
||||
(RIB_SYSTEM_ROUTE(match) && RSYSTEM_ROUTE(type))) {
|
||||
match = zebra_nhg_connected_ifindex(rn, match,
|
||||
nexthop->ifindex);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user