From 2fd9f52d7a687c84870a46f64a8a594311aa7ef3 Mon Sep 17 00:00:00 2001 From: miod Date: Thu, 22 Feb 2024 06:45:22 +0000 Subject: [PATCH] Workaround for gcc3 - the use of anonymous unions now makes it complain when named initializers use fields within these anonymous unions. Hopefully a short-term bandaid until the appropriate changes are identified and backported to gcc3. ok claudio@ --- usr.sbin/bgpd/rde.c | 9 ++++++++- usr.sbin/bgpd/util.c | 9 +++++++-- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/usr.sbin/bgpd/rde.c b/usr.sbin/bgpd/rde.c index d36bcb39fae..62acf44f070 100644 --- a/usr.sbin/bgpd/rde.c +++ b/usr.sbin/bgpd/rde.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rde.c,v 1.622 2024/02/03 00:11:34 jsg Exp $ */ +/* $OpenBSD: rde.c,v 1.623 2024/02/22 06:45:22 miod Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer @@ -1240,10 +1240,17 @@ rde_dispatch_imsg_rtr(struct imsgbuf *imsgbuf) if (imsg_get_data(&imsg, &roa, sizeof(roa)) == -1) fatalx("IMSG_RECONF_ROA_ITEM bad len"); if (trie_roa_add(&roa_new.th, &roa) != 0) { +#if defined(__GNUC__) && __GNUC__ < 4 + struct bgpd_addr p = { + .aid = roa.aid + }; + p.v6 = roa.prefix.inet6; +#else struct bgpd_addr p = { .aid = roa.aid, .v6 = roa.prefix.inet6 }; +#endif log_warnx("trie_roa_add %s/%u failed", log_addr(&p), roa.prefixlen); } diff --git a/usr.sbin/bgpd/util.c b/usr.sbin/bgpd/util.c index eb9b61080ec..0f9e89bc248 100644 --- a/usr.sbin/bgpd/util.c +++ b/usr.sbin/bgpd/util.c @@ -1,4 +1,4 @@ -/* $OpenBSD: util.c,v 1.81 2024/02/02 16:14:51 claudio Exp $ */ +/* $OpenBSD: util.c,v 1.82 2024/02/22 06:45:22 miod Exp $ */ /* * Copyright (c) 2006 Claudio Jeker @@ -178,8 +178,13 @@ const char * log_roa(struct roa *roa) { static char buf[256]; - struct bgpd_addr addr = { .aid = roa->aid, .v6 = roa->prefix.inet6 }; char maxbuf[32]; +#if defined(__GNUC__) && __GNUC__ < 4 + struct bgpd_addr addr = { .aid = roa->aid }; + addr.v6 = roa->prefix.inet6; +#else + struct bgpd_addr addr = { .aid = roa->aid, .v6 = roa->prefix.inet6 }; +#endif maxbuf[0] = '\0'; if (roa->prefixlen != roa->maxlen) -- 2.20.1