diff --git a/zebra/if_netlink.c b/zebra/if_netlink.c index 4201e0fae8c3..3e56d571e650 100644 --- a/zebra/if_netlink.c +++ b/zebra/if_netlink.c @@ -64,8 +64,7 @@ #include "zebra/netconf_netlink.h" #include "zebra/zebra_trace.h" #include "zebra/zebra_evpn_arp_nd.h" - -extern struct zebra_privs_t zserv_privs; +#include "zebra/zebra_privs.h" /* Utility function to parse hardware link-layer address and update ifp */ static void netlink_interface_update_hw_addr(struct rtattr **tb, diff --git a/zebra/ioctl.c b/zebra/ioctl.c index a35784cd36e4..4a61fd1f480a 100644 --- a/zebra/ioctl.c +++ b/zebra/ioctl.c @@ -22,13 +22,12 @@ #include "zebra/interface.h" #include "zebra/zebra_errors.h" #include "zebra/debug.h" +#include "zebra/zebra_privs.h" #ifdef HAVE_BSD_LINK_DETECT #include #endif /* HAVE_BSD_LINK_DETECT*/ -extern struct zebra_privs_t zserv_privs; - /* clear and set interface name string */ void ifreq_set_name(struct ifreq *ifreq, struct interface *ifp) { diff --git a/zebra/ipforward_proc.c b/zebra/ipforward_proc.c index 08fbfede42af..1691d7bb37c5 100644 --- a/zebra/ipforward_proc.c +++ b/zebra/ipforward_proc.c @@ -12,8 +12,7 @@ #include "privs.h" #include "zebra/ipforward.h" - -extern struct zebra_privs_t zserv_privs; +#include "zebra/zebra_privs.h" static const char proc_net_snmp[] = "/proc/net/snmp"; diff --git a/zebra/ipforward_sysctl.c b/zebra/ipforward_sysctl.c index bc9d12b5225a..39cb91cd13b5 100644 --- a/zebra/ipforward_sysctl.c +++ b/zebra/ipforward_sysctl.c @@ -14,9 +14,9 @@ #include "log.h" #include "lib_errors.h" -#define MIB_SIZ 4 +#include "zebra/zebra_privs.h" -extern struct zebra_privs_t zserv_privs; +#define MIB_SIZ 4 /* IPv4 forwarding control MIB. */ int mib[MIB_SIZ] = {CTL_NET, PF_INET, IPPROTO_IP, IPCTL_FORWARDING}; diff --git a/zebra/irdp_main.c b/zebra/irdp_main.c index 349ae1a19191..1bf6d7856f84 100644 --- a/zebra/irdp_main.c +++ b/zebra/irdp_main.c @@ -51,11 +51,9 @@ #include "sockunion.h" #include "log.h" #include "network.h" +#include "zebra/zebra_privs.h" /* GLOBAL VARS */ - -extern struct zebra_privs_t zserv_privs; - struct event *t_irdp_raw; /* Timer interval of irdp. */ diff --git a/zebra/kernel_netlink.c b/zebra/kernel_netlink.c index 84aabc425456..8815f7a148d8 100644 --- a/zebra/kernel_netlink.c +++ b/zebra/kernel_netlink.c @@ -40,6 +40,7 @@ #include "zebra/netconf_netlink.h" #include "zebra/zebra_errors.h" #include "zebra/ge_netlink.h" +#include "zebra/zebra_privs.h" #ifndef SO_RCVBUFFORCE #define SO_RCVBUFFORCE (33) @@ -168,8 +169,6 @@ static const struct message rttype_str[] = {{RTN_UNSPEC, "none"}, extern struct event_loop *master; -extern struct zebra_privs_t zserv_privs; - DEFINE_MTYPE_STATIC(ZEBRA, NL_BUF, "Zebra Netlink buffers"); /* Hashtable and mutex to allow lookup of nlsock structs by socket/fd value. diff --git a/zebra/kernel_socket.c b/zebra/kernel_socket.c index 5cfbe7a896dd..137853b759bc 100644 --- a/zebra/kernel_socket.c +++ b/zebra/kernel_socket.c @@ -35,8 +35,7 @@ #include "zebra/rib.h" #include "zebra/zebra_errors.h" #include "zebra/zebra_ptm.h" - -extern struct zebra_privs_t zserv_privs; +#include "zebra/zebra_privs.h" /* * Historically, the BSD routing socket has aligned data following a diff --git a/zebra/netconf_netlink.c b/zebra/netconf_netlink.c index 002d2c7bf65d..7196836bda1a 100644 --- a/zebra/netconf_netlink.c +++ b/zebra/netconf_netlink.c @@ -22,6 +22,7 @@ #include "zebra/kernel_netlink.h" #include "zebra/netconf_netlink.h" #include "zebra/debug.h" +#include "zebra/zebra_privs.h" static struct rtattr *netconf_rta(struct netconfmsg *ncm) { @@ -175,7 +176,6 @@ int netlink_request_netconf(int sockfd) return netlink_request(nls, &req); } -extern struct zebra_privs_t zserv_privs; /* * Currently netconf has no ability to set from netlink. * So we've received a request to do this work in the data plane. diff --git a/zebra/rt_socket.c b/zebra/rt_socket.c index 0bfcd518cade..54db65b203c6 100644 --- a/zebra/rt_socket.c +++ b/zebra/rt_socket.c @@ -28,8 +28,7 @@ #include "zebra/kernel_socket.h" #include "zebra/zebra_mpls.h" #include "zebra/zebra_errors.h" - -extern struct zebra_privs_t zserv_privs; +#include "zebra/zebra_privs.h" #ifdef __OpenBSD__ static int kernel_rtm_add_labels(struct mpls_label_stack *nh_label, diff --git a/zebra/rtadv.c b/zebra/rtadv.c index 8f6713517d35..8e424e728f67 100644 --- a/zebra/rtadv.c +++ b/zebra/rtadv.c @@ -30,8 +30,7 @@ #include "zebra/zebra_vrf.h" #include "zebra/zebra_errors.h" #include "zebra/zebra_router.h" - -extern struct zebra_privs_t zserv_privs; +#include "zebra/zebra_privs.h" static uint32_t interfaces_configured_for_ra_from_bgp; #define RTADV_ADATA_SIZE 1024 diff --git a/zebra/subdir.am b/zebra/subdir.am index b8edb6a55071..b015a17fb5b8 100644 --- a/zebra/subdir.am +++ b/zebra/subdir.am @@ -181,6 +181,7 @@ noinst_HEADERS += \ zebra/zebra_nhg_private.h \ zebra/zebra_ns.h \ zebra/zebra_opaque.h \ + zebra/zebra_privs.h \ zebra/zebra_pbr.h \ zebra/zebra_ptm.h \ zebra/zebra_ptm_redistribute.h \ diff --git a/zebra/zebra_evpn_arp_nd.c b/zebra/zebra_evpn_arp_nd.c index 3078ccc62b1c..e3c1b361e2c2 100644 --- a/zebra/zebra_evpn_arp_nd.c +++ b/zebra/zebra_evpn_arp_nd.c @@ -35,9 +35,9 @@ struct ethhdr; #include "zebra_evpn_mac.h" #include "zebra_evpn_mh.h" #include "zebra_evpn_arp_nd.h" +#include "zebra_privs.h" struct zebra_evpn_arp_nd_info zevpn_arp_nd_info; -extern struct zebra_privs_t zserv_privs; #ifdef GNU_LINUX #define DO_NOT_CRASH_COMPILER 0 diff --git a/zebra/zebra_mpls_openbsd.c b/zebra/zebra_mpls_openbsd.c index 85a53dd4c5a3..3295ac423a17 100644 --- a/zebra/zebra_mpls_openbsd.c +++ b/zebra/zebra_mpls_openbsd.c @@ -21,8 +21,7 @@ #include "interface.h" #include "log.h" #include "lib_errors.h" - -extern struct zebra_privs_t zserv_privs; +#include "zebra/zebra_privs.h" struct { uint32_t rtseq; diff --git a/zebra/zebra_netns_notify.c b/zebra/zebra_netns_notify.c index 3ac4fdd73716..0d83846987f7 100644 --- a/zebra/zebra_netns_notify.c +++ b/zebra/zebra_netns_notify.c @@ -32,6 +32,7 @@ #include "zebra_netns_id.h" #include "zebra_errors.h" #include "interface.h" +#include "zebra_privs.h" #ifdef HAVE_NETLINK diff --git a/zebra/zebra_netns_notify.h b/zebra/zebra_netns_notify.h index c701b0f8ac23..c62a8f3a5827 100644 --- a/zebra/zebra_netns_notify.h +++ b/zebra/zebra_netns_notify.h @@ -15,8 +15,6 @@ extern void zebra_ns_notify_init(void); extern void zebra_ns_notify_parse(void); extern void zebra_ns_notify_close(void); -extern struct zebra_privs_t zserv_privs; - #ifdef __cplusplus } #endif diff --git a/zebra/zebra_ns.c b/zebra/zebra_ns.c index 803d8f0034c0..bb5f2cae5c36 100644 --- a/zebra/zebra_ns.c +++ b/zebra/zebra_ns.c @@ -24,8 +24,7 @@ #include "table_manager.h" #include "zebra_errors.h" #include "zebra_dplane.h" - -extern struct zebra_privs_t zserv_privs; +#include "zebra_privs.h" DEFINE_MTYPE_STATIC(ZEBRA, ZEBRA_NS, "Zebra Name Space"); diff --git a/zebra/zserv.c b/zebra/zserv.c index 07e399664316..07a0f451eae5 100644 --- a/zebra/zserv.c +++ b/zebra/zserv.c @@ -50,10 +50,9 @@ #include "zebra/zserv.h" /* for zserv */ #include "zebra/zebra_router.h" #include "zebra/zebra_errors.h" /* for error messages */ +#include "zebra/zebra_privs.h" /* clang-format on */ -/* privileges */ -extern struct zebra_privs_t zserv_privs; /* The listener socket for clients connecting to us */ static int zsock;