NetBSD Problem Report #1228

From gnats  Fri Jul 14 10:09:17 1995
Received: from beauty.mcl.ucsb.edu (root@beauty.mcl.ucsb.edu [128.111.148.107]) by sun-lamp.pc.cs.cmu.edu (8.6.11/8.6.10) with ESMTP id KAA00711 for <gnats-bugs@gnats.netbsd.org>; Fri, 14 Jul 1995 10:09:16 -0400
Message-Id: <199507141911.MAA00336@blurg.blurg.ucsb.edu>
Date: Fri, 14 Jul 1995 12:11:09 -0700
From: uhenric@mcl.ucsb.edu
Reply-To: uhenric@mcl.ucsb.edu
To: gnats-bugs@gnats.netbsd.org
Subject: odd ifconfig behavior
X-Send-Pr-Version: 3.2

>Number:         1228
>Category:       kern
>Synopsis:       ifconfig & uninitialized sl0 acts strangely
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    kern-bug-people
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Jul 14 10:20:02 +0000 1995
>Closed-Date:    Thu Jan 04 20:12:52 +0000 1996
>Last-Modified:  Thu Jun 05 05:59:49 +0000 1997
>Originator:     Henric Jungheim
>Release:        July 12th <NetBSD-current source date>
>Organization:

>Environment:

System: NetBSD blurg.blurg.ucsb.edu 1.0A NetBSD 1.0A (HENRIC) #27: Wed Jul 12 13:04:00 PDT 1995 henric@blurg.blurg.ucsb.edu:/usr/src/sys/arch/amiga/compile/HENRIC amiga
gcc2.4.5 kernel, gcc2.7.0 for other stuff

>Description:


When sl0 is not initialzied properly, it seem to do something rather
strange to the list of available interfaces.  I have 2 slip and 2
ppp interfaces configured in my kernel, but when I do an "ifconfig
sl0 down" on an uninitialized sl0, ifconfig first tells me about
interface "sl0" and then it tries to tell me about interface ""
(i.e., an empty string).  See the "How-To-Repeat" section for more
details.

If inetd recieves a "HUP" while the interface table is in this condition,
it exits.  Trying to restart inetd fails.  Here is the tail of the output
of 'inetd -D':
...
ADD : time proto=udp, wait.max=0.40, user.group=root.(null) builtin=63c2 server=
internal
ADD : rstatd rpcprog=-1, rpcvers = 3/1, proto=rpc/udp, wait.max=1.40, user.group
=root.(null) builtin=0 server=/usr/libexec/rpc.rstatd
pmap_set: 100001 1 17 1027
get_myaddress: ioctl: Device not configured
blurg:~henric#

>How-To-Repeat:

Here is a transcript (sl0 has not been referenced at all before this):
blurg:~henric#ifconfig -a
sl0: flags=c010<POINTOPOINT,LINK2,MULTICAST>
sl1: flags=c010<POINTOPOINT,LINK2,MULTICAST>
ppp0: flags=10<POINTOPOINT>
        inet 10.0.2.15 --> 0.0.0.0 netmask 0xff000000
ppp1: flags=10<POINTOPOINT>
lo0: flags=8009<UP,LOOPBACK,MULTICAST>
        inet 127.0.0.1 netmask 0xff000000
tun0: flags=10<POINTOPOINT>
tun1: flags=10<POINTOPOINT>
blurg:~henric#ifconfig sl0 down
blurg:~henric#ifconfig -a
sl0: flags=c010<POINTOPOINT,LINK2,MULTICAST>
        inet 0.0.0.0 --> 0.0.0.0 netmask 0x0
ifconfig: SIOCGIFFLAGS: Device not configured
blurg:~henric#

>Fix:

>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->analyzed 
State-Changed-By: cgd 
State-Changed-When: Mon Jul 24 19:58:29 EDT 1995 
State-Changed-Why:  
i've investigated it, think i know a solution. 


Responsible-Changed-From-To: kern-bug-people->cgd 
Responsible-Changed-By: cgd 
Responsible-Changed-When: Mon Jul 24 19:58:29 EDT 1995 
Responsible-Changed-Why:  
i'm claiming it as mine. 
Responsible-Changed-From-To: cgd->kern-bug-people 
Responsible-Changed-By: cgd 
Responsible-Changed-When: Sat Aug 19 04:55:31 EDT 1995 
Responsible-Changed-Why:  
unclaim it, and supply (in the unformatted section) my suggestion for a fix. 
State-Changed-From-To: analyzed->closed 
State-Changed-By: pk 
State-Changed-When: Thu Jan 4 15:12:52 EST 1996 
State-Changed-Why:  
Both ifconfig and the RPC routine get_myaddress() were wrongly interpreting 
the results of a SIOCGIFCONF ioctl. 
Still, ifconfig should probably also be tought not to pass an all-zero 
address to the interface. 
>Unformatted:

 the following potential fix was presented to Charles Hannum for comment.
 He never commented, except to say that it sounded like a kernel, rather than
 a user-land bug.  Rather, i argue that ifconfig is wrongly passing
 undetectably-bogus arguments to the kernel.


 Index: sbin/ifconfig/ifconfig.c
 ===================================================================
 RCS file: /a/cvsroot/src/sbin/ifconfig/ifconfig.c,v
 retrieving revision 1.20
 diff -c -r1.20 ifconfig.c
 *** ifconfig.c	1995/05/19 20:17:16	1.20
 --- ifconfig.c	1995/08/19 09:20:06
 ***************
 *** 80,87 ****
  struct	sockaddr_in	netmask;
  char	name[30];
  int	flags, metric, setaddr, setipdst, doalias;
 ! int	clearaddr, s;
 ! int	newaddr = 1;
  int	nsellength = 1;
  int	af = AF_INET;

 --- 80,86 ----
  struct	sockaddr_in	netmask;
  char	name[30];
  int	flags, metric, setaddr, setipdst, doalias;
 ! int	clearaddr, newaddr, s;
  int	nsellength = 1;
  int	af = AF_INET;

 ***************
 *** 351,357 ****
  	 * The address interpretation may depend on the flags,
  	 * and the flags may change when the address is set.
  	 */
 ! 	setaddr++;
  	if (doalias == 0)
  		clearaddr = 1;
  	(*afp->af_getaddr)(addr, (doalias >= 0 ? ADDR : RIDADDR));
 --- 350,357 ----
  	 * The address interpretation may depend on the flags,
  	 * and the flags may change when the address is set.
  	 */
 ! 	setaddr = 1;
 ! 	newaddr = 1;
  	if (doalias == 0)
  		clearaddr = 1;
  	(*afp->af_getaddr)(addr, (doalias >= 0 ? ADDR : RIDADDR));
 ***************
 *** 396,403 ****
  	if (param < 0) {
  		clearaddr = 1;
  		newaddr = 0;
 ! 	} else
  		clearaddr = 0;
  }

  /*ARGSUSED*/
 --- 396,405 ----
  	if (param < 0) {
  		clearaddr = 1;
  		newaddr = 0;
 ! 	} else {
  		clearaddr = 0;
 + 		newaddr = 1;
 + 	}
  }

  /*ARGSUSED*/

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.