mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-15 11:30:30 +00:00
pimd: Convert boundary_oil_plist to struct prefix_list
Rather than storing the prefix-list name and looking it up every time we use it, store a pointer to the prefix-list itself. Signed-off-by: Corey Siltala <csiltala@atcorp.com>
This commit is contained in:
parent
ff5309ca2d
commit
8465ba1dde
@ -216,7 +216,6 @@ void pim_if_delete(struct interface *ifp)
|
||||
if (pim_ifp->bfd_config.profile)
|
||||
XFREE(MTYPE_TMP, pim_ifp->bfd_config.profile);
|
||||
|
||||
XFREE(MTYPE_PIM_INTERFACE, pim_ifp->boundary_oil_plist);
|
||||
XFREE(MTYPE_PIM_INTERFACE, pim_ifp);
|
||||
|
||||
ifp->info = NULL;
|
||||
|
@ -134,7 +134,7 @@ struct pim_interface {
|
||||
int pim_dr_num_nondrpri_neighbors; /* neighbors without dr_pri */
|
||||
|
||||
/* boundary prefix-list (group) */
|
||||
char *boundary_oil_plist;
|
||||
struct prefix_list *boundary_oil_plist;
|
||||
/* boundary access-list (source and group) */
|
||||
struct access_list *boundary_acl;
|
||||
|
||||
|
@ -9,6 +9,8 @@
|
||||
#include "memory.h"
|
||||
#include "if.h"
|
||||
#include "lib_errors.h"
|
||||
#include "plist.h"
|
||||
#include "plist_int.h"
|
||||
|
||||
#include "pimd.h"
|
||||
#include "pim_instance.h"
|
||||
@ -1815,9 +1817,10 @@ static bool igmp_pkt_grp_addr_ok(struct interface *ifp, const char *from_str,
|
||||
if (PIM_DEBUG_GM_PACKETS) {
|
||||
zlog_debug("Filtering IGMPv3 group record %pI4 from %s on %s per prefix-list %s or access-list %s",
|
||||
&grp.s_addr, from_str, ifp->name,
|
||||
(pim_ifp->boundary_oil_plist ? pim_ifp->boundary_oil_plist
|
||||
(pim_ifp->boundary_oil_plist ? pim_ifp->boundary_oil_plist->name
|
||||
: "(not found)"),
|
||||
(pim_ifp->boundary_acl ? pim_ifp->boundary_acl->name : "(not found)"));
|
||||
(pim_ifp->boundary_acl ? pim_ifp->boundary_acl->name
|
||||
: "(not found)"));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -2390,7 +2390,6 @@ int lib_interface_pim_address_family_multicast_boundary_oil_modify(
|
||||
{
|
||||
struct interface *ifp;
|
||||
struct pim_interface *pim_ifp;
|
||||
const char *plist;
|
||||
const struct lyd_node *if_dnode;
|
||||
|
||||
switch (args->event) {
|
||||
@ -2398,7 +2397,12 @@ int lib_interface_pim_address_family_multicast_boundary_oil_modify(
|
||||
if_dnode = yang_dnode_get_parent(args->dnode, "interface");
|
||||
if (!is_pim_interface(if_dnode)) {
|
||||
snprintf(args->errmsg, args->errmsg_len,
|
||||
"Pim not enabled on this interface");
|
||||
"%% Enable PIM and/or IGMP on this interface first");
|
||||
return NB_ERR_VALIDATION;
|
||||
}
|
||||
if (!prefix_list_lookup(AFI_IP, yang_dnode_get_string(args->dnode, NULL))) {
|
||||
snprintf(args->errmsg, args->errmsg_len,
|
||||
"%% Specified prefix-list not found");
|
||||
return NB_ERR_VALIDATION;
|
||||
}
|
||||
break;
|
||||
@ -2408,13 +2412,8 @@ int lib_interface_pim_address_family_multicast_boundary_oil_modify(
|
||||
case NB_EV_APPLY:
|
||||
ifp = nb_running_get_entry(args->dnode, NULL, true);
|
||||
pim_ifp = ifp->info;
|
||||
plist = yang_dnode_get_string(args->dnode, NULL);
|
||||
|
||||
if (pim_ifp->boundary_oil_plist)
|
||||
XFREE(MTYPE_PIM_INTERFACE, pim_ifp->boundary_oil_plist);
|
||||
|
||||
pim_ifp->boundary_oil_plist =
|
||||
XSTRDUP(MTYPE_PIM_INTERFACE, plist);
|
||||
prefix_list_lookup(AFI_IP, yang_dnode_get_string(args->dnode, NULL));
|
||||
|
||||
break;
|
||||
}
|
||||
@ -2444,8 +2443,7 @@ int lib_interface_pim_address_family_multicast_boundary_oil_destroy(
|
||||
case NB_EV_APPLY:
|
||||
ifp = nb_running_get_entry(args->dnode, NULL, true);
|
||||
pim_ifp = ifp->info;
|
||||
if (pim_ifp->boundary_oil_plist)
|
||||
XFREE(MTYPE_PIM_INTERFACE, pim_ifp->boundary_oil_plist);
|
||||
pim_ifp->boundary_oil_plist = NULL;
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -9,6 +9,7 @@
|
||||
#include "log.h"
|
||||
#include "prefix.h"
|
||||
#include "plist.h"
|
||||
#include "plist_int.h"
|
||||
|
||||
#include "pimd.h"
|
||||
#include "pim_instance.h"
|
||||
@ -174,7 +175,6 @@ bool pim_is_group_filtered(struct pim_interface *pim_ifp, pim_addr *grp, pim_add
|
||||
bool is_filtered = false;
|
||||
#if PIM_IPV == 4
|
||||
struct prefix grp_pfx = {};
|
||||
struct prefix_list *pl = NULL;
|
||||
pim_addr any_src = PIMADDR_ANY;
|
||||
|
||||
if (!pim_ifp->boundary_oil_plist && !pim_ifp->boundary_acl)
|
||||
@ -182,14 +182,13 @@ bool pim_is_group_filtered(struct pim_interface *pim_ifp, pim_addr *grp, pim_add
|
||||
|
||||
pim_addr_to_prefix(&grp_pfx, *grp);
|
||||
|
||||
pl = prefix_list_lookup(PIM_AFI, pim_ifp->boundary_oil_plist);
|
||||
|
||||
/* Filter if either group or (S,G) are denied */
|
||||
if (pl) {
|
||||
is_filtered = prefix_list_apply_ext(pl, NULL, &grp_pfx, true) == PREFIX_DENY;
|
||||
if (pim_ifp->boundary_oil_plist) {
|
||||
is_filtered = prefix_list_apply_ext(pim_ifp->boundary_oil_plist, NULL, &grp_pfx,
|
||||
true) == PREFIX_DENY;
|
||||
if (is_filtered && PIM_DEBUG_EVENTS) {
|
||||
zlog_debug("Filtering group %pI4 per prefix-list %s", grp,
|
||||
pim_ifp->boundary_oil_plist);
|
||||
pim_ifp->boundary_oil_plist->name);
|
||||
}
|
||||
}
|
||||
if (!is_filtered && pim_ifp->boundary_acl) {
|
||||
|
@ -12,6 +12,7 @@
|
||||
#include "vty.h"
|
||||
#include "vrf.h"
|
||||
#include "plist.h"
|
||||
#include "plist_int.h"
|
||||
#include "filter.h"
|
||||
|
||||
#include "pimd.h"
|
||||
@ -493,7 +494,7 @@ int pim_config_write(struct vty *vty, int writes, struct interface *ifp,
|
||||
/* boundary */
|
||||
if (pim_ifp->boundary_oil_plist) {
|
||||
vty_out(vty, " " PIM_AF_NAME " multicast boundary oil %s\n",
|
||||
pim_ifp->boundary_oil_plist);
|
||||
pim_ifp->boundary_oil_plist->name);
|
||||
++writes;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user