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

This commit is contained in:
Franco Fichtner 2016-05-09 09:40:11 +02:00
parent 51531ca047
commit b3d1481797
2 changed files with 6 additions and 3 deletions

View File

@ -662,6 +662,7 @@ function system_staticroutes_configure($interface = '', $update_dns = false)
}
$gatewayip = $gateway['gateway'];
$needs_iface = isset($gateway['fargw']);
$interfacegw = $gateway['interface'];
$blackhole = "";
@ -715,11 +716,12 @@ function system_staticroutes_configure($interface = '', $update_dns = false)
$ip .= "/128";
}
$inet = (is_subnetv6($ip) ? "-inet6" : "-inet");
$iface = $needs_iface ? ' -iface ' . escapeshellarg($interfacegw) . ' ' : '';
$cmd = " {$inet} {$blackhole} " . escapeshellarg($ip) . " ";
if (is_subnet($ip)) {
if (is_ipaddr($gatewayip)) {
mwexec("/sbin/route delete".$cmd . escapeshellarg($gatewayip));
mwexec("/sbin/route add".$cmd . escapeshellarg($gatewayip));
mwexec("/sbin/route delete".$cmd . $iface . escapeshellarg($gatewayip));
mwexec("/sbin/route add".$cmd . $iface . escapeshellarg($gatewayip));
} elseif (!empty($interfacegw)) {
mwexec("/sbin/route delete".$cmd . "-iface " . escapeshellarg($interfacegw));
mwexec("/sbin/route add".$cmd . "-iface " . escapeshellarg($interfacegw));

View File

@ -645,7 +645,8 @@ $( document ).ready(function() {
<td>
<input name="fargw" type="checkbox" value="yes" <?=!empty($pconfig['fargw']) ? 'checked="checked"' : '';?> />
<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>
</td>
</tr>