Hello. On 4/4/2016 10:09 AM, Liping Zhang wrote:
From: Liping Zhang <[email protected]> 1. Socket can use bind(directly) or connect(indirectly) to bind to a local ip address, and later if the network becomes down, that cause the source address becomes nonlocal, then send() call will fail and return EINVAL. But this error code is confusing, acctually we did not pass any invalid arguments. Furthermore, send() maybe return ok at first, it now returns fail just because of a temporary network problem, i.e. when the network recovery, send() call will become ok. Return EADDRNOTAVAIL instead of EINVAL in such situation is better. 2. We can use IPV6_PKTINFO to specify the ipv6 source address when call sendmsg() to send packet, but if the address is not available, call will fail and EINVAL is returned. This error code is not very appropriate, it failed maybe just because of a temporary network problem. Also RFC3542, section 6.6 describe an example returns EADDRNOTAVAIL: "ipi6_ifindex specifies an interface but the address ipi6_addr is not available for use on that interface.". So return EADDRNOTAVAIL instead of EINVAL here. Signed-off-by: Liping Zhang <[email protected]>
I think this should be 2 patches as you seem to fix 2 separate problems. [...] MBR, Sergei
