Clean up pptp a bit and modify text description in interfaces_ppps_edit

This commit is contained in:
gnhb 2010-06-10 01:39:49 +07:00
parent 3a7658652c
commit 4a1ee8ac31
3 changed files with 32 additions and 19 deletions

View File

@ -1053,8 +1053,6 @@ function interface_ppps_configure($interface) {
break;
sleep(1);
}
log_error("Could not get PPtP/L2tP Local IP address for {$port} using DHCP in interfaces_ppps_configure");
return 0;
} else {
// Manually configure interface IP/subnet
mwexec("/sbin/ifconfig " . escapeshellarg($port) . " " .
@ -1062,15 +1060,15 @@ function interface_ppps_configure($interface) {
}
/* configure the gateway (remote IP ) */
if (!is_ipaddr($gateways[$pid]) && is_hostname($gateways[$pid])) {
// do a DNS lookup for the gateway IP and store it in $gateways[$pid]
/* do a DNS lookup for the gateway IP and store it in $gateways[$pid]
If this pptp interface is not the default gateway, the default must be up and nameservers must resolve
whatever the user enters as the hostname */
for ($count = 0; $count < 30; $count++) {
$gateways[$pid] = gethostbyname($gateways[$pid]);
if(is_ipaddr($gateways[$pid]))
break;
sleep(1);
}
log_error("Could not get a PPtP/L2tP Remote IP address for {$port} using DNS in interfaces_ppps_configure");
return 0;
}
if (0) // Logic for this?
log_error("Could not bring up interface {$port} for {$interface} {$ppp['type']} link in interface_ppps_configure().");

View File

@ -150,9 +150,13 @@ if ($wancfg['if'] == $a_ppps[$pppid]['if']) {
if ($a_ppps[$pppid]['type'] == "pptp"){
$pconfig['pptp_username'] = $a_ppps[$pppid]['username'];
$pconfig['pptp_password'] = base64_decode($a_ppps[$pppid]['password']);
$pconfig['pptp_local'] = $a_ppps[$pppid]['localip'];
$pconfig['pptp_subnet'] = $a_ppps[$pppid]['subnet'];
$pconfig['pptp_remote'] = $a_ppps[$pppid]['gateway'];
$pconfig['pptp_local'] = explode(",",$a_ppps[$pppid]['localip']);
foreach ($pconfig['pptp_local'] as $key => $value){
if ($value == "dhcp")
$pconfig['localip'][$key] = "";
}
$pconfig['pptp_subnet'] = explode(",",$a_ppps[$pppid]['subnet']);
$pconfig['pptp_remote'] = explode(",",$a_ppps[$pppid]['gateway']);
$pconfig['pptp_dialondemand'] = isset($a_ppps[$pppid]['ondemand']);
$pconfig['pptp_idletimeout'] = $a_ppps[$pppid]['timeout'];
}
@ -1412,17 +1416,17 @@ $types = array("none" => "None", "static" => "Static", "dhcp" => "DHCP", "ppp" =
<tr>
<td width="22%" valign="top" class="vncellreq">Password</td>
<td width="78%" class="vtable">
<input name="pptp_password" type="text" class="formfld pwd" id="pptp_password" size="20" value="<?=htmlspecialchars($pconfig['pptp_password']);?>">
<input name="pptp_password" type="password" class="formfld pwd" id="pptp_password" size="20" value="<?=htmlspecialchars($pconfig['pptp_password']);?>">
</td>
</tr>
<tr>
<td width="22%" width="100" valign="top" class="vncellreq">Local IP address</td>
<td width="78%" class="vtable">
<input name="pptp_local" type="text" class="formfld unknown" id="pptp_local" size="20" value="<?=htmlspecialchars($pconfig['pptp_local']);?>">
<input name="pptp_local" type="text" class="formfld unknown" id="pptp_local" size="20" value="<?=htmlspecialchars($pconfig['pptp_local'][0]);?>">
/
<select name="pptp_subnet" class="formselect" id="pptp_subnet">
<?php for ($i = 31; $i > 0; $i--): ?>
<option value="<?=$i;?>" <?php if ($i == $pconfig['pptp_subnet']) echo "selected"; ?>>
<option value="<?=$i;?>" <?php if ($i == $pconfig['pptp_subnet'][0]) echo "selected"; ?>>
<?=$i;?></option>
<?php endfor; ?>
</select>
@ -1431,7 +1435,7 @@ $types = array("none" => "None", "static" => "Static", "dhcp" => "DHCP", "ppp" =
<tr>
<td width="22%" width="100" valign="top" class="vncellreq">Remote IP address</td>
<td width="78%" class="vtable">
<input name="pptp_remote" type="text" class="formfld unknown" id="pptp_remote" size="20" value="<?=htmlspecialchars($pconfig['pptp_remote']);?>">
<input name="pptp_remote" type="text" class="formfld unknown" id="pptp_remote" size="20" value="<?=htmlspecialchars($pconfig['pptp_remote'][0]);?>">
</td>
</tr>
<tr>
@ -1448,6 +1452,20 @@ $types = array("none" => "None", "static" => "Static", "dhcp" => "DHCP", "ppp" =
<input name="pptp_idletimeout" type="text" class="formfld unknown" id="pptp_idletimeout" size="8" value="<?=htmlspecialchars($pconfig['pptp_idletimeout']);?>"> seconds<br>If no qualifying outgoing packets are transmitted for the specified number of seconds, the connection is brought down. An idle timeout of zero disables this feature.
</td>
</tr>
<tr>
<td width="22%" valign="top" class="vncell">Advanced</td>
<?php if (isset($pconfig['pppid'])): ?>
<td width="78%" class="vtable">
<a href="/interfaces_ppps_edit.php?id=<?=htmlspecialchars($pconfig['pppid']);?>" class="navlnk">Click here</a>
for additional PPtP and L2tP configuration options. Save first if you made changes.
</td>
<? else: ?>
<td width="78%" class="vtable">
<a href="/interfaces_ppps_edit.php" class="navlnk">Click here</a>
for advanced PPtP and L2tP configuration options.
</td>
<? endif; ?>
</tr>
</table>
</td>
</tr>

View File

@ -107,9 +107,6 @@ if (isset($id) && $a_ppps[$id]) {
}
$pconfig['subnet'] = explode(",",$a_ppps[$id]['subnet']);
$pconfig['gateway'] = explode(",",$a_ppps[$id]['gateway']);
if (isset($a_ppps[$id]['dhcp']))
$pconfig['pptp_dhcp'] = true;
break;
case "pppoe":
$pconfig['provider'] = $a_ppps[$id]['provider'];
/* ================================================ */
@ -694,7 +691,7 @@ $types = array("select" => "Select", "ppp" => "PPP", "pppoe" => "PPPoE", "pptp"
<tr style="display:none" id="advanced_<?=$k;?>" name="advanced_<?=$k;$k++;?>">
<td width="22%" valign="top" class="vncell"><?= gettext("Compression"); ?></td>
<td width="78%" class="vtable">
<input type="checkbox" value="on" id="vjcomp" name="vjcomp" <?php if (isset($pconfig['vjcomp'])) echo "checked"; ?>>&nbsp;<?= gettext("Disable vjcomp(compression) (enabled by default)."); ?>
<input type="checkbox" value="on" id="vjcomp" name="vjcomp" <?php if (isset($pconfig['vjcomp'])) echo "checked"; ?>>&nbsp;<?= gettext("Disable vjcomp(compression) (auto-negotiated by default)."); ?>
<br/> <span class="vexpl">This option enables Van Jacobson TCP header compression, which saves several bytes per TCP data packet.
You almost always want this option. This compression ineffective for TCP connections with enabled modern extensions like time
stamping or SACK, which modify TCP options between sequential packets.</span>
@ -714,7 +711,7 @@ $types = array("select" => "Select", "ppp" => "PPP", "pppoe" => "PPPoE", "pptp"
<tr style="display:none" id="advanced_<?=$k;?>" name="advanced_<?=$k;$k++;?>">
<td width="22%" valign="top" class="vncell">ShortSeq</td>
<td width="78%" class="vtable">
<input type="checkbox" value="on" id="shortseq" name="shortseq" <?php if (isset($pconfig['shortseq'])) echo "checked"; ?>>&nbsp;<?= gettext("Disable shortseq (enabled by default)."); ?>
<input type="checkbox" value="on" id="shortseq" name="shortseq" <?php if (isset($pconfig['shortseq'])) echo "checked"; ?>>&nbsp;<?= gettext("Disable shortseq (auto-negotiated by default)."); ?>
<br/> <span class="vexpl"><?= gettext("This option is only meaningful if multi-link PPP is negotiated. It proscribes shorter multi-link fragment headers, saving two bytes on every frame.
It is not necessary to disable this for connections that are not multi-link."); ?></span>
</td>
@ -722,14 +719,14 @@ $types = array("select" => "Select", "ppp" => "PPP", "pppoe" => "PPPoE", "pptp"
<tr style="display:none" id="advanced_<?=$k;?>" name="advanced_<?=$k;$k++;?>">
<td width="22%" valign="top" class="vncell">ACFComp</td>
<td width="78%" class="vtable">
<input type="checkbox" value="on" id="acfcomp" name="acfcomp" <?php if (isset($pconfig['acfcomp'])) echo "checked"; ?>>&nbsp;<?= gettext("Disable acfcomp(compression) (enabled by default)."); ?>
<input type="checkbox" value="on" id="acfcomp" name="acfcomp" <?php if (isset($pconfig['acfcomp'])) echo "checked"; ?>>&nbsp;<?= gettext("Disable acfcomp(compression) (auto-negotiated by default)."); ?>
<br/> <span class="vexpl"><?= gettext("Address and control field compression. This option only applies to asynchronous link types. It saves two bytes per frame."); ?></span>
</td>
</tr>
<tr style="display:none" id="advanced_<?=$k;?>" name="advanced_<?=$k;$k++;?>">
<td width="22%" valign="top" class="vncell">ProtoComp</td>
<td width="78%" class="vtable">
<input type="checkbox" value="on" id="protocomp" name="protocomp" <?php if (isset($pconfig['protocomp'])) echo "checked"; ?>>&nbsp;<?= gettext("Disable protocomp(compression) (enabled by default)."); ?>
<input type="checkbox" value="on" id="protocomp" name="protocomp" <?php if (isset($pconfig['protocomp'])) echo "checked"; ?>>&nbsp;<?= gettext("Disable protocomp(compression) (auto-negotiated by default)."); ?>
<br/> <span class="vexpl"><?= gettext("Protocol field compression. This option saves one byte per frame for most frames."); ?></span>
</td>
</tr>