]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
Filter: Initialize route attribute flags properly
authorOndrej Zajicek <santiago@crfreenet.org>
Mon, 1 Apr 2024 00:53:25 +0000 (02:53 +0200)
committerOndrej Zajicek <santiago@crfreenet.org>
Mon, 1 Apr 2024 00:53:25 +0000 (02:53 +0200)
Move 'flags' field back to ea_class, so filtering code can use it to
initialize route attribute flags when set by filters.

filter/f-inst.c
lib/route.h
proto/bgp/attrs.c

index 6a0cdfdebf58d9c1b34088bba3e5c853baddbe13..2fed0543bb123b389dc2db0e5cb8b1d44841ad0d 100644 (file)
 
       case T_IP:
        a = ea_set_attr(&fs->rte->attrs,
-           EA_LITERAL_STORE_ADATA(da, 0, &v1.val.ip, sizeof(ip_addr)));
+           EA_LITERAL_STORE_ADATA(da, da->flags, &v1.val.ip, sizeof(ip_addr)));
        break;
 
       case T_STRING:
        a = ea_set_attr(&fs->rte->attrs,
-           EA_LITERAL_STORE_ADATA(da, 0, v1.val.s, strlen(v1.val.s) + 1));
+           EA_LITERAL_STORE_ADATA(da, da->flags, v1.val.s, strlen(v1.val.s) + 1));
        break;
 
       default:
        a = ea_set_attr(&fs->rte->attrs,
-           EA_LITERAL_GENERIC(da->id, da->type, 0, .u = v1.val.bval));
+           EA_LITERAL_GENERIC(da->id, da->type, da->flags, .u = v1.val.bval));
        break;
       }
 
index 61f7f34280bf4a728272787a098285ba247271fa..07ef898f45d56f540ae2a2f79fab05a2b4f733c2 100644 (file)
@@ -259,6 +259,7 @@ struct ea_class {
   uint id;                             /* Autoassigned attribute ID */ \
   uint uc;                             /* Reference count */ \
   btype type;                          /* Data type ID */ \
+  u16 flags;                           /* Protocol-dependent flags */ \
   uint readonly:1;                     /* This attribute can't be changed by filters */ \
   uint conf:1;                         /* Requested by config */ \
   uint hidden:1;                       /* Technical attribute, do not show, do not expose to filters */ \
index 6c4d9dcd921c56707b4b8390579c7763ce873064..78acfc69a4fc3a6a11da255d4816ab458b2ac39b 100644 (file)
@@ -70,7 +70,6 @@ union bgp_attr_desc {
   struct ea_class class;
   struct {
     EA_CLASS_INSIDE;
-    uint flags;
     void (*export)(struct bgp_export_state *s, eattr *a);
     int  (*encode)(struct bgp_write_state *s, eattr *a, byte *buf, uint size);
     void (*decode)(struct bgp_parse_state *s, uint code, uint flags, byte *data, uint len, ea_list **to);