From: Paul Donald Date: Fri, 7 Nov 2025 18:54:41 +0000 (+0100) Subject: router: Modify relayed RA PIO A flags according to interface policy X-Git-Url: http://git.cdn.openwrt.org/?a=commitdiff_plain;h=da3e2a9829cc252a12ab14ac57cf813959489fd6;p=project%2Fodhcpd.git router: Modify relayed RA PIO A flags according to interface policy Effectively: -inherit the A flag from upstream, but retain the possibility to disable SLAAC downstream. h/t user @Shine- Signed-off-by: Paul Donald Link: https://github.com/openwrt/odhcpd/pull/317 Signed-off-by: Álvaro Fernández Rojas --- diff --git a/src/router.c b/src/router.c index 608a558..3d1efa1 100644 --- a/src/router.c +++ b/src/router.c @@ -1202,7 +1202,7 @@ static void forward_router_advertisement(const struct interface *iface, uint8_t // MTU option struct nd_opt_mtu *mtu_opt = NULL; uint32_t ingress_mtu_val = 0; - /* PIO L flag and RA M/O Flags */ + /* PIO L/A flag and RA M/O Flags */ uint8_t ra_flags; size_t pio_count = 0; struct fwd_pio_flags { @@ -1286,6 +1286,15 @@ static void forward_router_advertisement(const struct interface *iface, uint8_t *pio_flags[i].ptr = pio_flags[i].flags; /* ensure L flag (on-link) cleared; relayed == not on-link */ *pio_flags[i].ptr &= ~ND_OPT_PI_FLAG_ONLINK; + /* upstream no SLAAC, downstream no SLAAC: no change + * upstream no SLAAC, downstream SLAAC: no change + * upstream SLAAC, downstream SLAAC: no change + * upstream SLAAC, downstream no SLAAC: clear flag + * Why? We shall not SLAAC downstream if upstream disables it. Sometimes + * we just inform about a prefix for DHCPv6 and routing info. + */ + if (!c->ra_slaac) + *pio_flags[i].ptr &= ~ND_OPT_PI_FLAG_AUTO;/* ensure A flag cleared */ } /* Apply per-interface modifications of upstream RA state */