aboutsummaryrefslogtreecommitdiffstats
path: root/vlib
diff options
context:
space:
mode:
authorEd Warnicke <eaw@cisco.com>2016-04-01 22:43:37 -0500
committerGerrit Code Review <gerrit@fd.io>2016-04-06 16:03:33 +0000
commita25bd1cae44e3a09584366c161cbc6beebd3d2c4 (patch)
treeebbb3091083c383df95644dfd98028d391e41f2d /vlib
parentdf2b0fd80281886cbfbe6c699f968b439cc3cd5f (diff)
Do not listen unless configured with cli-listen.
I noticed while mucking about with lsof that vpp was listening on port 5000. telnet 0 5000 revealed that it was listening for the cli on that port. Digging into the code, it turns out that if you do not configure cli-listen (Example: unix { cli-listen localhost:5002 } ) Then vpp is listening on the first available port starting at port 5000 anyway. This is a simple patch to *not* listen unless configured to do so. Change-Id: Id7f6f4d69e0a1642d2767849a90b21f38f21ecaa Signed-off-by: Ed Warnicke <eaw@cisco.com>
Diffstat (limited to 'vlib')
-rw-r--r--vlib/vlib/unix/cli.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/vlib/vlib/unix/cli.c b/vlib/vlib/unix/cli.c
index f8b7f08a373..2cdd47691cd 100644
--- a/vlib/vlib/unix/cli.c
+++ b/vlib/vlib/unix/cli.c
@@ -686,7 +686,7 @@ unix_cli_config (vlib_main_t * vm, unformat_input_t * input)
unix_main_t * um = &unix_main;
unix_cli_main_t * cm = &unix_cli_main;
int flags, standard_input_fd;
- clib_error_t * error;
+ clib_error_t * error = 0;
/* We depend on unix flags being set. */
if ((error = vlib_call_config_function (vm, unix_config)))
@@ -704,14 +704,15 @@ unix_cli_config (vlib_main_t * vm, unformat_input_t * input)
unix_cli_file_add (cm, "stdin", standard_input_fd);
}
- {
+ /* If we have socket config, LISTEN, otherwise, don't */
+ clib_socket_t * s = &um->cli_listen_socket;
+ if(s->config && s->config[0] != 0) {
/* CLI listen. */
- clib_socket_t * s = &um->cli_listen_socket;
unix_file_t template = {0};
s->flags = SOCKET_IS_SERVER; /* listen, don't connect */
-
error = clib_socket_init (s);
+
if (error)
return error;