Re: tc is giving an error: RTNETLINK answers: File exists

Linux Advanced Routing and Traffic Control

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 2006-09-14 at 21:36 -0700, gypsy wrote:
> 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.
> 

That is what puzzles me the most. If you look at the script, I create
the root qdisc, add a class to it and when I try to add a qdisc to that
class on the first iteration in the loop, I get the error right off. The
script also deletes all qdiscs, classes and filters before it creates
any new ones. On the first iteration of the loop, the handle is 1:76
with it's parent 1:1, which should be unique, since it's only the second
qdisc created.

As Leigh Sharpe suggested, I had already inserted echo statements into
the script so I could examine what was really going on. For this device,
the error takes place on the third command. the command sequence take
place like this:

/sbin/tc qdisc add dev eth5 root handle 1: cbq bandwidth 1600Kbit\
 cell 8 avpkt 1000 mpu 64 

/sbin/tc class add dev eth5 parent 1: classid 1:1 est 1sec 8sec cbq\
 bandwidth 1600Kbit rate 1500kbit allot 1514 maxburst 20 avpkt 1000\
 prio 0 bounded isolated 

/sbin/tc qdisc add dev eth5 parent 1:1 handle 1:76 cbq\
 bandwidth 1600Kbit cell 8 avpkt 1000 mpu 64
RTNETLINK answers: File exists

Like I said, I start by resetting all the devices on the machine, so
there is no possible way there can be any existing qdisc with a handle
of 1:76 for that device, yet I get the error anyway. The script is setup
as a service to be run at startup, so checking the status after running
the script for that device, I get this:

[qdisc - eth5]                  
qdisc cbq 1: rate 1600Kbit (bounded,isolated) prio no-transmit
 Sent 139719 bytes 181 pkt (dropped 0, overlimits 0 requeues 0) 
 rate 0bit 0pps backlog 0b 0p requeues 0 
  borrowed 0 overactions 0 avgidle 5120 undertime 0
------------------------        
                                
[class - eth5]                  
class cbq 1:11 parent 1:1 leaf 8236: rate 700000bit prio 2
 Sent 13814 bytes 42 pkt (dropped 0, overlimits 0 requeues 0) 
 rate 11792bit 4pps backlog 0b 0p requeues 0 
  borrowed 0 overactions 0 avgidle 306884 undertime 0
class cbq 1: root rate 100000Kbit (bounded,isolated) prio no-transmit
 Sent 60 bytes 1 pkt (dropped 0, overlimits 0 requeues 0) 
 rate 0bit 0pps backlog 0b 0p requeues 0 
  borrowed 0 overactions 0 avgidle 81 undertime 0
class cbq 1:10 parent 1:1 leaf 8235: rate 750000bit prio 1
 Sent 6712 bytes 48 pkt (dropped 0, overlimits 0 requeues 0) 
 rate 2008bit 2pps backlog 0b 0p requeues 0 
  borrowed 0 overactions 0 avgidle 148506 undertime 0
class cbq 1:1 parent 1: rate 800000bit (bounded,isolated) prio
no-transmit
 Sent 20526 bytes 90 pkt (dropped 0, overlimits 0 requeues 0) 
 rate 13800bit 7pps backlog 0b 0p requeues 0 
  borrowed 0 overactions 0 avgidle 57889 undertime 0
class cbq 1:12 parent 1:1 leaf 8237: rate 700000bit prio 3
 Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0) 
 rate 0bit 0pps backlog 0b 0p requeues 0 
  borrowed 0 overactions 0 avgidle 329838 undertime 0

Maybe I'm blind, but I don't see any qdisc or class with a handle of
1:76. Something else is wrong, but I don't see it.

> > 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.

I inserted a comment in the script that points out which command causes
the error. It's the first command inside the loop. 

> 
> 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.

I inserted an exit statement right after the command that give the
error. The script never gets to the statements that creates the filters.
Checking the status of the service would display the filters along with
the qdiscs and classes, but there are none.

> 
> Set prio to the same value (16 or 10 perhaps) for each and every line in
> your `$TC filter' lines.

If I ever get this script working, I'll do that. ;-)


_______________________________________________
LARTC mailing list
LARTC@xxxxxxxxxxxxxxx
http://mailman.ds9a.nl/cgi-bin/mailman/listinfo/lartc

[Index of Archives]     [LARTC Home Page]     [Netfilter]     [Netfilter Development]     [Network Development]     [Bugtraq]     [GCC Help]     [Yosemite News]     [Linux Kernel]     [Fedora Users]
  Powered by Linux