From 4f3749854a887aa51d4cb0c59356d4c39553e3d0 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 da6406d334..8f04261086 100644 --- a/lib/plist.c +++ b/lib/plist.c @@ -659,6 +659,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; @@ -1226,9 +1229,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, @@ -1305,7 +1310,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.5