Project

General

Profile

Download (5.45 KB) Statistics
| Branch: | Tag: | Revision:
1
#!/usr/local/bin/php
2
<?php
3
/*
4
	services_proxyarp.php
5
    part of pfSense
6
    Copyright (C) 2004 Scott Ullrich
7

    
8
	originally part of m0n0wall (http://m0n0.ch/wall)
9
	Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
10
	All rights reserved.
11

    
12
	Redistribution and use in source and binary forms, with or without
13
	modification, are permitted provided that the following conditions are met:
14

    
15
	1. Redistributions of source code must retain the above copyright notice,
16
	   this list of conditions and the following disclaimer.
17

    
18
	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

    
22
	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

    
45
	$retval = 0;
46
	if (!file_exists($d_sysrebootreqd_path)) {
47
		config_lock();
48
		$retval = services_proxyarp_configure();
49
		config_unlock();
50
	}
51
	$savemsg = get_std_save_message($retval);
52

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

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

    
77
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
78
<?php include("fbegin.inc"); ?>
79
<p class="pgtitle">Services: Proxy ARP</p>
80
<form action="services_proxyarp.php" method="post">
81
<?php if ($savemsg) print_info_box($savemsg); ?>
82
<?php if (file_exists($d_proxyarpdirty_path)): ?><p>
83
<?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>
84
<input name="apply" type="submit" class="formbtn" id="apply" value="Apply changes"></p>
85
<?php endif; ?>
86
              <table width="100%" border="0" cellpadding="0" cellspacing="0">
87
                <tr>
88
                  <td width="20%" class="listhdrr">Interface</td>
89
                  <td width="30%" class="listhdrr">Network</td>
90
                  <td width="40%" class="listhdr">Description</td>
91
                  <td width="10%" class="list"></td>
92
				</tr>
93
			  <?php $i = 0; foreach ($a_proxyarp as $arpent): ?>
94
                <tr>
95
				  <td class="listlr">
96
                  <?php
97
				  	if ($arpent['interface']) {
98
					  $iflabels = array('lan' => 'LAN', 'wan' => 'WAN');
99
					  for ($j = 1; isset($config['interfaces']['opt' . $j]); $j++)
100
						$iflabels['opt' . $j] = $config['interfaces']['opt' . $j]['descr'];
101
					  echo htmlspecialchars($iflabels[$arpent['interface']]);
102
					} else {
103
						echo "WAN";
104
					}
105
	    		  ?>
106
                  </td>
107
                  <td class="listr">
108
				  <?php if (isset($arpent['network'])) {
109
				  			list($sa,$sn) = explode("/", $arpent['network']);
110
							if ($sn == 32)
111
								echo $sa;
112
							else
113
					  			echo $arpent['network'];
114
						} else if (isset($arpent['range']))
115
							echo $arpent['range']['from'] . "-" . $arpent['range']['to'];
116
                    ?>&nbsp;
117
                  </td>
118
                  <td class="listbg"><font color="white">
119
                    <?=htmlspecialchars($arpent['descr']);?>&nbsp;
120
                  </td>
121
                  <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>
122
                     &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>
123
				</tr>
124
			  <?php $i++; endforeach; ?>
125
                <tr>
126
                  <td class="list" colspan="3"></td>
127
                  <td class="list"> <a href="services_proxyarp_edit.php"><img src="plus.gif" width="17" height="17" border="0"></a></td>
128
				</tr>
129
              </table>
130
            </form>
131
            <p class="vexpl"><span class="red"><strong>Note:<br>
132
                      </strong></span>Proxy ARP can be used if you need pfSense to send ARP
133
					  replies on an interface for other IP addresses than its own (e.g. for 1:1, advanced outbound or server NAT). It is not
134
					  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>
135
            <?php include("fend.inc"); ?>
136
</body>
137
</html>
(72-72/100)