Project

General

Profile

Download (46.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
define("CRON_MONTHLY_PATTERN", "0 0 1 * *");
35
define("CRON_WEEKLY_PATTERN", "0 0 * * 0");
36
define("CRON_DAILY_PATTERN", "0 0 * * *");
37
define("CRON_HOURLY_PATTERN", "0 * * * *");
38
define("CRON_PPPOE_CMD_FILE", "/etc/pppoerestart");
39
define("CRON_PPPOE_CMD", "#!/bin/sh\necho '<?php require(\"interfaces.inc\"); interfaces_wan_pppoe_restart(); services_dyndns_reset(); ?>' | /usr/local/bin/php -q");
40

    
41
function getMPDCRONSettings() {
42
  global $config;
43

    
44
  if (is_array($config['cron']['item'])) {
45
    for ($i = 0; $i < count($config['cron']['item']); $i++) {
46
      $item =& $config['cron']['item'][$i];
47

    
48
      if (strpos($item['command'], CRON_PPPOE_CMD_FILE) !== false) {
49
        return array("ID" => $i, "ITEM" => $item);
50
      }
51
    }
52
  }
53

    
54
  return NULL;
55
}
56

    
57
function getMPDResetTimeFromConfig() {
58
  $itemhash = getMPDCRONSettings();
59
  $cronitem = $itemhash['ITEM'];
60

    
61
  if (isset($cronitem)) {
62

    
63
    return "{$cronitem['minute']} {$cronitem['hour']} {$cronitem['mday']} {$cronitem['month']} {$cronitem['wday']}";
64
  } else {
65
    return NULL;
66
  }
67
}
68

    
69
require("guiconfig.inc");
70

    
71
$wancfg = &$config['interfaces']['wan'];
72
$optcfg = &$config['interfaces']['wan'];
73

    
74
$pconfig['username'] = $config['pppoe']['username'];
75
$pconfig['password'] = $config['pppoe']['password'];
76
$pconfig['provider'] = $config['pppoe']['provider'];
77
$pconfig['pppoe_dialondemand'] = isset($config['pppoe']['ondemand']);
78
$pconfig['pppoe_idletimeout'] = $config['pppoe']['timeout'];
79

    
80
/* ================================================ */
81
/* = force a connection reset at a specific time? = */
82
/* ================================================ */
83

    
84
if (isset($wancfg['pppoe']['pppoe-reset-type'])) {
85
  $resetTime = getMPDResetTimeFromConfig();  
86
  $pconfig['pppoe_preset'] = true;
87
  
88
  if ($wancfg['pppoe']['pppoe-reset-type'] == "custom") {
89
    $resetTime_a = split(" ", $resetTime);
90
    $pconfig['pppoe_pr_custom'] = true;
91
    $pconfig['pppoe_resetminute'] = $resetTime_a[0];
92
    $pconfig['pppoe_resethour'] = $resetTime_a[1];
93

    
94
    /* just initialize $pconfig['pppoe_resetdate'] if the
95
     * coresponding item contains appropriate numeric values.
96
     */
97
    if ($resetTime_a[2] <> "*" && $resetTime_a[3] <> "*") {
98
      $pconfig['pppoe_resetdate'] = "{$resetTime_a[3]}/{$resetTime_a[2]}/" . date("Y");
99
    }
100
  } else if ($wancfg['pppoe']['pppoe-reset-type'] == "preset") {
101
    $pconfig['pppoe_pr_preset'] = true;
102
    
103
    switch ($resetTime) {
104
      case CRON_MONTHLY_PATTERN:
105
        $pconfig['pppoe_monthly'] = true;
106
        break;
107
      case CRON_WEEKLY_PATTERN:
108
        $pconfig['pppoe_weekly'] = true;
109
        break;
110
      case CRON_DAILY_PATTERN:
111
        $pconfig['pppoe_daily'] = true;
112
        break;
113
      case CRON_HOURLY_PATTERN:
114
        $pconfig['pppoe_hourly'] = true;
115
        break;
116
    }
117
  }
118
}
119

    
120
$pconfig['pptp_username'] = $config['pptp']['username'];
121
$pconfig['pptp_password'] = $config['pptp']['password'];
122
$pconfig['pptp_local'] = $config['pptp']['local'];
123
$pconfig['pptp_subnet'] = $config['pptp']['subnet'];
124
$pconfig['pptp_remote'] = $config['pptp']['remote'];
125
$pconfig['pptp_dialondemand'] = isset($config['pptp']['ondemand']);
126
$pconfig['pptp_idletimeout'] = $config['pptp']['timeout'];
127

    
128
$pconfig['disableftpproxy'] = isset($wancfg['disableftpproxy']);
129

    
130
$pconfig['bigpond_username'] = $config['bigpond']['username'];
131
$pconfig['bigpond_password'] = $config['bigpond']['password'];
132
$pconfig['bigpond_authserver'] = $config['bigpond']['authserver'];
133
$pconfig['bigpond_authdomain'] = $config['bigpond']['authdomain'];
134
$pconfig['bigpond_minheartbeatinterval'] = $config['bigpond']['minheartbeatinterval'];
135

    
136
$pconfig['dhcphostname'] = $wancfg['dhcphostname'];
137

    
138
if ($wancfg['ipaddr'] == "dhcp") {
139
	$pconfig['type'] = "DHCP";
140
} else if ($wancfg['ipaddr'] == "pppoe") {
141
	$pconfig['type'] = "PPPoE";
142
} else if ($wancfg['ipaddr'] == "pptp") {
143
	$pconfig['type'] = "PPTP";
144
} else if ($wancfg['ipaddr'] == "bigpond") {
145
	$pconfig['type'] = "BigPond";
146
} else {
147
	$pconfig['type'] = "Static";
148
	$pconfig['ipaddr'] = $wancfg['ipaddr'];
149
	$pconfig['subnet'] = $wancfg['subnet'];
150
	$pconfig['gateway'] = $config['interfaces']['wan']['gateway'];
151
	$pconfig['pointtopoint'] = $wancfg['pointtopoint'];
152
}
153

    
154
$pconfig['blockpriv'] = isset($wancfg['blockpriv']);
155
$pconfig['blockbogons'] = isset($wancfg['blockbogons']);
156
$pconfig['spoofmac'] = $wancfg['spoofmac'];
157
$pconfig['mtu'] = $wancfg['mtu'];
158

    
159
/* Wireless interface? */
160
if (isset($wancfg['wireless'])) {
161
	require("interfaces_wlan.inc");
162
	wireless_config_init();
163
}
164

    
165
if ($_POST) {
166

    
167
	unset($input_errors);
168
	$pconfig = $_POST;
169
  
170
  /* okay first of all, cause we are just hidding the PPPoE HTML
171
   * fields releated to PPPoE resets, we are going to unset $_POST
172
   * vars, if the reset feature should not be used. Otherwise the
173
   * data validation procedure below, may trigger a false error
174
   * message.
175
   */
176
  if (empty($_POST['pppoe_preset'])) {
177
    unset($_POST['pppoe_pr_type']);
178
    unset($_POST['pppoe_resethour']);
179
    unset($_POST['pppoe_resetminute']);
180
    unset($_POST['pppoe_resetdate']);
181
    unset($_POST['pppoe_pr_preset_val']);
182
    unlink_if_exists(CRON_PPPOE_CMD_FILE);
183
  }
184

    
185
	if($_POST['gateway'] and $pconfig['gateway'] <> $_POST['gateway']) {
186
		/* enumerate slbd gateways and make sure we are not creating a route loop */
187
		if(is_array($config['load_balancer']['lbpool'])) {
188
			foreach($config['load_balancer']['lbpool'] as $lbpool) {
189
				if($lbpool['type'] == "gateway") {
190
				    foreach ((array) $lbpool['servers'] as $server) {
191
			            $svr = split("\|", $server);
192
			            if($svr[1] == $pconfig['gateway'])  {
193
			            		$_POST['gateway']  = $pconfig['gateway'];
194
			            		$input_errors[] = "Cannot change {$svr[1]} gateway.  It is currently referenced by the load balancer pools.";
195
			            }
196
					}
197
				}
198
			}
199
			foreach($config['filter']['rule'] as $rule) {
200
				if($rule['gateway'] == $pconfig['gateway']) {
201
	            		$_POST['gateway']  = $pconfig['gateway'];
202
	            		$input_errors[] = "Cannot change {$svr[1]} gateway.  It is currently referenced by the filter rules via policy based routing.";
203
				}
204
			}
205
		}
206
	}
207

    
208
	/* input validation */
209
	if ($_POST['type'] == "Static") {
210
		$reqdfields = explode(" ", "ipaddr subnet gateway");
211
		$reqdfieldsn = explode(",", "IP address,Subnet bit count,Gateway");
212
		do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
213
	} else if ($_POST['type'] == "PPPoE") {
214
		if ($_POST['pppoe_dialondemand']) {
215
			$reqdfields = explode(" ", "username password pppoe_dialondemand pppoe_idletimeout");
216
			$reqdfieldsn = explode(",", "PPPoE username,PPPoE password,Dial on demand,Idle timeout value");
217
		} else {
218
			$reqdfields = explode(" ", "username password");
219
			$reqdfieldsn = explode(",", "PPPoE username,PPPoE password");
220
		}
221
		do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
222
	} else if ($_POST['type'] == "PPTP") {
223
		if ($_POST['pptp_dialondemand']) {
224
			$reqdfields = explode(" ", "pptp_username pptp_password pptp_local pptp_subnet pptp_remote pptp_dialondemand pptp_idletimeout");
225
			$reqdfieldsn = explode(",", "PPTP username,PPTP password,PPTP local IP address,PPTP subnet,PPTP remote IP address,Dial on demand,Idle timeout value");
226
		} else {
227
			$reqdfields = explode(" ", "pptp_username pptp_password pptp_local pptp_subnet pptp_remote");
228
			$reqdfieldsn = explode(",", "PPTP username,PPTP password,PPTP local IP address,PPTP subnet,PPTP remote IP address");
229
		}
230
		do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
231
	} else if ($_POST['type'] == "BigPond") {
232
		$reqdfields = explode(" ", "bigpond_username bigpond_password");
233
		$reqdfieldsn = explode(",", "BigPond username,BigPond password");
234
		do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
235
	}
236

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

    
240
	if (($_POST['ipaddr'] && !is_ipaddr($_POST['ipaddr']))) {
241
		$input_errors[] = "A valid IP address must be specified.";
242
	}
243
	if (($_POST['subnet'] && !is_numeric($_POST['subnet']))) {
244
		$input_errors[] = "A valid subnet bit count must be specified.";
245
	}
246
	if (($_POST['gateway'] && !is_ipaddr($_POST['gateway']))) {
247
		$input_errors[] = "A valid gateway must be specified.";
248
	}
249
	if (($_POST['pointtopoint'] && !is_ipaddr($_POST['pointtopoint']))) {
250
		$input_errors[] = "A valid point-to-point IP address must be specified.";
251
	}
252
	if (($_POST['provider'] && !is_domain($_POST['provider']))) {
253
		$input_errors[] = "The service name contains invalid characters.";
254
	}
255
	if (($_POST['pppoe_idletimeout'] != "") && !is_numericint($_POST['pppoe_idletimeout'])) {
256
		$input_errors[] = "The idle timeout value must be an integer.";
257
	}
258
  if ($_POST['pppoe_resethour'] <> "" && 
259
      !is_numericint($_POST['pppoe_resethour']) && 
260
    $_POST['pppoe_resethour'] >= 0 && 
261
    $_POST['pppoe_resethour'] <=23) {
262
    $input_errors[] = gettext("A valid PPPoE reset hour must be specified (0-23).");
263
  }
264
  if ($_POST['pppoe_resetminute'] <> "" && 
265
      !is_numericint($_POST['pppoe_resetminute']) && 
266
    $_POST['pppoe_resetminute'] >= 0 && 
267
    $_POST['pppoe_resetminute'] <=59) {
268
    $input_errors[] = gettext("A valid PPPoE reset minute must be specified (0-59).");
269
  }
270
  if ($_POST['pppoe_resetdate'] <> "" && !is_numeric(str_replace("/", "", $_POST['pppoe_resetdate']))) {
271
    $input_errors[] = gettext("A valid PPPoE reset date must be specified (mm/dd/yyyy).");
272
  }
273
	if (($_POST['pptp_local'] && !is_ipaddr($_POST['pptp_local']))) {
274
		$input_errors[] = "A valid PPTP local IP address must be specified.";
275
	}
276
	if (($_POST['pptp_subnet'] && !is_numeric($_POST['pptp_subnet']))) {
277
		$input_errors[] = "A valid PPTP subnet bit count must be specified.";
278
	}
279
	if (($_POST['pptp_remote'] && !is_ipaddr($_POST['pptp_remote']))) {
280
		$input_errors[] = "A valid PPTP remote IP address must be specified.";
281
	}
282
	if (($_POST['pptp_idletimeout'] != "") && !is_numericint($_POST['pptp_idletimeout'])) {
283
		$input_errors[] = "The idle timeout value must be an integer.";
284
	}
285
	if (($_POST['bigpond_authserver'] && !is_domain($_POST['bigpond_authserver']))) {
286
		$input_errors[] = "The authentication server name contains invalid characters.";
287
	}
288
	if (($_POST['bigpond_authdomain'] && !is_domain($_POST['bigpond_authdomain']))) {
289
		$input_errors[] = "The authentication domain name contains invalid characters.";
290
	}
291
	if ($_POST['bigpond_minheartbeatinterval'] && !is_numericint($_POST['bigpond_minheartbeatinterval'])) {
292
		$input_errors[] = "The minimum heartbeat interval must be an integer.";
293
	}
294
	if (($_POST['spoofmac'] && !is_macaddr($_POST['spoofmac']))) {
295
		$input_errors[] = "A valid MAC address must be specified.";
296
	}
297
	if ($_POST['mtu'] && (($_POST['mtu'] < 576) || ($_POST['mtu'] > 1500))) {
298
		$input_errors[] = "The MTU must be between 576 and 1500 bytes.";
299
	}
300

    
301
	/* Wireless interface? */
302
	if (isset($wancfg['wireless'])) {
303
		$wi_input_errors = wireless_config_post();
304
		if ($wi_input_errors) {
305
			$input_errors = array_merge($input_errors, $wi_input_errors);
306
		}
307
	}
308

    
309
	if (!$input_errors) {
310

    
311
		$bridge = discover_bridge($wancfg['if'], filter_translate_type_to_real_interface($wancfg['bridge']));
312
		if($bridge <> "-1") {
313
			destroy_bridge($bridge);
314
		}
315

    
316
		unset($wancfg['ipaddr']);
317
		unset($wancfg['subnet']);
318
		unset($config['interfaces']['wan']['gateway']);
319
		unset($wancfg['pointtopoint']);
320
		unset($wancfg['dhcphostname']);
321
    if (is_array($wancfg['pppoe'])) {
322
      unset($config['pppoe']['username']);
323
      unset($config['pppoe']['password']);
324
      unset($config['pppoe']['provider']);
325
      unset($config['pppoe']['ondemand']);
326
      unset($config['pppoe']['timeout']);
327
      unset($wancfg['pppoe']['pppoe-reset-type']);
328
    }
329
    if (is_array($wancfg['pptp'])) {
330
      unset($config['pptp']['username']);
331
      unset($config['pptp']['password']);
332
      unset($config['pptp']['local']);
333
      unset($config['pptp']['subnet']);
334
      unset($config['pptp']['remote']);
335
      unset($config['pptp']['ondemand']);
336
      unset($config['pptp']['timeout']);
337
    }
338
		unset($config['bigpond']['username']);
339
		unset($config['bigpond']['password']);
340
		unset($config['bigpond']['authserver']);
341
		unset($config['bigpond']['authdomain']);
342
		unset($config['bigpond']['minheartbeatinterval']);
343
		unset($wancfg['disableftpproxy']);
344

    
345
		/* per interface pftpx helper */
346
		if($_POST['disableftpproxy'] == "yes") {
347
			$wancfg['disableftpproxy'] = true;
348
			system_start_ftp_helpers();
349
		} else {
350
			system_start_ftp_helpers();
351
		}
352

    
353
		if ($_POST['type'] == "Static") {
354
			$wancfg['ipaddr'] = $_POST['ipaddr'];
355
			$wancfg['subnet'] = $_POST['subnet'];
356
			$config['interfaces']['wan']['gateway'] = $_POST['gateway'];
357
			if (isset($wancfg['ispointtopoint']))
358
				$wancfg['pointtopoint'] = $_POST['pointtopoint'];
359
		} else if ($_POST['type'] == "DHCP") {
360
			$wancfg['ipaddr'] = "dhcp";
361
			$wancfg['dhcphostname'] = $_POST['dhcphostname'];
362
		} else if ($_POST['type'] == "PPPoE") {
363
			$wancfg['ipaddr'] = "pppoe";
364
			$config['pppoe']['username'] = $_POST['username'];
365
			$config['pppoe']['password'] = $_POST['password'];
366
			$config['pppoe']['provider'] = $_POST['provider'];
367
			$config['pppoe']['ondemand'] = $_POST['pppoe_dialondemand'] ? true : false;
368
			$config['pppoe']['timeout'] = $_POST['pppoe_idletimeout'];
369
      
370
      /* perform a periodic reset? */
371
      if (isset($_POST['pppoe_preset'])) {
372
        if (! is_array($config['cron']['item'])) { $config['cron']['item'] = array(); }
373

    
374
        $itemhash = getMPDCRONSettings();
375
        $item = $itemhash['ITEM'];
376

    
377
        if (empty($item)) {
378
          $item = array();
379
        }
380

    
381
        if (isset($_POST['pppoe_pr_type']) && $_POST['pppoe_pr_type'] == "custom") {
382
          $wancfg['pppoe']['pppoe-reset-type'] = "custom";
383
          $pconfig['pppoe_pr_custom'] = true;
384

    
385
          $item['minute'] = $_POST['pppoe_resetminute'];
386
          $item['hour'] = $_POST['pppoe_resethour'];
387

    
388
          if (isset($_POST['pppoe_resetdate']) && 
389
              $_POST['pppoe_resetdate'] <> "" && 
390
              strlen($_POST['pppoe_resetdate']) == 10) {
391
            $date = explode("/", $_POST['pppoe_resetdate']);
392

    
393
            $item['mday'] = $date[1];
394
            $item['month'] = $date[0];
395
          } else {
396
            $item['mday'] = "*";
397
            $item['month'] = "*";
398
          }
399

    
400
          $item['wday'] = "*";
401
          $item['who'] = "root";
402
          $item['command'] = CRON_PPPOE_CMD_FILE;
403
        } else if (isset($_POST['pppoe_pr_type']) && $_POST['pppoe_pr_type'] = "preset") {
404
          $wancfg['pppoe']['pppoe-reset-type'] = "preset";
405
          $pconfig['pppoe_pr_preset'] = true;
406

    
407
          switch ($_POST['pppoe_pr_preset_val']) {
408
            case "monthly":
409
              $item['minute'] = "0";
410
              $item['hour'] = "0";
411
              $item['mday'] = "1";
412
              $item['month'] = "*";
413
              $item['wday'] = "*";
414
              $item['who'] = "root";
415
              $item['command'] = CRON_PPPOE_CMD_FILE;
416
              break;
417
            case "weekly":
418
              $item['minute'] = "0";
419
              $item['hour'] = "0";
420
              $item['mday'] = "*";
421
              $item['month'] = "*";
422
              $item['wday'] = "0";
423
              $item['who'] = "root";
424
              $item['command'] = CRON_PPPOE_CMD_FILE;
425
              break;
426
            case "daily":
427
              $item['minute'] = "0";
428
              $item['hour'] = "0";
429
              $item['mday'] = "*";
430
              $item['month'] = "*";
431
              $item['wday'] = "*";
432
              $item['who'] = "root";
433
              $item['command'] = CRON_PPPOE_CMD_FILE;
434
              break;
435
            case "hourly":
436
              $item['minute'] = "0";
437
              $item['hour'] = "*";
438
              $item['mday'] = "*";
439
              $item['month'] = "*";
440
              $item['wday'] = "*";
441
              $item['who'] = "root";
442
              $item['command'] = CRON_PPPOE_CMD_FILE;
443
              break;
444
          } // end switch
445
        } // end if
446

    
447
        if (isset($itemhash['ID'])) {
448
          $config['cron']['item'][$itemhash['ID']] = $item;
449
        } else {
450
          $config['cron']['item'][] = $item;
451
        }
452
      } // end if
453
		} else if ($_POST['type'] == "PPTP") {
454
			$wancfg['ipaddr'] = "pptp";
455
			$config['pptp']['username'] = $_POST['pptp_username'];
456
			$config['pptp']['password'] = $_POST['pptp_password'];
457
			$config['pptp']['local'] = $_POST['pptp_local'];
458
			$config['pptp']['subnet'] = $_POST['pptp_subnet'];
459
			$config['pptp']['remote'] = $_POST['pptp_remote'];
460
			$config['pptp']['ondemand'] = $_POST['pptp_dialondemand'] ? true : false;
461
			$config['pptp']['timeout'] = $_POST['pptp_idletimeout'];
462
		} else if ($_POST['type'] == "BigPond") {
463
			$wancfg['ipaddr'] = "bigpond";
464
			$config['bigpond']['username'] = $_POST['bigpond_username'];
465
			$config['bigpond']['password'] = $_POST['bigpond_password'];
466
			$config['bigpond']['authserver'] = $_POST['bigpond_authserver'];
467
			$config['bigpond']['authdomain'] = $_POST['bigpond_authdomain'];
468
			$config['bigpond']['minheartbeatinterval'] = $_POST['bigpond_minheartbeatinterval'];
469
		}
470
    
471
    /* reset cron items if necessary */
472
    if (empty($_POST['pppoe_preset'])) {
473
      /* test whether a cron item exists and unset() it if necessary */
474
      $itemhash = getMPDCRONSettings();
475
      $item = $itemhash['ITEM'];
476

    
477
      if (isset($item)) { unset($config['cron']['item'][$itemhash['ID']]); }
478
    }
479

    
480
		if($_POST['blockpriv'] == "yes")
481
			$wancfg['blockpriv'] = true;
482
		else
483
			unset($wancfg['blockpriv']);
484

    
485
		if($_POST['blockbogons'] == "yes")
486
			$wancfg['blockbogons'] = true;
487
		else
488
			unset($wancfg['blockbogons']);
489

    
490
		$wancfg['spoofmac'] = $_POST['spoofmac'];
491
		$wancfg['mtu'] = $_POST['mtu'];
492

    
493
		write_config();
494
    
495
		/* finally install the pppoerestart file */
496
		if (isset($_POST['pppoe_preset'])) {
497
      config_lock();
498
      conf_mount_rw();
499
      
500
      if (! file_exists(CRON_PPPOE_CMD_FILE)) {
501
        file_put_contents(CRON_PPPOE_CMD_FILE, CRON_PPPOE_CMD);
502
        chmod(CRON_PPPOE_CMD_FILE, 0700);
503
      }
504
      
505
      /* regenerate cron settings/crontab file */
506
      configure_cron();
507
      sigkillbypid("{$g['varrun_path']}/cron.pid", "HUP");
508
      
509
      conf_mount_ro();
510
      config_unlock();
511
		}
512

    
513
		$retval = 0;
514

    
515
		$savemsg = get_std_save_message($retval);
516
	}
517
}
518

    
519
$pgtitle = "Interfaces: WAN";
520
$closehead = false;
521
include("head.inc");
522

    
523
?>
524

    
525
<script type="text/javascript" src="/javascript/numericupdown/js/numericupdown.js"></script>
526
<link href="/javascript/numericupdown/css/numericupdown.css" rel="stylesheet" type="text/css" />
527

    
528
<script type="text/javascript" src="/javascript/datepicker/js/datepicker.js"></script>
529
<link href="/javascript/datepicker/css/datepicker.css" rel="stylesheet" type="text/css" />
530

    
531
<script type="text/javascript" src="/javascript/scriptaculous/prototype.js"></script>
532
<script type="text/javascript" src="/javascript/scriptaculous/scriptaculous.js"></script>
533

    
534
<script type="text/javascript">
535
<!--
536
function enable_change(enable_change) {
537
	if (document.iform.pppoe_dialondemand.checked || enable_change) {
538
		document.iform.pppoe_idletimeout.disabled = 0;
539
	} else {
540
		document.iform.pppoe_idletimeout.disabled = 1;
541
	}
542
}
543

    
544
function enable_change_pptp(enable_change_pptp) {
545
	if (document.iform.pptp_dialondemand.checked || enable_change_pptp) {
546
		document.iform.pptp_idletimeout.disabled = 0;
547
		document.iform.pptp_local.disabled = 0;
548
		document.iform.pptp_remote.disabled = 0;
549
	} else {
550
		document.iform.pptp_idletimeout.disabled = 1;
551
	}
552
}
553

    
554
function type_change(enable_change,enable_change_pptp) {
555
	switch (document.iform.type.selectedIndex) {
556
		case 0:
557
			document.iform.username.disabled = 1;
558
			document.iform.password.disabled = 1;
559
			document.iform.provider.disabled = 1;
560
			document.iform.pppoe_dialondemand.disabled = 1;
561
			document.iform.pppoe_idletimeout.disabled = 1;
562
      document.iform.pppoe_preset.disabled = 1;
563
      document.iform.pppoe_preset.checked = 0;
564
      Effect.Fade('presetwrap', { duration: 1.0 });
565
			document.iform.ipaddr.disabled = 0;
566
			document.iform.subnet.disabled = 0;
567
			document.iform.gateway.disabled = 0;
568
			document.iform.pptp_username.disabled = 1;
569
			document.iform.pptp_password.disabled = 1;
570
			document.iform.pptp_local.disabled = 1;
571
			document.iform.pptp_subnet.disabled = 1;
572
			document.iform.pptp_remote.disabled = 1;
573
			document.iform.pptp_dialondemand.disabled = 1;
574
			document.iform.pptp_idletimeout.disabled = 1;
575
			document.iform.bigpond_username.disabled = 1;
576
			document.iform.bigpond_password.disabled = 1;
577
			document.iform.bigpond_authserver.disabled = 1;
578
			document.iform.bigpond_authdomain.disabled = 1;
579
			document.iform.bigpond_minheartbeatinterval.disabled = 1;
580
			document.iform.dhcphostname.disabled = 1;
581
			break;
582
		case 1:
583
			document.iform.username.disabled = 1;
584
			document.iform.password.disabled = 1;
585
			document.iform.provider.disabled = 1;
586
			document.iform.pppoe_dialondemand.disabled = 1;
587
			document.iform.pppoe_idletimeout.disabled = 1;
588
      document.iform.pppoe_preset.disabled = 1;
589
      document.iform.pppoe_preset.checked = 0;
590
      Effect.Fade('presetwrap', { duration: 1.0 });
591
			document.iform.ipaddr.disabled = 1;
592
			document.iform.subnet.disabled = 1;
593
			document.iform.gateway.disabled = 1;
594
			document.iform.pptp_username.disabled = 1;
595
			document.iform.pptp_password.disabled = 1;
596
			document.iform.pptp_local.disabled = 1;
597
			document.iform.pptp_subnet.disabled = 1;
598
			document.iform.pptp_remote.disabled = 1;
599
			document.iform.pptp_dialondemand.disabled = 1;
600
			document.iform.pptp_idletimeout.disabled = 1;
601
			document.iform.bigpond_username.disabled = 1;
602
			document.iform.bigpond_password.disabled = 1;
603
			document.iform.bigpond_authserver.disabled = 1;
604
			document.iform.bigpond_authdomain.disabled = 1;
605
			document.iform.bigpond_minheartbeatinterval.disabled = 1;
606
			document.iform.dhcphostname.disabled = 0;
607
			break;
608
		case 2:
609
			document.iform.username.disabled = 0;
610
			document.iform.password.disabled = 0;
611
			document.iform.provider.disabled = 0;
612
			document.iform.pppoe_dialondemand.disabled = 0;
613
			if (document.iform.pppoe_dialondemand.checked || enable_change) {
614
				document.iform.pppoe_idletimeout.disabled = 0;
615
			} else {
616
				document.iform.pppoe_idletimeout.disabled = 1;
617
			}
618
      document.iform.pppoe_preset.disabled = 0;
619
			document.iform.ipaddr.disabled = 1;
620
			document.iform.subnet.disabled = 1;
621
			document.iform.gateway.disabled = 1;
622
			document.iform.pptp_username.disabled = 1;
623
			document.iform.pptp_password.disabled = 1;
624
			document.iform.pptp_local.disabled = 1;
625
			document.iform.pptp_subnet.disabled = 1;
626
			document.iform.pptp_remote.disabled = 1;
627
			document.iform.pptp_dialondemand.disabled = 1;
628
			document.iform.pptp_idletimeout.disabled = 1;
629
			document.iform.bigpond_username.disabled = 1;
630
			document.iform.bigpond_password.disabled = 1;
631
			document.iform.bigpond_authserver.disabled = 1;
632
			document.iform.bigpond_authdomain.disabled = 1;
633
			document.iform.bigpond_minheartbeatinterval.disabled = 1;
634
			document.iform.dhcphostname.disabled = 1;
635
			break;
636
		case 3:
637
			document.iform.username.disabled = 1;
638
			document.iform.password.disabled = 1;
639
			document.iform.provider.disabled = 1;
640
			document.iform.pppoe_dialondemand.disabled = 1;
641
			document.iform.pppoe_idletimeout.disabled = 1;
642
      document.iform.pppoe_preset.disabled = 1;
643
      document.iform.pppoe_preset.checked = 0;
644
      Effect.Fade('presetwrap', { duration: 1.0 });			
645
			document.iform.ipaddr.disabled = 1;
646
			document.iform.subnet.disabled = 1;
647
			document.iform.gateway.disabled = 1;
648
			document.iform.pptp_username.disabled = 0;
649
			document.iform.pptp_password.disabled = 0;
650
			document.iform.pptp_local.disabled = 0;
651
			document.iform.pptp_subnet.disabled = 0;
652
			document.iform.pptp_remote.disabled = 0;
653
			document.iform.pptp_dialondemand.disabled = 0;
654
			if (document.iform.pptp_dialondemand.checked || enable_change_pptp) {
655
				document.iform.pptp_idletimeout.disabled = 0;
656
			} else {
657
				document.iform.pptp_idletimeout.disabled = 1;
658
			}
659
			document.iform.bigpond_username.disabled = 1;
660
			document.iform.bigpond_password.disabled = 1;
661
			document.iform.bigpond_authserver.disabled = 1;
662
			document.iform.bigpond_authdomain.disabled = 1;
663
			document.iform.bigpond_minheartbeatinterval.disabled = 1;
664
			document.iform.dhcphostname.disabled = 1;
665
			break;
666
		case 4:
667
			document.iform.username.disabled = 1;
668
			document.iform.password.disabled = 1;
669
			document.iform.provider.disabled = 1;
670
			document.iform.pppoe_dialondemand.disabled = 1;
671
			document.iform.pppoe_idletimeout.disabled = 1;
672
      document.iform.pppoe_preset.disabled = 1;
673
      document.iform.pppoe_preset.checked = 0;
674
      Effect.Fade('presetwrap', { duration: 1.0 });
675
			document.iform.ipaddr.disabled = 1;
676
			document.iform.subnet.disabled = 1;
677
			document.iform.gateway.disabled = 1;
678
			document.iform.pptp_username.disabled = 1;
679
			document.iform.pptp_password.disabled = 1;
680
			document.iform.pptp_local.disabled = 1;
681
			document.iform.pptp_subnet.disabled = 1;
682
			document.iform.pptp_remote.disabled = 1;
683
			document.iform.pptp_dialondemand.disabled = 1;
684
			document.iform.pptp_idletimeout.disabled = 1;
685
			document.iform.bigpond_username.disabled = 0;
686
			document.iform.bigpond_password.disabled = 0;
687
			document.iform.bigpond_authserver.disabled = 0;
688
			document.iform.bigpond_authdomain.disabled = 0;
689
			document.iform.bigpond_minheartbeatinterval.disabled = 0;
690
			document.iform.dhcphostname.disabled = 1;
691
			break;
692
	}
693
}
694
//-->
695
</script>
696
</head>
697
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
698
<?php include("fbegin.inc"); ?>
699
<p class="pgtitle"><?=$pgtitle?></p>
700
<?php if ($input_errors) print_input_errors($input_errors); ?>
701
<?php if ($savemsg) print_info_box($savemsg); ?>
702
            <form action="interfaces_wan.php" method="post" name="iform" id="iform">
703
              <table width="100%" border="0" cellpadding="6" cellspacing="0">
704
                <tr>
705
                  <td colspan="2" valign="top" class="listtopic">General configuration</td>
706
                </tr>
707
                <tr>
708
                  <td valign="middle" class="vncell"><strong>Type</strong></td>
709
                  <td class="vtable"> <select name="type" class="formfld" id="type" onchange="type_change()">
710
                      <?php $opts = split(" ", "Static DHCP PPPoE PPTP BigPond");
711
				foreach ($opts as $opt): ?>
712
                      <option <?php if ($opt == $pconfig['type']) echo "selected";?>>
713
                      <?=htmlspecialchars($opt);?>
714
                      </option>
715
                      <?php endforeach; ?>
716
                    </select></td>
717
                </tr>
718
                <tr>
719
                  <td valign="top" class="vncell">MAC address</td>
720
                  <td class="vtable"> <input name="spoofmac" type="text" class="formfld" id="spoofmac" size="30" value="<?=htmlspecialchars($pconfig['spoofmac']);?>">
721
		    <?php
722
			$ip = getenv('REMOTE_ADDR');
723
			$mac = `/usr/sbin/arp -an | grep {$ip} | cut -d" " -f4`;
724
			$mac = str_replace("\n","",$mac);
725
		    ?>
726
		    <a OnClick="document.forms[0].spoofmac.value='<?=$mac?>';" href="#">Copy my MAC address</a>
727
		    <br>
728
                    This field can be used to modify (&quot;spoof&quot;) the MAC
729
                    address of the WAN interface<br>
730
                    (may be required with some cable connections)<br>
731
                    Enter a MAC address in the following format: xx:xx:xx:xx:xx:xx
732
                    or leave blank</td>
733
                </tr>
734
                <tr>
735
                  <td valign="top" class="vncell">MTU</td>
736
                  <td class="vtable"> <input name="mtu" type="text" class="formfld" id="mtu" size="8" value="<?=htmlspecialchars($pconfig['mtu']);?>">
737
                    <br>
738
                    If you enter a value in this field, then MSS clamping for
739
                    TCP connections to the value entered above minus 40 (TCP/IP
740
                    header size) will be in effect. If you leave this field blank,
741
                    an MTU of 1492 bytes for PPPoE and 1500 bytes for all other
742
                    connection types will be assumed.</td>
743
                </tr>
744
                <tr>
745
                  <td colspan="2" valign="top" height="16"></td>
746
                </tr>
747
                <tr>
748
                  <td colspan="2" valign="top" class="listtopic">Static IP configuration</td>
749
                </tr>
750
                <tr>
751
                  <td width="100" valign="top" class="vncellreq">IP address</td>
752
                  <td class="vtable"> <input name="ipaddr" type="text" class="formfld" id="ipaddr" size="20" value="<?=htmlspecialchars($pconfig['ipaddr']);?>">
753
                    /
754
                    <select name="subnet" class="formfld" id="subnet">
755
			<?php
756
			for ($i = 32; $i > 0; $i--) {
757
				if($i <> 31) {
758
					echo "<option value=\"{$i}\" ";
759
					if ($i == $pconfig['subnet']) echo "selected";
760
					echo ">" . $i . "</option>";
761
				}
762
			}
763
			?>
764
                    </select></td>
765
                </tr><?php if (isset($wancfg['ispointtopoint'])): ?>
766
                <tr>
767
                  <td valign="top" class="vncellreq">Point-to-point IP address </td>
768
                  <td class="vtable">
769
                    <input name="pointtopoint" type="text" class="formfld" id="pointtopoint" size="20" value="<?=htmlspecialchars($pconfig['pointtopoint']);?>">
770
                  </td>
771
                </tr><?php endif; ?>
772
                <tr>
773
                  <td valign="top" class="vncellreq">Gateway</td>
774
                  <td class="vtable"> <input name="gateway" type="text" class="formfld" id="gateway" size="20" value="<?=htmlspecialchars($pconfig['gateway']);?>">
775
                  </td>
776
                </tr>
777
                <tr>
778
                  <td colspan="2" valign="top" height="16"></td>
779
                </tr>
780
                <tr>
781
                  <td colspan="2" valign="top" class="listtopic">DHCP client configuration</td>
782
                </tr>
783
                <tr>
784
                  <td valign="top" class="vncell">Hostname</td>
785
                  <td class="vtable"> <input name="dhcphostname" type="text" class="formfld" id="dhcphostname" size="40" value="<?=htmlspecialchars($pconfig['dhcphostname']);?>">
786
                    <br>
787
                    The value in this field is sent as the DHCP client identifier
788
                    and hostname when requesting a DHCP lease. Some ISPs may require
789
                    this (for client identification).</td>
790
                </tr>
791
                <tr>
792
                  <td colspan="2" valign="top" height="16"></td>
793
                </tr>
794
                <tr>
795
                  <td colspan="2" valign="top" class="listtopic">PPPoE configuration</td>
796
                </tr>
797
                <tr>
798
                  <td valign="top" class="vncellreq">Username</td>
799
                  <td class="vtable"><input name="username" type="text" class="formfld" id="username" size="20" value="<?=htmlspecialchars($pconfig['username']);?>">
800
                  </td>
801
                </tr>
802
                <tr>
803
                  <td valign="top" class="vncellreq">Password</td>
804
                  <td class="vtable"><input name="password" type="text" class="formfld" id="password" size="20" value="<?=htmlspecialchars($pconfig['password']);?>">
805
                  </td>
806
                </tr>
807
                <tr>
808
                  <td valign="top" class="vncell">Service name</td>
809
                  <td class="vtable"><input name="provider" type="text" class="formfld" id="provider" size="20" value="<?=htmlspecialchars($pconfig['provider']);?>">
810
                    <br> <span class="vexpl">Hint: this field can usually be left
811
                    empty</span></td>
812
                </tr>
813
                <tr>
814
                  <td valign="top" class="vncell">Dial on demand</td>
815
                  <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)" >
816
                    <strong>Enable Dial-On-Demand mode</strong><br>
817
		    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>
818
                </tr>
819
                <tr>
820
                  <td valign="top" class="vncell">Idle timeout</td>
821
                  <td class="vtable">
822
                    <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>
823
                </tr>
824
                <tr>
825
                  <td valign="top" class="vncell"><?=gettext("Periodic reset");?></td>
826
                  <td class="vtable">
827
                    <input name="pppoe_preset" type="checkbox" id="pppoe_preset" value="yes" <?php if ($pconfig['pppoe_preset']) echo "checked=\"checked\""; ?> onclick="Effect.toggle('presetwrap', 'appear', { duration: 1.0 });" />
828
                    <?= gettext("enable periodic PPPoE resets"); ?>
829
                    <br />
830
                    <?php if ($pconfig['pppoe_preset']): ?>
831
                    <table id="presetwrap" cellspacing="0" cellpadding="0" width="100%">
832
                    <?php else: ?>
833
                    <table id="presetwrap" cellspacing="0" cellpadding="0" width="100%" style="display: none;">
834
                    <?php endif; ?>
835
                      <tr>
836
                        <td align="left" valign="top">
837
                          <p style="margin: 4px; padding: 4px 0 4px 0; width: 94%;">
838
                            <input name="pppoe_pr_type" type="radio" id="pppoe_pr_custom" value="custom" <?php if ($pconfig['pppoe_pr_custom']) echo "checked=\"checked\""; ?> onclick="if (this.checked) { Effect.Appear('pppoecustomwrap', { duration: 1.0 }); Effect.Fade('pppoepresetwrap', { duration: 1.0 }); }" /> 
839
                            <?= gettext("provide a custom reset time"); ?>
840
                            <br />
841
                            <input name="pppoe_pr_type" type="radio" id="pppoe_pr_preset" value="preset" <?php if ($pconfig['pppoe_pr_preset']) echo "checked=\"checked\""; ?> onclick="if (this.checked) { Effect.Appear('pppoepresetwrap', { duration: 1.0 }); Effect.Fade('pppoecustomwrap', { duration: 1.0 }); }" /> 
842
                            <?= gettext("select reset time from a preset"); ?>
843
                          </p>
844
                          <?php if ($pconfig['pppoe_pr_custom']): ?>
845
                          <p style="margin: 2px; padding: 4px; width: 94%;" id="pppoecustomwrap">
846
                          <?php else: ?>
847
                          <p style="margin: 2px; padding: 4px; width: 94%; display: none;" id="pppoecustomwrap">
848
                          <?php endif; ?>
849
                            <input type="text" name="pppoe_resethour" class="fd_incremental_inp_range_0_23 fd_increment_1 fd_classname_dec_buttonDec fd_classname_inc_buttonInc" maxlength="2" id="pppoe_resethour" value="<?= $pconfig['pppoe_resethour']; ?>" size="3" /> 
850
                            <?= gettext("hour (0-23)"); ?><br />
851
                            <input type="text" name="pppoe_resetminute" class="fd_incremental_inp_range_0_59 fd_increment_1 fd_classname_dec_buttonDec fd_classname_inc_buttonInc" maxlength="2" id="pppoe_resetminute" value="<?= $pconfig['pppoe_resetminute']; ?>" size="3" /> 
852
                            <?= gettext("minute (0-59)"); ?><br />
853
                            <input name="pppoe_resetdate" type="text" class="w8em format-m-d-y highlight-days-67" id="pppoe_resetdate" maxlength="10" size="10" value="<?=htmlspecialchars($pconfig['pppoe_resetdate']);?>" /> 
854
                            <?= gettext("reset at a specific date (mm/dd/yyyy)"); ?>
855
                            <br />&nbsp;<br />
856
                            <span class="red"><strong>Note: </strong></span>
857
                            If you leave the date field empty, the reset will be executed each day at the time you did specify using the minutes and hour field.
858
                          </p>
859
                          <?php if ($pconfig['pppoe_pr_preset']): ?>
860
                          <p style="margin: 2px; padding: 4px; width: 94%;" id="pppoepresetwrap">
861
                          <?php else: ?>
862
                          <p style="margin: 2px; padding: 4px; width: 94%; display: none;" id="pppoepresetwrap">
863
                          <?php endif; ?>
864
                            <input name="pppoe_pr_preset_val" type="radio" id="pppoe_monthly" value="monthly" <?php if ($pconfig['pppoe_monthly']) echo "checked=\"checked\""; ?> /> 
865
                            <?= gettext("reset at each month ('0 0 1 * *')"); ?>
866
                            <br />
867
                            <input name="pppoe_pr_preset_val" type="radio" id="pppoe_weekly" value="weekly" <?php if ($pconfig['pppoe_weekly']) echo "checked=\"checked\""; ?> /> 
868
                            <?= gettext("reset at each week ('0 0 * * 0')"); ?>
869
                            <br />
870
                            <input name="pppoe_pr_preset_val" type="radio" id="pppoe_daily" value="daily" <?php if ($pconfig['pppoe_daily']) echo "checked=\"checked\""; ?> /> 
871
                            <?= gettext("reset at each day ('0 0 * * *')"); ?>
872
                            <br />
873
                            <input name="pppoe_pr_preset_val" type="radio" id="pppoe_hourly" value="hourly" <?php if ($pconfig['pppoe_hourly']) echo "checked=\"checked\""; ?> /> 
874
                            <?= gettext("reset at each hour ('0 * * * *')"); ?>
875
                          </p>
876
                        </td>
877
                      </tr>
878
                    </table>
879
                  </td>
880
                </tr>                
881
                <tr>
882
                  <td colspan="2" valign="top" height="16"></td>
883
                </tr>
884
                <tr>
885
                  <td colspan="2" valign="top" class="listtopic">PPTP configuration</td>
886
                </tr>
887
                <tr>
888
                  <td valign="top" class="vncellreq">Username</td>
889
                  <td class="vtable"><input name="pptp_username" type="text" class="formfld" id="pptp_username" size="20" value="<?=htmlspecialchars($pconfig['pptp_username']);?>">
890
                  </td>
891
                </tr>
892
                <tr>
893
                  <td valign="top" class="vncellreq">Password</td>
894
                  <td class="vtable"><input name="pptp_password" type="text" class="formfld" id="pptp_password" size="20" value="<?=htmlspecialchars($pconfig['pptp_password']);?>">
895
                  </td>
896
                </tr>
897
                <tr>
898
                  <td width="100" valign="top" class="vncellreq">Local IP address</td>
899
                  <td class="vtable"> <input name="pptp_local" type="text" class="formfld" id="pptp_local" size="20" value="<?=htmlspecialchars($pconfig['pptp_local']);?>">
900
                    /
901
                    <select name="pptp_subnet" class="formfld" id="pptp_subnet">
902
                      <?php for ($i = 31; $i > 0; $i--): ?>
903
                      <option value="<?=$i;?>" <?php if ($i == $pconfig['pptp_subnet']) echo "selected"; ?>>
904
                      <?=$i;?>
905
                      </option>
906
                      <?php endfor; ?>
907
                    </select></td>
908
                </tr>
909
                <tr>
910
                  <td width="100" valign="top" class="vncellreq">Remote IP address</td>
911
                  <td class="vtable"> <input name="pptp_remote" type="text" class="formfld" id="pptp_remote" size="20" value="<?=htmlspecialchars($pconfig['pptp_remote']);?>">
912
                  </td>
913
                </tr>
914
                <tr>
915
                  <td valign="top" class="vncell">Dial on demand</td>
916
                  <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)" >
917
                    <strong>Enable Dial-On-Demand mode</strong><br>
918
		    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>
919
                </tr>
920
                <tr>
921
                  <td valign="top" class="vncell">Idle timeout</td>
922
                  <td class="vtable">
923
                    <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>
924
                </tr>
925
                <tr>
926
                  <td colspan="2" valign="top" height="16"></td>
927
                </tr>
928
                <tr>
929
                  <td colspan="2" valign="top" class="listtopic">BigPond Cable configuration</td>
930
                </tr>
931
                <tr>
932
                  <td valign="top" class="vncellreq">Username</td>
933
                  <td class="vtable"><input name="bigpond_username" type="text" class="formfld" id="bigpond_username" size="20" value="<?=htmlspecialchars($pconfig['bigpond_username']);?>">
934
                  </td>
935
                </tr>
936
                <tr>
937
                  <td valign="top" class="vncellreq">Password</td>
938
                  <td class="vtable"><input name="bigpond_password" type="text" class="formfld" id="bigpond_password" size="20" value="<?=htmlspecialchars($pconfig['bigpond_password']);?>">
939
                  </td>
940
                </tr>
941
                <tr>
942
                  <td valign="top" class="vncell">Authentication server</td>
943
                  <td class="vtable"><input name="bigpond_authserver" type="text" class="formfld" id="bigpond_authserver" size="20" value="<?=htmlspecialchars($pconfig['bigpond_authserver']);?>">
944
                    <br>
945
                  <span class="vexpl">If this field is left empty, the default (&quot;dce-server&quot;) is used. </span></td>
946
                </tr>
947
                <tr>
948
                  <td valign="top" class="vncell">Authentication domain</td>
949
                  <td class="vtable"><input name="bigpond_authdomain" type="text" class="formfld" id="bigpond_authdomain" size="20" value="<?=htmlspecialchars($pconfig['bigpond_authdomain']);?>">
950
                    <br>
951
                  <span class="vexpl">If this field is left empty, the domain name assigned via DHCP will be used.<br>
952
                  <br>
953
                  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>
954
                </tr>
955
                <tr>
956
                  <td valign="top" class="vncell">Min. heartbeat interval</td>
957
                  <td class="vtable">
958
                    <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>
959
                </tr>
960
                <tr>
961
                  <td colspan="2" valign="top" height="16"></td>
962
                </tr>
963
                <tr>
964
                  <td colspan="2" valign="top" class="listtopic">FTP Helper</td>
965
                </tr>
966
		<tr>
967
			<td width="22%" valign="top" class="vncell">FTP Helper</td>
968
			<td width="78%" class="vtable">
969
				<input name="disableftpproxy" type="checkbox" id="disableftpproxy" value="yes" <?php if ($pconfig['disableftpproxy']) echo "checked"; ?> onclick="enable_change(false)" />
970
				<strong>Disable the userland FTP-Proxy application</strong>
971
				<br />
972
			</td>
973
		</tr>
974
		        <?php
975
				/* Wireless interface? */
976
				if (isset($wancfg['wireless']))
977
					wireless_config_print();
978
			?>
979
                <tr>
980
                  <td height="16" colspan="2" valign="top"></td>
981
                </tr>
982
                <tr>
983
                  <td valign="middle">&nbsp;</td>
984
                  <td class="vtable"><a name="rfc1918"></a> <input name="blockpriv" type="checkbox" id="blockpriv" value="yes" <?php if ($pconfig['blockpriv']) echo "checked"; ?>>
985
                    <strong>Block private networks</strong><br>
986
                    When set, this option blocks traffic from IP addresses that
987
                    are reserved for private<br>
988
                    networks as per RFC 1918 (10/8, 172.16/12, 192.168/16) as
989
                    well as loopback addresses<br>
990
                    (127/8). You should generally leave this option turned on,
991
                    unless your WAN network<br>
992
                    lies in such a private address space, too.</td>
993
                </tr>
994
                <tr>
995
                  <td valign="middle">&nbsp;</td>
996
                  <td class="vtable"> <input name="blockbogons" type="checkbox" id="blockbogons" value="yes" <?php if ($pconfig['blockbogons']) echo "checked"; ?>>
997
                    <strong>Block bogon networks</strong><br>
998
                    When set, this option blocks traffic from IP addresses that
999
                    are reserved (but not RFC 1918) or not yet assigned by IANA.<br>
1000
                    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>
1001
		</tr>
1002

    
1003
                <tr>
1004
                  <td width="100" valign="top">&nbsp;</td>
1005
                  <td> &nbsp;<br> <input name="Submit" type="submit" class="formbtn" value="Save" onClick="enable_change_pptp(true)&&enable_change(true)">
1006
                  </td>
1007
                </tr>
1008
              </table>
1009
</form>
1010
<script language="JavaScript">
1011
<!--
1012
type_change();
1013
//-->
1014
</script>
1015
<?php include("fend.inc"); ?>
1016
</body>
1017
</html>
1018

    
1019

    
1020
<?php
1021

    
1022
if ($_POST) {
1023

    
1024
	if (!$input_errors) {
1025

    
1026
		unlink_if_exists("{$g['tmp_path']}/config.cache");
1027

    
1028
		ob_flush();
1029
		flush();
1030
		sleep(1);
1031

    
1032
		interfaces_wan_configure();
1033

    
1034
		reset_carp();
1035

    
1036
		/* sync filter configuration */
1037
		filter_configure();
1038
	}
1039
}
1040

    
1041
?>
(74-74/171)