|
FD.io VPP
v21.06-3-gbb25fbf28
Vector Packet Processing
|
Go to the documentation of this file.
35 #include <dhcp/dhcp.api_enum.h>
36 #include <dhcp/dhcp.api_types.h>
42 #define REPLY_MSG_ID_BASE dhcp_base_msg_id
46 #define DHCP_PLUGIN_VERSION_MAJOR 1
47 #define DHCP_PLUGIN_VERSION_MINOR 0
54 int msg_size =
sizeof (*rmp);
82 rmp->
vpe_pid = ntohl (getpid ());
90 vl_api_dhcp6_duid_ll_set_reply_t *rmp;
97 rv = VNET_API_ERROR_INVALID_VALUE;
109 vl_api_dhcp_proxy_set_vss_reply_t *rmp;
128 vl_api_dhcp_proxy_set_vss_reply_t *rmp;
129 ip46_address_t
src, server;
134 rv = VNET_API_ERROR_INVALID_ARGUMENT;
181 vl_api_dhcp_server_t *v_server;
189 n =
sizeof (*mp) + (
count *
sizeof (vl_api_dhcp_server_t));
233 v_server->server_vrf_id = htonl (s_fib->
ft_table_id);
237 memcpy (&v_server->dhcp_server.un, &server->
dhcp_server.ip6, 16);
242 memcpy (&v_server->dhcp_server.un, &server->
dhcp_server.ip4, 4);
267 lease->state = ntohl (client->
state);
270 lease->hostname[
len] = 0;
281 for (
i = 0;
i < lease->count;
i++)
295 vclient->sw_if_index = ntohl (client->
sw_if_index);
298 vclient->hostname[
len] = 0;
303 vclient->id[
len] = 0;
306 vclient->want_dhcp_event = 1;
308 vclient->want_dhcp_event = 0;
311 vclient->pid = client->
pid;
338 vl_api_dhcp_client_config_reply_t *rmp;
354 (mp->
client.want_dhcp_event ?
357 mp->
client.set_broadcast_flag,
381 n =
sizeof (*mp) + (
count *
sizeof (vl_api_domain_server_t));
418 vl_api_dhcp6_clients_enable_disable_reply_t *rmp;
423 REPLY_MACRO (VL_API_DHCP6_CLIENTS_ENABLE_DISABLE_REPLY);
431 vl_api_want_dhcp6_reply_events_reply_t *rmp;
442 rv = VNET_API_ERROR_INVALID_REGISTRATION;
448 pool_put (
am->dhcp6_reply_events_registrations, rp);
451 if (
pool_elts (
am->dhcp6_reply_events_registrations) == 0)
459 rv = VNET_API_ERROR_INVALID_REGISTRATION;
462 pool_get (
am->dhcp6_reply_events_registrations, rp);
466 rp -
am->dhcp6_reply_events_registrations);
471 REPLY_MACRO (VL_API_WANT_DHCP6_REPLY_EVENTS_REPLY);
479 vl_api_want_dhcp6_pd_reply_events_reply_t *rmp;
490 rv = VNET_API_ERROR_INVALID_REGISTRATION;
497 pool_put (
am->dhcp6_pd_reply_events_registrations, rp);
498 hash_unset (
am->dhcp6_pd_reply_events_registration_hash,
500 if (
pool_elts (
am->dhcp6_pd_reply_events_registrations) == 0)
508 rv = VNET_API_ERROR_INVALID_REGISTRATION;
511 pool_get (
am->dhcp6_pd_reply_events_registrations, rp);
515 rp -
am->dhcp6_pd_reply_events_registrations);
520 REPLY_MACRO (VL_API_WANT_DHCP6_PD_REPLY_EVENTS_REPLY);
527 vl_api_dhcp6_send_client_message_reply_t *rmp;
537 REPLY_MACRO (VL_API_DHCP6_SEND_CLIENT_MESSAGE_REPLY);
544 params.
irt = ntohl (mp->
irt);
545 params.
mrt = ntohl (mp->
mrt);
546 params.
mrc = ntohl (mp->
mrc);
547 params.
mrd = ntohl (mp->
mrd);
549 params.
T1 = ntohl (mp->
T1);
550 params.
T2 = ntohl (mp->
T2);
555 rv = VNET_API_ERROR_INVALID_VALUE;
556 goto bad_sw_if_index;
561 for (
i = 0;
i < n_addresses;
i++)
563 vl_api_dhcp6_address_info_t *ai = &mp->
addresses[
i];
565 addr->preferred_lt = ntohl (ai->preferred_time);
566 addr->valid_lt = ntohl (ai->valid_time);
577 vl_api_dhcp6_pd_send_client_message_reply_t *rmp;
587 REPLY_MACRO (VL_API_DHCP6_PD_SEND_CLIENT_MESSAGE_REPLY);
594 params.
irt = ntohl (mp->
irt);
595 params.
mrt = ntohl (mp->
mrt);
596 params.
mrc = ntohl (mp->
mrc);
597 params.
mrd = ntohl (mp->
mrd);
599 params.
T1 = ntohl (mp->
T1);
600 params.
T2 = ntohl (mp->
T2);
606 rv = VNET_API_ERROR_INVALID_VALUE;
607 goto bad_sw_if_index;
613 for (
i = 0;
i < n_prefixes;
i++)
615 vl_api_dhcp6_pd_prefix_info_t *pi = &mp->
prefixes[
i];
619 pref->
valid_lt = ntohl (pi->valid_time);
630 _vnet_dhcp6_reply_event_function_list_elt_t
640 elt =
elt->next_dhcp6_reply_event_function;
669 sizeof (vl_api_dhcp6_address_info_t);
673 event->sw_if_index = htonl (
events[
i].body.sw_if_index);
674 event->server_index = htonl (
events[
i].body.server_index);
675 event->msg_type =
events[
i].body.msg_type;
676 event->T1 = htonl (
events[
i].body.T1);
677 event->T2 = htonl (
events[
i].body.T2);
678 event->inner_status_code =
679 htons (
events[
i].body.inner_status_code);
680 event->status_code = htons (
events[
i].body.status_code);
681 event->preference =
events[
i].body.preference;
684 vl_api_dhcp6_address_info_t *
address =
685 (typeof (
address)) event->addresses;
734 .name =
"dhcp6-reply-publisher-process",
740 _vnet_dhcp6_pd_reply_event_function_list_elt_t
750 elt =
elt->next_dhcp6_pd_reply_event_function;
779 sizeof (vl_api_dhcp6_pd_prefix_info_t);
784 event->sw_if_index = htonl (
events[
i].body.sw_if_index);
785 event->server_index = htonl (
events[
i].body.server_index);
786 event->msg_type =
events[
i].body.msg_type;
787 event->T1 = htonl (
events[
i].body.T1);
788 event->T2 = htonl (
events[
i].body.T2);
789 event->inner_status_code =
790 htons (
events[
i].body.inner_status_code);
791 event->status_code = htons (
events[
i].body.status_code);
792 event->preference =
events[
i].body.preference;
795 vl_api_dhcp6_pd_prefix_info_t *
prefix =
796 (typeof (
prefix)) event->prefixes;
846 .name =
"dhcp6-pd-reply-publisher-process",
857 #include <dhcp/dhcp.api.c>
878 #include <vpp/app/version.h>
882 .version = VPP_BUILD_VER,
883 .description =
"Dynamic Host Configuration Protocol (DHCP)",
static void vl_api_dhcp6_clients_enable_disable_t_handler(vl_api_dhcp6_clients_enable_disable_t *mp)
#define VALIDATE_SW_IF_INDEX(mp)
DHCP Proxy config add / del request.
static vl_api_registration_t * vl_api_client_index_to_registration(u32 index)
u8 vss_type
VSS type as defined in RFC 6607: 0 for NVT ASCII VPN Identifier 1 for RFC 2685 VPN-ID of 7 octects - ...
Register for DHCPv6 PD reply events.
dhcp_event_cb_t event_callback
enum ip_dscp_t_ ip_dscp_t
void dhcp6_pd_send_client_message(vlib_main_t *vm, u32 sw_if_index, u8 stop, dhcp6_pd_send_client_message_params_t *params)
A representation of a single DHCP Server within a given VRF config.
#define REPLY_MACRO2(t, body)
#define clib_memcpy(d, s, n)
dhcp6_pd_send_client_message_params_prefix_t * prefixes
static void vl_api_send_msg(vl_api_registration_t *rp, u8 *elem)
static uword * vlib_process_wait_for_event(vlib_main_t *vm)
u8 * vpn_ascii_id
Type 0 ASCII VPN Identifier.
DHCP Client config add / del request.
struct dhcp_client_send_walk_ctx_t_ dhcp_client_send_walk_ctx_t
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
vl_api_ip_dscp_t ip_dscp_encode(ip_dscp_t dscp)
static void vl_api_dhcp_proxy_dump_t_handler(vl_api_dhcp_proxy_dump_t *mp)
static void clib_mem_free(void *p)
static uword dhcp6_reply_process(vlib_main_t *vm, vlib_node_runtime_t *rt, vlib_frame_t *f)
static void vl_api_dhcp_proxy_set_vss_t_handler(vl_api_dhcp_proxy_set_vss_t *mp)
int dhcp_proxy_set_vss(fib_protocol_t proto, u32 tbl_id, u8 vss_type, u8 *vpn_ascii_id, u32 oui, u32 vpn_index, u8 is_del)
Configure/set a new VSS info.
vl_api_dhcp_client_t client
static int send_dhcp_client_entry(const dhcp_client_t *client, void *arg)
static clib_error_t * call_dhcp6_pd_reply_event_callbacks(void *data, _vnet_dhcp6_pd_reply_event_function_list_elt_t *elt)
A DHCP proxy representation fpr per-client VRF config.
void ip6_address_decode(const vl_api_ip6_address_t in, ip6_address_t *out)
vlib_node_registration_t dhcp6_reply_process_node
(constructor) VLIB_REGISTER_NODE (dhcp6_reply_process_node)
#define pool_put(P, E)
Free an object E in pool P.
vlib_main_t * vm
X-connect all packets from the HOST to the PHY.
The Virtual Sub-net Selection information for a given RX FIB.
vl_api_dhcp_lease_t lease
dhcp_proxy_main_t dhcp_proxy_main
Shard 4/6 instance of DHCP main.
Control ping from the client to the server response.
static void dhcp_client_data_encode(vl_api_dhcp_client_t *vclient, const dhcp_client_t *client)
static dhcp_vss_t * dhcp_get_vss_info(dhcp_proxy_main_t *dm, u32 rx_fib_index, fib_protocol_t proto)
Get the VSS data for the FIB index.
vl_api_interface_index_t sw_if_index
void dhcp6_set_publisher_node(uword node_index, uword event_type)
int dhcp6_proxy_set_server(ip46_address_t *addr, ip46_address_t *src_addr, u32 rx_table_id, u32 server_table_id, int is_del)
dhcp_client_fwd_addresses_t installed
dhcp6_send_client_message_params_address_t * addresses
ip46_type_t ip_address_decode(const vl_api_address_t *in, ip46_address_t *out)
Decode/Encode for struct/union types.
#define hash_set(h, key, value)
dhcp6_pd_client_public_main_t dhcp6_pd_client_public_main
static void setup_message_id_table(api_main_t *am)
void dhcp_send_details(fib_protocol_t proto, void *opaque, u32 context, dhcp_proxy_t *proxy)
Send the details of a proxy session to the API client during a dump.
Enable/disable listening on DHCPv6 client port.
A protocol Independent FIB table.
DHCP Proxy set / unset vss request.
#define pool_foreach(VAR, POOL)
Iterate through pool.
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
static void vl_api_dhcp_proxy_config_t_handler(vl_api_dhcp_proxy_config_t *mp)
vl_api_dhcp6_pd_prefix_info_t prefixes[n_prefixes]
void ip6_address_encode(const ip6_address_t *in, vl_api_ip6_address_t out)
static void * vlib_process_get_event_data(vlib_main_t *vm, uword *return_event_type_opaque)
ip4_address_t * domain_server_address
u32 ft_table_id
Table ID (hash key) for this FIB.
Tell client about a DHCPv6 server reply event.
static void vl_api_dhcp_plugin_control_ping_t_handler(vl_api_dhcp_plugin_control_ping_t *mp)
An API client registration, only in vpp/vlib.
VLIB_API_INIT_FUNCTION(dhcp_api_hookup)
ip_dscp_t ip_dscp_decode(vl_api_ip_dscp_t in)
#define vec_foreach_index(var, v)
Iterate over vector indices.
u32 rx_fib_index
The FIB index (not the external Table-ID) in which the client is resides.
if(node->flags &VLIB_NODE_FLAG_TRACE) vnet_interface_output_trace(vm
string vss_vpn_ascii_id[129]
int dhcp4_proxy_set_server(ip46_address_t *addr, ip46_address_t *src_addr, u32 rx_table_id, u32 server_table_id, int is_del)
Send DHCPv6 client message of specified type.
u32 server_fib_index
The FIB index (not the external Table-ID) in which the server is reachable.
vl_api_address_t dhcp_src_address
void vl_api_dhcp6_pd_send_client_message_t_handler(vl_api_dhcp6_pd_send_client_message_t *mp)
static u32 dhcp_base_msg_id
Base message ID fot the plugin.
Tell client about a DHCP completion event.
sll srl srl sll sra u16x4 i
static perfmon_event_t events[]
vl_api_address_t dhcp_server
_vnet_dhcp6_reply_event_function_list_elt_t * functions
#define pool_get(P, E)
Allocate an object E from a pool P (unspecified alignment).
void dhcp_proxy_dump(fib_protocol_t proto, void *opaque, u32 context)
Dump the proxy configs to the API.
#define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment)
vl_api_interface_index_t sw_if_index
manual_print typedef address
vl_api_address_t dhcp_src_address
Dump the DHCP client configurations.
enum fib_protocol_t_ fib_protocol_t
Protocol Type.
#define REPLY_MSG_ID_BASE
static void dhcp_compl_event_callback(u32 client_index, const dhcp_client_t *client)
vl_api_registration_t * reg
void dhcp6_pd_set_publisher_node(uword node_index, uword event_type)
struct _vlib_node_registration vlib_node_registration_t
void dhcp6_send_client_message(vlib_main_t *vm, u32 sw_if_index, u8 stop, dhcp6_send_client_message_params_t *params)
static void vl_api_dhcp_plugin_get_version_t_handler(vl_api_dhcp_plugin_get_version_t *mp)
dhcp6_ia_na_client_public_main_t dhcp6_ia_na_client_public_main
ip46_address_t dhcp_server
The address of the DHCP server to which to relay the client's messages.
#define BAD_SW_IF_INDEX_LABEL
static clib_error_t * dhcp_api_hookup(vlib_main_t *vm)
dhcp_client_state_t state
Register for DHCPv6 reply events.
vl_api_vss_type_t vss_type
#define vec_free(V)
Free vector's memory (no header).
u32 vl_msg_api_max_length(void *mp)
@ DHCP6_PD_DP_REPLY_REPORT
vl_api_dhcp_server_t servers[count]
vl_api_vss_type_t vss_type
u8 vpn_id[7]
Type 1 VPN-ID.
description fragment has unexpected format
static int vl_api_can_send_msg(vl_api_registration_t *rp)
static void dhcp_client_lease_encode(vl_api_dhcp_lease_t *lease, const dhcp_client_t *client)
vl_api_dhcp6_address_info_t addresses[n_addresses]
Tell client about a DHCPv6 PD server reply event.
fib_table_t * fib_table_get(fib_node_index_t index, fib_protocol_t proto)
Get a pointer to a FIB table.
void vl_api_want_dhcp6_pd_reply_events_t_handler(vl_api_want_dhcp6_pd_reply_events_t *mp)
u8 client_hardware_address[6]
vl_api_dhcpv6_msg_type_t msg_type
void dhcp6_clients_enable_disable(u8 enable)
_vnet_dhcp6_pd_reply_event_function_list_elt_t * functions
vl_api_dhcpv6_msg_type_t msg_type
static uword dhcp6_pd_reply_process(vlib_main_t *vm, vlib_node_runtime_t *rt, vlib_frame_t *f)
static void vlib_process_put_event_data(vlib_main_t *vm, void *event_data)
ip4_address_t router_address
The address of this client's default gateway - may not be present.
void dhcp_client_walk(dhcp_client_walk_cb_t cb, void *ctx)
Walk (visit each) DHCP client configuration.
ip4_address_t leased_address
the address assigned to this client and it's mask
for(i=1;i<=collision_buckets;i++)
static uword pool_elts(void *v)
Number of active elements in a pool.
DHCP Client details returned from dump.
dhcpv6_duid_ll_string_t client_duid
#define hash_unset(h, key)
u32 dhcp_proxy_rx_table_get_table_id(fib_protocol_t proto, u32 fib_index)
clib_memset(h->entries, 0, sizeof(h->entries[0]) *entries)
vl_api_dhcp_lease_t lease
Control ping from client to api server request.
static void vl_api_dhcp6_duid_ll_set_t_handler(vl_api_dhcp6_duid_ll_set_t *mp)
static vlib_main_t * vlib_get_main(void)
vnet_interface_output_runtime_t * rt
#define DHCP_PLUGIN_VERSION_MINOR
#define clib_warning(format, args...)
dhcp_server_t * dhcp_servers
The set of DHCP servers to which messages are relayed.
static void vl_api_dhcp_client_config_t_handler(vl_api_dhcp_client_config_t *mp)
ip46_address_t dhcp_src_address
The source address to use in relayed messaes.
void vl_api_dhcp6_send_client_message_t_handler(vl_api_dhcp6_send_client_message_t *mp)
Tell client about a DHCP completion event.
static clib_error_t * call_dhcp6_reply_event_callbacks(void *data, _vnet_dhcp6_reply_event_function_list_elt_t *elt)
vl_api_interface_index_t sw_if_index
int dhcp_client_config(u32 is_add, u32 client_index, vlib_main_t *vm, u32 sw_if_index, u8 *hostname, u8 *client_id, dhcp_event_cb_t event_callback, u8 set_broadcast_flag, ip_dscp_t dscp, u32 pid)
Add/Delete DHCP clients.
Reply to get the plugin version.
#define DHCP_PLUGIN_VERSION_MAJOR
static void * clib_mem_alloc(uword size)
void vl_api_want_dhcp6_reply_events_t_handler(vl_api_want_dhcp6_reply_events_t *mp)
vl_api_dhcp_client_t client
vlib_node_registration_t dhcp6_pd_reply_process_node
(constructor) VLIB_REGISTER_NODE (dhcp6_pd_reply_process_node)
vpe_api_main_t vpe_api_main
Send DHCPv6 PD client message of specified type.
static void vl_api_dhcp_client_dump_t_handler(vl_api_dhcp_client_dump_t *mp)
void * vl_msg_api_alloc(int nbytes)
#define VLIB_REGISTER_NODE(x,...)