Project

General

Profile

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

    
514
		$retval = 0;
515

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

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

    
524
?>
525

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

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

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

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

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

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

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

    
1020

    
1021
<?php
1022

    
1023
if ($_POST) {
1024

    
1025
	if (!$input_errors) {
1026

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

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

    
1033
		interfaces_wan_configure();
1034

    
1035
		reset_carp();
1036

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

    
1040
 		/* set up static routes */
1041
		system_routing_configure();
1042

    
1043
	}
1044
}
1045

    
1046
?>
(69-69/173)