From owner-p4-projects@FreeBSD.ORG Sun Jun 14 12:01:20 2009 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 5AC431065688; Sun, 14 Jun 2009 12:01:20 +0000 (UTC) Delivered-To: perforce@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1A2171065692 for ; Sun, 14 Jun 2009 12:01:20 +0000 (UTC) (envelope-from pgj@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id 07B3D8FC24 for ; Sun, 14 Jun 2009 12:01:20 +0000 (UTC) (envelope-from pgj@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.3/8.14.3) with ESMTP id n5EC1JhS001056 for ; Sun, 14 Jun 2009 12:01:19 GMT (envelope-from pgj@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id n5EC1J4b001054 for perforce@freebsd.org; Sun, 14 Jun 2009 12:01:19 GMT (envelope-from pgj@FreeBSD.org) Date: Sun, 14 Jun 2009 12:01:19 GMT Message-Id: <200906141201.n5EC1J4b001054@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to pgj@FreeBSD.org using -f From: Gabor Pali To: Perforce Change Reviews Cc: Subject: PERFORCE change 164328 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 14 Jun 2009 12:01:21 -0000 http://perforce.freebsd.org/chv.cgi?CH=164328 Change 164328 by pgj@petymeg-current on 2009/06/14 12:01:11 - Fix up some small problems with querying active connections - Add a "fixme" note about lazy domain/port name resolution Affected files ... .. //depot/projects/soc2009/pgj_libstat/src/lib/libnetstat/netstat.c#30 edit .. //depot/projects/soc2009/pgj_libstat/src/usr.bin/netstat/main.c#9 edit Differences ... ==== //depot/projects/soc2009/pgj_libstat/src/lib/libnetstat/netstat.c#30 (text+ko) ==== @@ -205,6 +205,12 @@ ) 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 && tp->t_state == TCPS_LISTEN) @@ -461,7 +467,7 @@ else NPCB_SCT(inet, domain, protocol, list, flags); break; - /* All PF_INET */ + /* All PF_INET, PF_INET6 */ case 0: /* Errors do not count here. */ if (use_kvm) { @@ -703,6 +709,7 @@ #endif } +/* XXX: Add support for "lazy" domain and port name resolution. */ struct addr_type * extract_inet_address(int type, const char *proto, struct in_addr *in, u_short port, int anonport) @@ -758,6 +765,7 @@ return (result); } +/* XXX: Add support for "lazy" domain and port name resolution. */ struct addr_type * extract_inet6_address(int type, const char *proto, struct in6_addr *in, u_short port) ==== //depot/projects/soc2009/pgj_libstat/src/usr.bin/netstat/main.c#9 (text+ko) ==== @@ -561,14 +561,6 @@ printproto(tp, tp->pr_name); exit(0); } - if (af == AF_INET) - for (tp = protox; tp->pr_name; tp++) - printproto(tp, tp->pr_name); -#ifdef INET6 - if (af == AF_INET6) - for (tp = ip6protox; tp->pr_name; tp++) - printproto(tp, tp->pr_name); -#endif /*INET6*/ #ifdef IPSEC if (af == PF_KEY || af == AF_UNSPEC) for (tp = pfkeyprotox; tp->pr_name; tp++) @@ -590,7 +582,11 @@ #endif /* NETGRAPH */ if (af == AF_UNIX && !sflag) unixpr(kvmd); - if (af == AF_UNSPEC) { + if (af == AF_UNSPEC || af == AF_INET +#ifdef INET6 + || af == AF_INET6 +#endif + ) { stlp = netstat_stl_alloc(); if (stlp == NULL) { warn("netstat_stl_alloc"); @@ -605,7 +601,7 @@ * There should be guaranteed that sockets are not mixed (i.e. * they are coming ordered by family/protocol). */ - if (netstat_socket(PF_UNSPEC, 0, 0, stlp, st_flags, + if (netstat_socket(af, 0, 0, stlp, st_flags, kvmd) < 0) { error = netstat_stl_geterror(stlp); if (error == NETSTAT_ERROR_KVM)