summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorÁlvaro Fernández Rojas2025-12-18 07:18:52 +0000
committerÁlvaro Fernández Rojas2025-12-18 16:43:58 +0000
commitd99528f7a91a26ab13ebf135dcbf6ae7cc821d70 (patch)
tree2a7d79931282fa2f6c7a22cf0f53a0f751a096c7
parent02e783c2f68c2ee16e1bed43369fa3029e32f70d (diff)
downloadodhcp6c-d99528f7a91a26ab13ebf135dcbf6ae7cc821d70.tar.gz
odhcp6c: avoid clearing CLIENT_ID
When CLIENT_ID is set as an argument instead of relying on the HW address it gets lost after getting to a DHCPV6_RESET state. Closes: https://github.com/openwrt/openwrt/issues/21053 Link: https://github.com/openwrt/odhcp6c/pull/139 Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
-rw-r--r--src/odhcp6c.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/odhcp6c.c b/src/odhcp6c.c
index 6c6acd4..9b37c24 100644
--- a/src/odhcp6c.c
+++ b/src/odhcp6c.c
@@ -60,6 +60,7 @@ static volatile bool signal_usr1 = false;
static volatile bool signal_usr2 = false;
static volatile bool signal_term = false;
+static bool client_id_param = false;
static int urandom_fd = -1;
static bool bound = false, ra = false;
static time_t last_update = 0;
@@ -281,6 +282,8 @@ int main(_o_unused int argc, char* const argv[])
if (odhcp6c_add_state(STATE_CLIENT_ID, buf, l + 4)) {
syslog(LOG_ERR, "Failed to override client-ID");
return 1;
+ } else {
+ client_id_param = true;
}
} else {
help = true;
@@ -722,7 +725,8 @@ int main(_o_unused int argc, char* const argv[])
break;
case DHCPV6_RESET:
- odhcp6c_clear_state(STATE_CLIENT_ID);
+ if (!client_id_param)
+ odhcp6c_clear_state(STATE_CLIENT_ID);
if (bound) {
bound = false;