]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
Allow iface pattern matching code to match peer address on ptp links.
authorOndrej Zajicek <santiago@crfreenet.org>
Fri, 19 Mar 2010 17:46:56 +0000 (18:46 +0100)
committerOndrej Zajicek <santiago@crfreenet.org>
Fri, 19 Mar 2010 17:46:56 +0000 (18:46 +0100)
nest/config.Y
nest/iface.c

index 792012e723c8bc2b13bf0d81fc6e16dbf9577d02..7bb05259d16b45fa82e87119948337cab9c21e0a 100644 (file)
@@ -181,8 +181,8 @@ iface_patt_node_init:
 
 iface_patt_node_body:
    TEXT { this_ipn->pattern = $1; this_ipn->prefix = IPA_NONE; this_ipn->pxlen = 0; }
- | prefix { this_ipn->pattern = NULL; this_ipn->prefix = $1.addr; this_ipn->pxlen = $1.len; }
- | TEXT prefix { this_ipn->pattern = $1; this_ipn->prefix = $2.addr; this_ipn->pxlen = $2.len; }
+ | prefix_or_ipa { this_ipn->pattern = NULL; this_ipn->prefix = $1.addr; this_ipn->pxlen = $1.len; }
+ | TEXT prefix_or_ipa { this_ipn->pattern = $1; this_ipn->prefix = $2.addr; this_ipn->pxlen = $2.len; }
  ;
 
 iface_negate:
index a80e9736a31aaec84877cc9d4712dca6ad3c4fda..4d0cf04c40a03346762a185cd9f97ac67a51e976 100644 (file)
@@ -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;