Mailing List Archive

[PATCH] pimd: properly declare pimd variables
gcc-10 has changed the default of -fcommon to -fno-common which now
flags some long existing issues.
See https://gcc.gnu.org/gcc-10/porting_to.html

Declare qpim* variables as extern in pimd/pimd.h to avoid:
/usr/bin/ld: pimd.o:./pimd/pimd.h:82: multiple definition of
`qpim_channel_oil_list'; pim_main.o:./pimd/pimd.h:82: first defined here
/usr/bin/ld: pimd.o:./pimd/pimd.h:85: multiple definition of
`qpim_upstream_list'; pim_main.o:./pimd/pimd.h:85: first defined here
/usr/bin/ld: pimd.o:./pimd/pimd.h:103: multiple definition of
`qpim_static_route_list'; pim_main.o:./pimd/pimd.h:103: first defined here
/usr/bin/ld: pimd.o:./pimd/pimd.h:83: multiple definition of
`qpim_all_pim_routers_addr'; pim_main.o:./pimd/pimd.h:83: first defined here
...

Due to that change it was also revealed that qpim_all_pim_routers_addr
was never properly initialized which now needs to be done in the
associated .c file where all the other qpim* variables are initialized.

Signed-off-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
---
pimd/pimd.c | 1 +
pimd/pimd.h | 66 ++++++++++++++++++++++++++---------------------------
2 files changed, 34 insertions(+), 33 deletions(-)

diff --git a/pimd/pimd.c b/pimd/pimd.c
index 97fb2233..f8ac4ef1 100644
--- a/pimd/pimd.c
+++ b/pimd/pimd.c
@@ -50,6 +50,7 @@ int64_t qpim_mroute_socket_creation = 0; /* timestamp of creat
struct thread *qpim_mroute_socket_reader = 0;
int qpim_mroute_oif_highest_vif_index = -1;
struct list *qpim_channel_oil_list = 0;
+struct in_addr qpim_all_pim_routers_addr = {};
int qpim_t_periodic = PIM_DEFAULT_T_PERIODIC; /* Period between Join/Prune Messages */
struct list *qpim_upstream_list = 0;
struct zclient *qpim_zclient_update = 0;
diff --git a/pimd/pimd.h b/pimd/pimd.h
index 9a7e6058..8b3496fd 100644
--- a/pimd/pimd.h
+++ b/pimd/pimd.h
@@ -68,39 +68,39 @@
#define PIM_MASK_PIM_J_P (1 << 12)
#define PIM_MASK_STATIC (1 << 13)

-const char *const PIM_ALL_SYSTEMS;
-const char *const PIM_ALL_ROUTERS;
-const char *const PIM_ALL_PIM_ROUTERS;
-const char *const PIM_ALL_IGMP_ROUTERS;
-
-struct thread_master *master;
-uint32_t qpim_debugs;
-int qpim_mroute_socket_fd;
-int64_t qpim_mroute_socket_creation; /* timestamp of creation */
-struct thread *qpim_mroute_socket_reader;
-int qpim_mroute_oif_highest_vif_index;
-struct list *qpim_channel_oil_list; /* list of struct channel_oil */
-struct in_addr qpim_all_pim_routers_addr;
-int qpim_t_periodic; /* Period between Join/Prune Messages */
-struct list *qpim_upstream_list; /* list of struct pim_upstream */
-struct zclient *qpim_zclient_update;
-struct zclient *qpim_zclient_lookup;
-struct pim_assert_metric qpim_infinite_assert_metric;
-long qpim_rpf_cache_refresh_delay_msec;
-struct thread *qpim_rpf_cache_refresher;
-int64_t qpim_rpf_cache_refresh_requests;
-int64_t qpim_rpf_cache_refresh_events;
-int64_t qpim_rpf_cache_refresh_last;
-struct in_addr qpim_inaddr_any;
-struct list *qpim_ssmpingd_list; /* list of struct ssmpingd_sock */
-struct in_addr qpim_ssmpingd_group_addr;
-int64_t qpim_scan_oil_events;
-int64_t qpim_scan_oil_last;
-int64_t qpim_mroute_add_events;
-int64_t qpim_mroute_add_last;
-int64_t qpim_mroute_del_events;
-int64_t qpim_mroute_del_last;
-struct list *qpim_static_route_list; /* list of routes added statically */
+extern const char *const PIM_ALL_SYSTEMS;
+extern const char *const PIM_ALL_ROUTERS;
+extern const char *const PIM_ALL_PIM_ROUTERS;
+extern const char *const PIM_ALL_IGMP_ROUTERS;
+
+extern struct thread_master *master;
+extern uint32_t qpim_debugs;
+extern int qpim_mroute_socket_fd;
+extern int64_t qpim_mroute_socket_creation; /* timestamp of creation */
+extern struct thread *qpim_mroute_socket_reader;
+extern int qpim_mroute_oif_highest_vif_index;
+extern struct list *qpim_channel_oil_list; /* list of struct channel_oil */
+extern struct in_addr qpim_all_pim_routers_addr;
+extern int qpim_t_periodic; /* Period between Join/Prune Messages */
+extern struct list *qpim_upstream_list; /* list of struct pim_upstream */
+extern struct zclient *qpim_zclient_update;
+extern struct zclient *qpim_zclient_lookup;
+extern struct pim_assert_metric qpim_infinite_assert_metric;
+extern long qpim_rpf_cache_refresh_delay_msec;
+extern struct thread *qpim_rpf_cache_refresher;
+extern int64_t qpim_rpf_cache_refresh_requests;
+extern int64_t qpim_rpf_cache_refresh_events;
+extern int64_t qpim_rpf_cache_refresh_last;
+extern struct in_addr qpim_inaddr_any;
+extern struct list *qpim_ssmpingd_list; /* list of struct ssmpingd_sock */
+extern struct in_addr qpim_ssmpingd_group_addr;
+extern int64_t qpim_scan_oil_events;
+extern int64_t qpim_scan_oil_last;
+extern int64_t qpim_mroute_add_events;
+extern int64_t qpim_mroute_add_last;
+extern int64_t qpim_mroute_del_events;
+extern int64_t qpim_mroute_del_last;
+extern struct list *qpim_static_route_list; /* list of routes added statically */

#define PIM_JP_HOLDTIME (qpim_t_periodic * 7 / 2)

--
2.28.0

_______________________________________________
Quagga-dev mailing list
Quagga-dev@lists.quagga.net
https://lists.quagga.net/mailman/listinfo/quagga-dev