Skip to content

Commit 699cc61

Browse files
committed
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 #144 (cherry picked from commit 8abb450) Closes: #144 Link: #147 Fixes: 63461f6 ("dhcpv6: always include IA_NA and IA_PD in Request message if requested") Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
1 parent 8774d3c commit 699cc61

File tree

1 file changed

+30
-3
lines changed

1 file changed

+30
-3
lines changed

src/dhcpv6.c

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -957,11 +957,38 @@ static void dhcpv6_send(enum dhcpv6_msg req_msg_type, uint8_t trid[3], uint32_t
957957
cnt = IOV_HDR_IA_NA;
958958

959959
// Disable IAs if not used
960-
if (req_msg_type != DHCPV6_MSG_SOLICIT && req_msg_type != DHCPV6_MSG_REQUEST && ia_na_len == 0)
960+
if (na_mode == IA_MODE_NONE) {
961961
iov[IOV_HDR_IA_NA].iov_len = 0;
962+
} else if (ia_na_len == 0) {
963+
/* RFC7550 §4.2
964+
* Solution: a client SHOULD accept Advertise messages, even
965+
* when not all IA option types are being offered. And, in
966+
* this case, the client SHOULD include the not offered IA
967+
* option types in its Request. A client SHOULD only ignore
968+
* an Advertise message when none of the requested IA
969+
* options include offered addresses or delegated prefixes.
970+
* Note that ignored messages MUST still be processed for
971+
* SOL_MAX_RT and INF_MAX_RT options as specified in
972+
* [RFC7083].
973+
*/
962974

963-
if (na_mode == IA_MODE_NONE)
964-
iov[IOV_HDR_IA_NA].iov_len = 0;
975+
switch (req_msg_type) {
976+
case DHCPV6_MSG_REQUEST:
977+
/* Some broken ISPs won't behave properly if IA_NA is
978+
* sent on Requests when they have provided an empty
979+
* IA_NA on Advertise.
980+
* Therefore we don't comply with RFC7550 and omit
981+
* IA_NA as a workaround.
982+
*/
983+
iov[IOV_HDR_IA_NA].iov_len = 0;
984+
break;
985+
case DHCPV6_MSG_SOLICIT:
986+
break;
987+
default:
988+
iov[IOV_HDR_IA_NA].iov_len = 0;
989+
break;
990+
}
991+
}
965992

966993
if ((req_msg_type != DHCPV6_MSG_SOLICIT && req_msg_type != DHCPV6_MSG_REQUEST) ||
967994
!(client_options & DHCPV6_ACCEPT_RECONFIGURE))

0 commit comments

Comments
 (0)