summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--etc/inc/interfaces.inc125
-rw-r--r--usr/local/www/interfaces_ppps_edit.php44
2 files changed, 83 insertions, 86 deletions
diff --git a/etc/inc/interfaces.inc b/etc/inc/interfaces.inc
index 371fe80..81d9042 100644
--- a/etc/inc/interfaces.inc
+++ b/etc/inc/interfaces.inc
@@ -1073,6 +1073,15 @@ function interface_ppps_configure($interface) {
$type = $ppp['type'];
$upper_type = strtoupper($ppp['type']);
+ // mpd5 requires a /var/spool/lock directory for PPP modem links.
+ if(!is_dir("/var/spool/lock")) {
+ exec("/bin/mkdir -p /var/spool/lock");
+ exec("/bin/chmod a+rw /var/spool/lock/.");
+ }
+ // mpd5 modem chat script expected in the same directory as the mpd_xxx.conf files
+ if (!file_exists("{$g['varetc_path']}/mpd.script"))
+ mwexec("/bin/ln -s /usr/local/sbin/mpd.script {$g['varetc_path']}/.");
+
if($g['booting'])
echo " configuring {$upper_type} on {$pppif} interface...\n";
@@ -1082,8 +1091,7 @@ function interface_ppps_configure($interface) {
log_error("Error: cannot open mpd_{$interface}.conf in interface_ppps_configure().\n");
return 1;
}
-
- $ports=explode(",",$ppp['ports']);
+ $ports = explode(',',$ppp['ports']);
if (is_array($ports) && count($ports) > 1)
$multilink = "enable";
else
@@ -1110,27 +1118,7 @@ function interface_ppps_configure($interface) {
$ondemand = "disable";
if (!isset($ppp['idletimeout']))
$ppp['idletimeout'] = 0;
- if (isset($ppp['tcpmssfix']))
- $tcpmssfix = "enable";
- else
- $tcpmssfix = "disable";
-
- if (isset($ppp['vjcomp']))
- $vjcomp = "enable";
- else
- $vjcomp = "disable";
- if (isset($ppp['acfcomp']))
- $acfcomp = "enable";
- else
- $acfcomp = "disable";
- if (isset($ppp['protocomp']))
- $protocomp = "enable";
- else
- $protocomp = "disable";
- if ($multilink == "enable" && isset($ppp['shortseq']))
- $shortseq = "enable";
- else
- $shortseq = "disable";
+
if (empty($ppp['username']) && $type == "modem"){
$ppp['username'] = "user";
$ppp['password'] = "none";
@@ -1138,11 +1126,6 @@ function interface_ppps_configure($interface) {
if (empty($ppp['password']) && $type == "modem")
$ppp['password'] = "none";
- if (isset($ppp['incoming']))
- $incoming = "enable";
- else
- $incoming = "disable";
-
// Construct the mpd.conf file
$mpdconf = <<<EOD
startup:
@@ -1177,45 +1160,73 @@ EOD;
EOD;
}
-
+ if (isset($ppp['tcpmssfix'])) {
+ $mpdconf .= <<<EOD
+ set iface enable tcpmssfix
+
+EOD;
+ }
$mpdconf .= <<<EOD
- set iface {$tcpmssfix} tcpmssfix
set iface up-script /usr/local/sbin/ppp-linkup
set iface down-script /usr/local/sbin/ppp-linkdown
set ipcp ranges {$ranges}
- set ipcp {$vjcomp} vjcomp
EOD;
-
- if (isset($config['system']['dnsallowoverride'])) {
+ if (isset($ppp['vjcomp'])){
$mpdconf .= <<<EOD
- set ipcp enable req-pri-dns
+ set ipcp no vjcomp
EOD;
}
+ if (isset($config['system']['dnsallowoverride']) && isset($ppp['defaultgw'])) {
+ $mpdconf .= <<<EOD
+ set ipcp enable req-pri-dns
+ set ipcp enable req-sec-dns
+
+EOD;
+ }
+/*
if (!isset($wancfg['dnsnosec']) && isset($config['system']['dnsallowoverride'])) {
$mpdconf .= <<<EOD
set ipcp enable req-sec-dns
EOD;
}
-
- foreach($ports as $port){
+*/
+ foreach($ports as $pid => $port){
$mpdconf .= <<<EOD
- create link static lnk{$interface} {$type}
+ create link static L{$pid}-{$interface} {$type}
set link action bundle {$interface}
set link {$multilink} multilink
set link keep-alive 10 60
set link max-redial 0
- set link {$shortseq} shortseq
- set link {$acfcomp} acfcomp
- set link {$protocomp} protocomp
- set link {$incoming} incoming
+
+EOD;
+ if (isset($ppp['shortseq'])){
+ $mpdconf .= <<<EOD
+ set link no shortseq
+
+EOD;
+ }
+ if (isset($ppp['acfcomp'])){
+ $mpdconf .= <<<EOD
+ set link no acfcomp
+
+EOD;
+ }
+ if (isset($ppp['protocomp'])){
+ $mpdconf .= <<<EOD
+ set link no protocomp
+
+EOD;
+ }
+
+ $mpdconf .= <<<EOD
set link disable chap pap
set link accept chap pap eap
- #set link enable no-orig-auth
+ set link disable incoming
EOD;
/*
@@ -1277,24 +1288,24 @@ EOD;
EOD;
}
- if ($type == "pppoe") {
+ if (isset($ppp['provider']) && $type == "pppoe") {
$mpdconf .= <<<EOD
- set pppoe iface {$port}
+ set pppoe service "{$ppp['provider']}"
EOD;
}
- if (isset($ppp['provider']) && $type == "pppoe") {
+ if ($type == "pppoe") {
$mpdconf .= <<<EOD
- set pppoe service "{$ppp['provider']}"
+ set pppoe iface {$port}
EOD;
}
if ($type == "pptp") {
$mpdconf .= <<<EOD
+ set bundle no noretry
set pptp self {$ppp['localip']}
set pptp peer {$ppp['gateway']}
set pptp disable windowing
- set bundle no noretry
EOD;
}
@@ -1340,30 +1351,28 @@ EOD;
log_error("Could not bring up interface {$port} for {$ppp['type']} link on {$interface} in interface_ppps_configure().");
break;
case "ppp":
- if (!file_exists("{$ppp['ports']}")) {
- log_error("Device {$ppp['ports']} does not exist. PPP link cannot start without the modem device.");
+ if (!file_exists("{$port}")) {
+ log_error("Device {$port} does not exist. PPP link cannot start without the modem device.");
return 1;
}
break;
default:
break;
}
-
- /* fire up mpd */
- mwexec("/usr/local/sbin/mpd5 -b -k -d {$g['varetc_path']} -f mpd_{$interface}.conf -p {$g['varrun_path']}/{$ppp['type']}_{$interface}.pid -s {$interface} {$ppp['type']}client");
}
+
+ /* fire up mpd */
+ mwexec("/usr/local/sbin/mpd5 -b -k -d {$g['varetc_path']} -f mpd_{$interface}.conf -p {$g['varrun_path']}/{$ppp['type']}_{$interface}.pid -s {$interface} {$ppp['type']}client");
}
/* sleep until wan is up - or 30 seconds, whichever comes first */
for ($count = 0; $count < 30; $count++) {
- if(file_exists("{$g['tmp_path']}/{$realif}up")) {
+ if(file_exists("{$g['tmp_path']}/{$pppif}up")) {
break;
}
sleep(1);
}
- //unlink_if_exists("{$g['tmp_path']}/{$realif}up");
-
return 0;
}
@@ -2262,13 +2271,13 @@ function interface_configure($interface = "wan", $reloadall = false) {
interface_dhcp_configure($interface);
break;
case 'pppoe':
- interface_pppoe_configure($interface);
+ interface_ppps_configure($interface);
break;
case 'pptp':
- interface_pptp_configure($interface);
+ interface_pps_configure($interface);
break;
case 'ppp':
- interface_ppp_configure($interface);
+ interface_ppps_configure($interface);
break;
default:
if ($wancfg['ipaddr'] <> "" && $wancfg['subnet'] <> "") {
diff --git a/usr/local/www/interfaces_ppps_edit.php b/usr/local/www/interfaces_ppps_edit.php
index aa11ff7..9bfa2c4 100644
--- a/usr/local/www/interfaces_ppps_edit.php
+++ b/usr/local/www/interfaces_ppps_edit.php
@@ -218,7 +218,9 @@ if ($_POST) {
break;
}
if ($_POST['type'] == "ppp" && count($_POST['interfaces']) > 1)
- $input_errors[] = "The PPP link type does not support multilink connections (MLPPP). Please select only one Link Interface.";
+ $input_errors[] = "Multilink connections (MLPPP) using the PPP link type is not currently supported. Please select only one Link Interface.";
+ if ($_POST['type'] == "pptp" && count($_POST['interfaces']) > 1)
+ $input_errors[] = "Multilink connections (MLPPP) using the PPTP link type is not currently supported. Please select only one Link Interface.";
if (($_POST['provider'] && !is_domain($_POST['provider'])))
$input_errors[] = "The service name contains invalid characters.";
if (($_POST['idletimeout'] != "") && !is_numericint($_POST['idletimeout']))
@@ -262,7 +264,7 @@ if ($_POST) {
$ppp = array();
$ppp['ptpid'] = $_POST['ptpid'];
$ppp['type'] = $_POST['type'];
- $ppp['ports'] = implode(',', $_POST['interfaces']);
+ $ppp['ports'] = implode(',',$_POST['interfaces']);
$ppp['username'] = $_POST['username'];
$ppp['password'] = base64_encode($_POST['password']);
$ppp['defaultgw'] = $_POST['defaultgw'] ? true : false;
@@ -370,19 +372,7 @@ if ($_POST) {
write_config();
if (!empty($thisif)){
- switch ($_POST['type']) {
- case "pppoe":
- interface_ppps_configure($thisif);
- break;
- case "pptp":
- interface_pptp_configure($thisif);
- break;
- case "ppp":
- interface_ppps_configure($thisif);
- break;
- default:
- break;
- }
+ interface_ppps_configure($thisif);
}
header("Location: interfaces_ppps.php");
exit;
@@ -529,7 +519,7 @@ $types = array("select" => "Select", "ppp" => "PPP", "pppoe" => "PPPoE", "pptp"
</tr>
<tr style="display:none" name="portlists" id="portlists">
<td id="serialports"><?php
- $selected_ports = explode(",",$pconfig['interfaces']);
+ $selected_ports = explode(',',$pconfig['interfaces']);
$serial = glob("/dev/cua*");
$modems = glob("/dev/modem*");
$serialports = array_merge($serial, $modems);
@@ -550,10 +540,8 @@ $types = array("select" => "Select", "ppp" => "PPP", "pppoe" => "PPPoE", "pptp"
$port_count = 0;
foreach ($portlist as $ifn => $ifinfo){
$port_count++;
- //if (is_jumbo_capable($ifn)) {
echo htmlspecialchars($ifn . " (" . $ifinfo['mac'] . ")") . ",{$ifn}";
- //echo "\"{$ifn}\"";
- if (stristr($pconfig['interfaces'], $ifn))
+ if (in_array($ifn,$selected_ports))
echo ",1|";
else
echo ",|";
@@ -592,9 +580,8 @@ $types = array("select" => "Select", "ppp" => "PPP", "pppoe" => "PPPoE", "pptp"
<tr>
<td valign="top" class="vncell">Idle Timeout</td>
<td class="vtable">
- <input name="idletimeout" type="text" class="formfld unknown" id="idletimeout" size="6" value="<?=htmlspecialchars($pconfig['idletimeout']);?>"> seconds
- <br/> <span class="vexpl">Sets the idle timeout value for the bundle. If no incoming or outgoing packets are transmitted for the set number of seconds
- the connection is brought down. An idle timeout of zero disables this feature. <bold>Default is 0.</bold>
+ <input name="idletimeout" type="text" class="formfld unknown" id="idletimeout" size="12" value="<?=htmlspecialchars($pconfig['idletimeout']);?>"> (seconds) <bold>Default is 0, which disables the timeout feature.</bold>
+ <br/> <span class="vexpl">If no incoming or outgoing packets are transmitted for the entered number of seconds the connection is brought down.
<br/>When the idle timeout occurs, if the dial-on-demand option is enabled, mpd goes back into dial-on-demand mode. Otherwise, the interface is brought down and all associated routes removed.</span>
</td>
</tr>
@@ -789,7 +776,7 @@ $types = array("select" => "Select", "ppp" => "PPP", "pppoe" => "PPPoE", "pptp"
<tr>
<td width="22%" valign="top" class="vncell">Compression</td>
<td width="78%" class="vtable">
- <input type="checkbox" value="on" id="vjcomp" name="vjcomp" <?php if (isset($pconfig['vjcomp'])) echo "checked"; ?>>&nbsp;Enable vjcomp(compression).
+ <input type="checkbox" value="on" id="vjcomp" name="vjcomp" <?php if (isset($pconfig['vjcomp'])) echo "checked"; ?>>&nbsp;Disable vjcomp(compression) (enabled 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>
@@ -798,7 +785,7 @@ $types = array("select" => "Select", "ppp" => "PPP", "pppoe" => "PPPoE", "pptp"
<tr>
<td width="22%" valign="top" class="vncell">TCPmssFix</td>
<td width="78%" class="vtable">
- <input type="checkbox" value="on" id="tcpmssfix" name="tcpmssfix" <?php if (isset($pconfig['tcpmssfix'])) echo "checked"; ?>>&nbsp;Enable tcpmssfix.
+ <input type="checkbox" value="on" id="tcpmssfix" name="tcpmssfix" <?php if (isset($pconfig['tcpmssfix'])) echo "checked"; ?>>&nbsp;Enable tcpmssfix (disabled by default).
<br/> <span class="vexpl">This option causes mpd to adjust incoming and outgoing TCP SYN segments so that the requested maximum segment size is not greater than the amount
allowed by the interface MTU. This is necessary in many setups to avoid problems caused by routers that drop ICMP Datagram Too Big messages. Without these messages,
the originating machine sends data, it passes the rogue router then hits a machine that has an MTU that is not big enough for the data. Because the IP Don't Fragment option is set,
@@ -809,21 +796,22 @@ $types = array("select" => "Select", "ppp" => "PPP", "pppoe" => "PPPoE", "pptp"
<tr>
<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;Enable shortseq.
- <br/> <span class="vexpl">This option is only meaningful if multi-link PPP is negotiated. It proscribes shorter multi-link fragment headers, saving two bytes on every frame.</span>
+ <input type="checkbox" value="on" id="shortseq" name="shortseq" <?php if (isset($pconfig['shortseq'])) echo "checked"; ?>>&nbsp;Disable shortseq (enabled by default).
+ <br/> <span class="vexpl">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>
</tr>
<tr>
<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;Enable acfcomp.
+ <input type="checkbox" value="on" id="acfcomp" name="acfcomp" <?php if (isset($pconfig['acfcomp'])) echo "checked"; ?>>&nbsp;Disable acfcomp(compression) (enabled by default).
<br/> <span class="vexpl">Address and control field compression. This option only applies to asynchronous link types. It saves two bytes per frame.</span>
</td>
</tr>
<tr>
<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;Enable protocomp(compression).
+ <input type="checkbox" value="on" id="protocomp" name="protocomp" <?php if (isset($pconfig['protocomp'])) echo "checked"; ?>>&nbsp;Disable protocomp(compression) (enabled by default).
<br/> <span class="vexpl">Protocol field compression. This option saves one byte per frame for most frames.</span>
</td>
</tr>
OpenPOWER on IntegriCloud