Project

General

Profile

Download (7.4 KB) Statistics
| Branch: | Tag: | Revision:
1
<?php
2
/* $Id$ */
3
/*
4
	interfaces_lan.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
##|+PRIV
33
##|*IDENT=page-interfaces-lan
34
##|*NAME=Interfaces: LAN page
35
##|*DESCR=Allow access to the 'Interfaces: LAN' page.
36
##|*MATCH=interfaces_lan.php*
37
##|-PRIV
38

    
39

    
40
require("guiconfig.inc");
41

    
42
$lancfg = &$config['interfaces']['lan'];
43
$optcfg = &$config['interfaces']['lan'];
44

    
45
$pconfig['ipaddr'] = $lancfg['ipaddr'];
46
$pconfig['subnet'] = $lancfg['subnet'];
47

    
48
$pconfig['disableftpproxy'] = isset($lancfg['disableftpproxy']);
49

    
50
/* Wireless interface? */
51
if (isset($lancfg['wireless'])) {
52
	require("interfaces_wlan.inc");
53
	wireless_config_init();
54
}
55

    
56
if ($_POST) {
57

    
58
	unset($input_errors);
59
	$pconfig = $_POST;
60
	$changedesc = "LAN Interface: ";
61

    
62
	/* input validation */
63
	$reqdfields = explode(" ", "ipaddr subnet");
64
	$reqdfieldsn = explode(",", "IP address,Subnet bit count");
65
	
66
	do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
67

    
68
	if (($_POST['ipaddr'] && !is_ipaddr($_POST['ipaddr']))) {
69
		$input_errors[] = "A valid IP address must be specified.";
70
	}
71
	if (($_POST['subnet'] && !is_numeric($_POST['subnet']))) {
72
		$input_errors[] = "A valid subnet bit count must be specified.";
73
	}
74

    
75
	/* Wireless interface? */
76
	if (isset($lancfg['wireless'])) {
77
		$wi_input_errors = wireless_config_post();
78
		if ($wi_input_errors) {
79
			$input_errors = array_merge($input_errors, $wi_input_errors);
80
		}
81
	}
82

    
83
	if (!$input_errors) {
84
		
85
		unset($lancfg['disableftpproxy']);
86
		
87
		/* per interface pftpx helper */
88
		if($_POST['disableftpproxy'] == "yes") {
89
			$lancfg['disableftpproxy'] = true;
90
			system_start_ftp_helpers();
91
		} else {			
92
			system_start_ftp_helpers();
93
		}			
94
		
95
		if (($lancfg['ipaddr'] != $_POST['ipaddr']) || ($lancfg['subnet'] != $_POST['subnet'])) {
96
			update_if_changed("IP Address", &$lancfg['ipaddr'], $_POST['ipaddr']);
97
			update_if_changed("subnet", &$lancfg['subnet'], $_POST['subnet']);
98
		}
99

    
100
		write_config($changedesc);
101

    
102
		touch($d_landirty_path);
103

    
104
		/* restart snmp so that it binds to correct address */
105
		services_snmpd_configure();
106

    
107
		if ($_POST['apply'] <> "") {
108
			
109
			unlink($d_landirty_path);
110
			
111
			$savemsg = "The changes have been applied.  You may need to correct your web browser's IP address.";
112
			
113
		}
114
	}
115
}
116

    
117
$pgtitle = array("Interfaces","LAN");
118
include("head.inc");
119

    
120
?>
121

    
122
<script language="JavaScript">
123
<!--
124
function enable_change(enable_over) {
125
	return;
126
	var endis;
127
	endis = enable_over;
128
	document.iform.ipaddr.disabled = endis;
129
	document.iform.subnet.disabled = endis;
130
}
131
// -->
132
</script>
133

    
134

    
135
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
136
<form action="interfaces_lan.php" method="post" name="iform" id="iform">
137
<?php include("fbegin.inc"); ?>
138
<?php if ($input_errors) print_input_errors($input_errors); ?>
139
<?php if (file_exists($d_landirty_path)): ?><p>
140
<?php print_info_box_np("The LAN configuration has been changed.<p>You must apply the changes in order for them to take effect.<p>Don't forget to adjust the DHCP Server range if needed before applying.");?><br>
141
<?php endif; ?>
142
<?php if ($savemsg) print_info_box_np($savemsg); ?>
143
              <table width="100%" border="0" cellpadding="6" cellspacing="0">
144
		<tr>
145
                  <td colspan="2" valign="top" class="listtopic">IP configuration</td>
146
		</tr>	      
147
                <tr>
148
                  <td width="22%" valign="top" class="vncellreq">IP address</td>
149
                  <td width="78%" class="vtable">
150
                    <input name="ipaddr" type="text" class="formfld unknown" id="hostname" size="20" value="<?=htmlspecialchars($pconfig['ipaddr']);?>">
151
                    /
152
                    <select name="subnet" class="formselect" id="subnet">
153
					<?php
154
					for ($i = 32; $i > 0; $i--) {
155
						if($i <> 31) {
156
							echo "<option value=\"{$i}\" ";
157
							if ($i == $pconfig['subnet']) echo "selected";
158
							echo ">" . $i . "</option>";
159
						}
160
					}
161
					?>
162
                    </select></td>
163
                </tr>
164
                <tr>
165
                  <td colspan="2" valign="top" height="16"></td>
166
                </tr>
167
                <tr>
168
                  <td colspan="2" valign="top" class="listtopic">FTP Helper</td>
169
                </tr>		
170
		<tr>
171
			<td width="22%" valign="top" class="vncell">FTP Helper</td>
172
			<td width="78%" class="vtable">
173
				<input name="disableftpproxy" type="checkbox" id="disableftpproxy" value="yes" <?php if ($pconfig['disableftpproxy']) echo "checked"; ?> onclick="enable_change(false)" />
174
				<strong>Disable the userland FTP-Proxy application</strong>
175
				<br />
176
			</td>
177
		</tr>			
178
				<?php /* Wireless interface? */
179
				if (isset($lancfg['wireless']))
180
					wireless_config_print();
181
				?>
182

    
183

    
184
                <tr>
185
                  <td colspan="2" valign="top" height="16"></td>
186
                </tr>
187
                <tr>
188
                  <td width="22%" valign="top">&nbsp;</td>
189
                  <td width="78%">
190
                    <input name="Submit" type="submit" class="formbtn" value="Save">
191
                  </td>
192
                </tr>
193
                <tr>
194
                  <td width="22%" valign="top">&nbsp;</td>
195
                  <td width="78%"><span class="vexpl"><span class="red"><strong>Warning:<br>
196
                    </strong></span>after you click &quot;Save&quot;, you will need
197
                    to do one or more of the following steps before you can
198
                    access your firewall again:
199
                    <ul>
200
                      <li>change the IP address of your computer</li>
201
                      <li>renew its DHCP lease</li>
202
                      <li>access the webConfigurator with the new IP address</li>
203
		      <li>be sure to add <a href="firewall_rules.php">firewall rules</a> to permit traffic through the interface.</li>
204
		      <li>You also need firewall rules for an interface in bridged mode as the firewall acts as a filtering bridge.</li>
205
                    </ul>
206
                    </span></td>
207
                </tr>
208
              </table>
209
</form>
210
<?php include("fend.inc"); ?>
211
</body>
212
</html>
213

    
214
<?php
215

    
216
if ($_POST['apply'] <> "") {
217

    
218
	ob_flush();
219
	flush();
220
	
221
	interfaces_lan_configure();
222
	
223
	reset_carp();
224
	
225
	/* sync filter configuration */
226
	filter_configure();
227

    
228
	/* set up static routes */
229
	system_routing_configure();
230
	
231
	if(file_exists($d_landirty_path))
232
		unlink($d_landirty_path);
233
	
234
}
235

    
236
?>
(85-85/214)