mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-06 12:52:49 +00:00
Merge pull request #6987 from Niral-Networks/acl_fix
lib, ospf : Fix when redist is performed with route-map using access-list
This commit is contained in:
commit
371ded520b
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user