Workaround for gcc3 - the use of anonymous unions now makes it complain
authormiod <miod@openbsd.org>
Thu, 22 Feb 2024 06:45:22 +0000 (06:45 +0000)
committermiod <miod@openbsd.org>
Thu, 22 Feb 2024 06:45:22 +0000 (06:45 +0000)
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
usr.sbin/bgpd/util.c

index d36bcb3..62acf44 100644 (file)
@@ -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 <henning@openbsd.org>
@@ -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);
                        }
index eb9b610..0f9e89b 100644 (file)
@@ -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 <claudio@openbsd.org>
@@ -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)