At Fri, 26 May 2000 22:53:29 +0900,
Hideaki YOSHIFUJI <yoshfuji@ecei.tohoku.ac.jp> wrote:
> > Or should we initialize sk->bound_dev_if when socket is created?
>
> We should initialize sk->bound_dev_if to 0 when socket is create by
> socket(2). When connect(2) or bind(2) is called without sin6_scope_id,
> we should keep the value of sk->bound_dev_if.
What do you mean?
If sk->bound_dev_if to 0 when socket is created, connect(2) or bind(2)
is called without sin6_scope_id and keep the value of sk->bound_dev_if,
then, for example, around line 294 of linux/net/udp.c
int udpv6_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len)
:
if (addr_type&IPV6_ADDR_LINKLOCAL) {
if (addr_len >= sizeof(struct sockaddr_in6) &&
usin->sin6_scope_id) {
if (sk->bound_dev_if && sk->bound_dev_if != usin->sin6_scope_id) {
fl6_sock_release(flowlabel);
return -EINVAL;
}
sk->bound_dev_if = usin->sin6_scope_id;
}
/* here, if connect(2) called for link local addr without
* sin6_scope_id, sk->bound_dev_if remains to be 0 because
* it was initialied to 0 and never assigned any other value.
*/
/* Connect to link-local address requires an interface */
if (sk->bound_dev_if == 0)
/* So, connect(2) to link local address
* without sin6_scope_id falls into here,
* then return -EINVAL ...
*/
return -EINVAL;
}
:
Therefore, we can't connect to IPv6 link local address without sin6_scope_id,
unless my previous patch applied.
Is this, that is, connect(2) for link local addr without sin6_scope_id
will fail, right behavior? If so, should we fix userland application?
Thanks,
Fumitoshi UKAI
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/
This archive was generated by hypermail 2b29 : Wed May 31 2000 - 21:00:16 EST