diff options
| author | Álvaro Fernández Rojas | 2025-12-28 18:44:16 +0000 |
|---|---|---|
| committer | Álvaro Fernández Rojas | 2025-12-29 16:34:51 +0000 |
| commit | 699cc61568b6816783d17d57dda4ef7851198528 (patch) | |
| tree | 5ff68f297999acb066320ff42b78e6c1b203ed26 | |
| parent | 8774d3c0ec9cd9db2e32ac87583b6a519bcb21f1 (diff) | |
| download | odhcp6c-699cc61568b6816783d17d57dda4ef7851198528.tar.gz | |
dhcpv6: omit IA_NA on Request
Omit IA_NA on Request if not present on Solicit, which is against RFC7550,
but turns out some broken ISPs don't like this.
See https://github.com/openwrt/odhcp6c/issues/144
(cherry picked from commit 8abb45065f5ef9d176efa6bd151a1209b05852c4)
Closes: https://github.com/openwrt/odhcp6c/issues/144
Link: https://github.com/openwrt/odhcp6c/pull/147
Fixes: 63461f64d4c1 ("dhcpv6: always include IA_NA and IA_PD in Request message if requested")
Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
| -rw-r--r-- | src/dhcpv6.c | 33 |
1 files changed, 30 insertions, 3 deletions
diff --git a/src/dhcpv6.c b/src/dhcpv6.c index bb9ac13..4963682 100644 --- a/src/dhcpv6.c +++ b/src/dhcpv6.c @@ -957,11 +957,38 @@ static void dhcpv6_send(enum dhcpv6_msg req_msg_type, uint8_t trid[3], uint32_t cnt = IOV_HDR_IA_NA; // Disable IAs if not used - if (req_msg_type != DHCPV6_MSG_SOLICIT && req_msg_type != DHCPV6_MSG_REQUEST && ia_na_len == 0) + if (na_mode == IA_MODE_NONE) { iov[IOV_HDR_IA_NA].iov_len = 0; + } else if (ia_na_len == 0) { + /* RFC7550 §4.2 + * Solution: a client SHOULD accept Advertise messages, even + * when not all IA option types are being offered. And, in + * this case, the client SHOULD include the not offered IA + * option types in its Request. A client SHOULD only ignore + * an Advertise message when none of the requested IA + * options include offered addresses or delegated prefixes. + * Note that ignored messages MUST still be processed for + * SOL_MAX_RT and INF_MAX_RT options as specified in + * [RFC7083]. + */ - if (na_mode == IA_MODE_NONE) - iov[IOV_HDR_IA_NA].iov_len = 0; + switch (req_msg_type) { + case DHCPV6_MSG_REQUEST: + /* Some broken ISPs won't behave properly if IA_NA is + * sent on Requests when they have provided an empty + * IA_NA on Advertise. + * Therefore we don't comply with RFC7550 and omit + * IA_NA as a workaround. + */ + iov[IOV_HDR_IA_NA].iov_len = 0; + break; + case DHCPV6_MSG_SOLICIT: + break; + default: + iov[IOV_HDR_IA_NA].iov_len = 0; + break; + } + } if ((req_msg_type != DHCPV6_MSG_SOLICIT && req_msg_type != DHCPV6_MSG_REQUEST) || !(client_options & DHCPV6_ACCEPT_RECONFIGURE)) |