FD.io VPP  v21.06-3-gbb25fbf28
Vector Packet Processing
dhcp_api.c
Go to the documentation of this file.
1 /*
2  *------------------------------------------------------------------
3  * dhcp_api.c - dhcp api
4  *
5  * Copyright (c) 2016 Cisco and/or its affiliates.
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at:
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  *------------------------------------------------------------------
18  */
19 
20 #include <vnet/vnet.h>
21 #include <vlibmemory/api.h>
22 
23 #include <vnet/interface.h>
24 #include <vnet/api_errno.h>
25 #include <dhcp/dhcp_proxy.h>
26 #include <dhcp/client.h>
30 #include <vnet/fib/fib_table.h>
31 #include <vnet/ip/ip_types_api.h>
32 
33 /* define message IDs */
34 #include <vnet/format_fns.h>
35 #include <dhcp/dhcp.api_enum.h>
36 #include <dhcp/dhcp.api_types.h>
37 
38 /**
39  * Base message ID fot the plugin
40  */
42 #define REPLY_MSG_ID_BASE dhcp_base_msg_id
43 
45 
46 #define DHCP_PLUGIN_VERSION_MAJOR 1
47 #define DHCP_PLUGIN_VERSION_MINOR 0
48 
49 static void
51  mp)
52 {
54  int msg_size = sizeof (*rmp);
56 
58  if (!reg)
59  return;
60 
61  rmp = vl_msg_api_alloc (msg_size);
62  clib_memset (rmp, 0, msg_size);
63  rmp->_vl_msg_id =
64  ntohs (VL_API_DHCP_PLUGIN_GET_VERSION_REPLY + REPLY_MSG_ID_BASE);
65  rmp->context = mp->context;
66  rmp->major = htonl (DHCP_PLUGIN_VERSION_MAJOR);
67  rmp->minor = htonl (DHCP_PLUGIN_VERSION_MINOR);
68 
69  vl_api_send_msg (reg, (u8 *) rmp);
70 }
71 
72 static void
74  mp)
75 {
77  int rv = 0;
78 
79  /* *INDENT-OFF* */
80  REPLY_MACRO2 (VL_API_DHCP_PLUGIN_CONTROL_PING_REPLY,
81  ({
82  rmp->vpe_pid = ntohl (getpid ());
83  }));
84  /* *INDENT-ON* */
85 }
86 
87 static void
89 {
90  vl_api_dhcp6_duid_ll_set_reply_t *rmp;
92  int rv = 0;
93 
94  duid = (dhcpv6_duid_ll_string_t *) mp->duid_ll;
95  if (duid->duid_type != htonl (DHCPV6_DUID_LL))
96  {
97  rv = VNET_API_ERROR_INVALID_VALUE;
98  goto reply;
99  }
100  clib_memcpy (&client_duid, &duid, sizeof (client_duid));
101 
102 reply:
103  REPLY_MACRO (VL_API_DHCP6_DUID_LL_SET_REPLY);
104 }
105 
106 static void
108 {
109  vl_api_dhcp_proxy_set_vss_reply_t *rmp;
110  u8 *vpn_ascii_id;
111  int rv;
112 
113  mp->vpn_ascii_id[sizeof (mp->vpn_ascii_id) - 1] = 0;
114  vpn_ascii_id = format (0, "%s", mp->vpn_ascii_id);
115  rv =
117  ntohl (mp->tbl_id), ntohl (mp->vss_type),
118  vpn_ascii_id, ntohl (mp->oui), ntohl (mp->vpn_index),
119  mp->is_add == 0);
120 
121  REPLY_MACRO (VL_API_DHCP_PROXY_SET_VSS_REPLY);
122 }
123 
124 
127 {
128  vl_api_dhcp_proxy_set_vss_reply_t *rmp;
129  ip46_address_t src, server;
130  int rv = -1;
131 
132  if (mp->dhcp_src_address.af != mp->dhcp_server.af)
133  {
134  rv = VNET_API_ERROR_INVALID_ARGUMENT;
135  goto reply;
136  }
137 
139  ip_address_decode (&mp->dhcp_server, &server);
140 
141  if (mp->dhcp_src_address.af == ADDRESS_IP4)
142  {
143  rv = dhcp4_proxy_set_server (&server,
144  &src,
145  (u32) ntohl (mp->rx_vrf_id),
146  (u32) ntohl (mp->server_vrf_id),
147  (int) (mp->is_add == 0));
148  }
149  else
150  {
151  rv = dhcp6_proxy_set_server (&server,
152  &src,
153  (u32) ntohl (mp->rx_vrf_id),
154  (u32) ntohl (mp->server_vrf_id),
155  (int) (mp->is_add == 0));
156  }
157 
158 reply:
159  REPLY_MACRO (VL_API_DHCP_PROXY_CONFIG_REPLY);
160 }
161 
162 static void
164 {
166 
168  if (!reg)
169  return;;
170 
171  dhcp_proxy_dump ((mp->is_ip6 == 1 ?
173 }
174 
175 void
177  void *opaque, u32 context, dhcp_proxy_t * proxy)
178 {
180  vl_api_registration_t *reg = opaque;
181  vl_api_dhcp_server_t *v_server;
182  dhcp_server_t *server;
183  fib_table_t *s_fib;
184  dhcp_vss_t *vss;
185  u32 count;
186  size_t n;
187 
188  count = vec_len (proxy->dhcp_servers);
189  n = sizeof (*mp) + (count * sizeof (vl_api_dhcp_server_t));
190  mp = vl_msg_api_alloc (n);
191  if (!mp)
192  return;
193  clib_memset (mp, 0, n);
194  mp->_vl_msg_id = ntohs (VL_API_DHCP_PROXY_DETAILS + REPLY_MSG_ID_BASE);
195  mp->context = context;
196  mp->count = count;
197 
198  mp->is_ipv6 = (proto == FIB_PROTOCOL_IP6);
199  mp->rx_vrf_id =
201 
203 
204  if (vss)
205  {
206  mp->vss_type = ntohl (vss->vss_type);
207  if (vss->vss_type == VSS_TYPE_ASCII)
208  {
209  u32 id_len = vec_len (vss->vpn_ascii_id);
210  clib_memcpy (mp->vss_vpn_ascii_id, vss->vpn_ascii_id, id_len);
211  }
212  else if (vss->vss_type == VSS_TYPE_VPN_ID)
213  {
214  u32 oui = ((u32) vss->vpn_id[0] << 16) + ((u32) vss->vpn_id[1] << 8)
215  + ((u32) vss->vpn_id[2]);
216  u32 fib_id = ((u32) vss->vpn_id[3] << 24) +
217  ((u32) vss->vpn_id[4] << 16) + ((u32) vss->vpn_id[5] << 8) +
218  ((u32) vss->vpn_id[6]);
219  mp->vss_oui = htonl (oui);
220  mp->vss_fib_id = htonl (fib_id);
221  }
222  }
223  else
225 
227  {
228  server = &proxy->dhcp_servers[count];
229  v_server = &mp->servers[count];
230 
231  s_fib = fib_table_get (server->server_fib_index, proto);
232 
233  v_server->server_vrf_id = htonl (s_fib->ft_table_id);
234 
235  if (mp->is_ipv6)
236  {
237  memcpy (&v_server->dhcp_server.un, &server->dhcp_server.ip6, 16);
238  }
239  else
240  {
241  /* put the address in the first bytes */
242  memcpy (&v_server->dhcp_server.un, &server->dhcp_server.ip4, 4);
243  }
244  }
245 
246  if (mp->is_ipv6)
247  {
248  memcpy (&mp->dhcp_src_address.un, &proxy->dhcp_src_address.ip6, 16);
249  }
250  else
251  {
252  /* put the address in the first bytes */
253  memcpy (&mp->dhcp_src_address.un, &proxy->dhcp_src_address.ip4, 4);
254  }
255  vl_api_send_msg (reg, (u8 *) mp);
256 }
257 
258 static void
259 dhcp_client_lease_encode (vl_api_dhcp_lease_t * lease,
260  const dhcp_client_t * client)
261 {
262  size_t len;
263  u8 i;
264 
265  lease->is_ipv6 = 0; // only support IPv4 clients
266  lease->sw_if_index = ntohl (client->sw_if_index);
267  lease->state = ntohl (client->state);
268  len = clib_min (sizeof (lease->hostname) - 1, vec_len (client->hostname));
269  clib_memcpy (&lease->hostname, client->hostname, len);
270  lease->hostname[len] = 0;
271 
272  lease->mask_width = client->installed.subnet_mask_width;
273  clib_memcpy (&lease->host_address.un,
274  (u8 *) & client->installed.leased_address,
275  sizeof (ip4_address_t));
276  clib_memcpy (&lease->router_address.un,
277  (u8 *) & client->installed.router_address,
278  sizeof (ip4_address_t));
279 
280  lease->count = vec_len (client->domain_server_address);
281  for (i = 0; i < lease->count; i++)
282  clib_memcpy (&lease->domain_server[i].address,
283  (u8 *) & client->domain_server_address[i],
284  sizeof (ip4_address_t));
285 
286  clib_memcpy (&lease->host_mac[0], client->client_hardware_address, 6);
287 }
288 
289 static void
290 dhcp_client_data_encode (vl_api_dhcp_client_t * vclient,
291  const dhcp_client_t * client)
292 {
293  size_t len;
294 
295  vclient->sw_if_index = ntohl (client->sw_if_index);
296  len = clib_min (sizeof (vclient->hostname) - 1, vec_len (client->hostname));
297  clib_memcpy (&vclient->hostname, client->hostname, len);
298  vclient->hostname[len] = 0;
299 
300  len = clib_min (sizeof (vclient->id) - 1,
301  vec_len (client->client_identifier));
302  clib_memcpy (&vclient->id, client->client_identifier, len);
303  vclient->id[len] = 0;
304 
305  if (NULL != client->event_callback)
306  vclient->want_dhcp_event = 1;
307  else
308  vclient->want_dhcp_event = 0;
309  vclient->set_broadcast_flag = client->set_broadcast_flag;
310  vclient->dscp = ip_dscp_encode (client->dscp);
311  vclient->pid = client->pid;
312 }
313 
314 static void
315 dhcp_compl_event_callback (u32 client_index, const dhcp_client_t * client)
316 {
319 
320  reg = vl_api_client_index_to_registration (client_index);
321  if (!reg)
322  return;
323 
324  mp = vl_msg_api_alloc (sizeof (*mp));
325  mp->client_index = client_index;
326  mp->pid = client->pid;
327  dhcp_client_lease_encode (&mp->lease, client);
328 
329  mp->_vl_msg_id = ntohs (VL_API_DHCP_COMPL_EVENT + REPLY_MSG_ID_BASE);
330 
331  vl_api_send_msg (reg, (u8 *) mp);
332 }
333 
336 {
338  vl_api_dhcp_client_config_reply_t *rmp;
340  ip_dscp_t dscp;
341  int rv = 0;
342 
343  VALIDATE_SW_IF_INDEX (&(mp->client));
344 
345  sw_if_index = ntohl (mp->client.sw_if_index);
346  dscp = ip_dscp_decode (mp->client.dscp);
347 
349  mp->client_index,
350  vm,
351  sw_if_index,
352  mp->client.hostname,
353  mp->client.id,
354  (mp->client.want_dhcp_event ?
356  NULL),
357  mp->client.set_broadcast_flag,
358  dscp, mp->client.pid);
359 
361  REPLY_MACRO (VL_API_DHCP_CLIENT_CONFIG_REPLY);
362 }
363 
365 {
369 
370 static int
371 send_dhcp_client_entry (const dhcp_client_t * client, void *arg)
372 {
375  u32 count;
376  size_t n;
377 
378  ctx = arg;
379 
380  count = vec_len (client->domain_server_address);
381  n = sizeof (*mp) + (count * sizeof (vl_api_domain_server_t));
382  mp = vl_msg_api_alloc (n);
383  if (!mp)
384  return 0;
385  clib_memset (mp, 0, n);
386 
387  mp->_vl_msg_id = ntohs (VL_API_DHCP_CLIENT_DETAILS + REPLY_MSG_ID_BASE);
388  mp->context = ctx->context;
389 
390  dhcp_client_data_encode (&mp->client, client);
391  dhcp_client_lease_encode (&mp->lease, client);
392 
393  vl_api_send_msg (ctx->reg, (u8 *) mp);
394 
395  return (1);
396 }
397 
398 static void
400 {
402 
404  if (!reg)
405  return;
406 
408  .reg = reg,
409  .context = mp->context,
410  };
412 }
413 
414 static void
417 {
418  vl_api_dhcp6_clients_enable_disable_reply_t *rmp;
419  int rv = 0;
420 
422 
423  REPLY_MACRO (VL_API_DHCP6_CLIENTS_ENABLE_DISABLE_REPLY);
424 }
425 
426 void
429 {
431  vl_api_want_dhcp6_reply_events_reply_t *rmp;
432  int rv = 0;
433 
434  uword *p =
435  hash_get (am->dhcp6_reply_events_registration_hash, mp->client_index);
437  if (p)
438  {
439  if (mp->enable_disable)
440  {
441  clib_warning ("pid %d: already enabled...", ntohl (mp->pid));
442  rv = VNET_API_ERROR_INVALID_REGISTRATION;
443  goto reply;
444  }
445  else
446  {
447  rp = pool_elt_at_index (am->dhcp6_reply_events_registrations, p[0]);
448  pool_put (am->dhcp6_reply_events_registrations, rp);
449  hash_unset (am->dhcp6_reply_events_registration_hash,
450  mp->client_index);
451  if (pool_elts (am->dhcp6_reply_events_registrations) == 0)
453  goto reply;
454  }
455  }
456  if (mp->enable_disable == 0)
457  {
458  clib_warning ("pid %d: already disabled...", ntohl (mp->pid));
459  rv = VNET_API_ERROR_INVALID_REGISTRATION;
460  goto reply;
461  }
462  pool_get (am->dhcp6_reply_events_registrations, rp);
463  rp->client_index = mp->client_index;
464  rp->client_pid = ntohl (mp->pid);
465  hash_set (am->dhcp6_reply_events_registration_hash, rp->client_index,
466  rp - am->dhcp6_reply_events_registrations);
469 
470 reply:
471  REPLY_MACRO (VL_API_WANT_DHCP6_REPLY_EVENTS_REPLY);
472 }
473 
474 void
477 {
479  vl_api_want_dhcp6_pd_reply_events_reply_t *rmp;
480  int rv = 0;
481 
482  uword *p =
483  hash_get (am->dhcp6_pd_reply_events_registration_hash, mp->client_index);
485  if (p)
486  {
487  if (mp->enable_disable)
488  {
489  clib_warning ("pid %d: already enabled...", ntohl (mp->pid));
490  rv = VNET_API_ERROR_INVALID_REGISTRATION;
491  goto reply;
492  }
493  else
494  {
495  rp =
496  pool_elt_at_index (am->dhcp6_pd_reply_events_registrations, p[0]);
497  pool_put (am->dhcp6_pd_reply_events_registrations, rp);
498  hash_unset (am->dhcp6_pd_reply_events_registration_hash,
499  mp->client_index);
500  if (pool_elts (am->dhcp6_pd_reply_events_registrations) == 0)
502  goto reply;
503  }
504  }
505  if (mp->enable_disable == 0)
506  {
507  clib_warning ("pid %d: already disabled...", ntohl (mp->pid));
508  rv = VNET_API_ERROR_INVALID_REGISTRATION;
509  goto reply;
510  }
511  pool_get (am->dhcp6_pd_reply_events_registrations, rp);
512  rp->client_index = mp->client_index;
513  rp->client_pid = ntohl (mp->pid);
514  hash_set (am->dhcp6_pd_reply_events_registration_hash, rp->client_index,
515  rp - am->dhcp6_pd_reply_events_registrations);
518 
519 reply:
520  REPLY_MACRO (VL_API_WANT_DHCP6_PD_REPLY_EVENTS_REPLY);
521 }
522 
523 void
526 {
527  vl_api_dhcp6_send_client_message_reply_t *rmp;
530  u32 n_addresses;
531  u32 i;
532  int rv = 0;
533 
535 
537  REPLY_MACRO (VL_API_DHCP6_SEND_CLIENT_MESSAGE_REPLY);
538 
539  if (rv != 0)
540  return;
541 
542  params.sw_if_index = ntohl (mp->sw_if_index);
543  params.server_index = ntohl (mp->server_index);
544  params.irt = ntohl (mp->irt);
545  params.mrt = ntohl (mp->mrt);
546  params.mrc = ntohl (mp->mrc);
547  params.mrd = ntohl (mp->mrd);
548  params.msg_type = ntohl (mp->msg_type);
549  params.T1 = ntohl (mp->T1);
550  params.T2 = ntohl (mp->T2);
551  n_addresses = ntohl (mp->n_addresses);
552  /* Make sure that the number of addresses is sane */
553  if (n_addresses * sizeof (params.addresses) > vl_msg_api_max_length (mp))
554  {
555  rv = VNET_API_ERROR_INVALID_VALUE;
556  goto bad_sw_if_index;
557  }
558  params.addresses = 0;
559  if (n_addresses > 0)
560  vec_validate (params.addresses, n_addresses - 1);
561  for (i = 0; i < n_addresses; i++)
562  {
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);
567  ip6_address_decode (ai->address, &addr->address);
568  }
569 
570  dhcp6_send_client_message (vm, ntohl (mp->sw_if_index), mp->stop, &params);
571 }
572 
573 void
576 {
577  vl_api_dhcp6_pd_send_client_message_reply_t *rmp;
580  u32 n_prefixes;
581  u32 i;
582  int rv = 0;
583 
585 
587  REPLY_MACRO (VL_API_DHCP6_PD_SEND_CLIENT_MESSAGE_REPLY);
588 
589  if (rv != 0)
590  return;
591 
592  params.sw_if_index = ntohl (mp->sw_if_index);
593  params.server_index = ntohl (mp->server_index);
594  params.irt = ntohl (mp->irt);
595  params.mrt = ntohl (mp->mrt);
596  params.mrc = ntohl (mp->mrc);
597  params.mrd = ntohl (mp->mrd);
598  params.msg_type = ntohl (mp->msg_type);
599  params.T1 = ntohl (mp->T1);
600  params.T2 = ntohl (mp->T2);
601  n_prefixes = ntohl (mp->n_prefixes);
602 
603  /* Minimal check to see that the number of prefixes is sane */
604  if (n_prefixes * sizeof (params.prefixes) > vl_msg_api_max_length (mp))
605  {
606  rv = VNET_API_ERROR_INVALID_VALUE;
607  goto bad_sw_if_index;
608  }
609 
610  params.prefixes = 0;
611  if (n_prefixes > 0)
612  vec_validate (params.prefixes, n_prefixes - 1);
613  for (i = 0; i < n_prefixes; i++)
614  {
615  vl_api_dhcp6_pd_prefix_info_t *pi = &mp->prefixes[i];
617  &params.prefixes[i];
618  pref->preferred_lt = ntohl (pi->preferred_time);
619  pref->valid_lt = ntohl (pi->valid_time);
620  ip6_address_decode (pi->prefix.address, &pref->prefix);
621  pref->prefix_length = pi->prefix.len;
622  }
623 
624  dhcp6_pd_send_client_message (vm, ntohl (mp->sw_if_index), mp->stop,
625  &params);
626 }
627 
628 static clib_error_t *
630  _vnet_dhcp6_reply_event_function_list_elt_t
631  * elt)
632 {
633  clib_error_t *error = 0;
634 
635  while (elt)
636  {
637  error = elt->fp (data);
638  if (error)
639  return error;
640  elt = elt->next_dhcp6_reply_event_function;
641  }
642 
643  return error;
644 }
645 
646 static uword
648  vlib_frame_t * f)
649 {
650  /* These cross the longjmp boundary (vlib_process_wait_for_event)
651  * and need to be volatile - to prevent them from being optimized into
652  * a register - which could change during suspension */
653 
654  while (1)
655  {
657  uword event_type = DHCP6_DP_REPLY_REPORT;
658  void *event_data = vlib_process_get_event_data (vm, &event_type);
659 
660  int i;
661  if (event_type == DHCP6_DP_REPLY_REPORT)
662  {
663  address_report_t *events = event_data;
664  for (i = 0; i < vec_len (events); i++)
665  {
666  u32 event_size =
667  sizeof (vl_api_dhcp6_reply_event_t) +
668  vec_len (events[i].addresses) *
669  sizeof (vl_api_dhcp6_address_info_t);
670  vl_api_dhcp6_reply_event_t *event = clib_mem_alloc (event_size);
671  clib_memset (event, 0, event_size);
672 
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;
682 
683  event->n_addresses = htonl (vec_len (events[i].addresses));
684  vl_api_dhcp6_address_info_t *address =
685  (typeof (address)) event->addresses;
686  u32 j;
687  for (j = 0; j < vec_len (events[i].addresses); j++)
688  {
689  dhcp6_address_info_t *info = &events[i].addresses[j];
690  ip6_address_encode (&info->address, address->address);
691  address->valid_time = htonl (info->valid_time);
692  address->preferred_time = htonl (info->preferred_time);
693  address++;
694  }
695  vec_free (events[i].addresses);
696 
700 
702  /* *INDENT-OFF* */
703  pool_foreach (reg, vpe_api_main.dhcp6_reply_events_registrations)
704  {
705  vl_api_registration_t *vl_reg;
706  vl_reg =
708  if (vl_reg && vl_api_can_send_msg (vl_reg))
709  {
711  vl_msg_api_alloc (event_size);
712  clib_memcpy (msg, event, event_size);
713  msg->_vl_msg_id = htons (VL_API_DHCP6_REPLY_EVENT + REPLY_MSG_ID_BASE);
714  msg->client_index = reg->client_index;
715  msg->pid = reg->client_pid;
716  vl_api_send_msg (vl_reg, (u8 *) msg);
717  }
718  }
719  /* *INDENT-ON* */
720 
721  clib_mem_free (event);
722  }
723  }
724  vlib_process_put_event_data (vm, event_data);
725  }
726 
727  return 0;
728 }
729 
730 /* *INDENT-OFF* */
732  .function = dhcp6_reply_process,
733  .type = VLIB_NODE_TYPE_PROCESS,
734  .name = "dhcp6-reply-publisher-process",
735 };
736 /* *INDENT-ON* */
737 
738 static clib_error_t *
740  _vnet_dhcp6_pd_reply_event_function_list_elt_t
741  * elt)
742 {
743  clib_error_t *error = 0;
744 
745  while (elt)
746  {
747  error = elt->fp (data);
748  if (error)
749  return error;
750  elt = elt->next_dhcp6_pd_reply_event_function;
751  }
752 
753  return error;
754 }
755 
756 static uword
758  vlib_frame_t * f)
759 {
760  /* These cross the longjmp boundary (vlib_process_wait_for_event)
761  * and need to be volatile - to prevent them from being optimized into
762  * a register - which could change during suspension */
763 
764  while (1)
765  {
767  uword event_type = DHCP6_PD_DP_REPLY_REPORT;
768  void *event_data = vlib_process_get_event_data (vm, &event_type);
769 
770  int i;
771  if (event_type == DHCP6_PD_DP_REPLY_REPORT)
772  {
773  prefix_report_t *events = event_data;
774  for (i = 0; i < vec_len (events); i++)
775  {
776  u32 event_size =
778  vec_len (events[i].prefixes) *
779  sizeof (vl_api_dhcp6_pd_prefix_info_t);
781  clib_mem_alloc (event_size);
782  clib_memset (event, 0, event_size);
783 
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;
793 
794  event->n_prefixes = htonl (vec_len (events[i].prefixes));
795  vl_api_dhcp6_pd_prefix_info_t *prefix =
796  (typeof (prefix)) event->prefixes;
797  u32 j;
798  for (j = 0; j < vec_len (events[i].prefixes); j++)
799  {
800  dhcp6_prefix_info_t *info = &events[i].prefixes[j];
801  ip6_address_encode (&info->prefix, prefix->prefix.address);
802  prefix->prefix.len = info->prefix_length;
803  prefix->valid_time = htonl (info->valid_time);
804  prefix->preferred_time = htonl (info->preferred_time);
805  prefix++;
806  }
807  vec_free (events[i].prefixes);
808 
812 
814  /* *INDENT-OFF* */
815  pool_foreach (reg, vpe_api_main.dhcp6_pd_reply_events_registrations)
816  {
817  vl_api_registration_t *vl_reg;
818  vl_reg =
820  if (vl_reg && vl_api_can_send_msg (vl_reg))
821  {
823  vl_msg_api_alloc (event_size);
824  clib_memcpy (msg, event, event_size);
825  msg->_vl_msg_id = htons (VL_API_DHCP6_PD_REPLY_EVENT + REPLY_MSG_ID_BASE);
826  msg->client_index = reg->client_index;
827  msg->pid = reg->client_pid;
828  vl_api_send_msg (vl_reg, (u8 *) msg);
829  }
830  }
831  /* *INDENT-ON* */
832 
833  clib_mem_free (event);
834  }
835  }
836  vlib_process_put_event_data (vm, event_data);
837  }
838 
839  return 0;
840 }
841 
842 /* *INDENT-OFF* */
844  .function = dhcp6_pd_reply_process,
845  .type = VLIB_NODE_TYPE_PROCESS,
846  .name = "dhcp6-pd-reply-publisher-process",
847 };
848 /* *INDENT-ON* */
849 
850 /*
851  * dhcp_api_hookup
852  * Add vpe's API message handlers to the table.
853  * vlib has already mapped shared memory and
854  * added the client registration handlers.
855  * See .../vlib-api/vlibmemory/memclnt_vlib.c:memclnt_process()
856  */
857 #include <dhcp/dhcp.api.c>
858 
859 static clib_error_t *
861 {
862  /*
863  * Set up the (msg_name, crc, message-id) table
864  */
866 
871 
872  return 0;
873 }
874 
876 
877 #include <vlib/unix/plugin.h>
878 #include <vpp/app/version.h>
879 
880 /* *INDENT-OFF* */
882  .version = VPP_BUILD_VER,
883  .description = "Dynamic Host Configuration Protocol (DHCP)",
884 };
885 /* *INDENT-ON* */
886 
887 /*
888  * fd.io coding-style-patch-verification: ON
889  *
890  * Local Variables:
891  * eval: (c-set-style "gnu")
892  * End:
893  */
vl_api_dhcp6_pd_send_client_message_t::n_prefixes
u32 n_prefixes
Definition: dhcp.api:402
dhcp6_pd_send_client_message_params_prefix_t
Definition: dhcp6_pd_client_dp.h:22
vl_api_dhcp6_clients_enable_disable_t_handler
static void vl_api_dhcp6_clients_enable_disable_t_handler(vl_api_dhcp6_clients_enable_disable_t *mp)
Definition: dhcp_api.c:416
VALIDATE_SW_IF_INDEX
#define VALIDATE_SW_IF_INDEX(mp)
Definition: api_helper_macros.h:281
vl_api_dhcp_proxy_config_t
DHCP Proxy config add / del request.
Definition: dhcp.api:110
vl_api_client_index_to_registration
static vl_api_registration_t * vl_api_client_index_to_registration(u32 index)
Definition: api.h:79
api.h
dhcp_vss_t_::vss_type
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 - ...
Definition: dhcp_proxy.h:64
vl_api_want_dhcp6_pd_reply_events_t
Register for DHCPv6 PD reply events.
Definition: dhcp.api:436
vl_api_dhcp6_pd_reply_event_t::client_index
u32 client_index
Definition: dhcp.api:492
ntohs
#define ntohs(x)
Definition: af_xdp.bpf.c:29
dhcp6_ia_na_client_public_main_t
Definition: dhcp6_ia_na_client_dp.h:110
vl_api_dhcp_proxy_config_t::is_add
bool is_add
Definition: dhcp.api:116
dhcp_client_t_::event_callback
dhcp_event_cb_t event_callback
Definition: client.h:116
ip_dscp_t
enum ip_dscp_t_ ip_dscp_t
dhcp6_pd_send_client_message
void dhcp6_pd_send_client_message(vlib_main_t *vm, u32 sw_if_index, u8 stop, dhcp6_pd_send_client_message_params_t *params)
Definition: dhcp6_pd_client_dp.c:364
vl_api_dhcp6_send_client_message_t::mrt
u32 mrt
Definition: dhcp.api:356
dhcp_server_t_
A representation of a single DHCP Server within a given VRF config.
Definition: dhcp_proxy.h:82
REPLY_MACRO2
#define REPLY_MACRO2(t, body)
Definition: api_helper_macros.h:65
clib_memcpy
#define clib_memcpy(d, s, n)
Definition: string.h:197
dhcp6_pd_send_client_message_params_t::prefixes
dhcp6_pd_send_client_message_params_prefix_t * prefixes
Definition: dhcp6_pd_client_dp.h:41
vl_api_send_msg
static void vl_api_send_msg(vl_api_registration_t *rp, u8 *elem)
Definition: api.h:35
vl_api_dhcp_proxy_details_t::vss_oui
u32 vss_oui
Definition: dhcp.api:271
vl_api_dhcp_proxy_details_t::context
u32 context
Definition: dhcp.api:269
vlib_process_wait_for_event
static uword * vlib_process_wait_for_event(vlib_main_t *vm)
Definition: node_funcs.h:660
dhcp_vss_t_::vpn_ascii_id
u8 * vpn_ascii_id
Type 0 ASCII VPN Identifier.
Definition: dhcp_proxy.h:76
dhcp6_prefix_info_t::valid_time
u32 valid_time
Definition: dhcp6_pd_client_dp.h:80
vl_api_dhcp_client_config_t
DHCP Client config add / del request.
Definition: dhcp.api:173
f
vlib_frame_t * f
Definition: interface_output.c:1080
dhcp_client_send_walk_ctx_t
struct dhcp_client_send_walk_ctx_t_ dhcp_client_send_walk_ctx_t
dhcp_client_t_::pid
u32 pid
Definition: client.h:103
pool_elt_at_index
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
Definition: pool.h:553
dhcp6_send_client_message_params_t::sw_if_index
u32 sw_if_index
Definition: dhcp6_ia_na_client_dp.h:32
vl_api_dhcp_proxy_dump_t::context
u32 context
Definition: dhcp.api:254
dhcp6_pd_send_client_message_params_t::mrt
u32 mrt
Definition: dhcp6_pd_client_dp.h:35
dhcp6_pd_client_public_main_t
Definition: dhcp6_pd_client_dp.h:117
vl_api_dhcp6_pd_send_client_message_t::T2
u32 T2
Definition: dhcp.api:401
vl_api_dhcp_proxy_set_vss_t::is_add
bool is_add
Definition: dhcp.api:142
ip_dscp_encode
vl_api_ip_dscp_t ip_dscp_encode(ip_dscp_t dscp)
Definition: ip_types_api.c:105
vl_api_dhcp_proxy_dump_t_handler
static void vl_api_dhcp_proxy_dump_t_handler(vl_api_dhcp_proxy_dump_t *mp)
Definition: dhcp_api.c:163
dhcp6_send_client_message_params_t::msg_type
u8 msg_type
Definition: dhcp6_ia_na_client_dp.h:38
dhcp6_send_client_message_params_t::mrd
u32 mrd
Definition: dhcp6_ia_na_client_dp.h:37
clib_mem_free
static void clib_mem_free(void *p)
Definition: mem.h:311
dhcp6_reply_process
static uword dhcp6_reply_process(vlib_main_t *vm, vlib_node_runtime_t *rt, vlib_frame_t *f)
Definition: dhcp_api.c:647
vl_api_dhcp6_pd_send_client_message_t::stop
bool stop
Definition: dhcp.api:398
vpe_api_main_t
Definition: api_helper_macros.h:414
vl_api_dhcp6_send_client_message_t::server_index
u32 server_index
Definition: dhcp.api:354
prefix_report_t
Definition: dhcp6_pd_client_dp.h:85
vl_api_dhcp6_pd_send_client_message_t::mrc
u32 mrc
Definition: dhcp.api:396
vl_api_dhcp_proxy_set_vss_t_handler
static void vl_api_dhcp_proxy_set_vss_t_handler(vl_api_dhcp_proxy_set_vss_t *mp)
Definition: dhcp_api.c:107
dhcp_proxy_set_vss
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.
Definition: dhcp_proxy.c:309
vl_api_dhcp_client_dump_t::context
u32 context
Definition: dhcp.api:233
vl_api_dhcp_client_details_t::client
vl_api_dhcp_client_t client
Definition: dhcp.api:243
fib_table.h
vl_api_dhcp_proxy_config_t::server_vrf_id
u32 server_vrf_id
Definition: dhcp.api:115
send_dhcp_client_entry
static int send_dhcp_client_entry(const dhcp_client_t *client, void *arg)
Definition: dhcp_api.c:371
dhcp6_prefix_info_t::prefix
ip6_address_t prefix
Definition: dhcp6_pd_client_dp.h:78
call_dhcp6_pd_reply_event_callbacks
static clib_error_t * call_dhcp6_pd_reply_event_callbacks(void *data, _vnet_dhcp6_pd_reply_event_function_list_elt_t *elt)
Definition: dhcp_api.c:739
dhcp6_pd_send_client_message_params_t
Definition: dhcp6_pd_client_dp.h:30
dhcp_proxy_t_
A DHCP proxy representation fpr per-client VRF config.
Definition: dhcp_proxy.h:100
am
app_main_t * am
Definition: application.c:489
ip6_address_decode
void ip6_address_decode(const vl_api_ip6_address_t in, ip6_address_t *out)
Definition: ip_types_api.c:143
dhcp6_reply_process_node
vlib_node_registration_t dhcp6_reply_process_node
(constructor) VLIB_REGISTER_NODE (dhcp6_reply_process_node)
Definition: dhcp_api.c:731
pool_put
#define pool_put(P, E)
Free an object E in pool P.
Definition: pool.h:305
dhcp6_pd_send_client_message_params_t::mrc
u32 mrc
Definition: dhcp6_pd_client_dp.h:36
vm
vlib_main_t * vm
X-connect all packets from the HOST to the PHY.
Definition: nat44_ei.c:3047
vl_api_dhcp_proxy_details_t::count
u8 count
Definition: dhcp.api:277
dhcp_vss_t_
The Virtual Sub-net Selection information for a given RX FIB.
Definition: dhcp_proxy.h:56
plugin.h
dhcp6_pd_send_client_message_params_t::server_index
u32 server_index
Definition: dhcp6_pd_client_dp.h:33
vl_api_dhcp6_duid_ll_set_t
Set DHCPv6 DUID-LL.
Definition: dhcp.api:286
vl_api_dhcp_client_details_t::lease
vl_api_dhcp_lease_t lease
Definition: dhcp.api:244
dhcp_proxy_main
dhcp_proxy_main_t dhcp_proxy_main
Shard 4/6 instance of DHCP main.
Definition: dhcp_proxy.c:25
addr
vhost_vring_addr_t addr
Definition: vhost_user.h:130
vl_api_want_dhcp6_pd_reply_events_t::client_index
u32 client_index
Definition: dhcp.api:438
vl_api_dhcp_plugin_get_version_reply_t::minor
u32 minor
Definition: dhcp.api:73
dhcp6_address_info_t
Definition: dhcp6_ia_na_client_dp.h:76
vl_api_dhcp_plugin_control_ping_reply_t
Control ping from the client to the server response.
Definition: dhcp.api:92
vlib_frame_t
Definition: node.h:372
vl_api_dhcp6_pd_send_client_message_t::server_index
u32 server_index
Definition: dhcp.api:393
dhcp_client_data_encode
static void dhcp_client_data_encode(vl_api_dhcp_client_t *vclient, const dhcp_client_t *client)
Definition: dhcp_api.c:290
dhcp_get_vss_info
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.
Definition: dhcp_proxy.h:254
vl_api_dhcp6_pd_send_client_message_t::sw_if_index
vl_api_interface_index_t sw_if_index
Definition: dhcp.api:392
dhcp6_set_publisher_node
void dhcp6_set_publisher_node(uword node_index, uword event_type)
Definition: dhcp6_ia_na_client_dp.c:56
error
Definition: cJSON.c:88
dhcp6_proxy_set_server
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)
Definition: dhcp6_proxy_node.c:874
dhcp_client_t_::installed
dhcp_client_fwd_addresses_t installed
Definition: client.h:86
dhcp6_send_client_message_params_t::addresses
dhcp6_send_client_message_params_address_t * addresses
Definition: dhcp6_ia_na_client_dp.h:41
vl_api_dhcp6_send_client_message_t::n_addresses
u32 n_addresses
Definition: dhcp.api:363
ip_address_decode
ip46_type_t ip_address_decode(const vl_api_address_t *in, ip46_address_t *out)
Decode/Encode for struct/union types.
Definition: ip_types_api.c:186
dhcp6_send_client_message_params_t::T2
u32 T2
Definition: dhcp6_ia_na_client_dp.h:40
hash_set
#define hash_set(h, key, value)
Definition: hash.h:255
dhcp6_pd_client_public_main
dhcp6_pd_client_public_main_t dhcp6_pd_client_public_main
Definition: dhcp6_pd_client_dp.c:29
setup_message_id_table
static void setup_message_id_table(api_main_t *am)
Definition: bfd_api.c:451
vl_api_dhcp6_reply_event_t::client_index
u32 client_index
Definition: dhcp.api:461
dhcp_send_details
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.
Definition: dhcp_api.c:176
vl_api_dhcp6_clients_enable_disable_t
Enable/disable listening on DHCPv6 client port.
Definition: dhcp.api:297
fib_table_t_
A protocol Independent FIB table.
Definition: fib_table.h:71
vl_api_dhcp_proxy_set_vss_t
DHCP Proxy set / unset vss request.
Definition: dhcp.api:132
pool_foreach
#define pool_foreach(VAR, POOL)
Iterate through pool.
Definition: pool.h:534
dhcp6_prefix_info_t::prefix_length
u8 prefix_length
Definition: dhcp6_pd_client_dp.h:79
dhcp6_pd_send_client_message_params_t::msg_type
u8 msg_type
Definition: dhcp6_pd_client_dp.h:38
count
u8 count
Definition: dhcp.api:208
vl_api_dhcp_proxy_details_t::vss_fib_id
u32 vss_fib_id
Definition: dhcp.api:272
vec_len
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
Definition: vec_bootstrap.h:142
vl_api_dhcp_proxy_config_t_handler
static void vl_api_dhcp_proxy_config_t_handler(vl_api_dhcp_proxy_config_t *mp)
Definition: dhcp_api.c:126
vl_api_dhcp_plugin_get_version_reply_t::context
u32 context
Definition: dhcp.api:71
vl_api_dhcp6_pd_send_client_message_t::T1
u32 T1
Definition: dhcp.api:400
len
u8 len
Definition: ip_types.api:103
vl_api_dhcp6_pd_send_client_message_t::prefixes
vl_api_dhcp6_pd_prefix_info_t prefixes[n_prefixes]
Definition: dhcp.api:403
vl_api_dhcp6_pd_send_client_message_t::irt
u32 irt
Definition: dhcp.api:394
dhcp_client_send_walk_ctx_t_::context
u32 context
Definition: dhcp_api.c:367
ip6_address_encode
void ip6_address_encode(const ip6_address_t *in, vl_api_ip6_address_t out)
Definition: ip_types_api.c:137
DHCP6_DP_REPLY_REPORT
@ DHCP6_DP_REPLY_REPORT
Definition: dhcp6_ia_na_client_dp.h:100
vlib_process_get_event_data
static void * vlib_process_get_event_data(vlib_main_t *vm, uword *return_event_type_opaque)
Definition: node_funcs.h:530
dhcp6_send_client_message_params_address_t
Definition: dhcp6_ia_na_client_dp.h:23
vl_api_dhcp_compl_event_t::client_index
u32 client_index
Definition: dhcp.api:219
dhcp_client_t_::domain_server_address
ip4_address_t * domain_server_address
Definition: client.h:90
vl_api_dhcp_proxy_dump_t
Dump DHCP proxy table.
Definition: dhcp.api:251
fib_table_t_::ft_table_id
u32 ft_table_id
Table ID (hash key) for this FIB.
Definition: fib_table.h:92
vl_api_dhcp6_reply_event_t
Tell client about a DHCPv6 server reply event.
Definition: dhcp.api:459
vl_api_dhcp_compl_event_t::pid
u32 pid
Definition: dhcp.api:220
dhcp_client_send_walk_ctx_t_
Definition: dhcp_api.c:364
vl_api_dhcp_plugin_control_ping_t_handler
static void vl_api_dhcp_plugin_control_ping_t_handler(vl_api_dhcp_plugin_control_ping_t *mp)
Definition: dhcp_api.c:73
vl_api_registration_
An API client registration, only in vpp/vlib.
Definition: api_common.h:47
REPLY_MACRO
#define REPLY_MACRO(t)
Definition: api_helper_macros.h:30
vpe_client_registration_t::client_pid
u32 client_pid
Definition: api_helper_macros.h:411
dhcp_client_t_::hostname
u8 * hostname
Definition: client.h:98
VLIB_API_INIT_FUNCTION
VLIB_API_INIT_FUNCTION(dhcp_api_hookup)
vl_api_dhcp6_pd_send_client_message_t::mrt
u32 mrt
Definition: dhcp.api:395
ip_dscp_decode
ip_dscp_t ip_dscp_decode(vl_api_ip_dscp_t in)
Definition: ip_types_api.c:99
vec_foreach_index
#define vec_foreach_index(var, v)
Iterate over vector indices.
Definition: vec_bootstrap.h:220
VSS_TYPE_ASCII
#define VSS_TYPE_ASCII
Definition: dhcp_proxy.h:65
dhcp_proxy_t_::rx_fib_index
u32 rx_fib_index
The FIB index (not the external Table-ID) in which the client is resides.
Definition: dhcp_proxy.h:131
uword
u64 uword
Definition: types.h:112
dhcp6_pd_send_client_message_params_t::mrd
u32 mrd
Definition: dhcp6_pd_client_dp.h:37
if
if(node->flags &VLIB_NODE_FLAG_TRACE) vnet_interface_output_trace(vm
hash_get
#define hash_get(h, key)
Definition: hash.h:249
dhcp6_ia_na_client_dp.h
vl_api_dhcp6_send_client_message_t::T1
u32 T1
Definition: dhcp.api:361
dhcp6_pd_send_client_message_params_prefix_t::valid_lt
u32 valid_lt
Definition: dhcp6_pd_client_dp.h:25
vl_api_dhcp_proxy_details_t::vss_vpn_ascii_id
string vss_vpn_ascii_id[129]
Definition: dhcp.api:275
dhcp4_proxy_set_server
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)
Definition: dhcp4_proxy_node.c:846
vl_api_dhcp6_send_client_message_t::mrc
u32 mrc
Definition: dhcp.api:357
dhcp6_send_client_message_params_t::mrt
u32 mrt
Definition: dhcp6_ia_na_client_dp.h:35
vl_api_dhcp6_send_client_message_t
Send DHCPv6 client message of specified type.
Definition: dhcp.api:349
vl_api_dhcp_plugin_get_version_t::client_index
u32 client_index
Definition: dhcp.api:59
dhcp_server_t_::server_fib_index
u32 server_fib_index
The FIB index (not the external Table-ID) in which the server is reachable.
Definition: dhcp_proxy.h:94
vl_api_dhcp_proxy_config_t::dhcp_src_address
vl_api_address_t dhcp_src_address
Definition: dhcp.api:118
interface.h
vl_api_dhcp6_pd_send_client_message_t_handler
void vl_api_dhcp6_pd_send_client_message_t_handler(vl_api_dhcp6_pd_send_client_message_t *mp)
Definition: dhcp_api.c:575
dhcp_base_msg_id
static u32 dhcp_base_msg_id
Base message ID fot the plugin.
Definition: dhcp_api.c:41
dhcp6_prefix_info_t::preferred_time
u32 preferred_time
Definition: dhcp6_pd_client_dp.h:81
vl_api_dhcp_compl_event_t
Tell client about a DHCP completion event.
Definition: dhcp.api:217
i
sll srl srl sll sra u16x4 i
Definition: vector_sse42.h:261
vl_api_dhcp6_pd_reply_event_t::pid
u32 pid
Definition: dhcp.api:493
events
static perfmon_event_t events[]
Definition: core.c:21
vl_api_dhcp_proxy_config_t::dhcp_server
vl_api_address_t dhcp_server
Definition: dhcp.api:117
dhcp6_ia_na_client_public_main_t::functions
_vnet_dhcp6_reply_event_function_list_elt_t * functions
Definition: dhcp6_ia_na_client_dp.h:112
pool_get
#define pool_get(P, E)
Allocate an object E from a pool P (unspecified alignment).
Definition: pool.h:255
dhcp_proxy_dump
void dhcp_proxy_dump(fib_protocol_t proto, void *opaque, u32 context)
Dump the proxy configs to the API.
Definition: dhcp_proxy.c:248
vec_validate
#define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment)
Definition: vec.h:523
vl_api_dhcp6_send_client_message_t::sw_if_index
vl_api_interface_index_t sw_if_index
Definition: dhcp.api:353
vl_api_dhcp_plugin_control_ping_reply_t::vpe_pid
u32 vpe_pid
Definition: dhcp.api:97
address
manual_print typedef address
Definition: ip_types.api:96
vl_api_dhcp_proxy_details_t::dhcp_src_address
vl_api_address_t dhcp_src_address
Definition: dhcp.api:276
vl_api_dhcp_client_dump_t
Dump the DHCP client configurations.
Definition: dhcp.api:230
src
vl_api_address_t src
Definition: gre.api:54
dhcp_client_t_::client_identifier
u8 * client_identifier
Definition: client.h:99
vl_api_dhcp_client_config_t::client_index
u32 client_index
Definition: dhcp.api:175
fib_protocol_t
enum fib_protocol_t_ fib_protocol_t
Protocol Type.
vl_api_dhcp6_pd_send_client_message_t::mrd
u32 mrd
Definition: dhcp.api:397
vl_api_dhcp_proxy_set_vss_t::tbl_id
u32 tbl_id
Definition: dhcp.api:136
ip4_address_t
Definition: ip4_packet.h:50
dhcp6_address_info_t::valid_time
u32 valid_time
Definition: dhcp6_ia_na_client_dp.h:79
vl_api_want_dhcp6_reply_events_t::pid
u32 pid
Definition: dhcp.api:427
FIB_PROTOCOL_IP4
@ FIB_PROTOCOL_IP4
Definition: fib_types.h:36
clib_min
#define clib_min(x, y)
Definition: clib.h:342
REPLY_MSG_ID_BASE
#define REPLY_MSG_ID_BASE
Definition: dhcp_api.c:42
dhcp_compl_event_callback
static void dhcp_compl_event_callback(u32 client_index, const dhcp_client_t *client)
Definition: dhcp_api.c:315
dhcp6_pd_client_dp.h
dhcp_client_send_walk_ctx_t_::reg
vl_api_registration_t * reg
Definition: dhcp_api.c:366
dhcp6_pd_set_publisher_node
void dhcp6_pd_set_publisher_node(uword node_index, uword event_type)
Definition: dhcp6_pd_client_dp.c:56
vlib_node_registration_t
struct _vlib_node_registration vlib_node_registration_t
dhcp6_send_client_message
void dhcp6_send_client_message(vlib_main_t *vm, u32 sw_if_index, u8 stop, dhcp6_send_client_message_params_t *params)
Definition: dhcp6_ia_na_client_dp.c:358
vl_api_dhcp_plugin_get_version_t_handler
static void vl_api_dhcp_plugin_get_version_t_handler(vl_api_dhcp_plugin_get_version_t *mp)
Definition: dhcp_api.c:50
dhcp6_address_info_t::address
ip6_address_t address
Definition: dhcp6_ia_na_client_dp.h:78
dhcp6_ia_na_client_public_main
dhcp6_ia_na_client_public_main_t dhcp6_ia_na_client_public_main
Definition: dhcp6_ia_na_client_dp.c:29
dhcp_server_t_::dhcp_server
ip46_address_t dhcp_server
The address of the DHCP server to which to relay the client's messages.
Definition: dhcp_proxy.h:88
vl_api_want_dhcp6_pd_reply_events_t::pid
u32 pid
Definition: dhcp.api:441
BAD_SW_IF_INDEX_LABEL
#define BAD_SW_IF_INDEX_LABEL
Definition: api_helper_macros.h:289
dhcp_api_hookup
static clib_error_t * dhcp_api_hookup(vlib_main_t *vm)
Definition: dhcp_api.c:860
dhcp_client_t_::state
dhcp_client_state_t state
Definition: client.h:65
vl_api_want_dhcp6_reply_events_t
Register for DHCPv6 reply events.
Definition: dhcp.api:422
data
u8 data[128]
Definition: ipsec_types.api:92
vl_api_dhcp_proxy_set_vss_t::is_ipv6
bool is_ipv6
Definition: dhcp.api:141
vl_api_want_dhcp6_reply_events_t::client_index
u32 client_index
Definition: dhcp.api:424
dhcp6_send_client_message_params_t
Definition: dhcp6_ia_na_client_dp.h:30
vl_api_dhcp_proxy_set_vss_t::vss_type
vl_api_vss_type_t vss_type
Definition: dhcp.api:137
vec_free
#define vec_free(V)
Free vector's memory (no header).
Definition: vec.h:395
dhcp6_pd_send_client_message_params_prefix_t::preferred_lt
u32 preferred_lt
Definition: dhcp6_pd_client_dp.h:24
vl_msg_api_max_length
u32 vl_msg_api_max_length(void *mp)
Definition: api_shared.c:926
DHCP6_PD_DP_REPLY_REPORT
@ DHCP6_PD_DP_REPLY_REPORT
Definition: dhcp6_pd_client_dp.h:106
vl_api_dhcp_proxy_details_t::servers
vl_api_dhcp_server_t servers[count]
Definition: dhcp.api:278
dhcp6_pd_send_client_message_params_t::T1
u32 T1
Definition: dhcp6_pd_client_dp.h:39
vl_api_dhcp_proxy_details_t::vss_type
vl_api_vss_type_t vss_type
Definition: dhcp.api:273
dhcp_vss_t_::vpn_id
u8 vpn_id[7]
Type 1 VPN-ID.
Definition: dhcp_proxy.h:72
dhcp_client_t_::dscp
ip_dscp_t dscp
Definition: client.h:114
vl_api_want_dhcp6_reply_events_t::enable_disable
u8 enable_disable
Definition: dhcp.api:426
vl_api_dhcp_proxy_dump_t::client_index
u32 client_index
Definition: dhcp.api:253
format_fns.h
dhcp6_pd_send_client_message_params_t::sw_if_index
u32 sw_if_index
Definition: dhcp6_pd_client_dp.h:32
format
description fragment has unexpected format
Definition: map.api:433
vl_api_can_send_msg
static int vl_api_can_send_msg(vl_api_registration_t *rp)
Definition: api.h:48
dhcp_client_lease_encode
static void dhcp_client_lease_encode(vl_api_dhcp_lease_t *lease, const dhcp_client_t *client)
Definition: dhcp_api.c:259
vl_api_dhcp6_send_client_message_t::addresses
vl_api_dhcp6_address_info_t addresses[n_addresses]
Definition: dhcp.api:364
vl_api_dhcp6_pd_reply_event_t
Tell client about a DHCPv6 PD server reply event.
Definition: dhcp.api:490
fib_table_get
fib_table_t * fib_table_get(fib_node_index_t index, fib_protocol_t proto)
Get a pointer to a FIB table.
Definition: fib_table.c:29
vl_api_dhcp_client_details_t::context
u32 context
Definition: dhcp.api:242
vl_api_want_dhcp6_pd_reply_events_t_handler
void vl_api_want_dhcp6_pd_reply_events_t_handler(vl_api_want_dhcp6_pd_reply_events_t *mp)
Definition: dhcp_api.c:476
dhcp_client_t_::client_hardware_address
u8 client_hardware_address[6]
Definition: client.h:108
vl_api_dhcp_plugin_get_version_t::context
u32 context
Definition: dhcp.api:60
dhcp6_client_common_dp.h
vl_api_dhcp6_pd_send_client_message_t::msg_type
vl_api_dhcpv6_msg_type_t msg_type
Definition: dhcp.api:399
u32
unsigned int u32
Definition: types.h:88
dhcp6_clients_enable_disable
void dhcp6_clients_enable_disable(u8 enable)
Definition: dhcp6_client_common_dp.c:448
dhcp6_pd_client_public_main_t::functions
_vnet_dhcp6_pd_reply_event_function_list_elt_t * functions
Definition: dhcp6_pd_client_dp.h:119
vl_api_dhcp_plugin_get_version_reply_t::major
u32 major
Definition: dhcp.api:72
vl_api_dhcp6_send_client_message_t::msg_type
vl_api_dhcpv6_msg_type_t msg_type
Definition: dhcp.api:360
FIB_PROTOCOL_IP6
@ FIB_PROTOCOL_IP6
Definition: fib_types.h:37
vl_api_dhcp6_send_client_message_t::irt
u32 irt
Definition: dhcp.api:355
VSS_TYPE_VPN_ID
#define VSS_TYPE_VPN_ID
Definition: dhcp_proxy.h:66
ctx
long ctx[MAX_CONNS]
Definition: main.c:144
dhcp6_pd_reply_process
static uword dhcp6_pd_reply_process(vlib_main_t *vm, vlib_node_runtime_t *rt, vlib_frame_t *f)
Definition: dhcp_api.c:757
vlib_process_put_event_data
static void vlib_process_put_event_data(vlib_main_t *vm, void *event_data)
Definition: node_funcs.h:567
dhcp_client_fwd_addresses_t_::router_address
ip4_address_t router_address
The address of this client's default gateway - may not be present.
Definition: client.h:60
dhcp6_pd_send_client_message_params_prefix_t::prefix_length
u8 prefix_length
Definition: dhcp6_pd_client_dp.h:27
dhcp_client_walk
void dhcp_client_walk(dhcp_client_walk_cb_t cb, void *ctx)
Walk (visit each) DHCP client configuration.
Definition: client.c:1116
api_helper_macros.h
dhcp_client_fwd_addresses_t_::leased_address
ip4_address_t leased_address
the address assigned to this client and it's mask
Definition: client.h:52
for
for(i=1;i<=collision_buckets;i++)
Definition: flowhash_template.h:378
VLIB_NODE_TYPE_PROCESS
@ VLIB_NODE_TYPE_PROCESS
Definition: node.h:84
pool_elts
static uword pool_elts(void *v)
Number of active elements in a pool.
Definition: pool.h:127
vl_api_dhcp_proxy_set_vss_t::vpn_ascii_id
string vpn_ascii_id[129]
Definition: dhcp.api:138
dhcp_client_fwd_addresses_t_::subnet_mask_width
u32 subnet_mask_width
Definition: client.h:53
vl_api_want_dhcp6_pd_reply_events_t::enable_disable
bool enable_disable
Definition: dhcp.api:440
vl_api_dhcp_client_details_t
DHCP Client details returned from dump.
Definition: dhcp.api:240
elt
app_rx_mq_elt_t * elt
Definition: application.c:488
VSS_TYPE_INVALID
#define VSS_TYPE_INVALID
Definition: dhcp_proxy.h:67
client_duid
dhcpv6_duid_ll_string_t client_duid
Definition: dhcp6_client_common_dp.c:26
vl_api_dhcp_client_config_t::is_add
bool is_add
Definition: dhcp.api:177
vl_api_dhcp6_send_client_message_t::T2
u32 T2
Definition: dhcp.api:362
hash_unset
#define hash_unset(h, key)
Definition: hash.h:261
vpe_client_registration_t::client_index
u32 client_index
Definition: api_helper_macros.h:410
dhcp_proxy_rx_table_get_table_id
u32 dhcp_proxy_rx_table_get_table_id(fib_protocol_t proto, u32 fib_index)
Definition: dhcp_proxy.c:46
clib_memset
clib_memset(h->entries, 0, sizeof(h->entries[0]) *entries)
vlib_main_t
Definition: main.h:102
vl_api_dhcp_compl_event_t::lease
vl_api_dhcp_lease_t lease
Definition: dhcp.api:221
vl_api_dhcp_plugin_control_ping_t
Control ping from client to api server request.
Definition: dhcp.api:80
vl_api_dhcp6_duid_ll_set_t_handler
static void vl_api_dhcp6_duid_ll_set_t_handler(vl_api_dhcp6_duid_ll_set_t *mp)
Definition: dhcp_api.c:88
dhcp_proxy.h
dhcp_client_t_::sw_if_index
u32 sw_if_index
Definition: client.h:68
dhcp6_pd_send_client_message_params_t::irt
u32 irt
Definition: dhcp6_pd_client_dp.h:34
vlib_get_main
static vlib_main_t * vlib_get_main(void)
Definition: global_funcs.h:38
vl_api_dhcp_proxy_set_vss_t::oui
u32 oui
Definition: dhcp.api:139
dhcp6_send_client_message_params_t::irt
u32 irt
Definition: dhcp6_ia_na_client_dp.h:34
u8
unsigned char u8
Definition: types.h:56
clib_error_t
Definition: clib_error.h:21
rt
vnet_interface_output_runtime_t * rt
Definition: interface_output.c:399
DHCP_PLUGIN_VERSION_MINOR
#define DHCP_PLUGIN_VERSION_MINOR
Definition: dhcp_api.c:47
vl_api_dhcp6_duid_ll_set_t::duid_ll
u8 duid_ll[10]
Definition: dhcp.api:290
vl_api_dhcp_client_dump_t::client_index
u32 client_index
Definition: dhcp.api:232
DHCPV6_DUID_LL
@ DHCPV6_DUID_LL
Definition: dhcp6_packet.h:111
dhcp6_pd_send_client_message_params_prefix_t::prefix
ip6_address_t prefix
Definition: dhcp6_pd_client_dp.h:26
dhcp6_pd_send_client_message_params_t::T2
u32 T2
Definition: dhcp6_pd_client_dp.h:40
dhcp6_prefix_info_t
Definition: dhcp6_pd_client_dp.h:76
vl_api_dhcp_plugin_get_version_t
Get the plugin version.
Definition: dhcp.api:57
clib_warning
#define clib_warning(format, args...)
Definition: error.h:59
vl_api_dhcp_proxy_config_t::rx_vrf_id
u32 rx_vrf_id
Definition: dhcp.api:114
context
u32 context
Definition: ip.api:780
rv
int __clib_unused rv
Definition: application.c:491
dhcp_proxy_t_::dhcp_servers
dhcp_server_t * dhcp_servers
The set of DHCP servers to which messages are relayed.
Definition: dhcp_proxy.h:110
address_report_t
Definition: dhcp6_ia_na_client_dp.h:84
vl_api_dhcp_client_config_t_handler
static void vl_api_dhcp_client_config_t_handler(vl_api_dhcp_client_config_t *mp)
Definition: dhcp_api.c:335
vl_api_dhcp_proxy_set_vss_t::vpn_index
u32 vpn_index
Definition: dhcp.api:140
vl_api_dhcp6_send_client_message_t::stop
bool stop
Definition: dhcp.api:359
dhcp_proxy_t_::dhcp_src_address
ip46_address_t dhcp_src_address
The source address to use in relayed messaes.
Definition: dhcp_proxy.h:125
vnet.h
api_errno.h
vl_api_dhcp6_clients_enable_disable_t::enable
bool enable
Definition: dhcp.api:301
vl_api_dhcp6_send_client_message_t_handler
void vl_api_dhcp6_send_client_message_t_handler(vl_api_dhcp6_send_client_message_t *mp)
Definition: dhcp_api.c:525
vl_api_dhcp_proxy_details_t::is_ipv6
bool is_ipv6
Definition: dhcp.api:274
vlib_node_runtime_t
Definition: node.h:454
proto
vl_api_ip_proto_t proto
Definition: acl_types.api:51
vl_api_dhcp_proxy_details_t
Tell client about a DHCP completion event.
Definition: dhcp.api:267
dhcpv6_duid_ll_string_t
Definition: dhcp6_client_common_dp.h:47
call_dhcp6_reply_event_callbacks
static clib_error_t * call_dhcp6_reply_event_callbacks(void *data, _vnet_dhcp6_reply_event_function_list_elt_t *elt)
Definition: dhcp_api.c:629
vl_api_dhcp6_send_client_message_t::mrd
u32 mrd
Definition: dhcp.api:358
VLIB_PLUGIN_REGISTER
VLIB_PLUGIN_REGISTER()
ADDRESS_IP4
@ ADDRESS_IP4
Definition: ip_types.api:22
vpe_client_registration_t
Definition: api_helper_macros.h:408
sw_if_index
vl_api_interface_index_t sw_if_index
Definition: wireguard.api:34
dhcp_client_t_::set_broadcast_flag
u8 set_broadcast_flag
Definition: client.h:106
dhcp_client_config
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.
Definition: client.c:1031
ip_types_api.h
dhcp6_address_info_t::preferred_time
u32 preferred_time
Definition: dhcp6_ia_na_client_dp.h:80
vl_api_dhcp6_reply_event_t::pid
u32 pid
Definition: dhcp.api:462
vl_api_dhcp_plugin_get_version_reply_t
Reply to get the plugin version.
Definition: dhcp.api:69
dhcp6_send_client_message_params_t::T1
u32 T1
Definition: dhcp6_ia_na_client_dp.h:39
DHCP_PLUGIN_VERSION_MAJOR
#define DHCP_PLUGIN_VERSION_MAJOR
Definition: dhcp_api.c:46
DHCP6_PD_DP_REPORT_MAX
@ DHCP6_PD_DP_REPORT_MAX
Definition: dhcp6_pd_client_dp.h:106
dhcp6_send_client_message_params_t::server_index
u32 server_index
Definition: dhcp6_ia_na_client_dp.h:33
clib_mem_alloc
static void * clib_mem_alloc(uword size)
Definition: mem.h:253
vl_api_want_dhcp6_reply_events_t_handler
void vl_api_want_dhcp6_reply_events_t_handler(vl_api_want_dhcp6_reply_events_t *mp)
Definition: dhcp_api.c:428
client.h
DHCP6_DP_REPORT_MAX
@ DHCP6_DP_REPORT_MAX
Definition: dhcp6_ia_na_client_dp.h:100
dscp
vl_api_ip_dscp_t dscp
Definition: dhcp.api:163
dhcp_client_t_
Definition: client.h:63
vl_api_dhcp_client_config_t::client
vl_api_dhcp_client_t client
Definition: dhcp.api:178
prefix
vl_api_prefix_t prefix
Definition: ip.api:146
dhcp6_pd_reply_process_node
vlib_node_registration_t dhcp6_pd_reply_process_node
(constructor) VLIB_REGISTER_NODE (dhcp6_pd_reply_process_node)
Definition: dhcp_api.c:843
dhcp6_send_client_message_params_t::mrc
u32 mrc
Definition: dhcp6_ia_na_client_dp.h:36
vpe_api_main
vpe_api_main_t vpe_api_main
Definition: interface_api.c:55
vl_api_dhcp6_pd_send_client_message_t
Send DHCPv6 PD client message of specified type.
Definition: dhcp.api:388
vl_api_dhcp_proxy_details_t::rx_vrf_id
u32 rx_vrf_id
Definition: dhcp.api:270
vl_api_dhcp_client_dump_t_handler
static void vl_api_dhcp_client_dump_t_handler(vl_api_dhcp_client_dump_t *mp)
Definition: dhcp_api.c:399
vl_msg_api_alloc
void * vl_msg_api_alloc(int nbytes)
Definition: memory_shared.c:199
VLIB_REGISTER_NODE
#define VLIB_REGISTER_NODE(x,...)
Definition: node.h:169
vl_api_dhcp_proxy_dump_t::is_ip6
bool is_ip6
Definition: dhcp.api:255