diff options
author | Ermal <eri@pfsense.org> | 2010-07-22 23:16:24 +0000 |
---|---|---|
committer | Ermal <eri@pfsense.org> | 2010-07-22 23:16:24 +0000 |
commit | d6a0379d291f5e98500776618559343f40254e40 (patch) | |
tree | 41d3c8f6a095bdef787994625b2d01c0b994c72b | |
parent | d2ff48a06df5edbcd786994a77f28c7997974a0f (diff) | |
download | pfsense-d6a0379d291f5e98500776618559343f40254e40.zip pfsense-d6a0379d291f5e98500776618559343f40254e40.tar.gz |
Add a subnet option to allowed ip addresses on CP.
-rw-r--r-- | etc/inc/captiveportal.inc | 7 | ||||
-rwxr-xr-x | usr/local/www/services_captiveportal_ip.php | 6 | ||||
-rwxr-xr-x | usr/local/www/services_captiveportal_ip_edit.php | 11 |
3 files changed, 22 insertions, 2 deletions
diff --git a/etc/inc/captiveportal.inc b/etc/inc/captiveportal.inc index bc1596e..0d3853b 100644 --- a/etc/inc/captiveportal.inc +++ b/etc/inc/captiveportal.inc @@ -886,14 +886,17 @@ function captiveportal_allowedip_configure_entry($ipent) { $bw_up = $ruleno + 20000; $rules .= "pipe {$bw_up} config bw {$ipent['bw_up']}Kbit/s queue 100\n"; } + $subnet = ""; + if (!empty($ipent['sn'])) + $subnet = "/{$ipent['sn']}"; foreach ($tablein as $table) - $rules .= "table {$table} add {$ipent['ip']} {$bw_up}\n"; + $rules .= "table {$table} add {$ipent['ip']}{$subnet} {$bw_up}\n"; if ($enBwdown) { $bw_down = $ruleno + 20001; $rules .= "pipe {$bw_down} config bw {$ipent['bw_down']}Kbit/s queue 100\n"; } foreach ($tableout as $table) - $rules .= "table {$table} add {$ipent['ip']} {$bw_down}\n"; + $rules .= "table {$table} add {$ipent['ip']}{$subnet} {$bw_down}\n"; return $rules; } diff --git a/usr/local/www/services_captiveportal_ip.php b/usr/local/www/services_captiveportal_ip.php index 29acb1c..1979519 100755 --- a/usr/local/www/services_captiveportal_ip.php +++ b/usr/local/www/services_captiveportal_ip.php @@ -59,10 +59,16 @@ if ($_GET['act'] == "del") { $ipent = $a_allowedips[$_GET['id']]; if (isset($config['captiveportal']['enable'])) { + if (!empty($ipent['sn'])) + $ipent['ip'] .= "/{$ipent['sn']}"; mwexec("/sbin/ipfw table 3 delete " . $ipent['ip']); mwexec("/sbin/ipfw table 4 delete " . $ipent['ip']); mwexec("/sbin/ipfw table 5 delete " . $ipent['ip']); mwexec("/sbin/ipfw table 6 delete " . $ipent['ip']); + mwexec("/sbin/ipfw table 7 delete " . $ipent['ip']); + mwexec("/sbin/ipfw table 8 delete " . $ipent['ip']); + mwexec("/sbin/ipfw table 9 delete " . $ipent['ip']); + mwexec("/sbin/ipfw table 10 delete " . $ipent['ip']); } unset($a_allowedips[$_GET['id']]); diff --git a/usr/local/www/services_captiveportal_ip_edit.php b/usr/local/www/services_captiveportal_ip_edit.php index 419327d..633900d 100755 --- a/usr/local/www/services_captiveportal_ip_edit.php +++ b/usr/local/www/services_captiveportal_ip_edit.php @@ -70,6 +70,7 @@ if (isset($_POST['id'])) if (isset($id) && $a_allowedips[$id]) { $pconfig['ip'] = $a_allowedips[$id]['ip']; + $pconfig['sn'] = $a_allowedips[$id]['sn']; $pconfig['dir'] = $a_allowedips[$id]['dir']; $pconfig['bw_up'] = $a_allowedips[$id]['bw_up']; $pconfig['bw_down'] = $a_allowedips[$id]['bw_down']; @@ -108,6 +109,7 @@ if ($_POST) { if (!$input_errors) { $ip = array(); $ip['ip'] = $_POST['ip']; + $ip['sn'] = $_POST['sn']; $ip['dir'] = $_POST['dir']; $ip['descr'] = $_POST['descr']; if ($_POST['bw_up']) @@ -116,9 +118,13 @@ if ($_POST) { $ip['bw_down'] = $_POST['bw_down']; if (isset($id) && $a_allowedips[$id]) { $oldip = $a_allowedips[$id]['ip']; + if (!empty($a_allowedips[$id]['sn'])) + $oldip .= "/{$a_allowedips[$id]['sn']}"; $a_allowedips[$id] = $ip; } else { $oldip = $ip['ip']; + if (!empty($$ip['sn'])) + $oldip .= "/{$$ip['sn']}"; $a_allowedips[] = $ip; } allowedips_sort(); @@ -168,6 +174,11 @@ include("head.inc"); <td width="22%" valign="top" class="vncellreq">IP address</td> <td width="78%" class="vtable"> <?=$mandfldhtml;?><input name="ip" type="text" class="formfld unknown" id="ip" size="17" value="<?=htmlspecialchars($pconfig['ip']);?>"> + <select name='sn' class="formselect" id='sn'> + <?php for ($i = 32; $i >= 1; $i--): ?> + <option value="<?=$i;?>" <?php if ($i == $pconfig['sn']) echo "selected"; ?>><?=$i;?></option> + <?php endfor; ?> + </select> <br> <span class="vexpl">IP address</span></td> </tr> |