netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [IPv6] Update setsockopt(IPV6_MULTICAST_IF) to support RFC 3493, try2
@ 2007-10-11 17:40 Brian Haley
  2007-10-11 17:49 ` David Stevens
  0 siblings, 1 reply; 3+ messages in thread
From: Brian Haley @ 2007-10-11 17:40 UTC (permalink / raw)
  To: David Miller, YOSHIFUJI Hideaki; +Cc: netdev@vger.kernel.org, David Stevens

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

Hi,

 From RFC 3493, Section 5.2:

       IPV6_MULTICAST_IF

          Set the interface to use for outgoing multicast packets.  The
          argument is the index of the interface to use.  If the
          interface index is specified as zero, the system selects the
          interface (for example, by looking up the address in a routing
          table and using the resulting interface).

This patch adds support for (index == 0) to reset the value to it's 
original state, allowing the system to choose the best interface.  IPv4 
already behaves this way.

-Brian


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

[-- Attachment #2: ipv6.multicast_if.patch --]
[-- Type: text/x-patch, Size: 655 bytes --]

diff --git a/net/ipv6/ipv6_sockglue.c b/net/ipv6/ipv6_sockglue.c
index 532425d..1334fc1 100644
--- a/net/ipv6/ipv6_sockglue.c
+++ b/net/ipv6/ipv6_sockglue.c
@@ -539,12 +539,15 @@ done:
 	case IPV6_MULTICAST_IF:
 		if (sk->sk_type == SOCK_STREAM)
 			goto e_inval;
-		if (sk->sk_bound_dev_if && sk->sk_bound_dev_if != val)
-			goto e_inval;
 
-		if (__dev_get_by_index(&init_net, val) == NULL) {
-			retv = -ENODEV;
-			break;
+		if (val) {
+			if (sk->sk_bound_dev_if && sk->sk_bound_dev_if != val)
+				goto e_inval;
+
+			if (__dev_get_by_index(&init_net, val) == NULL) {
+				retv = -ENODEV;
+				break;
+			}
 		}
 		np->mcast_oif = val;
 		retv = 0;

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

end of thread, other threads:[~2007-10-11 21:39 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-10-11 17:40 [IPv6] Update setsockopt(IPV6_MULTICAST_IF) to support RFC 3493, try2 Brian Haley
2007-10-11 17:49 ` David Stevens
2007-10-11 21:39   ` 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).