original_kernel/net
Neil Horman b6280b47a7 ipv4 routing: Ensure that route cache entries are usable and reclaimable with caching is off
When route caching is disabled (rt_caching returns false), We still use route
cache entries that are created and passed into rt_intern_hash once.  These
routes need to be made usable for the one call path that holds a reference to
them, and they need to be reclaimed when they're finished with their use.  To be
made usable, they need to be associated with a neighbor table entry (which they
currently are not), otherwise iproute_finish2 just discards the packet, since we
don't know which L2 peer to send the packet to.  To do this binding, we need to
follow the path a bit higher up in rt_intern_hash, which calls
arp_bind_neighbour, but not assign the route entry to the hash table.
Currently, if caching is off, we simply assign the route to the rp pointer and
are reutrn success.  This patch associates us with a neighbor entry first.

Secondly, we need to make sure that any single use routes like this are known to
the garbage collector when caching is off.  If caching is off, and we try to
hash in a route, it will leak when its refcount reaches zero.  To avoid this,
this patch calls rt_free on the route cache entry passed into rt_intern_hash.
This places us on the gc list for the route cache garbage collector, so that
when its refcount reaches zero, it will be reclaimed (Thanks to Alexey for this
suggestion).

I've tested this on a local system here, and with these patches in place, I'm
able to maintain routed connectivity to remote systems, even if I set
/proc/sys/net/ipv4/rt_cache_rebuild_count to -1, which forces rt_caching to
return false.

Signed-off-by: Neil Horman <nhorman@redhat.com>
Reported-by: Jarek Poplawski <jarkao2@gmail.com>
Reported-by: Maxime Bizon <mbizon@freebox.fr>
Signed-off-by: David S. Miller <davem@davemloft.net>
2009-06-23 16:36:26 -07:00
..
9p
802
8021q
appletalk
atm
ax25 net: Move rx skb_orphan call to where needed 2009-06-23 16:36:25 -07:00
bluetooth
bridge
can
core net: Move rx skb_orphan call to where needed 2009-06-23 16:36:25 -07:00
dcb
dccp ipv6: Use correct data types for ICMPv6 type and code 2009-06-23 04:31:07 -07:00
decnet
dsa
econet
ethernet
ieee802154 ieee802154: use standard routine for printing dumps 2009-06-19 00:18:43 -07:00
ipv4 ipv4 routing: Ensure that route cache entries are usable and reclaimable with caching is off 2009-06-23 16:36:26 -07:00
ipv6 ipv6: Use correct data types for ICMPv6 type and code 2009-06-23 04:31:07 -07:00
ipx
irda net: Move rx skb_orphan call to where needed 2009-06-23 16:36:25 -07:00
iucv af_iucv: Return -EAGAIN if iucv msg limit is exceeded 2009-06-19 00:10:40 -07:00
key
lapb
llc
mac80211
netfilter netfilter: xt_rateest: fix comparison with self 2009-06-22 14:17:12 +02:00
netlabel
netlink
netrom
packet
phonet
rds
rfkill rfkill: export persistent attribute in sysfs 2009-06-19 11:50:18 -04:00
rose
rxrpc
sched
sctp ipv6: Use correct data types for ICMPv6 type and code 2009-06-23 04:31:07 -07:00
sunrpc
tipc
unix
wanrouter
wimax
wireless cfg80211: validate station settings 2009-06-19 11:50:24 -04:00
x25
xfrm
Kconfig
Makefile
TUNABLE
compat.c
nonet.c
socket.c
sysctl_net.c