From owner-freebsd-bugs Wed Jun 16 19:10: 7 1999 Delivered-To: freebsd-bugs@freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.ORG [204.216.27.21]) by hub.freebsd.org (Postfix) with ESMTP id 21BD8150D0 for ; Wed, 16 Jun 1999 19:10:02 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.9.3/8.9.2) id TAA95771; Wed, 16 Jun 1999 19:10:02 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: by hub.freebsd.org (Postfix, from userid 32767) id 2E03314C2B; Wed, 16 Jun 1999 19:02:31 -0700 (PDT) Message-Id: <19990617020231.2E03314C2B@hub.freebsd.org> Date: Wed, 16 Jun 1999 19:02:31 -0700 (PDT) From: jrd@cc.usu.edu To: freebsd-gnats-submit@freebsd.org X-Send-Pr-Version: www-1.0 Subject: misc/12252: netstat fails to display TCP connectoins Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org >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