Revision 611ae852
Added by Ermal LUÇI over 15 years ago
etc/inc/pfsense-utils.inc | ||
---|---|---|
1207 | 1207 |
|
1208 | 1208 |
$found = false; |
1209 | 1209 |
foreach ($iflist as $if => $ifname) { |
1210 |
if ($ifdescr == $if || $ifdescr == $ifname) { |
|
1210 |
if ($ifdescr == $if || $ifdescr == $ifname) {
|
|
1211 | 1211 |
$ifinfo['hwif'] = $config['interfaces'][$if]['if']; |
1212 |
if($config['interfaces'][$if]['serialport']) |
|
1213 |
$ifinfo['hwif'] = get_real_interface($if); |
|
1214 | 1212 |
$ifinfo['if'] = get_real_interface($if); |
1215 | 1213 |
$found = true; |
1216 | 1214 |
break; |
... | ... | |
1317 | 1315 |
break; |
1318 | 1316 |
/* PPP interface? -> get uptime for this session and cumulative uptime from the persistant log file in conf */ |
1319 | 1317 |
case "ppp": |
1320 |
$ppp_int = $config['interfaces'][$if]['if']; |
|
1321 |
$dev = $config['interfaces'][$if]['serialport']; |
|
1322 |
if ($dev == "") |
|
1323 |
break; |
|
1324 |
if (file_exists("/dev/{$dev}")){ |
|
1325 |
$ifinfo['ppplink'] = $dev; |
|
1326 |
if (file_exists("{$g['varrun_path']}/{$ppp_int}.pid") && file_exists("{$g['varetc_path']}/{$ppp_int}.query")){ |
|
1327 |
$sec = trim(`/usr/bin/nc localhost 5005 < {$g['varetc_path']}/{$ppp_int}.query | grep 'Session time' | cut -f7 -d ' '`); |
|
1318 |
$dev = $config['interfaces'][$if]['if']; |
|
1319 |
if (empty($dev)) |
|
1320 |
break; |
|
1321 |
if (file_exists("/dev/{$dev}")) { |
|
1322 |
$ifinfo['ppplink'] = $dev; |
|
1323 |
if (file_exists("{$g['varrun_path']}/mpd_{$if}.pid") && file_exists("{$g['varetc_path']}/mpd_{$if}.query")) { |
|
1324 |
$sec = trim(`/usr/bin/nc localhost 5005 < {$g['varetc_path']}/mpd_{$if}.query | grep 'Session time' | cut -f7 -d ' '`); |
|
1328 | 1325 |
$ifinfo['ppp_uptime'] = convert_seconds_to_hms($sec); |
1329 |
} |
|
1330 |
$ifinfo['missing_device'] = 0; |
|
1331 |
} |
|
1332 |
else{ |
|
1333 |
$ifinfo['ppplink'] = $dev . " device not present! Is the modem attached to the system?"; |
|
1334 |
$ifinfo['missing_device'] = 1; |
|
1335 |
} |
|
1336 |
// Calculate cumulative uptime for PPP link. Useful for connections that have per minute/hour contracts so you don't go over! |
|
1337 |
$ifinfo['ppp_uptime_accumulated'] = get_ppp_uptime($dev); |
|
1326 |
} |
|
1327 |
$ifinfo['missing_device'] = 0; |
|
1328 |
} else { |
|
1329 |
$ifinfo['ppplink'] = $dev . " device not present! Is the modem attached to the system?"; |
|
1330 |
$ifinfo['missing_device'] = 1; |
|
1331 |
} |
|
1332 |
// Calculate cumulative uptime for PPP link. Useful for connections that have per minute/hour contracts so you don't go over! |
|
1333 |
$ifinfo['ppp_uptime_accumulated'] = get_ppp_uptime($dev); |
|
1338 | 1334 |
|
1339 | 1335 |
break; |
1340 | 1336 |
default: |
... | ... | |
1808 | 1804 |
fclose($fd); |
1809 | 1805 |
} |
1810 | 1806 |
|
1811 |
?> |
|
1807 |
?> |
Also available in: Unified diff
Redo most of the ppp interface handling to be consistent with the other mpd5 configurations. This way there is no more special handling for ppp around.