From 07757b8a0c192f116afba3e846a01d10657efdc2 Mon Sep 17 00:00:00 2001 From: Ondrej Zajicek Date: Mon, 1 Apr 2024 02:53:25 +0200 Subject: [PATCH] Filter: Initialize route attribute flags properly 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 | 6 +++--- lib/route.h | 1 + proto/bgp/attrs.c | 1 - 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/filter/f-inst.c b/filter/f-inst.c index 6a0cdfde..2fed0543 100644 --- a/filter/f-inst.c +++ b/filter/f-inst.c @@ -918,17 +918,17 @@ 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; } diff --git a/lib/route.h b/lib/route.h index 61f7f342..07ef898f 100644 --- a/lib/route.h +++ b/lib/route.h @@ -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 */ \ diff --git a/proto/bgp/attrs.c b/proto/bgp/attrs.c index 6c4d9dcd..78acfc69 100644 --- a/proto/bgp/attrs.c +++ b/proto/bgp/attrs.c @@ -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);