aboutsummaryrefslogtreecommitdiffstats
path: root/extras/vom
diff options
context:
space:
mode:
authorNeale Ranns <nranns@cisco.com>2019-09-30 10:53:31 +0000
committerOle Trøan <otroan@employees.org>2019-12-17 10:56:20 +0000
commitcbe25aab3be72154f2c706c39eeba6a77f34450f (patch)
tree131fb53b5ec973be045ffb9e2eb797af01d112a0 /extras/vom
parent96453fd2417ebd1d69354a7fb692976129cea80e (diff)
ip: Protocol Independent IP Neighbors
Type: feature - ip-neighbour: generic neighbour handling; APIs, DBs, event handling, aging - arp: ARP protocol implementation - ip6-nd; IPv6 neighbor discovery implementation; separate ND, MLD, RA - ip6-link; manage link-local addresses - l2-arp-term; events separated from IP neighbours, since they are not the same. vnet retains just enough education to perform ND/ARP packet construction. arp and ip6-nd to be moved to plugins soon. Change-Id: I88dedd0006b299344f4c7024a0aa5baa6b9a8bbe Signed-off-by: Neale Ranns <nranns@cisco.com>
Diffstat (limited to 'extras/vom')
-rw-r--r--extras/vom/vom/.clang-format1
-rw-r--r--extras/vom/vom/api_types.cpp16
-rw-r--r--extras/vom/vom/api_types.hpp2
-rw-r--r--extras/vom/vom/arp_proxy_binding_cmds.cpp10
-rw-r--r--extras/vom/vom/arp_proxy_binding_cmds.hpp2
-rw-r--r--extras/vom/vom/arp_proxy_config_cmds.cpp8
-rw-r--r--extras/vom/vom/arp_proxy_config_cmds.hpp2
-rw-r--r--extras/vom/vom/interface_ip6_nd_cmds.cpp10
-rw-r--r--extras/vom/vom/neighbour_cmds.cpp16
-rw-r--r--extras/vom/vom/neighbour_cmds.hpp2
-rw-r--r--extras/vom/vom/ra_config.cpp5
-rw-r--r--extras/vom/vom/ra_config.hpp4
-rw-r--r--extras/vom/vom/ra_prefix.hpp2
13 files changed, 45 insertions, 35 deletions
diff --git a/extras/vom/vom/.clang-format b/extras/vom/vom/.clang-format
index 917dceb793d..b83102010d0 100644
--- a/extras/vom/vom/.clang-format
+++ b/extras/vom/vom/.clang-format
@@ -1,3 +1,4 @@
BasedOnStyle: mozilla
+AlwaysBreakAfterReturnType: TopLevelDefinitions
BinPackParameters: false
diff --git a/extras/vom/vom/api_types.cpp b/extras/vom/vom/api_types.cpp
index 5a46571ddea..5eea7654eee 100644
--- a/extras/vom/vom/api_types.cpp
+++ b/extras/vom/vom/api_types.cpp
@@ -47,8 +47,7 @@ from_api(vapi_enum_ip_neighbor_flags f)
invalid_decode::invalid_decode(const std::string reason)
: reason(reason)
-{
-}
+{}
void
to_api(const boost::asio::ip::address_v4& a, vapi_type_ip4_address& v)
@@ -208,7 +207,8 @@ route::mprefix_t
from_api(const vapi_type_mprefix& v)
{
return route::mprefix_t(from_api(v.src_address, v.af),
- from_api(v.grp_address, v.af), v.grp_address_length);
+ from_api(v.grp_address, v.af),
+ v.grp_address_length);
}
vapi_type_mprefix
@@ -238,6 +238,16 @@ to_api(const nh_proto_t& p)
return FIB_API_PATH_NH_PROTO_IP4;
}
+
+vapi_enum_address_family
+to_api(const l3_proto_t p)
+{
+ if (p == l3_proto_t::IPV6) {
+ return ADDRESS_IP6;
+ }
+ return ADDRESS_IP4;
+}
+
const nh_proto_t&
from_api(vapi_enum_fib_path_nh_proto p)
{
diff --git a/extras/vom/vom/api_types.hpp b/extras/vom/vom/api_types.hpp
index b026ba38db2..8d898f4c880 100644
--- a/extras/vom/vom/api_types.hpp
+++ b/extras/vom/vom/api_types.hpp
@@ -19,6 +19,7 @@
#include <vom/types.hpp>
#include <vapi/ip.api.vapi.hpp>
+#include <vapi/ip_neighbor.api.vapi.hpp>
namespace VOM {
@@ -40,6 +41,7 @@ void to_api(const boost::asio::ip::address& a,
vapi_union_address_union& u,
vapi_enum_address_family& af);
void to_api(const boost::asio::ip::address& a, vapi_union_address_union& u);
+vapi_enum_address_family to_api(const l3_proto_t p);
boost::asio::ip::address_v4 from_api(const vapi_type_ip4_address& v);
boost::asio::ip::address_v6 from_api(const vapi_type_ip6_address& v);
diff --git a/extras/vom/vom/arp_proxy_binding_cmds.cpp b/extras/vom/vom/arp_proxy_binding_cmds.cpp
index 6da956c1c38..acad2d5f6ac 100644
--- a/extras/vom/vom/arp_proxy_binding_cmds.cpp
+++ b/extras/vom/vom/arp_proxy_binding_cmds.cpp
@@ -21,8 +21,7 @@ namespace arp_proxy_binding_cmds {
bind_cmd::bind_cmd(HW::item<bool>& item, const handle_t& itf)
: rpc_cmd(item)
, m_itf(itf)
-{
-}
+{}
bool
bind_cmd::operator==(const bind_cmd& other) const
@@ -37,7 +36,7 @@ bind_cmd::issue(connection& con)
auto& payload = req.get_request().get_payload();
payload.sw_if_index = m_itf.value();
- payload.enable_disable = 1;
+ payload.enable = 1;
VAPI_CALL(req.execute());
@@ -57,8 +56,7 @@ bind_cmd::to_string() const
unbind_cmd::unbind_cmd(HW::item<bool>& item, const handle_t& itf)
: rpc_cmd(item)
, m_itf(itf)
-{
-}
+{}
bool
unbind_cmd::operator==(const unbind_cmd& other) const
@@ -73,7 +71,7 @@ unbind_cmd::issue(connection& con)
auto& payload = req.get_request().get_payload();
payload.sw_if_index = m_itf.value();
- payload.enable_disable = 0;
+ payload.enable = 0;
VAPI_CALL(req.execute());
diff --git a/extras/vom/vom/arp_proxy_binding_cmds.hpp b/extras/vom/vom/arp_proxy_binding_cmds.hpp
index 9389896c009..976466b4236 100644
--- a/extras/vom/vom/arp_proxy_binding_cmds.hpp
+++ b/extras/vom/vom/arp_proxy_binding_cmds.hpp
@@ -19,7 +19,7 @@
#include "vom/arp_proxy_binding.hpp"
#include "vom/dump_cmd.hpp"
-#include <vapi/ip.api.vapi.hpp>
+#include <vapi/arp.api.vapi.hpp>
namespace VOM {
namespace arp_proxy_binding_cmds {
diff --git a/extras/vom/vom/arp_proxy_config_cmds.cpp b/extras/vom/vom/arp_proxy_config_cmds.cpp
index 8185c0910d2..a203830a62c 100644
--- a/extras/vom/vom/arp_proxy_config_cmds.cpp
+++ b/extras/vom/vom/arp_proxy_config_cmds.cpp
@@ -16,6 +16,8 @@
#include "vom/arp_proxy_config_cmds.hpp"
#include "vom/api_types.hpp"
+DEFINE_VAPI_MSG_IDS_ARP_API_JSON;
+
namespace VOM {
namespace arp_proxy_config_cmds {
@@ -25,8 +27,7 @@ config_cmd::config_cmd(HW::item<bool>& item,
: rpc_cmd(item)
, m_low(low)
, m_high(high)
-{
-}
+{}
bool
config_cmd::operator==(const config_cmd& o) const
@@ -68,8 +69,7 @@ unconfig_cmd::unconfig_cmd(HW::item<bool>& item,
: rpc_cmd(item)
, m_low(low)
, m_high(high)
-{
-}
+{}
bool
unconfig_cmd::operator==(const unconfig_cmd& o) const
diff --git a/extras/vom/vom/arp_proxy_config_cmds.hpp b/extras/vom/vom/arp_proxy_config_cmds.hpp
index d1a0a420411..ae95251f13e 100644
--- a/extras/vom/vom/arp_proxy_config_cmds.hpp
+++ b/extras/vom/vom/arp_proxy_config_cmds.hpp
@@ -20,7 +20,7 @@
#include "vom/dump_cmd.hpp"
#include "vom/rpc_cmd.hpp"
-#include <vapi/ip.api.vapi.hpp>
+#include <vapi/arp.api.vapi.hpp>
namespace VOM {
namespace arp_proxy_config_cmds {
diff --git a/extras/vom/vom/interface_ip6_nd_cmds.cpp b/extras/vom/vom/interface_ip6_nd_cmds.cpp
index b8909637644..15ff1caa4b4 100644
--- a/extras/vom/vom/interface_ip6_nd_cmds.cpp
+++ b/extras/vom/vom/interface_ip6_nd_cmds.cpp
@@ -15,10 +15,10 @@
#include "vom/interface_ip6_nd.hpp"
-#include <vapi/vpe.api.vapi.hpp>
+#include <vapi/ip6_nd.api.vapi.hpp>
namespace VOM {
-template <>
+template<>
rc_t
ip6nd_ra_config::config_cmd::issue(connection& con)
{
@@ -34,7 +34,7 @@ ip6nd_ra_config::config_cmd::issue(connection& con)
return (wait());
}
-template <>
+template<>
rc_t
ip6nd_ra_config::unconfig_cmd::issue(connection& con)
{
@@ -53,7 +53,7 @@ ip6nd_ra_config::unconfig_cmd::issue(connection& con)
return rc_t::OK;
}
-template <>
+template<>
rc_t
ip6nd_ra_prefix::config_cmd::issue(connection& con)
{
@@ -69,7 +69,7 @@ ip6nd_ra_prefix::config_cmd::issue(connection& con)
return (wait());
}
-template <>
+template<>
rc_t
ip6nd_ra_prefix::unconfig_cmd::issue(connection& con)
{
diff --git a/extras/vom/vom/neighbour_cmds.cpp b/extras/vom/vom/neighbour_cmds.cpp
index 758147c49c5..d507bb74ea8 100644
--- a/extras/vom/vom/neighbour_cmds.cpp
+++ b/extras/vom/vom/neighbour_cmds.cpp
@@ -16,6 +16,8 @@
#include "vom/neighbour_cmds.hpp"
#include "vom/api_types.hpp"
+DEFINE_VAPI_MSG_IDS_IP_NEIGHBOR_API_JSON;
+
namespace VOM {
namespace neighbour_cmds {
create_cmd::create_cmd(HW::item<handle_t>& item,
@@ -28,8 +30,7 @@ create_cmd::create_cmd(HW::item<handle_t>& item,
, m_mac(mac)
, m_ip_addr(ip_addr)
, m_flags(flags)
-{
-}
+{}
bool
create_cmd::operator==(const create_cmd& other) const
@@ -77,8 +78,7 @@ delete_cmd::delete_cmd(HW::item<handle_t>& item,
, m_mac(mac)
, m_ip_addr(ip_addr)
, m_flags(flags)
-{
-}
+{}
bool
delete_cmd::operator==(const delete_cmd& other) const
@@ -122,14 +122,12 @@ delete_cmd::to_string() const
dump_cmd::dump_cmd(const handle_t& hdl, const l3_proto_t& proto)
: m_itf(hdl)
, m_proto(proto)
-{
-}
+{}
dump_cmd::dump_cmd(const dump_cmd& d)
: m_itf(d.m_itf)
, m_proto(d.m_proto)
-{
-}
+{}
bool
dump_cmd::operator==(const dump_cmd& other) const
@@ -144,7 +142,7 @@ dump_cmd::issue(connection& con)
auto& payload = m_dump->get_request().get_payload();
payload.sw_if_index = m_itf.value();
- payload.is_ipv6 = m_proto.is_ipv6();
+ payload.af = to_api(m_proto);
VAPI_CALL(m_dump->execute());
diff --git a/extras/vom/vom/neighbour_cmds.hpp b/extras/vom/vom/neighbour_cmds.hpp
index ac1523d863d..024a021ce8d 100644
--- a/extras/vom/vom/neighbour_cmds.hpp
+++ b/extras/vom/vom/neighbour_cmds.hpp
@@ -20,7 +20,7 @@
#include "vom/srpc_cmd.hpp"
#include "neighbour.hpp"
-#include <vapi/ip.api.vapi.hpp>
+#include <vapi/ip_neighbor.api.vapi.hpp>
namespace VOM {
namespace neighbour_cmds {
diff --git a/extras/vom/vom/ra_config.cpp b/extras/vom/vom/ra_config.cpp
index de424a4d436..67faae699c8 100644
--- a/extras/vom/vom/ra_config.cpp
+++ b/extras/vom/vom/ra_config.cpp
@@ -17,6 +17,8 @@
#include "vom/ra_config.hpp"
+DEFINE_VAPI_MSG_IDS_IP6_ND_API_JSON;
+
namespace VOM {
/**
@@ -38,8 +40,7 @@ ra_config::ra_config(uint8_t suppress,
, m_lifetime(600)
, m_initial_count(3)
, m_initial_interval(16)
-{
-}
+{}
void
ra_config::to_vpp(vapi_payload_sw_interface_ip6nd_ra_config& ra_config) const
diff --git a/extras/vom/vom/ra_config.hpp b/extras/vom/vom/ra_config.hpp
index 505ccb3c499..81533162a39 100644
--- a/extras/vom/vom/ra_config.hpp
+++ b/extras/vom/vom/ra_config.hpp
@@ -16,7 +16,7 @@
#ifndef __VOM_RA_CONFIG_H__
#define __VOM_RA_CONFIG_H__
-#include <vapi/ip.api.vapi.hpp>
+#include <vapi/ip6_nd.api.vapi.hpp>
namespace VOM {
/**
@@ -67,7 +67,7 @@ private:
/**
* Advertises in ICMPv6 router-advertisement messages to use
* stateful address auto-configuration to obtain address information.
- */
+ */
uint8_t m_managed;
/**
diff --git a/extras/vom/vom/ra_prefix.hpp b/extras/vom/vom/ra_prefix.hpp
index 580aae146fd..8e0cf51c055 100644
--- a/extras/vom/vom/ra_prefix.hpp
+++ b/extras/vom/vom/ra_prefix.hpp
@@ -18,7 +18,7 @@
#include "vom/prefix.hpp"
-#include <vapi/ip.api.vapi.hpp>
+#include <vapi/ip6_nd.api.vapi.hpp>
namespace VOM {
/**