[patch] netstat: got bogus unix line...
Denys Vlasenko
vda.linux at googlemail.com
Wed Dec 26 12:40:21 PST 2007
On Tuesday 25 December 2007 16:34, Cristian Ionescu-Idbohrn wrote:
> On Tue, 25 Dec 2007, Denys Vlasenko wrote:
> > On Tuesday 25 December 2007 12:08, Cristian Ionescu-Idbohrn wrote:
> > > Seen a case when bb-netstat will output:
> > >
> > > prompt> ./busybox netstat -lanx
> > > ...
> > > unix 2 [ ACC ] STREAM LISTENING 14220
> > > private/mailman unix 2 [ ] DGRAM
> > > 14954 @
> > > netstat: got bogus unix line 'prompt>
> >
> > Can you run "strace -o log -s 512 <cmd>" and post the log?
>
> Yes. But it's too big. Let's see if attached few lines of /proc/net/unix
> will suffice.
>
> > > and stop. Looking through the code, I noticed:
> > >
> > > 184: bb_error_msg("warning, got bogus tcp line");
> > > 239: bb_error_msg("warning, got bogus udp line");
> > > 319: bb_error_msg("warning, got bogus raw line");
> > > 370: bb_error_msg("got bogus unix line '%s'", line);
> >
> > At least it tries to report what was the problem.
>
> Right.
>
> > > The bb_error_msg on line 370 differs from the others. Changed that to
> > > keep consistancy:
> > >
> > > 370: bb_error_msg("warning, got bogus unix line");
> > >
> > > The effect was that netstat does no longer stops, behaving almost
> > > similar to netstat from net-tools.
> >
> > Why doesn't it stop now?
>
> Well, the:
>
> ... '%s'", line);
>
> has certainly something to do with it. There's a line in /proc/net/unix
> containing non-printable characters (see attachment). The comment in
> netstat.c:
>
> 361: /* 2.6.15 may report lines like "... @/tmp/fam-user-^@^@^@^@^@^@^@..."
> 362: * (those ^@ are NUL bytes). fgets sees them as tons of empty lines.
> */
>
> gives a hint on what's going on too.
This patch fixes the issue for me. Can you test it?
--
vda
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 2.patch
Type: text/x-diff
Size: 7206 bytes
Desc: not available
Url : http://busybox.net/lists/busybox/attachments/20071226/64402d40/attachment.bin
More information about the busybox
mailing list