Skip to content

Commit 2711e12

Browse files
jukkarfabiobaltieri
authored andcommitted
net: ipv6: Tailor PE values for Zephyr
Making default preferred time much closer to default valid time so that the served addresses are much shorter time in deprecated state where they cannot be utilized. This is important in Zephyr as there are limited number of IPv6 addresses that can be allocated to the network interface. Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
1 parent 39ab0bb commit 2711e12

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

subsys/net/ip/Kconfig.ipv6

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -200,17 +200,17 @@ config NET_IPV6_PE_PREFER_PUBLIC_ADDRESSES
200200

201201
config NET_IPV6_PE_TEMP_VALID_LIFETIME
202202
int "Max lifetime for temporary address (in minutes)"
203-
default 1800
203+
default 1440
204204
help
205205
No temporary address should ever remain valid for longer than this
206-
value. The value is in minutes. Default value is 2 days (2*24*60).
206+
value. The value is in minutes. Default value is 1 day (24*60).
207207

208208
config NET_IPV6_PE_TEMP_PREFERRED_LIFETIME
209209
int "Max preferred lifetime for temporary address (in minutes)"
210-
default 1440
210+
default 1380
211211
help
212212
No temporary address should ever remain preferred for longer than this
213-
value. The value is in minutes. Default value is 1 day (24*60).
213+
value. The value is in minutes. Default value is 23 hours (23*60).
214214

215215
config NET_IPV6_PE_TEMP_IDGEN_RETRIES
216216
int "Max amount of failed DAD attempts"

subsys/net/ip/ipv6_pe.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,15 @@ static uint32_t temp_preferred_lifetime =
5252

5353
/* This is the upper bound on DESYNC_FACTOR. The value is in seconds.
5454
* See RFC 8981 ch 3.8 for details.
55+
*
56+
* RFC says the DESYNC_FACTOR should be 0.4 times the preferred lifetime.
57+
* This is too short for Zephyr as it means that the address is very long
58+
* time in deprecated state and not being used. Make this 7% of the preferred
59+
* time to deprecate the addresses later.
5560
*/
56-
#define MAX_DESYNC_FACTOR ((TEMP_PREFERRED_LIFETIME * 2U) / 5U)
57-
#define DESYNC_FACTOR(ipv6) ((ipv6)->desync_factor)
61+
#define MAX_DESYNC_FACTOR ((uint32_t)((uint64_t)TEMP_PREFERRED_LIFETIME * \
62+
(uint64_t)7U) / (uint64_t)100U)
63+
#define DESYNC_FACTOR(ipv6) ((ipv6)->desync_factor)
5864

5965
#define TEMP_IDGEN_RETRIES CONFIG_NET_IPV6_PE_TEMP_IDGEN_RETRIES
6066

0 commit comments

Comments
 (0)