Project

General

Profile

Download (5.98 KB) Statistics
| Branch: | Tag: | Revision:
1 5b237745 Scott Ullrich
<?php
2 b46bfcf5 Bill Marquette
/* $Id$ */
3 5b237745 Scott Ullrich
/*
4
	services_proxyarp.php
5 b46bfcf5 Bill Marquette
	part of pfSense
6
	Copyright (C) 2004 Scott Ullrich
7 841dd38a Scott Ullrich
8 7a1b90bc Scott Ullrich
	originally part of m0n0wall (http://m0n0.ch/wall)
9 5b237745 Scott Ullrich
	Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
10
	All rights reserved.
11 841dd38a Scott Ullrich
12 5b237745 Scott Ullrich
	Redistribution and use in source and binary forms, with or without
13
	modification, are permitted provided that the following conditions are met:
14 841dd38a Scott Ullrich
15 5b237745 Scott Ullrich
	1. Redistributions of source code must retain the above copyright notice,
16
	   this list of conditions and the following disclaimer.
17 841dd38a Scott Ullrich
18 5b237745 Scott Ullrich
	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 841dd38a Scott Ullrich
22 5b237745 Scott Ullrich
	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
require("guiconfig.inc");
35
36
if (!is_array($config['proxyarp']['proxyarpnet'])) {
37
	$config['proxyarp']['proxyarpnet'] = array();
38
}
39
proxyarp_sort();
40
$a_proxyarp = &$config['proxyarp']['proxyarpnet'];
41
42
if ($_POST) {
43
	$pconfig = $_POST;
44 841dd38a Scott Ullrich
45 5b237745 Scott Ullrich
	$retval = 0;
46 3851094f Scott Ullrich
	config_lock();
47
	$retval = services_proxyarp_configure();
48
	config_unlock();
49 5b237745 Scott Ullrich
	$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 4df96eff Scott Ullrich
67
$pgtitle = "Services: Proxy ARP";
68
include("head.inc");
69
70 5b237745 Scott Ullrich
?>
71
72
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
73
<?php include("fbegin.inc"); ?>
74 74f446e8 Bill Marquette
<p class="pgtitle"><?=$pgtitle?></p>
75 5b237745 Scott Ullrich
<form action="services_proxyarp.php" method="post">
76
<?php if ($savemsg) print_info_box($savemsg); ?>
77
<?php if (file_exists($d_proxyarpdirty_path)): ?><p>
78
<?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>
79
<?php endif; ?>
80
              <table width="100%" border="0" cellpadding="0" cellspacing="0">
81
                <tr>
82 26ef3f74 Scott Ullrich
                  <td width="20%" class="listhdrr">Interface</td>
83
                  <td width="30%" class="listhdrr">Network</td>
84
                  <td width="40%" class="listhdr">Description</td>
85 5b237745 Scott Ullrich
                  <td width="10%" class="list"></td>
86
				</tr>
87
			  <?php $i = 0; foreach ($a_proxyarp as $arpent): ?>
88
                <tr>
89 2d165eff Bill Marquette
		 <td class="listlr" ondblclick="document.location='services_proxyarp_edit.php?id=<?=$i;?>';">
90 26ef3f74 Scott Ullrich
                  <?php
91
				  	if ($arpent['interface']) {
92
					  $iflabels = array('lan' => 'LAN', 'wan' => 'WAN');
93
					  for ($j = 1; isset($config['interfaces']['opt' . $j]); $j++)
94
						$iflabels['opt' . $j] = $config['interfaces']['opt' . $j]['descr'];
95
					  echo htmlspecialchars($iflabels[$arpent['interface']]);
96
					} else {
97
						echo "WAN";
98
					}
99
	    		  ?>
100
                  </td>
101 2d165eff Bill Marquette
                  <td class="listr" ondblclick="document.location='services_proxyarp_edit.php?id=<?=$i;?>';">
102 5b237745 Scott Ullrich
				  <?php if (isset($arpent['network'])) {
103
				  			list($sa,$sn) = explode("/", $arpent['network']);
104
							if ($sn == 32)
105
								echo $sa;
106
							else
107
					  			echo $arpent['network'];
108
						} else if (isset($arpent['range']))
109
							echo $arpent['range']['from'] . "-" . $arpent['range']['to'];
110
                    ?>&nbsp;
111
                  </td>
112 2d165eff Bill Marquette
                  <td class="listbg" ondblclick="document.location='services_proxyarp_edit.php?id=<?=$i;?>';"><font color="white">
113 26ef3f74 Scott Ullrich
                    <?=htmlspecialchars($arpent['descr']);?>&nbsp;
114 5b237745 Scott Ullrich
                  </td>
115 75a70796 Bill Marquette
                  <td valign="middle" nowrap class="list">
116
                    <table border="0" cellspacing="0" cellpadding="1">
117
                      <tr>
118 677c0869 Erik Kristensen
                        <td valign="middle"><a href="services_proxyarp_edit.php?id=<?=$i;?>"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" width="17" height="17" border="0"></a></td>
119
                        <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="./themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" border="0"></a></td>
120 75a70796 Bill Marquette
                      </tr>
121
                    </table>
122
                  </td>
123
                </tr>
124
                <?php $i++; endforeach; ?>
125 841dd38a Scott Ullrich
                <tr>
126 26ef3f74 Scott Ullrich
                  <td class="list" colspan="3"></td>
127 75a70796 Bill Marquette
                  <td class="list">
128
                    <table border="0" cellspacing="0" cellpadding="1">
129
                      <tr>
130 677c0869 Erik Kristensen
                        <td valign="middle"><a href="services_proxyarp_edit.php"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0"></a></td>
131 75a70796 Bill Marquette
                      </tr>
132
                    </table>
133
                  </td>
134
                </tr>
135 5b237745 Scott Ullrich
              </table>
136
            </form>
137 055cf54b Scott Ullrich
            <p class="vexpl"><span class="red"><strong>Notes:<br>
138 b1caca4b Scott Ullrich
                      </strong></span>
139
			*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>
140
			<br>
141
			*CARP can be a great replacement for proxyarp.
142 26ef3f74 Scott Ullrich
            <?php include("fend.inc"); ?>
143 5b237745 Scott Ullrich
</body>
144
</html>