From 32d60bd2f26e3344fdba55137b10e162d95735e4 Mon Sep 17 00:00:00 2001 From: Scott Ullrich Date: Thu, 24 Feb 2005 19:24:25 +0000 Subject: * Continue wrapping interfaces around () * Convert $wanif variables to pf macro "wan" * Convert $lanif variables to pf macro "lan" --- etc/inc/filter.inc | 98 +++++++++++++++++++++++++++--------------------------- 1 file changed, 49 insertions(+), 49 deletions(-) diff --git a/etc/inc/filter.inc b/etc/inc/filter.inc index 7322b81..dbaeea4 100644 --- a/etc/inc/filter.inc +++ b/etc/inc/filter.inc @@ -783,12 +783,12 @@ function filter_nat_rules_generate() { } if(!isset($config['system']['disableftpproxy'])) - $natrules .= "rdr on " . $lanif . " proto tcp from any to any port 21 -> 127.0.0.1 port 8021\n"; + $natrules .= "rdr on lan proto tcp from any to any port 21 -> 127.0.0.1 port 8021\n"; /* DIAG: add ipv6 NAT, if requested */ if (isset($config['diag']['ipv6nat']['enable'])) { - $natrules .= "rdr on $wanif proto ipv6 from any to any port 0 -> " . + $natrules .= "rdr on wan proto ipv6 from any to any port 0 -> " . "{$config['diag']['ipv6nat']['ipaddr']}\n"; } @@ -846,8 +846,8 @@ function filter_nat_rules_generate() { $natrules .= << $pptpdtarget -rdr on $wanif proto tcp from any to any port 1723 -> $pptpdtarget +rdr on wan proto gre from any to any -> $pptpdtarget +rdr on wan proto tcp from any to any port 1723 -> $pptpdtarget EOD; } @@ -855,7 +855,7 @@ EOD; $squid_installed = run_command_return_string("/bin/ls /var/db/pkg/ | grep squid"); if ($squid_installed <> "") { - $natrules .= "rdr on " . $lanif . " inet proto tcp from any to any port www -> 127.0.0.1 port 3128\n"; + $natrules .= "rdr on lan inet proto tcp from any to any port www -> 127.0.0.1 port 3128\n"; } return $natrules; @@ -936,8 +936,8 @@ function filter_rules_generate() { /* if squid is installed, lets install its rule */ $squid_installed = run_command_return_string("/bin/ls /var/db/pkg/ | grep squid"); if ($squid_installed <> "") { - $ipfrules .= "pass in quick on " . $lanif . " inet proto tcp from any to 127.0.0.1 port 3128 keep state label \"transparent proxy\"\n"; - $ipfrules .= "pass out quick on " . $wanif . " inet proto tcp from any to any port www keep state label \"transparent proxy\"\n"; + $ipfrules .= "pass in quick on lan inet proto tcp from any to 127.0.0.1 port 3128 keep state label \"transparent proxy\"\n"; + $ipfrules .= "pass out quick on wan inet proto tcp from any to any port www keep state label \"transparent proxy\"\n"; } $ipfrules .= create_firewall_outgoing_rules_to_itself(); @@ -946,8 +946,8 @@ function filter_rules_generate() { # loopback anchor "loopback" -pass in quick on lo0 all label "pass loopback" -pass out quick on lo0 all label "pass loopback" +pass in quick on (lo0) all label "pass loopback" +pass out quick on (lo0) all label "pass loopback" # package manager early specific hook anchor "packageearly" @@ -957,14 +957,14 @@ anchor "carp" # enable ftp-proxy anchor "ftpproxy" -pass in quick on $wanif inet proto tcp from port 20 to ($wanif) user proxy flags S/SA keep state -pass in quick on $wanif inet proto tcp from any to $wanif port > 49000 user proxy keep state +pass in quick on wan inet proto tcp from port 20 to wan user proxy flags S/SA keep state +pass in quick on wan inet proto tcp from any to wan port > 49000 user proxy keep state # allow access to DHCP server on LAN anchor "dhcpserverlan" -pass in quick on $lanif proto udp from any port = 68 to 255.255.255.255 port = 67 label "allow access to DHCP server on LAN" -pass in quick on $lanif proto udp from any port = 68 to $lanip port = 67 label "allow access to DHCP server on LAN" -pass out quick on $lanif proto udp from $lanip port = 67 to any port = 68 label "allow access to DHCP server on LAN" +pass in quick on lan proto udp from any port = 68 to 255.255.255.255 port = 67 label "allow access to DHCP server on LAN" +pass in quick on lan proto udp from any port = 68 to $lanip port = 67 label "allow access to DHCP server on LAN" +pass out quick on lan proto udp from $lanip port = 67 to any port = 68 label "allow access to DHCP server on LAN" EOD; @@ -975,10 +975,10 @@ EOD; # allow access to DHCP server on {$on} anchor "dhcpserver" -pass in quick on {$oc['if']} proto udp from any port = 68 to 255.255.255.255 port = 67 label "allow access to DHCP server" -pass in quick on {$oc['if']} proto udp from any port = 68 to {$oc['ip']} port = 67 label "allow access to DHCP server" -pass out quick on {$oc['if']} proto udp from {$oc['ip']} port = 67 to any port = 68 label "allow access to DHCP server" -pass out on {$oc['if']} proto icmp from any to any keep state label "allow access to DHCP server" +pass in quick on ({$oc['if']}) proto udp from any port = 68 to 255.255.255.255 port = 67 label "allow access to DHCP server" +pass in quick on ({$oc['if']}) proto udp from any port = 68 to {$oc['ip']} port = 67 label "allow access to DHCP server" +pass out quick on ({$oc['if']}) proto udp from {$oc['ip']} port = 67 to any port = 68 label "allow access to DHCP server" +pass out on ({$oc['if']}) proto icmp from any to any keep state label "allow access to DHCP server" EOD; } @@ -1022,10 +1022,10 @@ EOD; if ($sa) { $ipfrules .= << $ifname) { $int = filter_translate_type_to_real_interface($ifname); - $rule .="pass out quick on {$int} inet from any to any keep state\n"; + $rule .="pass out quick on ({$int}) inet from any to any keep state\n"; /* XXX - billm: temp fix for pppoe, needs better fix */ if ($config['interfaces'][$ifname]['ipaddr'] == "pppoe") $int = "ng0"; - $rule .="pass out quick on {$int} inet from {$int} to any keep state\n"; + $rule .="pass out quick on ({$int}) inet from ({$int}) to any keep state\n"; } return $rule; } -- cgit v1.1