From 68577d2982a345537e300e99a8c0e0311fe08ce1 Mon Sep 17 00:00:00 2001 From: Neale Ranns Date: Tue, 4 Jun 2019 13:31:23 +0000 Subject: 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 --- src/vnet/ip/punt.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'src/vnet') 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")) -- cgit 1.2.3-korg