Project

General

Profile

Download (2.5 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-2016 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
print "*** Welcome to {$product} {$g['product_version_string']} ({$machine}) on {$hostname} ***\n";
34

    
35
$iflist = get_configured_interface_with_descr(false, true);
36
foreach ($iflist as $ifname => $friendly) {
37
	/* point to this interface's config */
38
	$ifconf = $config['interfaces'][$ifname];
39
	/* look for 'special cases' */
40
	switch ($ifconf['ipaddr']) {
41
		case "dhcp":
42
			$class = "/DHCP4";
43
			break;
44
		case "pppoe":
45
			$class = "/PPPoE";
46
			break;
47
		case "pptp":
48
			$class = "/PPTP";
49
			break;
50
		case "l2tp":
51
			$class = "/L2TP";
52
			break;
53
		default:
54
			$class = "";
55
			break;
56
	}
57
	switch ($ifconf['ipaddrv6']) {
58
		case "dhcp6":
59
			$class6 = "/DHCP6";
60
			break;
61
		case "slaac":
62
			$class6 = "/SLAAC";
63
			break;
64
		case "6rd":
65
			$class6 = "/6RD";
66
			break;
67
		case "6to4":
68
			$class6 = "/6to4";
69
			break;
70
		case "track6":
71
			$class6 = "/t6";
72
			break;
73
		default:
74
			$class6 = "";
75
			break;
76
	}
77
	$ipaddr = get_interface_ip($ifname);
78
	$subnet = get_interface_subnet($ifname);
79
	$ipaddr6 = get_interface_ipv6($ifname);
80
	$subnet6 = get_interface_subnetv6($ifname);
81
	$realif = get_real_interface($ifname);
82
	$tobanner = "{$friendly} ({$ifname})";
83

    
84
	printf("\n %-15s -> %-10s -> ",
85
		$tobanner,
86
		$realif
87
	);
88
	$v6first = false;
89
	if (!empty($ipaddr) && !empty($subnet)) {
90
		printf("v4%s: %s/%s",
91
			$class,
92
			$ipaddr,
93
			$subnet
94
		);
95
	} else {
96
		$v6first = true;
97
	}
98
	if (!empty($ipaddr6) && !empty($subnet6)) {
99
		if (!$v6first) {
100
			printf("\n%s", str_repeat(" ", 34));
101
		}
102
		printf("v6%s: %s/%s",
103
			$class6,
104
			$ipaddr6,
105
			$subnet6
106
		);
107
	}
108
}
109
printf("\n");
110
?>
(17-17/77)