From 32c4d38f7ac6fe22abb0b4859f6075bb9b661773 Mon Sep 17 00:00:00 2001 From: Paul Vinciguerra Date: Wed, 23 Oct 2019 16:07:32 -0400 Subject: ip: cleanup punt socket cli help Make the help string consistent with the cli parser. Type: fix Change-Id: I7140bd589c2a94dbf5af5cc633cb495457a6af22 Signed-off-by: Paul Vinciguerra --- src/vnet/ip/punt.c | 31 ++++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/src/vnet/ip/punt.c b/src/vnet/ip/punt.c index a3c7ecaf8a1..a2952773f97 100644 --- a/src/vnet/ip/punt.c +++ b/src/vnet/ip/punt.c @@ -351,10 +351,10 @@ vnet_punt_socket_del (vlib_main_t * vm, const punt_reg_t * pr) } /** - * @brief Request IP traffic punt to the local TCP/IP stack. + * @brief Request IP L4 traffic punt to the local TCP/IP stack. * * @em Note - * - UDP and TCP are the only protocols supported in the current implementation + * - UDP is the only protocol supported in the current implementation * * @param vm vlib_main_t corresponding to the current thread * @param af IP address family. @@ -434,7 +434,7 @@ punt_cli (vlib_main_t * vm, .l4 = { .af = AF_IP4, .port = ~0, - .protocol = ~0, + .protocol = IP_PROTOCOL_UDP, }, }, .type = PUNT_TYPE_L4, @@ -446,12 +446,16 @@ punt_cli (vlib_main_t * vm, { if (unformat (input, "del")) is_add = false; + else if (unformat (input, "ipv4")) + pr.punt.l4.af = AF_IP4; else if (unformat (input, "ipv6")) pr.punt.l4.af = AF_IP6; else if (unformat (input, "ip6")) pr.punt.l4.af = AF_IP6; else if (unformat (input, "%d", &port)) pr.punt.l4.port = port; + else if (unformat (input, "all")) + pr.punt.l4.port = ~0; else if (unformat (input, "udp")) pr.punt.l4.protocol = IP_PROTOCOL_UDP; else if (unformat (input, "tcp")) @@ -498,7 +502,7 @@ done: /* *INDENT-OFF* */ VLIB_CLI_COMMAND (punt_command, static) = { .path = "set punt", - .short_help = "set punt [udp|tcp] [del] ", + .short_help = "set punt [IPV4|ip6|ipv6] [UDP|tcp] [del] [ALL|]", .function = punt_cli, }; /* *INDENT-ON* */ @@ -515,7 +519,7 @@ punt_socket_register_cmd (vlib_main_t * vm, .l4 = { .af = AF_IP4, .port = ~0, - .protocol = ~0, + .protocol = IP_PROTOCOL_UDP, }, }, .type = PUNT_TYPE_L4, @@ -525,7 +529,7 @@ punt_socket_register_cmd (vlib_main_t * vm, while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT) { if (unformat (input, "ipv4")) - ; + pr.punt.l4.af = AF_IP4; else if (unformat (input, "ipv6")) pr.punt.l4.af = AF_IP6; else if (unformat (input, "udp")) @@ -534,6 +538,8 @@ punt_socket_register_cmd (vlib_main_t * vm, pr.punt.l4.protocol = IP_PROTOCOL_TCP; else if (unformat (input, "%d", &pr.punt.l4.port)) ; + else if (unformat (input, "all")) + pr.punt.l4.port = ~0; else if (unformat (input, "socket %s", &socket_name)) ; else @@ -556,14 +562,15 @@ done: /*? * * @cliexpar - * @cliexcmd{punt socket register} + * @cliexcmd{punt socket register socket punt_l4_foo.sock} + ?*/ /* *INDENT-OFF* */ VLIB_CLI_COMMAND (punt_socket_register_command, static) = { .path = "punt socket register", .function = punt_socket_register_cmd, - .short_help = "punt socket register [ipv4|ipv6] [udp|tcp]> ", + .short_help = "punt socket register [IPV4|ipv6] [UDP|tcp] [ALL|] socket ", .is_mp_safe = 1, }; /* *INDENT-ON* */ @@ -580,7 +587,7 @@ punt_socket_deregister_cmd (vlib_main_t * vm, .l4 = { .af = AF_IP4, .port = ~0, - .protocol = ~0, + .protocol = IP_PROTOCOL_UDP, }, }, .type = PUNT_TYPE_L4, @@ -590,7 +597,7 @@ punt_socket_deregister_cmd (vlib_main_t * vm, while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT) { if (unformat (input, "ipv4")) - ; + pr.punt.l4.af = AF_IP4; else if (unformat (input, "ipv6")) pr.punt.l4.af = AF_IP6; else if (unformat (input, "udp")) @@ -599,6 +606,8 @@ punt_socket_deregister_cmd (vlib_main_t * vm, pr.punt.l4.protocol = IP_PROTOCOL_TCP; else if (unformat (input, "%d", &pr.punt.l4.port)) ; + else if (unformat (input, "all")) + pr.punt.l4.port = ~0; else { error = clib_error_return (0, "parse error: '%U'", @@ -622,7 +631,7 @@ VLIB_CLI_COMMAND (punt_socket_deregister_command, static) = { .path = "punt socket deregister", .function = punt_socket_deregister_cmd, - .short_help = "punt socket deregister [ipv4|ipv6] [udp|tcp]> ", + .short_help = "punt socket deregister [IPV4|ipv6] [UDP|tcp] [ALL|]", .is_mp_safe = 1, }; /* *INDENT-ON* */ -- cgit 1.2.3-korg