(usagi-users 03566) Re: Can't remove route while used ???
Ignacy Gawedzki <[email protected]>
| Newsgroups | gmane.linux.ipv6.usagi.users |
|---|---|
| Message-ID | <[email protected]> |
On Wed, Dec 07, 2005 at 05:21:04PM +0100, thus spake Ignacy Gawedzki: > Hi all, > > I've just come across a strange behavior with route removal. Okay, I've just figured out the answer by myself. =) > Suppose you have two nodes A and B with addresses fec0::a and fec0::b. Each > one of them has a route to the other. > > A % ip -6 route add fec0::b dev eth0 > B % ip -6 route add fec0::a dev eth0 > > Now suppose that you have some intense traffic from A to B (TCP or UDP, it > doesn't matter) and you need to remove the route to fec0::b on A. > > A % ip -6 route del fec0::b dev eth0 > > Then it usually doesn't actually remove that route, as though it was kind of > locked by the traffic (?!). Of course ip doesn't return any error, but > the traffic continues and the route is still present. Each "used" route is put into the cache and that command (ip -6 route del fec0::b dev eth0) does only remove the first route found (if a cached version exists, it get removed instead of the actual route in the table). To see all the routes, including those cached, use "ip -6 route list table all". To remove a route along with its cached version, use "ip -6 route flush table all exact fec0::b dev eth0". > A % ip -6 route > ... > fec0::b dev eth0 metric 1024 mtu 1500 advmss 1440 hoplimit 4294967295 > ... > > When the traffic ends and you try to remove that route again, it fails at the > first attempt and works at the second one (as though the attempt to remove the > route while it was "used" had put it into some other "state"). The first attempt removes the cached route, while the second removes the actual route. > If, instead of trying to remove it while the traffic is going, you try > to remove that route while it isn't "used", it works perfectly as expected (at > the first attempt). Since the route doesn't get cached. > If you try several times while the traffic is going, you may ultimately > succeed in removing it, but the actual number of times you have to try is not > predictable. > > A % a=0; while echo try $((a++)); do \ > ip -6 route del fec0::b dev eth0 || break; \ > ip -6 route; done > > ... The removal may succeed if no packet triggered any route lookup and caching between two attempts. QED Thanks anyway. =) -- To err is human, to moo bovine.