From faf58cec4d0c0d3c1fddee6faf2f57a1362477bb Mon Sep 17 00:00:00 2001 From: Ondrej Zajicek Date: Sun, 22 Aug 2010 14:43:53 +0200 Subject: [PATCH] Fixes a bug in NBMA on an iface with multiple IP addresses. --- proto/ospf/iface.c | 3 +++ proto/ospf/ospf.c | 7 +++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/proto/ospf/iface.c b/proto/ospf/iface.c index bef31125..04868baa 100644 --- a/proto/ospf/iface.c +++ b/proto/ospf/iface.c @@ -472,6 +472,9 @@ ospf_iface_new(struct proto_ospf *po, struct iface *iface, struct ifa *addr, WALK_LIST(nb, ip->nbma_list) { + if (!ipa_in_net(nb->ip, addr->prefix, addr->pxlen)) + continue; + nbma = mb_alloc(p->pool, sizeof(struct nbma_node)); nbma->ip = nb->ip; nbma->eligible = nb->eligible; diff --git a/proto/ospf/ospf.c b/proto/ospf/ospf.c index e1ba96a4..a9dc1dee 100644 --- a/proto/ospf/ospf.c +++ b/proto/ospf/ospf.c @@ -855,7 +855,7 @@ ospf_reconfigure(struct proto *p, struct proto_config *c) { found = 0; WALK_LIST(nb2, newip->nbma_list) - if (ipa_compare(nb1->ip, nb2->ip) == 0) + if (ipa_equal(nb1->ip, nb2->ip)) { found = 1; if (nb1->eligible != nb2->eligible) @@ -877,9 +877,12 @@ ospf_reconfigure(struct proto *p, struct proto_config *c) /* And then add new */ WALK_LIST(nb2, newip->nbma_list) { + if (!ipa_in_net(nb2->ip, ifa->addr->prefix, ifa->addr->pxlen)) + continue; + found = 0; WALK_LIST(nb1, ifa->nbma_list) - if (ipa_compare(nb1->ip, nb2->ip) == 0) + if (ipa_equal(nb1->ip, nb2->ip)) { found = 1; break;