linux/net
Lorenzo Colitti 9145736d48 net: ping: Return EAFNOSUPPORT when appropriate.
1. For an IPv4 ping socket, ping_check_bind_addr does not check
   the family of the socket address that's passed in. Instead,
   make it behave like inet_bind, which enforces either that the
   address family is AF_INET, or that the family is AF_UNSPEC and
   the address is 0.0.0.0.
2. For an IPv6 ping socket, ping_check_bind_addr returns EINVAL
   if the socket family is not AF_INET6. Return EAFNOSUPPORT
   instead, for consistency with inet6_bind.
3. Make ping_v4_sendmsg and ping_v6_sendmsg return EAFNOSUPPORT
   instead of EINVAL if an incorrect socket address structure is
   passed in.
4. Make IPv6 ping sockets be IPv6-only. The code does not support
   IPv4, and it cannot easily be made to support IPv4 because
   the protocol numbers for ICMP and ICMPv6 are different. This
   makes connect(::ffff:192.0.2.1) fail with EAFNOSUPPORT instead
   of making the socket unusable.

Among other things, this fixes an oops that can be triggered by:

    int s = socket(AF_INET, SOCK_DGRAM, IPPROTO_ICMP);
    struct sockaddr_in6 sin6 = {
        .sin6_family = AF_INET6,
        .sin6_addr = in6addr_any,
    };
    bind(s, (struct sockaddr *) &sin6, sizeof(sin6));

Change-Id: If06ca86d9f1e4593c0d6df174caca3487c57a241
Signed-off-by: Lorenzo Colitti <lorenzo@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2015-03-04 15:46:51 -05:00
..
6lowpan
9p
802
8021q
appletalk
atm
ax25
batman-adv
bluetooth
bridge net: bridge: add compile-time assert for cb struct size 2015-03-03 14:07:04 -05:00
caif caif: fix a signedness bug in cfpkt_iterate() 2015-02-20 17:35:14 -05:00
can
ceph Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/sage/ceph-client 2015-02-19 14:14:42 -08:00
core net: do not use rcu in rtnl_dump_ifinfo() 2015-03-01 00:07:00 -05:00
dcb
dccp
decnet decnet: Fix obvious o/0 typo 2015-02-23 15:28:50 -05:00
dns_resolver
dsa net: dsa: Set valid phy interface type 2015-02-17 10:37:39 -08:00
ethernet
hsr net/hsr: Fix NULL pointer dereference and refcnt bugs when deleting a HSR interface. 2015-03-01 13:40:23 -05:00
ieee802154
ipv4 net: ping: Return EAFNOSUPPORT when appropriate. 2015-03-04 15:46:51 -05:00
ipv6 net: ping: Return EAFNOSUPPORT when appropriate. 2015-03-04 15:46:51 -05:00
ipx
irda irda: replace current->state by set_current_state() 2015-02-23 17:21:11 -05:00
iucv
key
l2tp
lapb
llc
mac80211 mac80211: Send EAPOL frames at lowest rate 2015-02-26 21:03:06 +01:00
mac802154
mpls
netfilter rhashtable: remove indirection for grow/shrink decision functions 2015-02-27 16:06:02 -05:00
netlabel Merge branch 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security 2015-02-11 20:25:11 -08:00
netlink rhashtable: remove indirection for grow/shrink decision functions 2015-02-27 16:06:02 -05:00
netrom
nfc
openvswitch openvswitch: Fix serialization of non-masked set actions. 2015-03-03 14:38:57 -05:00
packet af_packet: don't pass empty blocks for PACKET_V3 2015-02-24 16:08:42 -05:00
phonet
rds rds: rds_cong_queue_updates needs to defer the congestion update transmission 2015-02-11 14:35:44 -08:00
rfkill
rose
rxrpc rxrpc: don't multiply with HZ twice 2015-03-01 13:40:23 -05:00
sched Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2015-03-03 15:30:07 -08:00
sctp
sunrpc Merge branch 'for-4.0' of git://linux-nfs.org/~bfields/linux 2015-03-03 15:52:50 -08:00
switchdev Merge branch 'kconfig' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild 2015-02-19 10:36:45 -08:00
tipc rhashtable: remove indirection for grow/shrink decision functions 2015-02-27 16:06:02 -05:00
unix
vmw_vsock
wimax
wireless cfg80211: calls nl80211_exit on error 2015-02-24 11:41:21 +01:00
x25
xfrm
compat.c net: compat: Ignore MSG_CMSG_COMPAT in compat_sys_{send, recv}msg 2015-02-23 17:22:05 -05:00
Kconfig
Makefile
socket.c
sysctl_net.c