Project

General

Profile

Download (4.89 KB) Statistics
| Branch: | Tag: | Revision:
1
#!/usr/local/bin/php
2
<?php
3
/*
4
	services_proxyarp.php
5
	part of m0n0wall (http://m0n0.ch/wall)
6
	
7
	Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
8
	All rights reserved.
9
	
10
	Redistribution and use in source and binary forms, with or without
11
	modification, are permitted provided that the following conditions are met:
12
	
13
	1. Redistributions of source code must retain the above copyright notice,
14
	   this list of conditions and the following disclaimer.
15
	
16
	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
	
20
	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
require("guiconfig.inc");
33

    
34
if (!is_array($config['proxyarp']['proxyarpnet'])) {
35
	$config['proxyarp']['proxyarpnet'] = array();
36
}
37
proxyarp_sort();
38
$a_proxyarp = &$config['proxyarp']['proxyarpnet'];
39

    
40
if ($_POST) {
41
	$pconfig = $_POST;
42
	
43
	$retval = 0;
44
	if (!file_exists($d_sysrebootreqd_path)) {
45
		config_lock();
46
		$retval = services_proxyarp_configure();
47
		config_unlock();
48
	}
49
	$savemsg = get_std_save_message($retval);
50

    
51
	if ($retval == 0) {
52
		if (file_exists($d_proxyarpdirty_path))
53
			unlink($d_proxyarpdirty_path);
54
	}
55
}
56

    
57
if ($_GET['act'] == "del") {
58
	if ($a_proxyarp[$_GET['id']]) {
59
		unset($a_proxyarp[$_GET['id']]);
60
		write_config();
61
		touch($d_proxyarpdirty_path);
62
		header("Location: services_proxyarp.php");
63
		exit;
64
	}
65
}
66
?>
67
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
68
<html>
69
<head>
70
<title><?=gentitle("Services: Proxy ARP");?></title>
71
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
72
<link href="gui.css" rel="stylesheet" type="text/css">
73
</head>
74

    
75
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
76
<?php include("fbegin.inc"); ?>
77
<p class="pgtitle">Services: Proxy ARP</p>
78
<form action="services_proxyarp.php" method="post">
79
<?php if ($savemsg) print_info_box($savemsg); ?>
80
<?php if (file_exists($d_proxyarpdirty_path)): ?><p>
81
<?php print_info_box_np("The proxy ARP configuration has been changed.<br>You must apply the changes in order for them to take effect.");?><br>
82
<input name="apply" type="submit" class="formbtn" id="apply" value="Apply changes"></p>
83
<?php endif; ?>
84
              <table width="100%" border="0" cellpadding="0" cellspacing="0">
85
                <tr>
86
                  <td width="40%" class="listhdrr">Network</td>
87
                  <td width="50%" class="listhdr">Description</td>
88
                  <td width="10%" class="list"></td>
89
				</tr>
90
			  <?php $i = 0; foreach ($a_proxyarp as $arpent): ?>
91
                <tr>
92
                  <td class="listlr">
93
				  <?php if (isset($arpent['network'])) {
94
				  			list($sa,$sn) = explode("/", $arpent['network']);
95
							if ($sn == 32)
96
								echo $sa;
97
							else
98
					  			echo $arpent['network'];
99
						} else if (isset($arpent['range']))
100
							echo $arpent['range']['from'] . "-" . $arpent['range']['to'];
101
                    ?>&nbsp;
102
                  </td>
103
                  <td class="listbg">
104
                    <?=htmlspecialchars($arpent['descr']);?>&nbsp;
105
                  </td>
106
                  <td valign="middle" nowrap class="list"> <a href="services_proxyarp_edit.php?id=<?=$i;?>"><img src="e.gif" width="17" height="17" border="0"></a>
107
                     &nbsp;<a href="services_proxyarp.php?act=del&id=<?=$i;?>" onclick="return confirm('Do you really want to delete this network?')"><img src="x.gif" width="17" height="17" border="0"></a></td>
108
				</tr>
109
			  <?php $i++; endforeach; ?>
110
                <tr> 
111
                  <td class="list" colspan="2"></td>
112
                  <td class="list"> <a href="services_proxyarp_edit.php"><img src="plus.gif" width="17" height="17" border="0"></a></td>
113
				</tr>
114
              </table>
115
            </form>
116
            <p class="vexpl"><span class="red"><strong>Note:<br>
117
                      </strong></span>Proxy ARP can be used if you need m0n0wall to send ARP
118
					  replies on the WAN interface for other IP addresses than its own WAN
119
					  IP address (e.g. for 1:1, advanced outbound or server NAT). It is not
120
					  necessary if you have a subnet routed to you or if you use PPPoE/PPTP, and it only works if
121
					  the WAN interface is configured with a static IP address or DHCP.</p>
122
<?php include("fend.inc"); ?>
123
</body>
124
</html>
(61-61/86)