Skip to content

Instantly share code, notes, and snippets.

@rbgarga
Created November 20, 2013 19:07
Show Gist options
  • Save rbgarga/7569050 to your computer and use it in GitHub Desktop.
Save rbgarga/7569050 to your computer and use it in GitHub Desktop.
diff --git a/etc/inc/filter.inc b/etc/inc/filter.inc
index 1fcd2f1..8e430e8 100644
--- a/etc/inc/filter.inc
+++ b/etc/inc/filter.inc
@@ -2954,7 +2954,10 @@ EOD;
$ipfrules .= "pass out route-to ( {$ifcfg['if']} {$gw} ) from {$ifcfg['ip']} to !{$ifcfg['sa']}/{$ifcfg['sn']} keep state allow-opts label \"let out anything from firewall host itself\"\n";
if (is_array($ifcfg['vips'])) {
foreach ($ifcfg['vips'] as $vip)
- $ipfrules .= "pass out route-to ( {$ifcfg['if']} {$gw} ) from {$vip['ip']} to !{$vip['ip']}/{$vip['sn']} keep state allow-opts label \"let out anything from firewall host itself\"\n";
+ if (ip_in_subnet($vip['ip'], "{$ifcfg['sa']}/{$ifcfg['sn']}"))
+ $ipfrules .= "pass out route-to ( {$ifcfg['if']} {$gw} ) from {$vip['ip']} to !{$ifcfg['sa']}/{$ifcfg['sn']} keep state allow-opts label \"let out anything from firewall host itself\"\n";
+ else
+ $ipfrules .= "pass out route-to ( {$ifcfg['if']} {$gw} ) from {$vip['ip']} to !" . gen_subnet($vip['ip'], $vip['sn']) . "/{$vip['sn']} keep state allow-opts label \"let out anything from firewall host itself\"\n";
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment