Messages in this thread Patch in this message |  | | Subject | [PATCH net-next-2.6] net: ping: dont call udp_ioctl() | | From | Eric Dumazet <> | | Date | Sun, 15 May 2011 10:18:40 +0200 |
| |
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,
-- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
|  |