aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/ip
diff options
context:
space:
mode:
authorNeale Ranns <nranns@cisco.com>2019-06-04 13:31:23 +0000
committerDave Barach <openvpp@barachs.net>2019-06-04 15:55:31 +0000
commit68577d2982a345537e300e99a8c0e0311fe08ce1 (patch)
treeca3f73d63d9e833412a108d6bee587365667ad05 /src/vnet/ip
parentdf3ca23f17820389fc625bbc0e7f468fce550aa9 (diff)
punt: fix the set_punt API/CLI which was rejecting valid ports
add a UT for the API Change-Id: I93fb6ec2c5f74b991bf7f229250a30c0395b8e24 Signed-off-by: Neale Ranns <nranns@cisco.com>
Diffstat (limited to 'src/vnet/ip')
-rw-r--r--src/vnet/ip/punt.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/vnet/ip/punt.c b/src/vnet/ip/punt.c
index 296df59b615..6f321507efe 100644
--- a/src/vnet/ip/punt.c
+++ b/src/vnet/ip/punt.c
@@ -397,9 +397,6 @@ punt_l4_add_del (vlib_main_t * vm,
return clib_error_return (0,
"punt TCP/SCTP ports is not supported yet");
- if (!udp_is_valid_dst_port (port, af == AF_IP4))
- return clib_error_return (0, "invalid port: %d", port);
-
udp_register_dst_port (vm, port, udp4_punt_node.index, af == AF_IP4);
return 0;
@@ -438,16 +435,19 @@ punt_cli (vlib_main_t * vm,
{
clib_error_t *error = NULL;
bool is_add = true;
+ /* *INDENT-OFF* */
punt_reg_t pr = {
.punt = {
- .l4 = {
- .af = AF_IP4,
- .port = ~0,
- .protocol = ~0,
- },
- },
+ .l4 = {
+ .af = AF_IP4,
+ .port = ~0,
+ .protocol = ~0,
+ },
+ },
.type = PUNT_TYPE_L4,
};
+ u32 port;
+ /* *INDENT-ON* */
while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
{
@@ -457,8 +457,8 @@ punt_cli (vlib_main_t * vm,
pr.punt.l4.af = AF_IP6;
else if (unformat (input, "ip6"))
pr.punt.l4.af = AF_IP6;
- else if (unformat (input, "%d", &pr.punt.l4.port))
- ;
+ else if (unformat (input, "%d", &port))
+ pr.punt.l4.port = port;
else if (unformat (input, "udp"))
pr.punt.l4.protocol = IP_PROTOCOL_UDP;
else if (unformat (input, "tcp"))