[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAKD1Yr0FWRmmC1BkrADnrSRvbD3_J7fO8SR8gqgEz8exfqD01w@mail.gmail.com>
Date: Fri, 25 Apr 2014 00:35:21 +0900
From: Lorenzo Colitti <lorenzo@...gle.com>
To: Lorenzo Colitti <lorenzo@...gle.com>,
Florent Fourcot <florent.fourcot@...t-bretagne.fr>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
YOSHIFUJI Hideaki <yoshfuji@...ux-ipv6.org>,
David Miller <davem@...emloft.net>,
Eric Dumazet <eric.dumazet@...il.com>
Subject: Re: [PATCH net-next v4 3/3] net: ipv6: Use ip6_datagram_send_common
in ping.
On Fri, Apr 25, 2014 at 12:06 AM, Hannes Frederic Sowa
<hannes@...essinduktion.org> wrote:
>> There are probably very few users of this code at the moment, since
>> the code was only released in 3.12, and support hasn't made it into
>> iputils yet. And even there, ping just probably prints the error
>> message and exits. So I don't think it's a big deal to change the
>> return code.
>
> Sure, but we don't know about other applications. Wouldn't it be just easier
> and leave this as is for now and finally let ipv6 ping sockets also handle
> ipv4? I looked at it some time ago and it didn't look complicated.
I tried this today, but it's trickier than it looks. If you just
naively call ping_v4_sendmsg, then things almost work, except the
protocol field in the IPv4 header is set to 58 (ICMPv6) instead of 1
(ICMP).
The reason is that we call ping_v4_push_pending_frames ->
ip_push_pending_frames -> ip_finish_skb -> __ip_make_skb , which ends
up doing:
iph->protocol = sk->sk_protocol;
Passing down the protocol all through that call chain seems overkill,
because in basically every case except ICMP on a dual-stack socket,
the protocol you want is in fact sk->sk_protocol.
I suppose that since ping_v4_push_pending_frames gets called with the
socket locked, we might be able to get away with setting
sk->sk_protocol just before ping_v4_push_pending_frames and restoring
it afterwards. But that feels hacky and I don't know what else it
could break.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists