0
0
mirror of https://gitlab.nic.cz/labs/bird.git synced 2024-12-22 09:41:54 +00:00

Fixes missing cases in filters.

This commit is contained in:
Ondrej Zajicek 2010-03-15 00:34:44 +01:00
parent afa9f66c27
commit e8da1bd0b5

View File

@ -606,41 +606,44 @@ interpret(struct f_inst *what)
if ((!e) && (f_flags & FF_FORCE_TMPATTR)) if ((!e) && (f_flags & FF_FORCE_TMPATTR))
e = ea_find( (*f_rte)->attrs->eattrs, what->a2.i ); e = ea_find( (*f_rte)->attrs->eattrs, what->a2.i );
switch (what->aux & EAF_TYPE_MASK) {
case EAF_TYPE_INT:
if (!e) { if (!e) {
/* A special case: undefined int_set looks like empty int_set */
if ((what->aux & EAF_TYPE_MASK) == EAF_TYPE_INT_SET) {
res.type = T_CLIST;
res.val.ad = adata_empty(f_pool);
break;
}
/* Undefined value */
res.type = T_VOID; res.type = T_VOID;
break; break;
} }
switch (what->aux & EAF_TYPE_MASK) {
case EAF_TYPE_INT:
case EAF_TYPE_ROUTER_ID:
res.type = T_INT; res.type = T_INT;
res.val.i = e->u.data; res.val.i = e->u.data;
break; break;
case EAF_TYPE_IP_ADDRESS: case EAF_TYPE_OPAQUE:
if (!e) { res.type = T_ENUM_EMPTY;
res.type = T_VOID; res.val.i = 0;
break; break;
} case EAF_TYPE_IP_ADDRESS:
res.type = T_IP; res.type = T_IP;
struct adata * ad = e->u.ptr; struct adata * ad = e->u.ptr;
res.val.px.ip = * (ip_addr *) ad->data; res.val.px.ip = * (ip_addr *) ad->data;
break; break;
case EAF_TYPE_AS_PATH: case EAF_TYPE_AS_PATH:
if (!e) {
res.type = T_VOID;
break;
}
res.type = T_PATH; res.type = T_PATH;
res.val.ad = e->u.ptr; res.val.ad = e->u.ptr;
break; break;
case EAF_TYPE_INT_SET: case EAF_TYPE_INT_SET:
if (!e) {
res.type = T_CLIST;
res.val.ad = adata_empty(f_pool);
break;
}
res.type = T_CLIST; res.type = T_CLIST;
res.val.ad = e->u.ptr; res.val.ad = e->u.ptr;
break; break;
case EAF_TYPE_UNDEF:
res.type = T_VOID;
break;
default: default:
bug("Unknown type in e,a"); bug("Unknown type in e,a");
} }
@ -659,10 +662,14 @@ interpret(struct f_inst *what)
l->attrs[0].type = what->aux | EAF_ORIGINATED; l->attrs[0].type = what->aux | EAF_ORIGINATED;
switch (what->aux & EAF_TYPE_MASK) { switch (what->aux & EAF_TYPE_MASK) {
case EAF_TYPE_INT: case EAF_TYPE_INT:
case EAF_TYPE_ROUTER_ID:
if (v1.type != T_INT) if (v1.type != T_INT)
runtime( "Setting int attribute to non-int value" ); runtime( "Setting int attribute to non-int value" );
l->attrs[0].u.data = v1.val.i; l->attrs[0].u.data = v1.val.i;
break; break;
case EAF_TYPE_OPAQUE:
runtime( "Setting opaque attribute is not allowed" );
break;
case EAF_TYPE_IP_ADDRESS: case EAF_TYPE_IP_ADDRESS:
if (v1.type != T_IP) if (v1.type != T_IP)
runtime( "Setting ip attribute to non-ip value" ); runtime( "Setting ip attribute to non-ip value" );