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)
committerLorenzo Colitti <lorenzo@google.com>
Fri, 4 Nov 2011 00:08:47 +0000 (17:08 -0700)
commitadfa7bc8b41318c20ca571afbd924e3a8cedf2bc
tree880e0a4d2fd65c392fbc2159c600cf5cd9a406c1
parentb8cfed012c629458aaf6fdc536603194cbfd6557
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