1
|
#!/usr/local/bin/php -f
|
2
|
<?php
|
3
|
/*
|
4
|
$Id$
|
5
|
|
6
|
rc.banner
|
7
|
part of pfSense
|
8
|
Copyright (C) 2005 Scott Ullrich and Colin Smith
|
9
|
Copyright (C) 2009 Ermal Lu?i
|
10
|
All rights reserved
|
11
|
|
12
|
Redistribution and use in source and binary forms, with or without
|
13
|
modification, are permitted provided that the following conditions are met:
|
14
|
|
15
|
1. Redistributions of source code must retain the above copyright notice,
|
16
|
this list of conditions and the following disclaimer.
|
17
|
|
18
|
2. Redistributions in binary form must reproduce the above copyright
|
19
|
notice, this list of conditions and the following disclaimer in the
|
20
|
documentation and/or other materials provided with the distribution.
|
21
|
|
22
|
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
23
|
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
24
|
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
25
|
AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
|
26
|
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
27
|
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
28
|
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
29
|
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
30
|
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
31
|
POSSIBILITY OF SUCH DAMAGE.
|
32
|
*/
|
33
|
|
34
|
/* parse the configuration and include all functions used below */
|
35
|
require_once("config.inc");
|
36
|
require_once("interfaces.inc");
|
37
|
|
38
|
$version = trim(file_get_contents("{$g['etc_path']}/version"));
|
39
|
$platform = trim(file_get_contents("{$g['etc_path']}/platform"));
|
40
|
$hostname = $config['system']['hostname'];
|
41
|
$product = $g['product_name'];
|
42
|
$machine = trim(`uname -m`);
|
43
|
$hideplatform = $g['hideplatform'];
|
44
|
|
45
|
if(!$hideplatform)
|
46
|
$platformbanner = "-{$platform}";
|
47
|
|
48
|
print "*** Welcome to {$product} {$version}{$platformbanner} ({$machine}) on {$hostname} ***\n";
|
49
|
|
50
|
$iflist = get_configured_interface_with_descr(false, true);
|
51
|
foreach($iflist as $ifname => $friendly) {
|
52
|
/* point to this interface's config */
|
53
|
$ifconf = $config['interfaces'][$ifname];
|
54
|
/* look for 'special cases' */
|
55
|
switch($ifconf['ipaddr']) {
|
56
|
case "carpdev-dhcp":
|
57
|
$class = "(CarpDEV)";
|
58
|
break;
|
59
|
case "dhcp":
|
60
|
$class = "(DHCP)";
|
61
|
break;
|
62
|
case "pppoe":
|
63
|
$class = "(PPPoE)";
|
64
|
break;
|
65
|
case "pptp":
|
66
|
$class = "(PPTP)";
|
67
|
break;
|
68
|
default:
|
69
|
$class = "";
|
70
|
break;
|
71
|
}
|
72
|
$ipaddr = get_interface_ip($ifname);
|
73
|
$subnet = get_interface_subnet($ifname);
|
74
|
$ipaddr6 = get_interface_ipv6($ifname);
|
75
|
$subnet6 = get_interface_subnetv6($ifname);
|
76
|
$realif = get_real_interface($ifname);
|
77
|
$tobanner = "{$friendly} ({$ifname})";
|
78
|
|
79
|
printf("\n %-15s -> %-10s -> %s/%s\t%s/%s %s",
|
80
|
$tobanner,
|
81
|
$realif,
|
82
|
$ipaddr ? $ipaddr : "NONE",
|
83
|
$subnet ? $subnet : "NONE",
|
84
|
$ipaddr6 ? $ipaddr6 : "NONE",
|
85
|
$subnet6 ? $subnet6 : "NONE",
|
86
|
$class
|
87
|
);
|
88
|
}
|
89
|
|
90
|
?>
|