sysctl 947 B

123456789101112131415161718192021222324252627282930313233343536
  1. #!/bin/sh /etc/rc.common
  2. # Copyright (C) 2006 OpenWrt.org
  3. START=11
  4. apply_defaults() {
  5. local mem="$(awk '/^MemTotal:/ {print $2}' /proc/meminfo)"
  6. local min_free frag_low_thresh frag_high_thresh
  7. if [ "$mem" -gt 65536 ]; then # 128M
  8. min_free=16384
  9. elif [ "$mem" -gt 32768 ]; then # 64M
  10. min_free=8192
  11. else
  12. min_free=1024
  13. frag_low_thresh=393216
  14. frag_high_thresh=524288
  15. fi
  16. sysctl -qw vm.min_free_kbytes="$min_free"
  17. [ "$frag_low_thresh" ] && sysctl -qw \
  18. net.ipv4.ipfrag_low_thresh="$frag_low_thresh" \
  19. net.ipv4.ipfrag_high_thresh="$frag_high_thresh" \
  20. net.ipv6.ip6frag_low_thresh="$frag_low_thresh" \
  21. net.ipv6.ip6frag_high_thresh="$frag_high_thresh" \
  22. net.netfilter.nf_conntrack_frag6_low_thresh="$frag_low_thresh" \
  23. net.netfilter.nf_conntrack_frag6_high_thresh="$frag_high_thresh"
  24. }
  25. start() {
  26. apply_defaults
  27. for CONF in /etc/sysctl.conf /etc/sysctl.d/*.conf; do
  28. [ -f "$CONF" ] && sysctl -p "$CONF" -e >&-
  29. done
  30. }