diff options
| author | Álvaro Fernández Rojas | 2025-12-16 12:30:49 +0000 |
|---|---|---|
| committer | Álvaro Fernández Rojas | 2025-12-17 14:34:06 +0000 |
| commit | 2582843959a7fdfd962a3f005cbd09475ed186bb (patch) | |
| tree | f7e158521b9cc9a489a163babb3be5c555d4eccb | |
| parent | db6bec98ead183b04346c1403c31de91b02ee393 (diff) | |
| download | odhcp6c-2582843959a7fdfd962a3f005cbd09475ed186bb.tar.gz | |
dhcpv6: fix NA/PD=try when NA/PD aren't provided
Fixes infinite SOLICIT loop when NA=try and/or PD=try but the ISP provides
no NA and/or no PD (only SLAAC).
(cherry picked from commit 02e783c2f68c2ee16e1bed43369fa3029e32f70d)
Closes: https://github.com/openwrt/odhcp6c/issues/134
Link: https://github.com/openwrt/odhcp6c/pull/137
Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
| -rw-r--r-- | src/dhcpv6.c | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/src/dhcpv6.c b/src/dhcpv6.c index 32a5e47..d8bb8be 100644 --- a/src/dhcpv6.c +++ b/src/dhcpv6.c @@ -2064,12 +2064,25 @@ int dhcpv6_promote_server_cand(void) if (!cand_len) return -1; - if (!cand->ia_pd_len && cand->has_noaddravail && na_mode == IA_MODE_TRY) { - na_mode = IA_MODE_NONE; + if (!cand->ia_pd_len && cand->has_noaddravail) { + bool override = false; - dhcpv6_retx[DHCPV6_MSG_SOLICIT].max_timeo = cand->sol_max_rt; - dhcpv6_retx[DHCPV6_MSG_INFO_REQ].max_timeo = cand->inf_max_rt; - return -1; + if (na_mode == IA_MODE_TRY) { + na_mode = IA_MODE_NONE; + override = true; + } + + if (pd_mode == IA_MODE_TRY) { + pd_mode = IA_MODE_NONE; + override = true; + } + + if (override) { + dhcpv6_retx[DHCPV6_MSG_SOLICIT].max_timeo = cand->sol_max_rt; + dhcpv6_retx[DHCPV6_MSG_INFO_REQ].max_timeo = cand->inf_max_rt; + + return -1; + } } hdr[0] = htons(DHCPV6_OPT_SERVERID); |