fib: changing parsing order to avoid corner case 55/32755/2
authorArthur de Kerhor <arthurdekerhor@gmail.com>
Thu, 17 Jun 2021 07:34:12 +0000 (09:34 +0200)
committerNeale Ranns <neale@graphiant.com>
Thu, 17 Jun 2021 10:32:56 +0000 (10:32 +0000)
mfib interface flags are parsed before the interface name. For some
specific names, this creates a bug when adding routes.

ex: ip route add 10.0.2.0/24 via FortyGigabitEthernetd8/0/0
The 'F' at the beginnig of the interface name is parsed as the
"Forward" flag. Because of that, the interface name parsed is
"ortyGigabitEthernetd8/0/0" which results in a parsing error.

Type: fix

Signed-off-by: Arthur de Kerhor <arthurdekerhor@gmail.com>
Change-Id: Ib76c2f86416455841f910f7b466b467001072b70

src/vnet/fib/fib_types.c

index 2fce6a8..e2b8df7 100644 (file)
@@ -715,9 +715,6 @@ unformat_fib_route_path (unformat_input_t * input, va_list * args)
          rpath->frp_weight = 1;
          rpath->frp_flags |= FIB_ROUTE_PATH_LOCAL;
         }
-      else if (unformat (input, "%U",
-                        unformat_mfib_itf_flags, &rpath->frp_mitf_flags))
-       ;
       else if (unformat (input, "out-labels"))
         {
             while (unformat (input, "%U",
@@ -735,6 +732,9 @@ unformat_fib_route_path (unformat_input_t * input, va_list * args)
         {
             rpath->frp_proto = *payload_proto;
         }
+        else if (unformat (input, "%U",
+                        unformat_mfib_itf_flags, &rpath->frp_mitf_flags))
+       ;
         else if (unformat (input, "via"))
         {
             /* new path, back up and return */