diff options
author | Ondrej Zajicek (work) <santiago@crfreenet.org> | 2015-12-21 17:17:21 +0100 |
---|---|---|
committer | Ondrej Zajicek (work) <santiago@crfreenet.org> | 2015-12-21 17:17:21 +0100 |
commit | 0bf95f99e6126b481a4dcac574ada59f9ad3662b (patch) | |
tree | 8b8d229fbd4dbd21a9aa14d762ed0b11753437a8 /sysdep/unix/krt.c | |
parent | 23c212e7f1e80a3c6b88b49918972bc28375bd51 (diff) |
Follow-up work on integration
Contains some patches from Jan Moskyto Matejka
Diffstat (limited to 'sysdep/unix/krt.c')
-rw-r--r-- | sysdep/unix/krt.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/sysdep/unix/krt.c b/sysdep/unix/krt.c index 73324f38..41293a06 100644 --- a/sysdep/unix/krt.c +++ b/sysdep/unix/krt.c @@ -131,14 +131,14 @@ prefer_addr(struct ifa *a, struct ifa *b) } static inline struct ifa * -find_preferred_ifa(struct iface *i, ip_addr prefix, ip_addr mask) +find_preferred_ifa(struct iface *i, const net_addr *n) { struct ifa *a, *b = NULL; WALK_LIST(a, i->addrs) { if (!(a->flags & IA_SECONDARY) && - ipa_equal(ipa_and(a->ip, mask), prefix) && + (!n || ipa_in_netX(a->ip, n)) && (!b || prefer_addr(a, b))) b = a; } @@ -156,14 +156,14 @@ kif_choose_primary(struct iface *i) WALK_LIST(it, cf->primary) { if (!it->pattern || patmatch(it->pattern, i->name)) - if (a = find_preferred_ifa(i, it->prefix, ipa_mkmask(it->pxlen))) + if (a = find_preferred_ifa(i, &it->addr)) return a; } if (a = kif_get_primary_ip(i)) return a; - return find_preferred_ifa(i, IPA_NONE, IPA_NONE); + return find_preferred_ifa(i, NULL); } |