patch-2.3.15 linux/include/net/ip6_route.h

Next file: linux/include/net/ip_fib.h
Previous file: linux/include/net/ip6_fib.h
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.3.14/linux/include/net/ip6_route.h linux/include/net/ip6_route.h
@@ -87,6 +87,8 @@
 extern void rt6_ifdown(struct net_device *dev);
 extern void rt6_mtu_change(struct net_device *dev, unsigned mtu);
 
+extern rwlock_t rt6_lock;
+
 /*
  *	Store a destination cache entry in a socket
  *	For UDP/RAW sockets this is done on udp_connect.
@@ -95,16 +97,14 @@
 extern __inline__ void ip6_dst_store(struct sock *sk, struct dst_entry *dst,
 				     struct in6_addr *daddr)
 {
-	struct ipv6_pinfo *np;
-	struct rt6_info *rt;
-
-	np = &sk->net_pinfo.af_inet6;
-	dst_release(xchg(&sk->dst_cache,dst));
-
-	rt = (struct rt6_info *) dst;
+	struct ipv6_pinfo *np = &sk->net_pinfo.af_inet6;
+	struct rt6_info *rt = (struct rt6_info *) dst;
 
+	write_lock(&sk->dst_lock);
+	__sk_dst_set(sk, dst);
 	np->daddr_cache = daddr;
 	np->dst_cookie = rt->rt6i_node ? rt->rt6i_node->fn_sernum : 0;
+	write_unlock(&sk->dst_lock);
 }
 
 #endif

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