mirror of
https://github.com/vyos/vyos-build.git
synced 2025-10-01 20:28:40 +02:00
Merge pull request #1040 from hedrok/T6516-isis-advertise-passive-only
T6516: frr: fix isisd advertise-passive-only
This commit is contained in:
commit
137b20e425
@ -0,0 +1,133 @@
|
||||
From e2dbe69dd830d01af5bf0202b347524b3151e4e6 Mon Sep 17 00:00:00 2001
|
||||
From: Kyrylo Yatsenko <hedrok@gmail.com>
|
||||
Date: Fri, 19 Sep 2025 09:17:03 +0300
|
||||
Subject: [PATCH] isis: fix advertise-passive-only routes install
|
||||
|
||||
When advertise-passive-only is set don't ignore active circuits
|
||||
completely - we still need to install routes from those interfaces.
|
||||
|
||||
Update test to check this.
|
||||
|
||||
Fixes #16325
|
||||
|
||||
Signed-off-by: Kyrylo Yatsenko <hedrok@gmail.com>
|
||||
---
|
||||
isisd/isis_lsp.c | 43 ++++++++-----------
|
||||
tests/topotests/isis_topo1/test_isis_topo1.py | 30 ++++++++++---
|
||||
2 files changed, 42 insertions(+), 31 deletions(-)
|
||||
|
||||
diff --git a/isisd/isis_lsp.c b/isisd/isis_lsp.c
|
||||
index d588af314c..0aefba95a2 100644
|
||||
--- a/isisd/isis_lsp.c
|
||||
+++ b/isisd/isis_lsp.c
|
||||
@@ -1308,37 +1308,30 @@ static void lsp_build(struct isis_lsp *lsp, struct isis_area *area)
|
||||
continue;
|
||||
}
|
||||
|
||||
- if (area->advertise_passive_only && !circuit->is_passive) {
|
||||
- lsp_debug(
|
||||
- "ISIS (%s): Circuit is not passive, ignoring.",
|
||||
- area->area_tag);
|
||||
- continue;
|
||||
- }
|
||||
-
|
||||
uint32_t metric = area->oldmetric
|
||||
? circuit->metric[level - 1]
|
||||
: circuit->te_metric[level - 1];
|
||||
|
||||
- if (circuit->ip_router && circuit->ip_addrs->count > 0) {
|
||||
- lsp_debug(
|
||||
- "ISIS (%s): Circuit has IPv4 active, adding respective TLVs.",
|
||||
- area->area_tag);
|
||||
- struct listnode *ipnode;
|
||||
- struct prefix_ipv4 *ipv4;
|
||||
- for (ALL_LIST_ELEMENTS_RO(circuit->ip_addrs, ipnode,
|
||||
- ipv4))
|
||||
- lsp_build_internal_reach_ipv4(lsp, area, ipv4,
|
||||
- metric);
|
||||
- }
|
||||
+ if (area->advertise_passive_only && !circuit->is_passive) {
|
||||
+ lsp_debug("ISIS (%s): Circuit is not passive, don't add prefixes.",
|
||||
+ area->area_tag);
|
||||
+ } else {
|
||||
+ if (circuit->ip_router && circuit->ip_addrs->count > 0) {
|
||||
+ lsp_debug("ISIS (%s): Circuit has IPv4 active, adding respective TLVs.",
|
||||
+ area->area_tag);
|
||||
+ struct listnode *ipnode;
|
||||
+ struct prefix_ipv4 *ipv4;
|
||||
+ for (ALL_LIST_ELEMENTS_RO(circuit->ip_addrs, ipnode, ipv4))
|
||||
+ lsp_build_internal_reach_ipv4(lsp, area, ipv4, metric);
|
||||
+ }
|
||||
|
||||
- if (circuit->ipv6_router && circuit->ipv6_non_link->count > 0) {
|
||||
- struct listnode *ipnode;
|
||||
- struct prefix_ipv6 *ipv6;
|
||||
+ if (circuit->ipv6_router && circuit->ipv6_non_link->count > 0) {
|
||||
+ struct listnode *ipnode;
|
||||
+ struct prefix_ipv6 *ipv6;
|
||||
|
||||
- for (ALL_LIST_ELEMENTS_RO(circuit->ipv6_non_link,
|
||||
- ipnode, ipv6))
|
||||
- lsp_build_internal_reach_ipv6(lsp, area, ipv6,
|
||||
- metric);
|
||||
+ for (ALL_LIST_ELEMENTS_RO(circuit->ipv6_non_link, ipnode, ipv6))
|
||||
+ lsp_build_internal_reach_ipv6(lsp, area, ipv6, metric);
|
||||
+ }
|
||||
}
|
||||
|
||||
switch (circuit->circ_type) {
|
||||
diff --git a/tests/topotests/isis_topo1/test_isis_topo1.py b/tests/topotests/isis_topo1/test_isis_topo1.py
|
||||
index 1cec2f16f0..5d65b353cf 100644
|
||||
--- a/tests/topotests/isis_topo1/test_isis_topo1.py
|
||||
+++ b/tests/topotests/isis_topo1/test_isis_topo1.py
|
||||
@@ -148,12 +148,9 @@ def test_isis_route_installation():
|
||||
filename = "{0}/{1}/{1}_route.json".format(CWD, rname)
|
||||
expected = json.loads(open(filename, "r").read())
|
||||
|
||||
- def compare_isis_installed_routes(router, expected):
|
||||
- "Helper function to test ISIS routes installed in rib."
|
||||
- actual = router.vtysh_cmd("show ip route json", isjson=True)
|
||||
- return topotest.json_cmp(actual, expected)
|
||||
-
|
||||
- test_func = functools.partial(compare_isis_installed_routes, router, expected)
|
||||
+ test_func = functools.partial(
|
||||
+ _helper_compare_isis_installed_routes, router, expected
|
||||
+ )
|
||||
(result, _) = topotest.run_and_expect(test_func, None, wait=1, count=10)
|
||||
assertmsg = "Router '{}' routes mismatch".format(rname)
|
||||
assert result, assertmsg
|
||||
@@ -565,6 +562,21 @@ def test_isis_advertise_passive_only():
|
||||
)
|
||||
assert result is True, result
|
||||
|
||||
+ logger.info("Checking router for installed ISIS routes with advertise-passive-only")
|
||||
+
|
||||
+ # routes must be installed
|
||||
+ rname = "r1"
|
||||
+ router = r1
|
||||
+ filename = "{0}/{1}/{1}_route.json".format(CWD, rname)
|
||||
+ expected = json.loads(open(filename, "r").read())
|
||||
+
|
||||
+ test_func = functools.partial(
|
||||
+ _helper_compare_isis_installed_routes, router, expected
|
||||
+ )
|
||||
+ (result, _) = topotest.run_and_expect(test_func, None, wait=1, count=10)
|
||||
+ assertmsg = "Router '{}' routes mismatch:\n{}".format(rname, _)
|
||||
+ assert result, assertmsg
|
||||
+
|
||||
|
||||
def test_isis_hello_padding_during_adjacency_formation():
|
||||
"""Check that IIH packets is only padded when adjacency is still being formed
|
||||
@@ -842,3 +854,9 @@ def parse_topology(lines, level):
|
||||
continue
|
||||
|
||||
return areas
|
||||
+
|
||||
+
|
||||
+def _helper_compare_isis_installed_routes(router, expected):
|
||||
+ "Helper function to test ISIS routes installed in rib."
|
||||
+ actual = router.vtysh_cmd("show ip route json", isjson=True)
|
||||
+ return topotest.json_cmp(actual, expected)
|
||||
--
|
||||
2.50.1
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user