patch-2.1.89 linux/net/packet/af_packet.c

Next file: linux/net/socket.c
Previous file: linux/net/netsyms.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.88/linux/net/packet/af_packet.c linux/net/packet/af_packet.c
@@ -66,8 +66,8 @@
 #include <linux/module.h>
 #include <linux/init.h>
 
-#if defined(CONFIG_DLCI) || defined(CONFIG_DLCI_MODULE)
-#include <linux/if_frad.h>
+#ifdef CONFIG_INET
+#include <net/inet_common.h>
 #endif
 
 #ifdef CONFIG_BRIDGE
@@ -778,9 +778,8 @@
 			  int flags, struct scm_cookie *scm)
 {
 	struct sock *sk = sock->sk;
-	int copied=0;
 	struct sk_buff *skb;
-	int err;
+	int copied, err;
 
 #if 0
 	/* What error should we return now? EUNATTACH? */
@@ -816,7 +815,7 @@
 	 */
 
 	if(skb==NULL)
-		return err;
+		goto out;
 
 	/*
 	 *	You lose any data beyond the buffer you gave. If it worries a
@@ -824,7 +823,7 @@
 	 */
 
 	copied = skb->len;
-	if(copied>len)
+	if (copied > len)
 	{
 		copied=len;
 		msg->msg_flags|=MSG_TRUNC;
@@ -833,9 +832,7 @@
 	/* We can't use skb_copy_datagram here */
 	err = memcpy_toiovec(msg->msg_iov, skb->data, copied);
 	if (err)
-	{
-		return -EFAULT;
-	}
+		goto out_free;
 
 	sk->stamp=skb->stamp;
 
@@ -843,13 +840,15 @@
 		memcpy(msg->msg_name, skb->cb, msg->msg_namelen);
 
 	/*
-	 *	Free or return the buffer as appropriate. Again this hides all the
-	 *	races and re-entrancy issues from us.
+	 *	Free or return the buffer as appropriate. Again this
+	 *	hides all the races and re-entrancy issues from us.
 	 */
+	err = copied;
 
+out_free:
 	skb_free_datagram(sk, skb);
-
-	return(copied);
+out:
+	return err;
 }
 
 #ifdef CONFIG_SOCK_PACKET
@@ -1117,7 +1116,9 @@
 				err = -EFAULT;
 			return err;
 		case SIOCGIFFLAGS:
+#ifndef CONFIG_INET
 		case SIOCSIFFLAGS:
+#endif
 		case SIOCGIFCONF:
 		case SIOCGIFMETRIC:
 		case SIOCSIFMETRIC:
@@ -1146,23 +1147,28 @@
 			return -ENOPKG;
 #endif						
 			
+#ifdef CONFIG_INET
+		case SIOCADDRT:
+		case SIOCDELRT:
+		case SIOCDARP:
+		case SIOCGARP:
+		case SIOCSARP:
+		case SIOCDRARP:
+		case SIOCGRARP:
+		case SIOCSRARP:
+		case SIOCGIFADDR:
+		case SIOCSIFADDR:
+		case SIOCGIFBRDADDR:
+		case SIOCSIFBRDADDR:
+		case SIOCGIFNETMASK:
+		case SIOCSIFNETMASK:
+		case SIOCGIFDSTADDR:
+		case SIOCSIFDSTADDR:
+		case SIOCSIFFLAGS:
 		case SIOCADDDLCI:
 		case SIOCDELDLCI:
-#ifdef CONFIG_DLCI
-			return(dlci_ioctl(cmd, (void *) arg));
-#endif
-
-#ifdef CONFIG_DLCI_MODULE
-
-#ifdef CONFIG_KERNELD
-			if (dlci_ioctl_hook == NULL)
-				request_module("dlci");
+			return inet_dgram_ops.ioctl(sock, cmd, arg);
 #endif
-
-			if (dlci_ioctl_hook)
-				return((*dlci_ioctl_hook)(cmd, (void *) arg));
-#endif
-			return -ENOPKG;
 
 		default:
 			if ((cmd >= SIOCDEVPRIVATE) &&

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