0
0
mirror of https://gitlab.nic.cz/labs/bird.git synced 2024-11-08 12:18:42 +00:00

Allow iface pattern matching code to match peer address on ptp links.

This commit is contained in:
Ondrej Zajicek 2010-03-19 18:46:56 +01:00
parent 0aad2b9292
commit 5d53b80770
2 changed files with 15 additions and 7 deletions

View File

@ -181,8 +181,8 @@ iface_patt_node_init:
iface_patt_node_body: iface_patt_node_body:
TEXT { this_ipn->pattern = $1; this_ipn->prefix = IPA_NONE; this_ipn->pxlen = 0; } 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; } | prefix_or_ipa { 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; } | TEXT prefix_or_ipa { this_ipn->pattern = $1; this_ipn->prefix = $2.addr; this_ipn->pxlen = $2.len; }
; ;
iface_negate: iface_negate:

View File

@ -588,12 +588,20 @@ iface_patt_match(struct iface_patt *ifp, struct iface *i, struct ifa *a)
continue; continue;
} }
// FIXME there should be check for prefix in prefix. (?) if (p->pxlen == 0)
if (p->pxlen) return pos;
if (!a || !ipa_in_net(a->ip, p->prefix, p->pxlen))
continue;
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; return 0;