fourcentsshy wrote: > > Hello, > > I'm using tc to limit the bandwidth of our wireless customers. I have a > working script, but I'm not happy with it. I'm trying to write a more > sophisticated script, but when I run it, it give me this error: > > RTNETLINK answers: File exists > > I have no idea what this error means or how to fix it. It means pretty much what it says. There is already a record matching closely enough that it is duplicated. > Here is a portion > of the script (the whole script shapes several interfaces): > > IDEV='eth5' > TC='/sbin/tc' > IPS='/etc/sysconfig/shaper/shape.ips' > # high priority destination ports - I'll fill these in later (when this > # thing works) > HIGHPORT= > # low priority destination ports > LOWPORT= > > $TC qdisc add dev $IDEV root handle 1: cbq bandwidth 1600Kbit cell 8\ > avpkt 1000 mpu 64 > $TC class add dev $IDEV parent 1: classid 1:1 est 1sec 8sec cbq\ > bandwidth 1600Kbit rate 1500kbit allot 1514 maxburst 20 avpkt 1000\ > prio 0 bounded isolated > > cat $IPS | sed -e 's/#.*$//; s/^ *$//;' | while read IP RATE STATUS; do > if [ "x$IP" == "x" ]; then > continue > fi > > # I use the last byte of the customer's IP's for the handle, which range > # from 76 to 135 ATM. > > HANDLE="${IP##*.}" > > # I get the error from the next line. Because it fails to create the > # qdisc all the rest fail too. > > $TC qdisc add dev $IDEV parent 1:1 handle 1:$HANDLE cbq\ > bandwidth 1600Kbit cell 8 avpkt 1000 mpu 64 > > $TC class add dev $IDEV parent 1:$HANDLE classid $HANDLE:\ > est 1sec 8sec cbq bandwidth 1600Kbit rate ${RATE}kbit allot 1514\ > maxburst 20 avpkt 1000 prio 1 bounded isolated > $TC class add dev $IDEV parent $HANDLE: classid $HANDLE:1\ > est 1sec 8sec cbq bandwidth 1600Kbit rate ${RATE}kbit allot 1514\ > maxburst 20 avpkt 1000 prio 2 > $TC class add dev $IDEV parent $HANDLE: classid $HANDLE:2 est 1sec\ > 8sec cbq bandwidth 1600Kbit rate $[9*$RATE/10]kbit allot 1514\ > maxburst 20 avpkt 1000 prio 3 > $TC class add dev $IDEV parent $HANDLE: classid $HANDLE:3 est 1sec\ > 8sec cbq bandwidth 1600Kbit rate $[8*$RATE/10]kbit allot 1514\ > maxburst 20 avpkt 1000 prio 4 > $TC qdisc add dev $IDEV parent $HANDLE:1 sfq quantum 1514b\ > perturb 15 > $TC qdisc add dev $IDEV parent $HANDLE:2 sfq quantum 1514b\ > perturb 15 > $TC qdisc add dev $IDEV parent $HANDLE:3 sfq quantum 1514b\ > perturb 15 > $TC filter add dev $IDEV parent 1: protocol ip prio 16\ > u32 match ip src $IP flowid $HANDLE: > $TC filter add dev $IDEV parent $HANDLE: protocol ip prio 10\ > u32 match ip tos 0x10 0xff flowid $HANDLE:1 > $TC filter add dev $IDEV parent $HANDLE: protocol ip prio 11\ > u32 match ip protocol 1 0xff flowid $HANDLE:1 > $TC filter add dev $IDEV parent $HANDLE: protocol ip prio 12\ > u32 match ip protocol 6 0xff match u8 0x05 0x0f at 0 match u16\ > 0x0000 0xffc0 at 2 flowid $HANDLE:1 > > for a in $HIGHPORT; do > $TC filter add dev $IDEV parent 1:0 protocol ip prio 14\ > u32 match ip dport $a 0xffff flowid $HANDLE:1 > done > for a in $LOWPORT; do > $TC filter add dev $IDEV parent 1:0 protocol ip prio 16\ > u32 match ip dport $a 0xffff flowid $HANDLE:3 > done > $TC filter add dev $IDEV parent 1:0 protocol ip prio 15\ > u32 match ip dst 0.0.0.0/0 flowid $HANDLE:2 > done > > There are bound to other problems with this script, but until I can get > past the current one, I'm dead in the water. TIA You do not say which line or lines is causing the error so this is a guess. Run `tc -s filter show dev $IDEV' sending the output to a file because there will be a lot of it. I think you will find a ton of "duplicate" filters. Set prio to the same value (16 or 10 perhaps) for each and every line in your `$TC filter' lines. -- gypsy _______________________________________________ LARTC mailing list LARTC@xxxxxxxxxxxxxxx http://mailman.ds9a.nl/cgi-bin/mailman/listinfo/lartc