diff options
author | Ondrej Zajicek <santiago@crfreenet.org> | 2010-03-26 18:53:31 +0100 |
---|---|---|
committer | Ondrej Zajicek <santiago@crfreenet.org> | 2010-03-26 18:53:31 +0100 |
commit | eb0f129fcedcecbee85403095abad8f59b82683c (patch) | |
tree | 562179cf65bcdcfe1fc2ea42b401ddce620de350 /nest/iface.c | |
parent | b1c030b0ba59eed6da5271ed592d6b93ed088518 (diff) | |
parent | 48cff379a718998cd984d60fb6f8b48cb961c0f1 (diff) |
Merge branch 'socket2' into new
Diffstat (limited to 'nest/iface.c')
-rw-r--r-- | nest/iface.c | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/nest/iface.c b/nest/iface.c index 82dead35..4d0cf04c 100644 --- a/nest/iface.c +++ b/nest/iface.c @@ -566,8 +566,8 @@ if_init(void) * Interface Pattern Lists */ -static int -iface_patt_match(struct iface_patt *ifp, struct iface *i) +int +iface_patt_match(struct iface_patt *ifp, struct iface *i, struct ifa *a) { struct iface_patt_node *p; @@ -588,23 +588,32 @@ iface_patt_match(struct iface_patt *ifp, struct iface *i) continue; } - if (p->pxlen) - if (!i->addr || !ipa_in_net(i->addr->ip, p->prefix, p->pxlen)) - continue; + if (p->pxlen == 0) + return pos; + + if (!a) + continue; + + if (ipa_in_net(a->ip, p->prefix, p->pxlen)) + return pos; - return pos; + if ((a->flags & IA_UNNUMBERED) && + ipa_in_net(a->opposite, p->prefix, p->pxlen)) + return pos; + + continue; } return 0; } struct iface_patt * -iface_patt_find(list *l, struct iface *i) +iface_patt_find(list *l, struct iface *i, struct ifa *a) { struct iface_patt *p; WALK_LIST(p, *l) - if (iface_patt_match(p, i)) + if (iface_patt_match(p, i, a)) return p; return NULL; |