Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 9 Sep 2008 20:56:27 -0700
From:      Jeremy Chadwick <koitsu@FreeBSD.org>
To:        Mike Tancsa <mike@sentex.net>
Cc:        freebsd-stable@freebsd.org, "David E. O'Brien" <obrien@freebsd.org>
Subject:   Re: cvs commit: src/usr.bin/netstat Makefile bpf.c inet.c pfkey.c route.c sctp.c
Message-ID:  <20080910035627.GA14487@icarus.home.lan>
In-Reply-To: <200809100231.m8A2VliB098720@lava.sentex.ca>
References:  <200809011505.m81F5UwC062968@repoman.freebsd.org> <200809100231.m8A2VliB098720@lava.sentex.ca>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, Sep 09, 2008 at 10:31:46PM -0400, Mike Tancsa wrote:
>
> Hi,
>         The change below seems to make netstat -B on RELENG_7 coredump
> netstat -B
>
> specifically,
>
> -               printf("%5d %6s %7s %9lu %9lu %9lu %5d %5d %s\n",
> +               printf("%5d %6s %7s %9ju %9ju %9ju %5d %5d %s\n",
>
> ...
>
> Not sure if its a netstat issue or a libc issue as it works fine in HEAD

The commit:

http://www.freebsd.org/cgi/cvsweb.cgi/src/usr.bin/netstat/bpf.c.diff?r1=1.9.2.1;r2=1.9.2.2;f=h

Explanation:

The variables being printed (bd_rcount, bd_dcount and bd_fcount) are all
u_long on RELENG_7 i386 and amd64.  See include/net/bpfdesc.h.

%lu = unsigned long     (i386 returns 4, amd64 returns 8)
%ju = unsigned intmax_t (i386 returns 8, amd64 returns 8)

The segfault reason should be obvious here; u_long != unsigned intmax_t
on i386.  This is specific to i386 (which I see you're using from the
gdb output); it works fine on amd64.

The commit should be backed out or re-worked to work on i386, or more
bpf-related pieces from HEAD need to be MFC'd.

The reason it might work in HEAD (did you test HEAD i386 or HEAD amd64?)
is that HEAD might have the variables in bpfdesc.h declared as something
like unsigned intmax_t, which might be a better solution, but MFC'ing
that could break things.

-- 
| Jeremy Chadwick                                jdc at parodius.com |
| Parodius Networking                       http://www.parodius.com/ |
| UNIX Systems Administrator                  Mountain View, CA, USA |
| Making life hard for others since 1977.              PGP: 4BD6C0CB |




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