summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlynne <lynne@voltanet.io>2021-03-25 16:58:45 +0100
committerlynne <lynne@voltanet.io>2021-05-04 21:28:56 +0200
commitf6c5f2e0c3c46400fa95b401add386beab1e5118 (patch)
treeee58ef223908209c8bb78265ae6f0ade45361c34
parentMerge pull request #8499 from donaldsharp/ospf_what (diff)
downloadfrr-f6c5f2e0c3c46400fa95b401add386beab1e5118.tar.xz
frr-f6c5f2e0c3c46400fa95b401add386beab1e5118.zip
ospf6d: Fix when an "export-list" or "filter-list out" is applied.
When an "export-filter" or "filter-list out" was configured on an area the filter was not applied to existing database. The user would either have to restart the neighboring router in the other area or issue a "clear ipv6 ospf6 interface" to cause the neighbor router to resend it's LSAs. The new filter would then be applied to these LSAs and permit or deny summary LSAs from being added/removed from the database. The code now applies the filters to the existing database without user needing to take any action to clear ospfv3 adjacencies. The second part of the problem was if a rule changed the updated filter was not applied. The code has been modifed to now process the rule update and reapply the filter. Signed-off-by: Lynne Morrison <lynne@voltanet.io>
-rw-r--r--ospf6d/ospf6_abr.c27
-rw-r--r--ospf6d/ospf6_abr.h2
-rw-r--r--ospf6d/ospf6_area.c40
-rw-r--r--ospf6d/ospf6_area.h1
-rw-r--r--ospf6d/ospf6_flood.c6
-rw-r--r--ospf6d/ospf6_intra.c2
-rw-r--r--ospf6d/ospf6d.c4
7 files changed, 71 insertions, 11 deletions
diff --git a/ospf6d/ospf6_abr.c b/ospf6d/ospf6_abr.c
index 27d4f0755..286e64278 100644
--- a/ospf6d/ospf6_abr.c
+++ b/ospf6d/ospf6_abr.c
@@ -389,6 +389,8 @@ int ospf6_abr_originate_summary_to_area(struct ospf6_route *route,
zlog_debug(
"prefix %pFX was denied by export list",
&route->prefix);
+ ospf6_abr_delete_route(route, summary,
+ summary_table, old);
return 0;
}
}
@@ -401,6 +403,9 @@ int ospf6_abr_originate_summary_to_area(struct ospf6_route *route,
zlog_debug(
"prefix %pFX was denied by filter-list out",
&route->prefix);
+ ospf6_abr_delete_route(route, summary, summary_table,
+ old);
+
return 0;
}
@@ -1075,7 +1080,8 @@ void ospf6_abr_examin_summary(struct ospf6_lsa *lsa, struct ospf6_area *oa)
== FILTER_DENY) {
if (is_debug)
zlog_debug(
- "Prefix was denied by import-list");
+ "Prefix %pFX was denied by import-list",
+ &prefix);
if (old)
ospf6_route_remove(old, table);
return;
@@ -1087,7 +1093,9 @@ void ospf6_abr_examin_summary(struct ospf6_lsa *lsa, struct ospf6_area *oa)
if (prefix_list_apply(PREFIX_LIST_IN(oa), &prefix)
!= PREFIX_PERMIT) {
if (is_debug)
- zlog_debug("Prefix was denied by prefix-list");
+ zlog_debug(
+ "Prefix %pFX was denied by prefix-list in",
+ &prefix);
if (old)
ospf6_route_remove(old, table);
return;
@@ -1287,6 +1295,21 @@ void ospf6_abr_reimport(struct ospf6_area *oa)
ospf6_abr_examin_summary(lsa, oa);
}
+/* export filter removed so determine if we should reoriginate summary LSAs */
+void ospf6_abr_reexport(struct ospf6_area *oa)
+{
+ struct ospf6_route *route;
+
+ /* if not a ABR return success */
+ if (!ospf6_is_router_abr(oa->ospf6))
+ return;
+
+ /* Redo summaries if required */
+ for (route = ospf6_route_head(oa->ospf6->route_table); route;
+ route = ospf6_route_next(route))
+ ospf6_abr_originate_summary_to_area(route, oa);
+}
+
void ospf6_abr_prefix_resummarize(struct ospf6 *o)
{
struct ospf6_route *route;
diff --git a/ospf6d/ospf6_abr.h b/ospf6d/ospf6_abr.h
index 25a73f920..6a912ac63 100644
--- a/ospf6d/ospf6_abr.h
+++ b/ospf6d/ospf6_abr.h
@@ -73,6 +73,7 @@ extern void ospf6_abr_examin_brouter(uint32_t router_id,
struct ospf6_route *route,
struct ospf6 *ospf6);
extern void ospf6_abr_reimport(struct ospf6_area *oa);
+extern void ospf6_abr_reexport(struct ospf6_area *oa);
extern void ospf6_abr_range_reset_cost(struct ospf6 *ospf6);
extern void ospf6_abr_prefix_resummarize(struct ospf6 *ospf6);
@@ -86,5 +87,6 @@ extern void ospf6_abr_old_path_update(struct ospf6_route *old_route,
struct ospf6_route *route,
struct ospf6_route_table *table);
extern void ospf6_abr_init(void);
+extern void ospf6_abr_reexport(struct ospf6_area *oa);
#endif /*OSPF6_ABR_H*/
diff --git a/ospf6d/ospf6_area.c b/ospf6d/ospf6_area.c
index 6bf61b480..5100e27b9 100644
--- a/ospf6d/ospf6_area.c
+++ b/ospf6d/ospf6_area.c
@@ -661,7 +661,9 @@ DEFUN (area_filter_list,
XFREE(MTYPE_OSPF6_PLISTNAME, PREFIX_NAME_OUT(area));
PREFIX_NAME_OUT(area) =
XSTRDUP(MTYPE_OSPF6_PLISTNAME, plistname);
- ospf6_abr_enable_area(area);
+
+ /* Redo summaries if required */
+ ospf6_abr_reexport(area);
}
return CMD_SUCCESS;
@@ -703,12 +705,32 @@ DEFUN (no_area_filter_list,
return CMD_SUCCESS;
XFREE(MTYPE_OSPF6_PLISTNAME, PREFIX_NAME_OUT(area));
- ospf6_abr_enable_area(area);
+ PREFIX_LIST_OUT(area) = NULL;
+ ospf6_abr_reexport(area);
}
return CMD_SUCCESS;
}
+void ospf6_filter_update(struct access_list *access)
+{
+ struct ospf6_area *oa;
+ struct listnode *n, *node, *nnode;
+ struct ospf6 *ospf6;
+
+ for (ALL_LIST_ELEMENTS(om6->ospf6, node, nnode, ospf6)) {
+ for (ALL_LIST_ELEMENTS_RO(ospf6->area_list, n, oa)) {
+ if (IMPORT_NAME(oa)
+ && strcmp(IMPORT_NAME(oa), access->name) == 0)
+ ospf6_abr_reimport(oa);
+
+ if (EXPORT_NAME(oa)
+ && strcmp(EXPORT_NAME(oa), access->name) == 0)
+ ospf6_abr_reexport(oa);
+ }
+ }
+}
+
void ospf6_area_plist_update(struct prefix_list *plist, int add)
{
struct listnode *node, *nnode;
@@ -724,11 +746,15 @@ void ospf6_area_plist_update(struct prefix_list *plist, int add)
for (ALL_LIST_ELEMENTS(om6->ospf6, node, nnode, ospf6)) {
for (ALL_LIST_ELEMENTS_RO(ospf6->area_list, n, oa)) {
if (PREFIX_NAME_IN(oa)
- && !strcmp(PREFIX_NAME_IN(oa), name))
+ && !strcmp(PREFIX_NAME_IN(oa), name)) {
PREFIX_LIST_IN(oa) = add ? plist : NULL;
+ ospf6_abr_reexport(oa);
+ }
if (PREFIX_NAME_OUT(oa)
- && !strcmp(PREFIX_NAME_OUT(oa), name))
+ && !strcmp(PREFIX_NAME_OUT(oa), name)) {
PREFIX_LIST_OUT(oa) = add ? plist : NULL;
+ ospf6_abr_reexport(oa);
+ }
}
}
}
@@ -818,7 +844,9 @@ DEFUN (area_export_list,
free(EXPORT_NAME(area));
EXPORT_NAME(area) = strdup(argv[idx_name]->arg);
- ospf6_abr_enable_area(area);
+
+ /* Redo summaries if required */
+ ospf6_abr_reexport(area);
return CMD_SUCCESS;
}
@@ -846,7 +874,7 @@ DEFUN (no_area_export_list,
free(EXPORT_NAME(area));
EXPORT_NAME(area) = NULL;
- ospf6_abr_enable_area(area);
+ ospf6_abr_reexport(area);
return CMD_SUCCESS;
}
diff --git a/ospf6d/ospf6_area.h b/ospf6d/ospf6_area.h
index 8a58b2a50..761fe75f7 100644
--- a/ospf6d/ospf6_area.h
+++ b/ospf6d/ospf6_area.h
@@ -148,6 +148,7 @@ extern void ospf6_area_show(struct vty *, struct ospf6_area *,
json_object *json_areas, bool use_json);
extern void ospf6_area_plist_update(struct prefix_list *plist, int add);
+extern void ospf6_filter_update(struct access_list *access);
extern void ospf6_area_config_write(struct vty *vty, struct ospf6 *ospf6);
extern void ospf6_area_init(void);
struct ospf6_interface;
diff --git a/ospf6d/ospf6_flood.c b/ospf6d/ospf6_flood.c
index 5f4815fec..0fa6f8c77 100644
--- a/ospf6d/ospf6_flood.c
+++ b/ospf6d/ospf6_flood.c
@@ -381,7 +381,8 @@ void ospf6_flood_interface(struct ospf6_neighbor *from, struct ospf6_lsa *lsa,
} else {
/* (d) add retrans-list, schedule retransmission */
if (is_debug)
- zlog_debug("Add retrans-list of this neighbor");
+ zlog_debug("Add retrans-list of neighbor %s ",
+ on->name);
ospf6_increment_retrans_count(lsa);
ospf6_lsdb_add(ospf6_lsa_copy(lsa), on->retrans_list);
thread_add_timer(master, ospf6_lsupdate_send_neighbor,
@@ -395,7 +396,8 @@ void ospf6_flood_interface(struct ospf6_neighbor *from, struct ospf6_lsa *lsa,
if (retrans_added == 0) {
if (is_debug)
zlog_debug(
- "No retransmission scheduled, next interface");
+ "No retransmission scheduled, next interface %s",
+ oi->interface->name);
return;
}
diff --git a/ospf6d/ospf6_intra.c b/ospf6d/ospf6_intra.c
index adff76ec4..61a438b04 100644
--- a/ospf6d/ospf6_intra.c
+++ b/ospf6d/ospf6_intra.c
@@ -1672,7 +1672,7 @@ void ospf6_intra_prefix_route_ecmp_path(struct ospf6_area *oa,
if (IS_OSPF6_DEBUG_EXAMIN(INTRA_PREFIX))
zlog_debug(
- "%s: route %pFX %p with final effective paths %u nh%u",
+ "%s: route %pFX %p with final effective paths %u nh %u",
__func__, &route->prefix,
(void *)old_route,
old_route->paths
diff --git a/ospf6d/ospf6d.c b/ospf6d/ospf6d.c
index 91d427c78..ab8adce2e 100644
--- a/ospf6d/ospf6d.c
+++ b/ospf6d/ospf6d.c
@@ -25,6 +25,7 @@
#include "vty.h"
#include "command.h"
#include "plist.h"
+#include "filter.h"
#include "ospf6_proto.h"
#include "ospf6_top.h"
@@ -1123,8 +1124,11 @@ void ospf6_init(struct thread_master *master)
ospf6_asbr_init();
ospf6_abr_init();
+ /* initialize hooks for modifying filter rules */
prefix_list_add_hook(ospf6_plist_add);
prefix_list_delete_hook(ospf6_plist_del);
+ access_list_add_hook(ospf6_filter_update);
+ access_list_delete_hook(ospf6_filter_update);
ospf6_bfd_init();
install_node(&debug_node);