NetBSD Problem Report #3477

Received: (qmail-queue invoked from smtpd); 11 Apr 1997 13:59:51 -0000
Message-Id: <199704111359.WAA24696@bimota.imada.math.human.nagoya-u.ac.jp>
Date: Fri, 11 Apr 1997 22:59:25 +0900 (JST)
From: koji@math.human.nagoya-u.ac.jp
Reply-To: koji@math.human.nagoya-u.ac.jp
To: gnats-bugs@gnats.netbsd.org
Subject: ifconfig set null address if address is not specified.
X-Send-Pr-Version: 3.95

>Number:         3477
>Category:       bin
>Synopsis:       ifconfig set null address if address is not specified.
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    bin-bug-people
>State:          closed
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Fri Apr 11 07:05:00 +0000 1997
>Closed-Date:    Fri May 30 05:44:15 +0000 1997
>Last-Modified:  Fri May 30 05:44:30 +0000 1997
>Originator:     Koji Imada - je4owb/2
>Release:        970409
>Organization:
Mathematics Group of Graduate School of Human
	Infomatics, Nagoya University, Japan.
>Environment:

System: NetBSD bimota 1.2D NetBSD 1.2D (BIMOTA) #4: Thu Apr 10 05:13:05 JST 1997 koji@bimota:/usr/local/work/current/src/sys/arch/i386/compile/BIMOTA i386


>Description:
	ifconfig set null address, if address is not specified. This
	is rare condition but reasonable.
>How-To-Repeat:
	Do 'ifconfig <interface> up' when no address is specified
	yet. Null address(filled with binary 0) is set. This is not
	same with no address.
>Fix:
	apply following patch.

Index: ifconfig.c
===================================================================
RCS file: /mnt2/NetBSD/cvsroot/netbsd/sbin/ifconfig/ifconfig.c,v
retrieving revision 1.1.1.3
diff -c -r1.1.1.3 ifconfig.c
*** ifconfig.c	1997/04/11 08:39:31	1.1.1.3
--- ifconfig.c	1997/04/11 06:06:02
***************
*** 118,124 ****
  char	name[30];
  int	flags, metric, setaddr, setipdst, doalias;
  int	clearaddr, s;
! int	newaddr = 1;
  int	nsellength = 1;
  int	af;
  int	mflag, lflag;
--- 118,124 ----
  char	name[30];
  int	flags, metric, setaddr, setipdst, doalias;
  int	clearaddr, s;
! int	newaddr = -1;
  int	nsellength = 1;
  int	af;
  int	mflag, lflag;
***************
*** 385,391 ****
  				warn("SIOCDIFADDR");
  		}
  	}
! 	if (newaddr) {
  		(void) strncpy(afp->af_addreq, name, sizeof ifr.ifr_name);
  		if (ioctl(s, afp->af_aifaddr, afp->af_addreq) < 0)
  			warn("SIOCAIFADDR");
--- 385,391 ----
  				warn("SIOCDIFADDR");
  		}
  	}
! 	if (newaddr > 0) {
  		(void) strncpy(afp->af_addreq, name, sizeof ifr.ifr_name);
  		if (ioctl(s, afp->af_aifaddr, afp->af_addreq) < 0)
  			warn("SIOCAIFADDR");
***************
*** 515,520 ****
--- 515,522 ----
  	 * and the flags may change when the address is set.
  	 */
  	setaddr++;
+ 	if (newaddr == -1)
+ 		newaddr = 1;
  	if (doalias == 0)
  		clearaddr = 1;
  	(*afp->af_getaddr)(addr, (doalias >= 0 ? ADDR : RIDADDR));
>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: lukem 
State-Changed-When: Thu May 29 22:44:15 PDT 1997 
State-Changed-Why:  
patch applied - thanks! 
>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.