X-Git-Url: https://gerrit.fd.io/r/gitweb?p=vpp.git;a=blobdiff_plain;f=src%2Fvlib%2Funix%2Fcli.c;h=f9d6b40c4d5e9b89c2b35943834674b7fd56a742;hp=b268db57448dfc6ee9500e4f9e95c9a207958cc9;hb=8feeaff56;hpb=0610039fd06c760924fb92d0fc7b4d3e0ffeb8e3 diff --git a/src/vlib/unix/cli.c b/src/vlib/unix/cli.c index b268db57448..f9d6b40c4d5 100644 --- a/src/vlib/unix/cli.c +++ b/src/vlib/unix/cli.c @@ -60,6 +60,7 @@ #include #include #include +#include /** ANSI escape code. */ #define ESC "\x1b" @@ -580,7 +581,7 @@ unix_cli_del_pending_output (clib_file_t * uf, * @param str The buffer in which to search for the value. * @param len The depth into the buffer to search. * - * @return The index of the first occurence of \c chr. If \c chr is not + * @return The index of the first occurrence of \c chr. If \c chr is not * found then \c len instead. */ always_inline word @@ -898,7 +899,7 @@ unix_cli_pager_redraw (unix_cli_file_t * cf, clib_file_t * uf) * * If instead @c line is @c NULL then @c len_or_index is taken to mean the * index of an existing line in the pager buffer; this simply means that the - * input line does not need to be cloned since we alreayd have it. This is + * input line does not need to be cloned since we already have it. This is * typical if we are reindexing the pager buffer. * * @param cf The CLI session whose pager we are adding to. @@ -1294,7 +1295,7 @@ unix_cli_process_telnet (unix_main_t * um, case DO: case DONT: /* Expect 3 bytes */ - if (vec_len (input_vector) < 3) + if (len < 3) return -1; /* want more bytes */ consume = 2; @@ -2727,7 +2728,7 @@ unix_cli_file_add (unix_cli_main_t * cm, char *name, int fd) } pool_get (cm->cli_file_pool, cf); - memset (cf, 0, sizeof (*cf)); + clib_memset (cf, 0, sizeof (*cf)); template.read_function = unix_cli_read_ready; template.write_function = unix_cli_write_ready; @@ -2763,11 +2764,17 @@ unix_cli_listen_read_ready (clib_file_t * uf) clib_error_t *error; unix_cli_file_t *cf; u32 cf_index; + int one; error = clib_socket_accept (s, &client); if (error) return error; + /* Disable Nagle, ignore any errors doing so eg on PF_LOCAL socket */ + one = 1; + (void) setsockopt (client.fd, IPPROTO_TCP, TCP_NODELAY, + (void *) &one, sizeof (one)); + client_name = (char *) format (0, "%U%c", format_sockaddr, &client.peer, 0); cf_index = unix_cli_file_add (cm, client_name, client.fd); @@ -2911,7 +2918,7 @@ unix_cli_config (vlib_main_t * vm, unformat_input_t * input) if (isatty (STDIN_FILENO) && um->cli_line_mode == 0) { /* Capture terminal resize events */ - memset (&sa, 0, sizeof (sa)); + clib_memset (&sa, 0, sizeof (sa)); sa.sa_handler = unix_cli_resize_interrupt; if (sigaction (SIGWINCH, &sa, 0) < 0) clib_panic ("sigaction");