From bed1421b9f1b3643d93384084972337b596aec73 Mon Sep 17 00:00:00 2001 From: Filip Varga Date: Mon, 15 Apr 2019 18:52:43 +0200 Subject: NAT: VPP-1531 api cleanup & update Change-Id: I519d7efc8ee3c86381d96be2e2a46017cd948895 Signed-off-by: Filip Varga --- 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, 17 insertions(+), 11 deletions(-) (limited to 'extras') diff --git a/extras/vom/vom/nat_binding.cpp b/extras/vom/vom/nat_binding.cpp index 3c3d8261d67..a3fdee77be4 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.is_inside)); + zone_t::from_vpp(payload.flags & NAT_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.is_inside)); + zone_t::from_vpp(payload.flags & NAT_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.is_inside)); + zone_t::from_vpp(payload.flags & NAT_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 d67a0828003..4e69a67f2af 100644 --- a/extras/vom/vom/nat_binding_cmds.cpp +++ b/extras/vom/vom/nat_binding_cmds.cpp @@ -39,7 +39,8 @@ bind_44_input_cmd::issue(connection& con) auto& payload = req.get_request().get_payload(); payload.is_add = 1; - payload.is_inside = (nat_binding::zone_t::INSIDE == m_zone ? 1 : 0); + payload.flags = (vapi_enum_nat_config_flags)( + nat_binding::zone_t::INSIDE == m_zone ? NAT_IS_INSIDE : 0); payload.sw_if_index = m_itf.value(); VAPI_CALL(req.execute()); @@ -79,7 +80,8 @@ unbind_44_input_cmd::issue(connection& con) auto& payload = req.get_request().get_payload(); payload.is_add = 0; - payload.is_inside = (nat_binding::zone_t::INSIDE == m_zone ? 1 : 0); + payload.flags = (vapi_enum_nat_config_flags)( + nat_binding::zone_t::INSIDE == m_zone ? NAT_IS_INSIDE : 0); payload.sw_if_index = m_itf.value(); VAPI_CALL(req.execute()); @@ -119,7 +121,8 @@ bind_44_output_cmd::issue(connection& con) auto& payload = req.get_request().get_payload(); payload.is_add = 1; - payload.is_inside = (nat_binding::zone_t::INSIDE == m_zone ? 1 : 0); + payload.flags = (vapi_enum_nat_config_flags)( + nat_binding::zone_t::INSIDE == m_zone ? NAT_IS_INSIDE : 0); payload.sw_if_index = m_itf.value(); VAPI_CALL(req.execute()); @@ -159,7 +162,8 @@ unbind_44_output_cmd::issue(connection& con) auto& payload = req.get_request().get_payload(); payload.is_add = 0; - payload.is_inside = (nat_binding::zone_t::INSIDE == m_zone ? 1 : 0); + payload.flags = (vapi_enum_nat_config_flags)( + nat_binding::zone_t::INSIDE == m_zone ? NAT_IS_INSIDE : 0); payload.sw_if_index = m_itf.value(); VAPI_CALL(req.execute()); @@ -263,7 +267,8 @@ bind_66_input_cmd::issue(connection& con) auto& payload = req.get_request().get_payload(); payload.is_add = 1; - payload.is_inside = (nat_binding::zone_t::INSIDE == m_zone ? 1 : 0); + payload.flags = (vapi_enum_nat_config_flags)( + nat_binding::zone_t::INSIDE == m_zone ? NAT_IS_INSIDE : 0); payload.sw_if_index = m_itf.value(); VAPI_CALL(req.execute()); @@ -305,7 +310,8 @@ unbind_66_input_cmd::issue(connection& con) auto& payload = req.get_request().get_payload(); payload.is_add = 0; - payload.is_inside = (nat_binding::zone_t::INSIDE == m_zone ? 1 : 0); + payload.flags = (vapi_enum_nat_config_flags)( + nat_binding::zone_t::INSIDE == m_zone ? NAT_IS_INSIDE : 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 299f2f5f328..0c4d7283ea6 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.addr_only = 1; + payload.flags = NAT_IS_ADDR_ONLY; 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.addr_only = 1; + payload.flags = NAT_IS_ADDR_ONLY; payload.local_port = 0; payload.external_port = 0; payload.vrf_id = m_id; -- cgit 1.2.3-korg