Revision e7693c09
Added by Ermal Luçi over 16 years ago
etc/rc.banner | ||
---|---|---|
6 | 6 |
rc.banner |
7 | 7 |
part of pfSense |
8 | 8 |
Copyright (C) 2005 Scott Ullrich and Colin Smith |
9 |
Copyright (C) 2009 Ermal Lu?i |
|
9 | 10 |
All rights reserved |
10 | 11 |
|
11 | 12 |
Redistribution and use in source and binary forms, with or without |
... | ... | |
31 | 32 |
*/ |
32 | 33 |
|
33 | 34 |
/* parse the configuration and include all functions used below */ |
34 |
require_once("config.inc");
|
|
35 |
require_once("functions.inc");
|
|
35 |
require("config.inc"); |
|
36 |
require("interfaces.inc");
|
|
36 | 37 |
|
37 | 38 |
$version = trim(file_get_contents("{$g['etc_path']}/version")); |
38 | 39 |
$platform = trim(file_get_contents("{$g['etc_path']}/platform")); |
... | ... | |
41 | 42 |
|
42 | 43 |
print "\n*** Welcome to {$product} {$version}-{$platform} on {$hostname} ***\n"; |
43 | 44 |
|
44 |
/* get our initial interface list */ |
|
45 |
$vfaces = array( |
|
46 |
'ppp', |
|
47 |
'sl', |
|
48 |
'gif', |
|
49 |
'faith', |
|
50 |
'lo', |
|
51 |
'tun', |
|
52 |
'pflog', |
|
53 |
'pfsync', |
|
54 |
'carp' |
|
55 |
); |
|
56 |
$iflist = get_interface_list("media", "physical", $vfaces); |
|
57 |
|
|
58 |
foreach($iflist as $ifname => $ifinfo) { |
|
59 |
/* skip interfaces that don't have a friendly name */ |
|
60 |
if($ifinfo['friendly'] != "") { |
|
61 |
$friendly = strtoupper($ifinfo['friendly']); |
|
62 |
/* point to this interface's config */ |
|
63 |
$ifconf =& $config['interfaces'][$ifinfo['friendly']]; |
|
64 |
/* look for 'special cases' */ |
|
65 |
switch($ifconf['ipaddr']) { |
|
66 |
case "carpdev-dhcp": |
|
67 |
$ifinfo['class'] = "(CarpDEV)"; |
|
68 |
break; |
|
69 |
case "dhcp": |
|
70 |
$ifinfo['class'] = "(DHCP)"; |
|
71 |
break; |
|
72 |
case "pppoe": |
|
73 |
$ifinfo['class'] = "(PPPoE)"; |
|
74 |
break; |
|
75 |
case "pptp": |
|
76 |
$ifinfo['class'] = "(PPTP)"; |
|
77 |
break; |
|
78 |
} |
|
79 |
$ifinfo['ipaddr'] = get_interface_ip($ifinfo['friendly']); |
|
80 |
$tobanner = $friendly; |
|
81 |
/* does this interface have an extra description? */ |
|
82 |
if($ifconf['descr']) { |
|
83 |
$tobanner .= "({$ifconf['descr']})"; |
|
84 |
} |
|
85 |
/* is the interface up? */ |
|
86 |
if($ifinfo['up']) { |
|
87 |
$tobanner .= "*"; |
|
88 |
} |
|
89 |
printf("\n %-25s->\t%s\t->\t%s%s", |
|
90 |
$tobanner, |
|
91 |
$ifname, |
|
92 |
$ifinfo['ipaddr'] ? $ifinfo['ipaddr'] : "NONE", |
|
93 |
$ifinfo['class'] |
|
94 |
); |
|
45 |
$iflist = get_configured_interface_with_descr(false, true); |
|
46 |
foreach($iflist as $ifname => $friendly) { |
|
47 |
/* point to this interface's config */ |
|
48 |
$ifconf =& $config['interfaces'][$ifname]; |
|
49 |
/* look for 'special cases' */ |
|
50 |
switch($ifconf['ipaddr']) { |
|
51 |
case "carpdev-dhcp": |
|
52 |
$class = "(CarpDEV)"; |
|
53 |
break; |
|
54 |
case "dhcp": |
|
55 |
$class = "(DHCP)"; |
|
56 |
break; |
|
57 |
case "pppoe": |
|
58 |
$class = "(PPPoE)"; |
|
59 |
break; |
|
60 |
case "pptp": |
|
61 |
$class = "(PPTP)"; |
|
62 |
break; |
|
63 |
default: |
|
64 |
$class = ""; |
|
65 |
break; |
|
95 | 66 |
} |
67 |
$ipaddr = get_interface_ip($ifname); |
|
68 |
$realif = get_real_interface($ifname); |
|
69 |
$tobanner = "{$friendly}({$ifname})"; |
|
70 |
|
|
71 |
printf("\n %-25s -> %-10s -> %s%s", |
|
72 |
$tobanner, |
|
73 |
$realif, |
|
74 |
$ipaddr ? $ipaddr : "NONE", |
|
75 |
$class |
|
76 |
); |
|
96 | 77 |
} |
97 | 78 |
?> |
Also available in: Unified diff
Make the rc.banner a lot more faster.