tcp: Don't nuke connections for the wrong protocol
authorLorenzo Colitti <lorenzo@google.com>
Fri, 4 Nov 2011 00:05:11 +0000 (17:05 -0700)
committermgross <mark.gross@intel.com>
Wed, 9 Nov 2011 20:25:33 +0000 (12:25 -0800)
commit78d0af2c8e251612e8100503de9de117bb67137a
tree880e0a4d2fd65c392fbc2159c600cf5cd9a406c1
parent1be004c3086e9b83fe50e12ddec9cc255ac372eb
tcp: Don't nuke connections for the wrong protocol

Currently, calling tcp_nuke_addr to reset IPv6 connections
resets IPv4 connections as well, because all Android
framework sockets are dual-stack (i.e., IPv6) sockets, and
we don't check the source address to see if the connection
was in fact an IPv4 connection.

Fix this by checking the source address and not resetting
the connection if it's a mapped address.

Also slightly tweak the IPv4 code path, which doesn't check
for mapped addresses either. This was not causing any
problems because tcp_is_local normally always returns true
for LOOPBACK4_IPV6 (127.0.0.6), because the loopback
interface is configured as as 127.0.0.0/8. However,
checking explicitly for LOOPBACK4_IPV6 makes the code a bit
more robust.

Bug: 5535055
Change-Id: I4d6ed3497c5b8643c864783cf681f088cf6b8d2a
Signed-off-by: Lorenzo Colitti <lorenzo@google.com>
net/ipv4/tcp.c