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-2020 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
|
$product = $g['product_name'];
|
33
|
$machine = trim(`uname -m`);
|
34
|
|
35
|
$platform = system_identify_specific_platform();
|
36
|
$serial = system_get_serial();
|
37
|
if (isset($platform['descr'])) {
|
38
|
printf("%s - ", $platform['descr']);
|
39
|
}
|
40
|
if (!empty($serial)) {
|
41
|
printf("%s: %s - ", gettext("Serial"), $serial);
|
42
|
}
|
43
|
printf("%s: %s\n\n", gettext("Netgate Device ID"), system_get_uniqueid());
|
44
|
|
45
|
print "*** Welcome to {$product} {$g['product_version_string']} ({$machine}) on {$hostname} ***\n";
|
46
|
|
47
|
$iflist = get_configured_interface_with_descr(true);
|
48
|
foreach ($iflist as $ifname => $friendly) {
|
49
|
/* point to this interface's config */
|
50
|
$ifconf = $config['interfaces'][$ifname];
|
51
|
/* look for 'special cases' */
|
52
|
switch ($ifconf['ipaddr']) {
|
53
|
case "dhcp":
|
54
|
$class = "/DHCP4";
|
55
|
break;
|
56
|
case "pppoe":
|
57
|
$class = "/PPPoE";
|
58
|
break;
|
59
|
case "pptp":
|
60
|
$class = "/PPTP";
|
61
|
break;
|
62
|
case "l2tp":
|
63
|
$class = "/L2TP";
|
64
|
break;
|
65
|
default:
|
66
|
$class = "";
|
67
|
break;
|
68
|
}
|
69
|
switch ($ifconf['ipaddrv6']) {
|
70
|
case "dhcp6":
|
71
|
$class6 = "/DHCP6";
|
72
|
break;
|
73
|
case "slaac":
|
74
|
$class6 = "/SLAAC";
|
75
|
break;
|
76
|
case "6rd":
|
77
|
$class6 = "/6RD";
|
78
|
break;
|
79
|
case "6to4":
|
80
|
$class6 = "/6to4";
|
81
|
break;
|
82
|
case "track6":
|
83
|
$class6 = "/t6";
|
84
|
break;
|
85
|
default:
|
86
|
$class6 = "";
|
87
|
break;
|
88
|
}
|
89
|
$ipaddr = get_interface_ip($ifname);
|
90
|
$subnet = get_interface_subnet($ifname);
|
91
|
$ipaddr6 = get_interface_ipv6($ifname);
|
92
|
$subnet6 = get_interface_subnetv6($ifname);
|
93
|
$realif = get_real_interface($ifname);
|
94
|
$tobanner = "{$friendly} ({$ifname})";
|
95
|
|
96
|
printf("\n %-15s -> %-10s -> ",
|
97
|
$tobanner,
|
98
|
$realif
|
99
|
);
|
100
|
$v6first = false;
|
101
|
if (!empty($ipaddr) && !empty($subnet)) {
|
102
|
printf("v4%s: %s/%s",
|
103
|
$class,
|
104
|
$ipaddr,
|
105
|
$subnet
|
106
|
);
|
107
|
} else {
|
108
|
$v6first = true;
|
109
|
}
|
110
|
if (!empty($ipaddr6) && !empty($subnet6)) {
|
111
|
if (!$v6first) {
|
112
|
printf("\n%s", str_repeat(" ", 34));
|
113
|
}
|
114
|
printf("v6%s: %s/%s",
|
115
|
$class6,
|
116
|
$ipaddr6,
|
117
|
$subnet6
|
118
|
);
|
119
|
}
|
120
|
}
|
121
|
printf("\n");
|
122
|
?>
|