]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
Attributes: cleanup
authorMaria Matejka <mq@ucw.cz>
Fri, 7 Jun 2024 19:41:17 +0000 (21:41 +0200)
committerMaria Matejka <mq@ucw.cz>
Wed, 12 Jun 2024 07:23:50 +0000 (09:23 +0200)
Dropping EAF_TYPE__MAX and adding a check for forgotten
ea class registration

filter/f-inst.c
lib/route.h
lib/type.h

index 2fed0543bb123b389dc2db0e5cb8b1d44841ad0d..6c3724ad7ffe9464d0291b2cdc2a2c0d93a9d5ca 100644 (file)
     {
       struct eattr *a;
 
-      if (da->type >= EAF_TYPE__MAX)
-       bug("Unsupported attribute type");
-
       switch (da->type) {
       case T_IFACE:
       case T_OPAQUE:
index 0ef97f017f9bee66ce70ea8c142b93e4321c05c7..e73077134180c4d2ccbaf73412271ac61a57941d 100644 (file)
@@ -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,
index 2edaa2e4e179ca82e18f6d4e1633b6e642a89616..c7b116c5dbfc3650c8ff4ddb9844384f2724e560 100644 (file)
@@ -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 */