[patch] netstat: got bogus unix line...

Cristian Ionescu-Idbohrn cristian.ionescu-idbohrn at axis.com
Sun Dec 30 01:51:22 UTC 2007


On Sun, 30 Dec 2007, Denys Vlasenko wrote:

> On Thursday 27 December 2007 12:07, Cristian Ionescu-Idbohrn wrote:
> >
> > Looks like the code now completely hides the problem :(
>
> I don't know what do you want then.

netstat from net-tools does this:

unix  2      [ ACC ]     STREAM     LISTENING     14220    private/mailman
unix  2      [ ]         DGRAM                    14954    @
warning, got bogus unix line.		<===============================
unix  2      [ ACC ]     STREAM     LISTENING     14164    private/relay

Maybe that should do.

> How do you want it to be displayed? As soon as we see '@' as the first
> char in unix domain socket name, we cannot know what will follow.

True.

> Right now, on this notebook, I see:
>
> f6ee1740: 00000003 00000000 00000000 0001 03 13802 @/tmp/fam-vda-^@^@^@^@^@^@...
> f75aee40: 00000003 00000000 00000000 0001 03 12026 @/tmp/hald-local/dbus-hk8b0CGGAI

In my case it's:

f7ab6280: 00000002 00000000 00000000 0002 01 14954 @^@^@^@<9E>^R^@^@x*

and current bb-netstat does not display a warning.

> So, it can be *either* "normal" newline terminated name,
> *or* 108-byte verbatim copy of struct sockaddr_un's sun_path member,
> with possible embedded NULs, newlines and whatnot.
>
> I don't see how this can be cleanly handled.

Non-printable character detection, maybe?  Stop displaying before the 1st
non-printable character detected and show the bogus line warning on the
next line (see above net-tools netstat example).


Cheers,

-- 
Cristian



More information about the busybox mailing list