summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMikael Magnusson <mikma@users.sourceforge.net>2019-04-04 16:55:59 +0200
committerMikael Magnusson <mikma@users.sourceforge.net>2019-04-04 16:55:59 +0200
commitd07ddd22a1371e04f592348427ed192e9cb83f97 (patch)
tree5d9a1ca92f049787a68b978942c7d7154b0b44d4
parentb12562d5c325c43eb193679bf072fd86da6ce021 (diff)
Filter: rename tlv to sub-tlv
-rw-r--r--filter/config.Y28
-rw-r--r--filter/filter.c4
-rw-r--r--filter/filter.h1
3 files changed, 17 insertions, 16 deletions
diff --git a/filter/config.Y b/filter/config.Y
index 74ebd600..03f48846 100644
--- a/filter/config.Y
+++ b/filter/config.Y
@@ -107,11 +107,11 @@ f_new_pair_set(int fa, int ta, int fb, int tb)
#define LC_ALL 0xFFFFFFFF
static struct f_tree *
-f_new_tlv_item(u32 type, u32 v1)
+f_new_sub_tlv_item(u32 type, u32 v1)
{
struct f_tree *t = f_new_tree();
t->right = t;
- t->from.type = t->to.type = T_TLV;
+ t->from.type = t->to.type = T_SUB_TLV;
struct tlv v;
v.type = type;
switch (type) {
@@ -131,11 +131,11 @@ f_new_tlv_item(u32 type, u32 v1)
}
static struct f_tree *
-f_new_tlv_remote_ep(u32 asn, ip_addr ip)
+f_new_sub_tlv_remote_ep(u32 asn, ip_addr ip)
{
struct f_tree *t = f_new_tree();
t->right = t;
- t->from.type = t->to.type = T_TLV;
+ t->from.type = t->to.type = T_SUB_TLV;
struct tlv v;
v.type = TLV_REMOTE_ENDPOINT;
v.u.remote_endpoint.asn = asn;
@@ -149,11 +149,11 @@ typedef char wg_key_b64_string[45];
int wg_key_from_base64(u8 key[32], const wg_key_b64_string base64);
static struct f_tree *
-f_new_tlv_encap(u32 type, const char *v1)
+f_new_sub_tlv_encap(u32 type, const char *v1)
{
struct f_tree *t = f_new_tree();
t->right = t;
- t->from.type = t->to.type = T_TLV;
+ t->from.type = t->to.type = T_SUB_TLV;
struct tlv v;
v.type = TLV_ENCAPSULATION;
v.u.tunnel_encap.type = type;
@@ -496,7 +496,7 @@ CF_KEYWORDS(FUNCTION, PRINT, PRINTN, UNSET, RETURN,
%type <f> filter filter_body where_filter
%type <i> type break_command ec_kind
%type <i32> cnum
-%type <e> pair_item ec_item lc_item set_item switch_item set_items switch_items switch_body tlv_item
+%type <e> pair_item ec_item lc_item set_item switch_item set_items switch_items switch_body sub_tlv_item
%type <trie> fprefix_set
%type <v> set_atom switch_atom fipa
%type <px> fprefix
@@ -781,17 +781,17 @@ lc_item:
{ $$ = f_new_lc_item($2, $10, $4, $12, $6, $14); }
;
-tlv_item:
- '(' TUNNEL_ENCAP ',' cnum ',' text ')' { $$ = f_new_tlv_encap($4, $6); }
- | '(' UDP_DEST_PORT ',' cnum ')' { $$ = f_new_tlv_item(TLV_UDP_DEST_PORT, $4); }
- | '(' COLOR ',' cnum ')' { $$ = f_new_tlv_item(TLV_COLOR, $4); }
- | '(' REMOTE_ENDPOINT ',' NUM ',' ipa ')' { $$ = f_new_tlv_remote_ep($4, $6); }
+sub_tlv_item:
+ '(' TUNNEL_ENCAP ',' cnum ',' text ')' { $$ = f_new_sub_tlv_encap($4, $6); }
+ | '(' UDP_DEST_PORT ',' cnum ')' { $$ = f_new_sub_tlv_item(TLV_UDP_DEST_PORT, $4); }
+ | '(' COLOR ',' cnum ')' { $$ = f_new_sub_tlv_item(TLV_COLOR, $4); }
+ | '(' REMOTE_ENDPOINT ',' NUM ',' ipa ')' { $$ = f_new_sub_tlv_remote_ep($4, $6); }
set_item:
pair_item
| ec_item
| lc_item
- | tlv_item
+ | sub_tlv_item
| set_atom { $$ = f_new_item($1, $1); }
| set_atom DDOT set_atom { $$ = f_new_item($1, $3); }
;
@@ -800,7 +800,7 @@ switch_item:
pair_item
| ec_item
| lc_item
- | tlv_item
+ | sub_tlv_item
| switch_atom { $$ = f_new_item($1, $1); }
| switch_atom DDOT switch_atom { $$ = f_new_item($1, $3); }
;
diff --git a/filter/filter.c b/filter/filter.c
index 97017cee..ee439195 100644
--- a/filter/filter.c
+++ b/filter/filter.c
@@ -633,7 +633,7 @@ calc_tunnel_encap(struct f_tree *t, int *type)
return 0;
}
- if (t->from.type != T_TLV) {
+ if (t->from.type != T_SUB_TLV) {
debug("Not tlv %d\n", t->from.type);
return -1;
}
@@ -698,7 +698,7 @@ build_tunnel_encap_rec(void *p, struct f_tree *t)
if (t == NULL)
return p;
- if (t->from.type != T_TLV) {
+ if (t->from.type != T_SUB_TLV) {
debug("Not tlv %d\n", t->from.type);
return p;
}
diff --git a/filter/filter.h b/filter/filter.h
index dc9715a0..83efd036 100644
--- a/filter/filter.h
+++ b/filter/filter.h
@@ -247,6 +247,7 @@ void val_format(struct f_val v, buffer *buf);
#define T_LCLIST 0x29 /* Large community list */
#define T_RD 0x2a /* Route distinguisher for VPN addresses */
#define T_TLV 0x2b /* Tunnel encapsulation TLV */
+#define T_SUB_TLV 0x2c /* Tunnel encapsulation sub-TLV */
#define T_RETURN 0x40
#define T_SET 0x80