]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
RAdv: Add P-flag to prefer prefix delegation in DHCPv6 ip-radv-pflag master
authorIgor Putovny <igor.putovny@nic.cz>
Tue, 4 Nov 2025 14:15:54 +0000 (15:15 +0100)
committerIgor Putovny <igor.putovny@nic.cz>
Tue, 4 Nov 2025 14:30:32 +0000 (15:30 +0100)
doc/bird.sgml
proto/radv/config.Y
proto/radv/packets.c
proto/radv/radv.h

index a61400ef87f8852811786d09e3bcdc455fa849f6..68229cb9dba8001e38ce72667af6623bfa2c8a94 100644 (file)
@@ -5741,6 +5741,11 @@ custom option type 38 value hex:0e:10:20:01:0d:b8:00:0a:00:0b:00:00:00:00;
        This option specifies whether hosts may use the advertised prefix for
        stateless autoconfiguration. Default: yes
 
+       <tag><label id="radv-prefix-pd-preferred">pd preferred<m/switch/</tag>
+       This option specifies whether hosts should use prefix delegation in DHCPv6
+       instead of using stateless address autoconfiguration (SLAAC).
+       Default: no.
+
        <tag><label id="radv-prefix-valid-lifetime">valid lifetime <m/expr/ [sensitive <m/switch/]</tag>
        This option specifies the time (in seconds) how long (after the
        receipt of RA) the prefix information is valid, i.e., autoconfigured
index 045675b11953614f47f1a6e9668bed8516a4b39c..cd54f10ccf7bc989f4cb1b394b1b84974c379212 100644 (file)
@@ -42,7 +42,7 @@ CF_KEYWORDS(RADV, PREFIX, INTERFACE, MIN, MAX, RA, DELAY, INTERVAL, SOLICITED,
        RETRANS, TIMER, CURRENT, HOP, LIMIT, DEFAULT, VALID, PREFERRED, MULT,
        LIFETIME, SKIP, ONLINK, AUTONOMOUS, RDNSS, DNSSL, NS, DOMAIN, LOCAL,
        TRIGGER, SENSITIVE, PREFERENCE, LOW, MEDIUM, HIGH, PROPAGATE, ROUTE,
-       ROUTES, RA_PREFERENCE, RA_LIFETIME, CUSTOM, OPTION, TYPE, VALUE)
+       ROUTES, RA_PREFERENCE, RA_LIFETIME, CUSTOM, OPTION, TYPE, VALUE, PD)
 
 CF_ENUM(T_ENUM_RA_PREFERENCE, RA_PREF_, LOW, MEDIUM, HIGH)
 
@@ -215,6 +215,7 @@ radv_prefix_item:
    SKIP bool { RADV_PREFIX->skip = $2; }
  | ONLINK bool { RADV_PREFIX->onlink = $2; }
  | AUTONOMOUS bool { RADV_PREFIX->autonomous = $2; }
+ | PD PREFERRED bool { RADV_PREFIX->pd_preferred = $3; }
  | VALID LIFETIME expr radv_sensitive {
      RADV_PREFIX->valid_lifetime = $3;
      if ($4 != (uint) -1) RADV_PREFIX->valid_lifetime_sensitive = $4;
index 77c9879492582e8428522c461b8ff317f8415199..25f43b1a3b5dae9114e53ab10ebe6a5124d34be9 100644 (file)
@@ -44,8 +44,9 @@ struct radv_opt_prefix
   ip6_addr prefix;
 };
 
-#define OPT_PX_ONLINK 0x80
-#define OPT_PX_AUTONOMOUS 0x40
+#define OPT_PX_ONLINK            0x80
+#define OPT_PX_AUTONOMOUS        0x40
+#define OPT_PX_PD_PREFERRED      0x10
 
 struct radv_opt_mtu
 {
@@ -307,7 +308,8 @@ radv_prepare_prefix(struct radv_iface *ifa, struct radv_prefix *px,
   op->length = 4;
   op->pxlen = px->prefix.pxlen;
   op->flags = (pc->onlink ? OPT_PX_ONLINK : 0) |
-    (pc->autonomous ? OPT_PX_AUTONOMOUS : 0);
+             (pc->autonomous ? OPT_PX_AUTONOMOUS : 0) |
+             (pc->pd_preferred ? OPT_PX_PD_PREFERRED : 0);
   op->valid_lifetime = (ifa->ra->active || !pc->valid_lifetime_sensitive) ?
     htonl(pc->valid_lifetime) : 0;
   op->preferred_lifetime = (ifa->ra->active || !pc->preferred_lifetime_sensitive) ?
index ba4a1b6c75eb680e393dbb8eca0505c9998529a0..83491f47e94e596d2476d877df124d506fc44ce4 100644 (file)
@@ -101,6 +101,7 @@ struct radv_prefix_config
   u8 skip;                     /* Do not include this prefix to RA */
   u8 onlink;                   /* Standard options from RFC 4861 */
   u8 autonomous;
+  u8 pd_preferred;
   u32 valid_lifetime;
   u32 preferred_lifetime;
   u8 valid_lifetime_sensitive;  /* Whether valid_lifetime depends on trigger */