force connectivity on ipv4

This commit is contained in:
suvendhu 2023-09-20 19:48:51 +05:30
parent 897a91d11a
commit c2a310b499
4 changed files with 20 additions and 1 deletions

View file

@ -417,6 +417,15 @@
<td class="td_row_even"><div class="td_row_even"></div></td>
<td class="td_row_even"><div class="td_row_even">This configure firewall rules. Allowed values <IP_Only/Port_Only/IP_Port>. 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.</div></td>
</tr>
<tr>
<td class="td_row_odd"><div class="td_row_odd">force_ipv4</div></td>
<td class="td_row_odd"><div class="td_row_odd">boolean</div></td>
<td class="td_row_odd"><div class="td_row_odd">no</div></td>
<td class="td_row_odd"><div class="td_row_odd"></div></td>
<td class="td_row_odd">
<div class="td_row_odd">If set to <b>1</b>, it forces the connectivity over v4 IP address.</div>
</td>
</tr>
</tbody>
</table>
</td>

View file

@ -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];

View file

@ -155,6 +155,7 @@ typedef struct config {
unsigned int session_timeout;
bool http_disable_100continue;
int cr_timeout;
bool force_ipv4;
} config;
struct deviceid {

View file

@ -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)