From cbe25aab3be72154f2c706c39eeba6a77f34450f Mon Sep 17 00:00:00 2001 From: Neale Ranns Date: Mon, 30 Sep 2019 10:53:31 +0000 Subject: 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 --- extras/vom/vom/.clang-format | 1 + extras/vom/vom/api_types.cpp | 16 +++++++++++++--- extras/vom/vom/api_types.hpp | 2 ++ extras/vom/vom/arp_proxy_binding_cmds.cpp | 10 ++++------ extras/vom/vom/arp_proxy_binding_cmds.hpp | 2 +- extras/vom/vom/arp_proxy_config_cmds.cpp | 8 ++++---- extras/vom/vom/arp_proxy_config_cmds.hpp | 2 +- extras/vom/vom/interface_ip6_nd_cmds.cpp | 10 +++++----- extras/vom/vom/neighbour_cmds.cpp | 16 +++++++--------- extras/vom/vom/neighbour_cmds.hpp | 2 +- extras/vom/vom/ra_config.cpp | 5 +++-- extras/vom/vom/ra_config.hpp | 4 ++-- extras/vom/vom/ra_prefix.hpp | 2 +- 13 files changed, 45 insertions(+), 35 deletions(-) (limited to 'extras') 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 #include +#include 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& 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& 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 +#include 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& 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& 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 +#include 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 +#include 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& item, @@ -28,8 +30,7 @@ create_cmd::create_cmd(HW::item& 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& 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 +#include 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 +#include 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 +#include namespace VOM { /** -- cgit 1.2.3-korg