patch-2.2.4 linux/net/ipv4/ip_sockglue.c

Next file: linux/net/ipv4/ipip.c
Previous file: linux/net/ipv4/ip_output.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.2.3/linux/net/ipv4/ip_sockglue.c linux/net/ipv4/ip_sockglue.c
@@ -5,7 +5,7 @@
  *
  *		The IP to API glue.
  *		
- * Version:	$Id: ip_sockglue.c,v 1.39 1998/10/03 09:37:33 davem Exp $
+ * Version:	$Id: ip_sockglue.c,v 1.40 1999/03/21 05:22:42 davem Exp $
  *
  * Authors:	see ip.c
  *
@@ -209,7 +209,9 @@
 					kfree(new_ra);
 				return -EADDRINUSE;
 			}
+			net_serialize_enter();
 			*rap = ra->next;
+			net_serialize_leave();
 			if (ra->destructor)
 				ra->destructor(sk);
 			kfree(ra);
@@ -220,10 +222,10 @@
 		return -ENOBUFS;
 	new_ra->sk = sk;
 	new_ra->destructor = destructor;
-	start_bh_atomic();
 	new_ra->next = ra;
+	net_serialize_enter();
 	*rap = new_ra;
-	end_bh_atomic();
+	net_serialize_leave();
 	return 0;
 }
 
@@ -404,7 +406,7 @@
 			err = ip_options_get(&opt, optval, optlen, 1);
 			if (err)
 				return err;
-			start_bh_atomic();
+			lock_sock(sk);
 			if (sk->type == SOCK_STREAM) {
 				struct tcp_opt *tp = &sk->tp_pinfo.af_tcp;
 #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
@@ -420,7 +422,7 @@
 #endif
 			}
 			opt = xchg(&sk->opt, opt);
-			end_bh_atomic();
+			release_sock(sk);
 			if (opt)
 				kfree_s(opt, sizeof(struct ip_options) + opt->optlen);
 			return 0;
@@ -463,11 +465,12 @@
 			    !capable(CAP_NET_ADMIN))
 				return -EPERM;
 			if (sk->ip_tos != val) {
+				lock_sock(sk);
 				sk->ip_tos=val;
 				sk->priority = rt_tos2priority(val);
 				dst_release(xchg(&sk->dst_cache, NULL)); 
+				release_sock(sk);
 			}
-			sk->priority = rt_tos2priority(val);
 			return 0;
 		case IP_TTL:
 			if (optlen<1)
@@ -637,11 +640,11 @@
 			{
 				unsigned char optbuf[sizeof(struct ip_options)+40];
 				struct ip_options * opt = (struct ip_options*)optbuf;
-				start_bh_atomic();
+				lock_sock(sk);
 				opt->optlen = 0;
 				if (sk->opt)
 					memcpy(optbuf, sk->opt, sizeof(struct ip_options)+sk->opt->optlen);
-				end_bh_atomic();
+				release_sock(sk);
 				if (opt->optlen == 0) 
 					return put_user(0, optlen);
 

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)