diff --git a/http.c b/http.c index e0212f9..9661ec8 100644 --- a/http.c +++ b/http.c @@ -50,10 +50,20 @@ static CURL *curl; int http_client_init(struct cwmp *cwmp) { + char *dhcp_dis; + char *acs_var_stat; + uci_get_value(UCI_DHCP_DISCOVERY_PATH, &dhcp_dis); #ifdef HTTP_CURL - if (asprintf(&http_c.url, "%s", + if (dhcp_dis && cwmp->retry_count_session > 0 && strcmp(dhcp_dis, "enable") == 0) { + uci_get_value(UCI_DHCP_ACS_URL, &acs_var_stat); + if (asprintf(&http_c.url, "%s", + acs_var_stat) == -1) + return -1; + } else { + if (asprintf(&http_c.url, "%s", cwmp->conf.acsurl) == -1) return -1; + } #endif #ifdef HTTP_ZSTREAM diff --git a/inc/cwmp.h b/inc/cwmp.h index 9c427f2..912d5ca 100644 --- a/inc/cwmp.h +++ b/inc/cwmp.h @@ -68,6 +68,7 @@ #define LW_NOTIFICATION_ENABLE "cwmp.lwn.enable" #define LW_NOTIFICATION_HOSTNAME "cwmp.lwn.hostname" #define LW_NOTIFICATION_PORT "cwmp.lwn.port" +#define UCI_DHCP_ACS_URL "provisioning.iup.urlcwmp" enum end_session {