summaryrefslogtreecommitdiffhomepage
path: root/modules/freifunk/root/etc/firewall.freifunk
diff options
context:
space:
mode:
authorJo-Philipp Wich <jow@openwrt.org>2009-01-25 16:45:19 +0000
committerJo-Philipp Wich <jow@openwrt.org>2009-01-25 16:45:19 +0000
commit58d15fdedb105997156c86aedde87a18786da433 (patch)
tree59a96e6b98a2302bebb0685ed4faf6b1b9ea3205 /modules/freifunk/root/etc/firewall.freifunk
parent9b01a6e862d119b999ce57173f8de55c15cc8818 (diff)
modules/freifunk:
- implement generic fix for firewall MASQUERADE - implement advanced uci config to control sysctl and /proc values
Diffstat (limited to 'modules/freifunk/root/etc/firewall.freifunk')
-rw-r--r--modules/freifunk/root/etc/firewall.freifunk51
1 files changed, 51 insertions, 0 deletions
diff --git a/modules/freifunk/root/etc/firewall.freifunk b/modules/freifunk/root/etc/firewall.freifunk
new file mode 100644
index 000000000..ac3fcc55d
--- /dev/null
+++ b/modules/freifunk/root/etc/firewall.freifunk
@@ -0,0 +1,51 @@
+#!/bin/sh
+# Freifunk Firewall addons
+# $Id$
+
+
+#
+# Apply advanced settings
+#
+apply_advanced() {
+ local tcp_ecn
+ local tcp_window_scaling
+ local accept_redirects
+ local accept_source_route
+
+ config_get_bool tcp_ecn $1 tcp_ecn 1
+ config_get_bool tcp_window_scaling $1 tcp_window_scaling 1
+ config_get_bool accept_redirects $1 accept_redirects 0
+ config_get_bool accept_source_route $1 accept_source_route 0
+
+ logger -t firewall.freifunk "tcp_ecn is $tcp_ecn"
+ logger -t firewall.freifunk "tcp_window_scaling is $tcp_window_scaling"
+ logger -t firewall.freifunk "accept_redirects is $accept_redirects"
+ logger -t firewall.freifunk "accept_source_route is $accept_source_route"
+
+ sysctl -w net.ipv4.tcp_ecn=$tcp_ecn >/dev/null
+ sysctl -w net.ipv4.tcp_window_scaling=$tcp_window_scaling >/dev/null
+
+ for f in /proc/sys/net/ipv4/conf/*/accept_redirects; do
+ echo $accept_redirects > $f
+ done
+
+ for f in /proc/sys/net/ipv4/conf/*/accept_source_route; do
+ echo $accept_source_route > $f
+ done
+}
+
+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 )
+}
+
+config_foreach apply_nat_fix interface