]> git.proxmox.com Git - mirror_frr.git/blobdiff - pimd/pim_util.c
zebra: Allow ns delete to happen after under/over flow checks
[mirror_frr.git] / pimd / pim_util.c
index c2e4b2a4625ff8f466226e7ce11641d096f764f7..15bde256daf77ee3888507ad6442c7aa44e6c46d 100644 (file)
@@ -21,6 +21,7 @@
 
 #include "log.h"
 #include "prefix.h"
+#include "plist.h"
 
 #include "pim_util.h"
 
@@ -107,13 +108,14 @@ int pim_is_group_224_0_0_0_24(struct in_addr group_addr)
        struct prefix group;
 
        if (first) {
-               str2prefix("224.0.0.0/24", &group_224);
+               if (!str2prefix("224.0.0.0/24", &group_224))
+                       return 0;
                first = 0;
        }
 
        group.family = AF_INET;
        group.u.prefix4 = group_addr;
-       group.prefixlen = 32;
+       group.prefixlen = IPV4_MAX_PREFIXLEN;
 
        return prefix_match(&group_224, &group);
 }
@@ -125,7 +127,8 @@ int pim_is_group_224_4(struct in_addr group_addr)
        struct prefix group;
 
        if (first) {
-               str2prefix("224.0.0.0/4", &group_all);
+               if (!str2prefix("224.0.0.0/4", &group_all))
+                       return 0;
                first = 0;
        }
 
@@ -135,3 +138,19 @@ int pim_is_group_224_4(struct in_addr group_addr)
 
        return prefix_match(&group_all, &group);
 }
+
+bool pim_is_group_filtered(struct pim_interface *pim_ifp, struct in_addr *grp)
+{
+       struct prefix grp_pfx;
+       struct prefix_list *pl;
+
+       if (!pim_ifp->boundary_oil_plist)
+               return false;
+
+       grp_pfx.family = AF_INET;
+       grp_pfx.prefixlen = 32;
+       grp_pfx.u.prefix4 = *grp;
+
+       pl = prefix_list_lookup(AFI_IP, pim_ifp->boundary_oil_plist);
+       return pl ? prefix_list_apply(pl, &grp_pfx) == PREFIX_DENY : false;
+}