summaryrefslogtreecommitdiff
path: root/filter
diff options
context:
space:
mode:
authorJan Moskyto Matejka <mq@ucw.cz>2015-12-11 15:35:37 +0100
committerOndrej Zajicek (work) <santiago@crfreenet.org>2015-12-19 15:57:09 +0100
commitd7661fbe9dea980c61daa01a11a9aa59fa7be426 (patch)
treeba6c715e5b4cb1ba638dc5b75e14008a0e6f5e84 /filter
parent9b136840d90cce887cd139054c3f0a7d8b9f57d2 (diff)
Removed BITS_PER_IP_ADDRESS, MAX_PREFIX_LENGTH, BIRD_AF
Explicit setting of AF_INET(6|) in IP socket creation. BFD set to listen on v6, without setting the V6ONLY flag to catch both v4 and v6 traffic. Squashing and minor changes by Ondrej Santiago Zajicek
Diffstat (limited to 'filter')
-rw-r--r--filter/config.Y4
-rw-r--r--filter/filter.c2
2 files changed, 3 insertions, 3 deletions
diff --git a/filter/config.Y b/filter/config.Y
index 312506c4..d6844751 100644
--- a/filter/config.Y
+++ b/filter/config.Y
@@ -574,7 +574,7 @@ switch_items:
fprefix_s:
ipa_raw '/' NUM %prec '/' {
- if (($3 < 0) || ($3 > MAX_PREFIX_LENGTH) || !ip_is_prefix($1, $3)) cf_error("Invalid network prefix: %I/%d.", $1, $3);
+ if (($3 < 0) || ($3 > (ipa_is_ip4($1) ? IP4_MAX_PREFIX_LENGTH : IP6_MAX_PREFIX_LENGTH)) || !ip_is_prefix($1, $3)) cf_error("Invalid network prefix: %I/%d.", $1, $3);
$$.type = T_PREFIX; $$.val.px.ip = $1; $$.val.px.len = $3;
}
;
@@ -584,7 +584,7 @@ fprefix:
| fprefix_s '+' { $$ = $1; $$.val.px.len |= LEN_PLUS; }
| fprefix_s '-' { $$ = $1; $$.val.px.len |= LEN_MINUS; }
| fprefix_s '{' NUM ',' NUM '}' {
- if (! ((0 <= $3) && ($3 <= $5) && ($5 <= MAX_PREFIX_LENGTH))) cf_error("Invalid prefix pattern range: {%d, %d}.", $3, $5);
+ if (! ((0 <= $3) && ($3 <= $5) && ($5 <= (ipa_is_ip4($1.val.px.ip) ? IP4_MAX_PREFIX_LENGTH : IP6_MAX_PREFIX_LENGTH)))) cf_error("Invalid prefix pattern range: {%d, %d}.", $3, $5);
$$ = $1; $$.val.px.len |= LEN_RANGE | ($3 << 16) | ($5 << 8);
}
;
diff --git a/filter/filter.c b/filter/filter.c
index 1383961c..0e17a8e5 100644
--- a/filter/filter.c
+++ b/filter/filter.c
@@ -218,7 +218,7 @@ fprefix_get_bounds(struct f_prefix *px, int *l, int *h)
*l = 0;
else if (px->len & LEN_PLUS)
- *h = MAX_PREFIX_LENGTH;
+ *h = ipa_is_ip4(px->ip) ? IP4_MAX_PREFIX_LENGTH : IP6_MAX_PREFIX_LENGTH;
else if (px->len & LEN_RANGE)
{