PLease告訴我的問題。我正在構建基於CentOS x86_64,Linux版本2.6.32-431.3.1.el6.x86_64的流量整形器。所以它有大約10個u32哈希表,全部有256個除數。在缺省表800中,我散列第3個八位字節並將分組指向這個表中的一個,然後將第4個八位字節和點分組散列到描述每個用戶帶寬限制的類。所以,對於每個IP地址都有一個相應的tc類。我們很容易塑造大約3000個IP地址。當我的腳本將這些IP添加到散列表中時,我得到一個錯誤:RTNETLINK的答案是:文件存在。更多代碼在這裏:Linux tc,u32過濾奇怪的錯誤
tc qdisc add dev $inet root handle 2: htb default 8000
tc class add dev $inet parent 2: classid 2:6000 htb rate 100mbit
#this hash-tables are for subnets
for i in {901..912}; do
tc filter add dev $inet parent 2: handle $i: protocol ip u32 divisor 256
done
#adding filters for packet classifying
tc filter add dev $inet protocol ip parent 2: u32 ht 800:: match ip src 172.16.16.0/20 hashkey mask 0x0000ff00 at 12 link 901:
tc filter add dev $inet protocol ip parent 2: u32 ht 901:11: match ip src 172.16.17.0/24 hashkey mask 0x000000ff at 12 link 902:
tc filter add dev $inet protocol ip parent 2: u32 ht 901:12: match ip src 172.16.18.0/24 hashkey mask 0x000000ff at 12 link 903:
#...
#and so on under "link 912:"
#creating classes for every host, place it under root class 2: (100mb for all)
for i in {1..2815}; do tc class add dev $inet parent 2:6000 classid 2:$i htb rate 1mbit ceil 6mbit; done
#place each host in corresponding u32 table
for i in {1..255}; do printf -v hi "%x" "$i";
tc filter add dev $inet protocol ip parent 2: u32 ht 902:$hi: match ip src 172.16.17.$i flowid 2:$i
done
for i in {256..511}; do let j="i-256"; printf -v hi "%x" "$j";
tc filter add dev $inet protocol ip parent 2: u32 ht 903:$hi: match ip src 172.16.18.$j flowid 2:$i
done
#....
#and so on under 2815 hosts
而且某處命令後結束
tc filter add dev eth0 protocol ip parent 2: u32 ht 909:dc: match ip src 172.16.24.220 flowid 2:2012
RTNETLINK answers: File exists
We have an error talking to the kernel
我解決不了這個問題,我認爲有在Linux內核中的過濾器數量的限制,但有些人說我這不是真的,根本沒有限制。沒有flowid重用,並且沒有哈希表處理超限。還有什麼可以導致代碼中的這個錯誤?