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 <pvinci@vinciconsulting.com>
(cherry picked from commit 32c4d38f7ac6fe22abb0b4859f6075bb9b661773)
This commit is contained in:
Paul Vinciguerra 2019-10-23 16:07:32 -04:00 committed by Andrew Yourtchenko
parent 43deb075fb
commit ffd24e5243

View File

@ -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] <all | port-num1 [port-num2 ...]>",
.short_help = "set punt [IPV4|ip6|ipv6] [UDP|tcp] [del] [ALL|<port-num>]",
.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]> <all | port-num1 [port-num2 ...]> <socket>",
.short_help = "punt socket register [IPV4|ipv6] [UDP|tcp] [ALL|<port-num>] socket <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]> <all | port-num1 [port-num2 ...]>",
.short_help = "punt socket deregister [IPV4|ipv6] [UDP|tcp] [ALL|<port-num>]",
.is_mp_safe = 1,
};
/* *INDENT-ON* */