summaryrefslogtreecommitdiffstats
path: root/extras
diff options
context:
space:
mode:
authorNeale Ranns <neale.ranns@cisco.com>2018-05-14 05:16:46 -0700
committerDave Barach <openvpp@barachs.net>2018-05-15 11:30:11 +0000
commitd2d4c10ecd850b4c2fda6d258761026f9c595350 (patch)
treecf727a6a76ea76e3537a22ee2954a9da57457548 /extras
parent70816f0cca308ce3cbf98cdbdb14e02550362b9f (diff)
VOM: nat-binding populate handle errors
Change-Id: I8f41c659c6f50efd679a56878c6fdcf426ac9410 Signed-off-by: Neale Ranns <neale.ranns@cisco.com>
Diffstat (limited to 'extras')
-rw-r--r--extras/vom/vom/nat_binding.cpp34
1 files changed, 25 insertions, 9 deletions
diff --git a/extras/vom/vom/nat_binding.cpp b/extras/vom/vom/nat_binding.cpp
index 64b7a1007ac..3c3d8261d67 100644
--- a/extras/vom/vom/nat_binding.cpp
+++ b/extras/vom/vom/nat_binding.cpp
@@ -222,9 +222,15 @@ nat_binding::event_handler::handle_populate(const client_db::key_t& key)
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::IPV4,
- zone_t::from_vpp(payload.is_inside));
- OM::commit(key, nb);
+
+ if (itf) {
+ nat_binding nb(*itf, direction_t::INPUT, l3_proto_t::IPV4,
+ 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: "
+ << payload.sw_if_index;
+ }
}
std::shared_ptr<nat_binding_cmds::dump_output_44_cmd> ocmd =
@@ -237,9 +243,14 @@ nat_binding::event_handler::handle_populate(const client_db::key_t& key)
auto& payload = record.get_payload();
std::shared_ptr<interface> itf = interface::find(payload.sw_if_index);
- nat_binding nb(*itf, direction_t::OUTPUT, l3_proto_t::IPV4,
- zone_t::from_vpp(payload.is_inside));
- OM::commit(key, nb);
+ if (itf) {
+ nat_binding nb(*itf, direction_t::OUTPUT, l3_proto_t::IPV4,
+ 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: "
+ << payload.sw_if_index;
+ }
}
std::shared_ptr<nat_binding_cmds::dump_input_66_cmd> i6cmd =
@@ -252,9 +263,14 @@ nat_binding::event_handler::handle_populate(const client_db::key_t& key)
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);
+ if (itf) {
+ nat_binding nb(*itf, direction_t::INPUT, l3_proto_t::IPV6,
+ 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: "
+ << payload.sw_if_index;
+ }
}
}