Project

General

Profile

Download (32.9 KB) Statistics
| Branch: | Tag: | Revision:
1
<?php
2
/* $Id$ */
3
/*
4
	interfaces_wan.php
5
        Copyright (C) 2004 Scott Ullrich
6
	All rights reserved.
7
        
8
	originally part of m0n0wall (http://m0n0.ch/wall)
9
	Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
10
	All rights reserved.
11

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

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

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

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

    
34
require("guiconfig.inc");
35

    
36
$wancfg = &$config['interfaces']['wan'];
37
$optcfg = &$config['interfaces']['wan'];
38

    
39
$pconfig['username'] = $config['pppoe']['username'];
40
$pconfig['password'] = $config['pppoe']['password'];
41
$pconfig['provider'] = $config['pppoe']['provider'];
42
$pconfig['pppoe_dialondemand'] = isset($config['pppoe']['ondemand']);
43
$pconfig['pppoe_idletimeout'] = $config['pppoe']['timeout'];
44

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

    
53
$pconfig['disableftpproxy'] = isset($wancfg['disableftpproxy']);
54

    
55
$pconfig['bigpond_username'] = $config['bigpond']['username'];
56
$pconfig['bigpond_password'] = $config['bigpond']['password'];
57
$pconfig['bigpond_authserver'] = $config['bigpond']['authserver'];
58
$pconfig['bigpond_authdomain'] = $config['bigpond']['authdomain'];
59
$pconfig['bigpond_minheartbeatinterval'] = $config['bigpond']['minheartbeatinterval'];
60

    
61
$pconfig['dhcphostname'] = $wancfg['dhcphostname'];
62

    
63
if ($wancfg['ipaddr'] == "dhcp") {
64
	$pconfig['type'] = "DHCP";
65
} else if ($wancfg['ipaddr'] == "pppoe") {
66
	$pconfig['type'] = "PPPoE";
67
} else if ($wancfg['ipaddr'] == "pptp") {
68
	$pconfig['type'] = "PPTP";
69
} else if ($wancfg['ipaddr'] == "bigpond") {
70
	$pconfig['type'] = "BigPond";
71
} else {
72
	$pconfig['type'] = "Static";
73
	$pconfig['ipaddr'] = $wancfg['ipaddr'];
74
	$pconfig['subnet'] = $wancfg['subnet'];
75
	$pconfig['gateway'] = $config['interfaces']['wan']['gateway'];
76
	$pconfig['pointtopoint'] = $wancfg['pointtopoint'];
77
}
78

    
79
$pconfig['blockpriv'] = isset($wancfg['blockpriv']);
80
$pconfig['blockbogons'] = isset($wancfg['blockbogons']);
81
$pconfig['spoofmac'] = $wancfg['spoofmac'];
82
$pconfig['mtu'] = $wancfg['mtu'];
83

    
84
/* Wireless interface? */
85
if (isset($wancfg['wireless'])) {
86
	require("interfaces_wlan.inc");
87
	wireless_config_init();
88
}
89

    
90
if ($_POST) {
91

    
92
	unset($input_errors);
93
	$pconfig = $_POST;
94

    
95
	if($_POST['gateway']) {
96
		/* enumerate slbd gateways and make sure we are not creating a route loop */
97
		if(is_array($config['load_balancer']['lbpool'])) {
98
			foreach($config['load_balancer']['lbpool'] as $lbpool) {
99
				if($lbpool['type'] == "gateway") {
100
				    foreach ((array) $lbpool['servers'] as $server) {
101
			            $svr = split("\|", $server);
102
			            if($svr[1] == $_POST['gateway']) 
103
			            		$input_errors[] = "Cannot change {$svr[1]} gateway.  It is currently referenced by the load balancer pools.";
104
					}
105
				}
106
			}	
107
		}
108
	}
109

    
110
	/* input validation */
111
	if ($_POST['type'] == "Static") {
112
		$reqdfields = explode(" ", "ipaddr subnet gateway");
113
		$reqdfieldsn = explode(",", "IP address,Subnet bit count,Gateway");
114
		do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
115
	} else if ($_POST['type'] == "PPPoE") {
116
		if ($_POST['pppoe_dialondemand']) {
117
			$reqdfields = explode(" ", "username password pppoe_dialondemand pppoe_idletimeout");
118
			$reqdfieldsn = explode(",", "PPPoE username,PPPoE password,Dial on demand,Idle timeout value");
119
		} else {
120
			$reqdfields = explode(" ", "username password");
121
			$reqdfieldsn = explode(",", "PPPoE username,PPPoE password");
122
		}
123
		do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
124
	} else if ($_POST['type'] == "PPTP") {
125
		if ($_POST['pptp_dialondemand']) {
126
			$reqdfields = explode(" ", "pptp_username pptp_password pptp_local pptp_subnet pptp_remote pptp_dialondemand pptp_idletimeout");
127
			$reqdfieldsn = explode(",", "PPTP username,PPTP password,PPTP local IP address,PPTP subnet,PPTP remote IP address,Dial on demand,Idle timeout value");
128
		} else {
129
			$reqdfields = explode(" ", "pptp_username pptp_password pptp_local pptp_subnet pptp_remote");
130
			$reqdfieldsn = explode(",", "PPTP username,PPTP password,PPTP local IP address,PPTP subnet,PPTP remote IP address");
131
		}
132
		do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
133
	} else if ($_POST['type'] == "BigPond") {
134
		$reqdfields = explode(" ", "bigpond_username bigpond_password");
135
		$reqdfieldsn = explode(",", "BigPond username,BigPond password");
136
		do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
137
	}
138

    
139
        /* normalize MAC addresses - lowercase and convert Windows-ized hyphenated MACs to colon delimited */
140
        $_POST['spoofmac'] = strtolower(str_replace("-", ":", $_POST['spoofmac']));
141

    
142
	if (($_POST['ipaddr'] && !is_ipaddr($_POST['ipaddr']))) {
143
		$input_errors[] = "A valid IP address must be specified.";
144
	}
145
	if (($_POST['subnet'] && !is_numeric($_POST['subnet']))) {
146
		$input_errors[] = "A valid subnet bit count must be specified.";
147
	}
148
	if (($_POST['gateway'] && !is_ipaddr($_POST['gateway']))) {
149
		$input_errors[] = "A valid gateway must be specified.";
150
	}
151
	if (($_POST['pointtopoint'] && !is_ipaddr($_POST['pointtopoint']))) {
152
		$input_errors[] = "A valid point-to-point IP address must be specified.";
153
	}
154
	if (($_POST['provider'] && !is_domain($_POST['provider']))) {
155
		$input_errors[] = "The service name contains invalid characters.";
156
	}
157
	if (($_POST['pppoe_idletimeout'] != "") && !is_numericint($_POST['pppoe_idletimeout'])) {
158
		$input_errors[] = "The idle timeout value must be an integer.";
159
	}
160
	if (($_POST['pptp_local'] && !is_ipaddr($_POST['pptp_local']))) {
161
		$input_errors[] = "A valid PPTP local IP address must be specified.";
162
	}
163
	if (($_POST['pptp_subnet'] && !is_numeric($_POST['pptp_subnet']))) {
164
		$input_errors[] = "A valid PPTP subnet bit count must be specified.";
165
	}
166
	if (($_POST['pptp_remote'] && !is_ipaddr($_POST['pptp_remote']))) {
167
		$input_errors[] = "A valid PPTP remote IP address must be specified.";
168
	}
169
	if (($_POST['pptp_idletimeout'] != "") && !is_numericint($_POST['pptp_idletimeout'])) {
170
		$input_errors[] = "The idle timeout value must be an integer.";
171
	}
172
	if (($_POST['bigpond_authserver'] && !is_domain($_POST['bigpond_authserver']))) {
173
		$input_errors[] = "The authentication server name contains invalid characters.";
174
	}
175
	if (($_POST['bigpond_authdomain'] && !is_domain($_POST['bigpond_authdomain']))) {
176
		$input_errors[] = "The authentication domain name contains invalid characters.";
177
	}
178
	if ($_POST['bigpond_minheartbeatinterval'] && !is_numericint($_POST['bigpond_minheartbeatinterval'])) {
179
		$input_errors[] = "The minimum heartbeat interval must be an integer.";
180
	}
181
	if (($_POST['spoofmac'] && !is_macaddr($_POST['spoofmac']))) {
182
		$input_errors[] = "A valid MAC address must be specified.";
183
	}
184
	if ($_POST['mtu'] && (($_POST['mtu'] < 576) || ($_POST['mtu'] > 1500))) {
185
		$input_errors[] = "The MTU must be between 576 and 1500 bytes.";
186
	}
187

    
188
	/* Wireless interface? */
189
	if (isset($wancfg['wireless'])) {
190
		$wi_input_errors = wireless_config_post();
191
		if ($wi_input_errors) {
192
			$input_errors = array_merge($input_errors, $wi_input_errors);
193
		}
194
	}
195

    
196
	if (!$input_errors) {
197

    
198
		$bridge = discover_bridge($wancfg['if'], filter_translate_type_to_real_interface($wancfg['bridge']));
199
		if($bridge <> "-1") {
200
			destroy_bridge($bridge);
201
		}
202
	
203
		unset($wancfg['ipaddr']);
204
		unset($wancfg['subnet']);
205
		unset($config['interfaces']['wan']['gateway']);
206
		unset($wancfg['pointtopoint']);
207
		unset($wancfg['dhcphostname']);
208
		unset($config['pppoe']['username']);
209
		unset($config['pppoe']['password']);
210
		unset($config['pppoe']['provider']);
211
		unset($config['pppoe']['ondemand']);
212
		unset($config['pppoe']['timeout']);
213
		unset($config['pptp']['username']);
214
		unset($config['pptp']['password']);
215
		unset($config['pptp']['local']);
216
		unset($config['pptp']['subnet']);
217
		unset($config['pptp']['remote']);
218
		unset($config['pptp']['ondemand']);
219
		unset($config['pptp']['timeout']);
220
		unset($config['bigpond']['username']);
221
		unset($config['bigpond']['password']);
222
		unset($config['bigpond']['authserver']);
223
		unset($config['bigpond']['authdomain']);
224
		unset($config['bigpond']['minheartbeatinterval']);
225
		unset($wancfg['disableftpproxy']);
226
		
227
		/* per interface pftpx helper */
228
		if($_POST['disableftpproxy'] == "yes") {
229
			$wancfg['disableftpproxy'] = true;
230
			system_start_ftp_helpers();
231
		} else {			
232
			system_start_ftp_helpers();
233
		}
234

    
235
		if ($_POST['type'] == "Static") {
236
			$wancfg['ipaddr'] = $_POST['ipaddr'];
237
			$wancfg['subnet'] = $_POST['subnet'];
238
			$config['interfaces']['wan']['gateway'] = $_POST['gateway'];
239
			if (isset($wancfg['ispointtopoint']))
240
				$wancfg['pointtopoint'] = $_POST['pointtopoint'];
241
		} else if ($_POST['type'] == "DHCP") {
242
			$wancfg['ipaddr'] = "dhcp";
243
			$wancfg['dhcphostname'] = $_POST['dhcphostname'];
244
		} else if ($_POST['type'] == "PPPoE") {
245
			$wancfg['ipaddr'] = "pppoe";
246
			$config['pppoe']['username'] = $_POST['username'];
247
			$config['pppoe']['password'] = $_POST['password'];
248
			$config['pppoe']['provider'] = $_POST['provider'];
249
			$config['pppoe']['ondemand'] = $_POST['pppoe_dialondemand'] ? true : false;
250
			$config['pppoe']['timeout'] = $_POST['pppoe_idletimeout'];
251
		} else if ($_POST['type'] == "PPTP") {
252
			$wancfg['ipaddr'] = "pptp";
253
			$config['pptp']['username'] = $_POST['pptp_username'];
254
			$config['pptp']['password'] = $_POST['pptp_password'];
255
			$config['pptp']['local'] = $_POST['pptp_local'];
256
			$config['pptp']['subnet'] = $_POST['pptp_subnet'];
257
			$config['pptp']['remote'] = $_POST['pptp_remote'];
258
			$config['pptp']['ondemand'] = $_POST['pptp_dialondemand'] ? true : false;
259
			$config['pptp']['timeout'] = $_POST['pptp_idletimeout'];
260
		} else if ($_POST['type'] == "BigPond") {
261
			$wancfg['ipaddr'] = "bigpond";
262
			$config['bigpond']['username'] = $_POST['bigpond_username'];
263
			$config['bigpond']['password'] = $_POST['bigpond_password'];
264
			$config['bigpond']['authserver'] = $_POST['bigpond_authserver'];
265
			$config['bigpond']['authdomain'] = $_POST['bigpond_authdomain'];
266
			$config['bigpond']['minheartbeatinterval'] = $_POST['bigpond_minheartbeatinterval'];
267
		}
268

    
269
		if($_POST['blockpriv'] == "yes")
270
			$wancfg['blockpriv'] = true;
271
		else
272
			unset($wancfg['blockpriv']);
273
		
274
		if($_POST['blockbogons'] == "yes")
275
			$wancfg['blockbogons'] = true;
276
		else
277
			unset($wancfg['blockbogons']);
278
		
279
		$wancfg['spoofmac'] = $_POST['spoofmac'];
280
		$wancfg['mtu'] = $_POST['mtu'];
281

    
282
		write_config();
283

    
284
		$retval = 0;
285

    
286
		$savemsg = get_std_save_message($retval);
287
	}
288
}
289

    
290
$pgtitle = "Interfaces: WAN";
291
include("head.inc");
292

    
293
?>
294

    
295
<script language="JavaScript">
296
<!--
297
function enable_change(enable_change) {
298
	if (document.iform.pppoe_dialondemand.checked || enable_change) {
299
		document.iform.pppoe_idletimeout.disabled = 0;
300
	} else {
301
		document.iform.pppoe_idletimeout.disabled = 1;
302
	}
303
}
304

    
305
function enable_change_pptp(enable_change_pptp) {
306
	if (document.iform.pptp_dialondemand.checked || enable_change_pptp) {
307
		document.iform.pptp_idletimeout.disabled = 0;
308
		document.iform.pptp_local.disabled = 0;
309
		document.iform.pptp_remote.disabled = 0;
310
	} else {
311
		document.iform.pptp_idletimeout.disabled = 1;
312
	}
313
}
314

    
315
function type_change(enable_change,enable_change_pptp) {
316
	switch (document.iform.type.selectedIndex) {
317
		case 0:
318
			document.iform.username.disabled = 1;
319
			document.iform.password.disabled = 1;
320
			document.iform.provider.disabled = 1;
321
			document.iform.pppoe_dialondemand.disabled = 1;
322
			document.iform.pppoe_idletimeout.disabled = 1;
323
			document.iform.ipaddr.disabled = 0;
324
			document.iform.subnet.disabled = 0;
325
			document.iform.gateway.disabled = 0;
326
			document.iform.pptp_username.disabled = 1;
327
			document.iform.pptp_password.disabled = 1;
328
			document.iform.pptp_local.disabled = 1;
329
			document.iform.pptp_subnet.disabled = 1;
330
			document.iform.pptp_remote.disabled = 1;
331
			document.iform.pptp_dialondemand.disabled = 1;
332
			document.iform.pptp_idletimeout.disabled = 1;
333
			document.iform.bigpond_username.disabled = 1;
334
			document.iform.bigpond_password.disabled = 1;
335
			document.iform.bigpond_authserver.disabled = 1;
336
			document.iform.bigpond_authdomain.disabled = 1;
337
			document.iform.bigpond_minheartbeatinterval.disabled = 1;
338
			document.iform.dhcphostname.disabled = 1;
339
			break;
340
		case 1:
341
			document.iform.username.disabled = 1;
342
			document.iform.password.disabled = 1;
343
			document.iform.provider.disabled = 1;
344
			document.iform.pppoe_dialondemand.disabled = 1;
345
			document.iform.pppoe_idletimeout.disabled = 1;
346
			document.iform.ipaddr.disabled = 1;
347
			document.iform.subnet.disabled = 1;
348
			document.iform.gateway.disabled = 1;
349
			document.iform.pptp_username.disabled = 1;
350
			document.iform.pptp_password.disabled = 1;
351
			document.iform.pptp_local.disabled = 1;
352
			document.iform.pptp_subnet.disabled = 1;
353
			document.iform.pptp_remote.disabled = 1;
354
			document.iform.pptp_dialondemand.disabled = 1;
355
			document.iform.pptp_idletimeout.disabled = 1;
356
			document.iform.bigpond_username.disabled = 1;
357
			document.iform.bigpond_password.disabled = 1;
358
			document.iform.bigpond_authserver.disabled = 1;
359
			document.iform.bigpond_authdomain.disabled = 1;
360
			document.iform.bigpond_minheartbeatinterval.disabled = 1;
361
			document.iform.dhcphostname.disabled = 0;
362
			break;
363
		case 2:
364
			document.iform.username.disabled = 0;
365
			document.iform.password.disabled = 0;
366
			document.iform.provider.disabled = 0;
367
			document.iform.pppoe_dialondemand.disabled = 0;
368
			if (document.iform.pppoe_dialondemand.checked || enable_change) {
369
				document.iform.pppoe_idletimeout.disabled = 0;
370
			} else {
371
				document.iform.pppoe_idletimeout.disabled = 1;
372
			}
373
			document.iform.ipaddr.disabled = 1;
374
			document.iform.subnet.disabled = 1;
375
			document.iform.gateway.disabled = 1;
376
			document.iform.pptp_username.disabled = 1;
377
			document.iform.pptp_password.disabled = 1;
378
			document.iform.pptp_local.disabled = 1;
379
			document.iform.pptp_subnet.disabled = 1;
380
			document.iform.pptp_remote.disabled = 1;
381
			document.iform.pptp_dialondemand.disabled = 1;
382
			document.iform.pptp_idletimeout.disabled = 1;
383
			document.iform.bigpond_username.disabled = 1;
384
			document.iform.bigpond_password.disabled = 1;
385
			document.iform.bigpond_authserver.disabled = 1;
386
			document.iform.bigpond_authdomain.disabled = 1;
387
			document.iform.bigpond_minheartbeatinterval.disabled = 1;
388
			document.iform.dhcphostname.disabled = 1;
389
			break;
390
		case 3:
391
			document.iform.username.disabled = 1;
392
			document.iform.password.disabled = 1;
393
			document.iform.provider.disabled = 1;
394
			document.iform.pppoe_dialondemand.disabled = 1;
395
			document.iform.pppoe_idletimeout.disabled = 1;
396
			document.iform.ipaddr.disabled = 1;
397
			document.iform.subnet.disabled = 1;
398
			document.iform.gateway.disabled = 1;
399
			document.iform.pptp_username.disabled = 0;
400
			document.iform.pptp_password.disabled = 0;
401
			document.iform.pptp_local.disabled = 0;
402
			document.iform.pptp_subnet.disabled = 0;
403
			document.iform.pptp_remote.disabled = 0;
404
			document.iform.pptp_dialondemand.disabled = 0;
405
			if (document.iform.pptp_dialondemand.checked || enable_change_pptp) {
406
				document.iform.pptp_idletimeout.disabled = 0;
407
			} else {
408
				document.iform.pptp_idletimeout.disabled = 1;
409
			}
410
			document.iform.bigpond_username.disabled = 1;
411
			document.iform.bigpond_password.disabled = 1;
412
			document.iform.bigpond_authserver.disabled = 1;
413
			document.iform.bigpond_authdomain.disabled = 1;
414
			document.iform.bigpond_minheartbeatinterval.disabled = 1;
415
			document.iform.dhcphostname.disabled = 1;
416
			break;
417
		case 4:
418
			document.iform.username.disabled = 1;
419
			document.iform.password.disabled = 1;
420
			document.iform.provider.disabled = 1;
421
			document.iform.pppoe_dialondemand.disabled = 1;
422
			document.iform.pppoe_idletimeout.disabled = 1;
423
			document.iform.ipaddr.disabled = 1;
424
			document.iform.subnet.disabled = 1;
425
			document.iform.gateway.disabled = 1;
426
			document.iform.pptp_username.disabled = 1;
427
			document.iform.pptp_password.disabled = 1;
428
			document.iform.pptp_local.disabled = 1;
429
			document.iform.pptp_subnet.disabled = 1;
430
			document.iform.pptp_remote.disabled = 1;
431
			document.iform.pptp_dialondemand.disabled = 1;
432
			document.iform.pptp_idletimeout.disabled = 1;
433
			document.iform.bigpond_username.disabled = 0;
434
			document.iform.bigpond_password.disabled = 0;
435
			document.iform.bigpond_authserver.disabled = 0;
436
			document.iform.bigpond_authdomain.disabled = 0;
437
			document.iform.bigpond_minheartbeatinterval.disabled = 0;
438
			document.iform.dhcphostname.disabled = 1;
439
			break;
440
	}
441
}
442
//-->
443
</script>
444

    
445
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
446
<?php include("fbegin.inc"); ?>
447
<p class="pgtitle"><?=$pgtitle?></p>
448
<?php if ($input_errors) print_input_errors($input_errors); ?>
449
<?php if ($savemsg) print_info_box($savemsg); ?>
450
            <form action="interfaces_wan.php" method="post" name="iform" id="iform">
451
              <table width="100%" border="0" cellpadding="6" cellspacing="0">
452
                <tr>
453
                  <td colspan="2" valign="top" class="listtopic">General configuration</td>
454
                </tr>
455
                <tr>
456
                  <td valign="middle" class="vncell"><strong>Type</strong></td>
457
                  <td class="vtable"> <select name="type" class="formfld" id="type" onchange="type_change()">
458
                      <?php $opts = split(" ", "Static DHCP PPPoE PPTP BigPond");
459
				foreach ($opts as $opt): ?>
460
                      <option <?php if ($opt == $pconfig['type']) echo "selected";?>>
461
                      <?=htmlspecialchars($opt);?>
462
                      </option>
463
                      <?php endforeach; ?>
464
                    </select></td>
465
                </tr>
466
                <tr>
467
                  <td valign="top" class="vncell">MAC address</td>
468
                  <td class="vtable"> <input name="spoofmac" type="text" class="formfld" id="spoofmac" size="30" value="<?=htmlspecialchars($pconfig['spoofmac']);?>">
469
		    <?php
470
			$ip = getenv('REMOTE_ADDR');
471
			$mac = `/usr/sbin/arp -an | grep {$ip} | cut -d" " -f4`;
472
			$mac = str_replace("\n","",$mac);
473
		    ?>
474
		    <a OnClick="document.forms[0].spoofmac.value='<?=$mac?>';" href="#">Copy my MAC address</a>   
475
		    <br>
476
                    This field can be used to modify (&quot;spoof&quot;) the MAC
477
                    address of the WAN interface<br>
478
                    (may be required with some cable connections)<br>
479
                    Enter a MAC address in the following format: xx:xx:xx:xx:xx:xx
480
                    or leave blank</td>
481
                </tr>
482
                <tr>
483
                  <td valign="top" class="vncell">MTU</td>
484
                  <td class="vtable"> <input name="mtu" type="text" class="formfld" id="mtu" size="8" value="<?=htmlspecialchars($pconfig['mtu']);?>">
485
                    <br>
486
                    If you enter a value in this field, then MSS clamping for
487
                    TCP connections to the value entered above minus 40 (TCP/IP
488
                    header size) will be in effect. If you leave this field blank,
489
                    an MTU of 1492 bytes for PPPoE and 1500 bytes for all other
490
                    connection types will be assumed.</td>
491
                </tr>
492
                <tr>
493
                  <td colspan="2" valign="top" height="16"></td>
494
                </tr>
495
                <tr>
496
                  <td colspan="2" valign="top" class="listtopic">Static IP configuration</td>
497
                </tr>
498
                <tr>
499
                  <td width="100" valign="top" class="vncellreq">IP address</td>
500
                  <td class="vtable"> <input name="ipaddr" type="text" class="formfld" id="ipaddr" size="20" value="<?=htmlspecialchars($pconfig['ipaddr']);?>">
501
                    /
502
                    <select name="subnet" class="formfld" id="subnet">
503
			<?php
504
			for ($i = 32; $i > 0; $i--) {
505
				if($i <> 31) {
506
					echo "<option value=\"{$i}\" ";
507
					if ($i == $pconfig['subnet']) echo "selected";
508
					echo ">" . $i . "</option>";
509
				}
510
			}
511
			?>
512
                    </select></td>
513
                </tr><?php if (isset($wancfg['ispointtopoint'])): ?>
514
                <tr>
515
                  <td valign="top" class="vncellreq">Point-to-point IP address </td>
516
                  <td class="vtable">
517
                    <input name="pointtopoint" type="text" class="formfld" id="pointtopoint" size="20" value="<?=htmlspecialchars($pconfig['pointtopoint']);?>">
518
                  </td>
519
                </tr><?php endif; ?>
520
                <tr>
521
                  <td valign="top" class="vncellreq">Gateway</td>
522
                  <td class="vtable"> <input name="gateway" type="text" class="formfld" id="gateway" size="20" value="<?=htmlspecialchars($pconfig['gateway']);?>">
523
                  </td>
524
                </tr>
525
                <tr>
526
                  <td colspan="2" valign="top" height="16"></td>
527
                </tr>
528
                <tr>
529
                  <td colspan="2" valign="top" class="listtopic">DHCP client configuration</td>
530
                </tr>
531
                <tr>
532
                  <td valign="top" class="vncell">Hostname</td>
533
                  <td class="vtable"> <input name="dhcphostname" type="text" class="formfld" id="dhcphostname" size="40" value="<?=htmlspecialchars($pconfig['dhcphostname']);?>">
534
                    <br>
535
                    The value in this field is sent as the DHCP client identifier
536
                    and hostname when requesting a DHCP lease. Some ISPs may require
537
                    this (for client identification).</td>
538
                </tr>
539
                <tr>
540
                  <td colspan="2" valign="top" height="16"></td>
541
                </tr>
542
                <tr>
543
                  <td colspan="2" valign="top" class="listtopic">PPPoE configuration</td>
544
                </tr>
545
                <tr>
546
                  <td valign="top" class="vncellreq">Username</td>
547
                  <td class="vtable"><input name="username" type="text" class="formfld" id="username" size="20" value="<?=htmlspecialchars($pconfig['username']);?>">
548
                  </td>
549
                </tr>
550
                <tr>
551
                  <td valign="top" class="vncellreq">Password</td>
552
                  <td class="vtable"><input name="password" type="text" class="formfld" id="password" size="20" value="<?=htmlspecialchars($pconfig['password']);?>">
553
                  </td>
554
                </tr>
555
                <tr>
556
                  <td valign="top" class="vncell">Service name</td>
557
                  <td class="vtable"><input name="provider" type="text" class="formfld" id="provider" size="20" value="<?=htmlspecialchars($pconfig['provider']);?>">
558
                    <br> <span class="vexpl">Hint: this field can usually be left
559
                    empty</span></td>
560
                </tr>
561
                <tr>
562
                  <td valign="top" class="vncell">Dial on demand</td>
563
                  <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)" >
564
                    <strong>Enable Dial-On-Demand mode</strong><br>
565
		    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>
566
                </tr>
567
                <tr>
568
                  <td valign="top" class="vncell">Idle timeout</td>
569
                  <td class="vtable">
570
                    <input name="pppoe_idletimeout" type="text" class="formfld" id="pppoe_idletimeout" size="8" value="<?=htmlspecialchars($pconfig['pppoe_idletimeout']);?>"> seconds<br>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>
571
                </tr>
572
                <tr>
573
                  <td colspan="2" valign="top" height="16"></td>
574
                </tr>
575
                <tr>
576
                  <td colspan="2" valign="top" class="listtopic">PPTP configuration</td>
577
                </tr>
578
                <tr>
579
                  <td valign="top" class="vncellreq">Username</td>
580
                  <td class="vtable"><input name="pptp_username" type="text" class="formfld" id="pptp_username" size="20" value="<?=htmlspecialchars($pconfig['pptp_username']);?>">
581
                  </td>
582
                </tr>
583
                <tr>
584
                  <td valign="top" class="vncellreq">Password</td>
585
                  <td class="vtable"><input name="pptp_password" type="text" class="formfld" id="pptp_password" size="20" value="<?=htmlspecialchars($pconfig['pptp_password']);?>">
586
                  </td>
587
                </tr>
588
                <tr>
589
                  <td width="100" valign="top" class="vncellreq">Local IP address</td>
590
                  <td class="vtable"> <input name="pptp_local" type="text" class="formfld" id="pptp_local" size="20" value="<?=htmlspecialchars($pconfig['pptp_local']);?>">
591
                    /
592
                    <select name="pptp_subnet" class="formfld" id="pptp_subnet">
593
                      <?php for ($i = 31; $i > 0; $i--): ?>
594
                      <option value="<?=$i;?>" <?php if ($i == $pconfig['pptp_subnet']) echo "selected"; ?>>
595
                      <?=$i;?>
596
                      </option>
597
                      <?php endfor; ?>
598
                    </select></td>
599
                </tr>
600
                <tr>
601
                  <td width="100" valign="top" class="vncellreq">Remote IP address</td>
602
                  <td class="vtable"> <input name="pptp_remote" type="text" class="formfld" id="pptp_remote" size="20" value="<?=htmlspecialchars($pconfig['pptp_remote']);?>">
603
                  </td>
604
                </tr>
605
                <tr>
606
                  <td valign="top" class="vncell">Dial on demand</td>
607
                  <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)" >
608
                    <strong>Enable Dial-On-Demand mode</strong><br>
609
		    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>
610
                </tr>
611
                <tr>
612
                  <td valign="top" class="vncell">Idle timeout</td>
613
                  <td class="vtable">
614
                    <input name="pptp_idletimeout" type="text" class="formfld" id="pptp_idletimeout" size="8" value="<?=htmlspecialchars($pconfig['pptp_idletimeout']);?>"> seconds<br>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']);?>">seconds<br>Setting this to a sensible value (e.g. 60 seconds) can protect against DoS attacks. </td>
650
                </tr>
651
                <tr>
652
                  <td colspan="2" valign="top" height="16"></td>
653
                </tr>
654
                <tr>
655
                  <td colspan="2" valign="top" class="listtopic">FTP Helper</td>
656
                </tr>		
657
		<tr>
658
			<td width="22%" valign="top" class="vncell">FTP Helper</td>
659
			<td width="78%" class="vtable">
660
				<input name="disableftpproxy" type="checkbox" id="disableftpproxy" value="yes" <?php if ($pconfig['disableftpproxy']) echo "checked"; ?> onclick="enable_change(false)" />
661
				<strong>Disable the userland FTP-Proxy application</strong>
662
				<br />
663
			</td>
664
		</tr>
665
		        <?php
666
				/* Wireless interface? */
667
				if (isset($wancfg['wireless']))
668
					wireless_config_print();
669
			?>
670
                <tr>
671
                  <td height="16" colspan="2" valign="top"></td>
672
                </tr>
673
                <tr>
674
                  <td valign="middle">&nbsp;</td>
675
                  <td class="vtable"><a name="rfc1918"></a> <input name="blockpriv" type="checkbox" id="blockpriv" value="yes" <?php if ($pconfig['blockpriv']) echo "checked"; ?>>
676
                    <strong>Block private networks</strong><br>
677
                    When set, this option blocks traffic from IP addresses that
678
                    are reserved for private<br>
679
                    networks as per RFC 1918 (10/8, 172.16/12, 192.168/16) as
680
                    well as loopback addresses<br>
681
                    (127/8). You should generally leave this option turned on,
682
                    unless your WAN network<br>
683
                    lies in such a private address space, too.</td>
684
                </tr>
685
                <tr>
686
                  <td valign="middle">&nbsp;</td>
687
                  <td class="vtable"> <input name="blockbogons" type="checkbox" id="blockbogons" value="yes" <?php if ($pconfig['blockbogons']) echo "checked"; ?>>
688
                    <strong>Block bogon networks</strong><br>
689
                    When set, this option blocks traffic from IP addresses that
690
                    are reserved (but not RFC 1918) or not yet assigned by IANA.<br>
691
                    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>
692
		</tr>
693
	
694
                <tr>
695
                  <td width="100" valign="top">&nbsp;</td>
696
                  <td> &nbsp;<br> <input name="Submit" type="submit" class="formbtn" value="Save" onClick="enable_change_pptp(true)&&enable_change(true)">
697
                  </td>
698
                </tr>
699
              </table>
700
</form>
701
<script language="JavaScript">
702
<!--
703
type_change();
704
//-->
705
</script>
706
<?php include("fend.inc"); ?>
707
</body>
708
</html>
709

    
710

    
711
<?php
712

    
713
if ($_POST) {
714

    
715
	if (!$input_errors) {
716
		
717
		ob_flush();
718
		flush();
719
		sleep(1);		
720
		
721
		interfaces_wan_configure();
722
		
723
		reset_carp();
724
		
725
		/* sync filter configuration */
726
		filter_configure();
727
	}
728
}
729

    
730
?>
(63-63/164)