aboutsummaryrefslogtreecommitdiffstats
path: root/extras/vom
diff options
context:
space:
mode:
authorJakub Grajciar <jgrajcia@cisco.com>2019-09-03 10:40:01 +0200
committerOle Trøan <otroan@employees.org>2019-12-11 09:39:42 +0000
commit5de4fb7076a46ab75e2d3c30079dd6639af16a86 (patch)
tree3ac12410c3d0769f5d950df53d6abb43fe54e5b9 /extras/vom
parent8dc75c0cc3ac0db13778a0a32f9aa81597b80556 (diff)
devices: tap API cleanup
Use consistent API types. Type: fix Change-Id: I11cc7f6347b7a60e5fd41e54f0c7994e2d81199f Signed-off-by: Jakub Grajciar <jgrajcia@cisco.com>
Diffstat (limited to 'extras/vom')
-rw-r--r--extras/vom/vom/interface_factory.cpp12
-rw-r--r--extras/vom/vom/tap_interface_cmds.cpp25
2 files changed, 18 insertions, 19 deletions
diff --git a/extras/vom/vom/interface_factory.cpp b/extras/vom/vom/interface_factory.cpp
index a5981fda623..f0b25ffd837 100644
--- a/extras/vom/vom/interface_factory.cpp
+++ b/extras/vom/vom/interface_factory.cpp
@@ -175,12 +175,12 @@ interface_factory::new_tap_interface(
route::prefix_t pfx(route::prefix_t::ZERO);
boost::asio::ip::address addr;
- if (vd.host_ip4_prefix_len)
- pfx =
- route::prefix_t(0, (uint8_t*)vd.host_ip4_addr, vd.host_ip4_prefix_len);
- else if (vd.host_ip6_prefix_len)
- pfx =
- route::prefix_t(1, (uint8_t*)vd.host_ip6_addr, vd.host_ip6_prefix_len);
+ if (vd.host_ip4_prefix.len)
+ pfx = route::prefix_t(
+ 0, (uint8_t*)vd.host_ip4_prefix.address, vd.host_ip4_prefix.len);
+ else if (vd.host_ip6_prefix.len)
+ pfx = route::prefix_t(
+ 1, (uint8_t*)vd.host_ip6_prefix.address, vd.host_ip6_prefix.len);
l2_address_t l2_address(vd.host_mac_addr, 6);
sp = tap_interface(name, interface::admin_state_t::UP, pfx, l2_address)
diff --git a/extras/vom/vom/tap_interface_cmds.cpp b/extras/vom/vom/tap_interface_cmds.cpp
index 1d16aff217e..16bb065e016 100644
--- a/extras/vom/vom/tap_interface_cmds.cpp
+++ b/extras/vom/vom/tap_interface_cmds.cpp
@@ -31,8 +31,7 @@ tapv2_create_cmd::tapv2_create_cmd(HW::item<handle_t>& item,
: interface::create_cmd<vapi::Tap_create_v2>(item, name)
, m_prefix(prefix)
, m_l2_address(l2_address)
-{
-}
+{}
rc_t
tapv2_create_cmd::issue(connection& con)
@@ -41,18 +40,21 @@ tapv2_create_cmd::issue(connection& con)
auto& payload = req.get_request().get_payload();
memset(payload.host_if_name, 0, sizeof(payload.host_if_name));
- memcpy(payload.host_if_name, m_name.c_str(),
+ memcpy(payload.host_if_name,
+ m_name.c_str(),
std::min(m_name.length(), sizeof(payload.host_if_name)));
payload.host_if_name_set = 1;
if (m_prefix != route::prefix_t::ZERO) {
if (m_prefix.address().is_v6()) {
- m_prefix.to_vpp(&payload.host_ip6_addr_set, payload.host_ip6_addr,
- &payload.host_ip6_prefix_len);
+ m_prefix.to_vpp((uint8_t*)&payload.host_ip6_prefix_set,
+ payload.host_ip6_prefix.address,
+ &payload.host_ip6_prefix.len);
} else {
- m_prefix.to_vpp(&payload.host_ip4_addr_set, payload.host_ip4_addr,
- &payload.host_ip4_prefix_len);
- payload.host_ip4_addr_set = 1;
+ m_prefix.to_vpp((uint8_t*)&payload.host_ip4_prefix_set,
+ payload.host_ip4_prefix.address,
+ &payload.host_ip4_prefix.len);
+ payload.host_ip4_prefix_set = 1;
}
}
@@ -89,8 +91,7 @@ tapv2_create_cmd::to_string() const
tapv2_delete_cmd::tapv2_delete_cmd(HW::item<handle_t>& item)
: interface::delete_cmd<vapi::Tap_delete_v2>(item)
-{
-}
+{}
rc_t
tapv2_delete_cmd::issue(connection& con)
@@ -119,9 +120,7 @@ tapv2_delete_cmd::to_string() const
return (s.str());
}
-tapv2_dump_cmd::tapv2_dump_cmd()
-{
-}
+tapv2_dump_cmd::tapv2_dump_cmd() {}
bool
tapv2_dump_cmd::operator==(const tapv2_dump_cmd& other) const