mirror of
https://github.com/pfsense/pfsense.git
synced 2025-10-26 11:38:35 +00:00
Changes to make PPP work again. mpd5 fails to establish a ppp link without
*some* username and password, so defaults are set if user enters nothing. Removed interface_ppp_configure call from interfaces_ppp_edit.php. It was useless there with the new structure, and it caused all PPP links to attempt to connect when user presses "Save" even before they are assigned to LAN/WAN, etc. Also, fix up pfsense-utils.inc and status_interfaces.php to display more info on status_interfaces.php. Changed util.inc to allow cua* interfaces to be recognized as real interfaces as pfSense got "interface mismatch" at boot and forced user to reassign. Maybe someone else has a better way to do this.
This commit is contained in:
parent
a216a03a00
commit
c90f247117
@ -969,24 +969,27 @@ EOD;
|
||||
}
|
||||
|
||||
$mpdconf .= <<<EOD
|
||||
# Create link.
|
||||
create link static lnk{$interface} modem
|
||||
set link disable chap pap
|
||||
set link accept chap pap eap
|
||||
set link enable no-orig-auth
|
||||
# To make Ringback work we should specify how to handle incoming calls originated by it.
|
||||
#set link enable incoming
|
||||
set link action bundle {$interface}
|
||||
|
||||
EOD;
|
||||
|
||||
if (!empty($ppp['username'])) {
|
||||
if (empty($ppp['username'])) {
|
||||
$ppp['username'] = "user";
|
||||
$ppp['password'] = "none";
|
||||
}
|
||||
if (empty($ppp['password']))
|
||||
$ppp['password'] = "none";
|
||||
|
||||
$mpdconf .= <<<EOD
|
||||
set auth authname "{$ppp['username']}"
|
||||
set auth password "{$ppp['password']}"
|
||||
set auth password {$ppp['password']}
|
||||
|
||||
EOD;
|
||||
}
|
||||
|
||||
$mpdconf .= <<<EOD
|
||||
set modem device {$ppp['port']}
|
||||
|
||||
@ -1275,6 +1275,11 @@ function get_interface_info($ifdescr) {
|
||||
$ifinfo['outpkts'] = $in4_pass_packets + $out4_block_packets;
|
||||
|
||||
$ifconfiginfo = "";
|
||||
|
||||
unset($linkinfo);
|
||||
exec("/usr/bin/netstat -I " . $ifinfo['if'] . " -nWb -f link", $linkinfo);
|
||||
$linkinfo = preg_split("/\s+/", $linkinfo[1]);
|
||||
|
||||
switch ($config['interfaces'][$ifdescr]['ipaddr']) {
|
||||
/* DHCP? -> see if dhclient is up */
|
||||
case "dhcp":
|
||||
@ -1288,9 +1293,6 @@ function get_interface_info($ifdescr) {
|
||||
break;
|
||||
/* PPPoE interface? -> get status from virtual interface */
|
||||
case "pppoe":
|
||||
unset($linkinfo);
|
||||
exec("/usr/bin/netstat -I " . $ifinfo['if'] . " -nWb -f link", $linkinfo);
|
||||
$linkinfo = preg_split("/\s+/", $linkinfo[1]);
|
||||
if ("{$ifinfo['if']}*" == $linkinfo[0])
|
||||
$ifinfo['pppoelink'] = "down";
|
||||
else if ($ifinfo['if'] == $linkinfo[0] && !isset($link0))
|
||||
@ -1302,9 +1304,6 @@ function get_interface_info($ifdescr) {
|
||||
break;
|
||||
/* PPTP interface? -> get status from virtual interface */
|
||||
case "pptp":
|
||||
unset($linkinfo);
|
||||
exec("/usr/bin/netstat -I " . $ifinfo['if'] . " -nWb -f link", $linkinfo);
|
||||
$linkinfo = preg_split("/\s+/", $linkinfo[1]);
|
||||
if ("{$ifinfo['if']}*" == $linkinfo[0])
|
||||
$ifinfo['pptplink'] = "down";
|
||||
else if ($ifinfo['if'] == $linkinfo[0] && !isset($link0))
|
||||
@ -1315,20 +1314,28 @@ function get_interface_info($ifdescr) {
|
||||
break;
|
||||
/* PPP interface? -> get uptime for this session and cumulative uptime from the persistant log file in conf */
|
||||
case "ppp":
|
||||
if ("{$ifinfo['if']}*" == $linkinfo[0])
|
||||
$ifinfo['ppplink'] = "down";
|
||||
else if ($ifinfo['if'] == $linkinfo[0])
|
||||
$ifinfo['ppplink'] = "up";
|
||||
else
|
||||
$ifinfo['ppplink'] = "down" ;
|
||||
if (empty($ifinfo['status']))
|
||||
$ifinfo['status'] = "down";
|
||||
|
||||
$dev = $config['interfaces'][$if]['if'];
|
||||
if (empty($dev))
|
||||
break;
|
||||
if (file_exists("/dev/{$dev}")) {
|
||||
$ifinfo['ppplink'] = $ifinfo['if'];
|
||||
if (file_exists("{$g['varrun_path']}/ppp_{$if}.pid") && file_exists("{$g['varetc_path']}/mpd_{$if}.query")) {
|
||||
$ifinfo['pppinfo'] = "{$ifinfo['if']}";
|
||||
$pppid = substr($ifinfo['if'], 3);
|
||||
$sec = trim(`/usr/bin/nc 127.0.0.1 500{$pppid} < {$g['varetc_path']}/mpd_{$if}.query | grep 'Session time' | cut -f7 -d ' '`);
|
||||
$ifinfo['ppp_uptime'] = convert_seconds_to_hms($sec);
|
||||
}
|
||||
$ifinfo['missing_device'] = 0;
|
||||
$ifinfo['ppp_uptime'] = convert_seconds_to_hms($sec);
|
||||
}
|
||||
} else {
|
||||
$ifinfo['ppplink'] = $dev . " device not present! Is the modem attached to the system?";
|
||||
$ifinfo['missing_device'] = 1;
|
||||
$ifinfo['nodevice'] = 1;
|
||||
$ifinfo['pppinfo'] = $dev . " device not present! Is the modem attached to the system?";
|
||||
}
|
||||
// Calculate cumulative uptime for PPP link. Useful for connections that have per minute/hour contracts so you don't go over!
|
||||
$ifinfo['ppp_uptime_accumulated'] = get_ppp_uptime($dev);
|
||||
|
||||
@ -1117,7 +1117,7 @@ function is_interface_mismatch() {
|
||||
$do_assign = false;
|
||||
$i = 0;
|
||||
foreach ($config['interfaces'] as $ifname => $ifcfg) {
|
||||
if (preg_match("/^enc|^tun|^ppp|^pptp|^pppoe|^ovpn|^gif|^gre|^lagg|^bridge|vlan|_wlan/i", $ifcfg['if'])) {
|
||||
if (preg_match("/^enc|^cua|^ppp|^pptp|^pppoe|^ovpn|^gif|^gre|^lagg|^bridge|vlan|_wlan/i", $ifcfg['if'])) {
|
||||
$i++;
|
||||
}
|
||||
else if (does_interface_exist($ifcfg['if']) == false) {
|
||||
|
||||
@ -137,12 +137,10 @@ if ($_POST) {
|
||||
$ppp['descr'] = $_POST['descr'];
|
||||
|
||||
|
||||
$iflist = get_configured_interface_list();
|
||||
foreach ($iflist as $if) {
|
||||
if ($config['interfaces'][$if]['if'] == basename($a_ppps[$id]['port'])) {
|
||||
$iflist = get_configured_interface_list();
|
||||
foreach ($iflist as $if) {
|
||||
if ($config['interfaces'][$if]['if'] == basename($a_ppps[$id]['port']))
|
||||
$config['interfaces'][$if]['if'] = basename($ppp['port']);
|
||||
interface_ppp_configure($if);
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($id) && $a_ppps[$id])
|
||||
|
||||
@ -138,12 +138,12 @@ include("head.inc");
|
||||
<tr>
|
||||
<td width="22%" class="vncellt">PPP</td>
|
||||
<td width="78%" class="listr">
|
||||
<?=htmlspecialchars($ifinfo['ppplink']);?>
|
||||
<?php if ($ifinfo['status'] == "up"): ?>
|
||||
<?=htmlspecialchars($ifinfo['pppinfo']);?>
|
||||
<?php if ($ifinfo['ppplink'] == "up"): ?>
|
||||
<a href="status_interfaces.php?action=Disconnect&if=<?php echo $ifdescr; ?>">
|
||||
<input type="button" name="<?php echo $ifdescr; ?>" value="Disconnect" class="formbtns">
|
||||
<?php else: ?>
|
||||
<?php if (!$ifinfo['missing_device']): ?>
|
||||
<?php if (!$ifinfo['nodevice']): ?>
|
||||
<a href="status_interfaces.php?action=Connect&if=<?php echo $ifdescr; ?>">
|
||||
<input type="button" name="<?php echo $ifdescr; ?>" value="Connect" class="formbtns">
|
||||
<?php endif; ?>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user