Add bogons update frequency selection

This commit is contained in:
bcyrill 2013-01-06 23:59:54 +01:00
parent 149ed85efb
commit 6b4480dc84
3 changed files with 40 additions and 0 deletions

View File

@ -194,6 +194,9 @@
<disablelargereceiveoffloading/>
<ipv6allow/>
<powerd_mode>hadp</powerd_mode>
<bogons>
<interval>monthly</interval>
</bogons>
</system>
<interfaces>
<wan>

View File

@ -2619,6 +2619,8 @@ $types6 = array("none" => gettext("None"), "staticv6" => gettext("Static IPv6"),
"(but not RFC 1918) or not yet assigned by IANA."); ?>&nbsp;&nbsp;
<?=gettext("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."); ?>
<br/><br/>
<?=gettext("Note: The update frequency can be changed under System->Advanced Firewall/NAT settings.")?>
</td>
</tr>
</table> <!-- End "allcfg" table -->

View File

@ -59,6 +59,7 @@ $pconfig['maximumtables'] = $config['system']['maximumtables'];
$pconfig['maximumtableentries'] = $config['system']['maximumtableentries'];
$pconfig['disablereplyto'] = isset($config['system']['disablereplyto']);
$pconfig['disablenegate'] = isset($config['system']['disablenegate']);
$pconfig['bogonsinterval'] = $config['system']['bogons']['interval'];
$pconfig['disablenatreflection'] = $config['system']['disablenatreflection'];
$pconfig['enablebinatreflection'] = $config['system']['enablebinatreflection'];
$pconfig['reflectiontimeout'] = $config['system']['reflectiontimeout'];
@ -170,6 +171,22 @@ if ($_POST) {
$config['system']['tftpinterface'] = implode(",", $_POST['tftpinterface']);
else
unset($config['system']['tftpinterface']);
if ($_POST['bogonsinterval'] != $config['system']['bogons']['interval']) {
switch ($_POST['bogonsinterval']) {
case 'daily':
install_cron_job("/usr/bin/nice -n20 /etc/rc.update_bogons.sh", true, "1", "3", "*", "*", "*");
break;
case 'weekly':
install_cron_job("/usr/bin/nice -n20 /etc/rc.update_bogons.sh", true, "1", "3", "*", "*", "1");
break;
case 'monthly':
// fall through
default:
install_cron_job("/usr/bin/nice -n20 /etc/rc.update_bogons.sh", true, "1", "3", "1", "*", "*");
}
$config['system']['bogons']['interval'] = $_POST['bogonsinterval'];
}
write_config();
@ -392,6 +409,24 @@ function update_description(itemnum) {
<tr>
<td colspan="2" class="list" height="12">&nbsp;</td>
</tr>
<tr>
<td colspan="2" valign="top" class="listtopic"><?=gettext("Bogon Networks");?></td>
</tr>
<tr>
<td width="22%" valign="top" class="vncell"><?=gettext("Update Frequency");?></td>
<td width="78%" class="vtable">
<select name="bogonsinterval" class="formselect">
<option value="monthly" <?php if (empty($pconfig['bogonsinterval']) || $pconfig['bogonsinterval'] == 'monthly') echo "selected"; ?>><?=gettext("Monthly"); ?></option>
<option value="weekly" <?php if ($pconfig['bogonsinterval'] == 'weekly') echo "selected"; ?>><?=gettext("Weekly"); ?></option>
<option value="daily" <?php if ($pconfig['bogonsinterval'] == 'daily') echo "selected"; ?>><?=gettext("Daily"); ?></option>
</select>
<br/>
<?=gettext("The frequency of updating the lists of IP addresses that are reserved (but not RFC 1918) or not yet assigned by IANA.");?>
</td>
</tr>
<tr>
<td colspan="2" class="list" height="12">&nbsp;</td>
</tr>
<?php if(count($config['interfaces']) > 1): ?>
<tr>
<td colspan="2" valign="top" class="listtopic"><?=gettext("Network Address Translation");?></td>