diff options
author | Ondrej Zajicek <santiago@crfreenet.org> | 2011-05-01 17:16:05 +0200 |
---|---|---|
committer | Ondrej Zajicek <santiago@crfreenet.org> | 2011-05-01 18:42:32 +0200 |
commit | a506476acd4baa212f542b257eb5abba733ba4c5 (patch) | |
tree | 95caef919b3ac55cec65add6d09196ddb0e967ed /nest | |
parent | 5964569c23829ec93fcf671a2582be01c8aebecf (diff) |
There may be more IP address records with the same IP.
Diffstat (limited to 'nest')
-rw-r--r-- | nest/iface.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/nest/iface.c b/nest/iface.c index 3cfc626a..2ff2611a 100644 --- a/nest/iface.c +++ b/nest/iface.c @@ -451,6 +451,13 @@ ifa_recalc_all_primary_addresses(void) } } +static inline int +ifa_same(struct ifa *a, struct ifa *b) +{ + return ipa_equal(a->ip, b->ip) && ipa_equal(a->prefix, b->prefix) && + a->pxlen == b->pxlen; +} + /** * ifa_update - update interface address @@ -467,11 +474,9 @@ ifa_update(struct ifa *a) struct ifa *b; WALK_LIST(b, i->addrs) - if (ipa_equal(b->ip, a->ip)) + if (ifa_same(b, a)) { - if (ipa_equal(b->prefix, a->prefix) && - b->pxlen == a->pxlen && - ipa_equal(b->brd, a->brd) && + if (ipa_equal(b->brd, a->brd) && ipa_equal(b->opposite, a->opposite) && b->scope == a->scope && !((b->flags ^ a->flags) & IA_PEER)) @@ -514,7 +519,7 @@ ifa_delete(struct ifa *a) struct ifa *b; WALK_LIST(b, i->addrs) - if (ipa_equal(b->ip, a->ip)) + if (ifa_same(b, a)) { rem_node(&b->n); if (b->flags & IF_UP) |