Set cpe port in var state

This commit is contained in:
Suvendhu Hansa 2025-08-07 19:30:24 +05:30
parent ce1c11e561
commit 3b6737be25
4 changed files with 25 additions and 4 deletions

View file

@ -521,7 +521,7 @@ static void get_management_ip_port(char **listen_addr)
dmuci_get_option_value_string("cwmp", "cpe", "default_wan_interface", &interface);
dmuci_get_option_value_string("cwmp", "cpe", "interface", &l3_device);
dmuci_get_option_value_string("cwmp", "cpe", "port", &port);
dmuci_get_option_value_string_varstate("icwmp", "cpe", "port", &port);
dmuci_get_option_value_string_varstate("icwmp", "acs", "ip_version", &ip_version);
if (DM_STRLEN(port) == 0)

View file

@ -630,12 +630,30 @@ http_end:
FREE(cr_path);
}
static unsigned short get_prev_connection_request_port(void)
{
char value[BUF_SIZE_16] = {0};
unsigned short prev_cr_port = 0;
prev_cr_port = (unsigned short)(cwmp_ctx.conf.connection_request_port);
get_uci_path_value(VARSTATE_CONFIG, "icwmp.cpe.port", value, BUF_SIZE_16);
if (strlen(value) != 0) {
unsigned short temp = (unsigned short)strtoul(value, NULL, 10);
if (temp > 0) {
prev_cr_port = temp;
}
}
return prev_cr_port;
}
void icwmp_http_server_init(void)
{
int y = 0;
struct sockaddr_in6 server = { 0 };
unsigned short cr_port = 0;
unsigned short prev_cr_port = (unsigned short)(cwmp_ctx.conf.connection_request_port);
unsigned short prev_cr_port = get_prev_connection_request_port();
int max_retry = cwmp_ctx.conf.cpe_bind_retries;
for (;;) {

View file

@ -1088,6 +1088,6 @@ void set_cpe_port_conf(int cr_cpe_port)
if (cr_cpe_port > 0) {
char cr_port_str[BUF_SIZE_16] = {0};
snprintf(cr_port_str, sizeof(cr_port_str), "%d", cr_cpe_port);
set_uci_path_value(NULL, "cwmp.cpe.port", cr_port_str);
set_uci_path_value(VARSTATE_CONFIG, "icwmp.cpe.port", cr_port_str);
}
}

View file

@ -1,2 +1,5 @@
config acs 'acs'
option dhcp_url 'http://192.168.103.160:8080/openacs/acs'
option dhcp_url 'http://192.168.103.160:8080/openacs/acs'
config cpe 'cpe'
option port '7548'