cnat: fix interface map type unformat 43/41143/5
authorBenoît Ganne <[email protected]>
Wed, 12 Jun 2024 12:04:45 +0000 (14:04 +0200)
committerBenoît Ganne <[email protected]>
Wed, 5 Feb 2025 14:25:13 +0000 (15:25 +0100)
C enum is not guaranteed to be 8-bit (and in general it is not, it's
32-bits by default in GCC for example).

Type: fix

Change-Id: I6a10f85991ae1903fb9f4aeebfcfdf5315200903
Signed-off-by: Benoît Ganne <[email protected]>
src/plugins/cnat/cnat_snat_policy.c

index cd9bfef..5f15b7d 100644 (file)
@@ -22,7 +22,8 @@ cnat_snat_policy_main_t cnat_snat_policy_main;
 uword
 unformat_cnat_snat_interface_map_type (unformat_input_t *input, va_list *args)
 {
-  u8 *a = va_arg (*args, u8 *);
+  cnat_snat_interface_map_type_t *a =
+    va_arg (*args, cnat_snat_interface_map_type_t *);
   if (unformat (input, "include-v4"))
     *a = CNAT_SNAT_IF_MAP_INCLUDE_V4;
   else if (unformat (input, "include-v6"))
@@ -113,7 +114,7 @@ cnat_snat_policy_add_del_if_command_fn (vlib_main_t *vm,
   vnet_main_t *vnm = vnet_get_main ();
   int is_add = 1;
   u32 sw_if_index = ~0;
-  u32 table = 0;
+  cnat_snat_interface_map_type_t table = CNAT_SNAT_IF_MAP_INCLUDE_V4;
   int rv;
 
   while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)