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-2013 BSD Perimeter
|
9
|
* Copyright (c) 2013-2016 Electric Sheep Fencing
|
10
|
* Copyright (c) 2014-2021 Rubicon Communications, LLC (Netgate)
|
11
|
* All rights reserved
|
12
|
*
|
13
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
14
|
* you may not use this file except in compliance with the License.
|
15
|
* You may obtain a copy of the License at
|
16
|
*
|
17
|
* http://www.apache.org/licenses/LICENSE-2.0
|
18
|
*
|
19
|
* Unless required by applicable law or agreed to in writing, software
|
20
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
21
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
22
|
* See the License for the specific language governing permissions and
|
23
|
* limitations under the License.
|
24
|
*/
|
25
|
|
26
|
/* parse the configuration and include all functions used below */
|
27
|
require_once("config.inc");
|
28
|
require_once("gwlb.inc");
|
29
|
require_once("interfaces.inc");
|
30
|
|
31
|
$hostname = $config['system']['hostname'];
|
32
|
$machine = trim(`uname -m`);
|
33
|
|
34
|
$platform = system_identify_specific_platform();
|
35
|
$serial = system_get_serial();
|
36
|
if (isset($platform['descr'])) {
|
37
|
printf("%s - ", $platform['descr']);
|
38
|
}
|
39
|
if (!empty($serial)) {
|
40
|
printf("%s: %s - ", gettext("Serial"), $serial);
|
41
|
}
|
42
|
printf("%s: %s\n\n", gettext("Netgate Device ID"), system_get_uniqueid());
|
43
|
|
44
|
print "*** Welcome to {$g['product_label']} {$g['product_version_string']} ({$machine}) on {$hostname} ***\n";
|
45
|
|
46
|
$iflist = get_configured_interface_with_descr(true);
|
47
|
foreach ($iflist as $ifname => $friendly) {
|
48
|
/* point to this interface's config */
|
49
|
$ifconf = $config['interfaces'][$ifname];
|
50
|
/* look for 'special cases' */
|
51
|
switch ($ifconf['ipaddr']) {
|
52
|
case "dhcp":
|
53
|
$class = "/DHCP4";
|
54
|
break;
|
55
|
case "pppoe":
|
56
|
$class = "/PPPoE";
|
57
|
break;
|
58
|
case "pptp":
|
59
|
$class = "/PPTP";
|
60
|
break;
|
61
|
case "l2tp":
|
62
|
$class = "/L2TP";
|
63
|
break;
|
64
|
default:
|
65
|
$class = "";
|
66
|
break;
|
67
|
}
|
68
|
switch ($ifconf['ipaddrv6']) {
|
69
|
case "dhcp6":
|
70
|
$class6 = "/DHCP6";
|
71
|
break;
|
72
|
case "slaac":
|
73
|
$class6 = "/SLAAC";
|
74
|
break;
|
75
|
case "6rd":
|
76
|
$class6 = "/6RD";
|
77
|
break;
|
78
|
case "6to4":
|
79
|
$class6 = "/6to4";
|
80
|
break;
|
81
|
case "track6":
|
82
|
$class6 = "/t6";
|
83
|
break;
|
84
|
default:
|
85
|
$class6 = "";
|
86
|
break;
|
87
|
}
|
88
|
$ipaddr = get_interface_ip($ifname);
|
89
|
$subnet = get_interface_subnet($ifname);
|
90
|
$ipaddr6 = get_interface_ipv6($ifname);
|
91
|
$subnet6 = get_interface_subnetv6($ifname);
|
92
|
$realif = get_real_interface($ifname);
|
93
|
$tobanner = "{$friendly} ({$ifname})";
|
94
|
|
95
|
printf("\n %-15s -> %-10s -> ",
|
96
|
$tobanner,
|
97
|
$realif
|
98
|
);
|
99
|
$v6first = false;
|
100
|
if (!empty($ipaddr) && !empty($subnet)) {
|
101
|
printf("v4%s: %s/%s",
|
102
|
$class,
|
103
|
$ipaddr,
|
104
|
$subnet
|
105
|
);
|
106
|
} else {
|
107
|
$v6first = true;
|
108
|
}
|
109
|
if (!empty($ipaddr6) && !empty($subnet6)) {
|
110
|
if (!$v6first) {
|
111
|
printf("\n%s", str_repeat(" ", 34));
|
112
|
}
|
113
|
printf("v6%s: %s/%s",
|
114
|
$class6,
|
115
|
$ipaddr6,
|
116
|
$subnet6
|
117
|
);
|
118
|
}
|
119
|
}
|
120
|
printf("\n");
|
121
|
?>
|