diff options
| author | Paul Donald | 2025-11-07 18:54:41 +0000 |
|---|---|---|
| committer | Álvaro Fernández Rojas | 2025-12-18 17:17:35 +0000 |
| commit | 179429ba477d0df397c2a4e3ce8a890e179a2799 (patch) | |
| tree | 4083686f3874a36b81f839a881c4f86d8849e41a | |
| parent | cb1b8770b7827d888e1c49b52ca219db0d7f0fd8 (diff) | |
| download | odhcpd-179429ba477d0df397c2a4e3ce8a890e179a2799.tar.gz | |
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-
(cherry picked from commit da3e2a9829cc252a12ab14ac57cf813959489fd6)
Signed-off-by: Paul Donald <newtwen+github@gmail.com>
Link: https://github.com/openwrt/odhcpd/pull/317
Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
| -rw-r--r-- | src/router.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/router.c b/src/router.c index b322a41..5f41dca 100644 --- a/src/router.c +++ b/src/router.c @@ -1203,7 +1203,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 { @@ -1287,6 +1287,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 */ |