1 |
5b237745
|
Scott Ullrich
|
#!/usr/local/bin/php
|
2 |
|
|
<?php
|
3 |
b46bfcf5
|
Bill Marquette
|
/* $Id$ */
|
4 |
5b237745
|
Scott Ullrich
|
/*
|
5 |
|
|
services_proxyarp.php
|
6 |
b46bfcf5
|
Bill Marquette
|
part of pfSense
|
7 |
|
|
Copyright (C) 2004 Scott Ullrich
|
8 |
841dd38a
|
Scott Ullrich
|
|
9 |
7a1b90bc
|
Scott Ullrich
|
originally part of m0n0wall (http://m0n0.ch/wall)
|
10 |
5b237745
|
Scott Ullrich
|
Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
|
11 |
|
|
All rights reserved.
|
12 |
841dd38a
|
Scott Ullrich
|
|
13 |
5b237745
|
Scott Ullrich
|
Redistribution and use in source and binary forms, with or without
|
14 |
|
|
modification, are permitted provided that the following conditions are met:
|
15 |
841dd38a
|
Scott Ullrich
|
|
16 |
5b237745
|
Scott Ullrich
|
1. Redistributions of source code must retain the above copyright notice,
|
17 |
|
|
this list of conditions and the following disclaimer.
|
18 |
841dd38a
|
Scott Ullrich
|
|
19 |
5b237745
|
Scott Ullrich
|
2. Redistributions in binary form must reproduce the above copyright
|
20 |
|
|
notice, this list of conditions and the following disclaimer in the
|
21 |
|
|
documentation and/or other materials provided with the distribution.
|
22 |
841dd38a
|
Scott Ullrich
|
|
23 |
5b237745
|
Scott Ullrich
|
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
24 |
|
|
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
25 |
|
|
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
26 |
|
|
AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
|
27 |
|
|
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
28 |
|
|
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
29 |
|
|
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
30 |
|
|
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
31 |
|
|
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
32 |
|
|
POSSIBILITY OF SUCH DAMAGE.
|
33 |
|
|
*/
|
34 |
|
|
|
35 |
|
|
require("guiconfig.inc");
|
36 |
|
|
|
37 |
|
|
if (!is_array($config['proxyarp']['proxyarpnet'])) {
|
38 |
|
|
$config['proxyarp']['proxyarpnet'] = array();
|
39 |
|
|
}
|
40 |
|
|
proxyarp_sort();
|
41 |
|
|
$a_proxyarp = &$config['proxyarp']['proxyarpnet'];
|
42 |
|
|
|
43 |
|
|
if ($_POST) {
|
44 |
|
|
$pconfig = $_POST;
|
45 |
841dd38a
|
Scott Ullrich
|
|
46 |
5b237745
|
Scott Ullrich
|
$retval = 0;
|
47 |
|
|
if (!file_exists($d_sysrebootreqd_path)) {
|
48 |
|
|
config_lock();
|
49 |
|
|
$retval = services_proxyarp_configure();
|
50 |
|
|
config_unlock();
|
51 |
|
|
}
|
52 |
|
|
$savemsg = get_std_save_message($retval);
|
53 |
|
|
|
54 |
|
|
if ($retval == 0) {
|
55 |
|
|
if (file_exists($d_proxyarpdirty_path))
|
56 |
|
|
unlink($d_proxyarpdirty_path);
|
57 |
|
|
}
|
58 |
|
|
}
|
59 |
|
|
|
60 |
|
|
if ($_GET['act'] == "del") {
|
61 |
|
|
if ($a_proxyarp[$_GET['id']]) {
|
62 |
|
|
unset($a_proxyarp[$_GET['id']]);
|
63 |
|
|
write_config();
|
64 |
|
|
touch($d_proxyarpdirty_path);
|
65 |
|
|
header("Location: services_proxyarp.php");
|
66 |
|
|
exit;
|
67 |
|
|
}
|
68 |
|
|
}
|
69 |
|
|
?>
|
70 |
|
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
71 |
|
|
<html>
|
72 |
|
|
<head>
|
73 |
|
|
<title><?=gentitle("Services: Proxy ARP");?></title>
|
74 |
|
|
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
75 |
|
|
<link href="gui.css" rel="stylesheet" type="text/css">
|
76 |
|
|
</head>
|
77 |
|
|
|
78 |
|
|
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
|
79 |
|
|
<?php include("fbegin.inc"); ?>
|
80 |
|
|
<p class="pgtitle">Services: Proxy ARP</p>
|
81 |
|
|
<form action="services_proxyarp.php" method="post">
|
82 |
|
|
<?php if ($savemsg) print_info_box($savemsg); ?>
|
83 |
|
|
<?php if (file_exists($d_proxyarpdirty_path)): ?><p>
|
84 |
|
|
<?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>
|
85 |
|
|
<input name="apply" type="submit" class="formbtn" id="apply" value="Apply changes"></p>
|
86 |
|
|
<?php endif; ?>
|
87 |
|
|
<table width="100%" border="0" cellpadding="0" cellspacing="0">
|
88 |
|
|
<tr>
|
89 |
26ef3f74
|
Scott Ullrich
|
<td width="20%" class="listhdrr">Interface</td>
|
90 |
|
|
<td width="30%" class="listhdrr">Network</td>
|
91 |
|
|
<td width="40%" class="listhdr">Description</td>
|
92 |
5b237745
|
Scott Ullrich
|
<td width="10%" class="list"></td>
|
93 |
|
|
</tr>
|
94 |
|
|
<?php $i = 0; foreach ($a_proxyarp as $arpent): ?>
|
95 |
|
|
<tr>
|
96 |
2d165eff
|
Bill Marquette
|
<td class="listlr" ondblclick="document.location='services_proxyarp_edit.php?id=<?=$i;?>';">
|
97 |
26ef3f74
|
Scott Ullrich
|
<?php
|
98 |
|
|
if ($arpent['interface']) {
|
99 |
|
|
$iflabels = array('lan' => 'LAN', 'wan' => 'WAN');
|
100 |
|
|
for ($j = 1; isset($config['interfaces']['opt' . $j]); $j++)
|
101 |
|
|
$iflabels['opt' . $j] = $config['interfaces']['opt' . $j]['descr'];
|
102 |
|
|
echo htmlspecialchars($iflabels[$arpent['interface']]);
|
103 |
|
|
} else {
|
104 |
|
|
echo "WAN";
|
105 |
|
|
}
|
106 |
|
|
?>
|
107 |
|
|
</td>
|
108 |
2d165eff
|
Bill Marquette
|
<td class="listr" ondblclick="document.location='services_proxyarp_edit.php?id=<?=$i;?>';">
|
109 |
5b237745
|
Scott Ullrich
|
<?php if (isset($arpent['network'])) {
|
110 |
|
|
list($sa,$sn) = explode("/", $arpent['network']);
|
111 |
|
|
if ($sn == 32)
|
112 |
|
|
echo $sa;
|
113 |
|
|
else
|
114 |
|
|
echo $arpent['network'];
|
115 |
|
|
} else if (isset($arpent['range']))
|
116 |
|
|
echo $arpent['range']['from'] . "-" . $arpent['range']['to'];
|
117 |
|
|
?>
|
118 |
|
|
</td>
|
119 |
2d165eff
|
Bill Marquette
|
<td class="listbg" ondblclick="document.location='services_proxyarp_edit.php?id=<?=$i;?>';"><font color="white">
|
120 |
26ef3f74
|
Scott Ullrich
|
<?=htmlspecialchars($arpent['descr']);?>
|
121 |
5b237745
|
Scott Ullrich
|
</td>
|
122 |
75a70796
|
Bill Marquette
|
<td valign="middle" nowrap class="list">
|
123 |
|
|
<table border="0" cellspacing="0" cellpadding="1">
|
124 |
|
|
<tr>
|
125 |
|
|
<td valign="middle"><a href="services_proxyarp_edit.php?id=<?=$i;?>"><img src="e.gif" width="17" height="17" border="0"></a></td>
|
126 |
|
|
<td valign="middle"><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>
|
127 |
|
|
</tr>
|
128 |
|
|
</table>
|
129 |
|
|
</td>
|
130 |
|
|
</tr>
|
131 |
|
|
<?php $i++; endforeach; ?>
|
132 |
841dd38a
|
Scott Ullrich
|
<tr>
|
133 |
26ef3f74
|
Scott Ullrich
|
<td class="list" colspan="3"></td>
|
134 |
75a70796
|
Bill Marquette
|
<td class="list">
|
135 |
|
|
<table border="0" cellspacing="0" cellpadding="1">
|
136 |
|
|
<tr>
|
137 |
|
|
<td valign="middle"><a href="services_proxyarp_edit.php"><img src="plus.gif" width="17" height="17" border="0"></a></td>
|
138 |
|
|
</tr>
|
139 |
|
|
</table>
|
140 |
|
|
</td>
|
141 |
|
|
</tr>
|
142 |
5b237745
|
Scott Ullrich
|
</table>
|
143 |
|
|
</form>
|
144 |
055cf54b
|
Scott Ullrich
|
<p class="vexpl"><span class="red"><strong>Notes:<br>
|
145 |
b1caca4b
|
Scott Ullrich
|
</strong></span>
|
146 |
|
|
*Proxy ARP can be used if you need pfSense to send ARP replies on an interface for other IP addresses than its own (e.g. for 1:1, advanced outbound or server NAT). It is not necessary on the WAN interface if you have a subnet routed to you or if you use PPPoE/PPTP, and it only works on the WAN interface if it's configured with a static IP address or DHCP.</p>
|
147 |
|
|
<br>
|
148 |
|
|
*CARP can be a great replacement for proxyarp.
|
149 |
26ef3f74
|
Scott Ullrich
|
<?php include("fend.inc"); ?>
|
150 |
5b237745
|
Scott Ullrich
|
</body>
|
151 |
|
|
</html>
|