diff options
author | Ole Trøan <otroan@employees.org> | 2019-04-23 12:38:35 +0000 |
---|---|---|
committer | Ole Trøan <otroan@employees.org> | 2019-04-23 15:08:45 +0000 |
commit | 89fec713f84b8f567c52743c9c514ac29297fbda (patch) | |
tree | 52c25aa7bd1a23f03f8a176b669b33724f57d09c /src/plugins/nat/nat_test.c | |
parent | b8591ac91318984a2706c6388ff836f1a9ef0a16 (diff) |
Revert "NAT: VPP-1531 api cleanup & update"
This reverts commit bed1421b9f1b3643d93384084972337b596aec73.
/vpp/master3/src/plugins/nat/nat_api.c: In function ‘send_nat_worker_details’:
/vpp/master3/src/vppinfra/clib.h:62:33: error: division ‘sizeof (u8 * {aka unsigned char *}) / sizeof (u8 {aka unsigned char})’ does not compute the number of array elements [-Werror=sizeof-pointer-div]
#define ARRAY_LEN(x) (sizeof (x)/sizeof (x[0]))
^
/vpp/master3/src/plugins/nat/nat_api.c:205:43: note: in expansion of macro ‘ARRAY_LEN’
rmp = vl_msg_api_alloc (sizeof (*rmp) + ARRAY_LEN (w->name) - 1);
^~~~~~~~~
Change-Id: Ie82672c145fb2f6580827f95e535435307bc7a23
Signed-off-by: Ole Troan <ot@cisco.com>
Diffstat (limited to 'src/plugins/nat/nat_test.c')
-rw-r--r-- | src/plugins/nat/nat_test.c | 30 |
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), |