summaryrefslogtreecommitdiffhomepage
path: root/contrib/package/freifunk-firewall/files/etc/firewall.freifunk
blob: d2805f668ce246deba3d8181a4f2023ceac9dec4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/bin/sh
# Freifunk Firewall addons

. /lib/functions.sh

#
# 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

[ -x /etc/init.d/freifunk-p2pblock ] && /etc/init.d/freifunk-p2pblock enabled && \
	( sleep 3; /etc/init.d/freifunk-p2pblock restart )&