Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 46053 - Incorrect (truncated) display of IP addreses in netstat (from sys-apps/net-tools)
Summary: Incorrect (truncated) display of IP addreses in netstat (from sys-apps/net-to...
Status: RESOLVED DUPLICATE of bug 53731
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: All Linux
: High critical (vote)
Assignee: Gentoo's Team for Core System packages
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-03-28 18:21 UTC by Kalin KOZHUHAROV
Modified: 2005-07-17 13:06 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments
no_truncate.patch (net-tools-1.60-no_truncate.patch,4.91 KB, patch)
2004-10-10 11:25 UTC, Kalin KOZHUHAROV
Details | Diff
net-tools-1.60-r9.ebuild.diff (net-tools-1.60-r9.ebuild.diff,1.42 KB, patch)
2004-10-10 11:26 UTC, Kalin KOZHUHAROV
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Kalin KOZHUHAROV 2004-03-28 18:21:01 UTC
I was playing with IPv6 and routing and at a certain point I discovered this:

poi / # netstat -unlp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name   
udp        0      0 ::ffff:192.168.13.22:53 :::*                                19393/dnscache      
udp        0      0 ::ffff:192.168.13.10:53 :::*                                19212/dnscache      

poi / # ip -4 addr |grep 13
    inet 192.168.13.222/32 scope global eth0
    inet 192.168.13.100/24 scope global eth2

In other words, netstat truncates the IP when showing it. It phreaked me out and took me na hour to realize what was going on...

Reproducible: Always
Steps to Reproduce:
1.ip addr add 192.168.111.111
2.start something (dnscache) on that IP
3.check netstat -tunelp

Actual Results:  
address truncated to 192.168.111.1

Expected Results:  
not truncated address

IPv6 module
Mark it critical, cause some scripts may be quite broken.
Comment 1 Kalin KOZHUHAROV 2004-06-15 21:28:49 UTC
Does this has something to do with Gentoo or is this supposed to go upstream?

Still present in sys-apps/net-tools-1.60-r8
Comment 2 SpanKY gentoo-dev 2004-10-09 22:55:50 UTC
from the net-stat source code inside the tcp_do_one() function:
    printf("tcp   %6ld %6ld %-23s %-23s %-12s",
           rxq, txq, local_addr, rem_addr, _(tcp_state[state]));

so it's a limitation in the source; the addresses are truncated to 23 characters ... the example you provided showed this; truncated to 23 characters
Comment 3 Kalin KOZHUHAROV 2004-10-10 04:59:04 UTC
I see...
I just spent an hour looking around for solution but I couldn't find any good one :-( At least I learned some things about the glibc internals...

One possible solution will be to indicate that the address is truncated somehow (e.d. replace : with > on truncated addresses), but this is not very good for text based sys-app (good for GUI with tooltips), cause it may brake some scripts.

Another workaround will be to print all IPv4 addresses mapped to IPv6 as normal IPv4 ( IN6_IS_ADDR_V4MAPPED macro). However that will need a few more lines of code and some time to test (=>I cannot do it now)...

So, this is definately NOT a Gentoo bug, will have to go upstream.

BTW, what happens to resolved bugs as UPSTREAM ?? Shall we (I) mark it as such?
Comment 4 Kalin KOZHUHAROV 2004-10-10 11:25:02 UTC
Created attachment 41474 [details, diff]
no_truncate.patch

Well, I think I put enough comments in the patch itself, but it solves
(although not so beautifully) the problem.
It works as the original netstat unless there are long addresses.

To beautify output, pipe output to "column -t".
Comment 5 Kalin KOZHUHAROV 2004-10-10 11:26:15 UTC
Created attachment 41475 [details, diff]
net-tools-1.60-r9.ebuild.diff

This is the actual ebuild (trivial) patch.
Also included are a few substuitutions for hard-coded version inside the
ebuild.
Comment 6 SpanKY gentoo-dev 2004-10-10 17:54:42 UTC
resolving bugs as UPSTREAM is a do-it-as-we-feel solution :)

if a bug is too big or the developer doesnt really want to handle it, we mark it as such ... kind of a cop out sometimes :)

in this case, i wouldnt mind fixing it and sending it upstream ... as you say, UPSTREAM seems to be a bit dead anyways with net-tools
Comment 7 SpanKY gentoo-dev 2005-01-06 19:23:01 UTC

*** This bug has been marked as a duplicate of 53731 ***