diff --git a/docs/api/uci/cwmp.md b/docs/api/uci/cwmp.md index 3879e88..3a5c564 100644 --- a/docs/api/uci/cwmp.md +++ b/docs/api/uci/cwmp.md @@ -417,6 +417,15 @@
This configure firewall rules. Allowed values . IP_Only means only acs ip as source ip used for firewall input rule, Port_Only means only destination port will be used and IP_Port or empty value meaning both ip and port will be used for firewall input rule.
+ +
force_ipv4
+
boolean
+
no
+
+ +
If set to 1, it forces the connectivity over v4 IP address.
+ + diff --git a/src/common.c b/src/common.c index f827a19..684ebb7 100755 --- a/src/common.c +++ b/src/common.c @@ -792,6 +792,9 @@ static bool is_ipv6_addr_available(const char *device) bool is_ipv6_enabled(void) { + if (cwmp_main->conf.force_ipv4 == true) + return false; + if (CWMP_STRLEN(cwmp_main->net.interface) == 0) { struct blob_buf b = {0}; char network_interface[64]; diff --git a/src/common.h b/src/common.h index 8546694..9c3fc8a 100644 --- a/src/common.h +++ b/src/common.h @@ -155,6 +155,7 @@ typedef struct config { unsigned int session_timeout; bool http_disable_100continue; int cr_timeout; + bool force_ipv4; } config; struct deviceid { diff --git a/src/config.c b/src/config.c index 836ca08..476a8f6 100755 --- a/src/config.c +++ b/src/config.c @@ -66,6 +66,7 @@ static void config_get_cpe_elements(struct uci_section *s) UCI_CPE_SESSION_TIMEOUT, UCI_CPE_INSTANCE_MODE, UCI_CPE_JSON_CUSTOM_NOTIFY_FILE, + UCI_CPE_FORCE_IPV4, __MAX_NUM_UCI_CPE_ATTRS, }; @@ -83,7 +84,8 @@ static void config_get_cpe_elements(struct uci_section *s) [UCI_CPE_SESSION_TIMEOUT] = { .name = "session_timeout", .type = UCI_TYPE_STRING }, [UCI_CPE_INSTANCE_MODE] = { .name = "instance_mode", .type = UCI_TYPE_STRING }, [UCI_CPE_JSON_CUSTOM_NOTIFY_FILE] = { .name = "custom_notify_json", .type = UCI_TYPE_STRING }, - [UCI_CPE_CON_REQ_TIMEOUT] = { .name = "cr_timeout", .type = UCI_TYPE_STRING } + [UCI_CPE_CON_REQ_TIMEOUT] = { .name = "cr_timeout", .type = UCI_TYPE_STRING }, + [UCI_CPE_FORCE_IPV4] = { .name = "force_ipv4", .type = UCI_TYPE_STRING } }; struct uci_option *cpe_tb[__MAX_NUM_UCI_CPE_ATTRS]; @@ -176,6 +178,10 @@ static void config_get_cpe_elements(struct uci_section *s) snprintf(cwmp_main->conf.custom_notify_json, sizeof(cwmp_main->conf.custom_notify_json), "%s", get_value_from_uci_option(cpe_tb[UCI_CPE_JSON_CUSTOM_NOTIFY_FILE])); CWMP_LOG(DEBUG, "CWMP CONFIG - cpe custom notify json path: %s", cwmp_main->conf.custom_notify_json); + + cwmp_main->conf.force_ipv4 = uci_str_to_bool(get_value_from_uci_option(cpe_tb[UCI_CPE_FORCE_IPV4])); + CWMP_LOG(DEBUG, "CWMP CONFIG - cpe force ipv4 enable: %d", cwmp_main->conf.force_ipv4); + } static void config_get_acs_elements(struct uci_section *s)