From b9d45c5c673ead0b3ccf41c16f75b4df90dd140f Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Tue, 7 Nov 2017 10:54:03 -0500 Subject: [PATCH] lib: Only apply prefix's to the same family 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 --- lib/plist.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/lib/plist.c b/lib/plist.c index 56684e825..6c51cfe69 100644 --- a/lib/plist.c +++ b/lib/plist.c @@ -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; -- 2.39.2