NetBSD Problem Report #1285

From gnats  Wed Jul 26 23:42:21 1995
Received: from lassie.eunet.fi (lassie.eunet.fi [192.26.119.7]) by sun-lamp.pc.cs.cmu.edu (8.6.11/8.6.10) with SMTP id XAA24176 for <gnats-bugs@gnats.netbsd.org>; Wed, 26 Jul 1995 23:42:16 -0400
Message-Id: <199507270317.GAA02511@tuhnu.cute.fi>
Date: Thu, 27 Jul 1995 06:17:20 +0300
From: Jarkko Torppa <torppa@cute.fi>
Reply-To: torppa@cute.fi
To: gnats-bugs@gnats.netbsd.org
Subject: SIOCGIFCONF makes bad names for if10+
X-Send-Pr-Version: 3.2

>Number:         1285
>Category:       kern
>Synopsis:       SIOCGIFCONF ioctl generates bad names for if10+
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    kern-bug-people
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Jul 26 23:50:02 +0000 1995
>Closed-Date:    Tue Mar 05 02:47:43 +0000 1996
>Last-Modified:  Tue Mar 05 02:48:19 +0000 1996
>Originator:     
>Release:        also present in 26.07.1995 sup
>Organization:
-- 
 Jarkko.Torppa@cute.fi     +358-0-648090          Cute Communications Oy
>Environment:

System: NetBSD tuhnu.cute.fi 1.0A NetBSD 1.0A (TUHNU) #5: Mon Jul 17 10:45:07 EET DST 1995 torppa@tuhnu.cute.fi:/console/NetBSD/NetBSD-current/src/sys/arch/i386/compile/TUHNU i386


>Description:

SIOCGIFCONF(net/if.c ifconf()) makes names for iterfaces from straight
collating ascii sequence starting from '0', that works untill it
hits 10 which is named 'if:'

Other parts of the module(net/if.c) seem to make nicer names.
>How-To-Repeat:

configure 11+ ppp devices, try ifconfig -a

>Fix:

Ugly patch included. it would be nicer to generate all interface names
in one place ?

--- if.c.orig	Tue Apr 25 13:21:57 1995
+++ if.c	Thu Jul 27 06:06:39 1995
@@ -583,6 +583,7 @@
 	register char *cp, *ep;
 	struct ifreq ifr, *ifrp;
 	int space = ifc->ifc_len, error = 0;
+	char workbuf[12],*unitname;

 	ifrp = ifc->ifc_req;
 	ep = ifr.ifr_name + sizeof (ifr.ifr_name) - 2;
@@ -590,7 +591,9 @@
 		strncpy(ifr.ifr_name, ifp->if_name, sizeof(ifr.ifr_name) - 2);
 		for (cp = ifr.ifr_name; cp < ep && *cp; cp++)
 			continue;
-		*cp++ = '0' + ifp->if_unit; *cp = '\0';
+		unitname=sprint_d((u_int)ifp->if_unit,workbuf,sizeof(workbuf));
+		strcpy(cp,unitname);
+
 		if ((ifa = ifp->if_addrlist) == 0) {
 			bzero((caddr_t)&ifr.ifr_addr, sizeof(ifr.ifr_addr));
 			error = copyout((caddr_t)&ifr, (caddr_t)ifrp,

>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: thorpej 
State-Changed-When: Mon Mar 4 18:47:43 PST 1996 
State-Changed-Why:  
Fixed problem slightly differently. 
>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.