FD.io VPP  v21.10.1-2-g0a485f517
Vector Packet Processing
dhcp6_ia_na_client_cp.c
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2018 Cisco and/or its affiliates.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at:
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #include <vnet/vnet.h>
17 #include <vlibmemory/api.h>
18 #include <dhcp/dhcp6_packet.h>
20 #include <vnet/ip/ip.h>
21 #include <vnet/ip/ip6.h>
22 #include <vnet/ip/ip6_link.h>
23 #include <float.h>
24 #include <math.h>
25 
26 typedef struct
27 {
29  ip6_address_t address;
34 
35 typedef struct
36 {
46 
47 typedef struct
48 {
53 
54  /* convenience */
60 
62 
63 enum
64 {
67 };
68 
69 static void
71  u8 msg_type, address_info_t * address_list,
72  u8 start)
73 {
75  dhcp6_send_client_message_params_t params = { 0, };
77  u32 i;
78 
81  client_state_t *client_state =
83 
84  params.sw_if_index = sw_if_index;
85  params.server_index = server_index;
86  params.msg_type = msg_type;
87  if (start)
88  {
89  if (msg_type == DHCPV6_MSG_SOLICIT)
90  {
91  params.irt = 1;
92  params.mrt = 120;
93  }
94  else if (msg_type == DHCPV6_MSG_REQUEST)
95  {
96  params.irt = 1;
97  params.mrt = 30;
98  params.mrc = 10;
99  }
100  else if (msg_type == DHCPV6_MSG_RENEW)
101  {
102  params.irt = 10;
103  params.mrt = 600;
104  f64 current_time = vlib_time_now (rm->vlib_main);
105  i32 diff_time = client_state->T2 - current_time;
106  if (diff_time < 0)
107  diff_time = 0;
108  params.mrd = diff_time;
109  }
110  else if (msg_type == DHCPV6_MSG_REBIND)
111  {
112  params.irt = 10;
113  params.mrt = 600;
114  f64 current_time = vlib_time_now (rm->vlib_main);
115  i32 diff_time = rm->max_valid_due_time - current_time;
116  if (diff_time < 0)
117  diff_time = 0;
118  params.mrd = diff_time;
119  }
120  else if (msg_type == DHCPV6_MSG_RELEASE)
121  {
122  params.mrc = 1;
123  }
124  }
125 
126  params.T1 = 0;
127  params.T2 = 0;
128  if (vec_len (address_list) != 0)
129  vec_validate (addresses, vec_len (address_list) - 1);
130  for (i = 0; i < vec_len (address_list); i++)
131  {
132  address_info_t *address = &address_list[i];
133  addr = &addresses[i];
134  addr->valid_lt = address->valid_lt;
135  addr->preferred_lt = address->preferred_lt;
136  addr->address = address->address;
137  }
138  params.addresses = addresses;
139 
140  dhcp6_send_client_message (rm->vlib_main, sw_if_index, !start, &params);
141 
142  vec_free (params.addresses);
143 }
144 
145 static void interrupt_process (void);
146 
147 static u8
148 ip6_addresses_equal (ip6_address_t * address1, ip6_address_t * address2)
149 {
150  if (address1->as_u64[0] != address2->as_u64[0])
151  return 0;
152  return address1->as_u64[1] == address2->as_u64[1];
153 }
154 
155 static clib_error_t *
157 {
159  vlib_main_t *vm = rm->vlib_main;
160  client_state_t *client_state;
161  ip6_address_t *address;
163  u32 n_addresses;
164  vl_api_dhcp6_address_info_t *api_address;
165  u32 inner_status_code;
166  u32 status_code;
167  u32 server_index;
168  f64 current_time;
169  clib_error_t *error = 0;
170  u32 i;
171 
172  current_time = vlib_time_now (vm);
173 
174  sw_if_index = ntohl (mp->sw_if_index);
175 
177  return 0;
178 
179  client_state = &rm->client_state_by_sw_if_index[sw_if_index];
180 
181  if (!client_state->enabled)
182  return 0;
183 
184  server_index = ntohl (mp->server_index);
185 
186  n_addresses = ntohl (mp->n_addresses);
187 
188  inner_status_code = ntohs (mp->inner_status_code);
189  status_code = ntohs (mp->status_code);
190 
192  && client_state->server_index == ~0)
193  {
194  address_info_t *address_list = 0, *address_info;
195 
196  if (inner_status_code == DHCPV6_STATUS_NOADDRS_AVAIL)
197  {
199  ("Advertise message arrived with NoAddrsAvail status code");
200  return 0;
201  }
202 
203  if (n_addresses > 0)
204  vec_validate (address_list, n_addresses - 1);
205  for (i = 0; i < n_addresses; i++)
206  {
207  api_address = &mp->addresses[i];
208  address = (ip6_address_t *) api_address->address;
209 
210  address_info = &address_list[i];
211  address_info->address = *address;
212  address_info->preferred_lt = 0;
213  address_info->valid_lt = 0;
214  }
215 
216  client_state->server_index = server_index;
217 
219  DHCPV6_MSG_REQUEST, address_list, 1);
220  vec_free (address_list);
221  }
222 
223  if (mp->msg_type != DHCPV6_MSG_API_REPLY)
224  return 0;
225 
226  if (!client_state->rebinding && client_state->server_index != server_index)
227  {
228  clib_warning ("Reply message arrived with Server ID different "
229  "from that in Request or Renew message");
230  return 0;
231  }
232 
233  if (inner_status_code == DHCPV6_STATUS_NOADDRS_AVAIL)
234  {
235  clib_warning ("Reply message arrived with NoAddrsAvail status code");
236  if (n_addresses > 0)
237  {
239  ("Invalid Reply message arrived: It contains NoAddrsAvail "
240  "status code but also contains addresses");
241  return 0;
242  }
243  }
244 
245  if (status_code == DHCPV6_STATUS_UNSPEC_FAIL)
246  {
247  clib_warning ("Reply message arrived with UnspecFail status code");
248  return 0;
249  }
250 
252  mp->msg_type, 0, 0);
253 
254  for (i = 0; i < n_addresses; i++)
255  {
256  address_info_t *address_info = 0;
257  u32 valid_time;
259 
260  api_address = &mp->addresses[i];
261 
262  address = (ip6_address_t *) api_address->address;
263 
265  continue;
266 
267  valid_time = ntohl (api_address->valid_time);
268  preferred_time = ntohl (api_address->preferred_time);
269 
271  continue;
272 
273  u8 address_already_present = 0;
274  /* *INDENT-OFF* */
275  pool_foreach (address_info, rm->address_pool)
276  {
277  if (address_info->sw_if_index != sw_if_index)
278  ;
279  else if (!ip6_addresses_equal (&address_info->address, address))
280  ;
281  else
282  {
283  address_already_present = 1;
284  goto address_pool_foreach_out;
285  }
286  }
287  /* *INDENT-ON* */
288  address_pool_foreach_out:
289 
290  if (address_already_present)
291  {
292  address_info->preferred_lt = preferred_time;
293  address_info->valid_lt = valid_time;
294  address_info->due_time = current_time;
295  /* Renew the lease at the preferred time, if non-zero */
296  address_info->due_time += (preferred_time > 0) ?
298 
299  if (address_info->due_time > rm->max_valid_due_time)
300  rm->max_valid_due_time = address_info->due_time;
301  continue;
302  }
303 
304  if (valid_time == 0)
305  continue;
306 
307  pool_get (rm->address_pool, address_info);
308  address_info->sw_if_index = sw_if_index;
309  address_info->address = *address;
310  address_info->preferred_lt = preferred_time;
311  address_info->valid_lt = valid_time;
312  address_info->due_time = current_time;
313  /* Renew the lease at the preferred time, if non-zero */
314  address_info->due_time += (preferred_time > 0) ?
316 
317  if (address_info->due_time > rm->max_valid_due_time)
318  rm->max_valid_due_time = address_info->due_time;
320 
322  &address_info->address, 64, 0);
323  if (error)
324  clib_warning ("Failed to add interface address");
325  }
326 
327  client_state->server_index = server_index;
328  client_state->T1 = ntohl (mp->T1);
329  client_state->T2 = ntohl (mp->T2);
330  if (client_state->T1 != 0)
331  client_state->T1_due_time = current_time + client_state->T1;
332  if (client_state->T2 != 0)
333  client_state->T2_due_time = current_time + client_state->T2;
334  client_state->rebinding = 0;
335 
337 
338  return error;
339 }
340 
341 static address_info_t *
343 {
345  address_info_t *address_info, *address_list = 0;;
346 
347  /* *INDENT-OFF* */
348  pool_foreach (address_info, rm->address_pool)
349  {
350  if (address_info->sw_if_index == sw_if_index)
351  {
352  u32 pos = vec_len (address_list);
353  vec_validate (address_list, pos);
354  clib_memcpy (&address_list[pos], address_info, sizeof (*address_info));
355  }
356  }
357  /* *INDENT-ON* */
358 
359  return address_list;
360 }
361 
363 
364 static uword
366  vlib_frame_t * f)
367 {
369  address_info_t *address_info;
370  client_state_t *client_state;
371  f64 sleep_time = 1e9;
373  f64 current_time;
374  f64 due_time;
375  uword event_type;
376  uword *event_data = 0;
377  int i;
378 
379  while (1)
380  {
382  event_type = vlib_process_get_events (vm, &event_data);
383  vec_reset_length (event_data);
384 
385  if (event_type == RD_CP_EVENT_DISABLE)
386  {
387  vlib_node_set_state (vm, rm->node_index, VLIB_NODE_STATE_DISABLED);
388  sleep_time = 1e9;
389  continue;
390  }
391 
392  current_time = vlib_time_now (vm);
393  do
394  {
395  due_time = current_time + 1e9;
396  /* *INDENT-OFF* */
397  pool_foreach (address_info, rm->address_pool)
398  {
399  if (address_info->due_time > current_time)
400  {
401  if (address_info->due_time < due_time)
402  due_time = address_info->due_time;
403  }
404  else
405  {
406  u32 sw_if_index = address_info->sw_if_index;
408  &address_info->address,
409  64, 1);
410  if (error)
411  clib_warning ("Failed to delete interface address");
412  pool_put (rm->address_pool, address_info);
413  /* make sure ip6 stays enabled */
415  client_state = &rm->client_state_by_sw_if_index[sw_if_index];
416  if (--client_state->address_count == 0)
417  {
418  client_state->rebinding = 0;
419  client_state->server_index = ~0;
422  0, 1);
423  }
424  }
425  }
426  /* *INDENT-ON* */
427  for (i = 0; i < vec_len (rm->client_state_by_sw_if_index); i++)
428  {
430  if (cs->enabled && cs->server_index != ~0)
431  {
432  if (cs->T2_due_time > current_time)
433  {
434  if (cs->T2_due_time < due_time)
435  due_time = cs->T2_due_time;
436  if (cs->T1_due_time > current_time)
437  {
438  if (cs->T1_due_time < due_time)
439  due_time = cs->T1_due_time;
440  }
441  else
442  {
443  cs->T1_due_time = DBL_MAX;
444  address_info_t *address_list;
445  address_list = create_address_list (i);
446  cs->rebinding = 1;
449  address_list, 1);
450  vec_free (address_list);
451  }
452  }
453  else
454  {
455  cs->T2_due_time = DBL_MAX;
456  address_info_t *address_list;
457  address_list = create_address_list (i);
458  cs->rebinding = 1;
461  address_list, 1);
462  vec_free (address_list);
463  }
464  }
465  }
466  current_time = vlib_time_now (vm);
467  }
468  while (due_time < current_time);
469 
470  sleep_time = due_time - current_time;
471  }
472 
473  return 0;
474 }
475 
476 /* *INDENT-OFF* */
478  .function = dhcp6_client_cp_process,
479  .type = VLIB_NODE_TYPE_PROCESS,
480  .name = "dhcp6-client-cp-process",
481 };
482 /* *INDENT-ON* */
483 
484 static void
486 {
488  vlib_main_t *vm = rm->vlib_main;
489 
492 }
493 
494 static void
496 {
498  vlib_main_t *vm = rm->vlib_main;
499 
502 }
503 
504 static void
506 {
508  vlib_main_t *vm = rm->vlib_main;
509  vlib_node_t *node;
510 
512 
513  vlib_node_set_state (vm, rm->node_index, VLIB_NODE_STATE_POLLING);
514  vlib_start_process (vm, node->runtime_index);
515 }
516 
517 static clib_error_t *
519  unformat_input_t * input,
520  vlib_cli_command_t * cmd)
521 {
523  clib_error_t *error = 0;
524  address_info_t *address_info;
525  f64 current_time = vlib_time_now (vm);
526 
527  /* *INDENT-OFF* */
528  pool_foreach (address_info, dm->address_pool)
529  {
530  vlib_cli_output (vm, "address: %U, "
531  "preferred lifetime: %u, valid lifetime: %u "
532  "(%f remaining)",
533  format_ip6_address, &address_info->address,
534  address_info->preferred_lt, address_info->valid_lt,
535  address_info->due_time - current_time);
536  }
537  /* *INDENT-ON* */
538 
539  return error;
540 }
541 
542 /* *INDENT-OFF* */
544  .path = "show dhcp6 addresses",
545  .short_help = "show dhcp6 addresses",
547 };
548 /* *INDENT-ON* */
549 
550 static clib_error_t *
552  unformat_input_t * input,
553  vlib_cli_command_t * cmd)
554 {
556  clib_error_t *error = 0;
557  client_state_t *cs;
558  f64 current_time = vlib_time_now (vm);
559  u8 *buf1 = 0;
560  u8 *buf2 = 0;
561  const char *rebinding;
562  u32 i;
563 
564  for (i = 0; i < vec_len (rm->client_state_by_sw_if_index); i++)
565  {
566  cs = &rm->client_state_by_sw_if_index[i];
567  if (cs->enabled)
568  {
569  vec_reset_length (buf1);
570  vec_reset_length (buf2);
571  if (cs->T1_due_time != DBL_MAX && cs->T1_due_time > current_time)
572  {
573  buf1 = format (buf1, "%u remaining",
574  (u32) round (cs->T1_due_time - current_time));
575  }
576  else
577  buf1 = format (buf1, "timeout");
578  if (cs->T2_due_time != DBL_MAX && cs->T2_due_time > current_time)
579  buf2 = format (buf2, "%u remaining",
580  (u32) round (cs->T2_due_time - current_time));
581  else
582  buf2 = format (buf2, "timeout");
583  if (cs->rebinding)
584  rebinding = ", REBINDING";
585  else
586  rebinding = "";
587  if (cs->T1)
589  "sw_if_index: %u, T1: %u (%v), "
590  "T2: %u (%v), server index: %d%s", i,
591  cs->T1, buf1, cs->T2, buf2,
592  cs->server_index, rebinding);
593  else
594  vlib_cli_output (vm, "sw_if_index: %u%s", i, rebinding);
595  }
596  }
597 
598  vec_free (buf1);
599  vec_free (buf2);
600 
601  return error;
602 }
603 
604 /* *INDENT-OFF* */
606  .path = "show dhcp6 clients",
607  .short_help = "show dhcp6 clients",
609 };
610 /* *INDENT-ON* */
611 
612 int
614 {
616  vnet_main_t *vnm = rm->vnet_main;
617  vlib_main_t *vm = rm->vlib_main;
618  client_state_t *client_state;
619  client_state_t empty_config = { 0 };
620  address_info_t *address_info;
622 
624  {
625  clib_warning ("Invalid sw_if_index");
626  return 1;
627  }
628 
630  empty_config);
631  client_state = &rm->client_state_by_sw_if_index[sw_if_index];
632 
633  u8 old_enabled = client_state->enabled;
634  if (enable)
635  client_state->enabled = 1;
636  client_state->server_index = ~0;
637 
638  if (!old_enabled && enable)
639  {
640  rm->n_clients++;
641  if (rm->n_clients == 1)
642  {
643  enable_process ();
645  }
646 
649  0, 1);
650  }
651  else if (old_enabled && !enable)
652  {
654 
655  rm->n_clients--;
656  if (rm->n_clients == 0)
657  {
659  disable_process ();
660  }
661 
662  /* *INDENT-OFF* */
663  pool_foreach (address_info, rm->address_pool)
664  {
665  if (address_info->sw_if_index == sw_if_index)
666  {
669  client_state_t *client_state =
672  client_state->server_index,
673  DHCPV6_MSG_RELEASE, address_info,
674  1);
676  &address_info->address,
677  64, 1);
678  if (error)
679  clib_warning ("Failed to delete interface address");
680  pool_put (rm->address_pool, address_info);
681  }
682  }
683  /* *INDENT-ON* */
684  }
685 
686  if (!enable)
687  client_state->enabled = 0;
688 
689  return 0;
690 }
691 
692 static clib_error_t *
694  unformat_input_t * input,
695  vlib_cli_command_t * cmd)
696 {
698  vnet_main_t *vnm = rm->vnet_main;
699  clib_error_t *error = 0;
700  u32 sw_if_index = ~0;
701  u8 enable = 1;
702  unformat_input_t _line_input, *line_input = &_line_input;
703 
704  if (!unformat_user (input, unformat_line_input, line_input))
705  return 0;
706 
707  while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
708  {
709  if (unformat
710  (line_input, "%U", unformat_vnet_sw_interface, vnm, &sw_if_index))
711  ;
712  else if (unformat (line_input, "disable"))
713  enable = 0;
714  else
715  {
716  error = clib_error_return (0, "unexpected input `%U'",
717  format_unformat_error, line_input);
718  goto done;
719  }
720  }
721 
722  unformat_free (line_input);
723 
724  if (sw_if_index != ~0)
725  {
726  if (dhcp6_client_enable_disable (sw_if_index, enable) != 0)
727  error = clib_error_return (0, "Invalid sw_if_index");
728  }
729  else
730  error = clib_error_return (0, "Missing sw_if_index");
731 
732 done:
733  return error;
734 }
735 
736 /*?
737  * This command is used to enable/disable DHCPv6 client
738  * on particular interface.
739  *
740  * @cliexpar
741  * @parblock
742  * Example of how to enable DHCPv6 client:
743  * @cliexcmd{dhcp6 client GigabitEthernet2/0/0}
744  * Example of how to disable DHCPv6 client:
745  * @cliexcmd{dhcp6 client GigabitEthernet2/0/0 disable}
746  * @endparblock
747 ?*/
748 /* *INDENT-OFF* */
750  .path = "dhcp6 client",
751  .short_help = "dhcp6 client <interface> [disable]",
753 };
754 /* *INDENT-ON* */
755 
756 static clib_error_t *
758 {
760 
761  rm->vlib_main = vm;
762  rm->vnet_main = vnet_get_main ();
763  rm->api_main = vlibapi_get_main ();
765 
766  return NULL;
767 }
768 
770 
771 /*
772  * fd.io coding-style-patch-verification: ON
773  *
774  * Local Variables:
775  * eval: (c-set-style "gnu")
776  * End:
777  */
vec_reset_length
#define vec_reset_length(v)
Reset vector length to zero NULL-pointer tolerant.
Definition: vec_bootstrap.h:194
ip6_address_is_link_local_unicast
static uword ip6_address_is_link_local_unicast(const ip6_address_t *a)
Definition: ip6_packet.h:253
dhcp_ia_na_client_cp_init
static clib_error_t * dhcp_ia_na_client_cp_init(vlib_main_t *vm)
Definition: dhcp6_ia_na_client_cp.c:757
DHCPV6_MSG_API_REPLY
@ DHCPV6_MSG_API_REPLY
Definition: dhcp.api:43
RD_CP_EVENT_INTERRUPT
@ RD_CP_EVENT_INTERRUPT
Definition: dhcp6_ia_na_client_cp.c:65
DHCPV6_MSG_REBIND
@ DHCPV6_MSG_REBIND
Definition: dhcp6_packet.h:41
api.h
unformat_user
uword unformat_user(unformat_input_t *input, unformat_function_t *func,...)
Definition: unformat.c:989
ntohs
#define ntohs(x)
Definition: af_xdp.bpf.c:29
dhcp6_client_enable_disable_command_fn
static clib_error_t * dhcp6_client_enable_disable_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
Definition: dhcp6_ia_na_client_cp.c:693
client_state_t::T1
u32 T1
Definition: dhcp6_ia_na_client_cp.c:39
dhcp6_client_cp_main
static dhcp6_client_cp_main_t dhcp6_client_cp_main
Definition: dhcp6_ia_na_client_cp.c:61
enable_process
static void enable_process(void)
Definition: dhcp6_ia_na_client_cp.c:505
clib_memcpy
#define clib_memcpy(d, s, n)
Definition: string.h:197
create_address_list
static address_info_t * create_address_list(u32 sw_if_index)
Definition: dhcp6_ia_na_client_cp.c:342
vl_api_dhcp6_reply_event_t::n_addresses
u32 n_addresses
Definition: dhcp.api:471
VNET_DHCP6_REPLY_EVENT_FUNCTION
VNET_DHCP6_REPLY_EVENT_FUNCTION(dhcp6_reply_event_handler)
f
vlib_frame_t * f
Definition: interface_output.c:1098
dhcp6_client_cp_main_t::max_valid_due_time
f64 max_valid_due_time
Definition: dhcp6_ia_na_client_cp.c:52
unformat_line_input
unformat_function_t unformat_line_input
Definition: format.h:275
vlib_node_set_state
static void vlib_node_set_state(vlib_main_t *vm, u32 node_index, vlib_node_state_t new_state)
Set node dispatch state.
Definition: node_funcs.h:175
dhcp6_send_client_message_params_t::sw_if_index
u32 sw_if_index
Definition: dhcp6_ia_na_client_dp.h:32
preferred_time
u32 preferred_time
Definition: dhcp.api:313
DHCPV6_STATUS_NOADDRS_AVAIL
@ DHCPV6_STATUS_NOADDRS_AVAIL
Definition: dhcp6_packet.h:97
dhcp6_client_enable_disable
int dhcp6_client_enable_disable(u32 sw_if_index, u8 enable)
Definition: dhcp6_ia_na_client_cp.c:613
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
node
vlib_main_t vlib_node_runtime_t * node
Definition: nat44_ei.c:3047
vl_api_dhcp6_reply_event_t::msg_type
vl_api_dhcpv6_msg_type_t msg_type
Definition: dhcp.api:465
clib_error_return
#define clib_error_return(e, args...)
Definition: error.h:99
client_state_t::server_index
u32 server_index
Definition: dhcp6_ia_na_client_cp.c:38
vlib_cli_command_t::path
char * path
Definition: cli.h:96
dhcp6_client_cp_main_t::n_clients
u32 n_clients
Definition: dhcp6_ia_na_client_cp.c:51
dhcp6_client_cp_main_t::node_index
u32 node_index
Definition: dhcp6_ia_na_client_cp.c:58
vl_api_dhcp6_reply_event_t::sw_if_index
vl_api_interface_index_t sw_if_index
Definition: dhcp.api:463
vlib_main_t::node_main
vlib_node_main_t node_main
Definition: main.h:173
valid_time
u32 valid_time
Definition: dhcp.api:312
pool_put
#define pool_put(P, E)
Free an object E in pool P.
Definition: pool.h:305
client_state_t::address_count
u32 address_count
Definition: dhcp6_ia_na_client_cp.c:43
vm
vlib_main_t * vm
X-connect all packets from the HOST to the PHY.
Definition: nat44_ei.c:3047
vl_api_dhcp6_reply_event_t::status_code
u16 status_code
Definition: dhcp.api:469
vl_api_dhcp6_reply_event_t::T2
u32 T2
Definition: dhcp.api:467
unformat_input_t
struct _unformat_input_t unformat_input_t
addr
vhost_vring_addr_t addr
Definition: vhost_user.h:130
vlib_frame_t
Definition: node.h:372
vlib_process_signal_event
static void vlib_process_signal_event(vlib_main_t *vm, uword node_index, uword type_opaque, uword data)
Definition: node_funcs.h:1019
vlib_start_process
void vlib_start_process(vlib_main_t *vm, uword process_index)
Definition: main.c:1416
dhcp6_client_cp_main_t::address_pool
address_info_t * address_pool
Definition: dhcp6_ia_na_client_cp.c:49
error
Definition: cJSON.c:88
i32
signed int i32
Definition: types.h:77
DHCPV6_MSG_RELEASE
@ DHCPV6_MSG_RELEASE
Definition: dhcp6_packet.h:43
dhcp6_send_client_message_params_t::addresses
dhcp6_send_client_message_params_address_t * addresses
Definition: dhcp6_ia_na_client_dp.h:41
vnet_sw_interface_is_api_valid
static uword vnet_sw_interface_is_api_valid(vnet_main_t *vnm, u32 sw_if_index)
Definition: interface_funcs.h:285
unformat
uword unformat(unformat_input_t *i, const char *fmt,...)
Definition: unformat.c:978
interrupt_process
static void interrupt_process(void)
Definition: dhcp6_ia_na_client_cp.c:485
dhcp6_send_client_message_params_t::T2
u32 T2
Definition: dhcp6_ia_na_client_dp.h:40
vec_elt
#define vec_elt(v, i)
Get vector value at index i.
Definition: vec_bootstrap.h:210
vlib_process_get_events
static uword vlib_process_get_events(vlib_main_t *vm, uword **data_vector)
Return the first event type which has occurred and a vector of per-event data of that type,...
Definition: node_funcs.h:583
dhcp6_clients_show_command_function
static clib_error_t * dhcp6_clients_show_command_function(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
Definition: dhcp6_ia_na_client_cp.c:551
pool_foreach
#define pool_foreach(VAR, POOL)
Iterate through pool.
Definition: pool.h:534
address_info_t
Definition: dhcp6_ia_na_client_cp.c:26
ip6_add_del_interface_address
clib_error_t * ip6_add_del_interface_address(vlib_main_t *vm, u32 sw_if_index, ip6_address_t *address, u32 address_length, u32 is_del)
Definition: ip6_forward.c:298
vec_len
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
Definition: vec_bootstrap.h:142
unformat_free
static void unformat_free(unformat_input_t *i)
Definition: format.h:155
math.h
client_state_t::T2_due_time
f64 T2_due_time
Definition: dhcp6_ia_na_client_cp.c:42
vl_api_dhcp6_reply_event_t::server_index
u32 server_index
Definition: dhcp.api:464
dhcp6_send_client_message_params_address_t
Definition: dhcp6_ia_na_client_dp.h:23
vnet_get_main
vnet_main_t * vnet_get_main(void)
Definition: pnat_test_stubs.h:56
vl_api_dhcp6_reply_event_t
Tell client about a DHCPv6 server reply event.
Definition: dhcp.api:459
address_info_t::due_time
f64 due_time
Definition: dhcp6_ia_na_client_cp.c:32
unformat_check_input
static uword unformat_check_input(unformat_input_t *i)
Definition: format.h:163
dhcp6_client_cp_main_t::vlib_main
vlib_main_t * vlib_main
Definition: dhcp6_ia_na_client_cp.c:55
dhcp6_client_cp_main_t
Definition: dhcp6_ia_na_client_cp.c:47
uword
u64 uword
Definition: types.h:112
if
if(node->flags &VLIB_NODE_FLAG_TRACE) vnet_interface_output_trace(vm
dhcp6_ia_na_client_dp.h
dhcp6_reply_event_handler
static clib_error_t * dhcp6_reply_event_handler(vl_api_dhcp6_reply_event_t *mp)
Definition: dhcp6_ia_na_client_cp.c:156
dhcp6_send_client_message_params_t::mrt
u32 mrt
Definition: dhcp6_ia_na_client_dp.h:35
vlibapi_get_main
static api_main_t * vlibapi_get_main(void)
Definition: api_common.h:390
f64
double f64
Definition: types.h:142
format_unformat_error
u8 * format_unformat_error(u8 *s, va_list *va)
Definition: unformat.c:91
pool_get
#define pool_get(P, E)
Allocate an object E from a pool P (unspecified alignment).
Definition: pool.h:255
DHCPV6_MSG_RENEW
@ DHCPV6_MSG_RENEW
Definition: dhcp6_packet.h:40
address_info_t::preferred_lt
u32 preferred_lt
Definition: dhcp6_ia_na_client_cp.c:30
vec_validate
#define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment)
Definition: vec.h:523
address
manual_print typedef address
Definition: ip_types.api:96
VLIB_CLI_COMMAND
#define VLIB_CLI_COMMAND(x,...)
Definition: cli.h:163
client_state_t::T2
u32 T2
Definition: dhcp6_ia_na_client_cp.c:40
vlib_node_registration_t
struct _vlib_node_registration vlib_node_registration_t
vlib_cli_output
void vlib_cli_output(vlib_main_t *vm, char *fmt,...)
Definition: cli.c:716
dhcp6_addresses_show_command_function
static clib_error_t * dhcp6_addresses_show_command_function(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
Definition: dhcp6_ia_na_client_cp.c:518
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
api_main_t
API main structure, used by both vpp and binary API clients.
Definition: api_common.h:228
dhcp6_client_cp_main_t::api_main
api_main_t * api_main
Definition: dhcp6_ia_na_client_cp.c:57
dhcp6_client_cp_main_t::vnet_main
vnet_main_t * vnet_main
Definition: dhcp6_ia_na_client_cp.c:56
dhcp6_send_client_message_params_t
Definition: dhcp6_ia_na_client_dp.h:30
address_info_t::address
ip6_address_t address
Definition: dhcp6_ia_na_client_cp.c:29
disable_process
static void disable_process(void)
Definition: dhcp6_ia_na_client_cp.c:495
vnet_main_t
Definition: vnet.h:76
vec_free
#define vec_free(V)
Free vector's memory (no header).
Definition: vec.h:395
vl_api_dhcp6_reply_event_t::inner_status_code
u16 inner_status_code
Definition: dhcp.api:468
dhcp6_addresses_show_command
static vlib_cli_command_t dhcp6_addresses_show_command
(constructor) VLIB_CLI_COMMAND (dhcp6_addresses_show_command)
Definition: dhcp6_ia_na_client_cp.c:543
unformat_vnet_sw_interface
unformat_function_t unformat_vnet_sw_interface
Definition: interface_funcs.h:462
vlib_process_wait_for_event_or_clock
static f64 vlib_process_wait_for_event_or_clock(vlib_main_t *vm, f64 dt)
Suspend a cooperative multi-tasking thread Waits for an event, or for the indicated number of seconds...
Definition: node_funcs.h:755
format
description fragment has unexpected format
Definition: map.api:433
ASSERT
#define ASSERT(truth)
Definition: error_bootstrap.h:69
vec_validate_init_empty
#define vec_validate_init_empty(V, I, INIT)
Make sure vector is long enough for given index and initialize empty space (no header,...
Definition: vec.h:570
client_state_t::enabled
u8 enabled
Definition: dhcp6_ia_na_client_cp.c:37
ip.h
u32
unsigned int u32
Definition: types.h:88
VLIB_INIT_FUNCTION
#define VLIB_INIT_FUNCTION(x)
Definition: init.h:172
dhcp6_clients_enable_disable
void dhcp6_clients_enable_disable(u8 enable)
Definition: dhcp6_client_common_dp.c:448
VLIB_NODE_TYPE_PROCESS
@ VLIB_NODE_TYPE_PROCESS
Definition: node.h:84
vl_api_dhcp6_reply_event_t::addresses
vl_api_dhcp6_address_info_t addresses[n_addresses]
Definition: dhcp.api:472
RD_CP_EVENT_DISABLE
@ RD_CP_EVENT_DISABLE
Definition: dhcp6_ia_na_client_cp.c:66
vl_api_dhcp6_reply_event_t::T1
u32 T1
Definition: dhcp.api:466
dhcp6_client_cp_process_node
vlib_node_registration_t dhcp6_client_cp_process_node
(constructor) VLIB_REGISTER_NODE (dhcp6_client_cp_process_node)
Definition: dhcp6_ia_na_client_cp.c:477
vlib_main_t
Definition: main.h:102
vlib_node_t
Definition: node.h:247
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
DHCPV6_MSG_SOLICIT
@ DHCPV6_MSG_SOLICIT
Definition: dhcp6_packet.h:36
clib_error_t
Definition: clib_error.h:21
rt
vnet_interface_output_runtime_t * rt
Definition: interface_output.c:419
address_info_t::sw_if_index
u32 sw_if_index
Definition: dhcp6_ia_na_client_cp.c:28
DHCPV6_STATUS_UNSPEC_FAIL
@ DHCPV6_STATUS_UNSPEC_FAIL
Definition: dhcp6_packet.h:96
vlib_init_function_t
clib_error_t *() vlib_init_function_t(struct vlib_main_t *vm)
Definition: init.h:51
format_ip6_address
format_function_t format_ip6_address
Definition: format.h:91
i
int i
Definition: flowhash_template.h:376
dhcp6_packet.h
clib_warning
#define clib_warning(format, args...)
Definition: error.h:59
DHCPV6_MSG_API_ADVERTISE
@ DHCPV6_MSG_API_ADVERTISE
Definition: dhcp.api:38
vlib_time_now
static f64 vlib_time_now(vlib_main_t *vm)
Definition: main.h:327
client_state_t::T1_due_time
f64 T1_due_time
Definition: dhcp6_ia_na_client_cp.c:41
dhcp6_client_cp_main_t::client_state_by_sw_if_index
client_state_t * client_state_by_sw_if_index
Definition: dhcp6_ia_na_client_cp.c:50
vnet.h
ip6_addresses_equal
static u8 ip6_addresses_equal(ip6_address_t *address1, ip6_address_t *address2)
Definition: dhcp6_ia_na_client_cp.c:148
vlib_node_runtime_t
Definition: node.h:454
vlib_node_main_t::nodes
vlib_node_t ** nodes
Definition: node.h:668
vlib_cli_command_t
Definition: cli.h:92
address_info_t::valid_lt
u32 valid_lt
Definition: dhcp6_ia_na_client_cp.c:31
client_state_t
Definition: dhcp6_ia_na_client_cp.c:35
sw_if_index
vl_api_interface_index_t sw_if_index
Definition: wireguard.api:34
ip6.h
dhcp6_send_client_message_params_t::T1
u32 T1
Definition: dhcp6_ia_na_client_dp.h:39
dhcp6_send_client_message_params_t::server_index
u32 server_index
Definition: dhcp6_ia_na_client_dp.h:33
send_client_message_start_stop
static void send_client_message_start_stop(u32 sw_if_index, u32 server_index, u8 msg_type, address_info_t *address_list, u8 start)
Definition: dhcp6_ia_na_client_cp.c:70
client_state_t::rebinding
u8 rebinding
Definition: dhcp6_ia_na_client_cp.c:44
dhcp6_client_cp_process
static uword dhcp6_client_cp_process(vlib_main_t *vm, vlib_node_runtime_t *rt, vlib_frame_t *f)
Definition: dhcp6_ia_na_client_cp.c:365
DHCPV6_MSG_REQUEST
@ DHCPV6_MSG_REQUEST
Definition: dhcp6_packet.h:38
dhcp6_client_enable_disable_command
static vlib_cli_command_t dhcp6_client_enable_disable_command
(constructor) VLIB_CLI_COMMAND (dhcp6_client_enable_disable_command)
Definition: dhcp6_ia_na_client_cp.c:749
UNFORMAT_END_OF_INPUT
#define UNFORMAT_END_OF_INPUT
Definition: format.h:137
dhcp6_send_client_message_params_t::mrc
u32 mrc
Definition: dhcp6_ia_na_client_dp.h:36
dhcp6_clients_show_command
static vlib_cli_command_t dhcp6_clients_show_command
(constructor) VLIB_CLI_COMMAND (dhcp6_clients_show_command)
Definition: dhcp6_ia_na_client_cp.c:605
VLIB_REGISTER_NODE
#define VLIB_REGISTER_NODE(x,...)
Definition: node.h:169