From 85eb2ae96a9269e6e5f3f92b072a1717d8a76eee Mon Sep 17 00:00:00 2001 From: Andy Date: Tue, 5 Sep 2017 22:16:53 -0400 Subject: [PATCH] :bug: tools should init dpdk before all malloc for the same 'virtual memory address' --- tools/compat/ff_ipc.c | 2 +- tools/compat/ff_ipc.h | 1 + tools/ifconfig/ifconfig.c | 2 ++ tools/netstat/main.c | 2 ++ tools/route/route.c | 2 ++ tools/sysctl/sysctl.c | 2 ++ tools/top/top.c | 2 ++ 7 files changed, 12 insertions(+), 1 deletion(-) diff --git a/tools/compat/ff_ipc.c b/tools/compat/ff_ipc.c index f659b7407..6f37f3ca6 100644 --- a/tools/compat/ff_ipc.c +++ b/tools/compat/ff_ipc.c @@ -51,7 +51,7 @@ ff_set_proc_id(int pid) ff_proc_id = pid; } -static int +int ff_ipc_init(void) { if (inited) { diff --git a/tools/compat/ff_ipc.h b/tools/compat/ff_ipc.h index 43076e286..ebfda0889 100644 --- a/tools/compat/ff_ipc.h +++ b/tools/compat/ff_ipc.h @@ -32,6 +32,7 @@ /* Set F-Stack proccess id to communicate with */ void ff_set_proc_id(int pid); +int ff_ipc_init(void); struct ff_msg *ff_ipc_msg_alloc(void); int ff_ipc_msg_free(struct ff_msg *msg); diff --git a/tools/ifconfig/ifconfig.c b/tools/ifconfig/ifconfig.c index 1c8f9dbff..e029e10c1 100644 --- a/tools/ifconfig/ifconfig.c +++ b/tools/ifconfig/ifconfig.c @@ -426,6 +426,8 @@ main(int argc, char *argv[]) struct option *p; size_t iflen; + ff_ipc_init(); + all = downonly = uponly = namesonly = noload = verbose = 0; f_inet = f_inet6 = f_ether = f_addr = NULL; diff --git a/tools/netstat/main.c b/tools/netstat/main.c index 3271664ec..3eecf63a3 100644 --- a/tools/netstat/main.c +++ b/tools/netstat/main.c @@ -247,6 +247,8 @@ main(int argc, char *argv[]) char *endptr; bool first = true; + ff_ipc_init(); + af = AF_UNSPEC; argc = xo_parse_args(argc, argv); diff --git a/tools/route/route.c b/tools/route/route.c index bbd4a8000..af9765fa6 100644 --- a/tools/route/route.c +++ b/tools/route/route.c @@ -281,6 +281,8 @@ main(int argc, char **argv) if (argc < 2) usage(NULL); + ff_ipc_init(); + #ifndef FSTACK while ((ch = getopt(argc, argv, "46nqdtv")) != -1) #else diff --git a/tools/sysctl/sysctl.c b/tools/sysctl/sysctl.c index 3d225982a..b1839d94d 100644 --- a/tools/sysctl/sysctl.c +++ b/tools/sysctl/sysctl.c @@ -241,6 +241,8 @@ main(int argc, char **argv) int ch; int warncount = 0; + ff_ipc_init(); + setlocale(LC_NUMERIC, ""); setbuf(stdout,0); setbuf(stderr,0); diff --git a/tools/top/top.c b/tools/top/top.c index 4473926b2..f09992cba 100644 --- a/tools/top/top.c +++ b/tools/top/top.c @@ -53,6 +53,8 @@ int main(int argc, char **argv) unsigned int i; struct ff_top_args top, otop; + ff_ipc_init(); + #define TOP_DIFF(member) (top.member - otop.member) while ((ch = getopt(argc, argv, "hp:d:n:")) != -1) {