summaryrefslogtreecommitdiffstats
path: root/src/vpp-api/vom/nat_binding.cpp
diff options
context:
space:
mode:
authorNeale Ranns <neale.ranns@cisco.com>2018-04-24 07:45:33 -0700
committerDamjan Marion <dmarion.lists@gmail.com>2018-04-25 14:00:46 +0000
commit4a6d02337b9058182172f19df894ad2e18e6ac68 (patch)
tree60e1da4bfef3226dcac74c1c041e4387e2a0120e /src/vpp-api/vom/nat_binding.cpp
parent99ed486d1edf5d3eb6550179f3c379b1e9d4cafe (diff)
GBPv6: NAT66 actions for GBP
Change-Id: I379150a88f2d53d6281be41e8bad6fc4f4e88a71 Signed-off-by: Neale Ranns <neale.ranns@cisco.com>
Diffstat (limited to 'src/vpp-api/vom/nat_binding.cpp')
-rw-r--r--src/vpp-api/vom/nat_binding.cpp66
1 files changed, 54 insertions, 12 deletions
diff --git a/src/vpp-api/vom/nat_binding.cpp b/src/vpp-api/vom/nat_binding.cpp
index eca3f9041f0..64b7a1007ac 100644
--- a/src/vpp-api/vom/nat_binding.cpp
+++ b/src/vpp-api/vom/nat_binding.cpp
@@ -85,11 +85,20 @@ nat_binding::sweep()
{
if (m_binding) {
if (direction_t::INPUT == m_dir) {
- HW::enqueue(new nat_binding_cmds::unbind_44_input_cmd(
- m_binding, m_itf->handle(), m_zone));
+ if (l3_proto_t::IPV4 == m_proto) {
+ HW::enqueue(new nat_binding_cmds::unbind_44_input_cmd(
+ m_binding, m_itf->handle(), m_zone));
+ } else {
+ HW::enqueue(new nat_binding_cmds::unbind_66_input_cmd(
+ m_binding, m_itf->handle(), m_zone));
+ }
} else {
- HW::enqueue(new nat_binding_cmds::unbind_44_output_cmd(
- m_binding, m_itf->handle(), m_zone));
+ if (l3_proto_t::IPV4 == m_proto) {
+ HW::enqueue(new nat_binding_cmds::unbind_44_output_cmd(
+ m_binding, m_itf->handle(), m_zone));
+ } else {
+ VOM_LOG(log_level_t::ERROR) << "NAT 66 output feature not supported";
+ }
}
}
HW::write();
@@ -100,11 +109,20 @@ nat_binding::replay()
{
if (m_binding) {
if (direction_t::INPUT == m_dir) {
- HW::enqueue(new nat_binding_cmds::bind_44_input_cmd(
- m_binding, m_itf->handle(), m_zone));
+ if (l3_proto_t::IPV4 == m_proto) {
+ HW::enqueue(new nat_binding_cmds::bind_44_input_cmd(
+ m_binding, m_itf->handle(), m_zone));
+ } else {
+ HW::enqueue(new nat_binding_cmds::bind_66_input_cmd(
+ m_binding, m_itf->handle(), m_zone));
+ }
} else {
- HW::enqueue(new nat_binding_cmds::bind_44_output_cmd(
- m_binding, m_itf->handle(), m_zone));
+ if (l3_proto_t::IPV4 == m_proto) {
+ HW::enqueue(new nat_binding_cmds::bind_44_output_cmd(
+ m_binding, m_itf->handle(), m_zone));
+ } else {
+ VOM_LOG(log_level_t::ERROR) << "NAT 66 output feature not supported";
+ }
}
}
}
@@ -117,11 +135,20 @@ nat_binding::update(const nat_binding& desired)
*/
if (!m_binding) {
if (direction_t::INPUT == m_dir) {
- HW::enqueue(new nat_binding_cmds::bind_44_input_cmd(
- m_binding, m_itf->handle(), m_zone));
+ if (l3_proto_t::IPV4 == m_proto) {
+ HW::enqueue(new nat_binding_cmds::bind_44_input_cmd(
+ m_binding, m_itf->handle(), m_zone));
+ } else {
+ HW::enqueue(new nat_binding_cmds::bind_66_input_cmd(
+ m_binding, m_itf->handle(), m_zone));
+ }
} else {
- HW::enqueue(new nat_binding_cmds::bind_44_output_cmd(
- m_binding, m_itf->handle(), m_zone));
+ if (l3_proto_t::IPV4 == m_proto) {
+ HW::enqueue(new nat_binding_cmds::bind_44_output_cmd(
+ m_binding, m_itf->handle(), m_zone));
+ } else {
+ VOM_LOG(log_level_t::ERROR) << "NAT 66 output feature not supported";
+ }
}
}
}
@@ -214,6 +241,21 @@ nat_binding::event_handler::handle_populate(const client_db::key_t& key)
zone_t::from_vpp(payload.is_inside));
OM::commit(key, nb);
}
+
+ std::shared_ptr<nat_binding_cmds::dump_input_66_cmd> i6cmd =
+ std::make_shared<nat_binding_cmds::dump_input_66_cmd>();
+
+ HW::enqueue(i6cmd);
+ HW::write();
+
+ for (auto& record : *i6cmd) {
+ auto& payload = record.get_payload();
+
+ std::shared_ptr<interface> itf = interface::find(payload.sw_if_index);
+ nat_binding nb(*itf, direction_t::INPUT, l3_proto_t::IPV6,
+ zone_t::from_vpp(payload.is_inside));
+ OM::commit(key, nb);
+ }
}
dependency_t