summaryrefslogtreecommitdiff
path: root/proto
diff options
context:
space:
mode:
Diffstat (limited to 'proto')
-rw-r--r--proto/babel/babel.c6
-rw-r--r--proto/babel/config.Y2
-rw-r--r--proto/bgp/attrs.c40
-rw-r--r--proto/bgp/bgp.h16
-rw-r--r--proto/bgp/config.Y26
-rw-r--r--proto/ospf/config.Y8
-rw-r--r--proto/ospf/rt.c8
-rw-r--r--proto/radv/config.Y4
-rw-r--r--proto/rip/config.Y4
-rw-r--r--proto/rip/rip.c6
10 files changed, 63 insertions, 57 deletions
diff --git a/proto/babel/babel.c b/proto/babel/babel.c
index db54e4f1..6df80922 100644
--- a/proto/babel/babel.c
+++ b/proto/babel/babel.c
@@ -654,7 +654,7 @@ babel_announce_rte(struct babel_proto *p, struct babel_entry *e)
*a0.eattrs = (ea_list) { .count = 3 };
a0.eattrs->attrs[0] = (eattr) {
.id = EA_BABEL_METRIC,
- .type = EAF_TYPE_INT,
+ .type = T_INT,
.u.data = r->metric,
};
@@ -663,13 +663,13 @@ babel_announce_rte(struct babel_proto *p, struct babel_entry *e)
memcpy(ad->data, &(r->router_id), sizeof(u64));
a0.eattrs->attrs[1] = (eattr) {
.id = EA_BABEL_ROUTER_ID,
- .type = EAF_TYPE_OPAQUE,
+ .type = T_OPAQUE,
.u.ptr = ad,
};
a0.eattrs->attrs[2] = (eattr) {
.id = EA_BABEL_SEQNO,
- .type = EAF_TYPE_INT,
+ .type = T_INT,
.u.data = r->seqno,
};
diff --git a/proto/babel/config.Y b/proto/babel/config.Y
index 05210fa4..fa745993 100644
--- a/proto/babel/config.Y
+++ b/proto/babel/config.Y
@@ -163,7 +163,7 @@ babel_iface_opt_list:
babel_iface:
babel_iface_start iface_patt_list_nopx babel_iface_opt_list babel_iface_finish;
-dynamic_attr: BABEL_METRIC { $$ = f_new_dynamic_attr(EAF_TYPE_INT, T_INT, EA_BABEL_METRIC); } ;
+dynamic_attr: BABEL_METRIC { $$ = f_new_dynamic_attr(T_INT, EA_BABEL_METRIC); } ;
CF_CLI_HELP(SHOW BABEL, ..., [[Show information about Babel protocol]]);
diff --git a/proto/bgp/attrs.c b/proto/bgp/attrs.c
index 4cc089e9..ed1bb12f 100644
--- a/proto/bgp/attrs.c
+++ b/proto/bgp/attrs.c
@@ -80,7 +80,7 @@ static const struct bgp_attr_desc bgp_attr_table[];
static inline int bgp_attr_known(uint code);
eattr *
-bgp_set_attr(ea_list **attrs, struct linpool *pool, uint code, uint flags, uintptr_t val)
+bgp_set_attr(ea_list **attrs, struct linpool *pool, uint code, uint flags, union bval val)
{
ASSERT(bgp_attr_known(code));
@@ -976,7 +976,7 @@ static inline void
bgp_decode_unknown(struct bgp_parse_state *s, uint code, uint flags, byte *data, uint len, ea_list **to)
{
/* Cannot use bgp_set_attr_data() as it works on known attributes only */
- ea_set_attr_data(to, s->pool, EA_CODE(PROTOCOL_BGP, code), flags, EAF_TYPE_OPAQUE, data, len);
+ ea_set_attr_data(to, s->pool, EA_CODE(PROTOCOL_BGP, code), flags, T_OPAQUE, data, len);
}
@@ -987,7 +987,7 @@ bgp_decode_unknown(struct bgp_parse_state *s, uint code, uint flags, byte *data,
static const struct bgp_attr_desc bgp_attr_table[] = {
[BA_ORIGIN] = {
.name = "origin",
- .type = EAF_TYPE_BGP_ORIGIN,
+ .type = T_ENUM_BGP_ORIGIN,
.flags = BAF_TRANSITIVE,
.export = bgp_export_origin,
.encode = bgp_encode_u8,
@@ -996,14 +996,14 @@ static const struct bgp_attr_desc bgp_attr_table[] = {
},
[BA_AS_PATH] = {
.name = "as_path",
- .type = EAF_TYPE_AS_PATH,
+ .type = T_PATH,
.flags = BAF_TRANSITIVE,
.encode = bgp_encode_as_path,
.decode = bgp_decode_as_path,
},
[BA_NEXT_HOP] = {
.name = "next_hop",
- .type = EAF_TYPE_IP_ADDRESS,
+ .type = T_IP,
.flags = BAF_TRANSITIVE,
.encode = bgp_encode_next_hop,
.decode = bgp_decode_next_hop,
@@ -1011,14 +1011,14 @@ static const struct bgp_attr_desc bgp_attr_table[] = {
},
[BA_MULTI_EXIT_DISC] = {
.name = "med",
- .type = EAF_TYPE_INT,
+ .type = T_INT,
.flags = BAF_OPTIONAL,
.encode = bgp_encode_u32,
.decode = bgp_decode_med,
},
[BA_LOCAL_PREF] = {
.name = "local_pref",
- .type = EAF_TYPE_INT,
+ .type = T_INT,
.flags = BAF_TRANSITIVE,
.export = bgp_export_local_pref,
.encode = bgp_encode_u32,
@@ -1026,14 +1026,14 @@ static const struct bgp_attr_desc bgp_attr_table[] = {
},
[BA_ATOMIC_AGGR] = {
.name = "atomic_aggr",
- .type = EAF_TYPE_OPAQUE,
+ .type = T_OPAQUE,
.flags = BAF_TRANSITIVE,
.encode = bgp_encode_raw,
.decode = bgp_decode_atomic_aggr,
},
[BA_AGGREGATOR] = {
.name = "aggregator",
- .type = EAF_TYPE_OPAQUE,
+ .type = T_OPAQUE,
.flags = BAF_OPTIONAL | BAF_TRANSITIVE,
.encode = bgp_encode_aggregator,
.decode = bgp_decode_aggregator,
@@ -1041,7 +1041,7 @@ static const struct bgp_attr_desc bgp_attr_table[] = {
},
[BA_COMMUNITY] = {
.name = "community",
- .type = EAF_TYPE_INT_SET,
+ .type = T_CLIST,
.flags = BAF_OPTIONAL | BAF_TRANSITIVE,
.export = bgp_export_community,
.encode = bgp_encode_u32s,
@@ -1049,7 +1049,7 @@ static const struct bgp_attr_desc bgp_attr_table[] = {
},
[BA_ORIGINATOR_ID] = {
.name = "originator_id",
- .type = EAF_TYPE_ROUTER_ID,
+ .type = T_QUAD,
.flags = BAF_OPTIONAL,
.export = bgp_export_originator_id,
.encode = bgp_encode_u32,
@@ -1057,7 +1057,7 @@ static const struct bgp_attr_desc bgp_attr_table[] = {
},
[BA_CLUSTER_LIST] = {
.name = "cluster_list",
- .type = EAF_TYPE_INT_SET,
+ .type = T_CLIST,
.flags = BAF_OPTIONAL,
.export = bgp_export_cluster_list,
.encode = bgp_encode_u32s,
@@ -1066,19 +1066,19 @@ static const struct bgp_attr_desc bgp_attr_table[] = {
},
[BA_MP_REACH_NLRI] = {
.name = "mp_reach_nlri",
- .type = EAF_TYPE_OPAQUE,
+ .type = T_OPAQUE,
.flags = BAF_OPTIONAL,
.decode = bgp_decode_mp_reach_nlri,
},
[BA_MP_UNREACH_NLRI] = {
.name = "mp_unreach_nlri",
- .type = EAF_TYPE_OPAQUE,
+ .type = T_OPAQUE,
.flags = BAF_OPTIONAL,
.decode = bgp_decode_mp_unreach_nlri,
},
[BA_EXT_COMMUNITY] = {
.name = "ext_community",
- .type = EAF_TYPE_EC_SET,
+ .type = T_ECLIST,
.flags = BAF_OPTIONAL | BAF_TRANSITIVE,
.export = bgp_export_ext_community,
.encode = bgp_encode_u32s,
@@ -1086,14 +1086,14 @@ static const struct bgp_attr_desc bgp_attr_table[] = {
},
[BA_AS4_PATH] = {
.name = "as4_path",
- .type = EAF_TYPE_AS_PATH,
+ .type = T_PATH,
.flags = BAF_OPTIONAL | BAF_TRANSITIVE,
.encode = bgp_encode_raw,
.decode = bgp_decode_as4_path,
},
[BA_AS4_AGGREGATOR] = {
.name = "as4_aggregator",
- .type = EAF_TYPE_OPAQUE,
+ .type = T_OPAQUE,
.flags = BAF_OPTIONAL | BAF_TRANSITIVE,
.encode = bgp_encode_raw,
.decode = bgp_decode_as4_aggregator,
@@ -1101,7 +1101,7 @@ static const struct bgp_attr_desc bgp_attr_table[] = {
},
[BA_AIGP] = {
.name = "aigp",
- .type = EAF_TYPE_OPAQUE,
+ .type = T_OPAQUE,
.flags = BAF_OPTIONAL | BAF_DECODE_FLAGS,
.export = bgp_export_aigp,
.encode = bgp_encode_raw,
@@ -1110,7 +1110,7 @@ static const struct bgp_attr_desc bgp_attr_table[] = {
},
[BA_LARGE_COMMUNITY] = {
.name = "large_community",
- .type = EAF_TYPE_LC_SET,
+ .type = T_LCLIST,
.flags = BAF_OPTIONAL | BAF_TRANSITIVE,
.export = bgp_export_large_community,
.encode = bgp_encode_u32s,
@@ -1118,7 +1118,7 @@ static const struct bgp_attr_desc bgp_attr_table[] = {
},
[BA_MPLS_LABEL_STACK] = {
.name = "mpls_label_stack",
- .type = EAF_TYPE_INT_SET,
+ .type = T_CLIST,
.export = bgp_export_mpls_label_stack,
.encode = bgp_encode_mpls_label_stack,
.decode = bgp_decode_mpls_label_stack,
diff --git a/proto/bgp/bgp.h b/proto/bgp/bgp.h
index 022adb39..4a06eba2 100644
--- a/proto/bgp/bgp.h
+++ b/proto/bgp/bgp.h
@@ -545,22 +545,28 @@ bgp_find_attr(ea_list *attrs, uint code)
}
eattr *
-bgp_set_attr(ea_list **attrs, struct linpool *pool, uint code, uint flags, uintptr_t val);
+bgp_set_attr(ea_list **attrs, struct linpool *pool, uint code, uint flags, union bval val);
static inline void
bgp_set_attr_u32(ea_list **to, struct linpool *pool, uint code, uint flags, u32 val)
-{ bgp_set_attr(to, pool, code, flags, (uintptr_t) val); }
+{
+ union bval bv = { .data = val };
+ bgp_set_attr(to, pool, code, flags, bv);
+}
static inline void
-bgp_set_attr_ptr(ea_list **to, struct linpool *pool, uint code, uint flags, const struct adata *val)
-{ bgp_set_attr(to, pool, code, flags, (uintptr_t) val); }
+bgp_set_attr_ptr(ea_list **to, struct linpool *pool, uint code, uint flags, const struct adata *ad)
+{
+ union bval bv = { .ptr = ad };
+ bgp_set_attr(to, pool, code, flags, bv);
+}
static inline void
bgp_set_attr_data(ea_list **to, struct linpool *pool, uint code, uint flags, void *data, uint len)
{
struct adata *a = lp_alloc_adata(pool, len);
bmemcpy(a->data, data, len);
- bgp_set_attr(to, pool, code, flags, (uintptr_t) a);
+ bgp_set_attr_ptr(to, pool, code, flags, a);
}
#define bgp_unset_attr(to, pool, code) ea_unset_attr(to, pool, 0, code)
diff --git a/proto/bgp/config.Y b/proto/bgp/config.Y
index 86124bfb..6a78f79b 100644
--- a/proto/bgp/config.Y
+++ b/proto/bgp/config.Y
@@ -318,31 +318,31 @@ bgp_proto_channel: bgp_channel_start bgp_channel_opt_list bgp_channel_end;
dynamic_attr: BGP_ORIGIN
- { $$ = f_new_dynamic_attr(EAF_TYPE_BGP_ORIGIN, T_ENUM_BGP_ORIGIN, EA_CODE(PROTOCOL_BGP, BA_ORIGIN)); } ;
+ { $$ = f_new_dynamic_attr(T_ENUM_BGP_ORIGIN, EA_CODE(PROTOCOL_BGP, BA_ORIGIN)); } ;
dynamic_attr: BGP_PATH
- { $$ = f_new_dynamic_attr(EAF_TYPE_AS_PATH, T_PATH, EA_CODE(PROTOCOL_BGP, BA_AS_PATH)); } ;
+ { $$ = f_new_dynamic_attr(T_PATH, EA_CODE(PROTOCOL_BGP, BA_AS_PATH)); } ;
dynamic_attr: BGP_NEXT_HOP
- { $$ = f_new_dynamic_attr(EAF_TYPE_IP_ADDRESS, T_IP, EA_CODE(PROTOCOL_BGP, BA_NEXT_HOP)); } ;
+ { $$ = f_new_dynamic_attr(T_IP, EA_CODE(PROTOCOL_BGP, BA_NEXT_HOP)); } ;
dynamic_attr: BGP_MED
- { $$ = f_new_dynamic_attr(EAF_TYPE_INT, T_INT, EA_CODE(PROTOCOL_BGP, BA_MULTI_EXIT_DISC)); } ;
+ { $$ = f_new_dynamic_attr(T_INT, EA_CODE(PROTOCOL_BGP, BA_MULTI_EXIT_DISC)); } ;
dynamic_attr: BGP_LOCAL_PREF
- { $$ = f_new_dynamic_attr(EAF_TYPE_INT, T_INT, EA_CODE(PROTOCOL_BGP, BA_LOCAL_PREF)); } ;
+ { $$ = f_new_dynamic_attr(T_INT, EA_CODE(PROTOCOL_BGP, BA_LOCAL_PREF)); } ;
dynamic_attr: BGP_ATOMIC_AGGR
- { $$ = f_new_dynamic_attr(EAF_TYPE_OPAQUE, T_OPAQUE, EA_CODE(PROTOCOL_BGP, BA_ATOMIC_AGGR)); } ;
+ { $$ = f_new_dynamic_attr(T_OPAQUE, EA_CODE(PROTOCOL_BGP, BA_ATOMIC_AGGR)); } ;
dynamic_attr: BGP_AGGREGATOR
- { $$ = f_new_dynamic_attr(EAF_TYPE_OPAQUE, T_OPAQUE, EA_CODE(PROTOCOL_BGP, BA_AGGREGATOR)); } ;
+ { $$ = f_new_dynamic_attr(T_OPAQUE, EA_CODE(PROTOCOL_BGP, BA_AGGREGATOR)); } ;
dynamic_attr: BGP_COMMUNITY
- { $$ = f_new_dynamic_attr(EAF_TYPE_INT_SET, T_CLIST, EA_CODE(PROTOCOL_BGP, BA_COMMUNITY)); } ;
+ { $$ = f_new_dynamic_attr(T_CLIST, EA_CODE(PROTOCOL_BGP, BA_COMMUNITY)); } ;
dynamic_attr: BGP_ORIGINATOR_ID
- { $$ = f_new_dynamic_attr(EAF_TYPE_ROUTER_ID, T_QUAD, EA_CODE(PROTOCOL_BGP, BA_ORIGINATOR_ID)); } ;
+ { $$ = f_new_dynamic_attr(T_QUAD, EA_CODE(PROTOCOL_BGP, BA_ORIGINATOR_ID)); } ;
dynamic_attr: BGP_CLUSTER_LIST
- { $$ = f_new_dynamic_attr(EAF_TYPE_INT_SET, T_CLIST, EA_CODE(PROTOCOL_BGP, BA_CLUSTER_LIST)); } ;
+ { $$ = f_new_dynamic_attr(T_CLIST, EA_CODE(PROTOCOL_BGP, BA_CLUSTER_LIST)); } ;
dynamic_attr: BGP_EXT_COMMUNITY
- { $$ = f_new_dynamic_attr(EAF_TYPE_EC_SET, T_ECLIST, EA_CODE(PROTOCOL_BGP, BA_EXT_COMMUNITY)); } ;
+ { $$ = f_new_dynamic_attr(T_ECLIST, EA_CODE(PROTOCOL_BGP, BA_EXT_COMMUNITY)); } ;
dynamic_attr: BGP_AIGP
- { $$ = f_new_dynamic_attr(EAF_TYPE_OPAQUE, T_OPAQUE, EA_CODE(PROTOCOL_BGP, BA_AIGP)); } ;
+ { $$ = f_new_dynamic_attr(T_OPAQUE, EA_CODE(PROTOCOL_BGP, BA_AIGP)); } ;
dynamic_attr: BGP_LARGE_COMMUNITY
- { $$ = f_new_dynamic_attr(EAF_TYPE_LC_SET, T_LCLIST, EA_CODE(PROTOCOL_BGP, BA_LARGE_COMMUNITY)); } ;
+ { $$ = f_new_dynamic_attr(T_LCLIST, EA_CODE(PROTOCOL_BGP, BA_LARGE_COMMUNITY)); } ;
diff --git a/proto/ospf/config.Y b/proto/ospf/config.Y
index 4b7d5a36..a8972d2c 100644
--- a/proto/ospf/config.Y
+++ b/proto/ospf/config.Y
@@ -505,10 +505,10 @@ ospf_iface:
ospf_iface_start ospf_iface_patt_list ospf_iface_opt_list { ospf_iface_finish(); }
;
-dynamic_attr: OSPF_METRIC1 { $$ = f_new_dynamic_attr(EAF_TYPE_INT, T_INT, EA_OSPF_METRIC1); } ;
-dynamic_attr: OSPF_METRIC2 { $$ = f_new_dynamic_attr(EAF_TYPE_INT, T_INT, EA_OSPF_METRIC2); } ;
-dynamic_attr: OSPF_TAG { $$ = f_new_dynamic_attr(EAF_TYPE_INT, T_INT, EA_OSPF_TAG); } ;
-dynamic_attr: OSPF_ROUTER_ID { $$ = f_new_dynamic_attr(EAF_TYPE_ROUTER_ID, T_QUAD, EA_OSPF_ROUTER_ID); } ;
+dynamic_attr: OSPF_METRIC1 { $$ = f_new_dynamic_attr(T_INT, EA_OSPF_METRIC1); } ;
+dynamic_attr: OSPF_METRIC2 { $$ = f_new_dynamic_attr(T_INT, EA_OSPF_METRIC2); } ;
+dynamic_attr: OSPF_TAG { $$ = f_new_dynamic_attr(T_INT, EA_OSPF_TAG); } ;
+dynamic_attr: OSPF_ROUTER_ID { $$ = f_new_dynamic_attr(T_QUAD, EA_OSPF_ROUTER_ID); } ;
CF_CLI_HELP(SHOW OSPF, ..., [[Show information about OSPF protocol]]);
CF_CLI(SHOW OSPF, optproto, [<name>], [[Show information about OSPF protocol]])
diff --git a/proto/ospf/rt.c b/proto/ospf/rt.c
index 3e208023..7cb541d4 100644
--- a/proto/ospf/rt.c
+++ b/proto/ospf/rt.c
@@ -2072,27 +2072,27 @@ again1:
a0.eattrs->attrs[a0.eattrs->count++] = (eattr) {
.id = EA_OSPF_METRIC1,
- .type = EAF_TYPE_INT,
+ .type = T_INT,
.u.data = nf->n.metric1,
};
if (nf->n.type == RTS_OSPF_EXT2)
a0.eattrs->attrs[a0.eattrs->count++] = (eattr) {
.id = EA_OSPF_METRIC2,
- .type = EAF_TYPE_INT,
+ .type = T_INT,
.u.data = nf->n.metric2,
};
if ((nf->n.type == RTS_OSPF_EXT1) || (nf->n.type == RTS_OSPF_EXT2))
a0.eattrs->attrs[a0.eattrs->count++] = (eattr) {
.id = EA_OSPF_TAG,
- .type = EAF_TYPE_INT,
+ .type = T_INT,
.u.data = nf->n.tag,
};
a0.eattrs->attrs[a0.eattrs->count++] = (eattr) {
.id = EA_OSPF_ROUTER_ID,
- .type = EAF_TYPE_ROUTER_ID,
+ .type = T_QUAD,
.u.data = nf->n.rid,
};
diff --git a/proto/radv/config.Y b/proto/radv/config.Y
index f16b897d..0a339cb4 100644
--- a/proto/radv/config.Y
+++ b/proto/radv/config.Y
@@ -336,8 +336,8 @@ radv_sensitive:
| SENSITIVE bool { $$ = $2; }
;
-dynamic_attr: RA_PREFERENCE { $$ = f_new_dynamic_attr(EAF_TYPE_RA_PREFERENCE, T_ENUM_RA_PREFERENCE, EA_RA_PREFERENCE); } ;
-dynamic_attr: RA_LIFETIME { $$ = f_new_dynamic_attr(EAF_TYPE_INT, T_INT, EA_RA_LIFETIME); } ;
+dynamic_attr: RA_PREFERENCE { $$ = f_new_dynamic_attr(T_ENUM_RA_PREFERENCE, EA_RA_PREFERENCE); } ;
+dynamic_attr: RA_LIFETIME { $$ = f_new_dynamic_attr(T_INT, EA_RA_LIFETIME); } ;
CF_CODE
diff --git a/proto/rip/config.Y b/proto/rip/config.Y
index 28ee9609..3934d337 100644
--- a/proto/rip/config.Y
+++ b/proto/rip/config.Y
@@ -190,8 +190,8 @@ rip_iface:
rip_iface_start iface_patt_list_nopx rip_iface_opt_list rip_iface_finish;
-dynamic_attr: RIP_METRIC { $$ = f_new_dynamic_attr(EAF_TYPE_INT, T_INT, EA_RIP_METRIC); } ;
-dynamic_attr: RIP_TAG { $$ = f_new_dynamic_attr(EAF_TYPE_INT, T_INT, EA_RIP_TAG); } ;
+dynamic_attr: RIP_METRIC { $$ = f_new_dynamic_attr(T_INT, EA_RIP_METRIC); } ;
+dynamic_attr: RIP_TAG { $$ = f_new_dynamic_attr(T_INT, EA_RIP_TAG); } ;
CF_CLI_HELP(SHOW RIP, ..., [[Show information about RIP protocol]]);
diff --git a/proto/rip/rip.c b/proto/rip/rip.c
index 5bf1b3e6..e263172c 100644
--- a/proto/rip/rip.c
+++ b/proto/rip/rip.c
@@ -202,17 +202,17 @@ rip_announce_rte(struct rip_proto *p, struct rip_entry *en)
.e = {
{
.id = EA_RIP_METRIC,
- .type = EAF_TYPE_INT,
+ .type = T_INT,
.u.data = rt_metric,
},
{
.id = EA_RIP_TAG,
- .type = EAF_TYPE_INT,
+ .type = T_INT,
.u.data = rt_tag,
},
{
.id = EA_RIP_FROM,
- .type = EAF_TYPE_IFACE,
+ .type = T_IFACE,
.u.ptr = &ea_block.riad.ad,
}
},