1
|
#!/usr/local/bin/php-cgi -f
|
2
|
<?php
|
3
|
/*
|
4
|
* rc.banner
|
5
|
*
|
6
|
* part of pfSense
|
7
|
* Copyright (c) 2005 Colin Smith
|
8
|
* Copyright (c) 2005-2016 Rubicon Communications, LLC (Netgate)
|
9
|
* All rights reserved
|
10
|
*
|
11
|
* Redistribution and use in source and binary forms, with or without
|
12
|
* modification, are permitted provided that the following conditions are met:
|
13
|
*
|
14
|
* 1. Redistributions of source code must retain the above copyright notice,
|
15
|
* this list of conditions and the following disclaimer.
|
16
|
*
|
17
|
* 2. Redistributions in binary form must reproduce the above copyright
|
18
|
* notice, this list of conditions and the following disclaimer in
|
19
|
* the documentation and/or other materials provided with the
|
20
|
* distribution.
|
21
|
*
|
22
|
* 3. All advertising materials mentioning features or use of this software
|
23
|
* must display the following acknowledgment:
|
24
|
* "This product includes software developed by the pfSense Project
|
25
|
* for use in the pfSense® software distribution. (http://www.pfsense.org/).
|
26
|
*
|
27
|
* 4. The names "pfSense" and "pfSense Project" must not be used to
|
28
|
* endorse or promote products derived from this software without
|
29
|
* prior written permission. For written permission, please contact
|
30
|
* coreteam@pfsense.org.
|
31
|
*
|
32
|
* 5. Products derived from this software may not be called "pfSense"
|
33
|
* nor may "pfSense" appear in their names without prior written
|
34
|
* permission of the Electric Sheep Fencing, LLC.
|
35
|
*
|
36
|
* 6. Redistributions of any form whatsoever must retain the following
|
37
|
* acknowledgment:
|
38
|
*
|
39
|
* "This product includes software developed by the pfSense Project
|
40
|
* for use in the pfSense software distribution (http://www.pfsense.org/).
|
41
|
*
|
42
|
* THIS SOFTWARE IS PROVIDED BY THE pfSense PROJECT ``AS IS'' AND ANY
|
43
|
* EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
44
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
45
|
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE pfSense PROJECT OR
|
46
|
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
47
|
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
48
|
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
49
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
50
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
51
|
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
52
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
53
|
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
54
|
*/
|
55
|
|
56
|
/* parse the configuration and include all functions used below */
|
57
|
require_once("config.inc");
|
58
|
require_once("gwlb.inc");
|
59
|
require_once("interfaces.inc");
|
60
|
|
61
|
$hostname = $config['system']['hostname'];
|
62
|
$product = $g['product_name'];
|
63
|
$machine = trim(`uname -m`);
|
64
|
$hideplatform = $g['hideplatform'];
|
65
|
|
66
|
if (!$hideplatform) {
|
67
|
if ($g['platform'] == $g['product_name']) {
|
68
|
$platform = "full-install";
|
69
|
} else {
|
70
|
$platform = $g['platform'];
|
71
|
}
|
72
|
$platformbanner = " {$platform}";
|
73
|
}
|
74
|
|
75
|
print "*** Welcome to {$product} {$g['product_version_string']} ({$machine}{$platformbanner}) on {$hostname} ***\n";
|
76
|
|
77
|
$iflist = get_configured_interface_with_descr(false, true);
|
78
|
foreach ($iflist as $ifname => $friendly) {
|
79
|
/* point to this interface's config */
|
80
|
$ifconf = $config['interfaces'][$ifname];
|
81
|
/* look for 'special cases' */
|
82
|
switch ($ifconf['ipaddr']) {
|
83
|
case "dhcp":
|
84
|
$class = "/DHCP4";
|
85
|
break;
|
86
|
case "pppoe":
|
87
|
$class = "/PPPoE";
|
88
|
break;
|
89
|
case "pptp":
|
90
|
$class = "/PPTP";
|
91
|
break;
|
92
|
case "l2tp":
|
93
|
$class = "/L2TP";
|
94
|
break;
|
95
|
default:
|
96
|
$class = "";
|
97
|
break;
|
98
|
}
|
99
|
switch ($ifconf['ipaddrv6']) {
|
100
|
case "dhcp6":
|
101
|
$class6 = "/DHCP6";
|
102
|
break;
|
103
|
case "slaac":
|
104
|
$class6 = "/SLAAC";
|
105
|
break;
|
106
|
case "6rd":
|
107
|
$class6 = "/6RD";
|
108
|
break;
|
109
|
case "6to4":
|
110
|
$class6 = "/6to4";
|
111
|
break;
|
112
|
case "track6":
|
113
|
$class6 = "/t6";
|
114
|
break;
|
115
|
default:
|
116
|
$class6 = "";
|
117
|
break;
|
118
|
}
|
119
|
$ipaddr = get_interface_ip($ifname);
|
120
|
$subnet = get_interface_subnet($ifname);
|
121
|
$ipaddr6 = get_interface_ipv6($ifname);
|
122
|
$subnet6 = get_interface_subnetv6($ifname);
|
123
|
$realif = get_real_interface($ifname);
|
124
|
$tobanner = "{$friendly} ({$ifname})";
|
125
|
|
126
|
printf("\n %-15s -> %-10s -> ",
|
127
|
$tobanner,
|
128
|
$realif
|
129
|
);
|
130
|
$v6first = false;
|
131
|
if (!empty($ipaddr) && !empty($subnet)) {
|
132
|
printf("v4%s: %s/%s",
|
133
|
$class,
|
134
|
$ipaddr,
|
135
|
$subnet
|
136
|
);
|
137
|
} else {
|
138
|
$v6first = true;
|
139
|
}
|
140
|
if (!empty($ipaddr6) && !empty($subnet6)) {
|
141
|
if (!$v6first) {
|
142
|
printf("\n%s", str_repeat(" ", 34));
|
143
|
}
|
144
|
printf("v6%s: %s/%s",
|
145
|
$class6,
|
146
|
$ipaddr6,
|
147
|
$subnet6
|
148
|
);
|
149
|
}
|
150
|
}
|
151
|
printf("\n");
|
152
|
?>
|