Project

General

Profile

Download (4.25 KB) Statistics
| Branch: | Tag: | Revision:
1
#!/usr/local/bin/php
2
<?php
3
/*
4
    diag_dump_states.php
5
    Copyright (C) 2004 Scott Ullrich
6
    All rights reserved.
7

    
8
    Redistribution and use in source and binary forms, with or without
9
    modification, are permitted provided that the following conditions are met:
10

    
11
    1. Redistributions of source code must retain the above copyright notice,
12
       this list of conditions and the following disclaimer.
13

    
14
    2. Redistributions in binary form must reproduce the above copyright
15
       notice, this list of conditions and the following disclaimer in the
16
       documentation and/or other materials provided with the distribution.
17

    
18
    THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
19
    INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
20
    AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
21
    AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
22
    OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23
    SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24
    INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25
    CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26
    ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27
    POSSIBILITY OF SUCH DAMAGE.
28
*/
29

    
30
require_once("guiconfig.inc");
31
require_once("xmlparse.inc");
32

    
33
function gentitle_pkg($pgname) {
34
	global $config;
35
	return $config['system']['hostname'] . "." . $config['system']['domain'] . " - " . $pgname;
36
}
37

    
38
$pgtitle = "Diagnostics: Show States";
39
include("head.inc");
40
 
41
$states=split("\n",`/sbin/pfctl -ss`);
42

    
43
?>
44

    
45
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
46
<?php
47
include("fbegin.inc");
48
?>
49
<p class="pgtitle"><?=$pgtitle?></p>
50
<form action="carp_status.php" method="post">
51
<?php if ($savemsg) print_info_box($savemsg); ?>
52

    
53
<div id="mainlevel">
54
<table width="100%" border="0" cellpadding="0" cellspacing="0">
55
<tr><td>
56
<?php
57
	$tab_array = array();
58
	$tab_array[0] = array("States", true, "diag_dump_states.php");
59
	$tab_array[1] = array("Reset States", false, "diag_resetstate.php");
60
	display_top_tabs($tab_array);
61
?>
62
</td></tr>
63
<tr><td class="tabcont">
64
<table colspan="3" cellpadding="3" width="100%">
65

    
66
<?php
67

    
68
/* table header */
69
print "\n<tr><!-- " . count($state_split) . " -->";
70
print "<tr bgcolor='#990000'>";
71
print "<td><b><font color='#ffffff'>Type</td>";
72
print "<td><b><font color='#ffffff'>Proto</td>";
73
print "<td colspan='7'><b><font color='#ffffff'>Source -> Router -> Destination</td>";
74
print "<td><b><font color='#ffffff'>State</td>";
75
print "</tr>";
76

    
77
foreach($states as $state) {
78
	$state_fixed=str_replace("  ", " ", $state);
79
	$state_fixed=str_replace("  ", " ", $state_fixed);
80
	$state_split = split(" ", $state_fixed);
81
	print "<tr>";
82
	if(count($state_split) == 7) {
83
		print "<td>{$state_split[0]}</td>";
84
		print "<td>{$state_split[1]}</td>";
85
		print "<td align='right'>{$state_split[2]}</td>";
86
		print "<td>{$state_split[3]}</td>";
87
		print "<td>{$state_split[4]}</td>";
88
		print "<td>{$state_split[5]}</td>";
89
		print "<td>&nbsp;</td>";
90
		print "<td>&nbsp;</td>";
91
		print "<td>&nbsp;</td>";
92
		print "<td>{$state_split[6]}</td>";
93
	} else if(count($state_split) == 8) {
94
		print "<td>{$state_split[0]}</td>";
95
		print "<td>{$state_split[1]}</td>";
96
		print "<td align='right'>{$state_split[2]}</td>";
97
		print "<td>{$state_split[3]}</td>";
98
		print "<td>{$state_split[4]}</td>";
99
		print "<td>{$state_split[5]}</td>";
100
		print "<td>{$state_split[6]}</td>";
101
		print "<td>&nbsp;</td>";
102
		print "<td>&nbsp;</td>";
103
		print "<td>{$state_split[7]}</td>";	
104
	} else if(count($state_split) == 9) {
105
		print "<td>{$state_split[0]}</td>";
106
		print "<td>{$state_split[1]}</td>";
107
		print "<td align='right'>{$state_split[2]}</td>";
108
		print "<td>{$state_split[3]}</td>";
109
		print "<td>{$state_split[4]}</td>";
110
		print "<td>{$state_split[5]}</td>";
111
		print "<td>{$state_split[6]}</td>";
112
		print "<td>{$state_split[7]}</td>";	
113
		print "<td>&nbsp;</td>";
114
		print "<td>{$state_split[8]}</td>";	
115
	}
116
	print "</tr>";
117
}
118

    
119
?>
120
</table>
121

    
122
</center>
123
</td></tr>
124
</table>
125
</div>
126

    
127
<?php include("fend.inc"); ?>
128
<script type="text/javascript">
129
NiftyCheck();
130
Rounded("div#mainlevel","bl br","#FFF","#eeeeee","smooth");
131
</script>
132

    
133
<meta http-equiv="refresh" content="60;url=diag_dump_states.php">
134

    
135
</body>
136
</html>
137

    
(8-8/133)