summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Vinciguerra <pvinci@vinciconsulting.com>2019-10-23 16:07:32 -0400
committerAndrew Yourtchenko <ayourtch@gmail.com>2020-08-12 07:43:14 +0000
commitffd24e5243a27a9e2638c0e98d9fb3099f30acb7 (patch)
tree41f6c08e5485f9655b0d8a402bfe00e82d628ed3
parent43deb075fb01c7f91f5e8f3cf0b29a0a1309c2fe (diff)
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)
-rw-r--r--src/vnet/ip/punt.c31
1 files changed, 20 insertions, 11 deletions
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] <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* */