From 71612d61930e57e7c8ebf9e5647b15a4b23720b2 Mon Sep 17 00:00:00 2001 From: Dave Wallace Date: Tue, 24 Oct 2017 01:32:41 -0400 Subject: 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 --- src/examples/sample-plugin/sample/sample.h | 2 +- src/examples/srv6-sample-localsid/srv6_localsid_sample.h | 2 +- src/plugins/dpdk/device/dpdk.h | 2 +- src/plugins/dpdk/device/init.c | 1 + src/plugins/dpdk/ipsec/ipsec.c | 2 ++ src/plugins/dpdk/ipsec/ipsec.h | 2 +- src/plugins/gtpu/gtpu.h | 2 +- src/plugins/ioam/ip6/ioam_cache.c | 2 ++ src/plugins/ioam/ip6/ioam_cache.h | 2 +- src/plugins/ixge/ixge.h | 4 ++-- src/plugins/sixrd/sixrd.c | 2 ++ src/plugins/sixrd/sixrd.h | 2 +- src/vat/plugin.h | 2 +- src/vlib/lex.h | 2 +- src/vnet/cdp/cdp_node.h | 2 +- src/vnet/classify/flow_classify.c | 2 ++ src/vnet/classify/flow_classify.h | 2 +- src/vnet/classify/policer_classify.c | 2 ++ src/vnet/classify/policer_classify.h | 2 +- src/vnet/cop/cop.h | 2 +- src/vnet/devices/af_packet/af_packet.c | 2 ++ src/vnet/devices/af_packet/af_packet.h | 2 +- src/vnet/devices/netmap/netmap.c | 2 ++ src/vnet/devices/netmap/netmap.h | 2 +- src/vnet/devices/ssvm/ssvm_eth.h | 2 +- src/vnet/dhcp/client.h | 2 +- src/vnet/ethernet/ethernet.h | 2 +- src/vnet/geneve/geneve.h | 2 +- src/vnet/gre/gre.h | 2 +- src/vnet/ip/ip4_source_and_port_range_check.c | 2 ++ src/vnet/ip/ip_source_and_port_range_check.h | 2 +- src/vnet/ip/ping.c | 2 ++ src/vnet/ip/ping.h | 2 +- src/vnet/ipsec-gre/ipsec_gre.h | 2 +- src/vnet/ipsec/esp.h | 2 +- src/vnet/ipsec/esp_encrypt.c | 1 + src/vnet/ipsec/ikev2.c | 2 ++ src/vnet/ipsec/ikev2_priv.h | 2 +- src/vnet/ipsec/ipsec.c | 2 ++ src/vnet/ipsec/ipsec.h | 2 +- src/vnet/l2/l2_learn.c | 2 ++ src/vnet/l2/l2_learn.h | 2 +- src/vnet/l2/l2_output.h | 2 +- src/vnet/l2tp/l2tp.h | 2 +- src/vnet/lawful-intercept/lawful_intercept.c | 2 ++ src/vnet/lawful-intercept/lawful_intercept.h | 2 +- src/vnet/lisp-gpe/lisp_gpe.h | 2 +- src/vnet/map/map.c | 2 ++ src/vnet/map/map.h | 2 +- src/vnet/misc.c | 1 + src/vnet/policer/policer.c | 2 ++ src/vnet/policer/policer.h | 2 +- src/vnet/snap/snap.h | 2 +- src/vnet/span/span.c | 2 ++ src/vnet/span/span.h | 2 +- src/vnet/srp/node.c | 2 ++ src/vnet/srp/srp.h | 2 +- src/vnet/tcp/builtin_client.c | 2 ++ src/vnet/tcp/builtin_client.h | 2 +- src/vnet/tcp/builtin_proxy.h | 2 +- src/vnet/vnet.h | 4 ++-- src/vnet/vxlan-gpe/vxlan_gpe.h | 2 +- src/vnet/vxlan/vxlan.h | 2 +- src/vpp/api/plugin.h | 2 +- src/vpp/stats/stats.h | 2 +- 65 files changed, 85 insertions(+), 46 deletions(-) diff --git a/src/examples/sample-plugin/sample/sample.h b/src/examples/sample-plugin/sample/sample.h index c9778f74298..a5dd5bf9803 100644 --- a/src/examples/sample-plugin/sample/sample.h +++ b/src/examples/sample-plugin/sample/sample.h @@ -31,7 +31,7 @@ typedef struct { vnet_main_t * vnet_main; } sample_main_t; -sample_main_t sample_main; +extern sample_main_t sample_main; extern vlib_node_registration_t sample_node; diff --git a/src/examples/srv6-sample-localsid/srv6_localsid_sample.h b/src/examples/srv6-sample-localsid/srv6_localsid_sample.h index ef74ea3e5a6..16494497ccc 100644 --- a/src/examples/srv6-sample-localsid/srv6_localsid_sample.h +++ b/src/examples/srv6-sample-localsid/srv6_localsid_sample.h @@ -48,7 +48,7 @@ typedef struct { u32 fib_table; /* Stupid index used as an example.. */ } srv6_localsid_sample_per_sid_memory_t ; -srv6_localsid_sample_main_t srv6_localsid_sample_main; +extern srv6_localsid_sample_main_t srv6_localsid_sample_main; format_function_t format_srv6_localsid_sample; unformat_function_t unformat_srv6_localsid_sample; diff --git a/src/plugins/dpdk/device/dpdk.h b/src/plugins/dpdk/device/dpdk.h index 9762c7137f5..a0c57ea21b3 100644 --- a/src/plugins/dpdk/device/dpdk.h +++ b/src/plugins/dpdk/device/dpdk.h @@ -332,7 +332,7 @@ typedef struct } dpdk_config_main_t; -dpdk_config_main_t dpdk_config_main; +extern dpdk_config_main_t dpdk_config_main; typedef struct { diff --git a/src/plugins/dpdk/device/init.c b/src/plugins/dpdk/device/init.c index e94d2fa8588..9e7bb75d6f3 100755 --- a/src/plugins/dpdk/device/init.c +++ b/src/plugins/dpdk/device/init.c @@ -37,6 +37,7 @@ #include dpdk_main_t dpdk_main; +dpdk_config_main_t dpdk_config_main; #define LINK_STATE_ELOGS 0 diff --git a/src/plugins/dpdk/ipsec/ipsec.c b/src/plugins/dpdk/ipsec/ipsec.c index 4bae8c1b0f4..6aa5fae8b26 100644 --- a/src/plugins/dpdk/ipsec/ipsec.c +++ b/src/plugins/dpdk/ipsec/ipsec.c @@ -21,6 +21,8 @@ #include #include +dpdk_crypto_main_t dpdk_crypto_main; + #define EMPTY_STRUCT {0} static void diff --git a/src/plugins/dpdk/ipsec/ipsec.h b/src/plugins/dpdk/ipsec/ipsec.h index 98e5ad53acb..22890628ec6 100644 --- a/src/plugins/dpdk/ipsec/ipsec.h +++ b/src/plugins/dpdk/ipsec/ipsec.h @@ -144,7 +144,7 @@ typedef struct u8 enabled; } dpdk_crypto_main_t; -dpdk_crypto_main_t dpdk_crypto_main; +extern dpdk_crypto_main_t dpdk_crypto_main; static const u8 pad_data[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 0 }; diff --git a/src/plugins/gtpu/gtpu.h b/src/plugins/gtpu/gtpu.h index 744d21d4266..b1e677d4f29 100644 --- a/src/plugins/gtpu/gtpu.h +++ b/src/plugins/gtpu/gtpu.h @@ -228,7 +228,7 @@ typedef struct vnet_main_t *vnet_main; } gtpu_main_t; -gtpu_main_t gtpu_main; +extern gtpu_main_t gtpu_main; extern vlib_node_registration_t gtpu4_input_node; extern vlib_node_registration_t gtpu6_input_node; diff --git a/src/plugins/ioam/ip6/ioam_cache.c b/src/plugins/ioam/ip6/ioam_cache.c index 4e147da34dc..627f8b65d13 100644 --- a/src/plugins/ioam/ip6/ioam_cache.c +++ b/src/plugins/ioam/ip6/ioam_cache.c @@ -55,6 +55,8 @@ #define REPLY_MSG_ID_BASE cm->msg_id_base #include +ioam_cache_main_t ioam_cache_main; + /* List of message types that this plugin understands */ #define foreach_ioam_cache_plugin_api_msg \ _(IOAM_CACHE_IP6_ENABLE_DISABLE, ioam_cache_ip6_enable_disable) diff --git a/src/plugins/ioam/ip6/ioam_cache.h b/src/plugins/ioam/ip6/ioam_cache.h index 25a8fb65729..338ed9828ee 100644 --- a/src/plugins/ioam/ip6/ioam_cache.h +++ b/src/plugins/ioam/ip6/ioam_cache.h @@ -203,7 +203,7 @@ typedef struct u32 cleanup_process_node_index; } ioam_cache_main_t; -ioam_cache_main_t ioam_cache_main; +extern ioam_cache_main_t ioam_cache_main; extern vlib_node_registration_t ioam_cache_node; extern vlib_node_registration_t ioam_cache_ts_node; diff --git a/src/plugins/ixge/ixge.h b/src/plugins/ixge/ixge.h index 42c1bfa5c9b..a87af1ab04b 100644 --- a/src/plugins/ixge/ixge.h +++ b/src/plugins/ixge/ixge.h @@ -1270,8 +1270,8 @@ typedef struct vlib_physmem_region_index_t physmem_region; } ixge_main_t; -ixge_main_t ixge_main; -vnet_device_class_t ixge_device_class; +extern ixge_main_t ixge_main; +extern vnet_device_class_t ixge_device_class; typedef enum { diff --git a/src/plugins/sixrd/sixrd.c b/src/plugins/sixrd/sixrd.c index 983875257e3..ee198f21004 100644 --- a/src/plugins/sixrd/sixrd.c +++ b/src/plugins/sixrd/sixrd.c @@ -32,6 +32,8 @@ * ea_bits_len = 0 */ +sixrd_main_t sixrd_main; + int sixrd_create_domain (ip6_address_t *ip6_prefix, u8 ip6_prefix_len, diff --git a/src/plugins/sixrd/sixrd.h b/src/plugins/sixrd/sixrd.h index 56714c9e3bd..f911461b1cd 100644 --- a/src/plugins/sixrd/sixrd.h +++ b/src/plugins/sixrd/sixrd.h @@ -79,7 +79,7 @@ typedef struct { u32 sixrd_domain_index; } sixrd_trace_t; -sixrd_main_t sixrd_main; +extern sixrd_main_t sixrd_main; /* * sixrd_get_addr diff --git a/src/vat/plugin.h b/src/vat/plugin.h index 559ec52f128..c69186287aa 100644 --- a/src/vat/plugin.h +++ b/src/vat/plugin.h @@ -45,7 +45,7 @@ typedef struct } plugin_main_t; -plugin_main_t vat_plugin_main; +extern plugin_main_t vat_plugin_main; int vat_plugin_init (vat_main_t * vam); int vat_load_new_plugins (plugin_main_t * pm); diff --git a/src/vlib/lex.h b/src/vlib/lex.h index 4ae58f468c1..18289eef5ca 100644 --- a/src/vlib/lex.h +++ b/src/vlib/lex.h @@ -114,7 +114,7 @@ typedef struct u8 *token_buffer; } vlib_lex_main_t; -vlib_lex_main_t vlib_lex_main; +extern vlib_lex_main_t vlib_lex_main; always_inline void vlib_lex_cleanup_token (vlib_lex_token_t * t) diff --git a/src/vnet/cdp/cdp_node.h b/src/vnet/cdp/cdp_node.h index 7028ddcaf9c..21086c02527 100644 --- a/src/vnet/cdp/cdp_node.h +++ b/src/vnet/cdp/cdp_node.h @@ -95,7 +95,7 @@ typedef struct 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 0a624204e34..6c067f55759 100644 --- a/src/vnet/classify/flow_classify.c +++ b/src/vnet/classify/flow_classify.c @@ -14,6 +14,8 @@ */ #include +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 3ae04cd7b21..14430df392f 100644 --- a/src/vnet/classify/flow_classify.h +++ b/src/vnet/classify/flow_classify.h @@ -42,7 +42,7 @@ typedef struct { 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 569234fba3b..2a4fa62c023 100644 --- a/src/vnet/classify/policer_classify.c +++ b/src/vnet/classify/policer_classify.c @@ -14,6 +14,8 @@ */ #include +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 3065644438d..6ab424fbf9c 100644 --- a/src/vnet/classify/policer_classify.h +++ b/src/vnet/classify/policer_classify.h @@ -46,7 +46,7 @@ typedef struct { 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 eb5f1dfd78e..ee848ce872e 100644 --- a/src/vnet/cop/cop.h +++ b/src/vnet/cop/cop.h @@ -70,7 +70,7 @@ typedef struct { 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 e7bbdfd86ae..d0a241e2a2e 100644 --- a/src/vnet/devices/af_packet/af_packet.c +++ b/src/vnet/devices/af_packet/af_packet.c @@ -32,6 +32,8 @@ #include +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 66e2dea5169..b095e7ffcd1 100644 --- a/src/vnet/devices/af_packet/af_packet.h +++ b/src/vnet/devices/af_packet/af_packet.h @@ -56,7 +56,7 @@ typedef struct 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 fc49ed629b8..25a3af73451 100644 --- a/src/vnet/devices/netmap/netmap.c +++ b/src/vnet/devices/netmap/netmap.c @@ -27,6 +27,8 @@ #include #include +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 047318909c9..29f855fda8e 100644 --- a/src/vnet/devices/netmap/netmap.h +++ b/src/vnet/devices/netmap/netmap.h @@ -98,7 +98,7 @@ typedef struct 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 f877df3cd33..7f9aaad3e82 100644 --- a/src/vnet/devices/ssvm/ssvm_eth.h +++ b/src/vnet/devices/ssvm/ssvm_eth.h @@ -82,7 +82,7 @@ typedef struct 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 509d5d4cc15..68c3d7ba98e 100644 --- a/src/vnet/dhcp/client.h +++ b/src/vnet/dhcp/client.h @@ -100,7 +100,7 @@ typedef struct { 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 a6846b13ffc..2a3383a9eaa 100644 --- a/src/vnet/ethernet/ethernet.h +++ b/src/vnet/ethernet/ethernet.h @@ -271,7 +271,7 @@ typedef struct 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 2976043ed0f..cce57c8873b 100644 --- a/src/vnet/geneve/geneve.h +++ b/src/vnet/geneve/geneve.h @@ -175,7 +175,7 @@ typedef struct 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 ad3e025a0ff..9c12eb4bc13 100644 --- a/src/vnet/gre/gre.h +++ b/src/vnet/gre/gre.h @@ -195,7 +195,7 @@ gre_get_protocol_info (gre_main_t * em, gre_protocol_t protocol) 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 4829079bddd..d1f18dd6b26 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 #include +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 fefe5ff1fd9..b04fe613d1c 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 @@ typedef struct 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 0fa537f6281..f438ce96060 100755 --- a/src/vnet/ip/ping.c +++ b/src/vnet/ip/ping.c @@ -20,6 +20,8 @@ #include #include +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 b1b71f685fe..3f7488fbeac 100644 --- a/src/vnet/ip/ping.h +++ b/src/vnet/ip/ping.h @@ -56,7 +56,7 @@ typedef struct ping_main_t 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 a2ca64b6f74..5d56b4e1e1f 100644 --- a/src/vnet/ipsec-gre/ipsec_gre.h +++ b/src/vnet/ipsec-gre/ipsec_gre.h @@ -78,7 +78,7 @@ typedef struct 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 98db70179bd..bc67f9d0783 100644 --- a/src/vnet/ipsec/esp.h +++ b/src/vnet/ipsec/esp.h @@ -80,7 +80,7 @@ typedef struct 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 b2bc4e0b448..b6ee25808b6 100644 --- a/src/vnet/ipsec/esp_encrypt.c +++ b/src/vnet/ipsec/esp_encrypt.c @@ -22,6 +22,7 @@ #include #include +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 a3dc7b872c5..49bae17f730 100644 --- a/src/vnet/ipsec/ikev2.c +++ b/src/vnet/ipsec/ikev2.c @@ -24,6 +24,8 @@ #include #include +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 5a3dc5202f4..b396965a0bb 100644 --- a/src/vnet/ipsec/ikev2_priv.h +++ b/src/vnet/ipsec/ikev2_priv.h @@ -292,7 +292,7 @@ typedef struct } 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 828bfe81e43..2adcfd0b9bd 100644 --- a/src/vnet/ipsec/ipsec.c +++ b/src/vnet/ipsec/ipsec.c @@ -24,6 +24,8 @@ #include #include +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 f11bc56cb9a..222025dbee8 100644 --- a/src/vnet/ipsec/ipsec.h +++ b/src/vnet/ipsec/ipsec.h @@ -286,7 +286,7 @@ typedef struct 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 fddab82426c..6ece1a3c7f2 100644 --- a/src/vnet/l2/l2_learn.c +++ b/src/vnet/l2/l2_learn.c @@ -29,6 +29,8 @@ #include #include +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 3aaf48e2544..c1071450852 100644 --- a/src/vnet/l2/l2_learn.h +++ b/src/vnet/l2/l2_learn.h @@ -48,7 +48,7 @@ typedef struct #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 1a73fdf9790..3b6e480d1dc 100644 --- a/src/vnet/l2/l2_output.h +++ b/src/vnet/l2/l2_output.h @@ -75,7 +75,7 @@ typedef struct 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 e7d2892cbdf..a91f00c282a 100644 --- a/src/vnet/l2tp/l2tp.h +++ b/src/vnet/l2tp/l2tp.h @@ -91,7 +91,7 @@ typedef struct 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 ef07a339201..e48e1cf4bd1 100644 --- a/src/vnet/lawful-intercept/lawful_intercept.c +++ b/src/vnet/lawful-intercept/lawful_intercept.c @@ -15,6 +15,8 @@ #include +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 89e699f51a0..bcb18afece2 100644 --- a/src/vnet/lawful-intercept/lawful_intercept.h +++ b/src/vnet/lawful-intercept/lawful_intercept.h @@ -33,7 +33,7 @@ typedef struct { 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 5eafdd55ffc..fe51ed06eb1 100644 --- a/src/vnet/lisp-gpe/lisp_gpe.h +++ b/src/vnet/lisp-gpe/lisp_gpe.h @@ -177,7 +177,7 @@ typedef struct lisp_gpe_main } 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 862f7cf5612..6d18a069459 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 208a58efc42..b9b3353dd2e 100644 --- a/src/vnet/map/map.h +++ b/src/vnet/map/map.h @@ -329,7 +329,7 @@ typedef struct { 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 9cfe83940f1..ff85e3dedfe 100644 --- a/src/vnet/misc.c +++ b/src/vnet/misc.c @@ -41,6 +41,7 @@ #include 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 5a7b7711661..37380034fd2 100644 --- a/src/vnet/policer/policer.c +++ b/src/vnet/policer/policer.c @@ -16,6 +16,8 @@ #include #include +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 8e2d7c79b7c..b7c1d616cef 100644 --- a/src/vnet/policer/policer.h +++ b/src/vnet/policer/policer.h @@ -44,7 +44,7 @@ typedef struct 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 7cd453e7a97..08c3a8b9c18 100644 --- a/src/vnet/snap/snap.h +++ b/src/vnet/snap/snap.h @@ -165,7 +165,7 @@ snap_get_protocol_info (snap_main_t * sm, snap_header_t * h) 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 2fd9cd87dfb..b7292cf1e80 100644 --- a/src/vnet/span/span.c +++ b/src/vnet/span/span.c @@ -21,6 +21,8 @@ #include +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 10de8272ab0..ebdb4980c77 100644 --- a/src/vnet/span/span.h +++ b/src/vnet/span/span.h @@ -55,7 +55,7 @@ typedef struct 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 897be254624..9123c4c7735 100644 --- a/src/vnet/srp/node.c +++ b/src/vnet/srp/node.c @@ -41,6 +41,8 @@ #include /* for ip_csum_fold */ #include +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 5288ebe4759..8f59e064c8b 100644 --- a/src/vnet/srp/srp.h +++ b/src/vnet/srp/srp.h @@ -169,7 +169,7 @@ srp_ips_link_change (u32 sw_if_index, u32 link_is_up) 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 4258fc43010..76c5c123ab9 100644 --- a/src/vnet/tcp/builtin_client.c +++ b/src/vnet/tcp/builtin_client.c @@ -23,6 +23,8 @@ #include #include +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 06d239efe14..400c55c8685 100644 --- a/src/vnet/tcp/builtin_client.h +++ b/src/vnet/tcp/builtin_client.h @@ -106,7 +106,7 @@ typedef struct 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 cf707a150cf..c8cde5f70e6 100644 --- a/src/vnet/tcp/builtin_proxy.h +++ b/src/vnet/tcp/builtin_proxy.h @@ -87,7 +87,7 @@ typedef struct 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 8405f61b3c3..153fdcca785 100644 --- a/src/vnet/vnet.h +++ b/src/vnet/vnet.h @@ -78,8 +78,8 @@ typedef struct vnet_main_t 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 #include diff --git a/src/vnet/vxlan-gpe/vxlan_gpe.h b/src/vnet/vxlan-gpe/vxlan_gpe.h index c348b5d5aaa..053bcbe629a 100644 --- a/src/vnet/vxlan-gpe/vxlan_gpe.h +++ b/src/vnet/vxlan-gpe/vxlan_gpe.h @@ -209,7 +209,7 @@ typedef struct { 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 dca1cd1285d..f428ee54d78 100644 --- a/src/vnet/vxlan/vxlan.h +++ b/src/vnet/vxlan/vxlan.h @@ -158,7 +158,7 @@ typedef struct { 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; diff --git a/src/vpp/api/plugin.h b/src/vpp/api/plugin.h index 559ec52f128..c69186287aa 100644 --- a/src/vpp/api/plugin.h +++ b/src/vpp/api/plugin.h @@ -45,7 +45,7 @@ typedef struct } plugin_main_t; -plugin_main_t vat_plugin_main; +extern plugin_main_t vat_plugin_main; int vat_plugin_init (vat_main_t * vam); int vat_load_new_plugins (plugin_main_t * pm); diff --git a/src/vpp/stats/stats.h b/src/vpp/stats/stats.h index 042bcb65801..452e3052a10 100644 --- a/src/vpp/stats/stats.h +++ b/src/vpp/stats/stats.h @@ -184,7 +184,7 @@ typedef struct api_main_t *api_main; } stats_main_t; -stats_main_t stats_main; +extern stats_main_t stats_main; void dslock (stats_main_t * sm, int release_hint, int tag); void dsunlock (stats_main_t * sm); -- cgit 1.2.3-korg