Project

General

Profile

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