From owner-svn-src-stable@FreeBSD.ORG Sun Jul 15 03:43:57 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 92660106566C; Sun, 15 Jul 2012 03:43:57 +0000 (UTC) (envelope-from kensmith@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7D2BA8FC15; Sun, 15 Jul 2012 03:43:57 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6F3hv5e023958; Sun, 15 Jul 2012 03:43:57 GMT (envelope-from kensmith@svn.freebsd.org) Received: (from kensmith@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6F3hv1X023956; Sun, 15 Jul 2012 03:43:57 GMT (envelope-from kensmith@svn.freebsd.org) Message-Id: <201207150343.q6F3hv1X023956@svn.freebsd.org> From: Ken Smith Date: Sun, 15 Jul 2012 03:43:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238460 - stable/9/sys/conf X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 15 Jul 2012 03:43:57 -0000 Author: kensmith Date: Sun Jul 15 03:43:56 2012 New Revision: 238460 URL: http://svn.freebsd.org/changeset/base/238460 Log: 9.1-BETA1 builds done, shift back to PRERELEASE for the rest of the 9.1 release cycle. Approved by: re (implicit) Modified: stable/9/sys/conf/newvers.sh Modified: stable/9/sys/conf/newvers.sh ============================================================================== --- stable/9/sys/conf/newvers.sh Sat Jul 14 21:28:11 2012 (r238459) +++ stable/9/sys/conf/newvers.sh Sun Jul 15 03:43:56 2012 (r238460) @@ -32,7 +32,7 @@ TYPE="FreeBSD" REVISION="9.1" -BRANCH="BETA1" +BRANCH="PRERELEASE" if [ "X${BRANCH_OVERRIDE}" != "X" ]; then BRANCH=${BRANCH_OVERRIDE} fi From owner-svn-src-stable@FreeBSD.ORG Sun Jul 15 05:24:20 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 83ADC106566B; Sun, 15 Jul 2012 05:24:20 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6E6498FC08; Sun, 15 Jul 2012 05:24:20 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6F5OKug028082; Sun, 15 Jul 2012 05:24:20 GMT (envelope-from np@svn.freebsd.org) Received: (from np@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6F5OKV2028080; Sun, 15 Jul 2012 05:24:20 GMT (envelope-from np@svn.freebsd.org) Message-Id: <201207150524.q6F5OKV2028080@svn.freebsd.org> From: Navdeep Parhar Date: Sun, 15 Jul 2012 05:24:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238462 - stable/9/sys/dev/cxgbe X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 15 Jul 2012 05:24:20 -0000 Author: np Date: Sun Jul 15 05:24:19 2012 New Revision: 238462 URL: http://svn.freebsd.org/changeset/base/238462 Log: MFC r238313: Fix a bug in code that calculates the number of the first interrupt vector for a port. This affected the gigabit ports of T422 cards (the ones with 2x10G ports and 2x1G ports). Approved by: re (kib) Modified: stable/9/sys/dev/cxgbe/t4_sge.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) Modified: stable/9/sys/dev/cxgbe/t4_sge.c ============================================================================== --- stable/9/sys/dev/cxgbe/t4_sge.c Sun Jul 15 04:15:27 2012 (r238461) +++ stable/9/sys/dev/cxgbe/t4_sge.c Sun Jul 15 05:24:19 2012 (r238462) @@ -401,14 +401,16 @@ first_vector(struct port_info *pi) return (0); for_each_port(sc, i) { + struct port_info *p = sc->port[i]; + if (i == pi->port_id) break; #ifdef TCP_OFFLOAD if (sc->flags & INTR_DIRECT) - rc += pi->nrxq + pi->nofldrxq; + rc += p->nrxq + p->nofldrxq; else - rc += max(pi->nrxq, pi->nofldrxq); + rc += max(p->nrxq, p->nofldrxq); #else /* * Not compiled with offload support and intr_count > 1. Only @@ -419,7 +421,7 @@ first_vector(struct port_info *pi) ("%s: intr_count %d, !INTR_DIRECT", __func__, sc->intr_count)); - rc += pi->nrxq; + rc += p->nrxq; #endif } From owner-svn-src-stable@FreeBSD.ORG Sun Jul 15 10:55:43 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id D0FA7106566C; Sun, 15 Jul 2012 10:55:43 +0000 (UTC) (envelope-from brueffer@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BBD958FC28; Sun, 15 Jul 2012 10:55:43 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6FAthkE043161; Sun, 15 Jul 2012 10:55:43 GMT (envelope-from brueffer@svn.freebsd.org) Received: (from brueffer@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6FAthDK043159; Sun, 15 Jul 2012 10:55:43 GMT (envelope-from brueffer@svn.freebsd.org) Message-Id: <201207151055.q6FAthDK043159@svn.freebsd.org> From: Christian Brueffer Date: Sun, 15 Jul 2012 10:55:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238473 - stable/9/etc X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 15 Jul 2012 10:55:43 -0000 Author: brueffer Date: Sun Jul 15 10:55:43 2012 New Revision: 238473 URL: http://svn.freebsd.org/changeset/base/238473 Log: MFC: r237921 Similar to all.log, mention that /var/log/console.log has to be created and chmod'ed to make logging work. Approved by: re (kib) Modified: stable/9/etc/syslog.conf Directory Properties: stable/9/etc/ (props changed) Modified: stable/9/etc/syslog.conf ============================================================================== --- stable/9/etc/syslog.conf Sun Jul 15 10:54:10 2012 (r238472) +++ stable/9/etc/syslog.conf Sun Jul 15 10:55:43 2012 (r238473) @@ -16,6 +16,7 @@ cron.* /var/log/cron *.=debug /var/log/debug.log *.emerg * # uncomment this to log all writes to /dev/console to /var/log/console.log +# touch /var/log/console.log and chmod it to mode 600 before it will work #console.info /var/log/console.log # uncomment this to enable logging of all log messages to /var/log/all.log # touch /var/log/all.log and chmod it to mode 600 before it will work From owner-svn-src-stable@FreeBSD.ORG Sun Jul 15 11:04:35 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DDD8C1065672; Sun, 15 Jul 2012 11:04:35 +0000 (UTC) (envelope-from brueffer@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C8F798FC14; Sun, 15 Jul 2012 11:04:35 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6FB4Zue043582; Sun, 15 Jul 2012 11:04:35 GMT (envelope-from brueffer@svn.freebsd.org) Received: (from brueffer@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6FB4ZTF043580; Sun, 15 Jul 2012 11:04:35 GMT (envelope-from brueffer@svn.freebsd.org) Message-Id: <201207151104.q6FB4ZTF043580@svn.freebsd.org> From: Christian Brueffer Date: Sun, 15 Jul 2012 11:04:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238474 - stable/8/etc X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 15 Jul 2012 11:04:36 -0000 Author: brueffer Date: Sun Jul 15 11:04:35 2012 New Revision: 238474 URL: http://svn.freebsd.org/changeset/base/238474 Log: MFC: r237921 Similar to all.log, mention that /var/log/console.log has to be created and chmod'ed to make logging work. Modified: stable/8/etc/syslog.conf Directory Properties: stable/8/etc/ (props changed) Modified: stable/8/etc/syslog.conf ============================================================================== --- stable/8/etc/syslog.conf Sun Jul 15 10:55:43 2012 (r238473) +++ stable/8/etc/syslog.conf Sun Jul 15 11:04:35 2012 (r238474) @@ -16,6 +16,7 @@ cron.* /var/log/cron *.=debug /var/log/debug.log *.emerg * # uncomment this to log all writes to /dev/console to /var/log/console.log +# touch /var/log/console.log and chmod it to mode 600 before it will work #console.info /var/log/console.log # uncomment this to enable logging of all log messages to /var/log/all.log # touch /var/log/all.log and chmod it to mode 600 before it will work From owner-svn-src-stable@FreeBSD.ORG Sun Jul 15 11:13:10 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 10D2A106566B; Sun, 15 Jul 2012 11:13:10 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id EF3588FC0A; Sun, 15 Jul 2012 11:13:09 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6FBD9h9044067; Sun, 15 Jul 2012 11:13:09 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6FBD9dX044065; Sun, 15 Jul 2012 11:13:09 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <201207151113.q6FBD9dX044065@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Sun, 15 Jul 2012 11:13:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238476 - stable/9/sys/netinet6 X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 15 Jul 2012 11:13:10 -0000 Author: bz Date: Sun Jul 15 11:13:09 2012 New Revision: 238476 URL: http://svn.freebsd.org/changeset/base/238476 Log: MFC r238222: As mentioned in the commit message of r237571 (copied from a prototype patch of mine) also check if the 2nd in6_setscope() failed and return the error in that case. Approved by: re (kib) Modified: stable/9/sys/netinet6/in6.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/netinet6/in6.c ============================================================================== --- stable/9/sys/netinet6/in6.c Sun Jul 15 11:04:49 2012 (r238475) +++ stable/9/sys/netinet6/in6.c Sun Jul 15 11:13:09 2012 (r238476) @@ -1341,7 +1341,9 @@ in6_purgeaddr_mc(struct ifnet *ifp, stru sin6.sin6_family = AF_INET6; memcpy(&sin6.sin6_addr, &satosin6(ifa0->ifa_addr)->sin6_addr, sizeof(sin6.sin6_addr)); - in6_setscope(&sin6.sin6_addr, ifa0->ifa_ifp, NULL); + error = in6_setscope(&sin6.sin6_addr, ifa0->ifa_ifp, NULL); + if (error != 0) + return (error); } rt = in6_rtalloc1((struct sockaddr *)&mltaddr, 0, 0UL, RT_DEFAULT_FIB); From owner-svn-src-stable@FreeBSD.ORG Sun Jul 15 11:26:25 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 05E08106564A; Sun, 15 Jul 2012 11:26:25 +0000 (UTC) (envelope-from brueffer@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E584B8FC18; Sun, 15 Jul 2012 11:26:24 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6FBQO3V044684; Sun, 15 Jul 2012 11:26:24 GMT (envelope-from brueffer@svn.freebsd.org) Received: (from brueffer@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6FBQO7X044682; Sun, 15 Jul 2012 11:26:24 GMT (envelope-from brueffer@svn.freebsd.org) Message-Id: <201207151126.q6FBQO7X044682@svn.freebsd.org> From: Christian Brueffer Date: Sun, 15 Jul 2012 11:26:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238478 - stable/9/usr.bin/stat X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 15 Jul 2012 11:26:25 -0000 Author: brueffer Date: Sun Jul 15 11:26:24 2012 New Revision: 238478 URL: http://svn.freebsd.org/changeset/base/238478 Log: MFC: r234577 Remove duplicate -l description. Approved by: re (kib) Modified: stable/9/usr.bin/stat/stat.1 Directory Properties: stable/9/usr.bin/stat/ (props changed) Modified: stable/9/usr.bin/stat/stat.1 ============================================================================== --- stable/9/usr.bin/stat/stat.1 Sun Jul 15 11:18:52 2012 (r238477) +++ stable/9/usr.bin/stat/stat.1 Sun Jul 15 11:26:24 2012 (r238478) @@ -29,7 +29,7 @@ .\" .\" $FreeBSD$ .\" -.Dd December 5, 2010 +.Dd April 22, 2012 .Dt STAT 1 .Os .Sh NAME @@ -140,10 +140,6 @@ If the link is broken or the target does fall back on .Xr lstat 2 and report information about the link. -.It Fl l -Display output in -.Ic ls Fl lT -format. .It Fl n Do not force a newline to appear at the end of each piece of output. .It Fl q From owner-svn-src-stable@FreeBSD.ORG Sun Jul 15 11:27:15 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C6C9A1065677; Sun, 15 Jul 2012 11:27:15 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B0C4C8FC1F; Sun, 15 Jul 2012 11:27:15 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6FBRF0d044758; Sun, 15 Jul 2012 11:27:15 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6FBRFR9044756; Sun, 15 Jul 2012 11:27:15 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <201207151127.q6FBRFR9044756@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Sun, 15 Jul 2012 11:27:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238479 - stable/9/sys/netinet6 X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 15 Jul 2012 11:27:15 -0000 Author: bz Date: Sun Jul 15 11:27:15 2012 New Revision: 238479 URL: http://svn.freebsd.org/changeset/base/238479 Log: MFC r238248: Implement handling of "atomic fragements" as outlined in draft-gont-6man-ipv6-atomic-fragments to mitigate one class of possible fragmentation-based attacks. Approved by: re (kib) Modified: stable/9/sys/netinet6/frag6.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/netinet6/frag6.c ============================================================================== --- stable/9/sys/netinet6/frag6.c Sun Jul 15 11:26:24 2012 (r238478) +++ stable/9/sys/netinet6/frag6.c Sun Jul 15 11:27:15 2012 (r238479) @@ -221,6 +221,19 @@ frag6_input(struct mbuf **mp, int *offp, /* offset now points to data portion */ offset += sizeof(struct ip6_frag); + /* + * XXX-BZ RFC XXXX (draft-gont-6man-ipv6-atomic-fragments) + * Handle "atomic" fragments (offset and m bit set to 0) upfront, + * unrelated to any reassembly. Just skip the fragment header. + */ + if ((ip6f->ip6f_offlg & ~IP6F_RESERVED_MASK) == 0) { + /* XXX-BZ we want dedicated counters for this. */ + V_ip6stat.ip6s_reassembled++; + in6_ifstat_inc(dstifp, ifs6_reass_ok); + *offp = offset; + return (ip6f->ip6f_nxt); + } + IP6Q_LOCK(); /* From owner-svn-src-stable@FreeBSD.ORG Sun Jul 15 11:28:04 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 05D141065670; Sun, 15 Jul 2012 11:28:04 +0000 (UTC) (envelope-from brueffer@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E4E3A8FC1A; Sun, 15 Jul 2012 11:28:03 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6FBS3iR044836; Sun, 15 Jul 2012 11:28:03 GMT (envelope-from brueffer@svn.freebsd.org) Received: (from brueffer@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6FBS34j044834; Sun, 15 Jul 2012 11:28:03 GMT (envelope-from brueffer@svn.freebsd.org) Message-Id: <201207151128.q6FBS34j044834@svn.freebsd.org> From: Christian Brueffer Date: Sun, 15 Jul 2012 11:28:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238480 - stable/8/usr.bin/stat X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 15 Jul 2012 11:28:04 -0000 Author: brueffer Date: Sun Jul 15 11:28:03 2012 New Revision: 238480 URL: http://svn.freebsd.org/changeset/base/238480 Log: MFC: r234577 Remove duplicate -l description. Modified: stable/8/usr.bin/stat/stat.1 Directory Properties: stable/8/usr.bin/stat/ (props changed) Modified: stable/8/usr.bin/stat/stat.1 ============================================================================== --- stable/8/usr.bin/stat/stat.1 Sun Jul 15 11:27:15 2012 (r238479) +++ stable/8/usr.bin/stat/stat.1 Sun Jul 15 11:28:03 2012 (r238480) @@ -29,7 +29,7 @@ .\" .\" $FreeBSD$ .\" -.Dd December 5, 2010 +.Dd April 22, 2012 .Dt STAT 1 .Os .Sh NAME @@ -140,10 +140,6 @@ If the link is broken or the target does fall back on .Xr lstat 2 and report information about the link. -.It Fl l -Display output in -.Ic ls Fl lT -format. .It Fl n Do not force a newline to appear at the end of each piece of output. .It Fl q From owner-svn-src-stable@FreeBSD.ORG Sun Jul 15 11:39:36 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 7DB29106564A; Sun, 15 Jul 2012 11:39:36 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 647DB8FC16; Sun, 15 Jul 2012 11:39:36 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6FBdaPc045364; Sun, 15 Jul 2012 11:39:36 GMT (envelope-from des@svn.freebsd.org) Received: (from des@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6FBda4c045344; Sun, 15 Jul 2012 11:39:36 GMT (envelope-from des@svn.freebsd.org) Message-Id: <201207151139.q6FBda4c045344@svn.freebsd.org> From: Dag-Erling Smorgrav Date: Sun, 15 Jul 2012 11:39:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238481 - in stable/9: . bin/rcp etc include lib/libcrypt lib/libutil libexec/rshd release/picobsd/tinyware/passwd share/examples/etc sys/mips/rmi usr.bin/login usr.bin/passwd usr.bin/r... X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 15 Jul 2012 11:39:36 -0000 Author: des Date: Sun Jul 15 11:39:35 2012 New Revision: 238481 URL: http://svn.freebsd.org/changeset/base/238481 Log: MFH r236751: document sha256 / sha512 support MFH r236892: remove mention of auth.conf from programs that don't use it MFH r236963: remove dead code relating to auth.conf MFH r236965 r236966 r236967 r237005 r237006 r237011: retire auth.conf Approved by: re Deleted: stable/9/etc/auth.conf stable/9/lib/libutil/auth.3 stable/9/lib/libutil/auth.conf.5 Modified: stable/9/ObsoleteFiles.inc (contents, props changed) stable/9/bin/rcp/rcp.1 stable/9/etc/Makefile stable/9/include/paths.h stable/9/lib/libcrypt/Makefile stable/9/lib/libcrypt/crypt.3 stable/9/lib/libcrypt/crypt.c stable/9/lib/libutil/Makefile stable/9/lib/libutil/auth.c stable/9/lib/libutil/login.conf.5 stable/9/lib/libutil/property.3 stable/9/libexec/rshd/rshd.8 stable/9/release/picobsd/tinyware/passwd/passwd.c stable/9/share/examples/etc/README.examples stable/9/sys/mips/rmi/rootfs_list.txt stable/9/usr.bin/login/login.1 stable/9/usr.bin/passwd/passwd.1 stable/9/usr.bin/rlogin/rlogin.1 stable/9/usr.bin/rsh/rsh.1 Directory Properties: stable/9/ (props changed) stable/9/bin/rcp/ (props changed) stable/9/etc/ (props changed) stable/9/include/ (props changed) stable/9/lib/libcrypt/ (props changed) stable/9/lib/libutil/ (props changed) stable/9/libexec/rshd/ (props changed) stable/9/release/picobsd/tinyware/passwd/ (props changed) stable/9/share/examples/etc/ (props changed) stable/9/sys/ (props changed) stable/9/usr.bin/login/ (props changed) stable/9/usr.bin/passwd/ (props changed) stable/9/usr.bin/rlogin/ (props changed) stable/9/usr.bin/rsh/ (props changed) Modified: stable/9/ObsoleteFiles.inc ============================================================================== --- stable/9/ObsoleteFiles.inc Sun Jul 15 11:28:03 2012 (r238480) +++ stable/9/ObsoleteFiles.inc Sun Jul 15 11:39:35 2012 (r238481) @@ -38,6 +38,11 @@ # xargs -n1 | sort | uniq -d; # done +# 20120713: auth.conf removed +OLD_FILES+=etc/auth.conf +OLD_FILES+=usr/share/examples/etc/auth.conf +OLD_FILES+=usr/share/man/man3/auth.3.gz +OLD_FILES+=usr/share/man/man5/auth.conf.5.gz # 20120415: new clang import which bumps version from 3.0 to 3.1 OLD_FILES+=usr/include/clang/3.0/altivec.h OLD_FILES+=usr/include/clang/3.0/avxintrin.h Modified: stable/9/bin/rcp/rcp.1 ============================================================================== --- stable/9/bin/rcp/rcp.1 Sun Jul 15 11:28:03 2012 (r238480) +++ stable/9/bin/rcp/rcp.1 Sun Jul 15 11:39:35 2012 (r238481) @@ -116,17 +116,11 @@ The .Nm utility handles third party copies, where neither source nor target files are on the current machine. -.Sh FILES -.Bl -tag -width ".Pa /etc/auth.conf" -compact -.It Pa /etc/auth.conf -configure authentication services -.El .Sh SEE ALSO .Xr cp 1 , .Xr ftp 1 , .Xr rlogin 1 , .Xr rsh 1 , -.Xr auth.conf 5 , .Xr hosts.equiv 5 .Sh HISTORY The Modified: stable/9/etc/Makefile ============================================================================== --- stable/9/etc/Makefile Sun Jul 15 11:28:03 2012 (r238480) +++ stable/9/etc/Makefile Sun Jul 15 11:39:35 2012 (r238481) @@ -7,18 +7,47 @@ SUBDIR= sendmail .endif -BIN1= auth.conf \ - crontab devd.conf devfs.conf \ - ddb.conf dhclient.conf disktab fbtab \ - ftpusers gettytab group \ - hosts hosts.allow hosts.equiv \ - inetd.conf libalias.conf login.access login.conf mac.conf motd \ - netconfig network.subr networks newsyslog.conf nsswitch.conf \ - phones profile protocols \ - rc rc.bsdextended rc.firewall rc.initdiskless \ - rc.sendmail rc.shutdown \ - rc.subr remote rpc services shells \ - sysctl.conf syslog.conf termcap.small +BIN1= crontab \ + devd.conf \ + devfs.conf \ + ddb.conf \ + dhclient.conf \ + disktab \ + fbtab \ + ftpusers \ + gettytab \ + group \ + hosts \ + hosts.allow \ + hosts.equiv \ + inetd.conf \ + libalias.conf \ + login.access \ + login.conf \ + mac.conf \ + motd \ + netconfig \ + network.subr \ + networks \ + newsyslog.conf \ + nsswitch.conf \ + phones \ + profile \ + protocols \ + rc \ + rc.bsdextended \ + rc.firewall \ + rc.initdiskless \ + rc.sendmail \ + rc.shutdown \ + rc.subr \ + remote \ + rpc \ + services \ + shells \ + sysctl.conf \ + syslog.conf \ + termcap.small .if exists(${.CURDIR}/etc.${MACHINE}/ttys) BIN1+= etc.${MACHINE}/ttys Modified: stable/9/include/paths.h ============================================================================== --- stable/9/include/paths.h Sun Jul 15 11:28:03 2012 (r238480) +++ stable/9/include/paths.h Sun Jul 15 11:39:35 2012 (r238481) @@ -42,7 +42,6 @@ /* Locate system binaries. */ #define _PATH_SYSPATH "/sbin:/usr/sbin" -#define _PATH_AUTHCONF "/etc/auth.conf" #define _PATH_BSHELL "/bin/sh" #define _PATH_CAPABILITY "/etc/capability" #define _PATH_CAPABILITY_DB "/etc/capability.db" Modified: stable/9/lib/libcrypt/Makefile ============================================================================== --- stable/9/lib/libcrypt/Makefile Sun Jul 15 11:28:03 2012 (r238480) +++ stable/9/lib/libcrypt/Makefile Sun Jul 15 11:39:35 2012 (r238481) @@ -26,11 +26,7 @@ SRCS+= crypt-des.c crypt-blowfish.c blo CFLAGS+= -I${.CURDIR} -DHAS_DES -DHAS_BLOWFISH .endif -# And the auth_getval() code and support. -.PATH: ${.CURDIR}/../libutil -SRCS+= auth.c property.c -.for sym in auth_getval property_find properties_read properties_free \ - MD4Init MD4Final MD4Update MD4Pad \ +.for sym in MD4Init MD4Final MD4Update MD4Pad \ MD5Init MD5Final MD5Update MD5Pad \ SHA256_Init SHA256_Final SHA256_Update \ SHA512_Init SHA512_Final SHA512_Update Modified: stable/9/lib/libcrypt/crypt.3 ============================================================================== --- stable/9/lib/libcrypt/crypt.3 Sun Jul 15 11:28:03 2012 (r238480) +++ stable/9/lib/libcrypt/crypt.3 Sun Jul 15 11:39:35 2012 (r238481) @@ -242,12 +242,6 @@ The .Fn crypt_set_format function sets the default encoding format according to the supplied .Fa string . -.Pp -The global default format can be set using the -.Pa /etc/auth.conf -file using the -.Va crypt_default -property. .Sh RETURN VALUES The .Fn crypt @@ -264,9 +258,7 @@ Otherwise, a value of 0 is returned. .Sh SEE ALSO .Xr login 1 , .Xr passwd 1 , -.Xr auth_getval 3 , .Xr getpass 3 , -.Xr auth.conf 5 , .Xr passwd 5 .Sh HISTORY A rotor-based Modified: stable/9/lib/libcrypt/crypt.c ============================================================================== --- stable/9/lib/libcrypt/crypt.c Sun Jul 15 11:28:03 2012 (r238480) +++ stable/9/lib/libcrypt/crypt.c Sun Jul 15 11:39:35 2012 (r238481) @@ -79,23 +79,23 @@ static const struct { } }; +#ifdef HAS_DES +#define CRYPT_DEFAULT "des" +#else +#define CRYPT_DEFAULT "md5" +#endif + static int crypt_type = -1; static void crypt_setdefault(void) { - char *def; size_t i; if (crypt_type != -1) return; - def = auth_getval("crypt_default"); - if (def == NULL) { - crypt_type = 0; - return; - } for (i = 0; i < sizeof(crypt_types) / sizeof(crypt_types[0]) - 1; i++) { - if (strcmp(def, crypt_types[i].name) == 0) { + if (strcmp(CRYPT_DEFAULT, crypt_types[i].name) == 0) { crypt_type = (int)i; return; } Modified: stable/9/lib/libutil/Makefile ============================================================================== --- stable/9/lib/libutil/Makefile Sun Jul 15 11:28:03 2012 (r238480) +++ stable/9/lib/libutil/Makefile Sun Jul 15 11:39:35 2012 (r238481) @@ -8,7 +8,7 @@ SHLIBDIR?= /lib LIB= util SHLIB_MAJOR= 9 -SRCS= _secure_path.c auth.c expand_number.c flopen.c fparseln.c gr_util.c \ +SRCS= _secure_path.c expand_number.c flopen.c fparseln.c gr_util.c \ hexdump.c humanize_number.c kinfo_getfile.c kinfo_getfile.c \ kinfo_getallproc.c kinfo_getproc.c kinfo_getvmmap.c kld.c \ login_auth.c login_cap.c \ @@ -27,16 +27,15 @@ CFLAGS+= -I${.CURDIR} -I${.CURDIR}/../li MAN+= kld.3 login_auth.3 login_tty.3 pty.3 \ login_cap.3 login_class.3 login_times.3 login_ok.3 \ - _secure_path.3 uucplock.3 property.3 auth.3 realhostname.3 \ + _secure_path.3 uucplock.3 property.3 realhostname.3 \ realhostname_sa.3 trimdomain.3 fparseln.3 humanize_number.3 \ pidfile.3 flopen.3 expand_number.3 hexdump.3 \ kinfo_getfile.3 kinfo_getallproc.3 kinfo_getproc.3 \ kinfo_getvmmap.3 quotafile.3 -MAN+= login.conf.5 auth.conf.5 +MAN+= login.conf.5 MLINKS+= kld.3 kld_isloaded.3 kld.3 kld_load.3 MLINKS+= property.3 properties_read.3 property.3 properties_free.3 MLINKS+= property.3 property_find.3 -MLINKS+= auth.3 auth_getval.3 MLINKS+= pty.3 openpty.3 pty.3 forkpty.3 MLINKS+=login_cap.3 login_getclassbyname.3 login_cap.3 login_close.3 \ login_cap.3 login_getclass.3 login_cap.3 login_getuserclass.3 \ Modified: stable/9/lib/libutil/auth.c ============================================================================== --- stable/9/lib/libutil/auth.c Sun Jul 15 11:28:03 2012 (r238480) +++ stable/9/lib/libutil/auth.c Sun Jul 15 11:39:35 2012 (r238481) @@ -31,40 +31,14 @@ #include __FBSDID("$FreeBSD$"); -#include -#include -#include -#include -#include -#include - -static properties P; - -static int -initauthconf(const char *path) -{ - int fd; +#include - if (!P) { - if ((fd = open(path, O_RDONLY)) < 0) { - syslog(LOG_ERR, "initauthconf: unable to open file: %s", path); - return 1; - } - P = properties_read(fd); - close(fd); - if (!P) { - syslog(LOG_ERR, "initauthconf: unable to parse file: %s", path); - return 1; - } - } - return 0; -} +#include char * auth_getval(const char *name) { - if (!P && initauthconf(_PATH_AUTHCONF)) - return NULL; - else - return property_find(P, name); + + (void)name; + return (NULL); } Modified: stable/9/lib/libutil/login.conf.5 ============================================================================== --- stable/9/lib/libutil/login.conf.5 Sun Jul 15 11:28:03 2012 (r238480) +++ stable/9/lib/libutil/login.conf.5 Sun Jul 15 11:39:35 2012 (r238481) @@ -269,7 +269,9 @@ multiplied by 5 seconds. allowed before the login fails. .It "passwd_format string md5 The encryption format that new or changed passwords will use. -Valid values include "des", "md5" and "blf". +Valid values include "des", "md5", "blf", "sha256" and "sha512"; see +.Xr crypt 3 +for details. NIS clients using a .No non- Ns Fx NIS server should probably use "des". Modified: stable/9/lib/libutil/property.3 ============================================================================== --- stable/9/lib/libutil/property.3 Sun Jul 15 11:28:03 2012 (r238480) +++ stable/9/lib/libutil/property.3 Sun Jul 15 11:39:35 2012 (r238481) @@ -91,8 +91,6 @@ are desired, the entire value should be characters. Any line beginning with a # or ; character is assumed to be a comment and will be ignored. -.Sh SEE ALSO -.Xr auth_getval 3 .Sh AUTHORS .An Jordan Hubbard .Sh BUGS Modified: stable/9/libexec/rshd/rshd.8 ============================================================================== --- stable/9/libexec/rshd/rshd.8 Sun Jul 15 11:28:03 2012 (r238480) +++ stable/9/libexec/rshd/rshd.8 Sun Jul 15 11:39:35 2012 (r238481) @@ -237,7 +237,6 @@ and is not preceded by a flag byte. .Xr gethostbyaddr 3 , .Xr rcmd 3 , .Xr ruserok 3 , -.Xr auth.conf 5 , .Xr hosts 5 , .Xr hosts.equiv 5 , .Xr login.conf 5 , Modified: stable/9/release/picobsd/tinyware/passwd/passwd.c ============================================================================== --- stable/9/release/picobsd/tinyware/passwd/passwd.c Sun Jul 15 11:28:03 2012 (r238480) +++ stable/9/release/picobsd/tinyware/passwd/passwd.c Sun Jul 15 11:39:35 2012 (r238481) @@ -64,10 +64,6 @@ int yp_errno = YP_TRUE; extern int yp_passwd( char * ); #endif -#ifdef KERBEROS -#include "krb.h" -#endif - #include "extern.h" static void usage(void); @@ -81,26 +77,12 @@ main(argc, argv) { int ch; char *uname; -#ifdef KERBEROS - char *iflag = 0, *rflag = 0, *uflag = 0; - char *k; -#endif #ifdef YP -#ifdef KERBEROS - char realm[REALM_SZ]; -#define OPTIONS "d:h:lysfoi:r:u:" -#else #define OPTIONS "d:h:lysfo" -#endif -#else -#ifdef KERBEROS - char realm[REALM_SZ]; -#define OPTIONS "li:r:u:" #else #define OPTIONS "l" #endif -#endif #ifdef YP int res = 0; @@ -113,17 +95,6 @@ main(argc, argv) case 'l': /* change local password file */ use_local_passwd = 1; break; -#ifdef KERBEROS - case 'i': - iflag = optarg; - break; - case 'r': - rflag = optarg; - break; - case 'u': - uflag = optarg; - break; -#endif /* KERBEROS */ #ifdef YP case 'y': /* Change NIS password */ __use_yp = 1; @@ -182,46 +153,29 @@ main(argc, argv) /* * If NIS is turned on in the password database, use it, else punt. */ -#ifdef KERBEROS - if (__use_yp || (iflag == NULL && rflag == NULL && uflag == NULL)) { -#endif - res = use_yp(uname, 0, 0); - if (res == USER_YP_ONLY) { - if (!use_local_passwd) { - exit(yp_passwd(uname)); - } else { + res = use_yp(uname, 0, 0); + if (res == USER_YP_ONLY) { + if (!use_local_passwd) { + exit(yp_passwd(uname)); + } else { /* * Reject -l flag if NIS is turned on and the user * doesn't exist in the local password database. */ - errx(1, "unknown local user: %s", uname); - } - } else if (res == USER_LOCAL_ONLY) { - /* - * Reject -y flag if user only exists locally. - */ - if (__use_yp) - errx(1, "unknown NIS user: %s", uname); - } else if (res == USER_YP_AND_LOCAL) { - if (!use_local_passwd && (yp_in_pw_file || __use_yp)) - exit(yp_passwd(uname)); + errx(1, "unknown local user: %s", uname); } -#ifdef KERBEROS + } else if (res == USER_LOCAL_ONLY) { + /* + * Reject -y flag if user only exists locally. + */ + if (__use_yp) + errx(1, "unknown NIS user: %s", uname); + } else if (res == USER_YP_AND_LOCAL) { + if (!use_local_passwd && (yp_in_pw_file || __use_yp)) + exit(yp_passwd(uname)); } #endif -#endif - if (!use_local_passwd) { -#ifdef KERBEROS - k = auth_getval("auth_list"); - if (k && strstr(k, "kerberos")) - if(krb_get_lrealm(realm, 0) == KSUCCESS) { - setuid(getuid()); - fprintf(stderr, "realm %s\n", realm); - exit(krb_passwd(argv[0], iflag, rflag, uflag)); - } -#endif - } exit(local_passwd(uname)); } @@ -230,21 +184,10 @@ usage() { #ifdef YP -#ifdef KERBEROS - fprintf(stderr, "%s\n%s\n", - "usage: passwd [-l] [-i instance] [-r realm] [-u fullname]", - " passwd [-l] [-y] [-o] [-d domain [-h host]] [user]"); -#else (void)fprintf(stderr, "usage: passwd [-l] [-y] [-o] [-d domain [-h host]] [user]\n"); -#endif #else -#ifdef KERBEROS - fprintf(stderr, - "usage: passwd [-l] [-i instance] [-r realm] [-u fullname] [user]\n"); -#else - (void)fprintf(stderr, "usage: passwd user\n"); -#endif + (void)fprintf(stderr, "usage: passwd [-l] user\n"); #endif exit(1); } Modified: stable/9/share/examples/etc/README.examples ============================================================================== --- stable/9/share/examples/etc/README.examples Sun Jul 15 11:28:03 2012 (r238480) +++ stable/9/share/examples/etc/README.examples Sun Jul 15 11:39:35 2012 (r238481) @@ -9,7 +9,6 @@ This directory contains the following fi amd.map - filesystem automounter lookup resolution map (see amd(8)) apmd.conf - configuration file for apmd(8) -auth.conf - authentication capability database (see auth.conf(5)) bsd-style-copyright - copyright style for bsd system crontab - system scheduled command table (see crontab(5)) csh.cshrc - sample .cshrc (see csh(1)) Modified: stable/9/sys/mips/rmi/rootfs_list.txt ============================================================================== --- stable/9/sys/mips/rmi/rootfs_list.txt Sun Jul 15 11:28:03 2012 (r238480) +++ stable/9/sys/mips/rmi/rootfs_list.txt Sun Jul 15 11:39:35 2012 (r238481) @@ -1,3 +1,5 @@ +# $FreeBSD$ +# # This is the list of files that # should be in your rootfs (copy it from # the build world nfsmount dir. When the rge0 @@ -321,7 +323,6 @@ ./etc/ssh/moduli ./etc/ssl ./etc/ssl/openssl.cnf -./etc/auth.conf ./etc/crontab ./etc/devd.conf ./etc/devfs.conf Modified: stable/9/usr.bin/login/login.1 ============================================================================== --- stable/9/usr.bin/login/login.1 Sun Jul 15 11:28:03 2012 (r238480) +++ stable/9/usr.bin/login/login.1 Sun Jul 15 11:39:35 2012 (r238481) @@ -137,8 +137,6 @@ message-of-the-day system mailboxes .It Pa \&.hushlogin makes login quieter -.It Pa /etc/auth.conf -configure authentication services .It Pa /etc/pam.d/login .Xr pam 8 configuration file Modified: stable/9/usr.bin/passwd/passwd.1 ============================================================================== --- stable/9/usr.bin/passwd/passwd.1 Sun Jul 15 11:28:03 2012 (r238480) +++ stable/9/usr.bin/passwd/passwd.1 Sun Jul 15 11:39:35 2012 (r238481) @@ -221,8 +221,6 @@ a Version 7 format password file temporary copy of the password file .It Pa /etc/login.conf login class capabilities database -.It Pa /etc/auth.conf -configure authentication services .El .Sh SEE ALSO .Xr chpass 1 , Modified: stable/9/usr.bin/rlogin/rlogin.1 ============================================================================== --- stable/9/usr.bin/rlogin/rlogin.1 Sun Jul 15 11:28:03 2012 (r238480) +++ stable/9/usr.bin/rlogin/rlogin.1 Sun Jul 15 11:39:35 2012 (r238481) @@ -128,7 +128,6 @@ Determines the user's terminal type. .Bl -tag -width /etc/hosts -compact .It Pa /etc/hosts .It Pa /etc/hosts.equiv -.It Pa /etc/auth.conf .It Ev $HOME Ns Pa /.rhosts .El .Sh SEE ALSO @@ -138,7 +137,6 @@ Determines the user's terminal type. .Xr setsockopt 2 , .Xr ruserok 3 , .Xr tty 4 , -.Xr auth.conf 5 , .Xr hosts 5 , .Xr hosts.equiv 5 , .Xr rlogind 8 , Modified: stable/9/usr.bin/rsh/rsh.1 ============================================================================== --- stable/9/usr.bin/rsh/rsh.1 Sun Jul 15 11:28:03 2012 (r238480) +++ stable/9/usr.bin/rsh/rsh.1 Sun Jul 15 11:39:35 2012 (r238481) @@ -125,14 +125,12 @@ to .Sh FILES .Bl -tag -width /etc/hosts -compact .It Pa /etc/hosts -.It Pa /etc/auth.conf .El .Sh SEE ALSO .Xr rlogin 1 , .Xr setsockopt 2 , .Xr rcmd 3 , .Xr ruserok 3 , -.Xr auth.conf 5 , .Xr hosts 5 , .Xr hosts.equiv 5 , .Xr rlogind 8 , From owner-svn-src-stable@FreeBSD.ORG Sun Jul 15 11:39:57 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 1E2861065673; Sun, 15 Jul 2012 11:39:57 +0000 (UTC) (envelope-from issyl0@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id F331F8FC12; Sun, 15 Jul 2012 11:39:56 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6FBduqB045417; Sun, 15 Jul 2012 11:39:56 GMT (envelope-from issyl0@svn.freebsd.org) Received: (from issyl0@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6FBduP0045411; Sun, 15 Jul 2012 11:39:56 GMT (envelope-from issyl0@svn.freebsd.org) Message-Id: <201207151139.q6FBduP0045411@svn.freebsd.org> From: Isabell Long Date: Sun, 15 Jul 2012 11:39:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238482 - in stable/9/lib/libc: stdlib stdtime X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 15 Jul 2012 11:39:57 -0000 Author: issyl0 (doc committer) Date: Sun Jul 15 11:39:56 2012 New Revision: 238482 URL: http://svn.freebsd.org/changeset/base/238482 Log: MFC r237573: Add more locale-specific functions to the relevant man pages and Makefiles: - libc/stdtime/strftime.3 - libc/stdtime/strptime.3 - libc/stdlib/strfmon.3 Approved by: gabor (mentor) Approved by: re (kib) Modified: stable/9/lib/libc/stdlib/Makefile.inc stable/9/lib/libc/stdlib/strfmon.3 stable/9/lib/libc/stdtime/Makefile.inc stable/9/lib/libc/stdtime/strftime.3 stable/9/lib/libc/stdtime/strptime.3 Directory Properties: stable/9/lib/libc/ (props changed) stable/9/lib/libc/stdtime/ (props changed) Modified: stable/9/lib/libc/stdlib/Makefile.inc ============================================================================== --- stable/9/lib/libc/stdlib/Makefile.inc Sun Jul 15 11:39:35 2012 (r238481) +++ stable/9/lib/libc/stdlib/Makefile.inc Sun Jul 15 11:39:56 2012 (r238482) @@ -42,6 +42,7 @@ MLINKS+=rand.3 rand_r.3 rand.3 srand.3 r MLINKS+=random.3 initstate.3 random.3 setstate.3 random.3 srandom.3 \ random.3 srandomdev.3 MLINKS+=radixsort.3 sradixsort.3 +MLINKS+=strfmon.3 strfmon_l.3 MLINKS+=strtod.3 strtof.3 strtod.3 strtold.3 MLINKS+=strtol.3 strtoll.3 strtol.3 strtoq.3 strtol.3 strtoimax.3 MLINKS+=strtoul.3 strtoull.3 strtoul.3 strtouq.3 strtoul.3 strtoumax.3 Modified: stable/9/lib/libc/stdlib/strfmon.3 ============================================================================== --- stable/9/lib/libc/stdlib/strfmon.3 Sun Jul 15 11:39:35 2012 (r238481) +++ stable/9/lib/libc/stdlib/strfmon.3 Sun Jul 15 11:39:56 2012 (r238482) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 12, 2002 +.Dd June 25, 2012 .Dt STRFMON 3 .Os .Sh NAME @@ -36,6 +36,8 @@ .In monetary.h .Ft ssize_t .Fn strfmon "char * restrict s" "size_t maxsize" "const char * restrict format" "..." +.Ft ssize_t +.Fn strfmon_l "char * restrict s" "size_t maxsize" "locale_t loc" "const char * restrict format" "..." .Sh DESCRIPTION The .Fn strfmon @@ -47,6 +49,12 @@ No more than .Fa maxsize bytes are placed into the array. .Pp +The +.Fn strfmon_l +function does the same as +.Fn strfmon +but takes an explicit locale rather than using the current locale. +.Pp The format string is composed of zero or more directives: ordinary characters (not .Cm % ) , @@ -129,6 +137,11 @@ the contents of the array are indetermin and .Va errno is set to indicate the error. +.Pp +The +.Fn strfmon_l +function returns the same values as +.Fn strfmon . .Sh ERRORS The .Fn strfmon @@ -149,6 +162,10 @@ The function conforms to .St -p1003.1-2001 . +The +.Fn strfmon_l +function conforms to +.St -p1003.1-2008 . .Sh AUTHORS .An -nosplit The Modified: stable/9/lib/libc/stdtime/Makefile.inc ============================================================================== --- stable/9/lib/libc/stdtime/Makefile.inc Sun Jul 15 11:39:35 2012 (r238481) +++ stable/9/lib/libc/stdtime/Makefile.inc Sun Jul 15 11:39:56 2012 (r238482) @@ -18,4 +18,6 @@ MLINKS+=ctime.3 asctime.3 ctime.3 diffti ctime.3 localtime.3 ctime.3 mktime.3 ctime.3 timegm.3 \ ctime.3 ctime_r.3 ctime.3 localtime_r.3 ctime.3 gmtime_r.3 \ ctime.3 asctime_r.3 +MLINKS+=strftime.3 strftime_l.3 +MLINKS+=strptime.3 strptime_l.3 MLINKS+=time2posix.3 posix2time.3 Modified: stable/9/lib/libc/stdtime/strftime.3 ============================================================================== --- stable/9/lib/libc/stdtime/strftime.3 Sun Jul 15 11:39:35 2012 (r238481) +++ stable/9/lib/libc/stdtime/strftime.3 Sun Jul 15 11:39:56 2012 (r238482) @@ -32,7 +32,7 @@ .\" @(#)strftime.3 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd November 4, 2004 +.Dd June 25, 2012 .Dt STRFTIME 3 .Os .Sh NAME @@ -49,6 +49,8 @@ .Fa "const char * restrict format" .Fa "const struct tm * restrict timeptr" .Fc +.Ft size_t +.Fn strftime_l "char *restrict buf" "size_t maxsize" "const char * restrict format" "const struct tm *restrict timeptr" "locale_t loc" .Sh DESCRIPTION The .Fn strftime @@ -58,6 +60,11 @@ into the buffer .Fa buf according to the string pointed to by .Fa format . +The function +.Fn strftime_l +does the same as +.Fn strftime +but takes an explicit locale rather than using the current locale. .Pp The .Fa format @@ -268,6 +275,10 @@ The peculiar week number and year in the and .Ql \&%V are defined in ISO 8601: 1988. +The +.Fn strftime_l +function conforms to +.St -p1003.1-2008 . .Sh BUGS There is no conversion specification for the phase of the moon. .Pp Modified: stable/9/lib/libc/stdtime/strptime.3 ============================================================================== --- stable/9/lib/libc/stdtime/strptime.3 Sun Jul 15 11:39:35 2012 (r238481) +++ stable/9/lib/libc/stdtime/strptime.3 Sun Jul 15 11:39:56 2012 (r238482) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" " -.Dd January 4, 2003 +.Dd June 25, 2012 .Dt STRPTIME 3 .Os .Sh NAME @@ -41,6 +41,10 @@ .Fa "const char * restrict format" .Fa "struct tm * restrict timeptr" .Fc +.In time.h +.In xlocale.h +.Ft char * +.Fn strptime_l "const char * restrict buf" "const char * restrict format" "struct tm * restrict timeptr" "locale_t loc" .Sh DESCRIPTION The .Fn strptime @@ -53,6 +57,11 @@ and fills in the elements of the structu The resulting values will be relative to the local time zone. Thus, it can be considered the reverse operation of .Xr strftime 3 . +The +.Fn strptime_l +function does the same as +.Fn strptime , +but takes an explicit locale rather than using the current locale. .Pp The .Fa format @@ -104,6 +113,9 @@ that has not been required to satisfy th It returns .Dv NULL if one of the conversions failed. +.Fn strptime_l +returns the same values as +.Fn strptime . .Sh SEE ALSO .Xr date 1 , .Xr scanf 3 , From owner-svn-src-stable@FreeBSD.ORG Sun Jul 15 12:00:48 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8097D106564A; Sun, 15 Jul 2012 12:00:48 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2EE928FC17; Sun, 15 Jul 2012 12:00:48 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6FC0m8D046386; Sun, 15 Jul 2012 12:00:48 GMT (envelope-from des@svn.freebsd.org) Received: (from des@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6FC0lxY046383; Sun, 15 Jul 2012 12:00:47 GMT (envelope-from des@svn.freebsd.org) Message-Id: <201207151200.q6FC0lxY046383@svn.freebsd.org> From: Dag-Erling Smorgrav Date: Sun, 15 Jul 2012 12:00:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238484 - in stable/9: etc lib/libutil X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 15 Jul 2012 12:00:48 -0000 Author: des Date: Sun Jul 15 12:00:47 2012 New Revision: 238484 URL: http://svn.freebsd.org/changeset/base/238484 Log: MFH r237269: switch default password hash to sha512. Approved by: re Modified: stable/9/etc/login.conf stable/9/lib/libutil/login.conf.5 Directory Properties: stable/9/etc/ (props changed) stable/9/lib/libutil/ (props changed) Modified: stable/9/etc/login.conf ============================================================================== --- stable/9/etc/login.conf Sun Jul 15 11:52:24 2012 (r238483) +++ stable/9/etc/login.conf Sun Jul 15 12:00:47 2012 (r238484) @@ -23,7 +23,7 @@ # AND SEMANTICS'' section of getcap(3) for more escape sequences). default:\ - :passwd_format=md5:\ + :passwd_format=sha512:\ :copyright=/etc/COPYRIGHT:\ :welcome=/etc/motd:\ :setenv=MAIL=/var/mail/$,BLOCKSIZE=K,FTP_PASSIVE_MODE=YES:\ Modified: stable/9/lib/libutil/login.conf.5 ============================================================================== --- stable/9/lib/libutil/login.conf.5 Sun Jul 15 11:52:24 2012 (r238483) +++ stable/9/lib/libutil/login.conf.5 Sun Jul 15 12:00:47 2012 (r238484) @@ -267,7 +267,7 @@ The backoff delay is the number of tries multiplied by 5 seconds. .It "login-retries number 10 The number of login attempts allowed before the login fails. -.It "passwd_format string md5 The encryption format that new or +.It "passwd_format string sha512 The encryption format that new or" changed passwords will use. Valid values include "des", "md5", "blf", "sha256" and "sha512"; see .Xr crypt 3 From owner-svn-src-stable@FreeBSD.ORG Sun Jul 15 12:13:16 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 47A921065673; Sun, 15 Jul 2012 12:13:16 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 326CB8FC0C; Sun, 15 Jul 2012 12:13:16 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6FCDGEa047018; Sun, 15 Jul 2012 12:13:16 GMT (envelope-from des@svn.freebsd.org) Received: (from des@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6FCDFEv047016; Sun, 15 Jul 2012 12:13:15 GMT (envelope-from des@svn.freebsd.org) Message-Id: <201207151213.q6FCDFEv047016@svn.freebsd.org> From: Dag-Erling Smorgrav Date: Sun, 15 Jul 2012 12:13:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238485 - stable/9/etc X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 15 Jul 2012 12:13:16 -0000 Author: des Date: Sun Jul 15 12:13:15 2012 New Revision: 238485 URL: http://svn.freebsd.org/changeset/base/238485 Log: MFH r237270: no need to specify passive mode, it is the default. Approved by: re Modified: stable/9/etc/login.conf Directory Properties: stable/9/etc/ (props changed) Modified: stable/9/etc/login.conf ============================================================================== --- stable/9/etc/login.conf Sun Jul 15 12:00:47 2012 (r238484) +++ stable/9/etc/login.conf Sun Jul 15 12:13:15 2012 (r238485) @@ -26,7 +26,7 @@ default:\ :passwd_format=sha512:\ :copyright=/etc/COPYRIGHT:\ :welcome=/etc/motd:\ - :setenv=MAIL=/var/mail/$,BLOCKSIZE=K,FTP_PASSIVE_MODE=YES:\ + :setenv=MAIL=/var/mail/$,BLOCKSIZE=K:\ :path=/sbin /bin /usr/sbin /usr/bin /usr/games /usr/local/sbin /usr/local/bin ~/bin:\ :nologin=/var/run/nologin:\ :cputime=unlimited:\ From owner-svn-src-stable@FreeBSD.ORG Sun Jul 15 18:14:05 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 58A6E1065670; Sun, 15 Jul 2012 18:14:05 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4250F8FC08; Sun, 15 Jul 2012 18:14:05 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6FIE5Ed063041; Sun, 15 Jul 2012 18:14:05 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6FIE5Cq063039; Sun, 15 Jul 2012 18:14:05 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <201207151814.q6FIE5Cq063039@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Sun, 15 Jul 2012 18:14:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238494 - stable/8/sys/netinet6 X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 15 Jul 2012 18:14:05 -0000 Author: bz Date: Sun Jul 15 18:14:04 2012 New Revision: 238494 URL: http://svn.freebsd.org/changeset/base/238494 Log: MFC r238222: As mentioned in the commit message of r237571 (copied from a prototype patch of mine) also check if the 2nd in6_setscope() failed and return the error in that case. Modified: stable/8/sys/netinet6/in6.c Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/netinet6/in6.c ============================================================================== --- stable/8/sys/netinet6/in6.c Sun Jul 15 18:12:09 2012 (r238493) +++ stable/8/sys/netinet6/in6.c Sun Jul 15 18:14:04 2012 (r238494) @@ -1235,7 +1235,9 @@ in6_purgeaddr_mc(struct ifnet *ifp, stru sin6.sin6_family = AF_INET6; memcpy(&sin6.sin6_addr, &satosin6(ifa0->ifa_addr)->sin6_addr, sizeof(sin6.sin6_addr)); - in6_setscope(&sin6.sin6_addr, ifa0->ifa_ifp, NULL); + error = in6_setscope(&sin6.sin6_addr, ifa0->ifa_ifp, NULL); + if (error != 0) + return (error); } rt = in6_rtalloc1((struct sockaddr *)&mltaddr, 0, 0UL, RT_DEFAULT_FIB); From owner-svn-src-stable@FreeBSD.ORG Sun Jul 15 18:20:09 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id E3A7B1065673; Sun, 15 Jul 2012 18:20:09 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CE70C8FC0A; Sun, 15 Jul 2012 18:20:09 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6FIK9Z7063427; Sun, 15 Jul 2012 18:20:09 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6FIK9Au063425; Sun, 15 Jul 2012 18:20:09 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <201207151820.q6FIK9Au063425@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Sun, 15 Jul 2012 18:20:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238495 - stable/8/sys/netinet6 X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 15 Jul 2012 18:20:10 -0000 Author: bz Date: Sun Jul 15 18:20:09 2012 New Revision: 238495 URL: http://svn.freebsd.org/changeset/base/238495 Log: MFC r238248: Implement handling of "atomic fragements" as outlined in draft-gont-6man-ipv6-atomic-fragments to mitigate one class of possible fragmentation-based attacks. Modified: stable/8/sys/netinet6/frag6.c Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/netinet6/frag6.c ============================================================================== --- stable/8/sys/netinet6/frag6.c Sun Jul 15 18:14:04 2012 (r238494) +++ stable/8/sys/netinet6/frag6.c Sun Jul 15 18:20:09 2012 (r238495) @@ -221,6 +221,19 @@ frag6_input(struct mbuf **mp, int *offp, /* offset now points to data portion */ offset += sizeof(struct ip6_frag); + /* + * XXX-BZ RFC XXXX (draft-gont-6man-ipv6-atomic-fragments) + * Handle "atomic" fragments (offset and m bit set to 0) upfront, + * unrelated to any reassembly. Just skip the fragment header. + */ + if ((ip6f->ip6f_offlg & ~IP6F_RESERVED_MASK) == 0) { + /* XXX-BZ we want dedicated counters for this. */ + V_ip6stat.ip6s_reassembled++; + in6_ifstat_inc(dstifp, ifs6_reass_ok); + *offp = offset; + return (ip6f->ip6f_nxt); + } + IP6Q_LOCK(); /* From owner-svn-src-stable@FreeBSD.ORG Sun Jul 15 19:05:59 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 892A91065674; Sun, 15 Jul 2012 19:05:59 +0000 (UTC) (envelope-from jh@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 738DD8FC15; Sun, 15 Jul 2012 19:05:59 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6FJ5xcc066382; Sun, 15 Jul 2012 19:05:59 GMT (envelope-from jh@svn.freebsd.org) Received: (from jh@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6FJ5xW4066380; Sun, 15 Jul 2012 19:05:59 GMT (envelope-from jh@svn.freebsd.org) Message-Id: <201207151905.q6FJ5xW4066380@svn.freebsd.org> From: Jaakko Heinonen Date: Sun, 15 Jul 2012 19:05:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238497 - stable/7/sbin/mount_ntfs X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 15 Jul 2012 19:05:59 -0000 Author: jh Date: Sun Jul 15 19:05:58 2012 New Revision: 238497 URL: http://svn.freebsd.org/changeset/base/238497 Log: MFC r230642: Remove trailing whitespace. Modified: stable/7/sbin/mount_ntfs/mount_ntfs.c Directory Properties: stable/7/sbin/mount_ntfs/ (props changed) Modified: stable/7/sbin/mount_ntfs/mount_ntfs.c ============================================================================== --- stable/7/sbin/mount_ntfs/mount_ntfs.c Sun Jul 15 19:04:12 2012 (r238496) +++ stable/7/sbin/mount_ntfs/mount_ntfs.c Sun Jul 15 19:05:58 2012 (r238497) @@ -162,7 +162,7 @@ main(argc, argv) } /* - * Resolve the mountpoint with realpath(3) and remove unnecessary + * Resolve the mountpoint with realpath(3) and remove unnecessary * slashes from the devicename if there are any. */ (void)checkpath(dir, mntpath); From owner-svn-src-stable@FreeBSD.ORG Sun Jul 15 19:52:24 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0F38C106566B; Sun, 15 Jul 2012 19:52:24 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E461B8FC08; Sun, 15 Jul 2012 19:52:23 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6FJqNDo069133; Sun, 15 Jul 2012 19:52:23 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6FJqNhi069130; Sun, 15 Jul 2012 19:52:23 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201207151952.q6FJqNhi069130@svn.freebsd.org> From: Gleb Smirnoff Date: Sun, 15 Jul 2012 19:52:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238500 - stable/9/sys/geom/mirror X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 15 Jul 2012 19:52:24 -0000 Author: glebius Date: Sun Jul 15 19:52:23 2012 New Revision: 238500 URL: http://svn.freebsd.org/changeset/base/238500 Log: Merge r237929, r237930 from head: ------------------------------------------------------------------------ r237929 | glebius | 2012-07-01 19:30:43 +0400 (вс, 01 июл 2012) | 6 lines In g_mirror_regular_request() upon successful delivery treat BIO_DELETE requests same way as BIO_WRITE removing them from queue. This fixes panic with BIO_DELETE operations on geom_mirror. Reviewed by: pjd ------------------------------------------------------------------------ r237930 | glebius | 2012-07-01 19:43:52 +0400 (вс, 01 июл 2012) | 20 lines Make geom_mirror more friendly to SSDs. To properly support TRIM, we need to pass BIO_DELETE requests down to providers that support it. Also, we need to announce our support for BIO_DELETE to upper consumer. This requires: - In g_mirror_start() return true for "GEOM::candelete" request. - In g_mirror_init_disk() probe below provider for "GEOM::candelete" attribute, and mark disk with a flag if it does support BIO_DELETE. - In g_mirror_register_request() distribute BIO_DELETE requests only to those disks, that do support it. Note that we announce "GEOM::candelete" as true unconditionally of whether we have TRIM-capable media down below or not. This is made intentionally, because upper consumer (usually UFS) requests the attribite only once at mount time. And if user ever migrates his mirror from HDDs to SSDs, then he/she would get TRIM working without remounting filesystem. Reviewed by: pjd Approved by: re (kib) Modified: stable/9/sys/geom/mirror/g_mirror.c stable/9/sys/geom/mirror/g_mirror.h Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/geom/mirror/g_mirror.c ============================================================================== --- stable/9/sys/geom/mirror/g_mirror.c Sun Jul 15 19:32:02 2012 (r238499) +++ stable/9/sys/geom/mirror/g_mirror.c Sun Jul 15 19:52:23 2012 (r238500) @@ -439,7 +439,7 @@ g_mirror_init_disk(struct g_mirror_softc struct g_mirror_metadata *md, int *errorp) { struct g_mirror_disk *disk; - int error; + int i, error; disk = malloc(sizeof(*disk), M_MIRROR, M_NOWAIT | M_ZERO); if (disk == NULL) { @@ -454,6 +454,11 @@ g_mirror_init_disk(struct g_mirror_softc disk->d_state = G_MIRROR_DISK_STATE_NONE; disk->d_priority = md->md_priority; disk->d_flags = md->md_dflags; + error = g_getattr("GEOM::candelete", disk->d_consumer, &i); + if (error != 0) + goto fail; + if (i) + disk->d_flags |= G_MIRROR_DISK_FLAG_CANDELETE; if (md->md_provider[0] != '\0') disk->d_flags |= G_MIRROR_DISK_FLAG_HARDCODED; disk->d_sync.ds_consumer = NULL; @@ -890,7 +895,8 @@ g_mirror_regular_request(struct bio *bp) if (pbp->bio_children == pbp->bio_inbed) { G_MIRROR_LOGREQ(3, pbp, "Request delivered."); pbp->bio_completed = pbp->bio_length; - if (pbp->bio_cmd == BIO_WRITE) { + if (pbp->bio_cmd == BIO_WRITE || + pbp->bio_cmd == BIO_DELETE) { bioq_remove(&sc->sc_inflight, pbp); /* Release delayed sync requests if possible. */ g_mirror_sync_release(sc); @@ -1083,7 +1089,9 @@ g_mirror_start(struct bio *bp) g_mirror_flush(sc, bp); return; case BIO_GETATTR: - if (strcmp("GEOM::kerneldump", bp->bio_attribute) == 0) { + if (g_handleattr_int(bp, "GEOM::candelete", 1)) + return; + else if (strcmp("GEOM::kerneldump", bp->bio_attribute) == 0) { g_mirror_kernel_dump(bp); return; } @@ -1630,6 +1638,9 @@ g_mirror_register_request(struct bio *bp default: continue; } + if (bp->bio_cmd == BIO_DELETE && + (disk->d_flags & G_MIRROR_DISK_FLAG_CANDELETE) == 0) + continue; cbp = g_clone_bio(bp); if (cbp == NULL) { for (cbp = bioq_first(&queue); cbp != NULL; Modified: stable/9/sys/geom/mirror/g_mirror.h ============================================================================== --- stable/9/sys/geom/mirror/g_mirror.h Sun Jul 15 19:32:02 2012 (r238499) +++ stable/9/sys/geom/mirror/g_mirror.h Sun Jul 15 19:52:23 2012 (r238500) @@ -59,10 +59,12 @@ #define G_MIRROR_DISK_FLAG_INACTIVE 0x0000000000000008ULL #define G_MIRROR_DISK_FLAG_HARDCODED 0x0000000000000010ULL #define G_MIRROR_DISK_FLAG_BROKEN 0x0000000000000020ULL +#define G_MIRROR_DISK_FLAG_CANDELETE 0x0000000000000040ULL #define G_MIRROR_DISK_FLAG_MASK (G_MIRROR_DISK_FLAG_DIRTY | \ G_MIRROR_DISK_FLAG_SYNCHRONIZING | \ G_MIRROR_DISK_FLAG_FORCE_SYNC | \ - G_MIRROR_DISK_FLAG_INACTIVE) + G_MIRROR_DISK_FLAG_INACTIVE | \ + G_MIRROR_DISK_FLAG_CANDELETE) #define G_MIRROR_DEVICE_FLAG_NOAUTOSYNC 0x0000000000000001ULL #define G_MIRROR_DEVICE_FLAG_NOFAILSYNC 0x0000000000000002ULL From owner-svn-src-stable@FreeBSD.ORG Sun Jul 15 20:38:02 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D0294106564A; Sun, 15 Jul 2012 20:38:02 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B08B78FC14; Sun, 15 Jul 2012 20:38:02 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6FKc20L071893; Sun, 15 Jul 2012 20:38:02 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6FKc2iF071890; Sun, 15 Jul 2012 20:38:02 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201207152038.q6FKc2iF071890@svn.freebsd.org> From: Andriy Gapon Date: Sun, 15 Jul 2012 20:38:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238503 - in stable/9/sys/cddl/dev/dtrace: amd64 i386 X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 15 Jul 2012 20:38:02 -0000 Author: avg Date: Sun Jul 15 20:38:02 2012 New Revision: 238503 URL: http://svn.freebsd.org/changeset/base/238503 Log: MFC r238168,238169: further dtrace disassembler fixes for long nop decoding - segment-override prefixes are not invalid in long mode - fix nopw (0f 1f) behavior with respect to modifiers Reported by: emaste Tested by: emaste Obtained from: Illumos commit 13442:4adbe6de60c8 Approved by: re (kib) Modified: stable/9/sys/cddl/dev/dtrace/amd64/dis_tables.c stable/9/sys/cddl/dev/dtrace/i386/dis_tables.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/cddl/dev/dtrace/amd64/dis_tables.c ============================================================================== --- stable/9/sys/cddl/dev/dtrace/amd64/dis_tables.c Sun Jul 15 20:29:48 2012 (r238502) +++ stable/9/sys/cddl/dev/dtrace/amd64/dis_tables.c Sun Jul 15 20:38:02 2012 (r238503) @@ -815,7 +815,7 @@ const instable_t dis_op0F[16][16] = { /* [10] */ TNSZ("movups",XMMO,16), TNSZ("movups",XMMOS,16),TNSZ("movlps",XMMO,8), TNSZ("movlps",XMMOS,8), /* [14] */ TNSZ("unpcklps",XMMO,16),TNSZ("unpckhps",XMMO,16),TNSZ("movhps",XMMOM,8),TNSZ("movhps",XMMOMS,8), /* [18] */ IND(dis_op0F18), INVALID, INVALID, INVALID, -/* [1C] */ INVALID, INVALID, INVALID, TNS("nopw", M), +/* [1C] */ INVALID, INVALID, INVALID, TS("nopw", Mw), }, { /* [20] */ TSy("mov",SREG), TSy("mov",SREG), TSy("mov",SREG), TSy("mov",SREG), /* [24] */ TSx("mov",SREG), INVALID, TSx("mov",SREG), INVALID, @@ -1146,14 +1146,14 @@ const instable_t dis_distable[16][16] = /* [1,C] */ TNS("sbbb",IA), TS("sbb",IA), TSx("push",SEG), TSx("pop",SEG), }, { /* [2,0] */ TNS("andb",RMw), TS("and",RMw), TNS("andb",MRw), TS("and",MRw), -/* [2,4] */ TNS("andb",IA), TS("and",IA), TNSx("%es:",OVERRIDE), TNSx("daa",NORM), +/* [2,4] */ TNS("andb",IA), TS("and",IA), TNS("%es:",OVERRIDE), TNSx("daa",NORM), /* [2,8] */ TNS("subb",RMw), TS("sub",RMw), TNS("subb",MRw), TS("sub",MRw), -/* [2,C] */ TNS("subb",IA), TS("sub",IA), TNSx("%cs:",OVERRIDE), TNSx("das",NORM), +/* [2,C] */ TNS("subb",IA), TS("sub",IA), TNS("%cs:",OVERRIDE), TNSx("das",NORM), }, { /* [3,0] */ TNS("xorb",RMw), TS("xor",RMw), TNS("xorb",MRw), TS("xor",MRw), -/* [3,4] */ TNS("xorb",IA), TS("xor",IA), TNSx("%ss:",OVERRIDE), TNSx("aaa",NORM), +/* [3,4] */ TNS("xorb",IA), TS("xor",IA), TNS("%ss:",OVERRIDE), TNSx("aaa",NORM), /* [3,8] */ TNS("cmpb",RMw), TS("cmp",RMw), TNS("cmpb",MRw), TS("cmp",MRw), -/* [3,C] */ TNS("cmpb",IA), TS("cmp",IA), TNSx("%ds:",OVERRIDE), TNSx("aas",NORM), +/* [3,C] */ TNS("cmpb",IA), TS("cmp",IA), TNS("%ds:",OVERRIDE), TNSx("aas",NORM), }, { /* [4,0] */ TSx("inc",R), TSx("inc",R), TSx("inc",R), TSx("inc",R), /* [4,4] */ TSx("inc",R), TSx("inc",R), TSx("inc",R), TSx("inc",R), Modified: stable/9/sys/cddl/dev/dtrace/i386/dis_tables.c ============================================================================== --- stable/9/sys/cddl/dev/dtrace/i386/dis_tables.c Sun Jul 15 20:29:48 2012 (r238502) +++ stable/9/sys/cddl/dev/dtrace/i386/dis_tables.c Sun Jul 15 20:38:02 2012 (r238503) @@ -815,7 +815,7 @@ const instable_t dis_op0F[16][16] = { /* [10] */ TNSZ("movups",XMMO,16), TNSZ("movups",XMMOS,16),TNSZ("movlps",XMMO,8), TNSZ("movlps",XMMOS,8), /* [14] */ TNSZ("unpcklps",XMMO,16),TNSZ("unpckhps",XMMO,16),TNSZ("movhps",XMMOM,8),TNSZ("movhps",XMMOMS,8), /* [18] */ IND(dis_op0F18), INVALID, INVALID, INVALID, -/* [1C] */ INVALID, INVALID, INVALID, TNS("nopw", M), +/* [1C] */ INVALID, INVALID, INVALID, TS("nopw", Mw), }, { /* [20] */ TSy("mov",SREG), TSy("mov",SREG), TSy("mov",SREG), TSy("mov",SREG), /* [24] */ TSx("mov",SREG), INVALID, TSx("mov",SREG), INVALID, @@ -1146,14 +1146,14 @@ const instable_t dis_distable[16][16] = /* [1,C] */ TNS("sbbb",IA), TS("sbb",IA), TSx("push",SEG), TSx("pop",SEG), }, { /* [2,0] */ TNS("andb",RMw), TS("and",RMw), TNS("andb",MRw), TS("and",MRw), -/* [2,4] */ TNS("andb",IA), TS("and",IA), TNSx("%es:",OVERRIDE), TNSx("daa",NORM), +/* [2,4] */ TNS("andb",IA), TS("and",IA), TNS("%es:",OVERRIDE), TNSx("daa",NORM), /* [2,8] */ TNS("subb",RMw), TS("sub",RMw), TNS("subb",MRw), TS("sub",MRw), -/* [2,C] */ TNS("subb",IA), TS("sub",IA), TNSx("%cs:",OVERRIDE), TNSx("das",NORM), +/* [2,C] */ TNS("subb",IA), TS("sub",IA), TNS("%cs:",OVERRIDE), TNSx("das",NORM), }, { /* [3,0] */ TNS("xorb",RMw), TS("xor",RMw), TNS("xorb",MRw), TS("xor",MRw), -/* [3,4] */ TNS("xorb",IA), TS("xor",IA), TNSx("%ss:",OVERRIDE), TNSx("aaa",NORM), +/* [3,4] */ TNS("xorb",IA), TS("xor",IA), TNS("%ss:",OVERRIDE), TNSx("aaa",NORM), /* [3,8] */ TNS("cmpb",RMw), TS("cmp",RMw), TNS("cmpb",MRw), TS("cmp",MRw), -/* [3,C] */ TNS("cmpb",IA), TS("cmp",IA), TNSx("%ds:",OVERRIDE), TNSx("aas",NORM), +/* [3,C] */ TNS("cmpb",IA), TS("cmp",IA), TNS("%ds:",OVERRIDE), TNSx("aas",NORM), }, { /* [4,0] */ TSx("inc",R), TSx("inc",R), TSx("inc",R), TSx("inc",R), /* [4,4] */ TSx("inc",R), TSx("inc",R), TSx("inc",R), TSx("inc",R), From owner-svn-src-stable@FreeBSD.ORG Sun Jul 15 20:40:11 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5D1341065670; Sun, 15 Jul 2012 20:40:11 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3E7068FC17; Sun, 15 Jul 2012 20:40:11 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6FKeBWC072104; Sun, 15 Jul 2012 20:40:11 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6FKeBtu072101; Sun, 15 Jul 2012 20:40:11 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201207152040.q6FKeBtu072101@svn.freebsd.org> From: Andriy Gapon Date: Sun, 15 Jul 2012 20:40:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238505 - in stable/8/sys/cddl/dev/dtrace: amd64 i386 X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 15 Jul 2012 20:40:11 -0000 Author: avg Date: Sun Jul 15 20:40:10 2012 New Revision: 238505 URL: http://svn.freebsd.org/changeset/base/238505 Log: MFC r238168,238169: further dtrace disassembler fixes for long nop decoding - segment-override prefixes are not invalid in long mode - fix nopw (0f 1f) behavior with respect to modifiers Reported by: emaste Tested by: emaste Obtained from: Illumos commit 13442:4adbe6de60c8 Modified: stable/8/sys/cddl/dev/dtrace/amd64/dis_tables.c stable/8/sys/cddl/dev/dtrace/i386/dis_tables.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/cddl/ (props changed) Modified: stable/8/sys/cddl/dev/dtrace/amd64/dis_tables.c ============================================================================== --- stable/8/sys/cddl/dev/dtrace/amd64/dis_tables.c Sun Jul 15 20:39:21 2012 (r238504) +++ stable/8/sys/cddl/dev/dtrace/amd64/dis_tables.c Sun Jul 15 20:40:10 2012 (r238505) @@ -815,7 +815,7 @@ const instable_t dis_op0F[16][16] = { /* [10] */ TNSZ("movups",XMMO,16), TNSZ("movups",XMMOS,16),TNSZ("movlps",XMMO,8), TNSZ("movlps",XMMOS,8), /* [14] */ TNSZ("unpcklps",XMMO,16),TNSZ("unpckhps",XMMO,16),TNSZ("movhps",XMMOM,8),TNSZ("movhps",XMMOMS,8), /* [18] */ IND(dis_op0F18), INVALID, INVALID, INVALID, -/* [1C] */ INVALID, INVALID, INVALID, TNS("nopw", M), +/* [1C] */ INVALID, INVALID, INVALID, TS("nopw", Mw), }, { /* [20] */ TSy("mov",SREG), TSy("mov",SREG), TSy("mov",SREG), TSy("mov",SREG), /* [24] */ TSx("mov",SREG), INVALID, TSx("mov",SREG), INVALID, @@ -1146,14 +1146,14 @@ const instable_t dis_distable[16][16] = /* [1,C] */ TNS("sbbb",IA), TS("sbb",IA), TSx("push",SEG), TSx("pop",SEG), }, { /* [2,0] */ TNS("andb",RMw), TS("and",RMw), TNS("andb",MRw), TS("and",MRw), -/* [2,4] */ TNS("andb",IA), TS("and",IA), TNSx("%es:",OVERRIDE), TNSx("daa",NORM), +/* [2,4] */ TNS("andb",IA), TS("and",IA), TNS("%es:",OVERRIDE), TNSx("daa",NORM), /* [2,8] */ TNS("subb",RMw), TS("sub",RMw), TNS("subb",MRw), TS("sub",MRw), -/* [2,C] */ TNS("subb",IA), TS("sub",IA), TNSx("%cs:",OVERRIDE), TNSx("das",NORM), +/* [2,C] */ TNS("subb",IA), TS("sub",IA), TNS("%cs:",OVERRIDE), TNSx("das",NORM), }, { /* [3,0] */ TNS("xorb",RMw), TS("xor",RMw), TNS("xorb",MRw), TS("xor",MRw), -/* [3,4] */ TNS("xorb",IA), TS("xor",IA), TNSx("%ss:",OVERRIDE), TNSx("aaa",NORM), +/* [3,4] */ TNS("xorb",IA), TS("xor",IA), TNS("%ss:",OVERRIDE), TNSx("aaa",NORM), /* [3,8] */ TNS("cmpb",RMw), TS("cmp",RMw), TNS("cmpb",MRw), TS("cmp",MRw), -/* [3,C] */ TNS("cmpb",IA), TS("cmp",IA), TNSx("%ds:",OVERRIDE), TNSx("aas",NORM), +/* [3,C] */ TNS("cmpb",IA), TS("cmp",IA), TNS("%ds:",OVERRIDE), TNSx("aas",NORM), }, { /* [4,0] */ TSx("inc",R), TSx("inc",R), TSx("inc",R), TSx("inc",R), /* [4,4] */ TSx("inc",R), TSx("inc",R), TSx("inc",R), TSx("inc",R), Modified: stable/8/sys/cddl/dev/dtrace/i386/dis_tables.c ============================================================================== --- stable/8/sys/cddl/dev/dtrace/i386/dis_tables.c Sun Jul 15 20:39:21 2012 (r238504) +++ stable/8/sys/cddl/dev/dtrace/i386/dis_tables.c Sun Jul 15 20:40:10 2012 (r238505) @@ -815,7 +815,7 @@ const instable_t dis_op0F[16][16] = { /* [10] */ TNSZ("movups",XMMO,16), TNSZ("movups",XMMOS,16),TNSZ("movlps",XMMO,8), TNSZ("movlps",XMMOS,8), /* [14] */ TNSZ("unpcklps",XMMO,16),TNSZ("unpckhps",XMMO,16),TNSZ("movhps",XMMOM,8),TNSZ("movhps",XMMOMS,8), /* [18] */ IND(dis_op0F18), INVALID, INVALID, INVALID, -/* [1C] */ INVALID, INVALID, INVALID, TNS("nopw", M), +/* [1C] */ INVALID, INVALID, INVALID, TS("nopw", Mw), }, { /* [20] */ TSy("mov",SREG), TSy("mov",SREG), TSy("mov",SREG), TSy("mov",SREG), /* [24] */ TSx("mov",SREG), INVALID, TSx("mov",SREG), INVALID, @@ -1146,14 +1146,14 @@ const instable_t dis_distable[16][16] = /* [1,C] */ TNS("sbbb",IA), TS("sbb",IA), TSx("push",SEG), TSx("pop",SEG), }, { /* [2,0] */ TNS("andb",RMw), TS("and",RMw), TNS("andb",MRw), TS("and",MRw), -/* [2,4] */ TNS("andb",IA), TS("and",IA), TNSx("%es:",OVERRIDE), TNSx("daa",NORM), +/* [2,4] */ TNS("andb",IA), TS("and",IA), TNS("%es:",OVERRIDE), TNSx("daa",NORM), /* [2,8] */ TNS("subb",RMw), TS("sub",RMw), TNS("subb",MRw), TS("sub",MRw), -/* [2,C] */ TNS("subb",IA), TS("sub",IA), TNSx("%cs:",OVERRIDE), TNSx("das",NORM), +/* [2,C] */ TNS("subb",IA), TS("sub",IA), TNS("%cs:",OVERRIDE), TNSx("das",NORM), }, { /* [3,0] */ TNS("xorb",RMw), TS("xor",RMw), TNS("xorb",MRw), TS("xor",MRw), -/* [3,4] */ TNS("xorb",IA), TS("xor",IA), TNSx("%ss:",OVERRIDE), TNSx("aaa",NORM), +/* [3,4] */ TNS("xorb",IA), TS("xor",IA), TNS("%ss:",OVERRIDE), TNSx("aaa",NORM), /* [3,8] */ TNS("cmpb",RMw), TS("cmp",RMw), TNS("cmpb",MRw), TS("cmp",MRw), -/* [3,C] */ TNS("cmpb",IA), TS("cmp",IA), TNSx("%ds:",OVERRIDE), TNSx("aas",NORM), +/* [3,C] */ TNS("cmpb",IA), TS("cmp",IA), TNS("%ds:",OVERRIDE), TNSx("aas",NORM), }, { /* [4,0] */ TSx("inc",R), TSx("inc",R), TSx("inc",R), TSx("inc",R), /* [4,4] */ TSx("inc",R), TSx("inc",R), TSx("inc",R), TSx("inc",R), From owner-svn-src-stable@FreeBSD.ORG Mon Jul 16 02:10:26 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A0796106566B; Mon, 16 Jul 2012 02:10:26 +0000 (UTC) (envelope-from davidxu@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8A8228FC0A; Mon, 16 Jul 2012 02:10:26 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6G2AQM7094516; Mon, 16 Jul 2012 02:10:26 GMT (envelope-from davidxu@svn.freebsd.org) Received: (from davidxu@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6G2AQf5094514; Mon, 16 Jul 2012 02:10:26 GMT (envelope-from davidxu@svn.freebsd.org) Message-Id: <201207160210.q6G2AQf5094514@svn.freebsd.org> From: David Xu Date: Mon, 16 Jul 2012 02:10:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238513 - stable/9/lib/libc/i386/gen X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 Jul 2012 02:10:26 -0000 Author: davidxu Date: Mon Jul 16 02:10:26 2012 New Revision: 238513 URL: http://svn.freebsd.org/changeset/base/238513 Log: MFC r238328: Executing CPUID with EAX set to 1 to actually get feature flags. PR: 169730 Approved by: re (kib) Modified: stable/9/lib/libc/i386/gen/getcontextx.c Directory Properties: stable/9/lib/libc/ (props changed) Modified: stable/9/lib/libc/i386/gen/getcontextx.c ============================================================================== --- stable/9/lib/libc/i386/gen/getcontextx.c Mon Jul 16 00:21:05 2012 (r238512) +++ stable/9/lib/libc/i386/gen/getcontextx.c Mon Jul 16 02:10:26 2012 (r238513) @@ -68,7 +68,7 @@ __getcontextx_size(void) " movl %%ebx,%1\n" " popl %%ebx\n" : "=a" (p[0]), "=r" (p[1]), "=c" (p[2]), "=d" (p[3]) - : "0" (0x0)); + : "0" (0x1)); if ((p[2] & CPUID2_OSXSAVE) != 0) { __asm __volatile( " pushl %%ebx\n" From owner-svn-src-stable@FreeBSD.ORG Mon Jul 16 06:56:47 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 04870106564A; Mon, 16 Jul 2012 06:56:47 +0000 (UTC) (envelope-from melifaro@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DE7D68FC08; Mon, 16 Jul 2012 06:56:46 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6G6uk0J013224; Mon, 16 Jul 2012 06:56:46 GMT (envelope-from melifaro@svn.freebsd.org) Received: (from melifaro@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6G6ukJ4013222; Mon, 16 Jul 2012 06:56:46 GMT (envelope-from melifaro@svn.freebsd.org) Message-Id: <201207160656.q6G6ukJ4013222@svn.freebsd.org> From: "Alexander V. Chernikov" Date: Mon, 16 Jul 2012 06:56:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238515 - stable/8/sys/netinet/ipfw X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 Jul 2012 06:56:47 -0000 Author: melifaro Date: Mon Jul 16 06:56:46 2012 New Revision: 238515 URL: http://svn.freebsd.org/changeset/base/238515 Log: MFC r237479, r238265 Finally fix lookup (account remaining '\0') and deletion (provide valid key length for radix lookup). Submitted by: Ihor Kaharlichenko (prev version) Approved by: kib(mentor) Sponsored by: Shtorm ISP Modified: stable/8/sys/netinet/ipfw/ip_fw_table.c Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/netinet/ipfw/ip_fw_table.c ============================================================================== --- stable/8/sys/netinet/ipfw/ip_fw_table.c Mon Jul 16 06:43:04 2012 (r238514) +++ stable/8/sys/netinet/ipfw/ip_fw_table.c Mon Jul 16 06:56:46 2012 (r238515) @@ -344,9 +344,12 @@ ipfw_del_table_entry(struct ip_fw_chain struct xaddr_iface ifname, ifmask; memset(&ifname, 0, sizeof(ifname)); + /* Include last \0 into comparison */ + mlen++; + /* Set 'total' structure length */ - KEY_LEN(ifname) = mlen; - KEY_LEN(ifmask) = mlen; + KEY_LEN(ifname) = KEY_LEN_IFACE + mlen; + KEY_LEN(ifmask) = KEY_LEN_IFACE + mlen; /* Assume direct match */ /* FIXME: Add interface pattern matching */ #if 0 @@ -568,7 +571,8 @@ ipfw_lookup_table_extended(struct ip_fw_ break; case IPFW_TABLE_INTERFACE: - KEY_LEN(iface) = strlcpy(iface.ifname, (char *)paddr, IF_NAMESIZE); + KEY_LEN(iface) = KEY_LEN_IFACE + + strlcpy(iface.ifname, (char *)paddr, IF_NAMESIZE) + 1; /* Assume direct match */ /* FIXME: Add interface pattern matching */ xent = (struct table_xentry *)(rnh->rnh_lookup(&iface, NULL, rnh)); From owner-svn-src-stable@FreeBSD.ORG Mon Jul 16 07:22:23 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 447191065670; Mon, 16 Jul 2012 07:22:23 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2F26D8FC17; Mon, 16 Jul 2012 07:22:23 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6G7MN6o014821; Mon, 16 Jul 2012 07:22:23 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6G7MMnf014819; Mon, 16 Jul 2012 07:22:22 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <201207160722.q6G7MMnf014819@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Mon, 16 Jul 2012 07:22:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238517 - stable/7/sys/netinet6 X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 Jul 2012 07:22:23 -0000 Author: bz Date: Mon Jul 16 07:22:22 2012 New Revision: 238517 URL: http://svn.freebsd.org/changeset/base/238517 Log: MFC r238248: Implement handling of "atomic fragements" as outlined in draft-gont-6man-ipv6-atomic-fragments to mitigate one class of possible fragmentation-based attacks. Modified: stable/7/sys/netinet6/frag6.c Directory Properties: stable/7/sys/ (props changed) Modified: stable/7/sys/netinet6/frag6.c ============================================================================== --- stable/7/sys/netinet6/frag6.c Mon Jul 16 07:08:34 2012 (r238516) +++ stable/7/sys/netinet6/frag6.c Mon Jul 16 07:22:22 2012 (r238517) @@ -209,6 +209,19 @@ frag6_input(struct mbuf **mp, int *offp, /* offset now points to data portion */ offset += sizeof(struct ip6_frag); + /* + * XXX-BZ RFC XXXX (draft-gont-6man-ipv6-atomic-fragments) + * Handle "atomic" fragments (offset and m bit set to 0) upfront, + * unrelated to any reassembly. Just skip the fragment header. + */ + if ((ip6f->ip6f_offlg & ~IP6F_RESERVED_MASK) == 0) { + /* XXX-BZ we want dedicated counters for this. */ + ip6stat.ip6s_reassembled++; + in6_ifstat_inc(dstifp, ifs6_reass_ok); + *offp = offset; + return (ip6f->ip6f_nxt); + } + IP6Q_LOCK(); /* From owner-svn-src-stable@FreeBSD.ORG Mon Jul 16 08:16:42 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 469721065670; Mon, 16 Jul 2012 08:16:42 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3084B8FC16; Mon, 16 Jul 2012 08:16:42 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6G8Gfww018736; Mon, 16 Jul 2012 08:16:41 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6G8Gf7k018734; Mon, 16 Jul 2012 08:16:41 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201207160816.q6G8Gf7k018734@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Mon, 16 Jul 2012 08:16:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238520 - stable/9/usr.sbin/newsyslog X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 Jul 2012 08:16:42 -0000 Author: ae Date: Mon Jul 16 08:16:41 2012 New Revision: 238520 URL: http://svn.freebsd.org/changeset/base/238520 Log: MFC r238281: We don't need to check the result of sending signal when R flag is specified. Submitted by: Ilya A. Arkhipov Approved by: re (kib) Modified: stable/9/usr.sbin/newsyslog/newsyslog.c Directory Properties: stable/9/usr.sbin/newsyslog/ (props changed) Modified: stable/9/usr.sbin/newsyslog/newsyslog.c ============================================================================== --- stable/9/usr.sbin/newsyslog/newsyslog.c Mon Jul 16 08:13:30 2012 (r238519) +++ stable/9/usr.sbin/newsyslog/newsyslog.c Mon Jul 16 08:16:41 2012 (r238520) @@ -1972,7 +1972,8 @@ do_zipwork(struct zipwork_entry *zwork) else pgm_name++; - if (zwork->zw_swork != NULL && zwork->zw_swork->sw_pidok <= 0) { + if (zwork->zw_swork != NULL && zwork->zw_swork->run_cmd == 0 && + zwork->zw_swork->sw_pidok <= 0) { warnx( "log %s not compressed because daemon(s) not notified", zwork->zw_fname); From owner-svn-src-stable@FreeBSD.ORG Mon Jul 16 08:17:31 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 48FCA1065674; Mon, 16 Jul 2012 08:17:31 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 33BAE8FC1C; Mon, 16 Jul 2012 08:17:31 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6G8HVgN018842; Mon, 16 Jul 2012 08:17:31 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6G8HUVf018840; Mon, 16 Jul 2012 08:17:30 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201207160817.q6G8HUVf018840@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Mon, 16 Jul 2012 08:17:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238521 - stable/8/usr.sbin/newsyslog X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 Jul 2012 08:17:31 -0000 Author: ae Date: Mon Jul 16 08:17:30 2012 New Revision: 238521 URL: http://svn.freebsd.org/changeset/base/238521 Log: MFC r238281: We don't need to check the result of sending signal when R flag is specified. Submitted by: Ilya A. Arkhipov Modified: stable/8/usr.sbin/newsyslog/newsyslog.c Directory Properties: stable/8/usr.sbin/newsyslog/ (props changed) Modified: stable/8/usr.sbin/newsyslog/newsyslog.c ============================================================================== --- stable/8/usr.sbin/newsyslog/newsyslog.c Mon Jul 16 08:16:41 2012 (r238520) +++ stable/8/usr.sbin/newsyslog/newsyslog.c Mon Jul 16 08:17:30 2012 (r238521) @@ -1937,7 +1937,8 @@ do_zipwork(struct zipwork_entry *zwork) else pgm_name++; - if (zwork->zw_swork != NULL && zwork->zw_swork->sw_pidok <= 0) { + if (zwork->zw_swork != NULL && zwork->zw_swork->run_cmd == 0 && + zwork->zw_swork->sw_pidok <= 0) { warnx( "log %s not compressed because daemon(s) not notified", zwork->zw_fname); From owner-svn-src-stable@FreeBSD.ORG Tue Jul 17 02:02:40 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id DC5BD106566C; Tue, 17 Jul 2012 02:02:40 +0000 (UTC) (envelope-from davidxu@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8ACC78FC15; Tue, 17 Jul 2012 02:02:40 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6H22eu7004757; Tue, 17 Jul 2012 02:02:40 GMT (envelope-from davidxu@svn.freebsd.org) Received: (from davidxu@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6H22efr004755; Tue, 17 Jul 2012 02:02:40 GMT (envelope-from davidxu@svn.freebsd.org) Message-Id: <201207170202.q6H22efr004755@svn.freebsd.org> From: David Xu Date: Tue, 17 Jul 2012 02:02:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238541 - stable/8/lib/libc/i386/gen X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 Jul 2012 02:02:41 -0000 Author: davidxu Date: Tue Jul 17 02:02:40 2012 New Revision: 238541 URL: http://svn.freebsd.org/changeset/base/238541 Log: MFC r238328: Executing CPUID with EAX set to 1 to actually get feature flags. PR: 169730 Modified: stable/8/lib/libc/i386/gen/getcontextx.c Directory Properties: stable/8/lib/libc/ (props changed) Modified: stable/8/lib/libc/i386/gen/getcontextx.c ============================================================================== --- stable/8/lib/libc/i386/gen/getcontextx.c Mon Jul 16 22:15:30 2012 (r238540) +++ stable/8/lib/libc/i386/gen/getcontextx.c Tue Jul 17 02:02:40 2012 (r238541) @@ -68,7 +68,7 @@ __getcontextx_size(void) " movl %%ebx,%1\n" " popl %%ebx\n" : "=a" (p[0]), "=r" (p[1]), "=c" (p[2]), "=d" (p[3]) - : "0" (0x0)); + : "0" (0x1)); if ((p[2] & CPUID2_OSXSAVE) != 0) { __asm __volatile( " pushl %%ebx\n" From owner-svn-src-stable@FreeBSD.ORG Tue Jul 17 11:18:40 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 018C61065670; Tue, 17 Jul 2012 11:18:40 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E02D28FC17; Tue, 17 Jul 2012 11:18:39 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6HBIdFL047483; Tue, 17 Jul 2012 11:18:39 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6HBIdXH047481; Tue, 17 Jul 2012 11:18:39 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201207171118.q6HBIdXH047481@svn.freebsd.org> From: Michael Tuexen Date: Tue, 17 Jul 2012 11:18:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238548 - stable/9/sys/netinet X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 Jul 2012 11:18:40 -0000 Author: tuexen Date: Tue Jul 17 11:18:39 2012 New Revision: 238548 URL: http://svn.freebsd.org/changeset/base/238548 Log: MFC r238454: Bugfix: Send up a COMM UP notification for active 1-to-1 style sockets also in the case where the assoc comes up due to a remotely started handshake (collision case). Approved by: re@ Modified: stable/9/sys/netinet/sctp_input.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/netinet/sctp_input.c ============================================================================== --- stable/9/sys/netinet/sctp_input.c Tue Jul 17 09:34:52 2012 (r238547) +++ stable/9/sys/netinet/sctp_input.c Tue Jul 17 11:18:39 2012 (r238548) @@ -2912,14 +2912,12 @@ sctp_handle_cookie_echo(struct mbuf *m, return (m); } } - if ((*inp_p)->sctp_flags & SCTP_PCB_FLAGS_UDPTYPE) { - if (notification) { - sctp_ulp_notify(notification, *stcb, 0, NULL, SCTP_SO_NOT_LOCKED); - } - if (send_int_conf) { - sctp_ulp_notify(SCTP_NOTIFY_INTERFACE_CONFIRMED, - (*stcb), 0, (void *)netl, SCTP_SO_NOT_LOCKED); - } + if (notification) { + sctp_ulp_notify(notification, *stcb, 0, NULL, SCTP_SO_NOT_LOCKED); + } + if (send_int_conf) { + sctp_ulp_notify(SCTP_NOTIFY_INTERFACE_CONFIRMED, + (*stcb), 0, (void *)netl, SCTP_SO_NOT_LOCKED); } return (m); } From owner-svn-src-stable@FreeBSD.ORG Tue Jul 17 11:33:24 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E6590106564A; Tue, 17 Jul 2012 11:33:24 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D07478FC0A; Tue, 17 Jul 2012 11:33:24 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6HBXOLM048597; Tue, 17 Jul 2012 11:33:24 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6HBXOo8048595; Tue, 17 Jul 2012 11:33:24 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201207171133.q6HBXOo8048595@svn.freebsd.org> From: Michael Tuexen Date: Tue, 17 Jul 2012 11:33:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238549 - stable/9/sys/netinet X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 Jul 2012 11:33:25 -0000 Author: tuexen Date: Tue Jul 17 11:33:24 2012 New Revision: 238549 URL: http://svn.freebsd.org/changeset/base/238549 Log: MFC r238458: Provide the correct notification type (SCTP_SEND_FAILED_EVENT) for unsent messages. Approved by: re@ Modified: stable/9/sys/netinet/sctputil.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/netinet/sctputil.c ============================================================================== --- stable/9/sys/netinet/sctputil.c Tue Jul 17 11:18:39 2012 (r238548) +++ stable/9/sys/netinet/sctputil.c Tue Jul 17 11:33:24 2012 (r238549) @@ -2951,7 +2951,7 @@ sctp_notify_send_failed2(struct sctp_tcb SCTP_BUF_LEN(m_notify) = 0; if (sctp_stcb_is_feature_on(stcb->sctp_ep, stcb, SCTP_PCB_FLAGS_RECVNSENDFAILEVNT)) { ssfe = mtod(m_notify, struct sctp_send_failed_event *); - ssfe->ssfe_type = SCTP_SEND_FAILED; + ssfe->ssfe_type = SCTP_SEND_FAILED_EVENT; ssfe->ssfe_flags = SCTP_DATA_UNSENT; ssfe->ssfe_length = length; ssfe->ssfe_error = error; From owner-svn-src-stable@FreeBSD.ORG Tue Jul 17 17:34:49 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 71F7D106566C; Tue, 17 Jul 2012 17:34:49 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 59A468FC0A; Tue, 17 Jul 2012 17:34:49 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6HHYnZ3076481; Tue, 17 Jul 2012 17:34:49 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6HHYnob076477; Tue, 17 Jul 2012 17:34:49 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201207171734.q6HHYnob076477@svn.freebsd.org> From: Xin LI Date: Tue, 17 Jul 2012 17:34:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238553 - stable/8/sys/fs/tmpfs X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 Jul 2012 17:34:49 -0000 Author: delphij Date: Tue Jul 17 17:34:48 2012 New Revision: 238553 URL: http://svn.freebsd.org/changeset/base/238553 Log: MFC the following revisions per request from gleb@: r197953: Add locking around access to parent node, and bail out when the parent node is already freed rather than panicking the system. r227822: Avoid panics from recursive rename operations. Not a perfect patch but good enough for now. r232959: Don't enforce LK_RETRY to get existing vnode in tmpfs_alloc_vp(). Doomed vnode is hardly of any use here, besides all callers handle error case. vfs_hash_get() does the same. Don't mess with vnode holdcount, vget() takes care of it already. r232960: Prevent tmpfs_rename() deadlock in a way similar to UFS Unlock vnodes and try to lock them one by one. Relookup fvp and tvp. Modified: stable/8/sys/fs/tmpfs/tmpfs.h stable/8/sys/fs/tmpfs/tmpfs_subr.c stable/8/sys/fs/tmpfs/tmpfs_vnops.c Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/fs/tmpfs/tmpfs.h ============================================================================== --- stable/8/sys/fs/tmpfs/tmpfs.h Tue Jul 17 14:36:40 2012 (r238552) +++ stable/8/sys/fs/tmpfs/tmpfs.h Tue Jul 17 17:34:48 2012 (r238553) @@ -304,10 +304,30 @@ LIST_HEAD(tmpfs_node_list, tmpfs_node); #define TMPFS_NODE_LOCK(node) mtx_lock(&(node)->tn_interlock) #define TMPFS_NODE_UNLOCK(node) mtx_unlock(&(node)->tn_interlock) -#define TMPFS_NODE_MTX(node) (&(node)->tn_interlock) +#define TMPFS_NODE_MTX(node) (&(node)->tn_interlock) + +#ifdef INVARIANTS +#define TMPFS_ASSERT_LOCKED(node) do { \ + MPASS(node != NULL); \ + MPASS(node->tn_vnode != NULL); \ + if (!VOP_ISLOCKED(node->tn_vnode) && \ + !mtx_owned(TMPFS_NODE_MTX(node))) \ + panic("tmpfs: node is not locked: %p", node); \ + } while (0) +#define TMPFS_ASSERT_ELOCKED(node) do { \ + MPASS((node) != NULL); \ + MPASS((node)->tn_vnode != NULL); \ + mtx_assert(TMPFS_NODE_MTX(node), MA_OWNED); \ + ASSERT_VOP_LOCKED((node)->tn_vnode, "tmpfs"); \ + } while (0) +#else +#define TMPFS_ASSERT_LOCKED(node) (void)0 +#define TMPFS_ASSERT_ELOCKED(node) (void)0 +#endif #define TMPFS_VNODE_ALLOCATING 1 #define TMPFS_VNODE_WANT 2 +#define TMPFS_VNODE_DOOMED 4 /* --------------------------------------------------------------------- */ /* Modified: stable/8/sys/fs/tmpfs/tmpfs_subr.c ============================================================================== --- stable/8/sys/fs/tmpfs/tmpfs_subr.c Tue Jul 17 14:36:40 2012 (r238552) +++ stable/8/sys/fs/tmpfs/tmpfs_subr.c Tue Jul 17 17:34:48 2012 (r238553) @@ -42,6 +42,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -55,6 +56,8 @@ __FBSDID("$FreeBSD$"); #include #include +SYSCTL_NODE(_vfs, OID_AUTO, tmpfs, CTLFLAG_RW, 0, "tmpfs file system"); + /* --------------------------------------------------------------------- */ /* @@ -124,7 +127,9 @@ tmpfs_alloc_node(struct tmpfs_mount *tmp nnode->tn_dir.tn_readdir_lastn = 0; nnode->tn_dir.tn_readdir_lastp = NULL; nnode->tn_links++; + TMPFS_NODE_LOCK(nnode->tn_dir.tn_parent); nnode->tn_dir.tn_parent->tn_links++; + TMPFS_NODE_UNLOCK(nnode->tn_dir.tn_parent); break; case VFIFO: @@ -187,6 +192,7 @@ tmpfs_free_node(struct tmpfs_mount *tmp, #ifdef INVARIANTS TMPFS_NODE_LOCK(node); MPASS(node->tn_vnode == NULL); + MPASS((node->tn_vpstate & TMPFS_VNODE_ALLOCATING) == 0); TMPFS_NODE_UNLOCK(node); #endif @@ -314,11 +320,14 @@ tmpfs_alloc_vp(struct mount *mp, struct loop: TMPFS_NODE_LOCK(node); if ((vp = node->tn_vnode) != NULL) { + MPASS((node->tn_vpstate & TMPFS_VNODE_DOOMED) == 0); VI_LOCK(vp); TMPFS_NODE_UNLOCK(node); - vholdl(vp); - (void) vget(vp, lkflag | LK_INTERLOCK | LK_RETRY, curthread); - vdrop(vp); + error = vget(vp, lkflag | LK_INTERLOCK, curthread); + if (error != 0) { + vp = NULL; + goto out; + } /* * Make sure the vnode is still there after @@ -332,6 +341,14 @@ loop: goto out; } + if ((node->tn_vpstate & TMPFS_VNODE_DOOMED) || + (node->tn_type == VDIR && node->tn_dir.tn_parent == NULL)) { + TMPFS_NODE_UNLOCK(node); + error = ENOENT; + vp = NULL; + goto out; + } + /* * otherwise lock the vp list while we call getnewvnode * since that can block. @@ -377,6 +394,7 @@ loop: vp->v_op = &tmpfs_fifoop_entries; break; case VDIR: + MPASS(node->tn_dir.tn_parent != NULL); if (node->tn_dir.tn_parent == node) vp->v_vflag |= VV_ROOT; break; @@ -407,11 +425,13 @@ unlock: out: *vpp = vp; - MPASS(IFF(error == 0, *vpp != NULL && VOP_ISLOCKED(*vpp))); #ifdef INVARIANTS - TMPFS_NODE_LOCK(node); - MPASS(*vpp == node->tn_vnode); - TMPFS_NODE_UNLOCK(node); + if (error == 0) { + MPASS(*vpp != NULL && VOP_ISLOCKED(*vpp)); + TMPFS_NODE_LOCK(node); + MPASS(*vpp == node->tn_vnode); + TMPFS_NODE_UNLOCK(node); + } #endif return error; @@ -430,10 +450,9 @@ tmpfs_free_vp(struct vnode *vp) node = VP_TO_TMPFS_NODE(vp); - TMPFS_NODE_LOCK(node); + mtx_assert(TMPFS_NODE_MTX(node), MA_OWNED); node->tn_vnode = NULL; vp->v_data = NULL; - TMPFS_NODE_UNLOCK(node); } /* --------------------------------------------------------------------- */ @@ -657,7 +676,18 @@ tmpfs_dir_getdotdotdent(struct tmpfs_nod TMPFS_VALIDATE_DIR(node); MPASS(uio->uio_offset == TMPFS_DIRCOOKIE_DOTDOT); + /* + * Return ENOENT if the current node is already removed. + */ + TMPFS_ASSERT_LOCKED(node); + if (node->tn_dir.tn_parent == NULL) { + return (ENOENT); + } + + TMPFS_NODE_LOCK(node->tn_dir.tn_parent); dent.d_fileno = node->tn_dir.tn_parent->tn_id; + TMPFS_NODE_UNLOCK(node->tn_dir.tn_parent); + dent.d_type = DT_DIR; dent.d_namlen = 2; dent.d_name[0] = '.'; Modified: stable/8/sys/fs/tmpfs/tmpfs_vnops.c ============================================================================== --- stable/8/sys/fs/tmpfs/tmpfs_vnops.c Tue Jul 17 14:36:40 2012 (r238552) +++ stable/8/sys/fs/tmpfs/tmpfs_vnops.c Tue Jul 17 17:34:48 2012 (r238553) @@ -46,6 +46,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -60,6 +61,13 @@ __FBSDID("$FreeBSD$"); #include #include +SYSCTL_DECL(_vfs_tmpfs); + +static volatile int tmpfs_rename_restarts; +SYSCTL_INT(_vfs_tmpfs, OID_AUTO, rename_restarts, CTLFLAG_RD, + __DEVOLATILE(int *, &tmpfs_rename_restarts), 0, + "Times rename had to restart due to lock contention"); + /* --------------------------------------------------------------------- */ static int @@ -86,6 +94,11 @@ tmpfs_lookup(struct vop_cachedlookup_arg dnode->tn_dir.tn_parent == dnode, !(cnp->cn_flags & ISDOTDOT))); + TMPFS_ASSERT_LOCKED(dnode); + if (dnode->tn_dir.tn_parent == NULL) { + error = ENOENT; + goto out; + } if (cnp->cn_flags & ISDOTDOT) { int ltype = 0; @@ -893,6 +906,139 @@ out: /* --------------------------------------------------------------------- */ +/* + * We acquire all but fdvp locks using non-blocking acquisitions. If we + * fail to acquire any lock in the path we will drop all held locks, + * acquire the new lock in a blocking fashion, and then release it and + * restart the rename. This acquire/release step ensures that we do not + * spin on a lock waiting for release. On error release all vnode locks + * and decrement references the way tmpfs_rename() would do. + */ +static int +tmpfs_rename_relock(struct vnode *fdvp, struct vnode **fvpp, + struct vnode *tdvp, struct vnode **tvpp, + struct componentname *fcnp, struct componentname *tcnp) +{ + struct vnode *nvp; + struct mount *mp; + struct tmpfs_dirent *de; + int error, restarts = 0; + + VOP_UNLOCK(tdvp, 0); + if (*tvpp != NULL && *tvpp != tdvp) + VOP_UNLOCK(*tvpp, 0); + mp = fdvp->v_mount; + +relock: + restarts += 1; + error = vn_lock(fdvp, LK_EXCLUSIVE); + if (error) + goto releout; + if (vn_lock(tdvp, LK_EXCLUSIVE | LK_NOWAIT) != 0) { + VOP_UNLOCK(fdvp, 0); + error = vn_lock(tdvp, LK_EXCLUSIVE); + if (error) + goto releout; + VOP_UNLOCK(tdvp, 0); + goto relock; + } + /* + * Re-resolve fvp to be certain it still exists and fetch the + * correct vnode. + */ + de = tmpfs_dir_lookup(VP_TO_TMPFS_DIR(fdvp), NULL, fcnp); + if (de == NULL) { + VOP_UNLOCK(fdvp, 0); + VOP_UNLOCK(tdvp, 0); + if ((fcnp->cn_flags & ISDOTDOT) != 0 || + (fcnp->cn_namelen == 1 && fcnp->cn_nameptr[0] == '.')) + error = EINVAL; + else + error = ENOENT; + goto releout; + } + error = tmpfs_alloc_vp(mp, de->td_node, LK_EXCLUSIVE | LK_NOWAIT, &nvp); + if (error != 0) { + VOP_UNLOCK(fdvp, 0); + VOP_UNLOCK(tdvp, 0); + if (error != EBUSY) + goto releout; + error = tmpfs_alloc_vp(mp, de->td_node, LK_EXCLUSIVE, &nvp); + if (error != 0) + goto releout; + VOP_UNLOCK(nvp, 0); + /* + * Concurrent rename race. + */ + if (nvp == tdvp) { + vrele(nvp); + error = EINVAL; + goto releout; + } + vrele(*fvpp); + *fvpp = nvp; + goto relock; + } + vrele(*fvpp); + *fvpp = nvp; + VOP_UNLOCK(*fvpp, 0); + /* + * Re-resolve tvp and acquire the vnode lock if present. + */ + de = tmpfs_dir_lookup(VP_TO_TMPFS_DIR(tdvp), NULL, tcnp); + /* + * If tvp disappeared we just carry on. + */ + if (de == NULL && *tvpp != NULL) { + vrele(*tvpp); + *tvpp = NULL; + } + /* + * Get the tvp ino if the lookup succeeded. We may have to restart + * if the non-blocking acquire fails. + */ + if (de != NULL) { + nvp = NULL; + error = tmpfs_alloc_vp(mp, de->td_node, + LK_EXCLUSIVE | LK_NOWAIT, &nvp); + if (*tvpp != NULL) + vrele(*tvpp); + *tvpp = nvp; + if (error != 0) { + VOP_UNLOCK(fdvp, 0); + VOP_UNLOCK(tdvp, 0); + if (error != EBUSY) + goto releout; + error = tmpfs_alloc_vp(mp, de->td_node, LK_EXCLUSIVE, + &nvp); + if (error != 0) + goto releout; + VOP_UNLOCK(nvp, 0); + /* + * fdvp contains fvp, thus tvp (=fdvp) is not empty. + */ + if (nvp == fdvp) { + error = ENOTEMPTY; + goto releout; + } + goto relock; + } + } + tmpfs_rename_restarts += restarts; + + return (0); + +releout: + vrele(fdvp); + vrele(*fvpp); + vrele(tdvp); + if (*tvpp != NULL) + vrele(*tvpp); + tmpfs_rename_restarts += restarts; + + return (error); +} + static int tmpfs_rename(struct vop_rename_args *v) { @@ -902,10 +1048,12 @@ tmpfs_rename(struct vop_rename_args *v) struct vnode *tdvp = v->a_tdvp; struct vnode *tvp = v->a_tvp; struct componentname *tcnp = v->a_tcnp; + struct mount *mp = NULL; char *newname; int error; struct tmpfs_dirent *de; + struct tmpfs_mount *tmp; struct tmpfs_node *fdnode; struct tmpfs_node *fnode; struct tmpfs_node *tnode; @@ -916,8 +1064,6 @@ tmpfs_rename(struct vop_rename_args *v) MPASS(fcnp->cn_flags & HASBUF); MPASS(tcnp->cn_flags & HASBUF); - tnode = (tvp == NULL) ? NULL : VP_TO_TMPFS_NODE(tvp); - /* Disallow cross-device renames. * XXX Why isn't this done by the caller? */ if (fvp->v_mount != tdvp->v_mount || @@ -926,8 +1072,6 @@ tmpfs_rename(struct vop_rename_args *v) goto out; } - tdnode = VP_TO_TMPFS_DIR(tdvp); - /* If source and target are the same file, there is nothing to do. */ if (fvp == tvp) { error = 0; @@ -936,11 +1080,37 @@ tmpfs_rename(struct vop_rename_args *v) /* If we need to move the directory between entries, lock the * source so that we can safely operate on it. */ - if (tdvp != fdvp) { - error = vn_lock(fdvp, LK_EXCLUSIVE | LK_RETRY); - if (error != 0) - goto out; + if (fdvp != tdvp && fdvp != tvp) { + if (vn_lock(fdvp, LK_EXCLUSIVE | LK_NOWAIT) != 0) { + mp = tdvp->v_mount; + error = vfs_busy(mp, 0); + if (error != 0) { + mp = NULL; + goto out; + } + error = tmpfs_rename_relock(fdvp, &fvp, tdvp, &tvp, + fcnp, tcnp); + if (error != 0) { + vfs_unbusy(mp); + return (error); + } + ASSERT_VOP_ELOCKED(fdvp, + "tmpfs_rename: fdvp not locked"); + ASSERT_VOP_ELOCKED(tdvp, + "tmpfs_rename: tdvp not locked"); + if (tvp != NULL) + ASSERT_VOP_ELOCKED(tvp, + "tmpfs_rename: tvp not locked"); + if (fvp == tvp) { + error = 0; + goto out_locked; + } + } } + + tmp = VFS_TO_TMPFS(tdvp->v_mount); + tdnode = VP_TO_TMPFS_DIR(tdvp); + tnode = (tvp == NULL) ? NULL : VP_TO_TMPFS_NODE(tvp); fdnode = VP_TO_TMPFS_DIR(fdvp); fnode = VP_TO_TMPFS_NODE(fvp); de = tmpfs_dir_lookup(fdnode, fnode, fcnp); @@ -1014,25 +1184,63 @@ tmpfs_rename(struct vop_rename_args *v) * directory being moved. Otherwise, we'd end up * with stale nodes. */ n = tdnode; + /* TMPFS_LOCK garanties that no nodes are freed while + * traversing the list. Nodes can only be marked as + * removed: tn_parent == NULL. */ + TMPFS_LOCK(tmp); + TMPFS_NODE_LOCK(n); while (n != n->tn_dir.tn_parent) { + struct tmpfs_node *parent; + if (n == fnode) { + TMPFS_NODE_UNLOCK(n); + TMPFS_UNLOCK(tmp); error = EINVAL; if (newname != NULL) free(newname, M_TMPFSNAME); goto out_locked; } - n = n->tn_dir.tn_parent; + parent = n->tn_dir.tn_parent; + TMPFS_NODE_UNLOCK(n); + if (parent == NULL) { + n = NULL; + break; + } + TMPFS_NODE_LOCK(parent); + if (parent->tn_dir.tn_parent == NULL) { + TMPFS_NODE_UNLOCK(parent); + n = NULL; + break; + } + n = parent; } + TMPFS_UNLOCK(tmp); + if (n == NULL) { + error = EINVAL; + if (newname != NULL) + free(newname, M_TMPFSNAME); + goto out_locked; + } + TMPFS_NODE_UNLOCK(n); /* Adjust the parent pointer. */ TMPFS_VALIDATE_DIR(fnode); + TMPFS_NODE_LOCK(de->td_node); de->td_node->tn_dir.tn_parent = tdnode; + TMPFS_NODE_UNLOCK(de->td_node); /* As a result of changing the target of the '..' * entry, the link count of the source and target * directories has to be adjusted. */ - fdnode->tn_links--; + TMPFS_NODE_LOCK(tdnode); + TMPFS_ASSERT_LOCKED(tdnode); tdnode->tn_links++; + TMPFS_NODE_UNLOCK(tdnode); + + TMPFS_NODE_LOCK(fdnode); + TMPFS_ASSERT_LOCKED(fdnode); + fdnode->tn_links--; + TMPFS_NODE_UNLOCK(fdnode); } /* Do the move: just remove the entry from the source directory @@ -1078,7 +1286,7 @@ tmpfs_rename(struct vop_rename_args *v) error = 0; out_locked: - if (fdnode != tdnode) + if (fdvp != tdvp && fdvp != tvp) VOP_UNLOCK(fdvp, 0); out: @@ -1096,6 +1304,9 @@ out: vrele(fdvp); vrele(fvp); + if (mp != NULL) + vfs_unbusy(mp); + return error; } @@ -1166,17 +1377,28 @@ tmpfs_rmdir(struct vop_rmdir_args *v) goto out; } + /* Detach the directory entry from the directory (dnode). */ tmpfs_dir_detach(dvp, de); if (v->a_cnp->cn_flags & DOWHITEOUT) tmpfs_dir_whiteout_add(dvp, v->a_cnp); + /* No vnode should be allocated for this entry from this point */ + TMPFS_NODE_LOCK(node); + TMPFS_ASSERT_ELOCKED(node); node->tn_links--; + node->tn_dir.tn_parent = NULL; node->tn_status |= TMPFS_NODE_ACCESSED | TMPFS_NODE_CHANGED | \ TMPFS_NODE_MODIFIED; - node->tn_dir.tn_parent->tn_links--; - node->tn_dir.tn_parent->tn_status |= TMPFS_NODE_ACCESSED | \ + + TMPFS_NODE_UNLOCK(node); + + TMPFS_NODE_LOCK(dnode); + TMPFS_ASSERT_ELOCKED(dnode); + dnode->tn_links--; + dnode->tn_status |= TMPFS_NODE_ACCESSED | \ TMPFS_NODE_CHANGED | TMPFS_NODE_MODIFIED; + TMPFS_NODE_UNLOCK(dnode); cache_purge(dvp); cache_purge(vp); @@ -1364,13 +1586,21 @@ tmpfs_reclaim(struct vop_reclaim_args *v vnode_destroy_vobject(vp); cache_purge(vp); + + TMPFS_NODE_LOCK(node); + TMPFS_ASSERT_ELOCKED(node); tmpfs_free_vp(vp); /* If the node referenced by this vnode was deleted by the user, * we must free its associated data structures (now that the vnode * is being reclaimed). */ - if (node->tn_links == 0) + if (node->tn_links == 0 && + (node->tn_vpstate & TMPFS_VNODE_ALLOCATING) == 0) { + node->tn_vpstate = TMPFS_VNODE_DOOMED; + TMPFS_NODE_UNLOCK(node); tmpfs_free_node(tmp, node); + } else + TMPFS_NODE_UNLOCK(node); MPASS(vp->v_data == NULL); return 0; From owner-svn-src-stable@FreeBSD.ORG Tue Jul 17 18:04:35 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 723C91065673; Tue, 17 Jul 2012 18:04:35 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 428588FC0A; Tue, 17 Jul 2012 18:04:35 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6HI4Zer078755; Tue, 17 Jul 2012 18:04:35 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6HI4YwF078753; Tue, 17 Jul 2012 18:04:34 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201207171804.q6HI4YwF078753@svn.freebsd.org> From: Dimitry Andric Date: Tue, 17 Jul 2012 18:04:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238554 - stable/9/contrib/llvm/tools/clang/lib/Sema X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 Jul 2012 18:04:35 -0000 Author: dim Date: Tue Jul 17 18:04:34 2012 New Revision: 238554 URL: http://svn.freebsd.org/changeset/base/238554 Log: MFC r238429: Pull in r159895 from upstream clang trunk: When marking virtual functions as used for a class' vtable, mark all functions which will appear in the vtable as used, not just those ones which were declared within the class itself. Fixes an issue reported as comment#3 in PR12763 -- we sometimes assert in codegen if we try to emit a reference to a function declaration which we've not marked as referenced. This also matches gcc's observed behavior. This should fix clang assertions when building certain components of the LibreOffice port. Approved by: re (kib) Modified: stable/9/contrib/llvm/tools/clang/lib/Sema/SemaDeclCXX.cpp Directory Properties: stable/9/contrib/llvm/ (props changed) stable/9/contrib/llvm/tools/clang/ (props changed) Modified: stable/9/contrib/llvm/tools/clang/lib/Sema/SemaDeclCXX.cpp ============================================================================== --- stable/9/contrib/llvm/tools/clang/lib/Sema/SemaDeclCXX.cpp Tue Jul 17 17:34:48 2012 (r238553) +++ stable/9/contrib/llvm/tools/clang/lib/Sema/SemaDeclCXX.cpp Tue Jul 17 18:04:34 2012 (r238554) @@ -10937,14 +10937,23 @@ bool Sema::DefineUsedVTables() { void Sema::MarkVirtualMembersReferenced(SourceLocation Loc, const CXXRecordDecl *RD) { - for (CXXRecordDecl::method_iterator i = RD->method_begin(), - e = RD->method_end(); i != e; ++i) { - CXXMethodDecl *MD = *i; - - // C++ [basic.def.odr]p2: - // [...] A virtual member function is used if it is not pure. [...] - if (MD->isVirtual() && !MD->isPure()) - MarkFunctionReferenced(Loc, MD); + // Mark all functions which will appear in RD's vtable as used. + CXXFinalOverriderMap FinalOverriders; + RD->getFinalOverriders(FinalOverriders); + for (CXXFinalOverriderMap::const_iterator I = FinalOverriders.begin(), + E = FinalOverriders.end(); + I != E; ++I) { + for (OverridingMethods::const_iterator OI = I->second.begin(), + OE = I->second.end(); + OI != OE; ++OI) { + assert(OI->second.size() > 0 && "no final overrider"); + CXXMethodDecl *Overrider = OI->second.front().Method; + + // C++ [basic.def.odr]p2: + // [...] A virtual member function is used if it is not pure. [...] + if (!Overrider->isPure()) + MarkFunctionReferenced(Loc, Overrider); + } } // Only classes that have virtual bases need a VTT. From owner-svn-src-stable@FreeBSD.ORG Tue Jul 17 19:00:47 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 502E11065670; Tue, 17 Jul 2012 19:00:47 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3B2988FC17; Tue, 17 Jul 2012 19:00:47 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6HJ0ldW083905; Tue, 17 Jul 2012 19:00:47 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6HJ0lui083903; Tue, 17 Jul 2012 19:00:47 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201207171900.q6HJ0lui083903@svn.freebsd.org> From: Konstantin Belousov Date: Tue, 17 Jul 2012 19:00:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238555 - stable/9/sys/dev/fb X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 Jul 2012 19:00:47 -0000 Author: kib Date: Tue Jul 17 19:00:46 2012 New Revision: 238555 URL: http://svn.freebsd.org/changeset/base/238555 Log: MFC r237203,r237223 (by phk): Fix writes to the video memory of the VGA to always use half-word sized writes. Approved by: re (hrs), phk Modified: stable/9/sys/dev/fb/fbreg.h Directory Properties: stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) Modified: stable/9/sys/dev/fb/fbreg.h ============================================================================== --- stable/9/sys/dev/fb/fbreg.h Tue Jul 17 18:04:34 2012 (r238554) +++ stable/9/sys/dev/fb/fbreg.h Tue Jul 17 19:00:46 2012 (r238555) @@ -35,9 +35,17 @@ /* some macros */ #if defined(__amd64__) || defined(__i386__) -#define bcopy_io(s, d, c) bcopy((void *)(s), (void *)(d), (c)) -#define bcopy_toio(s, d, c) bcopy((void *)(s), (void *)(d), (c)) -#define bcopy_fromio(s, d, c) bcopy((void *)(s), (void *)(d), (c)) + +static __inline void +copyw(uint16_t *src, uint16_t *dst, size_t size) +{ + size >>= 1; + while (size--) + *dst++ = *src++; +} +#define bcopy_io(s, d, c) copyw((void*)(s), (void*)(d), (c)) +#define bcopy_toio(s, d, c) copyw((void*)(s), (void*)(d), (c)) +#define bcopy_fromio(s, d, c) copyw((void*)(s), (void*)(d), (c)) #define bzero_io(d, c) bzero((void *)(d), (c)) #define fill_io(p, d, c) fill((p), (void *)(d), (c)) #define fillw_io(p, d, c) fillw((p), (void *)(d), (c)) From owner-svn-src-stable@FreeBSD.ORG Tue Jul 17 19:14:13 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 3E6DA1065673; Tue, 17 Jul 2012 19:14:13 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 289C78FC19; Tue, 17 Jul 2012 19:14:13 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6HJEDw4084990; Tue, 17 Jul 2012 19:14:13 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6HJEC0G084988; Tue, 17 Jul 2012 19:14:12 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201207171914.q6HJEC0G084988@svn.freebsd.org> From: Konstantin Belousov Date: Tue, 17 Jul 2012 19:14:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238556 - stable/8/sys/dev/fb X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 Jul 2012 19:14:13 -0000 Author: kib Date: Tue Jul 17 19:14:12 2012 New Revision: 238556 URL: http://svn.freebsd.org/changeset/base/238556 Log: MFC r237203,r237223 (by phk): Fix writes to the video memory of the VGA to always use half-word sized writes. Approved by: phk Modified: stable/8/sys/dev/fb/fbreg.h Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/dev/fb/fbreg.h ============================================================================== --- stable/8/sys/dev/fb/fbreg.h Tue Jul 17 19:00:46 2012 (r238555) +++ stable/8/sys/dev/fb/fbreg.h Tue Jul 17 19:14:12 2012 (r238556) @@ -35,9 +35,17 @@ /* some macros */ #if defined(__amd64__) || defined(__i386__) -#define bcopy_io(s, d, c) bcopy((void *)(s), (void *)(d), (c)) -#define bcopy_toio(s, d, c) bcopy((void *)(s), (void *)(d), (c)) -#define bcopy_fromio(s, d, c) bcopy((void *)(s), (void *)(d), (c)) + +static __inline void +copyw(uint16_t *src, uint16_t *dst, size_t size) +{ + size >>= 1; + while (size--) + *dst++ = *src++; +} +#define bcopy_io(s, d, c) copyw((void*)(s), (void*)(d), (c)) +#define bcopy_toio(s, d, c) copyw((void*)(s), (void*)(d), (c)) +#define bcopy_fromio(s, d, c) copyw((void*)(s), (void*)(d), (c)) #define bzero_io(d, c) bzero((void *)(d), (c)) #define fill_io(p, d, c) fill((p), (void *)(d), (c)) #define fillw_io(p, d, c) fillw((p), (void *)(d), (c)) From owner-svn-src-stable@FreeBSD.ORG Tue Jul 17 19:29:33 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2737E106566C; Tue, 17 Jul 2012 19:29:33 +0000 (UTC) (envelope-from melifaro@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 10E498FC0C; Tue, 17 Jul 2012 19:29:33 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6HJTWoI086027; Tue, 17 Jul 2012 19:29:32 GMT (envelope-from melifaro@svn.freebsd.org) Received: (from melifaro@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6HJTW4W086025; Tue, 17 Jul 2012 19:29:32 GMT (envelope-from melifaro@svn.freebsd.org) Message-Id: <201207171929.q6HJTW4W086025@svn.freebsd.org> From: "Alexander V. Chernikov" Date: Tue, 17 Jul 2012 19:29:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238557 - stable/9/sys/netinet/ipfw X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 Jul 2012 19:29:33 -0000 Author: melifaro Date: Tue Jul 17 19:29:32 2012 New Revision: 238557 URL: http://svn.freebsd.org/changeset/base/238557 Log: MFC r237479, r238265 Finally fix lookup (account remaining '\0') and deletion (provide valid key length for radix lookup). Submitted by: Ihor Kaharlichenko (prev version) Approved by: re(hrs), kib(mentor) Sponsored by: Shtorm ISP Modified: stable/9/sys/netinet/ipfw/ip_fw_table.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/netinet/ipfw/ip_fw_table.c ============================================================================== --- stable/9/sys/netinet/ipfw/ip_fw_table.c Tue Jul 17 19:14:12 2012 (r238556) +++ stable/9/sys/netinet/ipfw/ip_fw_table.c Tue Jul 17 19:29:32 2012 (r238557) @@ -344,9 +344,12 @@ ipfw_del_table_entry(struct ip_fw_chain struct xaddr_iface ifname, ifmask; memset(&ifname, 0, sizeof(ifname)); + /* Include last \0 into comparison */ + mlen++; + /* Set 'total' structure length */ - KEY_LEN(ifname) = mlen; - KEY_LEN(ifmask) = mlen; + KEY_LEN(ifname) = KEY_LEN_IFACE + mlen; + KEY_LEN(ifmask) = KEY_LEN_IFACE + mlen; /* Assume direct match */ /* FIXME: Add interface pattern matching */ #if 0 @@ -568,7 +571,8 @@ ipfw_lookup_table_extended(struct ip_fw_ break; case IPFW_TABLE_INTERFACE: - KEY_LEN(iface) = strlcpy(iface.ifname, (char *)paddr, IF_NAMESIZE); + KEY_LEN(iface) = KEY_LEN_IFACE + + strlcpy(iface.ifname, (char *)paddr, IF_NAMESIZE) + 1; /* Assume direct match */ /* FIXME: Add interface pattern matching */ xent = (struct table_xentry *)(rnh->rnh_lookup(&iface, NULL, rnh)); From owner-svn-src-stable@FreeBSD.ORG Wed Jul 18 04:52:38 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6CACB1065675; Wed, 18 Jul 2012 04:52:38 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 56BDF8FC14; Wed, 18 Jul 2012 04:52:38 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6I4qc0n029229; Wed, 18 Jul 2012 04:52:38 GMT (envelope-from mjg@svn.freebsd.org) Received: (from mjg@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6I4qcwJ029225; Wed, 18 Jul 2012 04:52:38 GMT (envelope-from mjg@svn.freebsd.org) Message-Id: <201207180452.q6I4qcwJ029225@svn.freebsd.org> From: Mateusz Guzik Date: Wed, 18 Jul 2012 04:52:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238560 - in stable/9/sys: kern sys X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 18 Jul 2012 04:52:38 -0000 Author: mjg Date: Wed Jul 18 04:52:37 2012 New Revision: 238560 URL: http://svn.freebsd.org/changeset/base/238560 Log: MFC r238220, r238272: Unbreak handling of descriptors opened with O_EXEC by fexecve(2). While here return EBADF for descriptors opened for writing (previously it was ETXTBSY). Add fgetvp_exec function which performs appropriate checks. == Follow-up commit to r238220: Pass only FEXEC (instead of FREAD|FEXEC) in fgetvp_exec. _fget has to check for !FWRITE anyway and may as well know about FREAD. Make _fget code a bit more readable by converting permission checking from if() to switch(). Assert that correct permission flags are passed. PR: kern/169651 In collaboration with: kib Approved by: re (hrs), trasz (mentor) Modified: stable/9/sys/kern/kern_descrip.c stable/9/sys/kern/kern_exec.c stable/9/sys/sys/file.h Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/kern/kern_descrip.c ============================================================================== --- stable/9/sys/kern/kern_descrip.c Tue Jul 17 22:16:10 2012 (r238559) +++ stable/9/sys/kern/kern_descrip.c Wed Jul 18 04:52:37 2012 (r238560) @@ -2329,8 +2329,8 @@ _fget(struct thread *td, int fd, struct struct file *fp; #ifdef CAPABILITIES struct file *fp_fromcap; - int error; #endif + int error; *fpp = NULL; if (td == NULL || (fdp = td->td_proc->p_fd) == NULL) @@ -2369,7 +2369,7 @@ _fget(struct thread *td, int fd, struct else error = cap_funwrap_mmap(fp, needrights, maxprotp, &fp_fromcap); - if (error) { + if (error != 0) { fdrop(fp, td); return (error); } @@ -2394,14 +2394,30 @@ _fget(struct thread *td, int fd, struct /* * FREAD and FWRITE failure return EBADF as per POSIX. - * - * Only one flag, or 0, may be specified. */ - if ((flags == FREAD && (fp->f_flag & FREAD) == 0) || - (flags == FWRITE && (fp->f_flag & FWRITE) == 0)) { + error = 0; + switch (flags) { + case FREAD: + case FWRITE: + if ((fp->f_flag & flags) == 0) + error = EBADF; + break; + case FEXEC: + if ((fp->f_flag & (FREAD | FEXEC)) == 0 || + ((fp->f_flag & FWRITE) != 0)) + error = EBADF; + break; + case 0: + break; + default: + KASSERT(0, ("wrong flags")); + } + + if (error != 0) { fdrop(fp, td); - return (EBADF); + return (error); } + *fpp = fp; return (0); } @@ -2498,6 +2514,13 @@ fgetvp_read(struct thread *td, int fd, c return (_fgetvp(td, fd, FREAD, rights, NULL, vpp)); } +int +fgetvp_exec(struct thread *td, int fd, cap_rights_t rights, struct vnode **vpp) +{ + + return (_fgetvp(td, fd, FEXEC, rights, NULL, vpp)); +} + #ifdef notyet int fgetvp_write(struct thread *td, int fd, cap_rights_t rights, Modified: stable/9/sys/kern/kern_exec.c ============================================================================== --- stable/9/sys/kern/kern_exec.c Tue Jul 17 22:16:10 2012 (r238559) +++ stable/9/sys/kern/kern_exec.c Wed Jul 18 04:52:37 2012 (r238560) @@ -443,8 +443,10 @@ interpret: /* * Some might argue that CAP_READ and/or CAP_MMAP should also * be required here; such arguments will be entertained. + * + * Descriptors opened only with O_EXEC or O_RDONLY are allowed. */ - error = fgetvp_read(td, args->fd, CAP_FEXECVE, &binvp); + error = fgetvp_exec(td, args->fd, CAP_FEXECVE, &binvp); if (error) goto exec_fail; vfslocked = VFS_LOCK_GIANT(binvp->v_mount); Modified: stable/9/sys/sys/file.h ============================================================================== --- stable/9/sys/sys/file.h Tue Jul 17 22:16:10 2012 (r238559) +++ stable/9/sys/sys/file.h Wed Jul 18 04:52:37 2012 (r238560) @@ -225,6 +225,8 @@ fo_chown_t invfo_chown; void finit(struct file *, u_int, short, void *, struct fileops *); int fgetvp(struct thread *td, int fd, cap_rights_t rights, struct vnode **vpp); +int fgetvp_exec(struct thread *td, int fd, cap_rights_t rights, + struct vnode **vpp); int fgetvp_rights(struct thread *td, int fd, cap_rights_t need, cap_rights_t *have, struct vnode **vpp); int fgetvp_read(struct thread *td, int fd, cap_rights_t rights, From owner-svn-src-stable@FreeBSD.ORG Wed Jul 18 09:17:00 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 9E6A310657A0; Wed, 18 Jul 2012 09:17:00 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 801BE8FC1B; Wed, 18 Jul 2012 09:17:00 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6I9H0w0049795; Wed, 18 Jul 2012 09:17:00 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6I9H00F049788; Wed, 18 Jul 2012 09:17:00 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201207180917.q6I9H00F049788@svn.freebsd.org> From: Michael Tuexen Date: Wed, 18 Jul 2012 09:17:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238578 - in stable/9/sys: netinet netinet6 X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 18 Jul 2012 09:17:00 -0000 Author: tuexen Date: Wed Jul 18 09:16:59 2012 New Revision: 238578 URL: http://svn.freebsd.org/changeset/base/238578 Log: MFC r238475: #ifdef INET and INET6 consistently. This also fixes a bug, where it was done wrong. Approved by: re@ Modified: stable/9/sys/netinet/sctp_output.c stable/9/sys/netinet/sctp_pcb.c stable/9/sys/netinet/sctp_usrreq.c stable/9/sys/netinet/sctputil.c stable/9/sys/netinet6/sctp6_usrreq.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/netinet/sctp_output.c ============================================================================== --- stable/9/sys/netinet/sctp_output.c Wed Jul 18 09:16:47 2012 (r238577) +++ stable/9/sys/netinet/sctp_output.c Wed Jul 18 09:16:59 2012 (r238578) @@ -8518,12 +8518,14 @@ again_one_more_time: } /* now lets add any data within the MTU constraints */ switch (((struct sockaddr *)&net->ro._l_addr)->sa_family) { +#ifdef INET case AF_INET: if (net->mtu > (sizeof(struct ip) + sizeof(struct sctphdr))) omtu = net->mtu - (sizeof(struct ip) + sizeof(struct sctphdr)); else omtu = 0; break; +#endif #ifdef INET6 case AF_INET6: if (net->mtu > (sizeof(struct ip6_hdr) + sizeof(struct sctphdr))) @@ -12272,7 +12274,7 @@ sctp_lower_sosend(struct socket *so, union sctp_sockstore *raddr = (union sctp_sockstore *)addr; switch (raddr->sa.sa_family) { -#if defined(INET) +#ifdef INET case AF_INET: if (raddr->sin.sin_len != sizeof(struct sockaddr_in)) { SCTP_LTRACE_ERR_RET(inp, stcb, net, SCTP_FROM_SCTP_OUTPUT, EINVAL); @@ -12282,7 +12284,7 @@ sctp_lower_sosend(struct socket *so, port = raddr->sin.sin_port; break; #endif -#if defined(INET6) +#ifdef INET6 case AF_INET6: if (raddr->sin6.sin6_len != sizeof(struct sockaddr_in6)) { SCTP_LTRACE_ERR_RET(inp, stcb, net, SCTP_FROM_SCTP_OUTPUT, EINVAL); Modified: stable/9/sys/netinet/sctp_pcb.c ============================================================================== --- stable/9/sys/netinet/sctp_pcb.c Wed Jul 18 09:16:47 2012 (r238577) +++ stable/9/sys/netinet/sctp_pcb.c Wed Jul 18 09:16:59 2012 (r238578) @@ -3125,6 +3125,7 @@ continue_anyway: memset(&store_sa, 0, sizeof(store_sa)); switch (addr->sa_family) { +#ifdef INET case AF_INET: { struct sockaddr_in *sin; @@ -3134,6 +3135,8 @@ continue_anyway: sin->sin_port = 0; break; } +#endif +#ifdef INET6 case AF_INET6: { struct sockaddr_in6 *sin6; @@ -3143,6 +3146,7 @@ continue_anyway: sin6->sin6_port = 0; break; } +#endif default: break; } @@ -5304,12 +5308,16 @@ sctp_destination_is_reachable(struct sct } /* NOTE: all "scope" checks are done when local addresses are added */ switch (destaddr->sa_family) { +#ifdef INET6 case AF_INET6: answer = inp->ip_inp.inp.inp_vflag & INP_IPV6; break; +#endif +#ifdef INET case AF_INET: answer = inp->ip_inp.inp.inp_vflag & INP_IPV4; break; +#endif default: /* invalid family, so it's unreachable */ answer = 0; @@ -5400,7 +5408,7 @@ sctp_add_local_addr_ep(struct sctp_inpcb inp->ip_inp.inp.inp_vflag |= INP_IPV6; break; #endif -#ifdef INET6 +#ifdef INET case AF_INET: inp->ip_inp.inp.inp_vflag |= INP_IPV4; break; Modified: stable/9/sys/netinet/sctp_usrreq.c ============================================================================== --- stable/9/sys/netinet/sctp_usrreq.c Wed Jul 18 09:16:47 2012 (r238577) +++ stable/9/sys/netinet/sctp_usrreq.c Wed Jul 18 09:16:59 2012 (r238578) @@ -38,7 +38,7 @@ __FBSDID("$FreeBSD$"); #include #include #include -#if defined(INET6) +#ifdef INET6 #endif #include #include Modified: stable/9/sys/netinet/sctputil.c ============================================================================== --- stable/9/sys/netinet/sctputil.c Wed Jul 18 09:16:47 2012 (r238577) +++ stable/9/sys/netinet/sctputil.c Wed Jul 18 09:16:59 2012 (r238578) @@ -5691,7 +5691,7 @@ found_one: memcpy(from, &sin6, sizeof(struct sockaddr_in6)); } #endif -#if defined(INET6) +#ifdef INET6 { struct sockaddr_in6 lsa6, *from6; @@ -6588,7 +6588,7 @@ sctp_bindx_delete_address(struct sctp_in return; } addr_touse = sa; -#if defined(INET6) +#ifdef INET6 if (sa->sa_family == AF_INET6) { struct sockaddr_in6 *sin6; Modified: stable/9/sys/netinet6/sctp6_usrreq.c ============================================================================== --- stable/9/sys/netinet6/sctp6_usrreq.c Wed Jul 18 09:16:47 2012 (r238577) +++ stable/9/sys/netinet6/sctp6_usrreq.c Wed Jul 18 09:16:59 2012 (r238578) @@ -38,7 +38,7 @@ __FBSDID("$FreeBSD$"); #include #include #include -#if defined(INET6) +#ifdef INET6 #include #endif #include @@ -57,7 +57,7 @@ __FBSDID("$FreeBSD$"); #ifdef IPSEC #include -#if defined(INET6) +#ifdef INET6 #include #endif /* INET6 */ #endif /* IPSEC */ From owner-svn-src-stable@FreeBSD.ORG Wed Jul 18 10:42:31 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1451C106566C; Wed, 18 Jul 2012 10:42:31 +0000 (UTC) (envelope-from brueffer@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id F2C2B8FC1E; Wed, 18 Jul 2012 10:42:30 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6IAgUi9056400; Wed, 18 Jul 2012 10:42:30 GMT (envelope-from brueffer@svn.freebsd.org) Received: (from brueffer@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6IAgUS0056398; Wed, 18 Jul 2012 10:42:30 GMT (envelope-from brueffer@svn.freebsd.org) Message-Id: <201207181042.q6IAgUS0056398@svn.freebsd.org> From: Christian Brueffer Date: Wed, 18 Jul 2012 10:42:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238586 - stable/9/sys/dev/isp X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 18 Jul 2012 10:42:31 -0000 Author: brueffer Date: Wed Jul 18 10:42:30 2012 New Revision: 238586 URL: http://svn.freebsd.org/changeset/base/238586 Log: MFC: r238486 Fix typo in a message. Approved by: re (hrs) Modified: stable/9/sys/dev/isp/isp.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) stable/9/sys/dev/isp/ (props changed) Modified: stable/9/sys/dev/isp/isp.c ============================================================================== --- stable/9/sys/dev/isp/isp.c Wed Jul 18 10:26:50 2012 (r238585) +++ stable/9/sys/dev/isp/isp.c Wed Jul 18 10:42:30 2012 (r238586) @@ -2142,7 +2142,7 @@ isp_plogx(ispsoftc_t *isp, int chan, uin goto out; } else if (plp->plogx_status != PLOGX_STATUS_IOCBERR) { isp_prt(isp, ISP_LOGWARN, - "status 0x%x on port login IOCB chanel %d", + "status 0x%x on port login IOCB channel %d", plp->plogx_status, chan); rval = -1; goto out; From owner-svn-src-stable@FreeBSD.ORG Wed Jul 18 10:45:39 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 6E78C106566C; Wed, 18 Jul 2012 10:45:39 +0000 (UTC) (envelope-from brueffer@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 590388FC14; Wed, 18 Jul 2012 10:45:39 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6IAjdM3061796; Wed, 18 Jul 2012 10:45:39 GMT (envelope-from brueffer@svn.freebsd.org) Received: (from brueffer@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6IAjcih061794; Wed, 18 Jul 2012 10:45:38 GMT (envelope-from brueffer@svn.freebsd.org) Message-Id: <201207181045.q6IAjcih061794@svn.freebsd.org> From: Christian Brueffer Date: Wed, 18 Jul 2012 10:45:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238588 - stable/8/sys/dev/isp X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 18 Jul 2012 10:45:39 -0000 Author: brueffer Date: Wed Jul 18 10:45:38 2012 New Revision: 238588 URL: http://svn.freebsd.org/changeset/base/238588 Log: MFC: r238486 Fix typo in a message. Modified: stable/8/sys/dev/isp/isp.c Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/dev/isp/isp.c ============================================================================== --- stable/8/sys/dev/isp/isp.c Wed Jul 18 10:42:43 2012 (r238587) +++ stable/8/sys/dev/isp/isp.c Wed Jul 18 10:45:38 2012 (r238588) @@ -2143,7 +2143,7 @@ isp_plogx(ispsoftc_t *isp, int chan, uin goto out; } else if (plp->plogx_status != PLOGX_STATUS_IOCBERR) { isp_prt(isp, ISP_LOGWARN, - "status 0x%x on port login IOCB chanel %d", + "status 0x%x on port login IOCB channel %d", plp->plogx_status, chan); rval = -1; goto out; From owner-svn-src-stable@FreeBSD.ORG Wed Jul 18 10:56:48 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id D40F910656FF; Wed, 18 Jul 2012 10:56:48 +0000 (UTC) (envelope-from brueffer@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BE80F8FC0A; Wed, 18 Jul 2012 10:56:48 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6IAumre062760; Wed, 18 Jul 2012 10:56:48 GMT (envelope-from brueffer@svn.freebsd.org) Received: (from brueffer@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6IAum7x062758; Wed, 18 Jul 2012 10:56:48 GMT (envelope-from brueffer@svn.freebsd.org) Message-Id: <201207181056.q6IAum7x062758@svn.freebsd.org> From: Christian Brueffer Date: Wed, 18 Jul 2012 10:56:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238591 - stable/9/sys/cam/ata X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 18 Jul 2012 10:56:49 -0000 Author: brueffer Date: Wed Jul 18 10:56:48 2012 New Revision: 238591 URL: http://svn.freebsd.org/changeset/base/238591 Log: MFC: r238363 - fix description of SECURITY_FREEZE_LOCK - add missing underscores to SECURITY_DISABLE_PASSWORD Approved by: re (hrs) Modified: stable/9/sys/cam/ata/ata_all.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/cam/ata/ata_all.c ============================================================================== --- stable/9/sys/cam/ata/ata_all.c Wed Jul 18 10:51:11 2012 (r238590) +++ stable/9/sys/cam/ata/ata_all.c Wed Jul 18 10:56:48 2012 (r238591) @@ -171,8 +171,8 @@ ata_op_string(struct ata_cmd *cmd) case 0xf2: return ("SECURITY_UNLOCK"); case 0xf3: return ("SECURITY_ERASE_PREPARE"); case 0xf4: return ("SECURITY_ERASE_UNIT"); - case 0xf5: return ("SECURITY_FREE_LOCK"); - case 0xf6: return ("SECURITY DISABLE PASSWORD"); + case 0xf5: return ("SECURITY_FREEZE_LOCK"); + case 0xf6: return ("SECURITY_DISABLE_PASSWORD"); case 0xf8: return ("READ_NATIVE_MAX_ADDRESS"); case 0xf9: return ("SET_MAX_ADDRESS"); } From owner-svn-src-stable@FreeBSD.ORG Wed Jul 18 11:37:00 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 86D52106566C; Wed, 18 Jul 2012 11:37:00 +0000 (UTC) (envelope-from brueffer@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7175A8FC0A; Wed, 18 Jul 2012 11:37:00 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6IBb0rG066218; Wed, 18 Jul 2012 11:37:00 GMT (envelope-from brueffer@svn.freebsd.org) Received: (from brueffer@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6IBb0K1066216; Wed, 18 Jul 2012 11:37:00 GMT (envelope-from brueffer@svn.freebsd.org) Message-Id: <201207181137.q6IBb0K1066216@svn.freebsd.org> From: Christian Brueffer Date: Wed, 18 Jul 2012 11:37:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238594 - stable/8/sys/cam/ata X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 18 Jul 2012 11:37:00 -0000 Author: brueffer Date: Wed Jul 18 11:36:59 2012 New Revision: 238594 URL: http://svn.freebsd.org/changeset/base/238594 Log: MFC: r238363 - fix description of SECURITY_FREEZE_LOCK - add missing underscores to SECURITY_DISABLE_PASSWORD Modified: stable/8/sys/cam/ata/ata_all.c Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/cam/ata/ata_all.c ============================================================================== --- stable/8/sys/cam/ata/ata_all.c Wed Jul 18 10:58:30 2012 (r238593) +++ stable/8/sys/cam/ata/ata_all.c Wed Jul 18 11:36:59 2012 (r238594) @@ -161,8 +161,8 @@ ata_op_string(struct ata_cmd *cmd) case 0xf2: return ("SECURITY_UNLOCK"); case 0xf3: return ("SECURITY_ERASE_PREPARE"); case 0xf4: return ("SECURITY_ERASE_UNIT"); - case 0xf5: return ("SECURITY_FREE_LOCK"); - case 0xf6: return ("SECURITY DISABLE PASSWORD"); + case 0xf5: return ("SECURITY_FREEZE_LOCK"); + case 0xf6: return ("SECURITY_DISABLE_PASSWORD"); case 0xf8: return ("READ_NATIVE_MAX_ADDRESS"); case 0xf9: return ("SET_MAX_ADDRESS"); } From owner-svn-src-stable@FreeBSD.ORG Wed Jul 18 16:13:04 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 92F45106566C; Wed, 18 Jul 2012 16:13:04 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 72A628FC1D; Wed, 18 Jul 2012 16:13:04 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6IGD4so087603; Wed, 18 Jul 2012 16:13:04 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6IGD4gZ087600; Wed, 18 Jul 2012 16:13:04 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201207181613.q6IGD4gZ087600@svn.freebsd.org> From: Gleb Smirnoff Date: Wed, 18 Jul 2012 16:13:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238600 - stable/9/sys/contrib/pf/net X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 18 Jul 2012 16:13:04 -0000 Author: glebius Date: Wed Jul 18 16:13:03 2012 New Revision: 238600 URL: http://svn.freebsd.org/changeset/base/238600 Log: Merge r230119, r238498 from head: ------------------------------------------------------------------------ r230119 | csjp | 2012-01-15 02:51:34 +0400 (вс, 15 янв 2012) | 9 lines Revert to the old behavior of allocating table/table entries using M_NOWAIT. Currently, the code allows for sleeping in the ioctl path to guarantee allocation. However code also handles ENOMEM gracefully, so propagate this error back to user-space, rather than sleeping while holding the global pf mutex. Reviewed by: glebius Discussed with: bz ------------------------------------------------------------------------ r238498 | glebius | 2012-07-15 23:10:00 +0400 (вс, 15 июл 2012) | 2 lines Use M_NOWAIT while holding the pf giant lock. Approved by: re (kib) Modified: stable/9/sys/contrib/pf/net/pf_if.c stable/9/sys/contrib/pf/net/pf_table.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/contrib/pf/ (props changed) Modified: stable/9/sys/contrib/pf/net/pf_if.c ============================================================================== --- stable/9/sys/contrib/pf/net/pf_if.c Wed Jul 18 15:52:09 2012 (r238599) +++ stable/9/sys/contrib/pf/net/pf_if.c Wed Jul 18 16:13:03 2012 (r238600) @@ -506,8 +506,7 @@ pfi_dynaddr_setup(struct pf_addr_wrap *a if (aw->type != PF_ADDR_DYNIFTL) return (0); #ifdef __FreeBSD__ - /* XXX: revisit! */ - if ((dyn = pool_get(&V_pfi_addr_pl, PR_WAITOK | PR_ZERO)) + if ((dyn = pool_get(&V_pfi_addr_pl, PR_NOWAIT | PR_ZERO)) #else if ((dyn = pool_get(&pfi_addr_pl, PR_WAITOK | PR_LIMITFAIL | PR_ZERO)) #endif Modified: stable/9/sys/contrib/pf/net/pf_table.c ============================================================================== --- stable/9/sys/contrib/pf/net/pf_table.c Wed Jul 18 15:52:09 2012 (r238599) +++ stable/9/sys/contrib/pf/net/pf_table.c Wed Jul 18 16:13:03 2012 (r238600) @@ -926,16 +926,12 @@ pfr_create_kentry(struct pfr_addr *ad, i { struct pfr_kentry *ke; - if (intr) #ifdef __FreeBSD__ - ke = pool_get(&V_pfr_kentry_pl, PR_NOWAIT | PR_ZERO); + ke = pool_get(&V_pfr_kentry_pl, PR_NOWAIT | PR_ZERO); #else + if (intr) ke = pool_get(&pfr_kentry_pl, PR_NOWAIT | PR_ZERO); -#endif else -#ifdef __FreeBSD__ - ke = pool_get(&V_pfr_kentry_pl, PR_WAITOK|PR_ZERO); -#else ke = pool_get(&pfr_kentry_pl, PR_WAITOK|PR_ZERO|PR_LIMITFAIL); #endif if (ke == NULL) @@ -2080,16 +2076,12 @@ pfr_create_ktable(struct pfr_table *tbl, struct pfr_ktable *kt; struct pf_ruleset *rs; - if (intr) #ifdef __FreeBSD__ - kt = pool_get(&V_pfr_ktable_pl, PR_NOWAIT|PR_ZERO); + kt = pool_get(&V_pfr_ktable_pl, PR_NOWAIT|PR_ZERO); #else + if (intr) kt = pool_get(&pfr_ktable_pl, PR_NOWAIT|PR_ZERO|PR_LIMITFAIL); -#endif else -#ifdef __FreeBSD__ - kt = pool_get(&V_pfr_ktable_pl, PR_WAITOK|PR_ZERO); -#else kt = pool_get(&pfr_ktable_pl, PR_WAITOK|PR_ZERO|PR_LIMITFAIL); #endif if (kt == NULL) From owner-svn-src-stable@FreeBSD.ORG Thu Jul 19 09:33:00 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B1C481065672; Thu, 19 Jul 2012 09:33:00 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 993998FC12; Thu, 19 Jul 2012 09:33:00 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6J9X0Kw064248; Thu, 19 Jul 2012 09:33:00 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6J9X0k0064240; Thu, 19 Jul 2012 09:33:00 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201207190933.q6J9X0k0064240@svn.freebsd.org> From: Michael Tuexen Date: Thu, 19 Jul 2012 09:33:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238613 - in stable/9: sys/netinet sys/netinet6 usr.bin/netstat X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 Jul 2012 09:33:00 -0000 Author: tuexen Date: Thu Jul 19 09:32:59 2012 New Revision: 238613 URL: http://svn.freebsd.org/changeset/base/238613 Log: MFC r238501, r 238514: Changes which improve compilation if neither INET nor INET6 is defined. Allow netstat to be build if INET is not defined in the kernel. Thanks to Garrett Cooper for reporting the issue. This also fixes a bug where netstat doesn't work correctly for SCTP on INET only (no INET6) kernels. Approved by: re@ Modified: stable/9/sys/netinet/sctp_asconf.c stable/9/sys/netinet/sctp_output.c stable/9/sys/netinet/sctp_uio.h stable/9/sys/netinet/sctp_usrreq.c stable/9/sys/netinet6/sctp6_usrreq.c stable/9/usr.bin/netstat/Makefile stable/9/usr.bin/netstat/sctp.c Directory Properties: stable/9/sys/ (props changed) stable/9/usr.bin/ (props changed) stable/9/usr.bin/netstat/ (props changed) Modified: stable/9/sys/netinet/sctp_asconf.c ============================================================================== --- stable/9/sys/netinet/sctp_asconf.c Thu Jul 19 08:56:30 2012 (r238612) +++ stable/9/sys/netinet/sctp_asconf.c Thu Jul 19 09:32:59 2012 (r238613) @@ -2806,13 +2806,14 @@ sctp_process_initack_addresses(struct sc struct sctp_paramhdr tmp_param, *ph; uint16_t plen, ptype; struct sctp_ifa *sctp_ifa; - struct sctp_ipv6addr_param addr_store; #ifdef INET6 + struct sctp_ipv6addr_param addr6_store; struct sockaddr_in6 sin6; #endif #ifdef INET + struct sctp_ipv4addr_param addr4_store; struct sockaddr_in sin; #endif @@ -2861,7 +2862,7 @@ sctp_process_initack_addresses(struct sc a6p = (struct sctp_ipv6addr_param *) sctp_m_getptr(m, offset, sizeof(struct sctp_ipv6addr_param), - (uint8_t *) & addr_store); + (uint8_t *) & addr6_store); if (plen != sizeof(struct sctp_ipv6addr_param) || a6p == NULL) { return; @@ -2880,7 +2881,7 @@ sctp_process_initack_addresses(struct sc /* get the entire IPv4 address param */ a4p = (struct sctp_ipv4addr_param *)sctp_m_getptr(m, offset, sizeof(struct sctp_ipv4addr_param), - (uint8_t *) & addr_store); + (uint8_t *) & addr4_store); if (plen != sizeof(struct sctp_ipv4addr_param) || a4p == NULL) { return; @@ -2958,16 +2959,17 @@ sctp_addr_in_initack(struct mbuf *m, uin { struct sctp_paramhdr tmp_param, *ph; uint16_t plen, ptype; - struct sctp_ipv6addr_param addr_store; #ifdef INET struct sockaddr_in *sin; struct sctp_ipv4addr_param *a4p; + struct sctp_ipv6addr_param addr4_store; #endif #ifdef INET6 struct sockaddr_in6 *sin6; struct sctp_ipv6addr_param *a6p; + struct sctp_ipv6addr_param addr6_store; struct sockaddr_in6 sin6_tmp; #endif @@ -3013,7 +3015,7 @@ sctp_addr_in_initack(struct mbuf *m, uin a6p = (struct sctp_ipv6addr_param *) sctp_m_getptr(m, offset, sizeof(struct sctp_ipv6addr_param), - (uint8_t *) & addr_store); + (uint8_t *) & addr6_store); if (a6p == NULL) { return (0); } @@ -3043,7 +3045,7 @@ sctp_addr_in_initack(struct mbuf *m, uin a4p = (struct sctp_ipv4addr_param *) sctp_m_getptr(m, offset, sizeof(struct sctp_ipv4addr_param), - (uint8_t *) & addr_store); + (uint8_t *) & addr4_store); if (a4p == NULL) { return (0); } Modified: stable/9/sys/netinet/sctp_output.c ============================================================================== --- stable/9/sys/netinet/sctp_output.c Thu Jul 19 08:56:30 2012 (r238612) +++ stable/9/sys/netinet/sctp_output.c Thu Jul 19 09:32:59 2012 (r238613) @@ -3799,6 +3799,7 @@ sctp_get_ect(struct sctp_tcb *stcb) } } +#if defined(INET) || defined(INET6) static void sctp_handle_no_route(struct sctp_tcb *stcb, struct sctp_nets *net, @@ -3843,6 +3844,8 @@ sctp_handle_no_route(struct sctp_tcb *st } } +#endif + static int sctp_lowlevel_chunk_output(struct sctp_inpcb *inp, struct sctp_tcb *stcb, /* may be NULL */ @@ -3882,14 +3885,18 @@ sctp_lowlevel_chunk_output(struct sctp_i * interface and smallest_mtu size as well. */ /* Will need ifdefs around this */ - struct mbuf *o_pak; struct mbuf *newm; struct sctphdr *sctphdr; int packet_length; int ret; uint32_t vrf_id; + +#if defined(INET) || defined(INET6) + struct mbuf *o_pak; sctp_route_t *ro = NULL; struct udphdr *udp = NULL; + +#endif uint8_t tos_value; #if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING) Modified: stable/9/sys/netinet/sctp_uio.h ============================================================================== --- stable/9/sys/netinet/sctp_uio.h Thu Jul 19 08:56:30 2012 (r238612) +++ stable/9/sys/netinet/sctp_uio.h Thu Jul 19 09:32:59 2012 (r238613) @@ -1124,10 +1124,10 @@ struct sctpstat { #define SCTP_STAT_DECR_GAUGE32(_x) SCTP_STAT_DECR(_x) union sctp_sockstore { -#if defined(INET) || !defined(_KERNEL) +#if defined(INET) struct sockaddr_in sin; #endif -#if defined(INET6) || !defined(_KERNEL) +#if defined(INET6) struct sockaddr_in6 sin6; #endif struct sockaddr sa; Modified: stable/9/sys/netinet/sctp_usrreq.c ============================================================================== --- stable/9/sys/netinet/sctp_usrreq.c Thu Jul 19 08:56:30 2012 (r238612) +++ stable/9/sys/netinet/sctp_usrreq.c Thu Jul 19 09:32:59 2012 (r238613) @@ -5258,7 +5258,6 @@ sctp_setopt(struct socket *so, int optna case SCTP_BINDX_ADD_ADDR: { struct sctp_getaddresses *addrs; - size_t sz; struct thread *td; td = (struct thread *)p; @@ -5266,8 +5265,7 @@ sctp_setopt(struct socket *so, int optna optsize); #ifdef INET if (addrs->addr->sa_family == AF_INET) { - sz = sizeof(struct sctp_getaddresses) - sizeof(struct sockaddr) + sizeof(struct sockaddr_in); - if (optsize < sz) { + if (optsize < sizeof(struct sctp_getaddresses) - sizeof(struct sockaddr) + sizeof(struct sockaddr_in)) { SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL); error = EINVAL; break; @@ -5280,8 +5278,7 @@ sctp_setopt(struct socket *so, int optna #endif #ifdef INET6 if (addrs->addr->sa_family == AF_INET6) { - sz = sizeof(struct sctp_getaddresses) - sizeof(struct sockaddr) + sizeof(struct sockaddr_in6); - if (optsize < sz) { + if (optsize < sizeof(struct sctp_getaddresses) - sizeof(struct sockaddr) + sizeof(struct sockaddr_in6)) { SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL); error = EINVAL; break; @@ -5305,7 +5302,6 @@ sctp_setopt(struct socket *so, int optna case SCTP_BINDX_REM_ADDR: { struct sctp_getaddresses *addrs; - size_t sz; struct thread *td; td = (struct thread *)p; @@ -5313,8 +5309,7 @@ sctp_setopt(struct socket *so, int optna SCTP_CHECK_AND_CAST(addrs, optval, struct sctp_getaddresses, optsize); #ifdef INET if (addrs->addr->sa_family == AF_INET) { - sz = sizeof(struct sctp_getaddresses) - sizeof(struct sockaddr) + sizeof(struct sockaddr_in); - if (optsize < sz) { + if (optsize < sizeof(struct sctp_getaddresses) - sizeof(struct sockaddr) + sizeof(struct sockaddr_in)) { SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL); error = EINVAL; break; @@ -5327,8 +5322,7 @@ sctp_setopt(struct socket *so, int optna #endif #ifdef INET6 if (addrs->addr->sa_family == AF_INET6) { - sz = sizeof(struct sctp_getaddresses) - sizeof(struct sockaddr) + sizeof(struct sockaddr_in6); - if (optsize < sz) { + if (optsize < sizeof(struct sctp_getaddresses) - sizeof(struct sockaddr) + sizeof(struct sockaddr_in6)) { SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL); error = EINVAL; break; Modified: stable/9/sys/netinet6/sctp6_usrreq.c ============================================================================== --- stable/9/sys/netinet6/sctp6_usrreq.c Thu Jul 19 08:56:30 2012 (r238612) +++ stable/9/sys/netinet6/sctp6_usrreq.c Thu Jul 19 09:32:59 2012 (r238613) @@ -34,6 +34,7 @@ __FBSDID("$FreeBSD$"); #include +#ifdef INET6 #include #include #include @@ -1354,3 +1355,5 @@ struct pr_usrreqs sctp6_usrreqs = { .pru_sosend = sctp_sosend, .pru_soreceive = sctp_soreceive }; + +#endif Modified: stable/9/usr.bin/netstat/Makefile ============================================================================== --- stable/9/usr.bin/netstat/Makefile Thu Jul 19 08:56:30 2012 (r238612) +++ stable/9/usr.bin/netstat/Makefile Thu Jul 19 09:32:59 2012 (r238613) @@ -13,6 +13,10 @@ CFLAGS+=-fno-strict-aliasing CFLAGS+=-DIPSEC CFLAGS+=-DSCTP +.if ${MK_INET_SUPPORT} != "no" +CFLAGS+=-DINET +.endif + .if ${MK_INET6_SUPPORT} != "no" SRCS+= inet6.c CFLAGS+=-DINET6 Modified: stable/9/usr.bin/netstat/sctp.c ============================================================================== --- stable/9/usr.bin/netstat/sctp.c Thu Jul 19 08:56:30 2012 (r238612) +++ stable/9/usr.bin/netstat/sctp.c Thu Jul 19 09:32:59 2012 (r238613) @@ -107,6 +107,7 @@ struct xraddr_entry { * If numeric_addr has been supplied, give * numeric value, otherwise try for symbolic name. */ +#ifdef INET static char * inetname(struct in_addr *inp) { @@ -146,6 +147,7 @@ inetname(struct in_addr *inp) } return (line); } +#endif #ifdef INET6 static char ntop_buf[INET6_ADDRSTRLEN]; @@ -197,9 +199,11 @@ sctp_print_address(union sctp_sockstore int width; switch (address->sa.sa_family) { +#ifdef INET case AF_INET: sprintf(line, "%.*s.", Wflag ? 39 : 16, inetname(&address->sin.sin_addr)); break; +#endif #ifdef INET6 case AF_INET6: sprintf(line, "%.*s.", Wflag ? 39 : 16, inet6name(&address->sin6.sin6_addr)); From owner-svn-src-stable@FreeBSD.ORG Thu Jul 19 10:28:30 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 01F22106564A; Thu, 19 Jul 2012 10:28:30 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E00158FC14; Thu, 19 Jul 2012 10:28:29 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6JASTMW068693; Thu, 19 Jul 2012 10:28:29 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6JAST6L068691; Thu, 19 Jul 2012 10:28:29 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201207191028.q6JAST6L068691@svn.freebsd.org> From: Hans Petter Selasky Date: Thu, 19 Jul 2012 10:28:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238616 - stable/8/sys/conf X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 Jul 2012 10:28:30 -0000 Author: hselasky Date: Thu Jul 19 10:28:29 2012 New Revision: 238616 URL: http://svn.freebsd.org/changeset/base/238616 Log: MFC r213705: Add the XHCI USB controller to NOTES. Suggested by: dougb @ Modified: stable/8/sys/conf/NOTES Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/conf/NOTES ============================================================================== --- stable/8/sys/conf/NOTES Thu Jul 19 10:23:59 2012 (r238615) +++ stable/8/sys/conf/NOTES Thu Jul 19 10:28:29 2012 (r238616) @@ -2577,6 +2577,8 @@ device uhci device ohci # EHCI controller device ehci +# XHCI controller +device xhci # SL811 Controller #device slhci # General USB code (mandatory for USB) From owner-svn-src-stable@FreeBSD.ORG Thu Jul 19 10:47:08 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id E3900106564A; Thu, 19 Jul 2012 10:47:08 +0000 (UTC) (envelope-from ermal.luci@gmail.com) Received: from mail-qa0-f54.google.com (mail-qa0-f54.google.com [209.85.216.54]) by mx1.freebsd.org (Postfix) with ESMTP id 4B7B38FC15; Thu, 19 Jul 2012 10:47:08 +0000 (UTC) Received: by qaat11 with SMTP id t11so1677669qaa.13 for ; Thu, 19 Jul 2012 03:47:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=C5njcXtDi2WzRLL6a8aD0zmh2VqRDMjKqfXKSux9DGU=; b=gsX4WyNP0aS8IvKOf3UFNrorFVXDu3a6HEvfAszpc2U+jE76W2uiDOIGvuuyrY6Md4 0V9J35Tli8ovlreoq49PsnCWCh6JE8/0X1jMgkj5fIl1s2ceht9fbFYNhtyXdmc632+b IGBmR6KxXp5vkUvxJxK35DdrzbGskAXH5sl9zg/bUieXMwlSXJoBBRo9suPmY0lz51NR vuikUE9macfCp9ej7wxmcerirZKPJL3FOUM02cGmJEfzWoFK71N2bky5FV9GhLrHqgsp j3/bdMXtJ/iWkzC5wc6M3dIm6zDb1+9AXb8ZyNIu/+jmxDHeRtDPt7xGfCD9YC9KSJng z9pQ== MIME-Version: 1.0 Received: by 10.224.213.74 with SMTP id gv10mr2836028qab.25.1342694827571; Thu, 19 Jul 2012 03:47:07 -0700 (PDT) Sender: ermal.luci@gmail.com Received: by 10.229.161.211 with HTTP; Thu, 19 Jul 2012 03:47:07 -0700 (PDT) In-Reply-To: <201207181613.q6IGD4gZ087600@svn.freebsd.org> References: <201207181613.q6IGD4gZ087600@svn.freebsd.org> Date: Thu, 19 Jul 2012 12:47:07 +0200 X-Google-Sender-Auth: mRLF3P4P2LYkhWGRgIbfQtiLzDM Message-ID: From: =?ISO-8859-1?Q?Ermal_Lu=E7i?= To: Gleb Smirnoff Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Cc: svn-src-stable@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, svn-src-stable-9@freebsd.org Subject: Re: svn commit: r238600 - stable/9/sys/contrib/pf/net X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 Jul 2012 10:47:09 -0000 I would prefer to be in CC for this or at least asked! On Wed, Jul 18, 2012 at 6:13 PM, Gleb Smirnoff wrote: > Author: glebius > Date: Wed Jul 18 16:13:03 2012 > New Revision: 238600 > URL: http://svn.freebsd.org/changeset/base/238600 > > Log: > Merge r230119, r238498 from head: > > -----------------------------------------------------------------------= - > r230119 | csjp | 2012-01-15 02:51:34 +0400 (=D0=B2=D1=81, 15 =D1=8F=D0= =BD=D0=B2 2012) | 9 lines > > Revert to the old behavior of allocating table/table entries using > M_NOWAIT. Currently, the code allows for sleeping in the ioctl path > to guarantee allocation. However code also handles ENOMEM gracefully, = so > propagate this error back to user-space, rather than sleeping while > holding the global pf mutex. > > Reviewed by: glebius > Discussed with: bz > > -----------------------------------------------------------------------= - > r238498 | glebius | 2012-07-15 23:10:00 +0400 (=D0=B2=D1=81, 15 =D0=B8= =D1=8E=D0=BB 2012) | 2 lines > > Use M_NOWAIT while holding the pf giant lock. > > Approved by: re (kib) > > Modified: > stable/9/sys/contrib/pf/net/pf_if.c > stable/9/sys/contrib/pf/net/pf_table.c > Directory Properties: > stable/9/sys/ (props changed) > stable/9/sys/contrib/pf/ (props changed) > > Modified: stable/9/sys/contrib/pf/net/pf_if.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- stable/9/sys/contrib/pf/net/pf_if.c Wed Jul 18 15:52:09 2012 (= r238599) > +++ stable/9/sys/contrib/pf/net/pf_if.c Wed Jul 18 16:13:03 2012 (= r238600) > @@ -506,8 +506,7 @@ pfi_dynaddr_setup(struct pf_addr_wrap *a > if (aw->type !=3D PF_ADDR_DYNIFTL) > return (0); > #ifdef __FreeBSD__ > - /* XXX: revisit! */ > - if ((dyn =3D pool_get(&V_pfi_addr_pl, PR_WAITOK | PR_ZERO)) > + if ((dyn =3D pool_get(&V_pfi_addr_pl, PR_NOWAIT | PR_ZERO)) > #else > if ((dyn =3D pool_get(&pfi_addr_pl, PR_WAITOK | PR_LIMITFAIL | PR= _ZERO)) > #endif > > Modified: stable/9/sys/contrib/pf/net/pf_table.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- stable/9/sys/contrib/pf/net/pf_table.c Wed Jul 18 15:52:09 2012 = (r238599) > +++ stable/9/sys/contrib/pf/net/pf_table.c Wed Jul 18 16:13:03 2012 = (r238600) > @@ -926,16 +926,12 @@ pfr_create_kentry(struct pfr_addr *ad, i > { > struct pfr_kentry *ke; > > - if (intr) > #ifdef __FreeBSD__ > - ke =3D pool_get(&V_pfr_kentry_pl, PR_NOWAIT | PR_ZERO); > + ke =3D pool_get(&V_pfr_kentry_pl, PR_NOWAIT | PR_ZERO); > #else > + if (intr) > ke =3D pool_get(&pfr_kentry_pl, PR_NOWAIT | PR_ZERO); > -#endif > else > -#ifdef __FreeBSD__ > - ke =3D pool_get(&V_pfr_kentry_pl, PR_WAITOK|PR_ZERO); > -#else > ke =3D pool_get(&pfr_kentry_pl, PR_WAITOK|PR_ZERO|PR_LIMI= TFAIL); > #endif > if (ke =3D=3D NULL) > @@ -2080,16 +2076,12 @@ pfr_create_ktable(struct pfr_table *tbl, > struct pfr_ktable *kt; > struct pf_ruleset *rs; > > - if (intr) > #ifdef __FreeBSD__ > - kt =3D pool_get(&V_pfr_ktable_pl, PR_NOWAIT|PR_ZERO); > + kt =3D pool_get(&V_pfr_ktable_pl, PR_NOWAIT|PR_ZERO); > #else > + if (intr) > kt =3D pool_get(&pfr_ktable_pl, PR_NOWAIT|PR_ZERO|PR_LIMI= TFAIL); > -#endif > else > -#ifdef __FreeBSD__ > - kt =3D pool_get(&V_pfr_ktable_pl, PR_WAITOK|PR_ZERO); > -#else > kt =3D pool_get(&pfr_ktable_pl, PR_WAITOK|PR_ZERO|PR_LIMI= TFAIL); > #endif > if (kt =3D=3D NULL) --=20 Ermal From owner-svn-src-stable@FreeBSD.ORG Thu Jul 19 11:43:32 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 55E2A106566B; Thu, 19 Jul 2012 11:43:32 +0000 (UTC) (envelope-from melifaro@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3CCB18FC0C; Thu, 19 Jul 2012 11:43:32 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6JBhWmt077348; Thu, 19 Jul 2012 11:43:32 GMT (envelope-from melifaro@svn.freebsd.org) Received: (from melifaro@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6JBhWWe077343; Thu, 19 Jul 2012 11:43:32 GMT (envelope-from melifaro@svn.freebsd.org) Message-Id: <201207191143.q6JBhWWe077343@svn.freebsd.org> From: "Alexander V. Chernikov" Date: Thu, 19 Jul 2012 11:43:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238619 - in stable/8/sys: conf modules/netgraph/netflow netgraph/netflow X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 Jul 2012 11:43:32 -0000 Author: melifaro Date: Thu Jul 19 11:43:31 2012 New Revision: 238619 URL: http://svn.freebsd.org/changeset/base/238619 Log: MFC r219182, r219229, r220769, r223706, r223787, r223822, r232921, r237162, r237163, r237164, r237226, r237227 Merge netflow v9 support (kernel side) r219182 - Add support for NetFlow version 9 into ng_netflow(4) node. r219229 - Unbreak the build for no options INET6. r220769 - ng_netflow_cache_init() can be void. r223706 - Fix double free. r223787 - Eliminate flow6_hash_entry in favor of flow_hash_entry r223822 - Add missing unlocks. r232921 - Use rt_numfibs variable instead of compile-time RT_NUMFIBS. r237162 - Fix improper L4 header handling for IPv6 packets passed via DLT_RAW. r237163 - Set netflow v9 observation domain value to fib number instead of node id r237164 - Use time_uptime instead of getnanotime for accouting integer number of seconds. r237226 - Simplify IP pointer recovery in case of mbuf reallocation. r237227 - Make radix lookup on src and dst flow addresses optional No objection from: glebius Approved by: ae(mentor) Added: stable/8/sys/netgraph/netflow/netflow_v9.c - copied, changed from r219182, head/sys/netgraph/netflow/netflow_v9.c stable/8/sys/netgraph/netflow/netflow_v9.h - copied unchanged from r219182, head/sys/netgraph/netflow/netflow_v9.h Modified: stable/8/sys/conf/files stable/8/sys/modules/netgraph/netflow/Makefile stable/8/sys/netgraph/netflow/netflow.c stable/8/sys/netgraph/netflow/netflow.h stable/8/sys/netgraph/netflow/ng_netflow.c stable/8/sys/netgraph/netflow/ng_netflow.h Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/conf/files ============================================================================== --- stable/8/sys/conf/files Thu Jul 19 11:18:41 2012 (r238618) +++ stable/8/sys/conf/files Thu Jul 19 11:43:31 2012 (r238619) @@ -2533,6 +2533,7 @@ netgraph/bluetooth/socket/ng_btsocket_l2 netgraph/bluetooth/socket/ng_btsocket_rfcomm.c optional netgraph_bluetooth_socket netgraph/bluetooth/socket/ng_btsocket_sco.c optional netgraph_bluetooth_socket netgraph/netflow/netflow.c optional netgraph_netflow +netgraph/netflow/netflow_v9.c optional netgraph_netflow netgraph/netflow/ng_netflow.c optional netgraph_netflow netgraph/ng_UI.c optional netgraph_UI netgraph/ng_async.c optional netgraph_async Modified: stable/8/sys/modules/netgraph/netflow/Makefile ============================================================================== --- stable/8/sys/modules/netgraph/netflow/Makefile Thu Jul 19 11:18:41 2012 (r238618) +++ stable/8/sys/modules/netgraph/netflow/Makefile Thu Jul 19 11:43:31 2012 (r238619) @@ -3,9 +3,20 @@ # Author: Gleb Smirnoff # +.include + .PATH: ${.CURDIR}/../../../netgraph/netflow KMOD= ng_netflow -SRCS= ng_netflow.c netflow.c +SRCS= ng_netflow.c netflow.c netflow_v9.c opt_inet6.h opt_route.h + +.if !defined(KERNBUILDDIR) + +.if ${MK_INET6_SUPPORT} != "no" +opt_inet6.h: + echo "#define INET6 1" > ${.TARGET} +.endif + +.endif .include Modified: stable/8/sys/netgraph/netflow/netflow.c ============================================================================== --- stable/8/sys/netgraph/netflow/netflow.c Thu Jul 19 11:18:41 2012 (r238618) +++ stable/8/sys/netgraph/netflow/netflow.c Thu Jul 19 11:43:31 2012 (r238619) @@ -1,4 +1,5 @@ /*- + * Copyright (c) 2010-2011 Alexander V. Chernikov * Copyright (c) 2004-2005 Gleb Smirnoff * Copyright (c) 2001-2003 Roman V. Palagin * All rights reserved. @@ -30,6 +31,8 @@ static const char rcs_id[] = "@(#) $FreeBSD$"; +#include "opt_inet6.h" +#include "opt_route.h" #include #include #include @@ -37,14 +40,18 @@ static const char rcs_id[] = #include #include #include +#include #include +#include #include #include +#include #include #include #include +#include #include #include @@ -52,6 +59,7 @@ static const char rcs_id[] = #include #include +#include #include #define NBUCKETS (65536) /* must be power of 2 */ @@ -83,25 +91,30 @@ static const char rcs_id[] = */ #define SMALL(fle) (fle->f.packets <= 4) -/* - * Cisco uses milliseconds for uptime. Bad idea, since it overflows - * every 48+ days. But we will do same to keep compatibility. This macro - * does overflowable multiplication to 1000. - */ -#define MILLIUPTIME(t) (((t) << 9) + /* 512 */ \ - ((t) << 8) + /* 256 */ \ - ((t) << 7) + /* 128 */ \ - ((t) << 6) + /* 64 */ \ - ((t) << 5) + /* 32 */ \ - ((t) << 3)) /* 8 */ MALLOC_DECLARE(M_NETFLOW_HASH); MALLOC_DEFINE(M_NETFLOW_HASH, "netflow_hash", "NetFlow hash"); static int export_add(item_p, struct flow_entry *); -static int export_send(priv_p, item_p, int flags); +static int export_send(priv_p, fib_export_p, item_p, int); + +static int hash_insert(priv_p, struct flow_hash_entry *, struct flow_rec *, int, uint8_t, uint8_t); +#ifdef INET6 +static int hash6_insert(priv_p, struct flow_hash_entry *, struct flow6_rec *, int, uint8_t, uint8_t); +#endif + +static __inline void expire_flow(priv_p, fib_export_p, struct flow_entry *, int); -/* Generate hash for a given flow record. */ +/* + * Generate hash for a given flow record. + * + * FIB is not used here, because: + * most VRFS will carry public IPv4 addresses which are unique even + * without FIB private addresses can overlap, but this is worked out + * via flow_rec bcmp() containing fib id. In IPv6 world addresses are + * all globally unique (it's not fully true, there is FC00::/7 for example, + * but chances of address overlap are MUCH smaller) + */ static __inline uint32_t ip_hash(struct flow_rec *r) { @@ -115,6 +128,24 @@ ip_hash(struct flow_rec *r) } } +#ifdef INET6 +/* Generate hash for a given flow6 record. Use lower 4 octets from v6 addresses */ +static __inline uint32_t +ip6_hash(struct flow6_rec *r) +{ + switch (r->r_ip_p) { + case IPPROTO_TCP: + case IPPROTO_UDP: + return FULL_HASH(r->src.r_src6.__u6_addr.__u6_addr32[3], + r->dst.r_dst6.__u6_addr.__u6_addr32[3], r->r_sport, + r->r_dport); + default: + return ADDR_HASH(r->src.r_src6.__u6_addr.__u6_addr32[3], + r->dst.r_dst6.__u6_addr.__u6_addr32[3]); + } +} +#endif + /* This is callback from uma(9), called on alloc. */ static int uma_ctor_flow(void *mem, int size, void *arg, int how) @@ -138,21 +169,46 @@ uma_dtor_flow(void *mem, int size, void atomic_subtract_32(&priv->info.nfinfo_used, 1); } +#ifdef INET6 +/* This is callback from uma(9), called on alloc. */ +static int +uma_ctor_flow6(void *mem, int size, void *arg, int how) +{ + priv_p priv = (priv_p )arg; + + if (atomic_load_acq_32(&priv->info.nfinfo_used6) >= CACHESIZE) + return (ENOMEM); + + atomic_add_32(&priv->info.nfinfo_used6, 1); + + return (0); +} + +/* This is callback from uma(9), called on free. */ +static void +uma_dtor_flow6(void *mem, int size, void *arg) +{ + priv_p priv = (priv_p )arg; + + atomic_subtract_32(&priv->info.nfinfo_used6, 1); +} +#endif + /* * Detach export datagram from priv, if there is any. * If there is no, allocate a new one. */ static item_p -get_export_dgram(priv_p priv) +get_export_dgram(priv_p priv, fib_export_p fe) { item_p item = NULL; - mtx_lock(&priv->export_mtx); - if (priv->export_item != NULL) { - item = priv->export_item; - priv->export_item = NULL; + mtx_lock(&fe->export_mtx); + if (fe->exp.item != NULL) { + item = fe->exp.item; + fe->exp.item = NULL; } - mtx_unlock(&priv->export_mtx); + mtx_unlock(&fe->export_mtx); if (item == NULL) { struct netflow_v5_export_dgram *dgram; @@ -178,20 +234,20 @@ get_export_dgram(priv_p priv) * Re-attach incomplete datagram back to priv. * If there is already another one, then send incomplete. */ static void -return_export_dgram(priv_p priv, item_p item, int flags) +return_export_dgram(priv_p priv, fib_export_p fe, item_p item, int flags) { /* * It may happen on SMP, that some thread has already * put its item there, in this case we bail out and * send what we have to collector. */ - mtx_lock(&priv->export_mtx); - if (priv->export_item == NULL) { - priv->export_item = item; - mtx_unlock(&priv->export_mtx); + mtx_lock(&fe->export_mtx); + if (fe->exp.item == NULL) { + fe->exp.item = item; + mtx_unlock(&fe->export_mtx); } else { - mtx_unlock(&priv->export_mtx); - export_send(priv, item, flags); + mtx_unlock(&fe->export_mtx); + export_send(priv, fe, item, flags); } } @@ -200,20 +256,55 @@ return_export_dgram(priv_p priv, item_p * full, then call export_send(). */ static __inline void -expire_flow(priv_p priv, item_p *item, struct flow_entry *fle, int flags) +expire_flow(priv_p priv, fib_export_p fe, struct flow_entry *fle, int flags) { - if (*item == NULL) - *item = get_export_dgram(priv); - if (*item == NULL) { - atomic_add_32(&priv->info.nfinfo_export_failed, 1); - uma_zfree_arg(priv->zone, fle, priv); - return; + struct netflow_export_item exp; + uint16_t version = fle->f.version; + + if ((priv->export != NULL) && (version == IPVERSION)) { + exp.item = get_export_dgram(priv, fe); + if (exp.item == NULL) { + atomic_add_32(&priv->info.nfinfo_export_failed, 1); + if (priv->export9 != NULL) + atomic_add_32(&priv->info.nfinfo_export9_failed, 1); + /* fle definitely contains IPv4 flow */ + uma_zfree_arg(priv->zone, fle, priv); + return; + } + + if (export_add(exp.item, fle) > 0) + export_send(priv, fe, exp.item, flags); + else + return_export_dgram(priv, fe, exp.item, NG_QUEUE); } - if (export_add(*item, fle) > 0) { - export_send(priv, *item, flags); - *item = NULL; + + if (priv->export9 != NULL) { + exp.item9 = get_export9_dgram(priv, fe, &exp.item9_opt); + if (exp.item9 == NULL) { + atomic_add_32(&priv->info.nfinfo_export9_failed, 1); + if (version == IPVERSION) + uma_zfree_arg(priv->zone, fle, priv); +#ifdef INET6 + else if (version == IP6VERSION) + uma_zfree_arg(priv->zone6, fle, priv); +#endif + else + panic("ng_netflow: Unknown IP proto: %d", version); + return; + } + + if (export9_add(exp.item9, exp.item9_opt, fle) > 0) + export9_send(priv, fe, exp.item9, exp.item9_opt, flags); + else + return_export9_dgram(priv, fe, exp.item9, exp.item9_opt, NG_QUEUE); } - uma_zfree_arg(priv->zone, fle, priv); + + if (version == IPVERSION) + uma_zfree_arg(priv->zone, fle, priv); +#ifdef INET6 + else if (version == IP6VERSION) + uma_zfree_arg(priv->zone6, fle, priv); +#endif } /* Get a snapshot of node statistics */ @@ -234,9 +325,9 @@ ng_netflow_copyinfo(priv_p priv, struct * as this was done in previous version. Need to test & profile * to be sure. */ -static __inline int -hash_insert(priv_p priv, struct flow_hash_entry *hsh, struct flow_rec *r, - int plen, uint8_t tcp_flags) +static int +hash_insert(priv_p priv, struct flow_hash_entry *hsh, struct flow_rec *r, + int plen, uint8_t flags, uint8_t tcp_flags) { struct flow_entry *fle; struct sockaddr_in sin; @@ -255,6 +346,7 @@ hash_insert(priv_p priv, struct flow_has * we can safely edit it. */ + fle->f.version = IPVERSION; bcopy(r, &fle->f.r, sizeof(struct flow_rec)); fle->f.bytes = plen; fle->f.packets = 1; @@ -266,46 +358,48 @@ hash_insert(priv_p priv, struct flow_has * First we do route table lookup on destination address. So we can * fill in out_ifx, dst_mask, nexthop, and dst_as in future releases. */ - bzero(&sin, sizeof(sin)); - sin.sin_len = sizeof(struct sockaddr_in); - sin.sin_family = AF_INET; - sin.sin_addr = fle->f.r.r_dst; - /* XXX MRT 0 as a default.. need the m here to get fib */ - rt = rtalloc1_fib((struct sockaddr *)&sin, 0, 0, 0); - if (rt != NULL) { - fle->f.fle_o_ifx = rt->rt_ifp->if_index; - - if (rt->rt_flags & RTF_GATEWAY && - rt->rt_gateway->sa_family == AF_INET) - fle->f.next_hop = - ((struct sockaddr_in *)(rt->rt_gateway))->sin_addr; - - if (rt_mask(rt)) - fle->f.dst_mask = bitcount32(((struct sockaddr_in *) - rt_mask(rt))->sin_addr.s_addr); - else if (rt->rt_flags & RTF_HOST) - /* Give up. We can't determine mask :( */ - fle->f.dst_mask = 32; + if ((flags & NG_NETFLOW_CONF_NODSTLOOKUP) == 0) { + bzero(&sin, sizeof(sin)); + sin.sin_len = sizeof(struct sockaddr_in); + sin.sin_family = AF_INET; + sin.sin_addr = fle->f.r.r_dst; + rt = rtalloc1_fib((struct sockaddr *)&sin, 0, 0, r->fib); + if (rt != NULL) { + fle->f.fle_o_ifx = rt->rt_ifp->if_index; + + if (rt->rt_flags & RTF_GATEWAY && + rt->rt_gateway->sa_family == AF_INET) + fle->f.next_hop = + ((struct sockaddr_in *)(rt->rt_gateway))->sin_addr; + + if (rt_mask(rt)) + fle->f.dst_mask = bitcount32(((struct sockaddr_in *) + rt_mask(rt))->sin_addr.s_addr); + else if (rt->rt_flags & RTF_HOST) + /* Give up. We can't determine mask :( */ + fle->f.dst_mask = 32; - RTFREE_LOCKED(rt); + RTFREE_LOCKED(rt); + } } /* Do route lookup on source address, to fill in src_mask. */ - bzero(&sin, sizeof(sin)); - sin.sin_len = sizeof(struct sockaddr_in); - sin.sin_family = AF_INET; - sin.sin_addr = fle->f.r.r_src; - /* XXX MRT 0 as a default revisit. need the mbuf for fib*/ - rt = rtalloc1_fib((struct sockaddr *)&sin, 0, 0, 0); - if (rt != NULL) { - if (rt_mask(rt)) - fle->f.src_mask = bitcount32(((struct sockaddr_in *) - rt_mask(rt))->sin_addr.s_addr); - else if (rt->rt_flags & RTF_HOST) - /* Give up. We can't determine mask :( */ - fle->f.src_mask = 32; + if ((flags & NG_NETFLOW_CONF_NOSRCLOOKUP) == 0) { + bzero(&sin, sizeof(sin)); + sin.sin_len = sizeof(struct sockaddr_in); + sin.sin_family = AF_INET; + sin.sin_addr = fle->f.r.r_src; + rt = rtalloc1_fib((struct sockaddr *)&sin, 0, 0, r->fib); + if (rt != NULL) { + if (rt_mask(rt)) + fle->f.src_mask = bitcount32(((struct sockaddr_in *) + rt_mask(rt))->sin_addr.s_addr); + else if (rt->rt_flags & RTF_HOST) + /* Give up. We can't determine mask :( */ + fle->f.src_mask = 32; - RTFREE_LOCKED(rt); + RTFREE_LOCKED(rt); + } } /* Push new flow at the and of hash. */ @@ -314,40 +408,186 @@ hash_insert(priv_p priv, struct flow_has return (0); } +#ifdef INET6 +/* XXX: make normal function, instead of.. */ +#define ipv6_masklen(x) bitcount32((x).__u6_addr.__u6_addr32[0]) + \ + bitcount32((x).__u6_addr.__u6_addr32[1]) + \ + bitcount32((x).__u6_addr.__u6_addr32[2]) + \ + bitcount32((x).__u6_addr.__u6_addr32[3]) +#define RT_MASK6(x) (ipv6_masklen(((struct sockaddr_in6 *)rt_mask(x))->sin6_addr)) +static int +hash6_insert(priv_p priv, struct flow_hash_entry *hsh6, struct flow6_rec *r, + int plen, uint8_t flags, uint8_t tcp_flags) +{ + struct flow6_entry *fle6; + struct sockaddr_in6 *src, *dst; + struct rtentry *rt; + struct route_in6 rin6; + + mtx_assert(&hsh6->mtx, MA_OWNED); + + fle6 = uma_zalloc_arg(priv->zone6, priv, M_NOWAIT); + if (fle6 == NULL) { + atomic_add_32(&priv->info.nfinfo_alloc_failed, 1); + return (ENOMEM); + } + + /* + * Now fle is totally ours. It is detached from all lists, + * we can safely edit it. + */ + + fle6->f.version = IP6VERSION; + bcopy(r, &fle6->f.r, sizeof(struct flow6_rec)); + fle6->f.bytes = plen; + fle6->f.packets = 1; + fle6->f.tcp_flags = tcp_flags; + + fle6->f.first = fle6->f.last = time_uptime; + + /* + * First we do route table lookup on destination address. So we can + * fill in out_ifx, dst_mask, nexthop, and dst_as in future releases. + */ + if ((flags & NG_NETFLOW_CONF_NODSTLOOKUP) == 0) + { + bzero(&rin6, sizeof(struct route_in6)); + dst = (struct sockaddr_in6 *)&rin6.ro_dst; + dst->sin6_len = sizeof(struct sockaddr_in6); + dst->sin6_family = AF_INET6; + dst->sin6_addr = r->dst.r_dst6; + + rin6.ro_rt = rtalloc1_fib((struct sockaddr *)dst, 0, 0, r->fib); + + if (rin6.ro_rt != NULL) { + rt = rin6.ro_rt; + fle6->f.fle_o_ifx = rt->rt_ifp->if_index; + + if (rt->rt_flags & RTF_GATEWAY && + rt->rt_gateway->sa_family == AF_INET6) + fle6->f.n.next_hop6 = + ((struct sockaddr_in6 *)(rt->rt_gateway))->sin6_addr; + + if (rt_mask(rt)) + fle6->f.dst_mask = RT_MASK6(rt); + else + fle6->f.dst_mask = 128; + + RTFREE_LOCKED(rt); + } + } + + if ((flags & NG_NETFLOW_CONF_NODSTLOOKUP) == 0) + { + /* Do route lookup on source address, to fill in src_mask. */ + bzero(&rin6, sizeof(struct route_in6)); + src = (struct sockaddr_in6 *)&rin6.ro_dst; + src->sin6_len = sizeof(struct sockaddr_in6); + src->sin6_family = AF_INET6; + src->sin6_addr = r->src.r_src6; + + rin6.ro_rt = rtalloc1_fib((struct sockaddr *)src, 0, 0, r->fib); + + if (rin6.ro_rt != NULL) { + rt = rin6.ro_rt; + + if (rt_mask(rt)) + fle6->f.src_mask = RT_MASK6(rt); + else + fle6->f.src_mask = 128; + + RTFREE_LOCKED(rt); + } + } + + /* Push new flow at the and of hash. */ + TAILQ_INSERT_TAIL(&hsh6->head, (struct flow_entry *)fle6, fle_hash); + + return (0); +} +#undef ipv6_masklen +#undef RT_MASK6 +#endif + /* * Non-static functions called from ng_netflow.c */ /* Allocate memory and set up flow cache */ -int +void ng_netflow_cache_init(priv_p priv) { - struct flow_hash_entry *hsh; + struct flow_hash_entry *hsh; int i; /* Initialize cache UMA zone. */ - priv->zone = uma_zcreate("NetFlow cache", sizeof(struct flow_entry), + priv->zone = uma_zcreate("NetFlow IPv4 cache", sizeof(struct flow_entry), uma_ctor_flow, uma_dtor_flow, NULL, NULL, UMA_ALIGN_CACHE, 0); uma_zone_set_max(priv->zone, CACHESIZE); +#ifdef INET6 + priv->zone6 = uma_zcreate("NetFlow IPv6 cache", sizeof(struct flow6_entry), + uma_ctor_flow6, uma_dtor_flow6, NULL, NULL, UMA_ALIGN_CACHE, 0); + uma_zone_set_max(priv->zone6, CACHESIZE); +#endif /* Allocate hash. */ priv->hash = malloc(NBUCKETS * sizeof(struct flow_hash_entry), M_NETFLOW_HASH, M_WAITOK | M_ZERO); - if (priv->hash == NULL) { - uma_zdestroy(priv->zone); - return (ENOMEM); + /* Initialize hash. */ + for (i = 0, hsh = priv->hash; i < NBUCKETS; i++, hsh++) { + mtx_init(&hsh->mtx, "hash mutex", NULL, MTX_DEF); + TAILQ_INIT(&hsh->head); } +#ifdef INET6 + /* Allocate hash. */ + priv->hash6 = malloc(NBUCKETS * sizeof(struct flow_hash_entry), + M_NETFLOW_HASH, M_WAITOK | M_ZERO); + /* Initialize hash. */ - for (i = 0, hsh = priv->hash; i < NBUCKETS; i++, hsh++) { + for (i = 0, hsh = priv->hash6; i < NBUCKETS; i++, hsh++) { mtx_init(&hsh->mtx, "hash mutex", NULL, MTX_DEF); TAILQ_INIT(&hsh->head); } +#endif - mtx_init(&priv->export_mtx, "export dgram lock", NULL, MTX_DEF); + ng_netflow_v9_cache_init(priv); + CTR0(KTR_NET, "ng_netflow startup()"); +} +/* Initialize new FIB table for v5 and v9 */ +int +ng_netflow_fib_init(priv_p priv, int fib) +{ + fib_export_p fe = priv_to_fib(priv, fib); + + CTR1(KTR_NET, "ng_netflow(): fib init: %d", fib); + + if (fe != NULL) + return (0); + + if ((fe = malloc(sizeof(struct fib_export), M_NETGRAPH, M_NOWAIT | M_ZERO)) == NULL) + return (1); + + mtx_init(&fe->export_mtx, "export dgram lock", NULL, MTX_DEF); + mtx_init(&fe->export9_mtx, "export9 dgram lock", NULL, MTX_DEF); + fe->fib = fib; + fe->domain_id = fib; + + if (atomic_cmpset_ptr((volatile uintptr_t *)&priv->fib_data[fib], (uintptr_t)NULL, (uintptr_t)fe) == 0) { + /* FIB already set up by other ISR */ + CTR3(KTR_NET, "ng_netflow(): fib init: %d setup %p but got %p", fib, fe, priv_to_fib(priv, fib)); + mtx_destroy(&fe->export_mtx); + mtx_destroy(&fe->export9_mtx); + free(fe, M_NETGRAPH); + } else { + /* Increase counter for statistics */ + CTR3(KTR_NET, "ng_netflow(): fib %d setup to %p (%p)", fib, fe, priv_to_fib(priv, fib)); + atomic_fetchadd_32(&priv->info.nfinfo_alloc_fibs, 1); + } + return (0); } @@ -357,9 +597,12 @@ ng_netflow_cache_flush(priv_p priv) { struct flow_entry *fle, *fle1; struct flow_hash_entry *hsh; - item_p item = NULL; + struct netflow_export_item exp; + fib_export_p fe; int i; + bzero(&exp, sizeof(exp)); + /* * We are going to free probably billable data. * Expire everything before freeing it. @@ -368,36 +611,67 @@ ng_netflow_cache_flush(priv_p priv) for (hsh = priv->hash, i = 0; i < NBUCKETS; hsh++, i++) TAILQ_FOREACH_SAFE(fle, &hsh->head, fle_hash, fle1) { TAILQ_REMOVE(&hsh->head, fle, fle_hash); - expire_flow(priv, &item, fle, NG_QUEUE); + fe = priv_to_fib(priv, fle->f.r.fib); + expire_flow(priv, fe, fle, NG_QUEUE); } - - if (item != NULL) - export_send(priv, item, NG_QUEUE); +#ifdef INET6 + for (hsh = priv->hash6, i = 0; i < NBUCKETS; hsh++, i++) + TAILQ_FOREACH_SAFE(fle, &hsh->head, fle_hash, fle1) { + TAILQ_REMOVE(&hsh->head, fle, fle_hash); + fe = priv_to_fib(priv, fle->f.r.fib); + expire_flow(priv, fe, fle, NG_QUEUE); + } +#endif uma_zdestroy(priv->zone); - /* Destroy hash mutexes. */ for (i = 0, hsh = priv->hash; i < NBUCKETS; i++, hsh++) mtx_destroy(&hsh->mtx); /* Free hash memory. */ - if (priv->hash) + if (priv->hash != NULL) free(priv->hash, M_NETFLOW_HASH); +#ifdef INET6 + uma_zdestroy(priv->zone6); + /* Destroy hash mutexes. */ + for (i = 0, hsh = priv->hash6; i < NBUCKETS; i++, hsh++) + mtx_destroy(&hsh->mtx); + + /* Free hash memory. */ + if (priv->hash6 != NULL) + free(priv->hash6, M_NETFLOW_HASH); +#endif + + for (i = 0; i < priv->maxfibs; i++) { + if ((fe = priv_to_fib(priv, i)) == NULL) + continue; + + if (fe->exp.item != NULL) + export_send(priv, fe, fe->exp.item, NG_QUEUE); - mtx_destroy(&priv->export_mtx); + if (fe->exp.item9 != NULL) + export9_send(priv, fe, fe->exp.item9, fe->exp.item9_opt, NG_QUEUE); + + mtx_destroy(&fe->export_mtx); + mtx_destroy(&fe->export9_mtx); + free(fe, M_NETGRAPH); + } + + ng_netflow_v9_cache_flush(priv); } /* Insert packet from into flow cache. */ int -ng_netflow_flow_add(priv_p priv, struct ip *ip, unsigned int src_if_index) +ng_netflow_flow_add(priv_p priv, fib_export_p fe, struct ip *ip, caddr_t upper_ptr, uint8_t upper_proto, + uint8_t flags, unsigned int src_if_index) { register struct flow_entry *fle, *fle1; - struct flow_hash_entry *hsh; + struct flow_hash_entry *hsh; struct flow_rec r; - item_p item = NULL; int hlen, plen; int error = 0; uint8_t tcp_flags = 0; + uint16_t eproto; /* Try to fill flow_rec r */ bzero(&r, sizeof(r)); @@ -411,8 +685,13 @@ ng_netflow_flow_add(priv_p priv, struct if (hlen < sizeof(struct ip)) return (EINVAL); + eproto = ETHERTYPE_IP; + /* Assume L4 template by default */ + r.flow_type = NETFLOW_V9_FLOW_V4_L4; + r.r_src = ip->ip_src; r.r_dst = ip->ip_dst; + r.fib = fe->fib; /* save packet length */ plen = ntohs(ip->ip_len); @@ -448,8 +727,8 @@ ng_netflow_flow_add(priv_p priv, struct break; } - /* Update node statistics. XXX: race... */ - priv->info.nfinfo_packets ++; + atomic_fetchadd_32(&priv->info.nfinfo_packets, 1); + /* XXX: atomic */ priv->info.nfinfo_bytes += plen; /* Find hash slot. */ @@ -468,7 +747,7 @@ ng_netflow_flow_add(priv_p priv, struct break; if ((INACTIVE(fle) && SMALL(fle)) || AGED(fle)) { TAILQ_REMOVE(&hsh->head, fle, fle_hash); - expire_flow(priv, &item, fle, NG_QUEUE); + expire_flow(priv, priv_to_fib(priv, fle->f.r.fib), fle, NG_QUEUE); atomic_add_32(&priv->info.nfinfo_act_exp, 1); } } @@ -487,9 +766,9 @@ ng_netflow_flow_add(priv_p priv, struct * - it is going to overflow counter */ if (tcp_flags & TH_FIN || tcp_flags & TH_RST || AGED(fle) || - (fle->f.bytes >= (UINT_MAX - IF_MAXMTU)) ) { + (fle->f.bytes >= (CNTR_MAX - IF_MAXMTU)) ) { TAILQ_REMOVE(&hsh->head, fle, fle_hash); - expire_flow(priv, &item, fle, NG_QUEUE); + expire_flow(priv, priv_to_fib(priv, fle->f.r.fib), fle, NG_QUEUE); atomic_add_32(&priv->info.nfinfo_act_exp, 1); } else { /* @@ -503,15 +782,139 @@ ng_netflow_flow_add(priv_p priv, struct } } } else /* A new flow entry. */ - error = hash_insert(priv, hsh, &r, plen, tcp_flags); + error = hash_insert(priv, hsh, &r, plen, flags, tcp_flags); mtx_unlock(&hsh->mtx); - if (item != NULL) - return_export_dgram(priv, item, NG_QUEUE); + return (error); +} + +#ifdef INET6 +/* Insert IPv6 packet from into flow cache. */ +int +ng_netflow_flow6_add(priv_p priv, fib_export_p fe, struct ip6_hdr *ip6, caddr_t upper_ptr, uint8_t upper_proto, + uint8_t flags, unsigned int src_if_index) +{ + register struct flow_entry *fle = NULL, *fle1; + register struct flow6_entry *fle6; + struct flow_hash_entry *hsh; + struct flow6_rec r; + int plen; + int error = 0; + uint8_t tcp_flags = 0; + + /* check version */ + if ((ip6->ip6_vfc & IPV6_VERSION_MASK) != IPV6_VERSION) + return (EINVAL); + + bzero(&r, sizeof(r)); + + r.src.r_src6 = ip6->ip6_src; + r.dst.r_dst6 = ip6->ip6_dst; + r.fib = fe->fib; + + /* Assume L4 template by default */ + r.flow_type = NETFLOW_V9_FLOW_V6_L4; + + /* save packet length */ + plen = ntohs(ip6->ip6_plen) + sizeof(struct ip6_hdr); + + /* XXX: set DSCP/CoS value */ +#if 0 + r.r_tos = ip->ip_tos; +#endif + if ((flags & NG_NETFLOW_IS_FRAG) == 0) { + switch(upper_proto) { + case IPPROTO_TCP: + { + register struct tcphdr *tcp; + + tcp = (struct tcphdr *)upper_ptr; + r.r_ports = *(uint32_t *)upper_ptr; + tcp_flags = tcp->th_flags; + break; + } + case IPPROTO_UDP: + case IPPROTO_SCTP: + { + r.r_ports = *(uint32_t *)upper_ptr; + break; + } + + } + } + + r.r_ip_p = upper_proto; + r.r_i_ifx = src_if_index; + + atomic_fetchadd_32(&priv->info.nfinfo_packets6, 1); + /* XXX: atomic */ + priv->info.nfinfo_bytes6 += plen; + + /* Find hash slot. */ + hsh = &priv->hash6[ip6_hash(&r)]; + + mtx_lock(&hsh->mtx); + + /* + * Go through hash and find our entry. If we encounter an + * entry, that should be expired, purge it. We do a reverse + * search since most active entries are first, and most + * searches are done on most active entries. + */ + TAILQ_FOREACH_REVERSE_SAFE(fle, &hsh->head, fhead, fle_hash, fle1) { + if (fle->f.version != IP6VERSION) + continue; + fle6 = (struct flow6_entry *)fle; + if (bcmp(&r, &fle6->f.r, sizeof(struct flow6_rec)) == 0) + break; + if ((INACTIVE(fle6) && SMALL(fle6)) || AGED(fle6)) { + TAILQ_REMOVE(&hsh->head, fle, fle_hash); + expire_flow(priv, priv_to_fib(priv, fle->f.r.fib), fle, + NG_QUEUE); + atomic_add_32(&priv->info.nfinfo_act_exp, 1); + } + } + + if (fle != NULL) { /* An existent entry. */ + fle6 = (struct flow6_entry *)fle; + + fle6->f.bytes += plen; + fle6->f.packets ++; + fle6->f.tcp_flags |= tcp_flags; + fle6->f.last = time_uptime; + + /* + * We have the following reasons to expire flow in active way: + * - it hit active timeout + * - a TCP connection closed + * - it is going to overflow counter + */ + if (tcp_flags & TH_FIN || tcp_flags & TH_RST || AGED(fle6) || + (fle6->f.bytes >= (CNTR_MAX - IF_MAXMTU)) ) { + TAILQ_REMOVE(&hsh->head, fle, fle_hash); + expire_flow(priv, priv_to_fib(priv, fle->f.r.fib), fle, + NG_QUEUE); + atomic_add_32(&priv->info.nfinfo_act_exp, 1); + } else { + /* + * It is the newest, move it to the tail, + * if it isn't there already. Next search will + * locate it quicker. + */ + if (fle != TAILQ_LAST(&hsh->head, fhead)) { + TAILQ_REMOVE(&hsh->head, fle, fle_hash); + TAILQ_INSERT_TAIL(&hsh->head, fle, fle_hash); + } + } + } else /* A new flow entry. */ + error = hash6_insert(priv, hsh, &r, plen, flags, tcp_flags); + + mtx_unlock(&hsh->mtx); return (error); } +#endif /* * Return records from cache to userland. @@ -519,67 +922,113 @@ ng_netflow_flow_add(priv_p priv, struct * TODO: matching particular IP should be done in kernel, here. */ int -ng_netflow_flow_show(priv_p priv, uint32_t last, struct ng_mesg *resp) +ng_netflow_flow_show(priv_p priv, struct ngnf_show_header *req, +struct ngnf_show_header *resp) { - struct flow_hash_entry *hsh; - struct flow_entry *fle; - struct ngnf_flows *data; - int i; + struct flow_hash_entry *hsh; + struct flow_entry *fle; + struct flow_entry_data *data = (struct flow_entry_data *)(resp + 1); +#ifdef INET6 + struct flow6_entry_data *data6 = (struct flow6_entry_data *)(resp + 1); +#endif + int i, max; - data = (struct ngnf_flows *)resp->data; - data->last = 0; - data->nentries = 0; - - /* Check if this is a first run */ - if (last == 0) { - hsh = priv->hash; - i = 0; - } else { - if (last > NBUCKETS-1) - return (EINVAL); - hsh = priv->hash + last; - i = last; - } + i = req->hash_id; + if (i > NBUCKETS-1) + return (EINVAL); + +#ifdef INET6 + if (req->version == 6) { + resp->version = 6; + hsh = priv->hash6 + i; + max = NREC6_AT_ONCE; + } else +#endif + if (req->version == 4) { + resp->version = 4; + hsh = priv->hash + i; + max = NREC_AT_ONCE; + } else + return (EINVAL); /* * We will transfer not more than NREC_AT_ONCE. More data * will come in next message. - * We send current hash index to userland, and userland should - * return it back to us. Then, we will restart with new entry. + * We send current hash index and current record number in list + * to userland, and userland should return it back to us. + * Then, we will restart with new entry. * - * The resulting cache snapshot is inaccurate for the - * following reasons: - * - we skip locked hash entries - * - we bail out, if someone wants our entry - * - we skip rest of entry, when hit NREC_AT_ONCE + * The resulting cache snapshot can be inaccurate if flow expiration + * is taking place on hash item between userland data requests for + * this hash item id. */ + resp->nentries = 0; for (; i < NBUCKETS; hsh++, i++) { - if (mtx_trylock(&hsh->mtx) == 0) - continue; + int list_id; + if (mtx_trylock(&hsh->mtx) == 0) { + /* + * Requested hash index is not available, + * relay decision to skip or re-request data + * to userland. + */ + resp->hash_id = i; + resp->list_id = 0; + return (0); + } + + list_id = 0; TAILQ_FOREACH(fle, &hsh->head, fle_hash) { - if (hsh->mtx.mtx_lock & MTX_CONTESTED) - break; + if (hsh->mtx.mtx_lock & MTX_CONTESTED) { + resp->hash_id = i; + resp->list_id = list_id; + mtx_unlock(&hsh->mtx); + return (0); + } + + list_id++; + /* Search for particular record in list. */ + if (req->list_id > 0) { + if (list_id < req->list_id) + continue; - bcopy(&fle->f, &(data->entries[data->nentries]), - sizeof(fle->f)); - data->nentries++; - if (data->nentries == NREC_AT_ONCE) { + /* Requested list position found. */ + req->list_id = 0; + } +#ifdef INET6 + if (req->version == 6) { + struct flow6_entry *fle6; + + fle6 = (struct flow6_entry *)fle; + bcopy(&fle6->f, data6 + resp->nentries, + sizeof(fle6->f)); + } else +#endif + bcopy(&fle->f, data + resp->nentries, + sizeof(fle->f)); + resp->nentries++; + if (resp->nentries == max) { *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable@FreeBSD.ORG Thu Jul 19 11:53:15 2012 Return-Path: Delivered-To: svn-src-stable@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8D69310656AD; Thu, 19 Jul 2012 11:53:15 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from cell.glebius.int.ru (glebius.int.ru [81.19.64.117]) by mx1.freebsd.org (Postfix) with ESMTP id E84678FC1C; Thu, 19 Jul 2012 11:53:14 +0000 (UTC) Received: from cell.glebius.int.ru (localhost [127.0.0.1]) by cell.glebius.int.ru (8.14.5/8.14.5) with ESMTP id q6JBrDFb086336; Thu, 19 Jul 2012 15:53:13 +0400 (MSK) (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by cell.glebius.int.ru (8.14.5/8.14.5/Submit) id q6JBrDqM086335; Thu, 19 Jul 2012 15:53:13 +0400 (MSK) (envelope-from glebius@FreeBSD.org) X-Authentication-Warning: cell.glebius.int.ru: glebius set sender to glebius@FreeBSD.org using -f Date: Thu, 19 Jul 2012 15:53:13 +0400 From: Gleb Smirnoff To: Ermal Lu?i Message-ID: <20120719115313.GB85230@FreeBSD.org> References: <201207181613.q6IGD4gZ087600@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=koi8-r Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-stable@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, svn-src-stable-9@FreeBSD.org Subject: Re: svn commit: r238600 - stable/9/sys/contrib/pf/net X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 Jul 2012 11:53:15 -0000 Ermal, On Thu, Jul 19, 2012 at 12:47:07PM +0200, Ermal Lu?i wrote: E> I would prefer to be in CC for this or at least asked! You could comment on this when original revisions were committed to head. Any problems with this particular merge? -- Totus tuus, Glebius. From owner-svn-src-stable@FreeBSD.ORG Thu Jul 19 13:00:32 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 60BD91065673; Thu, 19 Jul 2012 13:00:32 +0000 (UTC) (envelope-from melifaro@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 40BA68FC12; Thu, 19 Jul 2012 13:00:32 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6JD0Waj083284; Thu, 19 Jul 2012 13:00:32 GMT (envelope-from melifaro@svn.freebsd.org) Received: (from melifaro@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6JD0WTs083280; Thu, 19 Jul 2012 13:00:32 GMT (envelope-from melifaro@svn.freebsd.org) Message-Id: <201207191300.q6JD0WTs083280@svn.freebsd.org> From: "Alexander V. Chernikov" Date: Thu, 19 Jul 2012 13:00:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238620 - stable/8/usr.sbin/flowctl X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 Jul 2012 13:00:32 -0000 Author: melifaro Date: Thu Jul 19 13:00:31 2012 New Revision: 238620 URL: http://svn.freebsd.org/changeset/base/238620 Log: MFC r223788, r223790, r223824 236808 Merge netflow v9 support (user side) r223788 - Rewrite the flowctl utility to add it support for displaying both IPv4 and IPv4 flows. r223790 - Update manual page. Mention IPv6 support, .. r223824 - Conditionally compile in the IPv4/IPv6 address family support. r236808 - Add "human" option to print IPv4/IPv6 flows in human-readable format. Additionally, implement compatibility code for syntax changes introduced in r223788. Flowctl supports specifying node both as absolute path (new style) and as node name without colon (old style). No objection from: glebius Approved by: ae(mentor) Modified: stable/8/usr.sbin/flowctl/Makefile stable/8/usr.sbin/flowctl/flowctl.8 stable/8/usr.sbin/flowctl/flowctl.c Directory Properties: stable/8/usr.sbin/ (props changed) stable/8/usr.sbin/flowctl/ (props changed) Modified: stable/8/usr.sbin/flowctl/Makefile ============================================================================== --- stable/8/usr.sbin/flowctl/Makefile Thu Jul 19 11:43:31 2012 (r238619) +++ stable/8/usr.sbin/flowctl/Makefile Thu Jul 19 13:00:31 2012 (r238620) @@ -2,6 +2,8 @@ # $FreeBSD$ # +.include + PROG= flowctl MAN= flowctl.8 @@ -9,4 +11,11 @@ WARNS?= 2 DPADD= ${LIBNETGRAPH} LDADD= -lnetgraph +.if ${MK_INET6_SUPPORT} != "no" +CFLAGS+= -DINET6 +.endif +.if ${MK_INET_SUPPORT} != "no" +CFLAGS+= -DINET +.endif + .include Modified: stable/8/usr.sbin/flowctl/flowctl.8 ============================================================================== --- stable/8/usr.sbin/flowctl/flowctl.8 Thu Jul 19 11:43:31 2012 (r238619) +++ stable/8/usr.sbin/flowctl/flowctl.8 Thu Jul 19 13:00:31 2012 (r238620) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 23, 2005 +.Dd June 8, 2012 .Dt FLOWCTL 8 .Os .Sh NAME @@ -35,7 +35,7 @@ control utility .Sh SYNOPSIS .Nm .Op Fl d Ar level -.Ar node command +.Ar path command .Sh DESCRIPTION The .Nm @@ -56,16 +56,23 @@ Currently, supports only one command. .Pp .Bl -tag -width ".Cm show" -.It Cm show +.It Cm show Oo Cm ipv4|ipv6 Oc Op Cm human|verbose This command is the analog of the .Dq "show ip cache flow" command of a Cisco router. It dumps the contents of the flow cache in Cisco-like format. +Specifing either +.Cm ipv4 +or +.Cm ipv6 +would extract only IPv4 or IPv6 flows respectively. It has optional parameter .Cm verbose , which is analog of the .Dq "show ip cache verbose flow" -command. +command. Additionally, +.Cm human +parameter can be specify to show selected flows in human-readable format. .El .Sh EXIT STATUS .Ex -std Modified: stable/8/usr.sbin/flowctl/flowctl.c ============================================================================== --- stable/8/usr.sbin/flowctl/flowctl.c Thu Jul 19 11:43:31 2012 (r238619) +++ stable/8/usr.sbin/flowctl/flowctl.c Thu Jul 19 13:00:31 2012 (r238620) @@ -46,29 +46,61 @@ static const char rcs_id[] = #include #include #include +#include #include #include #include -#define CISCO_SH_FLOW_HEADER "SrcIf SrcIPaddress DstIf DstIPaddress Pr SrcP DstP Pkts\n" +#define CISCO_SH_FLOW_HEADER "SrcIf SrcIPaddress " \ +"DstIf DstIPaddress Pr SrcP DstP Pkts\n" #define CISCO_SH_FLOW "%-13s %-15s %-13s %-15s %2u %4.4x %4.4x %6lu\n" -#define CISCO_SH_VERB_FLOW_HEADER "SrcIf SrcIPaddress DstIf DstIPaddress Pr TOS Flgs Pkts\n" \ +/* human-readable IPv4 header */ +#define CISCO_SH_FLOW_HHEADER "SrcIf SrcIPaddress " \ +"DstIf DstIPaddress Proto SrcPort DstPort Pkts\n" +#define CISCO_SH_FLOW_H "%-13s %-15s %-13s %-15s %5u %8d %8d %8lu\n" + +#define CISCO_SH_FLOW6_HEADER "SrcIf SrcIPaddress " \ +"DstIf DstIPaddress Pr SrcP DstP Pkts\n" +#define CISCO_SH_FLOW6 "%-13s %-30s %-13s %-30s %2u %4.4x %4.4x %6lu\n" + +/* Human-readable IPv6 headers */ +#define CISCO_SH_FLOW6_HHEADER "SrcIf SrcIPaddress " \ +"DstIf DstIPaddress Proto SrcPort DstPort Pkts\n" +#define CISCO_SH_FLOW6_H "%-13s %-36s %-13s %-36s %5u %8d %8d %8lu\n" + +#define CISCO_SH_VERB_FLOW_HEADER "SrcIf SrcIPaddress " \ +"DstIf DstIPaddress Pr TOS Flgs Pkts\n" \ "Port Msk AS Port Msk AS NextHop B/Pk Active\n" #define CISCO_SH_VERB_FLOW "%-14s %-15s %-14s %-15s %2u %3x %4x %6lu\n" \ "%4.4x /%-2u %-5u %4.4x /%-2u %-5u %-15s %9u %8u\n\n" -static int flow_cache_print(struct ngnf_flows *recs); -static int flow_cache_print_verbose(struct ngnf_flows *recs); -static int ctl_show(int, char **); +#define CISCO_SH_VERB_FLOW6_HEADER "SrcIf SrcIPaddress " \ +"DstIf DstIPaddress Pr TOS Flgs Pkts\n" \ +"Port Msk AS Port Msk AS NextHop B/Pk Active\n" + +#define CISCO_SH_VERB_FLOW6 "%-14s %-30s %-14s %-30s %2u %3x %4x %6lu\n" \ + "%4.4x /%-2u %-5u %4.4x /%-2u %-5u %-30s %9u %8u\n\n" +#ifdef INET +static void flow_cache_print(struct ngnf_show_header *resp); +static void flow_cache_print_verbose(struct ngnf_show_header *resp); +#endif +#ifdef INET6 +static void flow_cache_print6(struct ngnf_show_header *resp); +static void flow_cache_print6_verbose(struct ngnf_show_header *resp); +#endif +static void ctl_show(int, char **); +#if defined(INET) || defined(INET6) +static void do_show(int, void (*func)(struct ngnf_show_header *)); +#endif static void help(void); static void execute_command(int, char **); struct ip_ctl_cmd { char *cmd_name; - int (*cmd_func)(int argc, char **argv); + void (*cmd_func)(int argc, char **argv); }; struct ip_ctl_cmd cmds[] = { @@ -76,8 +108,8 @@ struct ip_ctl_cmd cmds[] = { {NULL, NULL}, }; -int cs; -char ng_nodename[NG_PATHSIZ]; +int cs, human = 0; +char *ng_path, ng_nodename[NG_PATHSIZ]; int main(int argc, char **argv) @@ -85,7 +117,6 @@ main(int argc, char **argv) int c; char sname[NG_NODESIZ]; int rcvbuf = SORCVBUF_SIZE; - char *ng_name; /* parse options */ while ((c = getopt(argc, argv, "d:")) != -1) { @@ -98,14 +129,26 @@ main(int argc, char **argv) argc -= optind; argv += optind; - ng_name = argv[0]; - if (ng_name == NULL) + ng_path = argv[0]; + if (ng_path == NULL || (strlen(ng_path) > NG_PATHSIZ)) help(); + + /* + * Compatibility check: + * If ng_path contains ':' we assume absolute path (new style) + * e.g. ( '.:', '[3f]:', 'foo:' or 'foo:hook1[.hook2][.hook3]' ) + * otherwise assume old style (node name) + */ + + if (strchr(ng_path, ':') == NULL) { + /* Old style, convert to absolute path */ + snprintf(ng_nodename, sizeof(ng_nodename), "%s:", ng_path); + ng_path = ng_nodename; + } + argc--; argv++; - snprintf(ng_nodename, sizeof(ng_nodename), "%s:", ng_name); - /* create control socket. */ snprintf(sname, sizeof(sname), "flowctl%i", getpid()); @@ -145,77 +188,116 @@ execute_command(int argc, char **argv) (*cmds[cindex].cmd_func)(argc, argv); } -static int +static void ctl_show(int argc, char **argv) { - struct ng_mesg *ng_mesg; - struct ngnf_flows *data; - char path[NG_PATHSIZ]; - int token, nread, last = 0; - int verbose = 0; + int ipv4, ipv6, verbose = 0; + + ipv4 = feature_present("inet"); + ipv6 = feature_present("inet6"); + + if (argc > 0 && !strncmp(argv[0], "ipv4", 4)) { + ipv6 = 0; + argc--; + argv++; + } + if (argc > 0 && !strncmp(argv[0], "ipv6", 4)) { + ipv4 = 0; + argc--; + argv++; + } if (argc > 0 && !strncmp(argv[0], "verbose", strlen(argv[0]))) verbose = 1; + if (argc > 0 && !strncmp(argv[0], "human", strlen(argv[0]))) + human = 1; + +#ifdef INET + if (ipv4) { + if (verbose) + do_show(4, &flow_cache_print_verbose); + else + do_show(4, &flow_cache_print); + } +#endif + +#ifdef INET6 + if (ipv6) { + if (verbose) + do_show(6, &flow_cache_print6_verbose); + else + do_show(6, &flow_cache_print6); + } +#endif +} + +#if defined(INET) || defined(INET6) +static void +do_show(int version, void (*func)(struct ngnf_show_header *)) +{ + struct ng_mesg *ng_mesg; + struct ngnf_show_header req, *resp; + int token, nread; + ng_mesg = alloca(SORCVBUF_SIZE); - if (verbose) - printf(CISCO_SH_VERB_FLOW_HEADER); - else - printf(CISCO_SH_FLOW_HEADER); + req.version = version; + req.hash_id = req.list_id = 0; for (;;) { /* request set of accounting records */ - token = NgSendMsg(cs, ng_nodename, NGM_NETFLOW_COOKIE, - NGM_NETFLOW_SHOW, (void *)&last, sizeof(last)); + token = NgSendMsg(cs, ng_path, NGM_NETFLOW_COOKIE, + NGM_NETFLOW_SHOW, (void *)&req, sizeof(req)); if (token == -1) err(1, "NgSendMsg(NGM_NETFLOW_SHOW)"); /* read reply */ - nread = NgRecvMsg(cs, ng_mesg, SORCVBUF_SIZE, path); + nread = NgRecvMsg(cs, ng_mesg, SORCVBUF_SIZE, NULL); if (nread == -1) err(1, "NgRecvMsg() failed"); if (ng_mesg->header.token != token) err(1, "NgRecvMsg(NGM_NETFLOW_SHOW): token mismatch"); - data = (struct ngnf_flows*)ng_mesg->data; - if ((ng_mesg->header.arglen < (sizeof(*data))) || - (ng_mesg->header.arglen < (sizeof(*data) + - (data->nentries * sizeof(struct flow_entry_data))))) + resp = (struct ngnf_show_header *)ng_mesg->data; + if ((ng_mesg->header.arglen < (sizeof(*resp))) || + (ng_mesg->header.arglen < (sizeof(*resp) + + (resp->nentries * sizeof(struct flow_entry_data))))) err(1, "NgRecvMsg(NGM_NETFLOW_SHOW): arglen too small"); - if (verbose) - (void )flow_cache_print_verbose(data); - else - (void )flow_cache_print(data); + (*func)(resp); - if (data->last != 0) - last = data->last; + if (resp->hash_id != 0) + req.hash_id = resp->hash_id; else break; + req.list_id = resp->list_id; } - - return (0); } +#endif -static int -flow_cache_print(struct ngnf_flows *recs) +#ifdef INET +static void +flow_cache_print(struct ngnf_show_header *resp) { struct flow_entry_data *fle; char src[INET_ADDRSTRLEN], dst[INET_ADDRSTRLEN]; char src_if[IFNAMSIZ], dst_if[IFNAMSIZ]; int i; - /* quick check */ - if (recs->nentries == 0) - return (0); + if (resp->version != 4) + errx(EX_SOFTWARE, "%s: version mismatch: %u", + __func__, resp->version); - fle = recs->entries; - for (i = 0; i < recs->nentries; i++, fle++) { + if (resp->nentries > 0) + printf(human ? CISCO_SH_FLOW_HHEADER : CISCO_SH_FLOW_HEADER); + + fle = (struct flow_entry_data *)(resp + 1); + for (i = 0; i < resp->nentries; i++, fle++) { inet_ntop(AF_INET, &fle->r.r_src, src, sizeof(src)); inet_ntop(AF_INET, &fle->r.r_dst, dst, sizeof(dst)); - printf(CISCO_SH_FLOW, + printf(human ? CISCO_SH_FLOW_H : CISCO_SH_FLOW, if_indextoname(fle->fle_i_ifx, src_if), src, if_indextoname(fle->fle_o_ifx, dst_if), @@ -226,24 +308,60 @@ flow_cache_print(struct ngnf_flows *recs fle->packets); } - - return (i); } +#endif + +#ifdef INET6 +static void +flow_cache_print6(struct ngnf_show_header *resp) +{ + struct flow6_entry_data *fle6; + char src6[INET6_ADDRSTRLEN], dst6[INET6_ADDRSTRLEN]; + char src_if[IFNAMSIZ], dst_if[IFNAMSIZ]; + int i; + + if (resp->version != 6) + errx(EX_SOFTWARE, "%s: version mismatch: %u", + __func__, resp->version); + + if (resp->nentries > 0) + printf(human ? CISCO_SH_FLOW6_HHEADER : CISCO_SH_FLOW6_HEADER); + + fle6 = (struct flow6_entry_data *)(resp + 1); + for (i = 0; i < resp->nentries; i++, fle6++) { + inet_ntop(AF_INET6, &fle6->r.src.r_src6, src6, sizeof(src6)); + inet_ntop(AF_INET6, &fle6->r.dst.r_dst6, dst6, sizeof(dst6)); + printf(human ? CISCO_SH_FLOW6_H : CISCO_SH_FLOW6, + if_indextoname(fle6->fle_i_ifx, src_if), + src6, + if_indextoname(fle6->fle_o_ifx, dst_if), + dst6, + fle6->r.r_ip_p, + ntohs(fle6->r.r_sport), + ntohs(fle6->r.r_dport), + fle6->packets); + + } +} +#endif -static int -flow_cache_print_verbose(struct ngnf_flows *recs) +#ifdef INET +static void +flow_cache_print_verbose(struct ngnf_show_header *resp) { struct flow_entry_data *fle; char src[INET_ADDRSTRLEN], dst[INET_ADDRSTRLEN], next[INET_ADDRSTRLEN]; char src_if[IFNAMSIZ], dst_if[IFNAMSIZ]; int i; - /* quick check */ - if (recs->nentries == 0) - return (0); + if (resp->version != 4) + errx(EX_SOFTWARE, "%s: version mismatch: %u", + __func__, resp->version); - fle = recs->entries; - for (i = 0; i < recs->nentries; i++, fle++) { + printf(CISCO_SH_VERB_FLOW_HEADER); + + fle = (struct flow_entry_data *)(resp + 1); + for (i = 0; i < resp->nentries; i++, fle++) { inet_ntop(AF_INET, &fle->r.r_src, src, sizeof(src)); inet_ntop(AF_INET, &fle->r.r_dst, dst, sizeof(dst)); inet_ntop(AF_INET, &fle->next_hop, next, sizeof(next)); @@ -267,9 +385,50 @@ flow_cache_print_verbose(struct ngnf_flo 0); } - - return (i); } +#endif + +#ifdef INET6 +static void +flow_cache_print6_verbose(struct ngnf_show_header *resp) +{ + struct flow6_entry_data *fle6; + char src6[INET6_ADDRSTRLEN], dst6[INET6_ADDRSTRLEN], next6[INET6_ADDRSTRLEN]; + char src_if[IFNAMSIZ], dst_if[IFNAMSIZ]; + int i; + + if (resp->version != 6) + errx(EX_SOFTWARE, "%s: version mismatch: %u", + __func__, resp->version); + + printf(CISCO_SH_VERB_FLOW6_HEADER); + + fle6 = (struct flow6_entry_data *)(resp + 1); + for (i = 0; i < resp->nentries; i++, fle6++) { + inet_ntop(AF_INET6, &fle6->r.src.r_src6, src6, sizeof(src6)); + inet_ntop(AF_INET6, &fle6->r.dst.r_dst6, dst6, sizeof(dst6)); + inet_ntop(AF_INET6, &fle6->n.next_hop6, next6, sizeof(next6)); + printf(CISCO_SH_VERB_FLOW6, + if_indextoname(fle6->fle_i_ifx, src_if), + src6, + if_indextoname(fle6->fle_o_ifx, dst_if), + dst6, + fle6->r.r_ip_p, + fle6->r.r_tos, + fle6->tcp_flags, + fle6->packets, + ntohs(fle6->r.r_sport), + fle6->src_mask, + 0, + ntohs(fle6->r.r_dport), + fle6->dst_mask, + 0, + next6, + (u_int)(fle6->bytes / fle6->packets), + 0); + } +} +#endif static void help(void) From owner-svn-src-stable@FreeBSD.ORG Thu Jul 19 13:45:15 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx2.freebsd.org (mx2.freebsd.org [IPv6:2001:4f8:fff6::35]) by hub.freebsd.org (Postfix) with ESMTP id 940B5106566B; Thu, 19 Jul 2012 13:45:15 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from opti.dougb.net (hub.freebsd.org [IPv6:2001:4f8:fff6::36]) by mx2.freebsd.org (Postfix) with ESMTP id 9C718155DB2; Thu, 19 Jul 2012 13:44:54 +0000 (UTC) Message-ID: <50080F56.1080307@FreeBSD.org> Date: Thu, 19 Jul 2012 06:44:54 -0700 From: Doug Barton Organization: http://SupersetSolutions.com/ User-Agent: Mozilla/5.0 (X11; FreeBSD i386; rv:13.0) Gecko/20120624 Thunderbird/13.0.1 MIME-Version: 1.0 To: "Alexander V. Chernikov" References: <201207191300.q6JD0WTs083280@svn.freebsd.org> In-Reply-To: <201207191300.q6JD0WTs083280@svn.freebsd.org> X-Enigmail-Version: 1.4.2 OpenPGP: id=1A1ABC84 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: svn-src-stable@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, svn-src-stable-8@freebsd.org Subject: Re: svn commit: r238620 - stable/8/usr.sbin/flowctl X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 Jul 2012 13:45:15 -0000 On 07/19/2012 06:00, Alexander V. Chernikov wrote: > Author: melifaro > Date: Thu Jul 19 13:00:31 2012 > New Revision: 238620 > URL: http://svn.freebsd.org/changeset/base/238620 > > Log: > MFC r223788, r223790, r223824 236808 > > Merge netflow v9 support (user side) Seems to have broken the build. Did you 'make universe' these changes? Doug -- Change is hard. From owner-svn-src-stable@FreeBSD.ORG Thu Jul 19 13:56:20 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx2.freebsd.org (mx2.freebsd.org [IPv6:2001:4f8:fff6::35]) by hub.freebsd.org (Postfix) with ESMTP id D4BFD106566C; Thu, 19 Jul 2012 13:56:20 +0000 (UTC) (envelope-from melifaro@FreeBSD.org) Received: from dhcp170-36-red.yandex.net (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx2.freebsd.org (Postfix) with ESMTP id AC74E14E482; Thu, 19 Jul 2012 13:56:18 +0000 (UTC) Message-ID: <50081192.50909@FreeBSD.org> Date: Thu, 19 Jul 2012 17:54:26 +0400 From: "Alexander V. Chernikov" User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:12.0) Gecko/20120511 Thunderbird/12.0.1 MIME-Version: 1.0 To: Doug Barton References: <201207191300.q6JD0WTs083280@svn.freebsd.org> <50080F56.1080307@FreeBSD.org> In-Reply-To: <50080F56.1080307@FreeBSD.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: svn-src-stable@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, svn-src-stable-8@freebsd.org Subject: Re: svn commit: r238620 - stable/8/usr.sbin/flowctl X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 Jul 2012 13:56:21 -0000 On 19.07.2012 17:44, Doug Barton wrote: > On 07/19/2012 06:00, Alexander V. Chernikov wrote: >> Author: melifaro >> Date: Thu Jul 19 13:00:31 2012 >> New Revision: 238620 >> URL: http://svn.freebsd.org/changeset/base/238620 >> >> Log: >> MFC r223788, r223790, r223824 236808 >> >> Merge netflow v9 support (user side) > > Seems to have broken the build. Did you 'make universe' these changes? New flowctl requires updated netflow headers introduced in r238619. 'cp -p /usr/src/sys/netgraph/netflow/*.h /usr/include/netgraph/netflow' should help. Can you please show exact error messages and arch ? > > Doug > -- WBR, Alexander From owner-svn-src-stable@FreeBSD.ORG Thu Jul 19 14:08:41 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx2.freebsd.org (mx2.freebsd.org [69.147.83.53]) by hub.freebsd.org (Postfix) with ESMTP id D57FA106566B; Thu, 19 Jul 2012 14:08:41 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from opti.dougb.net (hub.freebsd.org [IPv6:2001:4f8:fff6::36]) by mx2.freebsd.org (Postfix) with ESMTP id 591E4155AA9; Thu, 19 Jul 2012 14:08:41 +0000 (UTC) Message-ID: <500814E8.6070107@FreeBSD.org> Date: Thu, 19 Jul 2012 07:08:40 -0700 From: Doug Barton Organization: http://SupersetSolutions.com/ User-Agent: Mozilla/5.0 (X11; FreeBSD i386; rv:13.0) Gecko/20120624 Thunderbird/13.0.1 MIME-Version: 1.0 To: "Alexander V. Chernikov" References: <201207191300.q6JD0WTs083280@svn.freebsd.org> <50080F56.1080307@FreeBSD.org> <50081192.50909@FreeBSD.org> In-Reply-To: <50081192.50909@FreeBSD.org> X-Enigmail-Version: 1.4.2 OpenPGP: id=1A1ABC84 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: svn-src-stable@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, ae@freebsd.org Subject: Re: svn commit: r238620 - stable/8/usr.sbin/flowctl X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 Jul 2012 14:08:42 -0000 On 07/19/2012 06:54, Alexander V. Chernikov wrote: > On 19.07.2012 17:44, Doug Barton wrote: >> On 07/19/2012 06:00, Alexander V. Chernikov wrote: >>> Author: melifaro >>> Date: Thu Jul 19 13:00:31 2012 >>> New Revision: 238620 >>> URL: http://svn.freebsd.org/changeset/base/238620 >>> >>> Log: >>> MFC r223788, r223790, r223824 236808 >>> >>> Merge netflow v9 support (user side) >> >> Seems to have broken the build. Did you 'make universe' these changes? > New flowctl requires updated netflow headers introduced in r238619. > 'cp -p /usr/src/sys/netgraph/netflow/*.h /usr/include/netgraph/netflow' > should help. So it sounds like the answer to my question is, "No," you did not do a 'make universe'? If so, can you please start one? > Can you please show exact error messages and arch ? You can see for yourself in the freebsd-stable archives, as the tinderboxes have been failing ever since your commit. Doug -- Change is hard. From owner-svn-src-stable@FreeBSD.ORG Thu Jul 19 15:26:44 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 189901065675 for ; Thu, 19 Jul 2012 15:26:44 +0000 (UTC) (envelope-from jhellenthal@dataix.net) Received: from mail-yw0-f54.google.com (mail-yw0-f54.google.com [209.85.213.54]) by mx1.freebsd.org (Postfix) with ESMTP id ADE9F8FC1B for ; Thu, 19 Jul 2012 15:26:43 +0000 (UTC) Received: by yhfs35 with SMTP id s35so3431405yhf.13 for ; Thu, 19 Jul 2012 08:26:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dataix.net; s=rsa; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to; bh=g1SKMN/Rb9rfB2Hnoqo5tPudVYg8l/5Q3i8iGd671rU=; b=DlyhijUbFCYlRWvwfg1WGcrwi3/9+WWuNcQChntzpB90eoeOlfo5BO+sfdkDXd5wTl T+772CAKy2kBBfiOV0u7WxyjpcrGqGJFX3hpDI7A+RRTphz7uU89Xu2MmkvRb+QFjmHg 7BJKf7as99CeoC5VMZz6nINpvlTa30IXmKMmY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:x-gm-message-state; bh=g1SKMN/Rb9rfB2Hnoqo5tPudVYg8l/5Q3i8iGd671rU=; b=ZGtaSj3Ok4Vlq5PMlzwfbrRYsUbdvRUE+kMFK38IiqfJ9KGqTyv9osqnGzUdFbgSRw t8dApLPUhKWAdcdYgL51gZK7aSAryvj7Grv9kShoz8DNiV5+9TXrQoYWBn+GDJntzGTM AzACiT/EaJNGid1Z4sXb0oiF8vHcJMQF6nY7we42NObNCmy4co3gPKQqGMJl8JeFdEJE upW+4D2IZb8csGtPfYeo000tVloleq8c89MOS273tE+iExHB6ipMlwUpBZ/J27gnhUSi arY03dV1veNsbtBuAvUi2O/R4x97aAa9d8mK3pM98G47+j6CTFeeugNXmjH6M6zMPFBl xvzg== Received: by 10.50.189.135 with SMTP id gi7mr5744710igc.8.1342711603027; Thu, 19 Jul 2012 08:26:43 -0700 (PDT) Received: from DataIX.net (adsl-99-181-146-179.dsl.klmzmi.sbcglobal.net. [99.181.146.179]) by mx.google.com with ESMTPS id mj5sm4502603igc.8.2012.07.19.08.26.41 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 19 Jul 2012 08:26:42 -0700 (PDT) Received: from DataIX.net (localhost [127.0.0.1]) by DataIX.net (8.14.5/8.14.5) with ESMTP id q6JFQdtV096509 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 19 Jul 2012 11:26:39 -0400 (EDT) (envelope-from jhellenthal@DataIX.net) Received: (from jh@localhost) by DataIX.net (8.14.5/8.14.5/Submit) id q6JFQdkt096508; Thu, 19 Jul 2012 11:26:39 -0400 (EDT) (envelope-from jhellenthal@DataIX.net) Date: Thu, 19 Jul 2012 11:26:39 -0400 From: Jason Hellenthal To: "Alexander V. Chernikov" Message-ID: <20120719152639.GA95444@DataIX.net> References: <201207191300.q6JD0WTs083280@svn.freebsd.org> <50080F56.1080307@FreeBSD.org> <50081192.50909@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <50081192.50909@FreeBSD.org> X-Gm-Message-State: ALoCoQmM6vOen9cI1m/Gm4UIkMKAHvkuevehjoh8mpXZswo6oYXMXbBsbGELMntKLhJsSViFdpf+ Cc: svn-src-stable@freebsd.org, svn-src-all@freebsd.org, Doug Barton , src-committers@freebsd.org, svn-src-stable-8@freebsd.org Subject: Re: svn commit: r238620 - stable/8/usr.sbin/flowctl X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 Jul 2012 15:26:44 -0000 On Thu, Jul 19, 2012 at 05:54:26PM +0400, Alexander V. Chernikov wrote: > On 19.07.2012 17:44, Doug Barton wrote: > > On 07/19/2012 06:00, Alexander V. Chernikov wrote: > >> Author: melifaro > >> Date: Thu Jul 19 13:00:31 2012 > >> New Revision: 238620 > >> URL: http://svn.freebsd.org/changeset/base/238620 > >> > >> Log: > >> MFC r223788, r223790, r223824 236808 > >> > >> Merge netflow v9 support (user side) > > > > Seems to have broken the build. Did you 'make universe' these changes? > New flowctl requires updated netflow headers introduced in r238619. > 'cp -p /usr/src/sys/netgraph/netflow/*.h /usr/include/netgraph/netflow' > should help. > > Can you please show exact error messages and arch ? > > > > > Doug > > > Rebuild of includes is neccesary or else a full rebuild of world. > > -- > WBR, Alexander > _______________________________________________ > svn-src-stable-8@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/svn-src-stable-8 > To unsubscribe, send any mail to "svn-src-stable-8-unsubscribe@freebsd.org" -- - (2^(N-1)) JJH48-ARIN From owner-svn-src-stable@FreeBSD.ORG Thu Jul 19 15:56:43 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx2.freebsd.org (mx2.freebsd.org [IPv6:2001:4f8:fff6::35]) by hub.freebsd.org (Postfix) with ESMTP id 4682D106566B; Thu, 19 Jul 2012 15:56:43 +0000 (UTC) (envelope-from melifaro@FreeBSD.org) Received: from dhcp170-36-red.yandex.net (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx2.freebsd.org (Postfix) with ESMTP id 5E6691523BD; Thu, 19 Jul 2012 15:56:40 +0000 (UTC) Message-ID: <50082DC7.9060805@FreeBSD.org> Date: Thu, 19 Jul 2012 19:54:47 +0400 From: "Alexander V. Chernikov" User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:12.0) Gecko/20120511 Thunderbird/12.0.1 MIME-Version: 1.0 To: Doug Barton References: <201207191300.q6JD0WTs083280@svn.freebsd.org> <50080F56.1080307@FreeBSD.org> <50081192.50909@FreeBSD.org> <500814E8.6070107@FreeBSD.org> In-Reply-To: <500814E8.6070107@FreeBSD.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: svn-src-stable@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, ae@freebsd.org Subject: Re: svn commit: r238620 - stable/8/usr.sbin/flowctl X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 Jul 2012 15:56:43 -0000 On 19.07.2012 18:08, Doug Barton wrote: > On 07/19/2012 06:54, Alexander V. Chernikov wrote: >> On 19.07.2012 17:44, Doug Barton wrote: >>> On 07/19/2012 06:00, Alexander V. Chernikov wrote: >>>> Author: melifaro >>>> Date: Thu Jul 19 13:00:31 2012 >>>> New Revision: 238620 >>>> URL: http://svn.freebsd.org/changeset/base/238620 >>>> >>>> Log: >>>> MFC r223788, r223790, r223824 236808 >>>> >>>> Merge netflow v9 support (user side) >>> >>> Seems to have broken the build. Did you 'make universe' these changes? >> New flowctl requires updated netflow headers introduced in r238619. >> 'cp -p /usr/src/sys/netgraph/netflow/*.h /usr/include/netgraph/netflow' >> should help. > > So it sounds like the answer to my question is, "No," you did not do a I've tested this on amd64/i386 with various kernel configs. Additionally, I run the same patches in production on several routers. > 'make universe'? If so, can you please start one? It runs fine. > >> Can you please show exact error messages and arch ? > > You can see for yourself in the freebsd-stable archives, as the > tinderboxes have been failing ever since your commit. This is the result of 1+ hour gap between r238619 and r238620. Tinderbox tries to build old flowctl binary. > > Doug > -- WBR, Alexander From owner-svn-src-stable@FreeBSD.ORG Thu Jul 19 19:02:33 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx2.freebsd.org (mx2.freebsd.org [IPv6:2001:4f8:fff6::35]) by hub.freebsd.org (Postfix) with ESMTP id 97F98106566B; Thu, 19 Jul 2012 19:02:33 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from opti.dougb.net (hub.freebsd.org [IPv6:2001:4f8:fff6::36]) by mx2.freebsd.org (Postfix) with ESMTP id AABAF14DBF5; Thu, 19 Jul 2012 19:02:32 +0000 (UTC) Message-ID: <500859C8.6080808@FreeBSD.org> Date: Thu, 19 Jul 2012 12:02:32 -0700 From: Doug Barton Organization: http://SupersetSolutions.com/ User-Agent: Mozilla/5.0 (X11; FreeBSD i386; rv:13.0) Gecko/20120624 Thunderbird/13.0.1 MIME-Version: 1.0 To: "Alexander V. Chernikov" References: <201207191300.q6JD0WTs083280@svn.freebsd.org> <50080F56.1080307@FreeBSD.org> <50081192.50909@FreeBSD.org> <500814E8.6070107@FreeBSD.org> <50082DC7.9060805@FreeBSD.org> In-Reply-To: <50082DC7.9060805@FreeBSD.org> X-Enigmail-Version: 1.4.2 OpenPGP: id=1A1ABC84 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: svn-src-stable@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, ae@freebsd.org Subject: Re: svn commit: r238620 - stable/8/usr.sbin/flowctl X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 Jul 2012 19:02:33 -0000 On 07/19/2012 08:54, Alexander V. Chernikov wrote: >> You can see for yourself in the freebsd-stable archives, as the >> tinderboxes have been failing ever since your commit. > This is the result of 1+ hour gap between r238619 and r238620. Tinderbox > tries to build old flowctl binary. Indeed, this does seem to be the case. Thanks for looking into it. :) -- Change is hard. From owner-svn-src-stable@FreeBSD.ORG Fri Jul 20 06:50:58 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9B4F3106564A; Fri, 20 Jul 2012 06:50:58 +0000 (UTC) (envelope-from pgj@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7AB218FC1F; Fri, 20 Jul 2012 06:50:58 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6K6owDv066203; Fri, 20 Jul 2012 06:50:58 GMT (envelope-from pgj@svn.freebsd.org) Received: (from pgj@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6K6owvO066198; Fri, 20 Jul 2012 06:50:58 GMT (envelope-from pgj@svn.freebsd.org) Message-Id: <201207200650.q6K6owvO066198@svn.freebsd.org> From: Gabor Pali Date: Fri, 20 Jul 2012 06:50:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238647 - in stable/9: sys/kern sys/sys usr.bin/procstat X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 20 Jul 2012 06:50:58 -0000 Author: pgj (ports committer) Date: Fri Jul 20 06:50:57 2012 New Revision: 238647 URL: http://svn.freebsd.org/changeset/base/238647 Log: MFC r238527: - Add support for displaying process stack memory regions. Approved by: re (kib), rwatson Modified: stable/9/sys/kern/kern_proc.c stable/9/sys/sys/user.h stable/9/usr.bin/procstat/procstat.1 stable/9/usr.bin/procstat/procstat_vm.c Directory Properties: stable/9/sys/ (props changed) stable/9/usr.bin/procstat/ (props changed) Modified: stable/9/sys/kern/kern_proc.c ============================================================================== --- stable/9/sys/kern/kern_proc.c Fri Jul 20 06:11:26 2012 (r238646) +++ stable/9/sys/kern/kern_proc.c Fri Jul 20 06:50:57 2012 (r238647) @@ -2189,6 +2189,10 @@ sysctl_kern_proc_vmmap(SYSCTL_HANDLER_AR kve->kve_flags |= KVME_FLAG_NEEDS_COPY; if (entry->eflags & MAP_ENTRY_NOCOREDUMP) kve->kve_flags |= KVME_FLAG_NOCOREDUMP; + if (entry->eflags & MAP_ENTRY_GROWS_UP) + kve->kve_flags |= KVME_FLAG_GROWS_UP; + if (entry->eflags & MAP_ENTRY_GROWS_DOWN) + kve->kve_flags |= KVME_FLAG_GROWS_DOWN; last_timestamp = map->timestamp; vm_map_unlock_read(map); Modified: stable/9/sys/sys/user.h ============================================================================== --- stable/9/sys/sys/user.h Fri Jul 20 06:11:26 2012 (r238646) +++ stable/9/sys/sys/user.h Fri Jul 20 06:50:57 2012 (r238647) @@ -413,6 +413,8 @@ struct kinfo_file { #define KVME_FLAG_NEEDS_COPY 0x00000002 #define KVME_FLAG_NOCOREDUMP 0x00000004 #define KVME_FLAG_SUPER 0x00000008 +#define KVME_FLAG_GROWS_UP 0x00000010 +#define KVME_FLAG_GROWS_DOWN 0x00000020 #if defined(__amd64__) #define KINFO_OVMENTRY_SIZE 1168 Modified: stable/9/usr.bin/procstat/procstat.1 ============================================================================== --- stable/9/usr.bin/procstat/procstat.1 Fri Jul 20 06:11:26 2012 (r238646) +++ stable/9/usr.bin/procstat/procstat.1 Fri Jul 20 06:50:57 2012 (r238647) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 23, 2012 +.Dd July 11, 2012 .Dt PROCSTAT 1 .Os .Sh NAME @@ -433,6 +433,10 @@ copy-on-write needs copy .It S one or more superpage mappings are used +.It D +grows down (top-down stack) +.It U +grows up (bottom-up stack) .El .Sh EXIT STATUS .Ex -std Modified: stable/9/usr.bin/procstat/procstat_vm.c ============================================================================== --- stable/9/usr.bin/procstat/procstat_vm.c Fri Jul 20 06:11:26 2012 (r238646) +++ stable/9/usr.bin/procstat/procstat_vm.c Fri Jul 20 06:50:57 2012 (r238647) @@ -72,7 +72,9 @@ procstat_vm(struct kinfo_proc *kipp) printf("%-1s", kve->kve_flags & KVME_FLAG_COW ? "C" : "-"); printf("%-1s", kve->kve_flags & KVME_FLAG_NEEDS_COPY ? "N" : "-"); - printf("%-1s ", kve->kve_flags & KVME_FLAG_SUPER ? "S" : "-"); + printf("%-1s", kve->kve_flags & KVME_FLAG_SUPER ? "S" : "-"); + printf("%-1s ", kve->kve_flags & KVME_FLAG_GROWS_UP ? "U" : + kve->kve_flags & KVME_FLAG_GROWS_DOWN ? "D" : "-"); switch (kve->kve_type) { case KVME_TYPE_NONE: str = "--"; From owner-svn-src-stable@FreeBSD.ORG Fri Jul 20 09:49:51 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 0A3A01065677; Fri, 20 Jul 2012 09:49:51 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CFC878FC17; Fri, 20 Jul 2012 09:49:50 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6K9noTM079193; Fri, 20 Jul 2012 09:49:50 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6K9noBM079190; Fri, 20 Jul 2012 09:49:50 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201207200949.q6K9noBM079190@svn.freebsd.org> From: Michael Tuexen Date: Fri, 20 Jul 2012 09:49:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238655 - stable/9/sys/netinet X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 20 Jul 2012 09:49:51 -0000 Author: tuexen Date: Fri Jul 20 09:49:50 2012 New Revision: 238655 URL: http://svn.freebsd.org/changeset/base/238655 Log: MFC r238550: Fix a refcount bug when freeing an association. While there: Change code to be consistent. Discussed with: rrs Approved by: re (kib) Modified: stable/9/sys/netinet/sctp_pcb.c stable/9/sys/netinet/sctputil.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/netinet/sctp_pcb.c ============================================================================== --- stable/9/sys/netinet/sctp_pcb.c Fri Jul 20 08:36:53 2012 (r238654) +++ stable/9/sys/netinet/sctp_pcb.c Fri Jul 20 09:49:50 2012 (r238655) @@ -4984,6 +4984,7 @@ sctp_free_assoc(struct sctp_inpcb *inp, /* now clean up any chunks here */ TAILQ_FOREACH_SAFE(sp, &outs->outqueue, next, nsp) { TAILQ_REMOVE(&outs->outqueue, sp, next); + sctp_free_spbufspace(stcb, asoc, sp); if (sp->data) { if (so) { /* Still an open socket - report */ @@ -4994,19 +4995,14 @@ sctp_free_assoc(struct sctp_inpcb *inp, sctp_m_freem(sp->data); sp->data = NULL; sp->tail_mbuf = NULL; + sp->length = 0; } } if (sp->net) { sctp_free_remote_addr(sp->net); sp->net = NULL; } - sctp_free_spbufspace(stcb, asoc, sp); - if (sp->holds_key_ref) - sctp_auth_key_release(stcb, sp->auth_keyid, SCTP_SO_LOCKED); - /* Free the zone stuff */ - SCTP_ZONE_FREE(SCTP_BASE_INFO(ipi_zone_strmoq), sp); - SCTP_DECR_STRMOQ_COUNT(); - /* sa_ignore FREED_MEMORY */ + sctp_free_a_strmoq(stcb, sp, SCTP_SO_LOCKED); } } /* sa_ignore FREED_MEMORY */ Modified: stable/9/sys/netinet/sctputil.c ============================================================================== --- stable/9/sys/netinet/sctputil.c Fri Jul 20 08:36:53 2012 (r238654) +++ stable/9/sys/netinet/sctputil.c Fri Jul 20 09:49:50 2012 (r238655) @@ -3774,6 +3774,8 @@ sctp_report_all_outbound(struct sctp_tcb if (sp->data) { sctp_m_freem(sp->data); sp->data = NULL; + sp->tail_mbuf = NULL; + sp->length = 0; } } if (sp->net) { @@ -4887,7 +4889,7 @@ sctp_release_pr_sctp_chunk(struct sctp_t /* * Pull any data to free up the SB * and allow sender to "add more" - * whilc we will throw away :-) + * while we will throw away :-) */ sctp_free_spbufspace(stcb, &stcb->asoc, sp); @@ -4895,9 +4897,9 @@ sctp_release_pr_sctp_chunk(struct sctp_t do_wakeup_routine = 1; sp->some_taken = 1; sctp_m_freem(sp->data); - sp->length = 0; sp->data = NULL; sp->tail_mbuf = NULL; + sp->length = 0; } break; } From owner-svn-src-stable@FreeBSD.ORG Fri Jul 20 19:35:20 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BA8B21065670; Fri, 20 Jul 2012 19:35:20 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A09538FC1A; Fri, 20 Jul 2012 19:35:20 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6KJZKF8029665; Fri, 20 Jul 2012 19:35:20 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6KJZK16029661; Fri, 20 Jul 2012 19:35:20 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201207201935.q6KJZK16029661@svn.freebsd.org> From: Alexander Motin Date: Fri, 20 Jul 2012 19:35:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238658 - in stable/8/sys: amd64/amd64 i386/i386 pc98/pc98 X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 20 Jul 2012 19:35:20 -0000 Author: mav Date: Fri Jul 20 19:35:20 2012 New Revision: 238658 URL: http://svn.freebsd.org/changeset/base/238658 Log: Partially MFC r212541: Refactor cpu_idle() on x86. Use MONITOR/MWAIT instrunctions (if supported) under high sleep/wakeup rate, as fast alternative to other methods. It allows SMP scheduler to wake up sleeping CPUs much faster without using IPI, significantly increasing performance on some highly task-switching loads. Also on such loads it hides two ACPI timer reads, otherwise done by acpi_cpu_idle(), that are reported to be slow on some systems. MFC r225936 (by attilio): Add some improvements in the idle table callbacks: - Replace instances of manual assembly instruction "hlt" call with halt() function calling. - In cpu_idle_mwait() avoid races in check to sched_runnable() using the same pattern used in cpu_idle_hlt() with the 'hlt' instruction. - Add comments explaining the logic behind the pattern used in cpu_idle_hlt() and other idle callbacks. PR: kern/170021 Modified: stable/8/sys/amd64/amd64/machdep.c stable/8/sys/i386/i386/machdep.c stable/8/sys/pc98/pc98/machdep.c Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/amd64/amd64/machdep.c ============================================================================== --- stable/8/sys/amd64/amd64/machdep.c Fri Jul 20 17:51:20 2012 (r238657) +++ stable/8/sys/amd64/amd64/machdep.c Fri Jul 20 19:35:20 2012 (r238658) @@ -629,63 +629,122 @@ void cpu_halt(void) { for (;;) - __asm__ ("hlt"); + halt(); } void (*cpu_idle_hook)(void) = NULL; /* ACPI idle hook. */ +static int cpu_ident_amdc1e = 0; /* AMD C1E supported. */ +static int idle_mwait = 1; /* Use MONITOR/MWAIT for short idle. */ +TUNABLE_INT("machdep.idle_mwait", &idle_mwait); +SYSCTL_INT(_machdep, OID_AUTO, idle_mwait, CTLFLAG_RW, &idle_mwait, + 0, "Use MONITOR/MWAIT for short idle"); + +#define STATE_RUNNING 0x0 +#define STATE_MWAIT 0x1 +#define STATE_SLEEPING 0x2 + +static void +cpu_idle_acpi(int busy) +{ + int *state; + + state = (int *)PCPU_PTR(monitorbuf); + *state = STATE_SLEEPING; + + /* See comments in cpu_idle_hlt(). */ + disable_intr(); + if (sched_runnable()) + enable_intr(); + else if (cpu_idle_hook) + cpu_idle_hook(); + else + __asm __volatile("sti; hlt"); + *state = STATE_RUNNING; +} static void cpu_idle_hlt(int busy) { + int *state; + + state = (int *)PCPU_PTR(monitorbuf); + *state = STATE_SLEEPING; + /* - * we must absolutely guarentee that hlt is the next instruction - * after sti or we introduce a timing window. + * Since we may be in a critical section from cpu_idle(), if + * an interrupt fires during that critical section we may have + * a pending preemption. If the CPU halts, then that thread + * may not execute until a later interrupt awakens the CPU. + * To handle this race, check for a runnable thread after + * disabling interrupts and immediately return if one is + * found. Also, we must absolutely guarentee that hlt is + * the next instruction after sti. This ensures that any + * interrupt that fires after the call to disable_intr() will + * immediately awaken the CPU from hlt. Finally, please note + * that on x86 this works fine because of interrupts enabled only + * after the instruction following sti takes place, while IF is set + * to 1 immediately, allowing hlt instruction to acknowledge the + * interrupt. */ disable_intr(); - if (sched_runnable()) + if (sched_runnable()) enable_intr(); else __asm __volatile("sti; hlt"); + *state = STATE_RUNNING; } +/* + * MWAIT cpu power states. Lower 4 bits are sub-states. + */ +#define MWAIT_C0 0xf0 +#define MWAIT_C1 0x00 +#define MWAIT_C2 0x10 +#define MWAIT_C3 0x20 +#define MWAIT_C4 0x30 + static void -cpu_idle_acpi(int busy) +cpu_idle_mwait(int busy) { + int *state; + + state = (int *)PCPU_PTR(monitorbuf); + *state = STATE_MWAIT; + + /* See comments in cpu_idle_hlt(). */ disable_intr(); - if (sched_runnable()) + if (sched_runnable()) { enable_intr(); - else if (cpu_idle_hook) - cpu_idle_hook(); + *state = STATE_RUNNING; + return; + } + cpu_monitor(state, 0, 0); + if (*state == STATE_MWAIT) + __asm __volatile("sti; mwait" : : "a" (MWAIT_C1), "c" (0)); else - __asm __volatile("sti; hlt"); + enable_intr(); + *state = STATE_RUNNING; } -static int cpu_ident_amdc1e = 0; - -static int -cpu_probe_amdc1e(void) +static void +cpu_idle_spin(int busy) { + int *state; int i; - /* - * Forget it, if we're not using local APIC timer. - */ - if (resource_disabled("apic", 0) || - (resource_int_value("apic", 0, "clock", &i) == 0 && i == 0)) - return (0); + state = (int *)PCPU_PTR(monitorbuf); + *state = STATE_RUNNING; /* - * Detect the presence of C1E capability mostly on latest - * dual-cores (or future) k8 family. - */ - if (cpu_vendor_id == CPU_VENDOR_AMD && - (cpu_id & 0x00000f00) == 0x00000f00 && - (cpu_id & 0x0fff0000) >= 0x00040000) { - cpu_ident_amdc1e = 1; - return (1); + * The sched_runnable() call is racy but as long as there is + * a loop missing it one time will have just a little impact if any + * (and it is much better than missing the check at all). + */ + for (i = 0; i < 1000; i++) { + if (sched_runnable()) + return; + cpu_spinwait(); } - - return (0); } /* @@ -703,110 +762,66 @@ cpu_probe_amdc1e(void) #define AMDK8_CMPHALT (AMDK8_SMIONCMPHALT | AMDK8_C1EONCMPHALT) static void -cpu_idle_amdc1e(int busy) +cpu_probe_amdc1e(void) { - disable_intr(); - if (sched_runnable()) - enable_intr(); - else { - uint64_t msr; - - msr = rdmsr(MSR_AMDK8_IPM); - if (msr & AMDK8_CMPHALT) - wrmsr(MSR_AMDK8_IPM, msr & ~AMDK8_CMPHALT); - - if (cpu_idle_hook) - cpu_idle_hook(); - else - __asm __volatile("sti; hlt"); + /* + * Detect the presence of C1E capability mostly on latest + * dual-cores (or future) k8 family. + */ + if (cpu_vendor_id == CPU_VENDOR_AMD && + (cpu_id & 0x00000f00) == 0x00000f00 && + (cpu_id & 0x0fff0000) >= 0x00040000) { + cpu_ident_amdc1e = 1; } } -static void -cpu_idle_spin(int busy) -{ - return; -} - void (*cpu_idle_fn)(int) = cpu_idle_acpi; void cpu_idle(int busy) { + uint64_t msr; + #ifdef SMP if (mp_grab_cpu_hlt()) return; #endif - cpu_idle_fn(busy); -} - -/* - * mwait cpu power states. Lower 4 bits are sub-states. - */ -#define MWAIT_C0 0xf0 -#define MWAIT_C1 0x00 -#define MWAIT_C2 0x10 -#define MWAIT_C3 0x20 -#define MWAIT_C4 0x30 - -#define MWAIT_DISABLED 0x0 -#define MWAIT_WOKEN 0x1 -#define MWAIT_WAITING 0x2 - -static void -cpu_idle_mwait(int busy) -{ - int *mwait; - - mwait = (int *)PCPU_PTR(monitorbuf); - *mwait = MWAIT_WAITING; - if (sched_runnable()) - return; - cpu_monitor(mwait, 0, 0); - if (*mwait == MWAIT_WAITING) - cpu_mwait(0, MWAIT_C1); -} - -static void -cpu_idle_mwait_hlt(int busy) -{ - int *mwait; + /* If we are busy - try to use fast methods. */ + if (busy) { + if ((cpu_feature2 & CPUID2_MON) && idle_mwait) { + cpu_idle_mwait(busy); + return; + } + } - mwait = (int *)PCPU_PTR(monitorbuf); - if (busy == 0) { - *mwait = MWAIT_DISABLED; - cpu_idle_hlt(busy); - return; + /* Apply AMD APIC timer C1E workaround. */ + if (cpu_ident_amdc1e) { + msr = rdmsr(MSR_AMDK8_IPM); + if (msr & AMDK8_CMPHALT) + wrmsr(MSR_AMDK8_IPM, msr & ~AMDK8_CMPHALT); } - *mwait = MWAIT_WAITING; - if (sched_runnable()) - return; - cpu_monitor(mwait, 0, 0); - if (*mwait == MWAIT_WAITING) - cpu_mwait(0, MWAIT_C1); + + /* Call main idle method. */ + cpu_idle_fn(busy); } int cpu_idle_wakeup(int cpu) { struct pcpu *pcpu; - int *mwait; + int *state; - if (cpu_idle_fn == cpu_idle_spin) - return (1); - if (cpu_idle_fn != cpu_idle_mwait && cpu_idle_fn != cpu_idle_mwait_hlt) - return (0); pcpu = pcpu_find(cpu); - mwait = (int *)pcpu->pc_monitorbuf; + state = (int *)pcpu->pc_monitorbuf; /* * This doesn't need to be atomic since missing the race will * simply result in unnecessary IPIs. */ - if (cpu_idle_fn == cpu_idle_mwait_hlt && *mwait == MWAIT_DISABLED) + if (*state == STATE_SLEEPING) return (0); - *mwait = MWAIT_WOKEN; - + if (*state == STATE_MWAIT) + *state = STATE_RUNNING; return (1); } @@ -819,8 +834,6 @@ struct { } idle_tbl[] = { { cpu_idle_spin, "spin" }, { cpu_idle_mwait, "mwait" }, - { cpu_idle_mwait_hlt, "mwait_hlt" }, - { cpu_idle_amdc1e, "amdc1e" }, { cpu_idle_hlt, "hlt" }, { cpu_idle_acpi, "acpi" }, { NULL, NULL } @@ -839,8 +852,8 @@ idle_sysctl_available(SYSCTL_HANDLER_ARG if (strstr(idle_tbl[i].id_name, "mwait") && (cpu_feature2 & CPUID2_MON) == 0) continue; - if (strcmp(idle_tbl[i].id_name, "amdc1e") == 0 && - cpu_ident_amdc1e == 0) + if (strcmp(idle_tbl[i].id_name, "acpi") == 0 && + cpu_idle_hook == NULL) continue; p += sprintf(p, "%s, ", idle_tbl[i].id_name); } @@ -849,6 +862,9 @@ idle_sysctl_available(SYSCTL_HANDLER_ARG return (error); } +SYSCTL_PROC(_machdep, OID_AUTO, idle_available, CTLTYPE_STRING | CTLFLAG_RD, + 0, 0, idle_sysctl_available, "A", "list of available idle functions"); + static int idle_sysctl(SYSCTL_HANDLER_ARGS) { @@ -872,8 +888,8 @@ idle_sysctl(SYSCTL_HANDLER_ARGS) if (strstr(idle_tbl[i].id_name, "mwait") && (cpu_feature2 & CPUID2_MON) == 0) continue; - if (strcmp(idle_tbl[i].id_name, "amdc1e") == 0 && - cpu_ident_amdc1e == 0) + if (strcmp(idle_tbl[i].id_name, "acpi") == 0 && + cpu_idle_hook == NULL) continue; if (strcmp(idle_tbl[i].id_name, buf)) continue; @@ -883,9 +899,6 @@ idle_sysctl(SYSCTL_HANDLER_ARGS) return (EINVAL); } -SYSCTL_PROC(_machdep, OID_AUTO, idle_available, CTLTYPE_STRING | CTLFLAG_RD, - 0, 0, idle_sysctl_available, "A", "list of available idle functions"); - SYSCTL_PROC(_machdep, OID_AUTO, idle, CTLTYPE_STRING | CTLFLAG_RW, 0, 0, idle_sysctl, "A", "currently selected idle function"); @@ -1819,8 +1832,7 @@ hammer_time(u_int64_t modulep, u_int64_t } #endif - if (cpu_probe_amdc1e()) - cpu_idle_fn = cpu_idle_amdc1e; + cpu_probe_amdc1e(); /* Location of kernel stack for locore */ return ((u_int64_t)thread0.td_pcb); Modified: stable/8/sys/i386/i386/machdep.c ============================================================================== --- stable/8/sys/i386/i386/machdep.c Fri Jul 20 17:51:20 2012 (r238657) +++ stable/8/sys/i386/i386/machdep.c Fri Jul 20 19:35:20 2012 (r238658) @@ -1177,9 +1177,6 @@ cpu_est_clockrate(int cpu_id, uint64_t * return (0); } - -void (*cpu_idle_hook)(void) = NULL; /* ACPI idle hook. */ - #ifdef XEN void @@ -1207,66 +1204,127 @@ void cpu_halt(void) { for (;;) - __asm__ ("hlt"); + halt(); } +#endif + +void (*cpu_idle_hook)(void) = NULL; /* ACPI idle hook. */ +static int cpu_ident_amdc1e = 0; /* AMD C1E supported. */ +static int idle_mwait = 1; /* Use MONITOR/MWAIT for short idle. */ +TUNABLE_INT("machdep.idle_mwait", &idle_mwait); +SYSCTL_INT(_machdep, OID_AUTO, idle_mwait, CTLFLAG_RW, &idle_mwait, + 0, "Use MONITOR/MWAIT for short idle"); + +#define STATE_RUNNING 0x0 +#define STATE_MWAIT 0x1 +#define STATE_SLEEPING 0x2 + +static void +cpu_idle_acpi(int busy) +{ + int *state; + + state = (int *)PCPU_PTR(monitorbuf); + *state = STATE_SLEEPING; + + /* See comments in cpu_idle_hlt(). */ + disable_intr(); + if (sched_runnable()) + enable_intr(); + else if (cpu_idle_hook) + cpu_idle_hook(); + else + __asm __volatile("sti; hlt"); + *state = STATE_RUNNING; +} + +#ifndef XEN static void cpu_idle_hlt(int busy) { + int *state; + + state = (int *)PCPU_PTR(monitorbuf); + *state = STATE_SLEEPING; + /* - * we must absolutely guarentee that hlt is the next instruction - * after sti or we introduce a timing window. + * Since we may be in a critical section from cpu_idle(), if + * an interrupt fires during that critical section we may have + * a pending preemption. If the CPU halts, then that thread + * may not execute until a later interrupt awakens the CPU. + * To handle this race, check for a runnable thread after + * disabling interrupts and immediately return if one is + * found. Also, we must absolutely guarentee that hlt is + * the next instruction after sti. This ensures that any + * interrupt that fires after the call to disable_intr() will + * immediately awaken the CPU from hlt. Finally, please note + * that on x86 this works fine because of interrupts enabled only + * after the instruction following sti takes place, while IF is set + * to 1 immediately, allowing hlt instruction to acknowledge the + * interrupt. */ disable_intr(); - if (sched_runnable()) + if (sched_runnable()) enable_intr(); else __asm __volatile("sti; hlt"); + *state = STATE_RUNNING; } #endif +/* + * MWAIT cpu power states. Lower 4 bits are sub-states. + */ +#define MWAIT_C0 0xf0 +#define MWAIT_C1 0x00 +#define MWAIT_C2 0x10 +#define MWAIT_C3 0x20 +#define MWAIT_C4 0x30 + static void -cpu_idle_acpi(int busy) +cpu_idle_mwait(int busy) { + int *state; + + state = (int *)PCPU_PTR(monitorbuf); + *state = STATE_MWAIT; + + /* See comments in cpu_idle_hlt(). */ disable_intr(); - if (sched_runnable()) + if (sched_runnable()) { enable_intr(); - else if (cpu_idle_hook) - cpu_idle_hook(); + *state = STATE_RUNNING; + return; + } + cpu_monitor(state, 0, 0); + if (*state == STATE_MWAIT) + __asm __volatile("sti; mwait" : : "a" (MWAIT_C1), "c" (0)); else - __asm __volatile("sti; hlt"); + enable_intr(); + *state = STATE_RUNNING; } -static int cpu_ident_amdc1e = 0; - -#if !defined(XEN) || defined(XEN_PRIVILEGED) -static int -cpu_probe_amdc1e(void) -{ -#ifdef DEV_APIC +static void +cpu_idle_spin(int busy) +{ + int *state; int i; - /* - * Forget it, if we're not using local APIC timer. - */ - if (resource_disabled("apic", 0) || - (resource_int_value("apic", 0, "clock", &i) == 0 && i == 0)) - return (0); + state = (int *)PCPU_PTR(monitorbuf); + *state = STATE_RUNNING; /* - * Detect the presence of C1E capability mostly on latest - * dual-cores (or future) k8 family. - */ - if (cpu_vendor_id == CPU_VENDOR_AMD && - (cpu_id & 0x00000f00) == 0x00000f00 && - (cpu_id & 0x0fff0000) >= 0x00040000) { - cpu_ident_amdc1e = 1; - return (1); + * The sched_runnable() call is racy but as long as there is + * a loop missing it one time will have just a little impact if any + * (and it is much better than missing the check at all). + */ + for (i = 0; i < 1000; i++) { + if (sched_runnable()) + return; + cpu_spinwait(); } -#endif - return (0); } -#endif /* * C1E renders the local APIC timer dead, so we disable it by @@ -1283,32 +1341,20 @@ cpu_probe_amdc1e(void) #define AMDK8_CMPHALT (AMDK8_SMIONCMPHALT | AMDK8_C1EONCMPHALT) static void -cpu_idle_amdc1e(int busy) +cpu_probe_amdc1e(void) { - disable_intr(); - if (sched_runnable()) - enable_intr(); - else { - uint64_t msr; - - msr = rdmsr(MSR_AMDK8_IPM); - if (msr & AMDK8_CMPHALT) - wrmsr(MSR_AMDK8_IPM, msr & ~AMDK8_CMPHALT); - - if (cpu_idle_hook) - cpu_idle_hook(); - else - __asm __volatile("sti; hlt"); + /* + * Detect the presence of C1E capability mostly on latest + * dual-cores (or future) k8 family. + */ + if (cpu_vendor_id == CPU_VENDOR_AMD && + (cpu_id & 0x00000f00) == 0x00000f00 && + (cpu_id & 0x0fff0000) >= 0x00040000) { + cpu_ident_amdc1e = 1; } } -static void -cpu_idle_spin(int busy) -{ - return; -} - #ifdef XEN void (*cpu_idle_fn)(int) = cpu_idle_hlt; #else @@ -1318,79 +1364,51 @@ void (*cpu_idle_fn)(int) = cpu_idle_acpi void cpu_idle(int busy) { +#ifndef XEN + uint64_t msr; +#endif + #if defined(SMP) && !defined(XEN) if (mp_grab_cpu_hlt()) return; #endif - cpu_idle_fn(busy); -} - -/* - * mwait cpu power states. Lower 4 bits are sub-states. - */ -#define MWAIT_C0 0xf0 -#define MWAIT_C1 0x00 -#define MWAIT_C2 0x10 -#define MWAIT_C3 0x20 -#define MWAIT_C4 0x30 - -#define MWAIT_DISABLED 0x0 -#define MWAIT_WOKEN 0x1 -#define MWAIT_WAITING 0x2 - -static void -cpu_idle_mwait(int busy) -{ - int *mwait; - - mwait = (int *)PCPU_PTR(monitorbuf); - *mwait = MWAIT_WAITING; - if (sched_runnable()) - return; - cpu_monitor(mwait, 0, 0); - if (*mwait == MWAIT_WAITING) - cpu_mwait(0, MWAIT_C1); -} - -static void -cpu_idle_mwait_hlt(int busy) -{ - int *mwait; +#ifndef XEN + /* If we are busy - try to use fast methods. */ + if (busy) { + if ((cpu_feature2 & CPUID2_MON) && idle_mwait) { + cpu_idle_mwait(busy); + return; + } + } - mwait = (int *)PCPU_PTR(monitorbuf); - if (busy == 0) { - *mwait = MWAIT_DISABLED; - cpu_idle_hlt(busy); - return; + /* Apply AMD APIC timer C1E workaround. */ + if (cpu_ident_amdc1e) { + msr = rdmsr(MSR_AMDK8_IPM); + if (msr & AMDK8_CMPHALT) + wrmsr(MSR_AMDK8_IPM, msr & ~AMDK8_CMPHALT); } - *mwait = MWAIT_WAITING; - if (sched_runnable()) - return; - cpu_monitor(mwait, 0, 0); - if (*mwait == MWAIT_WAITING) - cpu_mwait(0, MWAIT_C1); +#endif + + /* Call main idle method. */ + cpu_idle_fn(busy); } int cpu_idle_wakeup(int cpu) { struct pcpu *pcpu; - int *mwait; + int *state; - if (cpu_idle_fn == cpu_idle_spin) - return (1); - if (cpu_idle_fn != cpu_idle_mwait && cpu_idle_fn != cpu_idle_mwait_hlt) - return (0); pcpu = pcpu_find(cpu); - mwait = (int *)pcpu->pc_monitorbuf; + state = (int *)pcpu->pc_monitorbuf; /* * This doesn't need to be atomic since missing the race will * simply result in unnecessary IPIs. */ - if (cpu_idle_fn == cpu_idle_mwait_hlt && *mwait == MWAIT_DISABLED) + if (*state == STATE_SLEEPING) return (0); - *mwait = MWAIT_WOKEN; - + if (*state == STATE_MWAIT) + *state = STATE_RUNNING; return (1); } @@ -1403,8 +1421,6 @@ struct { } idle_tbl[] = { { cpu_idle_spin, "spin" }, { cpu_idle_mwait, "mwait" }, - { cpu_idle_mwait_hlt, "mwait_hlt" }, - { cpu_idle_amdc1e, "amdc1e" }, { cpu_idle_hlt, "hlt" }, { cpu_idle_acpi, "acpi" }, { NULL, NULL } @@ -1423,8 +1439,8 @@ idle_sysctl_available(SYSCTL_HANDLER_ARG if (strstr(idle_tbl[i].id_name, "mwait") && (cpu_feature2 & CPUID2_MON) == 0) continue; - if (strcmp(idle_tbl[i].id_name, "amdc1e") == 0 && - cpu_ident_amdc1e == 0) + if (strcmp(idle_tbl[i].id_name, "acpi") == 0 && + cpu_idle_hook == NULL) continue; p += sprintf(p, "%s, ", idle_tbl[i].id_name); } @@ -1433,6 +1449,9 @@ idle_sysctl_available(SYSCTL_HANDLER_ARG return (error); } +SYSCTL_PROC(_machdep, OID_AUTO, idle_available, CTLTYPE_STRING | CTLFLAG_RD, + 0, 0, idle_sysctl_available, "A", "list of available idle functions"); + static int idle_sysctl(SYSCTL_HANDLER_ARGS) { @@ -1456,8 +1475,8 @@ idle_sysctl(SYSCTL_HANDLER_ARGS) if (strstr(idle_tbl[i].id_name, "mwait") && (cpu_feature2 & CPUID2_MON) == 0) continue; - if (strcmp(idle_tbl[i].id_name, "amdc1e") == 0 && - cpu_ident_amdc1e == 0) + if (strcmp(idle_tbl[i].id_name, "acpi") == 0 && + cpu_idle_hook == NULL) continue; if (strcmp(idle_tbl[i].id_name, buf)) continue; @@ -1467,9 +1486,6 @@ idle_sysctl(SYSCTL_HANDLER_ARGS) return (EINVAL); } -SYSCTL_PROC(_machdep, OID_AUTO, idle_available, CTLTYPE_STRING | CTLFLAG_RD, - 0, 0, idle_sysctl_available, "A", "list of available idle functions"); - SYSCTL_PROC(_machdep, OID_AUTO, idle, CTLTYPE_STRING | CTLFLAG_RW, 0, 0, idle_sysctl, "A", "currently selected idle function"); @@ -2723,8 +2739,7 @@ init386(first) thread0.td_pcb->pcb_gsd = PCPU_GET(fsgs_gdt)[1]; #if defined(XEN_PRIVILEGED) - if (cpu_probe_amdc1e()) - cpu_idle_fn = cpu_idle_amdc1e; + cpu_probe_amdc1e(); #endif } @@ -3001,8 +3016,7 @@ init386(first) thread0.td_pcb->pcb_ext = 0; thread0.td_frame = &proc0_tf; - if (cpu_probe_amdc1e()) - cpu_idle_fn = cpu_idle_amdc1e; + cpu_probe_amdc1e(); } #endif Modified: stable/8/sys/pc98/pc98/machdep.c ============================================================================== --- stable/8/sys/pc98/pc98/machdep.c Fri Jul 20 17:51:20 2012 (r238657) +++ stable/8/sys/pc98/pc98/machdep.c Fri Jul 20 19:35:20 2012 (r238658) @@ -1122,40 +1122,36 @@ cpu_halt(void) __asm__ ("hlt"); } +static int idle_mwait = 1; /* Use MONITOR/MWAIT for short idle. */ +TUNABLE_INT("machdep.idle_mwait", &idle_mwait); +SYSCTL_INT(_machdep, OID_AUTO, idle_mwait, CTLFLAG_RW, &idle_mwait, + 0, "Use MONITOR/MWAIT for short idle"); + +#define STATE_RUNNING 0x0 +#define STATE_MWAIT 0x1 +#define STATE_SLEEPING 0x2 + static void cpu_idle_hlt(int busy) { + int *state; + + state = (int *)PCPU_PTR(monitorbuf); + *state = STATE_SLEEPING; /* - * we must absolutely guarentee that hlt is the next instruction + * We must absolutely guarentee that hlt is the next instruction * after sti or we introduce a timing window. */ disable_intr(); - if (sched_runnable()) + if (sched_runnable()) enable_intr(); else __asm __volatile("sti; hlt"); -} - -static void -cpu_idle_spin(int busy) -{ - return; -} - -void (*cpu_idle_fn)(int) = cpu_idle_hlt; - -void -cpu_idle(int busy) -{ -#if defined(SMP) - if (mp_grab_cpu_hlt()) - return; -#endif - cpu_idle_fn(busy); + *state = STATE_RUNNING; } /* - * mwait cpu power states. Lower 4 bits are sub-states. + * MWAIT cpu power states. Lower 4 bits are sub-states. */ #define MWAIT_C0 0xf0 #define MWAIT_C1 0x00 @@ -1163,63 +1159,74 @@ cpu_idle(int busy) #define MWAIT_C3 0x20 #define MWAIT_C4 0x30 -#define MWAIT_DISABLED 0x0 -#define MWAIT_WOKEN 0x1 -#define MWAIT_WAITING 0x2 - static void cpu_idle_mwait(int busy) { - int *mwait; + int *state; - mwait = (int *)PCPU_PTR(monitorbuf); - *mwait = MWAIT_WAITING; - if (sched_runnable()) - return; - cpu_monitor(mwait, 0, 0); - if (*mwait == MWAIT_WAITING) - cpu_mwait(0, MWAIT_C1); + state = (int *)PCPU_PTR(monitorbuf); + *state = STATE_MWAIT; + if (!sched_runnable()) { + cpu_monitor(state, 0, 0); + if (*state == STATE_MWAIT) + cpu_mwait(0, MWAIT_C1); + } + *state = STATE_RUNNING; } static void -cpu_idle_mwait_hlt(int busy) +cpu_idle_spin(int busy) +{ + int *state; + int i; + + state = (int *)PCPU_PTR(monitorbuf); + *state = STATE_RUNNING; + for (i = 0; i < 1000; i++) { + if (sched_runnable()) + return; + cpu_spinwait(); + } +} + +void (*cpu_idle_fn)(int) = cpu_idle_hlt; + +void +cpu_idle(int busy) { - int *mwait; - mwait = (int *)PCPU_PTR(monitorbuf); - if (busy == 0) { - *mwait = MWAIT_DISABLED; - cpu_idle_hlt(busy); +#ifdef SMP + if (mp_grab_cpu_hlt()) return; +#endif + /* If we are busy - try to use fast methods. */ + if (busy) { + if ((cpu_feature2 & CPUID2_MON) && idle_mwait) { + cpu_idle_mwait(busy); + return; + } } - *mwait = MWAIT_WAITING; - if (sched_runnable()) - return; - cpu_monitor(mwait, 0, 0); - if (*mwait == MWAIT_WAITING) - cpu_mwait(0, MWAIT_C1); + + /* Call main idle method. */ + cpu_idle_fn(busy); } int cpu_idle_wakeup(int cpu) { struct pcpu *pcpu; - int *mwait; + int *state; - if (cpu_idle_fn == cpu_idle_spin) - return (1); - if (cpu_idle_fn != cpu_idle_mwait && cpu_idle_fn != cpu_idle_mwait_hlt) - return (0); pcpu = pcpu_find(cpu); - mwait = (int *)pcpu->pc_monitorbuf; + state = (int *)pcpu->pc_monitorbuf; /* * This doesn't need to be atomic since missing the race will * simply result in unnecessary IPIs. */ - if (cpu_idle_fn == cpu_idle_mwait_hlt && *mwait == MWAIT_DISABLED) + if (*state == STATE_SLEEPING) return (0); - *mwait = MWAIT_WOKEN; - + if (*state == STATE_MWAIT) + *state = STATE_RUNNING; return (1); } @@ -1232,7 +1239,6 @@ struct { } idle_tbl[] = { { cpu_idle_spin, "spin" }, { cpu_idle_mwait, "mwait" }, - { cpu_idle_mwait_hlt, "mwait_hlt" }, { cpu_idle_hlt, "hlt" }, { NULL, NULL } }; @@ -1257,6 +1263,9 @@ idle_sysctl_available(SYSCTL_HANDLER_ARG return (error); } +SYSCTL_PROC(_machdep, OID_AUTO, idle_available, CTLTYPE_STRING | CTLFLAG_RD, + 0, 0, idle_sysctl_available, "A", "list of available idle functions"); + static int idle_sysctl(SYSCTL_HANDLER_ARGS) { @@ -1288,9 +1297,6 @@ idle_sysctl(SYSCTL_HANDLER_ARGS) return (EINVAL); } -SYSCTL_PROC(_machdep, OID_AUTO, idle_available, CTLTYPE_STRING | CTLFLAG_RD, - 0, 0, idle_sysctl_available, "A", "list of available idle functions"); - SYSCTL_PROC(_machdep, OID_AUTO, idle, CTLTYPE_STRING | CTLFLAG_RW, 0, 0, idle_sysctl, "A", "currently selected idle function"); From owner-svn-src-stable@FreeBSD.ORG Fri Jul 20 21:09:37 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 761181065670; Fri, 20 Jul 2012 21:09:37 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 611EA8FC21; Fri, 20 Jul 2012 21:09:37 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6KL9bSh037213; Fri, 20 Jul 2012 21:09:37 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6KL9b0L037211; Fri, 20 Jul 2012 21:09:37 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201207202109.q6KL9b0L037211@svn.freebsd.org> From: Alexander Motin Date: Fri, 20 Jul 2012 21:09:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238659 - stable/8/sys/i386/i386 X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 20 Jul 2012 21:09:37 -0000 Author: mav Date: Fri Jul 20 21:09:36 2012 New Revision: 238659 URL: http://svn.freebsd.org/changeset/base/238659 Log: Fix XEN build after r238658. Modified: stable/8/sys/i386/i386/machdep.c Modified: stable/8/sys/i386/i386/machdep.c ============================================================================== --- stable/8/sys/i386/i386/machdep.c Fri Jul 20 19:35:20 2012 (r238658) +++ stable/8/sys/i386/i386/machdep.c Fri Jul 20 21:09:36 2012 (r238659) @@ -2738,9 +2738,7 @@ init386(first) thread0.td_pcb->pcb_fsd = PCPU_GET(fsgs_gdt)[0]; thread0.td_pcb->pcb_gsd = PCPU_GET(fsgs_gdt)[1]; -#if defined(XEN_PRIVILEGED) cpu_probe_amdc1e(); -#endif } #else From owner-svn-src-stable@FreeBSD.ORG Sat Jul 21 01:07:06 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 54CBB106564A; Sat, 21 Jul 2012 01:07:06 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3E89A8FC14; Sat, 21 Jul 2012 01:07:06 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6L176dK062299; Sat, 21 Jul 2012 01:07:06 GMT (envelope-from gjb@svn.freebsd.org) Received: (from gjb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6L176Cl062297; Sat, 21 Jul 2012 01:07:06 GMT (envelope-from gjb@svn.freebsd.org) Message-Id: <201207210107.q6L176Cl062297@svn.freebsd.org> From: Glen Barber Date: Sat, 21 Jul 2012 01:07:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238662 - stable/9/usr.sbin/wpa/hostapd X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 21 Jul 2012 01:07:06 -0000 Author: gjb (doc,ports committer) Date: Sat Jul 21 01:07:05 2012 New Revision: 238662 URL: http://svn.freebsd.org/changeset/base/238662 Log: MFC r231257, r238606: r231257 (kevlo): Mention run(4) r238606: Xref mwl(4) and rum(4) in hostapd(8). Approved by: re (kib) Modified: stable/9/usr.sbin/wpa/hostapd/hostapd.8 Directory Properties: stable/9/usr.sbin/wpa/hostapd/ (props changed) Modified: stable/9/usr.sbin/wpa/hostapd/hostapd.8 ============================================================================== --- stable/9/usr.sbin/wpa/hostapd/hostapd.8 Sat Jul 21 00:28:11 2012 (r238661) +++ stable/9/usr.sbin/wpa/hostapd/hostapd.8 Sat Jul 21 01:07:05 2012 (r238662) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 26, 2007 +.Dd July 18, 2012 .Dt HOSTAPD 8 .Os .Sh NAME @@ -111,7 +111,10 @@ Store PID in .Xr ath 4 , .Xr ipw 4 , .Xr iwi 4 , +.Xr mwl 4 , .Xr ral 4 , +.Xr rum 4 , +.Xr run 4 , .Xr ural 4 , .Xr wi 4 , .Xr hostapd.conf 5 , From owner-svn-src-stable@FreeBSD.ORG Sat Jul 21 01:13:46 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 19A121065670; Sat, 21 Jul 2012 01:13:46 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 04DB18FC1F; Sat, 21 Jul 2012 01:13:46 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6L1DjPe063057; Sat, 21 Jul 2012 01:13:45 GMT (envelope-from gjb@svn.freebsd.org) Received: (from gjb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6L1DjKS063054; Sat, 21 Jul 2012 01:13:45 GMT (envelope-from gjb@svn.freebsd.org) Message-Id: <201207210113.q6L1DjKS063054@svn.freebsd.org> From: Glen Barber Date: Sat, 21 Jul 2012 01:13:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238663 - stable/8/usr.sbin/wpa/hostapd X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 21 Jul 2012 01:13:46 -0000 Author: gjb (doc,ports committer) Date: Sat Jul 21 01:13:45 2012 New Revision: 238663 URL: http://svn.freebsd.org/changeset/base/238663 Log: MFC r231257, r238606: r231257 (kevlo): Mention run(4) r238606: Xref mwl(4) and rum(4) in hostapd(8). Modified: stable/8/usr.sbin/wpa/hostapd/hostapd.8 Directory Properties: stable/8/usr.sbin/wpa/hostapd/ (props changed) Modified: stable/8/usr.sbin/wpa/hostapd/hostapd.8 ============================================================================== --- stable/8/usr.sbin/wpa/hostapd/hostapd.8 Sat Jul 21 01:07:05 2012 (r238662) +++ stable/8/usr.sbin/wpa/hostapd/hostapd.8 Sat Jul 21 01:13:45 2012 (r238663) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 26, 2007 +.Dd July 18, 2012 .Dt HOSTAPD 8 .Os .Sh NAME @@ -111,7 +111,10 @@ Store PID in .Xr ath 4 , .Xr ipw 4 , .Xr iwi 4 , +.Xr mwl 4 , .Xr ral 4 , +.Xr rum 4 , +.Xr run 4 , .Xr ural 4 , .Xr wi 4 , .Xr hostapd.conf 5 , From owner-svn-src-stable@FreeBSD.ORG Sat Jul 21 19:46:14 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D0FB3106564A; Sat, 21 Jul 2012 19:46:14 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BA5068FC08; Sat, 21 Jul 2012 19:46:14 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6LJkEJg076780; Sat, 21 Jul 2012 19:46:14 GMT (envelope-from pfg@svn.freebsd.org) Received: (from pfg@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6LJkEwi076778; Sat, 21 Jul 2012 19:46:14 GMT (envelope-from pfg@svn.freebsd.org) Message-Id: <201207211946.q6LJkEwi076778@svn.freebsd.org> From: "Pedro F. Giffuni" Date: Sat, 21 Jul 2012 19:46:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238674 - stable/8/sys/dev/sound/pci X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 21 Jul 2012 19:46:14 -0000 Author: pfg Date: Sat Jul 21 19:46:14 2012 New Revision: 238674 URL: http://svn.freebsd.org/changeset/base/238674 Log: MFC 233362: Don't cast a bus address to a uint8_t pointer just to add an offset to it. Instead, add the offset directly to the bus address. This permits linking emu10k to an i386 PAE kernel. Modified: stable/8/sys/dev/sound/pci/emu10kx.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/dev/ (props changed) stable/8/sys/dev/sound/ (props changed) stable/8/sys/dev/sound/pci/ (props changed) Modified: stable/8/sys/dev/sound/pci/emu10kx.c ============================================================================== --- stable/8/sys/dev/sound/pci/emu10kx.c Sat Jul 21 14:59:43 2012 (r238673) +++ stable/8/sys/dev/sound/pci/emu10kx.c Sat Jul 21 19:46:14 2012 (r238674) @@ -1137,7 +1137,7 @@ emu_memalloc(struct emu_mem *mem, uint32 ofs = 0; for (idx = start; idx < start + blksz; idx++) { mem->bmap[idx >> 3] |= 1 << (idx & 7); - tmp = (uint32_t) (u_long) ((uint8_t *) blk->buf_addr + ofs); + tmp = (uint32_t) (blk->buf_addr + ofs); mem->ptb_pages[idx] = (tmp << 1) | idx; ofs += EMUPAGESIZE; }