summaryrefslogtreecommitdiffstats
path: root/etc/rc.update_urltables
diff options
context:
space:
mode:
authorRenato Botelho <garga@FreeBSD.org>2013-07-08 12:38:27 -0300
committerRenato Botelho <garga@FreeBSD.org>2013-07-08 12:38:37 -0300
commitdd042c5159fb61ccb1a9b3867b18263685703b7b (patch)
tree070118ecc373e61437cadd6d52a738ab3c03e1ed /etc/rc.update_urltables
parentff6c98526e026b634f3d1c89163bf850bdd7a2ba (diff)
downloadpfsense-dd042c5159fb61ccb1a9b3867b18263685703b7b.zip
pfsense-dd042c5159fb61ccb1a9b3867b18263685703b7b.tar.gz
Implement URL Table aliases for ports instead of IP addresses
Diffstat (limited to 'etc/rc.update_urltables')
-rwxr-xr-xetc/rc.update_urltables15
1 files changed, 12 insertions, 3 deletions
diff --git a/etc/rc.update_urltables b/etc/rc.update_urltables
index fcb60d3..89d4542 100755
--- a/etc/rc.update_urltables
+++ b/etc/rc.update_urltables
@@ -12,8 +12,9 @@ if (!is_array($config['aliases']['alias'])) {
// Gather list of urltable aliases
$todo = array();
foreach ($config['aliases']['alias'] as $alias) {
- if ($alias['type'] == 'urltable') {
+ if (preg_match('/urltable/i', $alias['type'])) {
$tmp = array();
+ $tmp['type'] = $alias['type'];
$tmp['name'] = $alias['name'];
$tmp['url'] = $alias['url'];
$tmp['freq'] = $alias['updatefreq'];
@@ -33,11 +34,16 @@ if (count($todo) > 0) {
log_error("{$argv[0]}: Starting URL table alias updates");
+ $filter_reload = false;
foreach ($todo as $t) {
$r = process_alias_urltable($t['name'], $t['url'], $t['freq']);
if ($r == 1) {
$result = "";
- exec("/sbin/pfctl -t " . escapeshellarg($t['name']) . " -T replace -f /var/db/aliastables/" . escapeshellarg($t['name']) . ".txt 2>&1", $result);
+ // TODO: Change it when pf supports tables with ports
+ if ($t['type'] == "urltable")
+ exec("/sbin/pfctl -t " . escapeshellarg($t['name']) . " -T replace -f /var/db/aliastables/" . escapeshellarg($t['name']) . ".txt 2>&1", $result);
+ else
+ $filter_reload = true;
log_error("{$argv[0]}: Updated {$t['name']} content from {$t['url']}: {$result[0]}");
} elseif ($r == -1) {
log_error("{$argv[0]}: {$t['name']} does not need updated.");
@@ -45,5 +51,8 @@ if (count($todo) > 0) {
log_error("{$argv[0]}: ERROR: could not update {$t['name']} content from {$t['url']}");
}
}
+
+ if ($filter_reload)
+ send_event("filter reload");
}
-?> \ No newline at end of file
+?>
OpenPOWER on IntegriCloud