Project

General

Profile

Download (32.5 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

    
36
$pconfig['username'] = $config['pppoe']['username'];
37
$pconfig['password'] = $config['pppoe']['password'];
38
$pconfig['provider'] = $config['pppoe']['provider'];
39
$pconfig['pppoe_dialondemand'] = isset($config['pppoe']['ondemand']);
40
$pconfig['pppoe_idletimeout'] = $config['pppoe']['timeout'];
41

    
42
$pconfig['pptp_username'] = $config['pptp']['username'];
43
$pconfig['pptp_password'] = $config['pptp']['password'];
44
$pconfig['pptp_local'] = $config['pptp']['local'];
45
$pconfig['pptp_subnet'] = $config['pptp']['subnet'];
46
$pconfig['pptp_remote'] = $config['pptp']['remote'];
47
$pconfig['pptp_dialondemand'] = isset($config['pptp']['ondemand']);
48
$pconfig['pptp_idletimeout'] = $config['pptp']['timeout'];
49

    
50
$pconfig['bigpond_username'] = $config['bigpond']['username'];
51
$pconfig['bigpond_password'] = $config['bigpond']['password'];
52
$pconfig['bigpond_authserver'] = $config['bigpond']['authserver'];
53
$pconfig['bigpond_authdomain'] = $config['bigpond']['authdomain'];
54
$pconfig['bigpond_minheartbeatinterval'] = $config['bigpond']['minheartbeatinterval'];
55

    
56
$pconfig['dhcphostname'] = $wancfg['dhcphostname'];
57

    
58
if ($wancfg['ipaddr'] == "dhcp") {
59
	$pconfig['type'] = "DHCP";
60
} else if ($wancfg['ipaddr'] == "pppoe") {
61
	$pconfig['type'] = "PPPoE";
62
} else if ($wancfg['ipaddr'] == "pptp") {
63
	$pconfig['type'] = "PPTP";
64
} else if ($wancfg['ipaddr'] == "bigpond") {
65
	$pconfig['type'] = "BigPond";
66
} else {
67
	$pconfig['type'] = "Static";
68
	$pconfig['ipaddr'] = $wancfg['ipaddr'];
69
	$pconfig['subnet'] = $wancfg['subnet'];
70
	$pconfig['gateway'] = $config['system']['gateway'];
71
	$pconfig['pointtopoint'] = $wancfg['pointtopoint'];
72
}
73

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

    
79
/* Wireless interface? */
80
if (isset($wancfg['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($wancfg['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($config['system']['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
			$config['system']['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['blockbogons'] = $_POST['blockbogons'] ? true : false;
237
		$wancfg['spoofmac'] = $_POST['spoofmac'];
238
		$wancfg['mtu'] = $_POST['mtu'];
239

    
240
		write_config();
241

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

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

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

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