[PATCH] odhcpd: fix compilation with GCC10

Rosen Penev rosenp at gmail.com
Mon Jun 22 00:37:36 EDT 2020


GCC10 mandates the C++ one definition rule, which breaks on multiple
definitions of config. Add the appropriate extern declarations.

Signed-off-by: Rosen Penev <rosenp at gmail.com>
---
 src/dhcpv6-ia.c | 2 ++
 src/odhcpd.c    | 2 +-
 src/odhcpd.h    | 2 +-
 3 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/dhcpv6-ia.c b/src/dhcpv6-ia.c
index 38a901b..60368cb 100644
--- a/src/dhcpv6-ia.c
+++ b/src/dhcpv6-ia.c
@@ -39,6 +39,8 @@
     ((iface)->dhcpv6_assignall || (i) == (m) || \
      (addrs)[(i)].prefix > 64)
 
+extern struct config config;
+
 static void dhcpv6_netevent_cb(unsigned long event, struct netevent_handler_info *info);
 static void apply_lease(struct dhcp_assignment *a, bool add);
 static void set_border_assignment_size(struct interface *iface, struct dhcp_assignment *b);
diff --git a/src/odhcpd.c b/src/odhcpd.c
index 26094b1..d781ca7 100644
--- a/src/odhcpd.c
+++ b/src/odhcpd.c
@@ -43,7 +43,7 @@
 #include <libubox/uloop.h>
 #include "odhcpd.h"
 
-
+extern struct config config;
 
 static int ioctl_sock = -1;
 static int urandom_fd = -1;
diff --git a/src/odhcpd.h b/src/odhcpd.h
index 072a148..b0ad8d0 100644
--- a/src/odhcpd.h
+++ b/src/odhcpd.h
@@ -139,7 +139,7 @@ struct config {
 	char *dhcp_cb;
 	char *dhcp_statefile;
 	int log_level;
-} config;
+};
 
 
 struct lease {
-- 
2.26.2


_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
http://lists.infradead.org/mailman/listinfo/openwrt-devel



More information about the openwrt-devel mailing list