mirror of
https://dev.iopsys.eu/bbf/icwmp.git
synced 2026-02-19 10:41:21 +01:00
Add configuration param to enable use of IPv6
This commit is contained in:
parent
9fd2fffcd3
commit
2efca121a2
5 changed files with 36 additions and 15 deletions
11
config.c
11
config.c
|
|
@ -620,6 +620,17 @@ int get_global_config(struct config *conf)
|
|||
value = NULL;
|
||||
}
|
||||
}
|
||||
if((error = uci_get_value(UCI_ACS_IPV6_ENABLE,&value)) == CWMP_OK)
|
||||
{
|
||||
if(value != NULL)
|
||||
{
|
||||
if ((strcasecmp(value,"true")==0) || (strcmp(value,"1")==0))
|
||||
{
|
||||
conf->ipv6_enable = true;
|
||||
}
|
||||
value = NULL;
|
||||
}
|
||||
}
|
||||
if((error = uci_get_value(UCI_ACS_SSL_VERSION,&value)) == CWMP_OK)
|
||||
{
|
||||
if(value != NULL)
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ config 'cwmp' 'acs'
|
|||
# possible configs interval :[1000:65535]
|
||||
option retry_interval_multiplier '2000'
|
||||
option https_ssl_capath ''
|
||||
option ipv6_enable '0'
|
||||
config 'cwmp' 'cpe'
|
||||
option 'interface' 'eth0.1'
|
||||
option 'default_wan_interface' 'wan'
|
||||
|
|
|
|||
31
http.c
31
http.c
|
|
@ -109,14 +109,16 @@ http_client_init(struct cwmp *cwmp)
|
|||
return -1;
|
||||
#endif /* HTTP_ZSTREAM */
|
||||
|
||||
char *ip = NULL;
|
||||
curl_easy_setopt(curl, CURLOPT_URL, http_c.url);
|
||||
curl_easy_setopt(curl, CURLOPT_TIMEOUT, HTTP_TIMEOUT);
|
||||
curl_easy_setopt(curl, CURLOPT_NOBODY, 1);
|
||||
curl_easy_getinfo(curl, CURLINFO_PRIMARY_IP, &ip);
|
||||
curl_easy_perform(curl);
|
||||
int tmp = inet_pton(AF_INET, ip, buf);
|
||||
ip_version = (tmp == 1) ? 4 : 6;
|
||||
if (cwmp->conf.ipv6_enable) {
|
||||
char *ip = NULL;
|
||||
curl_easy_setopt(curl, CURLOPT_URL, http_c.url);
|
||||
curl_easy_setopt(curl, CURLOPT_TIMEOUT, HTTP_TIMEOUT);
|
||||
curl_easy_setopt(curl, CURLOPT_NOBODY, 1);
|
||||
curl_easy_getinfo(curl, CURLINFO_PRIMARY_IP, &ip);
|
||||
curl_easy_perform(curl);
|
||||
int tmp = inet_pton(AF_INET, ip, buf);
|
||||
ip_version = (tmp == 1) ? 4 : 6;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -167,6 +169,7 @@ int
|
|||
http_send_message(struct cwmp *cwmp, char *msg_out, int msg_out_len,char **msg_in)
|
||||
{
|
||||
unsigned char buf[sizeof(struct in6_addr)];
|
||||
int tmp = 0;
|
||||
#ifdef HTTP_CURL
|
||||
CURLcode res;
|
||||
long http_code = 0;
|
||||
|
|
@ -251,11 +254,13 @@ http_send_message(struct cwmp *cwmp, char *msg_out, int msg_out_len,char **msg_i
|
|||
if (!ip_acs || strcmp(ip_acs, ip) != 0) {
|
||||
FREE(ip_acs);
|
||||
ip_acs = strdup(ip);
|
||||
int tmp = inet_pton(AF_INET, ip, buf);
|
||||
if (tmp == 1)
|
||||
tmp = 0;
|
||||
else
|
||||
tmp = inet_pton(AF_INET6, ip, buf);
|
||||
if (cwmp->conf.ipv6_enable) {
|
||||
tmp = inet_pton(AF_INET, ip, buf);
|
||||
if (tmp == 1)
|
||||
tmp = 0;
|
||||
else
|
||||
tmp = inet_pton(AF_INET6, ip, buf);
|
||||
}
|
||||
external_init();
|
||||
external_simple("allow_cr_ip", ip_acs, tmp);
|
||||
external_exit();
|
||||
|
|
|
|||
|
|
@ -53,6 +53,7 @@
|
|||
#define UCI_ACS_SSL_CAPATH "cwmp.acs.ssl_capath"
|
||||
#define UCI_HTTPS_SSL_CAPATH "cwmp.acs.https_ssl_capath"
|
||||
#define UCI_ACS_INSECURE_ENABLE "cwmp.acs.insecure_enable"
|
||||
#define UCI_ACS_IPV6_ENABLE "cwmp.acs.ipv6_enable"
|
||||
#define UCI_ACS_SSL_VERSION "cwmp.acs.ssl_version"
|
||||
#define UCI_ACS_COMPRESSION "cwmp.acs.compression"
|
||||
#define UCI_ACS_RETRY_MIN_WAIT_INTERVAL "cwmp.acs.retry_min_wait_interval"
|
||||
|
|
@ -191,6 +192,7 @@ typedef struct config {
|
|||
time_t time;
|
||||
bool periodic_enable;
|
||||
bool insecure_enable;
|
||||
bool ipv6_enable;
|
||||
int retry_min_wait_interval;
|
||||
int retry_interval_multiplier;
|
||||
bool lw_notification_enable;
|
||||
|
|
|
|||
6
ubus.c
6
ubus.c
|
|
@ -329,8 +329,10 @@ ubus_init(struct cwmp *cwmp)
|
|||
CWMP_LOG(ERROR,"netlink initialization failed");
|
||||
}
|
||||
|
||||
if (netlink_init_v6()) {
|
||||
CWMP_LOG(ERROR,"netlink initialization failed");
|
||||
if (cwmp->conf.ipv6_enable) {
|
||||
if (netlink_init_v6()) {
|
||||
CWMP_LOG(ERROR,"netlink initialization failed");
|
||||
}
|
||||
}
|
||||
ctx = ubus_connect(cwmp->conf.ubus_socket);
|
||||
if (!ctx) return -1;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue