Project

General

Profile

Download (46.9 KB) Statistics
| Branch: | Tag: | Revision:
1 e2cd32df Scott Ullrich
<?php
2 b46bfcf5 Bill Marquette
/* $Id$ */
3 5b237745 Scott Ullrich
/*
4
	interfaces_wan.php
5 c3b3cd36 Scott Ullrich
        Copyright (C) 2004 Scott Ullrich
6
	All rights reserved.
7 b1c525ee Scott Ullrich
8 c3b3cd36 Scott Ullrich
	originally part of m0n0wall (http://m0n0.ch/wall)
9 5b237745 Scott Ullrich
	Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
10
	All rights reserved.
11 e2cd32df Scott Ullrich
12 5b237745 Scott Ullrich
	Redistribution and use in source and binary forms, with or without
13
	modification, are permitted provided that the following conditions are met:
14 e2cd32df Scott Ullrich
15 5b237745 Scott Ullrich
	1. Redistributions of source code must retain the above copyright notice,
16
	   this list of conditions and the following disclaimer.
17 e2cd32df Scott Ullrich
18 5b237745 Scott Ullrich
	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 e2cd32df Scott Ullrich
22 5b237745 Scott Ullrich
	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 58af5941 Scott Ullrich
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 8171fcd9 Scott Ullrich
define("CRON_PPPOE_CMD", "#!/bin/sh\necho '<?php require(\"interfaces.inc\"); interfaces_wan_pppoe_restart(); services_dyndns_reset(); ?>' | /usr/local/bin/php -q");
40 58af5941 Scott Ullrich
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 5b237745 Scott Ullrich
require("guiconfig.inc");
70
71
$wancfg = &$config['interfaces']['wan'];
72 8bb29531 Scott Ullrich
$optcfg = &$config['interfaces']['wan'];
73 5b237745 Scott Ullrich
74
$pconfig['username'] = $config['pppoe']['username'];
75
$pconfig['password'] = $config['pppoe']['password'];
76
$pconfig['provider'] = $config['pppoe']['provider'];
77 a23d7248 Scott Ullrich
$pconfig['pppoe_dialondemand'] = isset($config['pppoe']['ondemand']);
78 5b237745 Scott Ullrich
$pconfig['pppoe_idletimeout'] = $config['pppoe']['timeout'];
79
80 58af5941 Scott Ullrich
/* ================================================ */
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 5b237745 Scott Ullrich
$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 a23d7248 Scott Ullrich
$pconfig['pptp_dialondemand'] = isset($config['pptp']['ondemand']);
126 5b237745 Scott Ullrich
$pconfig['pptp_idletimeout'] = $config['pptp']['timeout'];
127
128 c1ec2c2f Scott Ullrich
$pconfig['disableftpproxy'] = isset($wancfg['disableftpproxy']);
129
130 5b237745 Scott Ullrich
$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 588a183b Scott Ullrich
	$pconfig['gateway'] = $config['interfaces']['wan']['gateway'];
151 a23d7248 Scott Ullrich
	$pconfig['pointtopoint'] = $wancfg['pointtopoint'];
152 5b237745 Scott Ullrich
}
153
154
$pconfig['blockpriv'] = isset($wancfg['blockpriv']);
155 ff1955ee Bill Marquette
$pconfig['blockbogons'] = isset($wancfg['blockbogons']);
156 5b237745 Scott Ullrich
$pconfig['spoofmac'] = $wancfg['spoofmac'];
157
$pconfig['mtu'] = $wancfg['mtu'];
158
159
/* Wireless interface? */
160 b7f01f59 Bill Marquette
if (isset($wancfg['wireless'])) {
161 5b237745 Scott Ullrich
	require("interfaces_wlan.inc");
162
	wireless_config_init();
163
}
164
165
if ($_POST) {
166
167
	unset($input_errors);
168
	$pconfig = $_POST;
169 58af5941 Scott Ullrich
  
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 5b237745 Scott Ullrich
185 ee968e4f Scott Ullrich
	if($_POST['gateway'] and $pconfig['gateway'] <> $_POST['gateway']) {
186 6fc5bf35 Scott Ullrich
		/* 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 8bddc5b7 Scott Ullrich
			            if($svr[1] == $pconfig['gateway'])  {
193
			            		$_POST['gateway']  = $pconfig['gateway'];
194 de42a08e Scott Ullrich
			            		$input_errors[] = "Cannot change {$svr[1]} gateway.  It is currently referenced by the load balancer pools.";
195 8bddc5b7 Scott Ullrich
			            }
196 6fc5bf35 Scott Ullrich
					}
197
				}
198 8bddc5b7 Scott Ullrich
			}
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 6fc5bf35 Scott Ullrich
		}
206
	}
207
208 5b237745 Scott Ullrich
	/* 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 e2cd32df Scott Ullrich
237 4f3401e0 Bill Marquette
        /* normalize MAC addresses - lowercase and convert Windows-ized hyphenated MACs to colon delimited */
238
        $_POST['spoofmac'] = strtolower(str_replace("-", ":", $_POST['spoofmac']));
239
240 5b237745 Scott Ullrich
	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 a23d7248 Scott Ullrich
	if (($_POST['pointtopoint'] && !is_ipaddr($_POST['pointtopoint']))) {
250
		$input_errors[] = "A valid point-to-point IP address must be specified.";
251
	}
252 5b237745 Scott Ullrich
	if (($_POST['provider'] && !is_domain($_POST['provider']))) {
253
		$input_errors[] = "The service name contains invalid characters.";
254
	}
255 a23d7248 Scott Ullrich
	if (($_POST['pppoe_idletimeout'] != "") && !is_numericint($_POST['pppoe_idletimeout'])) {
256 5b237745 Scott Ullrich
		$input_errors[] = "The idle timeout value must be an integer.";
257
	}
258 58af5941 Scott Ullrich
  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 5b237745 Scott Ullrich
	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 a23d7248 Scott Ullrich
	if (($_POST['pptp_idletimeout'] != "") && !is_numericint($_POST['pptp_idletimeout'])) {
283 5b237745 Scott Ullrich
		$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 e2cd32df Scott Ullrich
301 5b237745 Scott Ullrich
	/* Wireless interface? */
302 b7f01f59 Bill Marquette
	if (isset($wancfg['wireless'])) {
303 5b237745 Scott Ullrich
		$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 e2cd32df Scott Ullrich
311 9a6757a1 Scott Ullrich
		$bridge = discover_bridge($wancfg['if'], filter_translate_type_to_real_interface($wancfg['bridge']));
312 0d429e43 Scott Ullrich
		if($bridge <> "-1") {
313 1665e79c Scott Ullrich
			destroy_bridge($bridge);
314 91e8aab2 Scott Ullrich
		}
315 b1c525ee Scott Ullrich
316 5b237745 Scott Ullrich
		unset($wancfg['ipaddr']);
317
		unset($wancfg['subnet']);
318 588a183b Scott Ullrich
		unset($config['interfaces']['wan']['gateway']);
319 a23d7248 Scott Ullrich
		unset($wancfg['pointtopoint']);
320 5b237745 Scott Ullrich
		unset($wancfg['dhcphostname']);
321 58af5941 Scott Ullrich
    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 5b237745 Scott Ullrich
		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 c1ec2c2f Scott Ullrich
		unset($wancfg['disableftpproxy']);
344 b1c525ee Scott Ullrich
345 c1ec2c2f Scott Ullrich
		/* per interface pftpx helper */
346
		if($_POST['disableftpproxy'] == "yes") {
347
			$wancfg['disableftpproxy'] = true;
348
			system_start_ftp_helpers();
349 b1c525ee Scott Ullrich
		} else {
350 c1ec2c2f Scott Ullrich
			system_start_ftp_helpers();
351
		}
352 e2cd32df Scott Ullrich
353 5b237745 Scott Ullrich
		if ($_POST['type'] == "Static") {
354
			$wancfg['ipaddr'] = $_POST['ipaddr'];
355
			$wancfg['subnet'] = $_POST['subnet'];
356 588a183b Scott Ullrich
			$config['interfaces']['wan']['gateway'] = $_POST['gateway'];
357 a23d7248 Scott Ullrich
			if (isset($wancfg['ispointtopoint']))
358
				$wancfg['pointtopoint'] = $_POST['pointtopoint'];
359 5b237745 Scott Ullrich
		} 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 a23d7248 Scott Ullrich
			$config['pppoe']['ondemand'] = $_POST['pppoe_dialondemand'] ? true : false;
368 5b237745 Scott Ullrich
			$config['pppoe']['timeout'] = $_POST['pppoe_idletimeout'];
369 58af5941 Scott Ullrich
      
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 5b237745 Scott Ullrich
		} 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 a23d7248 Scott Ullrich
			$config['pptp']['ondemand'] = $_POST['pptp_dialondemand'] ? true : false;
461 5b237745 Scott Ullrich
			$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 58af5941 Scott Ullrich
    
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 e2cd32df Scott Ullrich
480 90ebf755 Scott Ullrich
		if($_POST['blockpriv'] == "yes")
481
			$wancfg['blockpriv'] = true;
482
		else
483 42a58cb9 Scott Ullrich
			unset($wancfg['blockpriv']);
484 b1c525ee Scott Ullrich
485 90ebf755 Scott Ullrich
		if($_POST['blockbogons'] == "yes")
486
			$wancfg['blockbogons'] = true;
487
		else
488
			unset($wancfg['blockbogons']);
489 b1c525ee Scott Ullrich
490 5b237745 Scott Ullrich
		$wancfg['spoofmac'] = $_POST['spoofmac'];
491
		$wancfg['mtu'] = $_POST['mtu'];
492 e2cd32df Scott Ullrich
493 5b237745 Scott Ullrich
		write_config();
494 58af5941 Scott Ullrich
    
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 e2cd32df Scott Ullrich
513 5b237745 Scott Ullrich
		$retval = 0;
514 11a4b1a0 Scott Ullrich
515 824edb6c Scott Ullrich
		$savemsg = get_std_save_message($retval);
516 5b237745 Scott Ullrich
	}
517
}
518 7f43ca88 Scott Ullrich
519
$pgtitle = "Interfaces: WAN";
520 58af5941 Scott Ullrich
$closehead = false;
521 7f43ca88 Scott Ullrich
include("head.inc");
522
523 5b237745 Scott Ullrich
?>
524 7f43ca88 Scott Ullrich
525 58af5941 Scott Ullrich
<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 5b237745 Scott Ullrich
<!--
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 58af5941 Scott Ullrich
      document.iform.pppoe_preset.disabled = 1;
563
      document.iform.pppoe_preset.checked = 0;
564
      Effect.Fade('presetwrap', { duration: 1.0 });
565 5b237745 Scott Ullrich
			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 58af5941 Scott Ullrich
      document.iform.pppoe_preset.disabled = 1;
589
      document.iform.pppoe_preset.checked = 0;
590
      Effect.Fade('presetwrap', { duration: 1.0 });
591 5b237745 Scott Ullrich
			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 58af5941 Scott Ullrich
      document.iform.pppoe_preset.disabled = 0;
619 5b237745 Scott Ullrich
			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 58af5941 Scott Ullrich
      document.iform.pppoe_preset.disabled = 1;
643
      document.iform.pppoe_preset.checked = 0;
644
      Effect.Fade('presetwrap', { duration: 1.0 });			
645 5b237745 Scott Ullrich
			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 58af5941 Scott Ullrich
      document.iform.pppoe_preset.disabled = 1;
673
      document.iform.pppoe_preset.checked = 0;
674
      Effect.Fade('presetwrap', { duration: 1.0 });
675 5b237745 Scott Ullrich
			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 58af5941 Scott Ullrich
</head>
697 5b237745 Scott Ullrich
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
698
<?php include("fbegin.inc"); ?>
699 931066a8 Bill Marquette
<p class="pgtitle"><?=$pgtitle?></p>
700 5b237745 Scott Ullrich
<?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 e2cd32df Scott Ullrich
                <tr>
705 8fdc8744 Bill Marquette
                  <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 5b237745 Scott Ullrich
                      <?php $opts = split(" ", "Static DHCP PPPoE PPTP BigPond");
711
				foreach ($opts as $opt): ?>
712 e2cd32df Scott Ullrich
                      <option <?php if ($opt == $pconfig['type']) echo "selected";?>>
713 5b237745 Scott Ullrich
                      <?=htmlspecialchars($opt);?>
714
                      </option>
715
                      <?php endforeach; ?>
716
                    </select></td>
717
                </tr>
718 e2cd32df Scott Ullrich
                <tr>
719 5b237745 Scott Ullrich
                  <td valign="top" class="vncell">MAC address</td>
720 e2cd32df Scott Ullrich
                  <td class="vtable"> <input name="spoofmac" type="text" class="formfld" id="spoofmac" size="30" value="<?=htmlspecialchars($pconfig['spoofmac']);?>">
721 1e694bee Scott Ullrich
		    <?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 b1c525ee Scott Ullrich
		    <a OnClick="document.forms[0].spoofmac.value='<?=$mac?>';" href="#">Copy my MAC address</a>
727 1e694bee Scott Ullrich
		    <br>
728 e2cd32df Scott Ullrich
                    This field can be used to modify (&quot;spoof&quot;) the MAC
729 5b237745 Scott Ullrich
                    address of the WAN interface<br>
730
                    (may be required with some cable connections)<br>
731 e2cd32df Scott Ullrich
                    Enter a MAC address in the following format: xx:xx:xx:xx:xx:xx
732 5b237745 Scott Ullrich
                    or leave blank</td>
733
                </tr>
734 e2cd32df Scott Ullrich
                <tr>
735 5b237745 Scott Ullrich
                  <td valign="top" class="vncell">MTU</td>
736 e2cd32df Scott Ullrich
                  <td class="vtable"> <input name="mtu" type="text" class="formfld" id="mtu" size="8" value="<?=htmlspecialchars($pconfig['mtu']);?>">
737 5b237745 Scott Ullrich
                    <br>
738 e2cd32df Scott Ullrich
                    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 5b237745 Scott Ullrich
                    connection types will be assumed.</td>
743
                </tr>
744 e2cd32df Scott Ullrich
                <tr>
745 5b237745 Scott Ullrich
                  <td colspan="2" valign="top" height="16"></td>
746
                </tr>
747 e2cd32df Scott Ullrich
                <tr>
748 a23d7248 Scott Ullrich
                  <td colspan="2" valign="top" class="listtopic">Static IP configuration</td>
749 5b237745 Scott Ullrich
                </tr>
750 e2cd32df Scott Ullrich
                <tr>
751 5b237745 Scott Ullrich
                  <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 e2cd32df Scott Ullrich
                    /
754 5b237745 Scott Ullrich
                    <select name="subnet" class="formfld" id="subnet">
755 fa3b333d Scott Ullrich
			<?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 5b237745 Scott Ullrich
                    </select></td>
765 a23d7248 Scott Ullrich
                </tr><?php if (isset($wancfg['ispointtopoint'])): ?>
766 7f5b4824 Scott Ullrich
                <tr>
767 a23d7248 Scott Ullrich
                  <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 e2cd32df Scott Ullrich
                <tr>
773 5b237745 Scott Ullrich
                  <td valign="top" class="vncellreq">Gateway</td>
774 e2cd32df Scott Ullrich
                  <td class="vtable"> <input name="gateway" type="text" class="formfld" id="gateway" size="20" value="<?=htmlspecialchars($pconfig['gateway']);?>">
775 5b237745 Scott Ullrich
                  </td>
776
                </tr>
777 e2cd32df Scott Ullrich
                <tr>
778 73c38fa2 Scott Ullrich
                  <td colspan="2" valign="top" height="16"></td>
779
                </tr>
780 e2cd32df Scott Ullrich
                <tr>
781 a23d7248 Scott Ullrich
                  <td colspan="2" valign="top" class="listtopic">DHCP client configuration</td>
782 5b237745 Scott Ullrich
                </tr>
783 e2cd32df Scott Ullrich
                <tr>
784 5b237745 Scott Ullrich
                  <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 e2cd32df Scott Ullrich
                    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 5b237745 Scott Ullrich
                    this (for client identification).</td>
790
                </tr>
791 e2cd32df Scott Ullrich
                <tr>
792 5b237745 Scott Ullrich
                  <td colspan="2" valign="top" height="16"></td>
793
                </tr>
794 e2cd32df Scott Ullrich
                <tr>
795 a23d7248 Scott Ullrich
                  <td colspan="2" valign="top" class="listtopic">PPPoE configuration</td>
796 5b237745 Scott Ullrich
                </tr>
797 e2cd32df Scott Ullrich
                <tr>
798 5b237745 Scott Ullrich
                  <td valign="top" class="vncellreq">Username</td>
799 e2cd32df Scott Ullrich
                  <td class="vtable"><input name="username" type="text" class="formfld" id="username" size="20" value="<?=htmlspecialchars($pconfig['username']);?>">
800 5b237745 Scott Ullrich
                  </td>
801
                </tr>
802 e2cd32df Scott Ullrich
                <tr>
803 5b237745 Scott Ullrich
                  <td valign="top" class="vncellreq">Password</td>
804 e2cd32df Scott Ullrich
                  <td class="vtable"><input name="password" type="text" class="formfld" id="password" size="20" value="<?=htmlspecialchars($pconfig['password']);?>">
805 5b237745 Scott Ullrich
                  </td>
806
                </tr>
807 e2cd32df Scott Ullrich
                <tr>
808 5b237745 Scott Ullrich
                  <td valign="top" class="vncell">Service name</td>
809 e2cd32df Scott Ullrich
                  <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 5b237745 Scott Ullrich
                    empty</span></td>
812
                </tr>
813 e2cd32df Scott Ullrich
                <tr>
814 5b237745 Scott Ullrich
                  <td valign="top" class="vncell">Dial on demand</td>
815 e2cd32df Scott Ullrich
                  <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 5b237745 Scott Ullrich
                    <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 fa3b333d Scott Ullrich
                    <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 5b237745 Scott Ullrich
                </tr>
824 58af5941 Scott Ullrich
                <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 e2cd32df Scott Ullrich
                <tr>
882 5b237745 Scott Ullrich
                  <td colspan="2" valign="top" height="16"></td>
883
                </tr>
884 e2cd32df Scott Ullrich
                <tr>
885 a23d7248 Scott Ullrich
                  <td colspan="2" valign="top" class="listtopic">PPTP configuration</td>
886 5b237745 Scott Ullrich
                </tr>
887 e2cd32df Scott Ullrich
                <tr>
888 5b237745 Scott Ullrich
                  <td valign="top" class="vncellreq">Username</td>
889 e2cd32df Scott Ullrich
                  <td class="vtable"><input name="pptp_username" type="text" class="formfld" id="pptp_username" size="20" value="<?=htmlspecialchars($pconfig['pptp_username']);?>">
890 5b237745 Scott Ullrich
                  </td>
891
                </tr>
892 e2cd32df Scott Ullrich
                <tr>
893 5b237745 Scott Ullrich
                  <td valign="top" class="vncellreq">Password</td>
894 e2cd32df Scott Ullrich
                  <td class="vtable"><input name="pptp_password" type="text" class="formfld" id="pptp_password" size="20" value="<?=htmlspecialchars($pconfig['pptp_password']);?>">
895 5b237745 Scott Ullrich
                  </td>
896
                </tr>
897 e2cd32df Scott Ullrich
                <tr>
898 5b237745 Scott Ullrich
                  <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 e2cd32df Scott Ullrich
                    /
901 5b237745 Scott Ullrich
                    <select name="pptp_subnet" class="formfld" id="pptp_subnet">
902 a23d7248 Scott Ullrich
                      <?php for ($i = 31; $i > 0; $i--): ?>
903 e2cd32df Scott Ullrich
                      <option value="<?=$i;?>" <?php if ($i == $pconfig['pptp_subnet']) echo "selected"; ?>>
904 5b237745 Scott Ullrich
                      <?=$i;?>
905
                      </option>
906
                      <?php endfor; ?>
907
                    </select></td>
908
                </tr>
909 e2cd32df Scott Ullrich
                <tr>
910 5b237745 Scott Ullrich
                  <td width="100" valign="top" class="vncellreq">Remote IP address</td>
911 e2cd32df Scott Ullrich
                  <td class="vtable"> <input name="pptp_remote" type="text" class="formfld" id="pptp_remote" size="20" value="<?=htmlspecialchars($pconfig['pptp_remote']);?>">
912 5b237745 Scott Ullrich
                  </td>
913
                </tr>
914 e2cd32df Scott Ullrich
                <tr>
915 5b237745 Scott Ullrich
                  <td valign="top" class="vncell">Dial on demand</td>
916 e2cd32df Scott Ullrich
                  <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 5b237745 Scott Ullrich
                    <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 fa3b333d Scott Ullrich
                    <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 5b237745 Scott Ullrich
                </tr>
925 e2cd32df Scott Ullrich
                <tr>
926 5b237745 Scott Ullrich
                  <td colspan="2" valign="top" height="16"></td>
927
                </tr>
928 e2cd32df Scott Ullrich
                <tr>
929 a23d7248 Scott Ullrich
                  <td colspan="2" valign="top" class="listtopic">BigPond Cable configuration</td>
930 5b237745 Scott Ullrich
                </tr>
931 e2cd32df Scott Ullrich
                <tr>
932 5b237745 Scott Ullrich
                  <td valign="top" class="vncellreq">Username</td>
933 e2cd32df Scott Ullrich
                  <td class="vtable"><input name="bigpond_username" type="text" class="formfld" id="bigpond_username" size="20" value="<?=htmlspecialchars($pconfig['bigpond_username']);?>">
934 5b237745 Scott Ullrich
                  </td>
935
                </tr>
936 e2cd32df Scott Ullrich
                <tr>
937 5b237745 Scott Ullrich
                  <td valign="top" class="vncellreq">Password</td>
938 e2cd32df Scott Ullrich
                  <td class="vtable"><input name="bigpond_password" type="text" class="formfld" id="bigpond_password" size="20" value="<?=htmlspecialchars($pconfig['bigpond_password']);?>">
939 5b237745 Scott Ullrich
                  </td>
940
                </tr>
941 e2cd32df Scott Ullrich
                <tr>
942 5b237745 Scott Ullrich
                  <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 e2cd32df Scott Ullrich
                <tr>
948 5b237745 Scott Ullrich
                  <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 fa3b333d Scott Ullrich
                    <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 5b237745 Scott Ullrich
                </tr>
960 da56c4d7 Scott Ullrich
                <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 b1c525ee Scott Ullrich
                </tr>
966 da56c4d7 Scott Ullrich
		<tr>
967
			<td width="22%" valign="top" class="vncell">FTP Helper</td>
968
			<td width="78%" class="vtable">
969 0135299b Scott Ullrich
				<input name="disableftpproxy" type="checkbox" id="disableftpproxy" value="yes" <?php if ($pconfig['disableftpproxy']) echo "checked"; ?> onclick="enable_change(false)" />
970 da56c4d7 Scott Ullrich
				<strong>Disable the userland FTP-Proxy application</strong>
971
				<br />
972
			</td>
973
		</tr>
974 fa3b333d Scott Ullrich
		        <?php
975
				/* Wireless interface? */
976 b7f01f59 Bill Marquette
				if (isset($wancfg['wireless']))
977 5b237745 Scott Ullrich
					wireless_config_print();
978 fa3b333d Scott Ullrich
			?>
979 e2cd32df Scott Ullrich
                <tr>
980 5b237745 Scott Ullrich
                  <td height="16" colspan="2" valign="top"></td>
981
                </tr>
982 e2cd32df Scott Ullrich
                <tr>
983 5b237745 Scott Ullrich
                  <td valign="middle">&nbsp;</td>
984 d9eeccbd Scott Ullrich
                  <td class="vtable"><a name="rfc1918"></a> <input name="blockpriv" type="checkbox" id="blockpriv" value="yes" <?php if ($pconfig['blockpriv']) echo "checked"; ?>>
985 5b237745 Scott Ullrich
                    <strong>Block private networks</strong><br>
986 e2cd32df Scott Ullrich
                    When set, this option blocks traffic from IP addresses that
987 5b237745 Scott Ullrich
                    are reserved for private<br>
988 e2cd32df Scott Ullrich
                    networks as per RFC 1918 (10/8, 172.16/12, 192.168/16) as
989 5b237745 Scott Ullrich
                    well as loopback addresses<br>
990 e2cd32df Scott Ullrich
                    (127/8). You should generally leave this option turned on,
991 5b237745 Scott Ullrich
                    unless your WAN network<br>
992
                    lies in such a private address space, too.</td>
993
                </tr>
994 ff1955ee Bill Marquette
                <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 c1ec2c2f Scott Ullrich
		</tr>
1002 b1c525ee Scott Ullrich
1003 e2cd32df Scott Ullrich
                <tr>
1004 5b237745 Scott Ullrich
                  <td width="100" valign="top">&nbsp;</td>
1005 e2cd32df Scott Ullrich
                  <td> &nbsp;<br> <input name="Submit" type="submit" class="formbtn" value="Save" onClick="enable_change_pptp(true)&&enable_change(true)">
1006 5b237745 Scott Ullrich
                  </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 e4e8c30f Scott Ullrich
1019
1020
<?php
1021
1022
if ($_POST) {
1023
1024
	if (!$input_errors) {
1025 b1c525ee Scott Ullrich
1026
		unlink_if_exists("{$g['tmp_path']}/config.cache");
1027
1028 2e70a096 Scott Ullrich
		ob_flush();
1029
		flush();
1030 b1c525ee Scott Ullrich
		sleep(1);
1031
1032 e4e8c30f Scott Ullrich
		interfaces_wan_configure();
1033 b1c525ee Scott Ullrich
1034 610b1136 Scott Ullrich
		reset_carp();
1035 b1c525ee Scott Ullrich
1036 e4e8c30f Scott Ullrich
		/* sync filter configuration */
1037
		filter_configure();
1038
	}
1039
}
1040
1041 ba3538dc Daniel Stefan Haischt
?>