From 0aad2b9292f8e5ff32d048378faf80d2d0bfbb80 Mon Sep 17 00:00:00 2001 From: Ondrej Zajicek Date: Sun, 14 Mar 2010 16:36:59 +0100 Subject: Temporary OSPF commit - sockets. --- nest/iface.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'nest/iface.c') diff --git a/nest/iface.c b/nest/iface.c index 82dead3..a80e973 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,8 +588,9 @@ iface_patt_match(struct iface_patt *ifp, struct iface *i) continue; } + // FIXME there should be check for prefix in prefix. (?) if (p->pxlen) - if (!i->addr || !ipa_in_net(i->addr->ip, p->prefix, p->pxlen)) + if (!a || !ipa_in_net(a->ip, p->prefix, p->pxlen)) continue; return pos; @@ -599,12 +600,12 @@ iface_patt_match(struct iface_patt *ifp, struct iface *i) } 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; -- cgit v1.2.3 From 5d53b80770b4927b5a8205ee0e57f80454b0abf5 Mon Sep 17 00:00:00 2001 From: Ondrej Zajicek Date: Fri, 19 Mar 2010 18:46:56 +0100 Subject: Allow iface pattern matching code to match peer address on ptp links. --- nest/iface.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'nest/iface.c') diff --git a/nest/iface.c b/nest/iface.c index a80e973..4d0cf04 100644 --- a/nest/iface.c +++ b/nest/iface.c @@ -588,12 +588,20 @@ iface_patt_match(struct iface_patt *ifp, struct iface *i, struct ifa *a) continue; } - // FIXME there should be check for prefix in prefix. (?) - if (p->pxlen) - if (!a || !ipa_in_net(a->ip, p->prefix, p->pxlen)) - continue; + if (p->pxlen == 0) + return pos; - return pos; + if (!a) + continue; + + if (ipa_in_net(a->ip, p->prefix, p->pxlen)) + return pos; + + if ((a->flags & IA_UNNUMBERED) && + ipa_in_net(a->opposite, p->prefix, p->pxlen)) + return pos; + + continue; } return 0; -- cgit v1.2.3