PERFORCE change 163975 for review

Gabor Pali pgj at FreeBSD.org
Wed Jun 10 11:35:35 UTC 2009


http://perforce.freebsd.org/chv.cgi?CH=163975

Change 163975 by pgj at petymeg-current on 2009/06/10 11:34:59

	Add missing parts for display tcp connections, fix output

Affected files ...

.. //depot/projects/soc2009/pgj_libstat/src/lib/libnetstat/netstat.c#13 edit
.. //depot/projects/soc2009/pgj_libstat/src/usr.bin/netstat/inet.c#5 edit

Differences ...

==== //depot/projects/soc2009/pgj_libstat/src/lib/libnetstat/netstat.c#13 (text+ko) ====


==== //depot/projects/soc2009/pgj_libstat/src/usr.bin/netstat/inet.c#5 (text+ko) ====

@@ -624,29 +624,27 @@
 		tp = XXX_netstat_st_get_tcpcb(stp);
 		istcp = 1;
 	}
-/* XXX: af1 */
-#if 0
-	if ((af1 == AF_INET && (inp.inp_vflag & INP_IPV4) == 0)
+	if ((netstat_st_get_family(stp) == AF_INET && (inp.inp_vflag & INP_IPV4) == 0)
 #ifdef INET6
-	    || (af1 == AF_INET6 && (inp.inp_vflag & INP_IPV6) == 0)
+	    || (netstat_st_get_family(stp) == AF_INET6 && (inp.inp_vflag & INP_IPV6) == 0)
 #endif /* INET6 */
-	    || (af1 == AF_UNSPEC && ((inp.inp_vflag & INP_IPV4) == 0
+	    || (netstat_st_get_family(stp) == AF_UNSPEC && ((inp.inp_vflag & INP_IPV4) == 0
 #ifdef INET6
 				&& (inp.inp_vflag & INP_IPV6) == 0
 #endif /* INET6 */
 		))
 	    )
-		continue;
+		return;
 	if (!aflag &&
 	    (
 	     (istcp && netstat_st_get_listening(stp))
-	     || (af1 == AF_INET &&
+	     || (netstat_st_get_family(stp) == AF_INET &&
 	      inet_lnaof(inp.inp_laddr) == INADDR_ANY)
 #ifdef INET6
-	     || (af1 == AF_INET6 &&
+	     || (netstat_st_get_family(stp) == AF_INET6 &&
 		IN6_IS_ADDR_UNSPECIFIED(&inp.in6p_laddr))
 #endif /* INET6 */
-	     || (af1 == AF_UNSPEC &&
+	     || (netstat_st_get_family(stp) == AF_UNSPEC &&
 		 (((inp.inp_vflag & INP_IPV4) != 0 &&
 		   inet_lnaof(inp.inp_laddr) == INADDR_ANY)
 #ifdef INET6
@@ -656,7 +654,7 @@
 		   ))
 	     ))
 		return;
-#endif
+
 	if (first) {
 		if (!Lflag) {
 			printf("Active Internet connections");
@@ -679,11 +677,12 @@
 			    "Local Address", "Foreign Address");
 			if (xflag)
 				printf(
-    "%-6.6s %-6.6s %-6.6s %-6.6s %-6.6s %-6.6s %-6.6s %-6.6s %-6.6s %-6.6s %-6.6s %-6.6s\n",
+    "%-6.6s %-6.6s %-6.6s %-6.6s %-6.6s %-6.6s %-6.6s %-6.6s %-6.6s %-6.6s %-6.6s %-6.6s %s\n",
 				    "R-MBUF", "S-MBUF", "R-CLUS",
 				    "S-CLUS", "R-HIWA", "S-HIWA",
 				    "R-LOWA", "S-LOWA", "R-BCNT",
-				    "S-BCNT", "R-BMAX", "S-BMAX");
+				    "S-BCNT", "R-BMAX", "S-BMAX",
+				    "(state)");
 			else
 				printf("(state)\n");
 		}
@@ -701,13 +700,13 @@
 #endif
 	vchar = ((inp.inp_vflag & INP_IPV4) != 0) ?
 	    "4 " : "  ";
-	printf("%-3.3s%-2.2s", netstat_st_get_name(stp), vchar);
+	printf("%-3.3s%-2.2s ", netstat_st_get_name(stp), vchar);
 	if (Lflag) {
 		snprintf(buf1, 15, "%d/%d/%d", netstat_st_get_qlen(stp),
 		    netstat_st_get_incqlen(stp), netstat_st_get_qlimit(stp));
 		printf("%-14.14s", buf1);
 	} else {
-		printf("%6u %6u", netstat_st_get_rcv_cc(stp),
+		printf("%6u %6u ", netstat_st_get_rcv_cc(stp),
 		    netstat_st_get_snd_cc(stp));
 	}
 	if (numeric_port) {


More information about the p4-projects mailing list