diff options
author | gnhb <gnoahb@gmail.com> | 2010-03-29 20:03:55 +0700 |
---|---|---|
committer | gnhb <gnoahb@gmail.com> | 2010-03-29 20:03:55 +0700 |
commit | c90f247117ace2af4e072e7004e1750875e568ff (patch) | |
tree | 9ffc5d18ff5358ff09854d6170474f8dcb836d86 /etc | |
parent | a216a03a00166350c22162f1e0da03927e23af10 (diff) | |
download | pfsense-c90f247117ace2af4e072e7004e1750875e568ff.zip pfsense-c90f247117ace2af4e072e7004e1750875e568ff.tar.gz |
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.
Diffstat (limited to 'etc')
-rw-r--r-- | etc/inc/interfaces.inc | 13 | ||||
-rw-r--r-- | etc/inc/pfsense-utils.inc | 31 | ||||
-rw-r--r-- | etc/inc/util.inc | 2 |
3 files changed, 28 insertions, 18 deletions
diff --git a/etc/inc/interfaces.inc b/etc/inc/interfaces.inc index f2ad8d4..65e3996 100644 --- a/etc/inc/interfaces.inc +++ b/etc/inc/interfaces.inc @@ -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']} diff --git a/etc/inc/pfsense-utils.inc b/etc/inc/pfsense-utils.inc index f9158d7..7a27a81 100644 --- a/etc/inc/pfsense-utils.inc +++ b/etc/inc/pfsense-utils.inc @@ -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); diff --git a/etc/inc/util.inc b/etc/inc/util.inc index 584beb3..3c61b6c 100644 --- a/etc/inc/util.inc +++ b/etc/inc/util.inc @@ -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) { |