diff options
| author | Paul Donald | 2025-11-08 17:43:35 +0000 |
|---|---|---|
| committer | Álvaro Fernández Rojas | 2025-12-10 17:42:00 +0000 |
| commit | b84553e496a3e210c026a4fb6bf6f4576b72e937 (patch) | |
| tree | ccbb47bf53a6ef79174c4f7a83298133f922d9e3 | |
| parent | da3e2a9829cc252a12ab14ac57cf813959489fd6 (diff) | |
| download | odhcpd-b84553e496a3e210c026a4fb6bf6f4576b72e937.tar.gz | |
router: Modify relayed RA PIO P flag according to interface policy
Effectively:
-inherit the P flag from upstream, but retain the possibility to disable
its availability downstream, if any of the following are disabled:
-DHCPv6
-DHCPv6-PD
-DHCPv6-PD Preferred
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 | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/router.c b/src/router.c index 3d1efa1..8334a1c 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/A flag and RA M/O Flags */ + /* PIO L/A/R/P flag and RA M/O Flags */ uint8_t ra_flags; size_t pio_count = 0; struct fwd_pio_flags { @@ -1295,6 +1295,11 @@ static void forward_router_advertisement(const struct interface *iface, uint8_t */ if (!c->ra_slaac) *pio_flags[i].ptr &= ~ND_OPT_PI_FLAG_AUTO;/* ensure A flag cleared */ + + /* we have no opinion on the R flag - it can be forwarded */ + + if (c->dhcpv6 == MODE_DISABLED || !c->dhcpv6_pd || !c->dhcpv6_pd_preferred) + *pio_flags[i].ptr &= ~ND_OPT_PI_FLAG_PD_PREFERRED;/* ensure P flag (DHCPv6-PD) cleared */ } /* Apply per-interface modifications of upstream RA state */ |