patch-2.1.89 linux/net/ipv4/raw.c

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

diff -u --recursive --new-file v2.1.88/linux/net/ipv4/raw.c linux/net/ipv4/raw.c
@@ -342,7 +342,9 @@
 			daddr = ipc.opt->faddr;
 		}
 	}
-	tos = RT_TOS(sk->ip_tos) | (sk->localroute || (msg->msg_flags&MSG_DONTROUTE));
+	tos = RT_TOS(sk->ip_tos) | sk->localroute;
+	if (msg->msg_flags&MSG_DONTROUTE)
+		tos |= RTO_ONLINK;
 
 	if (MULTICAST(daddr)) {
 		if (!ipc.oif)
@@ -403,8 +405,7 @@
 	sk->rcv_saddr = sk->saddr = addr->sin_addr.s_addr;
 	if(chk_addr_ret == RTN_MULTICAST || chk_addr_ret == RTN_BROADCAST)
 		sk->saddr = 0;  /* Use device */
-	dst_release(sk->dst_cache);
-	sk->dst_cache = NULL;
+	dst_release(xchg(&sk->dst_cache, NULL));
 	return 0;
 }
 
@@ -453,6 +454,9 @@
 	}
 	
 	err = skb_copy_datagram_iovec(skb, 0, msg->msg_iov, copied);
+	if (err)
+		goto done;
+
 	sk->stamp=skb->stamp;
 
 	/* Copy the address. */
@@ -462,8 +466,9 @@
 	}
 	if (sk->ip_cmsg_flags)
 		ip_cmsg_recv(msg, skb);
+done:
 	skb_free_datagram(sk, skb);
-	return err ? err : (copied);
+	return (err ? : copied);
 }
 
 static int raw_init(struct sock *sk)

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