summaryrefslogtreecommitdiff
path: root/nest/iface.c
diff options
context:
space:
mode:
Diffstat (limited to 'nest/iface.c')
-rw-r--r--nest/iface.c25
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;