Bug 116643

Summary: [patch] [request] fstat(1): add socket endpoint information as in NetBSD and OpenBSD
Product: Base System Reporter: Jeremie Le Hen <jeremie>
Component: binAssignee: freebsd-bugs (Nobody) <bugs>
Status: Closed FIXED    
Severity: Affects Only Me CC: dch, jeremie, jlh
Priority: Normal Keywords: patch
Version: CURRENT   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
fstat_inetsock_detail.diff
none
fstat-i.diff none

Description Jeremie Le Hen 2007-09-26 00:20:01 UTC
This patch adds socket details to AF_INET/AF_INET6 output of fstat.
Currently, we have an output like this:
    root     sshd         721    3* internet stream tcp c3f08e10
    tataz    ssh         1271    3* internet stream tcp c4611870
With this patch, we have:
    root     sshd         721    3* internet stream tcp c3f08e10 *:22
    tataz    ssh         1271    3* internet stream tcp c4611870 192.168.1.3:50995 <-> 192.168.1.2:22

Fix: The patch below implements this behaviour.  It has been ported from
NetBSD and OpenBSD.  Note that due to lack of inet6 connectivity, I
couldn't test the AF_INET6 case.
Comment 1 Remko Lodder freebsd_committer freebsd_triage 2007-09-26 07:39:25 UTC
Responsible Changed
From-To: freebsd-bugs->freebsd-net

This looks like something for the -net team.
Comment 2 Bjoern A. Zeeb freebsd_committer freebsd_triage 2008-10-17 15:03:22 UTC
Hi,

I have the feeling that we should not change fstat for this. we have
socksts which gives the information already. In addition you can
actually get the pointers from fstat easily for debugging and fstat
does not have the line wrapping problems sockstat has with long ipv6
addresses.

What do you think?

-- 
Bjoern A. Zeeb              Stop bit received. Insert coin for new game.
Comment 3 Bjoern A. Zeeb freebsd_committer freebsd_triage 2008-10-17 15:03:39 UTC
State Changed
From-To: open->feedback

See what the submitetr thinks on staying with fstat and using sockstat.
Comment 4 Bjoern A. Zeeb freebsd_committer freebsd_triage 2008-10-17 15:04:47 UTC
Responsible Changed
From-To: freebsd-net->bz

Assign to me for the follow-up.
Comment 5 Jeremie Le Hen 2008-10-22 13:27:36 UTC
Hi Bjoern,

On Fri, Oct 17, 2008 at 02:03:22PM +0000, Bjoern A. Zeeb wrote:
>  I have the feeling that we should not change fstat for this. we have
>  socksts which gives the information already. In addition you can
>  actually get the pointers from fstat easily for debugging and fstat
>  does not have the line wrapping problems sockstat has with long ipv6
>  addresses.
> 
>  What do you think?

I suppose you meant sockstat(1), didn't you?  I agree that it actually
provides the information.  But I noticed that I often install lsof from
ports because it can match processes by pid and uid and displays
detailled information about sockets.  So I created this patch to
FreeBSD's fstat(1).  Additionally, it makes its output closer to the
other BSD's.

Line wrapping is certainly a problem, I wasn't aware of this.  However
I'm not sure the current fstat(1) is free from line wrapping problems.
On my 6.2 box (nothing else available right now) with a 80 columns
terminal, the longest line is 85 chars long.

Regards,
-- 
Jeremie Le Hen
< jeremie at le-hen dot org >< ttz at chchile dot org >
Comment 6 Bjoern A. Zeeb freebsd_committer freebsd_triage 2008-10-22 19:12:03 UTC
State Changed
From-To: feedback->open

Feedback received. 


Comment 7 Bjoern A. Zeeb freebsd_committer freebsd_triage 2008-10-22 19:12:03 UTC
Responsible Changed
From-To: bz->freebsd-net

Assign it bck to the masses; I think this needs further discussion.
Comment 8 Jeremie Le Hen 2010-05-05 17:40:34 UTC
Hi,

I've updated the patch so it compiles with -CURRENT.  Also the proposed
behaviour is opt-in through the -i option.

This PR has been waiting for two years and a half.  I propose that we
try to find a consensus whether it is useful or not and then close it,
no matter if it has been accepted or not.

Regards,
-- 
Jeremie Le Hen

Humans are born free and equal.  But some are more equal than others.
					    Coluche
Comment 9 Eitan Adler freebsd_committer freebsd_triage 2017-12-31 07:59:28 UTC
For bugs matching the following criteria:

Status: In Progress Changed: (is less than) 2014-06-01

Reset to default assignee and clear in-progress tags.

Mail being skipped
Comment 10 Jeremie Le Hen freebsd_committer freebsd_triage 2019-10-02 20:23:18 UTC
It's been a while...

You can discard the fstat-i.diff patch attached to the bug entry. I've created a new version on Phabricator: https://reviews.freebsd.org/D21880
Comment 11 Graham Perrin freebsd_committer freebsd_triage 2022-10-17 12:36:42 UTC
Keyword: 

    patch
or  patch-ready

– in lieu of summary line prefix: 

    [patch]

* bulk change for the keyword
* summary lines may be edited manually (not in bulk). 

Keyword descriptions and search interface: 

    <https://bugs.freebsd.org/bugzilla/describekeywords.cgi>
Comment 12 Dave Cottlehuber freebsd_committer freebsd_triage 2023-04-14 22:38:52 UTC
I believe this was committed in https://svnweb.freebsd.org/base?view=revision&revision=353769

Jeremie thanks for your patience, I found this very useful!