Download raw body.
bgpd, use anonymous union in bgpd_addr
This removes the problematic v4 and v6 macros and replaces them
with an anon union.
The pftable.c code is still nasty since pfvar.h has the same horror.
--
:wq Claudio
Index: bgpd.h
===================================================================
RCS file: /cvs/src/usr.sbin/bgpd/bgpd.h,v
diff -u -p -r1.484 bgpd.h
--- bgpd.h 30 Jan 2024 13:50:08 -0000 1.484
+++ bgpd.h 8 Feb 2024 15:13:44 -0000
@@ -197,14 +197,12 @@ struct bgpd_addr {
struct in_addr v4;
struct in6_addr v6;
/* maximum size for a prefix is 256 bits */
- } ba; /* 128-bit address */
+ }; /* 128-bit address */
uint64_t rd; /* route distinguisher for VPN addrs */
uint32_t scope_id; /* iface scope id for v6 */
uint8_t aid;
uint8_t labellen; /* size of the labelstack */
uint8_t labelstack[18]; /* max that makes sense */
-#define v4 ba.v4
-#define v6 ba.v6
};
#define DEFAULT_LISTENER 0x01
Index: pftable.c
===================================================================
RCS file: /cvs/src/usr.sbin/bgpd/pftable.c,v
diff -u -p -r1.17 pftable.c
--- pftable.c 17 Aug 2022 15:15:26 -0000 1.17
+++ pftable.c 8 Feb 2024 15:24:41 -0000
@@ -31,12 +31,9 @@
#include "log.h"
-/* Namespace collision: these are defined in both bgpd.h and pfvar.h */
+/* Namespace collision: these are defined in pfvar.h and bgpd.h */
#undef v4
#undef v6
-#undef addr8
-#undef addr16
-#undef addr32
#include "bgpd.h"
@@ -216,7 +213,7 @@ pftable_add_work(const char *table, stru
pfa = &pft->worklist[pft->naddrs];
memset(pfa, 0, sizeof(*pfa));
- memcpy(&pfa->pfra_u, &addr->ba, (len + 7U) / 8);
+ memcpy(&pfa->pfra_u, &addr->v6, (len + 7U) / 8);
pfa->pfra_af = aid2af(addr->aid);
pfa->pfra_net = len;
bgpd, use anonymous union in bgpd_addr