netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] [IPv6]: IPV6_MULTICAST_IF setting is ignored on link-local connect()
@ 2007-12-18 20:57 Brian Haley
  2007-12-18 21:52 ` David Stevens
  0 siblings, 1 reply; 15+ messages in thread
From: Brian Haley @ 2007-12-18 20:57 UTC (permalink / raw)
  To: David Miller, YOSHIFUJI Hideaki, David Stevens; +Cc: netdev@vger.kernel.org

[-- 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 */


^ permalink raw reply related	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2008-01-09  7:53 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2008-01-08  1:18             ` David Stevens
2008-01-09  7:53               ` David Miller

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).