misc: fix ip6_neighbor_cmd 48/26248/3
authorDave Barach <[email protected]>
Mon, 30 Mar 2020 15:06:46 +0000 (11:06 -0400)
committerAndrew Yourtchenko <[email protected]>
Wed, 1 Apr 2020 11:41:56 +0000 (11:41 +0000)
The option parsing loop had "break" statements included in each
'if (unformat (line_input, "this-option ...") option_values=xxx;'
statement.

Result: the code would silently ignore all but the first
option. Probably broken forever, not easy to spot because the code
looks OK even though it's badly broken.

Manual cherrypick: the function name has changed, the code has
moved to a different file, and the MAINTAINERS file entry doesn't
exist in 19.08.

Type: fix

Signed-off-by: Dave Barach <[email protected]>
(cherry picked from commit 7249b90ab21c20138907e692dcb6032aea9e2f0f)
Change-Id: Ie06bb083645302848a19ecc9ad2934927de01f62

src/vnet/ip/ip6_neighbor.c

index 071d3eb..87aa581 100644 (file)
@@ -3708,34 +3708,28 @@ ip6_neighbor_cmd (vlib_main_t * vm, unformat_input_t * main_input,
                         unformat_ip6_address, &ip6_addr, &addr_len))
        {
          add_radv_info = 0;
-         break;
        }
       else if (unformat (line_input, "ra-managed-config-flag"))
        {
          managed = 1;
-         break;
        }
       else if (unformat (line_input, "ra-other-config-flag"))
        {
          other = 1;
-         break;
        }
       else if (unformat (line_input, "ra-suppress") ||
               unformat (line_input, "ra-surpress"))
        {
          suppress = 1;
-         break;
        }
       else if (unformat (line_input, "ra-suppress-link-layer") ||
               unformat (line_input, "ra-surpress-link-layer"))
        {
          suppress_ll_option = 1;
-         break;
        }
       else if (unformat (line_input, "ra-send-unicast"))
        {
          send_unicast = 1;
-         break;
        }
       else if (unformat (line_input, "ra-lifetime"))
        {
@@ -3745,7 +3739,6 @@ ip6_neighbor_cmd (vlib_main_t * vm, unformat_input_t * main_input,
              goto done;
            }
          use_lifetime = 1;
-         break;
        }
       else if (unformat (line_input, "ra-initial"))
        {
@@ -3755,7 +3748,6 @@ ip6_neighbor_cmd (vlib_main_t * vm, unformat_input_t * main_input,
              error = unformat_parse_error (line_input);
              goto done;
            }
-         break;
        }
       else if (unformat (line_input, "ra-interval"))
        {
@@ -3767,12 +3759,10 @@ ip6_neighbor_cmd (vlib_main_t * vm, unformat_input_t * main_input,
 
          if (!unformat (line_input, "%d", &ra_min_interval))
            ra_min_interval = 0;
-         break;
        }
       else if (unformat (line_input, "ra-cease"))
        {
          cease = 1;
-         break;
        }
       else
        {