]> git.puffer.fish Git - matthieu/frr.git/commitdiff
ospfd: flush type 5 when type 7 is removed
authorckishimo <carles.kishimoto@gmail.com>
Mon, 28 Sep 2020 21:26:18 +0000 (14:26 -0700)
committerIgor Ryzhov <iryzhov@nfware.com>
Wed, 28 Oct 2020 18:35:48 +0000 (21:35 +0300)
When the ASBR stops announcing a prefix into the NSSA area, the LSA
type 7 is removed from the area. However the ABR is refreshing the
type 5 in its LSDB while removing the Type 7 LSA. Routers outside
the area do not get an update.

With the following topology: r1---r2---r3, with r3 being the ASBR
announcing type 7 LSA:

r3 configuration
router ospf
 redistribute static
 network 10.0.23.0/24 area 1
 area 1 nssa
!

We stop announcing prefix 3.3.3.3 in the ASBR
r3# conf
r3(config)# router ospf
r3(config-router)# no redistribute static
r3(config-router)#

r2 (ABR)
r2# sh ip os database

                NSSA-external Link States (Area 0.0.0.1 [NSSA])

Link ID         ADV Router      Age  Seq#       CkSum  Route
3.3.3.3         33.33.33.33     3600 0x8000002f 0x13be E2 3.3.3.3/32 [0x0]  <-- flushed

                AS External Link States

Link ID         ADV Router      Age  Seq#       CkSum  Route
3.3.3.3         10.0.25.2          7 0x8000002f 0x73c7 E2 3.3.3.3/32 [0x0]  <-- refreshed(?)

With PR#7086 the LSA type 5 is flushed from the LSDB in r2 and the change is
announced to routers outside the area (r1)

r2# sh ip os da

                NSSA-external Link States (Area 0.0.0.1 [NSSA])

Link ID         ADV Router      Age  Seq#       CkSum  Route
3.3.3.3         33.33.33.33     3600 0x80000002 0x6d91 E2 3.3.3.3/32 [0x0]  <-- flushed

                AS External Link States

Link ID         ADV Router      Age  Seq#       CkSum  Route
3.3.3.3         10.0.25.2       3600 0x80000002 0xcd9a E2 3.3.3.3/32 [0x0]  <-- flushed

r1# sh ip os da

                AS External Link States

Link ID         ADV Router      Age  Seq#       CkSum  Route
3.3.3.3         10.0.25.2       3600 0x80000002 0xcd9a E2 3.3.3.3/32 [0x0]  <-- flushed

Unfortunately I just realized that with PR#7086 I'm introducing a new bug, as Type-5 LSA
are not being refreshed when reaching MaxAge

r2# sh ip os da

                NSSA-external Link States (Area 0.0.0.1 [NSSA])

Link ID         ADV Router      Age  Seq#       CkSum  Route
3.3.3.3         33.33.33.33       35 0x80000002 0x6d91 E2 3.3.3.3/32 [0x0]  <--- refreshed

                AS External Link States

Link ID         ADV Router      Age  Seq#       CkSum  Route
3.3.3.3         10.0.25.2       3600 0x80000002 0xcd9a E2 3.3.3.3/32 [0x0]  <--- not refreshed!

So this PR should fix the original issue and the bug introduced later, so when stopping
redistribution in the ASBR, both type 5 and type 7 are flushed:

r2# sh ip os da

                NSSA-external Link States (Area 0.0.0.1 [NSSA])

Link ID         ADV Router      Age  Seq#       CkSum  Route
3.3.3.3         33.33.33.33     3600 0x80000002 0x6d91 E2 3.3.3.3/32 [0x0]

                AS External Link States

Link ID         ADV Router      Age  Seq#       CkSum  Route
3.3.3.3         10.0.25.2       3600 0x80000002 0xcd9a E2 3.3.3.3/32 [0x0]

Routers outside the area are also notified

r1# sh ip os da

Link ID         ADV Router      Age  Seq#       CkSum  Route
3.3.3.3         10.0.25.2       3600 0x80000002 0xcd9a E2 3.3.3.3/32 [0x0]

Re-enabling redistribution, both LSA will be advertised again

r3# conf
r3(config)# router ospf
r3(config-router)# no redistribute static
r3(config-router)# redistribute static
r3(config-router)#

r2# sh ip os da

                NSSA-external Link States (Area 0.0.0.1 [NSSA])

Link ID         ADV Router      Age  Seq#       CkSum  Route
3.3.3.3         33.33.33.33       19 0x80000001 0x6f90 E2 3.3.3.3/32 [0x0]

                AS External Link States

Link ID         ADV Router      Age  Seq#       CkSum  Route
3.3.3.3         10.0.25.2         11 0x80000001 0xcf99 E2 3.3.3.3/32 [0x0]

and they are refreshed when reaching MaxAge

                NSSA-external Link States (Area 0.0.0.1 [NSSA])

Link ID         ADV Router      Age  Seq#       CkSum  Route
3.3.3.3         33.33.33.33       10 0x80000002 0x6d91 E2 3.3.3.3/32 [0x0] <-- Seq 2

                AS External Link States

Link ID         ADV Router      Age  Seq#       CkSum  Route
3.3.3.3         10.0.25.2          2 0x80000002 0xcd9a E2 3.3.3.3/32 [0x0] <-- Seq 2

Signed-off-by: ckishimo <carles.kishimoto@gmail.com>
ospfd/ospf_abr.c

index 2131c8ee9df3f4eee6b270cd73a5ce624eb4fac1..c59e19bb16909056669b0f00f757f15f01d8ea56 100644 (file)
@@ -638,19 +638,23 @@ static int ospf_abr_translate_nssa(struct ospf_area *area, struct ospf_lsa *lsa)
        }
 
        /* try find existing AS-External LSA for this prefix */
-
        old = ospf_external_info_find_lsa(area->ospf, &p);
 
-       if (old) {
-               /* Do not continue if type 5 LSA not approved */
-               if (!CHECK_FLAG(old->flags, OSPF_LSA_APPROVED)) {
+       if (CHECK_FLAG(lsa->flags, OSPF_LSA_IN_MAXAGE)) {
+               /* if type-7 is removed, remove old translated type-5 lsa */
+               if (old) {
+                       UNSET_FLAG(old->flags, OSPF_LSA_APPROVED);
                        if (IS_DEBUG_OSPF_NSSA)
                                zlog_debug(
-                                       "ospf_abr_translate_nssa(): LSA Id %s type 5 is not approved",
+                                       "ospf_abr_translate_nssa(): remove old translated LSA id %s",
                                        inet_ntoa(old->data->id));
-                       return 1;
                }
+               /* if type-7 is removed and type-5 does not exist, do not
+                * originate */
+               return 1;
+       }
 
+       if (old && CHECK_FLAG(old->flags, OSPF_LSA_APPROVED)) {
                if (IS_DEBUG_OSPF_NSSA)
                        zlog_debug(
                                "ospf_abr_translate_nssa(): found old translated LSA Id %s, refreshing",