dhcpv6_client_fsm.c
Go to the documentation of this file.
1 /**
2  * @file dhcpv6_client_fsm.c
3  * @brief DHCPv6 client finite state machine
4  *
5  * @section License
6  *
7  * SPDX-License-Identifier: GPL-2.0-or-later
8  *
9  * Copyright (C) 2010-2024 Oryx Embedded SARL. All rights reserved.
10  *
11  * This file is part of CycloneTCP Open.
12  *
13  * This program is free software; you can redistribute it and/or
14  * modify it under the terms of the GNU General Public License
15  * as published by the Free Software Foundation; either version 2
16  * of the License, or (at your option) any later version.
17  *
18  * This program is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21  * GNU General Public License for more details.
22  *
23  * You should have received a copy of the GNU General Public License
24  * along with this program; if not, write to the Free Software Foundation,
25  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
26  *
27  * @author Oryx Embedded SARL (www.oryx-embedded.com)
28  * @version 2.4.4
29  **/
30 
31 //Switch to the appropriate trace level
32 #define TRACE_LEVEL DHCPV6_TRACE_LEVEL
33 
34 //Dependencies
35 #include "core/net.h"
36 #include "ipv6/ipv6.h"
37 #include "ipv6/ipv6_misc.h"
38 #include "dhcpv6/dhcpv6_client.h"
41 #include "dhcpv6/dhcpv6_common.h"
42 #include "dhcpv6/dhcpv6_debug.h"
43 #include "debug.h"
44 
45 //Check TCP/IP stack configuration
46 #if (IPV6_SUPPORT == ENABLED && DHCPV6_CLIENT_SUPPORT == ENABLED)
47 
48 
49 /**
50  * @brief INIT state
51  *
52  * This is the initialization state, where a client begins the process of
53  * acquiring a lease. It also returns here when a lease ends, or when a
54  * lease negotiation fails
55  *
56  * @param[in] context Pointer to the DHCPv6 client context
57  **/
58 
60 {
61  systime_t delay;
62  NetInterface *interface;
63 
64  //Point to the underlying network interface
65  interface = context->settings.interface;
66 
67  //Check whether the DHCPv6 client is running
68  if(context->running)
69  {
70  //Wait for the link to be up before starting DHCPv6 configuration
71  if(interface->linkState)
72  {
73  //Make sure that a valid link-local address has been assigned to the
74  //interface
76  {
77  //Flush the list of IPv6 addresses from the client's IA
79 
80  //The first Solicit message from the client on the interface must be
81  //delayed by a random amount of time between 0 and SOL_MAX_DELAY
83 
84  //Record the time at which the client started
85  //the address acquisition process
86  context->configStartTime = osGetSystemTime();
87  //Clear flag
88  context->timeoutEventDone = FALSE;
89 
90  //Switch to the SOLICIT state
92  }
93  }
94  }
95 }
96 
97 
98 /**
99  * @brief SOLICIT state
100  *
101  * A client uses the Solicit message to discover DHCPv6 servers
102  *
103  * @param[in] context Pointer to the DHCPv6 client context
104  **/
105 
107 {
108  systime_t time;
109 
110  //Get current time
111  time = osGetSystemTime();
112 
113  //Check current time
114  if(timeCompare(time, context->timestamp + context->timeout) >= 0)
115  {
116  //Check retransmission counter
117  if(context->retransmitCount == 0)
118  {
119  //Reset server preference value
120  context->serverPreference = -1;
121  //Generate a 24-bit transaction ID
122  context->transactionId = netGenerateRand() & 0x00FFFFFF;
123 
124  //Send a Solicit message
126 
127  //Save the time at which the message was sent
128  context->exchangeStartTime = time;
129  context->timestamp = time;
130 
131  //If the client is waiting for an Advertise message, the first RT must
132  //be selected to be strictly greater than IRT
135 
136  //Increment retransmission counter
137  context->retransmitCount++;
138  }
139  else
140  {
141  //Check whether a valid Advertise message has been received
142  if(context->serverPreference >= 0)
143  {
144  //Continue configuration procedure
146  }
147  else
148  {
149  //Send a Solicit message
151 
152  //Save the time at which the message was sent
153  context->timestamp = time;
154 
155  //The RT is doubled for each subsequent retransmission
156  context->timeout = netGenerateRandRange(
157  context->timeout * 2 - context->timeout / 10,
158  context->timeout * 2 + context->timeout / 10);
159 
160  //MRT specifies an upper bound on the value of RT
161  if(context->timeout > DHCPV6_CLIENT_SOL_MAX_RT)
162  {
163  //Each computation of a new RT includes a randomization factor
164  context->timeout = netGenerateRandRange(
167  }
168 
169  //Increment retransmission counter
170  context->retransmitCount++;
171  }
172  }
173  }
174 
175  //Manage DHCPv6 configuration timeout
176  dhcpv6ClientCheckTimeout(context);
177 }
178 
179 
180 /**
181  * @brief REQUEST state
182  *
183  * The client uses a Request message to populate IAs with addresses and obtain
184  * other configuration information. The client includes one or more more IA
185  * options in the Request message. The server then returns addresses and other
186  * information about the IAs to the client in IA options in a Reply message
187  *
188  * @param[in] context Pointer to the DHCPv6 client context
189  **/
190 
192 {
193  systime_t time;
194 
195  //Get current time
196  time = osGetSystemTime();
197 
198  //Check current time
199  if(timeCompare(time, context->timestamp + context->timeout) >= 0)
200  {
201  //Check retransmission counter
202  if(context->retransmitCount == 0)
203  {
204  //Generate a 24-bit transaction ID
205  context->transactionId = netGenerateRand() & 0x00FFFFFF;
206 
207  //Send a Request message
209 
210  //Save the time at which the message was sent
211  context->exchangeStartTime = time;
212  context->timestamp = time;
213 
214  //Initial retransmission timeout
215  context->timeout = netGenerateRandRange(
218 
219  //Increment retransmission counter
220  context->retransmitCount++;
221  }
222  else if(context->retransmitCount < DHCPV6_CLIENT_REQ_MAX_RC)
223  {
224  //Send a Request message
226 
227  //Save the time at which the message was sent
228  context->timestamp = time;
229 
230  //The RT is doubled for each subsequent retransmission
231  context->timeout = netGenerateRandRange(
232  context->timeout * 2 - context->timeout / 10,
233  context->timeout * 2 + context->timeout / 10);
234 
235  //MRT specifies an upper bound on the value of RT
236  if(context->timeout > DHCPV6_CLIENT_REQ_MAX_RT)
237  {
238  //Each computation of a new RT includes a randomization factor
239  context->timeout = netGenerateRandRange(
242  }
243 
244  //Increment retransmission counter
245  context->retransmitCount++;
246  }
247  else
248  {
249  //If the client does not receive a response within a reasonable period
250  //of time, then it restarts the initialization procedure
252  }
253  }
254 
255  //Manage DHCPv6 configuration timeout
256  dhcpv6ClientCheckTimeout(context);
257 }
258 
259 
260 /**
261  * @brief INIT-CONFIRM state
262  *
263  * When a client that already has a valid lease starts up after a power-down
264  * or reboot, it starts here instead of the INIT state
265  *
266  * @param[in] context Pointer to the DHCPv6 client context
267  **/
268 
270 {
271  systime_t delay;
272  NetInterface *interface;
273 
274  //Point to the underlying network interface
275  interface = context->settings.interface;
276 
277  //Check whether the DHCPv6 client is running
278  if(context->running)
279  {
280  //Wait for the link to be up before starting DHCPv6 configuration
281  if(interface->linkState)
282  {
283  //Make sure that a valid link-local address has been assigned to the
284  //interface
286  {
287  //The first Confirm message from the client on the interface must be
288  //delayed by a random amount of time between 0 and CNF_MAX_DELAY
290 
291  //Record the time at which the client started the address
292  //acquisition process
293  context->configStartTime = osGetSystemTime();
294  //Clear flag
295  context->timeoutEventDone = FALSE;
296 
297  //Switch to the CONFIRM state
299  }
300  }
301  }
302 }
303 
304 
305 /**
306  * @brief CONFIRM state
307  *
308  * Whenever a client may have moved to a new link, the prefixes from the
309  * addresses assigned to the interfaces on that link may no longer be
310  * appropriate for the link to which the client is attached. In such the
311  * client must initiate a Confirm/Reply message exchange
312  *
313  * @param[in] context Pointer to the DHCPv6 client context
314  **/
315 
317 {
318  systime_t time;
319 
320  //Get current time
321  time = osGetSystemTime();
322 
323  //Check current time
324  if(timeCompare(time, context->timestamp + context->timeout) >= 0)
325  {
326  //Check retransmission counter
327  if(context->retransmitCount == 0)
328  {
329  //Generate a 24-bit transaction ID
330  context->transactionId = netGenerateRand() & 0x00FFFFFF;
331 
332  //Send a Confirm message
334 
335  //Save the time at which the client sent the first message
336  context->exchangeStartTime = time;
337  context->timestamp = time;
338 
339  //Initial retransmission timeout
340  context->timeout = netGenerateRandRange(
343 
344  //Increment retransmission counter
345  context->retransmitCount++;
346  }
347  else
348  {
349  //Send a Confirm message
351 
352  //Save the time at which the message was sent
353  context->timestamp = time;
354 
355  //The RT is doubled for each subsequent retransmission
356  context->timeout = netGenerateRandRange(
357  context->timeout * 2 - context->timeout / 10,
358  context->timeout * 2 + context->timeout / 10);
359 
360  //MRT specifies an upper bound on the value of RT
361  if(context->timeout > DHCPV6_CLIENT_CNF_MAX_RT)
362  {
363  //Each computation of a new RT includes a randomization factor
364  context->timeout = netGenerateRandRange(
367  }
368 
369  //Increment retransmission counter
370  context->retransmitCount++;
371  }
372  }
373  else
374  {
375  //Check retransmission counter
376  if(context->retransmitCount > 0)
377  {
378  //The message exchange fails once MRD seconds have elapsed since the
379  //client first transmitted the message
380  if(timeCompare(time, context->exchangeStartTime + DHCPV6_CLIENT_CNF_MAX_RD) >= 0)
381  {
382  //If the client receives no responses before the message transmission
383  //process terminates, the client should continue to use any IP
384  //addresses using the last known lifetimes for those addresses
386  }
387  }
388  }
389 
390  //Manage DHCPv6 configuration timeout
391  dhcpv6ClientCheckTimeout(context);
392 }
393 
394 
395 /**
396  * @brief DAD state
397  *
398  * The client perform duplicate address detection on each of the addresses
399  * in any IAs it receives in the Reply message before using that address for
400  * traffic
401  *
402  * @param[in] context Pointer to the DHCPv6 client context
403  **/
404 
406 {
407  uint_t i;
408  NetInterface *interface;
409  Ipv6AddrState state;
410  Dhcpv6ClientAddrEntry *entry;
411 
412  //Point to the underlying network interface
413  interface = context->settings.interface;
414 
415  //Loop through the IPv6 addresses recorded by the DHCPv6 client
416  for(i = 0; i < DHCPV6_CLIENT_ADDR_LIST_SIZE; i++)
417  {
418  //Point to the current entry
419  entry = &context->ia.addrList[i];
420 
421  //Check the IPv6 address is a tentative address?
422  if(entry->validLifetime > 0)
423  {
424  //Get the state of the current IPv6 address
425  state = ipv6GetAddrState(interface, &entry->addr);
426 
427  //Duplicate Address Detection in progress?
428  if(state == IPV6_ADDR_STATE_TENTATIVE)
429  {
430  //Exit immediately
431  return;
432  }
433  //Duplicate Address Detection failed?
434  else if(state == IPV6_ADDR_STATE_INVALID)
435  {
436  //Switch to the DECLINE state
438  //Exit immediately
439  return;
440  }
441  }
442  }
443 
444  //Dump current DHCPv6 configuration for debugging purpose
445  dhcpv6ClientDumpConfig(context);
446  //Switch to the BOUND state
448 }
449 
450 
451 /**
452  * @brief BOUND state
453  *
454  * Client has a valid lease and is in its normal operating state
455  *
456  * @param[in] context Pointer to the DHCPv6 client context
457  **/
458 
460 {
461  systime_t t1;
462  systime_t time;
463 
464  //Get current time
465  time = osGetSystemTime();
466 
467  //A client will never attempt to extend the lifetime of any address in an
468  //IA with T1 set to 0xffffffff
469  if(context->ia.t1 != DHCPV6_INFINITE_TIME)
470  {
471  //Convert T1 to milliseconds
472  if(context->ia.t1 < (MAX_DELAY / 1000))
473  {
474  t1 = context->ia.t1 * 1000;
475  }
476  else
477  {
478  t1 = MAX_DELAY;
479  }
480 
481  //Check the time elapsed since the lease was obtained
482  if(timeCompare(time, context->leaseStartTime + t1) >= 0)
483  {
484  //Record the time at which the client started the address renewal
485  //process
486  context->configStartTime = time;
487 
488  //Enter the RENEW state
490  }
491  }
492 }
493 
494 
495 /**
496  * @brief RENEW state
497  *
498  * The client sends a Renew message to the server that originally provided
499  * the client's addresses and configuration parameters to extend the lifetimes
500  * on the addresses assigned to the client and to update other configuration
501  * parameters
502  *
503  * @param[in] context Pointer to the DHCPv6 client context
504  **/
505 
507 {
508  systime_t t2;
509  systime_t time;
510 
511  //Get current time
512  time = osGetSystemTime();
513 
514  //Check current time
515  if(timeCompare(time, context->timestamp + context->timeout) >= 0)
516  {
517  //Check retransmission counter
518  if(context->retransmitCount == 0)
519  {
520  //Generate a 24-bit transaction ID
521  context->transactionId = netGenerateRand() & 0x00FFFFFF;
522 
523  //Send a Renew message
525 
526  //Save the time at which the message was sent
527  context->exchangeStartTime = time;
528  context->timestamp = time;
529 
530  //Initial retransmission timeout
531  context->timeout = netGenerateRandRange(
534  }
535  else
536  {
537  //Send a Renew message
539 
540  //Save the time at which the message was sent
541  context->timestamp = time;
542 
543  //The RT is doubled for each subsequent retransmission
544  context->timeout = netGenerateRandRange(
545  context->timeout * 2 - context->timeout / 10,
546  context->timeout * 2 + context->timeout / 10);
547 
548  //MRT specifies an upper bound on the value of RT
549  if(context->timeout > DHCPV6_CLIENT_REN_MAX_RT)
550  {
551  //Each computation of a new RT includes a randomization factor
552  context->timeout = netGenerateRandRange(
555  }
556  }
557 
558  //Increment retransmission counter
559  context->retransmitCount++;
560  }
561  else
562  {
563  //A client will never attempt to use a Rebind message to locate a
564  //different server to extend the lifetime of any address in an IA
565  //with T2 set to 0xffffffff
566  if(context->ia.t2 != DHCPV6_INFINITE_TIME)
567  {
568  //Convert T2 to milliseconds
569  if(context->ia.t2 < (MAX_DELAY / 1000))
570  {
571  t2 = context->ia.t2 * 1000;
572  }
573  else
574  {
575  t2 = MAX_DELAY;
576  }
577 
578  //Check whether T2 timer has expired
579  if(timeCompare(time, context->leaseStartTime + t2) >= 0)
580  {
581  //Switch to the REBIND state
583  }
584  }
585  }
586 }
587 
588 
589 /**
590  * @brief REBIND state
591  *
592  * The client sends a Rebind message to any available server to extend the
593  * lifetimes on the addresses assigned to the client and to update other
594  * configuration parameters. This message is sent after a client receives no
595  * response to a Renew message
596  *
597  * @param[in] context Pointer to the DHCPv6 client context
598  **/
599 
601 {
602  uint_t i;
603  systime_t time;
604  NetInterface *interface;
605  Dhcpv6ClientAddrEntry *entry;
606 
607  //Point to the underlying network interface
608  interface = context->settings.interface;
609 
610  //Get current time
611  time = osGetSystemTime();
612 
613  //Check current time
614  if(timeCompare(time, context->timestamp + context->timeout) >= 0)
615  {
616  //Check retransmission counter
617  if(context->retransmitCount == 0)
618  {
619  //Generate a 24-bit transaction ID
620  context->transactionId = netGenerateRand() & 0x00FFFFFF;
621 
622  //Send a Rebind message
624 
625  //Save the time at which the message was sent
626  context->exchangeStartTime = time;
627  context->timestamp = time;
628 
629  //Initial retransmission timeout
630  context->timeout = netGenerateRandRange(
633  }
634  else
635  {
636  //Send a Rebind message
638 
639  //Save the time at which the message was sent
640  context->timestamp = time;
641 
642  //The RT is doubled for each subsequent retransmission
643  context->timeout = netGenerateRandRange(
644  context->timeout * 2 - context->timeout / 10,
645  context->timeout * 2 + context->timeout / 10);
646 
647  //MRT specifies an upper bound on the value of RT
648  if(context->timeout > DHCPV6_CLIENT_REB_MAX_RT)
649  {
650  //Each computation of a new RT includes a randomization factor
651  context->timeout = netGenerateRandRange(
654  }
655  }
656 
657  //Increment retransmission counter
658  context->retransmitCount++;
659  }
660  else
661  {
662  //Loop through the IPv6 addresses recorded by the DHCPv6 client
663  for(i = 0; i < DHCPV6_CLIENT_ADDR_LIST_SIZE; i++)
664  {
665  //Point to the current entry
666  entry = &context->ia.addrList[i];
667 
668  //Valid IPv6 address?
669  if(entry->validLifetime > 0)
670  {
671  //Check whether the valid lifetime has expired
672  if(ipv6GetAddrState(interface, &entry->addr) == IPV6_ADDR_STATE_INVALID)
673  {
674  //Restart DHCPv6 configuration
676  }
677  }
678  }
679  }
680 }
681 
682 
683 /**
684  * @brief RELEASE state
685  *
686  * To release one or more addresses, a client sends a Release message to the
687  * server
688  *
689  * @param[in] context Pointer to the DHCPv6 client context
690  **/
691 
693 {
694  systime_t time;
695 
696  //Get current time
697  time = osGetSystemTime();
698 
699  //Check current time
700  if(timeCompare(time, context->timestamp + context->timeout) >= 0)
701  {
702  //Check retransmission counter
703  if(context->retransmitCount == 0)
704  {
705  //Generate a 24-bit transaction ID
706  context->transactionId = netGenerateRand() & 0x00FFFFFF;
707 
708  //Send a Release message
710 
711  //Save the time at which the message was sent
712  context->exchangeStartTime = time;
713  context->timestamp = time;
714 
715  //Initial retransmission timeout
716  context->timeout = netGenerateRandRange(
719 
720  //Increment retransmission counter
721  context->retransmitCount++;
722  }
723  else if(context->retransmitCount < DHCPV6_CLIENT_REL_MAX_RC)
724  {
725  //Send a Release message
727 
728  //Save the time at which the message was sent
729  context->timestamp = time;
730 
731  //The RT is doubled for each subsequent retransmission
732  context->timeout = netGenerateRandRange(
733  context->timeout * 2 - context->timeout / 10,
734  context->timeout * 2 + context->timeout / 10);
735 
736  //Increment retransmission counter
737  context->retransmitCount++;
738  }
739  else
740  {
741  //Implementations should retransmit one or more times, but may choose
742  //to terminate the retransmission procedure early
743  context->running = FALSE;
744 
745  //Reinitialize state machine
747  }
748  }
749 }
750 
751 
752 /**
753  * @brief DECLINE state
754  *
755  * If a client detects that one or more addresses assigned to it by a server
756  * are already in use by another node, the client sends a Decline message to
757  * the server to inform it that the address is suspect
758  *
759  * @param[in] context Pointer to the DHCPv6 client context
760  **/
761 
763 {
764  systime_t time;
765 
766  //Get current time
767  time = osGetSystemTime();
768 
769  //Check current time
770  if(timeCompare(time, context->timestamp + context->timeout) >= 0)
771  {
772  //Check retransmission counter
773  if(context->retransmitCount == 0)
774  {
775  //Generate a 24-bit transaction ID
776  context->transactionId = netGenerateRand() & 0x00FFFFFF;
777 
778  //Send a Decline message
780 
781  //Save the time at which the message was sent
782  context->exchangeStartTime = time;
783  context->timestamp = time;
784 
785  //Initial retransmission timeout
786  context->timeout = netGenerateRandRange(
789 
790  //Increment retransmission counter
791  context->retransmitCount++;
792  }
793  else if(context->retransmitCount < DHCPV6_CLIENT_DEC_MAX_RC)
794  {
795  //Send a Decline message
797 
798  //Save the time at which the message was sent
799  context->timestamp = time;
800 
801  //The RT is doubled for each subsequent retransmission
802  context->timeout = netGenerateRandRange(
803  context->timeout * 2 - context->timeout / 10,
804  context->timeout * 2 + context->timeout / 10);
805 
806  //Increment retransmission counter
807  context->retransmitCount++;
808  }
809  else
810  {
811  //If the client does not receive a response within a reasonable period
812  //of time, then it restarts the initialization procedure
814  }
815  }
816 }
817 
818 #endif
@ IPV6_ADDR_STATE_TENTATIVE
An address whose uniqueness on a link is being verified.
Definition: ipv6.h:174
IPv6 (Internet Protocol Version 6)
void dhcpv6ClientStateInitConfirm(Dhcpv6ClientContext *context)
INIT-CONFIRM state.
@ DHCPV6_MSG_TYPE_DECLINE
Definition: dhcpv6_common.h:98
#define DHCPV6_CLIENT_REN_MAX_RT
@ DHCPV6_MSG_TYPE_SOLICIT
Definition: dhcpv6_common.h:90
#define DHCPV6_CLIENT_REL_TIMEOUT
#define DHCPV6_CLIENT_REB_MAX_RT
@ DHCPV6_STATE_REQUEST
Definitions common to DHCPv6 client, server and relay agent.
Ipv6AddrState ipv6GetAddrState(NetInterface *interface, const Ipv6Addr *addr)
Get the state of the specified IPv6 address.
Definition: ipv6_misc.c:56
@ DHCPV6_MSG_TYPE_REBIND
Definition: dhcpv6_common.h:95
void dhcpv6ClientStateDecline(Dhcpv6ClientContext *context)
DECLINE state.
@ DHCPV6_STATE_REBIND
#define DHCPV6_INFINITE_TIME
Definition: dhcpv6_common.h:53
void dhcpv6ClientCheckTimeout(Dhcpv6ClientContext *context)
Manage DHCPv6 configuration timeout.
void dhcpv6ClientFlushAddrList(Dhcpv6ClientContext *context)
Flush the list of IPv6 addresses from the IA.
@ DHCPV6_STATE_INIT
#define DHCPV6_CLIENT_CNF_MAX_DELAY
#define DHCPV6_CLIENT_REN_TIMEOUT
#define DHCPV6_CLIENT_ADDR_LIST_SIZE
Definition: dhcpv6_client.h:54
Helper functions for DHCPv6 client.
#define timeCompare(t1, t2)
Definition: os_port.h:40
@ IPV6_ADDR_STATE_INVALID
An address that is not assigned to any interface.
Definition: ipv6.h:173
Ipv6Addr addr
IPv6 address.
uint32_t netGenerateRand(void)
Generate a random 32-bit value.
Definition: net_misc.c:922
void dhcpv6ClientStateInit(Dhcpv6ClientContext *context)
INIT state.
#define DHCPV6_CLIENT_DEC_TIMEOUT
#define FALSE
Definition: os_port.h:46
#define DHCPV6_CLIENT_SOL_MAX_RT
Definition: dhcpv6_client.h:75
void dhcpv6ClientDumpConfig(Dhcpv6ClientContext *context)
Dump DHCPv6 configuration for debugging purpose.
#define DHCPV6_CLIENT_CNF_MAX_RD
#define DHCPV6_CLIENT_DEC_MAX_RC
Ipv6AddrState
IPv6 address state.
Definition: ipv6.h:172
uint32_t netGenerateRandRange(uint32_t min, uint32_t max)
Generate a random value in the specified range.
Definition: net_misc.c:948
@ DHCPV6_STATE_SOLICIT
uint32_t validLifetime
Valid lifetime.
DHCPv6 client (Dynamic Host Configuration Protocol for IPv6)
@ DHCPV6_MSG_TYPE_RELEASE
Definition: dhcpv6_common.h:97
IA address entry.
#define NetInterface
Definition: net.h:36
void dhcpv6ClientStateRenew(Dhcpv6ClientContext *context)
RENEW state.
Helper functions for IPv6.
#define Dhcpv6ClientContext
@ DHCPV6_MSG_TYPE_RENEW
Definition: dhcpv6_common.h:94
uint32_t t2
void dhcpv6ClientStateDad(Dhcpv6ClientContext *context)
DAD state.
void dhcpv6ClientStateRequest(Dhcpv6ClientContext *context)
REQUEST state.
@ DHCPV6_STATE_BOUND
#define DHCPV6_CLIENT_CNF_TIMEOUT
void dhcpv6ClientStateRebind(Dhcpv6ClientContext *context)
REBIND state.
error_t dhcpv6ClientSendMessage(Dhcpv6ClientContext *context, Dhcpv6MessageType type)
Send Solicit message.
uint32_t systime_t
System time.
@ DHCPV6_STATE_RENEW
uint32_t time
#define DHCPV6_CLIENT_REQ_MAX_RT
Definition: dhcpv6_client.h:89
void dhcpv6ClientStateConfirm(Dhcpv6ClientContext *context)
CONFIRM state.
uint32_t t1
DHCPv6 client finite state machine.
@ DHCPV6_STATE_DECLINE
Ipv6AddrState ipv6GetLinkLocalAddrState(NetInterface *interface)
Get the state of the link-local address.
Definition: ipv6.c:327
void dhcpv6ClientStateSolicit(Dhcpv6ClientContext *context)
SOLICIT state.
@ DHCPV6_STATE_CONFIRM
@ DHCPV6_MSG_TYPE_CONFIRM
Definition: dhcpv6_common.h:93
#define DHCPV6_CLIENT_REB_TIMEOUT
void dhcpv6ClientStateRelease(Dhcpv6ClientContext *context)
RELEASE state.
void dhcpv6ClientStateBound(Dhcpv6ClientContext *context)
BOUND state.
#define DHCPV6_CLIENT_SOL_MAX_DELAY
Definition: dhcpv6_client.h:61
#define MAX_DELAY
Definition: os_port.h:77
#define DHCPV6_CLIENT_REL_MAX_RC
@ IPV6_ADDR_STATE_PREFERRED
An address assigned to an interface whose use is unrestricted.
Definition: ipv6.h:175
#define DHCPV6_CLIENT_REQ_TIMEOUT
Definition: dhcpv6_client.h:82
unsigned int uint_t
Definition: compiler_port.h:50
TCP/IP stack core.
#define DHCPV6_CLIENT_CNF_MAX_RT
void dhcpv6ClientChangeState(Dhcpv6ClientContext *context, Dhcpv6State newState, systime_t delay)
Update DHCPv6 FSM state.
Debugging facilities.
Data logging functions for debugging purpose (DHCPv6)
@ DHCPV6_MSG_TYPE_REQUEST
Definition: dhcpv6_common.h:92
#define DHCPV6_CLIENT_SOL_TIMEOUT
Definition: dhcpv6_client.h:68
systime_t osGetSystemTime(void)
Retrieve system time.
#define DHCPV6_CLIENT_REQ_MAX_RC
Definition: dhcpv6_client.h:96