patch-1.3.68 linux/net/core/dev.c

Next file: linux/net/core/net_alias.c
Previous file: linux/net/ax25/ax25_timer.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v1.3.67/linux/net/core/dev.c linux/net/core/dev.c
@@ -43,6 +43,8 @@
  *					on a Sparc.
  *		Bjorn Ekwall	:	Added KERNELD hack.
  *		Alan Cox	:	Cleaned up the backlog initialise.
+ *		Craig Metz	:	SIOCGIFCONF fix if space for under
+ *					1 device.
  *
  */
 
@@ -214,8 +216,15 @@
 
 extern __inline__ void dev_load(const char *name)
 {
-	if(!dev_get(name))
-		request_module(name);
+        char *sptr;
+ 
+        if(!dev_get(name)) {
+#ifdef CONFIG_NET_ALIAS
+                for (sptr=name ; *sptr ; sptr++) if(*sptr==':') break;
+                if (!(*sptr && *(sptr+1)))
+#endif
+                        request_module(name);
+        }
 }
 
 #endif
@@ -788,17 +797,18 @@
 	{
         	if(!(dev->flags & IFF_UP))	/* Downed devices don't count */
 	        	continue;
-		memset(&ifr, 0, sizeof(struct ifreq));
-		strcpy(ifr.ifr_name, dev->name);
-		(*(struct sockaddr_in *) &ifr.ifr_addr).sin_family = dev->family;
-		(*(struct sockaddr_in *) &ifr.ifr_addr).sin_addr.s_addr = dev->pa_addr;
-
 		/*
 		 *	Have we run out of space here ?
 		 */
 	
 		if (len < sizeof(struct ifreq)) 
 			break;
+
+		memset(&ifr, 0, sizeof(struct ifreq));
+		strcpy(ifr.ifr_name, dev->name);
+		(*(struct sockaddr_in *) &ifr.ifr_addr).sin_family = dev->family;
+		(*(struct sockaddr_in *) &ifr.ifr_addr).sin_addr.s_addr = dev->pa_addr;
+
 
 		/*
 		 *	Write this block to the caller's space. 

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov with Sam's (original) version
of this