tunnel: Fix the format of tunnel flags 48/35548/2
authorNeale Ranns <neale@graphiant.com>
Fri, 4 Mar 2022 13:44:47 +0000 (13:44 +0000)
committerNeale Ranns <neale@graphiant.com>
Fri, 4 Mar 2022 14:29:09 +0000 (14:29 +0000)
Type: fix

it only display the first flag set

Signed-off-by: Neale Ranns <neale@graphiant.com>
Change-Id: I45cddbac0d4eed8bda10bf5e0f7c9db0faf183c5

src/vnet/tunnel/tunnel.c

index d45a462..0d27ad8 100644 (file)
@@ -66,16 +66,19 @@ unformat_tunnel_mode (unformat_input_t * input, va_list * args)
 u8 *
 format_tunnel_encap_decap_flags (u8 * s, va_list * args)
 {
-  tunnel_encap_decap_flags_t f = va_arg (*args, int);
+  tunnel_encap_decap_flags_t f = va_arg (*args, u32);
 
   if (f == TUNNEL_ENCAP_DECAP_FLAG_NONE)
     s = format (s, "none");
-
+  else
+    {
 #define _(a, b, c)                                                            \
-  else if (f & TUNNEL_ENCAP_DECAP_FLAG_##a) s = format (s, "%s ", b);
-  foreach_tunnel_encap_decap_flag
+  if (f & TUNNEL_ENCAP_DECAP_FLAG_##a)                                        \
+    s = format (s, "%s ", b);
+      foreach_tunnel_encap_decap_flag
 #undef _
-    return (s);
+    }
+  return (s);
 }
 
 uword
@@ -95,15 +98,19 @@ unformat_tunnel_encap_decap_flags (unformat_input_t * input, va_list * args)
 u8 *
 format_tunnel_flags (u8 *s, va_list *args)
 {
-  tunnel_flags_t f = va_arg (*args, int);
+  tunnel_flags_t f = va_arg (*args, u32);
 
   if (f == TUNNEL_FLAG_NONE)
     s = format (s, "none");
-
-#define _(a, b, c) else if (f & TUNNEL_FLAG_##a) s = format (s, "%s ", c);
-  foreach_tunnel_flag
+  else
+    {
+#define _(a, b, c)                                                            \
+  if (f & TUNNEL_FLAG_##a)                                                    \
+    s = format (s, "%s ", c);
+      foreach_tunnel_flag
 #undef _
-    return (s);
+    }
+  return (s);
 }
 
 uword