Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1a8218e9 authored by Eric Dumazet's avatar Eric Dumazet Committed by David S. Miller
Browse files

net: ping: dont call udp_ioctl()



udp_ioctl() really handles UDP and UDPLite protocols.

1) It can increment UDP_MIB_INERRORS in case first_packet_length() finds
a frame with bad checksum.

2) It has a dependency on sizeof(struct udphdr), not applicable to
ICMP/PING

If ping sockets need to handle SIOCINQ/SIOCOUTQ ioctl, this should be
done differently.

Signed-off-by: default avatarEric Dumazet <eric.dumazet@gmail.com>
CC: Vasiliy Kulikov <segoon@openwall.com>
Acked-by: default avatarVasiliy Kulikov <segoon@openwall.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 534ea99b
Loading
Loading
Loading
Loading
+0 −19
Original line number Original line Diff line number Diff line
@@ -22,7 +22,6 @@


#include <asm/system.h>
#include <asm/system.h>
#include <linux/uaccess.h>
#include <linux/uaccess.h>
#include <asm/ioctls.h>
#include <linux/types.h>
#include <linux/types.h>
#include <linux/fcntl.h>
#include <linux/fcntl.h>
#include <linux/socket.h>
#include <linux/socket.h>
@@ -609,23 +608,6 @@ int ping_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
	goto out;
	goto out;
}
}


/*
 *	IOCTL requests applicable to the UDP^H^H^HICMP protocol
 */

int ping_ioctl(struct sock *sk, int cmd, unsigned long arg)
{
	pr_debug("ping_ioctl(sk=%p,sk->num=%u,cmd=%d,arg=%lu)\n",
		inet_sk(sk), inet_sk(sk)->inet_num, cmd, arg);
	switch (cmd) {
	case SIOCOUTQ:
	case SIOCINQ:
		return udp_ioctl(sk, cmd, arg);
	default:
		return -ENOIOCTLCMD;
	}
}

int ping_recvmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
int ping_recvmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
		 size_t len, int noblock, int flags, int *addr_len)
		 size_t len, int noblock, int flags, int *addr_len)
{
{
@@ -735,7 +717,6 @@ struct proto ping_prot = {
	.close =	ping_close,
	.close =	ping_close,
	.connect =	ip4_datagram_connect,
	.connect =	ip4_datagram_connect,
	.disconnect =	udp_disconnect,
	.disconnect =	udp_disconnect,
	.ioctl =	ping_ioctl,
	.setsockopt =	ip_setsockopt,
	.setsockopt =	ip_setsockopt,
	.getsockopt =	ip_getsockopt,
	.getsockopt =	ip_getsockopt,
	.sendmsg =	ping_sendmsg,
	.sendmsg =	ping_sendmsg,