2007-05-10 10:07:38 +00:00
|
|
|
#!/bin/sh /etc/rc.common
|
2013-12-09 11:30:14 +00:00
|
|
|
# Copyright (C) 2006 OpenWrt.org
|
2007-05-10 10:07:38 +00:00
|
|
|
|
2013-03-26 10:02:58 +00:00
|
|
|
START=11
|
2016-08-01 12:52:13 +00:00
|
|
|
|
2018-03-05 08:13:53 +00:00
|
|
|
apply_defaults() {
|
|
|
|
local mem="$(awk '/^MemTotal:/ {print $2}' /proc/meminfo)"
|
|
|
|
local min_free frag_low_thresh frag_high_thresh
|
|
|
|
|
2016-08-01 12:52:13 +00:00
|
|
|
if [ "$mem" -gt 65536 ]; then # 128M
|
2018-03-05 08:13:53 +00:00
|
|
|
min_free=16384
|
2016-08-01 12:52:13 +00:00
|
|
|
elif [ "$mem" -gt 32768 ]; then # 64M
|
2018-03-05 08:13:53 +00:00
|
|
|
min_free=8192
|
2016-08-01 12:52:13 +00:00
|
|
|
else
|
2018-03-05 08:13:53 +00:00
|
|
|
min_free=1024
|
|
|
|
frag_low_thresh=393216
|
|
|
|
frag_high_thresh=524288
|
2016-08-01 12:52:13 +00:00
|
|
|
fi
|
2018-03-05 08:13:53 +00:00
|
|
|
|
|
|
|
sysctl -qw vm.min_free_kbytes="$min_free"
|
|
|
|
|
|
|
|
[ "$frag_low_thresh" ] && sysctl -qw \
|
|
|
|
net.ipv4.ipfrag_low_thresh="$frag_low_thresh" \
|
|
|
|
net.ipv4.ipfrag_high_thresh="$frag_high_thresh" \
|
|
|
|
net.ipv6.ip6frag_low_thresh="$frag_low_thresh" \
|
|
|
|
net.ipv6.ip6frag_high_thresh="$frag_high_thresh" \
|
|
|
|
net.netfilter.nf_conntrack_frag6_low_thresh="$frag_low_thresh" \
|
|
|
|
net.netfilter.nf_conntrack_frag6_high_thresh="$frag_high_thresh"
|
2016-08-01 12:52:13 +00:00
|
|
|
}
|
|
|
|
|
2007-05-10 10:07:38 +00:00
|
|
|
start() {
|
2018-03-05 08:13:53 +00:00
|
|
|
apply_defaults
|
2015-07-07 13:47:23 +00:00
|
|
|
for CONF in /etc/sysctl.conf /etc/sysctl.d/*.conf; do
|
|
|
|
[ -f "$CONF" ] && sysctl -p "$CONF" -e >&-
|
|
|
|
done
|
2007-05-10 10:07:38 +00:00
|
|
|
}
|