]> git.puffer.fish Git - mirror/frr.git/commitdiff
ospf6d: Don't advertise AS-External LSAs into stub area 8185/head
authorlynne <lynne@voltanet.io>
Tue, 2 Mar 2021 21:40:56 +0000 (16:40 -0500)
committerlynne <lynne@voltanet.io>
Wed, 3 Mar 2021 14:20:36 +0000 (09:20 -0500)
If area is a normal area and has adjacencies up and then the user changes
the area to a stub area, the code was leaving existing AS-External LSAs in
the database and was sending AS-External LSAs into the stub area causing
the adjacency to stay in Ex-Start.   With this change we now cleanup the
AS-External LSAs that existed when area was not a stub and do not advertise
AS-External LSAs into the stub area.

Signed-off-by: Lynne Morrison <lynne@voltanet.io>
ospf6d/ospf6_area.c
ospf6d/ospf6_asbr.c
ospf6d/ospf6_asbr.h
ospf6d/ospf6_message.c

index 898567b4f089ccb903e13d352ed8654c27c53ea0..cf33069c9f42c28db0e3f3139ddc69bb24a801df 100644 (file)
@@ -142,11 +142,12 @@ static void ospf6_area_stub_update(struct ospf6_area *area)
 
        if (IS_AREA_STUB(area)) {
                if (IS_OSPF6_DEBUG_ORIGINATE(ROUTER))
-                       zlog_debug("Stubbing out area for if %s", area->name);
+                       zlog_debug("Stubbing out area for area %s", area->name);
                OSPF6_OPT_CLEAR(area->options, OSPF6_OPT_E);
+               ospf6_asbr_remove_externals_from_area(area);
        } else if (IS_AREA_ENABLED(area)) {
                if (IS_OSPF6_DEBUG_ORIGINATE(ROUTER))
-                       zlog_debug("Normal area for if %s", area->name);
+                       zlog_debug("Normal area for area %s", area->name);
                OSPF6_OPT_SET(area->options, OSPF6_OPT_E);
                ospf6_asbr_send_externals_to_area(area);
        }
index d0c93dd5773e94d5042b6dba612be6f988b374dc..beca6b9690838984b551a43ba10e3f2671efc6cc 100644 (file)
@@ -1099,6 +1099,27 @@ void ospf6_asbr_send_externals_to_area(struct ospf6_area *oa)
        }
 }
 
+/* When an area is stubified, remove all the external LSAs in the area */
+void ospf6_asbr_remove_externals_from_area(struct ospf6_area *oa)
+{
+       struct ospf6_lsa *lsa, *lsanext;
+       struct listnode *node, *nnode;
+       struct ospf6_area *area;
+       struct ospf6 *ospf6 = oa->ospf6;
+
+
+       /* skip if router is in other non-stub areas */
+       for (ALL_LIST_ELEMENTS(ospf6->area_list, node, nnode, area))
+               if (!IS_AREA_STUB(area))
+                       return;
+
+       /* if router is only in a stub area then purge AS-External LSAs */
+       for (ALL_LSDB(oa->ospf6->lsdb, lsa, lsanext)) {
+               if (ntohs(lsa->header->type) == OSPF6_LSTYPE_AS_EXTERNAL)
+                       ospf6_lsdb_remove(lsa, ospf6->lsdb);
+       }
+}
+
 void ospf6_asbr_redistribute_add(int type, ifindex_t ifindex,
                                 struct prefix *prefix,
                                 unsigned int nexthop_num,
index fd14610042471991f3c38bbffdd180df62dc84a4..e4a4455a5c4ae326febb693634b0dc1bee4e0aed 100644 (file)
@@ -95,6 +95,7 @@ extern void ospf6_asbr_init(void);
 extern void ospf6_asbr_redistribute_reset(struct ospf6 *ospf6);
 extern void ospf6_asbr_terminate(void);
 extern void ospf6_asbr_send_externals_to_area(struct ospf6_area *);
+extern void ospf6_asbr_remove_externals_from_area(struct ospf6_area *oa);
 
 extern int config_write_ospf6_debug_asbr(struct vty *vty);
 extern void install_element_ospf6_debug_asbr(void);
index bd180a9f55e8e04508b301f020f503268d5d1a75..349dc50b8ce336f4e48b4495c164c9e4fd0598c4 100644 (file)
@@ -1893,6 +1893,13 @@ int ospf6_dbdesc_send_newone(struct thread *thread)
           so that ospf6_send_dbdesc () can send those LSAs */
        size = sizeof(struct ospf6_lsa_header) + sizeof(struct ospf6_dbdesc);
        for (ALL_LSDB(on->summary_list, lsa, lsanext)) {
+               /* if stub area then don't advertise AS-External LSAs */
+               if (IS_AREA_STUB(on->ospf6_if->area)
+                   && ntohs(lsa->header->type) == OSPF6_LSTYPE_AS_EXTERNAL) {
+                       ospf6_lsdb_remove(lsa, on->summary_list);
+                       continue;
+               }
+
                if (size + sizeof(struct ospf6_lsa_header)
                    > ospf6_packet_max(on->ospf6_if)) {
                        ospf6_lsdb_lsa_unlock(lsa);