Project

General

Profile

Download (3.41 KB) Statistics
| Branch: | Tag: | Revision:
1 cb7d18d5 Renato Botelho
#!/usr/local/bin/php-cgi -f
2 5b237745 Scott Ullrich
<?php
3
/*
4
	rc.banner
5 9e6d1022 Scott Ullrich
	part of pfSense
6 c6ee5ce4 Scott Ullrich
	Copyright (C) 2005 Scott Ullrich and Colin Smith
7 30ccf550 nagyrobi
	Copyright (C) 2009 Ermal Luçi
8 9e6d1022 Scott Ullrich
	All rights reserved
9 7b9ae57a Scott Ullrich
10 5b237745 Scott Ullrich
	Redistribution and use in source and binary forms, with or without
11
	modification, are permitted provided that the following conditions are met:
12 7b9ae57a Scott Ullrich
13 5b237745 Scott Ullrich
	1. Redistributions of source code must retain the above copyright notice,
14
	   this list of conditions and the following disclaimer.
15 7b9ae57a Scott Ullrich
16 5b237745 Scott Ullrich
	2. Redistributions in binary form must reproduce the above copyright
17
	   notice, this list of conditions and the following disclaimer in the
18
	   documentation and/or other materials provided with the distribution.
19 7b9ae57a Scott Ullrich
20 5b237745 Scott Ullrich
	THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
21
	INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
22
	AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
23
	AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
24
	OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25
	SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26
	INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27
	CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28
	ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29
	POSSIBILITY OF SUCH DAMAGE.
30
*/
31
32
	/* parse the configuration and include all functions used below */
33 8dcc8bbc Scott Ullrich
	require_once("config.inc");
34 e3b14bbe smos
	require_once("gwlb.inc");
35 8dcc8bbc Scott Ullrich
	require_once("interfaces.inc");
36 5b237745 Scott Ullrich
37 a2cb1b3f Scott Ullrich
	$hostname = $config['system']['hostname'];
38 3d7639eb Scott Ullrich
	$product = $g['product_name'];
39 9b08f477 Scott Ullrich
	$machine = trim(`uname -m`);
40 3d7639eb Scott Ullrich
	$hideplatform = $g['hideplatform'];
41 e173dd74 Phil Davis
42
	if (!$hideplatform) {
43 3d3c8094 Renato Botelho
		if ($g['platform'] == $g['product_name']) {
44
			$platform = "full-install";
45
		} else {
46
			$platform = $g['platform'];
47
		}
48
		$platformbanner = " {$platform}";
49 e173dd74 Phil Davis
	}
50
51 3d3c8094 Renato Botelho
	print "*** Welcome to {$product} {$g['product_version_string']} ({$machine}{$platformbanner}) on {$hostname} ***\n";
52 0afcc955 Scott Ullrich
53 e7693c09 Ermal Lu?i
	$iflist = get_configured_interface_with_descr(false, true);
54 e173dd74 Phil Davis
	foreach ($iflist as $ifname => $friendly) {
55 e7693c09 Ermal Lu?i
		/* point to this interface's config */
56 b51f12bb jim-p
		$ifconf = $config['interfaces'][$ifname];
57 e7693c09 Ermal Lu?i
		/* look for 'special cases' */
58 e173dd74 Phil Davis
		switch ($ifconf['ipaddr']) {
59
			case "dhcp":
60
				$class = "/DHCP4";
61
				break;
62
			case "pppoe":
63
				$class = "/PPPoE";
64
				break;
65
			case "pptp":
66
				$class = "/PPTP";
67
				break;
68
			case "l2tp":
69
				$class = "/L2TP";
70
				break;
71
			default:
72
				$class = "";
73
				break;
74 0afcc955 Scott Ullrich
		}
75 e173dd74 Phil Davis
		switch ($ifconf['ipaddrv6']) {
76
			case "dhcp6":
77
				$class6 = "/DHCP6";
78
				break;
79
			case "slaac":
80
				$class6 = "/SLAAC";
81
				break;
82
			case "6rd":
83
				$class6 = "/6RD";
84
				break;
85
			case "6to4":
86
				$class6 = "/6to4";
87
				break;
88
			case "track6":
89
				$class6 = "/t6";
90
				break;
91 af8397ca jim-p
			default:
92
				$class6 = "";
93
				break;
94 29e566a1 jim-p
		}
95 e7693c09 Ermal Lu?i
		$ipaddr = get_interface_ip($ifname);
96 41dfef33 Seth Mos
		$subnet = get_interface_subnet($ifname);
97
		$ipaddr6 = get_interface_ipv6($ifname);
98
		$subnet6 = get_interface_subnetv6($ifname);
99 e7693c09 Ermal Lu?i
		$realif = get_real_interface($ifname);
100 a6bce436 Scott Ullrich
		$tobanner = "{$friendly} ({$ifname})";
101 e7693c09 Ermal Lu?i
102 29e566a1 jim-p
		printf("\n %-15s -> %-10s -> ",
103 e7693c09 Ermal Lu?i
			$tobanner,
104 29e566a1 jim-p
			$realif
105 e7693c09 Ermal Lu?i
		);
106 29e566a1 jim-p
		$v6first = false;
107
		if (!empty($ipaddr) && !empty($subnet)) {
108
			printf("v4%s: %s/%s",
109
				$class,
110
				$ipaddr,
111
				$subnet
112
			);
113
		} else {
114
			$v6first = true;
115
		}
116
		if (!empty($ipaddr6) && !empty($subnet6)) {
117
			if (!$v6first) {
118 6c07db48 Phil Davis
				printf("\n%s", str_repeat(" ", 34));
119 29e566a1 jim-p
			}
120
			printf("v6%s: %s/%s",
121
				$class6,
122
				$ipaddr6,
123
				$subnet6
124
			);
125
		}
126 a438eb98 Scott Ullrich
	}
127 30ccf550 nagyrobi
	printf("\n");
128 41dfef33 Seth Mos
?>