Project

General

Profile

Download (33.1 KB) Statistics
| Branch: | Tag: | Revision:
1 5b237745 Scott Ullrich
#!/usr/local/bin/php
2 e2cd32df Scott Ullrich
<?php
3 b46bfcf5 Bill Marquette
/* $Id$ */
4 5b237745 Scott Ullrich
/*
5
	interfaces_wan.php
6
	part of m0n0wall (http://m0n0.ch/wall)
7 e2cd32df Scott Ullrich
8 5b237745 Scott Ullrich
	Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
9
	All rights reserved.
10 e2cd32df Scott Ullrich
11 5b237745 Scott Ullrich
	Redistribution and use in source and binary forms, with or without
12
	modification, are permitted provided that the following conditions are met:
13 e2cd32df Scott Ullrich
14 5b237745 Scott Ullrich
	1. Redistributions of source code must retain the above copyright notice,
15
	   this list of conditions and the following disclaimer.
16 e2cd32df Scott Ullrich
17 5b237745 Scott Ullrich
	2. Redistributions in binary form must reproduce the above copyright
18
	   notice, this list of conditions and the following disclaimer in the
19
	   documentation and/or other materials provided with the distribution.
20 e2cd32df Scott Ullrich
21 5b237745 Scott Ullrich
	THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
22
	INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
23
	AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
24
	AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
25
	OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26
	SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27
	INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28
	CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29
	ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30
	POSSIBILITY OF SUCH DAMAGE.
31
*/
32
33
require("guiconfig.inc");
34
35
$wancfg = &$config['interfaces']['wan'];
36 8bb29531 Scott Ullrich
$optcfg = &$config['interfaces']['wan'];
37 5b237745 Scott Ullrich
38
$pconfig['username'] = $config['pppoe']['username'];
39
$pconfig['password'] = $config['pppoe']['password'];
40
$pconfig['provider'] = $config['pppoe']['provider'];
41 a23d7248 Scott Ullrich
$pconfig['pppoe_dialondemand'] = isset($config['pppoe']['ondemand']);
42 5b237745 Scott Ullrich
$pconfig['pppoe_idletimeout'] = $config['pppoe']['timeout'];
43
44
$pconfig['pptp_username'] = $config['pptp']['username'];
45
$pconfig['pptp_password'] = $config['pptp']['password'];
46
$pconfig['pptp_local'] = $config['pptp']['local'];
47
$pconfig['pptp_subnet'] = $config['pptp']['subnet'];
48
$pconfig['pptp_remote'] = $config['pptp']['remote'];
49 a23d7248 Scott Ullrich
$pconfig['pptp_dialondemand'] = isset($config['pptp']['ondemand']);
50 5b237745 Scott Ullrich
$pconfig['pptp_idletimeout'] = $config['pptp']['timeout'];
51
52
$pconfig['bigpond_username'] = $config['bigpond']['username'];
53
$pconfig['bigpond_password'] = $config['bigpond']['password'];
54
$pconfig['bigpond_authserver'] = $config['bigpond']['authserver'];
55
$pconfig['bigpond_authdomain'] = $config['bigpond']['authdomain'];
56
$pconfig['bigpond_minheartbeatinterval'] = $config['bigpond']['minheartbeatinterval'];
57
58
$pconfig['dhcphostname'] = $wancfg['dhcphostname'];
59
60
if ($wancfg['ipaddr'] == "dhcp") {
61
	$pconfig['type'] = "DHCP";
62
} else if ($wancfg['ipaddr'] == "pppoe") {
63
	$pconfig['type'] = "PPPoE";
64
} else if ($wancfg['ipaddr'] == "pptp") {
65
	$pconfig['type'] = "PPTP";
66
} else if ($wancfg['ipaddr'] == "bigpond") {
67
	$pconfig['type'] = "BigPond";
68
} else {
69
	$pconfig['type'] = "Static";
70
	$pconfig['ipaddr'] = $wancfg['ipaddr'];
71
	$pconfig['subnet'] = $wancfg['subnet'];
72 88f66e13 Bill Marquette
	$pconfig['gateway'] = $config['system']['gateway'];
73 a23d7248 Scott Ullrich
	$pconfig['pointtopoint'] = $wancfg['pointtopoint'];
74 5b237745 Scott Ullrich
}
75
76
$pconfig['blockpriv'] = isset($wancfg['blockpriv']);
77 ff1955ee Bill Marquette
$pconfig['blockbogons'] = isset($wancfg['blockbogons']);
78 5b237745 Scott Ullrich
$pconfig['spoofmac'] = $wancfg['spoofmac'];
79
$pconfig['mtu'] = $wancfg['mtu'];
80
81
/* Wireless interface? */
82 b7f01f59 Bill Marquette
if (isset($wancfg['wireless'])) {
83 5b237745 Scott Ullrich
	require("interfaces_wlan.inc");
84
	wireless_config_init();
85
}
86
87
if ($_POST) {
88
89
	unset($input_errors);
90
	$pconfig = $_POST;
91
92
	/* input validation */
93
	if ($_POST['type'] == "Static") {
94
		$reqdfields = explode(" ", "ipaddr subnet gateway");
95
		$reqdfieldsn = explode(",", "IP address,Subnet bit count,Gateway");
96
		do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
97
	} else if ($_POST['type'] == "PPPoE") {
98
		if ($_POST['pppoe_dialondemand']) {
99
			$reqdfields = explode(" ", "username password pppoe_dialondemand pppoe_idletimeout");
100
			$reqdfieldsn = explode(",", "PPPoE username,PPPoE password,Dial on demand,Idle timeout value");
101
		} else {
102
			$reqdfields = explode(" ", "username password");
103
			$reqdfieldsn = explode(",", "PPPoE username,PPPoE password");
104
		}
105
		do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
106
	} else if ($_POST['type'] == "PPTP") {
107
		if ($_POST['pptp_dialondemand']) {
108
			$reqdfields = explode(" ", "pptp_username pptp_password pptp_local pptp_subnet pptp_remote pptp_dialondemand pptp_idletimeout");
109
			$reqdfieldsn = explode(",", "PPTP username,PPTP password,PPTP local IP address,PPTP subnet,PPTP remote IP address,Dial on demand,Idle timeout value");
110
		} else {
111
			$reqdfields = explode(" ", "pptp_username pptp_password pptp_local pptp_subnet pptp_remote");
112
			$reqdfieldsn = explode(",", "PPTP username,PPTP password,PPTP local IP address,PPTP subnet,PPTP remote IP address");
113
		}
114
		do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
115
	} else if ($_POST['type'] == "BigPond") {
116
		$reqdfields = explode(" ", "bigpond_username bigpond_password");
117
		$reqdfieldsn = explode(",", "BigPond username,BigPond password");
118
		do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
119
	}
120 e2cd32df Scott Ullrich
121 4f3401e0 Bill Marquette
        /* normalize MAC addresses - lowercase and convert Windows-ized hyphenated MACs to colon delimited */
122
        $_POST['spoofmac'] = strtolower(str_replace("-", ":", $_POST['spoofmac']));
123
124 5b237745 Scott Ullrich
	if (($_POST['ipaddr'] && !is_ipaddr($_POST['ipaddr']))) {
125
		$input_errors[] = "A valid IP address must be specified.";
126
	}
127
	if (($_POST['subnet'] && !is_numeric($_POST['subnet']))) {
128
		$input_errors[] = "A valid subnet bit count must be specified.";
129
	}
130
	if (($_POST['gateway'] && !is_ipaddr($_POST['gateway']))) {
131
		$input_errors[] = "A valid gateway must be specified.";
132
	}
133 a23d7248 Scott Ullrich
	if (($_POST['pointtopoint'] && !is_ipaddr($_POST['pointtopoint']))) {
134
		$input_errors[] = "A valid point-to-point IP address must be specified.";
135
	}
136 5b237745 Scott Ullrich
	if (($_POST['provider'] && !is_domain($_POST['provider']))) {
137
		$input_errors[] = "The service name contains invalid characters.";
138
	}
139 a23d7248 Scott Ullrich
	if (($_POST['pppoe_idletimeout'] != "") && !is_numericint($_POST['pppoe_idletimeout'])) {
140 5b237745 Scott Ullrich
		$input_errors[] = "The idle timeout value must be an integer.";
141
	}
142
	if (($_POST['pptp_local'] && !is_ipaddr($_POST['pptp_local']))) {
143
		$input_errors[] = "A valid PPTP local IP address must be specified.";
144
	}
145
	if (($_POST['pptp_subnet'] && !is_numeric($_POST['pptp_subnet']))) {
146
		$input_errors[] = "A valid PPTP subnet bit count must be specified.";
147
	}
148
	if (($_POST['pptp_remote'] && !is_ipaddr($_POST['pptp_remote']))) {
149
		$input_errors[] = "A valid PPTP remote IP address must be specified.";
150
	}
151 a23d7248 Scott Ullrich
	if (($_POST['pptp_idletimeout'] != "") && !is_numericint($_POST['pptp_idletimeout'])) {
152 5b237745 Scott Ullrich
		$input_errors[] = "The idle timeout value must be an integer.";
153
	}
154
	if (($_POST['bigpond_authserver'] && !is_domain($_POST['bigpond_authserver']))) {
155
		$input_errors[] = "The authentication server name contains invalid characters.";
156
	}
157
	if (($_POST['bigpond_authdomain'] && !is_domain($_POST['bigpond_authdomain']))) {
158
		$input_errors[] = "The authentication domain name contains invalid characters.";
159
	}
160
	if ($_POST['bigpond_minheartbeatinterval'] && !is_numericint($_POST['bigpond_minheartbeatinterval'])) {
161
		$input_errors[] = "The minimum heartbeat interval must be an integer.";
162
	}
163
	if (($_POST['spoofmac'] && !is_macaddr($_POST['spoofmac']))) {
164
		$input_errors[] = "A valid MAC address must be specified.";
165
	}
166
	if ($_POST['mtu'] && (($_POST['mtu'] < 576) || ($_POST['mtu'] > 1500))) {
167
		$input_errors[] = "The MTU must be between 576 and 1500 bytes.";
168
	}
169 e2cd32df Scott Ullrich
170 5b237745 Scott Ullrich
	/* Wireless interface? */
171 b7f01f59 Bill Marquette
	if (isset($wancfg['wireless'])) {
172 5b237745 Scott Ullrich
		$wi_input_errors = wireless_config_post();
173
		if ($wi_input_errors) {
174
			$input_errors = array_merge($input_errors, $wi_input_errors);
175
		}
176
	}
177
178
	if (!$input_errors) {
179 e2cd32df Scott Ullrich
180 5b237745 Scott Ullrich
		unset($wancfg['ipaddr']);
181
		unset($wancfg['subnet']);
182 88f66e13 Bill Marquette
		unset($config['system']['gateway']);
183 a23d7248 Scott Ullrich
		unset($wancfg['pointtopoint']);
184 5b237745 Scott Ullrich
		unset($wancfg['dhcphostname']);
185
		unset($config['pppoe']['username']);
186
		unset($config['pppoe']['password']);
187
		unset($config['pppoe']['provider']);
188
		unset($config['pppoe']['ondemand']);
189
		unset($config['pppoe']['timeout']);
190
		unset($config['pptp']['username']);
191
		unset($config['pptp']['password']);
192
		unset($config['pptp']['local']);
193
		unset($config['pptp']['subnet']);
194
		unset($config['pptp']['remote']);
195
		unset($config['pptp']['ondemand']);
196
		unset($config['pptp']['timeout']);
197
		unset($config['bigpond']['username']);
198
		unset($config['bigpond']['password']);
199
		unset($config['bigpond']['authserver']);
200
		unset($config['bigpond']['authdomain']);
201
		unset($config['bigpond']['minheartbeatinterval']);
202 e2cd32df Scott Ullrich
203 5b237745 Scott Ullrich
		if ($_POST['type'] == "Static") {
204
			$wancfg['ipaddr'] = $_POST['ipaddr'];
205
			$wancfg['subnet'] = $_POST['subnet'];
206 88f66e13 Bill Marquette
			$config['system']['gateway'] = $_POST['gateway'];
207 a23d7248 Scott Ullrich
			if (isset($wancfg['ispointtopoint']))
208
				$wancfg['pointtopoint'] = $_POST['pointtopoint'];
209 5b237745 Scott Ullrich
		} else if ($_POST['type'] == "DHCP") {
210
			$wancfg['ipaddr'] = "dhcp";
211
			$wancfg['dhcphostname'] = $_POST['dhcphostname'];
212
		} else if ($_POST['type'] == "PPPoE") {
213
			$wancfg['ipaddr'] = "pppoe";
214
			$config['pppoe']['username'] = $_POST['username'];
215
			$config['pppoe']['password'] = $_POST['password'];
216
			$config['pppoe']['provider'] = $_POST['provider'];
217 a23d7248 Scott Ullrich
			$config['pppoe']['ondemand'] = $_POST['pppoe_dialondemand'] ? true : false;
218 5b237745 Scott Ullrich
			$config['pppoe']['timeout'] = $_POST['pppoe_idletimeout'];
219
		} else if ($_POST['type'] == "PPTP") {
220
			$wancfg['ipaddr'] = "pptp";
221
			$config['pptp']['username'] = $_POST['pptp_username'];
222
			$config['pptp']['password'] = $_POST['pptp_password'];
223
			$config['pptp']['local'] = $_POST['pptp_local'];
224
			$config['pptp']['subnet'] = $_POST['pptp_subnet'];
225
			$config['pptp']['remote'] = $_POST['pptp_remote'];
226 a23d7248 Scott Ullrich
			$config['pptp']['ondemand'] = $_POST['pptp_dialondemand'] ? true : false;
227 5b237745 Scott Ullrich
			$config['pptp']['timeout'] = $_POST['pptp_idletimeout'];
228
		} else if ($_POST['type'] == "BigPond") {
229
			$wancfg['ipaddr'] = "bigpond";
230
			$config['bigpond']['username'] = $_POST['bigpond_username'];
231
			$config['bigpond']['password'] = $_POST['bigpond_password'];
232
			$config['bigpond']['authserver'] = $_POST['bigpond_authserver'];
233
			$config['bigpond']['authdomain'] = $_POST['bigpond_authdomain'];
234
			$config['bigpond']['minheartbeatinterval'] = $_POST['bigpond_minheartbeatinterval'];
235
		}
236 e2cd32df Scott Ullrich
237 001fdeea Scott Ullrich
		if($_POST['bandwidth'] <> "" and $_POST['bandwidthtype'] <> "") {
238
			$wancfg['bandwidth'] = $_POST['bandwidth'];
239
			$wancfg['bandwidthtype'] = $_POST['bandwidthtype'];
240
		} else {
241
			unset($wancfg['bandwidth']);
242
			unset($wancfg['bandwidthtype']);
243
		}
244 9ce0cacc Scott Ullrich
245 5b237745 Scott Ullrich
		$wancfg['blockpriv'] = $_POST['blockpriv'] ? true : false;
246 ff1955ee Bill Marquette
		$wancfg['blockbogons'] = $_POST['blockbogons'] ? true : false;
247 5b237745 Scott Ullrich
		$wancfg['spoofmac'] = $_POST['spoofmac'];
248
		$wancfg['mtu'] = $_POST['mtu'];
249 e2cd32df Scott Ullrich
250 5b237745 Scott Ullrich
		write_config();
251 e2cd32df Scott Ullrich
252 5b237745 Scott Ullrich
		$retval = 0;
253
		if (!file_exists($d_sysrebootreqd_path)) {
254
			config_lock();
255
			$retval = interfaces_wan_configure();
256
			config_unlock();
257
		}
258
		$savemsg = get_std_save_message($retval);
259
	}
260
}
261
?>
262
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
263
<html>
264
<head>
265
<title><?=gentitle("Interfaces: WAN");?></title>
266
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
267
<link href="gui.css" rel="stylesheet" type="text/css">
268
<script language="JavaScript">
269
<!--
270
function enable_change(enable_change) {
271
	if (document.iform.pppoe_dialondemand.checked || enable_change) {
272
		document.iform.pppoe_idletimeout.disabled = 0;
273
	} else {
274
		document.iform.pppoe_idletimeout.disabled = 1;
275
	}
276
}
277
278
function enable_change_pptp(enable_change_pptp) {
279
	if (document.iform.pptp_dialondemand.checked || enable_change_pptp) {
280
		document.iform.pptp_idletimeout.disabled = 0;
281
		document.iform.pptp_local.disabled = 0;
282
		document.iform.pptp_remote.disabled = 0;
283
	} else {
284
		document.iform.pptp_idletimeout.disabled = 1;
285
	}
286
}
287
288
function type_change(enable_change,enable_change_pptp) {
289
	switch (document.iform.type.selectedIndex) {
290
		case 0:
291
			document.iform.username.disabled = 1;
292
			document.iform.password.disabled = 1;
293
			document.iform.provider.disabled = 1;
294
			document.iform.pppoe_dialondemand.disabled = 1;
295
			document.iform.pppoe_idletimeout.disabled = 1;
296
			document.iform.ipaddr.disabled = 0;
297
			document.iform.subnet.disabled = 0;
298
			document.iform.gateway.disabled = 0;
299
			document.iform.pptp_username.disabled = 1;
300
			document.iform.pptp_password.disabled = 1;
301
			document.iform.pptp_local.disabled = 1;
302
			document.iform.pptp_subnet.disabled = 1;
303
			document.iform.pptp_remote.disabled = 1;
304
			document.iform.pptp_dialondemand.disabled = 1;
305
			document.iform.pptp_idletimeout.disabled = 1;
306
			document.iform.bigpond_username.disabled = 1;
307
			document.iform.bigpond_password.disabled = 1;
308
			document.iform.bigpond_authserver.disabled = 1;
309
			document.iform.bigpond_authdomain.disabled = 1;
310
			document.iform.bigpond_minheartbeatinterval.disabled = 1;
311
			document.iform.dhcphostname.disabled = 1;
312
			break;
313
		case 1:
314
			document.iform.username.disabled = 1;
315
			document.iform.password.disabled = 1;
316
			document.iform.provider.disabled = 1;
317
			document.iform.pppoe_dialondemand.disabled = 1;
318
			document.iform.pppoe_idletimeout.disabled = 1;
319
			document.iform.ipaddr.disabled = 1;
320
			document.iform.subnet.disabled = 1;
321
			document.iform.gateway.disabled = 1;
322
			document.iform.pptp_username.disabled = 1;
323
			document.iform.pptp_password.disabled = 1;
324
			document.iform.pptp_local.disabled = 1;
325
			document.iform.pptp_subnet.disabled = 1;
326
			document.iform.pptp_remote.disabled = 1;
327
			document.iform.pptp_dialondemand.disabled = 1;
328
			document.iform.pptp_idletimeout.disabled = 1;
329
			document.iform.bigpond_username.disabled = 1;
330
			document.iform.bigpond_password.disabled = 1;
331
			document.iform.bigpond_authserver.disabled = 1;
332
			document.iform.bigpond_authdomain.disabled = 1;
333
			document.iform.bigpond_minheartbeatinterval.disabled = 1;
334
			document.iform.dhcphostname.disabled = 0;
335
			break;
336
		case 2:
337
			document.iform.username.disabled = 0;
338
			document.iform.password.disabled = 0;
339
			document.iform.provider.disabled = 0;
340
			document.iform.pppoe_dialondemand.disabled = 0;
341
			if (document.iform.pppoe_dialondemand.checked || enable_change) {
342
				document.iform.pppoe_idletimeout.disabled = 0;
343
			} else {
344
				document.iform.pppoe_idletimeout.disabled = 1;
345
			}
346
			document.iform.ipaddr.disabled = 1;
347
			document.iform.subnet.disabled = 1;
348
			document.iform.gateway.disabled = 1;
349
			document.iform.pptp_username.disabled = 1;
350
			document.iform.pptp_password.disabled = 1;
351
			document.iform.pptp_local.disabled = 1;
352
			document.iform.pptp_subnet.disabled = 1;
353
			document.iform.pptp_remote.disabled = 1;
354
			document.iform.pptp_dialondemand.disabled = 1;
355
			document.iform.pptp_idletimeout.disabled = 1;
356
			document.iform.bigpond_username.disabled = 1;
357
			document.iform.bigpond_password.disabled = 1;
358
			document.iform.bigpond_authserver.disabled = 1;
359
			document.iform.bigpond_authdomain.disabled = 1;
360
			document.iform.bigpond_minheartbeatinterval.disabled = 1;
361
			document.iform.dhcphostname.disabled = 1;
362
			break;
363
		case 3:
364
			document.iform.username.disabled = 1;
365
			document.iform.password.disabled = 1;
366
			document.iform.provider.disabled = 1;
367
			document.iform.pppoe_dialondemand.disabled = 1;
368
			document.iform.pppoe_idletimeout.disabled = 1;
369
			document.iform.ipaddr.disabled = 1;
370
			document.iform.subnet.disabled = 1;
371
			document.iform.gateway.disabled = 1;
372
			document.iform.pptp_username.disabled = 0;
373
			document.iform.pptp_password.disabled = 0;
374
			document.iform.pptp_local.disabled = 0;
375
			document.iform.pptp_subnet.disabled = 0;
376
			document.iform.pptp_remote.disabled = 0;
377
			document.iform.pptp_dialondemand.disabled = 0;
378
			if (document.iform.pptp_dialondemand.checked || enable_change_pptp) {
379
				document.iform.pptp_idletimeout.disabled = 0;
380
			} else {
381
				document.iform.pptp_idletimeout.disabled = 1;
382
			}
383
			document.iform.bigpond_username.disabled = 1;
384
			document.iform.bigpond_password.disabled = 1;
385
			document.iform.bigpond_authserver.disabled = 1;
386
			document.iform.bigpond_authdomain.disabled = 1;
387
			document.iform.bigpond_minheartbeatinterval.disabled = 1;
388
			document.iform.dhcphostname.disabled = 1;
389
			break;
390
		case 4:
391
			document.iform.username.disabled = 1;
392
			document.iform.password.disabled = 1;
393
			document.iform.provider.disabled = 1;
394
			document.iform.pppoe_dialondemand.disabled = 1;
395
			document.iform.pppoe_idletimeout.disabled = 1;
396
			document.iform.ipaddr.disabled = 1;
397
			document.iform.subnet.disabled = 1;
398
			document.iform.gateway.disabled = 1;
399
			document.iform.pptp_username.disabled = 1;
400
			document.iform.pptp_password.disabled = 1;
401
			document.iform.pptp_local.disabled = 1;
402
			document.iform.pptp_subnet.disabled = 1;
403
			document.iform.pptp_remote.disabled = 1;
404
			document.iform.pptp_dialondemand.disabled = 1;
405
			document.iform.pptp_idletimeout.disabled = 1;
406
			document.iform.bigpond_username.disabled = 0;
407
			document.iform.bigpond_password.disabled = 0;
408
			document.iform.bigpond_authserver.disabled = 0;
409
			document.iform.bigpond_authdomain.disabled = 0;
410
			document.iform.bigpond_minheartbeatinterval.disabled = 0;
411
			document.iform.dhcphostname.disabled = 1;
412
			break;
413
	}
414
}
415
//-->
416
</script>
417
</head>
418
419
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
420
<?php include("fbegin.inc"); ?>
421
<p class="pgtitle">Interfaces: WAN</p>
422
<?php if ($input_errors) print_input_errors($input_errors); ?>
423
<?php if ($savemsg) print_info_box($savemsg); ?>
424
            <form action="interfaces_wan.php" method="post" name="iform" id="iform">
425
              <table width="100%" border="0" cellpadding="6" cellspacing="0">
426 e2cd32df Scott Ullrich
                <tr>
427 5b237745 Scott Ullrich
                  <td valign="middle"><strong>Type</strong></td>
428
                  <td> <select name="type" class="formfld" id="type" onchange="type_change()">
429
                      <?php $opts = split(" ", "Static DHCP PPPoE PPTP BigPond");
430
				foreach ($opts as $opt): ?>
431 e2cd32df Scott Ullrich
                      <option <?php if ($opt == $pconfig['type']) echo "selected";?>>
432 5b237745 Scott Ullrich
                      <?=htmlspecialchars($opt);?>
433
                      </option>
434
                      <?php endforeach; ?>
435
                    </select></td>
436
                </tr>
437 e2cd32df Scott Ullrich
                <tr>
438 5b237745 Scott Ullrich
                  <td colspan="2" valign="top" height="4"></td>
439
                </tr>
440 e2cd32df Scott Ullrich
                <tr>
441 a23d7248 Scott Ullrich
                  <td colspan="2" valign="top" class="listtopic">General configuration</td>
442 5b237745 Scott Ullrich
                </tr>
443 e2cd32df Scott Ullrich
                <tr>
444 5b237745 Scott Ullrich
                  <td valign="top" class="vncell">MAC address</td>
445 e2cd32df Scott Ullrich
                  <td class="vtable"> <input name="spoofmac" type="text" class="formfld" id="spoofmac" size="30" value="<?=htmlspecialchars($pconfig['spoofmac']);?>">
446 1e694bee Scott Ullrich
		    <?php
447
			$ip = getenv('REMOTE_ADDR');
448
			$mac = `/usr/sbin/arp -an | grep {$ip} | cut -d" " -f4`;
449
			$mac = str_replace("\n","",$mac);
450
		    ?>
451
		    <a OnClick="document.forms[0].spoofmac.value='<?=$mac?>';" href="#">Copy my MAC address</a>   
452
		    <br>
453 e2cd32df Scott Ullrich
                    This field can be used to modify (&quot;spoof&quot;) the MAC
454 5b237745 Scott Ullrich
                    address of the WAN interface<br>
455
                    (may be required with some cable connections)<br>
456 e2cd32df Scott Ullrich
                    Enter a MAC address in the following format: xx:xx:xx:xx:xx:xx
457 5b237745 Scott Ullrich
                    or leave blank</td>
458
                </tr>
459 e2cd32df Scott Ullrich
                <tr>
460 5b237745 Scott Ullrich
                  <td valign="top" class="vncell">MTU</td>
461 e2cd32df Scott Ullrich
                  <td class="vtable"> <input name="mtu" type="text" class="formfld" id="mtu" size="8" value="<?=htmlspecialchars($pconfig['mtu']);?>">
462 5b237745 Scott Ullrich
                    <br>
463 e2cd32df Scott Ullrich
                    If you enter a value in this field, then MSS clamping for
464
                    TCP connections to the value entered above minus 40 (TCP/IP
465
                    header size) will be in effect. If you leave this field blank,
466
                    an MTU of 1492 bytes for PPPoE and 1500 bytes for all other
467 5b237745 Scott Ullrich
                    connection types will be assumed.</td>
468
                </tr>
469 e2cd32df Scott Ullrich
                <tr>
470 5b237745 Scott Ullrich
                  <td colspan="2" valign="top" height="16"></td>
471
                </tr>
472 e2cd32df Scott Ullrich
                <tr>
473 a23d7248 Scott Ullrich
                  <td colspan="2" valign="top" class="listtopic">Static IP configuration</td>
474 5b237745 Scott Ullrich
                </tr>
475 e2cd32df Scott Ullrich
                <tr>
476 5b237745 Scott Ullrich
                  <td width="100" valign="top" class="vncellreq">IP address</td>
477
                  <td class="vtable"> <input name="ipaddr" type="text" class="formfld" id="ipaddr" size="20" value="<?=htmlspecialchars($pconfig['ipaddr']);?>">
478 e2cd32df Scott Ullrich
                    /
479 5b237745 Scott Ullrich
                    <select name="subnet" class="formfld" id="subnet">
480 21ab1cde Scott Ullrich
					<?php
481
					for ($i = 32; $i > 0; $i--) {
482
						if($i <> 31) {
483
							echo "<option value=\"{$i}\" ";
484
							if ($i == $pconfig['subnet']) echo "selected";
485
							echo ">" . $i . "</option>";
486
						}
487
					}
488
					?>
489 a23d7248 Scott Ullrich
                    <?php
490 21ab1cde Scott Ullrich
					/*
491 a23d7248 Scott Ullrich
                      if (isset($wancfg['ispointtopoint']))
492
                      	$snmax = 32;
493
                      else
494
                      	$snmax = 31;
495
                      for ($i = $snmax; $i > 0; $i--): ?>
496 21ab1cde Scott Ullrich
					  <?php if(i$ <> 31) ?><option value="<?=$i;?>" <?php if ($i == $pconfig['subnet']) echo "selected"; ?>><?php end if; ?>
497 5b237745 Scott Ullrich
                      <?=$i;?>
498
                      </option>
499
                      <?php endfor; ?>
500 21ab1cde Scott Ullrich
					*/
501
					?>
502 5b237745 Scott Ullrich
                    </select></td>
503 a23d7248 Scott Ullrich
                </tr><?php if (isset($wancfg['ispointtopoint'])): ?>
504 7f5b4824 Scott Ullrich
                <tr>
505 a23d7248 Scott Ullrich
                  <td valign="top" class="vncellreq">Point-to-point IP address </td>
506
                  <td class="vtable">
507
                    <input name="pointtopoint" type="text" class="formfld" id="pointtopoint" size="20" value="<?=htmlspecialchars($pconfig['pointtopoint']);?>">
508
                  </td>
509
                </tr><?php endif; ?>
510 e2cd32df Scott Ullrich
                <tr>
511 5b237745 Scott Ullrich
                  <td valign="top" class="vncellreq">Gateway</td>
512 e2cd32df Scott Ullrich
                  <td class="vtable"> <input name="gateway" type="text" class="formfld" id="gateway" size="20" value="<?=htmlspecialchars($pconfig['gateway']);?>">
513 5b237745 Scott Ullrich
                  </td>
514
                </tr>
515 e2cd32df Scott Ullrich
                <tr>
516 73c38fa2 Scott Ullrich
                  <td colspan="2" valign="top" height="16"></td>
517
                </tr>
518
                <tr>
519 e2cd32df Scott Ullrich
                  <td colspan="2" valign="top" class="listtopic">Bandwidth Management (Traffic Shaping)</td>
520 73c38fa2 Scott Ullrich
                </tr>
521
                <tr>
522
                  <td valign="top" class="vncell">Interface Bandwidth Speed</td>
523 9dfbadd9 Scott Ullrich
                  <td class="vtable"> <input name="bandwidth" type="text" class="formfld" id="bandwidth" size="30" value="<?=htmlspecialchars($wancfg['bandwidth']);?>">
524 73c38fa2 Scott Ullrich
			<select name="bandwidthtype">
525 9dfbadd9 Scott Ullrich
				<option value="<?=htmlspecialchars($wancfg['bandwidthtype']);?>"><?=htmlspecialchars($wancfg['bandwidthtype']);?></option>
526 73c38fa2 Scott Ullrich
				<option value="b">bit/s</option>
527
				<option value="Kb">Kilobit/s</option>
528
				<option value="Mb">Megabit/s</option>
529
				<option value="Gb">Gigabit/s</option>
530 d09c8936 Scott Ullrich
				<option value=""></option>
531 73c38fa2 Scott Ullrich
			</select>
532
			<br> The bandwidth setting will define the speed of the interface for traffic shaping.
533
		  </td>
534
                </tr>
535 e2cd32df Scott Ullrich
                <tr>
536 9ce0cacc Scott Ullrich
                  <td colspan="2" valign="top" height="16"></td>
537 e2cd32df Scott Ullrich
                </tr>
538
                <tr>
539 a23d7248 Scott Ullrich
                  <td colspan="2" valign="top" class="listtopic">DHCP client configuration</td>
540 5b237745 Scott Ullrich
                </tr>
541 e2cd32df Scott Ullrich
                <tr>
542 5b237745 Scott Ullrich
                  <td valign="top" class="vncell">Hostname</td>
543
                  <td class="vtable"> <input name="dhcphostname" type="text" class="formfld" id="dhcphostname" size="40" value="<?=htmlspecialchars($pconfig['dhcphostname']);?>">
544
                    <br>
545 e2cd32df Scott Ullrich
                    The value in this field is sent as the DHCP client identifier
546
                    and hostname when requesting a DHCP lease. Some ISPs may require
547 5b237745 Scott Ullrich
                    this (for client identification).</td>
548
                </tr>
549 e2cd32df Scott Ullrich
                <tr>
550 5b237745 Scott Ullrich
                  <td colspan="2" valign="top" height="16"></td>
551
                </tr>
552 e2cd32df Scott Ullrich
                <tr>
553 a23d7248 Scott Ullrich
                  <td colspan="2" valign="top" class="listtopic">PPPoE configuration</td>
554 5b237745 Scott Ullrich
                </tr>
555 e2cd32df Scott Ullrich
                <tr>
556 5b237745 Scott Ullrich
                  <td valign="top" class="vncellreq">Username</td>
557 e2cd32df Scott Ullrich
                  <td class="vtable"><input name="username" type="text" class="formfld" id="username" size="20" value="<?=htmlspecialchars($pconfig['username']);?>">
558 5b237745 Scott Ullrich
                  </td>
559
                </tr>
560 e2cd32df Scott Ullrich
                <tr>
561 5b237745 Scott Ullrich
                  <td valign="top" class="vncellreq">Password</td>
562 e2cd32df Scott Ullrich
                  <td class="vtable"><input name="password" type="text" class="formfld" id="password" size="20" value="<?=htmlspecialchars($pconfig['password']);?>">
563 5b237745 Scott Ullrich
                  </td>
564
                </tr>
565 e2cd32df Scott Ullrich
                <tr>
566 5b237745 Scott Ullrich
                  <td valign="top" class="vncell">Service name</td>
567 e2cd32df Scott Ullrich
                  <td class="vtable"><input name="provider" type="text" class="formfld" id="provider" size="20" value="<?=htmlspecialchars($pconfig['provider']);?>">
568
                    <br> <span class="vexpl">Hint: this field can usually be left
569 5b237745 Scott Ullrich
                    empty</span></td>
570
                </tr>
571 e2cd32df Scott Ullrich
                <tr>
572 5b237745 Scott Ullrich
                  <td valign="top" class="vncell">Dial on demand</td>
573 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)" >
574 5b237745 Scott Ullrich
                    <strong>Enable Dial-On-Demand mode</strong><br>
575
		    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>
576
                </tr>
577
                <tr>
578
                  <td valign="top" class="vncell">Idle timeout</td>
579
                  <td class="vtable">
580
                    <input name="pppoe_idletimeout" type="text" class="formfld" id="pppoe_idletimeout" size="8" value="<?=htmlspecialchars($pconfig['pppoe_idletimeout']);?>">
581
                    seconds<br>
582
    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>
583
                </tr>
584 e2cd32df Scott Ullrich
                <tr>
585 5b237745 Scott Ullrich
                  <td colspan="2" valign="top" height="16"></td>
586
                </tr>
587 e2cd32df Scott Ullrich
                <tr>
588 a23d7248 Scott Ullrich
                  <td colspan="2" valign="top" class="listtopic">PPTP configuration</td>
589 5b237745 Scott Ullrich
                </tr>
590 e2cd32df Scott Ullrich
                <tr>
591 5b237745 Scott Ullrich
                  <td valign="top" class="vncellreq">Username</td>
592 e2cd32df Scott Ullrich
                  <td class="vtable"><input name="pptp_username" type="text" class="formfld" id="pptp_username" size="20" value="<?=htmlspecialchars($pconfig['pptp_username']);?>">
593 5b237745 Scott Ullrich
                  </td>
594
                </tr>
595 e2cd32df Scott Ullrich
                <tr>
596 5b237745 Scott Ullrich
                  <td valign="top" class="vncellreq">Password</td>
597 e2cd32df Scott Ullrich
                  <td class="vtable"><input name="pptp_password" type="text" class="formfld" id="pptp_password" size="20" value="<?=htmlspecialchars($pconfig['pptp_password']);?>">
598 5b237745 Scott Ullrich
                  </td>
599
                </tr>
600 e2cd32df Scott Ullrich
                <tr>
601 5b237745 Scott Ullrich
                  <td width="100" valign="top" class="vncellreq">Local IP address</td>
602
                  <td class="vtable"> <input name="pptp_local" type="text" class="formfld" id="pptp_local" size="20" value="<?=htmlspecialchars($pconfig['pptp_local']);?>">
603 e2cd32df Scott Ullrich
                    /
604 5b237745 Scott Ullrich
                    <select name="pptp_subnet" class="formfld" id="pptp_subnet">
605 a23d7248 Scott Ullrich
                      <?php for ($i = 31; $i > 0; $i--): ?>
606 e2cd32df Scott Ullrich
                      <option value="<?=$i;?>" <?php if ($i == $pconfig['pptp_subnet']) echo "selected"; ?>>
607 5b237745 Scott Ullrich
                      <?=$i;?>
608
                      </option>
609
                      <?php endfor; ?>
610
                    </select></td>
611
                </tr>
612 e2cd32df Scott Ullrich
                <tr>
613 5b237745 Scott Ullrich
                  <td width="100" valign="top" class="vncellreq">Remote IP address</td>
614 e2cd32df Scott Ullrich
                  <td class="vtable"> <input name="pptp_remote" type="text" class="formfld" id="pptp_remote" size="20" value="<?=htmlspecialchars($pconfig['pptp_remote']);?>">
615 5b237745 Scott Ullrich
                  </td>
616
                </tr>
617 e2cd32df Scott Ullrich
                <tr>
618 5b237745 Scott Ullrich
                  <td valign="top" class="vncell">Dial on demand</td>
619 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)" >
620 5b237745 Scott Ullrich
                    <strong>Enable Dial-On-Demand mode</strong><br>
621
		    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>
622
                </tr>
623
                <tr>
624
                  <td valign="top" class="vncell">Idle timeout</td>
625
                  <td class="vtable">
626
                    <input name="pptp_idletimeout" type="text" class="formfld" id="pptp_idletimeout" size="8" value="<?=htmlspecialchars($pconfig['pptp_idletimeout']);?>">
627
                    seconds<br>
628
    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>
629
                </tr>
630 e2cd32df Scott Ullrich
                <tr>
631 5b237745 Scott Ullrich
                  <td colspan="2" valign="top" height="16"></td>
632
                </tr>
633 e2cd32df Scott Ullrich
                <tr>
634 a23d7248 Scott Ullrich
                  <td colspan="2" valign="top" class="listtopic">BigPond Cable configuration</td>
635 5b237745 Scott Ullrich
                </tr>
636 e2cd32df Scott Ullrich
                <tr>
637 5b237745 Scott Ullrich
                  <td valign="top" class="vncellreq">Username</td>
638 e2cd32df Scott Ullrich
                  <td class="vtable"><input name="bigpond_username" type="text" class="formfld" id="bigpond_username" size="20" value="<?=htmlspecialchars($pconfig['bigpond_username']);?>">
639 5b237745 Scott Ullrich
                  </td>
640
                </tr>
641 e2cd32df Scott Ullrich
                <tr>
642 5b237745 Scott Ullrich
                  <td valign="top" class="vncellreq">Password</td>
643 e2cd32df Scott Ullrich
                  <td class="vtable"><input name="bigpond_password" type="text" class="formfld" id="bigpond_password" size="20" value="<?=htmlspecialchars($pconfig['bigpond_password']);?>">
644 5b237745 Scott Ullrich
                  </td>
645
                </tr>
646 e2cd32df Scott Ullrich
                <tr>
647 5b237745 Scott Ullrich
                  <td valign="top" class="vncell">Authentication server</td>
648
                  <td class="vtable"><input name="bigpond_authserver" type="text" class="formfld" id="bigpond_authserver" size="20" value="<?=htmlspecialchars($pconfig['bigpond_authserver']);?>">
649
                    <br>
650
                  <span class="vexpl">If this field is left empty, the default (&quot;dce-server&quot;) is used. </span></td>
651
                </tr>
652 e2cd32df Scott Ullrich
                <tr>
653 5b237745 Scott Ullrich
                  <td valign="top" class="vncell">Authentication domain</td>
654
                  <td class="vtable"><input name="bigpond_authdomain" type="text" class="formfld" id="bigpond_authdomain" size="20" value="<?=htmlspecialchars($pconfig['bigpond_authdomain']);?>">
655
                    <br>
656
                  <span class="vexpl">If this field is left empty, the domain name assigned via DHCP will be used.<br>
657
                  <br>
658
                  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>
659
                </tr>
660
                <tr>
661
                  <td valign="top" class="vncell">Min. heartbeat interval</td>
662
                  <td class="vtable">
663
                    <input name="bigpond_minheartbeatinterval" type="text" class="formfld" id="bigpond_minheartbeatinterval" size="8" value="<?=htmlspecialchars($pconfig['bigpond_minheartbeatinterval']);?>">
664
                    seconds<br>
665
    Setting this to a sensible value (e.g. 60 seconds) can protect against DoS attacks. </td>
666
                </tr>
667
                <?php /* Wireless interface? */
668 b7f01f59 Bill Marquette
				if (isset($wancfg['wireless']))
669 5b237745 Scott Ullrich
					wireless_config_print();
670
				?>
671 e2cd32df Scott Ullrich
                <tr>
672 5b237745 Scott Ullrich
                  <td height="16" colspan="2" valign="top"></td>
673
                </tr>
674 e2cd32df Scott Ullrich
                <tr>
675 5b237745 Scott Ullrich
                  <td valign="middle">&nbsp;</td>
676 e2cd32df Scott Ullrich
                  <td class="vtable"> <input name="blockpriv" type="checkbox" id="blockpriv" value="yes" <?php if ($pconfig['blockpriv']) echo "checked"; ?>>
677 5b237745 Scott Ullrich
                    <strong>Block private networks</strong><br>
678 e2cd32df Scott Ullrich
                    When set, this option blocks traffic from IP addresses that
679 5b237745 Scott Ullrich
                    are reserved for private<br>
680 e2cd32df Scott Ullrich
                    networks as per RFC 1918 (10/8, 172.16/12, 192.168/16) as
681 5b237745 Scott Ullrich
                    well as loopback addresses<br>
682 e2cd32df Scott Ullrich
                    (127/8). You should generally leave this option turned on,
683 5b237745 Scott Ullrich
                    unless your WAN network<br>
684
                    lies in such a private address space, too.</td>
685
                </tr>
686 ff1955ee Bill Marquette
                <tr>
687
                  <td valign="middle">&nbsp;</td>
688
                  <td class="vtable"> <input name="blockbogons" type="checkbox" id="blockbogons" value="yes" <?php if ($pconfig['blockbogons']) echo "checked"; ?>>
689
                    <strong>Block bogon networks</strong><br>
690
                    When set, this option blocks traffic from IP addresses that
691
                    are reserved (but not RFC 1918) or not yet assigned by IANA.<br>
692
                    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>
693 e2cd32df Scott Ullrich
                <tr>
694 5b237745 Scott Ullrich
                  <td width="100" valign="top">&nbsp;</td>
695 e2cd32df Scott Ullrich
                  <td> &nbsp;<br> <input name="Submit" type="submit" class="formbtn" value="Save" onClick="enable_change_pptp(true)&&enable_change(true)">
696 5b237745 Scott Ullrich
                  </td>
697
                </tr>
698
              </table>
699
</form>
700
<script language="JavaScript">
701
<!--
702
type_change();
703
//-->
704
</script>
705
<?php include("fend.inc"); ?>
706
</body>
707
</html>