Project

General

Profile

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