Project

General

Profile

Download (32.2 KB) Statistics
| Branch: | Tag: | Revision:
1
#!/usr/local/bin/php
2
<?php
3
/*
4
	interfaces_wan.php
5
	part of m0n0wall (http://m0n0.ch/wall)
6

    
7
	Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
8
	All rights reserved.
9

    
10
	Redistribution and use in source and binary forms, with or without
11
	modification, are permitted provided that the following conditions are met:
12

    
13
	1. Redistributions of source code must retain the above copyright notice,
14
	   this list of conditions and the following disclaimer.
15

    
16
	2. Redistributions in binary form must reproduce the above copyright
17
	   notice, this list of conditions and the following disclaimer in the
18
	   documentation and/or other materials provided with the distribution.
19

    
20
	THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
21
	INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
22
	AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
23
	AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
24
	OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25
	SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26
	INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27
	CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28
	ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29
	POSSIBILITY OF SUCH DAMAGE.
30
*/
31

    
32
require("guiconfig.inc");
33

    
34
$wancfg = &$config['interfaces']['wan'];
35
$optcfg = &$config['interfaces']['wan'];
36

    
37
$pconfig['username'] = $config['pppoe']['username'];
38
$pconfig['password'] = $config['pppoe']['password'];
39
$pconfig['provider'] = $config['pppoe']['provider'];
40
$pconfig['pppoe_dialondemand'] = isset($config['pppoe']['ondemand']);
41
$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
$pconfig['pptp_dialondemand'] = isset($config['pptp']['ondemand']);
49
$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
	$pconfig['gateway'] = $wancfg['gateway'];
72
	$pconfig['pointtopoint'] = $wancfg['pointtopoint'];
73
}
74

    
75
$pconfig['blockpriv'] = isset($wancfg['blockpriv']);
76
$pconfig['spoofmac'] = $wancfg['spoofmac'];
77
$pconfig['mtu'] = $wancfg['mtu'];
78

    
79
/* Wireless interface? */
80
if (isset($optcfg['wireless'])) {
81
	require("interfaces_wlan.inc");
82
	wireless_config_init();
83
}
84

    
85
if ($_POST) {
86

    
87
	unset($input_errors);
88
	$pconfig = $_POST;
89

    
90
	/* input validation */
91
	if ($_POST['type'] == "Static") {
92
		$reqdfields = explode(" ", "ipaddr subnet gateway");
93
		$reqdfieldsn = explode(",", "IP address,Subnet bit count,Gateway");
94
		do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
95
	} else if ($_POST['type'] == "PPPoE") {
96
		if ($_POST['pppoe_dialondemand']) {
97
			$reqdfields = explode(" ", "username password pppoe_dialondemand pppoe_idletimeout");
98
			$reqdfieldsn = explode(",", "PPPoE username,PPPoE password,Dial on demand,Idle timeout value");
99
		} else {
100
			$reqdfields = explode(" ", "username password");
101
			$reqdfieldsn = explode(",", "PPPoE username,PPPoE password");
102
		}
103
		do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
104
	} else if ($_POST['type'] == "PPTP") {
105
		if ($_POST['pptp_dialondemand']) {
106
			$reqdfields = explode(" ", "pptp_username pptp_password pptp_local pptp_subnet pptp_remote pptp_dialondemand pptp_idletimeout");
107
			$reqdfieldsn = explode(",", "PPTP username,PPTP password,PPTP local IP address,PPTP subnet,PPTP remote IP address,Dial on demand,Idle timeout value");
108
		} else {
109
			$reqdfields = explode(" ", "pptp_username pptp_password pptp_local pptp_subnet pptp_remote");
110
			$reqdfieldsn = explode(",", "PPTP username,PPTP password,PPTP local IP address,PPTP subnet,PPTP remote IP address");
111
		}
112
		do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
113
	} else if ($_POST['type'] == "BigPond") {
114
		$reqdfields = explode(" ", "bigpond_username bigpond_password");
115
		$reqdfieldsn = explode(",", "BigPond username,BigPond password");
116
		do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
117
	}
118

    
119
	if (($_POST['ipaddr'] && !is_ipaddr($_POST['ipaddr']))) {
120
		$input_errors[] = "A valid IP address must be specified.";
121
	}
122
	if (($_POST['subnet'] && !is_numeric($_POST['subnet']))) {
123
		$input_errors[] = "A valid subnet bit count must be specified.";
124
	}
125
	if (($_POST['gateway'] && !is_ipaddr($_POST['gateway']))) {
126
		$input_errors[] = "A valid gateway must be specified.";
127
	}
128
	if (($_POST['pointtopoint'] && !is_ipaddr($_POST['pointtopoint']))) {
129
		$input_errors[] = "A valid point-to-point IP address must be specified.";
130
	}
131
	if (($_POST['provider'] && !is_domain($_POST['provider']))) {
132
		$input_errors[] = "The service name contains invalid characters.";
133
	}
134
	if (($_POST['pppoe_idletimeout'] != "") && !is_numericint($_POST['pppoe_idletimeout'])) {
135
		$input_errors[] = "The idle timeout value must be an integer.";
136
	}
137
	if (($_POST['pptp_local'] && !is_ipaddr($_POST['pptp_local']))) {
138
		$input_errors[] = "A valid PPTP local IP address must be specified.";
139
	}
140
	if (($_POST['pptp_subnet'] && !is_numeric($_POST['pptp_subnet']))) {
141
		$input_errors[] = "A valid PPTP subnet bit count must be specified.";
142
	}
143
	if (($_POST['pptp_remote'] && !is_ipaddr($_POST['pptp_remote']))) {
144
		$input_errors[] = "A valid PPTP remote IP address must be specified.";
145
	}
146
	if (($_POST['pptp_idletimeout'] != "") && !is_numericint($_POST['pptp_idletimeout'])) {
147
		$input_errors[] = "The idle timeout value must be an integer.";
148
	}
149
	if (($_POST['bigpond_authserver'] && !is_domain($_POST['bigpond_authserver']))) {
150
		$input_errors[] = "The authentication server name contains invalid characters.";
151
	}
152
	if (($_POST['bigpond_authdomain'] && !is_domain($_POST['bigpond_authdomain']))) {
153
		$input_errors[] = "The authentication domain name contains invalid characters.";
154
	}
155
	if ($_POST['bigpond_minheartbeatinterval'] && !is_numericint($_POST['bigpond_minheartbeatinterval'])) {
156
		$input_errors[] = "The minimum heartbeat interval must be an integer.";
157
	}
158
	if (($_POST['spoofmac'] && !is_macaddr($_POST['spoofmac']))) {
159
		$input_errors[] = "A valid MAC address must be specified.";
160
	}
161
	if ($_POST['mtu'] && (($_POST['mtu'] < 576) || ($_POST['mtu'] > 1500))) {
162
		$input_errors[] = "The MTU must be between 576 and 1500 bytes.";
163
	}
164

    
165
	/* Wireless interface? */
166
	if (isset($optcfg['wireless'])) {
167
		$wi_input_errors = wireless_config_post();
168
		if ($wi_input_errors) {
169
			$input_errors = array_merge($input_errors, $wi_input_errors);
170
		}
171
	}
172

    
173
	if (!$input_errors) {
174

    
175
		unset($wancfg['ipaddr']);
176
		unset($wancfg['subnet']);
177
		unset($wancfg['gateway']);
178
		unset($wancfg['pointtopoint']);
179
		unset($wancfg['dhcphostname']);
180
		unset($config['pppoe']['username']);
181
		unset($config['pppoe']['password']);
182
		unset($config['pppoe']['provider']);
183
		unset($config['pppoe']['ondemand']);
184
		unset($config['pppoe']['timeout']);
185
		unset($config['pptp']['username']);
186
		unset($config['pptp']['password']);
187
		unset($config['pptp']['local']);
188
		unset($config['pptp']['subnet']);
189
		unset($config['pptp']['remote']);
190
		unset($config['pptp']['ondemand']);
191
		unset($config['pptp']['timeout']);
192
		unset($config['bigpond']['username']);
193
		unset($config['bigpond']['password']);
194
		unset($config['bigpond']['authserver']);
195
		unset($config['bigpond']['authdomain']);
196
		unset($config['bigpond']['minheartbeatinterval']);
197

    
198
		if ($_POST['type'] == "Static") {
199
			$wancfg['ipaddr'] = $_POST['ipaddr'];
200
			$wancfg['subnet'] = $_POST['subnet'];
201
			$wancfg['gateway'] = $_POST['gateway'];
202
			if (isset($wancfg['ispointtopoint']))
203
				$wancfg['pointtopoint'] = $_POST['pointtopoint'];
204
		} else if ($_POST['type'] == "DHCP") {
205
			$wancfg['ipaddr'] = "dhcp";
206
			$wancfg['dhcphostname'] = $_POST['dhcphostname'];
207
		} else if ($_POST['type'] == "PPPoE") {
208
			$wancfg['ipaddr'] = "pppoe";
209
			$config['pppoe']['username'] = $_POST['username'];
210
			$config['pppoe']['password'] = $_POST['password'];
211
			$config['pppoe']['provider'] = $_POST['provider'];
212
			$config['pppoe']['ondemand'] = $_POST['pppoe_dialondemand'] ? true : false;
213
			$config['pppoe']['timeout'] = $_POST['pppoe_idletimeout'];
214
		} else if ($_POST['type'] == "PPTP") {
215
			$wancfg['ipaddr'] = "pptp";
216
			$config['pptp']['username'] = $_POST['pptp_username'];
217
			$config['pptp']['password'] = $_POST['pptp_password'];
218
			$config['pptp']['local'] = $_POST['pptp_local'];
219
			$config['pptp']['subnet'] = $_POST['pptp_subnet'];
220
			$config['pptp']['remote'] = $_POST['pptp_remote'];
221
			$config['pptp']['ondemand'] = $_POST['pptp_dialondemand'] ? true : false;
222
			$config['pptp']['timeout'] = $_POST['pptp_idletimeout'];
223
		} else if ($_POST['type'] == "BigPond") {
224
			$wancfg['ipaddr'] = "bigpond";
225
			$config['bigpond']['username'] = $_POST['bigpond_username'];
226
			$config['bigpond']['password'] = $_POST['bigpond_password'];
227
			$config['bigpond']['authserver'] = $_POST['bigpond_authserver'];
228
			$config['bigpond']['authdomain'] = $_POST['bigpond_authdomain'];
229
			$config['bigpond']['minheartbeatinterval'] = $_POST['bigpond_minheartbeatinterval'];
230
		}
231

    
232
		$wancfg['blockpriv'] = $_POST['blockpriv'] ? true : false;
233
		$wancfg['spoofmac'] = $_POST['spoofmac'];
234
		$wancfg['mtu'] = $_POST['mtu'];
235

    
236
		write_config();
237

    
238
		$retval = 0;
239
		if (!file_exists($d_sysrebootreqd_path)) {
240
			config_lock();
241
			$retval = interfaces_wan_configure();
242
			config_unlock();
243
		}
244
		$savemsg = get_std_save_message($retval);
245
	}
246
}
247
?>
248
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
249
<html>
250
<head>
251
<title><?=gentitle("Interfaces: WAN");?></title>
252
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
253
<link href="gui.css" rel="stylesheet" type="text/css">
254
<script language="JavaScript">
255
<!--
256
function enable_change(enable_change) {
257
	if (document.iform.pppoe_dialondemand.checked || enable_change) {
258
		document.iform.pppoe_idletimeout.disabled = 0;
259
	} else {
260
		document.iform.pppoe_idletimeout.disabled = 1;
261
	}
262
}
263

    
264
function enable_change_pptp(enable_change_pptp) {
265
	if (document.iform.pptp_dialondemand.checked || enable_change_pptp) {
266
		document.iform.pptp_idletimeout.disabled = 0;
267
		document.iform.pptp_local.disabled = 0;
268
		document.iform.pptp_remote.disabled = 0;
269
	} else {
270
		document.iform.pptp_idletimeout.disabled = 1;
271
	}
272
}
273

    
274
function type_change(enable_change,enable_change_pptp) {
275
	switch (document.iform.type.selectedIndex) {
276
		case 0:
277
			document.iform.username.disabled = 1;
278
			document.iform.password.disabled = 1;
279
			document.iform.provider.disabled = 1;
280
			document.iform.pppoe_dialondemand.disabled = 1;
281
			document.iform.pppoe_idletimeout.disabled = 1;
282
			document.iform.ipaddr.disabled = 0;
283
			document.iform.subnet.disabled = 0;
284
			document.iform.gateway.disabled = 0;
285
			document.iform.pptp_username.disabled = 1;
286
			document.iform.pptp_password.disabled = 1;
287
			document.iform.pptp_local.disabled = 1;
288
			document.iform.pptp_subnet.disabled = 1;
289
			document.iform.pptp_remote.disabled = 1;
290
			document.iform.pptp_dialondemand.disabled = 1;
291
			document.iform.pptp_idletimeout.disabled = 1;
292
			document.iform.bigpond_username.disabled = 1;
293
			document.iform.bigpond_password.disabled = 1;
294
			document.iform.bigpond_authserver.disabled = 1;
295
			document.iform.bigpond_authdomain.disabled = 1;
296
			document.iform.bigpond_minheartbeatinterval.disabled = 1;
297
			document.iform.dhcphostname.disabled = 1;
298
			break;
299
		case 1:
300
			document.iform.username.disabled = 1;
301
			document.iform.password.disabled = 1;
302
			document.iform.provider.disabled = 1;
303
			document.iform.pppoe_dialondemand.disabled = 1;
304
			document.iform.pppoe_idletimeout.disabled = 1;
305
			document.iform.ipaddr.disabled = 1;
306
			document.iform.subnet.disabled = 1;
307
			document.iform.gateway.disabled = 1;
308
			document.iform.pptp_username.disabled = 1;
309
			document.iform.pptp_password.disabled = 1;
310
			document.iform.pptp_local.disabled = 1;
311
			document.iform.pptp_subnet.disabled = 1;
312
			document.iform.pptp_remote.disabled = 1;
313
			document.iform.pptp_dialondemand.disabled = 1;
314
			document.iform.pptp_idletimeout.disabled = 1;
315
			document.iform.bigpond_username.disabled = 1;
316
			document.iform.bigpond_password.disabled = 1;
317
			document.iform.bigpond_authserver.disabled = 1;
318
			document.iform.bigpond_authdomain.disabled = 1;
319
			document.iform.bigpond_minheartbeatinterval.disabled = 1;
320
			document.iform.dhcphostname.disabled = 0;
321
			break;
322
		case 2:
323
			document.iform.username.disabled = 0;
324
			document.iform.password.disabled = 0;
325
			document.iform.provider.disabled = 0;
326
			document.iform.pppoe_dialondemand.disabled = 0;
327
			if (document.iform.pppoe_dialondemand.checked || enable_change) {
328
				document.iform.pppoe_idletimeout.disabled = 0;
329
			} else {
330
				document.iform.pppoe_idletimeout.disabled = 1;
331
			}
332
			document.iform.ipaddr.disabled = 1;
333
			document.iform.subnet.disabled = 1;
334
			document.iform.gateway.disabled = 1;
335
			document.iform.pptp_username.disabled = 1;
336
			document.iform.pptp_password.disabled = 1;
337
			document.iform.pptp_local.disabled = 1;
338
			document.iform.pptp_subnet.disabled = 1;
339
			document.iform.pptp_remote.disabled = 1;
340
			document.iform.pptp_dialondemand.disabled = 1;
341
			document.iform.pptp_idletimeout.disabled = 1;
342
			document.iform.bigpond_username.disabled = 1;
343
			document.iform.bigpond_password.disabled = 1;
344
			document.iform.bigpond_authserver.disabled = 1;
345
			document.iform.bigpond_authdomain.disabled = 1;
346
			document.iform.bigpond_minheartbeatinterval.disabled = 1;
347
			document.iform.dhcphostname.disabled = 1;
348
			break;
349
		case 3:
350
			document.iform.username.disabled = 1;
351
			document.iform.password.disabled = 1;
352
			document.iform.provider.disabled = 1;
353
			document.iform.pppoe_dialondemand.disabled = 1;
354
			document.iform.pppoe_idletimeout.disabled = 1;
355
			document.iform.ipaddr.disabled = 1;
356
			document.iform.subnet.disabled = 1;
357
			document.iform.gateway.disabled = 1;
358
			document.iform.pptp_username.disabled = 0;
359
			document.iform.pptp_password.disabled = 0;
360
			document.iform.pptp_local.disabled = 0;
361
			document.iform.pptp_subnet.disabled = 0;
362
			document.iform.pptp_remote.disabled = 0;
363
			document.iform.pptp_dialondemand.disabled = 0;
364
			if (document.iform.pptp_dialondemand.checked || enable_change_pptp) {
365
				document.iform.pptp_idletimeout.disabled = 0;
366
			} else {
367
				document.iform.pptp_idletimeout.disabled = 1;
368
			}
369
			document.iform.bigpond_username.disabled = 1;
370
			document.iform.bigpond_password.disabled = 1;
371
			document.iform.bigpond_authserver.disabled = 1;
372
			document.iform.bigpond_authdomain.disabled = 1;
373
			document.iform.bigpond_minheartbeatinterval.disabled = 1;
374
			document.iform.dhcphostname.disabled = 1;
375
			break;
376
		case 4:
377
			document.iform.username.disabled = 1;
378
			document.iform.password.disabled = 1;
379
			document.iform.provider.disabled = 1;
380
			document.iform.pppoe_dialondemand.disabled = 1;
381
			document.iform.pppoe_idletimeout.disabled = 1;
382
			document.iform.ipaddr.disabled = 1;
383
			document.iform.subnet.disabled = 1;
384
			document.iform.gateway.disabled = 1;
385
			document.iform.pptp_username.disabled = 1;
386
			document.iform.pptp_password.disabled = 1;
387
			document.iform.pptp_local.disabled = 1;
388
			document.iform.pptp_subnet.disabled = 1;
389
			document.iform.pptp_remote.disabled = 1;
390
			document.iform.pptp_dialondemand.disabled = 1;
391
			document.iform.pptp_idletimeout.disabled = 1;
392
			document.iform.bigpond_username.disabled = 0;
393
			document.iform.bigpond_password.disabled = 0;
394
			document.iform.bigpond_authserver.disabled = 0;
395
			document.iform.bigpond_authdomain.disabled = 0;
396
			document.iform.bigpond_minheartbeatinterval.disabled = 0;
397
			document.iform.dhcphostname.disabled = 1;
398
			break;
399
	}
400
}
401
//-->
402
</script>
403
</head>
404

    
405
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
406
<?php include("fbegin.inc"); ?>
407
<p class="pgtitle">Interfaces: WAN</p>
408
<?php if ($input_errors) print_input_errors($input_errors); ?>
409
<?php if ($savemsg) print_info_box($savemsg); ?>
410
            <form action="interfaces_wan.php" method="post" name="iform" id="iform">
411
              <table width="100%" border="0" cellpadding="6" cellspacing="0">
412
                <tr>
413
                  <td valign="middle"><strong>Type</strong></td>
414
                  <td> <select name="type" class="formfld" id="type" onchange="type_change()">
415
                      <?php $opts = split(" ", "Static DHCP PPPoE PPTP BigPond");
416
				foreach ($opts as $opt): ?>
417
                      <option <?php if ($opt == $pconfig['type']) echo "selected";?>>
418
                      <?=htmlspecialchars($opt);?>
419
                      </option>
420
                      <?php endforeach; ?>
421
                    </select></td>
422
                </tr>
423
                <tr>
424
                  <td colspan="2" valign="top" height="4"></td>
425
                </tr>
426
                <tr>
427
                  <td colspan="2" valign="top" class="listtopic">General configuration</td>
428
                </tr>
429
                <tr>
430
                  <td valign="top" class="vncell">MAC address</td>
431
                  <td class="vtable"> <input name="spoofmac" type="text" class="formfld" id="spoofmac" size="30" value="<?=htmlspecialchars($pconfig['spoofmac']);?>">
432
                    <br>
433
                    This field can be used to modify (&quot;spoof&quot;) the MAC
434
                    address of the WAN interface<br>
435
                    (may be required with some cable connections)<br>
436
                    Enter a MAC address in the following format: xx:xx:xx:xx:xx:xx
437
                    or leave blank</td>
438
                </tr>
439
                <tr>
440
                  <td valign="top" class="vncell">MTU</td>
441
                  <td class="vtable"> <input name="mtu" type="text" class="formfld" id="mtu" size="8" value="<?=htmlspecialchars($pconfig['mtu']);?>">
442
                    <br>
443
                    If you enter a value in this field, then MSS clamping for
444
                    TCP connections to the value entered above minus 40 (TCP/IP
445
                    header size) will be in effect. If you leave this field blank,
446
                    an MTU of 1492 bytes for PPPoE and 1500 bytes for all other
447
                    connection types will be assumed.</td>
448
                </tr>
449
                <tr>
450
                  <td colspan="2" valign="top" height="16"></td>
451
                </tr>
452
                <tr>
453
                  <td colspan="2" valign="top" class="listtopic">Static IP configuration</td>
454
                </tr>
455
                <tr>
456
                  <td width="100" valign="top" class="vncellreq">IP address</td>
457
                  <td class="vtable"> <input name="ipaddr" type="text" class="formfld" id="ipaddr" size="20" value="<?=htmlspecialchars($pconfig['ipaddr']);?>">
458
                    /
459
                    <select name="subnet" class="formfld" id="subnet">
460
                    <?php
461
                      if (isset($wancfg['ispointtopoint']))
462
                      	$snmax = 32;
463
                      else
464
                      	$snmax = 31;
465
                      for ($i = $snmax; $i > 0; $i--): ?>
466
                      <option value="<?=$i;?>" <?php if ($i == $pconfig['subnet']) echo "selected"; ?>>
467
                      <?=$i;?>
468
                      </option>
469
                      <?php endfor; ?>
470
                    </select></td>
471
                </tr><?php if (isset($wancfg['ispointtopoint'])): ?>
472
                <tr>
473
                  <td valign="top" class="vncellreq">Point-to-point IP address </td>
474
                  <td class="vtable">
475
                    <input name="pointtopoint" type="text" class="formfld" id="pointtopoint" size="20" value="<?=htmlspecialchars($pconfig['pointtopoint']);?>">
476
                  </td>
477
                </tr><?php endif; ?>
478
                <tr>
479
                  <td valign="top" class="vncellreq">Gateway</td>
480
                  <td class="vtable"> <input name="gateway" type="text" class="formfld" id="gateway" size="20" value="<?=htmlspecialchars($pconfig['gateway']);?>">
481
                  </td>
482
                </tr>
483
                <tr>
484
                  <td colspan="2" valign="top" height="16"></td>
485
                </tr>
486
                <tr>
487
                  <td colspan="2" valign="top" class="listtopic">Bandwidth Management (Traffic Shaping)</td>
488
                </tr>
489
		<tr>
490
		  <td width="22%" valign="top" class="vncell"><b>Scheduler</b> </td>
491
		  <td width="78%" class="vtable">
492
		    <select id="schedulertype" name="schedulertype">
493
		    <?php
494
			    if($schedulertype == 'priq')
495
				    echo "<option value=\"priq\">Priority based queueing</option>";
496
			    if($schedulertype == 'cbq')
497
				    echo "<option value=\"cbq\">Class based queueing</option>";
498
			    if($schedulertype == 'hfsc')
499
				    echo "<option value=\"hfsc\">Hierarchical Fair Service Curve queueing</option>";
500
		    ?>
501
			    <option value="priq">Priority based queueing</option>
502
			    <option value="cbq">Class based queueing</option>
503
			    <option value="hfsc">Hierarchical Fair Service Curve queueing</option>
504
		    </select>
505
		    <br> <span class="vexpl">Select which type of queueing you would like to use
506
		    </span></td>
507
		</tr>
508
                <tr>
509
                  <td valign="top" class="vncell">Interface Bandwidth Speed</td>
510
                  <td class="vtable"> <input name="bandwidth" type="text" class="formfld" id="bandwidth" size="30" value="<?=htmlspecialchars($pconfig['bandwidth']);?>">
511
			<select name="bandwidthtype">
512
				<option value="<?=htmlspecialchars($pconfig['bandwidthtype']);?>"><?=htmlspecialchars($pconfig['bandwidthtype']);?></option>
513
				<option value="b">bit/s</option>
514
				<option value="Kb">Kilobit/s</option>
515
				<option value="Mb">Megabit/s</option>
516
				<option value="Gb">Gigabit/s</option>
517
			</select>
518
			<br> The bandwidth setting will define the speed of the interface for traffic shaping.
519
		  </td>
520
                </tr>
521
                <tr>
522
                  <td colspan="2" valign="top" class="listtopic">Bandwidth Management (Traffic Shaping)</td>
523
                </tr>
524
                <tr>
525
                  <td colspan="2" valign="top" class="listtopic">DHCP client configuration</td>
526
                </tr>
527
                <tr>
528
                  <td valign="top" class="vncell">Hostname</td>
529
                  <td class="vtable"> <input name="dhcphostname" type="text" class="formfld" id="dhcphostname" size="40" value="<?=htmlspecialchars($pconfig['dhcphostname']);?>">
530
                    <br>
531
                    The value in this field is sent as the DHCP client identifier
532
                    and hostname when requesting a DHCP lease. Some ISPs may require
533
                    this (for client identification).</td>
534
                </tr>
535
                <tr>
536
                  <td colspan="2" valign="top" height="16"></td>
537
                </tr>
538
                <tr>
539
                  <td colspan="2" valign="top" class="listtopic">PPPoE configuration</td>
540
                </tr>
541
                <tr>
542
                  <td valign="top" class="vncellreq">Username</td>
543
                  <td class="vtable"><input name="username" type="text" class="formfld" id="username" size="20" value="<?=htmlspecialchars($pconfig['username']);?>">
544
                  </td>
545
                </tr>
546
                <tr>
547
                  <td valign="top" class="vncellreq">Password</td>
548
                  <td class="vtable"><input name="password" type="text" class="formfld" id="password" size="20" value="<?=htmlspecialchars($pconfig['password']);?>">
549
                  </td>
550
                </tr>
551
                <tr>
552
                  <td valign="top" class="vncell">Service name</td>
553
                  <td class="vtable"><input name="provider" type="text" class="formfld" id="provider" size="20" value="<?=htmlspecialchars($pconfig['provider']);?>">
554
                    <br> <span class="vexpl">Hint: this field can usually be left
555
                    empty</span></td>
556
                </tr>
557
                <tr>
558
                  <td valign="top" class="vncell">Dial on demand</td>
559
                  <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)" >
560
                    <strong>Enable Dial-On-Demand mode</strong><br>
561
		    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>
562
                </tr>
563
                <tr>
564
                  <td valign="top" class="vncell">Idle timeout</td>
565
                  <td class="vtable">
566
                    <input name="pppoe_idletimeout" type="text" class="formfld" id="pppoe_idletimeout" size="8" value="<?=htmlspecialchars($pconfig['pppoe_idletimeout']);?>">
567
                    seconds<br>
568
    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>
569
                </tr>
570
                <tr>
571
                  <td colspan="2" valign="top" height="16"></td>
572
                </tr>
573
                <tr>
574
                  <td colspan="2" valign="top" class="listtopic">PPTP configuration</td>
575
                </tr>
576
                <tr>
577
                  <td valign="top" class="vncellreq">Username</td>
578
                  <td class="vtable"><input name="pptp_username" type="text" class="formfld" id="pptp_username" size="20" value="<?=htmlspecialchars($pconfig['pptp_username']);?>">
579
                  </td>
580
                </tr>
581
                <tr>
582
                  <td valign="top" class="vncellreq">Password</td>
583
                  <td class="vtable"><input name="pptp_password" type="text" class="formfld" id="pptp_password" size="20" value="<?=htmlspecialchars($pconfig['pptp_password']);?>">
584
                  </td>
585
                </tr>
586
                <tr>
587
                  <td width="100" valign="top" class="vncellreq">Local IP address</td>
588
                  <td class="vtable"> <input name="pptp_local" type="text" class="formfld" id="pptp_local" size="20" value="<?=htmlspecialchars($pconfig['pptp_local']);?>">
589
                    /
590
                    <select name="pptp_subnet" class="formfld" id="pptp_subnet">
591
                      <?php for ($i = 31; $i > 0; $i--): ?>
592
                      <option value="<?=$i;?>" <?php if ($i == $pconfig['pptp_subnet']) echo "selected"; ?>>
593
                      <?=$i;?>
594
                      </option>
595
                      <?php endfor; ?>
596
                    </select></td>
597
                </tr>
598
                <tr>
599
                  <td width="100" valign="top" class="vncellreq">Remote IP address</td>
600
                  <td class="vtable"> <input name="pptp_remote" type="text" class="formfld" id="pptp_remote" size="20" value="<?=htmlspecialchars($pconfig['pptp_remote']);?>">
601
                  </td>
602
                </tr>
603
                <tr>
604
                  <td valign="top" class="vncell">Dial on demand</td>
605
                  <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)" >
606
                    <strong>Enable Dial-On-Demand mode</strong><br>
607
		    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>
608
                </tr>
609
                <tr>
610
                  <td valign="top" class="vncell">Idle timeout</td>
611
                  <td class="vtable">
612
                    <input name="pptp_idletimeout" type="text" class="formfld" id="pptp_idletimeout" size="8" value="<?=htmlspecialchars($pconfig['pptp_idletimeout']);?>">
613
                    seconds<br>
614
    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>
615
                </tr>
616
                <tr>
617
                  <td colspan="2" valign="top" height="16"></td>
618
                </tr>
619
                <tr>
620
                  <td colspan="2" valign="top" class="listtopic">BigPond Cable configuration</td>
621
                </tr>
622
                <tr>
623
                  <td valign="top" class="vncellreq">Username</td>
624
                  <td class="vtable"><input name="bigpond_username" type="text" class="formfld" id="bigpond_username" size="20" value="<?=htmlspecialchars($pconfig['bigpond_username']);?>">
625
                  </td>
626
                </tr>
627
                <tr>
628
                  <td valign="top" class="vncellreq">Password</td>
629
                  <td class="vtable"><input name="bigpond_password" type="text" class="formfld" id="bigpond_password" size="20" value="<?=htmlspecialchars($pconfig['bigpond_password']);?>">
630
                  </td>
631
                </tr>
632
                <tr>
633
                  <td valign="top" class="vncell">Authentication server</td>
634
                  <td class="vtable"><input name="bigpond_authserver" type="text" class="formfld" id="bigpond_authserver" size="20" value="<?=htmlspecialchars($pconfig['bigpond_authserver']);?>">
635
                    <br>
636
                  <span class="vexpl">If this field is left empty, the default (&quot;dce-server&quot;) is used. </span></td>
637
                </tr>
638
                <tr>
639
                  <td valign="top" class="vncell">Authentication domain</td>
640
                  <td class="vtable"><input name="bigpond_authdomain" type="text" class="formfld" id="bigpond_authdomain" size="20" value="<?=htmlspecialchars($pconfig['bigpond_authdomain']);?>">
641
                    <br>
642
                  <span class="vexpl">If this field is left empty, the domain name assigned via DHCP will be used.<br>
643
                  <br>
644
                  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>
645
                </tr>
646
                <tr>
647
                  <td valign="top" class="vncell">Min. heartbeat interval</td>
648
                  <td class="vtable">
649
                    <input name="bigpond_minheartbeatinterval" type="text" class="formfld" id="bigpond_minheartbeatinterval" size="8" value="<?=htmlspecialchars($pconfig['bigpond_minheartbeatinterval']);?>">
650
                    seconds<br>
651
    Setting this to a sensible value (e.g. 60 seconds) can protect against DoS attacks. </td>
652
                </tr>
653
                <?php /* Wireless interface? */
654
				if (isset($optcfg['wireless']))
655
					wireless_config_print();
656
				?>
657
                <tr>
658
                  <td height="16" colspan="2" valign="top"></td>
659
                </tr>
660
                <tr>
661
                  <td valign="middle">&nbsp;</td>
662
                  <td class="vtable"> <input name="blockpriv" type="checkbox" id="blockpriv" value="yes" <?php if ($pconfig['blockpriv']) echo "checked"; ?>>
663
                    <strong>Block private networks</strong><br>
664
                    When set, this option blocks traffic from IP addresses that
665
                    are reserved for private<br>
666
                    networks as per RFC 1918 (10/8, 172.16/12, 192.168/16) as
667
                    well as loopback addresses<br>
668
                    (127/8). You should generally leave this option turned on,
669
                    unless your WAN network<br>
670
                    lies in such a private address space, too.</td>
671
                </tr>
672
                <tr>
673
                  <td width="100" valign="top">&nbsp;</td>
674
                  <td> &nbsp;<br> <input name="Submit" type="submit" class="formbtn" value="Save" onClick="enable_change_pptp(true)&&enable_change(true)">
675
                  </td>
676
                </tr>
677
              </table>
678
</form>
679
<script language="JavaScript">
680
<!--
681
type_change();
682
//-->
683
</script>
684
<?php include("fend.inc"); ?>
685
</body>
686
</html>
(46-46/90)