]> git.baikalelectronics.ru Git - kernel.git/commit
ipv6: Don't create clones of host routes.
authorDavid S. Miller <davem@davemloft.net>
Thu, 10 Mar 2011 03:55:25 +0000 (19:55 -0800)
committerDavid S. Miller <davem@davemloft.net>
Thu, 10 Mar 2011 03:55:25 +0000 (19:55 -0800)
commitc9859188b5c8381ed379bdbcea4df9b42a994412
tree13c8180b8aeb82363c1e7b576372c23fa2d5f955
parent9c2a8494a9f6effb5c5bcb30b1a30439796d8f28
ipv6: Don't create clones of host routes.

Addresses https://bugzilla.kernel.org/show_bug.cgi?id=29252
Addresses https://bugzilla.kernel.org/show_bug.cgi?id=30462

In commit 560a2056805e31de996496a04ebe0d0c2846699e ("ipv6: Always
clone offlink routes.") we forced the kernel to always clone offlink
routes.

The reason we do that is to make sure we never bind an inetpeer to a
prefixed route.

The logic turned on here has existed in the tree for many years,
but was always off due to a protecting CPP define.  So perhaps
it's no surprise that there is a logic bug here.

The problem is that we canot clone a route that is already a
host route (ie. has DST_HOST set).  Because if we do, an identical
entry already exists in the routing tree and therefore the
ip6_rt_ins() call is going to fail.

This sets off a series of failures and high cpu usage, because when
ip6_rt_ins() fails we loop retrying this operation a few times in
order to handle a race between two threads trying to clone and insert
the same host route at the same time.

Fix this by simply using the route as-is when DST_HOST is set.

Reported-by: slash@ac.auone-net.jp
Reported-by: Ernst Sjöstrand <ernstp@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv6/route.c