Project

General

Profile

Download (31.7 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['bandwidth'] = $_POST['bandwidth'];
233
		$wancfg['bandwidthtype'] = $_POST['bandwidthtype'];
234

    
235
		$wancfg['blockpriv'] = $_POST['blockpriv'] ? true : false;
236
		$wancfg['spoofmac'] = $_POST['spoofmac'];
237
		$wancfg['mtu'] = $_POST['mtu'];
238

    
239
		write_config();
240

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

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

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

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