Date: Wed, 16 Jun 1999 19:02:31 -0700 (PDT) From: jrd@cc.usu.edu To: freebsd-gnats-submit@freebsd.org Subject: misc/12252: netstat fails to display TCP connectoins Message-ID: <19990617020231.2E03314C2B@hub.freebsd.org>
index | next in thread | raw e-mail
>Number: 12252
>Category: misc
>Synopsis: netstat fails to display TCP connectoins
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: freebsd-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Wed Jun 16 19:10:01 PDT 1999
>Closed-Date:
>Last-Modified:
>Originator: Joe R. Doupnik
>Release: v3.2
>Organization:
Utah State University
>Environment:
FreeBSD netlab6.usu.edu 3.2-RELEASE FreeBSD 3.2-RELEASE #17: Wed Jun 16 16:50:45
MDT 1999 root@netlab6.usu.edu:/usr/src/sys/compile/JRD i386
>Description:
netstat shows UDP and Unix but not TCP connections. The problem is
the TCP protocol value is not set in the xt_socket structure
passed back to netstat routines. See horrid workaround below (one
line). The value returned in the structure looks rather like an
address or left over un-inited garbage.
>How-To-Repeat:
Type netstat with TCP connections active
>Fix:
My dirty but quick fix, to netstat/inet.c:
oxig = xig = (struct xinpgen *)buf;
for (xig = (struct xinpgen *)((char *)xig + xig->xig_len);
xig->xig_len > sizeof(struct xinpgen);
xig = (struct xinpgen *)((char *)xig + xig->xig_len)) {
if (istcp) {
tp = &((struct xtcpcb *)xig)->xt_tp;
inp = &((struct xtcpcb *)xig)->xt_inp;
so = &((struct xtcpcb *)xig)->xt_socket;
/* JRD */
so->xso_protocol = proto; /* correct uninited value */
/* JRD */
} else {
inp = &((struct xinpcb *)xig)->xi_inp;
so = &((struct xinpcb *)xig)->xi_socket;
}
/* Ignore sockets for protocols other than the desired one. */
if (so->xso_protocol != proto)
continue;
>Release-Note:
>Audit-Trail:
>Unformatted:
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message
help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19990617020231.2E03314C2B>
