Sophie

Sophie

distrib > Scientific%20Linux > 5x > x86_64 > by-pkgid > 27922b4260f65d317aabda37e42bbbff > files > 2800

kernel-2.6.18-238.el5.src.rpm

From: Jiri Pirko <jpirko@redhat.com>
Date: Thu, 12 Feb 2009 11:07:09 +0100
Subject: [net] ipv6: update setsockopt to support RFC 3493
Message-id: 20090212100708.GB3425@psychotron.englab.brq.redhat.com
O-Subject: [RHEL5.4 patch] BZ484971 net: ipv6: Update setsockopt(IPV6_MULTICAST_IF) to support RFC 3493
Bugzilla: 484971
RH-Acked-by: Neil Horman <nhorman@redhat.com>
RH-Acked-by: David Miller <davem@redhat.com>
RH-Acked-by: Thomas Graf <tgraf@redhat.com>

BZ484971
https://bugzilla.redhat.com/show_bug.cgi?id=484971

Description:
>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.

Upstream:
http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=4953f0fcc06a125f87874743d968c0e185c8b296

Brew:
https://brewweb.devel.redhat.com/taskinfo?taskID=1691096

Test:
Booted on x86_64 and tested with reproducer.

Jirka

diff --git a/net/ipv6/ipv6_sockglue.c b/net/ipv6/ipv6_sockglue.c
index 58d9299..a5f7226 100644
--- a/net/ipv6/ipv6_sockglue.c
+++ b/net/ipv6/ipv6_sockglue.c
@@ -538,12 +538,14 @@ 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 (val) {
+			if (sk->sk_bound_dev_if && sk->sk_bound_dev_if != val)
+				goto e_inval;
 
-		if (__dev_get_by_index(val) == NULL) {
-			retv = -ENODEV;
-			break;
+			if (__dev_get_by_index(val) == NULL) {
+				retv = -ENODEV;
+				break;
+			}
 		}
 		np->mcast_oif = val;
 		retv = 0;