OpenWrt – Blame information for rev 1
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 1 | #!/bin/sh /etc/rc.common |
2 | # Copyright (C) 2006 OpenWrt.org |
||
3 | |||
4 | START=11 |
||
5 | |||
6 | apply_defaults() { |
||
7 | local mem="$(awk '/^MemTotal:/ {print $2}' /proc/meminfo)" |
||
8 | local min_free frag_low_thresh frag_high_thresh |
||
9 | |||
10 | if [ "$mem" -gt 65536 ]; then # 128M |
||
11 | min_free=16384 |
||
12 | elif [ "$mem" -gt 32768 ]; then # 64M |
||
13 | min_free=8192 |
||
14 | else |
||
15 | min_free=1024 |
||
16 | frag_low_thresh=393216 |
||
17 | frag_high_thresh=524288 |
||
18 | fi |
||
19 | |||
20 | sysctl -qw vm.min_free_kbytes="$min_free" |
||
21 | |||
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" |
||
29 | |||
30 | # first set default, then all interfaces to avoid races with appearing interfaces |
||
31 | if [ -d /proc/sys/net/ipv6/conf ]; then |
||
32 | echo 0 > /proc/sys/net/ipv6/conf/default/accept_ra |
||
33 | for iface in /proc/sys/net/ipv6/conf/*/accept_ra; do |
||
34 | echo 0 > "$iface" |
||
35 | done |
||
36 | fi |
||
37 | } |
||
38 | |||
39 | start() { |
||
40 | apply_defaults |
||
41 | for CONF in /etc/sysctl.d/*.conf /etc/sysctl.conf; do |
||
42 | [ -f "$CONF" ] && sysctl -e -p "$CONF" >&- |
||
43 | done |
||
44 | } |