Commit e2998ac4 authored by Franco Fichtner's avatar Franco Fichtner

interfaces: skip rtsold in case required by ISP for #637

parent b1161dfd
......@@ -3419,7 +3419,7 @@ function interface_dhcpv6_configure($interface = 'wan', $wancfg)
$dhcp6cscript = "#!/bin/sh\n";
$dhcp6cscript .= "# This shell script launches /usr/local/etc/rc.newwanipv6 with a interface argument.\n";
$dhcp6cscript .= "/usr/local/etc/rc.newwanipv6 {$wanif} \n";
/* Add wide-dhcp6c shell script here. Because we can not pass a argument to it. */
if (!@file_put_contents("/var/etc/dhcp6c_{$interface}_script.sh", $dhcp6cscript)) {
printf("Error: cannot open dhcp6c_{$interface}_script.sh in interface_dhcpv6_configure() for writing.\n");
unset($dhcp6cscript);
......@@ -3428,6 +3428,16 @@ function interface_dhcpv6_configure($interface = 'wan', $wancfg)
unset($dhcp6cscript);
chmod("/var/etc/dhcp6c_{$interface}_script.sh", 0755);
$dhcp6ccommand = exec_safe(
"/usr/local/sbin/dhcp6c %s -c %s -p %s %s",
array(
empty($wancfg['adv_dhcp6_debug']) ? '-d' : '-D',
"/var/etc/dhcp6c_{$interface}.conf",
"/var/run/dhcp6c_{$wanif}.pid",
"{$wanif}"
)
);
$rtsoldscript = "#!/bin/sh\n";
$rtsoldscript .= "# This shell script launches dhcp6c and configured gateways for this interface.\n";
$rtsoldscript .= "echo $2 > /tmp/{$wanif}_routerv6\n";
......@@ -3436,10 +3446,9 @@ function interface_dhcpv6_configure($interface = 'wan', $wancfg)
$rtsoldscript .= "\t/bin/pkill -F /var/run/dhcp6c_{$wanif}.pid\n";
$rtsoldscript .= "\t/bin/sleep 1\n";
$rtsoldscript .= "fi\n";
$rtsoldscript .= "/usr/local/sbin/dhcp6c " . (empty($wancfg['adv_dhcp6_debug']) ? '-d' : '-D') ;
$rtsoldscript .= " -c /var/etc/dhcp6c_{$interface}.conf -p /var/run/dhcp6c_{$wanif}.pid {$wanif}\n";
$rtsoldscript .= "/usr/bin/logger -t rtsold \"Starting dhcp6 client for interface {$interface}({$wanif})\"\n";
/* Add wide-dhcp6c shell script here. Because we can not pass a argument to it. */
$rtsoldscript .= "$dhcp6ccommand\n";
if (!@file_put_contents("/var/etc/rtsold_{$wanif}_script.sh", $rtsoldscript)) {
printf("Error: cannot open rtsold_{$wanif}_script.sh in interface_dhcpv6_configure() for writing.\n");
unset($rtsoldscript);
......@@ -3456,12 +3465,13 @@ function interface_dhcpv6_configure($interface = 'wan', $wancfg)
/* Enable RFC6204w support for IPv6 Customer Edge (CE) router */
set_single_sysctl("net.inet6.ip6.rfc6204w3", "1");
/* fire up rtsold for IPv6 RAs first, this backgrounds immediately. It will call dhcp6c */
if (isvalidpid("/var/run/rtsold_{$wanif}.pid")) {
killbypid("/var/run/rtsold_{$wanif}.pid");
sleep(2);
}
killbypid("/var/run/rtsold_{$wanif}.pid", 'TERM', true);
if (isset($wancfg['dhcp6sendsolicit'])) {
/* command is already exec_safe() */
mwexec($dhcp6ccommand);
} else {
/* fire up rtsold for IPv6 RAs first, this backgrounds immediately. It will call dhcp6c */
mwexecf(
'/usr/sbin/rtsold -p %s -O %s -R %s %s %s',
array(
......@@ -3472,10 +3482,7 @@ function interface_dhcpv6_configure($interface = 'wan', $wancfg)
$wanif
)
);
/* NOTE: will be called from rtsold invoked script
* link_interface_to_track6($interface, "update");
*/
}
return 0;
}
......
......@@ -371,6 +371,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
$pconfig['blockpriv'] = isset($a_interfaces[$if]['blockpriv']);
$pconfig['blockbogons'] = isset($a_interfaces[$if]['blockbogons']);
$pconfig['dhcp6-ia-pd-send-hint'] = isset($a_interfaces[$if]['dhcp6-ia-pd-send-hint']);
$pconfig['dhcp6sendsolicit'] = isset($a_interfaces[$if]['dhcp6sendsolicit']);
$pconfig['dhcp6prefixonly'] = isset($a_interfaces[$if]['dhcp6prefixonly']);
$pconfig['dhcp6usev4iface'] = isset($a_interfaces[$if]['dhcp6usev4iface']);
$pconfig['adv_dhcp6_debug'] = isset($a_interfaces[$if]['adv_dhcp6_debug']);
......@@ -1060,6 +1061,9 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
if (!empty($pconfig['dhcp6prefixonly'])) {
$new_config['dhcp6prefixonly'] = true;
}
if (!empty($pconfig['dhcp6sendsolicit'])) {
$new_config['dhcp6sendsolicit'] = true;
}
if (!empty($pconfig['dhcp6usev4iface'])) {
$new_config['dhcp6usev4iface'] = true;
}
......@@ -2460,6 +2464,15 @@ include("head.inc");
</div>
</td>
</tr>
<tr class="dhcpv6_basic">
<td><a id="help_for_dhcp6sendsolicit" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?=gettext('Directly send SOLICIT'); ?></td>
<td>
<input name="dhcp6sendsolicit" type="checkbox" id="dhcp6sendsolicit" value="yes" <?= !empty($pconfig['dhcp6sendsolicit']) ? 'checked="checked"' : '' ?>/>
<div class="hidden" for="help_for_dhcp6sendsolicit">
<?= gettext('In case the ISP requires a SOLICIT message for authentication, select this option to prevent indefinite waiting for a router advertisement.') ?>
</div>
</td>
</tr>
<tr class="dhcpv6_basic">
<td><a id="help_for_dhcp6-ia-pd-len" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?=gettext("DHCPv6 Prefix Delegation size"); ?></td>
<td>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment