netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Vlad Yasevich <vladislav.yasevich@hp.com>
To: David Stevens <dlstevens@us.ibm.com>
Cc: Brian Haley <brian.haley@hp.com>,
	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: Wed, 19 Dec 2007 10:20:53 -0500	[thread overview]
Message-ID: <476936D5.4070606@hp.com> (raw)
In-Reply-To: <OF7B1ADDCA.711DCE7B-ON882573B5.00820D67-882573B5.0083AEF8@us.ibm.com>

Daven

David Stevens wrote:
> Brian,
> 
> 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;
>         }
> 
>         /* connect to the link-local addres requires an interface */
>         if (!sk->sk_bound_dev_if) {
>                 err = -EINVAL;
>                 goto out;
>         }
> }

But this still requires either a SO_BINDTODEVICE or sin6_scope_id.  This
means the an application can call BINDTODEVICE(eth0), MULTICAST_IF(eth1)
issue a connect on a UDP socket an succeed?  Seems wrong to me.

Can you check section 6.7 of RFC 3542.

Thanks
-vlad

> 
>         That is (in English):
> 
>         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.
> 
>         Does that work for you?
> 
>                                         +-DLS
> 
> --
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 


  reply	other threads:[~2007-12-19 15:21 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 [this message]
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
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=476936D5.4070606@hp.com \
    --to=vladislav.yasevich@hp.com \
    --cc=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).