Project

General

Profile

Download (2.79 KB) Statistics
| Branch: | Tag: | Revision:
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-2018 Rubicon Communications, LLC (Netgate)
9
 * All rights reserved
10
 *
11
 * Licensed under the Apache License, Version 2.0 (the "License");
12
 * you may not use this file except in compliance with the License.
13
 * You may obtain a copy of the License at
14
 *
15
 * http://www.apache.org/licenses/LICENSE-2.0
16
 *
17
 * Unless required by applicable law or agreed to in writing, software
18
 * distributed under the License is distributed on an "AS IS" BASIS,
19
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20
 * See the License for the specific language governing permissions and
21
 * limitations under the License.
22
 */
23

    
24
/* parse the configuration and include all functions used below */
25
require_once("config.inc");
26
require_once("gwlb.inc");
27
require_once("interfaces.inc");
28

    
29
$hostname = $config['system']['hostname'];
30
$product = $g['product_name'];
31
$machine = trim(`uname -m`);
32

    
33
$platform = system_identify_specific_platform();
34
$serial = system_get_serial();
35
if (isset($platform['descr'])) {
36
	printf("%s - ", $platform['descr']);
37
}
38
if (!empty($serial)) {
39
	printf("%s: %s - ", gettext("Serial"), $serial);
40
}
41
printf("%s: %s\n\n", gettext("Netgate Device ID"), system_get_uniqueid());
42

    
43
print "*** Welcome to {$product} {$g['product_version_string']} ({$machine}) on {$hostname} ***\n";
44

    
45
$iflist = get_configured_interface_with_descr(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 "dhcp":
52
			$class = "/DHCP4";
53
			break;
54
		case "pppoe":
55
			$class = "/PPPoE";
56
			break;
57
		case "pptp":
58
			$class = "/PPTP";
59
			break;
60
		case "l2tp":
61
			$class = "/L2TP";
62
			break;
63
		default:
64
			$class = "";
65
			break;
66
	}
67
	switch ($ifconf['ipaddrv6']) {
68
		case "dhcp6":
69
			$class6 = "/DHCP6";
70
			break;
71
		case "slaac":
72
			$class6 = "/SLAAC";
73
			break;
74
		case "6rd":
75
			$class6 = "/6RD";
76
			break;
77
		case "6to4":
78
			$class6 = "/6to4";
79
			break;
80
		case "track6":
81
			$class6 = "/t6";
82
			break;
83
		default:
84
			$class6 = "";
85
			break;
86
	}
87
	$ipaddr = get_interface_ip($ifname);
88
	$subnet = get_interface_subnet($ifname);
89
	$ipaddr6 = get_interface_ipv6($ifname);
90
	$subnet6 = get_interface_subnetv6($ifname);
91
	$realif = get_real_interface($ifname);
92
	$tobanner = "{$friendly} ({$ifname})";
93

    
94
	printf("\n %-15s -> %-10s -> ",
95
		$tobanner,
96
		$realif
97
	);
98
	$v6first = false;
99
	if (!empty($ipaddr) && !empty($subnet)) {
100
		printf("v4%s: %s/%s",
101
			$class,
102
			$ipaddr,
103
			$subnet
104
		);
105
	} else {
106
		$v6first = true;
107
	}
108
	if (!empty($ipaddr6) && !empty($subnet6)) {
109
		if (!$v6first) {
110
			printf("\n%s", str_repeat(" ", 34));
111
		}
112
		printf("v6%s: %s/%s",
113
			$class6,
114
			$ipaddr6,
115
			$subnet6
116
		);
117
	}
118
}
119
printf("\n");
120
?>
(21-21/82)