linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Eric Dumazet <eric.dumazet@gmail.com>
To: Vasiliy Kulikov <segoon@openwall.com>
Cc: David Miller <davem@davemloft.net>,
	solar@openwall.com, linux-kernel@vger.kernel.org,
	netdev@vger.kernel.org, peak@argo.troja.mff.cuni.cz,
	kees.cook@canonical.com, dan.j.rosenberg@gmail.com,
	eugene@redhat.com, nelhage@ksplice.com, kuznet@ms2.inr.ac.ru,
	pekkas@netcore.fi, jmorris@namei.org, yoshfuji@linux-ipv6.org,
	kaber@trash.net
Subject: [PATCH net-next-2.6] net: ping: dont call udp_ioctl()
Date: Sun, 15 May 2011 10:18:40 +0200	[thread overview]
Message-ID: <1305447520.3120.88.camel@edumazet-laptop> (raw)
In-Reply-To: <20110513200100.GA3875@albatros>

Le samedi 14 mai 2011 à 00:01 +0400, Vasiliy Kulikov a écrit :

> +/*
> + *	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;
> +	}
> +}

Do we really need to support SIOCOUTQ and SIOCINQ ioctls for ping
sockets ?

I ask this because udp_ioctl() assumes it handles UDP frames, and can
change UDP_MIB_INERRORS in case first_packet_length() finds a frame with
bad checksum.

[ UDP let the checksum be completed and checked when it performs the
Kernel->User copy ]

I would just remove this legacy, please shout if you believe we really
should support ioctl...

[ I actually tested that ping was still working correctly, of course ]

BTW, link
(ftp://mirrors.kernel.org/openwall/Owl/current/sources/Owl/packages/iputils/iputils-ss020927.tar.gz ) provided in http://openwall.info/wiki/people/segoon/ping is not working.

I had to manually patch iputils-s20101006.tar.bz2 instead.

Thanks

[PATCH net-next-2.6] 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: Eric Dumazet <eric.dumazet@gmail.com>
CC: Vasiliy Kulikov <segoon@openwall.com>
---
 net/ipv4/ping.c |   11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/net/ipv4/ping.c b/net/ipv4/ping.c
index 7041d09..952505a 100644
--- a/net/ipv4/ping.c
+++ b/net/ipv4/ping.c
@@ -610,20 +610,15 @@ do_confirm:
 }
 
 /*
- *	IOCTL requests applicable to the UDP^H^H^HICMP protocol
+ *	IOCTL requests applicable to PING sockets
  */
 
 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;
-	}
+
+	return -ENOIOCTLCMD;
 }
 
 int ping_recvmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,



  parent reply	other threads:[~2011-05-15  8:18 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-09 10:15 [PATCH] net: ipv4: add IPPROTO_ICMP socket kind Vasiliy Kulikov
2011-04-12  5:06 ` Solar Designer
2011-04-12 21:25   ` David Miller
2011-04-13 11:22     ` Vasiliy Kulikov
2011-05-05 11:32     ` Vasiliy Kulikov
2011-05-10 18:09     ` [PATCH v2] " Vasiliy Kulikov
2011-05-10 19:15       ` David Miller
2011-05-10 19:45         ` Vasiliy Kulikov
2011-05-13 20:01         ` [PATCH v3] " Vasiliy Kulikov
2011-05-13 20:08           ` David Miller
2011-05-13 21:30           ` Andi Kleen
2011-05-13 22:22             ` [PATCH net-next-2.6] net: ipv4: add ping_group_range documentation Eric Dumazet
2011-05-15  8:18           ` Eric Dumazet [this message]
2011-05-15 21:30             ` [PATCH net-next-2.6] net: ping: dont call udp_ioctl() Solar Designer
2011-05-15 21:44               ` David Miller
2011-05-16  7:26                 ` [PATCH net-next-2.6 v2] " Eric Dumazet
2011-05-16 12:48                   ` Vasiliy Kulikov
2011-05-16 15:50                   ` David Miller
2011-04-13 10:29 ` [PATCH] net: ipv4: add IPPROTO_ICMP socket kind Alexey Dobriyan
2011-04-13 11:32   ` Vasiliy Kulikov
2011-04-14  9:16     ` Alexey Dobriyan
2011-04-14  1:53   ` Simon Horman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1305447520.3120.88.camel@edumazet-laptop \
    --to=eric.dumazet@gmail.com \
    --cc=dan.j.rosenberg@gmail.com \
    --cc=davem@davemloft.net \
    --cc=eugene@redhat.com \
    --cc=jmorris@namei.org \
    --cc=kaber@trash.net \
    --cc=kees.cook@canonical.com \
    --cc=kuznet@ms2.inr.ac.ru \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nelhage@ksplice.com \
    --cc=netdev@vger.kernel.org \
    --cc=peak@argo.troja.mff.cuni.cz \
    --cc=pekkas@netcore.fi \
    --cc=segoon@openwall.com \
    --cc=solar@openwall.com \
    --cc=yoshfuji@linux-ipv6.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).