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>
This commit is contained in:
Neale Ranns
2019-09-30 10:53:31 +00:00
committed by Ole Trøan
parent 96453fd241
commit cbe25aab3b
140 changed files with 13177 additions and 13405 deletions

View File

@ -110,7 +110,6 @@ VNET Ethernet
I: ethernet I: ethernet
M: Dave Barach <dave@barachs.net> M: Dave Barach <dave@barachs.net>
M: Damjan Marion <damarion@cisco.com> M: Damjan Marion <damarion@cisco.com>
M: Neale Ranns <nranns@cisco.com>
F: src/vnet/ethernet/ F: src/vnet/ethernet/
VNET Feature Arcs VNET Feature Arcs
@ -138,6 +137,11 @@ M: Neale Ranns <nranns@cisco.com>
M: Jon Loeliger <jdl@netgate.com> M: Jon Loeliger <jdl@netgate.com>
F: src/vnet/ip/ F: src/vnet/ip/
VNET IP Neighbors
I: ip-neighbor
M: Neale Ranns <nranns@cisco.com>
F: src/vnet/ip-neighbor
VNET QoS VNET QoS
I: qos I: qos
M: Neale Ranns <nranns@cisco.com> M: Neale Ranns <nranns@cisco.com>
@ -292,6 +296,18 @@ M: Dave Barach <dave@barachs.net>
M: Neale Ranns <nranns@cisco.com> M: Neale Ranns <nranns@cisco.com>
F: src/plugins/dhcp/ F: src/plugins/dhcp/
Plugin - ARP
I: arp
M: Dave Barach <dave@barachs.net>
M: Neale Ranns <nranns@cisco.com>
F: src/plugins/arp/
Plugin - IP6 Neighbor Discovery
I: ip6-nd
M: Dave Barach <dave@barachs.net>
M: Neale Ranns <nranns@cisco.com>
F: src/plugins/ip6-nd/
VNET GENEVE VNET GENEVE
I: geneve I: geneve
M: N/A M: N/A

View File

@ -1,3 +1,4 @@
BasedOnStyle: mozilla BasedOnStyle: mozilla
AlwaysBreakAfterReturnType: TopLevelDefinitions
BinPackParameters: false BinPackParameters: false

View File

@ -47,8 +47,7 @@ from_api(vapi_enum_ip_neighbor_flags f)
invalid_decode::invalid_decode(const std::string reason) invalid_decode::invalid_decode(const std::string reason)
: reason(reason) : reason(reason)
{ {}
}
void void
to_api(const boost::asio::ip::address_v4& a, vapi_type_ip4_address& v) 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) from_api(const vapi_type_mprefix& v)
{ {
return route::mprefix_t(from_api(v.src_address, v.af), 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 vapi_type_mprefix
@ -238,6 +238,16 @@ to_api(const nh_proto_t& p)
return FIB_API_PATH_NH_PROTO_IP4; 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& const nh_proto_t&
from_api(vapi_enum_fib_path_nh_proto p) from_api(vapi_enum_fib_path_nh_proto p)
{ {

View File

@ -19,6 +19,7 @@
#include <vom/types.hpp> #include <vom/types.hpp>
#include <vapi/ip.api.vapi.hpp> #include <vapi/ip.api.vapi.hpp>
#include <vapi/ip_neighbor.api.vapi.hpp>
namespace VOM { namespace VOM {
@ -40,6 +41,7 @@ void to_api(const boost::asio::ip::address& a,
vapi_union_address_union& u, vapi_union_address_union& u,
vapi_enum_address_family& af); vapi_enum_address_family& af);
void to_api(const boost::asio::ip::address& a, vapi_union_address_union& u); 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_v4 from_api(const vapi_type_ip4_address& v);
boost::asio::ip::address_v6 from_api(const vapi_type_ip6_address& v); boost::asio::ip::address_v6 from_api(const vapi_type_ip6_address& v);

View File

@ -21,8 +21,7 @@ namespace arp_proxy_binding_cmds {
bind_cmd::bind_cmd(HW::item<bool>& item, const handle_t& itf) bind_cmd::bind_cmd(HW::item<bool>& item, const handle_t& itf)
: rpc_cmd(item) : rpc_cmd(item)
, m_itf(itf) , m_itf(itf)
{ {}
}
bool bool
bind_cmd::operator==(const bind_cmd& other) const bind_cmd::operator==(const bind_cmd& other) const
@ -37,7 +36,7 @@ bind_cmd::issue(connection& con)
auto& payload = req.get_request().get_payload(); auto& payload = req.get_request().get_payload();
payload.sw_if_index = m_itf.value(); payload.sw_if_index = m_itf.value();
payload.enable_disable = 1; payload.enable = 1;
VAPI_CALL(req.execute()); 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) unbind_cmd::unbind_cmd(HW::item<bool>& item, const handle_t& itf)
: rpc_cmd(item) : rpc_cmd(item)
, m_itf(itf) , m_itf(itf)
{ {}
}
bool bool
unbind_cmd::operator==(const unbind_cmd& other) const unbind_cmd::operator==(const unbind_cmd& other) const
@ -73,7 +71,7 @@ unbind_cmd::issue(connection& con)
auto& payload = req.get_request().get_payload(); auto& payload = req.get_request().get_payload();
payload.sw_if_index = m_itf.value(); payload.sw_if_index = m_itf.value();
payload.enable_disable = 0; payload.enable = 0;
VAPI_CALL(req.execute()); VAPI_CALL(req.execute());

View File

@ -19,7 +19,7 @@
#include "vom/arp_proxy_binding.hpp" #include "vom/arp_proxy_binding.hpp"
#include "vom/dump_cmd.hpp" #include "vom/dump_cmd.hpp"
#include <vapi/ip.api.vapi.hpp> #include <vapi/arp.api.vapi.hpp>
namespace VOM { namespace VOM {
namespace arp_proxy_binding_cmds { namespace arp_proxy_binding_cmds {

View File

@ -16,6 +16,8 @@
#include "vom/arp_proxy_config_cmds.hpp" #include "vom/arp_proxy_config_cmds.hpp"
#include "vom/api_types.hpp" #include "vom/api_types.hpp"
DEFINE_VAPI_MSG_IDS_ARP_API_JSON;
namespace VOM { namespace VOM {
namespace arp_proxy_config_cmds { namespace arp_proxy_config_cmds {
@ -25,8 +27,7 @@ config_cmd::config_cmd(HW::item<bool>& item,
: rpc_cmd(item) : rpc_cmd(item)
, m_low(low) , m_low(low)
, m_high(high) , m_high(high)
{ {}
}
bool bool
config_cmd::operator==(const config_cmd& o) const config_cmd::operator==(const config_cmd& o) const
@ -68,8 +69,7 @@ unconfig_cmd::unconfig_cmd(HW::item<bool>& item,
: rpc_cmd(item) : rpc_cmd(item)
, m_low(low) , m_low(low)
, m_high(high) , m_high(high)
{ {}
}
bool bool
unconfig_cmd::operator==(const unconfig_cmd& o) const unconfig_cmd::operator==(const unconfig_cmd& o) const

View File

@ -20,7 +20,7 @@
#include "vom/dump_cmd.hpp" #include "vom/dump_cmd.hpp"
#include "vom/rpc_cmd.hpp" #include "vom/rpc_cmd.hpp"
#include <vapi/ip.api.vapi.hpp> #include <vapi/arp.api.vapi.hpp>
namespace VOM { namespace VOM {
namespace arp_proxy_config_cmds { namespace arp_proxy_config_cmds {

View File

@ -15,10 +15,10 @@
#include "vom/interface_ip6_nd.hpp" #include "vom/interface_ip6_nd.hpp"
#include <vapi/vpe.api.vapi.hpp> #include <vapi/ip6_nd.api.vapi.hpp>
namespace VOM { namespace VOM {
template <> template<>
rc_t rc_t
ip6nd_ra_config::config_cmd::issue(connection& con) ip6nd_ra_config::config_cmd::issue(connection& con)
{ {
@ -34,7 +34,7 @@ ip6nd_ra_config::config_cmd::issue(connection& con)
return (wait()); return (wait());
} }
template <> template<>
rc_t rc_t
ip6nd_ra_config::unconfig_cmd::issue(connection& con) ip6nd_ra_config::unconfig_cmd::issue(connection& con)
{ {
@ -53,7 +53,7 @@ ip6nd_ra_config::unconfig_cmd::issue(connection& con)
return rc_t::OK; return rc_t::OK;
} }
template <> template<>
rc_t rc_t
ip6nd_ra_prefix::config_cmd::issue(connection& con) ip6nd_ra_prefix::config_cmd::issue(connection& con)
{ {
@ -69,7 +69,7 @@ ip6nd_ra_prefix::config_cmd::issue(connection& con)
return (wait()); return (wait());
} }
template <> template<>
rc_t rc_t
ip6nd_ra_prefix::unconfig_cmd::issue(connection& con) ip6nd_ra_prefix::unconfig_cmd::issue(connection& con)
{ {

View File

@ -16,6 +16,8 @@
#include "vom/neighbour_cmds.hpp" #include "vom/neighbour_cmds.hpp"
#include "vom/api_types.hpp" #include "vom/api_types.hpp"
DEFINE_VAPI_MSG_IDS_IP_NEIGHBOR_API_JSON;
namespace VOM { namespace VOM {
namespace neighbour_cmds { namespace neighbour_cmds {
create_cmd::create_cmd(HW::item<handle_t>& item, 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_mac(mac)
, m_ip_addr(ip_addr) , m_ip_addr(ip_addr)
, m_flags(flags) , m_flags(flags)
{ {}
}
bool bool
create_cmd::operator==(const create_cmd& other) const 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_mac(mac)
, m_ip_addr(ip_addr) , m_ip_addr(ip_addr)
, m_flags(flags) , m_flags(flags)
{ {}
}
bool bool
delete_cmd::operator==(const delete_cmd& other) const 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) dump_cmd::dump_cmd(const handle_t& hdl, const l3_proto_t& proto)
: m_itf(hdl) : m_itf(hdl)
, m_proto(proto) , m_proto(proto)
{ {}
}
dump_cmd::dump_cmd(const dump_cmd& d) dump_cmd::dump_cmd(const dump_cmd& d)
: m_itf(d.m_itf) : m_itf(d.m_itf)
, m_proto(d.m_proto) , m_proto(d.m_proto)
{ {}
}
bool bool
dump_cmd::operator==(const dump_cmd& other) const 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(); auto& payload = m_dump->get_request().get_payload();
payload.sw_if_index = m_itf.value(); 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()); VAPI_CALL(m_dump->execute());

View File

@ -20,7 +20,7 @@
#include "vom/srpc_cmd.hpp" #include "vom/srpc_cmd.hpp"
#include "neighbour.hpp" #include "neighbour.hpp"
#include <vapi/ip.api.vapi.hpp> #include <vapi/ip_neighbor.api.vapi.hpp>
namespace VOM { namespace VOM {
namespace neighbour_cmds { namespace neighbour_cmds {

View File

@ -17,6 +17,8 @@
#include "vom/ra_config.hpp" #include "vom/ra_config.hpp"
DEFINE_VAPI_MSG_IDS_IP6_ND_API_JSON;
namespace VOM { namespace VOM {
/** /**
@ -38,8 +40,7 @@ ra_config::ra_config(uint8_t suppress,
, m_lifetime(600) , m_lifetime(600)
, m_initial_count(3) , m_initial_count(3)
, m_initial_interval(16) , m_initial_interval(16)
{ {}
}
void void
ra_config::to_vpp(vapi_payload_sw_interface_ip6nd_ra_config& ra_config) const ra_config::to_vpp(vapi_payload_sw_interface_ip6nd_ra_config& ra_config) const

View File

@ -16,7 +16,7 @@
#ifndef __VOM_RA_CONFIG_H__ #ifndef __VOM_RA_CONFIG_H__
#define __VOM_RA_CONFIG_H__ #define __VOM_RA_CONFIG_H__
#include <vapi/ip.api.vapi.hpp> #include <vapi/ip6_nd.api.vapi.hpp>
namespace VOM { namespace VOM {
/** /**
@ -67,7 +67,7 @@ private:
/** /**
* Advertises in ICMPv6 router-advertisement messages to use * Advertises in ICMPv6 router-advertisement messages to use
* stateful address auto-configuration to obtain address information. * stateful address auto-configuration to obtain address information.
*/ */
uint8_t m_managed; uint8_t m_managed;
/** /**

View File

@ -18,7 +18,7 @@
#include "vom/prefix.hpp" #include "vom/prefix.hpp"
#include <vapi/ip.api.vapi.hpp> #include <vapi/ip6_nd.api.vapi.hpp>
namespace VOM { namespace VOM {
/** /**

View File

@ -141,7 +141,6 @@ class TestAbf(VppTestCase):
for i in self.pg_interfaces: for i in self.pg_interfaces:
i.unconfig_ip4() i.unconfig_ip4()
i.unconfig_ip6() i.unconfig_ip6()
i.ip6_disable()
i.admin_down() i.admin_down()
super(TestAbf, self).tearDown() super(TestAbf, self).tearDown()

View File

@ -152,7 +152,7 @@ class ACLPluginConnTestCase(VppTestCase):
super(ACLPluginConnTestCase, self).tearDown() super(ACLPluginConnTestCase, self).tearDown()
def show_commands_at_teardown(self): def show_commands_at_teardown(self):
self.logger.info(self.vapi.cli("show ip arp")) self.logger.info(self.vapi.cli("show ip neighbors"))
self.logger.info(self.vapi.cli("show ip6 neighbors")) self.logger.info(self.vapi.cli("show ip6 neighbors"))
self.logger.info(self.vapi.cli("show acl-plugin sessions")) self.logger.info(self.vapi.cli("show acl-plugin sessions"))
self.logger.info(self.vapi.cli("show acl-plugin acl")) self.logger.info(self.vapi.cli("show acl-plugin acl"))

View File

@ -113,7 +113,7 @@ class TestACLpluginL2L3(VppTestCase):
def tearDown(self): def tearDown(self):
"""Run standard test teardown and log ``show l2patch``, """Run standard test teardown and log ``show l2patch``,
``show l2fib verbose``,``show bridge-domain <bd_id> detail``, ``show l2fib verbose``,``show bridge-domain <bd_id> detail``,
``show ip arp``. ``show ip neighbors``.
""" """
super(TestACLpluginL2L3, self).tearDown() super(TestACLpluginL2L3, self).tearDown()
@ -123,8 +123,7 @@ class TestACLpluginL2L3(VppTestCase):
self.logger.info(self.vapi.cli("show l2fib verbose")) self.logger.info(self.vapi.cli("show l2fib verbose"))
self.logger.info(self.vapi.cli("show bridge-domain %s detail" % self.logger.info(self.vapi.cli("show bridge-domain %s detail" %
self.bd_id)) self.bd_id))
self.logger.info(self.vapi.cli("show ip arp")) self.logger.info(self.vapi.cli("show ip neighbors"))
self.logger.info(self.vapi.cli("show ip6 neighbors"))
cmd = "show acl-plugin sessions verbose 1" cmd = "show acl-plugin sessions verbose 1"
self.logger.info(self.vapi.cli(cmd)) self.logger.info(self.vapi.cli(cmd))
self.logger.info(self.vapi.cli("show acl-plugin acl")) self.logger.info(self.vapi.cli("show acl-plugin acl"))

View File

@ -20,6 +20,7 @@
#include <dhcp/dhcp6_ia_na_client_dp.h> #include <dhcp/dhcp6_ia_na_client_dp.h>
#include <vnet/ip/ip.h> #include <vnet/ip/ip.h>
#include <vnet/ip/ip6.h> #include <vnet/ip/ip6.h>
#include <vnet/ip/ip6_link.h>
#include <float.h> #include <float.h>
#include <math.h> #include <math.h>
@ -144,17 +145,6 @@ send_client_message_start_stop (u32 sw_if_index, u32 server_index,
static void interrupt_process (void); static void interrupt_process (void);
static u32
ip6_enable (u32 sw_if_index)
{
dhcp6_client_cp_main_t *rm = &dhcp6_client_cp_main;
clib_error_t *rv;
rv = enable_ip6_interface (rm->vlib_main, sw_if_index);
return rv != 0;
}
static u8 static u8
ip6_addresses_equal (ip6_address_t * address1, ip6_address_t * address2) ip6_addresses_equal (ip6_address_t * address1, ip6_address_t * address2)
{ {
@ -422,7 +412,7 @@ dhcp6_client_cp_process (vlib_main_t * vm, vlib_node_runtime_t * rt,
clib_warning ("Failed to delete interface address"); clib_warning ("Failed to delete interface address");
pool_put (rm->address_pool, address_info); pool_put (rm->address_pool, address_info);
/* make sure ip6 stays enabled */ /* make sure ip6 stays enabled */
ip6_enable (sw_if_index); ip6_link_enable (sw_if_index);
client_state = &rm->client_state_by_sw_if_index[sw_if_index]; client_state = &rm->client_state_by_sw_if_index[sw_if_index];
if (--client_state->address_count == 0) if (--client_state->address_count == 0)
{ {
@ -650,7 +640,7 @@ dhcp6_client_enable_disable (u32 sw_if_index, u8 enable)
dhcp6_clients_enable_disable (1); dhcp6_clients_enable_disable (1);
} }
ip6_enable (sw_if_index); ip6_link_enable (sw_if_index);
send_client_message_start_stop (sw_if_index, ~0, DHCPV6_MSG_SOLICIT, send_client_message_start_stop (sw_if_index, ~0, DHCPV6_MSG_SOLICIT,
0, 1); 0, 1);
} }

View File

@ -20,7 +20,7 @@
#include <vnet/mfib/ip6_mfib.h> #include <vnet/mfib/ip6_mfib.h>
#include <vnet/fib/fib.h> #include <vnet/fib/fib.h>
#include <vnet/adj/adj_mcast.h> #include <vnet/adj/adj_mcast.h>
#include <vnet/ip/ip6_neighbor.h> #include <vnet/ip/ip6_link.h>
#include <dhcp/dhcp6_ia_na_client_dp.h> #include <dhcp/dhcp6_ia_na_client_dp.h>
#include <dhcp/dhcp6_client_common_dp.h> #include <dhcp/dhcp6_client_common_dp.h>
#include <vnet/ip/ip_types_api.h> #include <vnet/ip/ip_types_api.h>
@ -89,16 +89,16 @@ create_buffer_for_client_message (vlib_main_t * vm, u32 sw_if_index,
ip6_header_t *ip; ip6_header_t *ip;
udp_header_t *udp; udp_header_t *udp;
dhcpv6_header_t *dhcp; dhcpv6_header_t *dhcp;
ip6_address_t src_addr; const ip6_address_t *src_addr;
u32 dhcp_opt_len = 0; u32 dhcp_opt_len = 0;
client_state->transaction_start = vlib_time_now (vm); client_state->transaction_start = vlib_time_now (vm);
u32 n_addresses; u32 n_addresses;
u32 i; u32 i;
/* Get a link-local address */ /* Get a link-local address */
src_addr = ip6_neighbor_get_link_local_address (sw_if_index); src_addr = ip6_get_link_local_address (sw_if_index);
if (src_addr.as_u8[0] != 0xfe) if (src_addr->as_u8[0] != 0xfe)
{ {
clib_warning ("Could not find source address to send DHCPv6 packet"); clib_warning ("Could not find source address to send DHCPv6 packet");
return NULL; return NULL;
@ -123,7 +123,7 @@ create_buffer_for_client_message (vlib_main_t * vm, u32 sw_if_index,
udp = (udp_header_t *) (ip + 1); udp = (udp_header_t *) (ip + 1);
dhcp = (dhcpv6_header_t *) (udp + 1); dhcp = (dhcpv6_header_t *) (udp + 1);
ip->src_address = src_addr; ip->src_address = *src_addr;
ip->hop_limit = 255; ip->hop_limit = 255;
ip->ip_version_traffic_class_and_flow_label = ip->ip_version_traffic_class_and_flow_label =
clib_host_to_net_u32 (0x6 << 28); clib_host_to_net_u32 (0x6 << 28);

View File

@ -19,7 +19,8 @@
#include <dhcp/dhcp6_pd_client_dp.h> #include <dhcp/dhcp6_pd_client_dp.h>
#include <vnet/ip/ip.h> #include <vnet/ip/ip.h>
#include <vnet/ip/ip6.h> #include <vnet/ip/ip6.h>
#include <vnet/ip/ip6_neighbor.h> #include <vnet/ip/ip6_link.h>
#include <vnet/ip6-nd/ip6_ra.h>
#include <float.h> #include <float.h>
#include <math.h> #include <math.h>
#include <string.h> #include <string.h>
@ -243,17 +244,6 @@ send_client_message_start_stop (u32 sw_if_index, u32 server_index,
static void interrupt_process (void); static void interrupt_process (void);
static u32
ip6_enable (u32 sw_if_index)
{
dhcp6_pd_client_cp_main_t *rm = &dhcp6_pd_client_cp_main;
clib_error_t *rv;
rv = enable_ip6_interface (rm->vlib_main, sw_if_index);
return rv != 0;
}
static u8 static u8
ip6_prefixes_equal (ip6_address_t * prefix1, ip6_address_t * prefix2, u8 len) ip6_prefixes_equal (ip6_address_t * prefix1, ip6_address_t * prefix2, u8 len)
{ {
@ -807,16 +797,15 @@ cp_ip6_advertise_prefix (prefix_info_t * prefix_info,
addr.as_u64[0] &= im->fib_masks[address_info->prefix_length].as_u64[0]; addr.as_u64[0] &= im->fib_masks[address_info->prefix_length].as_u64[0];
addr.as_u64[1] &= im->fib_masks[address_info->prefix_length].as_u64[1]; addr.as_u64[1] &= im->fib_masks[address_info->prefix_length].as_u64[1];
rv = ip6_neighbor_ra_prefix (vm, address_info->sw_if_index, rv = ip6_ra_prefix (vm, address_info->sw_if_index,
&addr, address_info->prefix_length, &addr, address_info->prefix_length,
0 /* use_default */ , 0 /* use_default */ ,
prefix_info->valid_lt, prefix_info->valid_lt,
prefix_info->preferred_lt, prefix_info->preferred_lt, 0 /* no_advertise */ ,
0 /* no_advertise */ , 0 /* off_link */ ,
0 /* off_link */ , 0 /* no_autoconfig */ ,
0 /* no_autoconfig */ , 0 /* no_onlink */ ,
0 /* no_onlink */ , enable == 0 /* is_no */ );
enable == 0 /* is_no */ );
if (rv != 0) if (rv != 0)
{ {
clib_warning ("ip6_neighbor_ra_prefix returned %d", rv); clib_warning ("ip6_neighbor_ra_prefix returned %d", rv);
@ -1268,7 +1257,7 @@ dhcp6_pd_client_enable_disable (u32 sw_if_index,
dhcp6_clients_enable_disable (1); dhcp6_clients_enable_disable (1);
} }
ip6_enable (sw_if_index); ip6_link_enable (sw_if_index);
send_client_message_start_stop (sw_if_index, ~0, DHCPV6_MSG_SOLICIT, send_client_message_start_stop (sw_if_index, ~0, DHCPV6_MSG_SOLICIT,
0, 1); 0, 1);
} }
@ -1387,6 +1376,8 @@ VLIB_CLI_COMMAND (dhcp6_pd_client_enable_disable_command, static) = {
}; };
/* *INDENT-ON* */ /* *INDENT-ON* */
#include <vlib/unix/plugin.h>
static clib_error_t * static clib_error_t *
dhcp_pd_client_cp_init (vlib_main_t * vm) dhcp_pd_client_cp_init (vlib_main_t * vm)
{ {

View File

@ -20,10 +20,10 @@
#include <vnet/mfib/ip6_mfib.h> #include <vnet/mfib/ip6_mfib.h>
#include <vnet/fib/fib.h> #include <vnet/fib/fib.h>
#include <vnet/adj/adj_mcast.h> #include <vnet/adj/adj_mcast.h>
#include <vnet/ip/ip6_neighbor.h>
#include <dhcp/dhcp6_pd_client_dp.h> #include <dhcp/dhcp6_pd_client_dp.h>
#include <dhcp/dhcp6_client_common_dp.h> #include <dhcp/dhcp6_client_common_dp.h>
#include <vnet/ip/ip_types_api.h> #include <vnet/ip/ip_types_api.h>
#include <vnet/ip/ip6_link.h>
dhcp6_pd_client_main_t dhcp6_pd_client_main; dhcp6_pd_client_main_t dhcp6_pd_client_main;
dhcp6_pd_client_public_main_t dhcp6_pd_client_public_main; dhcp6_pd_client_public_main_t dhcp6_pd_client_public_main;
@ -90,7 +90,7 @@ create_buffer_for_client_message (vlib_main_t * vm,
ip6_header_t *ip; ip6_header_t *ip;
udp_header_t *udp; udp_header_t *udp;
dhcpv6_header_t *dhcp; dhcpv6_header_t *dhcp;
ip6_address_t src_addr; const ip6_address_t *src_addr;
u32 dhcp_opt_len = 0; u32 dhcp_opt_len = 0;
client_state->transaction_start = vlib_time_now (vm); client_state->transaction_start = vlib_time_now (vm);
u32 n_prefixes; u32 n_prefixes;
@ -102,9 +102,9 @@ create_buffer_for_client_message (vlib_main_t * vm,
*/ */
/* Get a link-local address */ /* Get a link-local address */
src_addr = ip6_neighbor_get_link_local_address (sw_if_index); src_addr = ip6_get_link_local_address (sw_if_index);
if (src_addr.as_u8[0] != 0xfe) if (src_addr->as_u8[0] != 0xfe)
{ {
clib_warning ("Could not find source address to send DHCPv6 packet"); clib_warning ("Could not find source address to send DHCPv6 packet");
return NULL; return NULL;
@ -129,7 +129,7 @@ create_buffer_for_client_message (vlib_main_t * vm,
udp = (udp_header_t *) (ip + 1); udp = (udp_header_t *) (ip + 1);
dhcp = (dhcpv6_header_t *) (udp + 1); dhcp = (dhcpv6_header_t *) (udp + 1);
ip->src_address = src_addr; ip->src_address = *src_addr;
ip->hop_limit = 255; ip->hop_limit = 255;
ip->ip_version_traffic_class_and_flow_label = ip->ip_version_traffic_class_and_flow_label =
clib_host_to_net_u32 (0x6 << 28); clib_host_to_net_u32 (0x6 << 28);

View File

@ -1297,12 +1297,6 @@ class TestDHCP(VppTestCase):
self.assertTrue(find_route(self, self.pg3.local_ip4, 24)) self.assertTrue(find_route(self, self.pg3.local_ip4, 24))
self.assertTrue(find_route(self, self.pg3.local_ip4, 32)) self.assertTrue(find_route(self, self.pg3.local_ip4, 32))
# remove the left over ARP entry
self.vapi.ip_neighbor_add_del(self.pg3.sw_if_index,
self.pg3.remote_mac,
self.pg3.remote_ip4,
is_add=0)
# #
# remove the DHCP config # remove the DHCP config
# #

View File

@ -24,13 +24,12 @@
#include <plugins/gbp/gbp_policy_dpo.h> #include <plugins/gbp/gbp_policy_dpo.h>
#include <plugins/gbp/gbp_vxlan.h> #include <plugins/gbp/gbp_vxlan.h>
#include <vnet/ethernet/arp.h>
#include <vnet/l2/l2_input.h> #include <vnet/l2/l2_input.h>
#include <vnet/l2/l2_output.h> #include <vnet/l2/l2_output.h>
#include <vnet/l2/feat_bitmap.h> #include <vnet/l2/feat_bitmap.h>
#include <vnet/l2/l2_fib.h> #include <vnet/l2/l2_fib.h>
#include <vnet/fib/fib_table.h> #include <vnet/fib/fib_table.h>
#include <vnet/ip/ip_neighbor.h> #include <vnet/ip-neighbor/ip_neighbor.h>
#include <vnet/fib/fib_walk.h> #include <vnet/fib/fib_walk.h>
#include <vnet/vxlan-gbp/vxlan_gbp.h> #include <vnet/vxlan-gbp/vxlan_gbp.h>
@ -208,12 +207,6 @@ gbp_endpoint_index (const gbp_endpoint_t * ge)
return (ge - gbp_endpoint_pool); return (ge - gbp_endpoint_pool);
} }
static ip46_type_t
ip46_address_get_type (const ip46_address_t * a)
{
return (ip46_address_is_ip4 (a) ? IP46_TYPE_IP4 : IP46_TYPE_IP6);
}
static int static int
gbp_endpoint_ip_is_equal (const fib_prefix_t * fp, const ip46_address_t * ip) gbp_endpoint_ip_is_equal (const fib_prefix_t * fp, const ip46_address_t * ip)
{ {
@ -775,14 +768,11 @@ gbb_endpoint_fwd_recalc (gbp_endpoint_t * ge)
{ {
gbp_endpoint_add_itf (gbp_itf_get_sw_if_index (gef->gef_itf), gbp_endpoint_add_itf (gbp_itf_get_sw_if_index (gef->gef_itf),
gei); gei);
if (FIB_PROTOCOL_IP4 == pfx->fp_proto) ip_neighbor_advertise (vlib_get_main (),
send_ip4_garp_w_addr (vlib_get_main (), (FIB_PROTOCOL_IP4 == pfx->fp_proto ?
&pfx->fp_addr.ip4, IP46_TYPE_IP4 :
gg->gg_uplink_sw_if_index); IP46_TYPE_IP6),
else &pfx->fp_addr, gg->gg_uplink_sw_if_index);
send_ip6_na_w_addr (vlib_get_main (),
&pfx->fp_addr.ip6,
gg->gg_uplink_sw_if_index);
} }
} }
} }

View File

@ -18,7 +18,6 @@
#include <vnet/dpo/dvr_dpo.h> #include <vnet/dpo/dvr_dpo.h>
#include <vnet/fib/fib_table.h> #include <vnet/fib/fib_table.h>
#include <vnet/ip/ip_neighbor.h>
/** /**
* A fixed MAC address to use as the source MAC for packets L3 switched * A fixed MAC address to use as the source MAC for packets L3 switched

View File

@ -87,7 +87,6 @@ class TestL3xc(VppTestCase):
for i in self.pg_interfaces: for i in self.pg_interfaces:
i.unconfig_ip4() i.unconfig_ip4()
i.unconfig_ip6() i.unconfig_ip6()
i.ip6_disable()
i.admin_down() i.admin_down()
super(TestL3xc, self).tearDown() super(TestL3xc, self).tearDown()

View File

@ -3,6 +3,17 @@
#include <http_static/http_static.h> #include <http_static/http_static.h>
#include <mactime/mactime.h> #include <mactime/mactime.h>
#include <vlib/unix/plugin.h> #include <vlib/unix/plugin.h>
#include <vnet/ip-neighbor/ip_neighbor.h>
static walk_rc_t
mactime_ip_neighbor_copy (index_t ipni, void *ctx)
{
mactime_main_t *mm = ctx;
vec_add1 (mm->arp_cache_copy, ipni);
return (WALK_CONTINUE);
}
static int static int
handle_get_mactime (http_builtin_method_type_t reqtype, handle_get_mactime (http_builtin_method_type_t reqtype,
@ -17,17 +28,14 @@ handle_get_mactime (http_builtin_method_type_t reqtype,
int i, j; int i, j;
f64 now; f64 now;
vlib_counter_t allow, drop; vlib_counter_t allow, drop;
ethernet_arp_ip4_entry_t *n, *pool; ip_neighbor_t *n;
char *q = "\""; char *q = "\"";
u8 *s = 0; u8 *s = 0;
int need_comma = 0; int need_comma = 0;
/* Walk all ip4 neighbours on all interfaces */
vec_reset_length (mm->arp_cache_copy); vec_reset_length (mm->arp_cache_copy);
pool = ip4_neighbors_pool (); ip_neighbor_walk (IP46_TYPE_IP4, ~0, mactime_ip_neighbor_copy, mm);
/* *INDENT-OFF* */
pool_foreach (n, pool, ({ vec_add1 (mm->arp_cache_copy, n[0]);}));
/* *INDENT-ON* */
now = clib_timebase_now (&mm->timebase); now = clib_timebase_now (&mm->timebase);
@ -124,11 +132,13 @@ handle_get_mactime (http_builtin_method_type_t reqtype,
for (j = 0; j < vec_len (mm->arp_cache_copy); j++) for (j = 0; j < vec_len (mm->arp_cache_copy); j++)
{ {
n = mm->arp_cache_copy + j; n = ip_neighbor_get (mm->arp_cache_copy[j]);
if (!memcmp (dp->mac_address, n->mac.bytes, sizeof (n->mac))) if (!memcmp (dp->mac_address,
ip_neighbor_get_mac (n), sizeof (mac_address_t)))
{ {
s = format (s, ", %sip4_address%s: %s%U%s", q, q, s = format (s, ", %sip4_address%s: %s%U%s", q, q,
q, format_ip4_address, &n->ip4_address, q); q, format_ip46_address,
ip_neighbor_get_ip (n), IP46_TYPE_IP4, q);
break; break;
} }
} }

View File

@ -33,6 +33,8 @@
#define REPLY_MSG_ID_BASE mm->msg_id_base #define REPLY_MSG_ID_BASE mm->msg_id_base
#include <vlibapi/api_helper_macros.h> #include <vlibapi/api_helper_macros.h>
#include <vnet/ip-neighbor/ip_neighbor.h>
mactime_main_t mactime_main; mactime_main_t mactime_main;
/** \file time-base src-mac filter device-input feature arc implementation /** \file time-base src-mac filter device-input feature arc implementation
@ -425,7 +427,12 @@ mactime_init (vlib_main_t * vm)
return 0; return 0;
} }
VLIB_INIT_FUNCTION (mactime_init); /* *INDENT-OFF* */
VLIB_INIT_FUNCTION (mactime_init) =
{
.runs_after = VLIB_INITS("ip_neighbor_init"),
};
/* *INDENT-ON* */
static clib_error_t * static clib_error_t *
mactime_config (vlib_main_t * vm, unformat_input_t * input) mactime_config (vlib_main_t * vm, unformat_input_t * input)
@ -519,6 +526,16 @@ format_bytes_with_width (u8 * s, va_list * va)
return s; return s;
} }
static walk_rc_t
mactime_ip_neighbor_copy (index_t ipni, void *ctx)
{
mactime_main_t *mm = ctx;
vec_add1 (mm->arp_cache_copy, ipni);
return (WALK_CONTINUE);
}
static clib_error_t * static clib_error_t *
show_mactime_command_fn (vlib_main_t * vm, show_mactime_command_fn (vlib_main_t * vm,
unformat_input_t * input, vlib_cli_command_t * cmd) unformat_input_t * input, vlib_cli_command_t * cmd)
@ -533,17 +550,11 @@ show_mactime_command_fn (vlib_main_t * vm,
int i, j; int i, j;
f64 now; f64 now;
vlib_counter_t allow, drop; vlib_counter_t allow, drop;
ethernet_arp_ip4_entry_t *n, *pool; ip_neighbor_t *ipn;
vec_reset_length (mm->arp_cache_copy); vec_reset_length (mm->arp_cache_copy);
pool = ip4_neighbors_pool (); /* Walk all ip4 neighbours on all interfaces */
ip_neighbor_walk (IP46_TYPE_IP4, ~0, mactime_ip_neighbor_copy, mm);
/* *INDENT-OFF* */
pool_foreach (n, pool,
({
vec_add1 (mm->arp_cache_copy, n[0]);
}));
/* *INDENT-ON* */
now = clib_timebase_now (&mm->timebase); now = clib_timebase_now (&mm->timebase);
@ -660,11 +671,12 @@ show_mactime_command_fn (vlib_main_t * vm,
/* This is really only good for small N... */ /* This is really only good for small N... */
for (j = 0; j < vec_len (mm->arp_cache_copy); j++) for (j = 0; j < vec_len (mm->arp_cache_copy); j++)
{ {
n = mm->arp_cache_copy + j; ipn = ip_neighbor_get (mm->arp_cache_copy[j]);
if (!memcmp (dp->mac_address, n->mac.bytes, sizeof (n->mac))) if (!memcmp
(dp->mac_address, ipn->ipn_mac.bytes, sizeof (ipn->ipn_mac)))
{ {
vlib_cli_output (vm, "%17s%U", " ", format_ip4_address, vlib_cli_output (vm, "%17s%U", " ", format_ip46_address,
&n->ip4_address); ip_neighbor_get_ip (ipn), IP46_TYPE_IP4);
} }
} }
} }

View File

@ -21,7 +21,7 @@
#include <vnet/vnet.h> #include <vnet/vnet.h>
#include <vnet/ip/ip.h> #include <vnet/ip/ip.h>
#include <vnet/ethernet/ethernet.h> #include <vnet/ethernet/ethernet.h>
#include <vnet/ethernet/arp.h> //#include <vnet/ethernet/arp.h>
#include <vlib/counter.h> #include <vlib/counter.h>
#include <vppinfra/hash.h> #include <vppinfra/hash.h>
@ -71,7 +71,7 @@ typedef struct
int feature_initialized; int feature_initialized;
/* arp cache copy, for "show mactime" */ /* arp cache copy, for "show mactime" */
ethernet_arp_ip4_entry_t *arp_cache_copy; index_t *arp_cache_copy;
/* convenience */ /* convenience */
vlib_main_t *vlib_main; vlib_main_t *vlib_main;

View File

@ -44,7 +44,7 @@ class TestMactime(VppTestCase):
"bin mactime_enable_disable sw_if_index 1", "bin mactime_enable_disable sw_if_index 1",
"set interface state loop0 up", "set interface state loop0 up",
"clear mactime", "clear mactime",
"set ip arp loop0 192.168.1.1 00:d0:2d:5e:86:85", "set ip neighbor loop0 192.168.1.1 00:d0:2d:5e:86:85",
"bin mactime_add_del_range name sallow " "bin mactime_add_del_range name sallow "
"mac 00:d0:2d:5e:86:85 allow-static del", "mac 00:d0:2d:5e:86:85 allow-static del",
"bin mactime_add_del_range name sallow " "bin mactime_add_del_range name sallow "

View File

@ -453,13 +453,13 @@ unk_proto_st_walk (nat64_db_st_entry_t * ste, void *arg)
ip46_address_t saddr, daddr; ip46_address_t saddr, daddr;
nat64_db_t *db = &nm->db[ctx->thread_index]; nat64_db_t *db = &nm->db[ctx->thread_index];
if (ip46_address_is_equal (&ste->in_r_addr, &ctx->dst_addr)) if (ip6_address_is_equal (&ste->in_r_addr, &ctx->dst_addr))
{ {
bibe = nat64_db_bib_entry_by_index (db, ste->proto, ste->bibe_index); bibe = nat64_db_bib_entry_by_index (db, ste->proto, ste->bibe_index);
if (!bibe) if (!bibe)
return -1; return -1;
if (ip46_address_is_equal (&bibe->in_addr, &ctx->src_addr) if (ip6_address_is_equal (&bibe->in_addr, &ctx->src_addr)
&& bibe->fib_index == ctx->fib_index) && bibe->fib_index == ctx->fib_index)
{ {
clib_memset (&saddr, 0, sizeof (saddr)); clib_memset (&saddr, 0, sizeof (saddr));

Some files were not shown because too many files have changed in this diff Show More