Add extern to *_main global variable declarations in header files.
- Global variables declared in header files without
the use of the 'extern' keword will result in multiple
instances of the variable to be created by the compiler
-- one for each different source file in which the
the header file is included. This results in wasted
memory allocated in the BSS segments as well as
potentially introducing bugs in the application.
Change-Id: I6ef1790b60a0bd9dd3994f8510723decf258b0cc
Signed-off-by: Dave Wallace <dwallacelf@gmail.com>
diff --git a/src/vnet/cdp/cdp_node.h b/src/vnet/cdp/cdp_node.h
index 7028ddc..21086c0 100644
--- a/src/vnet/cdp/cdp_node.h
+++ b/src/vnet/cdp/cdp_node.h
@@ -95,7 +95,7 @@
vnet_main_t *vnet_main;
} cdp_main_t;
-cdp_main_t cdp_main;
+extern cdp_main_t cdp_main;
/* Packet counters */
#define foreach_cdp_error \
diff --git a/src/vnet/classify/flow_classify.c b/src/vnet/classify/flow_classify.c
index 0a62420..6c067f5 100644
--- a/src/vnet/classify/flow_classify.c
+++ b/src/vnet/classify/flow_classify.c
@@ -14,6 +14,8 @@
*/
#include <vnet/classify/flow_classify.h>
+flow_classify_main_t flow_classify_main;
+
static void
vnet_flow_classify_feature_enable (vlib_main_t * vnm,
flow_classify_main_t * fcm,
diff --git a/src/vnet/classify/flow_classify.h b/src/vnet/classify/flow_classify.h
index 3ae04cd..14430df 100644
--- a/src/vnet/classify/flow_classify.h
+++ b/src/vnet/classify/flow_classify.h
@@ -42,7 +42,7 @@
vnet_config_main_t * vnet_config_main [FLOW_CLASSIFY_N_TABLES];
} flow_classify_main_t;
-flow_classify_main_t flow_classify_main;
+extern flow_classify_main_t flow_classify_main;
int vnet_set_flow_classify_intfc (vlib_main_t * vm, u32 sw_if_index,
u32 ip4_table_index, u32 ip6_table_index,
diff --git a/src/vnet/classify/policer_classify.c b/src/vnet/classify/policer_classify.c
index 569234f..2a4fa62 100644
--- a/src/vnet/classify/policer_classify.c
+++ b/src/vnet/classify/policer_classify.c
@@ -14,6 +14,8 @@
*/
#include <vnet/classify/policer_classify.h>
+policer_classify_main_t policer_classify_main;
+
static void
vnet_policer_classify_feature_enable (vlib_main_t * vnm,
policer_classify_main_t * pcm,
diff --git a/src/vnet/classify/policer_classify.h b/src/vnet/classify/policer_classify.h
index 3065644..6ab424f 100644
--- a/src/vnet/classify/policer_classify.h
+++ b/src/vnet/classify/policer_classify.h
@@ -46,7 +46,7 @@
vnet_config_main_t * vnet_config_main [POLICER_CLASSIFY_N_TABLES];
} policer_classify_main_t;
-policer_classify_main_t policer_classify_main;
+extern policer_classify_main_t policer_classify_main;
int vnet_set_policer_classify_intfc (vlib_main_t * vm, u32 sw_if_index,
u32 ip4_table_index, u32 ip6_table_index,
diff --git a/src/vnet/cop/cop.h b/src/vnet/cop/cop.h
index eb5f1df..ee848ce 100644
--- a/src/vnet/cop/cop.h
+++ b/src/vnet/cop/cop.h
@@ -70,7 +70,7 @@
vnet_main_t * vnet_main;
} cop_main_t;
-cop_main_t cop_main;
+extern cop_main_t cop_main;
extern vlib_node_registration_t cop_input_node;
diff --git a/src/vnet/devices/af_packet/af_packet.c b/src/vnet/devices/af_packet/af_packet.c
index e7bbdfd..d0a241e 100644
--- a/src/vnet/devices/af_packet/af_packet.c
+++ b/src/vnet/devices/af_packet/af_packet.c
@@ -32,6 +32,8 @@
#include <vnet/devices/af_packet/af_packet.h>
+af_packet_main_t af_packet_main;
+
#define AF_PACKET_DEBUG_SOCKET 0
#define AF_PACKET_TX_FRAMES_PER_BLOCK 1024
diff --git a/src/vnet/devices/af_packet/af_packet.h b/src/vnet/devices/af_packet/af_packet.h
index 66e2dea..b095e7f 100644
--- a/src/vnet/devices/af_packet/af_packet.h
+++ b/src/vnet/devices/af_packet/af_packet.h
@@ -56,7 +56,7 @@
mhash_t if_index_by_host_if_name;
} af_packet_main_t;
-af_packet_main_t af_packet_main;
+extern af_packet_main_t af_packet_main;
extern vnet_device_class_t af_packet_device_class;
extern vlib_node_registration_t af_packet_input_node;
diff --git a/src/vnet/devices/netmap/netmap.c b/src/vnet/devices/netmap/netmap.c
index fc49ed6..25a3af7 100644
--- a/src/vnet/devices/netmap/netmap.c
+++ b/src/vnet/devices/netmap/netmap.c
@@ -27,6 +27,8 @@
#include <vnet/ethernet/ethernet.h>
#include <vnet/devices/netmap/netmap.h>
+netmap_main_t netmap_main;
+
static u32
netmap_eth_flag_change (vnet_main_t * vnm, vnet_hw_interface_t * hi,
u32 flags)
diff --git a/src/vnet/devices/netmap/netmap.h b/src/vnet/devices/netmap/netmap.h
index 0473189..29f855f 100644
--- a/src/vnet/devices/netmap/netmap.h
+++ b/src/vnet/devices/netmap/netmap.h
@@ -98,7 +98,7 @@
u32 input_cpu_count;
} netmap_main_t;
-netmap_main_t netmap_main;
+extern netmap_main_t netmap_main;
extern vnet_device_class_t netmap_device_class;
extern vlib_node_registration_t netmap_input_node;
diff --git a/src/vnet/devices/ssvm/ssvm_eth.h b/src/vnet/devices/ssvm/ssvm_eth.h
index f877df3..7f9aaad 100644
--- a/src/vnet/devices/ssvm/ssvm_eth.h
+++ b/src/vnet/devices/ssvm/ssvm_eth.h
@@ -82,7 +82,7 @@
elog_main_t *elog_main;
} ssvm_eth_main_t;
-ssvm_eth_main_t ssvm_eth_main;
+extern ssvm_eth_main_t ssvm_eth_main;
typedef enum
{
diff --git a/src/vnet/dhcp/client.h b/src/vnet/dhcp/client.h
index 509d5d4..68c3d7b 100644
--- a/src/vnet/dhcp/client.h
+++ b/src/vnet/dhcp/client.h
@@ -100,7 +100,7 @@
void * event_callback;
} dhcp_client_add_del_args_t;
-dhcp_client_main_t dhcp_client_main;
+extern dhcp_client_main_t dhcp_client_main;
#define EVENT_DHCP_CLIENT_WAKEUP 1
diff --git a/src/vnet/ethernet/ethernet.h b/src/vnet/ethernet/ethernet.h
index a6846b1..2a3383a 100644
--- a/src/vnet/ethernet/ethernet.h
+++ b/src/vnet/ethernet/ethernet.h
@@ -271,7 +271,7 @@
uword *bm_loopback_instances;
} ethernet_main_t;
-ethernet_main_t ethernet_main;
+extern ethernet_main_t ethernet_main;
always_inline ethernet_type_info_t *
ethernet_get_type_info (ethernet_main_t * em, ethernet_type_t type)
diff --git a/src/vnet/geneve/geneve.h b/src/vnet/geneve/geneve.h
index 2976043..cce57c8 100644
--- a/src/vnet/geneve/geneve.h
+++ b/src/vnet/geneve/geneve.h
@@ -175,7 +175,7 @@
vnet_main_t *vnet_main;
} geneve_main_t;
-geneve_main_t geneve_main;
+extern geneve_main_t geneve_main;
extern vlib_node_registration_t geneve4_input_node;
extern vlib_node_registration_t geneve6_input_node;
diff --git a/src/vnet/gre/gre.h b/src/vnet/gre/gre.h
index ad3e025..9c12eb4 100644
--- a/src/vnet/gre/gre.h
+++ b/src/vnet/gre/gre.h
@@ -195,7 +195,7 @@
return p ? vec_elt_at_index (em->protocol_infos, p[0]) : 0;
}
-gre_main_t gre_main;
+extern gre_main_t gre_main;
/* Register given node index to take input for given gre type. */
void
diff --git a/src/vnet/ip/ip4_source_and_port_range_check.c b/src/vnet/ip/ip4_source_and_port_range_check.c
index 4829079..d1f18dd 100644
--- a/src/vnet/ip/ip4_source_and_port_range_check.c
+++ b/src/vnet/ip/ip4_source_and_port_range_check.c
@@ -18,6 +18,8 @@
#include <vnet/fib/fib_table.h>
#include <vnet/fib/ip4_fib.h>
+source_range_check_main_t source_range_check_main;
+
/**
* @file
* @brief IPv4 Source and Port Range Checking.
diff --git a/src/vnet/ip/ip_source_and_port_range_check.h b/src/vnet/ip/ip_source_and_port_range_check.h
index fefe5ff..b04fe61 100644
--- a/src/vnet/ip/ip_source_and_port_range_check.h
+++ b/src/vnet/ip/ip_source_and_port_range_check.h
@@ -24,7 +24,7 @@
vnet_main_t *vnet_main;
} source_range_check_main_t;
-source_range_check_main_t source_range_check_main;
+extern source_range_check_main_t source_range_check_main;
typedef enum
{
diff --git a/src/vnet/ip/ping.c b/src/vnet/ip/ping.c
index 0fa537f..f438ce9 100755
--- a/src/vnet/ip/ping.c
+++ b/src/vnet/ip/ping.c
@@ -20,6 +20,8 @@
#include <vnet/fib/fib_entry.h>
#include <vlib/vlib.h>
+ping_main_t ping_main;
+
/**
* @file
* @brief IPv4 and IPv6 ICMP Ping.
diff --git a/src/vnet/ip/ping.h b/src/vnet/ip/ping.h
index b1b71f6..3f7488f 100644
--- a/src/vnet/ip/ping.h
+++ b/src/vnet/ip/ping.h
@@ -56,7 +56,7 @@
ping_run_t *ping_run_by_icmp_id;
} ping_main_t;
-ping_main_t ping_main;
+extern ping_main_t ping_main;
#define PING_DEFAULT_DATA_LEN 60
#define PING_DEFAULT_INTERVAL 1.0
diff --git a/src/vnet/ipsec-gre/ipsec_gre.h b/src/vnet/ipsec-gre/ipsec_gre.h
index a2ca64b..5d56b4e 100644
--- a/src/vnet/ipsec-gre/ipsec_gre.h
+++ b/src/vnet/ipsec-gre/ipsec_gre.h
@@ -78,7 +78,7 @@
vnet_main_t *vnet_main; /**< convenience */
} ipsec_gre_main_t;
-ipsec_gre_main_t ipsec_gre_main;
+extern ipsec_gre_main_t ipsec_gre_main;
extern vlib_node_registration_t ipsec_gre_input_node;
extern vnet_device_class_t ipsec_gre_device_class;
diff --git a/src/vnet/ipsec/esp.h b/src/vnet/ipsec/esp.h
index 98db701..bc67f9d 100644
--- a/src/vnet/ipsec/esp.h
+++ b/src/vnet/ipsec/esp.h
@@ -80,7 +80,7 @@
esp_main_per_thread_data_t *per_thread_data;
} esp_main_t;
-esp_main_t esp_main;
+extern esp_main_t esp_main;
#define ESP_WINDOW_SIZE (64)
#define ESP_SEQ_MAX (4294967295UL)
diff --git a/src/vnet/ipsec/esp_encrypt.c b/src/vnet/ipsec/esp_encrypt.c
index b2bc4e0..b6ee258 100644
--- a/src/vnet/ipsec/esp_encrypt.c
+++ b/src/vnet/ipsec/esp_encrypt.c
@@ -22,6 +22,7 @@
#include <vnet/ipsec/ipsec.h>
#include <vnet/ipsec/esp.h>
+esp_main_t esp_main;
#define foreach_esp_encrypt_next \
_(DROP, "error-drop") \
diff --git a/src/vnet/ipsec/ikev2.c b/src/vnet/ipsec/ikev2.c
index a3dc7b8..49bae17 100644
--- a/src/vnet/ipsec/ikev2.c
+++ b/src/vnet/ipsec/ikev2.c
@@ -24,6 +24,8 @@
#include <vnet/ipsec/ikev2_priv.h>
#include <openssl/sha.h>
+ikev2_main_t ikev2_main;
+
static int ikev2_delete_tunnel_interface (vnet_main_t * vnm,
ikev2_sa_t * sa,
ikev2_child_sa_t * child);
diff --git a/src/vnet/ipsec/ikev2_priv.h b/src/vnet/ipsec/ikev2_priv.h
index 5a3dc52..b396965 100644
--- a/src/vnet/ipsec/ikev2_priv.h
+++ b/src/vnet/ipsec/ikev2_priv.h
@@ -292,7 +292,7 @@
} ikev2_main_t;
-ikev2_main_t ikev2_main;
+extern ikev2_main_t ikev2_main;
void ikev2_sa_free_proposal_vector (ikev2_sa_proposal_t ** v);
ikev2_sa_transform_t *ikev2_sa_get_td_for_type (ikev2_sa_proposal_t * p,
diff --git a/src/vnet/ipsec/ipsec.c b/src/vnet/ipsec/ipsec.c
index 828bfe8..2adcfd0 100644
--- a/src/vnet/ipsec/ipsec.c
+++ b/src/vnet/ipsec/ipsec.c
@@ -24,6 +24,8 @@
#include <vnet/ipsec/ikev2.h>
#include <vnet/ipsec/esp.h>
+ipsec_main_t ipsec_main;
+
u32
ipsec_get_sa_index_by_sa_id (u32 sa_id)
{
diff --git a/src/vnet/ipsec/ipsec.h b/src/vnet/ipsec/ipsec.h
index f11bc56..222025d 100644
--- a/src/vnet/ipsec/ipsec.h
+++ b/src/vnet/ipsec/ipsec.h
@@ -286,7 +286,7 @@
ipsec_main_callbacks_t cb;
} ipsec_main_t;
-ipsec_main_t ipsec_main;
+extern ipsec_main_t ipsec_main;
extern vlib_node_registration_t esp_encrypt_node;
extern vlib_node_registration_t esp_decrypt_node;
diff --git a/src/vnet/l2/l2_learn.c b/src/vnet/l2/l2_learn.c
index fddab82..6ece1a3 100644
--- a/src/vnet/l2/l2_learn.c
+++ b/src/vnet/l2/l2_learn.c
@@ -29,6 +29,8 @@
#include <vppinfra/error.h>
#include <vppinfra/hash.h>
+l2learn_main_t l2learn_main;
+
/**
* @file
* @brief Ethernet Bridge Learning.
diff --git a/src/vnet/l2/l2_learn.h b/src/vnet/l2/l2_learn.h
index 3aaf48e..c107145 100644
--- a/src/vnet/l2/l2_learn.h
+++ b/src/vnet/l2/l2_learn.h
@@ -48,7 +48,7 @@
#define L2LEARN_DEFAULT_LIMIT (L2FIB_NUM_BUCKETS * 64)
-l2learn_main_t l2learn_main;
+extern l2learn_main_t l2learn_main;
extern vlib_node_registration_t l2fib_mac_age_scanner_process_node;
diff --git a/src/vnet/l2/l2_output.h b/src/vnet/l2/l2_output.h
index 1a73fdf..3b6e480 100644
--- a/src/vnet/l2/l2_output.h
+++ b/src/vnet/l2/l2_output.h
@@ -75,7 +75,7 @@
vnet_main_t *vnet_main;
} l2output_main_t;
-l2output_main_t l2output_main;
+extern l2output_main_t l2output_main;
extern vlib_node_registration_t l2output_node;
diff --git a/src/vnet/l2tp/l2tp.h b/src/vnet/l2tp/l2tp.h
index e7d2892..a91f00c 100644
--- a/src/vnet/l2tp/l2tp.h
+++ b/src/vnet/l2tp/l2tp.h
@@ -91,7 +91,7 @@
ip6_address_t client_address;
} l2t_trace_t;
-l2t_main_t l2t_main;
+extern l2t_main_t l2t_main;
extern vlib_node_registration_t l2t_encap_node;
extern vlib_node_registration_t l2t_decap_node;
extern vlib_node_registration_t l2t_decap_local_node;
diff --git a/src/vnet/lawful-intercept/lawful_intercept.c b/src/vnet/lawful-intercept/lawful_intercept.c
index ef07a33..e48e1cf 100644
--- a/src/vnet/lawful-intercept/lawful_intercept.c
+++ b/src/vnet/lawful-intercept/lawful_intercept.c
@@ -15,6 +15,8 @@
#include <vnet/lawful-intercept/lawful_intercept.h>
+li_main_t li_main;
+
static clib_error_t *
set_li_command_fn (vlib_main_t * vm,
unformat_input_t * input,
diff --git a/src/vnet/lawful-intercept/lawful_intercept.h b/src/vnet/lawful-intercept/lawful_intercept.h
index 89e699f..bcb18af 100644
--- a/src/vnet/lawful-intercept/lawful_intercept.h
+++ b/src/vnet/lawful-intercept/lawful_intercept.h
@@ -33,7 +33,7 @@
vnet_main_t * vnet_main;
} li_main_t;
-li_main_t li_main;
+extern li_main_t li_main;
typedef CLIB_PACKED(struct {
ip4_header_t ip4;
diff --git a/src/vnet/lisp-gpe/lisp_gpe.h b/src/vnet/lisp-gpe/lisp_gpe.h
index 5eafdd5..fe51ed0 100644
--- a/src/vnet/lisp-gpe/lisp_gpe.h
+++ b/src/vnet/lisp-gpe/lisp_gpe.h
@@ -177,7 +177,7 @@
} lisp_gpe_main_t;
/** LISP-GPE global state*/
-lisp_gpe_main_t lisp_gpe_main;
+extern lisp_gpe_main_t lisp_gpe_main;
always_inline lisp_gpe_main_t *
vnet_lisp_gpe_get_main ()
diff --git a/src/vnet/map/map.c b/src/vnet/map/map.c
index 862f7cf..6d18a06 100644
--- a/src/vnet/map/map.c
+++ b/src/vnet/map/map.c
@@ -23,6 +23,8 @@
#include "map.h"
+map_main_t map_main;
+
/*
* This code supports the following MAP modes:
*
diff --git a/src/vnet/map/map.h b/src/vnet/map/map.h
index 208a58e..b9b3353 100644
--- a/src/vnet/map/map.h
+++ b/src/vnet/map/map.h
@@ -329,7 +329,7 @@
u16 port;
} map_trace_t;
-map_main_t map_main;
+extern map_main_t map_main;
extern vlib_node_registration_t ip4_map_node;
extern vlib_node_registration_t ip6_map_node;
diff --git a/src/vnet/misc.c b/src/vnet/misc.c
index 9cfe839..ff85e3d 100644
--- a/src/vnet/misc.c
+++ b/src/vnet/misc.c
@@ -41,6 +41,7 @@
#include <vnet/ip/ip.h>
vnet_main_t vnet_main;
+vnet_main_t **vnet_mains;
vnet_main_t *
vnet_get_main (void)
diff --git a/src/vnet/policer/policer.c b/src/vnet/policer/policer.c
index 5a7b771..3738003 100644
--- a/src/vnet/policer/policer.c
+++ b/src/vnet/policer/policer.c
@@ -16,6 +16,8 @@
#include <vnet/policer/policer.h>
#include <vnet/classify/vnet_classify.h>
+vnet_policer_main_t vnet_policer_main;
+
clib_error_t *
policer_add_del (vlib_main_t * vm,
u8 * name,
diff --git a/src/vnet/policer/policer.h b/src/vnet/policer/policer.h
index 8e2d7c7..b7c1d61 100644
--- a/src/vnet/policer/policer.h
+++ b/src/vnet/policer/policer.h
@@ -44,7 +44,7 @@
vnet_main_t *vnet_main;
} vnet_policer_main_t;
-vnet_policer_main_t vnet_policer_main;
+extern vnet_policer_main_t vnet_policer_main;
typedef enum
{
diff --git a/src/vnet/snap/snap.h b/src/vnet/snap/snap.h
index 7cd453e..08c3a8b 100644
--- a/src/vnet/snap/snap.h
+++ b/src/vnet/snap/snap.h
@@ -165,7 +165,7 @@
return p ? vec_elt_at_index (sm->protocols, p[0]) : 0;
}
-snap_main_t snap_main;
+extern snap_main_t snap_main;
/* Register given node index to take input for given snap type. */
void
diff --git a/src/vnet/span/span.c b/src/vnet/span/span.c
index 2fd9cd8..b7292cf 100644
--- a/src/vnet/span/span.c
+++ b/src/vnet/span/span.c
@@ -21,6 +21,8 @@
#include <vnet/span/span.h>
+span_main_t span_main;
+
typedef enum
{
SPAN_DISABLE = 0,
diff --git a/src/vnet/span/span.h b/src/vnet/span/span.h
index 10de827..ebdb498 100644
--- a/src/vnet/span/span.h
+++ b/src/vnet/span/span.h
@@ -55,7 +55,7 @@
vnet_main_t *vnet_main;
} span_main_t;
-span_main_t span_main;
+extern span_main_t span_main;
typedef struct
{
diff --git a/src/vnet/srp/node.c b/src/vnet/srp/node.c
index 897be25..9123c4c 100644
--- a/src/vnet/srp/node.c
+++ b/src/vnet/srp/node.c
@@ -41,6 +41,8 @@
#include <vnet/ip/ip_packet.h> /* for ip_csum_fold */
#include <vnet/srp/srp.h>
+srp_main_t srp_main;
+
typedef struct {
u8 packet_data[32];
} srp_input_trace_t;
diff --git a/src/vnet/srp/srp.h b/src/vnet/srp/srp.h
index 5288ebe..8f59e06 100644
--- a/src/vnet/srp/srp.h
+++ b/src/vnet/srp/srp.h
@@ -169,7 +169,7 @@
void srp_interface_get_interface_config (u32 hw_if_index, srp_interface_config_t * c);
void srp_interface_set_interface_config (u32 hw_if_index, srp_interface_config_t * c);
-srp_main_t srp_main;
+extern srp_main_t srp_main;
always_inline srp_interface_t *
srp_get_interface_from_vnet_hw_interface (u32 hw_if_index)
diff --git a/src/vnet/tcp/builtin_client.c b/src/vnet/tcp/builtin_client.c
index 4258fc4..76c5c12 100644
--- a/src/vnet/tcp/builtin_client.c
+++ b/src/vnet/tcp/builtin_client.c
@@ -23,6 +23,8 @@
#include <vlibmemory/api.h>
#include <vpp/app/version.h>
+tclient_main_t tclient_main;
+
#define TCP_BUILTIN_CLIENT_DBG (0)
static void
diff --git a/src/vnet/tcp/builtin_client.h b/src/vnet/tcp/builtin_client.h
index 06d239e..400c55c 100644
--- a/src/vnet/tcp/builtin_client.h
+++ b/src/vnet/tcp/builtin_client.h
@@ -106,7 +106,7 @@
ethernet_main_t *ethernet_main;
} tclient_main_t;
-tclient_main_t tclient_main;
+extern tclient_main_t tclient_main;
vlib_node_registration_t tclient_node;
diff --git a/src/vnet/tcp/builtin_proxy.h b/src/vnet/tcp/builtin_proxy.h
index cf707a1..c8cde5f 100644
--- a/src/vnet/tcp/builtin_proxy.h
+++ b/src/vnet/tcp/builtin_proxy.h
@@ -87,7 +87,7 @@
ethernet_main_t *ethernet_main;
} builtin_proxy_main_t;
-builtin_proxy_main_t builtin_proxy_main;
+extern builtin_proxy_main_t builtin_proxy_main;
#endif /* __included_builtin_proxy_h__ */
diff --git a/src/vnet/vnet.h b/src/vnet/vnet.h
index 8405f61..153fdcc 100644
--- a/src/vnet/vnet.h
+++ b/src/vnet/vnet.h
@@ -78,8 +78,8 @@
vlib_main_t *vlib_main;
} vnet_main_t;
-vnet_main_t vnet_main;
-vnet_main_t **vnet_mains;
+extern vnet_main_t vnet_main;
+extern vnet_main_t **vnet_mains;
#include <vnet/interface_funcs.h>
#include <vnet/global_funcs.h>
diff --git a/src/vnet/vxlan-gpe/vxlan_gpe.h b/src/vnet/vxlan-gpe/vxlan_gpe.h
index c348b5d..053bcbe 100644
--- a/src/vnet/vxlan-gpe/vxlan_gpe.h
+++ b/src/vnet/vxlan-gpe/vxlan_gpe.h
@@ -209,7 +209,7 @@
uword decap_next_node_list[VXLAN_GPE_PROTOCOL_MAX];
} vxlan_gpe_main_t;
-vxlan_gpe_main_t vxlan_gpe_main;
+extern vxlan_gpe_main_t vxlan_gpe_main;
extern vlib_node_registration_t vxlan_gpe_encap_node;
extern vlib_node_registration_t vxlan4_gpe_input_node;
diff --git a/src/vnet/vxlan/vxlan.h b/src/vnet/vxlan/vxlan.h
index dca1cd1..f428ee5 100644
--- a/src/vnet/vxlan/vxlan.h
+++ b/src/vnet/vxlan/vxlan.h
@@ -158,7 +158,7 @@
vnet_main_t * vnet_main;
} vxlan_main_t;
-vxlan_main_t vxlan_main;
+extern vxlan_main_t vxlan_main;
extern vlib_node_registration_t vxlan4_input_node;
extern vlib_node_registration_t vxlan6_input_node;