From d4fcd8bd82b232a467f5063268683a5dd7d52cd2 Mon Sep 17 00:00:00 2001 From: Renato Westphal Date: Fri, 16 Oct 2020 20:57:37 -0300 Subject: [PATCH] isisd: create routes for local destinations This is preparatory change for the upcoming SR Prefix-SID refactoring. Since Prefix-SID information will be stored inside IS-IS routes (instead of being maintained separately), it will be necessary to have local routes in order to store local Prefix-SID information. Signed-off-by: Renato Westphal --- isisd/isis_lfa.c | 4 ++++ isisd/isis_spf.c | 2 +- tests/topotests/isis-topo1-vrf/r1/r1_route.json | 14 -------------- tests/topotests/isis-topo1-vrf/r2/r2_route.json | 14 -------------- tests/topotests/isis-topo1-vrf/r3/r3_route.json | 14 -------------- tests/topotests/isis-topo1-vrf/r4/r4_route.json | 12 ------------ tests/topotests/isis-topo1/r1/r1_route.json | 13 ------------- tests/topotests/isis-topo1/r2/r2_route.json | 13 ------------- tests/topotests/isis-topo1/r3/r3_route.json | 13 ------------- tests/topotests/isis-topo1/r4/r4_route.json | 13 ------------- 10 files changed, 5 insertions(+), 107 deletions(-) diff --git a/isisd/isis_lfa.c b/isisd/isis_lfa.c index 8ca432f895..f3d4091f3e 100644 --- a/isisd/isis_lfa.c +++ b/isisd/isis_lfa.c @@ -614,6 +614,10 @@ static bool lfa_check_needs_protection(const struct isis_spftree *spftree_pc, size_t affected_nhs = 0; struct isis_vertex_adj *vadj; + /* Local routes don't need protection. */ + if (VTYPE_IP(vertex->type) && vertex->depth == 1) + return false; + /* Only local adjacencies need Adj-SID protection. */ if (VTYPE_IS(vertex->type) && !isis_adj_find(spftree_pc->area, spftree_pc->level, diff --git a/isisd/isis_spf.c b/isisd/isis_spf.c index 138095fa0c..dacf4e14ec 100644 --- a/isisd/isis_spf.c +++ b/isisd/isis_spf.c @@ -1280,7 +1280,7 @@ static void spf_path_process(struct isis_spftree *spftree, if (VTYPE_IP(vertex->type) && !CHECK_FLAG(spftree->flags, F_SPFTREE_NO_ROUTES)) { - if (listcount(vertex->Adj_N) > 0) { + if (vertex->depth == 1 || listcount(vertex->Adj_N) > 0) { struct route_table *route_table; if (spftree->type == SPF_TYPE_TI_LFA) { diff --git a/tests/topotests/isis-topo1-vrf/r1/r1_route.json b/tests/topotests/isis-topo1-vrf/r1/r1_route.json index 77d2ad9c63..f0a3593a4c 100644 --- a/tests/topotests/isis-topo1-vrf/r1/r1_route.json +++ b/tests/topotests/isis-topo1-vrf/r1/r1_route.json @@ -19,20 +19,6 @@ } ], "10.0.20.0/24": [ - { - "distance": 115, - "metric": 20, - "nexthops": [ - { - "afi": "ipv4", - "interfaceName": "r1-eth0", - "ip": "10.0.20.1" - } - ], - "prefix": "10.0.20.0/24", - "protocol": "isis", - "vrfName": "r1-cust1" - }, { "nexthops": [ { diff --git a/tests/topotests/isis-topo1-vrf/r2/r2_route.json b/tests/topotests/isis-topo1-vrf/r2/r2_route.json index 98252c5939..a26cdfad8e 100644 --- a/tests/topotests/isis-topo1-vrf/r2/r2_route.json +++ b/tests/topotests/isis-topo1-vrf/r2/r2_route.json @@ -19,20 +19,6 @@ } ], "10.0.21.0/24": [ - { - "distance": 115, - "metric": 20, - "nexthops": [ - { - "afi": "ipv4", - "interfaceName": "r2-eth0", - "ip": "10.0.21.1" - } - ], - "prefix": "10.0.21.0/24", - "protocol": "isis", - "vrfName": "r2-cust1" - }, { "nexthops": [ { diff --git a/tests/topotests/isis-topo1-vrf/r3/r3_route.json b/tests/topotests/isis-topo1-vrf/r3/r3_route.json index de158876f1..9717df5c1a 100644 --- a/tests/topotests/isis-topo1-vrf/r3/r3_route.json +++ b/tests/topotests/isis-topo1-vrf/r3/r3_route.json @@ -49,20 +49,6 @@ } ], "10.0.20.0/24": [ - { - "distance": 115, - "metric": 20, - "nexthops": [ - { - "afi": "ipv4", - "interfaceName": "r3-eth0", - "ip": "10.0.20.2" - } - ], - "prefix": "10.0.20.0/24", - "protocol": "isis", - "vrfName": "r3-cust1" - }, { "nexthops": [ { diff --git a/tests/topotests/isis-topo1-vrf/r4/r4_route.json b/tests/topotests/isis-topo1-vrf/r4/r4_route.json index b3ed4f2cbe..6cb79b0301 100644 --- a/tests/topotests/isis-topo1-vrf/r4/r4_route.json +++ b/tests/topotests/isis-topo1-vrf/r4/r4_route.json @@ -63,18 +63,6 @@ } ], "10.0.21.0/24": [ - { - "nexthops": [ - { - "afi": "ipv4", - "interfaceName": "r4-eth0", - "ip": "10.0.21.2" - } - ], - "prefix": "10.0.21.0/24", - "protocol": "isis", - "vrfName": "r4-cust1" - }, { "nexthops": [ { diff --git a/tests/topotests/isis-topo1/r1/r1_route.json b/tests/topotests/isis-topo1/r1/r1_route.json index 123b4dd163..f94233a80f 100644 --- a/tests/topotests/isis-topo1/r1/r1_route.json +++ b/tests/topotests/isis-topo1/r1/r1_route.json @@ -18,19 +18,6 @@ } ], "10.0.20.0/24": [ - { - "distance": 115, - "metric": 10, - "nexthops": [ - { - "afi": "ipv4", - "interfaceName": "r1-eth0", - "ip": "10.0.20.1" - } - ], - "prefix": "10.0.20.0/24", - "protocol": "isis" - }, { "nexthops": [ { diff --git a/tests/topotests/isis-topo1/r2/r2_route.json b/tests/topotests/isis-topo1/r2/r2_route.json index fe2de05734..aab651eff0 100644 --- a/tests/topotests/isis-topo1/r2/r2_route.json +++ b/tests/topotests/isis-topo1/r2/r2_route.json @@ -18,19 +18,6 @@ } ], "10.0.21.0/24": [ - { - "distance": 115, - "metric": 10, - "nexthops": [ - { - "afi": "ipv4", - "interfaceName": "r2-eth0", - "ip": "10.0.21.1" - } - ], - "prefix": "10.0.21.0/24", - "protocol": "isis" - }, { "nexthops": [ { diff --git a/tests/topotests/isis-topo1/r3/r3_route.json b/tests/topotests/isis-topo1/r3/r3_route.json index 1f0fcdfcd6..61d05e80bb 100644 --- a/tests/topotests/isis-topo1/r3/r3_route.json +++ b/tests/topotests/isis-topo1/r3/r3_route.json @@ -46,19 +46,6 @@ } ], "10.0.20.0/24": [ - { - "distance": 115, - "metric": 10, - "nexthops": [ - { - "afi": "ipv4", - "interfaceName": "r3-eth0", - "ip": "10.0.20.2" - } - ], - "prefix": "10.0.20.0/24", - "protocol": "isis" - }, { "nexthops": [ { diff --git a/tests/topotests/isis-topo1/r4/r4_route.json b/tests/topotests/isis-topo1/r4/r4_route.json index 597e953c09..79361af4b5 100644 --- a/tests/topotests/isis-topo1/r4/r4_route.json +++ b/tests/topotests/isis-topo1/r4/r4_route.json @@ -15,19 +15,6 @@ } ], "10.0.21.0/24": [ - { - "distance": 115, - "metric": 10, - "nexthops": [ - { - "afi": "ipv4", - "interfaceName": "r4-eth0", - "ip": "10.0.21.2" - } - ], - "prefix": "10.0.21.0/24", - "protocol": "isis" - }, { "nexthops": [ { -- 2.39.5