From 89fec713f84b8f567c52743c9c514ac29297fbda Mon Sep 17 00:00:00 2001 From: Ole Trøan Date: Tue, 23 Apr 2019 12:38:35 +0000 Subject: Revert "NAT: VPP-1531 api cleanup & update" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- extras/vom/vom/nat_binding.cpp | 6 +++--- extras/vom/vom/nat_binding_cmds.cpp | 18 ++++++------------ extras/vom/vom/nat_static_cmds.cpp | 4 ++-- 3 files changed, 11 insertions(+), 17 deletions(-) (limited to 'extras/vom') diff --git a/extras/vom/vom/nat_binding.cpp b/extras/vom/vom/nat_binding.cpp index a3fdee77be4..3c3d8261d67 100644 --- a/extras/vom/vom/nat_binding.cpp +++ b/extras/vom/vom/nat_binding.cpp @@ -225,7 +225,7 @@ nat_binding::event_handler::handle_populate(const client_db::key_t& key) if (itf) { nat_binding nb(*itf, direction_t::INPUT, l3_proto_t::IPV4, - zone_t::from_vpp(payload.flags & NAT_IS_INSIDE)); + zone_t::from_vpp(payload.is_inside)); OM::commit(key, nb); } else { VOM_LOG(log_level_t::ERROR) << "nat-binding-input-44 no sw_if_index: " @@ -245,7 +245,7 @@ nat_binding::event_handler::handle_populate(const client_db::key_t& key) std::shared_ptr itf = interface::find(payload.sw_if_index); if (itf) { nat_binding nb(*itf, direction_t::OUTPUT, l3_proto_t::IPV4, - zone_t::from_vpp(payload.flags & NAT_IS_INSIDE)); + zone_t::from_vpp(payload.is_inside)); OM::commit(key, nb); } else { VOM_LOG(log_level_t::ERROR) << "nat-binding-output-44 no sw_if_index: " @@ -265,7 +265,7 @@ nat_binding::event_handler::handle_populate(const client_db::key_t& key) std::shared_ptr itf = interface::find(payload.sw_if_index); if (itf) { nat_binding nb(*itf, direction_t::INPUT, l3_proto_t::IPV6, - zone_t::from_vpp(payload.flags & NAT_IS_INSIDE)); + zone_t::from_vpp(payload.is_inside)); OM::commit(key, nb); } else { VOM_LOG(log_level_t::ERROR) << "nat-binding-input-66 no sw_if_index: " diff --git a/extras/vom/vom/nat_binding_cmds.cpp b/extras/vom/vom/nat_binding_cmds.cpp index 4e69a67f2af..d67a0828003 100644 --- a/extras/vom/vom/nat_binding_cmds.cpp +++ b/extras/vom/vom/nat_binding_cmds.cpp @@ -39,8 +39,7 @@ bind_44_input_cmd::issue(connection& con) auto& payload = req.get_request().get_payload(); payload.is_add = 1; - payload.flags = (vapi_enum_nat_config_flags)( - nat_binding::zone_t::INSIDE == m_zone ? NAT_IS_INSIDE : 0); + payload.is_inside = (nat_binding::zone_t::INSIDE == m_zone ? 1 : 0); payload.sw_if_index = m_itf.value(); VAPI_CALL(req.execute()); @@ -80,8 +79,7 @@ unbind_44_input_cmd::issue(connection& con) auto& payload = req.get_request().get_payload(); payload.is_add = 0; - payload.flags = (vapi_enum_nat_config_flags)( - nat_binding::zone_t::INSIDE == m_zone ? NAT_IS_INSIDE : 0); + payload.is_inside = (nat_binding::zone_t::INSIDE == m_zone ? 1 : 0); payload.sw_if_index = m_itf.value(); VAPI_CALL(req.execute()); @@ -121,8 +119,7 @@ bind_44_output_cmd::issue(connection& con) auto& payload = req.get_request().get_payload(); payload.is_add = 1; - payload.flags = (vapi_enum_nat_config_flags)( - nat_binding::zone_t::INSIDE == m_zone ? NAT_IS_INSIDE : 0); + payload.is_inside = (nat_binding::zone_t::INSIDE == m_zone ? 1 : 0); payload.sw_if_index = m_itf.value(); VAPI_CALL(req.execute()); @@ -162,8 +159,7 @@ unbind_44_output_cmd::issue(connection& con) auto& payload = req.get_request().get_payload(); payload.is_add = 0; - payload.flags = (vapi_enum_nat_config_flags)( - nat_binding::zone_t::INSIDE == m_zone ? NAT_IS_INSIDE : 0); + payload.is_inside = (nat_binding::zone_t::INSIDE == m_zone ? 1 : 0); payload.sw_if_index = m_itf.value(); VAPI_CALL(req.execute()); @@ -267,8 +263,7 @@ bind_66_input_cmd::issue(connection& con) auto& payload = req.get_request().get_payload(); payload.is_add = 1; - payload.flags = (vapi_enum_nat_config_flags)( - nat_binding::zone_t::INSIDE == m_zone ? NAT_IS_INSIDE : 0); + payload.is_inside = (nat_binding::zone_t::INSIDE == m_zone ? 1 : 0); payload.sw_if_index = m_itf.value(); VAPI_CALL(req.execute()); @@ -310,8 +305,7 @@ unbind_66_input_cmd::issue(connection& con) auto& payload = req.get_request().get_payload(); payload.is_add = 0; - payload.flags = (vapi_enum_nat_config_flags)( - nat_binding::zone_t::INSIDE == m_zone ? NAT_IS_INSIDE : 0); + payload.is_inside = (nat_binding::zone_t::INSIDE == m_zone ? 1 : 0); payload.sw_if_index = m_itf.value(); VAPI_CALL(req.execute()); diff --git a/extras/vom/vom/nat_static_cmds.cpp b/extras/vom/vom/nat_static_cmds.cpp index 0c4d7283ea6..299f2f5f328 100644 --- a/extras/vom/vom/nat_static_cmds.cpp +++ b/extras/vom/vom/nat_static_cmds.cpp @@ -45,7 +45,7 @@ create_44_cmd::issue(connection& con) auto& payload = req.get_request().get_payload(); payload.is_add = 1; - payload.flags = NAT_IS_ADDR_ONLY; + payload.addr_only = 1; payload.local_port = 0; payload.external_port = 0; payload.vrf_id = m_id; @@ -94,7 +94,7 @@ delete_44_cmd::issue(connection& con) auto& payload = req.get_request().get_payload(); payload.is_add = 0; - payload.flags = NAT_IS_ADDR_ONLY; + payload.addr_only = 1; payload.local_port = 0; payload.external_port = 0; payload.vrf_id = m_id; -- cgit 1.2.3-korg