Commit b3d14817 authored by Franco Fichtner's avatar Franco Fichtner

gateways: pick up interface for manual route to far gateway; closes #880

parent 51531ca0
...@@ -662,6 +662,7 @@ function system_staticroutes_configure($interface = '', $update_dns = false) ...@@ -662,6 +662,7 @@ function system_staticroutes_configure($interface = '', $update_dns = false)
} }
$gatewayip = $gateway['gateway']; $gatewayip = $gateway['gateway'];
$needs_iface = isset($gateway['fargw']);
$interfacegw = $gateway['interface']; $interfacegw = $gateway['interface'];
$blackhole = ""; $blackhole = "";
...@@ -715,11 +716,12 @@ function system_staticroutes_configure($interface = '', $update_dns = false) ...@@ -715,11 +716,12 @@ function system_staticroutes_configure($interface = '', $update_dns = false)
$ip .= "/128"; $ip .= "/128";
} }
$inet = (is_subnetv6($ip) ? "-inet6" : "-inet"); $inet = (is_subnetv6($ip) ? "-inet6" : "-inet");
$iface = $needs_iface ? ' -iface ' . escapeshellarg($interfacegw) . ' ' : '';
$cmd = " {$inet} {$blackhole} " . escapeshellarg($ip) . " "; $cmd = " {$inet} {$blackhole} " . escapeshellarg($ip) . " ";
if (is_subnet($ip)) { if (is_subnet($ip)) {
if (is_ipaddr($gatewayip)) { if (is_ipaddr($gatewayip)) {
mwexec("/sbin/route delete".$cmd . escapeshellarg($gatewayip)); mwexec("/sbin/route delete".$cmd . $iface . escapeshellarg($gatewayip));
mwexec("/sbin/route add".$cmd . escapeshellarg($gatewayip)); mwexec("/sbin/route add".$cmd . $iface . escapeshellarg($gatewayip));
} elseif (!empty($interfacegw)) { } elseif (!empty($interfacegw)) {
mwexec("/sbin/route delete".$cmd . "-iface " . escapeshellarg($interfacegw)); mwexec("/sbin/route delete".$cmd . "-iface " . escapeshellarg($interfacegw));
mwexec("/sbin/route add".$cmd . "-iface " . escapeshellarg($interfacegw)); mwexec("/sbin/route add".$cmd . "-iface " . escapeshellarg($interfacegw));
......
...@@ -645,7 +645,8 @@ $( document ).ready(function() { ...@@ -645,7 +645,8 @@ $( document ).ready(function() {
<td> <td>
<input name="fargw" type="checkbox" value="yes" <?=!empty($pconfig['fargw']) ? 'checked="checked"' : '';?> /> <input name="fargw" type="checkbox" value="yes" <?=!empty($pconfig['fargw']) ? 'checked="checked"' : '';?> />
<div class="hidden" for="help_for_fargw"> <div class="hidden" for="help_for_fargw">
<?=gettext("This will allow the gateway to exist outside of the interface subnet."); ?> <?=gettext("This will allow the gateway to exist outside of the interface subnet. " .
"A corresponding route must bet set up for this gateway in order for it to operate correctly."); ?>
</div> </div>
</td> </td>
</tr> </tr>
......
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