1 |
5b237745
|
Scott Ullrich
|
#!/usr/local/bin/php -f
|
2 |
|
|
<?php
|
3 |
|
|
/*
|
4 |
c6ee5ce4
|
Scott Ullrich
|
$Id$
|
5 |
|
|
|
6 |
5b237745
|
Scott Ullrich
|
rc.banner
|
7 |
9e6d1022
|
Scott Ullrich
|
part of pfSense
|
8 |
c6ee5ce4
|
Scott Ullrich
|
Copyright (C) 2005 Scott Ullrich and Colin Smith
|
9 |
e7693c09
|
Ermal Lu?i
|
Copyright (C) 2009 Ermal Lu?i
|
10 |
9e6d1022
|
Scott Ullrich
|
All rights reserved
|
11 |
7b9ae57a
|
Scott Ullrich
|
|
12 |
5b237745
|
Scott Ullrich
|
Redistribution and use in source and binary forms, with or without
|
13 |
|
|
modification, are permitted provided that the following conditions are met:
|
14 |
7b9ae57a
|
Scott Ullrich
|
|
15 |
5b237745
|
Scott Ullrich
|
1. Redistributions of source code must retain the above copyright notice,
|
16 |
|
|
this list of conditions and the following disclaimer.
|
17 |
7b9ae57a
|
Scott Ullrich
|
|
18 |
5b237745
|
Scott Ullrich
|
2. Redistributions in binary form must reproduce the above copyright
|
19 |
|
|
notice, this list of conditions and the following disclaimer in the
|
20 |
|
|
documentation and/or other materials provided with the distribution.
|
21 |
7b9ae57a
|
Scott Ullrich
|
|
22 |
5b237745
|
Scott Ullrich
|
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
23 |
|
|
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
24 |
|
|
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
25 |
|
|
AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
|
26 |
|
|
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
27 |
|
|
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
28 |
|
|
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
29 |
|
|
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
30 |
|
|
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
31 |
|
|
POSSIBILITY OF SUCH DAMAGE.
|
32 |
|
|
*/
|
33 |
|
|
|
34 |
|
|
/* parse the configuration and include all functions used below */
|
35 |
8dcc8bbc
|
Scott Ullrich
|
require_once("config.inc");
|
36 |
e3b14bbe
|
smos
|
require_once("gwlb.inc");
|
37 |
8dcc8bbc
|
Scott Ullrich
|
require_once("interfaces.inc");
|
38 |
5b237745
|
Scott Ullrich
|
|
39 |
cd718d54
|
Scott Ullrich
|
$version = trim(file_get_contents("{$g['etc_path']}/version"));
|
40 |
c6ee5ce4
|
Scott Ullrich
|
$platform = trim(file_get_contents("{$g['etc_path']}/platform"));
|
41 |
a2cb1b3f
|
Scott Ullrich
|
$hostname = $config['system']['hostname'];
|
42 |
3d7639eb
|
Scott Ullrich
|
$product = $g['product_name'];
|
43 |
9b08f477
|
Scott Ullrich
|
$machine = trim(`uname -m`);
|
44 |
3d7639eb
|
Scott Ullrich
|
$hideplatform = $g['hideplatform'];
|
45 |
cd718d54
|
Scott Ullrich
|
|
46 |
3d7639eb
|
Scott Ullrich
|
if(!$hideplatform)
|
47 |
|
|
$platformbanner = "-{$platform}";
|
48 |
|
|
|
49 |
332bb9ab
|
Scott Ullrich
|
print "*** Welcome to {$product} {$version}{$platformbanner} ({$machine}) on {$hostname} ***\n";
|
50 |
0afcc955
|
Scott Ullrich
|
|
51 |
e7693c09
|
Ermal Lu?i
|
$iflist = get_configured_interface_with_descr(false, true);
|
52 |
|
|
foreach($iflist as $ifname => $friendly) {
|
53 |
|
|
/* point to this interface's config */
|
54 |
b51f12bb
|
jim-p
|
$ifconf = $config['interfaces'][$ifname];
|
55 |
e7693c09
|
Ermal Lu?i
|
/* look for 'special cases' */
|
56 |
|
|
switch($ifconf['ipaddr']) {
|
57 |
|
|
case "dhcp":
|
58 |
29e566a1
|
jim-p
|
$class = "/DHCP4";
|
59 |
e7693c09
|
Ermal Lu?i
|
break;
|
60 |
|
|
case "pppoe":
|
61 |
29e566a1
|
jim-p
|
$class = "/PPPoE";
|
62 |
e7693c09
|
Ermal Lu?i
|
break;
|
63 |
|
|
case "pptp":
|
64 |
29e566a1
|
jim-p
|
$class = "/PPTP";
|
65 |
|
|
break;
|
66 |
|
|
case "l2tp":
|
67 |
|
|
$class = "/L2TP";
|
68 |
e7693c09
|
Ermal Lu?i
|
break;
|
69 |
|
|
default:
|
70 |
|
|
$class = "";
|
71 |
|
|
break;
|
72 |
0afcc955
|
Scott Ullrich
|
}
|
73 |
29e566a1
|
jim-p
|
switch($ifconf['ipaddrv6']) {
|
74 |
|
|
case "dhcp6":
|
75 |
|
|
$class6 = "/DHCP6";
|
76 |
|
|
break;
|
77 |
|
|
case "slaac":
|
78 |
|
|
$class6 = "/SLAAC";
|
79 |
|
|
break;
|
80 |
|
|
case "6rd":
|
81 |
|
|
$class6 = "/6RD";
|
82 |
|
|
break;
|
83 |
|
|
case "6to4":
|
84 |
|
|
$class6 = "/6to4";
|
85 |
|
|
break;
|
86 |
|
|
case "track6":
|
87 |
|
|
$class6 = "/t6";
|
88 |
|
|
break;
|
89 |
|
|
}
|
90 |
e7693c09
|
Ermal Lu?i
|
$ipaddr = get_interface_ip($ifname);
|
91 |
41dfef33
|
Seth Mos
|
$subnet = get_interface_subnet($ifname);
|
92 |
|
|
$ipaddr6 = get_interface_ipv6($ifname);
|
93 |
|
|
$subnet6 = get_interface_subnetv6($ifname);
|
94 |
e7693c09
|
Ermal Lu?i
|
$realif = get_real_interface($ifname);
|
95 |
a6bce436
|
Scott Ullrich
|
$tobanner = "{$friendly} ({$ifname})";
|
96 |
e7693c09
|
Ermal Lu?i
|
|
97 |
29e566a1
|
jim-p
|
printf("\n %-15s -> %-10s -> ",
|
98 |
e7693c09
|
Ermal Lu?i
|
$tobanner,
|
99 |
29e566a1
|
jim-p
|
$realif
|
100 |
e7693c09
|
Ermal Lu?i
|
);
|
101 |
29e566a1
|
jim-p
|
$v6first = false;
|
102 |
|
|
if (!empty($ipaddr) && !empty($subnet)) {
|
103 |
|
|
printf("v4%s: %s/%s",
|
104 |
|
|
$class,
|
105 |
|
|
$ipaddr,
|
106 |
|
|
$subnet
|
107 |
|
|
);
|
108 |
|
|
} else {
|
109 |
|
|
$v6first = true;
|
110 |
|
|
}
|
111 |
|
|
if (!empty($ipaddr6) && !empty($subnet6)) {
|
112 |
|
|
if (!$v6first) {
|
113 |
|
|
printf("\n%s", str_repeat(" ",34));
|
114 |
|
|
}
|
115 |
|
|
printf("v6%s: %s/%s",
|
116 |
|
|
$class6,
|
117 |
|
|
$ipaddr6,
|
118 |
|
|
$subnet6
|
119 |
|
|
);
|
120 |
|
|
}
|
121 |
a438eb98
|
Scott Ullrich
|
}
|
122 |
7222ad41
|
Scott Ullrich
|
|
123 |
41dfef33
|
Seth Mos
|
?>
|