firewall.freifunk 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #!/bin/sh
  2. # Freifunk Firewall addons
  3. . /lib/functions.sh
  4. #
  5. # Apply advanced settings
  6. #
  7. apply_advanced() {
  8. local tcp_ecn
  9. local tcp_window_scaling
  10. local accept_redirects
  11. local accept_source_route
  12. config_get_bool tcp_ecn $1 tcp_ecn 1
  13. config_get_bool tcp_window_scaling $1 tcp_window_scaling 1
  14. config_get_bool accept_redirects $1 accept_redirects 0
  15. config_get_bool accept_source_route $1 accept_source_route 0
  16. logger -t firewall.freifunk "tcp_ecn is $tcp_ecn"
  17. logger -t firewall.freifunk "tcp_window_scaling is $tcp_window_scaling"
  18. logger -t firewall.freifunk "accept_redirects is $accept_redirects"
  19. logger -t firewall.freifunk "accept_source_route is $accept_source_route"
  20. sysctl -w net.ipv4.tcp_ecn=$tcp_ecn >/dev/null
  21. sysctl -w net.ipv4.tcp_window_scaling=$tcp_window_scaling >/dev/null
  22. for f in /proc/sys/net/ipv4/conf/*/accept_redirects; do
  23. echo $accept_redirects > $f
  24. done
  25. for f in /proc/sys/net/ipv4/conf/*/accept_source_route; do
  26. echo $accept_source_route > $f
  27. done
  28. }
  29. config_foreach apply_advanced advanced
  30. [ -x /etc/init.d/freifunk-p2pblock ] && /etc/init.d/freifunk-p2pblock enabled && \
  31. ( sleep 3; /etc/init.d/freifunk-p2pblock restart )&