blob: 8722126a6612d67a3f615166a7fbec146207e97f (
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
|
#!/bin/sh /etc/rc.common
# Copyright (C) 2006 OpenWrt.org
START=11
apply_defaults() {
local mem="$(awk '/^MemTotal:/ {print $2}' /proc/meminfo)"
local min_free frag_low_thresh frag_high_thresh
if [ "$mem" -gt 65536 ]; then # 128M
min_free=16384
elif [ "$mem" -gt 32768 ]; then # 64M
min_free=8192
else
min_free=1024
frag_low_thresh=393216
frag_high_thresh=524288
fi
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"
}
start() {
apply_defaults
for CONF in /etc/sysctl.d/*.conf /etc/sysctl.conf; do
[ -f "$CONF" ] && sysctl -p "$CONF" -e >&-
done
}
|