1 #!/bin/sh /etc/rc.common
2 # Copyright (C) 2006 OpenWrt.org
7 local mem
="$(awk '/^MemTotal:/ {print $2}' /proc/meminfo)"
8 local min_free frag_low_thresh frag_high_thresh
10 if [ "$mem" -gt 65536 ]; then # 128M
12 elif [ "$mem" -gt 32768 ]; then # 64M
16 frag_low_thresh
=393216
17 frag_high_thresh
=524288
20 sysctl
-qw vm.min_free_kbytes
="$min_free"
22 [ "$frag_low_thresh" ] && sysctl
-qw \
23 net.ipv4.ipfrag_low_thresh
="$frag_low_thresh" \
24 net.ipv4.ipfrag_high_thresh
="$frag_high_thresh" \
25 net.ipv6.ip6frag_low_thresh
="$frag_low_thresh" \
26 net.ipv6.ip6frag_high_thresh
="$frag_high_thresh" \
27 net.netfilter.nf_conntrack_frag6_low_thresh
="$frag_low_thresh" \
28 net.netfilter.nf_conntrack_frag6_high_thresh
="$frag_high_thresh"
30 # first set default, then all interfaces to avoid races with appearing interfaces
31 if [ -d /proc
/sys
/net
/ipv
6/conf
]; then
32 echo 0 > /proc
/sys
/net
/ipv
6/conf
/default
/accept_ra
33 for iface
in /proc
/sys
/net
/ipv
6/conf
/*/accept_ra
; do
41 for CONF
in /etc
/sysctl.d
/*.conf
/etc
/sysctl.conf
; do
42 [ -f "$CONF" ] && sysctl
-e -p "$CONF" >&-