Re: [PATCH net-next v4 3/3] net: ipv6: Use ip6_datagram_send_common in ping.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Apr 23, 2014 at 8:11 PM, Florent Fourcot
<florent.fourcot@xxxxxxxxxxxxxxxx> 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@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel Discussion]     [TCP Instrumentation]     [Ethernet Bridging]     [Linux Wireless Networking]     [Linux WPAN Networking]     [Linux Host AP]     [Linux WPAN Networking]     [Linux Bluetooth Networking]     [Linux ATH6KL Networking]     [Linux Networking Users]     [Linux Coverity]     [VLAN]     [Git]     [IETF Annouce]     [Linux Assembly]     [Security]     [Bugtraq]     [Yosemite Information]     [MIPS Linux]     [ARM Linux Kernel]     [ARM Linux]     [Linux Virtualization]     [Linux IDE]     [Linux RAID]     [Linux SCSI]