summaryrefslogtreecommitdiff
path: root/filter
diff options
context:
space:
mode:
authorOndrej Zajicek <santiago@crfreenet.org>2012-11-27 01:25:47 +0100
committerOndrej Zajicek <santiago@crfreenet.org>2012-11-27 01:25:47 +0100
commit3e40f3e795e39f0b92445fd5295382220077c77f (patch)
treeb048b687ea586fdaf23411b1a83827098b4bf4a6 /filter
parentc93c02088a026b83f452fbd260135ba4c8da7ecf (diff)
Fixes setting of route attributes of type router id.
Diffstat (limited to 'filter')
-rw-r--r--filter/filter.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/filter/filter.c b/filter/filter.c
index 49b67391..fb2034ee 100644
--- a/filter/filter.c
+++ b/filter/filter.c
@@ -956,11 +956,25 @@ interpret(struct f_inst *what)
l->attrs[0].type = what->aux | EAF_ORIGINATED;
switch (what->aux & EAF_TYPE_MASK) {
case EAF_TYPE_INT:
- case EAF_TYPE_ROUTER_ID:
if (v1.type != T_INT)
runtime( "Setting int attribute to non-int value" );
l->attrs[0].u.data = v1.val.i;
break;
+
+ case EAF_TYPE_ROUTER_ID:
+#ifndef IPV6
+ /* IP->Quad implicit conversion */
+ if (v1.type == T_IP) {
+ l->attrs[0].u.data = ipa_to_u32(v1.val.px.ip);
+ break;
+ }
+#endif
+ /* T_INT for backward compatibility */
+ if ((v1.type != T_QUAD) && (v1.type != T_INT))
+ runtime( "Setting quad attribute to non-quad value" );
+ l->attrs[0].u.data = v1.val.i;
+ break;
+
case EAF_TYPE_OPAQUE:
runtime( "Setting opaque attribute is not allowed" );
break;