aboutsummaryrefslogtreecommitdiffstats
path: root/extras
diff options
context:
space:
mode:
authorFilip Varga <fivarga@cisco.com>2019-04-15 18:52:43 +0200
committerOle Trøan <otroan@employees.org>2019-04-24 11:09:37 +0000
commitdd1e3e780cd480e3f29fc34df48e605ded1acb2c (patch)
tree29ecae4a0f965a65b96886ee06438adeb6a14d21 /extras
parent58c7580b1641879c91ac708162f1c3fccbb67302 (diff)
NAT: VPP-1531 api cleanup & update
Change-Id: I2492400a67b39a3adbc24ab7cf1ba17a409e95a8 Signed-off-by: Filip Varga <fivarga@cisco.com>
Diffstat (limited to 'extras')
-rw-r--r--extras/vom/vom/nat_binding.cpp6
-rw-r--r--extras/vom/vom/nat_binding_cmds.cpp18
-rw-r--r--extras/vom/vom/nat_static_cmds.cpp4
3 files changed, 17 insertions, 11 deletions
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<interface> 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<interface> 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;