PERFORCE change 165612 for review

Gabor Pali pgj at FreeBSD.org
Sat Jul 4 22:33:36 UTC 2009


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

Change 165612 by pgj at petymeg-current on 2009/07/04 22:33:33

	- Fix filtering of inet lists extracted from kernel images
	- Fix generation of symbols lists

Affected files ...

.. //depot/projects/soc2009/pgj_libstat/src/lib/libnetstat/netstat.c#40 edit

Differences ...

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

@@ -414,6 +414,33 @@
 		if (inp->inp_gencnt > pcbinfo.ipi_gencnt)
 			continue;
 
+		if (((inp->inp_vflag & INP_IPV4) == 0)
+#ifdef INET6
+		    && ((inp->inp_vflag & INP_IPV6) == 0)
+#endif
+		    )
+			continue;
+
+#ifdef INET6
+		if ((family == PF_INET && ((inp->inp_vflag & INP_IPV4) == 0)) ||
+		    (family == PF_INET6 && ((inp->inp_vflag & INP_IPV6) == 0)))
+			continue;
+#endif
+
+		if ((flags & NETSTAT_SOCKET_ALL) == 0 &&
+		    (
+		     (protocol == IPPROTO_TCP &&
+		     inp->inp_ppcb != NULL &&
+		     ((struct tcpcb *)inp->inp_ppcb)->t_state == TCPS_LISTEN)
+		     || ((inp->inp_vflag & INP_IPV4) != 0 &&
+		     inet_lnaof(inp->inp_laddr) == INADDR_ANY)
+#ifdef INET6
+		     || ((inp->inp_vflag & INP_IPV6) != 0 &&
+		     IN6_IS_ADDR_UNSPECIFIED(&inp->in6p_laddr))
+#endif
+		    ))
+			continue;
+
 		if (protocol == IPPROTO_TCP) {
 			if (inp->inp_ppcb == NULL)
 				bzero(&xt.xt_tp, sizeof(xt.xt_tp));
@@ -571,7 +598,8 @@
 			nls[nlUNP_MAX].n_name = NULL;
 			for (i = nlUNP_MAX + 1;
 			    i < (nlUNP_MAX + 1 + nlINP_MAX + 1); i++)
-				nls[i].n_name = strdup(inp_symbol[i]);
+				nls[i].n_name = strdup(inp_symbol[i -
+				    (nlUNP_MAX + 1)]);
 			nls[nlUNP_MAX + 1 + nlINP_MAX].n_name = NULL;
 			break;
 		case PF_LOCAL:


More information about the p4-projects mailing list