summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorManuel Munz <freifunk@somakoma.de>2011-10-27 14:40:45 +0000
committerManuel Munz <freifunk@somakoma.de>2011-10-27 14:40:45 +0000
commitfc6ad21d33d0b4879738c394da15ea6c051d277a (patch)
treea55d7ed43c8126977151384bde37bcb983455dc7
parentbbab73664240b87fc80eb57f3834566dcf3c794b (diff)
contrib/freifunk-firewall: With the masq_src option in openwrt's firewall the natfix hack is no longer needed
-rw-r--r--contrib/package/freifunk-firewall/files/etc/firewall.freifunk16
-rw-r--r--contrib/package/freifunk-firewall/files/etc/hotplug.d/iface/22-firewall-nat-fix61
2 files changed, 0 insertions, 77 deletions
diff --git a/contrib/package/freifunk-firewall/files/etc/firewall.freifunk b/contrib/package/freifunk-firewall/files/etc/firewall.freifunk
index 905299204..4c3f3c476 100644
--- a/contrib/package/freifunk-firewall/files/etc/firewall.freifunk
+++ b/contrib/package/freifunk-firewall/files/etc/firewall.freifunk
@@ -36,22 +36,6 @@ apply_advanced() {
config_foreach apply_advanced advanced
-
-#
-# Apply fixes for masquerading rules
-#
-apply_nat_fix() {
- local up
- local ifname
- config_get up $1 up
- [ -n "$up" ] || return 0
- (ACTION="ifup" INTERFACE="$1" . /etc/hotplug.d/iface/22-firewall-nat-fix )
-}
-
-uci_set_state firewall core loaded 1
-config_foreach fw_addif interface
-config_foreach apply_nat_fix interface
-
[ -x /etc/init.d/luci_splash ] && ( sleep 3; /etc/init.d/luci_splash restart )&
[ -x /etc/init.d/freifunk-p2pblock ] && /etc/init.d/freifunk-p2pblock enabled && \
diff --git a/contrib/package/freifunk-firewall/files/etc/hotplug.d/iface/22-firewall-nat-fix b/contrib/package/freifunk-firewall/files/etc/hotplug.d/iface/22-firewall-nat-fix
deleted file mode 100644
index 634f432f0..000000000
--- a/contrib/package/freifunk-firewall/files/etc/hotplug.d/iface/22-firewall-nat-fix
+++ /dev/null
@@ -1,61 +0,0 @@
-. /lib/firewall/uci_firewall.sh
-unset ZONE
-config_get ifname $INTERFACE ifname
-[ "$ifname" == "lo" ] && exit 0
-
-load_zones() {
- local name
- local network
- config_get name $1 name
- config_get network $1 network
- [ -z "$network" ] && network=$name
- for n in $network; do
- [ "$n" = "$INTERFACE" ] && ZONE="$ZONE $name"
- done
-}
-
-config_foreach load_zones zone
-
-[ -z "$ZONE" ] && exit 0
-
-natfix_addr_add() {
- local network=$1
- local iface=$2
-
- config_get parent "$1" interface
- [ "$network" != "$INTERFACE" -a "$parent" != "$INTERFACE" ] && return 0
-
- config_get ipaddr "$network" ipaddr
- [ -n "$ipaddr" ] || return 0
- config_get netmask "$network" netmask
- [ -n "$netmask" ] || return 0
- eval "$(ipcalc.sh $ipaddr $netmask)"
-
- logger -t firewall.freifunk "adding nat rule for $iface($NETWORK/$PREFIX)"
- iptables -t nat -A "natfix_$iface" -s "$NETWORK/$PREFIX" -d "$NETWORK/$PREFIX" -j ACCEPT
-}
-
-[ ifup = "$ACTION" ] && {
- iptables -t nat -N "natfix_$ifname"
- natfix_addr_add "$INTERFACE" "$ifname"
- config_foreach natfix_addr_add alias "$ifname"
-
- for z in $ZONE; do
- local loaded
- config_get loaded core loaded
- [ -n "$loaded" ] && {
- logger -t firewall.freifunk "applying nat rules on zone $z"
- iptables -t nat -I "zone_${z}_nat" 1 -o "$ifname" -j "natfix_$ifname"
- }
- done
-}
-
-[ ifdown = "$ACTION" ] && {
- for z in $ZONE; do
- local up
- config_get up $z up
- iptables -t nat -D "zone_${z}_nat" -o "$ifname" -j "natfix_$ifname" 2>/dev/null
- done
- iptables -t nat -F "natfix_$ifname" 2>/dev/null
- iptables -t nat -X "natfix_$ifname" 2>/dev/null
-}