nat: nat44-ed pool address allocation improvement
[vpp.git] / src / plugins / nat / nat44-ed / nat44_ed_cli.c
index 5ab14a6..9743ce6 100644 (file)
@@ -632,10 +632,14 @@ nat44_show_addresses_command_fn (vlib_main_t * vm, unformat_input_t * input,
     {
       vlib_cli_output (vm, "%U", format_ip4_address, &ap->addr);
       if (ap->fib_index != ~0)
-          vlib_cli_output (vm, "  tenant VRF: %u",
-            fib_table_get(ap->fib_index, FIB_PROTOCOL_IP4)->ft_table_id);
+       vlib_cli_output (
+         vm, "  tenant VRF: %u",
+         fib_table_get (ap->fib_index, FIB_PROTOCOL_IP4)->ft_table_id);
       else
         vlib_cli_output (vm, "  tenant VRF independent");
+
+      if (ap->addr_len != ~0)
+       vlib_cli_output (vm, "  synced with interface address");
     }
   vlib_cli_output (vm, "NAT44 twice-nat pool addresses:");
   vec_foreach (ap, sm->twice_nat_addresses)
@@ -646,6 +650,9 @@ nat44_show_addresses_command_fn (vlib_main_t * vm, unformat_input_t * input,
             fib_table_get(ap->fib_index, FIB_PROTOCOL_IP4)->ft_table_id);
       else
         vlib_cli_output (vm, "  tenant VRF independent");
+
+      if (ap->addr_len != ~0)
+       vlib_cli_output (vm, "  synced with interface address");
     }
   return 0;
 }
@@ -974,7 +981,7 @@ add_identity_mapping_command_fn (vlib_main_t * vm,
 
   int rv, is_add = 1, port_set = 0;
   u32 sw_if_index, port, flags, vrf_id = ~0;
-  ip_protocol_t proto;
+  ip_protocol_t proto = 0;
   ip4_address_t addr;
 
   flags = NAT_SM_FLAG_IDENTITY_NAT;
@@ -1383,7 +1390,7 @@ nat44_show_sessions_command_fn (vlib_main_t * vm, unformat_input_t * input,
   u16 i2o_sp, i2o_dp, o2i_sp, o2i_dp;
   u8 filter_i2o_sp = 0, filter_i2o_dp = 0;
   u8 filter_o2i_sp = 0, filter_o2i_dp = 0;
-  nat_protocol_t proto;
+  ip_protocol_t proto;
   u8 filter_proto = 0;
   u8 had_input = 1, filtering = 0;
   int i = 0, showed_sessions;
@@ -1417,10 +1424,10 @@ nat44_show_sessions_command_fn (vlib_main_t * vm, unformat_input_t * input,
       else if (unformat (line_input, "filter o2i dport %u", &o2i_dp))
        filter_o2i_dp = filtering = 1;
       else if (unformat (line_input, "filter i2o proto %U",
-                        unformat_nat_protocol, &proto))
+                        unformat_ip_protocol, &proto))
        filter_proto = filtering = 1;
       else if (unformat (line_input, "filter o2i proto %U",
-                        unformat_nat_protocol, &proto))
+                        unformat_ip_protocol, &proto))
        filter_proto = filtering = 1;
       else
        {
@@ -1467,7 +1474,7 @@ print:
              if (filter_o2i_dp &&
                  o2i_dp != clib_net_to_host_u16 (s->o2i.match.dport))
                continue;
-             if (filter_proto && proto != s->nat_proto)
+             if (filter_proto && proto != s->proto)
                continue;
              showed_sessions++;
            }