kernel_optimize_test/net/ipv6
Brian Haley d40a4de0be IPv6: fix IPV6_RECVERR handling of locally-generated errors
I noticed when I added support for IPV6_DONTFRAG that if you set
IPV6_RECVERR and tried to send a UDP packet larger than 64K to an
IPv6 destination, you'd correctly get an EMSGSIZE, but reading from
MSG_ERRQUEUE returned the incorrect address in the cmsg:

struct msghdr:
	 msg_name         0x7fff8f3c96d0
	 msg_namelen      28
struct sockaddr_in6:
	 sin6_family      10
	 sin6_port        7639
	 sin6_flowinfo    0
	 sin6_addr        ::ffff:38.32.0.0
	 sin6_scope_id    0  ((null))

It should have returned this in my case:

struct msghdr:
	 msg_name         0x7fffd866b510
	 msg_namelen      28
struct sockaddr_in6:
	 sin6_family      10
	 sin6_port        7639
	 sin6_flowinfo    0
	 sin6_addr        2620:0:a09:e000:21f:29ff:fe57:f88b
	 sin6_scope_id    0  ((null))

The problem is that ipv6_recv_error() assumes that if the error
wasn't generated by ICMPv6, it's an IPv4 address sitting there,
and proceeds to create a v4-mapped address from it.

Change ipv6_icmp_error() and ipv6_local_error() to set skb->protocol
to htons(ETH_P_IPV6) so that ipv6_recv_error() knows the address
sitting right after the extended error is IPv6, else it will
incorrectly map the first octet into an IPv4-mapped IPv6 address
in the cmsg structure returned in a recvmsg() call to obtain
the error.

Signed-off-by: Brian Haley <brian.haley@hp.com>

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Signed-off-by: David S. Miller <davem@davemloft.net>
2010-05-05 21:32:40 -07:00
..
netfilter
addrconf_core.c
addrconf.c
addrlabel.c
af_inet6.c ipv6: Fix default multicast hops setting. 2010-05-03 23:42:27 -07:00
ah6.c
anycast.c
datagram.c IPv6: fix IPV6_RECVERR handling of locally-generated errors 2010-05-05 21:32:40 -07:00
esp6.c
exthdrs_core.c
exthdrs.c
fib6_rules.c
icmp.c
inet6_connection_sock.c Revert "tcp: bind() fix when many ports are bound" 2010-04-28 11:25:59 -07:00
inet6_hashtables.c
ip6_fib.c
ip6_flowlabel.c
ip6_input.c
ip6_output.c ipv6: allow to send packet after receiving ICMPv6 Too Big message with MTU field less than IPV6_MIN_MTU 2010-04-21 22:48:26 -07:00
ip6_tunnel.c
ip6mr.c
ipcomp6.c
ipv6_sockglue.c
Kconfig
Makefile
mcast.c
mip6.c
ndisc.c
netfilter.c
proc.c
protocol.c
raw.c
reassembly.c
route.c net: ipv6 bind to device issue 2010-04-21 22:59:24 -07:00
sit.c
syncookies.c
sysctl_net_ipv6.c
tcp_ipv6.c ipv6: Fix tcp_v6_send_response transport header setting. 2010-04-21 00:47:15 -07:00
tunnel6.c
udp_impl.h
udp.c
udplite.c
xfrm6_input.c
xfrm6_mode_beet.c
xfrm6_mode_ro.c
xfrm6_mode_transport.c
xfrm6_mode_tunnel.c
xfrm6_output.c
xfrm6_policy.c xfrm6: ensure to use the same dev when building a bundle 2010-04-21 16:25:30 -07:00
xfrm6_state.c
xfrm6_tunnel.c