patch-2.1.11 linux/net/ipv4/packet.c

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

diff -u --recursive --new-file v2.1.10/linux/net/ipv4/packet.c linux/net/ipv4/packet.c
@@ -282,7 +282,7 @@
  *	Bind a packet socket to a device
  */
 
-static int packet_bind(struct sock *sk, struct sockaddr *uaddr, int addr_len)
+static int packet_bind(struct sock *sk, struct sockaddr *uaddr, size_t addr_len)
 {
 	char name[15];
 	struct device *dev;
@@ -410,9 +410,6 @@
 	struct sockaddr_pkt *saddr=(struct sockaddr_pkt *)msg->msg_name;
 	int err;
 
-	if (sk->shutdown & RCV_SHUTDOWN) 
-		return(0);
-		
 	/*
 	 *	If there is no protocol hook then the device is down.
 	 */
@@ -450,8 +447,13 @@
 	 *	user program they can ask the device for its MTU anyway.
 	 */
 	 
-	copied = min(len, skb->len);
-
+	copied = skb->len;
+	if(copied>len)
+	{
+		copied=len;
+		msg->msg_flags|=MSG_TRUNC;
+	}
+	
 	/* We can't use skb_copy_datagram here */
 	err = memcpy_toiovec(msg->msg_iov, skb->data, copied);
 	if (err)

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