diff options
author | Maria Matejka <mq@ucw.cz> | 2022-03-26 11:56:02 +0100 |
---|---|---|
committer | Maria Matejka <mq@ucw.cz> | 2022-05-04 15:37:41 +0200 |
commit | 0d0f6554a5c233bf2bf830ae319191c4b1808d49 (patch) | |
tree | b90790a9450dc4eaefd1cab522d49221d358a5d9 /nest/rt-attr.c | |
parent | 80272d4b64a38ee6f04a1c4e8566cac3a2293176 (diff) |
Unified attribute and filter types
This commit removes the EAF_TYPE_* namespace completely and also for
route attributes, filter-based types T_* are used. This simplifies
fetching and setting route attributes from filters.
Also, there is now union bval which serves as an universal value holder
instead of private unions held separately by eattr and filter code.
Diffstat (limited to 'nest/rt-attr.c')
-rw-r--r-- | nest/rt-attr.c | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/nest/rt-attr.c b/nest/rt-attr.c index 25548dca..de45dfa1 100644 --- a/nest/rt-attr.c +++ b/nest/rt-attr.c @@ -539,8 +539,8 @@ ea_walk(struct ea_walk_state *s, uint id, uint max) * by calling ea_find() to find the attribute, extracting its value or returning * a provided default if no such attribute is present. */ -uintptr_t -ea_get_int(ea_list *e, unsigned id, uintptr_t def) +u32 +ea_get_int(ea_list *e, unsigned id, u32 def) { eattr *a = ea_find(e, id); if (!a) @@ -950,30 +950,33 @@ ea_show(struct cli *c, const eattr *e) else switch (e->type) { - case EAF_TYPE_INT: + case T_INT: bsprintf(pos, "%u", e->u.data); break; - case EAF_TYPE_OPAQUE: + case T_OPAQUE: opaque_format(ad, pos, end - pos); break; - case EAF_TYPE_IP_ADDRESS: + case T_IP: bsprintf(pos, "%I", *(ip_addr *) ad->data); break; - case EAF_TYPE_ROUTER_ID: + case T_QUAD: bsprintf(pos, "%R", e->u.data); break; - case EAF_TYPE_AS_PATH: + case T_PATH: as_path_format(ad, pos, end - pos); break; - case EAF_TYPE_INT_SET: + case T_CLIST: ea_show_int_set(c, ad, 1, pos, buf, end); return; - case EAF_TYPE_EC_SET: + case T_ECLIST: ea_show_ec_set(c, ad, pos, buf, end); return; - case EAF_TYPE_LC_SET: + case T_LCLIST: ea_show_lc_set(c, ad, pos, buf, end); return; + case T_IFACE: + bsprintf(pos, "%s", ((struct iface *) e->u.ptr)->name); + return; default: bsprintf(pos, "<type %02x>", e->type); } |