]> git.puffer.fish Git - mirror/frr.git/commitdiff
lib: Only apply prefix's to the same family
authorDonald Sharp <sharpd@cumulusnetworks.com>
Tue, 7 Nov 2017 15:54:03 +0000 (10:54 -0500)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Fri, 10 Nov 2017 23:27:38 +0000 (18:27 -0500)
When we have a v4 or v6 prefix list, only
apply it via a match when the address families
are the same.

Fixes: #1339
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
lib/plist.c

index 56684e82512c7426f7c38ca82faf3ce26fbb9c2d..6c51cfe6964deee57d2730437012b4e04f5bf56e 100644 (file)
@@ -651,6 +651,9 @@ static int prefix_list_entry_match(struct prefix_list_entry *pentry,
 {
        int ret;
 
+       if (pentry->prefix.family != p->family)
+               return 0;
+
        ret = prefix_match(&pentry->prefix, p);
        if (!ret)
                return 0;
@@ -1213,9 +1216,11 @@ static int vty_show_prefix_list_prefix(struct vty *vty, afi_t afi,
                        if (prefix_same(&p, &pentry->prefix))
                                match = 1;
 
-               if (type == longer_display)
-                       if (prefix_match(&p, &pentry->prefix))
+               if (type == longer_display) {
+                       if ((p.family == pentry->prefix.family) &&
+                           (prefix_match(&p, &pentry->prefix)))
                                match = 1;
+               }
 
                if (match) {
                        vty_out(vty, "   seq %u %s ", pentry->seq,
@@ -1294,7 +1299,8 @@ static int vty_clear_prefix_list(struct vty *vty, afi_t afi, const char *name,
 
                for (pentry = plist->head; pentry; pentry = pentry->next) {
                        if (prefix) {
-                               if (prefix_match(&pentry->prefix, &p))
+                               if (pentry->prefix.family == p.family &&
+                                   prefix_match(&pentry->prefix, &p))
                                        pentry->hitcnt = 0;
                        } else
                                pentry->hitcnt = 0;