diff options
author | Neale Ranns <nranns@cisco.com> | 2019-09-30 10:53:31 +0000 |
---|---|---|
committer | Ole Trøan <otroan@employees.org> | 2019-12-17 10:56:20 +0000 |
commit | cbe25aab3be72154f2c706c39eeba6a77f34450f (patch) | |
tree | 131fb53b5ec973be045ffb9e2eb797af01d112a0 /src/plugins/dhcp | |
parent | 96453fd2417ebd1d69354a7fb692976129cea80e (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 'src/plugins/dhcp')
-rw-r--r-- | src/plugins/dhcp/dhcp6_ia_na_client_cp.c | 16 | ||||
-rw-r--r-- | src/plugins/dhcp/dhcp6_ia_na_client_dp.c | 10 | ||||
-rw-r--r-- | src/plugins/dhcp/dhcp6_pd_client_cp.c | 37 | ||||
-rw-r--r-- | src/plugins/dhcp/dhcp6_pd_client_dp.c | 10 | ||||
-rw-r--r-- | src/plugins/dhcp/test/test_dhcp.py | 6 |
5 files changed, 27 insertions, 52 deletions
diff --git a/src/plugins/dhcp/dhcp6_ia_na_client_cp.c b/src/plugins/dhcp/dhcp6_ia_na_client_cp.c index f9c379cffe8..b48559929e4 100644 --- a/src/plugins/dhcp/dhcp6_ia_na_client_cp.c +++ b/src/plugins/dhcp/dhcp6_ia_na_client_cp.c @@ -20,6 +20,7 @@ #include <dhcp/dhcp6_ia_na_client_dp.h> #include <vnet/ip/ip.h> #include <vnet/ip/ip6.h> +#include <vnet/ip/ip6_link.h> #include <float.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 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 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"); pool_put (rm->address_pool, address_info); /* 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]; 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); } - ip6_enable (sw_if_index); + ip6_link_enable (sw_if_index); send_client_message_start_stop (sw_if_index, ~0, DHCPV6_MSG_SOLICIT, 0, 1); } diff --git a/src/plugins/dhcp/dhcp6_ia_na_client_dp.c b/src/plugins/dhcp/dhcp6_ia_na_client_dp.c index 8ad7d765f69..3cf2fb1b349 100644 --- a/src/plugins/dhcp/dhcp6_ia_na_client_dp.c +++ b/src/plugins/dhcp/dhcp6_ia_na_client_dp.c @@ -20,7 +20,7 @@ #include <vnet/mfib/ip6_mfib.h> #include <vnet/fib/fib.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_client_common_dp.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; udp_header_t *udp; dhcpv6_header_t *dhcp; - ip6_address_t src_addr; + const ip6_address_t *src_addr; u32 dhcp_opt_len = 0; client_state->transaction_start = vlib_time_now (vm); u32 n_addresses; u32 i; /* 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"); 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); dhcp = (dhcpv6_header_t *) (udp + 1); - ip->src_address = src_addr; + ip->src_address = *src_addr; ip->hop_limit = 255; ip->ip_version_traffic_class_and_flow_label = clib_host_to_net_u32 (0x6 << 28); diff --git a/src/plugins/dhcp/dhcp6_pd_client_cp.c b/src/plugins/dhcp/dhcp6_pd_client_cp.c index ec9e5c64b07..18466270800 100644 --- a/src/plugins/dhcp/dhcp6_pd_client_cp.c +++ b/src/plugins/dhcp/dhcp6_pd_client_cp.c @@ -19,7 +19,8 @@ #include <dhcp/dhcp6_pd_client_dp.h> #include <vnet/ip/ip.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 <math.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 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 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[1] &= im->fib_masks[address_info->prefix_length].as_u64[1]; - rv = ip6_neighbor_ra_prefix (vm, address_info->sw_if_index, - &addr, address_info->prefix_length, - 0 /* use_default */ , - prefix_info->valid_lt, - prefix_info->preferred_lt, - 0 /* no_advertise */ , - 0 /* off_link */ , - 0 /* no_autoconfig */ , - 0 /* no_onlink */ , - enable == 0 /* is_no */ ); + rv = ip6_ra_prefix (vm, address_info->sw_if_index, + &addr, address_info->prefix_length, + 0 /* use_default */ , + prefix_info->valid_lt, + prefix_info->preferred_lt, 0 /* no_advertise */ , + 0 /* off_link */ , + 0 /* no_autoconfig */ , + 0 /* no_onlink */ , + enable == 0 /* is_no */ ); if (rv != 0) { 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); } - ip6_enable (sw_if_index); + ip6_link_enable (sw_if_index); send_client_message_start_stop (sw_if_index, ~0, DHCPV6_MSG_SOLICIT, 0, 1); } @@ -1387,6 +1376,8 @@ VLIB_CLI_COMMAND (dhcp6_pd_client_enable_disable_command, static) = { }; /* *INDENT-ON* */ +#include <vlib/unix/plugin.h> + static clib_error_t * dhcp_pd_client_cp_init (vlib_main_t * vm) { diff --git a/src/plugins/dhcp/dhcp6_pd_client_dp.c b/src/plugins/dhcp/dhcp6_pd_client_dp.c index 7896e9a6403..980c83c7bbe 100644 --- a/src/plugins/dhcp/dhcp6_pd_client_dp.c +++ b/src/plugins/dhcp/dhcp6_pd_client_dp.c @@ -20,10 +20,10 @@ #include <vnet/mfib/ip6_mfib.h> #include <vnet/fib/fib.h> #include <vnet/adj/adj_mcast.h> -#include <vnet/ip/ip6_neighbor.h> #include <dhcp/dhcp6_pd_client_dp.h> #include <dhcp/dhcp6_client_common_dp.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_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; udp_header_t *udp; dhcpv6_header_t *dhcp; - ip6_address_t src_addr; + const ip6_address_t *src_addr; u32 dhcp_opt_len = 0; client_state->transaction_start = vlib_time_now (vm); u32 n_prefixes; @@ -102,9 +102,9 @@ create_buffer_for_client_message (vlib_main_t * vm, */ /* 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"); return NULL; @@ -129,7 +129,7 @@ create_buffer_for_client_message (vlib_main_t * vm, udp = (udp_header_t *) (ip + 1); dhcp = (dhcpv6_header_t *) (udp + 1); - ip->src_address = src_addr; + ip->src_address = *src_addr; ip->hop_limit = 255; ip->ip_version_traffic_class_and_flow_label = clib_host_to_net_u32 (0x6 << 28); diff --git a/src/plugins/dhcp/test/test_dhcp.py b/src/plugins/dhcp/test/test_dhcp.py index 07db35d0cd0..065683fbcda 100644 --- a/src/plugins/dhcp/test/test_dhcp.py +++ b/src/plugins/dhcp/test/test_dhcp.py @@ -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, 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 # |