]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
IPv6: Clear previous address RA flags on receipt of a RA.
authorRoy Marples <roy@marples.name>
Tue, 20 May 2025 21:10:41 +0000 (22:10 +0100)
committerRoy Marples <roy@marples.name>
Tue, 20 May 2025 21:10:41 +0000 (22:10 +0100)
This allows a prefix gateway to transition from onlink to
not on link.

Fixes #506.

src/ipv6nd.c

index 39fe4731a6f9a56d24c95ee7c64b862cc9413e3e..cad5ce5bc31d23c796384106634a440d7aacc3d5 100644 (file)
@@ -189,6 +189,11 @@ static void routeinfohead_free(struct routeinfohead *);
 #define ipv6nd_free_ra(ra) ipv6nd_freedrop_ra((ra),  0)
 #define ipv6nd_drop_ra(ra) ipv6nd_freedrop_ra((ra),  1)
 
+/* Clear these addrflags on receipt of a new RA before adding the new flags
+ * dervived from the RA. */
+#define RA_STALE_FLAGS \
+       (IPV6_AF_ONLINK | IPV6_AF_AUTOCONF | IPV6_AF_ROUTER | IPV6_AF_STALE)
+
 void
 ipv6nd_printoptions(const struct dhcpcd_ctx *ctx,
     const struct dhcp_opt *opts, size_t opts_len)
@@ -1294,8 +1299,8 @@ ipv6nd_handlera(struct dhcpcd_ctx *ctx,
                                else
                                        ia->prefix_pltime = ia->prefix_vltime;
 
+                               ia->flags &= ~RA_STALE_FLAGS;
                                ia->flags |= flags;
-                               ia->flags &= ~IPV6_AF_STALE;
                                ia->acquired = rap->acquired;
 
 #ifdef IPV6_MANAGETEMPADDR