[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAKD1Yr1bYu1Rtqi6cfSTsnq14dj+esOd=MsPaUs-CbqkFY5H8Q@mail.gmail.com>
Date: Wed, 23 Apr 2014 21:22:23 +0900
From: Lorenzo Colitti <lorenzo@...gle.com>
To: Florent Fourcot <florent.fourcot@...t-bretagne.fr>
Cc: "netdev@...r.kernel.org" <netdev@...r.kernel.org>,
YOSHIFUJI Hideaki <yoshfuji@...ux-ipv6.org>,
Hannes Frederic Sowa <hannes@...essinduktion.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 Wed, Apr 23, 2014 at 8:11 PM, Florent Fourcot
<florent.fourcot@...t-bretagne.fr> wrote:
> Le 22/04/2014 17:14, Lorenzo Colitti a écrit :> +
>> + if (sin6->sin6_family != AF_INET6)
>> + return -EAFNOSUPPORT;
>> +
>
> It has before returned -EINVAL, it changes the return to the user space.
> You made it consistent with other protocols, but perhaps should you add
> a notice in the commit changelog?
Actually I'm not sure what the correct value is. When you setsockopt
IPV6_V6ONLY and then send to a mapped address, the error you get
depends on what you're trying to do - ip6_datagram_connect returns
EAFNOSUPPORT, but udpv6_sendmsg, dccp_v6_connect and tcp_v6_connect
return ENETUNREACH. I think EINVAL is wrong. EAFNOSUPPORT is probably
best because the code doesn't support dual-stack ping sockets, but it
could.
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.
>> - if (sk->sk_bound_dev_if &&
>> - sk->sk_bound_dev_if != u->sin6_scope_id) {
>> - return -EINVAL;
>> - }
>
> What about this check now ?
I think that was incorrect. It would return EINVAL even if you did
something as simple as:
- Open an IPv6 ping socket.
- Bind it to eth0 with SO_BINDTODEVICE
- Send a ping to 2001:: without specifying a scope id.
--
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