1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2024-12-31 17:17:43 +03:00

sd-radv: shorten the default lifetime for prefix/route prefix

See draft-ietf-6man-slaac-renum-02 section 4.1.1.
This commit is contained in:
Yu Watanabe 2021-10-25 04:13:14 +09:00
parent 95e104e049
commit d951507d5d
3 changed files with 12 additions and 7 deletions

View File

@ -39,6 +39,11 @@
#define RADV_MIN_ROUTER_LIFETIME_USEC RADV_MIN_MAX_TIMEOUT_USEC
#define RADV_MAX_ROUTER_LIFETIME_USEC (9000 * USEC_PER_SEC)
#define RADV_DEFAULT_ROUTER_LIFETIME_USEC (3 * RADV_DEFAULT_MAX_TIMEOUT_USEC)
/* draft-ietf-6man-slaac-renum-02 section 4.1.1.
* AdvPreferredLifetime: max(AdvDefaultLifetime, 3 * MaxRtrAdvInterval)
* AdvValidLifetime: 2 * AdvPreferredLifetime */
#define RADV_DEFAULT_PREFERRED_LIFETIME_USEC CONST_MAX(RADV_DEFAULT_ROUTER_LIFETIME_USEC, 3 * RADV_DEFAULT_MAX_TIMEOUT_USEC)
#define RADV_DEFAULT_VALID_LIFETIME_USEC (2 * RADV_DEFAULT_PREFERRED_LIFETIME_USEC)
/* RFC 4861 section 10.
* MAX_INITIAL_RTR_ADVERT_INTERVAL 16 seconds
* MAX_INITIAL_RTR_ADVERTISEMENTS 3 transmissions

View File

@ -837,8 +837,8 @@ _public_ int sd_radv_prefix_new(sd_radv_prefix **ret) {
/* RFC 4861, Section 6.2.1 */
.opt.flags = ND_OPT_PI_FLAG_ONLINK|ND_OPT_PI_FLAG_AUTO,
.lifetime_valid_usec = 30 * USEC_PER_DAY,
.lifetime_preferred_usec = 7 * USEC_PER_DAY,
.lifetime_valid_usec = RADV_DEFAULT_VALID_LIFETIME_USEC,
.lifetime_preferred_usec = RADV_DEFAULT_PREFERRED_LIFETIME_USEC,
.valid_until = USEC_INFINITY,
.preferred_until = USEC_INFINITY,
};
@ -930,7 +930,7 @@ _public_ int sd_radv_route_prefix_new(sd_radv_route_prefix **ret) {
.opt.length = DIV_ROUND_UP(sizeof(p->opt), 8),
.opt.prefixlen = 64,
.lifetime_usec = 7 * USEC_PER_DAY,
.lifetime_usec = RADV_DEFAULT_VALID_LIFETIME_USEC,
.valid_until = USEC_INFINITY,
};

View File

@ -32,13 +32,13 @@ static uint8_t advertisement[] = {
0x20, 0x01, 0x0d, 0xb8, 0xde, 0xad, 0xbe, 0xef,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
/* Prefix Information Option */
0x03, 0x04, 0x40, 0xc0, 0x00, 0x27, 0x8d, 0x00,
0x00, 0x09, 0x3a, 0x80, 0x00, 0x00, 0x00, 0x00,
0x03, 0x04, 0x40, 0xc0, 0x00, 0x00, 0x0e, 0x10,
0x00, 0x00, 0x07, 0x08, 0x00, 0x00, 0x00, 0x00,
0x20, 0x01, 0x0d, 0xb8, 0x0b, 0x16, 0xd0, 0x0d,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
/* Prefix Information Option */
0x03, 0x04, 0x30, 0xc0, 0x00, 0x27, 0x8d, 0x00,
0x00, 0x09, 0x3a, 0x80, 0x00, 0x00, 0x00, 0x00,
0x03, 0x04, 0x30, 0xc0, 0x00, 0x00, 0x0e, 0x10,
0x00, 0x00, 0x07, 0x08, 0x00, 0x00, 0x00, 0x00,
0x20, 0x01, 0x0d, 0xb8, 0xc0, 0x01, 0x0d, 0xad,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
/* Recursive DNS Server Option */