From 505d3d63e06d84b144ce2eb63ea89af723abf0ed Mon Sep 17 00:00:00 2001 From: Suvendhu Hansa Date: Mon, 22 Sep 2025 11:45:12 +0530 Subject: [PATCH] Disable dhcp on-boarding once connected --- src/session.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/session.c b/src/session.c index 88cfd06..9ed79ba 100644 --- a/src/session.c +++ b/src/session.c @@ -155,10 +155,23 @@ int cwmp_schedule_rpc() goto retry; CWMP_LOG(INFO, "Get the %sResponse message from the ACS", rpc_acs_methods[rpc_acs->type].name); - if (rpc_acs_methods[rpc_acs->type].parse_response) + if (rpc_acs_methods[rpc_acs->type].parse_response) { if (rpc_acs_methods[rpc_acs->type].parse_response(rpc_acs)) goto retry; + if (rpc_acs->type == RPC_ACS_INFORM) { + /* Inform response received from ACS and parsed successfully + * now disable DHCP discovery and set url */ + if (cwmp_ctx.conf.dhcp_discovery == true) + set_uci_path_value(NULL, "cwmp.acs.dhcp_discovery", "0"); + + char cur_url[BUF_SIZE_2048] = {0}; + get_uci_path_value(NULL, "cwmp.acs.url", cur_url, BUF_SIZE_2048); + if (CWMP_STRCMP(cwmp_ctx.conf.acs_url, cur_url) != 0) + set_uci_path_value(NULL, "cwmp.acs.url", cwmp_ctx.conf.acs_url); + } + } + ilist = ilist->prev; if (rpc_acs_methods[rpc_acs->type].extra_clean != NULL) rpc_acs_methods[rpc_acs->type].extra_clean(rpc_acs);