aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/nat/nat_test.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/nat/nat_test.c')
-rw-r--r--src/plugins/nat/nat_test.c30
1 files changed, 8 insertions, 22 deletions
diff --git a/src/plugins/nat/nat_test.c b/src/plugins/nat/nat_test.c
index 0371ec48553..b1de5340b9d 100644
--- a/src/plugins/nat/nat_test.c
+++ b/src/plugins/nat/nat_test.c
@@ -221,8 +221,7 @@ static int api_nat44_interface_add_del_feature (vat_main_t * vam)
M(NAT44_INTERFACE_ADD_DEL_FEATURE, mp);
mp->sw_if_index = ntohl(sw_if_index);
mp->is_add = is_add;
- if (is_inside)
- mp->flags |= NAT_API_IS_INSIDE;
+ mp->is_inside = is_inside;
S(mp);
W (ret);
@@ -292,11 +291,8 @@ static int api_nat44_add_del_static_mapping(vat_main_t * vam)
}
M(NAT44_ADD_DEL_STATIC_MAPPING, mp);
-
mp->is_add = is_add;
- if (addr_only)
- mp->flags |= NAT_API_IS_ADDR_ONLY;
-
+ mp->addr_only = addr_only;
mp->local_port = ntohs ((u16) local_port);
mp->external_port = ntohs ((u16) external_port);
mp->external_sw_if_index = ntohl (sw_if_index);
@@ -331,21 +327,20 @@ static void vl_api_nat44_static_mapping_details_t_handler
{
snat_test_main_t * sm = &snat_test_main;
vat_main_t *vam = sm->vat_main;
- nat_config_flags_t flags = (nat_config_flags_t) mp->flags;
- if (flags & NAT_API_IS_ADDR_ONLY && mp->external_sw_if_index != ~0)
+ if (mp->addr_only && mp->external_sw_if_index != ~0)
fformat (vam->ofp, "%15U%6s%15d%6s%11d%6d\n",
format_ip4_address, &mp->local_ip_address, "",
ntohl (mp->external_sw_if_index), "",
ntohl (mp->vrf_id),
mp->protocol);
- else if (flags & NAT_API_IS_ADDR_ONLY && mp->external_sw_if_index == ~0)
+ else if (mp->addr_only && mp->external_sw_if_index == ~0)
fformat (vam->ofp, "%15U%6s%15U%6s%11d%6d\n",
format_ip4_address, &mp->local_ip_address, "",
format_ip4_address, &mp->external_ip_address, "",
ntohl (mp->vrf_id),
mp->protocol);
- else if (!(flags & NAT_API_IS_ADDR_ONLY) && mp->external_sw_if_index != ~0)
+ else if (!mp->addr_only && mp->external_sw_if_index != ~0)
fformat (vam->ofp, "%15U%6d%15d%6d%11d%6d\n",
format_ip4_address, &mp->local_ip_address,
ntohs (mp->local_port),
@@ -474,19 +469,11 @@ static int api_nat44_address_dump(vat_main_t * vam)
static void vl_api_nat44_interface_details_t_handler
(vl_api_nat44_interface_details_t *mp)
{
- nat_config_flags_t flags = (nat_config_flags_t) mp->flags;
snat_test_main_t * sm = &snat_test_main;
vat_main_t *vam = sm->vat_main;
- if ((flags & NAT_API_IS_INSIDE) && (flags & NAT_API_IS_OUTSIDE))
- {
- fformat (vam->ofp, "sw_if_index %d in & out\n", ntohl (mp->sw_if_index));
- }
- else
- {
- fformat (vam->ofp, "sw_if_index %d %s\n", ntohl (mp->sw_if_index),
- flags & NAT_API_IS_INSIDE ? "in" : "out");
- }
+ fformat (vam->ofp, "sw_if_index %d %s\n", ntohl (mp->sw_if_index),
+ mp->is_inside ? "in" : "out");
}
static int api_nat44_interface_dump(vat_main_t * vam)
@@ -603,7 +590,6 @@ static int api_nat44_add_del_interface_addr (vat_main_t * vam)
M(NAT44_ADD_DEL_INTERFACE_ADDR, mp);
mp->sw_if_index = ntohl(sw_if_index);
-
mp->is_add = is_add;
S(mp);
@@ -685,7 +671,7 @@ static void vl_api_nat44_user_session_details_t_handler
fformat(vam->ofp, "%s session %U:%d to %U:%d protocol id %d "
"total packets %d total bytes %lld\n",
- mp->flags & NAT_API_IS_STATIC ? "static" : "dynamic",
+ mp->is_static ? "static" : "dynamic",
format_ip4_address, mp->inside_ip_address, ntohs(mp->inside_port),
format_ip4_address, mp->outside_ip_address, ntohs(mp->outside_port),
ntohs(mp->protocol), ntohl(mp->total_pkts),