Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 22 Sep 1996 13:52:09 -0500 (EST)
From:      "John S. Dyson" <toor@dyson.iquest.net>
To:        pjchilds@imforei.apana.org.au (Peter Childs)
Cc:        brett@lariat.org, freebsd-questions@freebsd.org
Subject:   Re: systat/netstat utilities buggy?
Message-ID:  <199609221852.NAA04002@dyson.iquest.net>
In-Reply-To: <199609221819.DAA09508@al.imforei.apana.org.au> from "Peter Childs" at Sep 23, 96 03:49:56 am

next in thread | previous in thread | raw e-mail | index | archive | help
> 
> : I would be VERY surprised, though, if a programmer were careless enough to
> : traverse a linked list whose links could potentially change without locking
> : resources -- or deferring insertions and deletions until after a traversal.
> : Doing nameserver lookups in the MIDDLE of the traversal is EXTREMELY poor
> : practice, since it maximizes the danger of inconsistencies even if the list
> : is traversed safely. Do you have the code to FreeBSD's netstat? (I don't
> : have room for the source tree here.) Is it really coded this badly?
> 
>  Grin.. better lock the kernel from opening/closing sockets during
>  a user-land program run?  Nah.. don't think so :)  I'm not sure
>  how netstat works, but a quick look at the code and you should
>  be able to identify the problem.
> 
>  You might need to do a quick dump copy of the table to local
>  land before trying to do any action (ie. the current system might
>  be trying to do hostname resolution whilst traversing the
>  list)
> 
>  Good luck and don't forget to submit your diffs :)
> 
The whole historical paradigm of peeking into the kernel is 
mostly flawed.  That is going away slowly with procfs/sysctl/etc...

John



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