]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
sd-radv: introduce RADV_DEFAULT_ROUTER_LIFETIME_USEC
authorYu Watanabe <watanabe.yu+github@gmail.com>
Sun, 24 Oct 2021 16:03:30 +0000 (01:03 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Wed, 27 Oct 2021 10:05:55 +0000 (19:05 +0900)
src/libsystemd-network/radv-internal.h
src/libsystemd-network/sd-radv.c

index e3d4ab99d68de61a68e278fc6298beee21911614..6d8ad60b4834c7de334adb0639ccdd52d3a751c5 100644 (file)
  * 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
index 462b153ac2f42424d3be1c5a7897aeb3ab34c6d5..0468b5268f20377a7a4dfc8d634e2e438e01d073 100644 (file)
@@ -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);