From 602595fe10b67da87bdc313b4bf3c36654df637f Mon Sep 17 00:00:00 2001 From: Maria Matejka Date: Fri, 7 Jun 2024 21:41:17 +0200 Subject: [PATCH] Attributes: cleanup Dropping EAF_TYPE__MAX and adding a check for forgotten ea class registration --- filter/f-inst.c | 3 --- lib/route.h | 3 +++ lib/type.h | 1 - 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/filter/f-inst.c b/filter/f-inst.c index 2fed0543..6c3724ad 100644 --- a/filter/f-inst.c +++ b/filter/f-inst.c @@ -907,9 +907,6 @@ { struct eattr *a; - if (da->type >= EAF_TYPE__MAX) - bug("Unsupported attribute type"); - switch (da->type) { case T_IFACE: case T_OPAQUE: diff --git a/lib/route.h b/lib/route.h index 0ef97f01..e7307713 100644 --- a/lib/route.h +++ b/lib/route.h @@ -380,6 +380,9 @@ void ea_list_copy(ea_list *dest, ea_list *src, uint size); static inline eattr * ea_set_attr(ea_list **to, eattr a) { + if (!a.id) + bug("You have forgotten to register your EA class"); + EA_LOCAL_LIST(1) *ea = tmp_alloc(sizeof(*ea)); *ea = (typeof(*ea)) { .l.flags = EALF_SORTED, diff --git a/lib/type.h b/lib/type.h index 2edaa2e4..c7b116c5 100644 --- a/lib/type.h +++ b/lib/type.h @@ -78,7 +78,6 @@ enum btype { T_ENUM_RA_PREFERENCE = 0x15, /* RA Preference enum */ T_ENUM_FLOWSPEC_VALID = 0x17, /* Flowspec validation result */ -#define EAF_TYPE__MAX 0x1f #define EAF_EMBEDDED 0x01 /* Data stored in eattr.u.data (part of type spec) */ /* Otherwise, attribute data is adata */