netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Brian Haley <brian.haley@hp.com>
To: David Stevens <dlstevens@us.ibm.com>
Cc: David Miller <davem@davemloft.net>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	netdev-owner@vger.kernel.org,
	YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
Subject: Re: [PATCH] [IPv6]: IPV6_MULTICAST_IF setting is ignored on link-local connect()
Date: Mon, 07 Jan 2008 12:03:12 -0500	[thread overview]
Message-ID: <47825B50.2060200@hp.com> (raw)
In-Reply-To: <OF27B7DA9C.52E5380F-ON882573B6.00650422-882573B6.0068581B@us.ibm.com>

[-- Attachment #1: Type: text/plain, Size: 1135 bytes --]

David Stevens wrote:
>         Yeah, that's what I get for typing in off-the-cuff code. What
> I was thinking was the fl.oif assignment instead was:
>         if (!sk->sk_bound_dev_if &&
>                 (addr_type & IPV6_ADDR_MULTICAST))
>                         sk->sk_bound_dev_if = np->mcast_oif;
> 
> Which it is not, but maybe it could be, since this is a connect().

How about the simple patch below?  I just removed the ENINVAL check from 
my original patch, but it accomplishes the same thing.

> That patch looks better, but I'm wondering if we could just remove the
> requirement that sin6_scope_id be set here if it's multicast, since it
> is doing the following later in the code:
> 
>         if (!fl.oif && (addr_type&IPV6_ADDR_MULTICAST))
>                 fl.oif = np->mcast_oif;
> 
> So, really, all we need to do is get through the LINKLOCAL section
> without error in the multicast case and we can remove the redundant
> multicast check there. I think that'd be simpler.

I don't think we can remove that check since it covers the non-multicast 
case.

-Brian

Signed-off-by: Brian Haley <brian.haley@hp.com>
---

[-- Attachment #2: mcast_oif.patch --]
[-- Type: text/x-patch, Size: 574 bytes --]

diff --git a/net/ipv6/datagram.c b/net/ipv6/datagram.c
index 2ed689a..5d4245a 100644
--- a/net/ipv6/datagram.c
+++ b/net/ipv6/datagram.c
@@ -123,11 +123,11 @@ ipv4_connected:
 				goto out;
 			}
 			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;
 		}
 
+		if (!sk->sk_bound_dev_if && (addr_type & IPV6_ADDR_MULTICAST))
+			sk->sk_bound_dev_if = np->mcast_oif;
+
 		/* Connect to link-local address requires an interface */
 		if (!sk->sk_bound_dev_if) {
 			err = -EINVAL;

  parent reply	other threads:[~2008-01-07 17:03 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-12-18 20:57 [PATCH] [IPv6]: IPV6_MULTICAST_IF setting is ignored on link-local connect() Brian Haley
2007-12-18 21:52 ` David Stevens
2007-12-18 22:34   ` Brian Haley
2007-12-18 23:56     ` David Stevens
2007-12-19 15:20       ` Vlad Yasevich
2007-12-19 18:18         ` David Stevens
2007-12-19 19:02           ` Vlad Yasevich
2007-12-19 19:14           ` Brian Haley
2007-12-19 15:35       ` Brian Haley
2007-12-19 18:57         ` David Stevens
2007-12-19 19:15           ` Brian Haley
2007-12-19 19:28             ` David Stevens
2008-01-07 17:03           ` Brian Haley [this message]
2008-01-08  1:18             ` David Stevens
2008-01-09  7:53               ` David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=47825B50.2060200@hp.com \
    --to=brian.haley@hp.com \
    --cc=davem@davemloft.net \
    --cc=dlstevens@us.ibm.com \
    --cc=netdev-owner@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=yoshfuji@linux-ipv6.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).