Project

General

Profile

Download (5.96 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 d88c6a9f Scott Ullrich
$pgtitle = array("Services","Proxy ARP");
68 4df96eff Scott Ullrich
include("head.inc");
69
70 5b237745 Scott Ullrich
?>
71
72
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
73
<?php include("fbegin.inc"); ?>
74
<form action="services_proxyarp.php" method="post">
75
<?php if ($savemsg) print_info_box($savemsg); ?>
76
<?php if (file_exists($d_proxyarpdirty_path)): ?><p>
77
<?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>
78
<?php endif; ?>
79
              <table width="100%" border="0" cellpadding="0" cellspacing="0">
80
                <tr>
81 26ef3f74 Scott Ullrich
                  <td width="20%" class="listhdrr">Interface</td>
82
                  <td width="30%" class="listhdrr">Network</td>
83
                  <td width="40%" class="listhdr">Description</td>
84 5b237745 Scott Ullrich
                  <td width="10%" class="list"></td>
85
				</tr>
86
			  <?php $i = 0; foreach ($a_proxyarp as $arpent): ?>
87
                <tr>
88 2d165eff Bill Marquette
		 <td class="listlr" ondblclick="document.location='services_proxyarp_edit.php?id=<?=$i;?>';">
89 26ef3f74 Scott Ullrich
                  <?php
90
				  	if ($arpent['interface']) {
91
					  $iflabels = array('lan' => 'LAN', 'wan' => 'WAN');
92
					  for ($j = 1; isset($config['interfaces']['opt' . $j]); $j++)
93
						$iflabels['opt' . $j] = $config['interfaces']['opt' . $j]['descr'];
94
					  echo htmlspecialchars($iflabels[$arpent['interface']]);
95
					} else {
96
						echo "WAN";
97
					}
98
	    		  ?>
99
                  </td>
100 2d165eff Bill Marquette
                  <td class="listr" ondblclick="document.location='services_proxyarp_edit.php?id=<?=$i;?>';">
101 5b237745 Scott Ullrich
				  <?php if (isset($arpent['network'])) {
102
				  			list($sa,$sn) = explode("/", $arpent['network']);
103
							if ($sn == 32)
104
								echo $sa;
105
							else
106
					  			echo $arpent['network'];
107
						} else if (isset($arpent['range']))
108
							echo $arpent['range']['from'] . "-" . $arpent['range']['to'];
109
                    ?>&nbsp;
110
                  </td>
111 2d165eff Bill Marquette
                  <td class="listbg" ondblclick="document.location='services_proxyarp_edit.php?id=<?=$i;?>';"><font color="white">
112 26ef3f74 Scott Ullrich
                    <?=htmlspecialchars($arpent['descr']);?>&nbsp;
113 5b237745 Scott Ullrich
                  </td>
114 75a70796 Bill Marquette
                  <td valign="middle" nowrap class="list">
115
                    <table border="0" cellspacing="0" cellpadding="1">
116
                      <tr>
117 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>
118
                        <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>
119 75a70796 Bill Marquette
                      </tr>
120
                    </table>
121
                  </td>
122
                </tr>
123
                <?php $i++; endforeach; ?>
124 841dd38a Scott Ullrich
                <tr>
125 26ef3f74 Scott Ullrich
                  <td class="list" colspan="3"></td>
126 75a70796 Bill Marquette
                  <td class="list">
127
                    <table border="0" cellspacing="0" cellpadding="1">
128
                      <tr>
129 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>
130 75a70796 Bill Marquette
                      </tr>
131
                    </table>
132
                  </td>
133
                </tr>
134 5b237745 Scott Ullrich
              </table>
135
            </form>
136 055cf54b Scott Ullrich
            <p class="vexpl"><span class="red"><strong>Notes:<br>
137 b1caca4b Scott Ullrich
                      </strong></span>
138 36d0358b Scott Ullrich
			*Proxy ARP can be used if you need {$g['product_name']} 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>
139 b1caca4b Scott Ullrich
			<br>
140
			*CARP can be a great replacement for proxyarp.
141 26ef3f74 Scott Ullrich
            <?php include("fend.inc"); ?>
142 5b237745 Scott Ullrich
</body>
143
</html>