summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSantosh P K <50885001+Spantik@users.noreply.github.com>2020-09-03 09:51:21 +0530
committerGitHub <noreply@github.com>2020-09-03 09:51:21 +0530
commit371ded520bb3c0085ce6a17443fd2d0bbdda2c4a (patch)
treec6348dcdde1737f8f38d27e1c41205fef24701ca
parent842b9211ac685148212db3ec9432c2db9cb2c7c9 (diff)
parente641623d90130ff5bed36cd581e625cc7d6845ea (diff)
Merge pull request #6987 from Niral-Networks/acl_fix
lib, ospf : Fix when redist is performed with route-map using access-list
-rw-r--r--lib/filter_nb.c55
-rw-r--r--ospfd/ospf_zebra.c17
2 files changed, 67 insertions, 5 deletions
diff --git a/lib/filter_nb.c b/lib/filter_nb.c
index 6eacc0f5c5..8838a48abd 100644
--- a/lib/filter_nb.c
+++ b/lib/filter_nb.c
@@ -29,6 +29,7 @@
#include "lib/filter.h"
#include "lib/plist.h"
#include "lib/plist_int.h"
+#include "lib/routemap.h"
/* Helper function. */
static in_addr_t
@@ -40,6 +41,22 @@ ipv4_network_addr(in_addr_t hostaddr, int masklen)
return hostaddr & mask.s_addr;
}
+static void acl_notify_route_map(struct access_list *acl, int route_map_event)
+{
+ switch (route_map_event) {
+ case RMAP_EVENT_FILTER_ADDED:
+ if (acl->master->add_hook)
+ (*acl->master->add_hook)(acl);
+ break;
+ case RMAP_EVENT_FILTER_DELETED:
+ if (acl->master->delete_hook)
+ (*acl->master->delete_hook)(acl);
+ break;
+ }
+
+ route_map_notify_dependencies(acl->name, route_map_event);
+}
+
static enum nb_error prefix_list_length_validate(struct nb_cb_modify_args *args)
{
int type = yang_dnode_get_enum(args->dnode, "../../type");
@@ -268,6 +285,8 @@ lib_access_list_entry_action_modify(struct nb_cb_modify_args *args)
else
f->type = FILTER_DENY;
+ acl_notify_route_map(f->acl, RMAP_EVENT_FILTER_ADDED);
+
return NB_OK;
}
@@ -288,6 +307,8 @@ lib_access_list_entry_ipv4_prefix_modify(struct nb_cb_modify_args *args)
fz = &f->u.zfilter;
yang_dnode_get_prefix(&fz->prefix, args->dnode, NULL);
+ acl_notify_route_map(f->acl, RMAP_EVENT_FILTER_ADDED);
+
return NB_OK;
}
@@ -304,6 +325,8 @@ lib_access_list_entry_ipv4_prefix_destroy(struct nb_cb_destroy_args *args)
fz = &f->u.zfilter;
memset(&fz->prefix, 0, sizeof(fz->prefix));
+ acl_notify_route_map(f->acl, RMAP_EVENT_FILTER_DELETED);
+
return NB_OK;
}
@@ -323,6 +346,8 @@ lib_access_list_entry_ipv4_exact_match_modify(struct nb_cb_modify_args *args)
fz = &f->u.zfilter;
fz->exact = yang_dnode_get_bool(args->dnode, NULL);
+ acl_notify_route_map(f->acl, RMAP_EVENT_FILTER_ADDED);
+
return NB_OK;
}
@@ -339,6 +364,8 @@ lib_access_list_entry_ipv4_exact_match_destroy(struct nb_cb_destroy_args *args)
fz = &f->u.zfilter;
fz->exact = 0;
+ acl_notify_route_map(f->acl, RMAP_EVENT_FILTER_DELETED);
+
return NB_OK;
}
@@ -360,6 +387,8 @@ lib_access_list_entry_host_modify(struct nb_cb_modify_args *args)
yang_dnode_get_ipv4(&fc->addr, args->dnode, NULL);
fc->addr_mask.s_addr = CISCO_BIN_HOST_WILDCARD_MASK;
+ acl_notify_route_map(f->acl, RMAP_EVENT_FILTER_ADDED);
+
return NB_OK;
}
@@ -376,6 +405,8 @@ lib_access_list_entry_host_destroy(struct nb_cb_destroy_args *args)
fc = &f->u.cfilter;
cisco_unset_addr_mask(&fc->addr, &fc->addr_mask);
+ acl_notify_route_map(f->acl, RMAP_EVENT_FILTER_DELETED);
+
return NB_OK;
}
@@ -400,6 +431,8 @@ lib_access_list_entry_network_modify(struct nb_cb_modify_args *args)
masklen2ip(p.prefixlen, &fc->addr_mask);
fc->addr_mask.s_addr = ~fc->addr_mask.s_addr;
+ acl_notify_route_map(f->acl, RMAP_EVENT_FILTER_ADDED);
+
return NB_OK;
}
@@ -416,6 +449,8 @@ lib_access_list_entry_network_destroy(struct nb_cb_destroy_args *args)
fc = &f->u.cfilter;
cisco_unset_addr_mask(&fc->addr, &fc->addr_mask);
+ acl_notify_route_map(f->acl, RMAP_EVENT_FILTER_DELETED);
+
return NB_OK;
}
@@ -437,6 +472,8 @@ lib_access_list_entry_source_any_create(struct nb_cb_create_args *args)
fc->addr.s_addr = INADDR_ANY;
fc->addr_mask.s_addr = CISCO_BIN_ANY_WILDCARD_MASK;
+ acl_notify_route_map(f->acl, RMAP_EVENT_FILTER_ADDED);
+
return NB_OK;
}
@@ -453,6 +490,8 @@ lib_access_list_entry_source_any_destroy(struct nb_cb_destroy_args *args)
fc = &f->u.cfilter;
cisco_unset_addr_mask(&fc->addr, &fc->addr_mask);
+ acl_notify_route_map(f->acl, RMAP_EVENT_FILTER_DELETED);
+
return NB_OK;
}
@@ -474,6 +513,8 @@ static int lib_access_list_entry_destination_host_modify(
yang_dnode_get_ipv4(&fc->mask, args->dnode, NULL);
fc->mask_mask.s_addr = CISCO_BIN_HOST_WILDCARD_MASK;
+ acl_notify_route_map(f->acl, RMAP_EVENT_FILTER_ADDED);
+
return NB_OK;
}
@@ -491,6 +532,8 @@ static int lib_access_list_entry_destination_host_destroy(
fc->extended = 0;
cisco_unset_addr_mask(&fc->mask, &fc->mask_mask);
+ acl_notify_route_map(f->acl, RMAP_EVENT_FILTER_DELETED);
+
return NB_OK;
}
@@ -515,6 +558,8 @@ static int lib_access_list_entry_destination_network_modify(
masklen2ip(p.prefixlen, &fc->mask_mask);
fc->mask_mask.s_addr = ~fc->mask_mask.s_addr;
+ acl_notify_route_map(f->acl, RMAP_EVENT_FILTER_ADDED);
+
return NB_OK;
}
@@ -532,6 +577,8 @@ static int lib_access_list_entry_destination_network_destroy(
fc->extended = 0;
cisco_unset_addr_mask(&fc->mask, &fc->mask_mask);
+ acl_notify_route_map(f->acl, RMAP_EVENT_FILTER_DELETED);
+
return NB_OK;
}
@@ -553,6 +600,8 @@ static int lib_access_list_entry_destination_any_create(
fc->mask.s_addr = INADDR_ANY;
fc->mask_mask.s_addr = CISCO_BIN_ANY_WILDCARD_MASK;
+ acl_notify_route_map(f->acl, RMAP_EVENT_FILTER_ADDED);
+
return NB_OK;
}
@@ -570,6 +619,8 @@ static int lib_access_list_entry_destination_any_destroy(
fc->extended = 0;
cisco_unset_addr_mask(&fc->mask, &fc->mask_mask);
+ acl_notify_route_map(f->acl, RMAP_EVENT_FILTER_DELETED);
+
return NB_OK;
}
@@ -603,6 +654,8 @@ static int lib_access_list_entry_any_create(struct nb_cb_create_args *args)
break;
}
+ acl_notify_route_map(f->acl, RMAP_EVENT_FILTER_ADDED);
+
return NB_OK;
}
@@ -618,6 +671,8 @@ static int lib_access_list_entry_any_destroy(struct nb_cb_destroy_args *args)
fz = &f->u.zfilter;
fz->prefix.family = 0;
+ acl_notify_route_map(f->acl, RMAP_EVENT_FILTER_DELETED);
+
return NB_OK;
}
diff --git a/ospfd/ospf_zebra.c b/ospfd/ospf_zebra.c
index eb125394b8..8cf8430247 100644
--- a/ospfd/ospf_zebra.c
+++ b/ospfd/ospf_zebra.c
@@ -1353,11 +1353,18 @@ static int ospf_distribute_list_update_timer(struct thread *thread)
default_refresh = 1;
else if (
(lsa = ospf_external_info_find_lsa(
- ospf, &ei->p)))
- ospf_external_lsa_refresh(
- ospf, lsa, ei,
- LSA_REFRESH_IF_CHANGED);
- else
+ ospf, &ei->p))) {
+ if (!CHECK_FLAG(
+ lsa->flags,
+ OSPF_LSA_IN_MAXAGE))
+ ospf_external_lsa_refresh(
+ ospf, lsa, ei,
+ LSA_REFRESH_IF_CHANGED);
+ else
+ ospf_external_lsa_refresh(
+ ospf, lsa, ei,
+ LSA_REFRESH_FORCE);
+ } else
ospf_external_lsa_originate(
ospf, ei);
}