dhcp: Move to plugin
Type: feature Change-Id: I3fe27a8ef577741d9a5c4f090ec91cf68fb44fe3 Signed-off-by: Neale Ranns <nranns@cisco.com>
This commit is contained in:
12
MAINTAINERS
12
MAINTAINERS
@ -249,12 +249,6 @@ Y: src/vnet/ipip/FEATURE.yaml
|
||||
M: Ole Troan <otroan@employees.org>
|
||||
F: src/vnet/ipip/
|
||||
|
||||
VNET DHCP
|
||||
I: dhcp
|
||||
M: Dave Barach <dave@barachs.net>
|
||||
M: Neale Ranns <nranns@cisco.com>
|
||||
F: src/vnet/dhcp/
|
||||
|
||||
VNET TLS and TLS engine plugins
|
||||
I: tls
|
||||
M: Florin Coras <fcoras@cisco.com>
|
||||
@ -268,6 +262,12 @@ I: syslog
|
||||
M: Matus Fabian <matfabia@cisco.com>
|
||||
F: src/vnet/syslog
|
||||
|
||||
Plugin - DHCP
|
||||
I: dhcp
|
||||
M: Dave Barach <dave@barachs.net>
|
||||
M: Neale Ranns <nranns@cisco.com>
|
||||
F: src/plugins/dhcp/
|
||||
|
||||
Plugin - Access Control List (ACL) Based Forwarding
|
||||
I: abf
|
||||
M: Neale Ranns <nranns@cisco.com>
|
||||
|
51
src/plugins/dhcp/CMakeLists.txt
Normal file
51
src/plugins/dhcp/CMakeLists.txt
Normal file
@ -0,0 +1,51 @@
|
||||
# Copyright (c) 2018 Cisco and/or its affiliates.
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at:
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
add_vpp_plugin(dhcp
|
||||
SOURCES
|
||||
client.c
|
||||
dhcp_api.c
|
||||
dhcp_client_detect.c
|
||||
dhcp_proxy.c
|
||||
dhcp4_proxy_node.c
|
||||
dhcp6_client_common_dp.c
|
||||
dhcp6_ia_na_client_dp.c
|
||||
dhcp6_ia_na_client_cp.c
|
||||
dhcp6_ia_na_client_cp_api.c
|
||||
dhcp6_pd_client_cp.c
|
||||
dhcp6_pd_client_cp_api.c
|
||||
dhcp6_pd_client_dp.c
|
||||
dhcp6_proxy_node.c
|
||||
|
||||
MULTIARCH_SOURCES
|
||||
dhcp_client_detect.c
|
||||
|
||||
API_FILES
|
||||
dhcp.api
|
||||
dhcp6_pd_client_cp.api
|
||||
dhcp6_ia_na_client_cp.api
|
||||
|
||||
INSTALL_HEADERS
|
||||
client.h
|
||||
dhcp4_packet.h
|
||||
dhcp6_packet.h
|
||||
dhcp_proxy.h
|
||||
dhcp6_proxy_error.def
|
||||
dhcp4_proxy_error.def
|
||||
dhcp6_client_common_dp.h
|
||||
dhcp6_pd_client_dp.h
|
||||
dhcp6_ia_na_client_dp.h
|
||||
|
||||
API_TEST_SOURCES
|
||||
dhcp_test.c
|
||||
)
|
@ -14,8 +14,8 @@
|
||||
*/
|
||||
#include <vlib/vlib.h>
|
||||
#include <vlibmemory/api.h>
|
||||
#include <vnet/dhcp/client.h>
|
||||
#include <vnet/dhcp/dhcp_proxy.h>
|
||||
#include <dhcp/client.h>
|
||||
#include <dhcp/dhcp_proxy.h>
|
||||
#include <vnet/fib/fib_table.h>
|
||||
#include <vnet/qos/qos_types.h>
|
||||
|
@ -20,7 +20,7 @@
|
||||
#define included_dhcp_client_h
|
||||
|
||||
#include <vnet/ip/ip.h>
|
||||
#include <vnet/dhcp/dhcp4_packet.h>
|
||||
#include <dhcp/dhcp4_packet.h>
|
||||
|
||||
#define foreach_dhcp_client_state \
|
||||
_(DHCP_DISCOVER) \
|
@ -49,6 +49,54 @@ enum dhcpv6_msg_type
|
||||
DHCPV6_MSG_API_RELAY_REPL = 13,
|
||||
};
|
||||
|
||||
/** \brief Get the plugin version
|
||||
@param client_index - opaque cookie to identify the sender
|
||||
@param context - sender context, to match reply w/ request
|
||||
*/
|
||||
|
||||
define dhcp_plugin_get_version
|
||||
{
|
||||
u32 client_index;
|
||||
u32 context;
|
||||
};
|
||||
|
||||
/** \brief Reply to get the plugin version
|
||||
@param context - returned sender context, to match reply w/ request
|
||||
@param major - Incremented every time a known breaking behavior change is introduced
|
||||
@param minor - Incremented with small changes, may be used to avoid buggy versions
|
||||
*/
|
||||
|
||||
define dhcp_plugin_get_version_reply
|
||||
{
|
||||
u32 context;
|
||||
u32 major;
|
||||
u32 minor;
|
||||
};
|
||||
|
||||
/** \brief Control ping from client to api server request
|
||||
@param client_index - opaque cookie to identify the sender
|
||||
@param context - sender context, to match reply w/ request
|
||||
*/
|
||||
define dhcp_plugin_control_ping
|
||||
{
|
||||
u32 client_index;
|
||||
u32 context;
|
||||
};
|
||||
|
||||
/** \brief Control ping from the client to the server response
|
||||
@param client_index - opaque cookie to identify the sender
|
||||
@param context - sender context, to match reply w/ request
|
||||
@param retval - return code for the request
|
||||
@param vpe_pid - the pid of the vpe, returned by the server
|
||||
*/
|
||||
define dhcp_plugin_control_ping_reply
|
||||
{
|
||||
u32 context;
|
||||
i32 retval;
|
||||
u32 client_index;
|
||||
u32 vpe_pid;
|
||||
};
|
||||
|
||||
/** \brief DHCP Proxy config add / del request
|
||||
@param client_index - opaque cookie to identify the sender
|
||||
@param context - sender context, to match reply w/ request
|
@ -17,13 +17,13 @@
|
||||
|
||||
#include <vlib/vlib.h>
|
||||
#include <vnet/pg/pg.h>
|
||||
#include <vnet/dhcp/dhcp_proxy.h>
|
||||
#include <vnet/dhcp/client.h>
|
||||
#include <dhcp/dhcp_proxy.h>
|
||||
#include <dhcp/client.h>
|
||||
#include <vnet/fib/ip4_fib.h>
|
||||
|
||||
static char *dhcp_proxy_error_strings[] = {
|
||||
#define dhcp_proxy_error(n,s) s,
|
||||
#include <vnet/dhcp/dhcp4_proxy_error.def>
|
||||
#include <dhcp/dhcp4_proxy_error.def>
|
||||
#undef dhcp_proxy_error
|
||||
};
|
||||
|
@ -14,10 +14,11 @@
|
||||
*/
|
||||
|
||||
#include <vnet/ethernet/ethernet.h>
|
||||
#include <vnet/dhcp/dhcp6_client_common_dp.h>
|
||||
#include <vnet/dhcp/dhcp6_ia_na_client_dp.h>
|
||||
#include <vnet/dhcp/dhcp6_pd_client_dp.h>
|
||||
#include <vnet/dhcp/dhcp6_packet.h>
|
||||
#include <dhcp/dhcp6_packet.h>
|
||||
#include <dhcp/dhcp6_client_common_dp.h>
|
||||
#include <dhcp/dhcp6_ia_na_client_dp.h>
|
||||
#include <dhcp/dhcp6_pd_client_dp.h>
|
||||
#include <dhcp/dhcp6_packet.h>
|
||||
#include <vnet/udp/udp.h>
|
||||
|
||||
dhcp6_client_common_main_t dhcp6_client_common_main;
|
||||
@ -48,30 +49,11 @@ server_index_get_or_create (u8 * data, u16 len)
|
||||
return vec_len (ccm->server_ids) - 1;
|
||||
}
|
||||
|
||||
void
|
||||
vl_api_dhcp6_duid_ll_set_t_handler (vl_api_dhcp6_duid_ll_set_t * mp)
|
||||
{
|
||||
vl_api_dhcp6_duid_ll_set_reply_t *rmp;
|
||||
dhcpv6_duid_ll_string_t *duid;
|
||||
int rv = 0;
|
||||
|
||||
duid = (dhcpv6_duid_ll_string_t *) mp->duid_ll;
|
||||
if (duid->duid_type != htonl (DHCPV6_DUID_LL))
|
||||
{
|
||||
rv = VNET_API_ERROR_INVALID_VALUE;
|
||||
goto reply;
|
||||
}
|
||||
clib_memcpy (&client_duid, &duid, sizeof (client_duid));
|
||||
|
||||
reply:
|
||||
REPLY_MACRO (VL_API_DHCP6_DUID_LL_SET_REPLY);
|
||||
}
|
||||
|
||||
static void
|
||||
generate_client_duid (void)
|
||||
{
|
||||
client_duid.duid_type = htons (DHCPV6_DUID_LL);
|
||||
client_duid.hardware_type = htons (1);
|
||||
client_duid.duid_type = clib_host_to_net_u16 (DHCPV6_DUID_LL);
|
||||
client_duid.hardware_type = clib_host_to_net_u16 (1);
|
||||
|
||||
vnet_main_t *vnm = vnet_get_main ();
|
||||
vnet_interface_main_t *im = &vnm->interface_main;
|
||||
@ -190,8 +172,8 @@ dhcpv6_client_node_fn (vlib_main_t * vm, vlib_node_runtime_t * node,
|
||||
u32 dhcpv6_ip6_payload_offset =
|
||||
(u8 *) dhcpv60 - ((u8 *) ip0 + sizeof (*ip0));
|
||||
options_length =
|
||||
ntohs (ip0->payload_length) - dhcpv6_ip6_payload_offset -
|
||||
sizeof (*dhcpv60);
|
||||
clib_net_to_host_u16 (ip0->payload_length) -
|
||||
dhcpv6_ip6_payload_offset - sizeof (*dhcpv60);
|
||||
|
||||
clib_memset (&report, 0, sizeof (report));
|
||||
|
||||
@ -232,22 +214,24 @@ dhcpv6_client_node_fn (vlib_main_t * vm, vlib_node_runtime_t * node,
|
||||
while (options_length > 0)
|
||||
{
|
||||
if (options_length <
|
||||
ntohs (option->length) + sizeof (*option))
|
||||
clib_net_to_host_u16 (option->length) +
|
||||
sizeof (*option))
|
||||
{
|
||||
clib_warning
|
||||
("remaining payload length < option length (%d < %d)",
|
||||
options_length,
|
||||
ntohs (option->length) + sizeof (*option));
|
||||
clib_net_to_host_u16 (option->length) +
|
||||
sizeof (*option));
|
||||
break;
|
||||
}
|
||||
u16 oo = ntohs (option->option);
|
||||
u16 oo = clib_net_to_host_u16 (option->option);
|
||||
if (oo == DHCPV6_OPTION_IA_NA || oo == DHCPV6_OPTION_IA_PD)
|
||||
{
|
||||
u8 discard_option = 0;
|
||||
dhcpv6_ia_header_t *ia_header = (void *) option;
|
||||
iaid = ntohl (ia_header->iaid);
|
||||
u32 T1 = ntohl (ia_header->t1);
|
||||
u32 T2 = ntohl (ia_header->t2);
|
||||
iaid = clib_net_to_host_u32 (ia_header->iaid);
|
||||
u32 T1 = clib_net_to_host_u32 (ia_header->t1);
|
||||
u32 T2 = clib_net_to_host_u32 (ia_header->t2);
|
||||
if (iaid != DHCPV6_CLIENT_IAID)
|
||||
discard_option = 1;
|
||||
if (T1 != 0 && T2 != 0 && T1 > T2)
|
||||
@ -260,11 +244,12 @@ dhcpv6_client_node_fn (vlib_main_t * vm, vlib_node_runtime_t * node,
|
||||
dhcpv6_option_t *inner_option =
|
||||
(void *) ia_header->data;
|
||||
u16 inner_options_length =
|
||||
ntohs (option->length) - (sizeof (*ia_header) -
|
||||
sizeof (dhcpv6_option_t));
|
||||
clib_net_to_host_u16 (option->length) -
|
||||
(sizeof (*ia_header) - sizeof (dhcpv6_option_t));
|
||||
while (inner_options_length > 0)
|
||||
{
|
||||
u16 inner_oo = ntohs (inner_option->option);
|
||||
u16 inner_oo =
|
||||
clib_net_to_host_u16 (inner_option->option);
|
||||
if (discard_option)
|
||||
;
|
||||
else if (inner_oo == DHCPV6_OPTION_IAADDR)
|
||||
@ -276,9 +261,9 @@ dhcpv6_client_node_fn (vlib_main_t * vm, vlib_node_runtime_t * node,
|
||||
dhcp6_address_info_t *address_info =
|
||||
&addresses[n_addresses];
|
||||
address_info->preferred_time =
|
||||
ntohl (iaaddr->preferred);
|
||||
clib_net_to_host_u32 (iaaddr->preferred);
|
||||
address_info->valid_time =
|
||||
ntohl (iaaddr->valid);
|
||||
clib_net_to_host_u32 (iaaddr->valid);
|
||||
address_info->address = iaaddr->addr;
|
||||
}
|
||||
else if (inner_oo == DHCPV6_OPTION_IAPREFIX)
|
||||
@ -290,9 +275,9 @@ dhcpv6_client_node_fn (vlib_main_t * vm, vlib_node_runtime_t * node,
|
||||
dhcp6_prefix_info_t *prefix_info =
|
||||
&prefixes[n_prefixes];
|
||||
prefix_info->preferred_time =
|
||||
ntohl (iaprefix->preferred);
|
||||
clib_net_to_host_u32 (iaprefix->preferred);
|
||||
prefix_info->valid_time =
|
||||
ntohl (iaprefix->valid);
|
||||
clib_net_to_host_u32 (iaprefix->valid);
|
||||
prefix_info->prefix_length = iaprefix->prefix;
|
||||
prefix_info->prefix = iaprefix->addr;
|
||||
}
|
||||
@ -301,15 +286,16 @@ dhcpv6_client_node_fn (vlib_main_t * vm, vlib_node_runtime_t * node,
|
||||
dhcpv6_status_code_t *sc =
|
||||
(void *) inner_option;
|
||||
report.inner_status_code =
|
||||
ntohs (sc->status_code);
|
||||
clib_net_to_host_u16 (sc->status_code);
|
||||
}
|
||||
inner_options_length -=
|
||||
sizeof (*inner_option) +
|
||||
ntohs (inner_option->length);
|
||||
clib_net_to_host_u16 (inner_option->length);
|
||||
inner_option =
|
||||
(void *) ((u8 *) inner_option +
|
||||
sizeof (*inner_option) +
|
||||
ntohs (inner_option->length));
|
||||
clib_net_to_host_u16
|
||||
(inner_option->length));
|
||||
}
|
||||
}
|
||||
else if (oo == DHCPV6_OPTION_CLIENTID)
|
||||
@ -322,7 +308,7 @@ dhcpv6_client_node_fn (vlib_main_t * vm, vlib_node_runtime_t * node,
|
||||
}
|
||||
else
|
||||
{
|
||||
u16 len = ntohs (option->length);
|
||||
u16 len = clib_net_to_host_u16 (option->length);
|
||||
client_id_present = 1;
|
||||
if (len != CLIENT_DUID_LENGTH ||
|
||||
0 != memcmp (option->data,
|
||||
@ -345,7 +331,7 @@ dhcpv6_client_node_fn (vlib_main_t * vm, vlib_node_runtime_t * node,
|
||||
}
|
||||
else
|
||||
{
|
||||
u16 ol = ntohs (option->length);
|
||||
u16 ol = clib_net_to_host_u16 (option->length);
|
||||
if (ol - 2 /* 2 byte DUID type code */ > 128)
|
||||
{
|
||||
clib_warning
|
||||
@ -366,12 +352,14 @@ dhcpv6_client_node_fn (vlib_main_t * vm, vlib_node_runtime_t * node,
|
||||
else if (oo == DHCPV6_OPTION_STATUS_CODE)
|
||||
{
|
||||
dhcpv6_status_code_t *sc = (void *) option;
|
||||
report.status_code = ntohs (sc->status_code);
|
||||
report.status_code =
|
||||
clib_net_to_host_u16 (sc->status_code);
|
||||
}
|
||||
options_length -= sizeof (*option) + ntohs (option->length);
|
||||
options_length -=
|
||||
sizeof (*option) + clib_net_to_host_u16 (option->length);
|
||||
option =
|
||||
(void *) ((u8 *) option + sizeof (*option) +
|
||||
ntohs (option->length));
|
||||
clib_net_to_host_u16 (option->length));
|
||||
}
|
||||
|
||||
if (!client_id_present)
|
||||
@ -472,18 +460,6 @@ dhcp6_clients_enable_disable (u8 enable)
|
||||
0 /* is_ip6 */ );
|
||||
}
|
||||
|
||||
void
|
||||
vl_api_dhcp6_clients_enable_disable_t_handler
|
||||
(vl_api_dhcp6_clients_enable_disable_t * mp)
|
||||
{
|
||||
vl_api_dhcp6_clients_enable_disable_reply_t *rmp;
|
||||
int rv = 0;
|
||||
|
||||
dhcp6_clients_enable_disable (mp->enable);
|
||||
|
||||
REPLY_MACRO (VL_API_DHCP6_CLIENTS_ENABLE_DISABLE_REPLY);
|
||||
}
|
||||
|
||||
/*
|
||||
* fd.io coding-style-patch-verification: ON
|
||||
*
|
@ -17,27 +17,7 @@
|
||||
#define included_vnet_dhcp6_client_common_dp_h
|
||||
|
||||
#include <vlib/vlib.h>
|
||||
#include <vnet/dhcp/dhcp6_client_common_dp.h>
|
||||
#include <vnet/dhcp/dhcp6_packet.h>
|
||||
#include <vnet/vnet_msg_enum.h>
|
||||
#include <vlibapi/api_common.h>
|
||||
#include <vlibmemory/api.h>
|
||||
|
||||
#define vl_typedefs /* define message structures */
|
||||
#include <vnet/vnet_all_api_h.h>
|
||||
#undef vl_typedefs
|
||||
|
||||
#define vl_endianfun /* define message structures */
|
||||
#include <vnet/vnet_all_api_h.h>
|
||||
#undef vl_endianfun
|
||||
|
||||
/* instantiate all the print functions we know about */
|
||||
#define vl_print(handle, ...) vlib_cli_output (handle, __VA_ARGS__)
|
||||
#define vl_printfun
|
||||
#include <vnet/vnet_all_api_h.h>
|
||||
#undef vl_printfun
|
||||
|
||||
#include <vlibapi/api_helper_macros.h>
|
||||
#include <dhcp/dhcp6_packet.h>
|
||||
|
||||
typedef struct
|
||||
{
|
||||
@ -82,11 +62,7 @@ extern dhcpv6_duid_ll_string_t client_duid;
|
||||
void dhcp6_clients_enable_disable (u8 enable);
|
||||
u32 server_index_get_or_create (u8 * data, u16 len);
|
||||
|
||||
#define vl_typedefs /* define message structures */
|
||||
#include <vnet/vnet_all_api_h.h>
|
||||
#undef vl_typedefs
|
||||
|
||||
void vl_api_dhcp6_duid_ll_set_t_handler (vl_api_dhcp6_duid_ll_set_t * mp);
|
||||
extern dhcpv6_duid_ll_string_t client_duid;
|
||||
|
||||
static_always_inline f64
|
||||
random_f64_from_to (f64 from, f64 to)
|
@ -16,28 +16,13 @@
|
||||
#include <vnet/vnet.h>
|
||||
#include <vlibmemory/api.h>
|
||||
#include <vnet/vnet_msg_enum.h>
|
||||
#include <vnet/dhcp/dhcp6_packet.h>
|
||||
#include <vnet/dhcp/dhcp6_ia_na_client_dp.h>
|
||||
#include <dhcp/dhcp6_packet.h>
|
||||
#include <dhcp/dhcp6_ia_na_client_dp.h>
|
||||
#include <vnet/ip/ip.h>
|
||||
#include <vnet/ip/ip6.h>
|
||||
#include <float.h>
|
||||
#include <math.h>
|
||||
|
||||
#define vl_typedefs /* define message structures */
|
||||
#include <vnet/vnet_all_api_h.h>
|
||||
#undef vl_typedefs
|
||||
|
||||
#define vl_endianfun /* define message structures */
|
||||
#include <vnet/vnet_all_api_h.h>
|
||||
#undef vl_endianfun
|
||||
|
||||
#include <vlibapi/api_helper_macros.h>
|
||||
|
||||
#define foreach_dhcp6_client_cp_msg \
|
||||
_(DHCP6_CLIENT_ENABLE_DISABLE, dhcp6_client_enable_disable)
|
||||
|
||||
#define vl_api_dhcp6_client_enable_disable_t_print vl_noop_handler
|
||||
|
||||
typedef struct
|
||||
{
|
||||
u32 sw_if_index;
|
||||
@ -622,7 +607,7 @@ VLIB_CLI_COMMAND (dhcp6_clients_show_command, static) = {
|
||||
};
|
||||
/* *INDENT-ON* */
|
||||
|
||||
static int
|
||||
int
|
||||
dhcp6_client_enable_disable (u32 sw_if_index, u8 enable)
|
||||
{
|
||||
dhcp6_client_cp_main_t *rm = &dhcp6_client_cp_main;
|
||||
@ -766,67 +751,20 @@ VLIB_CLI_COMMAND (dhcp6_client_enable_disable_command, static) = {
|
||||
};
|
||||
/* *INDENT-ON* */
|
||||
|
||||
static void
|
||||
vl_api_dhcp6_client_enable_disable_t_handler
|
||||
(vl_api_dhcp6_client_enable_disable_t * mp)
|
||||
{
|
||||
vl_api_dhcp6_client_enable_disable_reply_t *rmp;
|
||||
u32 sw_if_index;
|
||||
int rv = 0;
|
||||
|
||||
VALIDATE_SW_IF_INDEX (mp);
|
||||
|
||||
sw_if_index = ntohl (mp->sw_if_index);
|
||||
|
||||
rv = dhcp6_client_enable_disable (sw_if_index, mp->enable);
|
||||
|
||||
BAD_SW_IF_INDEX_LABEL;
|
||||
|
||||
REPLY_MACRO (VL_API_SW_INTERFACE_SET_TABLE_REPLY);
|
||||
}
|
||||
|
||||
#define vl_msg_name_crc_list
|
||||
#include <vnet/dhcp/dhcp6_ia_na_client_cp.api.h>
|
||||
#undef vl_msg_name_crc_list
|
||||
|
||||
static void
|
||||
setup_message_id_table (api_main_t * am)
|
||||
{
|
||||
#define _(id,n,crc) vl_msg_api_add_msg_name_crc (am, #n "_" #crc, id);
|
||||
foreach_vl_msg_name_crc_dhcp6_ia_na_client_cp;
|
||||
#undef _
|
||||
}
|
||||
|
||||
static clib_error_t *
|
||||
dhcp_client_cp_init (vlib_main_t * vm)
|
||||
dhcp_ia_na_client_cp_init (vlib_main_t * vm)
|
||||
{
|
||||
dhcp6_client_cp_main_t *rm = &dhcp6_client_cp_main;
|
||||
api_main_t *am = &api_main;
|
||||
|
||||
rm->vlib_main = vm;
|
||||
rm->vnet_main = vnet_get_main ();
|
||||
rm->api_main = am;
|
||||
rm->api_main = &api_main;
|
||||
rm->node_index = dhcp6_client_cp_process_node.index;
|
||||
|
||||
#define _(N,n) \
|
||||
vl_msg_api_set_handlers(VL_API_##N, #n, \
|
||||
vl_api_##n##_t_handler, \
|
||||
vl_noop_handler, \
|
||||
vl_api_##n##_t_endian, \
|
||||
vl_api_##n##_t_print, \
|
||||
sizeof(vl_api_##n##_t), 0/* do NOT trace! */);
|
||||
foreach_dhcp6_client_cp_msg;
|
||||
#undef _
|
||||
|
||||
/*
|
||||
* Set up the (msg_name, crc, message-id) table
|
||||
*/
|
||||
setup_message_id_table (am);
|
||||
|
||||
return 0;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
VLIB_INIT_FUNCTION (dhcp_client_cp_init);
|
||||
VLIB_INIT_FUNCTION (dhcp_ia_na_client_cp_init);
|
||||
|
||||
/*
|
||||
* fd.io coding-style-patch-verification: ON
|
80
src/plugins/dhcp/dhcp6_ia_na_client_cp_api.c
Normal file
80
src/plugins/dhcp/dhcp6_ia_na_client_cp_api.c
Normal file
@ -0,0 +1,80 @@
|
||||
/*
|
||||
*------------------------------------------------------------------
|
||||
* dhcp_api.c - dhcp api
|
||||
*
|
||||
* Copyright (c) 2016 Cisco and/or its affiliates.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at:
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#include <vnet/vnet.h>
|
||||
#include <vlibmemory/api.h>
|
||||
|
||||
#include <dhcp/dhcp6_ia_na_client_dp.h>
|
||||
|
||||
/* define message IDs */
|
||||
#include <vnet/format_fns.h>
|
||||
#include <dhcp/dhcp6_ia_na_client_cp.api_enum.h>
|
||||
#include <dhcp/dhcp6_ia_na_client_cp.api_types.h>
|
||||
|
||||
/**
|
||||
* Base message ID fot the plugin
|
||||
*/
|
||||
static u32 dhcp_base_msg_id;
|
||||
#define REPLY_MSG_ID_BASE dhcp_base_msg_id
|
||||
|
||||
#include <vlibapi/api_helper_macros.h>
|
||||
|
||||
static void
|
||||
vl_api_dhcp6_client_enable_disable_t_handler
|
||||
(vl_api_dhcp6_client_enable_disable_t * mp)
|
||||
{
|
||||
vl_api_dhcp6_client_enable_disable_reply_t *rmp;
|
||||
u32 sw_if_index;
|
||||
int rv = 0;
|
||||
|
||||
VALIDATE_SW_IF_INDEX (mp);
|
||||
|
||||
sw_if_index = ntohl (mp->sw_if_index);
|
||||
|
||||
rv = dhcp6_client_enable_disable (sw_if_index, mp->enable);
|
||||
|
||||
BAD_SW_IF_INDEX_LABEL;
|
||||
|
||||
REPLY_MACRO (VL_API_DHCP6_CLIENT_ENABLE_DISABLE_REPLY);
|
||||
}
|
||||
|
||||
#define vl_msg_name_crc_list
|
||||
#include <dhcp/dhcp6_ia_na_client_cp.api.c>
|
||||
#undef vl_msg_name_crc_list
|
||||
|
||||
static clib_error_t *
|
||||
dhcp_ia_na_client_cp_api_init (vlib_main_t * vm)
|
||||
{
|
||||
/*
|
||||
* Set up the (msg_name, crc, message-id) table
|
||||
*/
|
||||
dhcp_base_msg_id = setup_message_id_table ();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
VLIB_INIT_FUNCTION (dhcp_ia_na_client_cp_api_init);
|
||||
|
||||
/*
|
||||
* fd.io coding-style-patch-verification: ON
|
||||
*
|
||||
* Local Variables:
|
||||
* eval: (c-set-style "gnu")
|
||||
* End:
|
||||
*/
|
@ -14,37 +14,17 @@
|
||||
*/
|
||||
|
||||
#include <vlib/vlib.h>
|
||||
#include <vnet/dhcp/dhcp6_packet.h>
|
||||
#include <vnet/dhcp/dhcp_proxy.h>
|
||||
#include <dhcp/dhcp6_packet.h>
|
||||
#include <dhcp/dhcp_proxy.h>
|
||||
#include <vnet/mfib/mfib_table.h>
|
||||
#include <vnet/mfib/ip6_mfib.h>
|
||||
#include <vnet/fib/fib.h>
|
||||
#include <vnet/adj/adj_mcast.h>
|
||||
#include <vnet/ip/ip6_neighbor.h>
|
||||
#include <vlibapi/api_common.h>
|
||||
#include <vlibmemory/api.h>
|
||||
#include <vnet/dhcp/dhcp6_ia_na_client_dp.h>
|
||||
#include <vnet/dhcp/dhcp6_client_common_dp.h>
|
||||
#include <dhcp/dhcp6_ia_na_client_dp.h>
|
||||
#include <dhcp/dhcp6_client_common_dp.h>
|
||||
#include <vnet/ip/ip_types_api.h>
|
||||
|
||||
#include <vnet/vnet_msg_enum.h>
|
||||
|
||||
#define vl_typedefs /* define message structures */
|
||||
#include <vnet/vnet_all_api_h.h>
|
||||
#undef vl_typedefs
|
||||
|
||||
#define vl_endianfun /* define message structures */
|
||||
#include <vnet/vnet_all_api_h.h>
|
||||
#undef vl_endianfun
|
||||
|
||||
/* instantiate all the print functions we know about */
|
||||
#define vl_print(handle, ...) vlib_cli_output (handle, __VA_ARGS__)
|
||||
#define vl_printfun
|
||||
#include <vnet/vnet_all_api_h.h>
|
||||
#undef vl_printfun
|
||||
|
||||
#include <vlibapi/api_helper_macros.h>
|
||||
|
||||
dhcp6_ia_na_client_main_t dhcp6_ia_na_client_main;
|
||||
dhcp6_ia_na_client_public_main_t dhcp6_ia_na_client_public_main;
|
||||
|
||||
@ -430,208 +410,6 @@ dhcp6_send_client_message (vlib_main_t * vm, u32 sw_if_index, u8 stop,
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
vl_api_dhcp6_send_client_message_t_handler
|
||||
(vl_api_dhcp6_send_client_message_t * mp)
|
||||
{
|
||||
vl_api_dhcp6_send_client_message_reply_t *rmp;
|
||||
dhcp6_send_client_message_params_t params;
|
||||
vlib_main_t *vm = vlib_get_main ();
|
||||
u32 n_addresses;
|
||||
u32 i;
|
||||
int rv = 0;
|
||||
|
||||
VALIDATE_SW_IF_INDEX (mp);
|
||||
|
||||
BAD_SW_IF_INDEX_LABEL;
|
||||
REPLY_MACRO (VL_API_DHCP6_SEND_CLIENT_MESSAGE_REPLY);
|
||||
|
||||
if (rv != 0)
|
||||
return;
|
||||
|
||||
params.sw_if_index = ntohl (mp->sw_if_index);
|
||||
params.server_index = ntohl (mp->server_index);
|
||||
params.irt = ntohl (mp->irt);
|
||||
params.mrt = ntohl (mp->mrt);
|
||||
params.mrc = ntohl (mp->mrc);
|
||||
params.mrd = ntohl (mp->mrd);
|
||||
params.msg_type = ntohl (mp->msg_type);
|
||||
params.T1 = ntohl (mp->T1);
|
||||
params.T2 = ntohl (mp->T2);
|
||||
n_addresses = ntohl (mp->n_addresses);
|
||||
params.addresses = 0;
|
||||
if (n_addresses > 0)
|
||||
vec_validate (params.addresses, n_addresses - 1);
|
||||
for (i = 0; i < n_addresses; i++)
|
||||
{
|
||||
vl_api_dhcp6_address_info_t *ai = &mp->addresses[i];
|
||||
dhcp6_send_client_message_params_address_t *addr = ¶ms.addresses[i];
|
||||
addr->preferred_lt = ntohl (ai->preferred_time);
|
||||
addr->valid_lt = ntohl (ai->valid_time);
|
||||
ip6_address_decode (ai->address, &addr->address);
|
||||
}
|
||||
|
||||
dhcp6_send_client_message (vm, ntohl (mp->sw_if_index), mp->stop, ¶ms);
|
||||
}
|
||||
|
||||
clib_error_t *
|
||||
call_dhcp6_reply_event_callbacks (void *data,
|
||||
_vnet_dhcp6_reply_event_function_list_elt_t
|
||||
* elt)
|
||||
{
|
||||
clib_error_t *error = 0;
|
||||
|
||||
while (elt)
|
||||
{
|
||||
error = elt->fp (data);
|
||||
if (error)
|
||||
return error;
|
||||
elt = elt->next_dhcp6_reply_event_function;
|
||||
}
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
static uword
|
||||
dhcp6_reply_process (vlib_main_t * vm, vlib_node_runtime_t * rt,
|
||||
vlib_frame_t * f)
|
||||
{
|
||||
/* These cross the longjmp boundary (vlib_process_wait_for_event)
|
||||
* and need to be volatile - to prevent them from being optimized into
|
||||
* a register - which could change during suspension */
|
||||
|
||||
while (1)
|
||||
{
|
||||
vlib_process_wait_for_event (vm);
|
||||
uword event_type = DHCP6_DP_REPLY_REPORT;
|
||||
void *event_data = vlib_process_get_event_data (vm, &event_type);
|
||||
|
||||
int i;
|
||||
if (event_type == DHCP6_DP_REPLY_REPORT)
|
||||
{
|
||||
address_report_t *events = event_data;
|
||||
for (i = 0; i < vec_len (events); i++)
|
||||
{
|
||||
u32 event_size =
|
||||
sizeof (vl_api_dhcp6_reply_event_t) +
|
||||
vec_len (events[i].addresses) *
|
||||
sizeof (vl_api_dhcp6_address_info_t);
|
||||
vl_api_dhcp6_reply_event_t *event = clib_mem_alloc (event_size);
|
||||
clib_memset (event, 0, event_size);
|
||||
|
||||
event->sw_if_index = htonl (events[i].body.sw_if_index);
|
||||
event->server_index = htonl (events[i].body.server_index);
|
||||
event->msg_type = events[i].body.msg_type;
|
||||
event->T1 = htonl (events[i].body.T1);
|
||||
event->T2 = htonl (events[i].body.T2);
|
||||
event->inner_status_code =
|
||||
htons (events[i].body.inner_status_code);
|
||||
event->status_code = htons (events[i].body.status_code);
|
||||
event->preference = events[i].body.preference;
|
||||
|
||||
event->n_addresses = htonl (vec_len (events[i].addresses));
|
||||
vl_api_dhcp6_address_info_t *address =
|
||||
(typeof (address)) event->addresses;
|
||||
u32 j;
|
||||
for (j = 0; j < vec_len (events[i].addresses); j++)
|
||||
{
|
||||
dhcp6_address_info_t *info = &events[i].addresses[j];
|
||||
ip6_address_encode (&info->address, address->address);
|
||||
address->valid_time = htonl (info->valid_time);
|
||||
address->preferred_time = htonl (info->preferred_time);
|
||||
address++;
|
||||
}
|
||||
vec_free (events[i].addresses);
|
||||
|
||||
dhcp6_ia_na_client_public_main_t *dcpm =
|
||||
&dhcp6_ia_na_client_public_main;
|
||||
call_dhcp6_reply_event_callbacks (event, dcpm->functions);
|
||||
|
||||
vpe_client_registration_t *reg;
|
||||
/* *INDENT-OFF* */
|
||||
pool_foreach(reg, vpe_api_main.dhcp6_reply_events_registrations,
|
||||
({
|
||||
vl_api_registration_t *vl_reg;
|
||||
vl_reg =
|
||||
vl_api_client_index_to_registration (reg->client_index);
|
||||
if (vl_reg && vl_api_can_send_msg (vl_reg))
|
||||
{
|
||||
vl_api_dhcp6_reply_event_t *msg =
|
||||
vl_msg_api_alloc (event_size);
|
||||
clib_memcpy (msg, event, event_size);
|
||||
msg->_vl_msg_id = htons (VL_API_DHCP6_REPLY_EVENT);
|
||||
msg->client_index = reg->client_index;
|
||||
msg->pid = reg->client_pid;
|
||||
vl_api_send_msg (vl_reg, (u8 *) msg);
|
||||
}
|
||||
}));
|
||||
/* *INDENT-ON* */
|
||||
|
||||
clib_mem_free (event);
|
||||
}
|
||||
}
|
||||
vlib_process_put_event_data (vm, event_data);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* *INDENT-OFF* */
|
||||
VLIB_REGISTER_NODE (dhcp6_reply_process_node) = {
|
||||
.function = dhcp6_reply_process,
|
||||
.type = VLIB_NODE_TYPE_PROCESS,
|
||||
.name = "dhcp6-reply-publisher-process",
|
||||
};
|
||||
/* *INDENT-ON* */
|
||||
|
||||
void
|
||||
vl_api_want_dhcp6_reply_events_t_handler
|
||||
(vl_api_want_dhcp6_reply_events_t * mp)
|
||||
{
|
||||
vpe_api_main_t *am = &vpe_api_main;
|
||||
vl_api_want_dhcp6_reply_events_reply_t *rmp;
|
||||
int rv = 0;
|
||||
|
||||
uword *p =
|
||||
hash_get (am->dhcp6_reply_events_registration_hash, mp->client_index);
|
||||
vpe_client_registration_t *rp;
|
||||
if (p)
|
||||
{
|
||||
if (mp->enable_disable)
|
||||
{
|
||||
clib_warning ("pid %d: already enabled...", ntohl (mp->pid));
|
||||
rv = VNET_API_ERROR_INVALID_REGISTRATION;
|
||||
goto reply;
|
||||
}
|
||||
else
|
||||
{
|
||||
rp = pool_elt_at_index (am->dhcp6_reply_events_registrations, p[0]);
|
||||
pool_put (am->dhcp6_reply_events_registrations, rp);
|
||||
hash_unset (am->dhcp6_reply_events_registration_hash,
|
||||
mp->client_index);
|
||||
if (pool_elts (am->dhcp6_reply_events_registrations) == 0)
|
||||
dhcp6_set_publisher_node (~0, DHCP6_DP_REPORT_MAX);
|
||||
goto reply;
|
||||
}
|
||||
}
|
||||
if (mp->enable_disable == 0)
|
||||
{
|
||||
clib_warning ("pid %d: already disabled...", ntohl (mp->pid));
|
||||
rv = VNET_API_ERROR_INVALID_REGISTRATION;
|
||||
goto reply;
|
||||
}
|
||||
pool_get (am->dhcp6_reply_events_registrations, rp);
|
||||
rp->client_index = mp->client_index;
|
||||
rp->client_pid = ntohl (mp->pid);
|
||||
hash_set (am->dhcp6_reply_events_registration_hash, rp->client_index,
|
||||
rp - am->dhcp6_reply_events_registrations);
|
||||
dhcp6_set_publisher_node (dhcp6_reply_process_node.index,
|
||||
DHCP6_DP_REPLY_REPORT);
|
||||
|
||||
reply:
|
||||
REPLY_MACRO (VL_API_WANT_DHCP6_REPLY_EVENTS_REPLY);
|
||||
}
|
||||
|
||||
static clib_error_t *
|
||||
dhcp6_client_init (vlib_main_t * vm)
|
||||
{
|
@ -16,8 +16,9 @@
|
||||
#ifndef included_vnet_dhcp6_client_dp_h
|
||||
#define included_vnet_dhcp6_client_dp_h
|
||||
|
||||
#include <vlib/vlib.h>
|
||||
#include <vnet/dhcp/dhcp6_client_common_dp.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#include <dhcp/dhcp6_client_common_dp.h>
|
||||
|
||||
typedef struct
|
||||
{
|
||||
@ -87,31 +88,19 @@ typedef struct
|
||||
dhcp6_address_info_t *addresses;
|
||||
} address_report_t;
|
||||
|
||||
#define vl_typedefs /* define message structures */
|
||||
#include <vnet/vnet_all_api_h.h>
|
||||
#undef vl_typedefs
|
||||
|
||||
void dhcp6_send_client_message (vlib_main_t * vm, u32 sw_if_index, u8 stop,
|
||||
dhcp6_send_client_message_params_t * params);
|
||||
void dhcp6_set_publisher_node (uword node_index, uword event_type);
|
||||
int dhcp6_publish_report (address_report_t * r);
|
||||
|
||||
|
||||
void
|
||||
vl_api_want_dhcp6_reply_events_t_handler
|
||||
(vl_api_want_dhcp6_reply_events_t * mp);
|
||||
void
|
||||
vl_api_dhcp6_send_client_message_t_handler
|
||||
(vl_api_dhcp6_send_client_message_t * mp);
|
||||
void
|
||||
vl_api_dhcp6_clients_enable_disable_t_handler
|
||||
(vl_api_dhcp6_clients_enable_disable_t * mp);
|
||||
int dhcp6_client_enable_disable (u32 sw_if_index, u8 enable);
|
||||
|
||||
extern vlib_node_registration_t dhcp6_reply_process_node;
|
||||
|
||||
enum
|
||||
{ DHCP6_DP_REPLY_REPORT, DHCP6_DP_REPORT_MAX };
|
||||
|
||||
#include <dhcp/dhcp.api_types.h>
|
||||
|
||||
typedef struct _vnet_dhcp6_reply_function_list_elt
|
||||
{
|
||||
struct _vnet_dhcp6_reply_function_list_elt *next_dhcp6_reply_event_function;
|
@ -15,32 +15,14 @@
|
||||
|
||||
#include <vnet/vnet.h>
|
||||
#include <vlibmemory/api.h>
|
||||
#include <vnet/vnet_msg_enum.h>
|
||||
#include <vnet/dhcp/dhcp6_packet.h>
|
||||
#include <vnet/dhcp/dhcp6_pd_client_dp.h>
|
||||
#include <dhcp/dhcp6_packet.h>
|
||||
#include <dhcp/dhcp6_pd_client_dp.h>
|
||||
#include <vnet/ip/ip.h>
|
||||
#include <vnet/ip/ip6.h>
|
||||
#include <float.h>
|
||||
#include <math.h>
|
||||
#include <string.h>
|
||||
|
||||
#define vl_typedefs /* define message structures */
|
||||
#include <vnet/vnet_all_api_h.h>
|
||||
#undef vl_typedefs
|
||||
|
||||
#define vl_endianfun /* define message structures */
|
||||
#include <vnet/vnet_all_api_h.h>
|
||||
#undef vl_endianfun
|
||||
|
||||
#include <vlibapi/api_helper_macros.h>
|
||||
|
||||
#define foreach_dhcp6_pd_client_cp_msg \
|
||||
_(DHCP6_PD_CLIENT_ENABLE_DISABLE, dhcp6_pd_client_enable_disable) \
|
||||
_(IP6_ADD_DEL_ADDRESS_USING_PREFIX, ip6_add_del_address_using_prefix)
|
||||
|
||||
#define vl_api_dhcp6_pd_client_enable_disable_t_print vl_noop_handler
|
||||
#define vl_api_ip6_add_del_address_using_prefix_t_print vl_noop_handler
|
||||
|
||||
typedef struct
|
||||
{
|
||||
u32 prefix_group_index;
|
||||
@ -868,9 +850,10 @@ prefix_group_find_or_create (const u8 * name, u8 create)
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
cp_ip6_address_add_del (u32 sw_if_index, const u8 * prefix_group,
|
||||
ip6_address_t address, u8 prefix_length, u8 is_add)
|
||||
int
|
||||
dhcp6_cp_ip6_address_add_del (u32 sw_if_index, const u8 * prefix_group,
|
||||
ip6_address_t address, u8 prefix_length,
|
||||
u8 is_add)
|
||||
{
|
||||
|
||||
ip6_address_with_prefix_main_t *apm = &ip6_address_with_prefix_main;
|
||||
@ -927,32 +910,6 @@ cp_ip6_address_add_del (u32 sw_if_index, const u8 * prefix_group,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
vl_api_ip6_add_del_address_using_prefix_t_handler
|
||||
(vl_api_ip6_add_del_address_using_prefix_t * mp)
|
||||
{
|
||||
vl_api_ip6_add_del_address_using_prefix_reply_t *rmp;
|
||||
u32 sw_if_index;
|
||||
ip6_address_t address;
|
||||
u8 prefix_length;
|
||||
int rv = 0;
|
||||
|
||||
VALIDATE_SW_IF_INDEX (mp);
|
||||
|
||||
sw_if_index = ntohl (mp->sw_if_index);
|
||||
|
||||
memcpy (address.as_u8, mp->address, 16);
|
||||
prefix_length = mp->prefix_length;
|
||||
|
||||
rv =
|
||||
cp_ip6_address_add_del (sw_if_index, mp->prefix_group, address,
|
||||
prefix_length, mp->is_add);
|
||||
|
||||
BAD_SW_IF_INDEX_LABEL;
|
||||
|
||||
REPLY_MACRO (VL_API_IP6_ADD_DEL_ADDRESS_USING_PREFIX_REPLY);
|
||||
}
|
||||
|
||||
static clib_error_t *
|
||||
cp_ip6_address_add_del_command_function (vlib_main_t * vm,
|
||||
unformat_input_t * input,
|
||||
@ -999,7 +956,7 @@ cp_ip6_address_add_del_command_function (vlib_main_t * vm,
|
||||
error = clib_error_return (0, "Missing address");
|
||||
else
|
||||
{
|
||||
if (cp_ip6_address_add_del
|
||||
if (dhcp6_cp_ip6_address_add_del
|
||||
(sw_if_index, prefix_group, address, prefix_length, add) != 0)
|
||||
error = clib_error_return (0, "Error adding or removing address");
|
||||
}
|
||||
@ -1169,9 +1126,11 @@ VLIB_CLI_COMMAND (ip6_pd_clients_show_command, static) = {
|
||||
};
|
||||
/* *INDENT-ON* */
|
||||
|
||||
static int
|
||||
dhcp6_pd_client_enable_disable (u32 sw_if_index, const u8 * prefix_group,
|
||||
u8 enable)
|
||||
|
||||
|
||||
int
|
||||
dhcp6_pd_client_enable_disable (u32 sw_if_index,
|
||||
const u8 * prefix_group, u8 enable)
|
||||
{
|
||||
dhcp6_pd_client_cp_main_t *rm = &dhcp6_pd_client_cp_main;
|
||||
ip6_prefix_main_t *pm = &ip6_prefix_main;
|
||||
@ -1341,66 +1300,17 @@ VLIB_CLI_COMMAND (dhcp6_pd_client_enable_disable_command, static) = {
|
||||
};
|
||||
/* *INDENT-ON* */
|
||||
|
||||
static void
|
||||
vl_api_dhcp6_pd_client_enable_disable_t_handler
|
||||
(vl_api_dhcp6_pd_client_enable_disable_t * mp)
|
||||
{
|
||||
vl_api_dhcp6_pd_client_enable_disable_reply_t *rmp;
|
||||
u32 sw_if_index;
|
||||
int rv = 0;
|
||||
|
||||
VALIDATE_SW_IF_INDEX (mp);
|
||||
|
||||
sw_if_index = ntohl (mp->sw_if_index);
|
||||
|
||||
rv =
|
||||
dhcp6_pd_client_enable_disable (sw_if_index, mp->prefix_group,
|
||||
mp->enable);
|
||||
|
||||
BAD_SW_IF_INDEX_LABEL;
|
||||
|
||||
REPLY_MACRO (VL_API_DHCP6_PD_CLIENT_ENABLE_DISABLE_REPLY);
|
||||
}
|
||||
|
||||
#define vl_msg_name_crc_list
|
||||
#include <vnet/dhcp/dhcp6_pd_client_cp.api.h>
|
||||
#undef vl_msg_name_crc_list
|
||||
|
||||
static void
|
||||
setup_message_id_table (api_main_t * am)
|
||||
{
|
||||
#define _(id,n,crc) vl_msg_api_add_msg_name_crc (am, #n "_" #crc, id);
|
||||
foreach_vl_msg_name_crc_dhcp6_pd_client_cp;
|
||||
#undef _
|
||||
}
|
||||
|
||||
static clib_error_t *
|
||||
dhcp_pd_client_cp_init (vlib_main_t * vm)
|
||||
{
|
||||
dhcp6_pd_client_cp_main_t *rm = &dhcp6_pd_client_cp_main;
|
||||
api_main_t *am = &api_main;
|
||||
|
||||
rm->vlib_main = vm;
|
||||
rm->vnet_main = vnet_get_main ();
|
||||
rm->api_main = am;
|
||||
rm->api_main = &api_main;
|
||||
rm->node_index = dhcp6_pd_client_cp_process_node.index;
|
||||
|
||||
#define _(N,n) \
|
||||
vl_msg_api_set_handlers(VL_API_##N, #n, \
|
||||
vl_api_##n##_t_handler, \
|
||||
vl_noop_handler, \
|
||||
vl_api_##n##_t_endian, \
|
||||
vl_api_##n##_t_print, \
|
||||
sizeof(vl_api_##n##_t), 0/* do NOT trace! */);
|
||||
foreach_dhcp6_pd_client_cp_msg;
|
||||
#undef _
|
||||
|
||||
/*
|
||||
* Set up the (msg_name, crc, message-id) table
|
||||
*/
|
||||
setup_message_id_table (am);
|
||||
|
||||
return 0;
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
VLIB_INIT_FUNCTION (dhcp_pd_client_cp_init);
|
102
src/plugins/dhcp/dhcp6_pd_client_cp_api.c
Normal file
102
src/plugins/dhcp/dhcp6_pd_client_cp_api.c
Normal file
@ -0,0 +1,102 @@
|
||||
/*
|
||||
* Copyright (c) 2018 Cisco and/or its affiliates.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at:
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <vnet/vnet.h>
|
||||
#include <vlibmemory/api.h>
|
||||
|
||||
#include <dhcp/dhcp6_pd_client_dp.h>
|
||||
|
||||
/* define message IDs */
|
||||
#include <vnet/format_fns.h>
|
||||
#include <dhcp/dhcp6_pd_client_cp.api_enum.h>
|
||||
#include <dhcp/dhcp6_pd_client_cp.api_types.h>
|
||||
|
||||
/**
|
||||
* Base message ID fot the plugin
|
||||
*/
|
||||
static u32 dhcp_base_msg_id;
|
||||
#define REPLY_MSG_ID_BASE dhcp_base_msg_id
|
||||
|
||||
#include <vlibapi/api_helper_macros.h>
|
||||
|
||||
static void
|
||||
vl_api_dhcp6_pd_client_enable_disable_t_handler
|
||||
(vl_api_dhcp6_pd_client_enable_disable_t * mp)
|
||||
{
|
||||
vl_api_dhcp6_pd_client_enable_disable_reply_t *rmp;
|
||||
u32 sw_if_index;
|
||||
int rv = 0;
|
||||
|
||||
VALIDATE_SW_IF_INDEX (mp);
|
||||
|
||||
sw_if_index = ntohl (mp->sw_if_index);
|
||||
|
||||
rv = dhcp6_pd_client_enable_disable (sw_if_index,
|
||||
mp->prefix_group, mp->enable);
|
||||
|
||||
BAD_SW_IF_INDEX_LABEL;
|
||||
|
||||
REPLY_MACRO (VL_API_DHCP6_PD_CLIENT_ENABLE_DISABLE_REPLY);
|
||||
}
|
||||
|
||||
static void
|
||||
vl_api_ip6_add_del_address_using_prefix_t_handler
|
||||
(vl_api_ip6_add_del_address_using_prefix_t * mp)
|
||||
{
|
||||
vl_api_ip6_add_del_address_using_prefix_reply_t *rmp;
|
||||
u32 sw_if_index;
|
||||
ip6_address_t address;
|
||||
u8 prefix_length;
|
||||
int rv = 0;
|
||||
|
||||
VALIDATE_SW_IF_INDEX (mp);
|
||||
|
||||
sw_if_index = ntohl (mp->sw_if_index);
|
||||
|
||||
memcpy (address.as_u8, mp->address, 16);
|
||||
prefix_length = mp->prefix_length;
|
||||
|
||||
rv = dhcp6_cp_ip6_address_add_del (sw_if_index, mp->prefix_group, address,
|
||||
prefix_length, mp->is_add);
|
||||
|
||||
BAD_SW_IF_INDEX_LABEL;
|
||||
|
||||
REPLY_MACRO (VL_API_IP6_ADD_DEL_ADDRESS_USING_PREFIX_REPLY);
|
||||
}
|
||||
|
||||
#define vl_msg_name_crc_list
|
||||
#include <dhcp/dhcp6_pd_client_cp.api.c>
|
||||
#undef vl_msg_name_crc_list
|
||||
|
||||
static clib_error_t *
|
||||
dhcp_pd_client_cp_api_init (vlib_main_t * vm)
|
||||
{
|
||||
/*
|
||||
* Set up the (msg_name, crc, message-id) table
|
||||
*/
|
||||
dhcp_base_msg_id = setup_message_id_table ();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
VLIB_INIT_FUNCTION (dhcp_pd_client_cp_api_init);
|
||||
|
||||
/*
|
||||
* fd.io coding-style-patch-verification: ON
|
||||
*
|
||||
* Local Variables:
|
||||
* eval: (c-set-style "gnu")
|
||||
* End:
|
||||
*/
|
@ -14,37 +14,17 @@
|
||||
*/
|
||||
|
||||
#include <vlib/vlib.h>
|
||||
#include <vnet/dhcp/dhcp6_packet.h>
|
||||
#include <vnet/dhcp/dhcp_proxy.h>
|
||||
#include <dhcp/dhcp6_packet.h>
|
||||
#include <dhcp/dhcp_proxy.h>
|
||||
#include <vnet/mfib/mfib_table.h>
|
||||
#include <vnet/mfib/ip6_mfib.h>
|
||||
#include <vnet/fib/fib.h>
|
||||
#include <vnet/adj/adj_mcast.h>
|
||||
#include <vnet/ip/ip6_neighbor.h>
|
||||
#include <vlibapi/api_common.h>
|
||||
#include <vlibmemory/api.h>
|
||||
#include <vnet/dhcp/dhcp6_pd_client_dp.h>
|
||||
#include <vnet/dhcp/dhcp6_client_common_dp.h>
|
||||
#include <dhcp/dhcp6_pd_client_dp.h>
|
||||
#include <dhcp/dhcp6_client_common_dp.h>
|
||||
#include <vnet/ip/ip_types_api.h>
|
||||
|
||||
#include <vnet/vnet_msg_enum.h>
|
||||
|
||||
#define vl_typedefs /* define message structures */
|
||||
#include <vnet/vnet_all_api_h.h>
|
||||
#undef vl_typedefs
|
||||
|
||||
#define vl_endianfun /* define message structures */
|
||||
#include <vnet/vnet_all_api_h.h>
|
||||
#undef vl_endianfun
|
||||
|
||||
/* instantiate all the print functions we know about */
|
||||
#define vl_print(handle, ...) vlib_cli_output (handle, __VA_ARGS__)
|
||||
#define vl_printfun
|
||||
#include <vnet/vnet_all_api_h.h>
|
||||
#undef vl_printfun
|
||||
|
||||
#include <vlibapi/api_helper_macros.h>
|
||||
|
||||
dhcp6_pd_client_main_t dhcp6_pd_client_main;
|
||||
dhcp6_pd_client_public_main_t dhcp6_pd_client_public_main;
|
||||
|
||||
@ -433,214 +413,6 @@ dhcp6_pd_send_client_message (vlib_main_t * vm, u32 sw_if_index, u8 stop,
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
vl_api_dhcp6_pd_send_client_message_t_handler
|
||||
(vl_api_dhcp6_pd_send_client_message_t * mp)
|
||||
{
|
||||
vl_api_dhcp6_pd_send_client_message_reply_t *rmp;
|
||||
dhcp6_pd_send_client_message_params_t params;
|
||||
vlib_main_t *vm = vlib_get_main ();
|
||||
u32 n_prefixes;
|
||||
u32 i;
|
||||
int rv = 0;
|
||||
|
||||
VALIDATE_SW_IF_INDEX (mp);
|
||||
|
||||
BAD_SW_IF_INDEX_LABEL;
|
||||
REPLY_MACRO (VL_API_DHCP6_PD_SEND_CLIENT_MESSAGE_REPLY);
|
||||
|
||||
if (rv != 0)
|
||||
return;
|
||||
|
||||
params.sw_if_index = ntohl (mp->sw_if_index);
|
||||
params.server_index = ntohl (mp->server_index);
|
||||
params.irt = ntohl (mp->irt);
|
||||
params.mrt = ntohl (mp->mrt);
|
||||
params.mrc = ntohl (mp->mrc);
|
||||
params.mrd = ntohl (mp->mrd);
|
||||
params.msg_type = ntohl (mp->msg_type);
|
||||
params.T1 = ntohl (mp->T1);
|
||||
params.T2 = ntohl (mp->T2);
|
||||
n_prefixes = ntohl (mp->n_prefixes);
|
||||
params.prefixes = 0;
|
||||
if (n_prefixes > 0)
|
||||
vec_validate (params.prefixes, n_prefixes - 1);
|
||||
for (i = 0; i < n_prefixes; i++)
|
||||
{
|
||||
vl_api_dhcp6_pd_prefix_info_t *pi = &mp->prefixes[i];
|
||||
dhcp6_pd_send_client_message_params_prefix_t *pref =
|
||||
¶ms.prefixes[i];
|
||||
pref->preferred_lt = ntohl (pi->preferred_time);
|
||||
pref->valid_lt = ntohl (pi->valid_time);
|
||||
ip6_address_decode (pi->prefix.address, &pref->prefix);
|
||||
pref->prefix_length = pi->prefix.len;
|
||||
}
|
||||
|
||||
dhcp6_pd_send_client_message (vm, ntohl (mp->sw_if_index), mp->stop,
|
||||
¶ms);
|
||||
}
|
||||
|
||||
static clib_error_t *
|
||||
call_dhcp6_pd_reply_event_callbacks (void *data,
|
||||
_vnet_dhcp6_pd_reply_event_function_list_elt_t
|
||||
* elt)
|
||||
{
|
||||
clib_error_t *error = 0;
|
||||
|
||||
while (elt)
|
||||
{
|
||||
error = elt->fp (data);
|
||||
if (error)
|
||||
return error;
|
||||
elt = elt->next_dhcp6_pd_reply_event_function;
|
||||
}
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
static uword
|
||||
dhcp6_pd_reply_process (vlib_main_t * vm, vlib_node_runtime_t * rt,
|
||||
vlib_frame_t * f)
|
||||
{
|
||||
/* These cross the longjmp boundary (vlib_process_wait_for_event)
|
||||
* and need to be volatile - to prevent them from being optimized into
|
||||
* a register - which could change during suspension */
|
||||
|
||||
while (1)
|
||||
{
|
||||
vlib_process_wait_for_event (vm);
|
||||
uword event_type = DHCP6_PD_DP_REPLY_REPORT;
|
||||
void *event_data = vlib_process_get_event_data (vm, &event_type);
|
||||
|
||||
int i;
|
||||
if (event_type == DHCP6_PD_DP_REPLY_REPORT)
|
||||
{
|
||||
prefix_report_t *events = event_data;
|
||||
for (i = 0; i < vec_len (events); i++)
|
||||
{
|
||||
u32 event_size =
|
||||
sizeof (vl_api_dhcp6_pd_reply_event_t) +
|
||||
vec_len (events[i].prefixes) *
|
||||
sizeof (vl_api_dhcp6_pd_prefix_info_t);
|
||||
vl_api_dhcp6_pd_reply_event_t *event =
|
||||
clib_mem_alloc (event_size);
|
||||
clib_memset (event, 0, event_size);
|
||||
|
||||
event->sw_if_index = htonl (events[i].body.sw_if_index);
|
||||
event->server_index = htonl (events[i].body.server_index);
|
||||
event->msg_type = events[i].body.msg_type;
|
||||
event->T1 = htonl (events[i].body.T1);
|
||||
event->T2 = htonl (events[i].body.T2);
|
||||
event->inner_status_code =
|
||||
htons (events[i].body.inner_status_code);
|
||||
event->status_code = htons (events[i].body.status_code);
|
||||
event->preference = events[i].body.preference;
|
||||
|
||||
event->n_prefixes = htonl (vec_len (events[i].prefixes));
|
||||
vl_api_dhcp6_pd_prefix_info_t *prefix =
|
||||
(typeof (prefix)) event->prefixes;
|
||||
u32 j;
|
||||
for (j = 0; j < vec_len (events[i].prefixes); j++)
|
||||
{
|
||||
dhcp6_prefix_info_t *info = &events[i].prefixes[j];
|
||||
ip6_address_encode (&info->prefix, prefix->prefix.address);
|
||||
prefix->prefix.len = info->prefix_length;
|
||||
prefix->valid_time = htonl (info->valid_time);
|
||||
prefix->preferred_time = htonl (info->preferred_time);
|
||||
prefix++;
|
||||
}
|
||||
vec_free (events[i].prefixes);
|
||||
|
||||
dhcp6_pd_client_public_main_t *dpcpm =
|
||||
&dhcp6_pd_client_public_main;
|
||||
call_dhcp6_pd_reply_event_callbacks (event, dpcpm->functions);
|
||||
|
||||
vpe_client_registration_t *reg;
|
||||
/* *INDENT-OFF* */
|
||||
pool_foreach(reg, vpe_api_main.dhcp6_pd_reply_events_registrations,
|
||||
({
|
||||
vl_api_registration_t *vl_reg;
|
||||
vl_reg =
|
||||
vl_api_client_index_to_registration (reg->client_index);
|
||||
if (vl_reg && vl_api_can_send_msg (vl_reg))
|
||||
{
|
||||
vl_api_dhcp6_pd_reply_event_t *msg =
|
||||
vl_msg_api_alloc (event_size);
|
||||
clib_memcpy (msg, event, event_size);
|
||||
msg->_vl_msg_id = htons (VL_API_DHCP6_PD_REPLY_EVENT);
|
||||
msg->client_index = reg->client_index;
|
||||
msg->pid = reg->client_pid;
|
||||
vl_api_send_msg (vl_reg, (u8 *) msg);
|
||||
}
|
||||
}));
|
||||
/* *INDENT-ON* */
|
||||
|
||||
clib_mem_free (event);
|
||||
}
|
||||
}
|
||||
vlib_process_put_event_data (vm, event_data);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* *INDENT-OFF* */
|
||||
VLIB_REGISTER_NODE (dhcp6_pd_reply_process_node) = {
|
||||
.function = dhcp6_pd_reply_process,
|
||||
.type = VLIB_NODE_TYPE_PROCESS,
|
||||
.name = "dhcp6-pd-reply-publisher-process",
|
||||
};
|
||||
/* *INDENT-ON* */
|
||||
|
||||
void
|
||||
vl_api_want_dhcp6_pd_reply_events_t_handler
|
||||
(vl_api_want_dhcp6_pd_reply_events_t * mp)
|
||||
{
|
||||
vpe_api_main_t *am = &vpe_api_main;
|
||||
vl_api_want_dhcp6_pd_reply_events_reply_t *rmp;
|
||||
int rv = 0;
|
||||
|
||||
uword *p =
|
||||
hash_get (am->dhcp6_pd_reply_events_registration_hash, mp->client_index);
|
||||
vpe_client_registration_t *rp;
|
||||
if (p)
|
||||
{
|
||||
if (mp->enable_disable)
|
||||
{
|
||||
clib_warning ("pid %d: already enabled...", ntohl (mp->pid));
|
||||
rv = VNET_API_ERROR_INVALID_REGISTRATION;
|
||||
goto reply;
|
||||
}
|
||||
else
|
||||
{
|
||||
rp =
|
||||
pool_elt_at_index (am->dhcp6_pd_reply_events_registrations, p[0]);
|
||||
pool_put (am->dhcp6_pd_reply_events_registrations, rp);
|
||||
hash_unset (am->dhcp6_pd_reply_events_registration_hash,
|
||||
mp->client_index);
|
||||
if (pool_elts (am->dhcp6_pd_reply_events_registrations) == 0)
|
||||
dhcp6_pd_set_publisher_node (~0, DHCP6_PD_DP_REPORT_MAX);
|
||||
goto reply;
|
||||
}
|
||||
}
|
||||
if (mp->enable_disable == 0)
|
||||
{
|
||||
clib_warning ("pid %d: already disabled...", ntohl (mp->pid));
|
||||
rv = VNET_API_ERROR_INVALID_REGISTRATION;
|
||||
goto reply;
|
||||
}
|
||||
pool_get (am->dhcp6_pd_reply_events_registrations, rp);
|
||||
rp->client_index = mp->client_index;
|
||||
rp->client_pid = ntohl (mp->pid);
|
||||
hash_set (am->dhcp6_pd_reply_events_registration_hash, rp->client_index,
|
||||
rp - am->dhcp6_pd_reply_events_registrations);
|
||||
dhcp6_pd_set_publisher_node (dhcp6_pd_reply_process_node.index,
|
||||
DHCP6_PD_DP_REPLY_REPORT);
|
||||
|
||||
reply:
|
||||
REPLY_MACRO (VL_API_WANT_DHCP6_PD_REPLY_EVENTS_REPLY);
|
||||
}
|
||||
|
||||
static clib_error_t *
|
||||
dhcp6_pd_client_init (vlib_main_t * vm)
|
||||
{
|
@ -17,7 +17,7 @@
|
||||
#define included_vnet_dhcp6_pd_client_dp_h
|
||||
|
||||
#include <vlib/vlib.h>
|
||||
#include <vnet/dhcp/dhcp6_client_common_dp.h>
|
||||
#include <dhcp/dhcp6_client_common_dp.h>
|
||||
|
||||
typedef struct
|
||||
{
|
||||
@ -89,31 +89,24 @@ typedef struct
|
||||
dhcp6_prefix_info_t *prefixes;
|
||||
} prefix_report_t;
|
||||
|
||||
#define vl_typedefs /* define message structures */
|
||||
#include <vnet/vnet_all_api_h.h>
|
||||
#undef vl_typedefs
|
||||
|
||||
void dhcp6_pd_send_client_message (vlib_main_t * vm, u32 sw_if_index, u8 stop,
|
||||
dhcp6_pd_send_client_message_params_t *
|
||||
params);
|
||||
void dhcp6_pd_set_publisher_node (uword node_index, uword event_type);
|
||||
int dhcp6_pd_publish_report (prefix_report_t * r);
|
||||
|
||||
void
|
||||
vl_api_want_dhcp6_pd_reply_events_t_handler
|
||||
(vl_api_want_dhcp6_pd_reply_events_t * mp);
|
||||
void
|
||||
vl_api_dhcp6_pd_send_client_message_t_handler
|
||||
(vl_api_dhcp6_pd_send_client_message_t * mp);
|
||||
void
|
||||
vl_api_dhcp6_clients_enable_disable_t_handler
|
||||
(vl_api_dhcp6_clients_enable_disable_t * mp);
|
||||
int dhcp6_pd_client_enable_disable (u32 sw_if_index,
|
||||
const u8 * prefix_group, u8 enable);
|
||||
int dhcp6_cp_ip6_address_add_del (u32 sw_if_index, const u8 * prefix_group,
|
||||
ip6_address_t address, u8 prefix_length,
|
||||
u8 is_add);
|
||||
|
||||
extern vlib_node_registration_t dhcp6_pd_reply_process_node;
|
||||
|
||||
enum
|
||||
{ DHCP6_PD_DP_REPLY_REPORT, DHCP6_PD_DP_REPORT_MAX };
|
||||
|
||||
#include <dhcp/dhcp.api_types.h>
|
||||
|
||||
typedef struct _vnet_dhcp6_pd_reply_function_list_elt
|
||||
{
|
||||
struct _vnet_dhcp6_pd_reply_function_list_elt
|
@ -17,15 +17,15 @@
|
||||
|
||||
#include <vlib/vlib.h>
|
||||
#include <vnet/pg/pg.h>
|
||||
#include <vnet/dhcp/dhcp_proxy.h>
|
||||
#include <vnet/dhcp/dhcp6_packet.h>
|
||||
#include <dhcp/dhcp_proxy.h>
|
||||
#include <dhcp/dhcp6_packet.h>
|
||||
#include <vnet/mfib/mfib_table.h>
|
||||
#include <vnet/mfib/ip6_mfib.h>
|
||||
#include <vnet/fib/fib.h>
|
||||
|
||||
static char *dhcpv6_proxy_error_strings[] = {
|
||||
#define dhcpv6_proxy_error(n,s) s,
|
||||
#include <vnet/dhcp/dhcp6_proxy_error.def>
|
||||
#include <dhcp/dhcp6_proxy_error.def>
|
||||
#undef dhcpv6_proxy_error
|
||||
};
|
||||
|
871
src/plugins/dhcp/dhcp_api.c
Normal file
871
src/plugins/dhcp/dhcp_api.c
Normal file
File diff suppressed because it is too large
Load Diff
@ -15,7 +15,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <vnet/dhcp/client.h>
|
||||
#include <dhcp/client.h>
|
||||
#include <vnet/udp/udp.h>
|
||||
|
||||
#define foreach_dhcp_client_detect \
|
@ -15,7 +15,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <vnet/dhcp/dhcp_proxy.h>
|
||||
#include <dhcp/dhcp_proxy.h>
|
||||
#include <vnet/fib/fib_table.h>
|
||||
#include <vnet/mfib/mfib_table.h>
|
||||
|
@ -19,7 +19,7 @@
|
||||
#define included_dhcp_proxy_h
|
||||
|
||||
#include <vnet/vnet.h>
|
||||
#include <vnet/dhcp/dhcp4_packet.h>
|
||||
#include <dhcp/dhcp4_packet.h>
|
||||
#include <vnet/ethernet/ethernet.h>
|
||||
#include <vnet/ip/ip.h>
|
||||
#include <vnet/ip/ip4.h>
|
||||
@ -31,7 +31,7 @@
|
||||
typedef enum
|
||||
{
|
||||
#define dhcp_proxy_error(n,s) DHCP_PROXY_ERROR_##n,
|
||||
#include <vnet/dhcp/dhcp4_proxy_error.def>
|
||||
#include <dhcp/dhcp4_proxy_error.def>
|
||||
#undef dhcp_proxy_error
|
||||
DHCP_PROXY_N_ERROR,
|
||||
} dhcp_proxy_error_t;
|
||||
@ -39,7 +39,7 @@ typedef enum
|
||||
typedef enum
|
||||
{
|
||||
#define dhcpv6_proxy_error(n,s) DHCPV6_PROXY_ERROR_##n,
|
||||
#include <vnet/dhcp/dhcp6_proxy_error.def>
|
||||
#include <dhcp/dhcp6_proxy_error.def>
|
||||
#undef dhcpv6_proxy_error
|
||||
DHCPV6_PROXY_N_ERROR,
|
||||
} dhcpv6_proxy_error_t;
|
492
src/plugins/dhcp/dhcp_test.c
Normal file
492
src/plugins/dhcp/dhcp_test.c
Normal file
File diff suppressed because it is too large
Load Diff
@ -617,8 +617,10 @@ class TestDHCP(VppTestCase):
|
||||
# Add VSS config
|
||||
# table=1, vss_type=1, vpn_index=1, oui=4
|
||||
# table=2, vss_type=0, vpn_id = "ip4-table-2"
|
||||
self.vapi.dhcp_proxy_set_vss(1, 1, vpn_index=1, oui=4, is_add=1)
|
||||
self.vapi.dhcp_proxy_set_vss(2, 0, "ip4-table-2", is_add=1)
|
||||
self.vapi.dhcp_proxy_set_vss(tbl_id=1, vss_type=1,
|
||||
vpn_index=1, oui=4, is_add=1)
|
||||
self.vapi.dhcp_proxy_set_vss(tbl_id=2, vss_type=0,
|
||||
vpn_ascii_id="ip4-table-2", is_add=1)
|
||||
|
||||
self.pg4.add_stream(pkts_disc_vrf1)
|
||||
self.pg_enable_capture(self.pg_interfaces)
|
||||
@ -766,8 +768,8 @@ class TestDHCP(VppTestCase):
|
||||
# Remove the VSS config
|
||||
# relayed DHCP has default vlaues in the option.
|
||||
#
|
||||
self.vapi.dhcp_proxy_set_vss(1, is_add=0)
|
||||
self.vapi.dhcp_proxy_set_vss(2, is_add=0)
|
||||
self.vapi.dhcp_proxy_set_vss(tbl_id=1, is_add=0)
|
||||
self.vapi.dhcp_proxy_set_vss(tbl_id=2, is_add=0)
|
||||
|
||||
self.pg4.add_stream(pkts_disc_vrf1)
|
||||
self.pg_enable_capture(self.pg_interfaces)
|
||||
@ -1028,12 +1030,13 @@ class TestDHCP(VppTestCase):
|
||||
# Add VSS config
|
||||
#
|
||||
self.vapi.dhcp_proxy_set_vss(
|
||||
tbl_id=1, vss_type=1, oui=4, vpn_index=1, is_ipv6=1)
|
||||
tbl_id=1, vss_type=1, oui=4, vpn_index=1, is_ipv6=1, is_add=1)
|
||||
self.vapi.dhcp_proxy_set_vss(
|
||||
tbl_id=2,
|
||||
vss_type=0,
|
||||
vpn_ascii_id="IPv6-table-2",
|
||||
is_ipv6=1)
|
||||
is_ipv6=1,
|
||||
is_add=1)
|
||||
|
||||
self.pg4.add_stream(p_solicit_vrf1)
|
||||
self.pg_enable_capture(self.pg_interfaces)
|
||||
@ -1062,7 +1065,7 @@ class TestDHCP(VppTestCase):
|
||||
# Remove the VSS config
|
||||
# relayed DHCP has default vlaues in the option.
|
||||
#
|
||||
self.vapi.dhcp_proxy_set_vss(1, is_ipv6=1, is_add=0)
|
||||
self.vapi.dhcp_proxy_set_vss(tbl_id=1, is_ipv6=1, is_add=0)
|
||||
|
||||
self.pg4.add_stream(p_solicit_vrf1)
|
||||
self.pg_enable_capture(self.pg_interfaces)
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user