From: Brian Haley <brian.haley@hp.com>
To: David Miller <davem@davemloft.net>,
YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>,
David Stevens <dlstevens@us.ibm.com>
Cc: "netdev@vger.kernel.org" <netdev@vger.kernel.org>
Subject: [PATCH] [IPv6]: IPV6_MULTICAST_IF setting is ignored on link-local connect()
Date: Tue, 18 Dec 2007 15:57:54 -0500 [thread overview]
Message-ID: <47683452.8080102@hp.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 395 bytes --]
Trying to connect() to an IPv6 link-local multicast address by
specifying the outgoing multicast interface doesn't work, you have to
bind to a device first with an SO_BINDTODEVICE setsockopt() call. This
patch allows the IPV6_MULTICAST_IF setting to also control which
interface should be used for the connection, as specified in RFC 3493.
Signed-off-by: Brian Haley <brian.haley@hp.com>
---
[-- Attachment #2: mcast_oif.patch --]
[-- Type: text/x-patch, Size: 644 bytes --]
diff --git a/net/ipv6/datagram.c b/net/ipv6/datagram.c
index 2ed689a..0b1e7eb 100644
--- a/net/ipv6/datagram.c
+++ b/net/ipv6/datagram.c
@@ -123,9 +123,15 @@ 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 ((addr_type & IPV6_ADDR_MULTICAST) && np->mcast_oif) {
+ if (sk->sk_bound_dev_if &&
+ sk->sk_bound_dev_if != np->mcast_oif) {
+ err = -EINVAL;
+ goto out;
+ }
+ sk->sk_bound_dev_if = np->mcast_oif;
}
/* Connect to link-local address requires an interface */
next reply other threads:[~2007-12-18 20:57 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-12-18 20:57 Brian Haley [this message]
2007-12-18 21:52 ` [PATCH] [IPv6]: IPV6_MULTICAST_IF setting is ignored on link-local connect() 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
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=47683452.8080102@hp.com \
--to=brian.haley@hp.com \
--cc=davem@davemloft.net \
--cc=dlstevens@us.ibm.com \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.