diff options
-rw-r--r-- | etc/inc/util.inc | 10 | ||||
-rwxr-xr-x | etc/rc.bootup | 3 | ||||
-rw-r--r-- | usr/local/www/system_advanced_network.php | 20 |
3 files changed, 33 insertions, 0 deletions
diff --git a/etc/inc/util.inc b/etc/inc/util.inc index 6e91eb6..69fcbf5 100644 --- a/etc/inc/util.inc +++ b/etc/inc/util.inc @@ -2064,4 +2064,14 @@ function get_current_theme() { return $theme; } +/* Define what is preferred, IPv4 or IPv6 */ +function prefer_ipv4_or_ipv6() { + global $config; + + if (isset($config['system']['prefer_ipv4'])) + mwexec("/etc/rc.d/ip6addrctl prefer_ipv4"); + else + mwexec("/etc/rc.d/ip6addrctl prefer_ipv6"); +} + ?> diff --git a/etc/rc.bootup b/etc/rc.bootup index 89a2be7..f391a27 100755 --- a/etc/rc.bootup +++ b/etc/rc.bootup @@ -409,6 +409,9 @@ upnp_start(); /* If powerd is enabled, lets launch it */ activate_powerd(); +/* Set preferred protocol */ +prefer_ipv4_or_ipv6(); + /* Remove the old shutdown binary if we kept it. */ if (file_exists("/sbin/shutdown.old")) @unlink("/sbin/shutdown.old"); diff --git a/usr/local/www/system_advanced_network.php b/usr/local/www/system_advanced_network.php index 82b5661..28450ad 100644 --- a/usr/local/www/system_advanced_network.php +++ b/usr/local/www/system_advanced_network.php @@ -51,6 +51,7 @@ require_once("shaper.inc"); $pconfig['ipv6nat_enable'] = isset($config['diag']['ipv6nat']['enable']); $pconfig['ipv6nat_ipaddr'] = $config['diag']['ipv6nat']['ipaddr']; $pconfig['ipv6allow'] = isset($config['system']['ipv6allow']); +$pconfig['prefer_ipv4'] = isset($config['system']['prefer_ipv4']); $pconfig['polling_enable'] = isset($config['system']['polling']); $pconfig['sharednet'] = $config['system']['sharednet']; $pconfig['disablechecksumoffloading'] = isset($config['system']['disablechecksumoffloading']); @@ -88,6 +89,12 @@ if ($_POST) { unset($config['system']['ipv6allow']); } + if($_POST['prefer_ipv4'] == "yes") { + $config['system']['prefer_ipv4'] = true; + } else { + unset($config['system']['prefer_ipv4']); + } + if($_POST['sharednet'] == "yes") { $config['system']['sharednet'] = true; system_disable_arp_wrong_if(); @@ -136,6 +143,9 @@ if ($_POST) { // Configure flowtable support from filter.inc flowtable_configure(); + // Set preferred protocol + prefer_ipv4_or_ipv6(); + $retval = filter_configure(); if(stristr($retval, "error") <> true) $savemsg = get_std_save_message(gettext($retval)); @@ -228,6 +238,16 @@ function enable_change(enable_over) { </td> </tr> <tr> + <td width="22%" valign="top" class="vncell"><?=gettext("Prefer IPv4 over IPv6"); ?></td> + <td width="78%" class="vtable"> + <input name="prefer_ipv4" type="checkbox" id="prefer_ipv4" value="yes" <?php if ($pconfig['prefer_ipv4']) echo "checked=\"checked\""; ?> /> + <strong><?=gettext("Prefer to use IPv4 even if IPv6 is available"); ?></strong><br/> + <?=gettext("By default, if a hostname resolves IPv6 and IPv4 addresses ". + "IPv6 will be used, if you check this option, IPv4 will be " . + "used instead of IPv6."); ?><br /> + </td> + </tr> + <tr> <td colspan="2" class="list" height="12"> </td> </tr> <tr> |