Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 26 Dec 2001 12:00:01 -0800 (PST)
From:      Bruce Evans <bde@zeta.org.au>
To:        freebsd-bugs@FreeBSD.org
Subject:   Re: kern/33201: net/net_osdep.c:if_name is broken
Message-ID:  <200112262000.fBQK01k86881@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
The following reply was made to PR kern/33201; it has been noted by GNATS.

From: Bruce Evans <bde@zeta.org.au>
To: Robert Watson <rwatson@FreeBSD.ORG>
Cc: <freebsd-gnats-submit@FreeBSD.ORG>
Subject: Re: kern/33201: net/net_osdep.c:if_name is broken
Date: Thu, 27 Dec 2001 06:53:18 +1100 (EST)

 On Wed, 26 Dec 2001, Robert Watson wrote:
 
 >  Slight update on this: I misread the function, it's evil due to its
 >  use of MAXNUMBUF rather than its use of stack space.  Comments about
 >  IFNAMSIZE still apply.  If we want to formally maintain an interface name
 
 The multiple static buffer hack is even worse than a single static
 buffer in threaded and/or interruptible environments.  inet_ntoa() in
 the kernel an example of an old BAD interface that is implemented using
 the latter.  I think if_name() and inet_ntoa() are only used in kernel
 printfs, so the effects of races are somewhat limited.  With a static
 buffer that always has a NUL at the end, the buffer contents may be
 garbage.  With the multiple static buffer hack, there are also races
 bumping the buffer index, but for if_name() the buffer index is bumped
 in a fairly fail-safe way which might prevent it becoming invalid if
 the compiler doesn't do too many optimizations.
 
 Bruce
 

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200112262000.fBQK01k86881>