Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 28 Mar 2001 05:40:02 -0800 (PST)
From:      Jim Mercer <jim@reptiles.org>
To:        freebsd-bugs@FreeBSD.org
Subject:   Re: bin/26168: /usr/bin/netstat gets bus error with -i -a options
Message-ID:  <200103281340.f2SDe2k07302@freefall.freebsd.org>

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

From: Jim Mercer <jim@reptiles.org>
To: Peter Pentchev <roam@orbitel.bg>
Cc: freebsd-gnats-submit@FreeBSD.org
Subject: Re: bin/26168: /usr/bin/netstat gets bus error with -i -a options
Date: Wed, 28 Mar 2001 08:38:31 -0500

 On Wed, Mar 28, 2001 at 04:15:24PM +0300, Peter Pentchev wrote:
 > On Wed, Mar 28, 2001 at 04:37:13AM -0800, jim@reptiles.org wrote:
 > > >Number:         26168
 > > >Category:       bin
 > > >Synopsis:       /usr/bin/netstat gets bus error with -i -a options
 > > >Originator:     Jim Mercer
 > > >Release:        4.3-RC
 > > >Organization:
 > > Reptilian Research
 > > >Environment:
 > > gw# uname -a
 > > FreeBSD gw.reptiles.org 4.3-RC FreeBSD 4.3-RC #0: Tue Mar 27 18:24:41 EST 2001     root@gw.reptiles.org:/usr/src/sys/compile/GENERIC  i386
 > > >Description:
 > > /usr/bin/netstat gets bus error with -i -a options
 > 
 > I can confirm this; can you try the attached patch?
 > 
 > (multiaddr holds an address in KVM, not in userspace; dereferencing
 >  it does not give any meaningful value to the user process).
 
 this patch seems to have fixed it:
 
 gw# /usr/bin/netstat -ia
 Name  Mtu   Network       Address            Ipkts Ierrs    Opkts Oerrs  Coll
 xl0   1500  <Link#1>    00:01:02:6e:26:05      498     0      328     0     0
 Bus error
 
 gw# make install
 install -c -s -o root -g kmem -m 2555   netstat /usr/bin
 install -c -o root -g wheel -m 444 netstat.1.gz  /usr/share/man/man1
 
 gw# netstat -ia
 Name  Mtu   Network       Address            Ipkts Ierrs    Opkts Oerrs  Coll
 xl0   1500  <Link#1>    00:01:02:6e:26:05      595     0      388     0     0
                         33:33:5e:86:7b:45
                         33:33:0:0:0:1
                         33:33:ff:6e:26:5
                         1:0:5e:0:0:1
 ...
 faith 1500  <Link#10>                 
 
 > 
 > G'luck,
 > Peter
 > 
 > -- 
 > This inert sentence is my body, but my soul is alive, dancing in the sparks of your brain.
 > 
 > Index: src/usr.bin/netstat/if.c
 > ===================================================================
 > RCS file: /home/ncvs/src/usr.bin/netstat/if.c,v
 > retrieving revision 1.32.2.5
 > diff -u -r1.32.2.5 if.c
 > --- src/usr.bin/netstat/if.c	2001/03/22 13:48:42	1.32.2.5
 > +++ src/usr.bin/netstat/if.c	2001/03/28 13:14:35
 > @@ -448,9 +448,10 @@
 >  			const char *fmt;
 >  
 >  			LIST_FOREACH(multiaddr, &ifnet.if_multiaddrs, ifma_link) {
 > -				if (kread(*(u_long *)multiaddr, (char *)&ifma,
 > +				if (kread((u_long)multiaddr, (char *)&ifma,
 >  					  sizeof ifma))
 >  					break;
 > +				multiaddr = &ifma;
 >  				if (kread((u_long)ifma.ifma_addr, (char *)&msa,
 >  					  sizeof msa))
 >  					break;
 
 -- 
 [ Jim Mercer          jim@pneumonoultramicroscopicsilicovolcanoconiosis.ca ]
 [          Reptilian Research -- Longer Life through Colder Blood          ]
 [ aka                        jim@reptiles.org              +1 416 410-5633 ]

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?200103281340.f2SDe2k07302>