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);
}
}
}
+/* 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,
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);
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);