diff options
author | Ondrej Zajicek <santiago@crfreenet.org> | 2008-12-25 17:49:57 +0100 |
---|---|---|
committer | Ondrej Zajicek <santiago@crfreenet.org> | 2008-12-25 17:49:57 +0100 |
commit | 330aecead80140b0016d6de56dad1d193be774c8 (patch) | |
tree | 59ea071882a1237a013ab6286f6f720a61669762 /filter | |
parent | 083c43e22efb5353a258827a9e6f2f995cfe822d (diff) |
Bugfix in interpret
Missing cases in filter code interpret leads to crash
when bgp_next_hop attr was queried.
Diffstat (limited to 'filter')
-rw-r--r-- | filter/filter.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/filter/filter.c b/filter/filter.c index 109c7de4..1bd9a090 100644 --- a/filter/filter.c +++ b/filter/filter.c @@ -560,6 +560,15 @@ interpret(struct f_inst *what) res.type = T_INT; res.val.i = e->u.data; break; + case EAF_TYPE_IP_ADDRESS: + if (!e) { + res.type = T_VOID; + break; + } + res.type = T_IP; + struct adata * ad = e->u.ptr; + res.val.px.ip = * (ip_addr *) ad->data; + break; case EAF_TYPE_AS_PATH: if (!e) { res.type = T_VOID; @@ -599,6 +608,14 @@ interpret(struct f_inst *what) runtime( "Setting int attribute to non-int value" ); l->attrs[0].u.data = v1.val.i; break; + case EAF_TYPE_IP_ADDRESS: + if (v1.type != T_IP) + runtime( "Setting ip attribute to non-ip value" ); + int len = sizeof(ip_addr); + struct adata *ad = lp_alloc(f_pool, sizeof(struct adata) + len); + ad->length = len; + (* (ip_addr *) ad->data) = v1.val.px.ip; + break; case EAF_TYPE_AS_PATH: if (v1.type != T_PATH) runtime( "Setting path attribute to non-path value" ); |