From: Maria Matejka Date: Fri, 29 Nov 2024 09:25:59 +0000 (+0100) Subject: Merge commit '1002c35b' into thread-merge-2.16 X-Git-Tag: v3.0.0~50 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=14bc1fc4c18198eb02db5f6a5e57536ea0b9c3cf;p=thirdparty%2Fbird.git Merge commit '1002c35b' into thread-merge-2.16 --- 14bc1fc4c18198eb02db5f6a5e57536ea0b9c3cf diff --cc bird-gdb.py index b277cb0a5,7b31904f1..663ad6875 --- a/bird-gdb.py +++ b/bird-gdb.py @@@ -26,9 -25,10 +26,9 @@@ class BIRDFValPrinter(BIRDPrinter) "T_ENUM_RTS": "i", "T_ENUM_BGP_ORIGIN": "i", "T_ENUM_SCOPE": "i", - "T_ENUM_RTC": "i", "T_ENUM_RTD": "i", "T_ENUM_ROA": "i", - "T_ENUM_NETTYPE": "i", + "T_ENUM_NET_TYPE": "i", "T_ENUM_RA_PREFERENCE": "i", "T_ENUM_AF": "i", "T_IP": "ip", diff --cc filter/test.conf index 78170a5b1,37f93516a..198077d6a --- a/filter/test.conf +++ b/filter/test.conf @@@ -12,120 -12,6 +12,120 @@@ protocol device { attribute bgppath mypath; attribute lclist mylclist; +/* Setting some custom attributes, enough to force BIRD to reallocate the attribute idmap */ +attribute int test_ca_int1; +attribute int test_ca_int2; +attribute int test_ca_int3; +attribute int test_ca_int4; +attribute int test_ca_int5; +attribute int test_ca_int6; +attribute int test_ca_int7; +attribute int test_ca_int8; +attribute int test_ca_int9; +attribute int test_ca_int10; + +attribute ip test_ca_ip1; +attribute ip test_ca_ip2; +attribute ip test_ca_ip3; +attribute ip test_ca_ip4; +attribute ip test_ca_ip5; +attribute ip test_ca_ip6; +attribute ip test_ca_ip7; +attribute ip test_ca_ip8; +attribute ip test_ca_ip9; +attribute ip test_ca_ip10; + +attribute quad test_ca_quad1; +attribute quad test_ca_quad2; +attribute quad test_ca_quad3; +attribute quad test_ca_quad4; +attribute quad test_ca_quad5; +attribute quad test_ca_quad6; +attribute quad test_ca_quad7; +attribute quad test_ca_quad8; +attribute quad test_ca_quad9; +attribute quad test_ca_quad10; + +attribute bgppath test_ca_bgppath1; +attribute bgppath test_ca_bgppath2; +attribute bgppath test_ca_bgppath3; +attribute bgppath test_ca_bgppath4; +attribute bgppath test_ca_bgppath5; +attribute bgppath test_ca_bgppath6; +attribute bgppath test_ca_bgppath7; +attribute bgppath test_ca_bgppath8; +attribute bgppath test_ca_bgppath9; +attribute bgppath test_ca_bgppath10; + +attribute clist test_ca_clist1; +attribute clist test_ca_clist2; +attribute clist test_ca_clist3; +attribute clist test_ca_clist4; +attribute clist test_ca_clist5; +attribute clist test_ca_clist6; +attribute clist test_ca_clist7; +attribute clist test_ca_clist8; +attribute clist test_ca_clist9; +attribute clist test_ca_clist10; + +attribute eclist test_ca_eclist1; +attribute eclist test_ca_eclist2; +attribute eclist test_ca_eclist3; +attribute eclist test_ca_eclist4; +attribute eclist test_ca_eclist5; +attribute eclist test_ca_eclist6; +attribute eclist test_ca_eclist7; +attribute eclist test_ca_eclist8; +attribute eclist test_ca_eclist9; +attribute eclist test_ca_eclist10; + +attribute lclist test_ca_lclist1; +attribute lclist test_ca_lclist2; +attribute lclist test_ca_lclist3; +attribute lclist test_ca_lclist4; +attribute lclist test_ca_lclist5; +attribute lclist test_ca_lclist6; +attribute lclist test_ca_lclist7; +attribute lclist test_ca_lclist8; +attribute lclist test_ca_lclist9; +attribute lclist test_ca_lclist10; + +attribute lclist test_ca_lclist_max1; +attribute lclist test_ca_lclist_max2; +attribute lclist test_ca_lclist_max3; +attribute lclist test_ca_lclist_max4; +attribute lclist test_ca_lclist_max5; +attribute lclist test_ca_lclist_max6; +attribute lclist test_ca_lclist_max7; +attribute lclist test_ca_lclist_max8; +attribute lclist test_ca_lclist_max9; +attribute lclist test_ca_lclist_max10; +attribute lclist test_ca_lclist_max11; +attribute lclist test_ca_lclist_max12; +attribute lclist test_ca_lclist_max13; +attribute lclist test_ca_lclist_max14; +attribute lclist test_ca_lclist_max15; +attribute lclist test_ca_lclist_max16; +attribute lclist test_ca_lclist_max17; +attribute lclist test_ca_lclist_max18; +attribute lclist test_ca_lclist_max19; +attribute lclist test_ca_lclist_max20; +attribute lclist test_ca_lclist_max21; + +attribute enum rts test_ca_rts; +attribute enum rtd test_ca_rtd; +attribute enum scope test_ca_scope; +attribute enum roa test_ca_roa; +attribute enum aspa test_ca_aspa; +attribute enum af test_ca_af; - attribute enum nettype test_ca_nettype; ++attribute enum net_type test_ca_nettype; +attribute enum bgp_origin test_ca_bgp_origin; +attribute enum ra_preference test_ca_ra_preference; +attribute enum mpls_policy test_ca_mpls_policy; - attribute enum nettype set test_ca_nettype_set; ++attribute enum net_type set test_ca_nettype_set; + +/* Uncomment this to get an error */ +#attribute int bgp_path; /* * Common definitions and functions @@@ -607,12 -482,12 +607,12 @@@ function t_enum( enum ra_preference ev8 = RA_PREF_LOW; enum mpls_policy ev9 = MPLS_POLICY_STATIC; - enum nettype set es = [NET_IP6, NET_VPN6]; + enum net_type set es = [NET_IP6, NET_VPN6]; - bt_assert(format(RTS_STATIC) = "(enum 30)1"); - bt_assert(format(NET_IP4) = "(enum 36)1"); - bt_assert(format(NET_VPN6) = "(enum 36)4"); - bt_assert(format(ev6) = "(enum 36)2"); + bt_assert(format(RTS_STATIC) = "(enum 31)1"); + bt_assert(format(NET_IP4) = "(enum 3b)1"); + bt_assert(format(NET_VPN6) = "(enum 3b)4"); + bt_assert(format(ev6) = "(enum 3b)2"); bt_assert(ev0 = RTS_STATIC); bt_assert(ev6 = NET_IP6); diff --cc lib/type.h index 4d9a37fae,000000000..e42c67283 mode 100644,000000..100644 --- a/lib/type.h +++ b/lib/type.h @@@ -1,131 -1,0 +1,131 @@@ +/* + * BIRD Internet Routing Daemon -- Internal Data Types + * + * (c) 2022 Maria Matejka + * + * Can be freely distributed and used under the terms of the GNU GPL. + */ + +#ifndef _BIRD_TYPE_H_ +#define _BIRD_TYPE_H_ + +#include "lib/birdlib.h" +#include "lib/attrs.h" + +union bval { +#define BVAL_ITEMS \ + struct { \ + u32 data; /* Integer type inherited from eattrs */ \ + PADDING(data, 0, 4); /* Must be padded on 64-bits */ \ + }; \ + struct { \ + u32 i; /* Integer type inherited from filters */ \ + PADDING(i, 0, 4); /* Must be padded on 64-bits */ \ + }; \ + const struct adata *ptr; /* Generic attribute data inherited from eattrs */ \ + const struct adata *ad; /* Generic attribute data inherited from filters */ \ + const void * v_ptr; /* Stored pointer */ \ + + BVAL_ITEMS; +}; + +union bval_long { + union bval bval; /* For direct assignments */ + BVAL_ITEMS; /* For item-wise access */ + + u64 ec; + lcomm lc; + ip_addr ip; + const net_addr *net; + const char *s; + const struct adata *bs; + const struct f_tree *t; + const struct f_trie *ti; + const struct f_path_mask *path_mask; + struct f_path_mask_item pmi; + struct rte *rte; + struct rte_block { + struct rte **rte; + uint len; + } rte_block; +}; + + +/* Internal types */ +enum btype { +/* Nothing. Simply nothing. */ + T_VOID = 0, + T_NONE = 0xff, + +/* Something but inaccessible. */ + T_OPAQUE = 0x02, /* Opaque byte string (not filterable) */ + T_IFACE = 0x0c, /* Pointer to an interface (inside adata) */ + T_ROUTES_BLOCK = 0x68, /* Block of route pointers */ + T_ROUTE = 0x6a, /* One route pointer */ + T_NEXTHOP_LIST = 0x6c, /* The whole nexthop block */ + T_HOSTENTRY = 0x6e, /* Hostentry with possible MPLS labels */ + +/* Types shared with eattrs */ + T_INT = 0x01, /* 32-bit unsigned integer number */ + T_IP = 0x04, /* IP address */ + T_QUAD = 0x05, /* Router ID (IPv4 address) */ + T_PATH = 0x06, /* BGP AS path (encoding per RFC 1771:4.3) */ + T_CLIST = 0x0a, /* Set of u32's (e.g., a community list) */ + T_ECLIST = 0x0e, /* Set of pairs of u32's - ext. community list */ + T_LCLIST = 0x08, /* Set of triplets of u32's - large community list */ + T_STRING = 0x10, + T_PTR = 0x11, /* Void pointer */ + + T_ENUM_BGP_ORIGIN = 0x13, /* BGP Origin enum */ + T_ENUM_RA_PREFERENCE = 0x15, /* RA Preference enum */ + T_ENUM_FLOWSPEC_VALID = 0x17, /* Flowspec validation result */ + +#define EAF_EMBEDDED 0x01 /* Data stored in eattr.u.data (part of type spec) */ + /* Otherwise, attribute data is adata */ + +/* Other user visible types which fit in int */ + T_BOOL = 0xa0, + T_PAIR = 0xa4, /* Notice that pair is stored as integer: first << 16 | second */ + +/* Put enumerational types in 0x20..0x3f range */ + T_ENUM_LO = 0x12, + T_ENUM_HI = 0x3f, + + T_ENUM_ASPA = 0x2f, /* ASPA validation result */ + T_ENUM_RTS = 0x31, + T_ENUM_SCOPE = 0x33, + T_ENUM_MPLS_POLICY = 0x35, + T_ENUM_RTD = 0x37, + T_ENUM_ROA = 0x39, - T_ENUM_NETTYPE = 0x3b, ++ T_ENUM_NET_TYPE = 0x3b, + T_ENUM_AF = 0x3d, + +/* new enums go here */ + +#define T_ENUM T_ENUM_LO ... T_ENUM_HI + +/* Bigger ones */ + T_NET = 0xb0, + T_PATH_MASK = 0xb8, /* mask for BGP path */ + T_EC = 0xbc, /* Extended community value, u64 */ + T_LC = 0xc0, /* Large community value, lcomm */ + T_RD = 0xc4, /* Route distinguisher for VPN addresses */ + T_PATH_MASK_ITEM = 0xc8, /* Path mask item for path mask constructors */ + T_BYTESTRING = 0xcc, + T_ROA_AGGREGATED = 0xd0, /* ASN and maxlen tuple list */ + + + T_SET = 0x80, + T_PREFIX_SET = 0x84, + +/* protocol */ + T_ENUM_STATE = 0xd1, + T_BTIME = 0xd4, +} PACKED; + +typedef enum btype btype; + +STATIC_ASSERT(sizeof(btype) == sizeof(byte)); + + +#endif