aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/ip
diff options
context:
space:
mode:
authorDave Wallace <dwallacelf@gmail.com>2017-10-24 01:32:41 -0400
committerDave Wallace <dwallacelf@gmail.com>2017-10-24 01:32:41 -0400
commit71612d61930e57e7c8ebf9e5647b15a4b23720b2 (patch)
tree3c135af6d40442f5ae9f8397c62080e2b7e3f342 /src/vnet/ip
parent92b0275a364022af6ab828dfac83e38c0117cfe6 (diff)
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>
Diffstat (limited to 'src/vnet/ip')
-rw-r--r--src/vnet/ip/ip4_source_and_port_range_check.c2
-rw-r--r--src/vnet/ip/ip_source_and_port_range_check.h2
-rwxr-xr-xsrc/vnet/ip/ping.c2
-rw-r--r--src/vnet/ip/ping.h2
4 files changed, 6 insertions, 2 deletions
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 <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 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 <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 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