NAT: fix bin API dump of static mappings.
Static mappings with equal local and external IPs
but different ports were dumped as identity mappings.
@@ -876,7 +876,9 @@ vl_api_nat44_static_mapping_dump_t_handler (vl_api_nat44_static_mapping_dump_t
/* *INDENT-OFF* */
pool_foreach (m, sm->static_mappings,
({
- if (!vec_len(m->locals) && (m->local_addr.as_u32 != m->external_addr.as_u32))
+ if (!vec_len (m->locals) &&
+ ((m->local_port != m->external_port)
+ || (m->local_addr.as_u32 != m->external_addr.as_u32)))
send_nat44_static_mapping_details (m, reg, mp->context);
}));
/* *INDENT-ON* */
@@ -1034,7 +1036,8 @@ static void
/* *INDENT-OFF* */
pool_foreach (m, sm->static_mappings,
({
- if (!vec_len(m->locals) && (m->local_addr.as_u32 == m->external_addr.as_u32))
+ if (!vec_len (m->locals) && (m->local_port == m->external_port)
+ && (m->local_addr.as_u32 == m->external_addr.as_u32))
send_nat44_identity_mapping_details (m, reg, mp->context);
}));
/* *INDENT-ON* */
