Add a checkbox to allow setting a 3G/dialup modem as the default interface/gateway.

This commit is contained in:
Ermal Lui 2010-01-27 23:26:38 +00:00
parent f26baf72d1
commit daf8594a23
2 changed files with 14 additions and 1 deletions

View File

@ -893,7 +893,8 @@ function interface_ppp_configure($ifcfg,$edit=false) {
} else
$peerfile .= " set dial \"\"\n";
$peerfile .= " set speed {$ppp['linespeed']}\n";
$peerfile .= " add default HISADDR\n";
if (isset($ppp['defaultgw']))
$peerfile .= " add default HISADDR\n";
$peerfile .= " set timeout 0\n";
$peerfile .= " enable dns\n";
$endingip = $startingip+1;

View File

@ -62,6 +62,8 @@ if (isset($id) && $a_ppps[$id]) {
$pconfig['password'] = $a_ppps[$id]['password'];
$pconfig['gateway'] = $a_ppps[$id]['gateway'];
$pconfig['localip'] = $a_ppps[$id]['localip'];
if (isset($a_ppps[$id]['defaultgw']))
$pconfig['defaultgw'] = true;
$pconfig['phone'] = $a_ppps[$id]['phone'];
$pconfig['dialcmd'] = base64_decode($a_ppps[$id]['dialcmd']);
$pconfig['connect-max-attempts'] = $a_ppps[$id]['connect-max-attempts'];
@ -101,6 +103,10 @@ if ($_POST) {
$ppp['password'] = $_POST['password'];
$ppp['localip'] = $_POST['localip'];
$ppp['gateway'] = $_POST['gateway'];
if ($_POST['defaultgw'] == "on")
$ppp['defaultgw'] = true;
else
unset($ppp['defaultgw']);
$ppp['linespeed'] = $_POST['linespeed'];
$ppp['connect-max-attempts'] = $_POST['connect-max-attempts'];
$ppp['descr'] = $_POST['descr'];
@ -180,6 +186,12 @@ include("head.inc");
<a href='#' onClick='javascript:prefill_vzw();'>Verizon</A>
</td>
</tr>
<tr>
<td width="22%" valign="top" class="vncell">Link Type</td>
<td width="78%" class="vtable">
<input type="checkbox" value="on" id="defaultgw" name="defaultgw" <?php if (isset($pconfig['defaultgw'])) "echo checked"; ?>>This link will be used as default gateway.
</td>
</tr>
<tr>
<td width="22%" valign="top" class="vncell">Init String</td>
<td width="78%" class="vtable">