patch-2.1.30 linux/net/ipv6/ipv6_sockglue.c

Next file: linux/net/ipv6/mcast.c
Previous file: linux/net/ipv6/ipv6_route.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.29/linux/net/ipv6/ipv6_sockglue.c linux/net/ipv6/ipv6_sockglue.c
@@ -7,7 +7,7 @@
  *
  *	Based on linux/net/ipv4/ip_sockglue.c
  *
- *	$Id: ipv6_sockglue.c,v 1.12 1996/10/29 22:45:53 roque Exp $
+ *	$Id: ipv6_sockglue.c,v 1.8 1997/03/18 18:24:38 davem Exp $
  *
  *	This program is free software; you can redistribute it and/or
  *      modify it under the terms of the GNU General Public License
@@ -40,7 +40,7 @@
 #include <net/ndisc.h>
 #include <net/protocol.h>
 #include <net/transp_v6.h>
-#include <net/ipv6_route.h>
+#include <net/ip6_route.h>
 #include <net/addrconf.h>
 #include <net/inet_common.h>
 #include <net/sit.h>
@@ -78,12 +78,9 @@
 	if(level!=SOL_IPV6)
 		goto out;
 
-	if (optval == NULL)
-	{
+	if (optval == NULL) {
 		val=0;
-	}
-	else
-	{
+	} else {
 		err = get_user(val, (int *) optval);
 		if(err)
 			return err;
@@ -93,43 +90,33 @@
 	switch (optname) {
 
 	case IPV6_ADDRFORM:
-		if (val == PF_INET)
-		{
+		if (val == PF_INET) {
 			if (sk->protocol != IPPROTO_UDP &&
 			    sk->protocol != IPPROTO_TCP)
-			{				
 				goto out;
-			}
 			
-			if (sk->state != TCP_ESTABLISHED)
-			{
+			if (sk->state != TCP_ESTABLISHED) {
 				retv = ENOTCONN;
 				goto out;
 			}
 			
-			if (!(ipv6_addr_type(&np->daddr) & IPV6_ADDR_MAPPED))
-			{
+			if (!(ipv6_addr_type(&np->daddr) & IPV6_ADDR_MAPPED)) {
 				retv = -EADDRNOTAVAIL;
 				goto out;
 			}
 
-			if (sk->protocol == IPPROTO_TCP)
-			{
+			if (sk->protocol == IPPROTO_TCP) {
 				struct tcp_opt *tp = &(sk->tp_pinfo.af_tcp);
 				
 				sk->prot = &tcp_prot;
 				tp->af_specific = &ipv4_specific;
 				sk->socket->ops = &inet_stream_ops;
-			}
-			else
-			{
+			} else {
 				sk->prot = &udp_prot;
 				sk->socket->ops = &inet_dgram_ops;
 			}
 			retv = 0;
-		}
-		else
-		{
+		} else {
 			retv = -EINVAL;
 		}
 		break;
@@ -146,11 +133,8 @@
 
 	case IPV6_UNICAST_HOPS:
 		if (val > 255)
-		{
 			retv = -EINVAL;
-		}
-		else
-		{
+		else {
 			np->hop_limit = val;
 			retv = 0;
 		}
@@ -158,11 +142,8 @@
 
 	case IPV6_MULTICAST_HOPS:
 		if (val > 255)
-		{
 			retv = -EINVAL;
-		}
-		else
-		{
+		else {
 			np->mcast_hops = val;
 			retv = 0;
 		}
@@ -180,23 +161,19 @@
 		if(err)
 			return -EFAULT;
 				
-		if (ipv6_addr_any(&addr))
-		{
-			np->mc_if = NULL;
-		}
-		else
-		{
+		if (ipv6_addr_any(&addr)) {
+			np->oif = NULL;
+		} else {
 			struct inet6_ifaddr *ifp;
 
 			ifp = ipv6_chk_addr(&addr);
 
-			if (ifp == NULL)
-			{
+			if (ifp == NULL) {
 				retv = -EADDRNOTAVAIL;
 				break;
 			}
 
-			np->mc_if = ifp->idev->dev;
+			np->oif = ifp->idev->dev;
 		}
 		retv = 0;
 		break;
@@ -212,8 +189,8 @@
 		if(err)
 			return -EFAULT;
 		
-		if (mreq.ipv6mr_ifindex == 0)
-		{
+		if (mreq.ipv6mr_ifindex == 0) {
+#if 0
 			struct in6_addr mcast;
 			struct dest_entry *dc;
 
@@ -226,34 +203,22 @@
 				dev = dc->rt.rt_dev;
 				ipv6_dst_unlock(dc);
 			}
-		}
-		else
-		{
-			struct inet6_dev *idev;
-			
-			if ((idev = ipv6_dev_by_index(mreq.ipv6mr_ifindex)))
-			{
-				dev = idev->dev;
-			}
+#endif
+		} else {
+			dev = dev_get_by_index(mreq.ipv6mr_ifindex);
 		}
 
 		if (dev == NULL)
-		{
 			return -ENODEV;
-		}
 		
 		if (optname == IPV6_ADD_MEMBERSHIP)
-		{
 			retv = ipv6_sock_mc_join(sk, dev, &mreq.ipv6mr_multiaddr);
-		}
 		else
-		{
 			retv = ipv6_sock_mc_drop(sk, dev, &mreq.ipv6mr_multiaddr);
-		}
-	}
 	}
+	};
 
-  out:
+out:
 	return retv;
 }
 
@@ -285,7 +250,7 @@
 
 	register_netdevice_notifier(&ipv6_dev_notf);
 	
-	ipv6_route_init();
+	ip6_route_init();
 }
 
 #ifdef MODULE
@@ -294,14 +259,8 @@
 	unregister_netdevice_notifier(&ipv6_dev_notf);
 	dev_remove_pack(&ipv6_packet_type);
 	ipv6_sysctl_unregister();	
-	ipv6_route_cleanup();
+	ip6_route_cleanup();
 	ndisc_cleanup();
 	addrconf_cleanup();	
 }
 #endif
-
-/*
- * Local variables:
- *  compile-command: "gcc -D__KERNEL__ -I/usr/src/linux/include -Wall -Wstrict-prototypes -O6 -m486 -c ipv6_sockglue.c"
- * End:
- */

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov