From: Yu Watanabe Date: Sun, 24 Oct 2021 16:03:30 +0000 (+0900) Subject: sd-radv: introduce RADV_DEFAULT_ROUTER_LIFETIME_USEC X-Git-Tag: v250-rc1~409^2~3 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=72db0a714b3fe181d06cccaae27d62b92ea5c196;p=thirdparty%2Fsystemd.git sd-radv: introduce RADV_DEFAULT_ROUTER_LIFETIME_USEC --- diff --git a/src/libsystemd-network/radv-internal.h b/src/libsystemd-network/radv-internal.h index e3d4ab99d68..6d8ad60b483 100644 --- a/src/libsystemd-network/radv-internal.h +++ b/src/libsystemd-network/radv-internal.h @@ -25,6 +25,16 @@ * Default: 0.33 * MaxRtrAdvInterval If MaxRtrAdvInterval >= 9 seconds; otherwise, the Default is * MaxRtrAdvInterval (Note, this should be a typo. We use 0.75 * MaxRtrAdvInterval). */ #define RADV_DEFAULT_MIN_TIMEOUT_USEC (RADV_DEFAULT_MAX_TIMEOUT_USEC / 3) +/* RFC 4861 section 6.2.4. + * AdvDefaultLifetime + * The value to be placed in the Router Lifetime field of Router Advertisements sent from the interface, + * in seconds. MUST be either zero or between MaxRtrAdvInterval and 9000 seconds. A value of zero + * indicates that the router is not to be used as a default router. These limits may be overridden by + * specific documents that describe how IPv6 operates over different link layers. For instance, in a + * point-to-point link the peers may have enough information about the number and status of devices at + * the other end so that advertisements are needed less frequently. + * Default: 3 * MaxRtrAdvInterval */ +#define RADV_DEFAULT_ROUTER_LIFETIME_USEC (3 * RADV_DEFAULT_MAX_TIMEOUT_USEC) /* RFC 4861 section 10. * MAX_INITIAL_RTR_ADVERT_INTERVAL 16 seconds * MAX_INITIAL_RTR_ADVERTISEMENTS 3 transmissions diff --git a/src/libsystemd-network/sd-radv.c b/src/libsystemd-network/sd-radv.c index 462b153ac2f..0468b5268f2 100644 --- a/src/libsystemd-network/sd-radv.c +++ b/src/libsystemd-network/sd-radv.c @@ -38,6 +38,7 @@ _public_ int sd_radv_new(sd_radv **ret) { *ra = (sd_radv) { .n_ref = 1, .fd = -1, + .lifetime_usec = RADV_DEFAULT_ROUTER_LIFETIME_USEC, }; *ret = TAKE_PTR(ra);