summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMikael Magnusson <mikma@users.sourceforge.net>2019-03-08 17:48:05 +0100
committerMikael Magnusson <mikma@users.sourceforge.net>2019-03-08 17:48:05 +0100
commite5d2ddb8bb910a78509e3f04dae41bab45f16f40 (patch)
tree28972e41088db957e5a5481fda929900c5583088
parenta53f043d5ec96b74f77fe5dc9e853bbaa100f98e (diff)
BGP: Allow deletion of bgb_tunnel_encap
-rw-r--r--filter/config.Y3
-rw-r--r--filter/filter.c16
2 files changed, 16 insertions, 3 deletions
diff --git a/filter/config.Y b/filter/config.Y
index 8b5f01e9..04e5758c 100644
--- a/filter/config.Y
+++ b/filter/config.Y
@@ -232,6 +232,9 @@ f_generate_empty(struct f_dynamic_attr dyn)
case EAF_TYPE_LC_SET:
e->aux = T_LCLIST;
break;
+ case EAF_TYPE_TUNNEL_ENCAP:
+ e->aux = T_SET;
+ break;
default:
cf_error("Can't empty that attribute");
}
diff --git a/filter/filter.c b/filter/filter.c
index c2e7a44f..af1165bd 100644
--- a/filter/filter.c
+++ b/filter/filter.c
@@ -629,6 +629,10 @@ calc_tunnel_encap(struct f_tree *t, int *type)
if (t == NULL)
return 0;
+ if (t->from.type == 0) {
+ return 0;
+ }
+
if (t->from.type != T_TLV) {
debug("Not tlv %d\n", t->from.type);
return -1;
@@ -1346,11 +1350,17 @@ interpret(struct f_inst *what)
runtime( "Setting tunnel encap attribute to non-tlv value %d", v1.type );
int type = 0;
int len = calc_tunnel_encap(v1.val.t, &type);
- if (len <= 0)
- runtime( "Empty tunnel encapsulation" );
+ if (len < 0)
+ runtime( "Error tunnel encapsulation" );
+ else if (len == 0) {
+ struct adata *ad = lp_alloc(f_pool, sizeof(struct adata) + len);
+ ad->length = len;
+ l->attrs[0].u.ptr = ad;
+ }
else if (type <= 0 || type > 65535)
runtime( "Invalid tunnel encapsulation type: %d (0 < type <= 65535)", type );
- l->attrs[0].u.ptr = build_tunnel_encap(v1.val.t, type, len);
+ else
+ l->attrs[0].u.ptr = build_tunnel_encap(v1.val.t, type, len);
break;
}
default: bug("Unknown type in e,S");