Project

General

Profile

Download (32.2 KB) Statistics
| Branch: | Tag: | Revision:
1 e2cd32df Scott Ullrich
<?php
2 b46bfcf5 Bill Marquette
/* $Id$ */
3 5b237745 Scott Ullrich
/*
4
	interfaces_wan.php
5 c3b3cd36 Scott Ullrich
        Copyright (C) 2004 Scott Ullrich
6
	All rights reserved.
7
        
8
	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 e2cd32df 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 e2cd32df 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 e2cd32df 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 e2cd32df 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
$wancfg = &$config['interfaces']['wan'];
37 8bb29531 Scott Ullrich
$optcfg = &$config['interfaces']['wan'];
38 5b237745 Scott Ullrich
39
$pconfig['username'] = $config['pppoe']['username'];
40
$pconfig['password'] = $config['pppoe']['password'];
41
$pconfig['provider'] = $config['pppoe']['provider'];
42 a23d7248 Scott Ullrich
$pconfig['pppoe_dialondemand'] = isset($config['pppoe']['ondemand']);
43 5b237745 Scott Ullrich
$pconfig['pppoe_idletimeout'] = $config['pppoe']['timeout'];
44
45
$pconfig['pptp_username'] = $config['pptp']['username'];
46
$pconfig['pptp_password'] = $config['pptp']['password'];
47
$pconfig['pptp_local'] = $config['pptp']['local'];
48
$pconfig['pptp_subnet'] = $config['pptp']['subnet'];
49
$pconfig['pptp_remote'] = $config['pptp']['remote'];
50 a23d7248 Scott Ullrich
$pconfig['pptp_dialondemand'] = isset($config['pptp']['ondemand']);
51 5b237745 Scott Ullrich
$pconfig['pptp_idletimeout'] = $config['pptp']['timeout'];
52
53 c1ec2c2f Scott Ullrich
$pconfig['disableftpproxy'] = isset($wancfg['disableftpproxy']);
54
55 5b237745 Scott Ullrich
$pconfig['bigpond_username'] = $config['bigpond']['username'];
56
$pconfig['bigpond_password'] = $config['bigpond']['password'];
57
$pconfig['bigpond_authserver'] = $config['bigpond']['authserver'];
58
$pconfig['bigpond_authdomain'] = $config['bigpond']['authdomain'];
59
$pconfig['bigpond_minheartbeatinterval'] = $config['bigpond']['minheartbeatinterval'];
60
61
$pconfig['dhcphostname'] = $wancfg['dhcphostname'];
62
63
if ($wancfg['ipaddr'] == "dhcp") {
64
	$pconfig['type'] = "DHCP";
65
} else if ($wancfg['ipaddr'] == "pppoe") {
66
	$pconfig['type'] = "PPPoE";
67
} else if ($wancfg['ipaddr'] == "pptp") {
68
	$pconfig['type'] = "PPTP";
69
} else if ($wancfg['ipaddr'] == "bigpond") {
70
	$pconfig['type'] = "BigPond";
71
} else {
72
	$pconfig['type'] = "Static";
73
	$pconfig['ipaddr'] = $wancfg['ipaddr'];
74
	$pconfig['subnet'] = $wancfg['subnet'];
75 588a183b Scott Ullrich
	$pconfig['gateway'] = $config['interfaces']['wan']['gateway'];
76 a23d7248 Scott Ullrich
	$pconfig['pointtopoint'] = $wancfg['pointtopoint'];
77 5b237745 Scott Ullrich
}
78
79
$pconfig['blockpriv'] = isset($wancfg['blockpriv']);
80 ff1955ee Bill Marquette
$pconfig['blockbogons'] = isset($wancfg['blockbogons']);
81 5b237745 Scott Ullrich
$pconfig['spoofmac'] = $wancfg['spoofmac'];
82
$pconfig['mtu'] = $wancfg['mtu'];
83
84
/* Wireless interface? */
85 b7f01f59 Bill Marquette
if (isset($wancfg['wireless'])) {
86 5b237745 Scott Ullrich
	require("interfaces_wlan.inc");
87
	wireless_config_init();
88
}
89
90
if ($_POST) {
91
92
	unset($input_errors);
93
	$pconfig = $_POST;
94
95
	/* input validation */
96
	if ($_POST['type'] == "Static") {
97
		$reqdfields = explode(" ", "ipaddr subnet gateway");
98
		$reqdfieldsn = explode(",", "IP address,Subnet bit count,Gateway");
99
		do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
100
	} else if ($_POST['type'] == "PPPoE") {
101
		if ($_POST['pppoe_dialondemand']) {
102
			$reqdfields = explode(" ", "username password pppoe_dialondemand pppoe_idletimeout");
103
			$reqdfieldsn = explode(",", "PPPoE username,PPPoE password,Dial on demand,Idle timeout value");
104
		} else {
105
			$reqdfields = explode(" ", "username password");
106
			$reqdfieldsn = explode(",", "PPPoE username,PPPoE password");
107
		}
108
		do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
109
	} else if ($_POST['type'] == "PPTP") {
110
		if ($_POST['pptp_dialondemand']) {
111
			$reqdfields = explode(" ", "pptp_username pptp_password pptp_local pptp_subnet pptp_remote pptp_dialondemand pptp_idletimeout");
112
			$reqdfieldsn = explode(",", "PPTP username,PPTP password,PPTP local IP address,PPTP subnet,PPTP remote IP address,Dial on demand,Idle timeout value");
113
		} else {
114
			$reqdfields = explode(" ", "pptp_username pptp_password pptp_local pptp_subnet pptp_remote");
115
			$reqdfieldsn = explode(",", "PPTP username,PPTP password,PPTP local IP address,PPTP subnet,PPTP remote IP address");
116
		}
117
		do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
118
	} else if ($_POST['type'] == "BigPond") {
119
		$reqdfields = explode(" ", "bigpond_username bigpond_password");
120
		$reqdfieldsn = explode(",", "BigPond username,BigPond password");
121
		do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
122
	}
123 e2cd32df Scott Ullrich
124 4f3401e0 Bill Marquette
        /* normalize MAC addresses - lowercase and convert Windows-ized hyphenated MACs to colon delimited */
125
        $_POST['spoofmac'] = strtolower(str_replace("-", ":", $_POST['spoofmac']));
126
127 5b237745 Scott Ullrich
	if (($_POST['ipaddr'] && !is_ipaddr($_POST['ipaddr']))) {
128
		$input_errors[] = "A valid IP address must be specified.";
129
	}
130
	if (($_POST['subnet'] && !is_numeric($_POST['subnet']))) {
131
		$input_errors[] = "A valid subnet bit count must be specified.";
132
	}
133
	if (($_POST['gateway'] && !is_ipaddr($_POST['gateway']))) {
134
		$input_errors[] = "A valid gateway must be specified.";
135
	}
136 a23d7248 Scott Ullrich
	if (($_POST['pointtopoint'] && !is_ipaddr($_POST['pointtopoint']))) {
137
		$input_errors[] = "A valid point-to-point IP address must be specified.";
138
	}
139 5b237745 Scott Ullrich
	if (($_POST['provider'] && !is_domain($_POST['provider']))) {
140
		$input_errors[] = "The service name contains invalid characters.";
141
	}
142 a23d7248 Scott Ullrich
	if (($_POST['pppoe_idletimeout'] != "") && !is_numericint($_POST['pppoe_idletimeout'])) {
143 5b237745 Scott Ullrich
		$input_errors[] = "The idle timeout value must be an integer.";
144
	}
145
	if (($_POST['pptp_local'] && !is_ipaddr($_POST['pptp_local']))) {
146
		$input_errors[] = "A valid PPTP local IP address must be specified.";
147
	}
148
	if (($_POST['pptp_subnet'] && !is_numeric($_POST['pptp_subnet']))) {
149
		$input_errors[] = "A valid PPTP subnet bit count must be specified.";
150
	}
151
	if (($_POST['pptp_remote'] && !is_ipaddr($_POST['pptp_remote']))) {
152
		$input_errors[] = "A valid PPTP remote IP address must be specified.";
153
	}
154 a23d7248 Scott Ullrich
	if (($_POST['pptp_idletimeout'] != "") && !is_numericint($_POST['pptp_idletimeout'])) {
155 5b237745 Scott Ullrich
		$input_errors[] = "The idle timeout value must be an integer.";
156
	}
157
	if (($_POST['bigpond_authserver'] && !is_domain($_POST['bigpond_authserver']))) {
158
		$input_errors[] = "The authentication server name contains invalid characters.";
159
	}
160
	if (($_POST['bigpond_authdomain'] && !is_domain($_POST['bigpond_authdomain']))) {
161
		$input_errors[] = "The authentication domain name contains invalid characters.";
162
	}
163
	if ($_POST['bigpond_minheartbeatinterval'] && !is_numericint($_POST['bigpond_minheartbeatinterval'])) {
164
		$input_errors[] = "The minimum heartbeat interval must be an integer.";
165
	}
166
	if (($_POST['spoofmac'] && !is_macaddr($_POST['spoofmac']))) {
167
		$input_errors[] = "A valid MAC address must be specified.";
168
	}
169
	if ($_POST['mtu'] && (($_POST['mtu'] < 576) || ($_POST['mtu'] > 1500))) {
170
		$input_errors[] = "The MTU must be between 576 and 1500 bytes.";
171
	}
172 e2cd32df Scott Ullrich
173 5b237745 Scott Ullrich
	/* Wireless interface? */
174 b7f01f59 Bill Marquette
	if (isset($wancfg['wireless'])) {
175 5b237745 Scott Ullrich
		$wi_input_errors = wireless_config_post();
176
		if ($wi_input_errors) {
177
			$input_errors = array_merge($input_errors, $wi_input_errors);
178
		}
179
	}
180
181
	if (!$input_errors) {
182 e2cd32df Scott Ullrich
183 9a6757a1 Scott Ullrich
		$bridge = discover_bridge($wancfg['if'], filter_translate_type_to_real_interface($wancfg['bridge']));
184 0d429e43 Scott Ullrich
		if($bridge <> "-1") {
185 1665e79c Scott Ullrich
			destroy_bridge($bridge);
186 91e8aab2 Scott Ullrich
		}
187
	
188 5b237745 Scott Ullrich
		unset($wancfg['ipaddr']);
189
		unset($wancfg['subnet']);
190 588a183b Scott Ullrich
		unset($config['interfaces']['wan']['gateway']);
191 a23d7248 Scott Ullrich
		unset($wancfg['pointtopoint']);
192 5b237745 Scott Ullrich
		unset($wancfg['dhcphostname']);
193
		unset($config['pppoe']['username']);
194
		unset($config['pppoe']['password']);
195
		unset($config['pppoe']['provider']);
196
		unset($config['pppoe']['ondemand']);
197
		unset($config['pppoe']['timeout']);
198
		unset($config['pptp']['username']);
199
		unset($config['pptp']['password']);
200
		unset($config['pptp']['local']);
201
		unset($config['pptp']['subnet']);
202
		unset($config['pptp']['remote']);
203
		unset($config['pptp']['ondemand']);
204
		unset($config['pptp']['timeout']);
205
		unset($config['bigpond']['username']);
206
		unset($config['bigpond']['password']);
207
		unset($config['bigpond']['authserver']);
208
		unset($config['bigpond']['authdomain']);
209
		unset($config['bigpond']['minheartbeatinterval']);
210 c1ec2c2f Scott Ullrich
		unset($wancfg['disableftpproxy']);
211
		
212
		/* per interface pftpx helper */
213
		if($_POST['disableftpproxy'] == "yes") {
214
			$wancfg['disableftpproxy'] = true;
215
			system_start_ftp_helpers();
216
		} else {			
217
			system_start_ftp_helpers();
218
		}
219 e2cd32df Scott Ullrich
220 5b237745 Scott Ullrich
		if ($_POST['type'] == "Static") {
221
			$wancfg['ipaddr'] = $_POST['ipaddr'];
222
			$wancfg['subnet'] = $_POST['subnet'];
223 588a183b Scott Ullrich
			$config['interfaces']['wan']['gateway'] = $_POST['gateway'];
224 a23d7248 Scott Ullrich
			if (isset($wancfg['ispointtopoint']))
225
				$wancfg['pointtopoint'] = $_POST['pointtopoint'];
226 5b237745 Scott Ullrich
		} else if ($_POST['type'] == "DHCP") {
227
			$wancfg['ipaddr'] = "dhcp";
228
			$wancfg['dhcphostname'] = $_POST['dhcphostname'];
229
		} else if ($_POST['type'] == "PPPoE") {
230
			$wancfg['ipaddr'] = "pppoe";
231
			$config['pppoe']['username'] = $_POST['username'];
232
			$config['pppoe']['password'] = $_POST['password'];
233
			$config['pppoe']['provider'] = $_POST['provider'];
234 a23d7248 Scott Ullrich
			$config['pppoe']['ondemand'] = $_POST['pppoe_dialondemand'] ? true : false;
235 5b237745 Scott Ullrich
			$config['pppoe']['timeout'] = $_POST['pppoe_idletimeout'];
236
		} else if ($_POST['type'] == "PPTP") {
237
			$wancfg['ipaddr'] = "pptp";
238
			$config['pptp']['username'] = $_POST['pptp_username'];
239
			$config['pptp']['password'] = $_POST['pptp_password'];
240
			$config['pptp']['local'] = $_POST['pptp_local'];
241
			$config['pptp']['subnet'] = $_POST['pptp_subnet'];
242
			$config['pptp']['remote'] = $_POST['pptp_remote'];
243 a23d7248 Scott Ullrich
			$config['pptp']['ondemand'] = $_POST['pptp_dialondemand'] ? true : false;
244 5b237745 Scott Ullrich
			$config['pptp']['timeout'] = $_POST['pptp_idletimeout'];
245
		} else if ($_POST['type'] == "BigPond") {
246
			$wancfg['ipaddr'] = "bigpond";
247
			$config['bigpond']['username'] = $_POST['bigpond_username'];
248
			$config['bigpond']['password'] = $_POST['bigpond_password'];
249
			$config['bigpond']['authserver'] = $_POST['bigpond_authserver'];
250
			$config['bigpond']['authdomain'] = $_POST['bigpond_authdomain'];
251
			$config['bigpond']['minheartbeatinterval'] = $_POST['bigpond_minheartbeatinterval'];
252
		}
253 e2cd32df Scott Ullrich
254 90ebf755 Scott Ullrich
		if($_POST['blockpriv'] == "yes")
255
			$wancfg['blockpriv'] = true;
256
		else
257 42a58cb9 Scott Ullrich
			unset($wancfg['blockpriv']);
258 90ebf755 Scott Ullrich
		
259
		if($_POST['blockbogons'] == "yes")
260
			$wancfg['blockbogons'] = true;
261
		else
262
			unset($wancfg['blockbogons']);
263
		
264 5b237745 Scott Ullrich
		$wancfg['spoofmac'] = $_POST['spoofmac'];
265
		$wancfg['mtu'] = $_POST['mtu'];
266 e2cd32df Scott Ullrich
267 5b237745 Scott Ullrich
		write_config();
268 e2cd32df Scott Ullrich
269 5b237745 Scott Ullrich
		$retval = 0;
270 11a4b1a0 Scott Ullrich
271 50410044 Scott Ullrich
		touch("/tmp/reload_interfaces");
272 19aeae7f Scott Ullrich
273 824edb6c Scott Ullrich
		$savemsg = get_std_save_message($retval);
274 5b237745 Scott Ullrich
	}
275
}
276 7f43ca88 Scott Ullrich
277
$pgtitle = "Interfaces: WAN";
278
include("head.inc");
279
280 5b237745 Scott Ullrich
?>
281 7f43ca88 Scott Ullrich
282 5b237745 Scott Ullrich
<script language="JavaScript">
283
<!--
284
function enable_change(enable_change) {
285
	if (document.iform.pppoe_dialondemand.checked || enable_change) {
286
		document.iform.pppoe_idletimeout.disabled = 0;
287
	} else {
288
		document.iform.pppoe_idletimeout.disabled = 1;
289
	}
290
}
291
292
function enable_change_pptp(enable_change_pptp) {
293
	if (document.iform.pptp_dialondemand.checked || enable_change_pptp) {
294
		document.iform.pptp_idletimeout.disabled = 0;
295
		document.iform.pptp_local.disabled = 0;
296
		document.iform.pptp_remote.disabled = 0;
297
	} else {
298
		document.iform.pptp_idletimeout.disabled = 1;
299
	}
300
}
301
302
function type_change(enable_change,enable_change_pptp) {
303
	switch (document.iform.type.selectedIndex) {
304
		case 0:
305
			document.iform.username.disabled = 1;
306
			document.iform.password.disabled = 1;
307
			document.iform.provider.disabled = 1;
308
			document.iform.pppoe_dialondemand.disabled = 1;
309
			document.iform.pppoe_idletimeout.disabled = 1;
310
			document.iform.ipaddr.disabled = 0;
311
			document.iform.subnet.disabled = 0;
312
			document.iform.gateway.disabled = 0;
313
			document.iform.pptp_username.disabled = 1;
314
			document.iform.pptp_password.disabled = 1;
315
			document.iform.pptp_local.disabled = 1;
316
			document.iform.pptp_subnet.disabled = 1;
317
			document.iform.pptp_remote.disabled = 1;
318
			document.iform.pptp_dialondemand.disabled = 1;
319
			document.iform.pptp_idletimeout.disabled = 1;
320
			document.iform.bigpond_username.disabled = 1;
321
			document.iform.bigpond_password.disabled = 1;
322
			document.iform.bigpond_authserver.disabled = 1;
323
			document.iform.bigpond_authdomain.disabled = 1;
324
			document.iform.bigpond_minheartbeatinterval.disabled = 1;
325
			document.iform.dhcphostname.disabled = 1;
326
			break;
327
		case 1:
328
			document.iform.username.disabled = 1;
329
			document.iform.password.disabled = 1;
330
			document.iform.provider.disabled = 1;
331
			document.iform.pppoe_dialondemand.disabled = 1;
332
			document.iform.pppoe_idletimeout.disabled = 1;
333
			document.iform.ipaddr.disabled = 1;
334
			document.iform.subnet.disabled = 1;
335
			document.iform.gateway.disabled = 1;
336
			document.iform.pptp_username.disabled = 1;
337
			document.iform.pptp_password.disabled = 1;
338
			document.iform.pptp_local.disabled = 1;
339
			document.iform.pptp_subnet.disabled = 1;
340
			document.iform.pptp_remote.disabled = 1;
341
			document.iform.pptp_dialondemand.disabled = 1;
342
			document.iform.pptp_idletimeout.disabled = 1;
343
			document.iform.bigpond_username.disabled = 1;
344
			document.iform.bigpond_password.disabled = 1;
345
			document.iform.bigpond_authserver.disabled = 1;
346
			document.iform.bigpond_authdomain.disabled = 1;
347
			document.iform.bigpond_minheartbeatinterval.disabled = 1;
348
			document.iform.dhcphostname.disabled = 0;
349
			break;
350
		case 2:
351
			document.iform.username.disabled = 0;
352
			document.iform.password.disabled = 0;
353
			document.iform.provider.disabled = 0;
354
			document.iform.pppoe_dialondemand.disabled = 0;
355
			if (document.iform.pppoe_dialondemand.checked || enable_change) {
356
				document.iform.pppoe_idletimeout.disabled = 0;
357
			} else {
358
				document.iform.pppoe_idletimeout.disabled = 1;
359
			}
360
			document.iform.ipaddr.disabled = 1;
361
			document.iform.subnet.disabled = 1;
362
			document.iform.gateway.disabled = 1;
363
			document.iform.pptp_username.disabled = 1;
364
			document.iform.pptp_password.disabled = 1;
365
			document.iform.pptp_local.disabled = 1;
366
			document.iform.pptp_subnet.disabled = 1;
367
			document.iform.pptp_remote.disabled = 1;
368
			document.iform.pptp_dialondemand.disabled = 1;
369
			document.iform.pptp_idletimeout.disabled = 1;
370
			document.iform.bigpond_username.disabled = 1;
371
			document.iform.bigpond_password.disabled = 1;
372
			document.iform.bigpond_authserver.disabled = 1;
373
			document.iform.bigpond_authdomain.disabled = 1;
374
			document.iform.bigpond_minheartbeatinterval.disabled = 1;
375
			document.iform.dhcphostname.disabled = 1;
376
			break;
377
		case 3:
378
			document.iform.username.disabled = 1;
379
			document.iform.password.disabled = 1;
380
			document.iform.provider.disabled = 1;
381
			document.iform.pppoe_dialondemand.disabled = 1;
382
			document.iform.pppoe_idletimeout.disabled = 1;
383
			document.iform.ipaddr.disabled = 1;
384
			document.iform.subnet.disabled = 1;
385
			document.iform.gateway.disabled = 1;
386
			document.iform.pptp_username.disabled = 0;
387
			document.iform.pptp_password.disabled = 0;
388
			document.iform.pptp_local.disabled = 0;
389
			document.iform.pptp_subnet.disabled = 0;
390
			document.iform.pptp_remote.disabled = 0;
391
			document.iform.pptp_dialondemand.disabled = 0;
392
			if (document.iform.pptp_dialondemand.checked || enable_change_pptp) {
393
				document.iform.pptp_idletimeout.disabled = 0;
394
			} else {
395
				document.iform.pptp_idletimeout.disabled = 1;
396
			}
397
			document.iform.bigpond_username.disabled = 1;
398
			document.iform.bigpond_password.disabled = 1;
399
			document.iform.bigpond_authserver.disabled = 1;
400
			document.iform.bigpond_authdomain.disabled = 1;
401
			document.iform.bigpond_minheartbeatinterval.disabled = 1;
402
			document.iform.dhcphostname.disabled = 1;
403
			break;
404
		case 4:
405
			document.iform.username.disabled = 1;
406
			document.iform.password.disabled = 1;
407
			document.iform.provider.disabled = 1;
408
			document.iform.pppoe_dialondemand.disabled = 1;
409
			document.iform.pppoe_idletimeout.disabled = 1;
410
			document.iform.ipaddr.disabled = 1;
411
			document.iform.subnet.disabled = 1;
412
			document.iform.gateway.disabled = 1;
413
			document.iform.pptp_username.disabled = 1;
414
			document.iform.pptp_password.disabled = 1;
415
			document.iform.pptp_local.disabled = 1;
416
			document.iform.pptp_subnet.disabled = 1;
417
			document.iform.pptp_remote.disabled = 1;
418
			document.iform.pptp_dialondemand.disabled = 1;
419
			document.iform.pptp_idletimeout.disabled = 1;
420
			document.iform.bigpond_username.disabled = 0;
421
			document.iform.bigpond_password.disabled = 0;
422
			document.iform.bigpond_authserver.disabled = 0;
423
			document.iform.bigpond_authdomain.disabled = 0;
424
			document.iform.bigpond_minheartbeatinterval.disabled = 0;
425
			document.iform.dhcphostname.disabled = 1;
426
			break;
427
	}
428
}
429
//-->
430
</script>
431
432
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
433
<?php include("fbegin.inc"); ?>
434 931066a8 Bill Marquette
<p class="pgtitle"><?=$pgtitle?></p>
435 5b237745 Scott Ullrich
<?php if ($input_errors) print_input_errors($input_errors); ?>
436
<?php if ($savemsg) print_info_box($savemsg); ?>
437
            <form action="interfaces_wan.php" method="post" name="iform" id="iform">
438
              <table width="100%" border="0" cellpadding="6" cellspacing="0">
439 e2cd32df Scott Ullrich
                <tr>
440 8fdc8744 Bill Marquette
                  <td colspan="2" valign="top" class="listtopic">General configuration</td>
441
                </tr>
442
                <tr>
443
                  <td valign="middle" class="vncell"><strong>Type</strong></td>
444
                  <td class="vtable"> <select name="type" class="formfld" id="type" onchange="type_change()">
445 5b237745 Scott Ullrich
                      <?php $opts = split(" ", "Static DHCP PPPoE PPTP BigPond");
446
				foreach ($opts as $opt): ?>
447 e2cd32df Scott Ullrich
                      <option <?php if ($opt == $pconfig['type']) echo "selected";?>>
448 5b237745 Scott Ullrich
                      <?=htmlspecialchars($opt);?>
449
                      </option>
450
                      <?php endforeach; ?>
451
                    </select></td>
452
                </tr>
453 e2cd32df Scott Ullrich
                <tr>
454 5b237745 Scott Ullrich
                  <td valign="top" class="vncell">MAC address</td>
455 e2cd32df Scott Ullrich
                  <td class="vtable"> <input name="spoofmac" type="text" class="formfld" id="spoofmac" size="30" value="<?=htmlspecialchars($pconfig['spoofmac']);?>">
456 1e694bee Scott Ullrich
		    <?php
457
			$ip = getenv('REMOTE_ADDR');
458
			$mac = `/usr/sbin/arp -an | grep {$ip} | cut -d" " -f4`;
459
			$mac = str_replace("\n","",$mac);
460
		    ?>
461
		    <a OnClick="document.forms[0].spoofmac.value='<?=$mac?>';" href="#">Copy my MAC address</a>   
462
		    <br>
463 e2cd32df Scott Ullrich
                    This field can be used to modify (&quot;spoof&quot;) the MAC
464 5b237745 Scott Ullrich
                    address of the WAN interface<br>
465
                    (may be required with some cable connections)<br>
466 e2cd32df Scott Ullrich
                    Enter a MAC address in the following format: xx:xx:xx:xx:xx:xx
467 5b237745 Scott Ullrich
                    or leave blank</td>
468
                </tr>
469 e2cd32df Scott Ullrich
                <tr>
470 5b237745 Scott Ullrich
                  <td valign="top" class="vncell">MTU</td>
471 e2cd32df Scott Ullrich
                  <td class="vtable"> <input name="mtu" type="text" class="formfld" id="mtu" size="8" value="<?=htmlspecialchars($pconfig['mtu']);?>">
472 5b237745 Scott Ullrich
                    <br>
473 e2cd32df Scott Ullrich
                    If you enter a value in this field, then MSS clamping for
474
                    TCP connections to the value entered above minus 40 (TCP/IP
475
                    header size) will be in effect. If you leave this field blank,
476
                    an MTU of 1492 bytes for PPPoE and 1500 bytes for all other
477 5b237745 Scott Ullrich
                    connection types will be assumed.</td>
478
                </tr>
479 e2cd32df Scott Ullrich
                <tr>
480 5b237745 Scott Ullrich
                  <td colspan="2" valign="top" height="16"></td>
481
                </tr>
482 e2cd32df Scott Ullrich
                <tr>
483 a23d7248 Scott Ullrich
                  <td colspan="2" valign="top" class="listtopic">Static IP configuration</td>
484 5b237745 Scott Ullrich
                </tr>
485 e2cd32df Scott Ullrich
                <tr>
486 5b237745 Scott Ullrich
                  <td width="100" valign="top" class="vncellreq">IP address</td>
487
                  <td class="vtable"> <input name="ipaddr" type="text" class="formfld" id="ipaddr" size="20" value="<?=htmlspecialchars($pconfig['ipaddr']);?>">
488 e2cd32df Scott Ullrich
                    /
489 5b237745 Scott Ullrich
                    <select name="subnet" class="formfld" id="subnet">
490 fa3b333d Scott Ullrich
			<?php
491
			for ($i = 32; $i > 0; $i--) {
492
				if($i <> 31) {
493
					echo "<option value=\"{$i}\" ";
494
					if ($i == $pconfig['subnet']) echo "selected";
495
					echo ">" . $i . "</option>";
496
				}
497
			}
498
			?>
499 5b237745 Scott Ullrich
                    </select></td>
500 a23d7248 Scott Ullrich
                </tr><?php if (isset($wancfg['ispointtopoint'])): ?>
501 7f5b4824 Scott Ullrich
                <tr>
502 a23d7248 Scott Ullrich
                  <td valign="top" class="vncellreq">Point-to-point IP address </td>
503
                  <td class="vtable">
504
                    <input name="pointtopoint" type="text" class="formfld" id="pointtopoint" size="20" value="<?=htmlspecialchars($pconfig['pointtopoint']);?>">
505
                  </td>
506
                </tr><?php endif; ?>
507 e2cd32df Scott Ullrich
                <tr>
508 5b237745 Scott Ullrich
                  <td valign="top" class="vncellreq">Gateway</td>
509 e2cd32df Scott Ullrich
                  <td class="vtable"> <input name="gateway" type="text" class="formfld" id="gateway" size="20" value="<?=htmlspecialchars($pconfig['gateway']);?>">
510 5b237745 Scott Ullrich
                  </td>
511
                </tr>
512 e2cd32df Scott Ullrich
                <tr>
513 73c38fa2 Scott Ullrich
                  <td colspan="2" valign="top" height="16"></td>
514
                </tr>
515 e2cd32df Scott Ullrich
                <tr>
516 a23d7248 Scott Ullrich
                  <td colspan="2" valign="top" class="listtopic">DHCP client configuration</td>
517 5b237745 Scott Ullrich
                </tr>
518 e2cd32df Scott Ullrich
                <tr>
519 5b237745 Scott Ullrich
                  <td valign="top" class="vncell">Hostname</td>
520
                  <td class="vtable"> <input name="dhcphostname" type="text" class="formfld" id="dhcphostname" size="40" value="<?=htmlspecialchars($pconfig['dhcphostname']);?>">
521
                    <br>
522 e2cd32df Scott Ullrich
                    The value in this field is sent as the DHCP client identifier
523
                    and hostname when requesting a DHCP lease. Some ISPs may require
524 5b237745 Scott Ullrich
                    this (for client identification).</td>
525
                </tr>
526 e2cd32df Scott Ullrich
                <tr>
527 5b237745 Scott Ullrich
                  <td colspan="2" valign="top" height="16"></td>
528
                </tr>
529 e2cd32df Scott Ullrich
                <tr>
530 a23d7248 Scott Ullrich
                  <td colspan="2" valign="top" class="listtopic">PPPoE configuration</td>
531 5b237745 Scott Ullrich
                </tr>
532 e2cd32df Scott Ullrich
                <tr>
533 5b237745 Scott Ullrich
                  <td valign="top" class="vncellreq">Username</td>
534 e2cd32df Scott Ullrich
                  <td class="vtable"><input name="username" type="text" class="formfld" id="username" size="20" value="<?=htmlspecialchars($pconfig['username']);?>">
535 5b237745 Scott Ullrich
                  </td>
536
                </tr>
537 e2cd32df Scott Ullrich
                <tr>
538 5b237745 Scott Ullrich
                  <td valign="top" class="vncellreq">Password</td>
539 e2cd32df Scott Ullrich
                  <td class="vtable"><input name="password" type="text" class="formfld" id="password" size="20" value="<?=htmlspecialchars($pconfig['password']);?>">
540 5b237745 Scott Ullrich
                  </td>
541
                </tr>
542 e2cd32df Scott Ullrich
                <tr>
543 5b237745 Scott Ullrich
                  <td valign="top" class="vncell">Service name</td>
544 e2cd32df Scott Ullrich
                  <td class="vtable"><input name="provider" type="text" class="formfld" id="provider" size="20" value="<?=htmlspecialchars($pconfig['provider']);?>">
545
                    <br> <span class="vexpl">Hint: this field can usually be left
546 5b237745 Scott Ullrich
                    empty</span></td>
547
                </tr>
548 e2cd32df Scott Ullrich
                <tr>
549 5b237745 Scott Ullrich
                  <td valign="top" class="vncell">Dial on demand</td>
550 e2cd32df Scott Ullrich
                  <td class="vtable"><input name="pppoe_dialondemand" type="checkbox" id="pppoe_dialondemand" value="enable" <?php if ($pconfig['pppoe_dialondemand']) echo "checked"; ?> onClick="enable_change(false)" >
551 5b237745 Scott Ullrich
                    <strong>Enable Dial-On-Demand mode</strong><br>
552
		    This option causes the interface to operate in dial-on-demand mode, allowing you to have a <i>virtual full time</i> connection. The interface is configured, but the actual connection of the link is delayed until qualifying outgoing traffic is detected.</td>
553
                </tr>
554
                <tr>
555
                  <td valign="top" class="vncell">Idle timeout</td>
556
                  <td class="vtable">
557 fa3b333d Scott Ullrich
                    <input name="pppoe_idletimeout" type="text" class="formfld" id="pppoe_idletimeout" size="8" value="<?=htmlspecialchars($pconfig['pppoe_idletimeout']);?>"> seconds<br>If no qualifying outgoing packets are transmitted for the specified number of seconds, the connection is brought down. An idle timeout of zero disables this feature.</td>
558 5b237745 Scott Ullrich
                </tr>
559 e2cd32df Scott Ullrich
                <tr>
560 5b237745 Scott Ullrich
                  <td colspan="2" valign="top" height="16"></td>
561
                </tr>
562 e2cd32df Scott Ullrich
                <tr>
563 a23d7248 Scott Ullrich
                  <td colspan="2" valign="top" class="listtopic">PPTP configuration</td>
564 5b237745 Scott Ullrich
                </tr>
565 e2cd32df Scott Ullrich
                <tr>
566 5b237745 Scott Ullrich
                  <td valign="top" class="vncellreq">Username</td>
567 e2cd32df Scott Ullrich
                  <td class="vtable"><input name="pptp_username" type="text" class="formfld" id="pptp_username" size="20" value="<?=htmlspecialchars($pconfig['pptp_username']);?>">
568 5b237745 Scott Ullrich
                  </td>
569
                </tr>
570 e2cd32df Scott Ullrich
                <tr>
571 5b237745 Scott Ullrich
                  <td valign="top" class="vncellreq">Password</td>
572 e2cd32df Scott Ullrich
                  <td class="vtable"><input name="pptp_password" type="text" class="formfld" id="pptp_password" size="20" value="<?=htmlspecialchars($pconfig['pptp_password']);?>">
573 5b237745 Scott Ullrich
                  </td>
574
                </tr>
575 e2cd32df Scott Ullrich
                <tr>
576 5b237745 Scott Ullrich
                  <td width="100" valign="top" class="vncellreq">Local IP address</td>
577
                  <td class="vtable"> <input name="pptp_local" type="text" class="formfld" id="pptp_local" size="20" value="<?=htmlspecialchars($pconfig['pptp_local']);?>">
578 e2cd32df Scott Ullrich
                    /
579 5b237745 Scott Ullrich
                    <select name="pptp_subnet" class="formfld" id="pptp_subnet">
580 a23d7248 Scott Ullrich
                      <?php for ($i = 31; $i > 0; $i--): ?>
581 e2cd32df Scott Ullrich
                      <option value="<?=$i;?>" <?php if ($i == $pconfig['pptp_subnet']) echo "selected"; ?>>
582 5b237745 Scott Ullrich
                      <?=$i;?>
583
                      </option>
584
                      <?php endfor; ?>
585
                    </select></td>
586
                </tr>
587 e2cd32df Scott Ullrich
                <tr>
588 5b237745 Scott Ullrich
                  <td width="100" valign="top" class="vncellreq">Remote IP address</td>
589 e2cd32df Scott Ullrich
                  <td class="vtable"> <input name="pptp_remote" type="text" class="formfld" id="pptp_remote" size="20" value="<?=htmlspecialchars($pconfig['pptp_remote']);?>">
590 5b237745 Scott Ullrich
                  </td>
591
                </tr>
592 e2cd32df Scott Ullrich
                <tr>
593 5b237745 Scott Ullrich
                  <td valign="top" class="vncell">Dial on demand</td>
594 e2cd32df Scott Ullrich
                  <td class="vtable"><input name="pptp_dialondemand" type="checkbox" id="pptp_dialondemand" value="enable" <?php if ($pconfig['pptp_dialondemand']) echo "checked"; ?> onClick="enable_change_pptp(false)" >
595 5b237745 Scott Ullrich
                    <strong>Enable Dial-On-Demand mode</strong><br>
596
		    This option causes the interface to operate in dial-on-demand mode, allowing you to have a <i>virtual full time</i> connection. The interface is configured, but the actual connection of the link is delayed until qualifying outgoing traffic is detected.</td>
597
                </tr>
598
                <tr>
599
                  <td valign="top" class="vncell">Idle timeout</td>
600
                  <td class="vtable">
601 fa3b333d Scott Ullrich
                    <input name="pptp_idletimeout" type="text" class="formfld" id="pptp_idletimeout" size="8" value="<?=htmlspecialchars($pconfig['pptp_idletimeout']);?>"> seconds<br>If no qualifying outgoing packets are transmitted for the specified number of seconds, the connection is brought down. An idle timeout of zero disables this feature.</td>
602 5b237745 Scott Ullrich
                </tr>
603 e2cd32df Scott Ullrich
                <tr>
604 5b237745 Scott Ullrich
                  <td colspan="2" valign="top" height="16"></td>
605
                </tr>
606 e2cd32df Scott Ullrich
                <tr>
607 a23d7248 Scott Ullrich
                  <td colspan="2" valign="top" class="listtopic">BigPond Cable configuration</td>
608 5b237745 Scott Ullrich
                </tr>
609 e2cd32df Scott Ullrich
                <tr>
610 5b237745 Scott Ullrich
                  <td valign="top" class="vncellreq">Username</td>
611 e2cd32df Scott Ullrich
                  <td class="vtable"><input name="bigpond_username" type="text" class="formfld" id="bigpond_username" size="20" value="<?=htmlspecialchars($pconfig['bigpond_username']);?>">
612 5b237745 Scott Ullrich
                  </td>
613
                </tr>
614 e2cd32df Scott Ullrich
                <tr>
615 5b237745 Scott Ullrich
                  <td valign="top" class="vncellreq">Password</td>
616 e2cd32df Scott Ullrich
                  <td class="vtable"><input name="bigpond_password" type="text" class="formfld" id="bigpond_password" size="20" value="<?=htmlspecialchars($pconfig['bigpond_password']);?>">
617 5b237745 Scott Ullrich
                  </td>
618
                </tr>
619 e2cd32df Scott Ullrich
                <tr>
620 5b237745 Scott Ullrich
                  <td valign="top" class="vncell">Authentication server</td>
621
                  <td class="vtable"><input name="bigpond_authserver" type="text" class="formfld" id="bigpond_authserver" size="20" value="<?=htmlspecialchars($pconfig['bigpond_authserver']);?>">
622
                    <br>
623
                  <span class="vexpl">If this field is left empty, the default (&quot;dce-server&quot;) is used. </span></td>
624
                </tr>
625 e2cd32df Scott Ullrich
                <tr>
626 5b237745 Scott Ullrich
                  <td valign="top" class="vncell">Authentication domain</td>
627
                  <td class="vtable"><input name="bigpond_authdomain" type="text" class="formfld" id="bigpond_authdomain" size="20" value="<?=htmlspecialchars($pconfig['bigpond_authdomain']);?>">
628
                    <br>
629
                  <span class="vexpl">If this field is left empty, the domain name assigned via DHCP will be used.<br>
630
                  <br>
631
                  Note: the BigPond client implicitly sets the &quot;Allow DNS server list to be overridden by DHCP/PPP on WAN&quot; on the System: General setup page.            </span></td>
632
                </tr>
633
                <tr>
634
                  <td valign="top" class="vncell">Min. heartbeat interval</td>
635
                  <td class="vtable">
636 fa3b333d Scott Ullrich
                    <input name="bigpond_minheartbeatinterval" type="text" class="formfld" id="bigpond_minheartbeatinterval" size="8" value="<?=htmlspecialchars($pconfig['bigpond_minheartbeatinterval']);?>">seconds<br>Setting this to a sensible value (e.g. 60 seconds) can protect against DoS attacks. </td>
637 5b237745 Scott Ullrich
                </tr>
638 da56c4d7 Scott Ullrich
                <tr>
639
                  <td colspan="2" valign="top" height="16"></td>
640
                </tr>
641
                <tr>
642
                  <td colspan="2" valign="top" class="listtopic">FTP Helper</td>
643
                </tr>		
644
		<tr>
645
			<td width="22%" valign="top" class="vncell">FTP Helper</td>
646
			<td width="78%" class="vtable">
647 0135299b Scott Ullrich
				<input name="disableftpproxy" type="checkbox" id="disableftpproxy" value="yes" <?php if ($pconfig['disableftpproxy']) echo "checked"; ?> onclick="enable_change(false)" />
648 da56c4d7 Scott Ullrich
				<strong>Disable the userland FTP-Proxy application</strong>
649
				<br />
650
			</td>
651
		</tr>
652 fa3b333d Scott Ullrich
		        <?php
653
				/* Wireless interface? */
654 b7f01f59 Bill Marquette
				if (isset($wancfg['wireless']))
655 5b237745 Scott Ullrich
					wireless_config_print();
656 fa3b333d Scott Ullrich
			?>
657 e2cd32df Scott Ullrich
                <tr>
658 5b237745 Scott Ullrich
                  <td height="16" colspan="2" valign="top"></td>
659
                </tr>
660 e2cd32df Scott Ullrich
                <tr>
661 5b237745 Scott Ullrich
                  <td valign="middle">&nbsp;</td>
662 d9eeccbd Scott Ullrich
                  <td class="vtable"><a name="rfc1918"></a> <input name="blockpriv" type="checkbox" id="blockpriv" value="yes" <?php if ($pconfig['blockpriv']) echo "checked"; ?>>
663 5b237745 Scott Ullrich
                    <strong>Block private networks</strong><br>
664 e2cd32df Scott Ullrich
                    When set, this option blocks traffic from IP addresses that
665 5b237745 Scott Ullrich
                    are reserved for private<br>
666 e2cd32df Scott Ullrich
                    networks as per RFC 1918 (10/8, 172.16/12, 192.168/16) as
667 5b237745 Scott Ullrich
                    well as loopback addresses<br>
668 e2cd32df Scott Ullrich
                    (127/8). You should generally leave this option turned on,
669 5b237745 Scott Ullrich
                    unless your WAN network<br>
670
                    lies in such a private address space, too.</td>
671
                </tr>
672 ff1955ee Bill Marquette
                <tr>
673
                  <td valign="middle">&nbsp;</td>
674
                  <td class="vtable"> <input name="blockbogons" type="checkbox" id="blockbogons" value="yes" <?php if ($pconfig['blockbogons']) echo "checked"; ?>>
675
                    <strong>Block bogon networks</strong><br>
676
                    When set, this option blocks traffic from IP addresses that
677
                    are reserved (but not RFC 1918) or not yet assigned by IANA.<br>
678
                    Bogons are prefixes that should never appear in the Internet routing table, and obviously should not appear as the source address in any packets you receive.</td>
679 c1ec2c2f Scott Ullrich
		</tr>
680 da56c4d7 Scott Ullrich
	
681 e2cd32df Scott Ullrich
                <tr>
682 5b237745 Scott Ullrich
                  <td width="100" valign="top">&nbsp;</td>
683 e2cd32df Scott Ullrich
                  <td> &nbsp;<br> <input name="Submit" type="submit" class="formbtn" value="Save" onClick="enable_change_pptp(true)&&enable_change(true)">
684 5b237745 Scott Ullrich
                  </td>
685
                </tr>
686
              </table>
687
</form>
688
<script language="JavaScript">
689
<!--
690
type_change();
691
//-->
692
</script>
693
<?php include("fend.inc"); ?>
694
</body>
695
</html>