[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <47693A52.5020301@hp.com>
Date: Wed, 19 Dec 2007 10:35:46 -0500
From: Brian Haley <brian.haley@...com>
To: David Stevens <dlstevens@...ibm.com>
Cc: David Miller <davem@...emloft.net>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
netdev-owner@...r.kernel.org,
YOSHIFUJI Hideaki <yoshfuji@...ux-ipv6.org>
Subject: Re: [PATCH] [IPv6]: IPV6_MULTICAST_IF setting is ignored on link-local
connect()
Hi David,
David Stevens wrote:
> OK, I see what you're trying to fix now.
>
> I think the scope_id checks are not quite right-- they
> should be something like this:
>
> if (addr_type&IPV6_ADDR_LINKLOCAL) {
> if (addr_len >= sizeof(struct sockaddr_in6)) {
> if (sk->sk_bound_dev_if && usin->sin6_scope_id &&
> sk->sk_bound_dev_if != usin->sin6_scope_id) {
> err = -EINVAL;
> goto out;
> }
> if (usin->sin6_scope_id)
> sk->sk_bound_dev_if = usin->sin6_scope_id;
> if (!sk->sk_bound_dev_if &&
> (addr_type & IPV6_ADDR_MULTICAST))
> fl.oif = np->mcast_oif;
This assignment will not get us past the next check...
> /* connect to the link-local addres requires an interface */
> if (!sk->sk_bound_dev_if) {
> err = -EINVAL;
> goto out;
> }
... and even if it did, fl.oif is over-written by sk_bound_dev_if just a
few lines down.
> If I did an SO_BINDTODEVICE and specified sin6_scope_id,
> then they better agree.
> If I specified sin6_scope_id without SO_BINDTODEVICE, set
> the device to that.
> If I get this far without a device and it's multicast, use
> mcast_oif
> If I get all through that and don't have a device, EINVAL.
You also need to check if mcast_oif matches sk_bind_dev_if here - it's
actually done in the setsockopt() code already when we set it,
duplicating it here isn't that big a deal.
How about the following patch? It does not set sk_bound_dev_if to
mcast_oif, but does allow the connect() to succeed.
-Brian
Signed-off-by: Brian Haley <brian.haley@...com>
---
View attachment "mcast_oif.patch" of type "text/x-patch" (1120 bytes)
Powered by blists - more mailing lists