From owner-svn-src-head@FreeBSD.ORG Sun Nov 29 10:53:34 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9CC85106566B; Sun, 29 Nov 2009 10:53:34 +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 826048FC13; Sun, 29 Nov 2009 10:53:34 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nATArYxE086241; Sun, 29 Nov 2009 10:53:34 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nATArYrV086240; Sun, 29 Nov 2009 10:53:34 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <200911291053.nATArYrV086240@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Sun, 29 Nov 2009 10:53:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r199899 - head/sys/netipsec X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Nov 2009 10:53:34 -0000 Author: bz Date: Sun Nov 29 10:53:34 2009 New Revision: 199899 URL: http://svn.freebsd.org/changeset/base/199899 Log: Only add the IPcomp header if crypto reported success and we have a lower payload size. Before we had always added the header, no matter if we actually send out compressed data or not. With this, after the opencrypto/deflate changes, IPcomp starts to work apart from edge cases. Leave it disabled by default until those are fixed as well. PR: kern/123587 MFC after: 5 days Modified: head/sys/netipsec/xform_ipcomp.c Modified: head/sys/netipsec/xform_ipcomp.c ============================================================================== --- head/sys/netipsec/xform_ipcomp.c Sat Nov 28 23:50:48 2009 (r199898) +++ head/sys/netipsec/xform_ipcomp.c Sun Nov 29 10:53:34 2009 (r199899) @@ -330,13 +330,10 @@ ipcomp_output( { struct secasvar *sav; struct comp_algo *ipcompx; - int error, ralen, hlen, maxpacketsize, roff; - u_int8_t prot; + int error, ralen, maxpacketsize; struct cryptodesc *crdc; struct cryptop *crp; struct tdb_crypto *tc; - struct mbuf *mo; - struct ipcomp *ipcomp; sav = isr->sav; IPSEC_ASSERT(sav != NULL, ("null SA")); @@ -355,8 +352,6 @@ ipcomp_output( } ralen = m->m_pkthdr.len - skip; /* Raw payload length before comp. */ - hlen = IPCOMP_HLENGTH; - V_ipcompstat.ipcomps_output++; /* Check for maximum packet size violations. */ @@ -381,13 +376,13 @@ ipcomp_output( error = EPFNOSUPPORT; goto bad; } - if (skip + hlen + ralen > maxpacketsize) { + if (ralen + skip + IPCOMP_HLENGTH > maxpacketsize) { V_ipcompstat.ipcomps_toobig++; DPRINTF(("%s: packet in IPCA %s/%08lx got too big " "(len %u, max len %u)\n", __func__, ipsec_address(&sav->sah->saidx.dst), (u_long) ntohl(sav->spi), - skip + hlen + ralen, maxpacketsize)); + ralen + skip + IPCOMP_HLENGTH, maxpacketsize)); error = EMSGSIZE; goto bad; } @@ -405,40 +400,7 @@ ipcomp_output( goto bad; } - /* Inject IPCOMP header */ - mo = m_makespace(m, skip, hlen, &roff); - if (mo == NULL) { - V_ipcompstat.ipcomps_wrap++; - DPRINTF(("%s: IPCOMP header inject failed for IPCA %s/%08lx\n", - __func__, ipsec_address(&sav->sah->saidx.dst), - (u_long) ntohl(sav->spi))); - error = ENOBUFS; - goto bad; - } - ipcomp = (struct ipcomp *)(mtod(mo, caddr_t) + roff); - - /* Initialize the IPCOMP header */ - /* XXX alignment always correct? */ - switch (sav->sah->saidx.dst.sa.sa_family) { -#ifdef INET - case AF_INET: - ipcomp->comp_nxt = mtod(m, struct ip *)->ip_p; - break; -#endif /* INET */ -#ifdef INET6 - case AF_INET6: - ipcomp->comp_nxt = mtod(m, struct ip6_hdr *)->ip6_nxt; - break; -#endif - } - ipcomp->comp_flags = 0; - ipcomp->comp_cpi = htons((u_int16_t) ntohl(sav->spi)); - - /* Fix Next Protocol in IPv4/IPv6 header */ - prot = IPPROTO_IPCOMP; - m_copyback(m, protoff, sizeof(u_int8_t), (u_char *) &prot); - - /* Ok now, we can pass to the crypto processing */ + /* Ok now, we can pass to the crypto processing. */ /* Get crypto descriptors */ crp = crypto_getreq(1); @@ -451,10 +413,10 @@ ipcomp_output( crdc = crp->crp_desc; /* Compression descriptor */ - crdc->crd_skip = skip + hlen; - crdc->crd_len = m->m_pkthdr.len - (skip + hlen); + crdc->crd_skip = skip; + crdc->crd_len = ralen; crdc->crd_flags = CRD_F_COMP; - crdc->crd_inject = skip + hlen; + crdc->crd_inject = skip; /* Compression operation */ crdc->crd_alg = ipcompx->type; @@ -474,7 +436,8 @@ ipcomp_output( tc->tc_spi = sav->spi; tc->tc_dst = sav->sah->saidx.dst; tc->tc_proto = sav->sah->saidx.proto; - tc->tc_skip = skip + hlen; + tc->tc_protoff = protoff; + tc->tc_skip = skip; /* Crypto operation descriptor */ crp->crp_ilen = m->m_pkthdr.len; /* Total input length */ @@ -501,13 +464,12 @@ ipcomp_output_cb(struct cryptop *crp) struct ipsecrequest *isr; struct secasvar *sav; struct mbuf *m; - int error, skip, rlen; + int error, skip; tc = (struct tdb_crypto *) crp->crp_opaque; IPSEC_ASSERT(tc != NULL, ("null opaque data area!")); m = (struct mbuf *) crp->crp_buf; skip = tc->tc_skip; - rlen = crp->crp_ilen - skip; isr = tc->tc_isr; IPSECREQUEST_LOCK(isr); @@ -529,8 +491,7 @@ ipcomp_output_cb(struct cryptop *crp) if (crp->crp_etype == EAGAIN) { KEY_FREESAV(&sav); IPSECREQUEST_UNLOCK(isr); - error = crypto_dispatch(crp); - return error; + return crypto_dispatch(crp); } V_ipcompstat.ipcomps_noxform++; DPRINTF(("%s: crypto error %d\n", __func__, crp->crp_etype)); @@ -546,7 +507,46 @@ ipcomp_output_cb(struct cryptop *crp) } V_ipcompstat.ipcomps_hist[sav->alg_comp]++; - if (rlen > crp->crp_olen) { + if (crp->crp_ilen - skip > crp->crp_olen) { + struct mbuf *mo; + struct ipcomp *ipcomp; + int roff; + uint8_t prot; + + /* Compression helped, inject IPCOMP header. */ + mo = m_makespace(m, skip, IPCOMP_HLENGTH, &roff); + if (mo == NULL) { + V_ipcompstat.ipcomps_wrap++; + DPRINTF(("%s: IPCOMP header inject failed for IPCA %s/%08lx\n", + __func__, ipsec_address(&sav->sah->saidx.dst), + (u_long) ntohl(sav->spi))); + error = ENOBUFS; + goto bad; + } + ipcomp = (struct ipcomp *)(mtod(mo, caddr_t) + roff); + + /* Initialize the IPCOMP header */ + /* XXX alignment always correct? */ + switch (sav->sah->saidx.dst.sa.sa_family) { +#ifdef INET + case AF_INET: + ipcomp->comp_nxt = mtod(m, struct ip *)->ip_p; + break; +#endif /* INET */ +#ifdef INET6 + case AF_INET6: + ipcomp->comp_nxt = mtod(m, struct ip6_hdr *)->ip6_nxt; + break; +#endif + } + ipcomp->comp_flags = 0; + ipcomp->comp_cpi = htons((u_int16_t) ntohl(sav->spi)); + + /* Fix Next Protocol in IPv4/IPv6 header */ + prot = IPPROTO_IPCOMP; + m_copyback(m, tc->tc_protoff, sizeof(u_int8_t), + (u_char *)&prot); + /* Adjust the length in the IP header */ switch (sav->sah->saidx.dst.sa.sa_family) { #ifdef INET @@ -573,6 +573,8 @@ ipcomp_output_cb(struct cryptop *crp) } else { /* compression was useless, we have lost time */ /* XXX add statistic */ + /* XXX remember state to not compress the next couple + * of packets, RFC 3173, 2.2. Non-Expansion Policy */ } /* Release the crypto descriptor */ From owner-svn-src-head@FreeBSD.ORG Sun Nov 29 17:46:42 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9A0401065670; Sun, 29 Nov 2009 17:46:40 +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 893CA8FC1E; Sun, 29 Nov 2009 17:46:40 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nATHkekj002880; Sun, 29 Nov 2009 17:46:40 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nATHkeS1002878; Sun, 29 Nov 2009 17:46:40 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <200911291746.nATHkeS1002878@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Sun, 29 Nov 2009 17:46:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r199904 - head/sys/opencrypto X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Nov 2009 17:46:42 -0000 Author: bz Date: Sun Nov 29 17:46:40 2009 New Revision: 199904 URL: http://svn.freebsd.org/changeset/base/199904 Log: Add SDT iter probes forgotten in r199885. MFC after: 5 days Modified: head/sys/opencrypto/deflate.c Modified: head/sys/opencrypto/deflate.c ============================================================================== --- head/sys/opencrypto/deflate.c Sun Nov 29 17:44:44 2009 (r199903) +++ head/sys/opencrypto/deflate.c Sun Nov 29 17:46:40 2009 (r199904) @@ -148,6 +148,12 @@ deflate_global(data, size, decomp, out) zbuf.state->dummy, zbuf.total_out); goto bad; } + SDT_PROBE5(opencrypto, deflate, deflate_global, iter, + decomp, error, __LINE__, + zbuf.avail_in, zbuf.avail_out); + SDT_PROBE5(opencrypto, deflate, deflate_global, iter, + decomp, error, __LINE__, + zbuf.state->dummy, zbuf.total_out); if (decomp && zbuf.avail_in == 0 && error == Z_STREAM_END) { /* Done. */ break; From owner-svn-src-head@FreeBSD.ORG Sun Nov 29 17:47:49 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 80CD4106568D; Sun, 29 Nov 2009 17:47:49 +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 701D18FC12; Sun, 29 Nov 2009 17:47:49 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nATHln2K002934; Sun, 29 Nov 2009 17:47:49 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nATHln5v002932; Sun, 29 Nov 2009 17:47:49 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <200911291747.nATHln5v002932@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Sun, 29 Nov 2009 17:47:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r199905 - head/sys/netipsec X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Nov 2009 17:47:49 -0000 Author: bz Date: Sun Nov 29 17:47:49 2009 New Revision: 199905 URL: http://svn.freebsd.org/changeset/base/199905 Log: Assimilate very similar input and output code paths (no real functional change). MFC after: 5 days Modified: head/sys/netipsec/xform_ipcomp.c Modified: head/sys/netipsec/xform_ipcomp.c ============================================================================== --- head/sys/netipsec/xform_ipcomp.c Sun Nov 29 17:46:40 2009 (r199904) +++ head/sys/netipsec/xform_ipcomp.c Sun Nov 29 17:47:49 2009 (r199905) @@ -249,10 +249,8 @@ ipcomp_input_cb(struct cryptop *crp) if (crp->crp_etype == EAGAIN) { KEY_FREESAV(&sav); - error = crypto_dispatch(crp); - return error; + return crypto_dispatch(crp); } - V_ipcompstat.ipcomps_noxform++; DPRINTF(("%s: crypto error %d\n", __func__, crp->crp_etype)); error = crp->crp_etype; @@ -484,7 +482,7 @@ ipcomp_output_cb(struct cryptop *crp) /* Check for crypto errors */ if (crp->crp_etype) { - /* Reset session ID */ + /* Reset the session ID */ if (sav->tdb_cryptoid != 0) sav->tdb_cryptoid = crp->crp_sid; From owner-svn-src-head@FreeBSD.ORG Sun Nov 29 17:53:57 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B103E106566B; Sun, 29 Nov 2009 17:53:57 +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 A02758FC16; Sun, 29 Nov 2009 17:53:57 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nATHrv0v003073; Sun, 29 Nov 2009 17:53:57 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nATHrvcN003071; Sun, 29 Nov 2009 17:53:57 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <200911291753.nATHrvcN003071@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Sun, 29 Nov 2009 17:53:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r199906 - head/sys/opencrypto X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Nov 2009 17:53:57 -0000 Author: bz Date: Sun Nov 29 17:53:57 2009 New Revision: 199906 URL: http://svn.freebsd.org/changeset/base/199906 Log: In case the compression result is the same size as the orignal version, the compression was useless as well. Make sure to not update the data and return, else we would waste resources when decompressing. This also avoids the copyback() changing data other consumers like xform_ipcomp.c would have ignored because of no win and sent out without noting that compression was used, resulting in invalid packets at the receiver. MFC after: 5 days Modified: head/sys/opencrypto/cryptosoft.c Modified: head/sys/opencrypto/cryptosoft.c ============================================================================== --- head/sys/opencrypto/cryptosoft.c Sun Nov 29 17:47:49 2009 (r199905) +++ head/sys/opencrypto/cryptosoft.c Sun Nov 29 17:53:57 2009 (r199906) @@ -552,7 +552,7 @@ swcr_compdec(struct cryptodesc *crd, str sw->sw_size = result; /* Check the compressed size when doing compression */ if (crd->crd_flags & CRD_F_COMP) { - if (result > crd->crd_len) { + if (result >= crd->crd_len) { /* Compression was useless, we lost time */ free(out, M_CRYPTO_DATA); return 0; From owner-svn-src-head@FreeBSD.ORG Sun Nov 29 18:05:07 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 50913106566B; Sun, 29 Nov 2009 18:05:07 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mail.cksoft.de (mail.cksoft.de [IPv6:2001:4068:10::3]) by mx1.freebsd.org (Postfix) with ESMTP id 0D2768FC14; Sun, 29 Nov 2009 18:05:07 +0000 (UTC) Received: from localhost (amavis.fra.cksoft.de [192.168.74.71]) by mail.cksoft.de (Postfix) with ESMTP id 701E541C74D; Sun, 29 Nov 2009 19:05:06 +0100 (CET) X-Virus-Scanned: amavisd-new at cksoft.de Received: from mail.cksoft.de ([192.168.74.103]) by localhost (amavis.fra.cksoft.de [192.168.74.71]) (amavisd-new, port 10024) with ESMTP id jbizGoJMzWCy; Sun, 29 Nov 2009 19:05:05 +0100 (CET) Received: by mail.cksoft.de (Postfix, from userid 66) id AED2641C70C; Sun, 29 Nov 2009 19:05:05 +0100 (CET) Received: from maildrop.int.zabbadoz.net (maildrop.int.zabbadoz.net [10.111.66.10]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.int.zabbadoz.net (Postfix) with ESMTP id 235134448EC; Sun, 29 Nov 2009 18:00:56 +0000 (UTC) Date: Sun, 29 Nov 2009 18:00:56 +0000 (UTC) From: "Bjoern A. Zeeb" X-X-Sender: bz@maildrop.int.zabbadoz.net To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org In-Reply-To: <200911291053.nATArYrV086240@svn.freebsd.org> Message-ID: <20091129175432.K37440@maildrop.int.zabbadoz.net> References: <200911291053.nATArYrV086240@svn.freebsd.org> X-OpenPGP-Key: 0x14003F198FEFA3E77207EE8D2B58B8F83CCF1842 MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: Subject: Re: svn commit: r199899 - head/sys/netipsec X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Nov 2009 18:05:07 -0000 On Sun, 29 Nov 2009, Bjoern A. Zeeb wrote: > With this, after the opencrypto/deflate changes, IPcomp starts to work > apart from edge cases. Leave it disabled by default until those are > fixed as well. Note that after r199906 (apart from stats) IPcomp is working as good as net/zlib.? is. There are occational cases where we get a crypto error. An update to the latest zlib.? fixes this. I do have a patch but ideally we would want to just use an unchanged libz (we have 2-3 copies in sys/), a version without the classic PPP changes. For this to happen, ng_deflate will need to be "fixed"; it looks like it could need some zlib improvements for stability anyway from reading the code. Anyone who uses it and can test ng_deflate is welcome to contact me. /bz -- Bjoern A. Zeeb It will not break if you know what you are doing. From owner-svn-src-head@FreeBSD.ORG Sun Nov 29 20:17:50 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E2412106566C; Sun, 29 Nov 2009 20:17:50 +0000 (UTC) (envelope-from marcel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D27B28FC12; Sun, 29 Nov 2009 20:17:50 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nATKHogo007883; Sun, 29 Nov 2009 20:17:50 GMT (envelope-from marcel@svn.freebsd.org) Received: (from marcel@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nATKHoIe007881; Sun, 29 Nov 2009 20:17:50 GMT (envelope-from marcel@svn.freebsd.org) Message-Id: <200911292017.nATKHoIe007881@svn.freebsd.org> From: Marcel Moolenaar Date: Sun, 29 Nov 2009 20:17:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r199941 - head/sys/ia64/include X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Nov 2009 20:17:51 -0000 Author: marcel Date: Sun Nov 29 20:17:50 2009 New Revision: 199941 URL: http://svn.freebsd.org/changeset/base/199941 Log: Move the sysctl related fields to the end of the structure and make them conditional upon _KERNEL. libkvm includes and does not expose the structure definitions to userland. Modified: head/sys/ia64/include/pcpu.h Modified: head/sys/ia64/include/pcpu.h ============================================================================== --- head/sys/ia64/include/pcpu.h Sun Nov 29 20:12:07 2009 (r199940) +++ head/sys/ia64/include/pcpu.h Sun Nov 29 20:17:50 2009 (r199941) @@ -34,9 +34,6 @@ #include struct pcpu_stats { - struct sysctl_ctx_list pcs_sysctl_ctx; - struct sysctl_oid *pcs_sysctl_tree; - u_long pcs_nasts; /* IPI_AST counter. */ u_long pcs_nclks; /* Clock interrupt counter. */ u_long pcs_nextints; /* ExtINT counter. */ @@ -46,6 +43,11 @@ struct pcpu_stats { u_long pcs_nrdvs; /* IPI_RENDEZVOUS counter. */ u_long pcs_nstops; /* IPI_STOP counter. */ u_long pcs_nstrays; /* Stray interrupt counter. */ + +#ifdef _KERNEL + struct sysctl_ctx_list pcs_sysctl_ctx; + struct sysctl_oid *pcs_sysctl_tree; +#endif }; #define PCPU_MD_FIELDS \ From owner-svn-src-head@FreeBSD.ORG Sun Nov 29 20:37:31 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 01CC31065679; Sun, 29 Nov 2009 20:37:31 +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 E56B18FC15; Sun, 29 Nov 2009 20:37:30 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nATKbUw3008492; Sun, 29 Nov 2009 20:37:30 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nATKbUxY008488; Sun, 29 Nov 2009 20:37:30 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <200911292037.nATKbUxY008488@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Sun, 29 Nov 2009 20:37:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r199946 - in head: sys/netipsec usr.bin/netstat X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Nov 2009 20:37:31 -0000 Author: bz Date: Sun Nov 29 20:37:30 2009 New Revision: 199946 URL: http://svn.freebsd.org/changeset/base/199946 Log: Add more statistics variables for IPcomp. Try to version the struct in a backward compatible way. People asked for the versioning of the stats structs in general before. MFC after: 5 days Modified: head/sys/netipsec/ipcomp_var.h head/sys/netipsec/xform_ipcomp.c head/usr.bin/netstat/ipsec.c Modified: head/sys/netipsec/ipcomp_var.h ============================================================================== --- head/sys/netipsec/ipcomp_var.h Sun Nov 29 20:34:41 2009 (r199945) +++ head/sys/netipsec/ipcomp_var.h Sun Nov 29 20:37:30 2009 (r199946) @@ -41,6 +41,7 @@ */ #define IPCOMP_ALG_MAX 8 +#define IPCOMPSTAT_VERSION 1 struct ipcompstat { u_int32_t ipcomps_hdrops; /* Packet shorter than header shows */ u_int32_t ipcomps_nopf; /* Protocol family not supported */ @@ -58,6 +59,9 @@ struct ipcompstat { u_int32_t ipcomps_pdrops; /* Packet blocked due to policy */ u_int32_t ipcomps_crypto; /* "Crypto" processing failure */ u_int32_t ipcomps_hist[IPCOMP_ALG_MAX];/* Per-algorithm op count */ + u_int32_t version; /* Version of this structure. */ + u_int32_t ipcomps_threshold; /* Packet < comp. algo. threshold. */ + u_int32_t ipcomps_uncompr; /* Compression was useles. */ }; #ifdef _KERNEL Modified: head/sys/netipsec/xform_ipcomp.c ============================================================================== --- head/sys/netipsec/xform_ipcomp.c Sun Nov 29 20:34:41 2009 (r199945) +++ head/sys/netipsec/xform_ipcomp.c Sun Nov 29 20:37:30 2009 (r199946) @@ -345,7 +345,7 @@ ipcomp_output( * See RFC 3173, 2.2. Non-Expansion Policy. */ if (m->m_pkthdr.len <= ipcompx->minlen) { - /* XXX-BZ V_ipcompstat.threshold++; */ + V_ipcompstat.ipcomps_threshold++; return ipsec_process_done(m, isr); } @@ -569,8 +569,10 @@ ipcomp_output_cb(struct cryptop *crp) goto bad; } } else { - /* compression was useless, we have lost time */ - /* XXX add statistic */ + /* Compression was useless, we have lost time. */ + V_ipcompstat.ipcomps_uncompr++; + DPRINTF(("%s: compressions was useless %d - %d <= %d\n", + __func__, crp->crp_ilen, skip, crp->crp_olen)); /* XXX remember state to not compress the next couple * of packets, RFC 3173, 2.2. Non-Expansion Policy */ } @@ -609,3 +611,13 @@ ipcomp_attach(void) } SYSINIT(ipcomp_xform_init, SI_SUB_PROTO_DOMAIN, SI_ORDER_MIDDLE, ipcomp_attach, NULL); + +static void +vnet_ipcomp_attach(const void *unused __unused) +{ + + V_ipcompstat.version = IPCOMPSTAT_VERSION; +} + +VNET_SYSINIT(vnet_ipcomp_xform_init, SI_SUB_PROTO_DOMAIN, SI_ORDER_MIDDLE, + vnet_ipcomp_attach, NULL); Modified: head/usr.bin/netstat/ipsec.c ============================================================================== --- head/usr.bin/netstat/ipsec.c Sun Nov 29 20:34:41 2009 (r199945) +++ head/usr.bin/netstat/ipsec.c Sun Nov 29 20:37:30 2009 (r199946) @@ -418,6 +418,7 @@ esp_stats(u_long off, const char *name, static void print_ipcompstats(const struct ipcompstat *ipcompstat) { + uint32_t version; #define p32(f, m) if (ipcompstat->f || sflag <= 1) \ printf("\t%u" m, (unsigned int)ipcompstat->f, plural(ipcompstat->f)) #define p64(f, m) if (ipcompstat->f || sflag <= 1) \ @@ -425,6 +426,11 @@ print_ipcompstats(const struct ipcompsta #define hist(f, n, t) \ ipsec_hist_new((f), sizeof(f)/sizeof(f[0]), (n), (t)); +#ifndef IPCOMPSTAT_VERSION + version = 0; +#else + version = ipcompstat->version; +#endif p32(ipcomps_hdrops, " packet%s shorter than header shows\n"); p32(ipcomps_nopf, " packet%s dropped; protocol family not supported\n"); p32(ipcomps_notdb, " packet%s dropped; no TDB\n"); @@ -441,6 +447,10 @@ print_ipcompstats(const struct ipcompsta p32(ipcomps_pdrops, " packet%s blocked due to policy\n"); p32(ipcomps_crypto, " crypto processing failure%s\n"); hist(ipcompstat->ipcomps_hist, ipsec_compnames, "COMP output"); + if (version >= 1) { + p32(ipcomps_threshold, " packet%s sent uncompressed; size < compr. algo. threshold\n"); + p32(ipcomps_uncompr, " packet%s sent uncompressed; compression was useless\n"); + } #undef p32 #undef p64 From owner-svn-src-head@FreeBSD.ORG Sun Nov 29 20:47:44 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 345AD106566C; Sun, 29 Nov 2009 20:47:44 +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 1AA838FC15; Sun, 29 Nov 2009 20:47:44 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nATKlh1U008714; Sun, 29 Nov 2009 20:47:43 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nATKlh66008711; Sun, 29 Nov 2009 20:47:43 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <200911292047.nATKlh66008711@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Sun, 29 Nov 2009 20:47:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r199947 - in head: share/man/man4 sys/netipsec X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Nov 2009 20:47:44 -0000 Author: bz Date: Sun Nov 29 20:47:43 2009 New Revision: 199947 URL: http://svn.freebsd.org/changeset/base/199947 Log: Enable IPcomp by default. PR: kern/123587 MFC after: 5 days Modified: head/share/man/man4/ipsec.4 head/sys/netipsec/xform_ipcomp.c Modified: head/share/man/man4/ipsec.4 ============================================================================== --- head/share/man/man4/ipsec.4 Sun Nov 29 20:37:30 2009 (r199946) +++ head/share/man/man4/ipsec.4 Sun Nov 29 20:47:43 2009 (r199947) @@ -29,7 +29,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 23, 2009 +.Dd November 29, 2009 .Dt IPSEC 4 .Os .Sh NAME @@ -215,7 +215,7 @@ To selectively enable/disable protocols, .It Sy "Name Default" .It "net.inet.esp.esp_enable On" .It "net.inet.ah.ah_enable On" -.It "net.inet.ipcomp.ipcomp_enable Off" +.It "net.inet.ipcomp.ipcomp_enable On" .El .Pp In addition the following variables are accessible via @@ -408,6 +408,8 @@ size may alleviate this problem. .Pp The .Tn IPcomp -protocol support is currently broken. +protocol may occationally error because of +.Xr zlib 3 +problems. .Pp This documentation needs more review. Modified: head/sys/netipsec/xform_ipcomp.c ============================================================================== --- head/sys/netipsec/xform_ipcomp.c Sun Nov 29 20:37:30 2009 (r199946) +++ head/sys/netipsec/xform_ipcomp.c Sun Nov 29 20:47:43 2009 (r199947) @@ -68,7 +68,7 @@ #include #include -VNET_DEFINE(int, ipcomp_enable) = 0; +VNET_DEFINE(int, ipcomp_enable) = 1; VNET_DEFINE(struct ipcompstat, ipcompstat); SYSCTL_DECL(_net_inet_ipcomp); From owner-svn-src-head@FreeBSD.ORG Sun Nov 29 20:48:20 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4EEAE106566C; Sun, 29 Nov 2009 20:48:20 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3EEEF8FC1B; Sun, 29 Nov 2009 20:48:20 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nATKmKZ6008769; Sun, 29 Nov 2009 20:48:20 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nATKmKVc008767; Sun, 29 Nov 2009 20:48:20 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <200911292048.nATKmKVc008767@svn.freebsd.org> From: Nathan Whitehorn Date: Sun, 29 Nov 2009 20:48:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r199948 - head/sys/dev/usb/input X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Nov 2009 20:48:20 -0000 Author: nwhitehorn Date: Sun Nov 29 20:48:19 2009 New Revision: 199948 URL: http://svn.freebsd.org/changeset/base/199948 Log: Early-generation touchpads do not send periodic calibration frames for baseline subtraction, and are very temperature sensitive, so would slowly drift out of a calibrated state when under load. Escape this by taking the last frame before we decide that the pad is idle as a finger-free baseline. Tested on: iBook G4 Modified: head/sys/dev/usb/input/atp.c Modified: head/sys/dev/usb/input/atp.c ============================================================================== --- head/sys/dev/usb/input/atp.c Sun Nov 29 20:47:43 2009 (r199947) +++ head/sys/dev/usb/input/atp.c Sun Nov 29 20:48:19 2009 (r199948) @@ -1850,6 +1850,21 @@ atp_intr(struct usb_xfer *xfer, usb_erro sc->sc_idlecount++; if (sc->sc_idlecount >= ATP_IDLENESS_THRESHOLD) { DPRINTFN(ATP_LLEVEL_INFO, "idle\n"); + + /* + * Use the last frame before we go idle for + * calibration on pads which do not send + * calibration frames. + */ + if (sc->sc_params->prot < ATP_PROT_GEYSER3) { + memcpy(sc->base_x, sc->cur_x, + sc->sc_params->n_xsensors * + sizeof(*(sc->base_x))); + memcpy(sc->base_y, sc->cur_y, + sc->sc_params->n_ysensors * + sizeof(*(sc->base_y))); + } + sc->sc_idlecount = 0; usbd_transfer_start(sc->sc_xfer[ATP_RESET]); } From owner-svn-src-head@FreeBSD.ORG Sun Nov 29 20:51:23 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 95764106568D; Sun, 29 Nov 2009 20:51:23 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 856F08FC1D; Sun, 29 Nov 2009 20:51:23 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nATKpNEU008870; Sun, 29 Nov 2009 20:51:23 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nATKpNxc008868; Sun, 29 Nov 2009 20:51:23 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <200911292051.nATKpNxc008868@svn.freebsd.org> From: Nathan Whitehorn Date: Sun, 29 Nov 2009 20:51:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r199949 - head/sys/powerpc/conf X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Nov 2009 20:51:23 -0000 Author: nwhitehorn Date: Sun Nov 29 20:51:23 2009 New Revision: 199949 URL: http://svn.freebsd.org/changeset/base/199949 Log: Add atp(4) to powerpc GENERIC. Most late-generation Apple PowerPC laptops have trackpads that do not work at all without this driver. Modified: head/sys/powerpc/conf/GENERIC Modified: head/sys/powerpc/conf/GENERIC ============================================================================== --- head/sys/powerpc/conf/GENERIC Sun Nov 29 20:48:19 2009 (r199948) +++ head/sys/powerpc/conf/GENERIC Sun Nov 29 20:51:23 2009 (r199949) @@ -155,6 +155,7 @@ options KBD_INSTALL_CDEV # install a CD device ulpt # Printer device umass # Disks/Mass storage - Requires scbus and da0 device ums # Mouse +device atp # Apple USB touchpad device urio # Diamond Rio 500 MP3 player # USB Ethernet device aue # ADMtek USB Ethernet From owner-svn-src-head@FreeBSD.ORG Sun Nov 29 20:55:45 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 363E31065672; Sun, 29 Nov 2009 20:55:45 +0000 (UTC) (envelope-from gabor@FreeBSD.org) Received: from server.mypc.hu (server.mypc.hu [87.229.73.95]) by mx1.freebsd.org (Postfix) with ESMTP id D269D8FC13; Sun, 29 Nov 2009 20:55:44 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by server.mypc.hu (Postfix) with ESMTP id D8C0414D9D9B; Sun, 29 Nov 2009 21:55:41 +0100 (CET) X-Virus-Scanned: amavisd-new at example.com Received: from server.mypc.hu ([127.0.0.1]) by localhost (server.mypc.hu [127.0.0.1]) (amavisd-new, port 10024) with LMTP id AzIFvKg1W1NA; Sun, 29 Nov 2009 21:55:39 +0100 (CET) Received: from [192.168.1.105] (catv-89-132-179-104.catv.broadband.hu [89.132.179.104]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by server.mypc.hu (Postfix) with ESMTPSA id 0925614D9D47; Sun, 29 Nov 2009 21:55:38 +0100 (CET) Message-ID: <4B12DFC6.3050108@FreeBSD.org> Date: Sun, 29 Nov 2009 21:55:34 +0100 From: Gabor Kovesdan User-Agent: Thunderbird 2.0.0.23 (Windows/20090812) MIME-Version: 1.0 To: "Bjoern A. Zeeb" References: <200911292047.nATKlh66008711@svn.freebsd.org> In-Reply-To: <200911292047.nATKlh66008711@svn.freebsd.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r199947 - in head: share/man/man4 sys/netipsec X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Nov 2009 20:55:45 -0000 Bjoern A. Zeeb escribió: > -protocol support is currently broken. > +protocol may occationally error because of > +.Xr zlib 3 > +problems. > There's a typo here, should be occasionally. -- Gabor Kovesdan FreeBSD Volunteer EMAIL: gabor@FreeBSD.org .:|:. gabor@kovesdan.org WEB: http://people.FreeBSD.org/~gabor .:|:. http://kovesdan.org From owner-svn-src-head@FreeBSD.ORG Sun Nov 29 21:03:55 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 290F2106568B; Sun, 29 Nov 2009 21:03:55 +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 192668FC12; Sun, 29 Nov 2009 21:03:55 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nATL3sTI009147; Sun, 29 Nov 2009 21:03:54 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nATL3sPG009145; Sun, 29 Nov 2009 21:03:54 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <200911292103.nATL3sPG009145@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Sun, 29 Nov 2009 21:03:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r199950 - head/share/man/man4 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Nov 2009 21:03:55 -0000 Author: bz Date: Sun Nov 29 21:03:54 2009 New Revision: 199950 URL: http://svn.freebsd.org/changeset/base/199950 Log: Correct typo. Reported by: gabor MFC after: 5 days Modified: head/share/man/man4/ipsec.4 Modified: head/share/man/man4/ipsec.4 ============================================================================== --- head/share/man/man4/ipsec.4 Sun Nov 29 20:51:23 2009 (r199949) +++ head/share/man/man4/ipsec.4 Sun Nov 29 21:03:54 2009 (r199950) @@ -408,7 +408,7 @@ size may alleviate this problem. .Pp The .Tn IPcomp -protocol may occationally error because of +protocol may occasionally error because of .Xr zlib 3 problems. .Pp From owner-svn-src-head@FreeBSD.ORG Sun Nov 29 21:05:07 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5F1791065670; Sun, 29 Nov 2009 21:05:07 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mail.cksoft.de (mail.cksoft.de [IPv6:2001:4068:10::3]) by mx1.freebsd.org (Postfix) with ESMTP id 19CEF8FC08; Sun, 29 Nov 2009 21:05:07 +0000 (UTC) Received: from localhost (amavis.fra.cksoft.de [192.168.74.71]) by mail.cksoft.de (Postfix) with ESMTP id 7918D41C677; Sun, 29 Nov 2009 22:05:06 +0100 (CET) X-Virus-Scanned: amavisd-new at cksoft.de Received: from mail.cksoft.de ([192.168.74.103]) by localhost (amavis.fra.cksoft.de [192.168.74.71]) (amavisd-new, port 10024) with ESMTP id 6Ro5Zir0hGti; Sun, 29 Nov 2009 22:05:05 +0100 (CET) Received: by mail.cksoft.de (Postfix, from userid 66) id CC2E441C67E; Sun, 29 Nov 2009 22:05:05 +0100 (CET) Received: from maildrop.int.zabbadoz.net (maildrop.int.zabbadoz.net [10.111.66.10]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.int.zabbadoz.net (Postfix) with ESMTP id 85CFF4448EC; Sun, 29 Nov 2009 21:04:09 +0000 (UTC) Date: Sun, 29 Nov 2009 21:04:09 +0000 (UTC) From: "Bjoern A. Zeeb" X-X-Sender: bz@maildrop.int.zabbadoz.net To: Gabor Kovesdan In-Reply-To: <4B12DFC6.3050108@FreeBSD.org> Message-ID: <20091129210357.Y37440@maildrop.int.zabbadoz.net> References: <200911292047.nATKlh66008711@svn.freebsd.org> <4B12DFC6.3050108@FreeBSD.org> X-OpenPGP-Key: 0x14003F198FEFA3E77207EE8D2B58B8F83CCF1842 MIME-Version: 1.0 Content-Type: MULTIPART/MIXED; BOUNDARY="0-10082989-1259528649=:37440" Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r199947 - in head: share/man/man4 sys/netipsec X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Nov 2009 21:05:07 -0000 This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --0-10082989-1259528649=:37440 Content-Type: TEXT/PLAIN; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: QUOTED-PRINTABLE On Sun, 29 Nov 2009, Gabor Kovesdan wrote: > Bjoern A. Zeeb escribi=F3: >> -protocol support is currently broken. >> +protocol may occationally error because of >> +.Xr zlib 3 >> +problems. >>=20 > There's a typo here, should be occasionally. Fixed, thanks! --=20 Bjoern A. Zeeb It will not break if you know what you are doing. --0-10082989-1259528649=:37440-- From owner-svn-src-head@FreeBSD.ORG Sun Nov 29 22:33:59 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 696251065672; Sun, 29 Nov 2009 22:33:59 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5713A8FC08; Sun, 29 Nov 2009 22:33:59 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nATMXxPk011548; Sun, 29 Nov 2009 22:33:59 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nATMXxIn011543; Sun, 29 Nov 2009 22:33:59 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <200911292233.nATMXxIn011543@svn.freebsd.org> From: Jilles Tjoelker Date: Sun, 29 Nov 2009 22:33:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r199953 - in head: bin/sh tools/regression/bin/sh/execution X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Nov 2009 22:33:59 -0000 Author: jilles Date: Sun Nov 29 22:33:59 2009 New Revision: 199953 URL: http://svn.freebsd.org/changeset/base/199953 Log: Fix some cases where file descriptors from redirections leak to programs. - Redirecting fds that were not open before kept two copies of the redirected file. sh -c '{ :; } 7>/dev/null; fstat -p $$; true' (both fd 7 and 10 remained open) - File descriptors used to restore things after redirection were not set close-on-exec, instead they were explicitly closed before executing a program normally and before executing a shell procedure. The latter must remain but the former is replaced by close-on-exec. sh -c 'exec 7/dev/null; true' (fd 10 remained open) The examples above are simpler than the testsuite because I do not want to use fstat or procstat in the testsuite. Added: head/tools/regression/bin/sh/execution/redir1.0 (contents, props changed) head/tools/regression/bin/sh/execution/redir2.0 (contents, props changed) Modified: head/bin/sh/eval.c head/bin/sh/redir.c Modified: head/bin/sh/eval.c ============================================================================== --- head/bin/sh/eval.c Sun Nov 29 21:34:52 2009 (r199952) +++ head/bin/sh/eval.c Sun Nov 29 22:33:59 2009 (r199953) @@ -883,7 +883,6 @@ cmddone: #ifdef DEBUG trputs("normal command: "); trargs(argv); #endif - clearredir(); redirect(cmd->ncmd.redirect, 0); for (sp = varlist.list ; sp ; sp = sp->next) setvareq(sp->text, VEXPORT|VSTACK); Modified: head/bin/sh/redir.c ============================================================================== --- head/bin/sh/redir.c Sun Nov 29 21:34:52 2009 (r199952) +++ head/bin/sh/redir.c Sun Nov 29 22:33:59 2009 (r199953) @@ -63,6 +63,7 @@ __FBSDID("$FreeBSD$"); #define EMPTY -2 /* marks an unused slot in redirtab */ +#define CLOSED -1 /* fd was not open before redir */ #define PIPESIZE 4096 /* amount of buffering in a pipe */ @@ -101,7 +102,6 @@ redirect(union node *redir, int flags) struct redirtab *sv = NULL; int i; int fd; - int try; char memory[10]; /* file descriptors to write to memory */ for (i = 10 ; --i >= 0 ; ) @@ -116,38 +116,30 @@ redirect(union node *redir, int flags) } for (n = redir ; n ; n = n->nfile.next) { fd = n->nfile.fd; - try = 0; if ((n->nfile.type == NTOFD || n->nfile.type == NFROMFD) && n->ndup.dupfd == fd) continue; /* redirect from/to same file descriptor */ if ((flags & REDIR_PUSH) && sv->renamed[fd] == EMPTY) { INTOFF; -again: if ((i = fcntl(fd, F_DUPFD, 10)) == -1) { switch (errno) { case EBADF: - if (!try) { - openredirect(n, memory); - try++; - goto again; - } - /* FALLTHROUGH*/ + i = CLOSED; + break; default: INTON; error("%d: %s", fd, strerror(errno)); break; } - } - if (!try) { - sv->renamed[fd] = i; - } + } else + (void)fcntl(i, F_SETFD, FD_CLOEXEC); + sv->renamed[fd] = i; INTON; } if (fd == 0) fd0_redirected++; - if (!try) - openredirect(n, memory); + openredirect(n, memory); } if (memory[1]) out1 = &memout; Added: head/tools/regression/bin/sh/execution/redir1.0 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/bin/sh/execution/redir1.0 Sun Nov 29 22:33:59 2009 (r199953) @@ -0,0 +1,27 @@ +# $FreeBSD$ +trap ': $((brokenpipe+=1))' pipe + +P=${TMPDIR:-/tmp} +cd $P +T=$(mktemp -d sh-test.XXXXXX) +cd $T + +brokenpipe=0 +mkfifo fifo1 fifo2 +read dummy >fifo2 fifo2 +} 3fifo1 +if [ $brokenpipe -ne 0 ]; then + rc=3 +fi +wait +echo dummy >&4 +if [ $brokenpipe -eq 1 ]; then + : ${rc:=0} +fi + +rm fifo1 fifo2 +rmdir ${P}/${T} +exit ${rc:-3} Added: head/tools/regression/bin/sh/execution/redir2.0 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/bin/sh/execution/redir2.0 Sun Nov 29 22:33:59 2009 (r199953) @@ -0,0 +1,29 @@ +# $FreeBSD$ +trap ': $((brokenpipe+=1))' pipe + +P=${TMPDIR:-/tmp} +cd $P +T=$(mktemp -d sh-test.XXXXXX) +cd $T + +brokenpipe=0 +mkfifo fifo1 fifo2 +{ + { + exec sh -c 'exec fifo2 +exec 3>fifo1 +echo dummy >&4 +if [ $brokenpipe -eq 1 ]; then + : ${rc:=0} +fi +echo dummy >&3 +wait + +rm fifo1 fifo2 +rmdir ${P}/${T} +exit ${rc:-3} From owner-svn-src-head@FreeBSD.ORG Sun Nov 29 22:58:10 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C15571065741; Sun, 29 Nov 2009 22:58:10 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id AEC3E8FC14; Sun, 29 Nov 2009 22:58:10 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nATMwA6I012088; Sun, 29 Nov 2009 22:58:10 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nATMwArp012085; Sun, 29 Nov 2009 22:58:10 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <200911292258.nATMwArp012085@svn.freebsd.org> From: Jilles Tjoelker Date: Sun, 29 Nov 2009 22:58:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r199955 - in head/tools/regression/bin/sh: builtins errors X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Nov 2009 22:58:10 -0000 Author: jilles Date: Sun Nov 29 22:58:10 2009 New Revision: 199955 URL: http://svn.freebsd.org/changeset/base/199955 Log: Disable job control when running 'sh -i' in the testsuite. Job control tty manipulations sometimes cause the tests to stop (SIGTTOU and the like) when run from the 'prove' tool. Modified: head/tools/regression/bin/sh/builtins/fc1.0 head/tools/regression/bin/sh/errors/backquote-error1.0 Modified: head/tools/regression/bin/sh/builtins/fc1.0 ============================================================================== --- head/tools/regression/bin/sh/builtins/fc1.0 Sun Nov 29 22:43:51 2009 (r199954) +++ head/tools/regression/bin/sh/builtins/fc1.0 Sun Nov 29 22:58:10 2009 (r199955) @@ -8,7 +8,7 @@ T=$(mktemp -d sh-test.XXXXXX) cd $T mkfifo input output error -HISTFILE=/dev/null sh -i output 2>error & +HISTFILE=/dev/null sh +m -i output 2>error & { # Syntax error echo ')' >&3 Modified: head/tools/regression/bin/sh/errors/backquote-error1.0 ============================================================================== --- head/tools/regression/bin/sh/errors/backquote-error1.0 Sun Nov 29 22:43:51 2009 (r199954) +++ head/tools/regression/bin/sh/errors/backquote-error1.0 Sun Nov 29 22:58:10 2009 (r199955) @@ -1,4 +1,4 @@ # $FreeBSD$ -echo 'echo `for` echo ".BAD"CODE.' | sh -i 2>&1 | grep -q BADCODE && exit 1 +echo 'echo `for` echo ".BAD"CODE.' | sh +m -i 2>&1 | grep -q BADCODE && exit 1 exit 0 From owner-svn-src-head@FreeBSD.ORG Mon Nov 30 03:38:34 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B89C7106568D; Mon, 30 Nov 2009 03:38:34 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A55DC8FC26; Mon, 30 Nov 2009 03:38:34 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nAU3cYef017487; Mon, 30 Nov 2009 03:38:34 GMT (envelope-from dougb@svn.freebsd.org) Received: (from dougb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nAU3cYou017476; Mon, 30 Nov 2009 03:38:34 GMT (envelope-from dougb@svn.freebsd.org) Message-Id: <200911300338.nAU3cYou017476@svn.freebsd.org> From: Doug Barton Date: Mon, 30 Nov 2009 03:38:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r199958 - in head: contrib/bind9 contrib/bind9/bin/named contrib/bind9/lib/dns contrib/bind9/lib/dns/include/dns lib/bind X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Nov 2009 03:38:34 -0000 Author: dougb Date: Mon Nov 30 03:38:34 2009 New Revision: 199958 URL: http://svn.freebsd.org/changeset/base/199958 Log: Update to BIND 9.6.1-P2. The vulnerability this is designed to fix is related to DNSSEC validation on a resolving name server that allows access to untrusted users. If your system does not fall into all 3 of these categories you do not need to update immediately. Modified: head/contrib/bind9/CHANGES head/contrib/bind9/bin/named/query.c head/contrib/bind9/lib/dns/api head/contrib/bind9/lib/dns/include/dns/types.h head/contrib/bind9/lib/dns/masterdump.c head/contrib/bind9/lib/dns/rbtdb.c head/contrib/bind9/lib/dns/resolver.c head/contrib/bind9/lib/dns/validator.c head/contrib/bind9/version head/lib/bind/config.h Directory Properties: head/contrib/bind9/ (props changed) Modified: head/contrib/bind9/CHANGES ============================================================================== --- head/contrib/bind9/CHANGES Mon Nov 30 03:00:41 2009 (r199957) +++ head/contrib/bind9/CHANGES Mon Nov 30 03:38:34 2009 (r199958) @@ -1,3 +1,9 @@ + --- 9.6.1-P2 released --- + +2772. [security] When validating, track whether pending data was from + the additional section or not and only return it if + validates as secure. [RT #20438] + --- 9.6.1-P1 released --- 2640. [security] A specially crafted update packet will cause named Modified: head/contrib/bind9/bin/named/query.c ============================================================================== --- head/contrib/bind9/bin/named/query.c Mon Nov 30 03:00:41 2009 (r199957) +++ head/contrib/bind9/bin/named/query.c Mon Nov 30 03:38:34 2009 (r199958) @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: query.c,v 1.313.20.7 2009/03/13 01:38:51 marka Exp $ */ +/* $Id: query.c,v 1.313.20.7.12.1 2009/11/18 23:58:04 marka Exp $ */ /*! \file */ @@ -116,6 +116,8 @@ #define DNS_GETDB_NOLOG 0x02U #define DNS_GETDB_PARTIAL 0x04U +#define PENDINGOK(x) (((x) & DNS_DBFIND_PENDINGOK) != 0) + typedef struct client_additionalctx { ns_client_t *client; dns_rdataset_t *rdataset; @@ -1761,8 +1763,8 @@ query_addadditional2(void *arg, dns_name */ if (result == ISC_R_SUCCESS && additionaltype == dns_rdatasetadditional_fromcache && - (rdataset->trust == dns_trust_pending || - rdataset->trust == dns_trust_glue) && + (DNS_TRUST_PENDING(rdataset->trust) || + DNS_TRUST_GLUE(rdataset->trust)) && !validate(client, db, fname, rdataset, sigrdataset)) { dns_rdataset_disassociate(rdataset); if (dns_rdataset_isassociated(sigrdataset)) @@ -1801,8 +1803,8 @@ query_addadditional2(void *arg, dns_name */ if (result == ISC_R_SUCCESS && additionaltype == dns_rdatasetadditional_fromcache && - (rdataset->trust == dns_trust_pending || - rdataset->trust == dns_trust_glue) && + (DNS_TRUST_PENDING(rdataset->trust) || + DNS_TRUST_GLUE(rdataset->trust)) && !validate(client, db, fname, rdataset, sigrdataset)) { dns_rdataset_disassociate(rdataset); if (dns_rdataset_isassociated(sigrdataset)) @@ -2601,14 +2603,14 @@ query_addbestns(ns_client_t *client) { /* * Attempt to validate RRsets that are pending or that are glue. */ - if ((rdataset->trust == dns_trust_pending || - (sigrdataset != NULL && sigrdataset->trust == dns_trust_pending)) + if ((DNS_TRUST_PENDING(rdataset->trust) || + (sigrdataset != NULL && DNS_TRUST_PENDING(sigrdataset->trust))) && !validate(client, db, fname, rdataset, sigrdataset) && - (client->query.dboptions & DNS_DBFIND_PENDINGOK) == 0) + !PENDINGOK(client->query.dboptions)) goto cleanup; - if ((rdataset->trust == dns_trust_glue || - (sigrdataset != NULL && sigrdataset->trust == dns_trust_glue)) && + if ((DNS_TRUST_GLUE(rdataset->trust) || + (sigrdataset != NULL && DNS_TRUST_GLUE(sigrdataset->trust))) && !validate(client, db, fname, rdataset, sigrdataset) && SECURE(client) && WANTDNSSEC(client)) goto cleanup; @@ -3716,6 +3718,8 @@ query_find(ns_client_t *client, dns_fetc dns_rdataset_t *noqname; isc_boolean_t resuming; int line = -1; + dns_rdataset_t tmprdataset; + unsigned int dboptions; CTRACE("query_find"); @@ -3933,9 +3937,49 @@ query_find(ns_client_t *client, dns_fetc /* * Now look for an answer in the database. */ + dboptions = client->query.dboptions; + if (sigrdataset == NULL && client->view->enablednssec) { + /* + * If the client doesn't want DNSSEC we still want to + * look for any data pending validation to save a remote + * lookup if possible. + */ + dns_rdataset_init(&tmprdataset); + sigrdataset = &tmprdataset; + dboptions |= DNS_DBFIND_PENDINGOK; + } + refind: result = dns_db_find(db, client->query.qname, version, type, - client->query.dboptions, client->now, - &node, fname, rdataset, sigrdataset); + dboptions, client->now, &node, fname, + rdataset, sigrdataset); + /* + * If we have found pending data try to validate it. + * If the data does not validate as secure and we can't + * use the unvalidated data requery the database with + * pending disabled to prevent infinite looping. + */ + if (result != ISC_R_SUCCESS || !DNS_TRUST_PENDING(rdataset->trust)) + goto validation_done; + if (validate(client, db, fname, rdataset, sigrdataset)) + goto validation_done; + if (rdataset->trust != dns_trust_pending_answer || + !PENDINGOK(client->query.dboptions)) { + dns_rdataset_disassociate(rdataset); + if (sigrdataset != NULL && + dns_rdataset_isassociated(sigrdataset)) + dns_rdataset_disassociate(sigrdataset); + if (sigrdataset == &tmprdataset) + sigrdataset = NULL; + dns_db_detachnode(db, &node); + dboptions &= ~DNS_DBFIND_PENDINGOK; + goto refind; + } + validation_done: + if (sigrdataset == &tmprdataset) { + if (dns_rdataset_isassociated(sigrdataset)) + dns_rdataset_disassociate(sigrdataset); + sigrdataset = NULL; + } resume: CTRACE("query_find: resume"); Modified: head/contrib/bind9/lib/dns/api ============================================================================== --- head/contrib/bind9/lib/dns/api Mon Nov 30 03:00:41 2009 (r199957) +++ head/contrib/bind9/lib/dns/api Mon Nov 30 03:38:34 2009 (r199958) @@ -1,3 +1,3 @@ -LIBINTERFACE = 52 +LIBINTERFACE = 53 LIBREVISION = 0 -LIBAGE = 2 +LIBAGE = 0 Modified: head/contrib/bind9/lib/dns/include/dns/types.h ============================================================================== --- head/contrib/bind9/lib/dns/include/dns/types.h Mon Nov 30 03:00:41 2009 (r199957) +++ head/contrib/bind9/lib/dns/include/dns/types.h Mon Nov 30 03:38:34 2009 (r199958) @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: types.h,v 1.130.50.3 2009/01/29 22:40:35 jinmei Exp $ */ +/* $Id: types.h,v 1.130.50.3.12.1 2009/11/18 23:58:04 marka Exp $ */ #ifndef DNS_TYPES_H #define DNS_TYPES_H 1 @@ -258,40 +258,52 @@ enum { dns_trust_none = 0, #define dns_trust_none ((dns_trust_t)dns_trust_none) - /*% Subject to DNSSEC validation but has not yet been validated */ - dns_trust_pending = 1, -#define dns_trust_pending ((dns_trust_t)dns_trust_pending) + /*% + * Subject to DNSSEC validation but has not yet been validated + * dns_trust_pending_additional (from the additional section). + */ + dns_trust_pending_additional = 1, +#define dns_trust_pending_additional \ + ((dns_trust_t)dns_trust_pending_additional) + + dns_trust_pending_answer = 2, +#define dns_trust_pending_answer ((dns_trust_t)dns_trust_pending_answer) /*% Received in the additional section of a response. */ - dns_trust_additional = 2, + dns_trust_additional = 3, #define dns_trust_additional ((dns_trust_t)dns_trust_additional) /* Received in a referral response. */ - dns_trust_glue = 3, + dns_trust_glue = 4, #define dns_trust_glue ((dns_trust_t)dns_trust_glue) /* Answer from a non-authoritative server */ - dns_trust_answer = 4, + dns_trust_answer = 5, #define dns_trust_answer ((dns_trust_t)dns_trust_answer) /* Received in the authority section as part of an authoritative response */ - dns_trust_authauthority = 5, + dns_trust_authauthority = 6, #define dns_trust_authauthority ((dns_trust_t)dns_trust_authauthority) /* Answer from an authoritative server */ - dns_trust_authanswer = 6, + dns_trust_authanswer = 7, #define dns_trust_authanswer ((dns_trust_t)dns_trust_authanswer) /* Successfully DNSSEC validated */ - dns_trust_secure = 7, + dns_trust_secure = 8, #define dns_trust_secure ((dns_trust_t)dns_trust_secure) /* This server is authoritative */ - dns_trust_ultimate = 8 + dns_trust_ultimate = 9 #define dns_trust_ultimate ((dns_trust_t)dns_trust_ultimate) }; +#define DNS_TRUST_PENDING(x) ((x) == dns_trust_pending_answer || \ + (x) == dns_trust_pending_additional) +#define DNS_TRUST_GLUE(x) ((x) == dns_trust_glue) + + /*% * Name checking severities. */ Modified: head/contrib/bind9/lib/dns/masterdump.c ============================================================================== --- head/contrib/bind9/lib/dns/masterdump.c Mon Nov 30 03:00:41 2009 (r199957) +++ head/contrib/bind9/lib/dns/masterdump.c Mon Nov 30 03:38:34 2009 (r199958) @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: masterdump.c,v 1.94.50.2 2009/01/18 23:47:40 tbox Exp $ */ +/* $Id: masterdump.c,v 1.94.50.2.12.1 2009/11/18 23:58:04 marka Exp $ */ /*! \file */ @@ -775,7 +775,8 @@ dump_order_compare(const void *a, const static const char *trustnames[] = { "none", - "pending", + "pending-additional", + "pending-answer", "additional", "glue", "answer", Modified: head/contrib/bind9/lib/dns/rbtdb.c ============================================================================== --- head/contrib/bind9/lib/dns/rbtdb.c Mon Nov 30 03:00:41 2009 (r199957) +++ head/contrib/bind9/lib/dns/rbtdb.c Mon Nov 30 03:38:34 2009 (r199958) @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: rbtdb.c,v 1.270.12.6 2009/05/06 23:34:30 jinmei Exp $ */ +/* $Id: rbtdb.c,v 1.270.12.6.10.1 2009/11/18 23:58:04 marka Exp $ */ /*! \file */ @@ -4005,7 +4005,7 @@ cache_zonecut_callback(dns_rbtnode_t *no } if (dname_header != NULL && - (dname_header->trust != dns_trust_pending || + (!DNS_TRUST_PENDING(dname_header->trust) || (search->options & DNS_DBFIND_PENDINGOK) != 0)) { /* * We increment the reference count on node to ensure that @@ -4548,7 +4548,7 @@ cache_find(dns_db_t *db, dns_name_t *nam if (found == NULL || (found->trust == dns_trust_glue && ((options & DNS_DBFIND_GLUEOK) == 0)) || - (found->trust == dns_trust_pending && + (DNS_TRUST_PENDING(found->trust) && ((options & DNS_DBFIND_PENDINGOK) == 0))) { /* * If there is an NS rdataset at this node, then this is the Modified: head/contrib/bind9/lib/dns/resolver.c ============================================================================== --- head/contrib/bind9/lib/dns/resolver.c Mon Nov 30 03:00:41 2009 (r199957) +++ head/contrib/bind9/lib/dns/resolver.c Mon Nov 30 03:38:34 2009 (r199958) @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: resolver.c,v 1.384.14.14 2009/06/02 23:47:13 tbox Exp $ */ +/* $Id: resolver.c,v 1.384.14.14.8.1 2009/11/18 23:58:04 marka Exp $ */ /*! \file */ @@ -4293,6 +4293,7 @@ cache_name(fetchctx_t *fctx, dns_name_t * for it, unless it is glue. */ if (secure_domain && rdataset->trust != dns_trust_glue) { + dns_trust_t trust; /* * RRSIGs are validated as part of validating the * type they cover. @@ -4329,12 +4330,34 @@ cache_name(fetchctx_t *fctx, dns_name_t } /* + * Reject out of bailiwick additional records + * without RRSIGs as they can't possibly validate + * as "secure" and as we will never never want to + * store these as "answers" after validation. + */ + if (rdataset->trust == dns_trust_additional && + sigrdataset == NULL && EXTERNAL(rdataset)) + continue; + + /* + * XXXMPA: If we store as "answer" after validating + * then we need to do bailiwick processing and + * also need to track whether RRsets are in or + * out of bailiwick. This will require a another + * pending trust level. + * * Cache this rdataset/sigrdataset pair as - * pending data. + * pending data. Track whether it was additional + * or not. */ - rdataset->trust = dns_trust_pending; + if (rdataset->trust == dns_trust_additional) + trust = dns_trust_pending_additional; + else + trust = dns_trust_pending_answer; + + rdataset->trust = trust; if (sigrdataset != NULL) - sigrdataset->trust = dns_trust_pending; + sigrdataset->trust = trust; if (!need_validation || !ANSWER(rdataset)) { addedrdataset = ardataset; result = dns_db_addrdataset(fctx->cache, node, @@ -4682,7 +4705,7 @@ ncache_message(fetchctx_t *fctx, dns_adb for (trdataset = ISC_LIST_HEAD(tname->list); trdataset != NULL; trdataset = ISC_LIST_NEXT(trdataset, link)) - trdataset->trust = dns_trust_pending; + trdataset->trust = dns_trust_pending_answer; result = dns_message_nextname(fctx->rmessage, DNS_SECTION_AUTHORITY); } Modified: head/contrib/bind9/lib/dns/validator.c ============================================================================== --- head/contrib/bind9/lib/dns/validator.c Mon Nov 30 03:00:41 2009 (r199957) +++ head/contrib/bind9/lib/dns/validator.c Mon Nov 30 03:38:34 2009 (r199958) @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: validator.c,v 1.164.12.9 2009/05/07 23:47:12 tbox Exp $ */ +/* $Id: validator.c,v 1.164.12.9.8.1 2009/11/18 23:58:04 marka Exp $ */ #include @@ -1607,7 +1607,7 @@ get_key(dns_validator_t *val, dns_rdata_ * We have an rrset for the given keyname. */ val->keyset = &val->frdataset; - if (val->frdataset.trust == dns_trust_pending && + if (DNS_TRUST_PENDING(val->frdataset.trust) && dns_rdataset_isassociated(&val->fsigrdataset)) { /* @@ -1622,7 +1622,7 @@ get_key(dns_validator_t *val, dns_rdata_ if (result != ISC_R_SUCCESS) return (result); return (DNS_R_WAIT); - } else if (val->frdataset.trust == dns_trust_pending) { + } else if (DNS_TRUST_PENDING(val->frdataset.trust)) { /* * Having a pending key with no signature means that * something is broken. @@ -2243,7 +2243,7 @@ validatezonekey(dns_validator_t *val) { * We have DS records. */ val->dsset = &val->frdataset; - if (val->frdataset.trust == dns_trust_pending && + if (DNS_TRUST_PENDING(val->frdataset.trust) && dns_rdataset_isassociated(&val->fsigrdataset)) { result = create_validator(val, @@ -2256,7 +2256,7 @@ validatezonekey(dns_validator_t *val) { if (result != ISC_R_SUCCESS) return (result); return (DNS_R_WAIT); - } else if (val->frdataset.trust == dns_trust_pending) { + } else if (DNS_TRUST_PENDING(val->frdataset.trust)) { /* * There should never be an unsigned DS. */ @@ -3337,7 +3337,7 @@ proveunsecure(dns_validator_t *val, isc_ * There is no DS. If this is a delegation, * we maybe done. */ - if (val->frdataset.trust == dns_trust_pending) { + if (DNS_TRUST_PENDING(val->frdataset.trust)) { result = create_fetch(val, tname, dns_rdatatype_ds, dsfetched2, Modified: head/contrib/bind9/version ============================================================================== --- head/contrib/bind9/version Mon Nov 30 03:00:41 2009 (r199957) +++ head/contrib/bind9/version Mon Nov 30 03:38:34 2009 (r199958) @@ -1,4 +1,4 @@ -# $Id: version,v 1.43.12.5.8.1 2009/07/28 14:18:08 marka Exp $ +# $Id: version,v 1.43.12.5.8.2 2009/11/18 23:58:04 marka Exp $ # # This file must follow /bin/sh rules. It is imported directly via # configure. @@ -7,4 +7,4 @@ MAJORVER=9 MINORVER=6 PATCHVER=1 RELEASETYPE=-P -RELEASEVER=1 +RELEASEVER=2 Modified: head/lib/bind/config.h ============================================================================== --- head/lib/bind/config.h Mon Nov 30 03:00:41 2009 (r199957) +++ head/lib/bind/config.h Mon Nov 30 03:38:34 2009 (r199958) @@ -277,6 +277,10 @@ int sigwait(const unsigned int *set, int /* Define to 1 if you have the header file. */ #define HAVE_UNISTD_H 1 +/* Define to the sub-directory in which libtool stores uninstalled libraries. + */ +#define LT_OBJDIR ".libs/" + /* Defined if extern char *optarg is not declared. */ /* #undef NEED_OPTARG */ From owner-svn-src-head@FreeBSD.ORG Mon Nov 30 04:20:44 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E0DCD106566B; Mon, 30 Nov 2009 04:20:43 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CF6A78FC14; Mon, 30 Nov 2009 04:20:43 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nAU4Khnu018287; Mon, 30 Nov 2009 04:20:43 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nAU4KhQQ018284; Mon, 30 Nov 2009 04:20:43 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200911300420.nAU4KhQQ018284@svn.freebsd.org> From: Kip Macy Date: Mon, 30 Nov 2009 04:20:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r199959 - head/sys/dev/xen/blkfront X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Nov 2009 04:20:44 -0000 Author: kmacy Date: Mon Nov 30 04:20:43 2009 New Revision: 199959 URL: http://svn.freebsd.org/changeset/base/199959 Log: Update license to reflect terms in xen 2.0 as of the time when the driver was ported to FreeBSD Modified: head/sys/dev/xen/blkfront/blkfront.c head/sys/dev/xen/blkfront/block.h Modified: head/sys/dev/xen/blkfront/blkfront.c ============================================================================== --- head/sys/dev/xen/blkfront/blkfront.c Mon Nov 30 03:38:34 2009 (r199958) +++ head/sys/dev/xen/blkfront/blkfront.c Mon Nov 30 04:20:43 2009 (r199959) @@ -1,24 +1,29 @@ -/*- - * All rights reserved. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - */ - /* * XenBSD block device driver * * Copyright (c) 2009 Frank Suchomel, Citrix + * Copyright (c) 2009 Doug F. Rabson, Citrix + * Copyright (c) 2005 Kip Macy + * Copyright (c) 2003-2004, Keir Fraser & Steve Hand + * Modifications by Mark A. Williamson are (c) Intel Research Cambridge + * + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. */ #include Modified: head/sys/dev/xen/blkfront/block.h ============================================================================== --- head/sys/dev/xen/blkfront/block.h Mon Nov 30 03:38:34 2009 (r199958) +++ head/sys/dev/xen/blkfront/block.h Mon Nov 30 04:20:43 2009 (r199959) @@ -1,5 +1,23 @@ /* * + * XenBSD block device driver + * + * Copyright (c) 2009 Frank Suchomel, Citrix + * Copyright (c) 2009 Doug F. Rabson, Citrix + * Copyright (c) 2005 Kip Macy + * Copyright (c) 2003-2004, Keir Fraser & Steve Hand + * Modifications by Mark A. Williamson are (c) Intel Research Cambridge + * + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE From owner-svn-src-head@FreeBSD.ORG Mon Nov 30 04:32:35 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 48F921065670; Mon, 30 Nov 2009 04:32:35 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 36CBE8FC13; Mon, 30 Nov 2009 04:32:35 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nAU4WYti018516; Mon, 30 Nov 2009 04:32:34 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nAU4WYeA018513; Mon, 30 Nov 2009 04:32:34 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200911300432.nAU4WYeA018513@svn.freebsd.org> From: Kip Macy Date: Mon, 30 Nov 2009 04:32:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r199960 - head/sys/dev/xen/blkfront X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Nov 2009 04:32:35 -0000 Author: kmacy Date: Mon Nov 30 04:32:34 2009 New Revision: 199960 URL: http://svn.freebsd.org/changeset/base/199960 Log: Merge Scott Long's latest blkfront now that the licensing issues are resolved Modified: head/sys/dev/xen/blkfront/blkfront.c head/sys/dev/xen/blkfront/block.h Modified: head/sys/dev/xen/blkfront/blkfront.c ============================================================================== --- head/sys/dev/xen/blkfront/blkfront.c Mon Nov 30 04:20:43 2009 (r199959) +++ head/sys/dev/xen/blkfront/blkfront.c Mon Nov 30 04:32:34 2009 (r199960) @@ -1,6 +1,7 @@ /* * XenBSD block device driver * + * Copyright (c) 2009 Scott Long, Yahoo! * Copyright (c) 2009 Frank Suchomel, Citrix * Copyright (c) 2009 Doug F. Rabson, Citrix * Copyright (c) 2005 Kip Macy @@ -46,6 +47,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -63,27 +65,21 @@ __FBSDID("$FreeBSD$"); #include "xenbus_if.h" -#define ASSERT(S) KASSERT(S, (#S)) /* prototypes */ -struct xb_softc; +static void xb_free_command(struct xb_command *cm); static void xb_startio(struct xb_softc *sc); -static void connect(device_t, struct blkfront_info *); +static void connect(struct xb_softc *); static void blkfront_closing(device_t); static int blkfront_detach(device_t); -static int talk_to_backend(device_t, struct blkfront_info *); -static int setup_blkring(device_t, struct blkfront_info *); +static int talk_to_backend(struct xb_softc *); +static int setup_blkring(struct xb_softc *); static void blkif_int(void *); -#if 0 -static void blkif_restart_queue(void *arg); -#endif -static void blkif_recover(struct blkfront_info *); -static void blkif_completion(struct blk_shadow *); -static void blkif_free(struct blkfront_info *, int); +static void blkif_recover(struct xb_softc *); +static void blkif_completion(struct xb_command *); +static void blkif_free(struct xb_softc *, int); +static void blkif_queue_cb(void *, bus_dma_segment_t *, int, int); #define GRANT_INVALID_REF 0 -#define BLK_RING_SIZE __RING_SIZE((blkif_sring_t *)0, PAGE_SIZE) - -LIST_HEAD(xb_softc_list_head, xb_softc) xbsl_head; /* Control whether runtime update of vbds is enabled. */ #define ENABLE_VBD_UPDATE 0 @@ -92,7 +88,6 @@ LIST_HEAD(xb_softc_list_head, xb_softc) static void vbd_update(void); #endif - #define BLKIF_STATE_DISCONNECTED 0 #define BLKIF_STATE_CONNECTED 1 #define BLKIF_STATE_SUSPENDED 2 @@ -111,44 +106,34 @@ static char * blkif_status_name[] = { [BLKIF_INTERFACE_STATUS_CHANGED] = "changed", }; #endif -#define WPRINTK(fmt, args...) printf("[XEN] " fmt, ##args) + #if 0 #define DPRINTK(fmt, args...) printf("[XEN] %s:%d: " fmt ".\n", __func__, __LINE__, ##args) #else #define DPRINTK(fmt, args...) #endif -static grant_ref_t gref_head; #define MAXIMUM_OUTSTANDING_BLOCK_REQS \ (BLKIF_MAX_SEGMENTS_PER_REQUEST * BLK_RING_SIZE) -static void kick_pending_request_queues(struct blkfront_info *); +#define BLKIF_MAXIO (32 * 1024) + static int blkif_open(struct disk *dp); static int blkif_close(struct disk *dp); static int blkif_ioctl(struct disk *dp, u_long cmd, void *addr, int flag, struct thread *td); -static int blkif_queue_request(struct bio *bp); +static int blkif_queue_request(struct xb_softc *sc, struct xb_command *cm); static void xb_strategy(struct bio *bp); // In order to quiesce the device during kernel dumps, outstanding requests to // DOM0 for disk reads/writes need to be accounted for. -static int blkif_queued_requests; static int xb_dump(void *, void *, vm_offset_t, off_t, size_t); - /* XXX move to xb_vbd.c when VBD update support is added */ #define MAX_VBDS 64 #define XBD_SECTOR_SIZE 512 /* XXX: assume for now */ #define XBD_SECTOR_SHFT 9 -static struct mtx blkif_io_lock; - -static vm_paddr_t -pfn_to_mfn(vm_paddr_t pfn) -{ - return (phystomach(pfn << PAGE_SHIFT) >> PAGE_SHIFT); -} - /* * Translate Linux major/minor to an appropriate name and unit * number. For HVM guests, this allows us to use the same drive names @@ -217,23 +202,18 @@ blkfront_vdevice_to_unit(int vdevice, in } int -xlvbd_add(device_t dev, blkif_sector_t capacity, - int vdevice, uint16_t vdisk_info, uint16_t sector_size, - struct blkfront_info *info) +xlvbd_add(struct xb_softc *sc, blkif_sector_t capacity, + int vdevice, uint16_t vdisk_info, uint16_t sector_size) { - struct xb_softc *sc; int unit, error = 0; const char *name; blkfront_vdevice_to_unit(vdevice, &unit, &name); - sc = (struct xb_softc *)malloc(sizeof(*sc), M_DEVBUF, M_WAITOK|M_ZERO); sc->xb_unit = unit; - sc->xb_info = info; - info->sc = sc; if (strcmp(name, "xbd")) - device_printf(dev, "attaching as %s%d\n", name, unit); + device_printf(sc->xb_dev, "attaching as %s%d\n", name, unit); memset(&sc->xb_disk, 0, sizeof(sc->xb_disk)); sc->xb_disk = disk_alloc(); @@ -247,31 +227,18 @@ xlvbd_add(device_t dev, blkif_sector_t c sc->xb_disk->d_drv1 = sc; sc->xb_disk->d_sectorsize = sector_size; - /* XXX */ sc->xb_disk->d_mediasize = capacity << XBD_SECTOR_SHFT; -#if 0 - sc->xb_disk->d_maxsize = DFLTPHYS; -#else /* XXX: xen can't handle large single i/o requests */ - sc->xb_disk->d_maxsize = 4096; -#endif -#ifdef notyet - XENPRINTF("attaching device 0x%x unit %d capacity %llu\n", - xb_diskinfo[sc->xb_unit].device, sc->xb_unit, - sc->xb_disk->d_mediasize); -#endif + sc->xb_disk->d_maxsize = BLKIF_MAXIO; sc->xb_disk->d_flags = 0; disk_create(sc->xb_disk, DISK_VERSION_00); - bioq_init(&sc->xb_bioq); return error; } void -xlvbd_del(struct blkfront_info *info) +xlvbd_del(struct xb_softc *sc) { - struct xb_softc *sc; - sc = info->sc; disk_destroy(sc->xb_disk); } /************************ end VBD support *****************/ @@ -289,102 +256,147 @@ xb_strategy(struct bio *bp) if (sc == NULL) { bp->bio_error = EINVAL; bp->bio_flags |= BIO_ERROR; - goto bad; + bp->bio_resid = bp->bio_bcount; + biodone(bp); + return; } - DPRINTK(""); - /* * Place it in the queue of disk activities for this disk */ - mtx_lock(&blkif_io_lock); + mtx_lock(&sc->xb_io_lock); - bioq_disksort(&sc->xb_bioq, bp); + xb_enqueue_bio(sc, bp); xb_startio(sc); - mtx_unlock(&blkif_io_lock); + mtx_unlock(&sc->xb_io_lock); return; +} - bad: - /* - * Correctly set the bio to indicate a failed tranfer. - */ - bp->bio_resid = bp->bio_bcount; +static void +xb_bio_complete(struct xb_softc *sc, struct xb_command *cm) +{ + struct bio *bp; + + bp = cm->bp; + + if ( unlikely(cm->status != BLKIF_RSP_OKAY) ) { + disk_err(bp, "disk error" , -1, 0); + printf(" status: %x\n", cm->status); + bp->bio_flags |= BIO_ERROR; + } + + if (bp->bio_flags & BIO_ERROR) + bp->bio_error = EIO; + else + bp->bio_resid = 0; + + xb_free_command(cm); biodone(bp); - return; } -static void xb_quiesce(struct blkfront_info *info); // Quiesce the disk writes for a dump file before allowing the next buffer. static void -xb_quiesce(struct blkfront_info *info) +xb_quiesce(struct xb_softc *sc) { int mtd; // While there are outstanding requests - while (blkif_queued_requests) { - RING_FINAL_CHECK_FOR_RESPONSES(&info->ring, mtd); + while (!TAILQ_EMPTY(&sc->cm_busy)) { + RING_FINAL_CHECK_FOR_RESPONSES(&sc->ring, mtd); if (mtd) { - // Recieved request completions, update queue. - blkif_int(info); + /* Recieved request completions, update queue. */ + blkif_int(sc); } - if (blkif_queued_requests) { - // Still pending requests, wait for the disk i/o to complete + if (!TAILQ_EMPTY(&sc->cm_busy)) { + /* + * Still pending requests, wait for the disk i/o + * to complete. + */ HYPERVISOR_yield(); } } } -// Some bio structures for dumping core -#define DUMP_BIO_NO 16 // 16 * 4KB = 64KB dump block -static struct bio xb_dump_bp[DUMP_BIO_NO]; +/* Kernel dump function for a paravirtualized disk device */ +static void +xb_dump_complete(struct xb_command *cm) +{ + + xb_enqueue_complete(cm); +} -// Kernel dump function for a paravirtualized disk device static int xb_dump(void *arg, void *virtual, vm_offset_t physical, off_t offset, size_t length) { - int sbp; - int mbp; - size_t chunk; - struct disk *dp = arg; - struct xb_softc *sc = (struct xb_softc *) dp->d_drv1; - int rc = 0; - - xb_quiesce(sc->xb_info); // All quiet on the western front. - if (length > 0) { - // If this lock is held, then this module is failing, and a successful - // kernel dump is highly unlikely anyway. - mtx_lock(&blkif_io_lock); - // Split the 64KB block into 16 4KB blocks - for (sbp=0; length>0 && sbp PAGE_SIZE ? PAGE_SIZE : length; - xb_dump_bp[sbp].bio_disk = dp; - xb_dump_bp[sbp].bio_pblkno = offset / dp->d_sectorsize; - xb_dump_bp[sbp].bio_bcount = chunk; - xb_dump_bp[sbp].bio_resid = chunk; - xb_dump_bp[sbp].bio_data = virtual; - xb_dump_bp[sbp].bio_cmd = BIO_WRITE; - xb_dump_bp[sbp].bio_done = NULL; - - bioq_disksort(&sc->xb_bioq, &xb_dump_bp[sbp]); - - length -= chunk; - offset += chunk; - virtual = (char *) virtual + chunk; + struct disk *dp = arg; + struct xb_softc *sc = (struct xb_softc *) dp->d_drv1; + struct xb_command *cm; + size_t chunk; + int sbp; + int rc = 0; + + if (length <= 0) + return (rc); + + xb_quiesce(sc); /* All quiet on the western front. */ + + /* + * If this lock is held, then this module is failing, and a + * successful kernel dump is highly unlikely anyway. + */ + mtx_lock(&sc->xb_io_lock); + + /* Split the 64KB block as needed */ + for (sbp=0; length > 0; sbp++) { + cm = xb_dequeue_free(sc); + if (cm == NULL) { + mtx_unlock(&sc->xb_io_lock); + device_printf(sc->xb_dev, "dump: no more commands?\n"); + return (EBUSY); } - // Tell DOM0 to do the I/O - xb_startio(sc); - mtx_unlock(&blkif_io_lock); - - // Must wait for the completion: the dump routine reuses the same - // 16 x 4KB buffer space. - xb_quiesce(sc->xb_info); // All quite on the eastern front - // If there were any errors, bail out... - for (mbp=0; mbpgref_head) < 0) { + xb_free_command(cm); + mtx_unlock(&sc->xb_io_lock); + device_printf(sc->xb_dev, "no more grant allocs?\n"); + return (EBUSY); } + + chunk = length > BLKIF_MAXIO ? BLKIF_MAXIO : length; + cm->data = virtual; + cm->datalen = chunk; + cm->operation = BLKIF_OP_WRITE; + cm->sector_number = offset / dp->d_sectorsize; + cm->cm_complete = xb_dump_complete; + + xb_enqueue_ready(cm); + + length -= chunk; + offset += chunk; + virtual = (char *) virtual + chunk; } + + /* Tell DOM0 to do the I/O */ + xb_startio(sc); + mtx_unlock(&sc->xb_io_lock); + + /* Poll for the completion. */ + xb_quiesce(sc); /* All quite on the eastern front */ + + /* If there were any errors, bail out... */ + while ((cm = xb_dequeue_complete(sc)) != NULL) { + if (cm->status != BLKIF_RSP_OKAY) { + device_printf(sc->xb_dev, + "Dump I/O failed at sector %jd\n", + cm->sector_number); + rc = EIO; + } + xb_free_command(cm); + } + return (rc); } @@ -410,9 +422,10 @@ blkfront_probe(device_t dev) static int blkfront_attach(device_t dev) { - int error, vdevice, i, unit; - struct blkfront_info *info; + struct xb_softc *sc; + struct xb_command *cm; const char *name; + int error, vdevice, i, unit; /* FIXME: Use dynamic device id if this is not set. */ error = xenbus_scanf(XBT_NIL, xenbus_get_node(dev), @@ -427,29 +440,56 @@ blkfront_attach(device_t dev) if (!strcmp(name, "xbd")) device_set_unit(dev, unit); - info = device_get_softc(dev); - - /* - * XXX debug only - */ - for (i = 0; i < sizeof(*info); i++) - if (((uint8_t *)info)[i] != 0) - panic("non-null memory"); - - info->shadow_free = 0; - info->xbdev = dev; - info->vdevice = vdevice; - info->connected = BLKIF_STATE_DISCONNECTED; + sc = device_get_softc(dev); + mtx_init(&sc->xb_io_lock, "blkfront i/o lock", NULL, MTX_DEF); + xb_initq_free(sc); + xb_initq_busy(sc); + xb_initq_ready(sc); + xb_initq_complete(sc); + xb_initq_bio(sc); + + /* Allocate parent DMA tag */ + if (bus_dma_tag_create( NULL, /* parent */ + 4096, 0, /* algnmnt, boundary */ + BUS_SPACE_MAXADDR, /* lowaddr */ + BUS_SPACE_MAXADDR, /* highaddr */ + NULL, NULL, /* filter, filterarg */ + BLKIF_MAXIO, /* maxsize */ + BLKIF_MAX_SEGMENTS_PER_REQUEST, /* nsegments */ + PAGE_SIZE, /* maxsegsize */ + BUS_DMA_ALLOCNOW, /* flags */ + busdma_lock_mutex, /* lockfunc */ + &sc->xb_io_lock, /* lockarg */ + &sc->xb_io_dmat)) { + device_printf(dev, "Cannot allocate parent DMA tag\n"); + return (ENOMEM); + } +#ifdef notyet + if (bus_dma_tag_set(sc->xb_io_dmat, BUS_DMA_SET_MINSEGSZ, + XBD_SECTOR_SIZE)) { + device_printf(dev, "Cannot set sector size\n"); + return (EINVAL); + } +#endif + + sc->xb_dev = dev; + sc->vdevice = vdevice; + sc->connected = BLKIF_STATE_DISCONNECTED; /* work queue needed ? */ - for (i = 0; i < BLK_RING_SIZE; i++) - info->shadow[i].req.id = i+1; - info->shadow[BLK_RING_SIZE-1].req.id = 0x0fffffff; + for (i = 0; i < BLK_RING_SIZE; i++) { + cm = &sc->shadow[i]; + cm->req.id = i; + cm->cm_sc = sc; + if (bus_dmamap_create(sc->xb_io_dmat, 0, &cm->map) != 0) + break; + xb_free_command(cm); + } /* Front end dir is a number, which is used as the id. */ - info->handle = strtoul(strrchr(xenbus_get_node(dev),'/')+1, NULL, 0); + sc->handle = strtoul(strrchr(xenbus_get_node(dev),'/')+1, NULL, 0); - error = talk_to_backend(dev, info); + error = talk_to_backend(sc); if (error) return (error); @@ -459,12 +499,12 @@ blkfront_attach(device_t dev) static int blkfront_suspend(device_t dev) { - struct blkfront_info *info = device_get_softc(dev); + struct xb_softc *sc = device_get_softc(dev); /* Prevent new requests being issued until we fix things up. */ - mtx_lock(&blkif_io_lock); - info->connected = BLKIF_STATE_SUSPENDED; - mtx_unlock(&blkif_io_lock); + mtx_lock(&sc->xb_io_lock); + sc->connected = BLKIF_STATE_SUSPENDED; + mtx_unlock(&sc->xb_io_lock); return (0); } @@ -472,29 +512,31 @@ blkfront_suspend(device_t dev) static int blkfront_resume(device_t dev) { - struct blkfront_info *info = device_get_softc(dev); + struct xb_softc *sc = device_get_softc(dev); int err; DPRINTK("blkfront_resume: %s\n", xenbus_get_node(dev)); - blkif_free(info, 1); - err = talk_to_backend(dev, info); - if (info->connected == BLKIF_STATE_SUSPENDED && !err) - blkif_recover(info); + blkif_free(sc, 1); + err = talk_to_backend(sc); + if (sc->connected == BLKIF_STATE_SUSPENDED && !err) + blkif_recover(sc); return (err); } /* Common code used when first setting up, and when resuming. */ static int -talk_to_backend(device_t dev, struct blkfront_info *info) +talk_to_backend(struct xb_softc *sc) { - const char *message = NULL; + device_t dev; struct xenbus_transaction xbt; + const char *message = NULL; int err; /* Create shared ring, alloc event channel. */ - err = setup_blkring(dev, info); + dev = sc->xb_dev; + err = setup_blkring(sc); if (err) goto out; @@ -506,13 +548,13 @@ talk_to_backend(device_t dev, struct blk } err = xenbus_printf(xbt, xenbus_get_node(dev), - "ring-ref","%u", info->ring_ref); + "ring-ref","%u", sc->ring_ref); if (err) { message = "writing ring-ref"; goto abort_transaction; } err = xenbus_printf(xbt, xenbus_get_node(dev), - "event-channel", "%u", irq_to_evtchn_port(info->irq)); + "event-channel", "%u", irq_to_evtchn_port(sc->irq)); if (err) { message = "writing event-channel"; goto abort_transaction; @@ -540,47 +582,47 @@ talk_to_backend(device_t dev, struct blk if (message) xenbus_dev_fatal(dev, err, "%s", message); destroy_blkring: - blkif_free(info, 0); + blkif_free(sc, 0); out: return err; } static int -setup_blkring(device_t dev, struct blkfront_info *info) +setup_blkring(struct xb_softc *sc) { blkif_sring_t *sring; int error; - info->ring_ref = GRANT_INVALID_REF; + sc->ring_ref = GRANT_INVALID_REF; sring = (blkif_sring_t *)malloc(PAGE_SIZE, M_DEVBUF, M_NOWAIT|M_ZERO); if (sring == NULL) { - xenbus_dev_fatal(dev, ENOMEM, "allocating shared ring"); + xenbus_dev_fatal(sc->xb_dev, ENOMEM, "allocating shared ring"); return ENOMEM; } SHARED_RING_INIT(sring); - FRONT_RING_INIT(&info->ring, sring, PAGE_SIZE); + FRONT_RING_INIT(&sc->ring, sring, PAGE_SIZE); - error = xenbus_grant_ring(dev, - (vtomach(info->ring.sring) >> PAGE_SHIFT), &info->ring_ref); + error = xenbus_grant_ring(sc->xb_dev, + (vtomach(sc->ring.sring) >> PAGE_SHIFT), &sc->ring_ref); if (error) { free(sring, M_DEVBUF); - info->ring.sring = NULL; + sc->ring.sring = NULL; goto fail; } - error = bind_listening_port_to_irqhandler(xenbus_get_otherend_id(dev), - "xbd", (driver_intr_t *)blkif_int, info, - INTR_TYPE_BIO | INTR_MPSAFE, &info->irq); + error = bind_listening_port_to_irqhandler(xenbus_get_otherend_id(sc->xb_dev), + "xbd", (driver_intr_t *)blkif_int, sc, + INTR_TYPE_BIO | INTR_MPSAFE, &sc->irq); if (error) { - xenbus_dev_fatal(dev, error, + xenbus_dev_fatal(sc->xb_dev, error, "bind_evtchn_to_irqhandler failed"); goto fail; } return (0); fail: - blkif_free(info, 0); + blkif_free(sc, 0); return (error); } @@ -591,7 +633,7 @@ setup_blkring(device_t dev, struct blkfr static int blkfront_backend_changed(device_t dev, XenbusState backend_state) { - struct blkfront_info *info = device_get_softc(dev); + struct xb_softc *sc = device_get_softc(dev); DPRINTK("backend_state=%d\n", backend_state); @@ -606,22 +648,22 @@ blkfront_backend_changed(device_t dev, X break; case XenbusStateConnected: - connect(dev, info); + connect(sc); break; case XenbusStateClosing: - if (info->users > 0) + if (sc->users > 0) xenbus_dev_error(dev, -EBUSY, "Device in use; refusing to close"); else blkfront_closing(dev); #ifdef notyet - bd = bdget(info->dev); + bd = bdget(sc->dev); if (bd == NULL) xenbus_dev_fatal(dev, -ENODEV, "bdget failed"); down(&bd->bd_sem); - if (info->users > 0) + if (sc->users > 0) xenbus_dev_error(dev, -EBUSY, "Device in use; refusing to close"); else @@ -639,14 +681,15 @@ blkfront_backend_changed(device_t dev, X ** the details about the physical device - #sectors, size, etc). */ static void -connect(device_t dev, struct blkfront_info *info) +connect(struct xb_softc *sc) { + device_t dev = sc->xb_dev; unsigned long sectors, sector_size; unsigned int binfo; - int err; + int err, feature_barrier; - if( (info->connected == BLKIF_STATE_CONNECTED) || - (info->connected == BLKIF_STATE_SUSPENDED) ) + if( (sc->connected == BLKIF_STATE_CONNECTED) || + (sc->connected == BLKIF_STATE_SUSPENDED) ) return; DPRINTK("blkfront.c:connect:%s.\n", xenbus_get_otherend_path(dev)); @@ -663,10 +706,10 @@ connect(device_t dev, struct blkfront_in return; } err = xenbus_gather(XBT_NIL, xenbus_get_otherend_path(dev), - "feature-barrier", "%lu", &info->feature_barrier, + "feature-barrier", "%lu", &feature_barrier, NULL); - if (err) - info->feature_barrier = 0; + if (!err || feature_barrier) + sc->xb_flags |= XB_BARRIER; device_printf(dev, "%juMB <%s> at %s", (uintmax_t) sectors / (1048576 / sector_size), @@ -674,20 +717,17 @@ connect(device_t dev, struct blkfront_in xenbus_get_node(dev)); bus_print_child_footer(device_get_parent(dev), dev); - xlvbd_add(dev, sectors, info->vdevice, binfo, sector_size, info); + xlvbd_add(sc, sectors, sc->vdevice, binfo, sector_size); (void)xenbus_set_state(dev, XenbusStateConnected); /* Kick pending requests. */ - mtx_lock(&blkif_io_lock); - info->connected = BLKIF_STATE_CONNECTED; - kick_pending_request_queues(info); - mtx_unlock(&blkif_io_lock); - info->is_ready = 1; + mtx_lock(&sc->xb_io_lock); + sc->connected = BLKIF_STATE_CONNECTED; + xb_startio(sc); + sc->xb_flags |= XB_READY; + mtx_unlock(&sc->xb_io_lock); -#if 0 - add_disk(info->gd); -#endif } /** @@ -699,14 +739,14 @@ connect(device_t dev, struct blkfront_in static void blkfront_closing(device_t dev) { - struct blkfront_info *info = device_get_softc(dev); + struct xb_softc *sc = device_get_softc(dev); DPRINTK("blkfront_closing: %s removed\n", xenbus_get_node(dev)); - if (info->mi) { + if (sc->mi) { DPRINTK("Calling xlvbd_del\n"); - xlvbd_del(info); - info->mi = NULL; + xlvbd_del(sc); + sc->mi = NULL; } xenbus_set_state(dev, XenbusStateClosed); @@ -716,92 +756,33 @@ blkfront_closing(device_t dev) static int blkfront_detach(device_t dev) { - struct blkfront_info *info = device_get_softc(dev); + struct xb_softc *sc = device_get_softc(dev); DPRINTK("blkfront_remove: %s removed\n", xenbus_get_node(dev)); - blkif_free(info, 0); + blkif_free(sc, 0); + mtx_destroy(&sc->xb_io_lock); return 0; } -static inline int -GET_ID_FROM_FREELIST(struct blkfront_info *info) -{ - unsigned long nfree = info->shadow_free; - - KASSERT(nfree <= BLK_RING_SIZE, ("free %lu > RING_SIZE", nfree)); - info->shadow_free = info->shadow[nfree].req.id; - info->shadow[nfree].req.id = 0x0fffffee; /* debug */ - atomic_add_int(&blkif_queued_requests, 1); - return nfree; -} - static inline void -ADD_ID_TO_FREELIST(struct blkfront_info *info, unsigned long id) -{ - info->shadow[id].req.id = info->shadow_free; - info->shadow[id].request = 0; - info->shadow_free = id; - atomic_subtract_int(&blkif_queued_requests, 1); -} - -static inline void -flush_requests(struct blkfront_info *info) +flush_requests(struct xb_softc *sc) { int notify; - RING_PUSH_REQUESTS_AND_CHECK_NOTIFY(&info->ring, notify); + RING_PUSH_REQUESTS_AND_CHECK_NOTIFY(&sc->ring, notify); if (notify) - notify_remote_via_irq(info->irq); -} - -static void -kick_pending_request_queues(struct blkfront_info *info) -{ - /* XXX check if we can't simplify */ -#if 0 - if (!RING_FULL(&info->ring)) { - /* Re-enable calldowns. */ - blk_start_queue(info->rq); - /* Kick things off immediately. */ - do_blkif_request(info->rq); - } -#endif - if (!RING_FULL(&info->ring)) { -#if 0 - sc = LIST_FIRST(&xbsl_head); - LIST_REMOVE(sc, entry); - /* Re-enable calldowns. */ - blk_start_queue(di->rq); -#endif - /* Kick things off immediately. */ - xb_startio(info->sc); - } -} - -#if 0 -/* XXX */ -static void blkif_restart_queue(void *arg) -{ - struct blkfront_info *info = (struct blkfront_info *)arg; - - mtx_lock(&blkif_io_lock); - kick_pending_request_queues(info); - mtx_unlock(&blkif_io_lock); + notify_remote_via_irq(sc->irq); } -#endif static void blkif_restart_queue_callback(void *arg) { -#if 0 - struct blkfront_info *info = (struct blkfront_info *)arg; - /* XXX BSD equiv ? */ + struct xb_softc *sc = arg; - schedule_work(&info->work); -#endif + xb_startio(sc); } static int @@ -815,7 +796,7 @@ blkif_open(struct disk *dp) } sc->xb_flags |= XB_OPEN; - sc->xb_info->users++; + sc->users++; return (0); } @@ -827,11 +808,11 @@ blkif_close(struct disk *dp) if (sc == NULL) return (ENXIO); sc->xb_flags &= ~XB_OPEN; - if (--(sc->xb_info->users) == 0) { + if (--(sc->users) == 0) { /* Check whether we have been instructed to close. We will have ignored this request initially, as the device was still mounted. */ - device_t dev = sc->xb_info->xbdev; + device_t dev = sc->xb_dev; XenbusState state = xenbus_read_driver_state(xenbus_get_otherend_path(dev)); @@ -852,6 +833,18 @@ blkif_ioctl(struct disk *dp, u_long cmd, return (ENOTTY); } +static void +xb_free_command(struct xb_command *cm) +{ + + KASSERT((cm->cm_flags & XB_ON_XBQ_MASK) == 0, + ("Freeing command that is still on a queue\n")); + + cm->cm_flags = 0; + cm->bp = NULL; + cm->cm_complete = NULL; + xb_enqueue_free(cm); +} /* * blkif_queue_request @@ -863,106 +856,152 @@ blkif_ioctl(struct disk *dp, u_long cmd, * buffer: buffer to read/write into. this should be a * virtual address in the guest os. */ -static int blkif_queue_request(struct bio *bp) +static struct xb_command * +xb_bio_command(struct xb_softc *sc) +{ + struct xb_command *cm; + struct bio *bp; + + if (unlikely(sc->connected != BLKIF_STATE_CONNECTED)) + return (NULL); + + bp = xb_dequeue_bio(sc); + if (bp == NULL) + return (NULL); + + if ((cm = xb_dequeue_free(sc)) == NULL) { + xb_requeue_bio(sc, bp); + return (NULL); + } + + if (gnttab_alloc_grant_references(BLKIF_MAX_SEGMENTS_PER_REQUEST, + &cm->gref_head) < 0) { + gnttab_request_free_callback(&sc->callback, + blkif_restart_queue_callback, sc, + BLKIF_MAX_SEGMENTS_PER_REQUEST); + xb_requeue_bio(sc, bp); + xb_enqueue_free(cm); + sc->xb_flags |= XB_FROZEN; + return (NULL); + } + + /* XXX Can we grab refs before doing the load so that the ref can + * be filled out here? + */ + cm->bp = bp; + cm->data = bp->bio_data; + cm->datalen = bp->bio_bcount; + cm->operation = (bp->bio_cmd == BIO_READ) ? BLKIF_OP_READ : + BLKIF_OP_WRITE; + cm->sector_number = (blkif_sector_t)bp->bio_pblkno; + + return (cm); +} + +static int +blkif_queue_request(struct xb_softc *sc, struct xb_command *cm) { - caddr_t alignbuf; + int error; + + error = bus_dmamap_load(sc->xb_io_dmat, cm->map, cm->data, cm->datalen, + blkif_queue_cb, cm, 0); + if (error == EINPROGRESS) { + printf("EINPROGRESS\n"); + sc->xb_flags |= XB_FROZEN; + cm->cm_flags |= XB_CMD_FROZEN; + return (0); + } + + return (error); +} + +static void +blkif_queue_cb(void *arg, bus_dma_segment_t *segs, int nsegs, int error) +{ + struct xb_softc *sc; + struct xb_command *cm; + blkif_request_t *ring_req; vm_paddr_t buffer_ma; - blkif_request_t *ring_req; - unsigned long id; uint64_t fsect, lsect; - struct xb_softc *sc = (struct xb_softc *)bp->bio_disk->d_drv1; - struct blkfront_info *info = sc->xb_info; - int ref; - - if (unlikely(sc->xb_info->connected != BLKIF_STATE_CONNECTED)) - return 1; - - if (gnttab_alloc_grant_references( - BLKIF_MAX_SEGMENTS_PER_REQUEST, &gref_head) < 0) { - gnttab_request_free_callback( - &info->callback, - blkif_restart_queue_callback, - info, - BLKIF_MAX_SEGMENTS_PER_REQUEST); - return 1; + int ref, i, op; + + cm = arg; + sc = cm->cm_sc; + + if (error) { + printf("error %d in blkif_queue_cb\n", error); + cm->bp->bio_error = EIO; + biodone(cm->bp); + xb_free_command(cm); + return; } - /* Check if the buffer is properly aligned */ - if ((vm_offset_t)bp->bio_data & PAGE_MASK) { - int align = (bp->bio_bcount < PAGE_SIZE/2) ? XBD_SECTOR_SIZE : - PAGE_SIZE; - caddr_t newbuf = malloc(bp->bio_bcount + align, M_DEVBUF, - M_NOWAIT); - - alignbuf = (char *)roundup2((u_long)newbuf, align); - - /* save a copy of the current buffer */ - bp->bio_driver1 = newbuf; - bp->bio_driver2 = alignbuf; - - /* Copy the data for a write */ - if (bp->bio_cmd == BIO_WRITE) - bcopy(bp->bio_data, alignbuf, bp->bio_bcount); - } else - alignbuf = bp->bio_data; - /* Fill out a communications ring structure. */ - ring_req = RING_GET_REQUEST(&info->ring, - info->ring.req_prod_pvt); - id = GET_ID_FROM_FREELIST(info); - info->shadow[id].request = (unsigned long)bp; - - ring_req->id = id; - ring_req->operation = (bp->bio_cmd == BIO_READ) ? BLKIF_OP_READ : - BLKIF_OP_WRITE; - - ring_req->sector_number= (blkif_sector_t)bp->bio_pblkno; - ring_req->handle = (blkif_vdev_t)(uintptr_t)sc->xb_disk; - - ring_req->nr_segments = 0; /* XXX not doing scatter/gather since buffer - * chaining is not supported. *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Mon Nov 30 08:01:54 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 13B411065692; Mon, 30 Nov 2009 08:01:54 +0000 (UTC) (envelope-from ed@hoeg.nl) Received: from palm.hoeg.nl (mx0.hoeg.nl [IPv6:2001:7b8:613:100::211]) by mx1.freebsd.org (Postfix) with ESMTP id AA3668FC08; Mon, 30 Nov 2009 08:01:53 +0000 (UTC) Received: by palm.hoeg.nl (Postfix, from userid 1000) id 9C3BE1CE67; Mon, 30 Nov 2009 09:01:52 +0100 (CET) Date: Mon, 30 Nov 2009 09:01:52 +0100 From: Ed Schouten To: Gabor Kovesdan Message-ID: <20091130080152.GZ64905@hoeg.nl> References: <200911292047.nATKlh66008711@svn.freebsd.org> <4B12DFC6.3050108@FreeBSD.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="xNMMsVvlV1B6vaKr" Content-Disposition: inline In-Reply-To: <4B12DFC6.3050108@FreeBSD.org> User-Agent: Mutt/1.5.20 (2009-06-14) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, "Bjoern A. Zeeb" , src-committers@freebsd.org Subject: Re: svn commit: r199947 - in head: share/man/man4 sys/netipsec X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Nov 2009 08:01:54 -0000 --xNMMsVvlV1B6vaKr Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable * Gabor Kovesdan wrote: > Bjoern A. Zeeb escribi=F3: > >-protocol support is currently broken. > >+protocol may occationally error because of > >+.Xr zlib 3 > >+problems. > There's a typo here, should be occasionally. Because we're nitpicking anyway. Do we consider `error' to be a proper verb? Can't we use the word `fail' here? --=20 Ed Schouten WWW: http://80386.nl/ --xNMMsVvlV1B6vaKr Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (FreeBSD) iEYEARECAAYFAksTe/AACgkQ52SDGA2eCwU0RQCfdFBmHeZjGdXyQmSwOj5dtveo etAAniKC8d44MDWH1qb1j2qB2amDHZjX =2wRT -----END PGP SIGNATURE----- --xNMMsVvlV1B6vaKr-- From owner-svn-src-head@FreeBSD.ORG Mon Nov 30 11:11:08 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D9F0D1065679; Mon, 30 Nov 2009 11:11:08 +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 ADE218FC08; Mon, 30 Nov 2009 11:11:08 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nAUBB8qK028432; Mon, 30 Nov 2009 11:11:08 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nAUBB8qe028431; Mon, 30 Nov 2009 11:11:08 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <200911301111.nAUBB8qe028431@svn.freebsd.org> From: Andriy Gapon Date: Mon, 30 Nov 2009 11:11:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r199968 - in head/sys: amd64/amd64 amd64/include i386/i386 i386/include X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Nov 2009 11:11:09 -0000 Author: avg Date: Mon Nov 30 11:11:08 2009 New Revision: 199968 URL: http://svn.freebsd.org/changeset/base/199968 Log: x86 cpu features: add MOVBE reporting and flag The check is glimpsed from Linux and OpenSolaris. MOVBE instruction is found in Intel Atom processors. Modified: head/sys/amd64/amd64/identcpu.c head/sys/amd64/include/specialreg.h head/sys/i386/i386/identcpu.c head/sys/i386/include/specialreg.h Modified: head/sys/amd64/amd64/identcpu.c ============================================================================== --- head/sys/amd64/amd64/identcpu.c Mon Nov 30 08:01:18 2009 (r199967) +++ head/sys/amd64/amd64/identcpu.c Mon Nov 30 11:11:08 2009 (r199968) @@ -259,7 +259,7 @@ printcpuinfo(void) "\024SSE4.1" "\025SSE4.2" "\026x2APIC" /* xAPIC Extensions */ - "\027" + "\027MOVBE" "\030POPCNT" "\031" "\032" Modified: head/sys/amd64/include/specialreg.h ============================================================================== --- head/sys/amd64/include/specialreg.h Mon Nov 30 08:01:18 2009 (r199967) +++ head/sys/amd64/include/specialreg.h Mon Nov 30 11:11:08 2009 (r199968) @@ -129,6 +129,7 @@ #define CPUID2_SSE41 0x00080000 #define CPUID2_SSE42 0x00100000 #define CPUID2_X2APIC 0x00200000 +#define CPUID2_MOVBE 0x00400000 #define CPUID2_POPCNT 0x00800000 /* Modified: head/sys/i386/i386/identcpu.c ============================================================================== --- head/sys/i386/i386/identcpu.c Mon Nov 30 08:01:18 2009 (r199967) +++ head/sys/i386/i386/identcpu.c Mon Nov 30 11:11:08 2009 (r199968) @@ -746,7 +746,7 @@ printcpuinfo(void) "\024SSE4.1" "\025SSE4.2" "\026x2APIC" /* xAPIC Extensions */ - "\027" + "\027MOVBE" "\030POPCNT" "\031" "\032" Modified: head/sys/i386/include/specialreg.h ============================================================================== --- head/sys/i386/include/specialreg.h Mon Nov 30 08:01:18 2009 (r199967) +++ head/sys/i386/include/specialreg.h Mon Nov 30 11:11:08 2009 (r199968) @@ -126,6 +126,7 @@ #define CPUID2_SSE41 0x00080000 #define CPUID2_SSE42 0x00100000 #define CPUID2_X2APIC 0x00200000 +#define CPUID2_MOVBE 0x00400000 #define CPUID2_POPCNT 0x00800000 /* From owner-svn-src-head@FreeBSD.ORG Mon Nov 30 11:44:03 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D25551065670; Mon, 30 Nov 2009 11:44:03 +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 BCDB28FC18; Mon, 30 Nov 2009 11:44:03 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nAUBi3Uw029502; Mon, 30 Nov 2009 11:44:03 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nAUBi3if029492; Mon, 30 Nov 2009 11:44:03 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <200911301144.nAUBi3if029492@svn.freebsd.org> From: Andriy Gapon Date: Mon, 30 Nov 2009 11:44:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r199969 - in head: share/man/man4 sys/amd64/conf sys/conf sys/dev/amdsbwd sys/i386/conf sys/modules sys/modules/amdsbwd X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Nov 2009 11:44:04 -0000 Author: avg Date: Mon Nov 30 11:44:03 2009 New Revision: 199969 URL: http://svn.freebsd.org/changeset/base/199969 Log: amdsbwd: new driver for AMD SB600/SB7xx watchdog timer The hardware is compliant with WDRT specification, so I originally considered including generic WDRT watchdog support, but decided against it, because I couldn't find anyone to the code for me. WDRT seems to be not very popular. Besides, generic WDRT porbably requires a slightly different driver approach. Reviewed by: des, gavin, rpaulo MFC after: 3 weeks Added: head/share/man/man4/amdsbwd.4 (contents, props changed) head/sys/dev/amdsbwd/ head/sys/dev/amdsbwd/amdsbwd.c (contents, props changed) head/sys/modules/amdsbwd/ head/sys/modules/amdsbwd/Makefile (contents, props changed) Modified: head/share/man/man4/Makefile head/sys/amd64/conf/NOTES head/sys/conf/files.amd64 head/sys/conf/files.i386 head/sys/i386/conf/NOTES head/sys/modules/Makefile Modified: head/share/man/man4/Makefile ============================================================================== --- head/share/man/man4/Makefile Mon Nov 30 11:11:08 2009 (r199968) +++ head/share/man/man4/Makefile Mon Nov 30 11:44:03 2009 (r199969) @@ -31,6 +31,7 @@ MAN= aac.4 \ ale.4 \ altq.4 \ amd.4 \ + ${_amdsbwd.4} \ ${_amdsmb.4} \ ${_amdtemp.4} \ amr.4 \ @@ -610,6 +611,7 @@ _acpi_panasonic.4=acpi_panasonic.4 _acpi_sony.4= acpi_sony.4 _acpi_toshiba.4=acpi_toshiba.4 _acpi_wmi.4= acpi_wmi.4 +_amdsbwd.4= amdsbwd.4 _amdsmb.4= amdsmb.4 _amdtemp.4= amdtemp.4 _asmc.4= asmc.4 Added: head/share/man/man4/amdsbwd.4 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/share/man/man4/amdsbwd.4 Mon Nov 30 11:44:03 2009 (r199969) @@ -0,0 +1,72 @@ +.\"- +.\" Copyright (c) 2009 Andriy Gapon +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd November 30, 2009 +.Dt AMDSBWD 4 +.Os +.Sh NAME +.Nm amdsbwd +.Nd device driver for the AMD SB600/SB700/SB710/SB750 watchdog timer +.Sh SYNOPSIS +To compile this driver into the kernel, +place the following line in your +kernel configuration file: +.Bd -ragged -offset indent +.Cd "device amdsbwd" +.Ed +.Pp +Alternatively, to load the driver as a +module at boot time, place the following line in +.Xr loader.conf 5 : +.Bd -literal -offset indent +amdsbwd_load="YES" +.Ed +.Sh DESCRIPTION +The +.Nm +driver provides +.Xr watchdog 4 +support for the watchdog timers present on +AMD SB600 and SB7xx south bridge chips. +.Sh SEE ALSO +.Xr watchdog 4 , +.Xr watchdog 8 , +.Xr watchdogd 8 , +.Xr watchdog 9 +.Sh HISTORY +The +.Nm +driver first appeared in +.Fx 9.0 . +.Sh AUTHORS +.An -nosplit +The +.Nm +driver was written by +.An Andiry Gapon Aq avg@FreeBSD.org . +This manual page was written by +.An Andiry Gapon Aq avg@FreeBSD.org . Modified: head/sys/amd64/conf/NOTES ============================================================================== --- head/sys/amd64/conf/NOTES Mon Nov 30 11:11:08 2009 (r199968) +++ head/sys/amd64/conf/NOTES Mon Nov 30 11:44:03 2009 (r199969) @@ -399,8 +399,10 @@ device asmc # Hardware watchdog timers: # # ichwd: Intel ICH watchdog timer +# amdsbwd: AMD SB7xx watchdog timer # device ichwd +device amdsbwd # # Temperature sensors: Modified: head/sys/conf/files.amd64 ============================================================================== --- head/sys/conf/files.amd64 Mon Nov 30 11:11:08 2009 (r199968) +++ head/sys/conf/files.amd64 Mon Nov 30 11:44:03 2009 (r199969) @@ -151,6 +151,7 @@ dev/agp/agp_amd64.c optional agp dev/agp/agp_i810.c optional agp dev/agp/agp_intel.c optional agp dev/agp/agp_via.c optional agp +dev/amdsbwd/amdsbwd.c optional amdsbwd dev/amdtemp/amdtemp.c optional amdtemp dev/arcmsr/arcmsr.c optional arcmsr pci dev/asmc/asmc.c optional asmc isa Modified: head/sys/conf/files.i386 ============================================================================== --- head/sys/conf/files.i386 Mon Nov 30 11:11:08 2009 (r199968) +++ head/sys/conf/files.i386 Mon Nov 30 11:44:03 2009 (r199969) @@ -127,6 +127,7 @@ dev/agp/agp_nvidia.c optional agp dev/agp/agp_sis.c optional agp dev/agp/agp_via.c optional agp dev/aic/aic_isa.c optional aic isa +dev/amdsbwd/amdsbwd.c optional amdsbwd dev/amdtemp/amdtemp.c optional amdtemp dev/arcmsr/arcmsr.c optional arcmsr pci dev/asmc/asmc.c optional asmc isa Added: head/sys/dev/amdsbwd/amdsbwd.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/amdsbwd/amdsbwd.c Mon Nov 30 11:44:03 2009 (r199969) @@ -0,0 +1,431 @@ +/*- + * Copyright (c) 2009 Andriy Gapon + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* + * This is a driver for watchdog timer present in AMD SB600/SB7xx + * south bridges and other watchdog timers advertised via WDRT ACPI table. + * Please see the following specifications for the descriptions of the + * registers and flags: + * - AMD SB600 Register Reference Guide, Public Version, Rev. 3.03 (SB600 RRG) + * http://www.amd.com/us-en/assets/content_type/white_papers_and_tech_docs/46155_sb600_rrg_pub_3.03.pdf + * - AMD SB700/710/750 Register Reference Guide (RRG) + * http://developer.amd.com/assets/43009_sb7xx_rrg_pub_1.00.pdf + * - AMD SB700/710/750 Register Programming Requirements (RPR) + * http://developer.amd.com/assets/42413_sb7xx_rpr_pub_1.00.pdf + * Please see the following for Watchdog Resource Table specification: + * - Watchdog Timer Hardware Requirements for Windows Server 2003 (WDRT) + * http://www.microsoft.com/whdc/system/sysinternals/watchdog.mspx + * AMD SB600/SB7xx watchdog hardware seems to conform to the above, + * but my system doesn't provide the table. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +/* RRG 2.3.3.1.1, page 161. */ +#define AMDSB_PMIO_INDEX 0xcd6 +#define AMDSB_PMIO_DATA (PMIO_INDEX + 1) +#define AMDSB_PMIO_WIDTH 2 +/* RRG 2.3.3.2, page 181. */ +#define AMDSB_PM_RESET_STATUS0 0x44 +#define AMDSB_PM_RESET_STATUS1 0x45 +#define AMDSB_WD_RST_STS 0x02 +/* RRG 2.3.3.2, page 188; RPR 2.36, page 30. */ +#define AMDSB_PM_WDT_CTRL 0x69 +#define AMDSB_WDT_DISABLE 0x01 +#define AMDSB_WDT_RES_MASK (0x02 | 0x04) +#define AMDSB_WDT_RES_32US 0x00 +#define AMDSB_WDT_RES_10MS 0x02 +#define AMDSB_WDT_RES_100MS 0x04 +#define AMDSB_WDT_RES_1S 0x06 +#define AMDSB_PM_WDT_BASE_LSB 0x6c +#define AMDSB_PM_WDT_BASE_MSB 0x6f +/* RRG 2.3.4, page 223, WDRT. */ +#define AMDSB_WD_CTRL 0x00 +#define AMDSB_WD_RUN 0x01 +#define AMDSB_WD_FIRED 0x02 +#define AMDSB_WD_SHUTDOWN 0x04 +#define AMDSB_WD_DISABLE 0x08 +#define AMDSB_WD_RESERVED 0x70 +#define AMDSB_WD_RELOAD 0x80 +#define AMDSB_WD_COUNT 0x04 +#define AMDSB_WD_COUNT_MASK 0xffff +#define AMDSB_WDIO_REG_WIDTH 4 +/* WDRT */ +#define MAXCOUNT_MIN_VALUE 511 +/* RRG 2.3.1.1, page 122; SB600 RRG 2.3.1.1, page 97. */ +#define AMDSB7xx_SMBUS_DEVID 0x43851002 + +#define amdsbwd_verbose_printf(dev, ...) \ + do { \ + if (bootverbose) \ + device_printf(dev, __VA_ARGS__);\ + } while (0) + +struct amdsbwd_softc { + device_t dev; + eventhandler_tag ev_tag; + struct resource *res_ctrl; + struct resource *res_count; + int rid_ctrl; + int rid_count; + int ms_per_tick; + int max_ticks; + int active; + unsigned int timeout; +}; + +static void amdsbwd_identify(driver_t *driver, device_t parent); +static int amdsbwd_probe(device_t dev); +static int amdsbwd_attach(device_t dev); +static int amdsbwd_detach(device_t dev); + +static device_method_t amdsbwd_methods[] = { + DEVMETHOD(device_identify, amdsbwd_identify), + DEVMETHOD(device_probe, amdsbwd_probe), + DEVMETHOD(device_attach, amdsbwd_attach), + DEVMETHOD(device_detach, amdsbwd_detach), +#if 0 + DEVMETHOD(device_shutdown, amdsbwd_detach), +#endif + {0, 0} +}; + +static devclass_t amdsbwd_devclass; +static driver_t amdsbwd_driver = { + "amdsbwd", + amdsbwd_methods, + sizeof(struct amdsbwd_softc) +}; + +DRIVER_MODULE(amdsbwd, isa, amdsbwd_driver, amdsbwd_devclass, NULL, NULL); + + +static uint8_t +pmio_read(struct resource *res, uint8_t reg) +{ + bus_write_1(res, 0, reg); /* Index */ + return (bus_read_1(res, 1)); /* Data */ +} + +static void +pmio_write(struct resource *res, uint8_t reg, uint8_t val) +{ + bus_write_1(res, 0, reg); /* Index */ + bus_write_1(res, 1, val); /* Data */ +} + +static uint32_t +wdctrl_read(struct amdsbwd_softc *sc) +{ + return (bus_read_4(sc->res_ctrl, 0)); +} + +static void +wdctrl_write(struct amdsbwd_softc *sc, uint32_t val) +{ + bus_write_4(sc->res_ctrl, 0, val); +} + +static __unused uint32_t +wdcount_read(struct amdsbwd_softc *sc) +{ + return (bus_read_4(sc->res_count, 0)); +} + +static void +wdcount_write(struct amdsbwd_softc *sc, uint32_t val) +{ + bus_write_4(sc->res_count, 0, val); +} + +static void +amdsbwd_tmr_enable(struct amdsbwd_softc *sc) +{ + uint32_t val; + + val = wdctrl_read(sc); + val |= AMDSB_WD_RUN; + wdctrl_write(sc, val); + sc->active = 1; + amdsbwd_verbose_printf(sc->dev, "timer enabled\n"); +} + +static void +amdsbwd_tmr_disable(struct amdsbwd_softc *sc) +{ + uint32_t val; + + val = wdctrl_read(sc); + val &= ~AMDSB_WD_RUN; + wdctrl_write(sc, val); + sc->active = 0; + amdsbwd_verbose_printf(sc->dev, "timer disabled\n"); +} + +static void +amdsbwd_tmr_reload(struct amdsbwd_softc *sc) +{ + uint32_t val; + + val = wdctrl_read(sc); + val |= AMDSB_WD_RELOAD; + wdctrl_write(sc, val); +} + +static void +amdsbwd_tmr_set(struct amdsbwd_softc *sc, uint16_t timeout) +{ + + timeout &= AMDSB_WD_COUNT_MASK; + wdcount_write(sc, timeout); + sc->timeout = timeout; + amdsbwd_verbose_printf(sc->dev, "timeout set to %u ticks\n", timeout); +} + +static void +amdsbwd_event(void *arg, unsigned int cmd, int *error) +{ + struct amdsbwd_softc *sc = arg; + unsigned int timeout; + + /* convert from power-of-two-ns to WDT ticks */ + cmd &= WD_INTERVAL; + if (cmd < WD_TO_1SEC) + cmd = 0; + timeout = ((uint64_t)1 << (cmd - WD_TO_1MS)) / sc->ms_per_tick; + if (timeout > sc->max_ticks) + timeout = sc->max_ticks; + if (cmd) { + if (timeout != sc->timeout) { + amdsbwd_tmr_set(sc, timeout); + if (!sc->active) + amdsbwd_tmr_enable(sc); + } + amdsbwd_tmr_reload(sc); + *error = 0; + } else { + if (sc->active) + amdsbwd_tmr_disable(sc); + } +} + +static void +amdsbwd_identify(driver_t *driver, device_t parent) +{ + device_t child; + device_t smb_dev; + + if (resource_disabled("amdsbwd", 0)) + return; + if (device_find_child(parent, "amdsbwd", -1) != NULL) + return; + + /* + * Try to identify SB600/SB7xx by PCI Device ID of SMBus device + * that should be present at bus 0, device 20, function 0. + */ + smb_dev = pci_find_bsf(0, 20, 0); + if (smb_dev == NULL) + return; + if (pci_get_devid(smb_dev) != AMDSB7xx_SMBUS_DEVID) + return; + + child = BUS_ADD_CHILD(parent, ISA_ORDER_SPECULATIVE, "amdsbwd", -1); + if (child == NULL) + device_printf(parent, "add amdsbwd child failed\n"); +} + +static int +amdsbwd_probe(device_t dev) +{ + struct resource *res; + uint32_t addr; + uint32_t val; + int rid; + int rc; + int i; + + /* Do not claim some ISA PnP device by accident. */ + if (isa_get_logicalid(dev) != 0) + return (ENXIO); + + rc = bus_set_resource(dev, SYS_RES_IOPORT, 0, AMDSB_PMIO_INDEX, + AMDSB_PMIO_WIDTH); + if (rc != 0) { + device_printf(dev, "bus_set_resource for IO failed\n"); + return (ENXIO); + } + rid = 0; + res = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid, 0ul, ~0ul, + AMDSB_PMIO_WIDTH, RF_ACTIVE | RF_SHAREABLE); + if (res == NULL) { + device_printf(dev, "bus_alloc_resource for IO failed\n"); + return (ENXIO); + } + + /* Report cause of previous reset for user's convenience. */ + val = pmio_read(res, AMDSB_PM_RESET_STATUS0); + if (val != 0) + amdsbwd_verbose_printf(dev, "ResetStatus0 = %#04x\n", val); + val = pmio_read(res, AMDSB_PM_RESET_STATUS1); + if (val != 0) + amdsbwd_verbose_printf(dev, "ResetStatus1 = %#04x\n", val); + if ((val & AMDSB_WD_RST_STS) != 0) + device_printf(dev, "Previous Reset was caused by Watchdog\n"); + + /* Find base address of memory mapped WDT registers. */ + for (addr = 0, i = 0; i < 4; i++) { + addr <<= 8; + addr |= pmio_read(res, AMDSB_PM_WDT_BASE_MSB - i); + } + amdsbwd_verbose_printf(dev, "memory base address = %#010x\n", addr); + rc = bus_set_resource(dev, SYS_RES_MEMORY, 0, addr + AMDSB_WD_CTRL, + AMDSB_WDIO_REG_WIDTH); + if (rc != 0) { + device_printf(dev, "bus_set_resource for control failed\n"); + return (ENXIO); + } + rc = bus_set_resource(dev, SYS_RES_MEMORY, 1, addr + AMDSB_WD_COUNT, + AMDSB_WDIO_REG_WIDTH); + if (rc != 0) { + device_printf(dev, "bus_set_resource for count failed\n"); + return (ENXIO); + } + + /* Set watchdog timer tick to 10ms. */ + val = pmio_read(res, AMDSB_PM_WDT_CTRL); + val &= ~AMDSB_WDT_RES_MASK; + val |= AMDSB_WDT_RES_10MS; + pmio_write(res, AMDSB_PM_WDT_CTRL, val); + + /* Enable watchdog device (in stopped state). */ + val = pmio_read(res, AMDSB_PM_WDT_CTRL); + val &= ~AMDSB_WDT_DISABLE; + pmio_write(res, AMDSB_PM_WDT_CTRL, val); + + /* + * XXX TODO: Ensure that watchdog decode is enabled + * (register 0x41, bit 3). + */ + bus_release_resource(dev, SYS_RES_IOPORT, rid, res); + bus_delete_resource(dev, SYS_RES_IOPORT, rid); + + device_set_desc(dev, "AMD SB600/SB7xx Watchdog Timer"); + return (0); +} + +static int +amdsbwd_attach_sb(device_t dev, struct amdsbwd_softc *sc) +{ + sc->max_ticks = UINT16_MAX; + sc->ms_per_tick = 10; + sc->rid_ctrl = 0; + sc->rid_count = 1; + + sc->res_ctrl = bus_alloc_resource_any(dev, SYS_RES_MEMORY, + &sc->rid_ctrl, RF_ACTIVE); + if (sc->res_ctrl == NULL) { + device_printf(dev, "bus_alloc_resource for ctrl failed\n"); + return (ENXIO); + } + sc->res_count = bus_alloc_resource_any(dev, SYS_RES_MEMORY, + &sc->rid_count, RF_ACTIVE); + if (sc->res_count == NULL) { + device_printf(dev, "bus_alloc_resource for count failed\n"); + return (ENXIO); + } + return (0); +} + +static int +amdsbwd_attach(device_t dev) +{ + struct amdsbwd_softc *sc; + int rc; + + sc = device_get_softc(dev); + sc->dev = dev; + + rc = amdsbwd_attach_sb(dev, sc); + if (rc != 0) + goto fail; + + /* Setup initial state of Watchdog Control. */ + wdctrl_write(sc, AMDSB_WD_FIRED); + + if (wdctrl_read(sc) & AMDSB_WD_DISABLE) { + device_printf(dev, "watchdog hardware is disabled\n"); + goto fail; + } + + sc->ev_tag = EVENTHANDLER_REGISTER(watchdog_list, amdsbwd_event, sc, + EVENTHANDLER_PRI_ANY); + + return (0); + +fail: + amdsbwd_detach(dev); + return (ENXIO); +} + +static int +amdsbwd_detach(device_t dev) +{ + struct amdsbwd_softc *sc; + + sc = device_get_softc(dev); + if (sc->ev_tag != NULL) + EVENTHANDLER_DEREGISTER(watchdog_list, sc->ev_tag); + + if (sc->active) + amdsbwd_tmr_disable(sc); + + if (sc->res_ctrl != NULL) + bus_release_resource(dev, SYS_RES_MEMORY, sc->rid_ctrl, + sc->res_ctrl); + + if (sc->res_count != NULL) + bus_release_resource(dev, SYS_RES_MEMORY, sc->rid_count, + sc->res_count); + + return (0); +} + Modified: head/sys/i386/conf/NOTES ============================================================================== --- head/sys/i386/conf/NOTES Mon Nov 30 11:11:08 2009 (r199968) +++ head/sys/i386/conf/NOTES Mon Nov 30 11:44:03 2009 (r199969) @@ -785,8 +785,10 @@ hint.pcf.0.irq="5" # Hardware watchdog timers: # # ichwd: Intel ICH watchdog timer +# amdsbwd: AMD SB7xx watchdog timer # device ichwd +device amdsbwd # # Temperature sensors: Modified: head/sys/modules/Makefile ============================================================================== --- head/sys/modules/Makefile Mon Nov 30 11:11:08 2009 (r199968) +++ head/sys/modules/Makefile Mon Nov 30 11:44:03 2009 (r199969) @@ -21,6 +21,7 @@ SUBDIR= ${_3dfx} \ alc \ ale \ ${_amd} \ + ${_amdsbwd} \ ${_amdtemp} \ amr \ ${_an} \ @@ -416,6 +417,7 @@ _zfs= zfs _aac= aac _acpi= acpi _ahb= ahb +_amdsbwd= amdsbwd _amdtemp= amdtemp _arcmsr= arcmsr _asmc= asmc @@ -472,6 +474,7 @@ _aac= aac _acpi= acpi _agp= agp _an= an +_amdsbwd= amdsbwd _amdtemp= amdtemp _arcmsr= arcmsr _asmc= asmc Added: head/sys/modules/amdsbwd/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/modules/amdsbwd/Makefile Mon Nov 30 11:44:03 2009 (r199969) @@ -0,0 +1,8 @@ +# $FreeBSD$ + +.PATH: ${.CURDIR}/../../dev/amdsbwd +KMOD = amdsbwd +SRCS = amdsbwd.c +SRCS += device_if.h bus_if.h pci_if.h isa_if.h + +.include From owner-svn-src-head@FreeBSD.ORG Mon Nov 30 18:08:33 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 39C161065670; Mon, 30 Nov 2009 18:08:33 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from harmony.bsdimp.com (bsdimp.com [199.45.160.85]) by mx1.freebsd.org (Postfix) with ESMTP id D854F8FC17; Mon, 30 Nov 2009 18:08:32 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by harmony.bsdimp.com (8.14.3/8.14.1) with ESMTP id nAUHwhuq055000; Mon, 30 Nov 2009 10:58:43 -0700 (MST) (envelope-from imp@bsdimp.com) Date: Mon, 30 Nov 2009 10:58:59 -0700 (MST) Message-Id: <20091130.105859.-1417605724.imp@bsdimp.com> To: trasz@freebsd.org From: "M. Warner Losh" In-Reply-To: <200911251636.nAPGa7YX055796@svn.freebsd.org> References: <200911251636.nAPGa7YX055796@svn.freebsd.org> X-Mailer: Mew version 5.2 on Emacs 21.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r199806 - head/sys/boot/i386/libi386 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Nov 2009 18:08:33 -0000 In message: <200911251636.nAPGa7YX055796@svn.freebsd.org> Edward Tomasz Napierala writes: : Author: trasz : Date: Wed Nov 25 16:36:07 2009 : New Revision: 199806 : URL: http://svn.freebsd.org/changeset/base/199806 : : Log: : Be nice, don't use the f-word. Too bad the boot code doesn't grok EDOOFUS :) Warner From owner-svn-src-head@FreeBSD.ORG Mon Nov 30 18:26:47 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2B86C106568F; Mon, 30 Nov 2009 18:26:47 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1C8EB8FC18; Mon, 30 Nov 2009 18:26:47 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nAUIQkj0037223; Mon, 30 Nov 2009 18:26:46 GMT (envelope-from emaste@svn.freebsd.org) Received: (from emaste@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nAUIQk41037222; Mon, 30 Nov 2009 18:26:46 GMT (envelope-from emaste@svn.freebsd.org) Message-Id: <200911301826.nAUIQk41037222@svn.freebsd.org> From: Ed Maste Date: Mon, 30 Nov 2009 18:26:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r199970 - head/sys/dev/hatm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Nov 2009 18:26:47 -0000 Author: emaste Date: Mon Nov 30 18:26:46 2009 New Revision: 199970 URL: http://svn.freebsd.org/changeset/base/199970 Log: Free pointer from getenv() when done with it. Submitted by: Phil Longstaff Modified: head/sys/dev/hatm/if_hatm.c Modified: head/sys/dev/hatm/if_hatm.c ============================================================================== --- head/sys/dev/hatm/if_hatm.c Mon Nov 30 11:44:03 2009 (r199969) +++ head/sys/dev/hatm/if_hatm.c Mon Nov 30 18:26:46 2009 (r199970) @@ -1325,6 +1325,7 @@ kenv_getuint(struct hatm_softc *sc, cons freeenv(val); return (EINVAL); } + freeenv(val); if (bootverbose) if_printf(sc->ifp, "%s=%u\n", full, u); *ptr = u; From owner-svn-src-head@FreeBSD.ORG Mon Nov 30 20:41:30 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D18B0106566B; Mon, 30 Nov 2009 20:41:30 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C2EB88FC0C; Mon, 30 Nov 2009 20:41:30 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nAUKfUDN042095; Mon, 30 Nov 2009 20:41:30 GMT (envelope-from emaste@svn.freebsd.org) Received: (from emaste@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nAUKfUJ7042093; Mon, 30 Nov 2009 20:41:30 GMT (envelope-from emaste@svn.freebsd.org) Message-Id: <200911302041.nAUKfUJ7042093@svn.freebsd.org> From: Ed Maste Date: Mon, 30 Nov 2009 20:41:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r199972 - head/sys/dev/hwpmc X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Nov 2009 20:41:30 -0000 Author: emaste Date: Mon Nov 30 20:41:30 2009 New Revision: 199972 URL: http://svn.freebsd.org/changeset/base/199972 Log: Use switch out (SWO) instead of switch in (SWI) debug log mask in csw_out. Modified: head/sys/dev/hwpmc/hwpmc_mod.c Modified: head/sys/dev/hwpmc/hwpmc_mod.c ============================================================================== --- head/sys/dev/hwpmc/hwpmc_mod.c Mon Nov 30 18:48:07 2009 (r199971) +++ head/sys/dev/hwpmc/hwpmc_mod.c Mon Nov 30 20:41:30 2009 (r199972) @@ -1401,7 +1401,7 @@ pmc_process_csw_out(struct thread *td) tmp = newvalue - PMC_PCPU_SAVED(cpu,ri); - PMCDBG(CSW,SWI,1,"cpu=%d ri=%d tmp=%jd", cpu, ri, + PMCDBG(CSW,SWO,1,"cpu=%d ri=%d tmp=%jd", cpu, ri, tmp); if (mode == PMC_MODE_TS) { From owner-svn-src-head@FreeBSD.ORG Mon Nov 30 21:03:45 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4F56A1065697; Mon, 30 Nov 2009 21:03:45 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4088F8FC13; Mon, 30 Nov 2009 21:03:45 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nAUL3j7k042674; Mon, 30 Nov 2009 21:03:45 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nAUL3jZp042672; Mon, 30 Nov 2009 21:03:45 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <200911302103.nAUL3jZp042672@svn.freebsd.org> From: John Baldwin Date: Mon, 30 Nov 2009 21:03:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r199974 - head/sys/conf X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Nov 2009 21:03:45 -0000 Author: jhb Date: Mon Nov 30 21:03:44 2009 New Revision: 199974 URL: http://svn.freebsd.org/changeset/base/199974 Log: Remove extra parantheses from usb_ethernet.c and usb_serial.c lines. config(8) doesn't parse parantheses and instead treated them as being part of the device driver name (e.g. '(u3g' vs 'u3g'). While here, fix the style of these long lines to match the wrapping used for other long lines in this file. Submitted by: Brett Glass MFC after: 1 week Modified: head/sys/conf/files Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Mon Nov 30 21:00:42 2009 (r199973) +++ head/sys/conf/files Mon Nov 30 21:03:44 2009 (r199974) @@ -1656,8 +1656,8 @@ dev/usb/net/if_cue.c optional cue dev/usb/net/if_kue.c optional kue dev/usb/net/if_rue.c optional rue dev/usb/net/if_udav.c optional udav -dev/usb/net/usb_ethernet.c \ - optional (aue | axe | cdce | cue | kue | rue | udav) +dev/usb/net/usb_ethernet.c optional aue | axe | cdce | cue | kue | rue | \ + udav # # USB WLAN drivers # @@ -1688,8 +1688,11 @@ dev/usb/serial/uplcom.c optional uplcom dev/usb/serial/uslcom.c optional uslcom dev/usb/serial/uvisor.c optional uvisor dev/usb/serial/uvscom.c optional uvscom -dev/usb/serial/usb_serial.c optional ucom | \ - (u3g | uark | ubsa | ubser | uchcom | ucycom | ufoma | uftdi | ugensa | uipaq | ulpt | umct | umodem | umoscom | uplcom | uslcom | uvisor | uvscom) +dev/usb/serial/usb_serial.c optional ucom | u3g | uark | ubsa | ubser | \ + uchcom | ucycom | ufoma | uftdi | \ + ugensa | uipaq | ulpt | umct | \ + umodem | umoscom | uplcom | uslcom | \ + uvisor | uvscom # # USB misc drivers # From owner-svn-src-head@FreeBSD.ORG Mon Nov 30 21:25:58 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2B6AB106568F; Mon, 30 Nov 2009 21:25:58 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1B6FB8FC08; Mon, 30 Nov 2009 21:25:58 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nAULPvEs043113; Mon, 30 Nov 2009 21:25:57 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nAULPvRO043110; Mon, 30 Nov 2009 21:25:57 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <200911302125.nAULPvRO043110@svn.freebsd.org> From: John Baldwin Date: Mon, 30 Nov 2009 21:25:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r199975 - head/sys/net X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Nov 2009 21:25:58 -0000 Author: jhb Date: Mon Nov 30 21:25:57 2009 New Revision: 199975 URL: http://svn.freebsd.org/changeset/base/199975 Log: Remove if_timer/if_watchdog now that they are no longer used. The space used by if_timer is reserved for expanding if_index to an int in the future. Reviewed by: rwatson, brooks Modified: head/sys/net/if.c head/sys/net/if_dead.c head/sys/net/if_var.h Modified: head/sys/net/if.c ============================================================================== --- head/sys/net/if.c Mon Nov 30 21:03:44 2009 (r199974) +++ head/sys/net/if.c Mon Nov 30 21:25:57 2009 (r199975) @@ -96,8 +96,6 @@ struct ifindex_entry { struct ifnet *ife_ifnet; }; -static int slowtimo_started; - SYSCTL_NODE(_net, PF_LINK, link, CTLFLAG_RW, 0, "Link layers"); SYSCTL_NODE(_net_link, 0, generic, CTLFLAG_RW, 0, "Generic link-management"); @@ -125,10 +123,8 @@ static int ifconf(u_long, caddr_t); static void if_freemulti(struct ifmultiaddr *); static void if_init(void *); static void if_grow(void); -static void if_check(void *); static void if_route(struct ifnet *, int flag, int fam); static int if_setflag(struct ifnet *, int, int, int *, int); -static void if_slowtimo(void *); static int if_transmit(struct ifnet *ifp, struct mbuf *m); static void if_unroute(struct ifnet *, int flag, int fam); static void link_rtrequest(int, struct rtentry *, struct rt_addrinfo *); @@ -185,11 +181,6 @@ struct sx ifnet_sxlock; static if_com_alloc_t *if_com_alloc[256]; static if_com_free_t *if_com_free[256]; -/* - * System initialization - */ -SYSINIT(interface_check, SI_SUB_PROTO_IF, SI_ORDER_FIRST, if_check, NULL); - MALLOC_DEFINE(M_IFNET, "ifnet", "interface internals"); MALLOC_DEFINE(M_IFADDR, "ifaddr", "interface address"); MALLOC_DEFINE(M_IFMADDR, "ether_multi", "link-level multicast address"); @@ -375,18 +366,6 @@ if_grow(void) V_ifindex_table = e; } -static void -if_check(void *dummy __unused) -{ - - /* - * If at least one interface added during boot uses - * if_watchdog then start the timer. - */ - if (slowtimo_started) - if_slowtimo(0); -} - /* * Allocate a struct ifnet and an index for an interface. A layer 2 * common structure will also be allocated if an allocation routine is @@ -670,18 +649,6 @@ if_attach_internal(struct ifnet *ifp, in /* Announce the interface. */ rt_ifannouncemsg(ifp, IFAN_ARRIVAL); - - if (!vmove && ifp->if_watchdog != NULL) { - if_printf(ifp, - "WARNING: using obsoleted if_watchdog interface\n"); - - /* - * Note that we need if_slowtimo(). If this happens after - * boot, then call if_slowtimo() directly. - */ - if (atomic_cmpset_int(&slowtimo_started, 0, 1) && !cold) - if_slowtimo(0); - } } static void @@ -1973,39 +1940,6 @@ if_qflush(struct ifnet *ifp) } /* - * Handle interface watchdog timer routines. Called - * from softclock, we decrement timers (if set) and - * call the appropriate interface routine on expiration. - * - * XXXRW: Note that because timeouts run with Giant, if_watchdog() is called - * holding Giant. - */ -static void -if_slowtimo(void *arg) -{ - VNET_ITERATOR_DECL(vnet_iter); - struct ifnet *ifp; - int s = splimp(); - - VNET_LIST_RLOCK_NOSLEEP(); - IFNET_RLOCK_NOSLEEP(); - VNET_FOREACH(vnet_iter) { - CURVNET_SET(vnet_iter); - TAILQ_FOREACH(ifp, &V_ifnet, if_link) { - if (ifp->if_timer == 0 || --ifp->if_timer) - continue; - if (ifp->if_watchdog) - (*ifp->if_watchdog)(ifp); - } - CURVNET_RESTORE(); - } - IFNET_RUNLOCK_NOSLEEP(); - VNET_LIST_RUNLOCK_NOSLEEP(); - splx(s); - timeout(if_slowtimo, (void *)0, hz / IFNET_SLOWHZ); -} - -/* * Map interface name to interface structure pointer, with or without * returning a reference. */ Modified: head/sys/net/if_dead.c ============================================================================== --- head/sys/net/if_dead.c Mon Nov 30 21:03:44 2009 (r199974) +++ head/sys/net/if_dead.c Mon Nov 30 21:25:57 2009 (r199975) @@ -70,12 +70,6 @@ ifdead_ioctl(struct ifnet *ifp, u_long c return (ENXIO); } -static void -ifdead_watchdog(struct ifnet *ifp) -{ - -} - static int ifdead_resolvemulti(struct ifnet *ifp, struct sockaddr **llsa, struct sockaddr *sa) @@ -107,7 +101,6 @@ if_dead(struct ifnet *ifp) ifp->if_input = ifdead_input; ifp->if_start = ifdead_start; ifp->if_ioctl = ifdead_ioctl; - ifp->if_watchdog = ifdead_watchdog; ifp->if_resolvemulti = ifdead_resolvemulti; ifp->if_qflush = ifdead_qflush; ifp->if_transmit = ifdead_transmit; Modified: head/sys/net/if_var.h ============================================================================== --- head/sys/net/if_var.h Mon Nov 30 21:03:44 2009 (r199974) +++ head/sys/net/if_var.h Mon Nov 30 21:25:57 2009 (r199975) @@ -141,7 +141,7 @@ struct ifnet { struct carp_if *if_carp; /* carp interface structure */ struct bpf_if *if_bpf; /* packet filter structure */ u_short if_index; /* numeric abbreviation for this if */ - short if_timer; /* time 'til if_watchdog called */ + short if_index_reserved; /* spare space to grow if_index */ struct ifvlantrunk *if_vlantrunk; /* pointer to 802.1q data */ int if_flags; /* up/down, broadcast, etc. */ int if_capabilities; /* interface features & capabilities */ @@ -161,8 +161,6 @@ struct ifnet { (struct ifnet *); int (*if_ioctl) /* ioctl routine */ (struct ifnet *, u_long, caddr_t); - void (*if_watchdog) /* timer routine */ - (struct ifnet *); void (*if_init) /* Init routine */ (void *); int (*if_resolvemulti) /* validate/resolve multicast */ From owner-svn-src-head@FreeBSD.ORG Mon Nov 30 23:35:54 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E6990106566B; Mon, 30 Nov 2009 23:35:54 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from pele.citylink.co.nz (pele.citylink.co.nz [202.8.44.226]) by mx1.freebsd.org (Postfix) with ESMTP id 9DACF8FC1E; Mon, 30 Nov 2009 23:35:54 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by pele.citylink.co.nz (Postfix) with ESMTP id 411DE7BA13; Tue, 1 Dec 2009 12:35:53 +1300 (NZDT) X-Virus-Scanned: Debian amavisd-new at citylink.co.nz Received: from pele.citylink.co.nz ([127.0.0.1]) by localhost (pele.citylink.co.nz [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id hCAmkr0uMrbU; Tue, 1 Dec 2009 12:35:48 +1300 (NZDT) Received: from citylink.fud.org.nz (unknown [202.8.44.45]) by pele.citylink.co.nz (Postfix) with ESMTP; Tue, 1 Dec 2009 12:35:48 +1300 (NZDT) Received: by citylink.fud.org.nz (Postfix, from userid 1001) id 0483B11475; Tue, 1 Dec 2009 12:35:47 +1300 (NZDT) Date: Tue, 1 Dec 2009 12:35:47 +1300 From: Andrew Thompson To: John Baldwin Message-ID: <20091130233547.GA68836@citylink.fud.org.nz> References: <200911302125.nAULPvRO043110@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200911302125.nAULPvRO043110@svn.freebsd.org> User-Agent: Mutt/1.5.17 (2007-11-01) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r199975 - head/sys/net X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Nov 2009 23:35:55 -0000 On Mon, Nov 30, 2009 at 09:25:57PM +0000, John Baldwin wrote: > Author: jhb > Date: Mon Nov 30 21:25:57 2009 > New Revision: 199975 > URL: http://svn.freebsd.org/changeset/base/199975 > > Log: > Remove if_timer/if_watchdog now that they are no longer used. The space > used by if_timer is reserved for expanding if_index to an int in the > future. > > Reviewed by: rwatson, brooks > I am getting, ===> usr.bin/netstat (all) cc -O2 -pipe -fno-strict-aliasing -DIPSEC -DSCTP -DINET6 -DNETGRAPH -DIPX -std=gnu99 -fstack-protector -Wsystem-headers -Werror -Wall -Wno-format-y2k -W -Wno-unused-parameter -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wno-uninitialized -Wno-pointer-sign -c /usr/home/thompsa/scratch/fbsvn/head/usr.bin/netstat/if.c /usr/home/thompsa/scratch/fbsvn/head/usr.bin/netstat/if.c: In function 'intpr': /usr/home/thompsa/scratch/fbsvn/head/usr.bin/netstat/if.c:291: error: 'struct ifnet' has no member named 'if_timer' *** Error code 1 Stop in /usr/home/thompsa/scratch/fbsvn/head/usr.bin/netstat. *** Error code 1 From owner-svn-src-head@FreeBSD.ORG Tue Dec 1 00:32:41 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1C08D106566B; Tue, 1 Dec 2009 00:32:41 +0000 (UTC) (envelope-from lynx.ripe@gmail.com) Received: from mail-fx0-f218.google.com (mail-fx0-f218.google.com [209.85.220.218]) by mx1.freebsd.org (Postfix) with ESMTP id 4D27B8FC1B; Tue, 1 Dec 2009 00:32:39 +0000 (UTC) Received: by fxm10 with SMTP id 10so3647638fxm.14 for ; Mon, 30 Nov 2009 16:32:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from :user-agent:mime-version:to:cc:subject:content-type :content-transfer-encoding; bh=lxkgGsdTXtz9qnm+rb3GJQ9Ge8bLQY5aoedkBw05y2g=; b=H+kxDtqFm9Wyb03F1FTnVhNJYz5TH52xwoIoDgFh+BS0O3LTP6JW4mi2cO2oLMvaOY LUTnCteCnLxwdYSfvKcntH44q55LC+2WojHUidneYV352nxUG8st2arBrMKs6tv0zhLN nkekqhdukTulNVGj+evHpPwfOVNDK0fVzpa8A= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:cc:subject :content-type:content-transfer-encoding; b=ssuwhZNKRoNT7gFMEbdzQS18ysJJgedzObJWodMrrwbpcoFsCZ3TIFO4+6zGS21Pjn MOXwtmd5IlGHjNxS2xRaCUdsETGACWP8/K17YaxzUKuGE3ckQPDqXTK2Q7j+kES69Z11 6VDkpggdv/03zAjDnxz+YRaDL9oIrjC6Gt+6E= Received: by 10.86.161.1 with SMTP id j1mr4808623fge.7.1259627558093; Mon, 30 Nov 2009 16:32:38 -0800 (PST) Received: from lynx.homenet (135-4-132-95.pool.ukrtel.net [95.132.4.135]) by mx.google.com with ESMTPS id 12sm12190742fgg.2.2009.11.30.16.32.36 (version=TLSv1/SSLv3 cipher=RC4-MD5); Mon, 30 Nov 2009 16:32:37 -0800 (PST) Message-ID: <4B146423.2090703@gmail.com> Date: Tue, 01 Dec 2009 02:32:35 +0200 From: Dmitry Pryanishnikov User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.8.1.23) Gecko/20090906 SeaMonkey/1.1.18 MIME-Version: 1.0 To: Brooks Davis Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r195843 - in head: lib/libkvm sys/kern sys/sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Dec 2009 00:32:41 -0000 Hello! > Author: brooks > Date: Fri Jul 24 15:03:10 2009 > New Revision: 195843 > URL: http://svn.freebsd.org/changeset/base/195843 > > Log: > Revert the changes to struct kinfo_proc in r194498. Instead, fill > in up to 16 (KI_NGROUPS) values and steal a bit from ki_cr_flags > (all bits currently unused) to indicate overflow with the new flag > KI_CRF_GRP_OVERFLOW. > > This fixes procstat -s. > > Approved by: re (kib) > > Modified: > head/lib/libkvm/kvm_proc.c > head/sys/kern/kern_proc.c > head/sys/sys/user.h > > Modified: head/lib/libkvm/kvm_proc.c > ============================================================================== > --- head/lib/libkvm/kvm_proc.c Fri Jul 24 14:57:02 2009 (r195842) > +++ head/lib/libkvm/kvm_proc.c Fri Jul 24 15:03:10 2009 (r195843) > @@ -145,8 +145,14 @@ kvm_proclist(kd, what, arg, p, bp, maxcn > kp->ki_svuid = ucred.cr_svuid; > kp->ki_rgid = ucred.cr_rgid; > kp->ki_svgid = ucred.cr_svgid; > - kp->ki_ngroups = ucred.cr_ngroups; > - kp->ki_groups = ucred.cr_groups; > + kp->ki_cr_flags = ucred.cr_flags; > + if (ucred.cr_ngroups > KI_NGROUPS) { > + kp->ki_ngroups = KI_NGROUPS; > + kp->ki_cr_flags |= KI_CRF_GRP_OVERFLOW; > + } > + kp->ki_ngroups = ucred.cr_ngroups; It seems that 'else' is missing after closing brace of this 'if'? With the code as is, 'kp->ki_ngroups = KI_NGROUPS;' is effectively NO-OP... Sincerely, Dmitry -- nic-hdl: LYNX-RIPE From owner-svn-src-head@FreeBSD.ORG Tue Dec 1 02:57:07 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9EC0C1065672; Tue, 1 Dec 2009 02:57:07 +0000 (UTC) (envelope-from cperciva@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8D6A78FC1C; Tue, 1 Dec 2009 02:57:07 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nB12v7UR049987; Tue, 1 Dec 2009 02:57:07 GMT (envelope-from cperciva@svn.freebsd.org) Received: (from cperciva@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nB12v7Qe049986; Tue, 1 Dec 2009 02:57:07 GMT (envelope-from cperciva@svn.freebsd.org) Message-Id: <200912010257.nB12v7Qe049986@svn.freebsd.org> From: Colin Percival Date: Tue, 1 Dec 2009 02:57:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r199979 - head/libexec/rtld-elf X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Dec 2009 02:57:07 -0000 Author: cperciva Date: Tue Dec 1 02:57:06 2009 New Revision: 199979 URL: http://svn.freebsd.org/changeset/base/199979 Log: Fix local root vulnerability. Security: Advisory will be coming soon. X-MFC-After: 30 seconds Modified: head/libexec/rtld-elf/rtld.c Modified: head/libexec/rtld-elf/rtld.c ============================================================================== --- head/libexec/rtld-elf/rtld.c Tue Dec 1 00:42:17 2009 (r199978) +++ head/libexec/rtld-elf/rtld.c Tue Dec 1 02:57:06 2009 (r199979) @@ -366,12 +366,12 @@ _rtld(Elf_Addr *sp, func_ptr_type *exit_ * future processes to honor the potentially un-safe variables. */ if (!trust) { - unsetenv(LD_ "PRELOAD"); - unsetenv(LD_ "LIBMAP"); - unsetenv(LD_ "LIBRARY_PATH"); - unsetenv(LD_ "LIBMAP_DISABLE"); - unsetenv(LD_ "DEBUG"); - unsetenv(LD_ "ELF_HINTS_PATH"); + if (unsetenv(LD_ "PRELOAD") || unsetenv(LD_ "LIBMAP") || + unsetenv(LD_ "LIBRARY_PATH") || unsetenv(LD_ "LIBMAP_DISABLE") || + unsetenv(LD_ "DEBUG") || unsetenv(LD_ "ELF_HINTS_PATH")) { + _rtld_error("environment corrupt; aborting"); + die(); + } } ld_debug = getenv(LD_ "DEBUG"); libmap_disable = getenv(LD_ "LIBMAP_DISABLE") != NULL; From owner-svn-src-head@FreeBSD.ORG Tue Dec 1 05:04:43 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0650810662F1; Tue, 1 Dec 2009 05:04:32 +0000 (UTC) (envelope-from green@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E932C8FC13; Tue, 1 Dec 2009 05:04:31 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nB154Vxm053172; Tue, 1 Dec 2009 05:04:31 GMT (envelope-from green@svn.freebsd.org) Received: (from green@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nB154VnS053167; Tue, 1 Dec 2009 05:04:31 GMT (envelope-from green@svn.freebsd.org) Message-Id: <200912010504.nB154VnS053167@svn.freebsd.org> From: Brian Feldman Date: Tue, 1 Dec 2009 05:04:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r199983 - in head: lib/libc/stdlib tools/regression/environ X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Dec 2009 05:04:43 -0000 Author: green Date: Tue Dec 1 05:04:31 2009 New Revision: 199983 URL: http://svn.freebsd.org/changeset/base/199983 Log: Do not gratuitously fail *env(3) operations due to corrupt ('='-less) **environ entries. This puts non-getenv(3) operations in line with getenv(3) in that bad environ entries do not cause all operations to fail. There is still some inconsistency in that getenv(3) in the absence of any environment-modifying operation does not emit corrupt environ entry warnings. I also fixed another inconsistency in getenv(3) where updating the global environ pointer would not be reflected in the return values. It would have taken an intermediary setenv(3)/putenv(3)/unsetenv(3) in order to see the change. Modified: head/lib/libc/stdlib/getenv.c head/tools/regression/environ/Makefile.envctl head/tools/regression/environ/envctl.c head/tools/regression/environ/envtest.t Modified: head/lib/libc/stdlib/getenv.c ============================================================================== --- head/lib/libc/stdlib/getenv.c Tue Dec 1 03:52:50 2009 (r199982) +++ head/lib/libc/stdlib/getenv.c Tue Dec 1 05:04:31 2009 (r199983) @@ -96,6 +96,8 @@ static int envVarsTotal = 0; /* Deinitialization of new environment. */ static void __attribute__ ((destructor)) __clean_env_destructor(void); +/* Resetting the environ pointer will affect the env functions. */ +static int __merge_environ(void); /* @@ -190,6 +192,9 @@ __findenv_environ(const char *name, size { int envNdx; + if (environ == NULL) + return (NULL); + /* Find variable within environ. */ for (envNdx = 0; environ[envNdx] != NULL; envNdx++) if (strncmpeq(environ[envNdx], name, nameLen)) @@ -328,6 +333,7 @@ __build_env(void) { char **env; int activeNdx; + int checking; int envNdx; int savedErrno; size_t nameLen; @@ -339,6 +345,23 @@ __build_env(void) /* Count environment variables. */ for (env = environ, envVarsTotal = 0; *env != NULL; env++) envVarsTotal++; + /* Remove any corrupt variable entries, but do not error out. */ + checking = 0; + while (checking < envVarsTotal) { + if (strchr(environ[checking], '=') != NULL) { + checking++; + } else { + __env_warnx(CorruptEnvValueMsg, + environ[checking], strlen(environ[checking])); + /* + * Pull back all remaining entries from checking + 1 + * through envVarsTotal, including the NULL at the end. + */ + memmove(&environ[checking], &environ[checking + 1], + sizeof(char *) * (envVarsTotal - checking)); + envVarsTotal--; + } + } envVarsSize = envVarsTotal * 2; /* Create new environment. */ @@ -353,18 +376,8 @@ __build_env(void) strdup(environ[envVarsTotal - envNdx - 1]); if (envVars[envNdx].name == NULL) goto Failure; - envVars[envNdx].value = strchr(envVars[envNdx].name, '='); - if (envVars[envNdx].value != NULL) { - envVars[envNdx].value++; - envVars[envNdx].valueSize = - strlen(envVars[envNdx].value); - } else { - __env_warnx(CorruptEnvValueMsg, envVars[envNdx].name, - strlen(envVars[envNdx].name)); - errno = EFAULT; - goto Failure; - } - + envVars[envNdx].value = strchr(envVars[envNdx].name, '=') + 1; + envVars[envNdx].valueSize = strlen(envVars[envNdx].value); /* * Find most current version of variable to make active. This * will prevent multiple active variables from being created @@ -426,22 +439,18 @@ getenv(const char *name) } /* - * An empty environment (environ or its first value) regardless if - * environ has been copied before will return a NULL. - * - * If the environment is not empty, find an environment variable via - * environ if environ has not been copied via an *env() call or been - * replaced by a running program, otherwise, use the rebuilt - * environment. + * If we have not already allocated memory by performing + * write operations on the environment, avoid doing so now. */ - if (environ == NULL || environ[0] == NULL) - return (NULL); - else if (envVars == NULL || environ != intEnviron) + if (envVars == NULL) return (__findenv_environ(name, nameLen)); - else { - envNdx = envVarsTotal - 1; - return (__findenv(name, nameLen, &envNdx, true)); - } + + /* Synchronize environment. */ + if (__merge_environ() == -1) + return (NULL); + + envNdx = envVarsTotal - 1; + return (__findenv(name, nameLen, &envNdx, true)); } @@ -559,8 +568,7 @@ __merge_environ(void) if ((equals = strchr(*env, '=')) == NULL) { __env_warnx(CorruptEnvValueMsg, *env, strlen(*env)); - errno = EFAULT; - return (-1); + continue; } if (__setenv(*env, equals - *env, equals + 1, 1) == -1) Modified: head/tools/regression/environ/Makefile.envctl ============================================================================== --- head/tools/regression/environ/Makefile.envctl Tue Dec 1 03:52:50 2009 (r199982) +++ head/tools/regression/environ/Makefile.envctl Tue Dec 1 05:04:31 2009 (r199983) @@ -13,4 +13,4 @@ NO_MAN= yes .include test: ${PROG} - @sh envtest.t + @env -i sh envtest.t Modified: head/tools/regression/environ/envctl.c ============================================================================== --- head/tools/regression/environ/envctl.c Tue Dec 1 03:52:50 2009 (r199982) +++ head/tools/regression/environ/envctl.c Tue Dec 1 05:04:31 2009 (r199983) @@ -60,7 +60,7 @@ dump_environ(void) static void usage(const char *program) { - fprintf(stderr, "Usage: %s [-DGUchrt] [-c 1|2|3|4] [-gu name] " + fprintf(stderr, "Usage: %s [-DGUchrt] [-c 1|2|3|4] [-bgu name] " "[-p name=value]\n" "\t[(-S|-s name) value overwrite]\n\n" "Options:\n" @@ -68,6 +68,7 @@ usage(const char *program) " -G name\t\t\tgetenv(NULL)\n" " -S value overwrite\t\tsetenv(NULL, value, overwrite)\n" " -U\t\t\t\tunsetenv(NULL)\n" + " -b name\t\t\tblank the 'name=$name' entry, corrupting it\n" " -c 1|2|3|4\t\t\tClear environ variable using method:\n" "\t\t\t\t1 - set environ to NULL pointer\n" "\t\t\t\t2 - set environ[0] to NULL pointer\n" @@ -98,6 +99,28 @@ print_rtrn_errno(int rtrnVal, const char return; } +static void +blank_env(const char *var) +{ + char **newenviron; + int n, varlen; + + if (environ == NULL) + return; + + for (n = 0; environ[n] != NULL; n++) + ; + newenviron = malloc(sizeof(char *) * (n + 1)); + varlen = strlen(var); + for (; n >= 0; n--) { + newenviron[n] = environ[n]; + if (newenviron[n] != NULL && + strncmp(newenviron[n], var, varlen) == 0 && + newenviron[n][varlen] == '=') + newenviron[n] += strlen(newenviron[n]); + } + environ = newenviron; +} int main(int argc, char **argv) @@ -114,8 +137,12 @@ main(int argc, char **argv) } /* The entire program is basically executed from this loop. */ - while ((arg = getopt(argc, argv, "DGS:Uc:g:hp:rs:tu:")) != -1) { + while ((arg = getopt(argc, argv, "DGS:Ub:c:g:hp:rs:tu:")) != -1) { switch (arg) { + case 'b': + blank_env(optarg); + break; + case 'c': switch (atoi(optarg)) { case 1: Modified: head/tools/regression/environ/envtest.t ============================================================================== --- head/tools/regression/environ/envtest.t Tue Dec 1 03:52:50 2009 (r199982) +++ head/tools/regression/environ/envtest.t Tue Dec 1 05:04:31 2009 (r199983) @@ -232,3 +232,18 @@ check_result "${BAR} 0 0 ${BAR} 0 0 ${NU run_test -r -g FOO -u FOO -g FOO -s FOO ${BAR} 1 -g FOO check_result "${BAR} 0 0 ${NULL} 0 0 ${BAR}" + + +# corruption (blanking) of environ members. +export BLANK_ME= +export AFTER_BLANK=blanked +run_test -b BLANK_ME -p MORE=vars -g FOO -g BLANK_ME -g AFTER_BLANK +check_result "0 0 ${FOO} ${NULL} ${AFTER_BLANK}" + +run_test -b BLANK_ME -u FOO -g FOO -g AFTER_BLANK +check_result "0 0 ${NULL} ${AFTER_BLANK}" + +export BLANK_ME2= +export AFTER_BLANKS=blankD +run_test -b BLANK_ME -b AFTER_BLANK -b BLANK_ME2 -g FOO -g AFTER_BLANKS +check_result "${FOO} ${AFTER_BLANKS}" From owner-svn-src-head@FreeBSD.ORG Tue Dec 1 06:09:49 2009 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx2.freebsd.org (mx2.freebsd.org [IPv6:2001:4f8:fff6::35]) by hub.freebsd.org (Postfix) with ESMTP id E40C41065694 for ; Tue, 1 Dec 2009 06:09:49 +0000 (UTC) (envelope-from cperciva@freebsd.org) Received: from xps.daemonology.net (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx2.freebsd.org (Postfix) with SMTP id 41EF014E10D for ; Tue, 1 Dec 2009 06:09:49 +0000 (UTC) Received: (qmail 82538 invoked from network); 1 Dec 2009 06:09:48 -0000 Received: from unknown (HELO xps.daemonology.net) (127.0.0.1) by localhost with SMTP; 1 Dec 2009 06:09:48 -0000 Message-ID: <4B14B32C.3060409@freebsd.org> Date: Mon, 30 Nov 2009 22:09:48 -0800 From: Colin Percival User-Agent: Thunderbird 2.0.0.23 (X11/20090919) MIME-Version: 1.0 To: Brian Feldman References: <200912010504.nB154VnS053167@svn.freebsd.org> In-Reply-To: <200912010504.nB154VnS053167@svn.freebsd.org> X-Enigmail-Version: 0.96.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r199983 - in head: lib/libc/stdlib tools/regression/environ X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Dec 2009 06:09:50 -0000 Brian Feldman wrote: > Do not gratuitously fail *env(3) operations due to corrupt ('='-less) > **environ entries. This puts non-getenv(3) operations in line with > getenv(3) in that bad environ entries do not cause all operations to > fail. There is still some inconsistency in that getenv(3) in the > absence of any environment-modifying operation does not emit corrupt > environ entry warnings. > > I also fixed another inconsistency in getenv(3) where updating the > global environ pointer would not be reflected in the return values. > It would have taken an intermediary setenv(3)/putenv(3)/unsetenv(3) > in order to see the change. The FreeBSD Security Team is currently dealing with a security issue relating to this code. Please back out your change (at least to getenv.c; I don't particularly care about the regression tests) until we've finished, and then submit the patch to us for review along with a detailed explanation of what it does. We've already had two major security issues arising out of getenv.c in the past year, and I'd like to make sure we don't have a third. -- Colin Percival Security Officer, FreeBSD | freebsd.org | The power to serve Founder / author, Tarsnap | tarsnap.com | Online backups for the truly paranoid From owner-svn-src-head@FreeBSD.ORG Tue Dec 1 06:12:31 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A79AE1065670; Tue, 1 Dec 2009 06:12:31 +0000 (UTC) (envelope-from keramida@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 978BD8FC1E; Tue, 1 Dec 2009 06:12:31 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nB16CVQL054548; Tue, 1 Dec 2009 06:12:31 GMT (envelope-from keramida@svn.freebsd.org) Received: (from keramida@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nB16CVre054546; Tue, 1 Dec 2009 06:12:31 GMT (envelope-from keramida@svn.freebsd.org) Message-Id: <200912010612.nB16CVre054546@svn.freebsd.org> From: Giorgos Keramidas Date: Tue, 1 Dec 2009 06:12:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r199985 - head/lib/libc/sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Dec 2009 06:12:31 -0000 Author: keramida (doc committer) Date: Tue Dec 1 06:12:31 2009 New Revision: 199985 URL: http://svn.freebsd.org/changeset/base/199985 Log: Describe what setpgid(2) does when pgid=0. The text has been copied from NetBSD's manpage, and it also matches the behavior described by the Open Group's online copy of setpgid.2 at http://www.opengroup.org/onlinepubs/009695399/functions/setpgid.html Obtained from: NetBSD Submitted by: Petros Barbayiannis MFC after: 1 week Modified: head/lib/libc/sys/setpgid.2 Modified: head/lib/libc/sys/setpgid.2 ============================================================================== --- head/lib/libc/sys/setpgid.2 Tue Dec 1 06:11:42 2009 (r199984) +++ head/lib/libc/sys/setpgid.2 Tue Dec 1 06:12:31 2009 (r199985) @@ -54,6 +54,11 @@ to the specified If .Fa pid is zero, then the call applies to the current process. +If +.Fa pgrp +is zero, then the process id of the process specified by +.Fa pid +is used instead. .Pp If the affected process is not the invoking process, then it must be a child of the invoking process, it must not have performed an From owner-svn-src-head@FreeBSD.ORG Tue Dec 1 06:42:48 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 964A7106568F; Tue, 1 Dec 2009 06:42:48 +0000 (UTC) (envelope-from green@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 85F028FC17; Tue, 1 Dec 2009 06:42:48 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nB16gmtn055296; Tue, 1 Dec 2009 06:42:48 GMT (envelope-from green@svn.freebsd.org) Received: (from green@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nB16glnH055295; Tue, 1 Dec 2009 06:42:47 GMT (envelope-from green@svn.freebsd.org) Message-Id: <200912010642.nB16glnH055295@svn.freebsd.org> From: Brian Feldman Date: Tue, 1 Dec 2009 06:42:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r199987 - head/lib/libc/stdlib X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Dec 2009 06:42:48 -0000 Author: green Date: Tue Dec 1 06:42:47 2009 New Revision: 199987 URL: http://svn.freebsd.org/changeset/base/199987 Log: Temporarily revert the previous change because the linker has been modified so that it will abort when the environment is bad. Modified: head/lib/libc/stdlib/getenv.c Modified: head/lib/libc/stdlib/getenv.c ============================================================================== --- head/lib/libc/stdlib/getenv.c Tue Dec 1 06:15:19 2009 (r199986) +++ head/lib/libc/stdlib/getenv.c Tue Dec 1 06:42:47 2009 (r199987) @@ -96,8 +96,6 @@ static int envVarsTotal = 0; /* Deinitialization of new environment. */ static void __attribute__ ((destructor)) __clean_env_destructor(void); -/* Resetting the environ pointer will affect the env functions. */ -static int __merge_environ(void); /* @@ -192,9 +190,6 @@ __findenv_environ(const char *name, size { int envNdx; - if (environ == NULL) - return (NULL); - /* Find variable within environ. */ for (envNdx = 0; environ[envNdx] != NULL; envNdx++) if (strncmpeq(environ[envNdx], name, nameLen)) @@ -333,7 +328,6 @@ __build_env(void) { char **env; int activeNdx; - int checking; int envNdx; int savedErrno; size_t nameLen; @@ -345,23 +339,6 @@ __build_env(void) /* Count environment variables. */ for (env = environ, envVarsTotal = 0; *env != NULL; env++) envVarsTotal++; - /* Remove any corrupt variable entries, but do not error out. */ - checking = 0; - while (checking < envVarsTotal) { - if (strchr(environ[checking], '=') != NULL) { - checking++; - } else { - __env_warnx(CorruptEnvValueMsg, - environ[checking], strlen(environ[checking])); - /* - * Pull back all remaining entries from checking + 1 - * through envVarsTotal, including the NULL at the end. - */ - memmove(&environ[checking], &environ[checking + 1], - sizeof(char *) * (envVarsTotal - checking)); - envVarsTotal--; - } - } envVarsSize = envVarsTotal * 2; /* Create new environment. */ @@ -376,8 +353,18 @@ __build_env(void) strdup(environ[envVarsTotal - envNdx - 1]); if (envVars[envNdx].name == NULL) goto Failure; - envVars[envNdx].value = strchr(envVars[envNdx].name, '=') + 1; - envVars[envNdx].valueSize = strlen(envVars[envNdx].value); + envVars[envNdx].value = strchr(envVars[envNdx].name, '='); + if (envVars[envNdx].value != NULL) { + envVars[envNdx].value++; + envVars[envNdx].valueSize = + strlen(envVars[envNdx].value); + } else { + __env_warnx(CorruptEnvValueMsg, envVars[envNdx].name, + strlen(envVars[envNdx].name)); + errno = EFAULT; + goto Failure; + } + /* * Find most current version of variable to make active. This * will prevent multiple active variables from being created @@ -439,18 +426,22 @@ getenv(const char *name) } /* - * If we have not already allocated memory by performing - * write operations on the environment, avoid doing so now. + * An empty environment (environ or its first value) regardless if + * environ has been copied before will return a NULL. + * + * If the environment is not empty, find an environment variable via + * environ if environ has not been copied via an *env() call or been + * replaced by a running program, otherwise, use the rebuilt + * environment. */ - if (envVars == NULL) - return (__findenv_environ(name, nameLen)); - - /* Synchronize environment. */ - if (__merge_environ() == -1) + if (environ == NULL || environ[0] == NULL) return (NULL); - - envNdx = envVarsTotal - 1; - return (__findenv(name, nameLen, &envNdx, true)); + else if (envVars == NULL || environ != intEnviron) + return (__findenv_environ(name, nameLen)); + else { + envNdx = envVarsTotal - 1; + return (__findenv(name, nameLen, &envNdx, true)); + } } @@ -568,7 +559,8 @@ __merge_environ(void) if ((equals = strchr(*env, '=')) == NULL) { __env_warnx(CorruptEnvValueMsg, *env, strlen(*env)); - continue; + errno = EFAULT; + return (-1); } if (__setenv(*env, equals - *env, equals + 1, 1) == -1) From owner-svn-src-head@FreeBSD.ORG Tue Dec 1 06:48:14 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 378DB106568D; Tue, 1 Dec 2009 06:48:14 +0000 (UTC) (envelope-from green@green.homeunix.org) Received: from green.homeunix.org (green.homeunix.org [66.92.150.152]) by mx1.freebsd.org (Postfix) with ESMTP id DB1C58FC22; Tue, 1 Dec 2009 06:48:13 +0000 (UTC) Received: from green.homeunix.org (green@localhost [127.0.0.1]) by green.homeunix.org (8.14.3/8.14.1) with ESMTP id nB16VHk1040284; Tue, 1 Dec 2009 01:31:17 -0500 (EST) (envelope-from green@green.homeunix.org) Received: (from green@localhost) by green.homeunix.org (8.14.3/8.14.3/Submit) id nB16VGcn040283; Tue, 1 Dec 2009 01:31:16 -0500 (EST) (envelope-from green) Date: Tue, 1 Dec 2009 01:31:16 -0500 From: Brian Fundakowski Feldman To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Message-ID: <20091201063116.GA35660@green.homeunix.org> References: <200912010504.nB154VnS053167@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200912010504.nB154VnS053167@svn.freebsd.org> User-Agent: Mutt/1.5.17 (2007-11-01) Cc: Subject: Re: svn commit: r199983 - in head: lib/libc/stdlib tools/regression/environ X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Dec 2009 06:48:14 -0000 On Tue, Dec 01, 2009 at 05:04:31AM +0000, Brian Feldman wrote: > Author: green > Date: Tue Dec 1 05:04:31 2009 > New Revision: 199983 > URL: http://svn.freebsd.org/changeset/base/199983 > > Log: > Do not gratuitously fail *env(3) operations due to corrupt ('='-less) > **environ entries. This puts non-getenv(3) operations in line with > getenv(3) in that bad environ entries do not cause all operations to > fail. There is still some inconsistency in that getenv(3) in the > absence of any environment-modifying operation does not emit corrupt > environ entry warnings. > > I also fixed another inconsistency in getenv(3) where updating the > global environ pointer would not be reflected in the return values. > It would have taken an intermediary setenv(3)/putenv(3)/unsetenv(3) > in order to see the change. ^^^ I'm apparently pretty sleepy, because I had forgotten what the second half of the change was for :P It makes getenv(3) capable of emitting the corrupted environ warnings. However, this is still avoided in the no-memory-allocation scenario. -- Brian Fundakowski Feldman \'[ FreeBSD ]''''''''''\ <> green@FreeBSD.org \ The Power to Serve! \ Opinions expressed are my own. \,,,,,,,,,,,,,,,,,,,,,,\ From owner-svn-src-head@FreeBSD.ORG Tue Dec 1 07:28:57 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2BBAB1065672; Tue, 1 Dec 2009 07:28:57 +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 1B0C48FC15; Tue, 1 Dec 2009 07:28:57 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nB17SuSr056412; Tue, 1 Dec 2009 07:28:56 GMT (envelope-from brueffer@svn.freebsd.org) Received: (from brueffer@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nB17Suoo056411; Tue, 1 Dec 2009 07:28:56 GMT (envelope-from brueffer@svn.freebsd.org) Message-Id: <200912010728.nB17Suoo056411@svn.freebsd.org> From: Christian Brueffer Date: Tue, 1 Dec 2009 07:28:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r199988 - head/lib/libc/string X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Dec 2009 07:28:57 -0000 Author: brueffer Date: Tue Dec 1 07:28:56 2009 New Revision: 199988 URL: http://svn.freebsd.org/changeset/base/199988 Log: Add an .Nm for strncat. PR: 141037 Submitted by: Jeremy Huddleston MFC after: 3 days Modified: head/lib/libc/string/strcat.3 Modified: head/lib/libc/string/strcat.3 ============================================================================== --- head/lib/libc/string/strcat.3 Tue Dec 1 06:42:47 2009 (r199987) +++ head/lib/libc/string/strcat.3 Tue Dec 1 07:28:56 2009 (r199988) @@ -32,11 +32,12 @@ .\" @(#)strcat.3 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd June 4, 1993 +.Dd December 1, 2009 .Dt STRCAT 3 .Os .Sh NAME -.Nm strcat +.Nm strcat , +.Nm strncat .Nd concatenate strings .Sh LIBRARY .Lb libc From owner-svn-src-head@FreeBSD.ORG Tue Dec 1 10:06:06 2009 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 924311065670; Tue, 1 Dec 2009 10:06:06 +0000 (UTC) (envelope-from ache@nagual.pp.ru) Received: from nagual.pp.ru (nagual.pp.ru [194.87.13.69]) by mx1.freebsd.org (Postfix) with ESMTP id 039688FC12; Tue, 1 Dec 2009 10:06:05 +0000 (UTC) Received: from nagual.pp.ru (ache@localhost [127.0.0.1]) by nagual.pp.ru (8.14.3/8.14.3) with ESMTP id nB1A646x078275; Tue, 1 Dec 2009 13:06:04 +0300 (MSK) (envelope-from ache@nagual.pp.ru) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=nagual.pp.ru; s=default; t=1259661964; bh=oPCWw2UKGV+LahIkYmaE+IdqrKgNMIFcMsjP0vdTcMc=; l=656; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:In-Reply-To; b=tYb4zvlNdFbjyO6CCMiXFZwB8NWYjUwIZgjJO/XIpFQDzGrDxUT7EFtfA//WgI7Yy +ahREP2ivvSO4nLpjA7Rc6Ss1rVCV/cFB9E8ZMETc0TKnmFqb8Z2JtwSj5ElCB8Dc/ mpDGxwVd75UqPOCVDSW90WJxu48oden80oeIfCg0= Received: (from ache@localhost) by nagual.pp.ru (8.14.3/8.14.3/Submit) id nB1A63or078274; Tue, 1 Dec 2009 13:06:04 +0300 (MSK) (envelope-from ache) Date: Tue, 1 Dec 2009 13:06:03 +0300 From: Andrey Chernov To: Brian Feldman Message-ID: <20091201100602.GA77706@nagual.pp.ru> Mail-Followup-To: Andrey Chernov , Brian Feldman , src-committers@FreeBSD.org, svn-src-all@FreeBSD.org, svn-src-head@FreeBSD.org References: <200912010504.nB154VnS053167@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200912010504.nB154VnS053167@svn.freebsd.org> User-Agent: Mutt/1.5.20 (2009-06-14) Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r199983 - in head: lib/libc/stdlib tools/regression/environ X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Dec 2009 10:06:06 -0000 On Tue, Dec 01, 2009 at 05:04:31AM +0000, Brian Feldman wrote: > - if (environ == NULL || environ[0] == NULL) > - return (NULL); > - else if (envVars == NULL || environ != intEnviron) > + if (envVars == NULL) > return (__findenv_environ(name, nameLen)); > - else { > - envNdx = envVarsTotal - 1; > - return (__findenv(name, nameLen, &envNdx, true)); > - } > + > + /* Synchronize environment. */ > + if (__merge_environ() == -1) > + return (NULL); > + > + envNdx = envVarsTotal - 1; > + return (__findenv(name, nameLen, &envNdx, true)); > } __merge_environ() should be avoided here for speed reasons. -- http://ache.pp.ru/ From owner-svn-src-head@FreeBSD.ORG Tue Dec 1 10:25:09 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1B0141065676; Tue, 1 Dec 2009 10:25:09 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mail.cksoft.de (mail.cksoft.de [IPv6:2001:4068:10::3]) by mx1.freebsd.org (Postfix) with ESMTP id 8F0828FC12; Tue, 1 Dec 2009 10:25:08 +0000 (UTC) Received: from localhost (amavis.fra.cksoft.de [192.168.74.71]) by mail.cksoft.de (Postfix) with ESMTP id C51F641C751; Tue, 1 Dec 2009 11:25:06 +0100 (CET) X-Virus-Scanned: amavisd-new at cksoft.de Received: from mail.cksoft.de ([192.168.74.103]) by localhost (amavis.fra.cksoft.de [192.168.74.71]) (amavisd-new, port 10024) with ESMTP id v4LzqpTGGWYz; Tue, 1 Dec 2009 11:25:06 +0100 (CET) Received: by mail.cksoft.de (Postfix, from userid 66) id 1016F41C758; Tue, 1 Dec 2009 11:25:06 +0100 (CET) Received: from maildrop.int.zabbadoz.net (maildrop.int.zabbadoz.net [10.111.66.10]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.int.zabbadoz.net (Postfix) with ESMTP id AE9814448EC; Tue, 1 Dec 2009 10:23:11 +0000 (UTC) Date: Tue, 1 Dec 2009 10:23:09 +0000 (UTC) From: "Bjoern A. Zeeb" X-X-Sender: bz@maildrop.int.zabbadoz.net To: John Baldwin In-Reply-To: <200911302125.nAULPvRO043110@svn.freebsd.org> Message-ID: <20091201102112.N83957@maildrop.int.zabbadoz.net> References: <200911302125.nAULPvRO043110@svn.freebsd.org> X-OpenPGP-Key: 0x14003F198FEFA3E77207EE8D2B58B8F83CCF1842 MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r199975 - head/sys/net X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Dec 2009 10:25:09 -0000 On Mon, 30 Nov 2009, John Baldwin wrote: > Author: jhb > Date: Mon Nov 30 21:25:57 2009 > New Revision: 199975 > URL: http://svn.freebsd.org/changeset/base/199975 > > Log: > Remove if_timer/if_watchdog now that they are no longer used. The space > used by if_timer is reserved for expanding if_index to an int in the > future. > > Reviewed by: rwatson, brooks I have no idea yet if it builds or if the output of netstat still looks sane but this is about what was missed (in userland, apart from the traditional docs in share/doc/smm/18.net/6.t ): http://people.freebsd.org/~bz/20091201-01-no-if_timer.diff > Modified: > head/sys/net/if.c > head/sys/net/if_dead.c > head/sys/net/if_var.h -- Bjoern A. Zeeb It will not break if you know what you are doing. From owner-svn-src-head@FreeBSD.ORG Tue Dec 1 12:18:17 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0C339106566B; Tue, 1 Dec 2009 12:18:17 +0000 (UTC) (envelope-from rbgarga@gmail.com) Received: from mail-ew0-f226.google.com (mail-ew0-f226.google.com [209.85.219.226]) by mx1.freebsd.org (Postfix) with ESMTP id C9CBD8FC13; Tue, 1 Dec 2009 12:18:15 +0000 (UTC) Received: by ewy26 with SMTP id 26so5202990ewy.3 for ; Tue, 01 Dec 2009 04:18:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :from:date:message-id:subject:to:cc:content-type :content-transfer-encoding; bh=L7sH9yK+RXEiFerZ6w08IUFBHa2RoPkq0aEI7BaPXPI=; b=sKpr2NM+8bJs8VTYUhn1UMEwqOxgWDF1J2jGryhwD/s1AHbjbwcRZftQm/jLZpjHpY yNCfNupnDvJ8cWkDe8ui8qs1E4bYNd8u/oBCDW7vpal9l+Jz4NhPYu7eaIHbVSr5KRcq XOaRBxOIuPmZ5tPVqKbyVVNAZy6Cma35G35rs= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type:content-transfer-encoding; b=er/q7Rz9q7jsDMUbwkRWrqjtMcyyZkokyyiuETajLKmoDXKLJu2gKpoOOKQrt8C4sW 4uXxs2sR16SN+h2UliAALzXd/h4tA19viNUFocr8EX7Z68WTnkKLutcTTC60/tWgKAnc EJywpoM2uAEMqCKvugE4AxpMXd++snw+/P0oc= MIME-Version: 1.0 Received: by 10.216.93.71 with SMTP id k49mr1898224wef.172.1259668208415; Tue, 01 Dec 2009 03:50:08 -0800 (PST) In-Reply-To: <20091130233547.GA68836@citylink.fud.org.nz> References: <200911302125.nAULPvRO043110@svn.freebsd.org> <20091130233547.GA68836@citylink.fud.org.nz> From: Renato Botelho Date: Tue, 1 Dec 2009 09:49:48 -0200 Message-ID: <747dc8f30912010349t746cdc6ev779e99c0cba7bc3c@mail.gmail.com> To: Andrew Thompson Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, John Baldwin Subject: Re: svn commit: r199975 - head/sys/net X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Dec 2009 12:18:17 -0000 On Mon, Nov 30, 2009 at 9:35 PM, Andrew Thompson wrot= e: > On Mon, Nov 30, 2009 at 09:25:57PM +0000, John Baldwin wrote: >> Author: jhb >> Date: Mon Nov 30 21:25:57 2009 >> New Revision: 199975 >> URL: http://svn.freebsd.org/changeset/base/199975 >> >> Log: >> =A0 Remove if_timer/if_watchdog now that they are no longer used. =A0The= space >> =A0 used by if_timer is reserved for expanding if_index to an int in the >> =A0 future. >> >> =A0 Reviewed by: =A0 =A0 =A0 =A0rwatson, brooks >> > > I am getting, > > =3D=3D=3D> usr.bin/netstat (all) > cc -O2 -pipe =A0-fno-strict-aliasing -DIPSEC -DSCTP -DINET6 -DNETGRAPH -D= IPX -std=3Dgnu99 -fstack-protector -Wsystem-headers -Werror -Wall -Wno-form= at-y2k -W -Wno-unused-parameter -Wstrict-prototypes -Wmissing-prototypes -W= pointer-arith -Wno-uninitialized -Wno-pointer-sign -c /usr/home/thompsa/scr= atch/fbsvn/head/usr.bin/netstat/if.c > /usr/home/thompsa/scratch/fbsvn/head/usr.bin/netstat/if.c: In function 'i= ntpr': > /usr/home/thompsa/scratch/fbsvn/head/usr.bin/netstat/if.c:291: error: 'st= ruct ifnet' has no member named 'if_timer' > *** Error code 1 > > Stop in /usr/home/thompsa/scratch/fbsvn/head/usr.bin/netstat. > *** Error code 1 same here. --=20 Renato Botelho From owner-svn-src-head@FreeBSD.ORG Tue Dec 1 14:48:17 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BF00F106568F; Tue, 1 Dec 2009 14:48:17 +0000 (UTC) (envelope-from des@des.no) Received: from tim.des.no (tim.des.no [194.63.250.121]) by mx1.freebsd.org (Postfix) with ESMTP id 7E6758FC21; Tue, 1 Dec 2009 14:48:17 +0000 (UTC) Received: from ds4.des.no (des.no [84.49.246.2]) by smtp.des.no (Postfix) with ESMTP id 5A7616D41B; Tue, 1 Dec 2009 14:48:16 +0000 (UTC) Received: by ds4.des.no (Postfix, from userid 1001) id 2185D844D2; Tue, 1 Dec 2009 15:48:16 +0100 (CET) From: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= To: John Baldwin References: <200911302125.nAULPvRO043110@svn.freebsd.org> Date: Tue, 01 Dec 2009 15:48:16 +0100 In-Reply-To: <200911302125.nAULPvRO043110@svn.freebsd.org> (John Baldwin's message of "Mon, 30 Nov 2009 21:25:57 +0000 (UTC)") Message-ID: <86k4x6eonj.fsf@ds4.des.no> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.95 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r199975 - head/sys/net X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Dec 2009 14:48:17 -0000 John Baldwin writes: > Log: > Remove if_timer/if_watchdog now that they are no longer used. The space > used by if_timer is reserved for expanding if_index to an int in the > future. This breaks the build; please either fix netstat or revert. DES --=20 Dag-Erling Sm=C3=B8rgrav - des@des.no From owner-svn-src-head@FreeBSD.ORG Tue Dec 1 14:56:00 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D9A7E1065670; Tue, 1 Dec 2009 14:56:00 +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 C29D88FC0A; Tue, 1 Dec 2009 14:56:00 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nB1Eu0B4067886; Tue, 1 Dec 2009 14:56:00 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nB1Eu0Tt067882; Tue, 1 Dec 2009 14:56:00 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <200912011456.nB1Eu0Tt067882@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Tue, 1 Dec 2009 14:56:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r199992 - in head: share/man/man9 usr.bin/netstat X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Dec 2009 14:56:01 -0000 Author: bz Date: Tue Dec 1 14:56:00 2009 New Revision: 199992 URL: http://svn.freebsd.org/changeset/base/199992 Log: Unbreak user space after if_timer/if_watchdog removal in r199975. Tested by: glebius Modified: head/share/man/man9/ifnet.9 head/usr.bin/netstat/if.c head/usr.bin/netstat/main.c head/usr.bin/netstat/netstat.h Modified: head/share/man/man9/ifnet.9 ============================================================================== --- head/share/man/man9/ifnet.9 Tue Dec 1 12:35:51 2009 (r199991) +++ head/share/man/man9/ifnet.9 Tue Dec 1 14:56:00 2009 (r199992) @@ -28,7 +28,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 14, 2007 +.Dd December 1, 2009 .Os .Dt IFNET 9 .Sh NAME @@ -279,13 +279,6 @@ to refer to a particular interface by in .Xr link_addr 3 ) . (Initialized by .Fn if_alloc . ) -.It Va if_timer -.Pq Vt short -Number of seconds until the watchdog timer -.Fn if_watchdog -is called, or zero if the timer is disabled. -(Set by driver, -decremented by generic watchdog code.) .It Va if_flags .Pq Vt int Flags describing operational parameters of this interface (see below). @@ -401,11 +394,6 @@ flags and flushing queues. See the description of .Fn ifioctl below for more information. -.It Fn if_watchdog -Routine called by the generic code when the watchdog timer, -.Va if_timer , -expires. -Usually this will reset the interface. .\" .It Fn if_poll_recv .\" .It Fn if_poll_xmit .\" .It Fn if_poll_slowinput @@ -415,7 +403,7 @@ Usually this will reset the interface. .\" section, below. .It Fn if_init Initialize and bring up the hardware, -e.g., reset the chip and the watchdog timer and enable the receiver unit. +e.g., reset the chip and enable the receiver unit. Should mark the interface running, but not active .Dv ( IFF_RUNNING , ~IIF_OACTIVE ) . Modified: head/usr.bin/netstat/if.c ============================================================================== --- head/usr.bin/netstat/if.c Tue Dec 1 12:35:51 2009 (r199991) +++ head/usr.bin/netstat/if.c Tue Dec 1 14:56:00 2009 (r199992) @@ -200,7 +200,6 @@ intpr(int interval1, u_long ifnetaddr, v u_long ierrors; u_long idrops; u_long collisions; - short timer; int drops; struct sockaddr *sa = NULL; char name[IFNAMSIZ]; @@ -234,8 +233,6 @@ intpr(int interval1, u_long ifnetaddr, v if (bflag) printf(" %10.10s","Obytes"); printf(" %5s", "Coll"); - if (tflag) - printf(" %s", "Time"); if (dflag) printf(" %s", "Drop"); putchar('\n'); @@ -288,7 +285,6 @@ intpr(int interval1, u_long ifnetaddr, v ierrors = ifnet.if_ierrors; idrops = ifnet.if_iqdrops; collisions = ifnet.if_collisions; - timer = ifnet.if_timer; drops = ifnet.if_snd.ifq_drops; if (ifaddraddr == 0) { @@ -435,8 +431,6 @@ intpr(int interval1, u_long ifnetaddr, v show_stat("lu", 10, obytes, link_layer|network_layer); show_stat("NRSlu", 5, collisions, link_layer); - if (tflag) - show_stat("LSd", 4, timer, link_layer); if (dflag) show_stat("LSd", 4, drops, link_layer); putchar('\n'); Modified: head/usr.bin/netstat/main.c ============================================================================== --- head/usr.bin/netstat/main.c Tue Dec 1 12:35:51 2009 (r199991) +++ head/usr.bin/netstat/main.c Tue Dec 1 14:56:00 2009 (r199992) @@ -339,7 +339,6 @@ int numeric_port; /* show ports numerica static int pflag; /* show given protocol */ int rflag; /* show routing tables (or routing stats) */ int sflag; /* show protocol statistics */ -int tflag; /* show i/f watchdog timers */ int Wflag; /* wide display */ int xflag; /* extra information, includes all socket buffer info */ int zflag; /* zero stats */ @@ -455,9 +454,6 @@ main(int argc, char *argv[]) case 'S': numeric_addr = 1; break; - case 't': - tflag = 1; - break; case 'u': af = AF_UNIX; break; Modified: head/usr.bin/netstat/netstat.h ============================================================================== --- head/usr.bin/netstat/netstat.h Tue Dec 1 12:35:51 2009 (r199991) +++ head/usr.bin/netstat/netstat.h Tue Dec 1 14:56:00 2009 (r199992) @@ -49,7 +49,6 @@ extern int numeric_addr; /* show address extern int numeric_port; /* show ports numerically */ extern int rflag; /* show routing tables (or routing stats) */ extern int sflag; /* show protocol statistics */ -extern int tflag; /* show i/f watchdog timers */ extern int Wflag; /* wide display */ extern int xflag; /* extended display, includes all socket buffer info */ extern int zflag; /* zero stats */ From owner-svn-src-head@FreeBSD.ORG Tue Dec 1 15:15:32 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E3F3F106566B; Tue, 1 Dec 2009 15:15:32 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id B0D898FC1A; Tue, 1 Dec 2009 15:15:32 +0000 (UTC) Received: from bigwig.baldwin.cx (66.111.2.69.static.nyinternet.net [66.111.2.69]) by cyrus.watson.org (Postfix) with ESMTPSA id 49C5546B2A; Tue, 1 Dec 2009 10:15:32 -0500 (EST) Received: from jhbbsd.localnet (unknown [209.249.190.9]) by bigwig.baldwin.cx (Postfix) with ESMTPA id 79DAE8A01F; Tue, 1 Dec 2009 10:15:31 -0500 (EST) From: John Baldwin To: Andrew Thompson Date: Tue, 1 Dec 2009 09:47:58 -0500 User-Agent: KMail/1.12.1 (FreeBSD/7.2-CBSD-20091103; KDE/4.3.1; amd64; ; ) References: <200911302125.nAULPvRO043110@svn.freebsd.org> <20091130233547.GA68836@citylink.fud.org.nz> In-Reply-To: <20091130233547.GA68836@citylink.fud.org.nz> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <200912010947.58475.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.0.1 (bigwig.baldwin.cx); Tue, 01 Dec 2009 10:15:31 -0500 (EST) X-Virus-Scanned: clamav-milter 0.95.1 at bigwig.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-2.5 required=4.2 tests=AWL,BAYES_00,RDNS_NONE autolearn=no version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on bigwig.baldwin.cx Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r199975 - head/sys/net X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Dec 2009 15:15:33 -0000 On Monday 30 November 2009 6:35:47 pm Andrew Thompson wrote: > On Mon, Nov 30, 2009 at 09:25:57PM +0000, John Baldwin wrote: > > Author: jhb > > Date: Mon Nov 30 21:25:57 2009 > > New Revision: 199975 > > URL: http://svn.freebsd.org/changeset/base/199975 > > > > Log: > > Remove if_timer/if_watchdog now that they are no longer used. The space > > used by if_timer is reserved for expanding if_index to an int in the > > future. > > > > Reviewed by: rwatson, brooks > > > > I am getting, > > ===> usr.bin/netstat (all) > cc -O2 -pipe -fno-strict-aliasing -DIPSEC -DSCTP -DINET6 -DNETGRAPH -DIPX -std=gnu99 -fstack-protector -Wsystem-headers -Werror -Wall -Wno-format-y2k -W -Wno-unused-parameter -Wstrict-prototypes - Wmissing-prototypes -Wpointer-arith -Wno-uninitialized -Wno-pointer-sign -c /usr/home/thompsa/scratch/fbsvn/head/usr.bin/netstat/if.c > /usr/home/thompsa/scratch/fbsvn/head/usr.bin/netstat/if.c: In function 'intpr': > /usr/home/thompsa/scratch/fbsvn/head/usr.bin/netstat/if.c:291: error: 'struct ifnet' has no member named 'if_timer' > *** Error code 1 > > Stop in /usr/home/thompsa/scratch/fbsvn/head/usr.bin/netstat. > *** Error code 1 Gah, will fix. -- John Baldwin From owner-svn-src-head@FreeBSD.ORG Tue Dec 1 15:15:34 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 31E7E1065679; Tue, 1 Dec 2009 15:15:34 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id 034488FC08; Tue, 1 Dec 2009 15:15:34 +0000 (UTC) Received: from bigwig.baldwin.cx (66.111.2.69.static.nyinternet.net [66.111.2.69]) by cyrus.watson.org (Postfix) with ESMTPSA id A7C0D46B29; Tue, 1 Dec 2009 10:15:33 -0500 (EST) Received: from jhbbsd.localnet (unknown [209.249.190.9]) by bigwig.baldwin.cx (Postfix) with ESMTPA id B6B9A8A021; Tue, 1 Dec 2009 10:15:32 -0500 (EST) From: John Baldwin To: "Bjoern A. Zeeb" Date: Tue, 1 Dec 2009 09:53:12 -0500 User-Agent: KMail/1.12.1 (FreeBSD/7.2-CBSD-20091103; KDE/4.3.1; amd64; ; ) References: <200911302125.nAULPvRO043110@svn.freebsd.org> <20091201102112.N83957@maildrop.int.zabbadoz.net> In-Reply-To: <20091201102112.N83957@maildrop.int.zabbadoz.net> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <200912010953.12730.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.0.1 (bigwig.baldwin.cx); Tue, 01 Dec 2009 10:15:32 -0500 (EST) X-Virus-Scanned: clamav-milter 0.95.1 at bigwig.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-2.5 required=4.2 tests=AWL,BAYES_00,RDNS_NONE autolearn=no version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on bigwig.baldwin.cx Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r199975 - head/sys/net X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Dec 2009 15:15:34 -0000 On Tuesday 01 December 2009 5:23:09 am Bjoern A. Zeeb wrote: > On Mon, 30 Nov 2009, John Baldwin wrote: > > > Author: jhb > > Date: Mon Nov 30 21:25:57 2009 > > New Revision: 199975 > > URL: http://svn.freebsd.org/changeset/base/199975 > > > > Log: > > Remove if_timer/if_watchdog now that they are no longer used. The space > > used by if_timer is reserved for expanding if_index to an int in the > > future. > > > > Reviewed by: rwatson, brooks > > I have no idea yet if it builds or if the output of netstat still > looks sane but this is about what was missed (in userland, apart from > the traditional docs in share/doc/smm/18.net/6.t ): > > http://people.freebsd.org/~bz/20091201-01-no-if_timer.diff This looks good to me and matches what I just did to netstat locally. -- John Baldwin From owner-svn-src-head@FreeBSD.ORG Tue Dec 1 15:16:04 2009 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6CCA810656DA; Tue, 1 Dec 2009 15:16:04 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id 4450C8FC12; Tue, 1 Dec 2009 15:16:04 +0000 (UTC) Received: from fledge.watson.org (fledge.watson.org [65.122.17.41]) by cyrus.watson.org (Postfix) with ESMTPS id E693946B32; Tue, 1 Dec 2009 10:16:03 -0500 (EST) Date: Tue, 1 Dec 2009 15:16:03 +0000 (GMT) From: Robert Watson X-X-Sender: robert@fledge.watson.org To: Colin Percival In-Reply-To: <4B14B32C.3060409@freebsd.org> Message-ID: References: <200912010504.nB154VnS053167@svn.freebsd.org> <4B14B32C.3060409@freebsd.org> User-Agent: Alpine 2.00 (BSF 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: svn-src-head@FreeBSD.org, Brian Feldman , svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r199983 - in head: lib/libc/stdlib tools/regression/environ X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Dec 2009 15:16:04 -0000 On Mon, 30 Nov 2009, Colin Percival wrote: > Brian Feldman wrote: >> Do not gratuitously fail *env(3) operations due to corrupt ('='-less) >> **environ entries. This puts non-getenv(3) operations in line with >> getenv(3) in that bad environ entries do not cause all operations to >> fail. There is still some inconsistency in that getenv(3) in the >> absence of any environment-modifying operation does not emit corrupt >> environ entry warnings. >> >> I also fixed another inconsistency in getenv(3) where updating the >> global environ pointer would not be reflected in the return values. >> It would have taken an intermediary setenv(3)/putenv(3)/unsetenv(3) >> in order to see the change. > > The FreeBSD Security Team is currently dealing with a security issue > relating to this code. Please back out your change (at least to getenv.c; I > don't particularly care about the regression tests) until we've finished, > and then submit the patch to us for review along with a detailed explanation > of what it does. > > We've already had two major security issues arising out of getenv.c in the > past year, and I'd like to make sure we don't have a third. I think it's fair to say that the POSIXization of the environment code has been an unmitigated disaster, and speaks to the necessity for careful review of those sorts of code changes. Robert N M Watson Computer Laboratory University of Cambridge From owner-svn-src-head@FreeBSD.ORG Tue Dec 1 15:18:25 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9A028106566C; Tue, 1 Dec 2009 15:18:25 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 89CD08FC1B; Tue, 1 Dec 2009 15:18:25 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nB1FIPS9068373; Tue, 1 Dec 2009 15:18:25 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nB1FIPIa068370; Tue, 1 Dec 2009 15:18:25 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <200912011518.nB1FIPIa068370@svn.freebsd.org> From: John Baldwin Date: Tue, 1 Dec 2009 15:18:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r199993 - head/usr.bin/netstat X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Dec 2009 15:18:25 -0000 Author: jhb Date: Tue Dec 1 15:18:25 2009 New Revision: 199993 URL: http://svn.freebsd.org/changeset/base/199993 Log: Remove -t from the manpage and usage. Modified: head/usr.bin/netstat/main.c head/usr.bin/netstat/netstat.1 Modified: head/usr.bin/netstat/main.c ============================================================================== --- head/usr.bin/netstat/main.c Tue Dec 1 14:56:00 2009 (r199992) +++ head/usr.bin/netstat/main.c Tue Dec 1 15:18:25 2009 (r199993) @@ -359,7 +359,7 @@ main(int argc, char *argv[]) af = AF_UNSPEC; - while ((ch = getopt(argc, argv, "AaBbdf:ghI:iLlM:mN:np:rSstuWw:xz")) != -1) + while ((ch = getopt(argc, argv, "AaBbdf:ghI:iLlM:mN:np:rSsuWw:xz")) != -1) switch(ch) { case 'A': Aflag = 1; @@ -777,7 +777,7 @@ usage(void) (void)fprintf(stderr, "%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n", "usage: netstat [-AaLnSWx] [-f protocol_family | -p protocol]\n" " [-M core] [-N system]", -" netstat -i | -I interface [-abdhntW] [-f address_family]\n" +" netstat -i | -I interface [-abdhnW] [-f address_family]\n" " [-M core] [-N system]", " netstat -w wait [-I interface] [-d] [-M core] [-N system]", " netstat -s [-s] [-z] [-f protocol_family | -p protocol]\n" Modified: head/usr.bin/netstat/netstat.1 ============================================================================== --- head/usr.bin/netstat/netstat.1 Tue Dec 1 14:56:00 2009 (r199992) +++ head/usr.bin/netstat/netstat.1 Tue Dec 1 15:18:25 2009 (r199993) @@ -92,7 +92,7 @@ is present, display socket buffer and tc .Bk -words .Nm .Fl i | I Ar interface -.Op Fl abdhntW +.Op Fl abdhnW .Op Fl f Ar address_family .Op Fl M Ar core .Op Fl N Ar system @@ -123,9 +123,6 @@ If .Fl h is also present, print all counters in human readable form. If -.Fl t -is also present, show the contents of watchdog timers. -If .Fl W is also present, print interface names using a wider field size. .It Xo From owner-svn-src-head@FreeBSD.ORG Tue Dec 1 15:24:45 2009 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1A9AD1065676; Tue, 1 Dec 2009 15:24:45 +0000 (UTC) (envelope-from green@green.homeunix.org) Received: from green.homeunix.org (green.homeunix.org [66.92.150.152]) by mx1.freebsd.org (Postfix) with ESMTP id BD7198FC0C; Tue, 1 Dec 2009 15:24:44 +0000 (UTC) Received: from green.homeunix.org (green@localhost [127.0.0.1]) by green.homeunix.org (8.14.3/8.14.1) with ESMTP id nB1FOhMM043689; Tue, 1 Dec 2009 10:24:43 -0500 (EST) (envelope-from green@green.homeunix.org) Received: (from green@localhost) by green.homeunix.org (8.14.3/8.14.3/Submit) id nB1FOh87043688; Tue, 1 Dec 2009 10:24:43 -0500 (EST) (envelope-from green) Date: Tue, 1 Dec 2009 10:24:43 -0500 From: Brian Fundakowski Feldman To: Andrey Chernov , src-committers@FreeBSD.org, svn-src-all@FreeBSD.org, svn-src-head@FreeBSD.org Message-ID: <20091201152442.GB35660@green.homeunix.org> References: <200912010504.nB154VnS053167@svn.freebsd.org> <20091201100602.GA77706@nagual.pp.ru> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20091201100602.GA77706@nagual.pp.ru> User-Agent: Mutt/1.5.17 (2007-11-01) Cc: Subject: Re: svn commit: r199983 - in head: lib/libc/stdlib tools/regression/environ X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Dec 2009 15:24:45 -0000 On Tue, Dec 01, 2009 at 01:06:03PM +0300, Andrey Chernov wrote: > On Tue, Dec 01, 2009 at 05:04:31AM +0000, Brian Feldman wrote: > > - if (environ == NULL || environ[0] == NULL) > > - return (NULL); > > - else if (envVars == NULL || environ != intEnviron) > > + if (envVars == NULL) > > return (__findenv_environ(name, nameLen)); > > - else { > > - envNdx = envVarsTotal - 1; > > - return (__findenv(name, nameLen, &envNdx, true)); > > - } > > + > > + /* Synchronize environment. */ > > + if (__merge_environ() == -1) > > + return (NULL); > > + > > + envNdx = envVarsTotal - 1; > > + return (__findenv(name, nameLen, &envNdx, true)); > > } > > __merge_environ() should be avoided here for speed reasons. If the corrupt environment warnings are not actually that useful, then I agree that there's no other reason not to defer __merge_environ(). I actually wanted to have getenv(3) produce the warnings even if one of the other (modification) functions was never called, but that seemed impossible to do correctly without also having it call __build_environ(). The warnings I don't care much about, but having getenv(3) treat the environment as sane when setenv(3)/unsetenv(3)/putenv(3) operations are indefinitely failing is wrong. -- Brian Fundakowski Feldman \'[ FreeBSD ]''''''''''\ <> green@FreeBSD.org \ The Power to Serve! \ Opinions expressed are my own. \,,,,,,,,,,,,,,,,,,,,,,\ From owner-svn-src-head@FreeBSD.ORG Tue Dec 1 15:51:27 2009 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 78595106568B; Tue, 1 Dec 2009 15:51:27 +0000 (UTC) (envelope-from scf@FreeBSD.org) Received: from mail.farley.org (mail.farley.org [IPv6:2001:470:1f0f:20:2::11]) by mx1.freebsd.org (Postfix) with ESMTP id 3FC3D8FC1D; Tue, 1 Dec 2009 15:51:27 +0000 (UTC) Received: from thor.farley.org (HPooka@thor.farley.org [IPv6:2001:470:1f0f:20:1::5]) by mail.farley.org (8.14.3/8.14.3) with ESMTP id nB1FpQJd059868; Tue, 1 Dec 2009 09:51:26 -0600 (CST) (envelope-from scf@FreeBSD.org) Date: Tue, 1 Dec 2009 09:51:26 -0600 (CST) From: "Sean C. Farley" To: Brian Feldman In-Reply-To: <200912010504.nB154VnS053167@svn.freebsd.org> Message-ID: References: <200912010504.nB154VnS053167@svn.freebsd.org> User-Agent: Alpine 2.00 (BSF 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Spam-Status: No, score=-2.6 required=4.0 tests=AWL,BAYES_00,NO_RELAYS autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on mail.farley.org Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r199983 - in head: lib/libc/stdlib tools/regression/environ X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Dec 2009 15:51:27 -0000 On Tue, 1 Dec 2009, Brian Feldman wrote: > Author: green > Date: Tue Dec 1 05:04:31 2009 > New Revision: 199983 > URL: http://svn.freebsd.org/changeset/base/199983 > > Log: > Do not gratuitously fail *env(3) operations due to corrupt ('='-less) > **environ entries. This puts non-getenv(3) operations in line with > getenv(3) in that bad environ entries do not cause all operations to > fail. There is still some inconsistency in that getenv(3) in the > absence of any environment-modifying operation does not emit corrupt > environ entry warnings. > > I also fixed another inconsistency in getenv(3) where updating the > global environ pointer would not be reflected in the return values. > It would have taken an intermediary setenv(3)/putenv(3)/unsetenv(3) > in order to see the change. A simpler patch[1] is to have the build and merge routines skip unusable environ entries and continue to the next entry. It still can return an error due to memory allocation problems, but those do not necessarily reflect a corrupt environ array. I want to test a few more things first. Sean 1. http://people.freebsd.org/~scf/getenv-1.patch -- scf@FreeBSD.org From owner-svn-src-head@FreeBSD.ORG Tue Dec 1 16:02:01 2009 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 06F57106566B; Tue, 1 Dec 2009 16:02:01 +0000 (UTC) (envelope-from scf@FreeBSD.org) Received: from mail.farley.org (mail.farley.org [IPv6:2001:470:1f0f:20:2::11]) by mx1.freebsd.org (Postfix) with ESMTP id 96BE78FC12; Tue, 1 Dec 2009 16:02:00 +0000 (UTC) Received: from thor.farley.org (HPooka@thor.farley.org [IPv6:2001:470:1f0f:20:1::5]) by mail.farley.org (8.14.3/8.14.3) with ESMTP id nB1G1xFg081957; Tue, 1 Dec 2009 10:01:59 -0600 (CST) (envelope-from scf@FreeBSD.org) Date: Tue, 1 Dec 2009 10:01:59 -0600 (CST) From: "Sean C. Farley" To: Brian Feldman In-Reply-To: <200912010504.nB154VnS053167@svn.freebsd.org> Message-ID: References: <200912010504.nB154VnS053167@svn.freebsd.org> User-Agent: Alpine 2.00 (BSF 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Spam-Status: No, score=-2.6 required=4.0 tests=AWL,BAYES_00,NO_RELAYS autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on mail.farley.org Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r199983 - in head: lib/libc/stdlib tools/regression/environ X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Dec 2009 16:02:01 -0000 On Tue, 1 Dec 2009, Brian Feldman wrote: > I also fixed another inconsistency in getenv(3) where updating the > global environ pointer would not be reflected in the return values. > It would have taken an intermediary setenv(3)/putenv(3)/unsetenv(3) > in order to see the change. In the current code, if environ is replaced or none of the set/put/unset calls have been made, getenv() will use __findenv_environ() (searches environ directly) to find the entry. This is necessary since malloc() depends upon getenv() creating a cross-dependency. > @@ -426,22 +439,18 @@ getenv(const char *name) > } > > /* > - * An empty environment (environ or its first value) regardless if > - * environ has been copied before will return a NULL. > - * > - * If the environment is not empty, find an environment variable via > - * environ if environ has not been copied via an *env() call or been > - * replaced by a running program, otherwise, use the rebuilt > - * environment. > + * If we have not already allocated memory by performing > + * write operations on the environment, avoid doing so now. > */ > - if (environ == NULL || environ[0] == NULL) > - return (NULL); > - else if (envVars == NULL || environ != intEnviron) > + if (envVars == NULL) > return (__findenv_environ(name, nameLen)); > - else { > - envNdx = envVarsTotal - 1; > - return (__findenv(name, nameLen, &envNdx, true)); > - } > + > + /* Synchronize environment. */ > + if (__merge_environ() == -1) > + return (NULL); > + > + envNdx = envVarsTotal - 1; > + return (__findenv(name, nameLen, &envNdx, true)); > } Sean -- scf@FreeBSD.org From owner-svn-src-head@FreeBSD.ORG Tue Dec 1 16:07:50 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 86E671065670; Tue, 1 Dec 2009 16:07:50 +0000 (UTC) (envelope-from ume@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5B91B8FC2E; Tue, 1 Dec 2009 16:07:50 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nB1G7o3P069421; Tue, 1 Dec 2009 16:07:50 GMT (envelope-from ume@svn.freebsd.org) Received: (from ume@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nB1G7oQG069419; Tue, 1 Dec 2009 16:07:50 GMT (envelope-from ume@svn.freebsd.org) Message-Id: <200912011607.nB1G7oQG069419@svn.freebsd.org> From: Hajimu UMEMOTO Date: Tue, 1 Dec 2009 16:07:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r199995 - head/contrib/ntp/ntpd X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Dec 2009 16:07:50 -0000 Author: ume Date: Tue Dec 1 16:07:50 2009 New Revision: 199995 URL: http://svn.freebsd.org/changeset/base/199995 Log: Don't try to bind to an anycast addeess. The KAME IPv6 stack doesn't allow bind to an anycast addeess. It does away with an annoying message. Reviewed by: bz, roberto MFC after: 2 weeks Modified: head/contrib/ntp/ntpd/ntp_io.c Modified: head/contrib/ntp/ntpd/ntp_io.c ============================================================================== --- head/contrib/ntp/ntpd/ntp_io.c Tue Dec 1 15:27:39 2009 (r199994) +++ head/contrib/ntp/ntpd/ntp_io.c Tue Dec 1 16:07:50 2009 (r199995) @@ -65,6 +65,12 @@ #endif /* IPV6 Multicast Support */ #endif /* IPv6 Support */ +#ifdef INCLUDE_IPV6_SUPPORT +#include +#include +#include +#endif /* !INCLUDE_IPV6_SUPPORT */ + extern int listen_to_virtual_ips; extern const char *specific_interface; @@ -1137,6 +1143,36 @@ set_wildcard_reuse(int family, int on) } #endif /* OS_NEEDS_REUSEADDR_FOR_IFADDRBIND */ +#ifdef INCLUDE_IPV6_SUPPORT +static isc_boolean_t +is_anycast(struct sockaddr *sa, char *name) +{ +#if defined(SIOCGIFAFLAG_IN6) && defined(IN6_IFF_ANYCAST) + struct in6_ifreq ifr6; + int fd; + u_int32_t flags6; + + if (sa->sa_family != AF_INET6) + return ISC_FALSE; + if ((fd = socket(AF_INET6, SOCK_DGRAM, 0)) < 0) + return ISC_FALSE; + memset(&ifr6, 0, sizeof(ifr6)); + memcpy(&ifr6.ifr_addr, (struct sockaddr_in6 *)sa, + sizeof(struct sockaddr_in6)); + strlcpy(ifr6.ifr_name, name, IF_NAMESIZE); + if (ioctl(fd, SIOCGIFAFLAG_IN6, &ifr6) < 0) { + close(fd); + return ISC_FALSE; + } + close(fd); + flags6 = ifr6.ifr_ifru.ifru_flags6; + if ((flags6 & IN6_IFF_ANYCAST) != 0) + return ISC_TRUE; +#endif /* !SIOCGIFAFLAG_IN6 || !IN6_IFF_ANYCAST */ + return ISC_FALSE; +} +#endif /* !INCLUDE_IPV6_SUPPORT */ + /* * update_interface strategy * @@ -1276,6 +1312,11 @@ update_interfaces( if (is_wildcard_addr(&interface.sin)) continue; +#ifdef INCLUDE_IPV6_SUPPORT + if (is_anycast((struct sockaddr *)&interface.sin, isc_if.name)) + continue; +#endif /* !INCLUDE_IPV6_SUPPORT */ + /* * map to local *address* in order * to map all duplicate interfaces to an interface structure From owner-svn-src-head@FreeBSD.ORG Tue Dec 1 16:25:17 2009 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8BF771065670; Tue, 1 Dec 2009 16:25:17 +0000 (UTC) (envelope-from scf@FreeBSD.org) Received: from mail.farley.org (mail.farley.org [IPv6:2001:470:1f0f:20:2::11]) by mx1.freebsd.org (Postfix) with ESMTP id 501A78FC0A; Tue, 1 Dec 2009 16:25:17 +0000 (UTC) Received: from thor.farley.org (HPooka@thor.farley.org [IPv6:2001:470:1f0f:20:1::5]) by mail.farley.org (8.14.3/8.14.3) with ESMTP id nB1GPGv9010633; Tue, 1 Dec 2009 10:25:16 -0600 (CST) (envelope-from scf@FreeBSD.org) Date: Tue, 1 Dec 2009 10:25:16 -0600 (CST) From: "Sean C. Farley" To: Robert Watson In-Reply-To: Message-ID: References: <200912010504.nB154VnS053167@svn.freebsd.org> <4B14B32C.3060409@freebsd.org> User-Agent: Alpine 2.00 (BSF 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Spam-Status: No, score=-2.6 required=4.0 tests=AWL,BAYES_00,NO_RELAYS autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on mail.farley.org Cc: svn-src-head@FreeBSD.org, Brian Feldman , svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, Colin Percival Subject: Re: svn commit: r199983 - in head: lib/libc/stdlib tools/regression/environ X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Dec 2009 16:25:17 -0000 On Tue, 1 Dec 2009, Robert Watson wrote: > On Mon, 30 Nov 2009, Colin Percival wrote: *snip* >> We've already had two major security issues arising out of getenv.c >> in the past year, and I'd like to make sure we don't have a third. > > I think it's fair to say that the POSIXization of the environment code > has been an unmitigated disaster, and speaks to the necessity for > careful review of those sorts of code changes. As the author of the environment code, I agree that it has been a painful process. Interestingly, the security issue was a combination of r169661 to rtld.c, which is a correct action, and the new environ code which was developed, as opposed to committed, at the same time. Separately, the security issue would not have existed. Sean -- scf@FreeBSD.org From owner-svn-src-head@FreeBSD.ORG Tue Dec 1 16:29:14 2009 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4097C106568D; Tue, 1 Dec 2009 16:29:14 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id 1499F8FC0C; Tue, 1 Dec 2009 16:29:14 +0000 (UTC) Received: from dhcp-0074221542-35-1b.client.fas.harvard.edu (dhcp-0074221542-35-1b.client.fas.harvard.edu [140.247.247.224]) by cyrus.watson.org (Postfix) with ESMTPSA id 501D746B2D; Tue, 1 Dec 2009 11:29:13 -0500 (EST) Mime-Version: 1.0 (Apple Message framework v1077) Content-Type: text/plain; charset=us-ascii From: "Robert N. M. Watson" In-Reply-To: Date: Tue, 1 Dec 2009 11:29:12 -0500 Content-Transfer-Encoding: quoted-printable Message-Id: <18889B20-51A1-4B38-A303-7642AE23655B@FreeBSD.org> References: <200912010504.nB154VnS053167@svn.freebsd.org> <4B14B32C.3060409@freebsd.org> To: "Sean C. Farley" X-Mailer: Apple Mail (2.1077) Cc: svn-src-head@FreeBSD.org, Brian Feldman , svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, Colin Percival Subject: Re: svn commit: r199983 - in head: lib/libc/stdlib tools/regression/environ X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Dec 2009 16:29:14 -0000 On 1 Dec 2009, at 11:25, Sean C. Farley wrote: >>> We've already had two major security issues arising out of getenv.c = in the past year, and I'd like to make sure we don't have a third. >>=20 >> I think it's fair to say that the POSIXization of the environment = code has been an unmitigated disaster, and speaks to the necessity for = careful review of those sorts of code changes. >=20 > As the author of the environment code, I agree that it has been a = painful process. >=20 > Interestingly, the security issue was a combination of r169661 to = rtld.c, which is a correct action, and the new environ code which was = developed, as opposed to committed, at the same time. Separately, the = security issue would not have existed. One immediately pressing question is whether we can mitigate future = possible problems along the same lines. The obvious thing is a further = (and very careful) audit if all environmental variable use in the base = system. But I wonder if there are some other things we could do, such = as: - libc environment scrubbing: try to be more robust in the presence of = the unexpected (for example, if you find corrupted stuff, ignore it more = robustly); another variation might be to have libc abort(2) if = issetugid() and unsetenv(3) would fail. - kernel environment scrubbing: the kernel is already responsible for = getting those variables across the execve(2) boundary, so is already = copying (and to a lesser extent, validating) it, and could learn to be a = bit more rigorous in its expectations, perhaps more so for = security-sensitive transitions (setuid/setgid/MAC/...) Brian's changes, although poorly timed, seem like a reasonable direction = in this regard: we're stuck with unhelpful APIs, but maybe we can do a = better job. Robert= From owner-svn-src-head@FreeBSD.ORG Tue Dec 1 16:46:59 2009 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CB58E106566C; Tue, 1 Dec 2009 16:46:57 +0000 (UTC) (envelope-from scf@FreeBSD.org) Received: from mail.farley.org (mail.farley.org [IPv6:2001:470:1f0f:20:2::11]) by mx1.freebsd.org (Postfix) with ESMTP id 7672E8FC14; Tue, 1 Dec 2009 16:46:57 +0000 (UTC) Received: from thor.farley.org (HPooka@thor.farley.org [IPv6:2001:470:1f0f:20:1::5]) by mail.farley.org (8.14.3/8.14.3) with ESMTP id nB1GkuWG044128; Tue, 1 Dec 2009 10:46:56 -0600 (CST) (envelope-from scf@FreeBSD.org) Date: Tue, 1 Dec 2009 10:46:56 -0600 (CST) From: "Sean C. Farley" To: "Robert N. M. Watson" In-Reply-To: <18889B20-51A1-4B38-A303-7642AE23655B@FreeBSD.org> Message-ID: References: <200912010504.nB154VnS053167@svn.freebsd.org> <4B14B32C.3060409@freebsd.org> <18889B20-51A1-4B38-A303-7642AE23655B@FreeBSD.org> User-Agent: Alpine 2.00 (BSF 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Spam-Status: No, score=-2.6 required=4.0 tests=AWL,BAYES_00,NO_RELAYS autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on mail.farley.org Cc: svn-src-head@FreeBSD.org, Brian Feldman , svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, Colin Percival Subject: Re: svn commit: r199983 - in head: lib/libc/stdlib tools/regression/environ X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Dec 2009 16:47:00 -0000 On Tue, 1 Dec 2009, Robert N. M. Watson wrote: > On 1 Dec 2009, at 11:25, Sean C. Farley wrote: > >>> I think it's fair to say that the POSIXization of the environment >>> code has been an unmitigated disaster, and speaks to the necessity >>> for careful review of those sorts of code changes. >> >> As the author of the environment code, I agree that it has been a >> painful process. >> >> Interestingly, the security issue was a combination of r169661 to >> rtld.c, which is a correct action, and the new environ code which was >> developed, as opposed to committed, at the same time. Separately, >> the security issue would not have existed. > > One immediately pressing question is whether we can mitigate future > possible problems along the same lines. The obvious thing is a further > (and very careful) audit if all environmental variable use in the base > system. But I wonder if there are some other things we could do, such > as: > > - libc environment scrubbing: try to be more robust in the presence of > the unexpected (for example, if you find corrupted stuff, ignore it > more robustly); another variation might be to have libc abort(2) if > issetugid() and unsetenv(3) would fail. The preliminary patch I sent earlier should at least make the calls behave more like they used to do (go through each variable even if corrupt). However, I do agree that more code (getenv.c and any code that calls into it) needs to be verified for more paranoid use of the environment. As for abort(), I was/still am considering having that be the result of a corrupt environ array. If it is corrupt, why attempt to use it? unsetenv() may still fail, so it may not abort() for other scenarios. > - kernel environment scrubbing: the kernel is already responsible for > getting those variables across the execve(2) boundary, so is already > copying (and to a lesser extent, validating) it, and could learn to be > a bit more rigorous in its expectations, perhaps more so for > security-sensitive transitions (setuid/setgid/MAC/...) That is a good point. I had not thought about kernel validation of the environment in addition to the validation performed in libc. > Brian's changes, although poorly timed, seem like a reasonable > direction in this regard: we're stuck with unhelpful APIs, but maybe > we can do a better job. Getting rid of putenv() and especially removing direct access of environ (replaced with API call(s)) would be my favorite API changes. Sean -- scf@FreeBSD.org From owner-svn-src-head@FreeBSD.ORG Tue Dec 1 17:10:53 2009 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3E5EB1065696; Tue, 1 Dec 2009 17:10:53 +0000 (UTC) (envelope-from green@green.homeunix.org) Received: from green.homeunix.org (green.homeunix.org [66.92.150.152]) by mx1.freebsd.org (Postfix) with ESMTP id BC0DC8FC19; Tue, 1 Dec 2009 17:10:52 +0000 (UTC) Received: from green.homeunix.org (green@localhost [127.0.0.1]) by green.homeunix.org (8.14.3/8.14.1) with ESMTP id nB1HApx1044356; Tue, 1 Dec 2009 12:10:51 -0500 (EST) (envelope-from green@green.homeunix.org) Received: (from green@localhost) by green.homeunix.org (8.14.3/8.14.3/Submit) id nB1HApOx044355; Tue, 1 Dec 2009 12:10:51 -0500 (EST) (envelope-from green) Date: Tue, 1 Dec 2009 12:10:50 -0500 From: Brian Fundakowski Feldman To: "Robert N. M. Watson" Message-ID: <20091201171050.GC35660@green.homeunix.org> References: <200912010504.nB154VnS053167@svn.freebsd.org> <4B14B32C.3060409@freebsd.org> <18889B20-51A1-4B38-A303-7642AE23655B@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <18889B20-51A1-4B38-A303-7642AE23655B@FreeBSD.org> User-Agent: Mutt/1.5.17 (2007-11-01) Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, Colin Percival , "Sean C. Farley" Subject: Re: svn commit: r199983 - in head: lib/libc/stdlib tools/regression/environ X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Dec 2009 17:10:53 -0000 On Tue, Dec 01, 2009 at 11:29:12AM -0500, Robert N. M. Watson wrote: > > On 1 Dec 2009, at 11:25, Sean C. Farley wrote: > > >>> We've already had two major security issues arising out of getenv.c in the past year, and I'd like to make sure we don't have a third. > >> > >> I think it's fair to say that the POSIXization of the environment code has been an unmitigated disaster, and speaks to the necessity for careful review of those sorts of code changes. > > > > As the author of the environment code, I agree that it has been a painful process. > > > > Interestingly, the security issue was a combination of r169661 to rtld.c, which is a correct action, and the new environ code which was developed, as opposed to committed, at the same time. Separately, the security issue would not have existed. > > One immediately pressing question is whether we can mitigate future possible problems along the same lines. The obvious thing is a further (and very careful) audit if all environmental variable use in the base system. But I wonder if there are some other things we could do, such as: > > - libc environment scrubbing: try to be more robust in the presence of the unexpected (for example, if you find corrupted stuff, ignore it more robustly); another variation might be to have libc abort(2) if issetugid() and unsetenv(3) would fail. An abort() makes more sense than an error return where no error is ever expected (i.e. expecting unsetenv(3) to never fail is quite reasonable). > - kernel environment scrubbing: the kernel is already responsible for getting those variables across the execve(2) boundary, so is already copying (and to a lesser extent, validating) it, and could learn to be a bit more rigorous in its expectations, perhaps more so for security-sensitive transitions (setuid/setgid/MAC/...) > > Brian's changes, although poorly timed, seem like a reasonable direction in this regard: we're stuck with unhelpful APIs, but maybe we can do a better job. Do you see a clear advantage to scrubbing environment in the kernel versus libc? The libc environ functions will still need to be able to do it upon change of the environ pointer, so there's some duplication of functionality; but then again there may be iffy environ-using logic in things you run which are not using the /lib/libc.so. -- Brian Fundakowski Feldman \'[ FreeBSD ]''''''''''\ <> green@FreeBSD.org \ The Power to Serve! \ Opinions expressed are my own. \,,,,,,,,,,,,,,,,,,,,,,\ From owner-svn-src-head@FreeBSD.ORG Tue Dec 1 17:24:32 2009 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 678C31065679; Tue, 1 Dec 2009 17:24:32 +0000 (UTC) (envelope-from green@green.homeunix.org) Received: from green.homeunix.org (green.homeunix.org [66.92.150.152]) by mx1.freebsd.org (Postfix) with ESMTP id EBFF38FC20; Tue, 1 Dec 2009 17:24:31 +0000 (UTC) Received: from green.homeunix.org (green@localhost [127.0.0.1]) by green.homeunix.org (8.14.3/8.14.1) with ESMTP id nB1HOUVc044402; Tue, 1 Dec 2009 12:24:30 -0500 (EST) (envelope-from green@green.homeunix.org) Received: (from green@localhost) by green.homeunix.org (8.14.3/8.14.3/Submit) id nB1HOUQ9044401; Tue, 1 Dec 2009 12:24:30 -0500 (EST) (envelope-from green) Date: Tue, 1 Dec 2009 12:24:30 -0500 From: Brian Fundakowski Feldman To: "Sean C. Farley" Message-ID: <20091201172430.GD35660@green.homeunix.org> References: <200912010504.nB154VnS053167@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.17 (2007-11-01) Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r199983 - in head: lib/libc/stdlib tools/regression/environ X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Dec 2009 17:24:32 -0000 On Tue, Dec 01, 2009 at 10:01:59AM -0600, Sean C. Farley wrote: > On Tue, 1 Dec 2009, Brian Feldman wrote: > >> I also fixed another inconsistency in getenv(3) where updating the >> global environ pointer would not be reflected in the return values. >> It would have taken an intermediary setenv(3)/putenv(3)/unsetenv(3) >> in order to see the change. > > In the current code, if environ is replaced or none of the set/put/unset > calls have been made, getenv() will use __findenv_environ() (searches > environ directly) to find the entry. This is necessary since malloc() > depends upon getenv() creating a cross-dependency. Could you replace the (quoted) comment wholesale with something to that effect? >> @@ -426,22 +439,18 @@ getenv(const char *name) >> } >> >> /* >> - * An empty environment (environ or its first value) regardless if >> - * environ has been copied before will return a NULL. >> - * >> - * If the environment is not empty, find an environment variable via >> - * environ if environ has not been copied via an *env() call or been >> - * replaced by a running program, otherwise, use the rebuilt >> - * environment. >> + * If we have not already allocated memory by performing >> + * write operations on the environment, avoid doing so now. >> */ >> - if (environ == NULL || environ[0] == NULL) >> - return (NULL); >> - else if (envVars == NULL || environ != intEnviron) >> + if (envVars == NULL) >> return (__findenv_environ(name, nameLen)); >> - else { >> - envNdx = envVarsTotal - 1; >> - return (__findenv(name, nameLen, &envNdx, true)); >> - } >> + >> + /* Synchronize environment. */ >> + if (__merge_environ() == -1) >> + return (NULL); >> + >> + envNdx = envVarsTotal - 1; >> + return (__findenv(name, nameLen, &envNdx, true)); >> } -- Brian Fundakowski Feldman \'[ FreeBSD ]''''''''''\ <> green@FreeBSD.org \ The Power to Serve! \ Opinions expressed are my own. \,,,,,,,,,,,,,,,,,,,,,,\ From owner-svn-src-head@FreeBSD.ORG Tue Dec 1 17:29:25 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EDB48106568D; Tue, 1 Dec 2009 17:29:25 +0000 (UTC) (envelope-from gibbs@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D299F8FC19; Tue, 1 Dec 2009 17:29:25 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nB1HTP8q071289; Tue, 1 Dec 2009 17:29:25 GMT (envelope-from gibbs@svn.freebsd.org) Received: (from gibbs@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nB1HTP4J071287; Tue, 1 Dec 2009 17:29:25 GMT (envelope-from gibbs@svn.freebsd.org) Message-Id: <200912011729.nB1HTP4J071287@svn.freebsd.org> From: "Justin T. Gibbs" Date: Tue, 1 Dec 2009 17:29:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r199997 - head/sys/dev/xen/netfront X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Dec 2009 17:29:26 -0000 Author: gibbs Date: Tue Dec 1 17:29:25 2009 New Revision: 199997 URL: http://svn.freebsd.org/changeset/base/199997 Log: Add media ioctl support and link notifications so that devd will attempt to run dhclient on a netfront (xn) device that is setup for DHCP in /etc/rc.conf. PR: kern/136251 (fixed differently than the submitted patch) Modified: head/sys/dev/xen/netfront/netfront.c Modified: head/sys/dev/xen/netfront/netfront.c ============================================================================== --- head/sys/dev/xen/netfront/netfront.c Tue Dec 1 16:31:59 2009 (r199996) +++ head/sys/dev/xen/netfront/netfront.c Tue Dec 1 17:29:25 2009 (r199997) @@ -155,6 +155,9 @@ static void netif_disconnect_backend(str static int setup_device(device_t dev, struct netfront_info *info); static void end_access(int ref, void *page); +static int xn_ifmedia_upd(struct ifnet *ifp); +static void xn_ifmedia_sts(struct ifnet *ifp, struct ifmediareq *ifmr); + /* Xenolinux helper functions */ int network_connect(struct netfront_info *); @@ -240,7 +243,9 @@ struct netfront_info { /* Receive-ring batched refills. */ #define RX_MIN_TARGET 32 #define RX_MAX_TARGET NET_RX_RING_SIZE - int rx_min_target, rx_max_target, rx_target; + int rx_min_target; + int rx_max_target; + int rx_target; /* * {tx,rx}_skbs store outstanding skbuffs. The first entry in each @@ -253,19 +258,20 @@ struct netfront_info { grant_ref_t grant_rx_ref[NET_TX_RING_SIZE + 1]; #define TX_MAX_TARGET min(NET_RX_RING_SIZE, 256) - device_t xbdev; - int tx_ring_ref; - int rx_ring_ref; - uint8_t mac[ETHER_ADDR_LEN]; + device_t xbdev; + int tx_ring_ref; + int rx_ring_ref; + uint8_t mac[ETHER_ADDR_LEN]; struct xn_chain_data xn_cdata; /* mbufs */ - struct mbuf_head xn_rx_batch; /* head of the batch queue */ + struct mbuf_head xn_rx_batch; /* head of the batch queue */ int xn_if_flags; struct callout xn_stat_ch; - u_long rx_pfn_array[NET_RX_RING_SIZE]; - multicall_entry_t rx_mcl[NET_RX_RING_SIZE+1]; - mmu_update_t rx_mmu[NET_RX_RING_SIZE]; + u_long rx_pfn_array[NET_RX_RING_SIZE]; + multicall_entry_t rx_mcl[NET_RX_RING_SIZE+1]; + mmu_update_t rx_mmu[NET_RX_RING_SIZE]; + struct ifmedia sc_media; }; #define rx_mbufs xn_cdata.xn_rx_chain @@ -1622,6 +1628,7 @@ xn_ifinit_locked(struct netfront_info *s ifp->if_drv_flags |= IFF_DRV_RUNNING; ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; + if_link_state_change(ifp, LINK_STATE_UP); callout_reset(&sc->xn_stat_ch, hz, xn_tick, sc); @@ -1761,7 +1768,7 @@ xn_ioctl(struct ifnet *ifp, u_long cmd, /* FALLTHROUGH */ case SIOCSIFMEDIA: case SIOCGIFMEDIA: - error = EINVAL; + error = ifmedia_ioctl(ifp, ifr, &sc->sc_media, cmd); break; default: error = ether_ioctl(ifp, cmd, data); @@ -1785,6 +1792,7 @@ xn_stop(struct netfront_info *sc) xn_free_tx_ring(sc); ifp->if_drv_flags &= ~(IFF_DRV_RUNNING | IFF_DRV_OACTIVE); + if_link_state_change(ifp, LINK_STATE_DOWN); } /* START of Xenolinux helper functions adapted to FreeBSD */ @@ -1903,6 +1911,11 @@ create_netdev(device_t dev) np->xbdev = dev; XN_LOCK_INIT(np, xennetif); + + ifmedia_init(&np->sc_media, 0, xn_ifmedia_upd, xn_ifmedia_sts); + ifmedia_add(&np->sc_media, IFM_ETHER|IFM_MANUAL, 0, NULL); + ifmedia_set(&np->sc_media, IFM_ETHER|IFM_MANUAL); + np->rx_target = RX_MIN_TARGET; np->rx_min_target = RX_MIN_TARGET; np->rx_max_target = RX_MAX_TARGET; @@ -1987,7 +2000,8 @@ out: * acknowledgement. */ #if 0 -static void netfront_closing(device_t dev) +static void +netfront_closing(device_t dev) { #if 0 struct netfront_info *info = dev->dev_driver_data; @@ -2000,7 +2014,8 @@ static void netfront_closing(device_t de } #endif -static int netfront_detach(device_t dev) +static int +netfront_detach(device_t dev) { struct netfront_info *info = device_get_softc(dev); @@ -2011,8 +2026,8 @@ static int netfront_detach(device_t dev) return 0; } - -static void netif_free(struct netfront_info *info) +static void +netif_free(struct netfront_info *info) { netif_disconnect_backend(info); #if 0 @@ -2020,7 +2035,8 @@ static void netif_free(struct netfront_i #endif } -static void netif_disconnect_backend(struct netfront_info *info) +static void +netif_disconnect_backend(struct netfront_info *info) { XN_RX_LOCK(info); XN_TX_LOCK(info); @@ -2042,12 +2058,26 @@ static void netif_disconnect_backend(str } -static void end_access(int ref, void *page) +static void +end_access(int ref, void *page) { if (ref != GRANT_INVALID_REF) gnttab_end_foreign_access(ref, page); } +static int +xn_ifmedia_upd(struct ifnet *ifp) +{ + return (0); +} + +static void +xn_ifmedia_sts(struct ifnet *ifp, struct ifmediareq *ifmr) +{ + ifmr->ifm_status = IFM_AVALID|IFM_ACTIVE; + ifmr->ifm_active = IFM_ETHER|IFM_MANUAL; +} + /* ** Driver registration ** */ static device_method_t netfront_methods[] = { /* Device interface */ From owner-svn-src-head@FreeBSD.ORG Tue Dec 1 19:14:57 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6E3AC106568B; Tue, 1 Dec 2009 19:14:57 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5D3528FC12; Tue, 1 Dec 2009 19:14:57 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nB1JEvD8073648; Tue, 1 Dec 2009 19:14:57 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nB1JEvV3073646; Tue, 1 Dec 2009 19:14:57 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <200912011914.nB1JEvV3073646@svn.freebsd.org> From: Ed Schouten Date: Tue, 1 Dec 2009 19:14:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r199998 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Dec 2009 19:14:57 -0000 Author: ed Date: Tue Dec 1 19:14:57 2009 New Revision: 199998 URL: http://svn.freebsd.org/changeset/base/199998 Log: Don't allocate an input buffer for a TTY when the receiver is turned off. When the termios CREAD flag is not set, it makes little sense to allocate an input buffer. Just set the size to 0 in this case to reduce memory footprint. Disallow CREAD to be disabled for pseudo-devices to prevent foot-shooting. Modified: head/sys/kern/tty.c Modified: head/sys/kern/tty.c ============================================================================== --- head/sys/kern/tty.c Tue Dec 1 17:29:25 2009 (r199997) +++ head/sys/kern/tty.c Tue Dec 1 19:14:57 2009 (r199998) @@ -102,10 +102,11 @@ static const char *dev_console_filename; static void tty_watermarks(struct tty *tp) { - size_t bs; + size_t bs = 0; /* Provide an input buffer for 0.2 seconds of data. */ - bs = MIN(tp->t_termios.c_ispeed / 5, TTYBUF_MAX); + if (tp->t_termios.c_cflag & CREAD) + bs = MIN(tp->t_termios.c_ispeed / 5, TTYBUF_MAX); ttyinq_setsize(&tp->t_inq, tp, bs); /* Set low watermark at 10% (when 90% is available). */ @@ -890,6 +891,7 @@ ttydevsw_defparam(struct tty *tp, struct t->c_ospeed = B50; else if (t->c_ospeed > B115200) t->c_ospeed = B115200; + t->c_cflag |= CREAD; return (0); } From owner-svn-src-head@FreeBSD.ORG Tue Dec 1 21:54:53 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CF9831065670; Tue, 1 Dec 2009 21:54:53 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BED118FC08; Tue, 1 Dec 2009 21:54:53 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nB1LsrKt077256; Tue, 1 Dec 2009 21:54:53 GMT (envelope-from emaste@svn.freebsd.org) Received: (from emaste@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nB1LsrQn077254; Tue, 1 Dec 2009 21:54:53 GMT (envelope-from emaste@svn.freebsd.org) Message-Id: <200912012154.nB1LsrQn077254@svn.freebsd.org> From: Ed Maste Date: Tue, 1 Dec 2009 21:54:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200001 - head/sys/dev/hwpmc X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Dec 2009 21:54:53 -0000 Author: emaste Date: Tue Dec 1 21:54:53 2009 New Revision: 200001 URL: http://svn.freebsd.org/changeset/base/200001 Log: Fix parenthesis typo -- copy full frame pointer for userland callchain, not just one byte. Submitted by: Ryan Stone rysto32 at gmail dot com Modified: head/sys/dev/hwpmc/hwpmc_x86.c Modified: head/sys/dev/hwpmc/hwpmc_x86.c ============================================================================== --- head/sys/dev/hwpmc/hwpmc_x86.c Tue Dec 1 21:05:08 2009 (r200000) +++ head/sys/dev/hwpmc/hwpmc_x86.c Tue Dec 1 21:54:53 2009 (r200001) @@ -101,7 +101,7 @@ pmc_save_user_callchain(uintptr_t *cc, i if (copyin((void *) sp, &pc, sizeof(pc)) != 0) return (n); } else if (copyin((void *) r, &pc, sizeof(pc)) != 0 || - copyin((void *) fp, &fp, sizeof(fp) != 0)) + copyin((void *) fp, &fp, sizeof(fp)) != 0) return (n); for (; n < nframes;) { From owner-svn-src-head@FreeBSD.ORG Tue Dec 1 22:23:16 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 07E76106568D; Tue, 1 Dec 2009 22:23:16 +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 E8BCC8FC0A; Tue, 1 Dec 2009 22:23:15 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nB1MNFoC078096; Tue, 1 Dec 2009 22:23:15 GMT (envelope-from np@svn.freebsd.org) Received: (from np@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nB1MNFKI078093; Tue, 1 Dec 2009 22:23:15 GMT (envelope-from np@svn.freebsd.org) Message-Id: <200912012223.nB1MNFKI078093@svn.freebsd.org> From: Navdeep Parhar Date: Tue, 1 Dec 2009 22:23:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200003 - in head/sys/dev/cxgb: . common X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Dec 2009 22:23:16 -0000 Author: np Date: Tue Dec 1 22:23:15 2009 New Revision: 200003 URL: http://svn.freebsd.org/changeset/base/200003 Log: T3 firmware 7.8.0 for cxgb(4) Obtained from: Chelsio MFC after: 3 days Modified: head/sys/dev/cxgb/common/cxgb_common.h head/sys/dev/cxgb/cxgb_t3fw.h Modified: head/sys/dev/cxgb/common/cxgb_common.h ============================================================================== --- head/sys/dev/cxgb/common/cxgb_common.h Tue Dec 1 22:18:27 2009 (r200002) +++ head/sys/dev/cxgb/common/cxgb_common.h Tue Dec 1 22:23:15 2009 (r200003) @@ -97,7 +97,7 @@ enum { enum { FW_VERSION_MAJOR = 7, - FW_VERSION_MINOR = 7, + FW_VERSION_MINOR = 8, FW_VERSION_MICRO = 0 }; Modified: head/sys/dev/cxgb/cxgb_t3fw.h ============================================================================== --- head/sys/dev/cxgb/cxgb_t3fw.h Tue Dec 1 22:18:27 2009 (r200002) +++ head/sys/dev/cxgb/cxgb_t3fw.h Tue Dec 1 22:23:15 2009 (r200003) @@ -32,8 +32,8 @@ $FreeBSD$ #define U (unsigned char) -static unsigned int t3fw_length = 30772; -static unsigned char t3fw[30772] = { +static unsigned int t3fw_length = 30840; +static unsigned char t3fw[30840] = { U 0x60, U 0x00, U 0x74, U 0x00, U 0x20, U 0x03, U 0x80, U 0x00, U 0x20, U 0x03, U 0x70, U 0x00, @@ -55,13 +55,13 @@ static unsigned char t3fw[30772] = { U 0x1F, U 0xFF, U 0xC0, U 0x00, U 0xE3, U 0x00, U 0x04, U 0x3C, U 0x02, U 0x00, U 0x00, U 0x00, - U 0x20, U 0x00, U 0x6B, U 0xE8, + U 0x20, U 0x00, U 0x6C, U 0x34, U 0x1F, U 0xFF, U 0xC2, U 0x90, - U 0x20, U 0x00, U 0x6C, U 0x30, + U 0x20, U 0x00, U 0x6C, U 0x7C, U 0x1F, U 0xFF, U 0xC2, U 0x94, - U 0x20, U 0x00, U 0x6C, U 0x70, + U 0x20, U 0x00, U 0x6C, U 0xBC, U 0x1F, U 0xFF, U 0xC2, U 0x98, - U 0x20, U 0x00, U 0x6C, U 0xE4, + U 0x20, U 0x00, U 0x6D, U 0x30, U 0x1F, U 0xFF, U 0xC2, U 0x9C, U 0x20, U 0x00, U 0x03, U 0xC0, U 0xC0, U 0x00, U 0x00, U 0xE4, @@ -396,11 +396,11 @@ static unsigned char t3fw[30772] = { U 0x20, U 0x00, U 0x03, U 0xB0, U 0xE3, U 0x00, U 0x0D, U 0x3C, U 0x20, U 0x00, U 0x03, U 0xB0, - U 0x20, U 0x00, U 0x6E, U 0x08, + U 0x20, U 0x00, U 0x6E, U 0x54, U 0xE3, U 0x00, U 0x0D, U 0x3C, - U 0x20, U 0x00, U 0x6E, U 0x08, - U 0x20, U 0x00, U 0x6E, U 0x08, - U 0xE3, U 0x00, U 0x77, U 0x94, + U 0x20, U 0x00, U 0x6E, U 0x54, + U 0x20, U 0x00, U 0x6E, U 0x54, + U 0xE3, U 0x00, U 0x77, U 0xE0, U 0x00, U 0x00, U 0x00, U 0x00, U 0x00, U 0x00, U 0x00, U 0x00, U 0x00, U 0x00, U 0x00, U 0x00, @@ -408,8 +408,8 @@ static unsigned char t3fw[30772] = { U 0x1F, U 0xFC, U 0x00, U 0x00, U 0x1F, U 0xFF, U 0xC5, U 0x90, U 0x1F, U 0xFF, U 0xC6, U 0x70, - U 0x20, U 0x00, U 0x6E, U 0x08, - U 0x20, U 0x00, U 0x6E, U 0x08, + U 0x20, U 0x00, U 0x6E, U 0x58, + U 0x20, U 0x00, U 0x6E, U 0x58, U 0xDE, U 0xFF, U 0xFE, U 0x00, U 0x00, U 0x00, U 0x08, U 0x0C, U 0xDE, U 0xAD, U 0xBE, U 0xEF, @@ -616,47 +616,47 @@ static unsigned char t3fw[30772] = { U 0x00, U 0x00, U 0x00, U 0x00, U 0x00, U 0x00, U 0x00, U 0x00, U 0x00, U 0x00, U 0x00, U 0x00, - U 0x20, U 0x00, U 0x55, U 0x08, - U 0x20, U 0x00, U 0x53, U 0xD8, - U 0x20, U 0x00, U 0x55, U 0x08, - U 0x20, U 0x00, U 0x55, U 0x08, - U 0x20, U 0x00, U 0x53, U 0x14, - U 0x20, U 0x00, U 0x53, U 0x14, - U 0x20, U 0x00, U 0x53, U 0x14, - U 0x20, U 0x00, U 0x51, U 0x54, - U 0x20, U 0x00, U 0x51, U 0x54, - U 0x20, U 0x00, U 0x51, U 0x4C, - U 0x20, U 0x00, U 0x50, U 0xB8, - U 0x20, U 0x00, U 0x4F, U 0x60, - U 0x20, U 0x00, U 0x4D, U 0x40, - U 0x20, U 0x00, U 0x4B, U 0x14, - U 0x00, U 0x00, U 0x00, U 0x00, - U 0x00, U 0x00, U 0x00, U 0x00, - U 0x20, U 0x00, U 0x54, U 0xD8, - U 0x20, U 0x00, U 0x53, U 0xA4, - U 0x20, U 0x00, U 0x54, U 0x48, - U 0x20, U 0x00, U 0x54, U 0x48, - U 0x20, U 0x00, U 0x51, U 0xFC, - U 0x20, U 0x00, U 0x51, U 0xFC, - U 0x20, U 0x00, U 0x51, U 0xFC, - U 0x20, U 0x00, U 0x51, U 0xFC, - U 0x20, U 0x00, U 0x51, U 0xFC, - U 0x20, U 0x00, U 0x51, U 0x44, - U 0x20, U 0x00, U 0x51, U 0xFC, - U 0x20, U 0x00, U 0x4E, U 0x80, - U 0x20, U 0x00, U 0x4C, U 0xF0, - U 0x20, U 0x00, U 0x4A, U 0xC0, + U 0x20, U 0x00, U 0x55, U 0x54, + U 0x20, U 0x00, U 0x54, U 0x24, + U 0x20, U 0x00, U 0x55, U 0x54, + U 0x20, U 0x00, U 0x55, U 0x54, + U 0x20, U 0x00, U 0x53, U 0x60, + U 0x20, U 0x00, U 0x53, U 0x60, + U 0x20, U 0x00, U 0x53, U 0x60, + U 0x20, U 0x00, U 0x51, U 0xA0, + U 0x20, U 0x00, U 0x51, U 0xA0, + U 0x20, U 0x00, U 0x51, U 0x98, + U 0x20, U 0x00, U 0x51, U 0x04, + U 0x20, U 0x00, U 0x4F, U 0xAC, + U 0x20, U 0x00, U 0x4D, U 0x8C, + U 0x20, U 0x00, U 0x4B, U 0x60, + U 0x00, U 0x00, U 0x00, U 0x00, + U 0x00, U 0x00, U 0x00, U 0x00, + U 0x20, U 0x00, U 0x55, U 0x24, + U 0x20, U 0x00, U 0x53, U 0xF0, + U 0x20, U 0x00, U 0x54, U 0x94, + U 0x20, U 0x00, U 0x54, U 0x94, + U 0x20, U 0x00, U 0x52, U 0x48, + U 0x20, U 0x00, U 0x52, U 0x48, + U 0x20, U 0x00, U 0x52, U 0x48, + U 0x20, U 0x00, U 0x52, U 0x48, + U 0x20, U 0x00, U 0x52, U 0x48, + U 0x20, U 0x00, U 0x51, U 0x90, + U 0x20, U 0x00, U 0x52, U 0x48, + U 0x20, U 0x00, U 0x4E, U 0xCC, + U 0x20, U 0x00, U 0x4D, U 0x3C, + U 0x20, U 0x00, U 0x4B, U 0x0C, U 0x00, U 0x00, U 0x00, U 0x00, U 0x00, U 0x00, U 0x00, U 0x00, U 0x20, U 0x00, U 0x0B, U 0xE8, U 0x20, U 0x00, U 0x3A, U 0xA8, U 0x20, U 0x00, U 0x04, U 0xC0, - U 0x20, U 0x00, U 0x46, U 0xB4, + U 0x20, U 0x00, U 0x46, U 0xFC, U 0x20, U 0x00, U 0x0B, U 0xE0, U 0x20, U 0x00, U 0x41, U 0xC0, U 0x20, U 0x00, U 0x03, U 0xF0, - U 0x20, U 0x00, U 0x46, U 0x74, - U 0x20, U 0x00, U 0x4A, U 0x9C, + U 0x20, U 0x00, U 0x46, U 0xBC, + U 0x20, U 0x00, U 0x4A, U 0xE8, U 0x20, U 0x00, U 0x3E, U 0xCC, U 0x20, U 0x00, U 0x3D, U 0xE8, U 0x20, U 0x00, U 0x3A, U 0x24, @@ -666,7 +666,7 @@ static unsigned char t3fw[30772] = { U 0x20, U 0x00, U 0x3C, U 0x44, U 0x20, U 0x00, U 0x2D, U 0xB0, U 0x20, U 0x00, U 0x28, U 0x44, - U 0x20, U 0x00, U 0x67, U 0x8C, + U 0x20, U 0x00, U 0x67, U 0xD8, U 0x20, U 0x00, U 0x23, U 0xD0, U 0x20, U 0x00, U 0x20, U 0xB0, U 0x20, U 0x00, U 0x20, U 0x5C, @@ -851,22 +851,22 @@ static unsigned char t3fw[30772] = { U 0x0B, U 0xBB, U 0x90, U 0x00, U 0x53, U 0x00, U 0x00, U 0x00, U 0x63, U 0xFF, U 0xFC, U 0x00, - U 0x20, U 0x00, U 0x6B, U 0xC4, + U 0x20, U 0x00, U 0x6C, U 0x10, U 0x10, U 0xFF, U 0xFF, U 0x0A, U 0x00, U 0x00, U 0x00, U 0x00, - U 0x20, U 0x00, U 0x6B, U 0xE8, + U 0x20, U 0x00, U 0x6C, U 0x34, U 0x00, U 0xD2, U 0x31, U 0x10, U 0xFF, U 0xFE, U 0x0A, U 0x00, U 0x00, U 0x00, U 0x00, U 0x00, - U 0x20, U 0x00, U 0x6C, U 0x30, + U 0x20, U 0x00, U 0x6C, U 0x7C, U 0x00, U 0xD3, U 0x31, U 0x10, U 0xFF, U 0xFE, U 0x0A, U 0x00, U 0x00, U 0x00, U 0x00, U 0x00, - U 0x20, U 0x00, U 0x6C, U 0x70, + U 0x20, U 0x00, U 0x6C, U 0xBC, U 0x00, U 0xD4, U 0x31, U 0x10, U 0xFF, U 0xFE, U 0x0A, U 0x00, U 0x00, U 0x00, U 0x00, U 0x00, - U 0x20, U 0x00, U 0x6C, U 0xE4, + U 0x20, U 0x00, U 0x6D, U 0x30, U 0x00, U 0xD5, U 0x31, U 0x10, U 0xFF, U 0xFE, U 0x0A, U 0x00, U 0x00, U 0x00, U 0x00, U 0x00, @@ -893,8 +893,8 @@ static unsigned char t3fw[30772] = { U 0xFA, U 0xD3, U 0x0F, U 0x77, U 0x6B, U 0x06, U 0x90, U 0x60, U 0xB4, U 0x66, U 0x77, U 0x63, - U 0xF8, U 0x54, U 0x15, U 0xD3, - U 0x54, U 0x1A, U 0x7E, U 0x0F, + U 0xF8, U 0x54, U 0x15, U 0xE6, + U 0x54, U 0x1A, U 0x91, U 0x0F, U 0x14, U 0x00, U 0x63, U 0xFF, U 0xF9, U 0x00, U 0x00, U 0x00, U 0x6C, U 0x10, U 0x04, U 0xC0, @@ -1107,7 +1107,7 @@ static unsigned char t3fw[30772] = { U 0xFC, U 0x13, U 0x2C, U 0x16, U 0x18, U 0x2B, U 0x12, U 0x1A, U 0x2A, U 0x12, U 0x1B, U 0xDC, - U 0x50, U 0x58, U 0x19, U 0x91, + U 0x50, U 0x58, U 0x19, U 0xA4, U 0xC0, U 0xD0, U 0xC0, U 0x90, U 0x2E, U 0x5C, U 0xF4, U 0x2C, U 0x12, U 0x17, U 0x28, U 0x12, @@ -1345,7 +1345,7 @@ static unsigned char t3fw[30772] = { U 0xFC, U 0x2A, U 0x00, U 0x00, U 0x64, U 0x50, U 0xC0, U 0xDA, U 0x20, U 0xDB, U 0xC0, U 0x58, - U 0x16, U 0x65, U 0xC0, U 0x20, + U 0x16, U 0x78, U 0xC0, U 0x20, U 0xD1, U 0x0F, U 0xC0, U 0x91, U 0x63, U 0xFD, U 0x7A, U 0x00, U 0xC0, U 0x91, U 0x63, U 0xFA, @@ -1354,7 +1354,7 @@ static unsigned char t3fw[30772] = { U 0x0A, U 0x80, U 0xC0, U 0x9A, U 0x29, U 0x24, U 0x68, U 0x2C, U 0x70, U 0x07, U 0x58, U 0x15, - U 0x55, U 0xD2, U 0xA0, U 0xD1, + U 0x68, U 0xD2, U 0xA0, U 0xD1, U 0x0F, U 0x03, U 0x47, U 0x0B, U 0x18, U 0xED, U 0x4F, U 0xDB, U 0x70, U 0xA8, U 0x28, U 0x78, @@ -1362,7 +1362,7 @@ static unsigned char t3fw[30772] = { U 0xF8, U 0xD9, U 0xB0, U 0x63, U 0xFA, U 0x61, U 0x00, U 0x00, U 0x2A, U 0x2C, U 0x74, U 0xDB, - U 0x40, U 0x58, U 0x0E, U 0xD1, + U 0x40, U 0x58, U 0x0E, U 0xE3, U 0x63, U 0xFA, U 0xE4, U 0x00, U 0x00, U 0x29, U 0x22, U 0x1D, U 0x2D, U 0x25, U 0x02, U 0x7B, @@ -1386,7 +1386,7 @@ static unsigned char t3fw[30772] = { U 0xC0, U 0xD1, U 0x2E, U 0x0A, U 0x80, U 0xC0, U 0x9E, U 0x29, U 0x24, U 0x68, U 0x2C, U 0x70, - U 0x07, U 0x58, U 0x15, U 0x34, + U 0x07, U 0x58, U 0x15, U 0x47, U 0xC0, U 0x20, U 0xD1, U 0x0F, U 0xC0, U 0x94, U 0x63, U 0xFB, U 0xC9, U 0xC0, U 0x96, U 0x63, @@ -1472,7 +1472,7 @@ static unsigned char t3fw[30772] = { U 0x28, U 0x2D, U 0xF6, U 0x85, U 0xC8, U 0x5A, U 0x2A, U 0x2C, U 0x74, U 0xDB, U 0x40, U 0x58, - U 0x0E, U 0x64, U 0xD2, U 0xA0, + U 0x0E, U 0x76, U 0xD2, U 0xA0, U 0xD1, U 0x0F, U 0xC0, U 0x20, U 0xD1, U 0x0F, U 0x00, U 0x00, U 0x00, U 0x29, U 0xCC, U 0xF9, @@ -1497,26 +1497,26 @@ static unsigned char t3fw[30772] = { U 0x75, U 0x63, U 0xFF, U 0x7D, U 0x00, U 0xCC, U 0x57, U 0xDA, U 0x20, U 0xDB, U 0x30, U 0xDC, - U 0x40, U 0x58, U 0x15, U 0x3A, + U 0x40, U 0x58, U 0x15, U 0x4D, U 0xC0, U 0x20, U 0xD1, U 0x0F, U 0x00, U 0xDA, U 0x20, U 0xC0, - U 0xB6, U 0x58, U 0x15, U 0xC9, + U 0xB6, U 0x58, U 0x15, U 0xDC, U 0x63, U 0xFF, U 0xE5, U 0x00, U 0xDA, U 0x20, U 0x58, U 0x15, - U 0xC7, U 0x63, U 0xFF, U 0xDC, + U 0xDA, U 0x63, U 0xFF, U 0xDC, U 0x00, U 0xDA, U 0x20, U 0xDB, U 0x30, U 0xDC, U 0x40, U 0xDD, - U 0x50, U 0x58, U 0x16, U 0x55, + U 0x50, U 0x58, U 0x16, U 0x68, U 0xD2, U 0xA0, U 0xD1, U 0x0F, U 0xC8, U 0x58, U 0xDA, U 0x20, U 0xDB, U 0x30, U 0x58, U 0x14, - U 0xA7, U 0x2A, U 0x21, U 0x02, + U 0xBA, U 0x2A, U 0x21, U 0x02, U 0x65, U 0xAF, U 0xBD, U 0xC0, U 0x94, U 0x09, U 0xA9, U 0x02, U 0x29, U 0x25, U 0x02, U 0x63, U 0xFF, U 0xB2, U 0x00, U 0x00, U 0x2B, U 0x21, U 0x04, U 0x58, - U 0x14, U 0x53, U 0x1D, U 0xEC, + U 0x14, U 0x66, U 0x1D, U 0xEC, U 0xAF, U 0xC0, U 0xE0, U 0x2E, U 0x24, U 0x66, U 0x8F, U 0x30, U 0x2B, U 0x20, U 0x0C, U 0x0F, @@ -1527,7 +1527,7 @@ static unsigned char t3fw[30772] = { U 0xFC, U 0x50, U 0x64, U 0xCF, U 0x56, U 0x2B, U 0x21, U 0x04, U 0xC0, U 0xC0, U 0x58, U 0x14, - U 0x48, U 0x1D, U 0xEC, U 0xA4, + U 0x5B, U 0x1D, U 0xEC, U 0xA4, U 0xC0, U 0xE0, U 0x8F, U 0x30, U 0x2B, U 0x20, U 0x0C, U 0x0F, U 0x8F, U 0x14, U 0x63, U 0xFF, @@ -1535,7 +1535,7 @@ static unsigned char t3fw[30772] = { U 0x2B, U 0x21, U 0x04, U 0xB1, U 0xCC, U 0x0C, U 0x0C, U 0x47, U 0x2C, U 0x24, U 0x66, U 0x58, - U 0x14, U 0x40, U 0x1D, U 0xEC, + U 0x14, U 0x53, U 0x1D, U 0xEC, U 0x9C, U 0xC0, U 0xE0, U 0x2E, U 0x24, U 0x66, U 0x8F, U 0x30, U 0x2B, U 0x20, U 0x0C, U 0x0F, @@ -1574,7 +1574,7 @@ static unsigned char t3fw[30772] = { U 0xAC, U 0xFD, U 0x65, U 0xA0, U 0xC2, U 0xCC, U 0x5F, U 0xDB, U 0x30, U 0xDA, U 0x20, U 0x8C, - U 0x11, U 0x58, U 0x14, U 0xED, + U 0x11, U 0x58, U 0x15, U 0x00, U 0xC0, U 0x51, U 0x9A, U 0x13, U 0xC7, U 0xBF, U 0x9B, U 0xA9, U 0x8E, U 0x13, U 0x2E, U 0xE2, @@ -1613,19 +1613,19 @@ static unsigned char t3fw[30772] = { U 0x20, U 0x7F, U 0x89, U 0x05, U 0x29, U 0xD2, U 0x85, U 0x65, U 0x91, U 0x65, U 0xDA, U 0x20, - U 0x58, U 0x15, U 0x58, U 0xC9, + U 0x58, U 0x15, U 0x6B, U 0xC9, U 0x5C, U 0x60, U 0x01, U 0xFF, U 0x00, U 0xDA, U 0x20, U 0xC0, - U 0xB6, U 0x58, U 0x15, U 0x55, + U 0xB6, U 0x58, U 0x15, U 0x68, U 0x60, U 0x00, U 0x0C, U 0x00, U 0xC0, U 0x90, U 0x63, U 0xFF, U 0xB5, U 0x00, U 0x00, U 0xDA, - U 0x20, U 0x58, U 0x15, U 0x51, + U 0x20, U 0x58, U 0x15, U 0x64, U 0x65, U 0x51, U 0xE4, U 0x8D, U 0x13, U 0x8C, U 0x11, U 0xDB, U 0xD0, U 0x8D, U 0xD0, U 0x02, U 0x2A, U 0x02, U 0x0D, U 0x6D, - U 0x51, U 0x58, U 0x13, U 0xC3, + U 0x51, U 0x58, U 0x13, U 0xD6, U 0x9A, U 0x13, U 0x64, U 0xA1, U 0xCE, U 0xC7, U 0x5F, U 0x8F, U 0xA1, U 0x95, U 0xA9, U 0xC0, @@ -1643,7 +1643,7 @@ static unsigned char t3fw[30772] = { U 0x09, U 0x9D, U 0x02, U 0x64, U 0x81, U 0x59, U 0xC9, U 0xD3, U 0x8A, U 0x10, U 0x2B, U 0x21, - U 0x04, U 0x58, U 0x13, U 0xD3, + U 0x04, U 0x58, U 0x13, U 0xE6, U 0x8A, U 0x13, U 0xC0, U 0xB0, U 0x2B, U 0x24, U 0x66, U 0x2E, U 0xA2, U 0x09, U 0x2A, U 0xA0, @@ -1700,7 +1700,7 @@ static unsigned char t3fw[30772] = { U 0xE4, U 0xCF, U 0x2B, U 0xBC, U 0x20, U 0x2B, U 0xC6, U 0x85, U 0x2A, U 0x2C, U 0x74, U 0x8B, - U 0x11, U 0x58, U 0x0D, U 0x7F, + U 0x11, U 0x58, U 0x0D, U 0x91, U 0xD2, U 0xA0, U 0xD1, U 0x0F, U 0x28, U 0x20, U 0x3D, U 0xC0, U 0xE0, U 0x7C, U 0x87, U 0x7F, @@ -1734,14 +1734,14 @@ static unsigned char t3fw[30772] = { U 0xF0, U 0x63, U 0xFE, U 0x95, U 0x00, U 0xDA, U 0x20, U 0xDB, U 0x30, U 0x8C, U 0x11, U 0xDD, - U 0x50, U 0x58, U 0x15, U 0x71, + U 0x50, U 0x58, U 0x15, U 0x84, U 0xD2, U 0xA0, U 0xD1, U 0x0F, U 0xC0, U 0xE1, U 0x63, U 0xFF, U 0x7A, U 0x8B, U 0x13, U 0x8C, U 0x11, U 0xDD, U 0x50, U 0xC0, U 0xAA, U 0x2E, U 0x0A, U 0x80, U 0x2A, U 0x24, U 0x68, U 0xDA, - U 0x20, U 0x58, U 0x13, U 0xD1, + U 0x20, U 0x58, U 0x13, U 0xE4, U 0xD2, U 0xA0, U 0xD1, U 0x0F, U 0xC0, U 0x20, U 0xD1, U 0x0F, U 0x6C, U 0x10, U 0x06, U 0x29, @@ -1851,19 +1851,19 @@ static unsigned char t3fw[30772] = { U 0x72, U 0x63, U 0xFF, U 0x66, U 0x00, U 0xCC, U 0x57, U 0xDA, U 0x20, U 0xDB, U 0x30, U 0xDC, - U 0x40, U 0x58, U 0x13, U 0xD8, + U 0x40, U 0x58, U 0x13, U 0xEB, U 0xC0, U 0x20, U 0xD1, U 0x0F, U 0xDA, U 0x20, U 0x58, U 0x14, - U 0x68, U 0x63, U 0xFF, U 0xE8, + U 0x7B, U 0x63, U 0xFF, U 0xE8, U 0xC0, U 0xA0, U 0x63, U 0xFE, U 0x82, U 0xDA, U 0x20, U 0xC0, - U 0xB6, U 0x58, U 0x14, U 0x64, + U 0xB6, U 0x58, U 0x14, U 0x77, U 0x63, U 0xFF, U 0xD9, U 0x00, U 0xDB, U 0x40, U 0x2A, U 0x2C, - U 0x74, U 0x58, U 0x0C, U 0xDF, + U 0x74, U 0x58, U 0x0C, U 0xF1, U 0xD2, U 0xA0, U 0xD1, U 0x0F, U 0x8A, U 0x10, U 0x2B, U 0x21, - U 0x04, U 0x58, U 0x12, U 0xF7, + U 0x04, U 0x58, U 0x13, U 0x0A, U 0x1E, U 0xEB, U 0x46, U 0xC0, U 0xD0, U 0x2D, U 0x24, U 0x66, U 0x63, U 0xFE, U 0xB1, U 0x00, @@ -1893,14 +1893,14 @@ static unsigned char t3fw[30772] = { U 0x22, U 0xD2, U 0x85, U 0xCF, U 0x25, U 0x60, U 0x00, U 0x0D, U 0x00, U 0xDA, U 0x60, U 0xC0, - U 0xB6, U 0x58, U 0x14, U 0x40, + U 0xB6, U 0x58, U 0x14, U 0x53, U 0xC8, U 0x5A, U 0x60, U 0x01, U 0x0F, U 0x00, U 0xDA, U 0x60, - U 0x58, U 0x14, U 0x3D, U 0x65, + U 0x58, U 0x14, U 0x50, U 0x65, U 0x51, U 0x06, U 0xDC, U 0x40, U 0xDB, U 0x30, U 0x8D, U 0x30, U 0xDA, U 0x60, U 0x0D, U 0x6D, - U 0x51, U 0x58, U 0x12, U 0xB0, + U 0x51, U 0x58, U 0x12, U 0xC3, U 0xD3, U 0xA0, U 0x64, U 0xA0, U 0xF3, U 0x84, U 0xA1, U 0xC0, U 0x51, U 0x04, U 0x04, U 0x47, @@ -1911,7 +1911,7 @@ static unsigned char t3fw[30772] = { U 0x2C, U 0x64, U 0x66, U 0x6F, U 0xC6, U 0x02, U 0x70, U 0x96, U 0x0A, U 0x2B, U 0x61, U 0x04, - U 0x58, U 0x12, U 0xC7, U 0xC0, + U 0x58, U 0x12, U 0xDA, U 0xC0, U 0xB0, U 0x2B, U 0x64, U 0x66, U 0x65, U 0x50, U 0xB4, U 0x2A, U 0x3C, U 0x10, U 0xC0, U 0xE7, @@ -1961,7 +1961,7 @@ static unsigned char t3fw[30772] = { U 0xFF, U 0x60, U 0x00, U 0x00, U 0x2A, U 0x6C, U 0x74, U 0xC0, U 0xB2, U 0xDC, U 0x20, U 0xDD, - U 0x40, U 0x58, U 0x12, U 0xA5, + U 0x40, U 0x58, U 0x12, U 0xB8, U 0xC0, U 0xB0, U 0x63, U 0xFF, U 0x63, U 0xC0, U 0x20, U 0xD1, U 0x0F, U 0x00, U 0x00, U 0x00, @@ -2013,7 +2013,7 @@ static unsigned char t3fw[30772] = { U 0xA6, U 0x9D, U 0x2F, U 0x35, U 0x02, U 0xC0, U 0x20, U 0xD1, U 0x0F, U 0xDA, U 0x30, U 0xC0, - U 0xB6, U 0x58, U 0x13, U 0xC8, + U 0xB6, U 0x58, U 0x13, U 0xDB, U 0xC0, U 0x20, U 0xD1, U 0x0F, U 0x6C, U 0x10, U 0x06, U 0x2A, U 0x20, U 0x06, U 0x94, U 0x10, @@ -2024,7 +2024,7 @@ static unsigned char t3fw[30772] = { U 0x92, U 0x0A, U 0xCC, U 0x5F, U 0xDB, U 0x30, U 0xDA, U 0x20, U 0x8C, U 0x10, U 0x58, U 0x13, - U 0x2C, U 0xC0, U 0x51, U 0xD3, + U 0x3F, U 0xC0, U 0x51, U 0xD3, U 0xA0, U 0xC7, U 0xAF, U 0x9A, U 0x3A, U 0xC0, U 0xD0, U 0x1C, U 0xEA, U 0xA5, U 0x14, U 0xEA, @@ -2154,37 +2154,37 @@ static unsigned char t3fw[30772] = { U 0xC0, U 0x20, U 0xD1, U 0x0F, U 0x00, U 0xCC, U 0x57, U 0xDA, U 0x20, U 0xDB, U 0x30, U 0x8C, - U 0x10, U 0x58, U 0x12, U 0xA9, + U 0x10, U 0x58, U 0x12, U 0xBC, U 0xC0, U 0x20, U 0xD1, U 0x0F, U 0xC0, U 0x91, U 0x63, U 0xFF, U 0x8F, U 0xDA, U 0x20, U 0xC0, - U 0xB6, U 0x58, U 0x13, U 0x37, + U 0xB6, U 0x58, U 0x13, U 0x4A, U 0x63, U 0xFF, U 0xE1, U 0x00, U 0xDA, U 0x20, U 0x58, U 0x13, - U 0x35, U 0x63, U 0xFF, U 0xD8, + U 0x48, U 0x63, U 0xFF, U 0xD8, U 0x2B, U 0x21, U 0x04, U 0x58, - U 0x11, U 0xCC, U 0x1E, U 0xEA, + U 0x11, U 0xDF, U 0x1E, U 0xEA, U 0x1D, U 0x2B, U 0x20, U 0x0C, U 0xC0, U 0xD0, U 0x2D, U 0x24, U 0x66, U 0x8F, U 0x3A, U 0x63, U 0xFE, U 0x4D, U 0xDA, U 0x20, U 0xDB, U 0x30, U 0xDC, U 0x40, U 0xDD, U 0x50, U 0x58, U 0x13, - U 0xBE, U 0xD2, U 0xA0, U 0xD1, + U 0xD1, U 0xD2, U 0xA0, U 0xD1, U 0x0F, U 0x2A, U 0x2C, U 0x74, U 0x8B, U 0x10, U 0x58, U 0x0B, - U 0xA7, U 0xD2, U 0xA0, U 0xD1, + U 0xB9, U 0xD2, U 0xA0, U 0xD1, U 0x0F, U 0x29, U 0x21, U 0x38, U 0xC0, U 0x88, U 0x79, U 0x83, U 0x2E, U 0x8C, U 0x31, U 0x0C, U 0xFC, U 0x50, U 0x64, U 0xCE, U 0x22, U 0x2B, U 0x21, U 0x04, U 0xC0, U 0xC0, U 0x58, U 0x11, - U 0xBB, U 0xC0, U 0xD0, U 0x1E, + U 0xCE, U 0xC0, U 0xD0, U 0x1E, U 0xEA, U 0x0C, U 0x8F, U 0x3A, U 0x2B, U 0x20, U 0x0C, U 0x63, U 0xFE, U 0x0D, U 0xDA, U 0x20, - U 0x58, U 0x13, U 0x1D, U 0x63, + U 0x58, U 0x13, U 0x30, U 0x63, U 0xFF, U 0x7A, U 0xDA, U 0x20, U 0x5B, U 0xFF, U 0x22, U 0xD2, U 0xA0, U 0xD1, U 0x0F, U 0x00, @@ -2192,7 +2192,7 @@ static unsigned char t3fw[30772] = { U 0x21, U 0x04, U 0xB1, U 0xCC, U 0x0C, U 0x0C, U 0x47, U 0x2C, U 0x24, U 0x66, U 0x58, U 0x11, - U 0xAF, U 0x1E, U 0xEA, U 0x00, + U 0xC2, U 0x1E, U 0xEA, U 0x00, U 0x2B, U 0x20, U 0x0C, U 0xC0, U 0xD0, U 0x2D, U 0x24, U 0x66, U 0x8F, U 0x3A, U 0x63, U 0xFD, @@ -2376,7 +2376,7 @@ static unsigned char t3fw[30772] = { U 0xCF, U 0x0B, U 0x4B, U 0x0B, U 0x2B, U 0xC6, U 0x85, U 0xC0, U 0xB0, U 0x8C, U 0x15, U 0x58, - U 0x11, U 0x9C, U 0xD2, U 0xA0, + U 0x11, U 0xAF, U 0xD2, U 0xA0, U 0xD1, U 0x0F, U 0x8A, U 0x35, U 0x6F, U 0xA5, U 0x46, U 0xD8, U 0x30, U 0x8B, U 0xD5, U 0x6D, @@ -2388,7 +2388,7 @@ static unsigned char t3fw[30772] = { U 0x08, U 0x0B, U 0x47, U 0x65, U 0xB1, U 0x0B, U 0xDA, U 0x20, U 0xDB, U 0x30, U 0x2C, U 0x12, - U 0x05, U 0x58, U 0x11, U 0xBF, + U 0x05, U 0x58, U 0x11, U 0xD2, U 0xD3, U 0xA0, U 0xC0, U 0xC1, U 0xC0, U 0xD0, U 0x2D, U 0xA4, U 0x03, U 0x9C, U 0x14, U 0x63, @@ -2401,25 +2401,25 @@ static unsigned char t3fw[30772] = { U 0x88, U 0x14, U 0xCC, U 0x87, U 0xDA, U 0x20, U 0xDB, U 0x30, U 0x8C, U 0x15, U 0x58, U 0x11, - U 0xB3, U 0xC0, U 0x20, U 0xD1, + U 0xC6, U 0xC0, U 0x20, U 0xD1, U 0x0F, U 0xDA, U 0x20, U 0xC0, - U 0xB6, U 0x58, U 0x12, U 0x42, + U 0xB6, U 0x58, U 0x12, U 0x55, U 0x63, U 0xFF, U 0xE4, U 0x00, U 0x00, U 0xDA, U 0x20, U 0x8B, - U 0x10, U 0x58, U 0x12, U 0x3F, + U 0x10, U 0x58, U 0x12, U 0x52, U 0x63, U 0xFF, U 0xD8, U 0x00, U 0x9E, U 0x17, U 0x8A, U 0x12, U 0x2B, U 0x21, U 0x04, U 0x58, - U 0x10, U 0xD5, U 0x8E, U 0x17, + U 0x10, U 0xE8, U 0x8E, U 0x17, U 0xC0, U 0x90, U 0x29, U 0x24, U 0x66, U 0x63, U 0xFE, U 0x34, U 0xC0, U 0x80, U 0x63, U 0xFE, U 0x06, U 0xDA, U 0x20, U 0xDB, U 0x30, U 0x8C, U 0x15, U 0xDD, - U 0x50, U 0x58, U 0x12, U 0xC7, + U 0x50, U 0x58, U 0x12, U 0xDA, U 0xD2, U 0xA0, U 0xD1, U 0x0F, U 0xDA, U 0x20, U 0x58, U 0x12, - U 0x33, U 0x63, U 0xFF, U 0xA7, + U 0x46, U 0x63, U 0xFF, U 0xA7, U 0x00, U 0x2B, U 0x21, U 0x38, U 0xC0, U 0xA8, U 0x7B, U 0xAB, U 0x02, U 0x60, U 0x01, U 0x04, @@ -2427,7 +2427,7 @@ static unsigned char t3fw[30772] = { U 0x50, U 0x64, U 0xCE, U 0x04, U 0x8A, U 0x12, U 0x2B, U 0x21, U 0x04, U 0xC0, U 0xC0, U 0x98, - U 0x17, U 0x58, U 0x10, U 0xC3, + U 0x17, U 0x58, U 0x10, U 0xD6, U 0x8E, U 0x17, U 0x63, U 0xFD, U 0xF3, U 0x2D, U 0x21, U 0x38, U 0x2D, U 0xDC, U 0xFF, U 0x0D, @@ -2458,7 +2458,7 @@ static unsigned char t3fw[30772] = { U 0x8D, U 0x14, U 0x2E, U 0x0A, U 0x80, U 0xC0, U 0x8E, U 0x28, U 0x24, U 0x68, U 0x58, U 0x11, - U 0x05, U 0xD2, U 0xA0, U 0xD1, + U 0x18, U 0xD2, U 0xA0, U 0xD1, U 0x0F, U 0x2E, U 0x7C, U 0x48, U 0x19, U 0xE8, U 0xF5, U 0x2A, U 0x32, U 0x16, U 0x2B, U 0x76, @@ -2483,7 +2483,7 @@ static unsigned char t3fw[30772] = { U 0x0C, U 0x47, U 0x2C, U 0x24, U 0x66, U 0xC9, U 0xC0, U 0x9E, U 0x17, U 0x8A, U 0x12, U 0x58, - U 0x10, U 0x8C, U 0x8E, U 0x17, + U 0x10, U 0x9F, U 0x8E, U 0x17, U 0xC0, U 0x34, U 0x8F, U 0x20, U 0xC0, U 0xD0, U 0x2D, U 0x24, U 0x66, U 0xC0, U 0x68, U 0x26, @@ -2493,7 +2493,7 @@ static unsigned char t3fw[30772] = { U 0x66, U 0x98, U 0x17, U 0xB1, U 0xCC, U 0x0C, U 0x0C, U 0x47, U 0x2C, U 0x24, U 0x66, U 0x58, - U 0x10, U 0x82, U 0x8E, U 0x17, + U 0x10, U 0x95, U 0x8E, U 0x17, U 0x87, U 0x16, U 0xC0, U 0xD0, U 0x2D, U 0x24, U 0x66, U 0x63, U 0xFC, U 0xE6, U 0x8D, U 0x35, @@ -2578,13 +2578,13 @@ static unsigned char t3fw[30772] = { U 0xCD, U 0x2D, U 0x25, U 0x23, U 0xC8, U 0x55, U 0xDA, U 0x20, U 0xDB, U 0x30, U 0x58, U 0x10, - U 0x7B, U 0x29, U 0x21, U 0x02, + U 0x8E, U 0x29, U 0x21, U 0x02, U 0xCC, U 0x96, U 0xC0, U 0xE8, U 0x0E, U 0x9E, U 0x02, U 0x2E, U 0x25, U 0x02, U 0xCC, U 0x57, U 0xDA, U 0x20, U 0xDB, U 0x30, - U 0xDC, U 0x40, U 0x58, U 0x10, - U 0xFC, U 0xC0, U 0x20, U 0xD1, + U 0xDC, U 0x40, U 0x58, U 0x11, + U 0x0F, U 0xC0, U 0x20, U 0xD1, U 0x0F, U 0x2C, U 0x20, U 0x66, U 0x89, U 0x31, U 0xB1, U 0xCC, U 0x0C, U 0x0C, U 0x47, U 0x2C, @@ -2694,28 +2694,28 @@ static unsigned char t3fw[30772] = { U 0x20, U 0xD1, U 0x0F, U 0x00, U 0xC0, U 0x9A, U 0x63, U 0xFF, U 0xC6, U 0xDA, U 0x20, U 0x58, - U 0x11, U 0x20, U 0x63, U 0xFE, + U 0x11, U 0x33, U 0x63, U 0xFE, U 0x38, U 0xDA, U 0x20, U 0xC0, - U 0xB6, U 0x58, U 0x11, U 0x1D, + U 0xB6, U 0x58, U 0x11, U 0x30, U 0x63, U 0xFE, U 0x2E, U 0x00, U 0x68, U 0x97, U 0x3C, U 0x2B, U 0x9C, U 0xFD, U 0x64, U 0xBE, U 0x24, U 0xC0, U 0x20, U 0xD1, U 0x0F, U 0xDA, U 0x20, U 0xDB, - U 0x70, U 0x58, U 0x10, U 0xD9, + U 0x70, U 0x58, U 0x10, U 0xEC, U 0xC0, U 0xC0, U 0xC0, U 0xD1, U 0x0A, U 0xDA, U 0x39, U 0x0A, U 0xDC, U 0x38, U 0x65, U 0xCD, U 0xE0, U 0x63, U 0xFE, U 0x09, U 0x8A, U 0x10, U 0x2B, U 0x21, - U 0x04, U 0x58, U 0x0F, U 0xAA, + U 0x04, U 0x58, U 0x0F, U 0xBD, U 0xC0, U 0xB0, U 0x2B, U 0x24, U 0x66, U 0x63, U 0xFE, U 0x21, U 0xDB, U 0x40, U 0x2A, U 0x2C, - U 0x74, U 0x58, U 0x09, U 0x8B, + U 0x74, U 0x58, U 0x09, U 0x9D, U 0xD2, U 0xA0, U 0xD1, U 0x0F, U 0xDA, U 0x20, U 0x58, U 0x0F, - U 0xAF, U 0x63, U 0xFC, U 0xF7, + U 0xC2, U 0x63, U 0xFC, U 0xF7, U 0x6C, U 0x10, U 0x04, U 0xC0, U 0x20, U 0xD1, U 0x0F, U 0x00, U 0x6C, U 0x10, U 0x04, U 0x29, @@ -2744,7 +2744,7 @@ static unsigned char t3fw[30772] = { U 0x9B, U 0x68, U 0x98, U 0x0B, U 0x2A, U 0x9C, U 0xF9, U 0x65, U 0xA1, U 0xB2, U 0x02, U 0x2A, - U 0x02, U 0x58, U 0x0F, U 0x91, + U 0x02, U 0x58, U 0x0F, U 0xA4, U 0x89, U 0x37, U 0x1B, U 0xE7, U 0xD7, U 0xC8, U 0x91, U 0x64, U 0x52, U 0x0E, U 0x2A, U 0x21, @@ -2787,7 +2787,7 @@ static unsigned char t3fw[30772] = { U 0x55, U 0x60, U 0x00, U 0x1E, U 0x2A, U 0x20, U 0x0C, U 0xC1, U 0xB2, U 0x8C, U 0x20, U 0x58, - U 0x11, U 0x03, U 0x9A, U 0x18, + U 0x11, U 0x16, U 0x9A, U 0x18, U 0x64, U 0xA2, U 0x45, U 0x8D, U 0x67, U 0x63, U 0xFF, U 0xCF, U 0xC0, U 0xC0, U 0x63, U 0xFF, @@ -2802,7 +2802,7 @@ static unsigned char t3fw[30772] = { U 0x01, U 0x99, U 0xD7, U 0xA0, U 0xDA, U 0x20, U 0xDB, U 0x70, U 0xC1, U 0xC8, U 0x2D, U 0x21, - U 0x20, U 0x58, U 0x10, U 0x9D, + U 0x20, U 0x58, U 0x10, U 0xB0, U 0x8C, U 0x26, U 0x8B, U 0x27, U 0x9A, U 0x16, U 0x0C, U 0xBB, U 0x0C, U 0x7A, U 0xB3, U 0x34, @@ -2820,7 +2820,7 @@ static unsigned char t3fw[30772] = { U 0x02, U 0x60, U 0x00, U 0x97, U 0xCF, U 0x58, U 0x60, U 0x00, U 0x1F, U 0xDA, U 0x20, U 0x8B, - U 0x16, U 0x58, U 0x10, U 0x63, + U 0x16, U 0x58, U 0x10, U 0x76, U 0x65, U 0xA1, U 0x38, U 0x63, U 0xFF, U 0xBD, U 0xC0, U 0x81, U 0xC0, U 0x90, U 0x8F, U 0x18, @@ -2829,7 +2829,7 @@ static unsigned char t3fw[30772] = { U 0x97, U 0xF5, U 0x63, U 0xFF, U 0xD2, U 0xDB, U 0x30, U 0xDA, U 0x20, U 0xDC, U 0x40, U 0x58, - U 0x10, U 0x07, U 0xC0, U 0x51, + U 0x10, U 0x1A, U 0xC0, U 0x51, U 0xD6, U 0xA0, U 0xC0, U 0xC0, U 0x2B, U 0xA0, U 0x10, U 0x2C, U 0xA4, U 0x03, U 0x9B, U 0x17, @@ -2854,7 +2854,7 @@ static unsigned char t3fw[30772] = { U 0x26, U 0x18, U 0x63, U 0xFE, U 0x96, U 0xDA, U 0x20, U 0xDB, U 0x30, U 0xDC, U 0x40, U 0xDD, - U 0x50, U 0x58, U 0x11, U 0x11, + U 0x50, U 0x58, U 0x11, U 0x24, U 0xD2, U 0xA0, U 0xD1, U 0x0F, U 0xC0, U 0x30, U 0x2C, U 0x20, U 0x66, U 0x89, U 0x61, U 0xB1, @@ -2877,7 +2877,7 @@ static unsigned char t3fw[30772] = { U 0x16, U 0xDC, U 0x40, U 0x2F, U 0x22, U 0x13, U 0xDD, U 0x50, U 0xB1, U 0xFF, U 0x2F, U 0x26, - U 0x13, U 0x58, U 0x0F, U 0xA6, + U 0x13, U 0x58, U 0x0F, U 0xB9, U 0xD2, U 0xA0, U 0xD1, U 0x0F, U 0x00, U 0x28, U 0x20, U 0x3D, U 0x08, U 0x48, U 0x40, U 0x65, @@ -2902,28 +2902,28 @@ static unsigned char t3fw[30772] = { U 0xD1, U 0x00, U 0x00, U 0x00, U 0x65, U 0x50, U 0x81, U 0xDA, U 0x20, U 0xDB, U 0x60, U 0xDC, - U 0x40, U 0x58, U 0x0F, U 0xBD, + U 0x40, U 0x58, U 0x0F, U 0xD0, U 0xC0, U 0x20, U 0xC0, U 0xF0, U 0x2F, U 0xA4, U 0x03, U 0xD1, U 0x0F, U 0xDA, U 0x20, U 0xC0, - U 0xB6, U 0x58, U 0x10, U 0x4B, + U 0xB6, U 0x58, U 0x10, U 0x5E, U 0x63, U 0xFF, U 0xE0, U 0x00, U 0x00, U 0x6F, U 0x95, U 0x02, U 0x63, U 0xFD, U 0x6C, U 0xDA, U 0x20, U 0xDB, U 0x30, U 0xDC, U 0x40, U 0xDD, U 0x50, U 0xC4, - U 0xE0, U 0x58, U 0x0F, U 0x3E, + U 0xE0, U 0x58, U 0x0F, U 0x51, U 0xD2, U 0xA0, U 0xD1, U 0x0F, U 0x8A, U 0x15, U 0x2B, U 0x21, - U 0x04, U 0x58, U 0x0E, U 0xDB, + U 0x04, U 0x58, U 0x0E, U 0xEE, U 0x23, U 0x24, U 0x66, U 0x28, U 0x60, U 0x10, U 0x98, U 0x17, U 0x63, U 0xFF, U 0x21, U 0x00, U 0xDA, U 0x20, U 0x58, U 0x10, - U 0x3E, U 0x63, U 0xFF, U 0xAB, + U 0x51, U 0x63, U 0xFF, U 0xAB, U 0xC8, U 0x58, U 0xDB, U 0x30, U 0xDA, U 0x20, U 0x58, U 0x0F, - U 0x22, U 0x2A, U 0x21, U 0x02, + U 0x35, U 0x2A, U 0x21, U 0x02, U 0x65, U 0xAF, U 0x9C, U 0xC0, U 0x94, U 0x09, U 0xA9, U 0x02, U 0x29, U 0x25, U 0x02, U 0x63, @@ -2932,11 +2932,11 @@ static unsigned char t3fw[30772] = { U 0xC0, U 0xA3, U 0x2E, U 0x0A, U 0x80, U 0x2A, U 0x24, U 0x68, U 0xDA, U 0x20, U 0x58, U 0x0F, - U 0x2B, U 0xD2, U 0xA0, U 0xD1, + U 0x3E, U 0xD2, U 0xA0, U 0xD1, U 0x0F, U 0xC0, U 0x20, U 0xD1, U 0x0F, U 0xDA, U 0x20, U 0x2B, U 0x20, U 0x0C, U 0x58, U 0x10, - U 0x53, U 0x63, U 0xFF, U 0x6B, + U 0x66, U 0x63, U 0xFF, U 0x6B, U 0x6C, U 0x10, U 0x04, U 0x28, U 0x20, U 0x06, U 0xC0, U 0x62, U 0x28, U 0x8C, U 0xF8, U 0x65, @@ -3007,7 +3007,7 @@ static unsigned char t3fw[30772] = { U 0xAF, U 0xE7, U 0x63, U 0xFF, U 0xA6, U 0x2A, U 0x2C, U 0x74, U 0xC0, U 0xB0, U 0x2C, U 0x0A, - U 0x02, U 0x58, U 0x0E, U 0x15, + U 0x02, U 0x58, U 0x0E, U 0x28, U 0x1C, U 0xE6, U 0xFB, U 0x9C, U 0xA0, U 0x8B, U 0x20, U 0x08, U 0xBB, U 0x11, U 0x06, U 0xBB, @@ -3017,10 +3017,10 @@ static unsigned char t3fw[30772] = { U 0x26, U 0x24, U 0x68, U 0xDA, U 0x20, U 0xDB, U 0x30, U 0xDC, U 0x40, U 0xDD, U 0x50, U 0x58, - U 0x10, U 0x6F, U 0xD2, U 0xA0, + U 0x10, U 0x82, U 0xD2, U 0xA0, U 0xD1, U 0x0F, U 0xDA, U 0x20, U 0x2B, U 0x20, U 0x0C, U 0x58, - U 0x0F, U 0xDA, U 0xC0, U 0x20, + U 0x0F, U 0xED, U 0xC0, U 0x20, U 0xD1, U 0x0F, U 0x00, U 0x00, U 0x6C, U 0x10, U 0x06, U 0x07, U 0x3D, U 0x14, U 0xC0, U 0x80, @@ -3239,7 +3239,7 @@ static unsigned char t3fw[30772] = { U 0x21, U 0x23, U 0x65, U 0xD4, U 0xA0, U 0xC0, U 0xA6, U 0x2B, U 0x0A, U 0x03, U 0x2C, U 0x22, - U 0x00, U 0x58, U 0x0F, U 0x17, + U 0x00, U 0x58, U 0x0F, U 0x2A, U 0x64, U 0xA3, U 0xB9, U 0x17, U 0xE5, U 0xE6, U 0x8E, U 0x38, U 0x9A, U 0x16, U 0x64, U 0xE3, @@ -3248,11 +3248,11 @@ static unsigned char t3fw[30772] = { U 0xF3, U 0x7E, U 0x83, U 0x11, U 0xC2, U 0xB0, U 0x8C, U 0x20, U 0x2A, U 0x20, U 0x0C, U 0x58, - U 0x0F, U 0x36, U 0xD7, U 0xA0, + U 0x0F, U 0x49, U 0xD7, U 0xA0, U 0xCD, U 0xA1, U 0x60, U 0x04, U 0xA2, U 0x00, U 0xC2, U 0xB0, U 0x8C, U 0x20, U 0x2A, U 0x20, - U 0x0C, U 0x58, U 0x0F, U 0x0A, + U 0x0C, U 0x58, U 0x0F, U 0x1D, U 0xD7, U 0xA0, U 0x64, U 0xA4, U 0x86, U 0x2F, U 0x21, U 0x2E, U 0x8B, U 0x68, U 0x0F, U 0xBF, @@ -3264,7 +3264,7 @@ static unsigned char t3fw[30772] = { U 0x4C, U 0xDA, U 0x20, U 0xDB, U 0x50, U 0xC1, U 0xC4, U 0x2D, U 0x21, U 0x1F, U 0x58, U 0x0E, - U 0xD0, U 0x8B, U 0x26, U 0x9A, + U 0xE3, U 0x8B, U 0x26, U 0x9A, U 0x18, U 0x9A, U 0x19, U 0x89, U 0x27, U 0x2A, U 0xAC, U 0x38, U 0x0B, U 0x99, U 0x0C, U 0x7A, @@ -3291,11 +3291,11 @@ static unsigned char t3fw[30772] = { U 0x93, U 0xC0, U 0xE0, U 0x63, U 0xFF, U 0xE2, U 0xDA, U 0x20, U 0x8B, U 0x18, U 0x58, U 0x0E, - U 0x8D, U 0x65, U 0xA2, U 0xB1, + U 0xA0, U 0x65, U 0xA2, U 0xB1, U 0x63, U 0xFF, U 0x9E, U 0x00, U 0x00, U 0xDA, U 0x20, U 0xDB, U 0x30, U 0x8C, U 0x15, U 0x58, - U 0x0E, U 0x35, U 0xD6, U 0xA0, + U 0x0E, U 0x48, U 0xD6, U 0xA0, U 0xC0, U 0xC0, U 0xC0, U 0xD1, U 0x2D, U 0x16, U 0x04, U 0x2C, U 0xA4, U 0x03, U 0xDC, U 0x70, @@ -3346,12 +3346,12 @@ static unsigned char t3fw[30772] = { U 0x64, U 0x41, U 0x81, U 0xC0, U 0x44, U 0x2B, U 0x0A, U 0x00, U 0x8C, U 0x20, U 0x2A, U 0x20, - U 0x0C, U 0x58, U 0x0E, U 0xAC, + U 0x0C, U 0x58, U 0x0E, U 0xBF, U 0x0A, U 0xA7, U 0x02, U 0x65, U 0xA0, U 0x0F, U 0xC0, U 0xB0, U 0x2C, U 0x22, U 0x00, U 0x2A, U 0x20, U 0x0C, U 0x58, U 0x0E, - U 0xA8, U 0xD7, U 0xA0, U 0x64, + U 0xBB, U 0xD7, U 0xA0, U 0x64, U 0xAF, U 0xEF, U 0xDA, U 0x20, U 0xC1, U 0xBC, U 0xC1, U 0xC8, U 0x2D, U 0x21, U 0x20, U 0x8F, @@ -3360,7 +3360,7 @@ static unsigned char t3fw[30772] = { U 0x26, U 0x0E, U 0x99, U 0x0C, U 0x09, U 0x09, U 0x48, U 0x29, U 0x25, U 0x25, U 0x58, U 0x0E, - U 0x70, U 0xC0, U 0x90, U 0xC0, + U 0x83, U 0xC0, U 0x90, U 0xC0, U 0x50, U 0xC0, U 0xC2, U 0x88, U 0x60, U 0x9A, U 0x19, U 0x1E, U 0xE5, U 0x6E, U 0xC0, U 0xA1, @@ -3442,7 +3442,7 @@ static unsigned char t3fw[30772] = { U 0xFD, U 0x0B, U 0x2D, U 0xE6, U 0x85, U 0xDA, U 0x20, U 0x8B, U 0x19, U 0x8C, U 0x15, U 0x8D, - U 0x14, U 0x58, U 0x0D, U 0x71, + U 0x14, U 0x58, U 0x0D, U 0x84, U 0xD2, U 0xA0, U 0xD1, U 0x0F, U 0xDC, U 0x70, U 0xDF, U 0x50, U 0xDB, U 0x60, U 0x2D, U 0x6C, @@ -3467,20 +3467,20 @@ static unsigned char t3fw[30772] = { U 0xFF, U 0xE8, U 0x88, U 0x14, U 0x65, U 0x81, U 0x68, U 0xDA, U 0x20, U 0xDB, U 0x60, U 0x8C, - U 0x15, U 0x58, U 0x0D, U 0x88, + U 0x15, U 0x58, U 0x0D, U 0x9B, U 0xC0, U 0x20, U 0xC0, U 0x90, U 0x29, U 0xA4, U 0x03, U 0xD1, U 0x0F, U 0x8A, U 0x16, U 0x2B, U 0x21, U 0x04, U 0x58, U 0x0C, - U 0xAF, U 0xC0, U 0xA0, U 0x2A, + U 0xC2, U 0xC0, U 0xA0, U 0x2A, U 0x24, U 0x66, U 0x8E, U 0x68, U 0x63, U 0xFD, U 0xCA, U 0x00, U 0x00, U 0x2B, U 0x9C, U 0xF9, U 0x65, U 0xB0, U 0xFD, U 0xDA, - U 0x20, U 0x58, U 0x0C, U 0xB4, + U 0x20, U 0x58, U 0x0C, U 0xC7, U 0x63, U 0xFC, U 0x22, U 0x00, U 0x00, U 0xDA, U 0x20, U 0xC0, - U 0xB6, U 0x58, U 0x0E, U 0x0D, + U 0xB6, U 0x58, U 0x0E, U 0x20, U 0x63, U 0xFF, U 0xBA, U 0x00, U 0x2B, U 0x20, U 0x0C, U 0x0C, U 0xBE, U 0x11, U 0xA7, U 0xEE, @@ -3500,7 +3500,7 @@ static unsigned char t3fw[30772] = { U 0xC6, U 0x02, U 0x70, U 0x96, U 0x0C, U 0x8A, U 0x16, U 0x2B, U 0x21, U 0x04, U 0x58, U 0x0C, - U 0x93, U 0xC0, U 0xD0, U 0x2D, + U 0xA6, U 0xC0, U 0xD0, U 0x2D, U 0x24, U 0x66, U 0x8E, U 0x30, U 0x77, U 0xE7, U 0x4D, U 0x1C, U 0xE4, U 0xF1, U 0x1B, U 0xE4, @@ -3528,7 +3528,7 @@ static unsigned char t3fw[30772] = { U 0x8B, U 0x14, U 0x2C, U 0x25, U 0x23, U 0xC8, U 0xB7, U 0x02, U 0x2A, U 0x02, U 0x06, U 0x6B, - U 0x02, U 0x58, U 0x0C, U 0xC4, + U 0x02, U 0x58, U 0x0C, U 0xD7, U 0x2A, U 0x21, U 0x02, U 0x65, U 0xAE, U 0xF7, U 0xC0, U 0xD8, U 0x0D, U 0xAD, U 0x02, U 0x2D, @@ -3536,38 +3536,38 @@ static unsigned char t3fw[30772] = { U 0xEC, U 0x00, U 0x8E, U 0x14, U 0xC8, U 0xE8, U 0xDA, U 0x20, U 0xDB, U 0x30, U 0x58, U 0x0C, - U 0xBD, U 0x2A, U 0x21, U 0x02, + U 0xD0, U 0x2A, U 0x21, U 0x02, U 0x65, U 0xAE, U 0xDA, U 0x07, U 0xAF, U 0x02, U 0x2F, U 0x25, U 0x02, U 0x63, U 0xFE, U 0xD1, U 0x00, U 0xDA, U 0x20, U 0xDB, U 0x30, U 0x8C, U 0x15, U 0x8D, - U 0x14, U 0x58, U 0x0E, U 0x61, + U 0x14, U 0x58, U 0x0E, U 0x74, U 0xD2, U 0xA0, U 0xD1, U 0x0F, U 0xDA, U 0x20, U 0x2B, U 0x20, - U 0x0C, U 0x58, U 0x0D, U 0xCC, + U 0x0C, U 0x58, U 0x0D, U 0xDF, U 0x63, U 0xFE, U 0xB6, U 0x00, U 0xDA, U 0x20, U 0x2B, U 0x20, - U 0x0C, U 0x58, U 0x0D, U 0xEE, + U 0x0C, U 0x58, U 0x0E, U 0x01, U 0x63, U 0xFE, U 0xAA, U 0xDA, U 0x20, U 0xDB, U 0x30, U 0x8C, U 0x15, U 0x2D, U 0x12, U 0x04, U 0x2E, U 0x0A, U 0x80, U 0x28, U 0x0A, U 0x00, U 0x28, U 0x24, - U 0x68, U 0x58, U 0x0C, U 0xBC, + U 0x68, U 0x58, U 0x0C, U 0xCF, U 0x63, U 0xFA, U 0xE5, U 0x00, U 0xC0, U 0x20, U 0xD1, U 0x0F, U 0xDA, U 0x20, U 0x58, U 0x0D, - U 0xC0, U 0x89, U 0x14, U 0xCD, + U 0xD3, U 0x89, U 0x14, U 0xCD, U 0x92, U 0xDA, U 0x20, U 0xDB, U 0x30, U 0x8C, U 0x15, U 0x58, - U 0x0D, U 0x2B, U 0xDB, U 0xA0, + U 0x0D, U 0x3E, U 0xDB, U 0xA0, U 0xC0, U 0x20, U 0xC0, U 0xA0, U 0x2A, U 0xB4, U 0x03, U 0xD1, U 0x0F, U 0xC0, U 0x20, U 0xD1, U 0x0F, U 0x2A, U 0x2C, U 0x74, U 0x8B, U 0x15, U 0x58, U 0x06, - U 0x35, U 0xD2, U 0xA0, U 0xD1, + U 0x47, U 0xD2, U 0xA0, U 0xD1, U 0x0F, U 0x00, U 0x00, U 0x00, U 0x6C, U 0x10, U 0x0E, U 0x28, U 0x21, U 0x02, U 0x24, U 0x16, @@ -3804,15 +3804,15 @@ static unsigned char t3fw[30772] = { U 0xC0, U 0x90, U 0x63, U 0xFF, U 0x5E, U 0xCC, U 0x57, U 0xDA, U 0x20, U 0xDB, U 0x30, U 0x8C, - U 0x11, U 0x58, U 0x0C, U 0x37, + U 0x11, U 0x58, U 0x0C, U 0x4A, U 0xC0, U 0x20, U 0xD1, U 0x0F, U 0x00, U 0xDA, U 0x20, U 0xC0, - U 0xB6, U 0x58, U 0x0C, U 0xC6, + U 0xB6, U 0x58, U 0x0C, U 0xD9, U 0x63, U 0xFF, U 0xE5, U 0x00, U 0xDA, U 0x20, U 0x58, U 0x0C, - U 0xC4, U 0x63, U 0xFF, U 0xDC, + U 0xD7, U 0x63, U 0xFF, U 0xDC, U 0x2A, U 0x2C, U 0x74, U 0x8B, - U 0x11, U 0x58, U 0x05, U 0x3F, + U 0x11, U 0x58, U 0x05, U 0x51, U 0xD2, U 0xA0, U 0xD1, U 0x0F, U 0x6C, U 0x10, U 0x06, U 0x28, U 0x20, U 0x06, U 0x8A, U 0x33, @@ -3946,7 +3946,7 @@ static unsigned char t3fw[30772] = { U 0x2D, U 0x20, U 0x6A, U 0x0D, U 0x2D, U 0x41, U 0x65, U 0xDF, U 0x7E, U 0xDA, U 0x20, U 0xC0, - U 0xB0, U 0x58, U 0x0C, U 0x8E, + U 0xB0, U 0x58, U 0x0C, U 0xA1, U 0x64, U 0xAF, U 0x18, U 0xC0, U 0xF1, U 0x63, U 0xFE, U 0xEF, U 0x9F, U 0x27, U 0x63, U 0xFF, @@ -4041,7 +4041,7 @@ static unsigned char t3fw[30772] = { U 0xEE, U 0x12, U 0xDA, U 0x70, U 0xC0, U 0xB3, U 0x2C, U 0x3C, U 0x18, U 0xDD, U 0x50, U 0x58, - U 0x0A, U 0x86, U 0x89, U 0x40, + U 0x0A, U 0x99, U 0x89, U 0x40, U 0xC0, U 0x80, U 0x63, U 0xFE, U 0xE3, U 0x06, U 0x6E, U 0x02, U 0x02, U 0x2A, U 0x02, U 0xDB, @@ -4049,7 +4049,7 @@ static unsigned char t3fw[30772] = { U 0x50, U 0x58, U 0x00, U 0x04, U 0x9A, U 0x10, U 0xDB, U 0x50, U 0xDA, U 0x70, U 0x58, U 0x04, - U 0x53, U 0x88, U 0x10, U 0x63, + U 0x65, U 0x88, U 0x10, U 0x63, U 0xFE, U 0xF7, U 0x00, U 0x00, U 0x6C, U 0x10, U 0x06, U 0x92, U 0x12, U 0x1E, U 0xE2, U 0xC6, @@ -4149,7 +4149,7 @@ static unsigned char t3fw[30772] = { U 0x14, U 0x7B, U 0xA3, U 0x17, U 0x9D, U 0x13, U 0x2A, U 0x20, U 0x0C, U 0x8B, U 0x10, U 0x8C, - U 0x20, U 0x58, U 0x0B, U 0xB0, + U 0x20, U 0x58, U 0x0B, U 0xC3, U 0x8C, U 0x14, U 0x8D, U 0x13, *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Tue Dec 1 23:01:30 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 01BCD1065670; Tue, 1 Dec 2009 23:01:30 +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 E53588FC08; Tue, 1 Dec 2009 23:01:29 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nB1N1TP3079291; Tue, 1 Dec 2009 23:01:29 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nB1N1TgN079287; Tue, 1 Dec 2009 23:01:29 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <200912012301.nB1N1TgN079287@svn.freebsd.org> From: Alexander Motin Date: Tue, 1 Dec 2009 23:01:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200008 - in head/sys: cam/ata sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Dec 2009 23:01:30 -0000 Author: mav Date: Tue Dec 1 23:01:29 2009 New Revision: 200008 URL: http://svn.freebsd.org/changeset/base/200008 Log: Add CAM_ATAIO_DMA ATA command flag to mark DMA protocol commands. It is not needed for SATA controllers, but required for PATA. Modified: head/sys/cam/ata/ata_all.c head/sys/cam/ata/ata_all.h head/sys/sys/ata.h Modified: head/sys/cam/ata/ata_all.c ============================================================================== --- head/sys/cam/ata/ata_all.c Tue Dec 1 22:59:37 2009 (r200007) +++ head/sys/cam/ata/ata_all.c Tue Dec 1 23:01:29 2009 (r200008) @@ -93,8 +93,8 @@ ata_op_string(struct ata_cmd *cmd) case 0x39: return ("WRITE_MUL48"); case 0x3a: return ("WRITE_STREAM_DMA48"); case 0x3b: return ("WRITE_STREAM48"); - case 0x3d: return ("WRITE_DMA_FUA"); - case 0x3e: return ("WRITE_DMA_FUA48"); + case 0x3d: return ("WRITE_DMA_FUA48"); + case 0x3e: return ("WRITE_DMA_QUEUED_FUA48"); case 0x3f: return ("WRITE_LOG_EXT"); case 0x40: return ("READ_VERIFY"); case 0x42: return ("READ_VERIFY48"); @@ -119,7 +119,7 @@ ata_op_string(struct ata_cmd *cmd) case 0xca: return ("WRITE_DMA"); case 0xcc: return ("WRITE_DMA_QUEUED"); case 0xcd: return ("CFA_WRITE_MULTIPLE_WITHOUT_ERASE"); - case 0xce: return ("WRITE_MULTIPLE_FUA48"); + case 0xce: return ("WRITE_MUL_FUA48"); case 0xd1: return ("CHECK_MEDIA_CARD_TYPE"); case 0xda: return ("GET_MEDIA_STATUS"); case 0xde: return ("MEDIA_LOCK"); @@ -309,6 +309,11 @@ ata_28bit_cmd(struct ccb_ataio *ataio, u { bzero(&ataio->cmd, sizeof(ataio->cmd)); ataio->cmd.flags = 0; + if (cmd == ATA_READ_DMA || + cmd == ATA_READ_DMA_QUEUED || + cmd == ATA_WRITE_DMA || + cmd == ATA_WRITE_DMA_QUEUED) + ataio->cmd.flags |= CAM_ATAIO_DMA; ataio->cmd.command = cmd; ataio->cmd.features = features; ataio->cmd.lba_low = lba; @@ -324,6 +329,15 @@ ata_48bit_cmd(struct ccb_ataio *ataio, u { bzero(&ataio->cmd, sizeof(ataio->cmd)); ataio->cmd.flags = CAM_ATAIO_48BIT; + if (cmd == ATA_READ_DMA48 || + cmd == ATA_READ_DMA_QUEUED48 || + cmd == ATA_READ_STREAM_DMA48 || + cmd == ATA_WRITE_DMA48 || + cmd == ATA_WRITE_DMA_FUA48 || + cmd == ATA_WRITE_DMA_QUEUED48 || + cmd == ATA_WRITE_DMA_QUEUED_FUA48 || + cmd == ATA_WRITE_STREAM_DMA48) + ataio->cmd.flags |= CAM_ATAIO_DMA; ataio->cmd.command = cmd; ataio->cmd.features = features; ataio->cmd.lba_low = lba; Modified: head/sys/cam/ata/ata_all.h ============================================================================== --- head/sys/cam/ata/ata_all.h Tue Dec 1 22:59:37 2009 (r200007) +++ head/sys/cam/ata/ata_all.h Tue Dec 1 23:01:29 2009 (r200008) @@ -41,6 +41,7 @@ struct ata_cmd { #define CAM_ATAIO_FPDMA 0x02 /* FPDMA command */ #define CAM_ATAIO_CONTROL 0x04 /* Control, not a command */ #define CAM_ATAIO_NEEDRESULT 0x08 /* Request requires result. */ +#define CAM_ATAIO_DMA 0x10 /* DMA command */ u_int8_t command; u_int8_t features; Modified: head/sys/sys/ata.h ============================================================================== --- head/sys/sys/ata.h Tue Dec 1 22:59:37 2009 (r200007) +++ head/sys/sys/ata.h Tue Dec 1 23:01:29 2009 (r200008) @@ -291,12 +291,21 @@ struct ata_params { #define ATA_READ_DMA_QUEUED48 0x26 /* read DMA QUEUED 48bit LBA */ #define ATA_READ_NATIVE_MAX_ADDRESS48 0x27 /* read native max addr 48bit */ #define ATA_READ_MUL48 0x29 /* read multi 48bit LBA */ +#define ATA_READ_STREAM_DMA48 0x2a /* read DMA stream 48bit LBA */ +#define ATA_READ_STREAM48 0x2b /* read stream 48bit LBA */ #define ATA_WRITE 0x30 /* write */ #define ATA_WRITE48 0x34 /* write 48bit LBA */ #define ATA_WRITE_DMA48 0x35 /* write DMA 48bit LBA */ #define ATA_WRITE_DMA_QUEUED48 0x36 /* write DMA QUEUED 48bit LBA*/ #define ATA_SET_MAX_ADDRESS48 0x37 /* set max address 48bit */ #define ATA_WRITE_MUL48 0x39 /* write multi 48bit LBA */ +#define ATA_WRITE_STREAM_DMA48 0x3a +#define ATA_WRITE_STREAM48 0x3b +#define ATA_WRITE_DMA_FUA48 0x3d +#define ATA_WRITE_DMA_QUEUED_FUA48 0x3e +#define ATA_WRITE_LOG_EXT 0x3f +#define ATA_READ_VERIFY 0x40 +#define ATA_READ_VERIFY48 0x42 #define ATA_READ_FPDMA_QUEUED 0x60 /* read DMA NCQ */ #define ATA_WRITE_FPDMA_QUEUED 0x61 /* write DMA NCQ */ #define ATA_SEEK 0x70 /* seek */ @@ -312,6 +321,7 @@ struct ata_params { #define ATA_READ_DMA 0xc8 /* read DMA */ #define ATA_WRITE_DMA 0xca /* write DMA */ #define ATA_WRITE_DMA_QUEUED 0xcc /* write DMA QUEUED */ +#define ATA_WRITE_MUL_FUA48 0xce #define ATA_STANDBY_IMMEDIATE 0xe0 /* standby immediate */ #define ATA_IDLE_IMMEDIATE 0xe1 /* idle immediate */ #define ATA_STANDBY_CMD 0xe2 /* standby */ From owner-svn-src-head@FreeBSD.ORG Wed Dec 2 00:37:03 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 600FB1065676; Wed, 2 Dec 2009 00:37:03 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4FAB78FC0C; Wed, 2 Dec 2009 00:37:03 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nB20b3xK081614; Wed, 2 Dec 2009 00:37:03 GMT (envelope-from thompsa@svn.freebsd.org) Received: (from thompsa@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nB20b3WB081612; Wed, 2 Dec 2009 00:37:03 GMT (envelope-from thompsa@svn.freebsd.org) Message-Id: <200912020037.nB20b3WB081612@svn.freebsd.org> From: Andrew Thompson Date: Wed, 2 Dec 2009 00:37:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200014 - head/sys/arm/conf X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Dec 2009 00:37:03 -0000 Author: thompsa Date: Wed Dec 2 00:37:03 2009 New Revision: 200014 URL: http://svn.freebsd.org/changeset/base/200014 Log: Remove unknown ath hal device entries. Modified: head/sys/arm/conf/CAMBRIA Modified: head/sys/arm/conf/CAMBRIA ============================================================================== --- head/sys/arm/conf/CAMBRIA Tue Dec 1 23:24:42 2009 (r200013) +++ head/sys/arm/conf/CAMBRIA Wed Dec 2 00:37:03 2009 (r200014) @@ -135,11 +135,8 @@ device ath_rf5413 # #device ath_ar5416 #options AH_SUPPORT_AR5416 # NB: for 11n descriptor format -#device ath_rf2133 #device ath_ar9160 #device ath_ar9280 -#device ath_rf9280 -#device ath_ar9285 # NB: 2 USB 2.0 ports standard device usb From owner-svn-src-head@FreeBSD.ORG Wed Dec 2 00:38:11 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9C35B1065679; Wed, 2 Dec 2009 00:38:11 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8B8C88FC1A; Wed, 2 Dec 2009 00:38:11 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nB20cBFs081678; Wed, 2 Dec 2009 00:38:11 GMT (envelope-from thompsa@svn.freebsd.org) Received: (from thompsa@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nB20cBgR081674; Wed, 2 Dec 2009 00:38:11 GMT (envelope-from thompsa@svn.freebsd.org) Message-Id: <200912020038.nB20cBgR081674@svn.freebsd.org> From: Andrew Thompson Date: Wed, 2 Dec 2009 00:38:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200015 - in head/sys: arm/conf i386/conf pc98/conf X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Dec 2009 00:38:11 -0000 Author: thompsa Date: Wed Dec 2 00:38:11 2009 New Revision: 200015 URL: http://svn.freebsd.org/changeset/base/200015 Log: Add missing ath_ar9* ath hal entries. Modified: head/sys/arm/conf/AVILA head/sys/i386/conf/NOTES head/sys/pc98/conf/NOTES Modified: head/sys/arm/conf/AVILA ============================================================================== --- head/sys/arm/conf/AVILA Wed Dec 2 00:37:03 2009 (r200014) +++ head/sys/arm/conf/AVILA Wed Dec 2 00:38:11 2009 (r200015) @@ -132,6 +132,7 @@ device ath_rf5413 device ath_ar5416 options AH_SUPPORT_AR5416 device ath_ar9160 +device ath_ar9280 device usb #options USB_DEBUG Modified: head/sys/i386/conf/NOTES ============================================================================== --- head/sys/i386/conf/NOTES Wed Dec 2 00:37:03 2009 (r200014) +++ head/sys/i386/conf/NOTES Wed Dec 2 00:38:11 2009 (r200015) @@ -578,6 +578,8 @@ device ath_hal # pci/cardbus chip supp #device ath_rf5413 #device ath_ar5416 # AR5416 chips options AH_SUPPORT_AR5416 # enable AR5416 tx/rx descriptors +#device ath_ar9160 # AR9160 chips +#device ath_ar9280 # AR9160 chips device ath_rate_sample # SampleRate tx rate control for ath device ce device cp Modified: head/sys/pc98/conf/NOTES ============================================================================== --- head/sys/pc98/conf/NOTES Wed Dec 2 00:37:03 2009 (r200014) +++ head/sys/pc98/conf/NOTES Wed Dec 2 00:38:11 2009 (r200015) @@ -432,6 +432,8 @@ device ath_hal # pci/cardbus chip supp #device ath_rf5413 #device ath_ar5416 # AR5416 chips options AH_SUPPORT_AR5416 # enable AR5416 tx/rx descriptors +#device ath_ar9160 # AR9160 chips +#device ath_ar9280 # AR9160 chips device ath_rate_sample # SampleRate tx rate control for ath # From owner-svn-src-head@FreeBSD.ORG Wed Dec 2 02:42:37 2009 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C2B661065692; Wed, 2 Dec 2009 02:42:37 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from harmony.bsdimp.com (bsdimp.com [199.45.160.85]) by mx1.freebsd.org (Postfix) with ESMTP id 7B9CE8FC1A; Wed, 2 Dec 2009 02:42:37 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by harmony.bsdimp.com (8.14.3/8.14.1) with ESMTP id nB22Z0TD077715; Tue, 1 Dec 2009 19:35:00 -0700 (MST) (envelope-from imp@bsdimp.com) Date: Tue, 01 Dec 2009 19:35:18 -0700 (MST) Message-Id: <20091201.193518.387188323.imp@bsdimp.com> To: rwatson@FreeBSD.org From: "M. Warner Losh" In-Reply-To: References: <200912010504.nB154VnS053167@svn.freebsd.org> <4B14B32C.3060409@freebsd.org> X-Mailer: Mew version 5.2 on Emacs 21.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: svn-src-head@FreeBSD.org, green@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, cperciva@FreeBSD.org Subject: Re: svn commit: r199983 - in head: lib/libc/stdlib tools/regression/environ X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Dec 2009 02:42:37 -0000 In message: Robert Watson writes: : On Mon, 30 Nov 2009, Colin Percival wrote: : : > Brian Feldman wrote: : >> Do not gratuitously fail *env(3) operations due to corrupt ('='-less) : >> **environ entries. This puts non-getenv(3) operations in line with : >> getenv(3) in that bad environ entries do not cause all operations to : >> fail. There is still some inconsistency in that getenv(3) in the : >> absence of any environment-modifying operation does not emit corrupt : >> environ entry warnings. : >> : >> I also fixed another inconsistency in getenv(3) where updating the : >> global environ pointer would not be reflected in the return values. : >> It would have taken an intermediary setenv(3)/putenv(3)/unsetenv(3) : >> in order to see the change. : > : > The FreeBSD Security Team is currently dealing with a security issue : > relating to this code. Please back out your change (at least to getenv.c; I : > don't particularly care about the regression tests) until we've finished, : > and then submit the patch to us for review along with a detailed explanation : > of what it does. : > : > We've already had two major security issues arising out of getenv.c in the : > past year, and I'd like to make sure we don't have a third. : : I think it's fair to say that the POSIXization of the environment code has : been an unmitigated disaster, and speaks to the necessity for careful review : of those sorts of code changes. Why we're not just reverting the whole thing as a bad idea is beyond me. Clearly the tiny incremental benefits have been far overshadowed by this fiasco. Warner From owner-svn-src-head@FreeBSD.ORG Wed Dec 2 06:49:23 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0D82C1065679; Wed, 2 Dec 2009 06:49:23 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id F032C8FC17; Wed, 2 Dec 2009 06:49:22 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nB26nMir089711; Wed, 2 Dec 2009 06:49:22 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nB26nMYd089710; Wed, 2 Dec 2009 06:49:22 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <200912020649.nB26nMYd089710@svn.freebsd.org> From: Nathan Whitehorn Date: Wed, 2 Dec 2009 06:49:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200018 - head/sys/powerpc/include X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Dec 2009 06:49:23 -0000 Author: nwhitehorn Date: Wed Dec 2 06:49:22 2009 New Revision: 200018 URL: http://svn.freebsd.org/changeset/base/200018 Log: Bump limits on PowerPC. This allows large executables like parts of LLVM to function. Reviewed by: grehan Obtained from: NetBSD MFC after: 2 weeks Modified: head/sys/powerpc/include/vmparam.h Modified: head/sys/powerpc/include/vmparam.h ============================================================================== --- head/sys/powerpc/include/vmparam.h Wed Dec 2 03:08:29 2009 (r200017) +++ head/sys/powerpc/include/vmparam.h Wed Dec 2 06:49:22 2009 (r200018) @@ -38,23 +38,23 @@ #define USRSTACK VM_MAXUSER_ADDRESS #ifndef MAXTSIZ -#define MAXTSIZ (16*1024*1024) /* max text size */ +#define MAXTSIZ (64*1024*1024) /* max text size */ #endif #ifndef DFLDSIZ -#define DFLDSIZ (32*1024*1024) /* default data size */ +#define DFLDSIZ (128*1024*1024) /* default data size */ #endif #ifndef MAXDSIZ -#define MAXDSIZ (512*1024*1024) /* max data size */ +#define MAXDSIZ (1*1024*1024*1024) /* max data size */ #endif #ifndef DFLSSIZ -#define DFLSSIZ (1*1024*1024) /* default stack size */ +#define DFLSSIZ (8*1024*1024) /* default stack size */ #endif #ifndef MAXSSIZ -#define MAXSSIZ (32*1024*1024) /* max stack size */ +#define MAXSSIZ (64*1024*1024) /* max stack size */ #endif /* From owner-svn-src-head@FreeBSD.ORG Wed Dec 2 07:51:26 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7AB8F1065670; Wed, 2 Dec 2009 07:51:26 +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 348C38FC0A; Wed, 2 Dec 2009 07:51:26 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nB27pQuW091004; Wed, 2 Dec 2009 07:51:26 GMT (envelope-from brueffer@svn.freebsd.org) Received: (from brueffer@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nB27pQiP091002; Wed, 2 Dec 2009 07:51:26 GMT (envelope-from brueffer@svn.freebsd.org) Message-Id: <200912020751.nB27pQiP091002@svn.freebsd.org> From: Christian Brueffer Date: Wed, 2 Dec 2009 07:51:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200019 - head/lib/libc/stdio X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Dec 2009 07:51:26 -0000 Author: brueffer Date: Wed Dec 2 07:51:25 2009 New Revision: 200019 URL: http://svn.freebsd.org/changeset/base/200019 Log: Fix the dprintf() prototype. PR: 141087 Submitted by: Jeremy Huddleston MFC after: 3 days Modified: head/lib/libc/stdio/printf.3 Modified: head/lib/libc/stdio/printf.3 ============================================================================== --- head/lib/libc/stdio/printf.3 Wed Dec 2 06:49:22 2009 (r200018) +++ head/lib/libc/stdio/printf.3 Wed Dec 2 07:51:25 2009 (r200019) @@ -32,7 +32,7 @@ .\" @(#)printf.3 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd March 3, 2009 +.Dd December 2, 2009 .Dt PRINTF 3 .Os .Sh NAME @@ -55,7 +55,7 @@ .Ft int .Fn asprintf "char **ret" "const char *format" ... .Ft int -.Fn dprintf "int" "const char * restrict format" ... +.Fn dprintf "int fd" "const char * restrict format" ... .In stdarg.h .Ft int .Fn vprintf "const char * restrict format" "va_list ap" From owner-svn-src-head@FreeBSD.ORG Wed Dec 2 08:52:06 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E9F49106566B; Wed, 2 Dec 2009 08:52:06 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D8F428FC0A; Wed, 2 Dec 2009 08:52:06 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nB28q6Wd092494; Wed, 2 Dec 2009 08:52:06 GMT (envelope-from luigi@svn.freebsd.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nB28q60m092493; Wed, 2 Dec 2009 08:52:06 GMT (envelope-from luigi@svn.freebsd.org) Message-Id: <200912020852.nB28q60m092493@svn.freebsd.org> From: Luigi Rizzo Date: Wed, 2 Dec 2009 08:52:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200020 - head/sys/netinet X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Dec 2009 08:52:07 -0000 Author: luigi Date: Wed Dec 2 08:52:06 2009 New Revision: 200020 URL: http://svn.freebsd.org/changeset/base/200020 Log: change the type of the opcode from enum *:8 to u_int8_t so the size and alignment of the ipfw_insn is not compiler dependent. No changes in the code generated by gcc. There was only one instance of this kind in our entire source tree, so i suspect the old definition was a poor choice (which i made). MFC after: 3 days Modified: head/sys/netinet/ip_fw.h Modified: head/sys/netinet/ip_fw.h ============================================================================== --- head/sys/netinet/ip_fw.h Wed Dec 2 07:51:25 2009 (r200019) +++ head/sys/netinet/ip_fw.h Wed Dec 2 08:52:06 2009 (r200020) @@ -237,7 +237,7 @@ enum ipfw_opcodes { /* arguments (4 byt * */ typedef struct _ipfw_insn { /* template for instructions */ - enum ipfw_opcodes opcode:8; + u_int8_t opcode; u_int8_t len; /* number of 32-bit words */ #define F_NOT 0x80 #define F_OR 0x40 From owner-svn-src-head@FreeBSD.ORG Wed Dec 2 09:37:42 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 52DB2106566C; Wed, 2 Dec 2009 09:37:42 +0000 (UTC) (envelope-from fluffy@fluffy.khv.ru) Received: from ns.ael.RU (ns.ael.ru [62.76.207.226]) by mx1.freebsd.org (Postfix) with ESMTP id 631778FC08; Wed, 2 Dec 2009 09:37:40 +0000 (UTC) Received: from Fluffy.Khv.RU (85.9.168.188.retail.ttk.ru [188.168.9.85] (may be forged)) by ns.ael.RU (8.14.3/8.14.3/Fluffy/5.3) with ESMTP id nB29QVch030491; Wed, 2 Dec 2009 19:26:32 +1000 (VLAT) (envelope-from fluffy@fluffy.khv.ru) Received: from fluffy.khv.ru (localhost [127.0.0.1]) by Fluffy.Khv.RU (8.14.3/8.14.3/Fluffy/5.4.1) with ESMTP id nB29Q37h000220; Wed, 2 Dec 2009 19:26:03 +1000 (VLAT) (envelope-from fluffy@fluffy.khv.ru) From: Dima Panov Organization: Twilight Zone To: cvs-all@freebsd.org Date: Wed, 2 Dec 2009 19:25:56 +1000 User-Agent: KMail/1.12.3 (FreeBSD/9.0-900002-CURRENT; KDE/4.3.3; amd64; ; ) References: <200911261349.nAQDnco2083469@svn.freebsd.org> In-Reply-To: <200911261349.nAQDnco2083469@svn.freebsd.org> X-Face: "RE-2'yS-N:*/7DHOjQ%Az<.+SG>K7B'k(&; qb0K4]Hv>J}"l9,=:m2_]-3S/}`b\]yA-g !y3en*Zl(i-86iM?Q[w@!=rW&JdT>KHW@dri>+qMcy42O, 5#izEqa-K+=B<@A X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-3.0 (ns.ael.RU [62.76.207.226]); Wed, 02 Dec 2009 19:26:33 +1000 (VLAT) X-Spam-Status: No, score=-1.9 required=3.0 tests=AWL,BAYES_00,RDNS_NONE, SPF_FAIL,SPF_HELO_FAIL autolearn=no version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on ns.ael.RU Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Konstantin Belousov Subject: Re: svn commit: r199827 - in head: include lib/libc/compat-43 sys/sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Dec 2009 09:37:42 -0000 --nextPart5006014.CNh04PIApl Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable On Thursday 26 November 2009 23:49:38 Konstantin Belousov wrote: > Author: kib > Date: Thu Nov 26 13:49:37 2009 > New Revision: 199827 > URL: http://svn.freebsd.org/changeset/base/199827 >=20 > Log: > Implement sighold, sigignore, sigpause, sigrelse, sigset functions > from SUSv4 XSI. Note that the functions are obsoleted, and only > provided to ease porting from System V-like systems. Since sigpause > already exists in compat with different interface, XSI sigpause is > named xsi_sigpause. >=20 > Reviewed by: davidxu > MFC after: 3 weeks >=20 > Modified: > head/include/signal.h > head/lib/libc/compat-43/Makefile.inc > head/lib/libc/compat-43/Symbol.map > head/lib/libc/compat-43/sigcompat.c > head/lib/libc/compat-43/sigpause.2 > head/sys/sys/signal.h > head/sys/sys/signalvar.h kib, you forgot about osversion bump, it is strongly needed. This changeset caused jdk (may be not only jdk) breakage, as jdk-bsd-patches always provide own implementations of sigingnore() for FreeBSD. Patch for jdk16 port will be ready soon. =2D-=20 Dima "Red Fox" Panov @ Home | C73E 2B72 1FFD 61BD E206 1234 A626 76ED 93E3 = B018 Khabarovsk, Russia | 2D30 2CCB 9984 130C 6F87 BAFC FB8B A09D D539 = 8F29 KDE@FreeBSD Team | FreeBSD committer since 10.08.2009 | FreeBSD since Sept = 1995 Twitter.com:fluffy_khv | Skype:dima.panov | Jabber.org:fluffy.khv | ICQ:174= 5024 --nextPart5006014.CNh04PIApl Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part. -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.13 (FreeBSD) iEYEABECAAYFAksWMqoACgkQpiZ27ZPjsBjjqQCgv5rA31KssMf9Ox6LU/v8D/RC O3QAoL40+xAoqz7X8k+UOFSGLr4q+ahu =LEYU -----END PGP SIGNATURE----- --nextPart5006014.CNh04PIApl-- From owner-svn-src-head@FreeBSD.ORG Wed Dec 2 10:36:41 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D8238106566B; Wed, 2 Dec 2009 10:36:41 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C77D78FC12; Wed, 2 Dec 2009 10:36:41 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nB2AafjF001089; Wed, 2 Dec 2009 10:36:41 GMT (envelope-from luigi@svn.freebsd.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nB2Aafdo001087; Wed, 2 Dec 2009 10:36:41 GMT (envelope-from luigi@svn.freebsd.org) Message-Id: <200912021036.nB2Aafdo001087@svn.freebsd.org> From: Luigi Rizzo Date: Wed, 2 Dec 2009 10:36:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200023 - head/sys/netinet X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Dec 2009 10:36:41 -0000 Author: luigi Date: Wed Dec 2 10:36:41 2009 New Revision: 200023 URL: http://svn.freebsd.org/changeset/base/200023 Log: Add new sockopt names for ipfw and dummynet. This commit is just grabbing entries for the new names that will be used in the future, so you don't need to rebuild anything now. MFC after: 3 days Modified: head/sys/netinet/in.h Modified: head/sys/netinet/in.h ============================================================================== --- head/sys/netinet/in.h Wed Dec 2 10:32:34 2009 (r200022) +++ head/sys/netinet/in.h Wed Dec 2 10:36:41 2009 (r200023) @@ -423,12 +423,20 @@ __END_DECLS #define IP_ONESBCAST 23 /* bool: send all-ones broadcast */ #define IP_BINDANY 24 /* bool: allow bind to any address */ +/* + * Options for controlling the firewall and dummynet. + * Historical options (from 40 to 64) will eventually be + * replaced by only two options, IP_FW3 and IP_DUMMYNET3. + */ #define IP_FW_TABLE_ADD 40 /* add entry */ #define IP_FW_TABLE_DEL 41 /* delete entry */ #define IP_FW_TABLE_FLUSH 42 /* flush table */ #define IP_FW_TABLE_GETSIZE 43 /* get table size */ #define IP_FW_TABLE_LIST 44 /* list table contents */ +#define IP_FW3 48 /* generic ipfw v.3 sockopts */ +#define IP_DUMMYNET3 49 /* generic dummynet v.3 sockopts */ + #define IP_FW_ADD 50 /* add a firewall rule to chain */ #define IP_FW_DEL 51 /* delete a firewall rule from chain */ #define IP_FW_FLUSH 52 /* flush firewall rule chain */ From owner-svn-src-head@FreeBSD.ORG Wed Dec 2 13:24:22 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1F6BE106566B; Wed, 2 Dec 2009 13:24:22 +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 039798FC18; Wed, 2 Dec 2009 13:24:22 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nB2DOLwN006678; Wed, 2 Dec 2009 13:24:21 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nB2DOLuO006676; Wed, 2 Dec 2009 13:24:21 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <200912021324.nB2DOLuO006676@svn.freebsd.org> From: Gleb Smirnoff Date: Wed, 2 Dec 2009 13:24:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200026 - head/sys/netinet X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Dec 2009 13:24:22 -0000 Author: glebius Date: Wed Dec 2 13:24:21 2009 New Revision: 200026 URL: http://svn.freebsd.org/changeset/base/200026 Log: Until this moment carp(4) used a strange logging priority. It used debug priority for such important information as MASTER/BACKUP state change, and used a normal logging priority for such innocent messages as receiving short packet (which is a normal VRRP packet between some other routers) or receving a CARP packet on non-carp interface (someone else running CARP). This commit shifts message logging priorities to a more sane default. Modified: head/sys/netinet/ip_carp.c Modified: head/sys/netinet/ip_carp.c ============================================================================== --- head/sys/netinet/ip_carp.c Wed Dec 2 12:26:26 2009 (r200025) +++ head/sys/netinet/ip_carp.c Wed Dec 2 13:24:21 2009 (r200026) @@ -550,7 +550,7 @@ carp_input(struct mbuf *m, int hlen) /* check if received on a valid carp interface */ if (m->m_pkthdr.rcvif->if_carp == NULL) { CARPSTATS_INC(carps_badif); - CARP_LOG("carp_input: packet received on non-carp " + CARP_DEBUG("carp_input: packet received on non-carp " "interface: %s\n", m->m_pkthdr.rcvif->if_xname); m_freem(m); @@ -571,7 +571,7 @@ carp_input(struct mbuf *m, int hlen) if (m->m_pkthdr.len < iplen + sizeof(*ch)) { CARPSTATS_INC(carps_badlen); - CARP_LOG("carp_input: received len %zd < " + CARP_DEBUG("carp_input: received len %zd < " "sizeof(struct carp_header) on %s\n", m->m_len - sizeof(struct ip), m->m_pkthdr.rcvif->if_xname); @@ -582,7 +582,7 @@ carp_input(struct mbuf *m, int hlen) if (iplen + sizeof(*ch) < m->m_len) { if ((m = m_pullup(m, iplen + sizeof(*ch))) == NULL) { CARPSTATS_INC(carps_hdrops); - CARP_LOG("carp_input: pullup failed\n"); + CARP_DEBUG("carp_input: pullup failed\n"); return; } ip = mtod(m, struct ip *); @@ -596,7 +596,7 @@ carp_input(struct mbuf *m, int hlen) len = iplen + sizeof(*ch); if (len > m->m_pkthdr.len) { CARPSTATS_INC(carps_badlen); - CARP_LOG("carp_input: packet too short %d on %s\n", + CARP_DEBUG("carp_input: packet too short %d on %s\n", m->m_pkthdr.len, m->m_pkthdr.rcvif->if_xname); m_freem(m); @@ -614,7 +614,7 @@ carp_input(struct mbuf *m, int hlen) m->m_data += iplen; if (carp_cksum(m, len - iplen)) { CARPSTATS_INC(carps_badsum); - CARP_LOG("carp_input: checksum failed on %s\n", + CARP_DEBUG("carp_input: checksum failed on %s\n", m->m_pkthdr.rcvif->if_xname); m_freem(m); return; @@ -643,7 +643,7 @@ carp6_input(struct mbuf **mp, int *offp, /* check if received on a valid carp interface */ if (m->m_pkthdr.rcvif->if_carp == NULL) { CARPSTATS_INC(carps_badif); - CARP_LOG("carp6_input: packet received on non-carp " + CARP_DEBUG("carp6_input: packet received on non-carp " "interface: %s\n", m->m_pkthdr.rcvif->if_xname); m_freem(m); @@ -653,7 +653,7 @@ carp6_input(struct mbuf **mp, int *offp, /* verify that the IP TTL is 255 */ if (ip6->ip6_hlim != CARP_DFLTTL) { CARPSTATS_INC(carps_badttl); - CARP_LOG("carp6_input: received ttl %d != 255 on %s\n", + CARP_DEBUG("carp6_input: received ttl %d != 255 on %s\n", ip6->ip6_hlim, m->m_pkthdr.rcvif->if_xname); m_freem(m); @@ -665,7 +665,7 @@ carp6_input(struct mbuf **mp, int *offp, IP6_EXTHDR_GET(ch, struct carp_header *, m, *offp, sizeof(*ch)); if (ch == NULL) { CARPSTATS_INC(carps_badlen); - CARP_LOG("carp6_input: packet size %u too small\n", len); + CARP_DEBUG("carp6_input: packet size %u too small\n", len); return (IPPROTO_DONE); } @@ -674,7 +674,7 @@ carp6_input(struct mbuf **mp, int *offp, m->m_data += *offp; if (carp_cksum(m, sizeof(*ch))) { CARPSTATS_INC(carps_badsum); - CARP_LOG("carp6_input: checksum failed, on %s\n", + CARP_DEBUG("carp6_input: checksum failed, on %s\n", m->m_pkthdr.rcvif->if_xname); m_freem(m); return (IPPROTO_DONE); @@ -727,7 +727,7 @@ carp_input_c(struct mbuf *m, struct carp CARPSTATS_INC(carps_badver); SC2IFP(sc)->if_ierrors++; CARP_UNLOCK(ifp->if_carp); - CARP_LOG("%s; invalid version %d\n", + CARP_DEBUG("%s; invalid version %d\n", SC2IFP(sc)->if_xname, ch->carp_version); m_freem(m); @@ -772,7 +772,7 @@ carp_input_c(struct mbuf *m, struct carp if (timevalcmp(&sc_tv, &ch_tv, >) || timevalcmp(&sc_tv, &ch_tv, ==)) { callout_stop(&sc->sc_ad_tmo); - CARP_DEBUG("%s: MASTER -> BACKUP " + CARP_LOG("%s: MASTER -> BACKUP " "(more frequent advertisement received)\n", SC2IFP(sc)->if_xname); carp_set_state(sc, BACKUP); @@ -787,7 +787,7 @@ carp_input_c(struct mbuf *m, struct carp */ if (carp_opts[CARPCTL_PREEMPT] && timevalcmp(&sc_tv, &ch_tv, <)) { - CARP_DEBUG("%s: BACKUP -> MASTER " + CARP_LOG("%s: BACKUP -> MASTER " "(preempting a slower master)\n", SC2IFP(sc)->if_xname); carp_master_down_locked(sc); @@ -801,7 +801,7 @@ carp_input_c(struct mbuf *m, struct carp */ sc_tv.tv_sec = sc->sc_advbase * 3; if (timevalcmp(&sc_tv, &ch_tv, <)) { - CARP_DEBUG("%s: BACKUP -> MASTER " + CARP_LOG("%s: BACKUP -> MASTER " "(master timed out)\n", SC2IFP(sc)->if_xname); carp_master_down_locked(sc); @@ -1024,7 +1024,7 @@ carp_send_ad_locked(struct carp_softc *s if (in6_setscope(&ip6->ip6_dst, sc->sc_carpdev, NULL) != 0) { SC2IFP(sc)->if_oerrors++; m_freem(m); - CARP_LOG("%s: in6_setscope failed\n", __func__); + CARP_DEBUG("%s: in6_setscope failed\n", __func__); return; } @@ -1385,12 +1385,12 @@ carp_setrun(struct carp_softc *sc, sa_fa #ifdef INET6 carp_send_na(sc); #endif /* INET6 */ - CARP_DEBUG("%s: INIT -> MASTER (preempting)\n", + CARP_LOG("%s: INIT -> MASTER (preempting)\n", SC2IFP(sc)->if_xname); carp_set_state(sc, MASTER); carp_setroute(sc, RTM_ADD); } else { - CARP_DEBUG("%s: INIT -> BACKUP\n", SC2IFP(sc)->if_xname); + CARP_LOG("%s: INIT -> BACKUP\n", SC2IFP(sc)->if_xname); carp_set_state(sc, BACKUP); carp_setroute(sc, RTM_DELETE); carp_setrun(sc, 0); From owner-svn-src-head@FreeBSD.ORG Wed Dec 2 13:29:18 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9465A1065698; Wed, 2 Dec 2009 13:29:18 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.zoral.com.ua (skuns.zoral.com.ua [91.193.166.194]) by mx1.freebsd.org (Postfix) with ESMTP id 08E068FC1F; Wed, 2 Dec 2009 13:29:17 +0000 (UTC) Received: from deviant.kiev.zoral.com.ua (root@deviant.kiev.zoral.com.ua [10.1.1.148]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id nB2DT4Ic069614 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 2 Dec 2009 15:29:04 +0200 (EET) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1]) by deviant.kiev.zoral.com.ua (8.14.3/8.14.3) with ESMTP id nB2DT4lt042699; Wed, 2 Dec 2009 15:29:04 +0200 (EET) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.3/8.14.3/Submit) id nB2DT4qb042698; Wed, 2 Dec 2009 15:29:04 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Wed, 2 Dec 2009 15:29:04 +0200 From: Kostik Belousov To: Dima Panov Message-ID: <20091202132904.GH2368@deviant.kiev.zoral.com.ua> References: <200911261349.nAQDnco2083469@svn.freebsd.org> <200912021926.02346.fluffy@fluffy.khv.ru> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="h2J70RNbM0WNXG3M" Content-Disposition: inline In-Reply-To: <200912021926.02346.fluffy@fluffy.khv.ru> User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: clamav-milter 0.95.2 at skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-4.4 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on skuns.kiev.zoral.com.ua Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, cvs-all@freebsd.org Subject: Re: svn commit: r199827 - in head: include lib/libc/compat-43 sys/sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Dec 2009 13:29:18 -0000 --h2J70RNbM0WNXG3M Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Dec 02, 2009 at 07:25:56PM +1000, Dima Panov wrote: > On Thursday 26 November 2009 23:49:38 Konstantin Belousov wrote: > > Author: kib > > Date: Thu Nov 26 13:49:37 2009 > > New Revision: 199827 > > URL: http://svn.freebsd.org/changeset/base/199827 > >=20 > > Log: > > Implement sighold, sigignore, sigpause, sigrelse, sigset functions > > from SUSv4 XSI. Note that the functions are obsoleted, and only > > provided to ease porting from System V-like systems. Since sigpause > > already exists in compat with different interface, XSI sigpause is > > named xsi_sigpause. > >=20 > > Reviewed by: davidxu > > MFC after: 3 weeks > >=20 > > Modified: > > head/include/signal.h > > head/lib/libc/compat-43/Makefile.inc > > head/lib/libc/compat-43/Symbol.map > > head/lib/libc/compat-43/sigcompat.c > > head/lib/libc/compat-43/sigpause.2 > > head/sys/sys/signal.h > > head/sys/sys/signalvar.h >=20 > kib, you forgot about osversion bump, it is strongly needed. No. My interpretation of __FreeBSD_version is that the bump indicates incompatible change in the interfaces. Sometime it is used to mark the point where big changes hit the tree, possibly not related to interface change. Also, __FreeBSD_version denotes the kernel "version". We do support running earlier usermode on the later kernels. Think about kernel-only upgrades, compatXx libs and jails which can run arbitrary earlier usermode. (The change in question is purely libc). Said this, I think it is actually harmful practice to bump __FreeBSD_version after API additions or feature implementation. I can bump version for this case, but due to the above reason, it would not make much sense. >=20 > This changeset caused jdk (may be not only jdk) breakage, as jdk-bsd-patc= hes > always provide own implementations of sigingnore() for FreeBSD. >=20 > Patch for jdk16 port will be ready soon. Ok, thanks for working on this. --h2J70RNbM0WNXG3M Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (FreeBSD) iEYEARECAAYFAksWa58ACgkQC3+MBN1Mb4hLuACg7g8APMvdYvJweHwy6Zyfn7Wl +b8Anj9tGX1ZpyLFas+xlIFJAy+YeAJQ =jyC5 -----END PGP SIGNATURE----- --h2J70RNbM0WNXG3M-- From owner-svn-src-head@FreeBSD.ORG Wed Dec 2 14:32:01 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C97AB106566B; Wed, 2 Dec 2009 14:32:01 +0000 (UTC) (envelope-from ume@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id AD3618FC16; Wed, 2 Dec 2009 14:32:01 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nB2EW1ru014372; Wed, 2 Dec 2009 14:32:01 GMT (envelope-from ume@svn.freebsd.org) Received: (from ume@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nB2EW10c014370; Wed, 2 Dec 2009 14:32:01 GMT (envelope-from ume@svn.freebsd.org) Message-Id: <200912021432.nB2EW10c014370@svn.freebsd.org> From: Hajimu UMEMOTO Date: Wed, 2 Dec 2009 14:32:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200027 - head/sys/netinet/ipfw X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Dec 2009 14:32:02 -0000 Author: ume Date: Wed Dec 2 14:32:01 2009 New Revision: 200027 URL: http://svn.freebsd.org/changeset/base/200027 Log: Teach an IPv6 to send_pkt() and ipfw_tick(). It fixes the issue which keep-alive doesn't work for an IPv6. PR: kern/117234 Submitted by: mlaier, Joost Bekkers MFC after: 1 month Modified: head/sys/netinet/ipfw/ip_fw2.c Modified: head/sys/netinet/ipfw/ip_fw2.c ============================================================================== --- head/sys/netinet/ipfw/ip_fw2.c Wed Dec 2 13:24:21 2009 (r200026) +++ head/sys/netinet/ipfw/ip_fw2.c Wed Dec 2 14:32:01 2009 (r200027) @@ -94,6 +94,7 @@ __FBSDID("$FreeBSD$"); #include #ifdef INET6 #include +#include #endif #include /* XXX for in_cksum */ @@ -249,6 +250,10 @@ static struct mtx ipfw_dyn_mtx; /* mute #define IPFW_DYN_UNLOCK() mtx_unlock(&ipfw_dyn_mtx) #define IPFW_DYN_LOCK_ASSERT() mtx_assert(&ipfw_dyn_mtx, MA_OWNED) +static struct mbuf *send_pkt(struct mbuf *, struct ipfw_flow_id *, + u_int32_t, u_int32_t, int); + + /* * Timeouts for various events in handing dynamic rules. */ @@ -708,60 +713,18 @@ send_reject6(struct ip_fw_args *args, in m = args->m; if (code == ICMP6_UNREACH_RST && args->f_id.proto == IPPROTO_TCP) { struct tcphdr *tcp; - tcp_seq ack, seq; - int flags; - struct { - struct ip6_hdr ip6; - struct tcphdr th; - } ti; tcp = (struct tcphdr *)((char *)ip6 + hlen); - if ((tcp->th_flags & TH_RST) != 0) { - m_freem(m); - args->m = NULL; - return; - } - - ti.ip6 = *ip6; - ti.th = *tcp; - ti.th.th_seq = ntohl(ti.th.th_seq); - ti.th.th_ack = ntohl(ti.th.th_ack); - ti.ip6.ip6_nxt = IPPROTO_TCP; - - if (ti.th.th_flags & TH_ACK) { - ack = 0; - seq = ti.th.th_ack; - flags = TH_RST; - } else { - ack = ti.th.th_seq; - if ((m->m_flags & M_PKTHDR) != 0) { - /* - * total new data to ACK is: - * total packet length, - * minus the header length, - * minus the tcp header length. - */ - ack += m->m_pkthdr.len - hlen - - (ti.th.th_off << 2); - } else if (ip6->ip6_plen) { - ack += ntohs(ip6->ip6_plen) + sizeof(*ip6) - - hlen - (ti.th.th_off << 2); - } else { - m_freem(m); - return; - } - if (tcp->th_flags & TH_SYN) - ack++; - seq = 0; - flags = TH_RST|TH_ACK; + if ((tcp->th_flags & TH_RST) == 0) { + struct mbuf *m0; + m0 = send_pkt(args->m, &(args->f_id), + ntohl(tcp->th_seq), ntohl(tcp->th_ack), + tcp->th_flags | TH_RST); + if (m0 != NULL) + ip6_output(m0, NULL, NULL, 0, NULL, NULL, + NULL); } - bcopy(&ti, ip6, sizeof(ti)); - /* - * m is only used to recycle the mbuf - * The data in it is never read so we don't need - * to correct the offsets or anything - */ - tcp_respond(NULL, ip6, tcp, m, ack, seq, flags); + m_freem(m); } else if (code != ICMP6_UNREACH_RST) { /* Send an ICMPv6 unreach. */ #if 0 /* @@ -1649,13 +1612,16 @@ send_pkt(struct mbuf *replyto, struct ip u_int32_t ack, int flags) { struct mbuf *m; - struct ip *ip; - struct tcphdr *tcp; + int len, dir; + struct ip *h = NULL; /* stupid compiler */ +#ifdef INET6 + struct ip6_hdr *h6 = NULL; +#endif + struct tcphdr *th = NULL; MGETHDR(m, M_DONTWAIT, MT_DATA); - if (m == 0) + if (m == NULL) return (NULL); - m->m_pkthdr.rcvif = (struct ifnet *)0; M_SETFIB(m, id->fib); #ifdef MAC @@ -1667,67 +1633,118 @@ send_pkt(struct mbuf *replyto, struct ip (void)replyto; /* don't warn about unused arg */ #endif - m->m_pkthdr.len = m->m_len = sizeof(struct ip) + sizeof(struct tcphdr); + switch (id->addr_type) { + case 4: + len = sizeof(struct ip) + sizeof(struct tcphdr); + break; +#ifdef INET6 + case 6: + len = sizeof(struct ip6_hdr) + sizeof(struct tcphdr); + break; +#endif + default: + /* XXX: log me?!? */ + m_freem(m); + return (NULL); + } + dir = ((flags & (TH_SYN | TH_RST)) == TH_SYN); + m->m_data += max_linkhdr; + m->m_flags |= M_SKIP_FIREWALL; + m->m_pkthdr.len = m->m_len = len; + m->m_pkthdr.rcvif = NULL; + bzero(m->m_data, len); + + switch (id->addr_type) { + case 4: + h = mtod(m, struct ip *); + + /* prepare for checksum */ + h->ip_p = IPPROTO_TCP; + h->ip_len = htons(sizeof(struct tcphdr)); + if (dir) { + h->ip_src.s_addr = htonl(id->src_ip); + h->ip_dst.s_addr = htonl(id->dst_ip); + } else { + h->ip_src.s_addr = htonl(id->dst_ip); + h->ip_dst.s_addr = htonl(id->src_ip); + } - ip = mtod(m, struct ip *); - bzero(ip, m->m_len); - tcp = (struct tcphdr *)(ip + 1); /* no IP options */ - ip->ip_p = IPPROTO_TCP; - tcp->th_off = 5; - /* - * Assume we are sending a RST (or a keepalive in the reverse - * direction), swap src and destination addresses and ports. - */ - ip->ip_src.s_addr = htonl(id->dst_ip); - ip->ip_dst.s_addr = htonl(id->src_ip); - tcp->th_sport = htons(id->dst_port); - tcp->th_dport = htons(id->src_port); - if (flags & TH_RST) { /* we are sending a RST */ + th = (struct tcphdr *)(h + 1); + break; +#ifdef INET6 + case 6: + h6 = mtod(m, struct ip6_hdr *); + + /* prepare for checksum */ + h6->ip6_nxt = IPPROTO_TCP; + h6->ip6_plen = htons(sizeof(struct tcphdr)); + if (dir) { + h6->ip6_src = id->src_ip6; + h6->ip6_dst = id->dst_ip6; + } else { + h6->ip6_src = id->dst_ip6; + h6->ip6_dst = id->src_ip6; + } + + th = (struct tcphdr *)(h6 + 1); + break; +#endif + } + + if (dir) { + th->th_sport = htons(id->src_port); + th->th_dport = htons(id->dst_port); + } else { + th->th_sport = htons(id->dst_port); + th->th_dport = htons(id->src_port); + } + th->th_off = sizeof(struct tcphdr) >> 2; + + if (flags & TH_RST) { if (flags & TH_ACK) { - tcp->th_seq = htonl(ack); - tcp->th_ack = htonl(0); - tcp->th_flags = TH_RST; + th->th_seq = htonl(ack); + th->th_flags = TH_RST; } else { if (flags & TH_SYN) seq++; - tcp->th_seq = htonl(0); - tcp->th_ack = htonl(seq); - tcp->th_flags = TH_RST | TH_ACK; + th->th_ack = htonl(seq); + th->th_flags = TH_RST | TH_ACK; } } else { /* - * We are sending a keepalive. flags & TH_SYN determines - * the direction, forward if set, reverse if clear. - * NOTE: seq and ack are always assumed to be correct - * as set by the caller. This may be confusing... + * Keepalive - use caller provided sequence numbers */ - if (flags & TH_SYN) { - /* - * we have to rewrite the correct addresses! - */ - ip->ip_dst.s_addr = htonl(id->dst_ip); - ip->ip_src.s_addr = htonl(id->src_ip); - tcp->th_dport = htons(id->dst_port); - tcp->th_sport = htons(id->src_port); - } - tcp->th_seq = htonl(seq); - tcp->th_ack = htonl(ack); - tcp->th_flags = TH_ACK; + th->th_seq = htonl(seq); + th->th_ack = htonl(ack); + th->th_flags = TH_ACK; + } + + switch (id->addr_type) { + case 4: + th->th_sum = in_cksum(m, len); + + /* finish the ip header */ + h->ip_v = 4; + h->ip_hl = sizeof(*h) >> 2; + h->ip_tos = IPTOS_LOWDELAY; + h->ip_off = 0; + h->ip_len = len; + h->ip_ttl = V_ip_defttl; + h->ip_sum = 0; + break; +#ifdef INET6 + case 6: + th->th_sum = in6_cksum(m, IPPROTO_TCP, sizeof(*h6), + sizeof(struct tcphdr)); + + /* finish the ip6 header */ + h6->ip6_vfc |= IPV6_VERSION; + h6->ip6_hlim = IPV6_DEFHLIM; + break; +#endif } - /* - * set ip_len to the payload size so we can compute - * the tcp checksum on the pseudoheader - * XXX check this, could save a couple of words ? - */ - ip->ip_len = htons(sizeof(struct tcphdr)); - tcp->th_sum = in_cksum(m, m->m_pkthdr.len); - /* - * now fill fields left out earlier - */ - ip->ip_ttl = V_ip_defttl; - ip->ip_len = m->m_pkthdr.len; - m->m_flags |= M_SKIP_FIREWALL; + return (m); } @@ -4530,13 +4547,16 @@ static void ipfw_tick(void * vnetx) { struct mbuf *m0, *m, *mnext, **mtailp; +#ifdef INET6 + struct mbuf *m6, **m6_tailp; +#endif int i; ipfw_dyn_rule *q; #ifdef VIMAGE struct vnet *vp = vnetx; #endif - CURVNET_SET(vp); + CURVNET_SET(vp); if (V_dyn_keepalive == 0 || V_ipfw_dyn_v == NULL || V_dyn_count == 0) goto done; @@ -4548,6 +4568,10 @@ ipfw_tick(void * vnetx) */ m0 = NULL; mtailp = &m0; +#ifdef INET6 + m6 = NULL; + m6_tailp = &m6; +#endif IPFW_DYN_LOCK(); for (i = 0 ; i < V_curr_dyn_buckets ; i++) { for (q = V_ipfw_dyn_v[i] ; q ; q = q->next ) { @@ -4563,14 +4587,37 @@ ipfw_tick(void * vnetx) if (TIME_LEQ(q->expire, time_uptime)) continue; /* too late, rule expired */ - *mtailp = send_pkt(NULL, &(q->id), q->ack_rev - 1, + m = send_pkt(NULL, &(q->id), q->ack_rev - 1, q->ack_fwd, TH_SYN); - if (*mtailp != NULL) - mtailp = &(*mtailp)->m_nextpkt; - *mtailp = send_pkt(NULL, &(q->id), q->ack_fwd - 1, + mnext = send_pkt(NULL, &(q->id), q->ack_fwd - 1, q->ack_rev, 0); - if (*mtailp != NULL) - mtailp = &(*mtailp)->m_nextpkt; + + switch (q->id.addr_type) { + case 4: + if (m != NULL) { + *mtailp = m; + mtailp = &(*mtailp)->m_nextpkt; + } + if (mnext != NULL) { + *mtailp = mnext; + mtailp = &(*mtailp)->m_nextpkt; + } + break; +#ifdef INET6 + case 6: + if (m != NULL) { + *m6_tailp = m; + m6_tailp = &(*m6_tailp)->m_nextpkt; + } + if (mnext != NULL) { + *m6_tailp = mnext; + m6_tailp = &(*m6_tailp)->m_nextpkt; + } + break; +#endif + } + + m = mnext = NULL; } } IPFW_DYN_UNLOCK(); @@ -4579,6 +4626,13 @@ ipfw_tick(void * vnetx) m->m_nextpkt = NULL; ip_output(m, NULL, NULL, 0, NULL, NULL); } +#ifdef INET6 + for (m = mnext = m6; m != NULL; m = mnext) { + mnext = m->m_nextpkt; + m->m_nextpkt = NULL; + ip6_output(m, NULL, NULL, 0, NULL, NULL, NULL); + } +#endif done: callout_reset(&V_ipfw_timeout, V_dyn_keepalive_period * hz, ipfw_tick, vnetx); From owner-svn-src-head@FreeBSD.ORG Wed Dec 2 15:05:27 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 59A441065695; Wed, 2 Dec 2009 15:05:27 +0000 (UTC) (envelope-from ume@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 468A18FC16; Wed, 2 Dec 2009 15:05:27 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nB2F5RXE018943; Wed, 2 Dec 2009 15:05:27 GMT (envelope-from ume@svn.freebsd.org) Received: (from ume@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nB2F5RIt018936; Wed, 2 Dec 2009 15:05:27 GMT (envelope-from ume@svn.freebsd.org) Message-Id: <200912021505.nB2F5RIt018936@svn.freebsd.org> From: Hajimu UMEMOTO Date: Wed, 2 Dec 2009 15:05:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200028 - in head: . etc etc/defaults etc/rc.d X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Dec 2009 15:05:27 -0000 Author: ume Date: Wed Dec 2 15:05:26 2009 New Revision: 200028 URL: http://svn.freebsd.org/changeset/base/200028 Log: Unify rc.firewall and rc.firewall6, and obsolete rc.firewall6 and rc.d/ip6fw. Reviewed by: dougb, jhb MFC after: 1 month Deleted: head/etc/rc.d/ip6fw head/etc/rc.firewall6 Modified: head/ObsoleteFiles.inc head/etc/Makefile head/etc/defaults/rc.conf head/etc/rc.d/Makefile head/etc/rc.d/ipfw head/etc/rc.firewall Modified: head/ObsoleteFiles.inc ============================================================================== --- head/ObsoleteFiles.inc Wed Dec 2 14:32:01 2009 (r200027) +++ head/ObsoleteFiles.inc Wed Dec 2 15:05:26 2009 (r200028) @@ -14,6 +14,9 @@ # The file is partitioned: OLD_FILES first, then OLD_LIBS and OLD_DIRS last. # +# 20091202: unify rc.firewall and rc.firewall6. +OLD_FILES+=etc/rc.d/ip6fw +OLD_FILES+=etc/rc.firewall6 # 20091117: removal of rc.early(8) link OLD_FILES+=usr/share/man/man8/rc.early.8.gz # 20091027: pselect.3 implemented as syscall Modified: head/etc/Makefile ============================================================================== --- head/etc/Makefile Wed Dec 2 14:32:01 2009 (r200027) +++ head/etc/Makefile Wed Dec 2 15:05:26 2009 (r200028) @@ -15,7 +15,7 @@ BIN1= auth.conf \ 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.firewall6 rc.initdiskless \ + rc rc.bsdextended rc.firewall rc.initdiskless \ rc.sendmail rc.shutdown \ rc.subr remote rpc services shells \ sysctl.conf syslog.conf Modified: head/etc/defaults/rc.conf ============================================================================== --- head/etc/defaults/rc.conf Wed Dec 2 14:32:01 2009 (r200027) +++ head/etc/defaults/rc.conf Wed Dec 2 15:05:26 2009 (r200028) @@ -118,7 +118,10 @@ firewall_type="UNKNOWN" # Firewall type firewall_quiet="NO" # Set to YES to suppress rule display firewall_logging="NO" # Set to YES to enable events logging firewall_flags="" # Flags passed to ipfw when type is a file -firewall_client_net="192.0.2.0/24" # Network address for "client" firewall. +firewall_client_net="192.0.2.0/24" # IPv4 Network address for "client" + # firewall. +#firewall_client_net_ipv6="2001:db8:2:1::/64" # IPv6 network prefix for + # "client" firewall. firewall_simple_iif="ed1" # Inside network interface for "simple" # firewall. firewall_simple_inet="192.0.2.16/28" # Inside network address for "simple" @@ -127,12 +130,22 @@ firewall_simple_oif="ed0" # Outside netw # firewall. firewall_simple_onet="192.0.2.0/28" # Outside network address for "simple" # firewall. +#firewall_simple_iif_ipv6="ed1" # Inside IPv6 network interface for "simple" + # firewall. +#firewall_simple_inet_ipv6="2001:db8:2:800::/56" # Inside IPv6 network prefix + # for "simple" firewall. +#firewall_simple_oif_ipv6="ed0" # Outside IPv6 network interface for "simple" + # firewall. +#firewall_simple_onet_ipv6="2001:db8:2:0::/56" # Outside IPv6 network prefix + # for "simple" firewall. firewall_myservices="" # List of TCP ports on which this host # offers services for "workstation" firewall. firewall_allowservices="" # List of IPs which have access to # $firewall_myservices for "workstation" # firewall. -firewall_trusted="" # List of IPs which have full access to this +firewall_trusted="" # List of IPv4s which have full access to this + # host for "workstation" firewall. +firewall_trusted_ipv6="" # List of IPv6s which have full access to this # host for "workstation" firewall. firewall_logdeny="NO" # Set to YES to log default denied incoming # packets for "workstation" firewall. @@ -472,13 +485,6 @@ ipv6_faith_prefix="NO" # Set faith pref # faithd(8) setup. ipv6_ipv4mapping="NO" # Set to "YES" to enable IPv4 mapped IPv6 addr # communication. (like ::ffff:a.b.c.d) -ipv6_firewall_enable="NO" # Set to YES to enable IPv6 firewall - # functionality -ipv6_firewall_script="/etc/rc.firewall6" # Which script to run to set up the IPv6 firewall -ipv6_firewall_type="UNKNOWN" # IPv6 Firewall type (see /etc/rc.firewall6) -ipv6_firewall_quiet="NO" # Set to YES to suppress rule display -ipv6_firewall_logging="NO" # Set to YES to enable events logging -ipv6_firewall_flags="" # Flags passed to ip6fw when type is a file ipv6_ipfilter_rules="/etc/ipf6.rules" # rules definition file for ipfilter, # see /usr/src/contrib/ipfilter/rules # for examples Modified: head/etc/rc.d/Makefile ============================================================================== --- head/etc/rc.d/Makefile Wed Dec 2 14:32:01 2009 (r200027) +++ head/etc/rc.d/Makefile Wed Dec 2 15:05:26 2009 (r200028) @@ -15,7 +15,7 @@ FILES= DAEMON FILESYSTEMS LOGIN NETWORKI hcsecd \ hostapd hostid hostid_save hostname \ inetd initrandom \ - ip6addrctl ip6fw ipfilter ipfs ipfw ipmon \ + ip6addrctl ipfilter ipfs ipfw ipmon \ ipnat ipsec ipxrouted \ jail \ kadmind kerberos keyserv kldxref kpasswdd \ Modified: head/etc/rc.d/ipfw ============================================================================== --- head/etc/rc.d/ipfw Wed Dec 2 14:32:01 2009 (r200027) +++ head/etc/rc.d/ipfw Wed Dec 2 15:05:26 2009 (r200028) @@ -17,6 +17,8 @@ start_precmd="ipfw_prestart" stop_cmd="ipfw_stop" required_modules="ipfw" +set_rcvar_obsolete ipv6_firewall_enable + ipfw_prestart() { if checkyesno dummynet_enable; then @@ -61,7 +63,13 @@ ipfw_start() # Enable the firewall # if ! ${SYSCTL_W} net.inet.ip.fw.enable=1 1>/dev/null 2>&1; then - warn "failed to enable firewall" + warn "failed to enable IPv4 firewall" + fi + if afexists inet6; then + if ! ${SYSCTL_W} net.inet6.ip6.fw.enable=1 1>/dev/null 2>&1 + then + warn "failed to enable IPv6 firewall" + fi fi } @@ -70,6 +78,9 @@ ipfw_stop() # Disable the firewall # ${SYSCTL_W} net.inet.ip.fw.enable=0 + if afexists inet6; then + ${SYSCTL_W} net.inet6.ip6.fw.enable=0 + fi if [ -f /etc/rc.d/natd ] ; then /etc/rc.d/natd quietstop fi Modified: head/etc/rc.firewall ============================================================================== --- head/etc/rc.firewall Wed Dec 2 14:32:01 2009 (r200027) +++ head/etc/rc.firewall Wed Dec 2 15:05:26 2009 (r200028) @@ -85,12 +85,42 @@ setup_loopback () { ${fwcmd} add 100 pass all from any to any via lo0 ${fwcmd} add 200 deny all from any to 127.0.0.0/8 ${fwcmd} add 300 deny ip from 127.0.0.0/8 to any + if [ $ipv6_available -eq 0 ]; then + ${fwcmd} add 400 deny all from any to ::1 + ${fwcmd} add 500 deny all from ::1 to any + fi +} + +setup_ipv6_mandatory () { + [ $ipv6_available -eq 0 ] || return 0 + + ############ + # Only in rare cases do you want to change these rules + # + # ND + # + # DAD + ${fwcmd} add pass ipv6-icmp from :: to ff02::/16 + # RS, RA, NS, NA, redirect... + ${fwcmd} add pass ipv6-icmp from fe80::/10 to fe80::/10 + ${fwcmd} add pass ipv6-icmp from fe80::/10 to ff02::/16 + + # Allow ICMPv6 destination unreach + ${fwcmd} add pass ipv6-icmp from any to any icmp6types 1 + + # Allow NS/NA/toobig (don't filter it out) + ${fwcmd} add pass ipv6-icmp from any to any icmp6types 2,135,136 } if [ -n "${1}" ]; then firewall_type="${1}" fi +. /etc/rc.subr +. /etc/network.subr +afexists inet6 +ipv6_available=$? + ############ # Set quiet mode if requested # @@ -109,6 +139,7 @@ esac ${fwcmd} -f flush setup_loopback +setup_ipv6_mandatory ############ # Network Address Translation. All packets are passed to natd(8) @@ -166,11 +197,13 @@ case ${firewall_type} in # against people from outside your own network. # # Configuration: - # firewall_client_net: Network address of local network. + # firewall_client_net: Network address of local IPv4 network. + # firewall_client_net_ipv6: Network address of local IPv6 network. ############ # set this to your local network net="$firewall_client_net" + net6="$firewall_client_net_ipv6" # Allow limited broadcast traffic from my own net. ${fwcmd} add pass all from ${net} to 255.255.255.255 @@ -178,6 +211,16 @@ case ${firewall_type} in # Allow any traffic to or from my own net. ${fwcmd} add pass all from me to ${net} ${fwcmd} add pass all from ${net} to me + if [ -n "$net6" ]; then + ${fwcmd} add pass all from me6 to ${net6} + ${fwcmd} add pass all from ${net6} to me6 + fi + + if [ -n "$net6" ]; then + # Allow any link-local multicast traffic + ${fwcmd} add pass all from fe80::/10 to ff02::/16 + ${fwcmd} add pass all from ${net6} to ff02::/16 + fi # Allow TCP through if setup succeeded ${fwcmd} add pass tcp from any to any established @@ -212,23 +255,38 @@ case ${firewall_type} in # on the inside at this machine for those services. # # Configuration: - # firewall_simple_iif: Inside network interface. - # firewall_simple_inet: Inside network address. - # firewall_simple_oif: Outside network interface. - # firewall_simple_onet: Outside network address. + # firewall_simple_iif: Inside IPv4 network interface. + # firewall_simple_inet: Inside IPv4 network address. + # firewall_simple_oif: Outside IPv4 network interface. + # firewall_simple_onet: Outside IPv4 network address. + # firewall_simple_iif_ipv6: Inside IPv6 network interface. + # firewall_simple_inet_ipv6: Inside IPv6 network prefix. + # firewall_simple_oif_ipv6: Outside IPv6 network interface. + # firewall_simple_onet_ipv6: Outside IPv6 network prefix. ############ # set these to your outside interface network oif="$firewall_simple_oif" onet="$firewall_simple_onet" + oif6="${firewall_simple_oif_ipv6:-$firewall_simple_oif}" + onet6="$firewall_simple_onet_ipv6" # set these to your inside interface network iif="$firewall_simple_iif" inet="$firewall_simple_inet" + iif6="${firewall_simple_iif_ipv6:-$firewall_simple_iif}" + inet6="$firewall_simple_inet_ipv6" # Stop spoofing ${fwcmd} add deny all from ${inet} to any in via ${oif} ${fwcmd} add deny all from ${onet} to any in via ${iif} + if [ -n "$inet6" ]; then + ${fwcmd} add deny all from ${inet6} to any in via ${oif6} + if [ -n "$onet6" ]; then + ${fwcmd} add deny all from ${onet6} to any in \ + via ${iif6} + fi + fi # Stop RFC1918 nets on the outside interface ${fwcmd} add deny all from any to 10.0.0.0/8 via ${oif} @@ -254,7 +312,7 @@ case ${firewall_type} in case ${natd_enable} in [Yy][Ee][Ss]) if [ -n "${natd_interface}" ]; then - ${fwcmd} add divert natd all from any to any via ${natd_interface} + ${fwcmd} add divert natd ip4 from any to any via ${natd_interface} fi ;; esac @@ -273,6 +331,55 @@ case ${firewall_type} in ${fwcmd} add deny all from 224.0.0.0/4 to any via ${oif} ${fwcmd} add deny all from 240.0.0.0/4 to any via ${oif} + if [ -n "$inet6" ]; then + # Stop unique local unicast address on the outside interface + ${fwcmd} add deny all from fc00::/7 to any via ${oif6} + ${fwcmd} add deny all from any to fc00::/7 via ${oif6} + + # Stop site-local on the outside interface + ${fwcmd} add deny all from fec0::/10 to any via ${oif6} + ${fwcmd} add deny all from any to fec0::/10 via ${oif6} + + # Disallow "internal" addresses to appear on the wire. + ${fwcmd} add deny all from ::ffff:0.0.0.0/96 to any \ + via ${oif6} + ${fwcmd} add deny all from any to ::ffff:0.0.0.0/96 \ + via ${oif6} + + # Disallow packets to malicious IPv4 compatible prefix. + ${fwcmd} add deny all from ::224.0.0.0/100 to any via ${oif6} + ${fwcmd} add deny all from any to ::224.0.0.0/100 via ${oif6} + ${fwcmd} add deny all from ::127.0.0.0/104 to any via ${oif6} + ${fwcmd} add deny all from any to ::127.0.0.0/104 via ${oif6} + ${fwcmd} add deny all from ::0.0.0.0/104 to any via ${oif6} + ${fwcmd} add deny all from any to ::0.0.0.0/104 via ${oif6} + ${fwcmd} add deny all from ::255.0.0.0/104 to any via ${oif6} + ${fwcmd} add deny all from any to ::255.0.0.0/104 via ${oif6} + + ${fwcmd} add deny all from ::0.0.0.0/96 to any via ${oif6} + ${fwcmd} add deny all from any to ::0.0.0.0/96 via ${oif6} + + # Disallow packets to malicious 6to4 prefix. + ${fwcmd} add deny all from 2002:e000::/20 to any via ${oif6} + ${fwcmd} add deny all from any to 2002:e000::/20 via ${oif6} + ${fwcmd} add deny all from 2002:7f00::/24 to any via ${oif6} + ${fwcmd} add deny all from any to 2002:7f00::/24 via ${oif6} + ${fwcmd} add deny all from 2002:0000::/24 to any via ${oif6} + ${fwcmd} add deny all from any to 2002:0000::/24 via ${oif6} + ${fwcmd} add deny all from 2002:ff00::/24 to any via ${oif6} + ${fwcmd} add deny all from any to 2002:ff00::/24 via ${oif6} + + ${fwcmd} add deny all from 2002:0a00::/24 to any via ${oif6} + ${fwcmd} add deny all from any to 2002:0a00::/24 via ${oif6} + ${fwcmd} add deny all from 2002:ac10::/28 to any via ${oif6} + ${fwcmd} add deny all from any to 2002:ac10::/28 via ${oif6} + ${fwcmd} add deny all from 2002:c0a8::/32 to any via ${oif6} + ${fwcmd} add deny all from any to 2002:c0a8::/32 via ${oif6} + + ${fwcmd} add deny all from ff05::/16 to any via ${oif6} + ${fwcmd} add deny all from any to ff05::/16 via ${oif6} + fi + # Allow TCP through if setup succeeded ${fwcmd} add pass tcp from any to any established @@ -291,7 +398,11 @@ case ${firewall_type} in ${fwcmd} add pass tcp from any to me 80 setup # Reject&Log all setup of incoming connections from the outside - ${fwcmd} add deny log tcp from any to any in via ${oif} setup + ${fwcmd} add deny log ip4 from any to any in via ${oif} setup proto tcp + if [ -n "$inet6" ]; then + ${fwcmd} add deny log ip6 from any to any in via ${oif6} \ + setup proto tcp + fi # Allow setup of any other TCP connection ${fwcmd} add pass tcp from any to any setup @@ -313,7 +424,7 @@ case ${firewall_type} in # offers services. # firewall_allowservices: List of IPs which has access to # $firewall_myservices. - # firewall_trusted: List of IPs which has full access + # firewall_trusted: List of IPv4s which has full access # to this host. Be very carefull # when setting this. This option can # seriously degrade the level of @@ -324,25 +435,44 @@ case ${firewall_type} in # firewall_nologports: List of TCP/UDP ports for which # denied incomming packets are not # logged. - + # firewall_trusted_ipv6: List of IPv6s which has full access + # to this host. Be very carefull + # when setting this. This option can + # seriously degrade the level of + # protection provided by the firewall. + # Allow packets for which a state has been built. ${fwcmd} add check-state # For services permitted below. ${fwcmd} add pass tcp from me to any established + if [ $ipv6_available -eq 0 ]; then + ${fwcmd} add pass tcp from me6 to any established + fi # Allow any connection out, adding state for each. ${fwcmd} add pass tcp from me to any setup keep-state ${fwcmd} add pass udp from me to any keep-state ${fwcmd} add pass icmp from me to any keep-state + if [ $ipv6_available -eq 0 ]; then + ${fwcmd} add pass tcp from me6 to any setup keep-state + ${fwcmd} add pass udp from me6 to any keep-state + ${fwcmd} add pass ipv6-icmp from me6 to any keep-state + fi # Allow DHCP. ${fwcmd} add pass udp from 0.0.0.0 68 to 255.255.255.255 67 out ${fwcmd} add pass udp from any 67 to me 68 in ${fwcmd} add pass udp from any 67 to 255.255.255.255 68 in + if [ $ipv6_available -eq 0 ]; then + ${fwcmd} add pass udp from fe80::/10 to me6 546 in + fi # Some servers will ping the IP while trying to decide if it's # still in use. ${fwcmd} add pass icmp from any to any icmptype 8 + if [ $ipv6_available -eq 0 ]; then + ${fwcmd} add pass ipv6-icmp from any to any icmp6type 128,129 + fi # Allow "mandatory" ICMP in. ${fwcmd} add pass icmp from any to any icmptype 3,4,11 @@ -361,6 +491,9 @@ case ${firewall_type} in for i in ${firewall_allowservices} ; do for j in ${firewall_myservices} ; do ${fwcmd} add pass tcp from $i to me $j + if [ $ipv6_available -eq 0 ]; then + ${fwcmd} add pass tcp from $i to me6 $j + fi done done @@ -370,7 +503,10 @@ case ${firewall_type} in for i in ${firewall_trusted} ; do ${fwcmd} add pass ip from $i to me done - + for i in ${firewall_trusted_ipv6} ; do + ${fwcmd} add pass all from $i to me6 + done + ${fwcmd} add 65000 count ip from any to any # Drop packets to ports where we don't want logging From owner-svn-src-head@FreeBSD.ORG Wed Dec 2 15:20:31 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D36FE1065693; Wed, 2 Dec 2009 15:20:31 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C1C4F8FC13; Wed, 2 Dec 2009 15:20:31 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nB2FKV5A021090; Wed, 2 Dec 2009 15:20:31 GMT (envelope-from luigi@svn.freebsd.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nB2FKVLd021088; Wed, 2 Dec 2009 15:20:31 GMT (envelope-from luigi@svn.freebsd.org) Message-Id: <200912021520.nB2FKVLd021088@svn.freebsd.org> From: Luigi Rizzo Date: Wed, 2 Dec 2009 15:20:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200029 - head/sys/netinet/ipfw X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Dec 2009 15:20:31 -0000 Author: luigi Date: Wed Dec 2 15:20:31 2009 New Revision: 200029 URL: http://svn.freebsd.org/changeset/base/200029 Log: small changes for portability and diff reduction wrt/ FreeBSD 7. No functional differences. - use the div64() macro to wrap 64 bit divisions (which almost always are 64 / 32 bits) so they are easier to handle with compilers or OS that do not have native support for 64bit divisions; - use a local variable for p_numbytes even if not strictly necessary on HEAD, as it reduces diffs with FreeBSD7 - in dummynet_send() check that a tag is present before dereferencing the pointer. - add a couple of blank lines for readability near the end of a function MFC after: 3 days Modified: head/sys/netinet/ipfw/ip_dummynet.c Modified: head/sys/netinet/ipfw/ip_dummynet.c ============================================================================== --- head/sys/netinet/ipfw/ip_dummynet.c Wed Dec 2 15:05:26 2009 (r200028) +++ head/sys/netinet/ipfw/ip_dummynet.c Wed Dec 2 15:20:31 2009 (r200029) @@ -570,7 +570,7 @@ compute_extra_bits(struct mbuf *pkt, str if (!p->samples || p->samples_no == 0) return 0; index = random() % p->samples_no; - extra_bits = ((dn_key)p->samples[index] * p->bandwidth) / 1000; + extra_bits = div64((dn_key)p->samples[index] * p->bandwidth, 1000); if (index >= p->loss_level) { struct dn_pkt_tag *dt = dn_tag_get(pkt); if (dt) @@ -696,11 +696,20 @@ ready_event_wfq(struct dn_pipe *p, struc int p_was_empty = (p->head == NULL); struct dn_heap *sch = &(p->scheduler_heap); struct dn_heap *neh = &(p->not_eligible_heap); + int64_t p_numbytes = p->numbytes; + + /* + * p->numbytes is only 32bits in FBSD7, but we might need 64 bits. + * Use a local variable for the computations, and write back the + * results when done, saturating if needed. + * The local variable has no impact on performance and helps + * reducing diffs between the various branches. + */ DUMMYNET_LOCK_ASSERT(); if (p->if_name[0] == 0) /* tx clock is simulated */ - p->numbytes += (curr_time - p->sched_time) * p->bandwidth; + p_numbytes += (curr_time - p->sched_time) * p->bandwidth; else { /* * tx clock is for real, * the ifq must be empty or this is a NOP. @@ -717,7 +726,7 @@ ready_event_wfq(struct dn_pipe *p, struc * While we have backlogged traffic AND credit, we need to do * something on the queue. */ - while (p->numbytes >= 0 && (sch->elements > 0 || neh->elements > 0)) { + while (p_numbytes >= 0 && (sch->elements > 0 || neh->elements > 0)) { if (sch->elements > 0) { /* Have some eligible pkts to send out. */ struct dn_flow_queue *q = sch->p[0].object; @@ -727,10 +736,10 @@ ready_event_wfq(struct dn_pipe *p, struc int len_scaled = p->bandwidth ? len * 8 * hz : 0; heap_extract(sch, NULL); /* Remove queue from heap. */ - p->numbytes -= len_scaled; + p_numbytes -= len_scaled; move_pkt(pkt, q, p, len); - p->V += (len << MY_M) / p->sum; /* Update V. */ + p->V += div64((len << MY_M), p->sum); /* Update V. */ q->S = q->F; /* Update start time. */ if (q->len == 0) { /* Flow not backlogged any more. */ @@ -745,7 +754,7 @@ ready_event_wfq(struct dn_pipe *p, struc * (we will fix this later). */ len = (q->head)->m_pkthdr.len; - q->F += (len << MY_M) / (uint64_t)fs->weight; + q->F += div64((len << MY_M), fs->weight); if (DN_KEY_LEQ(q->S, p->V)) heap_insert(neh, q->S, q); else @@ -768,11 +777,11 @@ ready_event_wfq(struct dn_pipe *p, struc } if (p->if_name[0] != '\0') { /* Tx clock is from a real thing */ - p->numbytes = -1; /* Mark not ready for I/O. */ + p_numbytes = -1; /* Mark not ready for I/O. */ break; } } - if (sch->elements == 0 && neh->elements == 0 && p->numbytes >= 0) { + if (sch->elements == 0 && neh->elements == 0 && p_numbytes >= 0) { p->idle_time = curr_time; /* * No traffic and no events scheduled. @@ -798,11 +807,11 @@ ready_event_wfq(struct dn_pipe *p, struc * If we are under credit, schedule the next ready event. * Also fix the delivery time of the last packet. */ - if (p->if_name[0]==0 && p->numbytes < 0) { /* This implies bw > 0. */ + if (p->if_name[0]==0 && p_numbytes < 0) { /* This implies bw > 0. */ dn_key t = 0; /* Number of ticks i have to wait. */ if (p->bandwidth > 0) - t = (p->bandwidth - 1 - p->numbytes) / p->bandwidth; + t = div64(p->bandwidth - 1 - p_numbytes, p->bandwidth); dn_tag_get(p->tail)->output_time += t; p->sched_time = curr_time; heap_insert(&wfq_ready_heap, curr_time + t, (void *)p); @@ -812,6 +821,9 @@ ready_event_wfq(struct dn_pipe *p, struc */ } + /* Write back p_numbytes (adjust 64->32bit if necessary). */ + p->numbytes = p_numbytes; + /* * If the delay line was empty call transmit_event() now. * Otherwise, the scheduler will take care of it. @@ -938,12 +950,20 @@ dummynet_send(struct mbuf *m) struct dn_pkt_tag *pkt; struct mbuf *n; struct ip *ip; + int dst; for (; m != NULL; m = n) { n = m->m_nextpkt; m->m_nextpkt = NULL; - pkt = dn_tag_get(m); - switch (pkt->dn_dir) { + if (m_tag_first(m) == NULL) { + pkt = NULL; /* probably unnecessary */ + dst = DN_TO_DROP; + } else { + pkt = dn_tag_get(m); + dst = pkt->dn_dir; + } + + switch (dst) { case DN_TO_IP_OUT: ip_output(m, NULL, NULL, IP_FORWARDING, NULL, NULL); break ; @@ -1218,7 +1238,8 @@ red_drops(struct dn_flow_set *fs, struct * XXX check wraps... */ if (q->avg) { - u_int t = (curr_time - q->idle_time) / fs->lookup_step; + u_int t = div64(curr_time - q->idle_time, + fs->lookup_step); q->avg = (t < fs->lookup_depth) ? SCALE_MUL(q->avg, fs->w_q_lookup[t]) : 0; @@ -1258,7 +1279,7 @@ red_drops(struct dn_flow_set *fs, struct } if (fs->flags_fs & DN_QSIZE_IS_BYTES) - p_b = (p_b * len) / fs->max_pkt_size; + p_b = div64(p_b * len, fs->max_pkt_size); if (++q->count == 0) q->random = random() & 0xffff; else { @@ -1475,7 +1496,7 @@ dummynet_io(struct mbuf **m0, int dir, s heap_extract(&(pipe->idle_heap), q); q->S = MAX64(q->F, pipe->V); } - q->F = q->S + (len << MY_M) / (uint64_t)fs->weight; + q->F = q->S + div64(len << MY_M, fs->weight); if (pipe->not_eligible_heap.elements == 0 && pipe->scheduler_heap.elements == 0) @@ -2245,8 +2266,10 @@ ip_dn_ctl(struct sockopt *sopt) error = delete_pipe(p); break ; } + if (p != NULL) free(p, M_TEMP); + return error ; } From owner-svn-src-head@FreeBSD.ORG Wed Dec 2 15:33:34 2009 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B99D5106566B; Wed, 2 Dec 2009 15:33:34 +0000 (UTC) (envelope-from scf@FreeBSD.org) Received: from mail.farley.org (mail.farley.org [IPv6:2001:470:1f0f:20:2::11]) by mx1.freebsd.org (Postfix) with ESMTP id 72FE48FC19; Wed, 2 Dec 2009 15:33:34 +0000 (UTC) Received: from thor.farley.org (HPooka@thor.farley.org [IPv6:2001:470:1f0f:20:1::5]) by mail.farley.org (8.14.3/8.14.3) with ESMTP id nB2FXTqC032102; Wed, 2 Dec 2009 09:33:30 -0600 (CST) (envelope-from scf@FreeBSD.org) Date: Wed, 2 Dec 2009 09:33:29 -0600 (CST) From: "Sean C. Farley" To: "M. Warner Losh" In-Reply-To: <20091201.193518.387188323.imp@bsdimp.com> Message-ID: References: <200912010504.nB154VnS053167@svn.freebsd.org> <4B14B32C.3060409@freebsd.org> <20091201.193518.387188323.imp@bsdimp.com> User-Agent: Alpine 2.00 (BSF 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Spam-Status: No, score=-2.6 required=4.0 tests=BAYES_00,NO_RELAYS autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on mail.farley.org Cc: green@FreeBSD.org, src-committers@FreeBSD.org, svn-src-all@FreeBSD.org, rwatson@FreeBSD.org, cperciva@FreeBSD.org, svn-src-head@FreeBSD.org Subject: Re: svn commit: r199983 - in head: lib/libc/stdlib tools/regression/environ X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Dec 2009 15:33:34 -0000 On Tue, 1 Dec 2009, M. Warner Losh wrote: > In message: > Robert Watson writes: > : On Mon, 30 Nov 2009, Colin Percival wrote: > : > : > Brian Feldman wrote: > : >> Do not gratuitously fail *env(3) operations due to corrupt ('='-less) > : >> **environ entries. This puts non-getenv(3) operations in line with > : >> getenv(3) in that bad environ entries do not cause all operations to > : >> fail. There is still some inconsistency in that getenv(3) in the > : >> absence of any environment-modifying operation does not emit corrupt > : >> environ entry warnings. > : >> > : >> I also fixed another inconsistency in getenv(3) where updating the > : >> global environ pointer would not be reflected in the return values. > : >> It would have taken an intermediary setenv(3)/putenv(3)/unsetenv(3) > : >> in order to see the change. > : > > : > The FreeBSD Security Team is currently dealing with a security > : > issue relating to this code. Please back out your change (at > : > least to getenv.c; I don't particularly care about the regression > : > tests) until we've finished, and then submit the patch to us for > : > review along with a detailed explanation of what it does. > : > > : > We've already had two major security issues arising out of > : > getenv.c in the past year, and I'd like to make sure we don't have > : > a third. > : > : I think it's fair to say that the POSIXization of the environment > : code has been an unmitigated disaster, and speaks to the necessity > : for careful review of those sorts of code changes. > > Why we're not just reverting the whole thing as a bad idea is beyond > me. Clearly the tiny incremental benefits have been far overshadowed > by this fiasco. Which "whole thing"? The code or the POSIX-compliance? Technically, it is not pure compliance because the code has a few BSD requirements in it such as keeping old name=value entries even when new ones are created. It was my fault for not checking how unsetenv() was used in all of base. The change to use unsetenv() in rtld.c was committed just prior to my change which introduced a version of unsetenv() that returned an int to allow checking. I am testing a change to have unsetenv() not stop in its attempt to unset a variable which should mimic the old behavior. One difference between our man page and IEEE Std 1003.1-2008 is the part concerning that the "environment shall be unchanged" which I will introduce to the man page: Upon successful completion, zero shall be returned. Otherwise, -1 shall be returned, errno set to indicate the error, and the environment shall be unchanged. After my change, unsetenv() will not return an error if environ is corrupt. It will wipe the variable. The only time errors will be returned are when the name passed to unsetenv() is invalid or when memory allocation fails. One question is whether the code should abort() when it detects a corrupt environ array or do its best to complete the request from the caller. Sean -- scf@FreeBSD.org From owner-svn-src-head@FreeBSD.ORG Wed Dec 2 15:45:55 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 91FA6106566B; Wed, 2 Dec 2009 15:45:55 +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 7F5668FC19; Wed, 2 Dec 2009 15:45:55 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nB2FjtMI024715; Wed, 2 Dec 2009 15:45:55 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nB2FjtQ0024710; Wed, 2 Dec 2009 15:45:55 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <200912021545.nB2FjtQ0024710@svn.freebsd.org> From: Andriy Gapon Date: Wed, 2 Dec 2009 15:45:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200033 - in head/sys: amd64/amd64 amd64/include i386/i386 i386/include X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Dec 2009 15:45:55 -0000 Author: avg Date: Wed Dec 2 15:45:55 2009 New Revision: 200033 URL: http://svn.freebsd.org/changeset/base/200033 Log: mca: improve status checking, recording and reporting - directly print mca information in case we fail to allocate memory for a record - include bank number into mca record - print raw mca status value for extended information Reviewed by: jhb MFC after: 10 days Modified: head/sys/amd64/amd64/mca.c head/sys/amd64/include/mca.h head/sys/i386/i386/mca.c head/sys/i386/include/mca.h Modified: head/sys/amd64/amd64/mca.c ============================================================================== --- head/sys/amd64/amd64/mca.c Wed Dec 2 15:34:13 2009 (r200032) +++ head/sys/amd64/amd64/mca.c Wed Dec 2 15:45:55 2009 (r200033) @@ -117,48 +117,6 @@ sysctl_mca_records(SYSCTL_HANDLER_ARGS) return (SYSCTL_OUT(req, &record, sizeof(record))); } -static struct mca_record * -mca_record_entry(int bank) -{ - struct mca_internal *rec; - uint64_t status; - u_int p[4]; - - status = rdmsr(MSR_MC_STATUS(bank)); - if (!(status & MC_STATUS_VAL)) - return (NULL); - - rec = malloc(sizeof(*rec), M_MCA, M_NOWAIT | M_ZERO); - if (rec == NULL) { - printf("MCA: Unable to allocate space for an event.\n"); - return (NULL); - } - - /* Save exception information. */ - rec->rec.mr_status = status; - if (status & MC_STATUS_ADDRV) - rec->rec.mr_addr = rdmsr(MSR_MC_ADDR(bank)); - if (status & MC_STATUS_MISCV) - rec->rec.mr_misc = rdmsr(MSR_MC_MISC(bank)); - rec->rec.mr_tsc = rdtsc(); - rec->rec.mr_apic_id = PCPU_GET(apic_id); - - /* - * Clear machine check. Don't do this for uncorrectable - * errors so that the BIOS can see them. - */ - if (!(rec->rec.mr_status & (MC_STATUS_PCC | MC_STATUS_UC))) { - wrmsr(MSR_MC_STATUS(bank), 0); - do_cpuid(0, p); - } - - mtx_lock_spin(&mca_lock); - STAILQ_INSERT_TAIL(&mca_records, rec, link); - mca_count++; - mtx_unlock_spin(&mca_lock); - return (&rec->rec); -} - static const char * mca_error_ttype(uint16_t mca_error) { @@ -219,11 +177,13 @@ mca_error_request(uint16_t mca_error) } /* Dump details about a single machine check. */ -static void -mca_log(struct mca_record *rec) +static void __nonnull(1) +mca_log(const struct mca_record *rec) { uint16_t mca_error; + printf("MCA: bank %d, status 0x%016llx\n", rec->mr_bank, + (long long)rec->mr_status); printf("MCA: CPU %d ", rec->mr_apic_id); if (rec->mr_status & MC_STATUS_UC) printf("UNCOR "); @@ -329,6 +289,59 @@ mca_log(struct mca_record *rec) printf("MCA: Address 0x%llx\n", (long long)rec->mr_addr); } +static int __nonnull(2) +mca_check_status(int bank, struct mca_record *rec) +{ + uint64_t status; + u_int p[4]; + + status = rdmsr(MSR_MC_STATUS(bank)); + if (!(status & MC_STATUS_VAL)) + return (0); + + /* Save exception information. */ + rec->mr_status = status; + rec->mr_bank = bank; + rec->mr_addr = 0; + if (status & MC_STATUS_ADDRV) + rec->mr_addr = rdmsr(MSR_MC_ADDR(bank)); + rec->mr_misc = 0; + if (status & MC_STATUS_MISCV) + rec->mr_misc = rdmsr(MSR_MC_MISC(bank)); + rec->mr_tsc = rdtsc(); + rec->mr_apic_id = PCPU_GET(apic_id); + + /* + * Clear machine check. Don't do this for uncorrectable + * errors so that the BIOS can see them. + */ + if (!(rec->mr_status & (MC_STATUS_PCC | MC_STATUS_UC))) { + wrmsr(MSR_MC_STATUS(bank), 0); + do_cpuid(0, p); + } + return (1); +} + +static void __nonnull(1) +mca_record_entry(const struct mca_record *record) +{ + struct mca_internal *rec; + + rec = malloc(sizeof(*rec), M_MCA, M_NOWAIT); + if (rec == NULL) { + printf("MCA: Unable to allocate space for an event.\n"); + mca_log(record); + return; + } + + rec->rec = *record; + rec->logged = 0; + mtx_lock_spin(&mca_lock); + STAILQ_INSERT_TAIL(&mca_records, rec, link); + mca_count++; + mtx_unlock_spin(&mca_lock); +} + /* * This scans all the machine check banks of the current CPU to see if * there are any machine checks. Any non-recoverable errors are @@ -341,7 +354,7 @@ mca_log(struct mca_record *rec) static int mca_scan(int mcip) { - struct mca_record *rec; + struct mca_record rec; uint64_t mcg_cap, ucmask; int count, i, recoverable; @@ -354,13 +367,13 @@ mca_scan(int mcip) ucmask |= MC_STATUS_OVER; mcg_cap = rdmsr(MSR_MCG_CAP); for (i = 0; i < (mcg_cap & MCG_CAP_COUNT); i++) { - rec = mca_record_entry(i); - if (rec != NULL) { + if (mca_check_status(i, &rec)) { count++; - if (rec->mr_status & ucmask) { + if (rec.mr_status & ucmask) { recoverable = 0; - mca_log(rec); + mca_log(&rec); } + mca_record_entry(&rec); } } return (mcip ? recoverable : count); Modified: head/sys/amd64/include/mca.h ============================================================================== --- head/sys/amd64/include/mca.h Wed Dec 2 15:34:13 2009 (r200032) +++ head/sys/amd64/include/mca.h Wed Dec 2 15:45:55 2009 (r200033) @@ -36,6 +36,7 @@ struct mca_record { uint64_t mr_misc; uint64_t mr_tsc; int mr_apic_id; + int mr_bank; }; #ifdef _KERNEL Modified: head/sys/i386/i386/mca.c ============================================================================== --- head/sys/i386/i386/mca.c Wed Dec 2 15:34:13 2009 (r200032) +++ head/sys/i386/i386/mca.c Wed Dec 2 15:45:55 2009 (r200033) @@ -117,48 +117,6 @@ sysctl_mca_records(SYSCTL_HANDLER_ARGS) return (SYSCTL_OUT(req, &record, sizeof(record))); } -static struct mca_record * -mca_record_entry(int bank) -{ - struct mca_internal *rec; - uint64_t status; - u_int p[4]; - - status = rdmsr(MSR_MC_STATUS(bank)); - if (!(status & MC_STATUS_VAL)) - return (NULL); - - rec = malloc(sizeof(*rec), M_MCA, M_NOWAIT | M_ZERO); - if (rec == NULL) { - printf("MCA: Unable to allocate space for an event.\n"); - return (NULL); - } - - /* Save exception information. */ - rec->rec.mr_status = status; - if (status & MC_STATUS_ADDRV) - rec->rec.mr_addr = rdmsr(MSR_MC_ADDR(bank)); - if (status & MC_STATUS_MISCV) - rec->rec.mr_misc = rdmsr(MSR_MC_MISC(bank)); - rec->rec.mr_tsc = rdtsc(); - rec->rec.mr_apic_id = PCPU_GET(apic_id); - - /* - * Clear machine check. Don't do this for uncorrectable - * errors so that the BIOS can see them. - */ - if (!(rec->rec.mr_status & (MC_STATUS_PCC | MC_STATUS_UC))) { - wrmsr(MSR_MC_STATUS(bank), 0); - do_cpuid(0, p); - } - - mtx_lock_spin(&mca_lock); - STAILQ_INSERT_TAIL(&mca_records, rec, link); - mca_count++; - mtx_unlock_spin(&mca_lock); - return (&rec->rec); -} - static const char * mca_error_ttype(uint16_t mca_error) { @@ -219,11 +177,13 @@ mca_error_request(uint16_t mca_error) } /* Dump details about a single machine check. */ -static void -mca_log(struct mca_record *rec) +static void __nonnull(1) +mca_log(const struct mca_record *rec) { uint16_t mca_error; + printf("MCA: bank %d, status 0x%016llx\n", rec->mr_bank, + (long long)rec->mr_status); printf("MCA: CPU %d ", rec->mr_apic_id); if (rec->mr_status & MC_STATUS_UC) printf("UNCOR "); @@ -329,6 +289,59 @@ mca_log(struct mca_record *rec) printf("MCA: Address 0x%llx\n", (long long)rec->mr_addr); } +static int __nonnull(2) +mca_check_status(int bank, struct mca_record *rec) +{ + uint64_t status; + u_int p[4]; + + status = rdmsr(MSR_MC_STATUS(bank)); + if (!(status & MC_STATUS_VAL)) + return (0); + + /* Save exception information. */ + rec->mr_status = status; + rec->mr_bank = bank; + rec->mr_addr = 0; + if (status & MC_STATUS_ADDRV) + rec->mr_addr = rdmsr(MSR_MC_ADDR(bank)); + rec->mr_misc = 0; + if (status & MC_STATUS_MISCV) + rec->mr_misc = rdmsr(MSR_MC_MISC(bank)); + rec->mr_tsc = rdtsc(); + rec->mr_apic_id = PCPU_GET(apic_id); + + /* + * Clear machine check. Don't do this for uncorrectable + * errors so that the BIOS can see them. + */ + if (!(rec->mr_status & (MC_STATUS_PCC | MC_STATUS_UC))) { + wrmsr(MSR_MC_STATUS(bank), 0); + do_cpuid(0, p); + } + return (1); +} + +static void __nonnull(1) +mca_record_entry(const struct mca_record *record) +{ + struct mca_internal *rec; + + rec = malloc(sizeof(*rec), M_MCA, M_NOWAIT); + if (rec == NULL) { + printf("MCA: Unable to allocate space for an event.\n"); + mca_log(record); + return; + } + + rec->rec = *record; + rec->logged = 0; + mtx_lock_spin(&mca_lock); + STAILQ_INSERT_TAIL(&mca_records, rec, link); + mca_count++; + mtx_unlock_spin(&mca_lock); +} + /* * This scans all the machine check banks of the current CPU to see if * there are any machine checks. Any non-recoverable errors are @@ -341,7 +354,7 @@ mca_log(struct mca_record *rec) static int mca_scan(int mcip) { - struct mca_record *rec; + struct mca_record rec; uint64_t mcg_cap, ucmask; int count, i, recoverable; @@ -354,13 +367,13 @@ mca_scan(int mcip) ucmask |= MC_STATUS_OVER; mcg_cap = rdmsr(MSR_MCG_CAP); for (i = 0; i < (mcg_cap & MCG_CAP_COUNT); i++) { - rec = mca_record_entry(i); - if (rec != NULL) { + if (mca_check_status(i, &rec)) { count++; - if (rec->mr_status & ucmask) { + if (rec.mr_status & ucmask) { recoverable = 0; - mca_log(rec); + mca_log(&rec); } + mca_record_entry(&rec); } } return (mcip ? recoverable : count); Modified: head/sys/i386/include/mca.h ============================================================================== --- head/sys/i386/include/mca.h Wed Dec 2 15:34:13 2009 (r200032) +++ head/sys/i386/include/mca.h Wed Dec 2 15:45:55 2009 (r200033) @@ -36,6 +36,7 @@ struct mca_record { uint64_t mr_misc; uint64_t mr_tsc; int mr_apic_id; + int mr_bank; }; #ifdef _KERNEL From owner-svn-src-head@FreeBSD.ORG Wed Dec 2 15:50:43 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 74B601065672; Wed, 2 Dec 2009 15:50:43 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 63CE48FC1A; Wed, 2 Dec 2009 15:50:43 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nB2FohFn025395; Wed, 2 Dec 2009 15:50:43 GMT (envelope-from luigi@svn.freebsd.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nB2FohaR025393; Wed, 2 Dec 2009 15:50:43 GMT (envelope-from luigi@svn.freebsd.org) Message-Id: <200912021550.nB2FohaR025393@svn.freebsd.org> From: Luigi Rizzo Date: Wed, 2 Dec 2009 15:50:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200034 - head/sys/netinet X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Dec 2009 15:50:43 -0000 Author: luigi Date: Wed Dec 2 15:50:43 2009 New Revision: 200034 URL: http://svn.freebsd.org/changeset/base/200034 Log: Dispatch sockopt calls to ipfw and dummynet using the new option numbers, IP_FW3 and IP_DUMMYNET3. Right now the modules return an error if called with those arguments so there is no danger of unwanted behaviour. MFC after: 3 days Modified: head/sys/netinet/raw_ip.c Modified: head/sys/netinet/raw_ip.c ============================================================================== --- head/sys/netinet/raw_ip.c Wed Dec 2 15:45:55 2009 (r200033) +++ head/sys/netinet/raw_ip.c Wed Dec 2 15:50:43 2009 (r200034) @@ -535,6 +535,7 @@ rip_ctloutput(struct socket *so, struct error = sooptcopyout(sopt, &optval, sizeof optval); break; + case IP_FW3: /* generic ipfw v.3 functions */ case IP_FW_ADD: /* ADD actually returns the body... */ case IP_FW_GET: case IP_FW_TABLE_GETSIZE: @@ -547,6 +548,7 @@ rip_ctloutput(struct socket *so, struct error = ENOPROTOOPT; break; + case IP_DUMMYNET3: /* generic dummynet v.3 functions */ case IP_DUMMYNET_GET: if (ip_dn_ctl_ptr != NULL) error = ip_dn_ctl_ptr(sopt); @@ -592,6 +594,7 @@ rip_ctloutput(struct socket *so, struct inp->inp_flags &= ~INP_HDRINCL; break; + case IP_FW3: /* generic ipfw v.3 functions */ case IP_FW_ADD: case IP_FW_DEL: case IP_FW_FLUSH: @@ -608,6 +611,7 @@ rip_ctloutput(struct socket *so, struct error = ENOPROTOOPT; break; + case IP_DUMMYNET3: /* generic dummynet v.3 functions */ case IP_DUMMYNET_CONFIGURE: case IP_DUMMYNET_DEL: case IP_DUMMYNET_FLUSH: From owner-svn-src-head@FreeBSD.ORG Wed Dec 2 15:56:19 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3326D106566B; Wed, 2 Dec 2009 15:56:19 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 227B78FC15; Wed, 2 Dec 2009 15:56:19 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nB2FuJPZ026186; Wed, 2 Dec 2009 15:56:19 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nB2FuJLp026184; Wed, 2 Dec 2009 15:56:19 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <200912021556.nB2FuJLp026184@svn.freebsd.org> From: Ed Schouten Date: Wed, 2 Dec 2009 15:56:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200035 - head/lib/libutil X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Dec 2009 15:56:19 -0000 Author: ed Date: Wed Dec 2 15:56:18 2009 New Revision: 200035 URL: http://svn.freebsd.org/changeset/base/200035 Log: Make work when included by itself. There are several reasons why it didn't work: - It was missing for __BEGIN_DECLS. - It uses various primitive types that were not declared. Modified: head/lib/libutil/libutil.h Modified: head/lib/libutil/libutil.h ============================================================================== --- head/lib/libutil/libutil.h Wed Dec 2 15:50:43 2009 (r200034) +++ head/lib/libutil/libutil.h Wed Dec 2 15:56:18 2009 (r200035) @@ -39,6 +39,34 @@ #ifndef _LIBUTIL_H_ #define _LIBUTIL_H_ +#include +#include + +#ifndef _GID_T_DECLARED +typedef __gid_t gid_t; +#define _GID_T_DECLARED +#endif + +#ifndef _INT64_T_DECLARED +typedef __int64_t int64_t; +#define _INT64_T_DECLARED +#endif + +#ifndef _PID_T_DECLARED +typedef __pid_t pid_t; +#define _PID_T_DECLARED +#endif + +#ifndef _SIZE_T_DECLARED +typedef __size_t size_t; +#define _SIZE_T_DECLARED +#endif + +#ifndef _UID_T_DECLARED +typedef __uid_t uid_t; +#define _UID_T_DECLARED +#endif + #define PROPERTY_MAX_NAME 64 #define PROPERTY_MAX_VALUE 512 From owner-svn-src-head@FreeBSD.ORG Wed Dec 2 16:08:33 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id ACFDC106566B; Wed, 2 Dec 2009 16:08:33 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9B7608FC13; Wed, 2 Dec 2009 16:08:33 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nB2G8XXD027893; Wed, 2 Dec 2009 16:08:33 GMT (envelope-from scottl@svn.freebsd.org) Received: (from scottl@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nB2G8Xop027891; Wed, 2 Dec 2009 16:08:33 GMT (envelope-from scottl@svn.freebsd.org) Message-Id: <200912021608.nB2G8Xop027891@svn.freebsd.org> From: Scott Long Date: Wed, 2 Dec 2009 16:08:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200036 - head/sys/cam/scsi X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Dec 2009 16:08:33 -0000 Author: scottl Date: Wed Dec 2 16:08:33 2009 New Revision: 200036 URL: http://svn.freebsd.org/changeset/base/200036 Log: Fix several cases where the periph lock was held over malloc. Submitted by: Jaakko Heinonen Modified: head/sys/cam/scsi/scsi_cd.c Modified: head/sys/cam/scsi/scsi_cd.c ============================================================================== --- head/sys/cam/scsi/scsi_cd.c Wed Dec 2 15:56:18 2009 (r200035) +++ head/sys/cam/scsi/scsi_cd.c Wed Dec 2 16:08:33 2009 (r200036) @@ -2673,12 +2673,10 @@ cdioctl(struct disk *dp, u_long cmd, voi authinfo = (struct dvd_authinfo *)addr; - cam_periph_lock(periph); if (cmd == DVDIOCREPORTKEY) error = cdreportkey(periph, authinfo); else error = cdsendkey(periph, authinfo); - cam_periph_unlock(periph); break; } case DVDIOCREADSTRUCTURE: { @@ -2686,9 +2684,7 @@ cdioctl(struct disk *dp, u_long cmd, voi dvdstruct = (struct dvd_struct *)addr; - cam_periph_lock(periph); error = cdreaddvdstructure(periph, dvdstruct); - cam_periph_unlock(periph); break; } @@ -3732,8 +3728,6 @@ cdreportkey(struct cam_periph *periph, s databuf = NULL; lba = 0; - ccb = cdgetccb(periph, CAM_PRIORITY_NORMAL); - switch (authinfo->format) { case DVD_REPORT_AGID: length = sizeof(struct scsi_report_key_data_agid); @@ -3759,9 +3753,7 @@ cdreportkey(struct cam_periph *periph, s length = 0; break; default: - error = EINVAL; - goto bailout; - break; /* NOTREACHED */ + return (EINVAL); } if (length != 0) { @@ -3769,6 +3761,8 @@ cdreportkey(struct cam_periph *periph, s } else databuf = NULL; + cam_periph_lock(periph); + ccb = cdgetccb(periph, CAM_PRIORITY_NORMAL); scsi_report_key(&ccb->csio, /* retries */ 1, @@ -3869,12 +3863,14 @@ cdreportkey(struct cam_periph *periph, s goto bailout; break; /* NOTREACHED */ } + bailout: + xpt_release_ccb(ccb); + cam_periph_unlock(periph); + if (databuf != NULL) free(databuf, M_DEVBUF); - xpt_release_ccb(ccb); - return(error); } @@ -3889,8 +3885,6 @@ cdsendkey(struct cam_periph *periph, str error = 0; databuf = NULL; - ccb = cdgetccb(periph, CAM_PRIORITY_NORMAL); - switch(authinfo->format) { case DVD_SEND_CHALLENGE: { struct scsi_report_key_data_challenge *challenge_data; @@ -3942,11 +3936,12 @@ cdsendkey(struct cam_periph *periph, str break; } default: - error = EINVAL; - goto bailout; - break; /* NOTREACHED */ + return (EINVAL); } + cam_periph_lock(periph); + ccb = cdgetccb(periph, CAM_PRIORITY_NORMAL); + scsi_send_key(&ccb->csio, /* retries */ 1, /* cbfcnp */ cddone, @@ -3961,13 +3956,12 @@ cdsendkey(struct cam_periph *periph, str error = cdrunccb(ccb, cderror, /*cam_flags*/CAM_RETRY_SELTO, /*sense_flags*/SF_RETRY_UA); -bailout: + xpt_release_ccb(ccb); + cam_periph_unlock(periph); if (databuf != NULL) free(databuf, M_DEVBUF); - xpt_release_ccb(ccb); - return(error); } @@ -3985,8 +3979,6 @@ cdreaddvdstructure(struct cam_periph *pe /* The address is reserved for many of the formats */ address = 0; - ccb = cdgetccb(periph, CAM_PRIORITY_NORMAL); - switch(dvdstruct->format) { case DVD_STRUCT_PHYSICAL: length = sizeof(struct scsi_read_dvd_struct_data_physical); @@ -4004,13 +3996,7 @@ cdreaddvdstructure(struct cam_periph *pe length = sizeof(struct scsi_read_dvd_struct_data_manufacturer); break; case DVD_STRUCT_CMI: - error = ENODEV; - goto bailout; -#ifdef notyet - length = sizeof(struct scsi_read_dvd_struct_data_copy_manage); - address = dvdstruct->address; -#endif - break; /* NOTREACHED */ + return (ENODEV); case DVD_STRUCT_PROTDISCID: length = sizeof(struct scsi_read_dvd_struct_data_prot_discid); break; @@ -4027,21 +4013,9 @@ cdreaddvdstructure(struct cam_periph *pe length = sizeof(struct scsi_read_dvd_struct_data_spare_area); break; case DVD_STRUCT_RMD_LAST: - error = ENODEV; - goto bailout; -#ifdef notyet - length = sizeof(struct scsi_read_dvd_struct_data_rmd_borderout); - address = dvdstruct->address; -#endif - break; /* NOTREACHED */ + return (ENODEV); case DVD_STRUCT_RMD_RMA: - error = ENODEV; - goto bailout; -#ifdef notyet - length = sizeof(struct scsi_read_dvd_struct_data_rmd); - address = dvdstruct->address; -#endif - break; /* NOTREACHED */ + return (ENODEV); case DVD_STRUCT_PRERECORDED: length = sizeof(struct scsi_read_dvd_struct_data_leadin); break; @@ -4049,13 +4023,7 @@ cdreaddvdstructure(struct cam_periph *pe length = sizeof(struct scsi_read_dvd_struct_data_disc_id); break; case DVD_STRUCT_DCB: - error = ENODEV; - goto bailout; -#ifdef notyet - length = sizeof(struct scsi_read_dvd_struct_data_dcb); - address = dvdstruct->address; -#endif - break; /* NOTREACHED */ + return (ENODEV); case DVD_STRUCT_LIST: /* * This is the maximum allocation length for the READ DVD @@ -4067,9 +4035,7 @@ cdreaddvdstructure(struct cam_periph *pe length = 65535; break; default: - error = EINVAL; - goto bailout; - break; /* NOTREACHED */ + return (EINVAL); } if (length != 0) { @@ -4077,6 +4043,9 @@ cdreaddvdstructure(struct cam_periph *pe } else databuf = NULL; + cam_periph_lock(periph); + ccb = cdgetccb(periph, CAM_PRIORITY_NORMAL); + scsi_read_dvd_structure(&ccb->csio, /* retries */ 1, /* cbfcnp */ cddone, @@ -4164,13 +4133,14 @@ cdreaddvdstructure(struct cam_periph *pe min(sizeof(dvdstruct->data), dvdstruct->length)); break; } + bailout: + xpt_release_ccb(ccb); + cam_periph_unlock(periph); if (databuf != NULL) free(databuf, M_DEVBUF); - xpt_release_ccb(ccb); - return(error); } From owner-svn-src-head@FreeBSD.ORG Wed Dec 2 16:09:14 2009 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 86E361065695; Wed, 2 Dec 2009 16:09:14 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from harmony.bsdimp.com (bsdimp.com [199.45.160.85]) by mx1.freebsd.org (Postfix) with ESMTP id 13A4F8FC14; Wed, 2 Dec 2009 16:09:13 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by harmony.bsdimp.com (8.14.3/8.14.1) with ESMTP id nB2G5B1a086738; Wed, 2 Dec 2009 09:05:11 -0700 (MST) (envelope-from imp@bsdimp.com) Date: Wed, 02 Dec 2009 09:05:29 -0700 (MST) Message-Id: <20091202.090529.1219863310.imp@bsdimp.com> To: kostikbel@gmail.com From: "M. Warner Losh" In-Reply-To: <20091202132904.GH2368@deviant.kiev.zoral.com.ua> References: <200911261349.nAQDnco2083469@svn.freebsd.org> <200912021926.02346.fluffy@fluffy.khv.ru> <20091202132904.GH2368@deviant.kiev.zoral.com.ua> X-Mailer: Mew version 5.2 on Emacs 21.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: fluffy@fluffy.khv.ru, svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, cvs-all@FreeBSD.org Subject: Re: svn commit: r199827 - in head: include lib/libc/compat-43 sys/sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Dec 2009 16:09:14 -0000 In message: <20091202132904.GH2368@deviant.kiev.zoral.com.ua> Kostik Belousov writes: : On Wed, Dec 02, 2009 at 07:25:56PM +1000, Dima Panov wrote: : > On Thursday 26 November 2009 23:49:38 Konstantin Belousov wrote: : > > Author: kib : > > Date: Thu Nov 26 13:49:37 2009 : > > New Revision: 199827 : > > URL: http://svn.freebsd.org/changeset/base/199827 : > > : > > Log: : > > Implement sighold, sigignore, sigpause, sigrelse, sigset functions : > > from SUSv4 XSI. Note that the functions are obsoleted, and only : > > provided to ease porting from System V-like systems. Since sigpause : > > already exists in compat with different interface, XSI sigpause is : > > named xsi_sigpause. : > > : > > Reviewed by: davidxu : > > MFC after: 3 weeks : > > : > > Modified: : > > head/include/signal.h : > > head/lib/libc/compat-43/Makefile.inc : > > head/lib/libc/compat-43/Symbol.map : > > head/lib/libc/compat-43/sigcompat.c : > > head/lib/libc/compat-43/sigpause.2 : > > head/sys/sys/signal.h : > > head/sys/sys/signalvar.h : > : > kib, you forgot about osversion bump, it is strongly needed. : No. My interpretation of __FreeBSD_version is that the bump indicates : incompatible change in the interfaces. Sometime it is used to mark the : point where big changes hit the tree, possibly not related to interface : change. : : Also, __FreeBSD_version denotes the kernel "version". We do support : running earlier usermode on the later kernels. Think about kernel-only : upgrades, compatXx libs and jails which can run arbitrary earlier : usermode. (The change in question is purely libc). : : Said this, I think it is actually harmful practice to bump : __FreeBSD_version after API additions or feature implementation. : : I can bump version for this case, but due to the above reason, : it would not make much sense. In the past, __FreeBSD_version has been used to expose changes in interfaces (both plus, minus and delta) that are necessary for the entire system. Adding an interface definitely qualifies because this is a build-time issue, not a run time one. Unfortunately, __FreeBSD_version has also been used to force kernel recompiles lately since it is encoded in the kernel modules. Despite this, it isn't just for kernels... Warner : > This changeset caused jdk (may be not only jdk) breakage, as jdk-bsd-patches : > always provide own implementations of sigingnore() for FreeBSD. : > : > Patch for jdk16 port will be ready soon. : : Ok, thanks for working on this. From owner-svn-src-head@FreeBSD.ORG Wed Dec 2 16:26:19 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 35913106568D; Wed, 2 Dec 2009 16:26:19 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 245C28FC1B; Wed, 2 Dec 2009 16:26:19 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nB2GQJJg030297; Wed, 2 Dec 2009 16:26:19 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nB2GQIKZ030295; Wed, 2 Dec 2009 16:26:18 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <200912021626.nB2GQIKZ030295@svn.freebsd.org> From: John Baldwin Date: Wed, 2 Dec 2009 16:26:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200037 - head/sys/dev/if_ndis X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Dec 2009 16:26:19 -0000 Author: jhb Date: Wed Dec 2 16:26:18 2009 New Revision: 200037 URL: http://svn.freebsd.org/changeset/base/200037 Log: ndis_scan_results() can sleep if the scan results are not ready when ndis_scan() is called. However, ndis_scan() is invoked from softclock() and cannot sleep. Move ndis_scan_results() to the ndis' driver's scan_end hook instead. Submitted by: Paul B Mahol onemda of gmail MFC after: 1 week Modified: head/sys/dev/if_ndis/if_ndis.c Modified: head/sys/dev/if_ndis/if_ndis.c ============================================================================== --- head/sys/dev/if_ndis/if_ndis.c Wed Dec 2 16:08:33 2009 (r200036) +++ head/sys/dev/if_ndis/if_ndis.c Wed Dec 2 16:26:18 2009 (r200037) @@ -3222,14 +3222,8 @@ ndis_newstate(struct ieee80211vap *vap, static void ndis_scan(void *arg) { - struct ndis_softc *sc = arg; - struct ieee80211com *ic; - struct ieee80211vap *vap; - - ic = sc->ifp->if_l2com; - vap = TAILQ_FIRST(&ic->ic_vaps); + struct ieee80211vap *vap = arg; - ndis_scan_results(sc); ieee80211_scan_done(vap); } @@ -3377,7 +3371,7 @@ ndis_scan_start(struct ieee80211com *ic) return; } /* Set a timer to collect the results */ - callout_reset(&sc->ndis_scan_callout, hz * 3, ndis_scan, sc); + callout_reset(&sc->ndis_scan_callout, hz * 3, ndis_scan, vap); } static void @@ -3401,5 +3395,7 @@ ndis_scan_mindwell(struct ieee80211_scan static void ndis_scan_end(struct ieee80211com *ic) { - /* ignore */ + struct ndis_softc *sc = ic->ic_ifp->if_softc; + + ndis_scan_results(sc); } From owner-svn-src-head@FreeBSD.ORG Wed Dec 2 16:34:21 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 58567106566B; Wed, 2 Dec 2009 16:34:21 +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 441768FC08; Wed, 2 Dec 2009 16:34:21 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nB2GYLVP031409; Wed, 2 Dec 2009 16:34:21 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nB2GYLSq031398; Wed, 2 Dec 2009 16:34:21 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <200912021634.nB2GYLSq031398@svn.freebsd.org> From: Konstantin Belousov Date: Wed, 2 Dec 2009 16:34:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200038 - in head: contrib/gcc/config lib/csu/amd64 lib/csu/arm lib/csu/i386-elf lib/csu/ia64 lib/csu/mips lib/csu/powerpc lib/csu/sparc64 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Dec 2009 16:34:21 -0000 Author: kib Date: Wed Dec 2 16:34:20 2009 New Revision: 200038 URL: http://svn.freebsd.org/changeset/base/200038 Log: Properly support -fPIE by linking PIE binaries with specially-built Scrt1.o instead of crt1.o, since the later is built as non-PIC. Separate i386-elf crt1.c into the pure assembler part and C code, supplying all data extracted by assembler stub as explicit parameters [1]. Hide and localize _start1 symbol used as an interface between asm and C code. In collaboration with: kan Inspired by: PR i386/127387 [1] Prodded and tested by: rdivacky [1] MFC after: 3 weeks Added: head/lib/csu/i386-elf/crt1_c.c - copied, changed from r200027, head/lib/csu/i386-elf/crt1.c head/lib/csu/i386-elf/crt1_s.S (contents, props changed) Deleted: head/lib/csu/i386-elf/crt1.c Modified: head/contrib/gcc/config/freebsd-spec.h head/lib/csu/amd64/Makefile head/lib/csu/arm/Makefile head/lib/csu/i386-elf/Makefile head/lib/csu/ia64/Makefile head/lib/csu/mips/Makefile head/lib/csu/powerpc/Makefile head/lib/csu/sparc64/Makefile Modified: head/contrib/gcc/config/freebsd-spec.h ============================================================================== --- head/contrib/gcc/config/freebsd-spec.h Wed Dec 2 16:26:18 2009 (r200037) +++ head/contrib/gcc/config/freebsd-spec.h Wed Dec 2 16:34:20 2009 (r200038) @@ -103,9 +103,10 @@ Boston, MA 02110-1301, USA. */ %{p:gcrt1.o%s} \ %{!p: \ %{profile:gcrt1.o%s} \ - %{!profile:crt1.o%s}}}} \ + %{!profile: \ + %{pie: Scrt1.o%s;:crt1.o%s}}}}} \ crti.o%s \ - %{static:crtbeginT.o%s;shared:crtbeginS.o%s;:crtbegin.o%s}" + %{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbegin.o%s}" /* Provide an ENDFILE_SPEC appropriate for FreeBSD/i386. Here we tack on our own magical crtend.o file (see crtstuff.c) which provides part of @@ -113,8 +114,7 @@ Boston, MA 02110-1301, USA. */ entering `main', followed by the normal "finalizer" file, `crtn.o'. */ #define FBSD_ENDFILE_SPEC "\ - %{!shared:crtend.o%s} \ - %{shared:crtendS.o%s} \ + %{shared|pie:crtendS.o%s;:crtend.o%s} \ crtn.o%s " /* Provide a LIB_SPEC appropriate for FreeBSD as configured and as Modified: head/lib/csu/amd64/Makefile ============================================================================== --- head/lib/csu/amd64/Makefile Wed Dec 2 16:26:18 2009 (r200037) +++ head/lib/csu/amd64/Makefile Wed Dec 2 16:34:20 2009 (r200038) @@ -4,7 +4,7 @@ SRCS= crt1.c crti.S crtn.S OBJS= ${SRCS:N*.h:R:S/$/.o/g} -OBJS+= gcrt1.o +OBJS+= Scrt1.o gcrt1.o CFLAGS+= -I${.CURDIR}/../common \ -I${.CURDIR}/../../libc/include CFLAGS+= -fno-omit-frame-pointer @@ -16,6 +16,9 @@ CLEANFILES= ${OBJS} gcrt1.o: crt1.c ${CC} ${CFLAGS} -DGCRT -c -o gcrt1.o ${.CURDIR}/crt1.c +Scrt1.o: crt1.c + ${CC} ${CFLAGS} -fPIC -DPIC -c -o Scrt1.o ${.CURDIR}/crt1.c + realinstall: ${INSTALL} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \ ${OBJS} ${DESTDIR}${LIBDIR} Modified: head/lib/csu/arm/Makefile ============================================================================== --- head/lib/csu/arm/Makefile Wed Dec 2 16:26:18 2009 (r200037) +++ head/lib/csu/arm/Makefile Wed Dec 2 16:34:20 2009 (r200038) @@ -4,7 +4,7 @@ SRCS= crt1.c crti.S crtn.S OBJS= ${SRCS:N*.h:R:S/$/.o/g} -OBJS+= gcrt1.o +OBJS+= Scrt1.o gcrt1.o CFLAGS+= -Wall -Wno-unused \ -I${.CURDIR}/../common \ -I${.CURDIR}/../../libc/include @@ -16,6 +16,9 @@ CLEANFILES= ${OBJS} gcrt1.o: crt1.c ${CC} ${CFLAGS} -DGCRT -c -o gcrt1.o ${.ALLSRC} +Scrt1.o: crt1.c + ${CC} ${CFLAGS} -fPIC -DPIC -c -o Scrt1.o ${.ALLSRC} + realinstall: ${INSTALL} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \ ${OBJS} ${DESTDIR}${LIBDIR} Modified: head/lib/csu/i386-elf/Makefile ============================================================================== --- head/lib/csu/i386-elf/Makefile Wed Dec 2 16:26:18 2009 (r200037) +++ head/lib/csu/i386-elf/Makefile Wed Dec 2 16:34:20 2009 (r200038) @@ -2,8 +2,8 @@ .PATH: ${.CURDIR}/../common -SRCS= crt1.c crti.S crtn.S -FILES= ${SRCS:N*.h:R:S/$/.o/g} gcrt1.o +SRCS= crti.S crtn.S +FILES= ${SRCS:N*.h:R:S/$/.o/g} gcrt1.o crt1.o Scrt1.o FILESOWN= ${LIBOWN} FILESGRP= ${LIBGRP} FILESMODE= ${LIBMODE} @@ -11,9 +11,23 @@ FILESDIR= ${LIBDIR} WARNS?= 6 CFLAGS+= -I${.CURDIR}/../common \ -I${.CURDIR}/../../libc/include -CLEANFILES= ${FILES} +CLEANFILES= ${FILES} crt1_c.o crt1_s.o gcrt1_c.o Scrt1_c.o -gcrt1.o: crt1.c - ${CC} ${CFLAGS} -DGCRT -c -o gcrt1.o ${.CURDIR}/crt1.c +gcrt1_c.o: crt1_c.c + ${CC} ${CFLAGS} -DGCRT -c -o gcrt1_c.o ${.CURDIR}/crt1_c.c + +gcrt1.o: gcrt1_c.o crt1_s.o + ${LD} ${LDFLAGS} -o gcrt1.o -r crt1_s.o gcrt1_c.o + +crt1.o: crt1_c.o crt1_s.o + ${LD} ${LDFLAGS} -o crt1.o -r crt1_s.o crt1_c.o + objcopy --localize-symbol _start1 crt1.o + +Scrt1_c.o: crt1_c.c + ${CC} ${CFLAGS} -DGCRT -fPIC -DPIC -c -o Scrt1_c.o ${.CURDIR}/crt1_c.c + +Scrt1.o: Scrt1_c.o crt1_s.o + ${LD} ${LDFLAGS} -o Scrt1.o -r crt1_s.o Scrt1_c.o + objcopy --localize-symbol _start1 Scrt1.o .include Copied and modified: head/lib/csu/i386-elf/crt1_c.c (from r200027, head/lib/csu/i386-elf/crt1.c) ============================================================================== --- head/lib/csu/i386-elf/crt1.c Wed Dec 2 14:32:01 2009 (r200027, copy source) +++ head/lib/csu/i386-elf/crt1_c.c Wed Dec 2 16:34:20 2009 (r200038) @@ -22,6 +22,8 @@ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * $FreeBSD$ */ #ifndef lint @@ -55,35 +57,15 @@ extern int etext; char **environ; const char *__progname = ""; -static __inline fptr -get_rtld_cleanup(void) -{ - fptr retval; +void _start1(fptr, int, char *[]) __dead2; -#ifdef __GNUC__ - __asm__("movl %%edx,%0" : "=rm"(retval)); -#else - retval = (fptr)0; /* XXXX Fix this for other compilers */ -#endif - return(retval); -} - -/* The entry function. */ +/* The entry function, C part. */ void -_start(char *ap, ...) +_start1(fptr cleanup, int argc, char *argv[]) { - fptr cleanup; - int argc; - char **argv; char **env; const char *s; -#ifdef __GNUC__ - __asm__("and $0xfffffff0,%esp"); -#endif - cleanup = get_rtld_cleanup(); - argv = ≈ - argc = *(long *)(void *)(argv - 1); env = argv + argc + 1; environ = env; if (argc > 0 && argv[0] != NULL) { @@ -110,4 +92,4 @@ __asm__("eprol:"); exit( main(argc, argv, env) ); } -__asm__(".ident\t\"$FreeBSD$\""); +__asm(".hidden _start1"); Added: head/lib/csu/i386-elf/crt1_s.S ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/csu/i386-elf/crt1_s.S Wed Dec 2 16:34:20 2009 (r200038) @@ -0,0 +1,44 @@ +/*- + * Copyright 2009 Konstantin Belousov. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * $FreeBSD$ + */ + + + .text + .align 4 + .globl _start + .type _start, @function +_start: xorl %ebp,%ebp + pushl %ebp + movl %esp,%ebp + andl $0xfffffff0,%esp # align stack + leal 8(%ebp),%eax + pushl %eax # argv + pushl 4(%ebp) # argc + pushl %edx # rtld cleanup + call _start1 + .size _start, . - _start + + .ident "$FreeBSD$" Modified: head/lib/csu/ia64/Makefile ============================================================================== --- head/lib/csu/ia64/Makefile Wed Dec 2 16:26:18 2009 (r200037) +++ head/lib/csu/ia64/Makefile Wed Dec 2 16:34:20 2009 (r200038) @@ -4,7 +4,7 @@ SRCS= crt1.S crti.S crtn.S OBJS= ${SRCS:N*.h:R:S/$/.o/g} -OBJS+= gcrt1.o +OBJS+= Scrt1.o gcrt1.o CFLAGS+= -Wall -Wno-unused \ -I${.CURDIR}/../common \ -I${.CURDIR}/../../libc/include @@ -16,6 +16,9 @@ CLEANFILES= ${OBJS} gcrt1.o: crt1.S ${CC} ${CFLAGS} -DGCRT -c -o gcrt1.o ${.ALLSRC} +Scrt1.o: crt1.S + ${CC} ${CFLAGS} -fPIC -DPIC -c -o Scrt1.o ${.ALLSRC} + realinstall: ${INSTALL} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \ ${OBJS} ${DESTDIR}${LIBDIR} Modified: head/lib/csu/mips/Makefile ============================================================================== --- head/lib/csu/mips/Makefile Wed Dec 2 16:26:18 2009 (r200037) +++ head/lib/csu/mips/Makefile Wed Dec 2 16:34:20 2009 (r200038) @@ -4,7 +4,7 @@ SRCS= crt1.c crti.S crtn.S OBJS= ${SRCS:N*.h:R:S/$/.o/g} -OBJS+= gcrt1.o +OBJS+= Scrt1.o gcrt1.o CFLAGS+= -Wall -Wno-unused \ -I${.CURDIR}/../common \ -I${.CURDIR}/../../libc/include @@ -16,6 +16,9 @@ CLEANFILES= ${OBJS} gcrt1.o: crt1.c ${CC} ${CFLAGS} -DGCRT -c -o gcrt1.o ${.ALLSRC} +Scrt1.o: crt1.c + ${CC} ${CFLAGS} -fPIC -DPIC -c -o Scrt1.o ${.ALLSRC} + realinstall: ${INSTALL} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \ ${OBJS} ${DESTDIR}${LIBDIR} Modified: head/lib/csu/powerpc/Makefile ============================================================================== --- head/lib/csu/powerpc/Makefile Wed Dec 2 16:26:18 2009 (r200037) +++ head/lib/csu/powerpc/Makefile Wed Dec 2 16:34:20 2009 (r200038) @@ -4,7 +4,7 @@ SRCS= crt1.c crti.S crtn.S OBJS= ${SRCS:N*.h:R:S/$/.o/g} -OBJS+= gcrt1.o +OBJS+= Scrt1.o gcrt1.o CFLAGS+= -Wall -Wno-unused \ -I${.CURDIR}/../common \ -I${.CURDIR}/../../libc/include @@ -16,6 +16,9 @@ CLEANFILES= ${OBJS} gcrt1.o: crt1.c ${CC} ${CFLAGS} -DGCRT -c -o gcrt1.o ${.ALLSRC} +Scrt1.o: crt1.c + ${CC} ${CFLAGS} -fPIC -DPIC -c -o Scrt1.o ${.ALLSRC} + realinstall: ${INSTALL} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \ ${OBJS} ${DESTDIR}${LIBDIR} Modified: head/lib/csu/sparc64/Makefile ============================================================================== --- head/lib/csu/sparc64/Makefile Wed Dec 2 16:26:18 2009 (r200037) +++ head/lib/csu/sparc64/Makefile Wed Dec 2 16:34:20 2009 (r200038) @@ -4,7 +4,7 @@ SRCS= crt1.c crti.S crtn.S OBJS= ${SRCS:N*.h:R:S/$/.o/g} -OBJS+= gcrt1.o +OBJS+= Scrt1.o gcrt1.o CFLAGS+= -I${.CURDIR}/../common -I${.CURDIR}/../../libc/include all: ${OBJS} @@ -14,6 +14,9 @@ CLEANFILES= ${OBJS} gcrt1.o: crt1.c ${CC} ${CFLAGS} -DGCRT -c -o gcrt1.o ${.ALLSRC} +Scrt1.o: crt1.c + ${CC} ${CFLAGS} -fPIC -DPIC -c -o Scrt1.o ${.ALLSRC} + realinstall: ${INSTALL} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \ ${OBJS} ${DESTDIR}${LIBDIR} From owner-svn-src-head@FreeBSD.ORG Wed Dec 2 16:40:23 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 68948106566B; Wed, 2 Dec 2009 16:40:23 +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 57CDC8FC15; Wed, 2 Dec 2009 16:40:23 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nB2GeNIL032251; Wed, 2 Dec 2009 16:40:23 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nB2GeNPL032249; Wed, 2 Dec 2009 16:40:23 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <200912021640.nB2GeNPL032249@svn.freebsd.org> From: Konstantin Belousov Date: Wed, 2 Dec 2009 16:40:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200039 - head/sys/sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Dec 2009 16:40:23 -0000 Author: kib Date: Wed Dec 2 16:40:23 2009 New Revision: 200039 URL: http://svn.freebsd.org/changeset/base/200039 Log: Bump __FreeBSD_version for sigpause(3) addition [1] and PIE support in csu. Requested by: fluffy [1] Modified: head/sys/sys/param.h Modified: head/sys/sys/param.h ============================================================================== --- head/sys/sys/param.h Wed Dec 2 16:34:20 2009 (r200038) +++ head/sys/sys/param.h Wed Dec 2 16:40:23 2009 (r200039) @@ -58,7 +58,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 900002 /* Master, propagated to newvers */ +#define __FreeBSD_version 900003 /* Master, propagated to newvers */ #ifndef LOCORE #include From owner-svn-src-head@FreeBSD.ORG Wed Dec 2 17:16:07 2009 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1A5191065693; Wed, 2 Dec 2009 17:16:07 +0000 (UTC) (envelope-from green@green.homeunix.org) Received: from green.homeunix.org (green.homeunix.org [66.92.150.152]) by mx1.freebsd.org (Postfix) with ESMTP id C9F338FC13; Wed, 2 Dec 2009 17:16:06 +0000 (UTC) Received: from green.homeunix.org (green@localhost [127.0.0.1]) by green.homeunix.org (8.14.3/8.14.1) with ESMTP id nB2HG4vO050740; Wed, 2 Dec 2009 12:16:04 -0500 (EST) (envelope-from green@green.homeunix.org) Received: (from green@localhost) by green.homeunix.org (8.14.3/8.14.3/Submit) id nB2HG4Wn050739; Wed, 2 Dec 2009 12:16:04 -0500 (EST) (envelope-from green) Date: Wed, 2 Dec 2009 12:16:03 -0500 From: Brian Fundakowski Feldman To: "Sean C. Farley" Message-ID: <20091202171603.GE35660@green.homeunix.org> References: <200912010504.nB154VnS053167@svn.freebsd.org> <4B14B32C.3060409@freebsd.org> <20091201.193518.387188323.imp@bsdimp.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.17 (2007-11-01) Cc: src-committers@FreeBSD.org, svn-src-all@FreeBSD.org, rwatson@FreeBSD.org, cperciva@FreeBSD.org, svn-src-head@FreeBSD.org, "M. Warner Losh" Subject: Re: svn commit: r199983 - in head: lib/libc/stdlib tools/regression/environ X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Dec 2009 17:16:07 -0000 On Wed, Dec 02, 2009 at 09:33:29AM -0600, Sean C. Farley wrote: > On Tue, 1 Dec 2009, M. Warner Losh wrote: > >> In message: >> Robert Watson writes: >> : On Mon, 30 Nov 2009, Colin Percival wrote: >> : >> : > Brian Feldman wrote: >> : >> Do not gratuitously fail *env(3) operations due to corrupt ('='-less) >> : >> **environ entries. This puts non-getenv(3) operations in line with >> : >> getenv(3) in that bad environ entries do not cause all operations to >> : >> fail. There is still some inconsistency in that getenv(3) in the >> : >> absence of any environment-modifying operation does not emit corrupt >> : >> environ entry warnings. >> : >> >> : >> I also fixed another inconsistency in getenv(3) where updating the >> : >> global environ pointer would not be reflected in the return values. >> : >> It would have taken an intermediary setenv(3)/putenv(3)/unsetenv(3) >> : >> in order to see the change. >> : > >> : > The FreeBSD Security Team is currently dealing with a security : > >> issue relating to this code. Please back out your change (at : > least to >> getenv.c; I don't particularly care about the regression : > tests) until >> we've finished, and then submit the patch to us for : > review along with >> a detailed explanation of what it does. >> : > >> : > We've already had two major security issues arising out of : > >> getenv.c in the past year, and I'd like to make sure we don't have : > a >> third. >> : >> : I think it's fair to say that the POSIXization of the environment : code >> has been an unmitigated disaster, and speaks to the necessity : for >> careful review of those sorts of code changes. >> >> Why we're not just reverting the whole thing as a bad idea is beyond me. >> Clearly the tiny incremental benefits have been far overshadowed by this >> fiasco. > > Which "whole thing"? The code or the POSIX-compliance? Technically, it is > not pure compliance because the code has a few BSD requirements in it such > as keeping old name=value entries even when new ones are created. > > It was my fault for not checking how unsetenv() was used in all of base. > The change to use unsetenv() in rtld.c was committed just prior to my > change which introduced a version of unsetenv() that returned an int to > allow checking. > > I am testing a change to have unsetenv() not stop in its attempt to unset a > variable which should mimic the old behavior. > > One difference between our man page and IEEE Std 1003.1-2008 is the part > concerning that the "environment shall be unchanged" which I will introduce > to the man page: > > Upon successful completion, zero shall be returned. Otherwise, -1 > shall be returned, errno set to indicate the error, and the > environment shall be unchanged. > > After my change, unsetenv() will not return an error if environ is corrupt. > It will wipe the variable. The only time errors will be returned are when > the name passed to unsetenv() is invalid or when memory allocation fails. > > One question is whether the code should abort() when it detects a corrupt > environ array or do its best to complete the request from the caller. The consensus seems to be that either of those two behaviors is okay. I lean more heavily toward repairing environ and moving on because it seems likely that as often as not, *env(3) will not occur immediately after (unintentional) environ corruption and abort() won't make debugging much easier, only make lives harder. Of course, we could also see what Solaris, Linux, NetBSD and friends do... Using abort() and assert() against data provided directly by the user (that is, data that is not supposed to be already "owned" by the library) is somewhat evil. It annoys me to no end as a developer when libraries do that (one of the guiltiest examples being libdbus.) -- Brian Fundakowski Feldman \'[ FreeBSD ]''''''''''\ <> green@FreeBSD.org \ The Power to Serve! \ Opinions expressed are my own. \,,,,,,,,,,,,,,,,,,,,,,\ From owner-svn-src-head@FreeBSD.ORG Wed Dec 2 17:50:53 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 72F5E10656C8; Wed, 2 Dec 2009 17:50:53 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 47A508FC1E; Wed, 2 Dec 2009 17:50:53 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nB2HorNN044996; Wed, 2 Dec 2009 17:50:53 GMT (envelope-from luigi@svn.freebsd.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nB2HorZ2044994; Wed, 2 Dec 2009 17:50:53 GMT (envelope-from luigi@svn.freebsd.org) Message-Id: <200912021750.nB2HorZ2044994@svn.freebsd.org> From: Luigi Rizzo Date: Wed, 2 Dec 2009 17:50:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200040 - head/sys/netinet/ipfw X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Dec 2009 17:50:53 -0000 Author: luigi Date: Wed Dec 2 17:50:52 2009 New Revision: 200040 URL: http://svn.freebsd.org/changeset/base/200040 Log: - initialize src_ip in the main loop to prevent a compiler warning (gcc 4.x under linux, not sure how real is the complaint). - rename a macro argument to prevent name clashes. - add the macro name on a couple of #endif - add a blank line for readability. MFC after: 3 days Modified: head/sys/netinet/ipfw/ip_fw2.c Modified: head/sys/netinet/ipfw/ip_fw2.c ============================================================================== --- head/sys/netinet/ipfw/ip_fw2.c Wed Dec 2 16:40:23 2009 (r200039) +++ head/sys/netinet/ipfw/ip_fw2.c Wed Dec 2 17:50:52 2009 (r200040) @@ -186,6 +186,7 @@ SYSCTL_INT(_net_inet_ip_fw, OID_AUTO, de &default_to_accept, 0, "Make the default rule accept all packets."); TUNABLE_INT("net.inet.ip.fw.default_to_accept", &default_to_accept); + #ifdef INET6 SYSCTL_DECL(_net_inet6_ip6); SYSCTL_NODE(_net_inet6_ip6, OID_AUTO, fw, CTLFLAG_RW, 0, "Firewall"); @@ -195,8 +196,9 @@ SYSCTL_VNET_PROC(_net_inet6_ip6_fw, OID_ SYSCTL_VNET_INT(_net_inet6_ip6_fw, OID_AUTO, deny_unknown_exthdrs, CTLFLAG_RW | CTLFLAG_SECURE, &VNET_NAME(fw_deny_unknown_exthdrs), 0, "Deny packets with unknown IPv6 Extension Headers"); -#endif -#endif +#endif /* INET6 */ + +#endif /* SYSCTL_NODE */ /* * Description of dynamic rules. @@ -2260,6 +2262,7 @@ ipfw_chk(struct ip_fw_args *args) return (IP_FW_PASS); /* accept */ dst_ip.s_addr = 0; /* make sure it is initialized */ + src_ip.s_addr = 0; /* make sure it is initialized */ pktlen = m->m_pkthdr.len; args->f_id.fib = M_GETFIB(m); /* note mbuf not altered) */ proto = args->f_id.proto = 0; /* mark f_id invalid */ @@ -2271,15 +2274,15 @@ ipfw_chk(struct ip_fw_args *args) * pointer might become stale after other pullups (but we never use it * this way). */ -#define PULLUP_TO(len, p, T) \ +#define PULLUP_TO(_len, p, T) \ do { \ - int x = (len) + sizeof(T); \ + int x = (_len) + sizeof(T); \ if ((m)->m_len < x) { \ args->m = m = m_pullup(m, x); \ if (m == NULL) \ goto pullup_failed; \ } \ - p = (mtod(m, char *) + (len)); \ + p = (mtod(m, char *) + (_len)); \ } while (0) /* From owner-svn-src-head@FreeBSD.ORG Wed Dec 2 18:09:22 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7ADDF106566B; Wed, 2 Dec 2009 18:09:22 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 699278FC19; Wed, 2 Dec 2009 18:09:22 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nB2I9Mkb049581; Wed, 2 Dec 2009 18:09:22 GMT (envelope-from trasz@svn.freebsd.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nB2I9MKt049579; Wed, 2 Dec 2009 18:09:22 GMT (envelope-from trasz@svn.freebsd.org) Message-Id: <200912021809.nB2I9MKt049579@svn.freebsd.org> From: Edward Tomasz Napierala Date: Wed, 2 Dec 2009 18:09:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200041 - head/sys/fs/portalfs X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Dec 2009 18:09:22 -0000 Author: trasz Date: Wed Dec 2 18:09:22 2009 New Revision: 200041 URL: http://svn.freebsd.org/changeset/base/200041 Log: Don't use ap->a_td->td_ucred when we were passed ap->a_cred. Modified: head/sys/fs/portalfs/portal_vnops.c Modified: head/sys/fs/portalfs/portal_vnops.c ============================================================================== --- head/sys/fs/portalfs/portal_vnops.c Wed Dec 2 17:50:52 2009 (r200040) +++ head/sys/fs/portalfs/portal_vnops.c Wed Dec 2 18:09:22 2009 (r200041) @@ -246,7 +246,7 @@ portal_open(ap) /* * Create a new socket. */ - error = socreate(AF_UNIX, &so, SOCK_STREAM, 0, ap->a_td->td_ucred, + error = socreate(AF_UNIX, &so, SOCK_STREAM, 0, ap->a_cred, ap->a_td); if (error) goto bad; From owner-svn-src-head@FreeBSD.ORG Wed Dec 2 18:11:14 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A81321065670; Wed, 2 Dec 2009 18:11:14 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 96C1B8FC08; Wed, 2 Dec 2009 18:11:14 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nB2IBE3X050110; Wed, 2 Dec 2009 18:11:14 GMT (envelope-from trasz@svn.freebsd.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nB2IBEx8050108; Wed, 2 Dec 2009 18:11:14 GMT (envelope-from trasz@svn.freebsd.org) Message-Id: <200912021811.nB2IBEx8050108@svn.freebsd.org> From: Edward Tomasz Napierala Date: Wed, 2 Dec 2009 18:11:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200042 - head/share/man/man9 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Dec 2009 18:11:14 -0000 Author: trasz Date: Wed Dec 2 18:11:14 2009 New Revision: 200042 URL: http://svn.freebsd.org/changeset/base/200042 Log: Add missing parameter description. Modified: head/share/man/man9/VOP_OPENCLOSE.9 Modified: head/share/man/man9/VOP_OPENCLOSE.9 ============================================================================== --- head/share/man/man9/VOP_OPENCLOSE.9 Wed Dec 2 18:09:22 2009 (r200041) +++ head/share/man/man9/VOP_OPENCLOSE.9 Wed Dec 2 18:11:14 2009 (r200042) @@ -28,7 +28,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 5, 2007 +.Dd December 2, 2009 .Os .Dt VOP_OPEN 9 .Sh NAME @@ -55,6 +55,8 @@ The arguments are: The vnode of the file. .It Fa mode The access mode required by the calling process. +.It Fa cred +The caller's credentials. .It Fa td The thread which is accessing the file. .It Fa fp From owner-svn-src-head@FreeBSD.ORG Wed Dec 2 19:11:54 2009 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9C6CF1065693; Wed, 2 Dec 2009 19:11:54 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from harmony.bsdimp.com (bsdimp.com [199.45.160.85]) by mx1.freebsd.org (Postfix) with ESMTP id 4C7E58FC27; Wed, 2 Dec 2009 19:11:54 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by harmony.bsdimp.com (8.14.3/8.14.1) with ESMTP id nB2J3HNJ089051; Wed, 2 Dec 2009 12:03:17 -0700 (MST) (envelope-from imp@bsdimp.com) Date: Wed, 02 Dec 2009 12:03:36 -0700 (MST) Message-Id: <20091202.120336.-491321773.imp@bsdimp.com> To: scf@FreeBSD.org From: "M. Warner Losh" In-Reply-To: References: <20091201.193518.387188323.imp@bsdimp.com> X-Mailer: Mew version 5.2 on Emacs 21.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: green@FreeBSD.org, src-committers@FreeBSD.org, svn-src-all@FreeBSD.org, rwatson@FreeBSD.org, cperciva@FreeBSD.org, svn-src-head@FreeBSD.org Subject: Re: svn commit: r199983 - in head: lib/libc/stdlib tools/regression/environ X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Dec 2009 19:11:54 -0000 In message: "Sean C. Farley" writes: : On Tue, 1 Dec 2009, M. Warner Losh wrote: : : > In message: : > Robert Watson writes: : > : On Mon, 30 Nov 2009, Colin Percival wrote: : > : : > : > Brian Feldman wrote: : > : >> Do not gratuitously fail *env(3) operations due to corrupt ('='-less) : > : >> **environ entries. This puts non-getenv(3) operations in line with : > : >> getenv(3) in that bad environ entries do not cause all operations to : > : >> fail. There is still some inconsistency in that getenv(3) in the : > : >> absence of any environment-modifying operation does not emit corrupt : > : >> environ entry warnings. : > : >> : > : >> I also fixed another inconsistency in getenv(3) where updating the : > : >> global environ pointer would not be reflected in the return values. : > : >> It would have taken an intermediary setenv(3)/putenv(3)/unsetenv(3) : > : >> in order to see the change. : > : > : > : > The FreeBSD Security Team is currently dealing with a security : > : > issue relating to this code. Please back out your change (at : > : > least to getenv.c; I don't particularly care about the regression : > : > tests) until we've finished, and then submit the patch to us for : > : > review along with a detailed explanation of what it does. : > : > : > : > We've already had two major security issues arising out of : > : > getenv.c in the past year, and I'd like to make sure we don't have : > : > a third. : > : : > : I think it's fair to say that the POSIXization of the environment : > : code has been an unmitigated disaster, and speaks to the necessity : > : for careful review of those sorts of code changes. : > : > Why we're not just reverting the whole thing as a bad idea is beyond : > me. Clearly the tiny incremental benefits have been far overshadowed : > by this fiasco. : : Which "whole thing"? The code or the POSIX-compliance? Technically, it : is not pure compliance because the code has a few BSD requirements in it : such as keeping old name=value entries even when new ones are created. I'm calling for something fairly radical: Go back to the code that was working before and abandon all this POSIX code. If someone wants to reimplement it correctly, securely and audits the system to prove it, then it can go back in. We've had two black eyes from the current code and I have little confidence that all the subtle problems have been resolved with it. My gut tells me there are more lurking, although that can be hard to quantify into an actionable item. I don't think there's much support for this position, so the next best thing is what consensus appears to be calling for: fix the current code in a fail-safe manner. Warner From owner-svn-src-head@FreeBSD.ORG Wed Dec 2 20:24:37 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B52D91065672; Wed, 2 Dec 2009 20:24:37 +0000 (UTC) (envelope-from marcel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A46088FC0C; Wed, 2 Dec 2009 20:24:37 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nB2KObiY088617; Wed, 2 Dec 2009 20:24:37 GMT (envelope-from marcel@svn.freebsd.org) Received: (from marcel@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nB2KOblx088615; Wed, 2 Dec 2009 20:24:37 GMT (envelope-from marcel@svn.freebsd.org) Message-Id: <200912022024.nB2KOblx088615@svn.freebsd.org> From: Marcel Moolenaar Date: Wed, 2 Dec 2009 20:24:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200045 - head/sys/dev/iir X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Dec 2009 20:24:37 -0000 Author: marcel Date: Wed Dec 2 20:24:37 2009 New Revision: 200045 URL: http://svn.freebsd.org/changeset/base/200045 Log: Include , to get the declarations of ostype and osrelease. Remove the duplicate declarations from this file. Modified: head/sys/dev/iir/iir_ctrl.c Modified: head/sys/dev/iir/iir_ctrl.c ============================================================================== --- head/sys/dev/iir/iir_ctrl.c Wed Dec 2 19:30:33 2009 (r200044) +++ head/sys/dev/iir/iir_ctrl.c Wed Dec 2 20:24:37 2009 (r200045) @@ -51,6 +51,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -83,8 +84,6 @@ static int iir_devsw_installed = 0; static int sdev_made = 0; #endif extern int gdt_cnt; -extern char ostype[]; -extern char osrelease[]; extern gdt_statist_t gdt_stat; /* From owner-svn-src-head@FreeBSD.ORG Wed Dec 2 21:22:10 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E9568106568F; Wed, 2 Dec 2009 21:22:10 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D56458FC17; Wed, 2 Dec 2009 21:22:10 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nB2LMAtm013570; Wed, 2 Dec 2009 21:22:10 GMT (envelope-from thompsa@svn.freebsd.org) Received: (from thompsa@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nB2LMAab013567; Wed, 2 Dec 2009 21:22:10 GMT (envelope-from thompsa@svn.freebsd.org) Message-Id: <200912022122.nB2LMAab013567@svn.freebsd.org> From: Andrew Thompson Date: Wed, 2 Dec 2009 21:22:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200046 - in head/sys: i386/conf pc98/conf X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Dec 2009 21:22:11 -0000 Author: thompsa Date: Wed Dec 2 21:22:10 2009 New Revision: 200046 URL: http://svn.freebsd.org/changeset/base/200046 Log: Fix cut'n paste on the AR9280 entry. Submitted by: pluknet Modified: head/sys/i386/conf/NOTES head/sys/pc98/conf/NOTES Modified: head/sys/i386/conf/NOTES ============================================================================== --- head/sys/i386/conf/NOTES Wed Dec 2 20:24:37 2009 (r200045) +++ head/sys/i386/conf/NOTES Wed Dec 2 21:22:10 2009 (r200046) @@ -579,7 +579,7 @@ device ath_hal # pci/cardbus chip supp #device ath_ar5416 # AR5416 chips options AH_SUPPORT_AR5416 # enable AR5416 tx/rx descriptors #device ath_ar9160 # AR9160 chips -#device ath_ar9280 # AR9160 chips +#device ath_ar9280 # AR9280 chips device ath_rate_sample # SampleRate tx rate control for ath device ce device cp Modified: head/sys/pc98/conf/NOTES ============================================================================== --- head/sys/pc98/conf/NOTES Wed Dec 2 20:24:37 2009 (r200045) +++ head/sys/pc98/conf/NOTES Wed Dec 2 21:22:10 2009 (r200046) @@ -433,7 +433,7 @@ device ath_hal # pci/cardbus chip supp #device ath_ar5416 # AR5416 chips options AH_SUPPORT_AR5416 # enable AR5416 tx/rx descriptors #device ath_ar9160 # AR9160 chips -#device ath_ar9280 # AR9160 chips +#device ath_ar9280 # AR9280 chips device ath_rate_sample # SampleRate tx rate control for ath # From owner-svn-src-head@FreeBSD.ORG Thu Dec 3 04:06:49 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 09728106566B; Thu, 3 Dec 2009 04:06:49 +0000 (UTC) (envelope-from marcel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E7C478FC14; Thu, 3 Dec 2009 04:06:48 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nB346mNk074751; Thu, 3 Dec 2009 04:06:48 GMT (envelope-from marcel@svn.freebsd.org) Received: (from marcel@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nB346maI074746; Thu, 3 Dec 2009 04:06:48 GMT (envelope-from marcel@svn.freebsd.org) Message-Id: <200912030406.nB346maI074746@svn.freebsd.org> From: Marcel Moolenaar Date: Thu, 3 Dec 2009 04:06:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200051 - in head/sys/ia64: ia64 include X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Dec 2009 04:06:49 -0000 Author: marcel Date: Thu Dec 3 04:06:48 2009 New Revision: 200051 URL: http://svn.freebsd.org/changeset/base/200051 Log: Make sure bus space accesses use unorder memory loads and stores. Memory accesses are posted in program order by virtue of the uncacheable memory attribute. Since GCC, by default, adds acquire and release semantics to volatile memory loads and stores, we need to use inline assembly to guarantee it. With inline assembly, we don't need volatile pointers anymore. Itanium does not support semaphore instructions to uncacheable memory. Modified: head/sys/ia64/ia64/machdep.c head/sys/ia64/include/bus.h head/sys/ia64/include/cpufunc.h head/sys/ia64/include/ia64_cpu.h Modified: head/sys/ia64/ia64/machdep.c ============================================================================== --- head/sys/ia64/ia64/machdep.c Thu Dec 3 02:19:12 2009 (r200050) +++ head/sys/ia64/ia64/machdep.c Thu Dec 3 04:06:48 2009 (r200051) @@ -919,14 +919,14 @@ ia64_init(void) return (ret); } -__volatile void * +void * ia64_ioport_address(u_int port) { uint64_t addr; addr = (port > 0xffff) ? IA64_PHYS_TO_RR6((uint64_t)port) : ia64_port_base | ((port & 0xfffc) << 10) | (port & 0xFFF); - return ((__volatile void *)addr); + return ((void *)addr); } uint64_t Modified: head/sys/ia64/include/bus.h ============================================================================== --- head/sys/ia64/include/bus.h Thu Dec 3 02:19:12 2009 (r200050) +++ head/sys/ia64/include/bus.h Thu Dec 3 04:06:48 2009 (r200051) @@ -169,37 +169,37 @@ bus_space_barrier(bus_space_tag_t bst, b static __inline uint8_t bus_space_read_1(bus_space_tag_t bst, bus_space_handle_t bsh, bus_size_t ofs) { - uint8_t __volatile *bsp; + uint8_t *bsp; bsp = (bst == IA64_BUS_SPACE_IO) ? __PIO_ADDR(bsh + ofs) : __MEMIO_ADDR(bsh + ofs); - return (*bsp); + return (ia64_ld1(bsp)); } static __inline uint16_t bus_space_read_2(bus_space_tag_t bst, bus_space_handle_t bsh, bus_size_t ofs) { - uint16_t __volatile *bsp; + uint16_t *bsp; bsp = (bst == IA64_BUS_SPACE_IO) ? __PIO_ADDR(bsh + ofs) : __MEMIO_ADDR(bsh + ofs); - return (*bsp); + return (ia64_ld2(bsp)); } static __inline uint32_t bus_space_read_4(bus_space_tag_t bst, bus_space_handle_t bsh, bus_size_t ofs) { - uint32_t __volatile *bsp; + uint32_t *bsp; bsp = (bst == IA64_BUS_SPACE_IO) ? __PIO_ADDR(bsh + ofs) : __MEMIO_ADDR(bsh + ofs); - return (*bsp); + return (ia64_ld4(bsp)); } static __inline uint64_t bus_space_read_8(bus_space_tag_t bst, bus_space_handle_t bsh, bus_size_t ofs) { - uint64_t __volatile *bsp; + uint64_t *bsp; bsp = (bst == IA64_BUS_SPACE_IO) ? __PIO_ADDR(bsh + ofs) : __MEMIO_ADDR(bsh + ofs); - return (*bsp); + return (ia64_ld8(bsp)); } @@ -212,40 +212,40 @@ static __inline void bus_space_write_1(bus_space_tag_t bst, bus_space_handle_t bsh, bus_size_t ofs, uint8_t val) { - uint8_t __volatile *bsp; + uint8_t *bsp; bsp = (bst == IA64_BUS_SPACE_IO) ? __PIO_ADDR(bsh + ofs) : __MEMIO_ADDR(bsh + ofs); - *bsp = val; + ia64_st1(bsp, val); } static __inline void bus_space_write_2(bus_space_tag_t bst, bus_space_handle_t bsh, bus_size_t ofs, uint16_t val) { - uint16_t __volatile *bsp; + uint16_t *bsp; bsp = (bst == IA64_BUS_SPACE_IO) ? __PIO_ADDR(bsh + ofs) : __MEMIO_ADDR(bsh + ofs); - *bsp = val; + ia64_st2(bsp, val); } static __inline void bus_space_write_4(bus_space_tag_t bst, bus_space_handle_t bsh, bus_size_t ofs, uint32_t val) { - uint32_t __volatile *bsp; + uint32_t *bsp; bsp = (bst == IA64_BUS_SPACE_IO) ? __PIO_ADDR(bsh + ofs) : __MEMIO_ADDR(bsh + ofs); - *bsp = val; + ia64_st4(bsp, val); } static __inline void bus_space_write_8(bus_space_tag_t bst, bus_space_handle_t bsh, bus_size_t ofs, uint64_t val) { - uint64_t __volatile *bsp; + uint64_t *bsp; bsp = (bst == IA64_BUS_SPACE_IO) ? __PIO_ADDR(bsh + ofs) : __MEMIO_ADDR(bsh + ofs); - *bsp = val; + ia64_st8(bsp, val); } @@ -258,44 +258,44 @@ static __inline void bus_space_read_multi_1(bus_space_tag_t bst, bus_space_handle_t bsh, bus_size_t ofs, uint8_t *bufp, size_t count) { - uint8_t __volatile *bsp; + uint8_t *bsp; bsp = (bst == IA64_BUS_SPACE_IO) ? __PIO_ADDR(bsh + ofs) : __MEMIO_ADDR(bsh + ofs); while (count-- > 0) - *bufp++ = *bsp; + *bufp++ = ia64_ld1(bsp); } static __inline void bus_space_read_multi_2(bus_space_tag_t bst, bus_space_handle_t bsh, bus_size_t ofs, uint16_t *bufp, size_t count) { - uint16_t __volatile *bsp; + uint16_t *bsp; bsp = (bst == IA64_BUS_SPACE_IO) ? __PIO_ADDR(bsh + ofs) : __MEMIO_ADDR(bsh + ofs); while (count-- > 0) - *bufp++ = *bsp; + *bufp++ = ia64_ld2(bsp); } static __inline void bus_space_read_multi_4(bus_space_tag_t bst, bus_space_handle_t bsh, bus_size_t ofs, uint32_t *bufp, size_t count) { - uint32_t __volatile *bsp; + uint32_t *bsp; bsp = (bst == IA64_BUS_SPACE_IO) ? __PIO_ADDR(bsh + ofs) : __MEMIO_ADDR(bsh + ofs); while (count-- > 0) - *bufp++ = *bsp; + *bufp++ = ia64_ld4(bsp); } static __inline void bus_space_read_multi_8(bus_space_tag_t bst, bus_space_handle_t bsh, bus_size_t ofs, uint64_t *bufp, size_t count) { - uint64_t __volatile *bsp; + uint64_t *bsp; bsp = (bst == IA64_BUS_SPACE_IO) ? __PIO_ADDR(bsh + ofs) : __MEMIO_ADDR(bsh + ofs); while (count-- > 0) - *bufp++ = *bsp; + *bufp++ = ia64_ld8(bsp); } @@ -308,44 +308,44 @@ static __inline void bus_space_write_multi_1(bus_space_tag_t bst, bus_space_handle_t bsh, bus_size_t ofs, const uint8_t *bufp, size_t count) { - uint8_t __volatile *bsp; + uint8_t *bsp; bsp = (bst == IA64_BUS_SPACE_IO) ? __PIO_ADDR(bsh + ofs) : __MEMIO_ADDR(bsh + ofs); while (count-- > 0) - *bsp = *bufp++; + ia64_st1(bsp, *bufp++); } static __inline void bus_space_write_multi_2(bus_space_tag_t bst, bus_space_handle_t bsh, bus_size_t ofs, const uint16_t *bufp, size_t count) { - uint16_t __volatile *bsp; + uint16_t *bsp; bsp = (bst == IA64_BUS_SPACE_IO) ? __PIO_ADDR(bsh + ofs) : __MEMIO_ADDR(bsh + ofs); while (count-- > 0) - *bsp = *bufp++; + ia64_st2(bsp, *bufp++); } static __inline void bus_space_write_multi_4(bus_space_tag_t bst, bus_space_handle_t bsh, bus_size_t ofs, const uint32_t *bufp, size_t count) { - uint32_t __volatile *bsp; + uint32_t *bsp; bsp = (bst == IA64_BUS_SPACE_IO) ? __PIO_ADDR(bsh + ofs) : __MEMIO_ADDR(bsh + ofs); while (count-- > 0) - *bsp = *bufp++; + ia64_st4(bsp, *bufp++); } static __inline void bus_space_write_multi_8(bus_space_tag_t bst, bus_space_handle_t bsh, bus_size_t ofs, const uint64_t *bufp, size_t count) { - uint64_t __volatile *bsp; + uint64_t *bsp; bsp = (bst == IA64_BUS_SPACE_IO) ? __PIO_ADDR(bsh + ofs) : __MEMIO_ADDR(bsh + ofs); while (count-- > 0) - *bsp = *bufp++; + ia64_st8(bsp, *bufp++); } @@ -359,11 +359,11 @@ static __inline void bus_space_read_region_1(bus_space_tag_t bst, bus_space_handle_t bsh, bus_size_t ofs, uint8_t *bufp, size_t count) { - uint8_t __volatile *bsp; + uint8_t *bsp; while (count-- > 0) { bsp = (bst == IA64_BUS_SPACE_IO) ? __PIO_ADDR(bsh + ofs) : __MEMIO_ADDR(bsh + ofs); - *bufp++ = *bsp; + *bufp++ = ia64_ld1(bsp); ofs += 1; } } @@ -372,11 +372,11 @@ static __inline void bus_space_read_region_2(bus_space_tag_t bst, bus_space_handle_t bsh, bus_size_t ofs, uint16_t *bufp, size_t count) { - uint16_t __volatile *bsp; + uint16_t *bsp; while (count-- > 0) { bsp = (bst == IA64_BUS_SPACE_IO) ? __PIO_ADDR(bsh + ofs) : __MEMIO_ADDR(bsh + ofs); - *bufp++ = *bsp; + *bufp++ = ia64_ld2(bsp); ofs += 2; } } @@ -385,11 +385,11 @@ static __inline void bus_space_read_region_4(bus_space_tag_t bst, bus_space_handle_t bsh, bus_size_t ofs, uint32_t *bufp, size_t count) { - uint32_t __volatile *bsp; + uint32_t *bsp; while (count-- > 0) { bsp = (bst == IA64_BUS_SPACE_IO) ? __PIO_ADDR(bsh + ofs) : __MEMIO_ADDR(bsh + ofs); - *bufp++ = *bsp; + *bufp++ = ia64_ld4(bsp); ofs += 4; } } @@ -398,11 +398,11 @@ static __inline void bus_space_read_region_8(bus_space_tag_t bst, bus_space_handle_t bsh, bus_size_t ofs, uint64_t *bufp, size_t count) { - uint64_t __volatile *bsp; + uint64_t *bsp; while (count-- > 0) { bsp = (bst == IA64_BUS_SPACE_IO) ? __PIO_ADDR(bsh + ofs) : __MEMIO_ADDR(bsh + ofs); - *bufp++ = *bsp; + *bufp++ = ia64_ld8(bsp); ofs += 8; } } @@ -418,11 +418,11 @@ static __inline void bus_space_write_region_1(bus_space_tag_t bst, bus_space_handle_t bsh, bus_size_t ofs, const uint8_t *bufp, size_t count) { - uint8_t __volatile *bsp; + uint8_t *bsp; while (count-- > 0) { bsp = (bst == IA64_BUS_SPACE_IO) ? __PIO_ADDR(bsh + ofs) : __MEMIO_ADDR(bsh + ofs); - *bsp = *bufp++; + ia64_st1(bsp, *bufp++); ofs += 1; } } @@ -431,11 +431,11 @@ static __inline void bus_space_write_region_2(bus_space_tag_t bst, bus_space_handle_t bsh, bus_size_t ofs, const uint16_t *bufp, size_t count) { - uint16_t __volatile *bsp; + uint16_t *bsp; while (count-- > 0) { bsp = (bst == IA64_BUS_SPACE_IO) ? __PIO_ADDR(bsh + ofs) : __MEMIO_ADDR(bsh + ofs); - *bsp = *bufp++; + ia64_st2(bsp, *bufp++); ofs += 2; } } @@ -444,11 +444,11 @@ static __inline void bus_space_write_region_4(bus_space_tag_t bst, bus_space_handle_t bsh, bus_size_t ofs, const uint32_t *bufp, size_t count) { - uint32_t __volatile *bsp; + uint32_t *bsp; while (count-- > 0) { bsp = (bst == IA64_BUS_SPACE_IO) ? __PIO_ADDR(bsh + ofs) : __MEMIO_ADDR(bsh + ofs); - *bsp = *bufp++; + ia64_st4(bsp, *bufp++); ofs += 4; } } @@ -457,11 +457,11 @@ static __inline void bus_space_write_region_8(bus_space_tag_t bst, bus_space_handle_t bsh, bus_size_t ofs, const uint64_t *bufp, size_t count) { - uint64_t __volatile *bsp; + uint64_t *bsp; while (count-- > 0) { bsp = (bst == IA64_BUS_SPACE_IO) ? __PIO_ADDR(bsh + ofs) : __MEMIO_ADDR(bsh + ofs); - *bsp = *bufp++; + ia64_st8(bsp, *bufp++); ofs += 8; } } @@ -476,44 +476,44 @@ static __inline void bus_space_set_multi_1(bus_space_tag_t bst, bus_space_handle_t bsh, bus_size_t ofs, uint8_t val, size_t count) { - uint8_t __volatile *bsp; + uint8_t *bsp; bsp = (bst == IA64_BUS_SPACE_IO) ? __PIO_ADDR(bsh + ofs) : __MEMIO_ADDR(bsh + ofs); while (count-- > 0) - *bsp = val; + ia64_st1(bsp, val); } static __inline void bus_space_set_multi_2(bus_space_tag_t bst, bus_space_handle_t bsh, bus_size_t ofs, uint16_t val, size_t count) { - uint16_t __volatile *bsp; + uint16_t *bsp; bsp = (bst == IA64_BUS_SPACE_IO) ? __PIO_ADDR(bsh + ofs) : __MEMIO_ADDR(bsh + ofs); while (count-- > 0) - *bsp = val; + ia64_st2(bsp, val); } static __inline void bus_space_set_multi_4(bus_space_tag_t bst, bus_space_handle_t bsh, bus_size_t ofs, uint32_t val, size_t count) { - uint32_t __volatile *bsp; + uint32_t *bsp; bsp = (bst == IA64_BUS_SPACE_IO) ? __PIO_ADDR(bsh + ofs) : __MEMIO_ADDR(bsh + ofs); while (count-- > 0) - *bsp = val; + ia64_st4(bsp, val); } static __inline void bus_space_set_multi_8(bus_space_tag_t bst, bus_space_handle_t bsh, bus_size_t ofs, uint64_t val, size_t count) { - uint64_t __volatile *bsp; + uint64_t *bsp; bsp = (bst == IA64_BUS_SPACE_IO) ? __PIO_ADDR(bsh + ofs) : __MEMIO_ADDR(bsh + ofs); while (count-- > 0) - *bsp = val; + ia64_st8(bsp, val); } @@ -527,11 +527,11 @@ static __inline void bus_space_set_region_1(bus_space_tag_t bst, bus_space_handle_t bsh, bus_size_t ofs, uint8_t val, size_t count) { - uint8_t __volatile *bsp; + uint8_t *bsp; while (count-- > 0) { bsp = (bst == IA64_BUS_SPACE_IO) ? __PIO_ADDR(bsh + ofs) : __MEMIO_ADDR(bsh + ofs); - *bsp = val; + ia64_st1(bsp, val); ofs += 1; } } @@ -540,11 +540,11 @@ static __inline void bus_space_set_region_2(bus_space_tag_t bst, bus_space_handle_t bsh, bus_size_t ofs, uint16_t val, size_t count) { - uint16_t __volatile *bsp; + uint16_t *bsp; while (count-- > 0) { bsp = (bst == IA64_BUS_SPACE_IO) ? __PIO_ADDR(bsh + ofs) : __MEMIO_ADDR(bsh + ofs); - *bsp = val; + ia64_st2(bsp, val); ofs += 2; } } @@ -553,11 +553,11 @@ static __inline void bus_space_set_region_4(bus_space_tag_t bst, bus_space_handle_t bsh, bus_size_t ofs, uint32_t val, size_t count) { - uint32_t __volatile *bsp; + uint32_t *bsp; while (count-- > 0) { bsp = (bst == IA64_BUS_SPACE_IO) ? __PIO_ADDR(bsh + ofs) : __MEMIO_ADDR(bsh + ofs); - *bsp = val; + ia64_st4(bsp, val); ofs += 4; } } @@ -566,11 +566,11 @@ static __inline void bus_space_set_region_8(bus_space_tag_t bst, bus_space_handle_t bsh, bus_size_t ofs, uint64_t val, size_t count) { - uint64_t __volatile *bsp; + uint64_t *bsp; while (count-- > 0) { bsp = (bst == IA64_BUS_SPACE_IO) ? __PIO_ADDR(bsh + ofs) : __MEMIO_ADDR(bsh + ofs); - *bsp = val; + ia64_st8(bsp, val); ofs += 8; } } @@ -588,7 +588,7 @@ bus_space_copy_region_1(bus_space_tag_t bus_size_t ofs1, bus_space_handle_t bsh2, bus_size_t ofs2, size_t count) { bus_addr_t dst, src; - uint8_t __volatile *dstp, *srcp; + uint8_t *dstp, *srcp; src = bsh1 + ofs1; dst = bsh2 + ofs2; if (dst > src) { @@ -602,7 +602,7 @@ bus_space_copy_region_1(bus_space_tag_t srcp = __MEMIO_ADDR(src); dstp = __MEMIO_ADDR(dst); } - *dstp = *srcp; + ia64_st1(dstp, ia64_ld1(srcp)); src -= 1; dst -= 1; } @@ -615,7 +615,7 @@ bus_space_copy_region_1(bus_space_tag_t srcp = __MEMIO_ADDR(src); dstp = __MEMIO_ADDR(dst); } - *dstp = *srcp; + ia64_st1(dstp, ia64_ld1(srcp)); src += 1; dst += 1; } @@ -627,7 +627,7 @@ bus_space_copy_region_2(bus_space_tag_t bus_size_t ofs1, bus_space_handle_t bsh2, bus_size_t ofs2, size_t count) { bus_addr_t dst, src; - uint16_t __volatile *dstp, *srcp; + uint16_t *dstp, *srcp; src = bsh1 + ofs1; dst = bsh2 + ofs2; if (dst > src) { @@ -641,7 +641,7 @@ bus_space_copy_region_2(bus_space_tag_t srcp = __MEMIO_ADDR(src); dstp = __MEMIO_ADDR(dst); } - *dstp = *srcp; + ia64_st2(dstp, ia64_ld2(srcp)); src -= 2; dst -= 2; } @@ -654,7 +654,7 @@ bus_space_copy_region_2(bus_space_tag_t srcp = __MEMIO_ADDR(src); dstp = __MEMIO_ADDR(dst); } - *dstp = *srcp; + ia64_st2(dstp, ia64_ld2(srcp)); src += 2; dst += 2; } @@ -666,7 +666,7 @@ bus_space_copy_region_4(bus_space_tag_t bus_size_t ofs1, bus_space_handle_t bsh2, bus_size_t ofs2, size_t count) { bus_addr_t dst, src; - uint32_t __volatile *dstp, *srcp; + uint32_t *dstp, *srcp; src = bsh1 + ofs1; dst = bsh2 + ofs2; if (dst > src) { @@ -680,7 +680,7 @@ bus_space_copy_region_4(bus_space_tag_t srcp = __MEMIO_ADDR(src); dstp = __MEMIO_ADDR(dst); } - *dstp = *srcp; + ia64_st4(dstp, ia64_ld4(srcp)); src -= 4; dst -= 4; } @@ -693,7 +693,7 @@ bus_space_copy_region_4(bus_space_tag_t srcp = __MEMIO_ADDR(src); dstp = __MEMIO_ADDR(dst); } - *dstp = *srcp; + ia64_st4(dstp, ia64_ld4(srcp)); src += 4; dst += 4; } @@ -705,7 +705,7 @@ bus_space_copy_region_8(bus_space_tag_t bus_size_t ofs1, bus_space_handle_t bsh2, bus_size_t ofs2, size_t count) { bus_addr_t dst, src; - uint64_t __volatile *dstp, *srcp; + uint64_t *dstp, *srcp; src = bsh1 + ofs1; dst = bsh2 + ofs2; if (dst > src) { @@ -719,7 +719,7 @@ bus_space_copy_region_8(bus_space_tag_t srcp = __MEMIO_ADDR(src); dstp = __MEMIO_ADDR(dst); } - *dstp = *srcp; + ia64_st8(dstp, ia64_ld8(srcp)); src -= 8; dst -= 8; } @@ -732,7 +732,7 @@ bus_space_copy_region_8(bus_space_tag_t srcp = __MEMIO_ADDR(src); dstp = __MEMIO_ADDR(dst); } - *dstp = *srcp; + ia64_st8(dstp, ia64_ld8(srcp)); src += 8; dst += 8; } Modified: head/sys/ia64/include/cpufunc.h ============================================================================== --- head/sys/ia64/include/cpufunc.h Thu Dec 3 02:19:12 2009 (r200050) +++ head/sys/ia64/include/cpufunc.h Thu Dec 3 04:06:48 2009 (r200051) @@ -54,8 +54,8 @@ breakpoint(void) #define HAVE_INLINE_FFS #define ffs(x) __builtin_ffs(x) -#define __MEMIO_ADDR(x) (__volatile void*)(IA64_PHYS_TO_RR6(x)) -extern __volatile void *ia64_ioport_address(u_int); +#define __MEMIO_ADDR(x) (void*)(IA64_PHYS_TO_RR6(x)) +extern void *ia64_ioport_address(u_int); #define __PIO_ADDR(x) ia64_ioport_address(x) /* Modified: head/sys/ia64/include/ia64_cpu.h ============================================================================== --- head/sys/ia64/include/ia64_cpu.h Thu Dec 3 02:19:12 2009 (r200050) +++ head/sys/ia64/include/ia64_cpu.h Thu Dec 3 04:06:48 2009 (r200051) @@ -282,6 +282,74 @@ ia64_ptc_l(u_int64_t va, u_int64_t log2s } /* + * Unordered memory load. + */ + +static __inline uint8_t +ia64_ld1(uint8_t *p) +{ + uint8_t v; + + __asm __volatile("ld1 %0=[%1];;" : "=r"(v) : "r"(p)); + return (v); +} + +static __inline uint16_t +ia64_ld2(uint16_t *p) +{ + uint16_t v; + + __asm __volatile("ld2 %0=[%1];;" : "=r"(v) : "r"(p)); + return (v); +} + +static __inline uint32_t +ia64_ld4(uint32_t *p) +{ + uint32_t v; + + __asm __volatile("ld4 %0=[%1];;" : "=r"(v) : "r"(p)); + return (v); +} + +static __inline uint64_t +ia64_ld8(uint64_t *p) +{ + uint64_t v; + + __asm __volatile("ld8 %0=[%1];;" : "=r"(v) : "r"(p)); + return (v); +} + +/* + * Unordered memory store. + */ + +static __inline void +ia64_st1(uint8_t *p, uint8_t v) +{ + __asm __volatile("st1 [%0]=%1;;" :: "r"(p), "r"(v)); +} + +static __inline void +ia64_st2(uint16_t *p, uint16_t v) +{ + __asm __volatile("st2 [%0]=%1;;" :: "r"(p), "r"(v)); +} + +static __inline void +ia64_st4(uint32_t *p, uint32_t v) +{ + __asm __volatile("st4 [%0]=%1;;" :: "r"(p), "r"(v)); +} + +static __inline void +ia64_st8(uint64_t *p, uint64_t v) +{ + __asm __volatile("st8 [%0]=%1;;" :: "r"(p), "r"(v)); +} + +/* * Read the value of psr. */ static __inline u_int64_t From owner-svn-src-head@FreeBSD.ORG Thu Dec 3 08:01:29 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D62B91065693; Thu, 3 Dec 2009 08:01:29 +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 C61EC8FC1A; Thu, 3 Dec 2009 08:01:29 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nB381TuW043852; Thu, 3 Dec 2009 08:01:29 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nB381Tdf043850; Thu, 3 Dec 2009 08:01:29 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <200912030801.nB381Tdf043850@svn.freebsd.org> From: Andriy Gapon Date: Thu, 3 Dec 2009 08:01:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200052 - head/sys/dev/ichsmb X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Dec 2009 08:01:29 -0000 Author: avg Date: Thu Dec 3 08:01:29 2009 New Revision: 200052 URL: http://svn.freebsd.org/changeset/base/200052 Log: ichsmb: add pci ids for some newer supported hardware Submitted by: Dmitry S. Luhtionov MFC after: 5 days Modified: head/sys/dev/ichsmb/ichsmb_pci.c Modified: head/sys/dev/ichsmb/ichsmb_pci.c ============================================================================== --- head/sys/dev/ichsmb/ichsmb_pci.c Thu Dec 3 04:06:48 2009 (r200051) +++ head/sys/dev/ichsmb/ichsmb_pci.c Thu Dec 3 08:01:29 2009 (r200052) @@ -75,6 +75,9 @@ __FBSDID("$FreeBSD$"); #define ID_82801EB 0x24D38086 #define ID_82801FB 0x266A8086 #define ID_82801GB 0x27da8086 +#define ID_82801H 0x283e8086 +#define ID_82801I 0x29308086 +#define ID_82801JI 0x3a308086 #define ID_6300ESB 0x25a48086 #define ID_631xESB 0x269b8086 @@ -152,6 +155,15 @@ ichsmb_pci_probe(device_t dev) case ID_82801GB: device_set_desc(dev, "Intel 82801GB (ICH7) SMBus controller"); break; + case ID_82801H: + device_set_desc(dev, "Intel 82801H (ICH8) SMBus controller"); + break; + case ID_82801I: + device_set_desc(dev, "Intel 82801I (ICH9) SMBus controller"); + break; + case ID_82801JI: + device_set_desc(dev, "Intel 82801JI (ICH10) SMBus controller"); + break; case ID_6300ESB: device_set_desc(dev, "Intel 6300ESB (ICH) SMBus controller"); break; From owner-svn-src-head@FreeBSD.ORG Thu Dec 3 08:11:20 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C712F106566B; Thu, 3 Dec 2009 08:11:20 +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 B6CDA8FC0C; Thu, 3 Dec 2009 08:11:20 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nB38BKwS046792; Thu, 3 Dec 2009 08:11:20 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nB38BK0h046790; Thu, 3 Dec 2009 08:11:20 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <200912030811.nB38BK0h046790@svn.freebsd.org> From: Andriy Gapon Date: Thu, 3 Dec 2009 08:11:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200053 - head/sys/dev/ichsmb X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Dec 2009 08:11:20 -0000 Author: avg Date: Thu Dec 3 08:11:20 2009 New Revision: 200053 URL: http://svn.freebsd.org/changeset/base/200053 Log: ichsmb: try attaching only to intel hardware in the default case Ideally we should attempt attaching only to known supported devices. But I am not sure that we have all supported PCI IDs already listed, and I am too young to die, err, I don't want to take the heat from causing a trouble to someone. MFC after: 1 week X-ToDo: drop the default case Modified: head/sys/dev/ichsmb/ichsmb_pci.c Modified: head/sys/dev/ichsmb/ichsmb_pci.c ============================================================================== --- head/sys/dev/ichsmb/ichsmb_pci.c Thu Dec 3 08:01:29 2009 (r200052) +++ head/sys/dev/ichsmb/ichsmb_pci.c Thu Dec 3 08:11:20 2009 (r200053) @@ -67,6 +67,7 @@ __FBSDID("$FreeBSD$"); #include /* PCI unique identifiers */ +#define VENDORID_INTEL 0x8086 #define ID_82801AA 0x24138086 #define ID_82801AB 0x24238086 #define ID_82801BA 0x24438086 @@ -171,10 +172,11 @@ ichsmb_pci_probe(device_t dev) device_set_desc(dev, "Intel 631xESB/6321ESB (ESB2) SMBus controller"); break; default: - if (pci_get_class(dev) == PCIC_SERIALBUS + if (pci_get_vendor(dev) == VENDORID_INTEL + && pci_get_class(dev) == PCIC_SERIALBUS && pci_get_subclass(dev) == PCIS_SERIALBUS_SMBUS && pci_get_progif(dev) == PCIS_SERIALBUS_SMBUS_PROGIF) { - device_set_desc(dev, "SMBus controller"); + device_set_desc(dev, "Intel SMBus controller"); return (BUS_PROBE_DEFAULT); /* XXX */ } return (ENXIO); From owner-svn-src-head@FreeBSD.ORG Thu Dec 3 09:18:41 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 31DFD10656A4; Thu, 3 Dec 2009 09:18:41 +0000 (UTC) (envelope-from cperciva@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 07A618FC1C; Thu, 3 Dec 2009 09:18:41 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nB39Iesu061830; Thu, 3 Dec 2009 09:18:40 GMT (envelope-from cperciva@svn.freebsd.org) Received: (from cperciva@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nB39IeUQ061824; Thu, 3 Dec 2009 09:18:40 GMT (envelope-from cperciva@svn.freebsd.org) Message-Id: <200912030918.nB39IeUQ061824@svn.freebsd.org> From: Colin Percival Date: Thu, 3 Dec 2009 09:18:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200054 - head/crypto/openssl/ssl head/etc/mtree head/usr.sbin/freebsd-update releng/6.3 releng/6.3/crypto/openssl/ssl releng/6.3/etc/mtree releng/6.3/usr.sbin/freebsd-update releng/6.4... X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Dec 2009 09:18:41 -0000 Author: cperciva Date: Thu Dec 3 09:18:40 2009 New Revision: 200054 URL: http://svn.freebsd.org/changeset/base/200054 Log: Disable SSL renegotiation in order to protect against a serious protocol flaw. [09:15] Correctly handle failures from unsetenv resulting from a corrupt environment in rtld-elf. [09:16] Fix permissions in freebsd-update in order to prevent leakage of sensitive files. [09:17] Approved by: so (cperciva) Security: FreeBSD-SA-09:15.ssl Security: FreeBSD-SA-09:16.rtld Security: FreeBSD-SA-09:17.freebsd-udpate Modified: head/crypto/openssl/ssl/s3_lib.c head/crypto/openssl/ssl/s3_pkt.c head/crypto/openssl/ssl/s3_srvr.c head/etc/mtree/BSD.var.dist head/usr.sbin/freebsd-update/freebsd-update.sh Changes in other areas also in this revision: Modified: releng/6.3/UPDATING releng/6.3/crypto/openssl/ssl/s3_lib.c releng/6.3/crypto/openssl/ssl/s3_pkt.c releng/6.3/crypto/openssl/ssl/s3_srvr.c releng/6.3/etc/mtree/BSD.var.dist releng/6.3/usr.sbin/freebsd-update/freebsd-update.sh releng/6.4/UPDATING releng/6.4/crypto/openssl/ssl/s3_lib.c releng/6.4/crypto/openssl/ssl/s3_pkt.c releng/6.4/crypto/openssl/ssl/s3_srvr.c releng/6.4/etc/mtree/BSD.var.dist releng/6.4/usr.sbin/freebsd-update/freebsd-update.sh releng/7.1/UPDATING releng/7.1/crypto/openssl/ssl/s3_lib.c releng/7.1/crypto/openssl/ssl/s3_pkt.c releng/7.1/crypto/openssl/ssl/s3_srvr.c releng/7.1/etc/mtree/BSD.var.dist releng/7.1/libexec/rtld-elf/rtld.c releng/7.1/usr.sbin/freebsd-update/freebsd-update.sh releng/7.2/UPDATING releng/7.2/crypto/openssl/ssl/s3_lib.c releng/7.2/crypto/openssl/ssl/s3_pkt.c releng/7.2/crypto/openssl/ssl/s3_srvr.c releng/7.2/etc/mtree/BSD.var.dist releng/7.2/libexec/rtld-elf/rtld.c releng/7.2/usr.sbin/freebsd-update/freebsd-update.sh releng/8.0/UPDATING releng/8.0/crypto/openssl/ssl/s3_lib.c releng/8.0/crypto/openssl/ssl/s3_pkt.c releng/8.0/crypto/openssl/ssl/s3_srvr.c releng/8.0/etc/mtree/BSD.var.dist releng/8.0/libexec/rtld-elf/rtld.c releng/8.0/usr.sbin/freebsd-update/freebsd-update.sh stable/6/crypto/openssl/ssl/s3_lib.c stable/6/crypto/openssl/ssl/s3_pkt.c stable/6/crypto/openssl/ssl/s3_srvr.c stable/6/etc/mtree/BSD.var.dist stable/6/usr.sbin/freebsd-update/freebsd-update.sh stable/7/crypto/openssl/ssl/s3_lib.c stable/7/crypto/openssl/ssl/s3_pkt.c stable/7/crypto/openssl/ssl/s3_srvr.c stable/7/etc/mtree/BSD.var.dist stable/7/usr.sbin/freebsd-update/freebsd-update.sh stable/8/crypto/openssl/ssl/s3_lib.c stable/8/crypto/openssl/ssl/s3_pkt.c stable/8/crypto/openssl/ssl/s3_srvr.c stable/8/etc/mtree/BSD.var.dist stable/8/usr.sbin/freebsd-update/freebsd-update.sh Modified: head/crypto/openssl/ssl/s3_lib.c ============================================================================== --- head/crypto/openssl/ssl/s3_lib.c Thu Dec 3 08:11:20 2009 (r200053) +++ head/crypto/openssl/ssl/s3_lib.c Thu Dec 3 09:18:40 2009 (r200054) @@ -2592,6 +2592,9 @@ int ssl3_renegotiate(SSL *s) if (s->s3->flags & SSL3_FLAGS_NO_RENEGOTIATE_CIPHERS) return(0); + if (1) + return(0); + s->s3->renegotiate=1; return(1); } Modified: head/crypto/openssl/ssl/s3_pkt.c ============================================================================== --- head/crypto/openssl/ssl/s3_pkt.c Thu Dec 3 08:11:20 2009 (r200053) +++ head/crypto/openssl/ssl/s3_pkt.c Thu Dec 3 09:18:40 2009 (r200054) @@ -983,9 +983,7 @@ start: if (s->msg_callback) s->msg_callback(0, s->version, SSL3_RT_HANDSHAKE, s->s3->handshake_fragment, 4, s, s->msg_callback_arg); - if (SSL_is_init_finished(s) && - !(s->s3->flags & SSL3_FLAGS_NO_RENEGOTIATE_CIPHERS) && - !s->s3->renegotiate) + if (0) { ssl3_renegotiate(s); if (ssl3_renegotiate_check(s)) @@ -1116,8 +1114,7 @@ start: /* Unexpected handshake message (Client Hello, or protocol violation) */ if ((s->s3->handshake_fragment_len >= 4) && !s->in_handshake) { - if (((s->state&SSL_ST_MASK) == SSL_ST_OK) && - !(s->s3->flags & SSL3_FLAGS_NO_RENEGOTIATE_CIPHERS)) + if (0) { #if 0 /* worked only because C operator preferences are not as expected (and * because this is not really needed for clients except for detecting Modified: head/crypto/openssl/ssl/s3_srvr.c ============================================================================== --- head/crypto/openssl/ssl/s3_srvr.c Thu Dec 3 08:11:20 2009 (r200053) +++ head/crypto/openssl/ssl/s3_srvr.c Thu Dec 3 09:18:40 2009 (r200054) @@ -718,6 +718,13 @@ int ssl3_get_client_hello(SSL *s) #endif STACK_OF(SSL_CIPHER) *ciphers=NULL; + if (s->new_session) + { + al=SSL_AD_HANDSHAKE_FAILURE; + SSLerr(SSL_F_SSL3_GET_CLIENT_HELLO, ERR_R_INTERNAL_ERROR); + goto f_err; + } + /* We do this so that we will respond with our native type. * If we are TLSv1 and we get SSLv3, we will respond with TLSv1, * This down switching should be handled by a different method. Modified: head/etc/mtree/BSD.var.dist ============================================================================== --- head/etc/mtree/BSD.var.dist Thu Dec 3 08:11:20 2009 (r200053) +++ head/etc/mtree/BSD.var.dist Thu Dec 3 09:18:40 2009 (r200054) @@ -32,7 +32,7 @@ db entropy uname=operator gname=operator mode=0700 .. - freebsd-update + freebsd-update mode=0700 .. ipf mode=0700 .. Modified: head/usr.sbin/freebsd-update/freebsd-update.sh ============================================================================== --- head/usr.sbin/freebsd-update/freebsd-update.sh Thu Dec 3 08:11:20 2009 (r200053) +++ head/usr.sbin/freebsd-update/freebsd-update.sh Thu Dec 3 09:18:40 2009 (r200054) @@ -603,6 +603,7 @@ fetch_check_params () { echo ${WORKDIR} exit 1 fi + chmod 700 ${WORKDIR} cd ${WORKDIR} || exit 1 # Generate release number. The s/SECURITY/RELEASE/ bit exists From owner-svn-src-head@FreeBSD.ORG Thu Dec 3 11:16:54 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3C300106566B; Thu, 3 Dec 2009 11:16:54 +0000 (UTC) (envelope-from ume@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2056F8FC13; Thu, 3 Dec 2009 11:16:54 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nB3BGshP091412; Thu, 3 Dec 2009 11:16:54 GMT (envelope-from ume@svn.freebsd.org) Received: (from ume@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nB3BGsm2091411; Thu, 3 Dec 2009 11:16:54 GMT (envelope-from ume@svn.freebsd.org) Message-Id: <200912031116.nB3BGsm2091411@svn.freebsd.org> From: Hajimu UMEMOTO Date: Thu, 3 Dec 2009 11:16:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200055 - head/sys/netinet/ipfw X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Dec 2009 11:16:54 -0000 Author: ume Date: Thu Dec 3 11:16:53 2009 New Revision: 200055 URL: http://svn.freebsd.org/changeset/base/200055 Log: Teach an IPv6 to the debug prints. Modified: head/sys/netinet/ipfw/ip_fw2.c Modified: head/sys/netinet/ipfw/ip_fw2.c ============================================================================== --- head/sys/netinet/ipfw/ip_fw2.c Thu Dec 3 09:18:40 2009 (r200054) +++ head/sys/netinet/ipfw/ip_fw2.c Thu Dec 3 11:16:53 2009 (r200055) @@ -1050,6 +1050,28 @@ hash_packet(struct ipfw_flow_id *id) return i; } +static __inline void +unlink_dyn_rule_print(struct ipfw_flow_id *id) +{ + struct in_addr da; + char src[48], dst[48]; + +#ifdef INET6 + if (IS_IP6_FLOW_ID(id)) { + ip6_sprintf(src, &id->src_ip6); + ip6_sprintf(dst, &id->dst_ip6); + } else +#endif + { + da.s_addr = htonl(id->src_ip); + inet_ntoa_r(da, src); + da.s_addr = htonl(id->dst_ip); + inet_ntoa_r(da, dst); + } + printf("ipfw: unlink entry %s %d -> %s %d, %d left\n", + src, id->src_port, dst, id->dst_port, V_dyn_count - 1); +} + /** * unlink a dynamic rule from a chain. prev is a pointer to * the previous one, q is a pointer to the rule to delete, @@ -1062,9 +1084,7 @@ hash_packet(struct ipfw_flow_id *id) /* remove a refcount to the parent */ \ if (q->dyn_type == O_LIMIT) \ q->parent->count--; \ - DEB(printf("ipfw: unlink entry 0x%08x %d -> 0x%08x %d, %d left\n",\ - (q->id.src_ip), (q->id.src_port), \ - (q->id.dst_ip), (q->id.dst_port), V_dyn_count-1 ); ) \ + DEB(unlink_dyn_rule_print(&q->id);) \ if (prev != NULL) \ prev->next = q = q->next; \ else \ @@ -1394,11 +1414,26 @@ add_dyn_rule(struct ipfw_flow_id *id, u_ r->next = V_ipfw_dyn_v[i]; V_ipfw_dyn_v[i] = r; V_dyn_count++; - DEB(printf("ipfw: add dyn entry ty %d 0x%08x %d -> 0x%08x %d, total %d\n", - dyn_type, - (r->id.src_ip), (r->id.src_port), - (r->id.dst_ip), (r->id.dst_port), - V_dyn_count ); ) + DEB({ + struct in_addr da; + char src[48]; + char dst[48]; +#ifdef INET6 + if (IS_IP6_FLOW_ID(&(r->id))) { + ip6_sprintf(src, &r->id.src_ip6); + ip6_sprintf(dst, &r->id.dst_ip6); + } else +#endif + { + da.s_addr = htonl(r->id.src_ip); + inet_ntoa_r(da, src); + da.s_addr = htonl(r->id.dst_ip); + inet_ntoa_r(da, dst); + } + printf("ipfw: add dyn entry ty %d %s %d -> %s %d, total %d\n", + dyn_type, src, r->id.src_port, dst, r->id.dst_port, + V_dyn_count); + }) return r; } @@ -1460,15 +1495,28 @@ install_state(struct ip_fw *rule, ipfw_i src[0] = '\0'; dst[0] = '\0'; + IPFW_DYN_LOCK(); + DEB( - printf("ipfw: %s: type %d 0x%08x %u -> 0x%08x %u\n", - __func__, cmd->o.opcode, - (args->f_id.src_ip), (args->f_id.src_port), - (args->f_id.dst_ip), (args->f_id.dst_port)); +#ifdef INET6 + if (IS_IP6_FLOW_ID(&(args->f_id))) { + ip6_sprintf(src, &args->f_id.src_ip6); + ip6_sprintf(dst, &args->f_id.dst_ip6); + } else +#endif + { + da.s_addr = htonl(args->f_id.src_ip); + inet_ntoa_r(da, src); + da.s_addr = htonl(args->f_id.dst_ip); + inet_ntoa_r(da, dst); + } + printf("ipfw: %s: type %d %s %u -> %s %u\n", + __func__, cmd->o.opcode, src, args->f_id.src_port, + dst, args->f_id.dst_port); + src[0] = '\0'; + dst[0] = '\0'; ) - IPFW_DYN_LOCK(); - q = lookup_dyn_rule_locked(&args->f_id, NULL, NULL); if (q != NULL) { /* should never occur */ From owner-svn-src-head@FreeBSD.ORG Thu Dec 3 12:23:48 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C8EA21065679; Thu, 3 Dec 2009 12:23:48 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B57E48FC15; Thu, 3 Dec 2009 12:23:48 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nB3CNmKC007732; Thu, 3 Dec 2009 12:23:48 GMT (envelope-from luigi@svn.freebsd.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nB3CNmtM007730; Thu, 3 Dec 2009 12:23:48 GMT (envelope-from luigi@svn.freebsd.org) Message-Id: <200912031223.nB3CNmtM007730@svn.freebsd.org> From: Luigi Rizzo Date: Thu, 3 Dec 2009 12:23:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200056 - head/sbin/ipfw X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Dec 2009 12:23:48 -0000 Author: luigi Date: Thu Dec 3 12:23:48 2009 New Revision: 200056 URL: http://svn.freebsd.org/changeset/base/200056 Log: use qsort_r instead of heapsort; staticize two functions. MFC after: 3 days Modified: head/sbin/ipfw/dummynet.c Modified: head/sbin/ipfw/dummynet.c ============================================================================== --- head/sbin/ipfw/dummynet.c Thu Dec 3 11:16:53 2009 (r200055) +++ head/sbin/ipfw/dummynet.c Thu Dec 3 12:23:48 2009 (r200056) @@ -78,7 +78,7 @@ static struct _s_x dummynet_params[] = { }; static int -sort_q(const void *pa, const void *pb) +sort_q(void *arg, const void *pa, const void *pb) { int rev = (co.do_sort < 0); int field = rev ? -co.do_sort : co.do_sort; @@ -121,7 +121,7 @@ list_queues(struct dn_flow_set *fs, stru return; if (co.do_sort != 0) - heapsort(q, fs->rq_elements, sizeof *q, sort_q); + qsort_r(q, fs->rq_elements, sizeof *q, NULL, sort_q); /* Print IPv4 flows */ index_printed = 0; @@ -486,7 +486,7 @@ is_valid_number(const char *s) * and return the numeric bandwidth value. * set clocking interface or bandwidth value */ -void +static void read_bandwidth(char *arg, int *bandwidth, char *if_name, int namelen) { if (*bandwidth != -1) @@ -530,7 +530,7 @@ struct point { double delay; }; -int +static int compare_points(const void *vp1, const void *vp2) { const struct point *p1 = vp1; From owner-svn-src-head@FreeBSD.ORG Thu Dec 3 13:29:24 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 86A84106566B; Thu, 3 Dec 2009 13:29:24 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 755EF8FC17; Thu, 3 Dec 2009 13:29:24 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nB3DTOj7015130; Thu, 3 Dec 2009 13:29:24 GMT (envelope-from trasz@svn.freebsd.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nB3DTOk9015128; Thu, 3 Dec 2009 13:29:24 GMT (envelope-from trasz@svn.freebsd.org) Message-Id: <200912031329.nB3DTOk9015128@svn.freebsd.org> From: Edward Tomasz Napierala Date: Thu, 3 Dec 2009 13:29:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200058 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Dec 2009 13:29:24 -0000 Author: trasz Date: Thu Dec 3 13:29:24 2009 New Revision: 200058 URL: http://svn.freebsd.org/changeset/base/200058 Log: Add change that was somehow missed in r192586. It could manifest by incorrectly returning EINVAL from acl_valid(3) for applications linked against pre-8.0 libc. Modified: head/sys/kern/vfs_acl.c Modified: head/sys/kern/vfs_acl.c ============================================================================== --- head/sys/kern/vfs_acl.c Thu Dec 3 12:59:39 2009 (r200057) +++ head/sys/kern/vfs_acl.c Thu Dec 3 13:29:24 2009 (r200058) @@ -173,7 +173,7 @@ acl_copyout(struct acl *kernel_acl, void /* * Convert "old" type - ACL_TYPE_{ACCESS,DEFAULT}_OLD - into its "new" - * counterpart. It's required for old (pre-NFS4 ACLs) libc to work + * counterpart. It's required for old (pre-NFSv4 ACLs) libc to work * with new kernel. Fixing 'type' for old binaries with new libc * is being done in lib/libc/posix1e/acl_support.c:_acl_type_unold(). */ @@ -307,7 +307,8 @@ vacl_aclcheck(struct thread *td, struct error = acl_copyin(aclp, inkernelacl, type); if (error != 0) goto out; - error = VOP_ACLCHECK(vp, type, inkernelacl, td->td_ucred, td); + error = VOP_ACLCHECK(vp, acl_type_unold(type), inkernelacl, + td->td_ucred, td); out: acl_free(inkernelacl); return (error); From owner-svn-src-head@FreeBSD.ORG Thu Dec 3 13:33:16 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4A5811065679; Thu, 3 Dec 2009 13:33:16 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id 1A79F8FC17; Thu, 3 Dec 2009 13:33:16 +0000 (UTC) Received: from bigwig.baldwin.cx (66.111.2.69.static.nyinternet.net [66.111.2.69]) by cyrus.watson.org (Postfix) with ESMTPSA id 84B2A46B03; Thu, 3 Dec 2009 08:33:15 -0500 (EST) Received: from jhbbsd.localnet (unknown [209.249.190.9]) by bigwig.baldwin.cx (Postfix) with ESMTPA id C31828A01D; Thu, 3 Dec 2009 08:33:14 -0500 (EST) From: John Baldwin To: Andriy Gapon Date: Thu, 3 Dec 2009 07:45:28 -0500 User-Agent: KMail/1.12.1 (FreeBSD/7.2-CBSD-20091103; KDE/4.3.1; amd64; ; ) References: <200912030811.nB38BK0h046790@svn.freebsd.org> In-Reply-To: <200912030811.nB38BK0h046790@svn.freebsd.org> MIME-Version: 1.0 Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <200912030745.28650.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.0.1 (bigwig.baldwin.cx); Thu, 03 Dec 2009 08:33:14 -0500 (EST) X-Virus-Scanned: clamav-milter 0.95.1 at bigwig.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-2.5 required=4.2 tests=AWL,BAYES_00,RDNS_NONE autolearn=no version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on bigwig.baldwin.cx Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r200053 - head/sys/dev/ichsmb X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Dec 2009 13:33:16 -0000 On Thursday 03 December 2009 3:11:20 am Andriy Gapon wrote: > Author: avg > Date: Thu Dec 3 08:11:20 2009 > New Revision: 200053 > URL: http://svn.freebsd.org/changeset/base/200053 > > Log: > ichsmb: try attaching only to intel hardware in the default case > > Ideally we should attempt attaching only to known supported devices. > But I am not sure that we have all supported PCI IDs already listed, > and I am too young to die, err, I don't want to take the heat from > causing a trouble to someone. > > MFC after: 1 week > X-ToDo: drop the default case Perhaps drop the default case in 8 and 9? I actually think the default case has caused more harm than good in the past, and I suspect that there are actually very few supported devices that we don't already have the PCI IDs for. -- John Baldwin From owner-svn-src-head@FreeBSD.ORG Thu Dec 3 14:22:16 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 36119106566B; Thu, 3 Dec 2009 14:22:16 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2266E8FC0C; Thu, 3 Dec 2009 14:22:16 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nB3EMFVe016442; Thu, 3 Dec 2009 14:22:15 GMT (envelope-from luigi@svn.freebsd.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nB3EMFrS016440; Thu, 3 Dec 2009 14:22:15 GMT (envelope-from luigi@svn.freebsd.org) Message-Id: <200912031422.nB3EMFrS016440@svn.freebsd.org> From: Luigi Rizzo Date: Thu, 3 Dec 2009 14:22:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200059 - head/sys/netinet/ipfw X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Dec 2009 14:22:16 -0000 Author: luigi Date: Thu Dec 3 14:22:15 2009 New Revision: 200059 URL: http://svn.freebsd.org/changeset/base/200059 Log: preparation work to replace the monster switch in ipfw_chk() with table of functions. This commit (which is heavily based on work done by Marta Carbone in this year's GSOC project), removes the goto's and explicit return from the inner switch(), so we will have a easier time when putting the blocks into individual functions. MFC after: 3 weeks Modified: head/sys/netinet/ipfw/ip_fw2.c Modified: head/sys/netinet/ipfw/ip_fw2.c ============================================================================== --- head/sys/netinet/ipfw/ip_fw2.c Thu Dec 3 13:29:24 2009 (r200058) +++ head/sys/netinet/ipfw/ip_fw2.c Thu Dec 3 14:22:15 2009 (r200059) @@ -2306,6 +2306,8 @@ ipfw_chk(struct ip_fw_args *args) /* end of ipv6 variables */ int is_ipv4 = 0; + int done = 0; /* flag to exit the outer loop */ + if (m->m_flags & M_SKIP_FIREWALL || (! V_ipfw_vnet_ready)) return (IP_FW_PASS); /* accept */ @@ -2573,7 +2575,14 @@ do { \ * Packet has already been tagged. Look for the next rule * to restart processing. Make sure that args->rule still * exists and not changed. + * If fw_one_pass != 0 then just accept it. + * XXX should not happen here, but optimized out in + * the caller. */ + if (fw_one_pass) { + IPFW_RUNLOCK(chain); + return (IP_FW_PASS); + } if (chain->id != args->chain_id) { for (f = chain->rules; f != NULL; f = f->next) if (f == args->rule && f->id == args->rule_id) @@ -2618,13 +2627,28 @@ do { \ /* * Now scan the rules, and parse microinstructions for each rule. + * We have two nested loops and an inner switch. Sometimes we + * need to break out of one or both loops, or re-enter one of + * the loops with updated variables. Loop variables are: + * + * f (outer loop) points to the current rule. + * On output it points to the matching rule. + * done (outer loop) is used as a flag to break the loop. + * l (inner loop) residual length of current rule. + * cmd points to the current microinstruction. + * + * We break the inner loop by setting l=0 and possibly + * cmdlen=0 if we don't want to advance cmd. + * We break the outer loop by setting done=1 + * We can restart the inner loop by setting l>0 and f, cmd + * as needed. */ for (; f; f = f->next) { ipfw_insn *cmd; uint32_t tablearg = 0; int l, cmdlen, skip_or; /* skip rest of OR block */ -again: +/* again: */ if (V_set_disable & (1 << f->set) ) continue; @@ -2639,7 +2663,7 @@ again: * the target rule. */ -check_body: +/* check_body: */ cmdlen = F_LEN(cmd); /* * An OR block (insn_1 || .. || insn_n) has the @@ -3210,14 +3234,13 @@ check_body: * * In general, here we set retval and terminate the * outer loop (would be a 'break 3' in some language, - * but we need to do a 'goto done'). + * but we need to set l=0, done=1) * * Exceptions: * O_COUNT and O_SKIPTO actions: * instead of terminating, we jump to the next rule - * ('goto next_rule', equivalent to a 'break 2'), - * or to the SKIPTO target ('goto again' after - * having set f, cmd and l), respectively. + * (setting l=0), or to the SKIPTO target (by + * setting f, cmd and l as needed), respectively. * * O_TAG, O_LOG and O_ALTQ action parameters: * perform some action and set match = 1; @@ -3228,25 +3251,28 @@ check_body: * These opcodes try to install an entry in the * state tables; if successful, we continue with * the next opcode (match=1; break;), otherwise - * the packet * must be dropped - * ('goto done' after setting retval); + * the packet must be dropped (set retval, + * break loops with l=0, done=1) * * O_PROBE_STATE and O_CHECK_STATE: these opcodes * cause a lookup of the state table, and a jump * to the 'action' part of the parent rule - * ('goto check_body') if an entry is found, or + * if an entry is found, or * (CHECK_STATE only) a jump to the next rule if - * the entry is not found ('goto next_rule'). - * The result of the lookup is cached to make - * further instances of these opcodes are - * effectively NOPs. + * the entry is not found. + * The result of the lookup is cached so that + * further instances of these opcodes become NOPs. + * The jump to the next rule is done by setting + * l=0, cmdlen=0. */ case O_LIMIT: case O_KEEP_STATE: if (install_state(f, (ipfw_insn_limit *)cmd, args, tablearg)) { + /* error or limit violation */ retval = IP_FW_DENY; - goto done; /* error/limit violation */ + l = 0; /* exit inner loop */ + done = 1; /* exit outer loop */ } match = 1; break; @@ -3270,7 +3296,8 @@ check_body: /* * Found dynamic entry, update stats * and jump to the 'action' part of - * the parent rule. + * the parent rule by setting + * f, cmd, l and clearing cmdlen. */ q->pcnt++; q->bcnt += pktlen; @@ -3278,7 +3305,9 @@ check_body: cmd = ACTION_PTR(f); l = f->cmd_len - f->act_ofs; IPFW_DYN_UNLOCK(); - goto check_body; + cmdlen = 0; + match = 1; + break; } /* * Dynamic entry not found. If CHECK_STATE, @@ -3286,13 +3315,15 @@ check_body: * ignore and continue with next opcode. */ if (cmd->opcode == O_CHECK_STATE) - goto next_rule; + l = 0; /* exit inner loop */ match = 1; break; case O_ACCEPT: retval = 0; /* accept */ - goto done; + l = 0; /* exit inner loop */ + done = 1; /* exit outer loop */ + break; case O_PIPE: case O_QUEUE: @@ -3304,43 +3335,45 @@ check_body: else args->cookie = cmd->arg1; retval = IP_FW_DUMMYNET; - goto done; + l = 0; /* exit inner loop */ + done = 1; /* exit outer loop */ + break; case O_DIVERT: - case O_TEE: { - struct divert_tag *dt; - + case O_TEE: if (args->eh) /* not on layer 2 */ - break; + break; + /* otherwise this is terminal */ + l = 0; /* exit inner loop */ + done = 1; /* exit outer loop */ mtag = m_tag_get(PACKET_TAG_DIVERT, - sizeof(struct divert_tag), - M_NOWAIT); + sizeof(struct divert_tag), + M_NOWAIT); if (mtag == NULL) { - /* XXX statistic */ - /* drop packet */ - IPFW_RUNLOCK(chain); - if (ucred_cache != NULL) - crfree(ucred_cache); - return (IP_FW_DENY); - } - dt = (struct divert_tag *)(mtag+1); - dt->cookie = f->rulenum; - if (cmd->arg1 == IP_FW_TABLEARG) + retval = IP_FW_DENY; + } else { + struct divert_tag *dt; + dt = (struct divert_tag *)(mtag+1); + dt->cookie = f->rulenum; + if (cmd->arg1 == IP_FW_TABLEARG) dt->info = tablearg; - else + else dt->info = cmd->arg1; - m_tag_prepend(m, mtag); - retval = (cmd->opcode == O_DIVERT) ? - IP_FW_DIVERT : IP_FW_TEE; - goto done; - } + m_tag_prepend(m, mtag); + retval = (cmd->opcode == O_DIVERT) ? + IP_FW_DIVERT : IP_FW_TEE; + } + break; + case O_COUNT: case O_SKIPTO: f->pcnt++; /* update stats */ f->bcnt += pktlen; f->timestamp = time_uptime; - if (cmd->opcode == O_COUNT) - goto next_rule; + if (cmd->opcode == O_COUNT) { + l = 0; /* exit inner loop */ + break; + } /* handle skipto */ if (cmd->arg1 == IP_FW_TABLEARG) { f = lookup_next_rule(f, tablearg); @@ -3349,7 +3382,24 @@ check_body: lookup_next_rule(f, 0); f = f->next_rule; } - goto again; + /* + * Skip disabled rules, and + * re-enter the inner loop + * with the correct f, l and cmd. + * Also clear cmdlen and skip_or + */ + while (f && (V_set_disable & (1 << f->set))) + f = f->next; + if (f) { /* found a valid rule */ + l = f->cmd_len; + cmd = f->cmd; + } else { + l = 0; /* exit inner loop */ + } + match = 1; + cmdlen = 0; + skip_or = 0; + break; case O_REJECT: /* @@ -3383,28 +3433,30 @@ check_body: #endif case O_DENY: retval = IP_FW_DENY; - goto done; + l = 0; /* exit inner loop */ + done = 1; /* exit outer loop */ + break; - case O_FORWARD_IP: { - struct sockaddr_in *sa; - sa = &(((ipfw_insn_sa *)cmd)->sa); + case O_FORWARD_IP: if (args->eh) /* not valid on layer2 pkts */ break; if (!q || dyn_dir == MATCH_FORWARD) { - if (sa->sin_addr.s_addr == INADDR_ANY) { - bcopy(sa, &args->hopstore, + struct sockaddr_in *sa; + sa = &(((ipfw_insn_sa *)cmd)->sa); + if (sa->sin_addr.s_addr == INADDR_ANY) { + bcopy(sa, &args->hopstore, sizeof(*sa)); - args->hopstore.sin_addr.s_addr = + args->hopstore.sin_addr.s_addr = htonl(tablearg); - args->next_hop = - &args->hopstore; - } else { - args->next_hop = sa; - } + args->next_hop = &args->hopstore; + } else { + args->next_hop = sa; + } } retval = IP_FW_PASS; - } - goto done; + l = 0; /* exit inner loop */ + done = 1; /* exit outer loop */ + break; case O_NETGRAPH: case O_NGTEE: @@ -3417,7 +3469,9 @@ check_body: args->cookie = cmd->arg1; retval = (cmd->opcode == O_NETGRAPH) ? IP_FW_NETGRAPH : IP_FW_NGTEE; - goto done; + l = 0; /* exit inner loop */ + done = 1; /* exit outer loop */ + break; case O_SETFIB: f->pcnt++; /* update stats */ @@ -3425,88 +3479,98 @@ check_body: f->timestamp = time_uptime; M_SETFIB(m, cmd->arg1); args->f_id.fib = cmd->arg1; - goto next_rule; + l = 0; /* exit inner loop */ + break; - case O_NAT: { - struct cfg_nat *t; - int nat_id; - - if (IPFW_NAT_LOADED) { - args->rule = f; /* Report matching rule. */ - args->rule_id = f->id; - args->chain_id = chain->id; - t = ((ipfw_insn_nat *)cmd)->nat; + case O_NAT: + if (!IPFW_NAT_LOADED) { + retval = IP_FW_DENY; + } else { + struct cfg_nat *t; + int nat_id; + + args->rule = f; /* Report matching rule. */ + args->rule_id = f->id; + args->chain_id = chain->id; + t = ((ipfw_insn_nat *)cmd)->nat; + if (t == NULL) { + nat_id = (cmd->arg1 == IP_FW_TABLEARG) ? + tablearg : cmd->arg1; + LOOKUP_NAT(V_layer3_chain, nat_id, t); if (t == NULL) { - nat_id = (cmd->arg1 == IP_FW_TABLEARG) ? - tablearg : cmd->arg1; - LOOKUP_NAT(V_layer3_chain, nat_id, t); - if (t == NULL) { - retval = IP_FW_DENY; - goto done; - } - if (cmd->arg1 != IP_FW_TABLEARG) - ((ipfw_insn_nat *)cmd)->nat = t; + retval = IP_FW_DENY; + l = 0; /* exit inner loop */ + done = 1; /* exit outer loop */ + break; } - retval = ipfw_nat_ptr(args, t, m); - } else - retval = IP_FW_DENY; - goto done; - } + if (cmd->arg1 != IP_FW_TABLEARG) + ((ipfw_insn_nat *)cmd)->nat = t; + } + retval = ipfw_nat_ptr(args, t, m); + } + l = 0; /* exit inner loop */ + done = 1; /* exit outer loop */ + break; case O_REASS: { int ip_off; f->pcnt++; f->bcnt += pktlen; - ip_off = (args->eh != NULL) ? ntohs(ip->ip_off) : ip->ip_off; - if (ip_off & (IP_MF | IP_OFFMASK)) { - /* - * ip_reass() expects len & off in host - * byte order: fix them in case we come - * from layer2. - */ - if (args->eh != NULL) { - ip->ip_len = ntohs(ip->ip_len); - ip->ip_off = ntohs(ip->ip_off); - } + l = 0; /* in any case exit inner loop */ - m = ip_reass(m); - args->m = m; - - /* - * IP header checksum fixup after - * reassembly and leave header - * in network byte order. - */ - if (m != NULL) { - int hlen; - - ip = mtod(m, struct ip *); - hlen = ip->ip_hl << 2; - /* revert len & off for layer2 pkts */ - if (args->eh != NULL) - ip->ip_len = htons(ip->ip_len); - ip->ip_sum = 0; - if (hlen == sizeof(struct ip)) - ip->ip_sum = in_cksum_hdr(ip); - else - ip->ip_sum = in_cksum(m, hlen); - retval = IP_FW_REASS; - args->rule = f; - args->rule_id = f->id; - args->chain_id = chain->id; - goto done; - } else { - retval = IP_FW_DENY; - goto done; - } + ip_off = (args->eh != NULL) ? + ntohs(ip->ip_off) : ip->ip_off; + /* if not fragmented, go to next rule */ + if ((ip_off & (IP_MF | IP_OFFMASK)) == 0) + break; + /* + * ip_reass() expects len & off in host + * byte order: fix them in case we come + * from layer2. + */ + if (args->eh != NULL) { + ip->ip_len = ntohs(ip->ip_len); + ip->ip_off = ntohs(ip->ip_off); + } + + args->m = m = ip_reass(m); + + /* + * IP header checksum fixup after + * reassembly and leave header + * in network byte order. + */ + if (m == NULL) { /* fragment got swallowed */ + retval = IP_FW_DENY; + } else { /* good, packet complete */ + int hlen; + + ip = mtod(m, struct ip *); + hlen = ip->ip_hl << 2; + /* revert len & off for layer2 pkts */ + if (args->eh != NULL) + ip->ip_len = htons(ip->ip_len); + ip->ip_sum = 0; + if (hlen == sizeof(struct ip)) + ip->ip_sum = in_cksum_hdr(ip); + else + ip->ip_sum = in_cksum(m, hlen); + retval = IP_FW_REASS; + args->rule = f; + args->rule_id = f->id; + args->chain_id = chain->id; } - goto next_rule; + done = 1; /* exit outer loop */ + break; } default: panic("-- unknown opcode %d\n", cmd->opcode); } /* end of switch() on opcodes */ + /* + * if we get here with l=0, then match is irrelevant. + */ if (cmd->len & F_NOT) match = !match; @@ -3519,22 +3583,24 @@ check_body: break; /* try next rule */ } - } /* end of inner for, scan opcodes */ + } /* end of inner loop, scan opcodes */ + + if (done) + break; -next_rule:; /* try next rule */ +/* next_rule:; */ /* try next rule */ } /* end of outer for, scan rules */ - printf("ipfw: ouch!, skip past end of rules, denying packet\n"); - IPFW_RUNLOCK(chain); - if (ucred_cache != NULL) - crfree(ucred_cache); - return (IP_FW_DENY); -done: - /* Update statistics */ - f->pcnt++; - f->bcnt += pktlen; - f->timestamp = time_uptime; + if (done) { + /* Update statistics */ + f->pcnt++; + f->bcnt += pktlen; + f->timestamp = time_uptime; + } else { + retval = IP_FW_DENY; + printf("ipfw: ouch!, skip past end of rules, denying packet\n"); + } IPFW_RUNLOCK(chain); if (ucred_cache != NULL) crfree(ucred_cache); From owner-svn-src-head@FreeBSD.ORG Thu Dec 3 14:59:43 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 07C58106566B; Thu, 3 Dec 2009 14:59:43 +0000 (UTC) (envelope-from jkoshy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id EB5268FC14; Thu, 3 Dec 2009 14:59:42 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nB3Exgf2017320; Thu, 3 Dec 2009 14:59:42 GMT (envelope-from jkoshy@svn.freebsd.org) Received: (from jkoshy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nB3ExgeU017318; Thu, 3 Dec 2009 14:59:42 GMT (envelope-from jkoshy@svn.freebsd.org) Message-Id: <200912031459.nB3ExgeU017318@svn.freebsd.org> From: Joseph Koshy Date: Thu, 3 Dec 2009 14:59:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200060 - head/sys/dev/hwpmc X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Dec 2009 14:59:43 -0000 Author: jkoshy Date: Thu Dec 3 14:59:42 2009 New Revision: 200060 URL: http://svn.freebsd.org/changeset/base/200060 Log: Use a better check for a valid kernel stack address when capturing kernel call chains. Submitted by: Mark Unangst Tested by: fabient Modified: head/sys/dev/hwpmc/hwpmc_x86.c Modified: head/sys/dev/hwpmc/hwpmc_x86.c ============================================================================== --- head/sys/dev/hwpmc/hwpmc_x86.c Thu Dec 3 14:22:15 2009 (r200059) +++ head/sys/dev/hwpmc/hwpmc_x86.c Thu Dec 3 14:59:42 2009 (r200060) @@ -176,7 +176,8 @@ pmc_save_kernel_callchain(uintptr_t *cc, stackend = (uintptr_t) td->td_kstack + td->td_kstack_pages * PAGE_SIZE; if (PMC_IN_TRAP_HANDLER(pc) || - !PMC_IN_KERNEL(pc) || !PMC_IN_KERNEL(r) || + !PMC_IN_KERNEL(pc) || + !PMC_IN_KERNEL_STACK(r, stackstart, stackend) || !PMC_IN_KERNEL_STACK(sp, stackstart, stackend) || !PMC_IN_KERNEL_STACK(fp, stackstart, stackend)) return (1); @@ -221,7 +222,7 @@ pmc_save_kernel_callchain(uintptr_t *cc, r = fp + sizeof(uintptr_t); if (!PMC_IN_KERNEL_STACK(fp, stackstart, stackend) || - !PMC_IN_KERNEL(r)) + !PMC_IN_KERNEL_STACK(r, stackstart, stackend)) break; pc = *(uintptr_t *) r; fp = *(uintptr_t *) fp; From owner-svn-src-head@FreeBSD.ORG Thu Dec 3 15:14:30 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 79623106568F; Thu, 3 Dec 2009 15:14:30 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 68EC68FC19; Thu, 3 Dec 2009 15:14:30 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nB3FEUof017700; Thu, 3 Dec 2009 15:14:30 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nB3FEUHT017698; Thu, 3 Dec 2009 15:14:30 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <200912031514.nB3FEUHT017698@svn.freebsd.org> From: John Baldwin Date: Thu, 3 Dec 2009 15:14:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200061 - head/lib/libc/rpc X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Dec 2009 15:14:30 -0000 Author: jhb Date: Thu Dec 3 15:14:30 2009 New Revision: 200061 URL: http://svn.freebsd.org/changeset/base/200061 Log: The fd_mask type is an unsigned long, not an int, so treat the mask as a long instead of an int when examining the results of select() to look for RPC requests. Previously this routine would ignore RPC requests to sockets whose file descriptor mod 64 was greater than 31 on a 64-bit platform. PR: amd64/141130 Submitted by: liujb of array networks MFC after: 3 days Modified: head/lib/libc/rpc/svc.c Modified: head/lib/libc/rpc/svc.c ============================================================================== --- head/lib/libc/rpc/svc.c Thu Dec 3 14:59:42 2009 (r200060) +++ head/lib/libc/rpc/svc.c Thu Dec 3 15:14:30 2009 (r200061) @@ -627,8 +627,8 @@ svc_getreqset(readfds) maskp = readfds->fds_bits; for (sock = 0; sock < FD_SETSIZE; sock += NFDBITS) { - for (mask = *maskp++; (bit = ffs(mask)) != 0; - mask ^= (1 << (bit - 1))) { + for (mask = *maskp++; (bit = ffsl(mask)) != 0; + mask ^= (1ul << (bit - 1))) { /* sock has input waiting */ fd = sock + bit - 1; svc_getreq_common(fd); From owner-svn-src-head@FreeBSD.ORG Thu Dec 3 15:48:25 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6D7301065679; Thu, 3 Dec 2009 15:48:25 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5A0258FC15; Thu, 3 Dec 2009 15:48:25 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nB3FmP35018538; Thu, 3 Dec 2009 15:48:25 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nB3FmPp3018525; Thu, 3 Dec 2009 15:48:25 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <200912031548.nB3FmPp3018525@svn.freebsd.org> From: Ed Schouten Date: Thu, 3 Dec 2009 15:48:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200062 - in head: contrib/groff/tmac lib lib/libulog libexec libexec/ulog-helper share/mk X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Dec 2009 15:48:25 -0000 Author: ed Date: Thu Dec 3 15:48:24 2009 New Revision: 200062 URL: http://svn.freebsd.org/changeset/base/200062 Log: Add a new library: libulog. One of the things I really want to do, is to get rid of the limitations of our current utmp(5) mechanism: - It only allows 8 byte TTY device names. - The hostname only allows 16 bytes of storage. I'm not a big fan of , but I think we should at least try to add parts of it. Unfortunately we cannot implement , because we miss various fields, such as ut_id, ut_pid, etc. The API provided by libulog shares some similarities with , so it shouldn't be too hard to port these applications eventually. In most simple cases, it should just be a matter of removing the ulog_ prefix everywhere. As a bonus, it also implements a function called ulog_login_pseudo(), which allows unprivileged applications to write log entries, provided they have a valid file descriptor to a pseudo-terminal master device. libulog will allow a smoother transition to a new file format by adding a library interface to deal with utmp/wtmp/lastlog files. I initially thought about adding the functionality to libutil, but because I'm not planning on keeping this library around forever, we'd better keep it separated. Next items on the todo list: 1. Port applications in the base system (and ports) to libulog, instead of letting them use . 2. Remove , implement and reimplement this library on top. 3. Port as many applications as possible back to . Added: head/lib/libulog/ head/lib/libulog/Makefile (contents, props changed) head/lib/libulog/Symbol.map (contents, props changed) head/lib/libulog/ulog.h (contents, props changed) head/lib/libulog/ulog_getutxent.3 (contents, props changed) head/lib/libulog/ulog_getutxent.c (contents, props changed) head/lib/libulog/ulog_internal.h (contents, props changed) head/lib/libulog/ulog_login.3 (contents, props changed) head/lib/libulog/ulog_login.c (contents, props changed) head/lib/libulog/ulog_login_pseudo.c (contents, props changed) head/libexec/ulog-helper/ head/libexec/ulog-helper/Makefile (contents, props changed) head/libexec/ulog-helper/ulog-helper.c (contents, props changed) Modified: head/contrib/groff/tmac/doc-syms head/lib/Makefile head/libexec/Makefile head/share/mk/bsd.libnames.mk Modified: head/contrib/groff/tmac/doc-syms ============================================================================== --- head/contrib/groff/tmac/doc-syms Thu Dec 3 15:14:30 2009 (r200061) +++ head/contrib/groff/tmac/doc-syms Thu Dec 3 15:48:24 2009 (r200062) @@ -777,6 +777,7 @@ .ds doc-str-Lb-librt \*[Px] \*[doc-str-Lb]Real-time Library (librt, \-lrt) .ds doc-str-Lb-libtermcap Termcap Access Library (libtermcap, \-ltermcap) .ds doc-str-Lb-libusbhid USB Human Interface Devices Library (libusbhid, \-lusbhid) +.ds doc-str-Lb-libulog User Login Record Library (libulog, \-lulog) .ds doc-str-Lb-libutil System Utilities Library (libutil, \-lutil) .ds doc-str-Lb-libx86_64 x86_64 Architecture Library (libx86_64, \-lx86_64) .ds doc-str-Lb-libz Compression Library (libz, \-lz) Modified: head/lib/Makefile ============================================================================== --- head/lib/Makefile Thu Dec 3 15:14:30 2009 (r200061) +++ head/lib/Makefile Thu Dec 3 15:48:24 2009 (r200062) @@ -40,8 +40,8 @@ SUBDIR= ${_csu} libc libbsm libauditd li ${_libpmc} libproc librt ${_libsdp} ${_libsm} ${_libsmb} \ ${_libsmdb} \ ${_libsmutil} libstand ${_libtelnet} ${_libthr} libthread_db libufs \ - libugidfw ${_libusbhid} ${_libusb} ${_libvgl} libwrap liby libz \ - ${_bind} + libugidfw libulog ${_libusbhid} ${_libusb} ${_libvgl} libwrap \ + liby libz ${_bind} .if exists(${.CURDIR}/csu/${MACHINE_ARCH}-elf) _csu=csu/${MACHINE_ARCH}-elf Added: head/lib/libulog/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libulog/Makefile Thu Dec 3 15:48:24 2009 (r200062) @@ -0,0 +1,21 @@ +# $FreeBSD$ + +LIB= ulog +SHLIB_MAJOR= 0 +INCS= ulog.h +SRCS= ulog.h ulog_getutxent.c ulog_internal.h \ + ulog_login.c ulog_login_pseudo.c + +MAN= ulog_getutxent.3 ulog_login.3 +MLINKS+=ulog_getutxent.3 ulog_endutxent.3 \ + ulog_getutxent.3 ulog_setutxent.3 \ + ulog_login.3 ulog_login_pseudo.3 \ + ulog_login.3 ulog_logout.3 \ + ulog_login.3 ulog_logout_pseudo.3 + +WARNS?= 6 + +VERSION_DEF= ${.CURDIR}/../libc/Versions.def +SYMBOL_MAPS= ${.CURDIR}/Symbol.map + +.include Added: head/lib/libulog/Symbol.map ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libulog/Symbol.map Thu Dec 3 15:48:24 2009 (r200062) @@ -0,0 +1,13 @@ +/* + * $FreeBSD$ + */ + +FBSD_1.2 { + ulog_endutxent; + ulog_getutxent; + ulog_login; + ulog_login_pseudo; + ulog_logout; + ulog_logout_pseudo; + ulog_setutxent; +}; Added: head/lib/libulog/ulog.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libulog/ulog.h Thu Dec 3 15:48:24 2009 (r200062) @@ -0,0 +1,87 @@ +/*- + * Copyright (c) 2009 Ed Schouten + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef _ULOG_H_ +#define _ULOG_H_ + +#include +#include + +/* + * libulog. + * + * This library is provided as a migratory tool towards . We + * cannot yet implement , because our on-disk file format lacks + * various fields. also has some shortcomings. Ideally we + * want to allow logging of user login records generated by unprivileged + * processes as well, provided that they hold a file descriptor to a + * pseudo-terminal master device. + * + * Unlike struct utmpx, the buffers containing the strings are not + * stored inside struct ulog_utmpx itself. Processes should never + * handcraft these structures anyway. + * + * This library (or at least parts of it) will hopefully deprecate over + * time, when we provide the API. + */ + +#define _UTX_USERDISPSIZE 16 +#define _UTX_LINEDISPSIZE 8 +#define _UTX_HOSTDISPSIZE 16 + +struct ulog_utmpx { + char *ut_user; +#if 0 + char *ut_id; +#endif + char *ut_line; + char *ut_host; +#if 0 + pid_t ut_pid; + short ut_type; +#endif + struct timeval ut_tv; +}; + +__BEGIN_DECLS +void ulog_endutxent(void); +struct ulog_utmpx *ulog_getutxent(void); +#if 0 +struct ulog_utmpx *ulog_getutxid(const struct ulog_utmpx *id); +struct ulog_utmpx *ulog_getutxline(const struct ulog_utmpx *line); +struct ulog_utmpx *ulog_pututxline(const struct ulog_utmpx *utmpx); +#endif +void ulog_setutxent(void); + +void ulog_login(const char *, const char *, const char *); +void ulog_login_pseudo(int, const char *); +void ulog_logout(const char *); +void ulog_logout_pseudo(int); +__END_DECLS + +#endif /* !_ULOG_H_ */ Added: head/lib/libulog/ulog_getutxent.3 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libulog/ulog_getutxent.3 Thu Dec 3 15:48:24 2009 (r200062) @@ -0,0 +1,98 @@ +.\" Copyright (c) 2009 Ed Schouten +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd December 2, 2009 +.Os +.Dt ULOG_GETUTXENT 3 +.Sh NAME +.Nm ulog_getutxent , +.Nm ulog_setutxent , +.Nm ulog_endutxent +.Nd read user login records +.Sh LIBRARY +.Lb libulog +.Sh SYNOPSIS +.In ulog.h +.Ft struct ulog_utmpx * +.Fn ulog_getutxent "void" +.Ft void +.Fn ulog_setutxent "void" +.Ft void +.Fn ulog_endutxent "void" +.Sh DESCRIPTION +The +.Fn ulog_getutxent +function returns a pointer to an object, with the following structure, +containing stored information of an active user login session. +.Bd -literal +struct ulog_utmpx { + char *ut_user; /* Username. */ + char *ut_line; /* TTY device. */ + char *ut_host; /* Remote hostname. */ + struct timeval ut_tv; /* Timestamp. */ +}; +.Ed +.Pp +The fields are as follows: +.Bl -tag -width ut_user +.It Fa ut_user +The username of the logged in user. +.It Fa ut_line +The pathname of the TTY device, without the leading +.Pa /dev/ +directory. +.It Fa ut_host +An optional hostname of a remote system, if the login session is +provided through a networked login service. +.It Fa ut_tv +Timestamp indicating when the entry was last modified. +.El +.Pp +The +.Fn ulog_getutxent +function reads the next entry from the utmp file, opening the file if +necessary. +The +.Fn ulog_setutxent +opens the file, closing it first if already opened. +The +.Fn ulog_endutxent +function closes any open files. +.Pp +The +.Fn ulog_getutxent +function reads from the beginning of the file until and EOF is +encountered. +.Sh RETURN VALUES +The +.Fn ulog_getutxent +function returns a null pointer on EOF or error. +.Sh SEE ALSO +.Xr ulog_login 3 , +.Xr utmp 5 +.Sh HISTORY +These functions appeared in +.Fx 9.0 . Added: head/lib/libulog/ulog_getutxent.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libulog/ulog_getutxent.c Thu Dec 3 15:48:24 2009 (r200062) @@ -0,0 +1,84 @@ +/*- + * Copyright (c) 2009 Ed Schouten + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include + +#include "ulog_internal.h" + +static FILE *ufile; + +void +ulog_endutxent(void) +{ + if (ufile != NULL) + fclose(ufile); + ufile = NULL; +} + +struct ulog_utmpx * +ulog_getutxent(void) +{ + struct futmp ut; + static struct ulog_utmpx utx; + + /* Open the utmp file if not already done so. */ + if (ufile == NULL) + ulog_setutxent(); + if (ufile == NULL) + return (NULL); + + if (fread(&ut, sizeof ut, 1, ufile) != 1) + return (NULL); +#define COPY_STRING(field) do { \ + free(utx.ut_ ## field); \ + utx.ut_ ## field = strndup(ut.ut_ ## field, \ + sizeof ut.ut_ ## field); \ + if (utx.ut_ ## field == NULL) \ + utx.ut_ ## field = __DECONST(char *, ""); \ +} while (0) + COPY_STRING(user); + COPY_STRING(line); + COPY_STRING(host); + utx.ut_tv.tv_sec = _time32_to_time(ut.ut_time); + utx.ut_tv.tv_usec = 0; + + return (&utx); +} + +void +ulog_setutxent(void) +{ + + if (ufile != NULL) + fclose(ufile); + ufile = fopen(_PATH_UTMP, "r"); +} Added: head/lib/libulog/ulog_internal.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libulog/ulog_internal.h Thu Dec 3 15:48:24 2009 (r200062) @@ -0,0 +1,58 @@ +/*- + * Copyright (c) 2009 Ed Schouten + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef _ULOG_INTERNAL_H_ +#define _ULOG_INTERNAL_H_ + +#include + +#include "ulog.h" + +/* + * On-disk format. + */ + +#define _PATH_UTMP "/var/run/utmp" +#define _PATH_WTMP "/var/log/wtmp" + +struct futmp { + char ut_line[8]; + char ut_user[16]; + char ut_host[16]; + int32_t ut_time; +}; + +#define _PATH_LASTLOG "/var/log/lastlog" + +struct flastlog { + int32_t ll_time; + char ll_line[8]; + char ll_host[16]; +}; + +#endif /* !_ULOG_INTERNAL_H_ */ Added: head/lib/libulog/ulog_login.3 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libulog/ulog_login.3 Thu Dec 3 15:48:24 2009 (r200062) @@ -0,0 +1,102 @@ +.\" Copyright (c) 2009 Ed Schouten +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd December 2, 2009 +.Os +.Dt ULOG_LOGIN 3 +.Sh NAME +.Nm ulog_login , +.Nm ulog_login_pseudo , +.Nm ulog_logout , +.Nm ulog_logout_pseudo +.Nd manage user login records +.Sh LIBRARY +.Lb libulog +.Sh SYNOPSIS +.In ulog.h +.Ft void +.Fn ulog_login "const char *line" "const char *user" "const char *host" +.Ft void +.Fn ulog_login_pseudo "int fd" "const char *host" +.Ft void +.Fn ulog_logout "const char *line" +.Ft void +.Fn ulog_logout_pseudo "int fd" +.Sh DESCRIPTION +The +.Fn ulog_login +and +.Fn ulog_login_pseudo +functions register a login session on a TTY. +The +.Fn ulog_login +function adds an entry for TTY +.Fa line +and username +.Fa user . +The +.Fn ulog_login_pseudo +function uses file descriptor to a pseudo-terminal master device +.Fa fd +to determine the TTY name, while using the username belonging to the +real user ID of the calling process. +The optional +.Fa host +argument denotes a remote hostname, in case the login session is +provided by a network service. +.Pp +The +.Fn ulog_logout +and +.Fn ulog_logout_pseudo +functions mark the previously registered login session as being +terminated. +.Pp +Because the +.Fa line +and +.Fa user +arguments of +.Fn ulog_login +and +.Fn ulog_logout +cannot be trusted, these functions require administrative privileges. +The +.Fn ulog_login_pseudo +and +.Fn ulog_logout_pseudo +functions spawn a privileged process to perform the actual logging. +.Sh SEE ALSO +.Xr getuid 3 , +.Xr login 3 , +.Xr logout 3 , +.Xr posix_openpt 2 , +.Xr ptsname 3 , +.Xr ulog_getutxent 3 , +.Xr utmp 5 +.Sh HISTORY +These functions appeared in +.Fx 9.0 . Added: head/lib/libulog/ulog_login.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libulog/ulog_login.c Thu Dec 3 15:48:24 2009 (r200062) @@ -0,0 +1,135 @@ +/*- + * Copyright (c) 2009 Ed Schouten + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "ulog_internal.h" + +void +ulog_login(const char *line, const char *user, const char *host) +{ + struct futmp fu; + struct flastlog fl; + int fd; + + /* Remove /dev/ component. */ + if (strncmp(line, _PATH_DEV, sizeof _PATH_DEV - 1) == 0) + line += sizeof _PATH_DEV - 1; + + /* Prepare log entries. */ + memset(&fu, 0, sizeof fu); + strlcpy(fu.ut_line, line, sizeof fu.ut_line); + strlcpy(fu.ut_user, user, sizeof fu.ut_user); + if (host != NULL) + strlcpy(fu.ut_host, host, sizeof fu.ut_host); + fu.ut_time = _time_to_time32(time(NULL)); + + fl.ll_time = fu.ut_time; + memcpy(fl.ll_line, fu.ut_line, sizeof fl.ll_line); + memcpy(fl.ll_host, fu.ut_host, sizeof fl.ll_host); + + /* Update utmp entry. */ + if ((fd = open(_PATH_UTMP, O_WRONLY|O_CREAT, 0644)) >= 0) { + struct ttyent *ty; + int idx; + + setttyent(); + for (idx = 1; (ty = getttyent()) != NULL; ++idx) { + if (strcmp(ty->ty_name, line) != 0) + continue; + lseek(fd, (off_t)(idx * sizeof fu), L_SET); + write(fd, &fu, sizeof fu); + break; + } + endttyent(); + close(fd); + } + + /* Add wtmp entry. */ + if ((fd = open(_PATH_WTMP, O_WRONLY|O_APPEND, 0)) >= 0) { + write(fd, &fu, sizeof fu); + close(fd); + } + + /* Update lastlog entry. */ + if ((fd = open(_PATH_LASTLOG, O_WRONLY, 0)) >= 0) { + struct passwd *pw; + + pw = getpwnam(user); + if (pw != NULL) { + lseek(fd, (off_t)(pw->pw_uid * sizeof fl), L_SET); + write(fd, &fl, sizeof fl); + } + close(fd); + } +} + +void +ulog_logout(const char *line) +{ + struct futmp ut; + int fd, found; + + /* Remove /dev/ component. */ + if (strncmp(line, _PATH_DEV, sizeof _PATH_DEV - 1) == 0) + line += sizeof _PATH_DEV - 1; + + /* Mark entry in utmp as logged out. */ + if ((fd = open(_PATH_UTMP, O_RDWR, 0)) < 0) + return; + found = 0; + while (read(fd, &ut, sizeof ut) == sizeof ut) { + if (ut.ut_user[0] == '\0' || + strncmp(ut.ut_line, line, sizeof ut.ut_line) != 0) + continue; + memset(ut.ut_user, 0, sizeof ut.ut_user); + memset(ut.ut_host, 0, sizeof ut.ut_host); + ut.ut_time = _time_to_time32(time(NULL)); + lseek(fd, -(off_t)sizeof ut, L_INCR); + write(fd, &ut, sizeof ut); + found = 1; + } + close(fd); + if (!found) + return; + + /* utmp entry found. Also add logout entry to wtmp. */ + if ((fd = open(_PATH_WTMP, O_WRONLY|O_APPEND, 0)) >= 0) { + write(fd, &ut, sizeof ut); + close(fd); + } +} Added: head/lib/libulog/ulog_login_pseudo.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libulog/ulog_login_pseudo.c Thu Dec 3 15:48:24 2009 (r200062) @@ -0,0 +1,93 @@ +/*- + * Copyright (c) 2009 Ed Schouten + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include + +#include +#include +#include +#include +#include + +#include "ulog_internal.h" + +#define _PATH_ULOG_HELPER "/usr/libexec/ulog-helper" + +/* + * Registering login sessions. + */ + +static void +ulog_exec_helper(int fd, char const * const argv[]) +{ + sigset_t oblock, nblock; + pid_t pid, wpid; + int status; + + /* Block SIGCHLD. */ + sigemptyset(&nblock); + sigaddset(&nblock, SIGCHLD); + sigprocmask(SIG_BLOCK, &nblock, &oblock); + + switch (pid = fork()) { + case -1: + break; + case 0: + /* Execute helper program. */ + if (dup2(fd, STDIN_FILENO) == -1) + exit(EX_UNAVAILABLE); + sigprocmask(SIG_SETMASK, &oblock, NULL); + execv(_PATH_ULOG_HELPER, __DECONST(char * const *, argv)); + exit(EX_UNAVAILABLE); + default: + /* Wait for helper to finish. */ + do { + wpid = waitpid(pid, &status, 0); + } while (wpid == -1 && errno == EINTR); + break; + } + + sigprocmask(SIG_SETMASK, &oblock, NULL); +} + +void +ulog_login_pseudo(int fd, const char *host) +{ + char const * const args[4] = { "ulog-helper", "login", host, NULL }; + + ulog_exec_helper(fd, args); +} + +void +ulog_logout_pseudo(int fd) +{ + char const * const args[3] = { "ulog-helper", "logout", NULL }; + + ulog_exec_helper(fd, args); +} Modified: head/libexec/Makefile ============================================================================== --- head/libexec/Makefile Thu Dec 3 15:14:30 2009 (r200061) +++ head/libexec/Makefile Thu Dec 3 15:48:24 2009 (r200062) @@ -29,6 +29,7 @@ SUBDIR= ${_atrun} \ ${_telnetd} \ tftpd \ ${_tftp-proxy} \ + ulog-helper \ ${_ypxfr} .if ${MK_AT} != "no" Added: head/libexec/ulog-helper/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/libexec/ulog-helper/Makefile Thu Dec 3 15:48:24 2009 (r200062) @@ -0,0 +1,13 @@ +# $FreeBSD$ + +PROG= ulog-helper +BINOWN= root +BINMODE=4555 +NO_MAN= + +DPADD= ${LIBULOG} +LDADD= -lulog + +WARNS?= 6 + +.include Added: head/libexec/ulog-helper/ulog-helper.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/libexec/ulog-helper/ulog-helper.c Thu Dec 3 15:48:24 2009 (r200062) @@ -0,0 +1,81 @@ +/*- + * Copyright (c) 2009 Ed Schouten + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include + +/* + * This setuid helper utility writes user login records to disk. + * Unprivileged processes are not capable of writing records to utmp, + * wtmp and lastlog, but we do want to allow this for pseudo-terminals. + * Because a file descriptor to a pseudo-terminal master device can only + * be obtained by processes using the pseudo-terminal, we expect such a + * descriptor on stdin. + * + * It uses the real user ID of the calling process to determine the + * username. It does allow users to log arbitrary hostnames. + */ + +int +main(int argc, char *argv[]) +{ + const char *line; + + /* Device line name. */ + if ((line = ptsname(STDIN_FILENO)) == NULL) + return (EX_USAGE); + + if ((argc == 2 || argc == 3) && strcmp(argv[1], "login") == 0) { + struct passwd *pwd; + const char *host = NULL; + + /* Username. */ + pwd = getpwuid(getuid()); + if (pwd == NULL) + return (EX_OSERR); + + /* Hostname. */ + if (argc == 3) + host = argv[2]; + + if (ulog_login(line, pwd->pw_name, host) != 0) + return (EX_OSFILE); + return (EX_OK); + } else if (argc == 2 && strcmp(argv[1], "logout") == 0) { + if (ulog_logout(line) != 0) + return (EX_OSFILE); + return (EX_OK); + } + + return (EX_USAGE); +} Modified: head/share/mk/bsd.libnames.mk ============================================================================== --- head/share/mk/bsd.libnames.mk Thu Dec 3 15:14:30 2009 (r200061) +++ head/share/mk/bsd.libnames.mk Thu Dec 3 15:48:24 2009 (r200062) @@ -151,6 +151,7 @@ LIBUGIDFW?= ${DESTDIR}${LIBDIR}/libugidf LIBUMEM?= ${DESTDIR}${LIBDIR}/libumem.a LIBUSBHID?= ${DESTDIR}${LIBDIR}/libusbhid.a LIBUSB20?= ${DESTDIR}${LIBDIR}/libusb20.a +LIBULOG?= ${DESTDIR}${LIBDIR}/libulog.a LIBUTIL?= ${DESTDIR}${LIBDIR}/libutil.a LIBUUTIL?= ${DESTDIR}${LIBDIR}/libuutil.a LIBVGL?= ${DESTDIR}${LIBDIR}/libvgl.a From owner-svn-src-head@FreeBSD.ORG Thu Dec 3 16:02:04 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9A817106568B; Thu, 3 Dec 2009 16:02:04 +0000 (UTC) (envelope-from avg@freebsd.org) Received: from citadel.icyb.net.ua (citadel.icyb.net.ua [212.40.38.140]) by mx1.freebsd.org (Postfix) with ESMTP id 41E3E8FC1C; Thu, 3 Dec 2009 16:02:02 +0000 (UTC) Received: from odyssey.starpoint.kiev.ua (alpha-e.starpoint.kiev.ua [212.40.38.101]) by citadel.icyb.net.ua (8.8.8p3/ICyb-2.3exp) with ESMTP id SAA27946; Thu, 03 Dec 2009 18:02:01 +0200 (EET) (envelope-from avg@freebsd.org) Message-ID: <4B17E0F8.1040700@freebsd.org> Date: Thu, 03 Dec 2009 18:02:00 +0200 From: Andriy Gapon User-Agent: Thunderbird 2.0.0.23 (X11/20090825) MIME-Version: 1.0 To: John Baldwin References: <200912030811.nB38BK0h046790@svn.freebsd.org> <200912030745.28650.jhb@freebsd.org> In-Reply-To: <200912030745.28650.jhb@freebsd.org> X-Enigmail-Version: 0.95.7 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r200053 - head/sys/dev/ichsmb X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Dec 2009 16:02:04 -0000 on 03/12/2009 14:45 John Baldwin said the following: > On Thursday 03 December 2009 3:11:20 am Andriy Gapon wrote: >> Author: avg >> Date: Thu Dec 3 08:11:20 2009 >> New Revision: 200053 >> URL: http://svn.freebsd.org/changeset/base/200053 >> >> Log: >> ichsmb: try attaching only to intel hardware in the default case >> >> Ideally we should attempt attaching only to known supported devices. >> But I am not sure that we have all supported PCI IDs already listed, >> and I am too young to die, err, I don't want to take the heat from >> causing a trouble to someone. >> >> MFC after: 1 week >> X-ToDo: drop the default case > > Perhaps drop the default case in 8 and 9? I actually think the default case > has caused more harm than good in the past, and I suspect that there are > actually very few supported devices that we don't already have the PCI IDs > for. > I can drop it in head now, if no one objects. And MFC to 8 after 2 weeks. -- Andriy Gapon From owner-svn-src-head@FreeBSD.ORG Thu Dec 3 16:08:01 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5D191106566B; Thu, 3 Dec 2009 16:08:01 +0000 (UTC) (envelope-from syrinx@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4BE1A8FC1B; Thu, 3 Dec 2009 16:08:00 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nB3G80jF018942; Thu, 3 Dec 2009 16:08:00 GMT (envelope-from syrinx@svn.freebsd.org) Received: (from syrinx@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nB3G80hm018936; Thu, 3 Dec 2009 16:08:00 GMT (envelope-from syrinx@svn.freebsd.org) Message-Id: <200912031608.nB3G80hm018936@svn.freebsd.org> From: Shteryana Shopova Date: Thu, 3 Dec 2009 16:08:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200063 - head/contrib/bsnmp/snmp_mibII X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Dec 2009 16:08:01 -0000 Author: syrinx Date: Thu Dec 3 16:08:00 2009 New Revision: 200063 URL: http://svn.freebsd.org/changeset/base/200063 Log: Fix a problem with high CPU consumption (up to 30%) by bsnmpd on a loaded system. Instead of constantly calling the mibII_idle function when the server is not busy call the function only once every 10 seconds to avoid bsnmpd constantly doing gettimeofday syscalls. Make the idle polling interval confugurable via begemotIfDataPoll. Reported and tested by: misho (at) aitbg (dot) com Oked by: harti MFC after: 1 week Modified: head/contrib/bsnmp/snmp_mibII/BEGEMOT-MIB2-MIB.txt head/contrib/bsnmp/snmp_mibII/mibII.c head/contrib/bsnmp/snmp_mibII/mibII.h head/contrib/bsnmp/snmp_mibII/mibII_begemot.c head/contrib/bsnmp/snmp_mibII/mibII_tree.def Modified: head/contrib/bsnmp/snmp_mibII/BEGEMOT-MIB2-MIB.txt ============================================================================== --- head/contrib/bsnmp/snmp_mibII/BEGEMOT-MIB2-MIB.txt Thu Dec 3 15:48:24 2009 (r200062) +++ head/contrib/bsnmp/snmp_mibII/BEGEMOT-MIB2-MIB.txt Thu Dec 3 16:08:00 2009 (r200063) @@ -39,7 +39,7 @@ IMPORTS FROM BEGEMOT-IP-MIB; begemotMib2 MODULE-IDENTITY - LAST-UPDATED "200602130000Z" + LAST-UPDATED "200908030000Z" ORGANIZATION "German Aerospace Center" CONTACT-INFO " Hartmut Brandt @@ -54,6 +54,12 @@ begemotMib2 MODULE-IDENTITY E-mail: harti@freebsd.org" DESCRIPTION "The MIB for private mib2 stuff." + REVISION "200908030000Z" + DESCRIPTION + "Second edition adds begemotIfDataPoll object." + REVISION "200602130000Z" + DESCRIPTION + "Initial revision." ::= { begemotIp 1 } begemotIfMaxspeed OBJECT-TYPE @@ -87,4 +93,14 @@ begemotIfForcePoll OBJECT-TYPE bit rate in its MIB." ::= { begemotMib2 3 } +begemotIfDataPoll OBJECT-TYPE + SYNTAX TimeTicks + UNITS "deciseconds" + MAX-ACCESS read-write + STATUS current + DESCRIPTION + "The rate at which the mib2 module will poll interface data." + DEFVAL { 100 } + ::= { begemotMib2 4 } + END Modified: head/contrib/bsnmp/snmp_mibII/mibII.c ============================================================================== --- head/contrib/bsnmp/snmp_mibII/mibII.c Thu Dec 3 15:48:24 2009 (r200062) +++ head/contrib/bsnmp/snmp_mibII/mibII.c Thu Dec 3 16:08:00 2009 (r200063) @@ -117,6 +117,15 @@ u_int mibif_hc_update_interval; /* HC update timer handle */ static void *hc_update_timer; +/* Idle poll timer */ +static void *mibII_poll_timer; + +/* interfaces' data poll interval */ +u_int mibII_poll_ticks; + +/* Idle poll hook */ +static void mibII_idle(void *arg __unused); + /*****************************/ static const struct asn_oid oid_ifMIB = OIDX_ifMIB; @@ -410,6 +419,20 @@ mibif_reset_hc_timer(void) mibif_hc_update_interval = ticks; } +/** + * Restart the idle poll timer. + */ +void +mibif_restart_mibII_poll_timer(void) +{ + if (mibII_poll_timer != NULL) + timer_stop(mibII_poll_timer); + + if ((mibII_poll_timer = timer_start_repeat(mibII_poll_ticks * 10, + mibII_poll_ticks * 10, mibII_idle, NULL, module)) == NULL) + syslog(LOG_ERR, "timer_start(%u): %m", mibII_poll_ticks); +} + /* * Fetch new MIB data. */ @@ -1553,7 +1576,7 @@ get_cloners(void) * Idle function */ static void -mibII_idle(void) +mibII_idle(void *arg __unused) { struct mibifa *ifa; @@ -1608,6 +1631,10 @@ mibII_start(void) ipForward_reg = or_register(&oid_ipForward, "The MIB module for the display of CIDR multipath IP Routes.", module); + + mibII_poll_timer = NULL; + mibII_poll_ticks = MIBII_POLL_TICKS; + mibif_restart_mibII_poll_timer(); } /* @@ -1651,6 +1678,11 @@ mibII_init(struct lmodule *mod, int argc static int mibII_fini(void) { + if (mibII_poll_timer != NULL ) { + timer_stop(mibII_poll_timer); + mibII_poll_timer = NULL; + } + if (route_fd != NULL) fd_deselect(route_fd); if (route != -1) @@ -1690,7 +1722,7 @@ const struct snmp_module config = { "This module implements the interface and ip groups.", mibII_init, mibII_fini, - mibII_idle, /* idle */ + NULL, /* idle */ NULL, /* dump */ NULL, /* config */ mibII_start, Modified: head/contrib/bsnmp/snmp_mibII/mibII.h ============================================================================== --- head/contrib/bsnmp/snmp_mibII/mibII.h Thu Dec 3 15:48:24 2009 (r200062) +++ head/contrib/bsnmp/snmp_mibII/mibII.h Thu Dec 3 16:08:00 2009 (r200063) @@ -211,6 +211,14 @@ extern u_int mibif_hc_update_interval; /* re-compute update interval */ void mibif_reset_hc_timer(void); +/* interfaces' data poll interval */ +extern u_int mibII_poll_ticks; + +/* restart the data poll timer */ +void mibif_restart_mibII_poll_timer(void); + +#define MIBII_POLL_TICKS 100 + /* get interfaces and interface addresses. */ void mib_fetch_interfaces(void); Modified: head/contrib/bsnmp/snmp_mibII/mibII_begemot.c ============================================================================== --- head/contrib/bsnmp/snmp_mibII/mibII_begemot.c Thu Dec 3 15:48:24 2009 (r200062) +++ head/contrib/bsnmp/snmp_mibII/mibII_begemot.c Thu Dec 3 16:08:00 2009 (r200063) @@ -59,6 +59,11 @@ op_begemot_mibII(struct snmp_context *ct ctx->scratch->int1 = mibif_force_hc_update_interval; mibif_force_hc_update_interval = value->v.uint32; return (SNMP_ERR_NOERROR); + + case LEAF_begemotIfDataPoll: + ctx->scratch->int1 = mibII_poll_ticks; + mibII_poll_ticks = value->v.uint32; + return (SNMP_ERR_NOERROR); } abort(); @@ -68,6 +73,10 @@ op_begemot_mibII(struct snmp_context *ct case LEAF_begemotIfForcePoll: mibif_force_hc_update_interval = ctx->scratch->int1; return (SNMP_ERR_NOERROR); + + case LEAF_begemotIfDataPoll: + mibII_poll_ticks = ctx->scratch->int1; + return (SNMP_ERR_NOERROR); } abort(); @@ -78,6 +87,10 @@ op_begemot_mibII(struct snmp_context *ct mibif_force_hc_update_interval = ctx->scratch->int1; mibif_reset_hc_timer(); return (SNMP_ERR_NOERROR); + + case LEAF_begemotIfDataPoll: + mibif_restart_mibII_poll_timer(); + return (SNMP_ERR_NOERROR); } abort(); } @@ -98,6 +111,10 @@ op_begemot_mibII(struct snmp_context *ct case LEAF_begemotIfForcePoll: value->v.uint32 = mibif_force_hc_update_interval; return (SNMP_ERR_NOERROR); + + case LEAF_begemotIfDataPoll: + value->v.uint32 = mibII_poll_ticks; + return (SNMP_ERR_NOERROR); } abort(); } Modified: head/contrib/bsnmp/snmp_mibII/mibII_tree.def ============================================================================== --- head/contrib/bsnmp/snmp_mibII/mibII_tree.def Thu Dec 3 15:48:24 2009 (r200062) +++ head/contrib/bsnmp/snmp_mibII/mibII_tree.def Thu Dec 3 16:08:00 2009 (r200063) @@ -240,6 +240,7 @@ (1 begemotIfMaxspeed COUNTER64 op_begemot_mibII GET) (2 begemotIfPoll TIMETICKS op_begemot_mibII GET) (3 begemotIfForcePoll TIMETICKS op_begemot_mibII GET SET) + (4 begemotIfDataPoll TIMETICKS op_begemot_mibII GET SET) ) ) ) From owner-svn-src-head@FreeBSD.ORG Thu Dec 3 16:10:22 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DF7A0106566C; Thu, 3 Dec 2009 16:10:21 +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 CEBD28FC1D; Thu, 3 Dec 2009 16:10:21 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nB3GALxv019036; Thu, 3 Dec 2009 16:10:21 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nB3GALIc019033; Thu, 3 Dec 2009 16:10:21 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <200912031610.nB3GALIc019033@svn.freebsd.org> From: Andriy Gapon Date: Thu, 3 Dec 2009 16:10:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200064 - in head/sys: amd64/amd64 i386/i386 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Dec 2009 16:10:22 -0000 Author: avg Date: Thu Dec 3 16:10:21 2009 New Revision: 200064 URL: http://svn.freebsd.org/changeset/base/200064 Log: mca: small enhancements related to cpu quirks - use utility macros for CPU family/model checking - limit Intel P6 quirk to pre-Nehalem models (taken from OpenSolaris) - add AMD GartTblWkEn quirk for families 0Fh and 10h; I haven't experienced any problems without the quirk but both Linux and OpenSolaris do this - slightly re-arrange quirk code to provide for the future generalization and separation of vendor-specific quirk functions Reviewed by: jhb MFC after: 1 week Modified: head/sys/amd64/amd64/mca.c head/sys/i386/i386/mca.c Modified: head/sys/amd64/amd64/mca.c ============================================================================== --- head/sys/amd64/amd64/mca.c Thu Dec 3 16:08:00 2009 (r200063) +++ head/sys/amd64/amd64/mca.c Thu Dec 3 16:10:21 2009 (r200064) @@ -43,6 +43,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -478,6 +479,8 @@ void mca_init(void) { uint64_t mcg_cap; + uint64_t ctl; + int skip; int i; /* MCE is required. */ @@ -495,15 +498,26 @@ mca_init(void) wrmsr(MSR_MCG_CTL, MCG_CTL_ENABLE); for (i = 0; i < (mcg_cap & MCG_CAP_COUNT); i++) { - /* - * Enable logging of all errors. For P6 - * processors, MC0_CTL is always enabled. - * - * XXX: Better CPU test needed here? - */ - if (!(i == 0 && (cpu_id & 0xf00) == 0x600)) - wrmsr(MSR_MC_CTL(i), 0xffffffffffffffffUL); + /* By default enable logging of all errors. */ + ctl = 0xffffffffffffffffUL; + skip = 0; + + if (cpu_vendor_id == CPU_VENDOR_INTEL) { + /* + * For P6 models before Nehalem MC0_CTL is + * always enabled and reserved. + */ + if (i == 0 && CPUID_TO_FAMILY(cpu_id) == 0x6 + && CPUID_TO_MODEL(cpu_id) < 0x1a) + skip = 1; + } else if (cpu_vendor_id == CPU_VENDOR_AMD) { + /* BKDG for Family 10h: unset GartTblWkEn. */ + if (i == 4 && CPUID_TO_FAMILY(cpu_id) >= 0xf) + ctl &= ~(1UL << 10); + } + if (!skip) + wrmsr(MSR_MC_CTL(i), ctl); /* Clear all errors. */ wrmsr(MSR_MC_STATUS(i), 0); } Modified: head/sys/i386/i386/mca.c ============================================================================== --- head/sys/i386/i386/mca.c Thu Dec 3 16:08:00 2009 (r200063) +++ head/sys/i386/i386/mca.c Thu Dec 3 16:10:21 2009 (r200064) @@ -43,6 +43,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -478,6 +479,8 @@ void mca_init(void) { uint64_t mcg_cap; + uint64_t ctl; + int skip; int i; /* MCE is required. */ @@ -495,15 +498,26 @@ mca_init(void) wrmsr(MSR_MCG_CTL, MCG_CTL_ENABLE); for (i = 0; i < (mcg_cap & MCG_CAP_COUNT); i++) { - /* - * Enable logging of all errors. For P6 - * processors, MC0_CTL is always enabled. - * - * XXX: Better CPU test needed here? - */ - if (!(i == 0 && (cpu_id & 0xf00) == 0x600)) - wrmsr(MSR_MC_CTL(i), 0xffffffffffffffffUL); + /* By default enable logging of all errors. */ + ctl = 0xffffffffffffffffUL; + skip = 0; + + if (cpu_vendor_id == CPU_VENDOR_INTEL) { + /* + * For P6 models before Nehalem MC0_CTL is + * always enabled and reserved. + */ + if (i == 0 && CPUID_TO_FAMILY(cpu_id) == 0x6 + && CPUID_TO_MODEL(cpu_id) < 0x1a) + skip = 1; + } else if (cpu_vendor_id == CPU_VENDOR_AMD) { + /* BKDG for Family 10h: unset GartTblWkEn. */ + if (i == 4 && CPUID_TO_FAMILY(cpu_id) >= 0xf) + ctl &= ~(1UL << 10); + } + if (!skip) + wrmsr(MSR_MC_CTL(i), ctl); /* Clear all errors. */ wrmsr(MSR_MC_STATUS(i), 0); } From owner-svn-src-head@FreeBSD.ORG Thu Dec 3 16:33:48 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 345381065670; Thu, 3 Dec 2009 16:33:48 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1917E8FC1C; Thu, 3 Dec 2009 16:33:48 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nB3GXlZY019592; Thu, 3 Dec 2009 16:33:47 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nB3GXlQu019588; Thu, 3 Dec 2009 16:33:47 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <200912031633.nB3GXlQu019588@svn.freebsd.org> From: Ed Schouten Date: Thu, 3 Dec 2009 16:33:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200065 - head/lib/libulog X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Dec 2009 16:33:48 -0000 Author: ed Date: Thu Dec 3 16:33:47 2009 New Revision: 200065 URL: http://svn.freebsd.org/changeset/base/200065 Log: Also implement ut_type. I thought we couldn't emulate this field, but we can derive this field by looking at special values for ut_host, ut_line and ut_name. Modified: head/lib/libulog/ulog.h head/lib/libulog/ulog_getutxent.3 head/lib/libulog/ulog_getutxent.c Modified: head/lib/libulog/ulog.h ============================================================================== --- head/lib/libulog/ulog.h Thu Dec 3 16:10:21 2009 (r200064) +++ head/lib/libulog/ulog.h Thu Dec 3 16:33:47 2009 (r200065) @@ -63,8 +63,23 @@ struct ulog_utmpx { char *ut_host; #if 0 pid_t ut_pid; +#endif short ut_type; +#define EMPTY 0 +#if 0 +#define BOOT_TIME 1 #endif +#define OLD_TIME 2 +#define NEW_TIME 3 +#if 0 +#define USER_PROCESS 4 +#define INIT_PROCESS 5 +#endif +#define LOGIN_PROCESS 6 +#define DEAD_PROCESS 7 + +#define SHUTDOWN_TIME 8 +#define REBOOT_TIME 9 struct timeval ut_tv; }; Modified: head/lib/libulog/ulog_getutxent.3 ============================================================================== --- head/lib/libulog/ulog_getutxent.3 Thu Dec 3 16:10:21 2009 (r200064) +++ head/lib/libulog/ulog_getutxent.3 Thu Dec 3 16:33:47 2009 (r200065) @@ -52,6 +52,7 @@ struct ulog_utmpx { char *ut_user; /* Username. */ char *ut_line; /* TTY device. */ char *ut_host; /* Remote hostname. */ + short ut_type; /* Type of entry. */ struct timeval ut_tv; /* Timestamp. */ }; .Ed @@ -67,6 +68,27 @@ directory. .It Fa ut_host An optional hostname of a remote system, if the login session is provided through a networked login service. +.It Fa ut_type +The +.Fa ut_type +field contains the type of the message, which may have one of the +following values: +.Bl -tag -width LOGIN_PROCESS +.It Dv EMPTY +No valid user accounting information. +.It Dv OLD_TIME +Identifies time when system clock changed. +.It Dv NEW_TIME +Identifies time after system clock changed. +.It Dv LOGIN_PROCESS +Identifies the session leader of a logged in user. +.It Dv DEAD_PROCESS +Identifies a session leader who has exited. +.It Dv SHUTDOWN_TIME +Identifies time when system was shut down. +.It Dv REBOOT_TIME +Identifies time when system was rebooted. +.El .It Fa ut_tv Timestamp indicating when the entry was last modified. .El Modified: head/lib/libulog/ulog_getutxent.c ============================================================================== --- head/lib/libulog/ulog_getutxent.c Thu Dec 3 16:10:21 2009 (r200064) +++ head/lib/libulog/ulog_getutxent.c Thu Dec 3 16:33:47 2009 (r200065) @@ -70,6 +70,21 @@ ulog_getutxent(void) COPY_STRING(host); utx.ut_tv.tv_sec = _time32_to_time(ut.ut_time); utx.ut_tv.tv_usec = 0; +#define MATCH(field, value) (strcmp(utx.ut_ ## field, (value)) == 0) + if (MATCH(user, "date") && MATCH(line, "|")) + utx.ut_type = OLD_TIME; + else if (MATCH(user, "date") && MATCH(line, "{")) + utx.ut_type = NEW_TIME; + else if (MATCH(user, "shutdown") && MATCH(line, "~")) + utx.ut_type = SHUTDOWN_TIME; + else if (MATCH(user, "reboot") && MATCH(line, "~")) + utx.ut_type = REBOOT_TIME; + else if (MATCH(user, "") && MATCH(host, "")) + utx.ut_type = DEAD_PROCESS; + else if (!MATCH(user, "")) + utx.ut_type = LOGIN_PROCESS; + else + utx.ut_type = EMPTY; return (&utx); } From owner-svn-src-head@FreeBSD.ORG Thu Dec 3 16:42:19 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4343B1065697; Thu, 3 Dec 2009 16:42:19 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 279CB8FC1E; Thu, 3 Dec 2009 16:42:19 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nB3GgJYe019820; Thu, 3 Dec 2009 16:42:19 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nB3GgJHh019817; Thu, 3 Dec 2009 16:42:19 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <200912031642.nB3GgJHh019817@svn.freebsd.org> From: Ed Schouten Date: Thu, 3 Dec 2009 16:42:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200066 - head/usr.bin/users X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Dec 2009 16:42:19 -0000 Author: ed Date: Thu Dec 3 16:42:18 2009 New Revision: 200066 URL: http://svn.freebsd.org/changeset/base/200066 Log: Port users(1) to libulog. Instead of digging through the utmp database by hand, use proper API calls to do so. Instead of parsing entries with a non-empty ut_user, we now look at LOGIN_PROCESS entries. Modified: head/usr.bin/users/Makefile head/usr.bin/users/users.c Modified: head/usr.bin/users/Makefile ============================================================================== --- head/usr.bin/users/Makefile Thu Dec 3 16:33:47 2009 (r200065) +++ head/usr.bin/users/Makefile Thu Dec 3 16:42:18 2009 (r200066) @@ -3,4 +3,7 @@ PROG= users +DPADD= ${LIBULOG} +LDADD= -lulog + .include Modified: head/usr.bin/users/users.c ============================================================================== --- head/usr.bin/users/users.c Thu Dec 3 16:33:47 2009 (r200065) +++ head/usr.bin/users/users.c Thu Dec 3 16:42:18 2009 (r200066) @@ -45,15 +45,16 @@ static const char rcsid[] = "$FreeBSD$"; #endif /* not lint */ +#include #include #include #include #include #include +#include #include -#include -typedef char namebuf[UT_NAMESIZE]; +typedef char namebuf[MAXLOGNAME]; int scmp(const void *, const void *); static void usage(void); @@ -65,7 +66,7 @@ main(int argc, char **argv) int ncnt = 0; int nmax = 0; int cnt; - struct utmp utmp; + struct ulog_utmpx *ut; int ch; while ((ch = getopt(argc, argv, "")) != -1) @@ -77,28 +78,28 @@ main(int argc, char **argv) argc -= optind; argv += optind; - if (!freopen(_PATH_UTMP, "r", stdin)) - errx(1, "can't open %s", _PATH_UTMP); - while (fread((char *)&utmp, sizeof(utmp), 1, stdin) == 1) { - if (*utmp.ut_name) { - if (ncnt >= nmax) { - nmax += 32; - names = realloc(names, sizeof (*names) * nmax); - if (!names) { - errx(1, "realloc"); - /* NOTREACHED */ - } + ulog_setutxent(); + while ((ut = ulog_getutxent()) != NULL) { + if (ut->ut_type != LOGIN_PROCESS) + continue; + if (ncnt >= nmax) { + nmax += 32; + names = realloc(names, sizeof(*names) * nmax); + if (!names) { + errx(1, "realloc"); + /* NOTREACHED */ } - (void)strncpy(names[ncnt], utmp.ut_name, UT_NAMESIZE); - ++ncnt; } + (void)strlcpy(names[ncnt], ut->ut_user, sizeof(*names)); + ++ncnt; } - if (ncnt) { - qsort(names, ncnt, UT_NAMESIZE, scmp); - (void)printf("%.*s", UT_NAMESIZE, names[0]); + ulog_endutxent(); + if (ncnt > 0) { + qsort(names, ncnt, sizeof(namebuf), scmp); + (void)printf("%s", names[0]); for (cnt = 1; cnt < ncnt; ++cnt) - if (strncmp(names[cnt], names[cnt - 1], UT_NAMESIZE)) - (void)printf(" %.*s", UT_NAMESIZE, names[cnt]); + if (strcmp(names[cnt], names[cnt - 1]) != 0) + (void)printf(" %s", names[cnt]); (void)printf("\n"); } exit(0); @@ -114,5 +115,6 @@ usage(void) int scmp(const void *p, const void *q) { - return(strncmp(p, q, UT_NAMESIZE)); + + return (strcmp(p, q)); } From owner-svn-src-head@FreeBSD.ORG Thu Dec 3 17:05:37 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 161921065672; Thu, 3 Dec 2009 17:05:37 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E049A8FC1B; Thu, 3 Dec 2009 17:05:36 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nB3H5aP6020337; Thu, 3 Dec 2009 17:05:36 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nB3H5amN020332; Thu, 3 Dec 2009 17:05:36 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <200912031705.nB3H5amN020332@svn.freebsd.org> From: Ed Schouten Date: Thu, 3 Dec 2009 17:05:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200067 - in head: lib/libulog usr.bin/users X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Dec 2009 17:05:37 -0000 Author: ed Date: Thu Dec 3 17:05:36 2009 New Revision: 200067 URL: http://svn.freebsd.org/changeset/base/200067 Log: Use USER_PROCESS instead of LOGIN_PROCESS. POSIX isn't clear about how the fields should be used, but according to utmpx(5) on Linux, LOGIN_PROCESS refers to a TTY that's still running a getty. Modified: head/lib/libulog/ulog.h head/lib/libulog/ulog_getutxent.3 head/lib/libulog/ulog_getutxent.c head/usr.bin/users/users.c Modified: head/lib/libulog/ulog.h ============================================================================== --- head/lib/libulog/ulog.h Thu Dec 3 16:42:18 2009 (r200066) +++ head/lib/libulog/ulog.h Thu Dec 3 17:05:36 2009 (r200067) @@ -71,11 +71,11 @@ struct ulog_utmpx { #endif #define OLD_TIME 2 #define NEW_TIME 3 -#if 0 #define USER_PROCESS 4 +#if 0 #define INIT_PROCESS 5 -#endif #define LOGIN_PROCESS 6 +#endif #define DEAD_PROCESS 7 #define SHUTDOWN_TIME 8 Modified: head/lib/libulog/ulog_getutxent.3 ============================================================================== --- head/lib/libulog/ulog_getutxent.3 Thu Dec 3 16:42:18 2009 (r200066) +++ head/lib/libulog/ulog_getutxent.3 Thu Dec 3 17:05:36 2009 (r200067) @@ -73,15 +73,15 @@ The .Fa ut_type field contains the type of the message, which may have one of the following values: -.Bl -tag -width LOGIN_PROCESS +.Bl -tag -width SHUTDOWN_TIME .It Dv EMPTY No valid user accounting information. .It Dv OLD_TIME Identifies time when system clock changed. .It Dv NEW_TIME Identifies time after system clock changed. -.It Dv LOGIN_PROCESS -Identifies the session leader of a logged in user. +.It Dv USER_PROCESS +Identifies a process. .It Dv DEAD_PROCESS Identifies a session leader who has exited. .It Dv SHUTDOWN_TIME Modified: head/lib/libulog/ulog_getutxent.c ============================================================================== --- head/lib/libulog/ulog_getutxent.c Thu Dec 3 16:42:18 2009 (r200066) +++ head/lib/libulog/ulog_getutxent.c Thu Dec 3 17:05:36 2009 (r200067) @@ -82,7 +82,7 @@ ulog_getutxent(void) else if (MATCH(user, "") && MATCH(host, "")) utx.ut_type = DEAD_PROCESS; else if (!MATCH(user, "")) - utx.ut_type = LOGIN_PROCESS; + utx.ut_type = USER_PROCESS; else utx.ut_type = EMPTY; Modified: head/usr.bin/users/users.c ============================================================================== --- head/usr.bin/users/users.c Thu Dec 3 16:42:18 2009 (r200066) +++ head/usr.bin/users/users.c Thu Dec 3 17:05:36 2009 (r200067) @@ -80,7 +80,7 @@ main(int argc, char **argv) ulog_setutxent(); while ((ut = ulog_getutxent()) != NULL) { - if (ut->ut_type != LOGIN_PROCESS) + if (ut->ut_type != USER_PROCESS) continue; if (ncnt >= nmax) { nmax += 32; From owner-svn-src-head@FreeBSD.ORG Thu Dec 3 18:02:56 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0FFE1106566B; Thu, 3 Dec 2009 18:02:56 +0000 (UTC) (envelope-from rdivacky@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id F397E8FC1A; Thu, 3 Dec 2009 18:02:55 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nB3I2t8Q021474; Thu, 3 Dec 2009 18:02:55 GMT (envelope-from rdivacky@svn.freebsd.org) Received: (from rdivacky@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nB3I2txS021472; Thu, 3 Dec 2009 18:02:55 GMT (envelope-from rdivacky@svn.freebsd.org) Message-Id: <200912031802.nB3I2txS021472@svn.freebsd.org> From: Roman Divacky Date: Thu, 3 Dec 2009 18:02:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200068 - head/usr.bin X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Dec 2009 18:02:56 -0000 Author: rdivacky Date: Thu Dec 3 18:02:55 2009 New Revision: 200068 URL: http://svn.freebsd.org/changeset/base/200068 Log: Connect unzip to the build. Approved by: ed (mentor) Approved by: des (unzip author) Tested by: exp ports build (miwi) Modified: head/usr.bin/Makefile Modified: head/usr.bin/Makefile ============================================================================== --- head/usr.bin/Makefile Thu Dec 3 17:05:36 2009 (r200067) +++ head/usr.bin/Makefile Thu Dec 3 18:02:55 2009 (r200068) @@ -203,6 +203,7 @@ SUBDIR= alias \ unexpand \ ${_unifdef} \ uniq \ + unzip \ units \ unvis \ ${_usbhidaction} \ From owner-svn-src-head@FreeBSD.ORG Thu Dec 3 18:03:42 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EC5041065670; Thu, 3 Dec 2009 18:03:42 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DAB8B8FC12; Thu, 3 Dec 2009 18:03:42 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nB3I3gJE021538; Thu, 3 Dec 2009 18:03:42 GMT (envelope-from trasz@svn.freebsd.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nB3I3gtl021530; Thu, 3 Dec 2009 18:03:42 GMT (envelope-from trasz@svn.freebsd.org) Message-Id: <200912031803.nB3I3gtl021530@svn.freebsd.org> From: Edward Tomasz Napierala Date: Thu, 3 Dec 2009 18:03:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200069 - in head/sys/fs: nfs nfsclient X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Dec 2009 18:03:43 -0000 Author: trasz Date: Thu Dec 3 18:03:42 2009 New Revision: 200069 URL: http://svn.freebsd.org/changeset/base/200069 Log: Remove unneeded ifdefs. Reviewed by: rmacklem Modified: head/sys/fs/nfs/nfs_commonacl.c head/sys/fs/nfs/nfs_commonport.c head/sys/fs/nfs/nfs_commonsubs.c head/sys/fs/nfs/nfs_var.h head/sys/fs/nfs/nfsport.h head/sys/fs/nfsclient/nfs_clrpcops.c head/sys/fs/nfsclient/nfs_clvnops.c Modified: head/sys/fs/nfs/nfs_commonacl.c ============================================================================== --- head/sys/fs/nfs/nfs_commonacl.c Thu Dec 3 18:02:55 2009 (r200068) +++ head/sys/fs/nfs/nfs_commonacl.c Thu Dec 3 18:03:42 2009 (r200069) @@ -37,7 +37,6 @@ extern int nfsrv_useacl; static int nfsrv_acemasktoperm(u_int32_t acetype, u_int32_t mask, int owner, enum vtype type, acl_perm_t *permp); -#if defined(NFS4_ACL_EXTATTR_NAME) /* * Handle xdr for an ace. */ @@ -263,189 +262,7 @@ nfsrv_acemasktoperm(u_int32_t acetype, u *permp = perm; return (0); } -#else -/* - * Handle xdr for an ace. - */ -APPLESTATIC int -nfsrv_dissectace(struct nfsrv_descript *nd, struct acl_entry *acep, - int *aceerrp, int *acesizep, NFSPROC_T *p) -{ - u_int32_t *tl; - int len, gotid = 0, owner = 0, error = 0, aceerr = 0; - u_char *name, namestr[NFSV4_SMALLSTR + 1]; - u_int32_t flag, mask, acetype; - gid_t gid; - uid_t uid; - - *aceerrp = 0; - NFSM_DISSECT(tl, u_int32_t *, 4 * NFSX_UNSIGNED); - acetype = fxdr_unsigned(u_int32_t, *tl++); - flag = fxdr_unsigned(u_int32_t, *tl++); - mask = fxdr_unsigned(u_int32_t, *tl++); - len = fxdr_unsigned(int, *tl); - if (len < 0) { - return (NFSERR_BADXDR); - } else if (len == 0) { - /* Netapp filers return a 0 length who for nil users */ - acep->ae_tag = ACL_UNDEFINED_TAG; - acep->ae_id = ACL_UNDEFINED_ID; - acep->ae_perm = (acl_perm_t)0; - if (acesizep) - *acesizep = 4 * NFSX_UNSIGNED; - return (0); - } - if (len > NFSV4_SMALLSTR) - name = malloc(len + 1, M_NFSSTRING, M_WAITOK); - else - name = namestr; - error = nfsrv_mtostr(nd, name, len); - if (error) { - if (len > NFSV4_SMALLSTR) - free(name, M_NFSSTRING); - return (error); - } - if (len == 6) { - if (!NFSBCMP(name, "OWNER@", 6)) { - acep->ae_tag = ACL_USER_OBJ; - acep->ae_id = ACL_UNDEFINED_ID; - owner = 1; - gotid = 1; - } else if (!NFSBCMP(name, "GROUP@", 6)) { - acep->ae_tag = ACL_GROUP_OBJ; - acep->ae_id = ACL_UNDEFINED_ID; - gotid = 1; - flag &= ~NFSV4ACE_IDENTIFIERGROUP; - } - } else if (len == 9 && !NFSBCMP(name, "EVERYONE@", 9)) { - acep->ae_tag = ACL_OTHER; - acep->ae_id = ACL_UNDEFINED_ID; - gotid = 1; - } - if (!gotid) { - if (flag & NFSV4ACE_IDENTIFIERGROUP) { - flag &= ~NFSV4ACE_IDENTIFIERGROUP; - acep->ae_tag = ACL_GROUP; - aceerr = nfsv4_strtogid(name, len, &gid, p); - if (!aceerr) - acep->ae_id = (uid_t)gid; - } else { - acep->ae_tag = ACL_USER; - aceerr = nfsv4_strtouid(name, len, &uid, p); - if (!aceerr) - acep->ae_id = uid; - } - } - if (len > NFSV4_SMALLSTR) - free(name, M_NFSSTRING); - - /* - * Now, check for unsupported types or flag bits. - */ - if (!aceerr && ((acetype != NFSV4ACE_ALLOWEDTYPE && - acetype != NFSV4ACE_AUDITTYPE && acetype != NFSV4ACE_ALARMTYPE - && acetype != NFSV4ACE_DENIEDTYPE) || flag)) - aceerr = NFSERR_ATTRNOTSUPP; - - /* - * And turn the mask into perm bits. - */ - if (!aceerr) - aceerr = nfsrv_acemasktoperm(acetype, mask, owner, VREG, - &acep->ae_perm); - *aceerrp = aceerr; - if (acesizep) - *acesizep = NFSM_RNDUP(len) + (4 * NFSX_UNSIGNED); - return (0); -nfsmout: - return (error); -} - -/* - * Turn an NFSv4 ace mask into R/W/X flag bits. - */ -static int -nfsrv_acemasktoperm(u_int32_t acetype, u_int32_t mask, int owner, - enum vtype type, acl_perm_t *permp) -{ - acl_perm_t perm = 0x0; - - if (acetype != NFSV4ACE_ALLOWEDTYPE && acetype != NFSV4ACE_DENIEDTYPE){ - if (mask & ~NFSV4ACE_AUDITMASK) - return (NFSERR_ATTRNOTSUPP); - } - if (mask & NFSV4ACE_DELETE) { - return (NFSERR_ATTRNOTSUPP); - } - if (acetype == NFSV4ACE_DENIEDTYPE) { - if (mask & NFSV4ACE_ALLFILESMASK) { - return (NFSERR_ATTRNOTSUPP); - } - if (owner) { - if (mask & NFSV4ACE_OWNERMASK) { - return (NFSERR_ATTRNOTSUPP); - } - } else { - if ((mask & NFSV4ACE_OWNERMASK) != NFSV4ACE_OWNERMASK) { - return (NFSERR_ATTRNOTSUPP); - } - mask &= ~NFSV4ACE_OWNERMASK; - } - } else if (acetype == NFSV4ACE_ALLOWEDTYPE) { - if ((mask & NFSV4ACE_ALLFILESMASK) != NFSV4ACE_ALLFILESMASK) { - return (NFSERR_ATTRNOTSUPP); - } - mask &= ~NFSV4ACE_ALLFILESMASK; - if (owner) { - if ((mask & NFSV4ACE_OWNERMASK) != NFSV4ACE_OWNERMASK) { - return (NFSERR_ATTRNOTSUPP); - } - mask &= ~NFSV4ACE_OWNERMASK; - } else if (mask & NFSV4ACE_OWNERMASK) { - return (NFSERR_ATTRNOTSUPP); - } - } - if (type == VDIR) { - if ((mask & NFSV4ACE_DIRREADMASK) == NFSV4ACE_DIRREADMASK) { - perm |= ACL_READ; - mask &= ~NFSV4ACE_DIRREADMASK; - } - if ((mask & NFSV4ACE_DIRWRITEMASK) == NFSV4ACE_DIRWRITEMASK) { - perm |= ACL_WRITE; - mask &= ~NFSV4ACE_DIRWRITEMASK; - } - if ((mask & NFSV4ACE_DIREXECUTEMASK)==NFSV4ACE_DIREXECUTEMASK){ - perm |= ACL_EXECUTE; - mask &= ~NFSV4ACE_DIREXECUTEMASK; - } - } else { - if (acetype == NFSV4ACE_DENIEDTYPE && - (mask & NFSV4ACE_SYNCHRONIZE)) { - return (NFSERR_ATTRNOTSUPP); - } - mask &= ~(NFSV4ACE_SYNCHRONIZE | NFSV4ACE_DELETECHILD); - if ((mask & NFSV4ACE_READMASK) == NFSV4ACE_READMASK) { - perm |= ACL_READ; - mask &= ~NFSV4ACE_READMASK; - } - if ((mask & NFSV4ACE_WRITEMASK) == NFSV4ACE_WRITEMASK) { - perm |= ACL_WRITE; - mask &= ~NFSV4ACE_WRITEMASK; - } - if ((mask & NFSV4ACE_EXECUTEMASK) == NFSV4ACE_EXECUTEMASK) { - perm |= ACL_EXECUTE; - mask &= ~NFSV4ACE_EXECUTEMASK; - } - } - if (mask) { - return (NFSERR_ATTRNOTSUPP); - } - *permp = perm; - return (0); -} -#endif /* !NFS4_ACL_EXTATTR_NAME */ -#ifdef NFS4_ACL_EXTATTR_NAME /* local functions */ static int nfsrv_buildace(struct nfsrv_descript *, u_char *, int, enum vtype, int, int, struct acl_entry *); @@ -742,5 +559,3 @@ nfsrv_compareacl(NFSACL_T *aclp1, NFSACL } return (0); } - -#endif /* NFS4_ACL_EXTATTR_NAME */ Modified: head/sys/fs/nfs/nfs_commonport.c ============================================================================== --- head/sys/fs/nfs/nfs_commonport.c Thu Dec 3 18:02:55 2009 (r200068) +++ head/sys/fs/nfs/nfs_commonport.c Thu Dec 3 18:03:42 2009 (r200069) @@ -421,7 +421,6 @@ newnfs_portinit(void) mtx_init(&nfs_state_mutex, "nfs_state_mutex", NULL, MTX_DEF); } -#ifdef NFS4_ACL_EXTATTR_NAME /* * Determine if the file system supports NFSv4 ACLs. * Return 1 if it does, 0 otherwise. @@ -441,7 +440,6 @@ nfs_supportsnfsv4acls(struct mount *mp) } return (0); } -#endif /* NFS4_ACL_EXTATTR_NAME */ extern int (*nfsd_call_nfscommon)(struct thread *, struct nfssvc_args *); Modified: head/sys/fs/nfs/nfs_commonsubs.c ============================================================================== --- head/sys/fs/nfs/nfs_commonsubs.c Thu Dec 3 18:02:55 2009 (r200068) +++ head/sys/fs/nfs/nfs_commonsubs.c Thu Dec 3 18:03:42 2009 (r200069) @@ -650,10 +650,8 @@ nfsrv_dissectacl(struct nfsrv_descript * int acecnt, error = 0, aceerr = 0, acesize; *aclerrp = 0; -#ifdef NFS4_ACL_EXTATTR_NAME if (aclp) aclp->acl_cnt = 0; -#endif /* * Parse out the ace entries and expect them to conform to * what can be supported by R/W/X bits. @@ -661,28 +659,22 @@ nfsrv_dissectacl(struct nfsrv_descript * NFSM_DISSECT(tl, u_int32_t *, NFSX_UNSIGNED); aclsize = NFSX_UNSIGNED; acecnt = fxdr_unsigned(int, *tl); -#ifdef NFS4_ACL_EXTATTR_NAME if (acecnt > ACL_MAX_ENTRIES) aceerr = 1; -#endif if (nfsrv_useacl == 0) aceerr = 1; for (i = 0; i < acecnt; i++) { -#ifdef NFS4_ACL_EXTATTR_NAME if (aclp && !aceerr) error = nfsrv_dissectace(nd, &aclp->acl_entry[i], &aceerr, &acesize, p); else -#endif error = nfsrv_skipace(nd, &acesize); if (error) return (error); aclsize += acesize; } -#ifdef NFS4_ACL_EXTATTR_NAME if (aclp && !aceerr) aclp->acl_cnt = acecnt; -#endif if (aceerr) *aclerrp = aceerr; if (aclsizep) @@ -1014,7 +1006,6 @@ nfsv4_loadattr(struct nfsrv_descript *nd case NFSATTRBIT_ACL: if (compare) { if (!(*retcmpp)) { -#ifdef NFS4_ACL_EXTATTR_NAME if (nfsrv_useacl) { NFSACL_T *naclp; @@ -1028,9 +1019,7 @@ nfsv4_loadattr(struct nfsrv_descript *nd if (aceerr || nfsrv_compareacl(aclp, naclp)) *retcmpp = NFSERR_NOTSAME; acl_free(naclp); - } else -#endif - { + } else { error = nfsrv_dissectacl(nd, NULL, &aceerr, &cnt, p); *retcmpp = NFSERR_ATTRNOTSUPP; @@ -1932,9 +1921,7 @@ nfsv4_fillattr(struct nfsrv_descript *nd aclp = saclp; } else { NFSCLRNOTFILLABLE_ATTRBIT(retbitp); -#ifdef NFS4_ACL_EXTATTR_NAME naclp = acl_alloc(M_WAITOK); -#endif aclp = naclp; } nfsvno_getfs(&fsinf, isdgram); @@ -1957,21 +1944,15 @@ nfsv4_fillattr(struct nfsrv_descript *nd /* * And the NFSv4 ACL... */ - if (NFSISSET_ATTRBIT(retbitp, NFSATTRBIT_ACLSUPPORT) -#ifdef NFS4_ACL_EXTATTR_NAME - && (nfsrv_useacl == 0 || ((cred != NULL || p != NULL) && - !NFSHASNFS4ACL(vnode_mount(vp)))) -#endif - ) { + if (NFSISSET_ATTRBIT(retbitp, NFSATTRBIT_ACLSUPPORT) && + (nfsrv_useacl == 0 || ((cred != NULL || p != NULL) && + !NFSHASNFS4ACL(vnode_mount(vp))))) { NFSCLRBIT_ATTRBIT(retbitp, NFSATTRBIT_ACLSUPPORT); } if (NFSISSET_ATTRBIT(retbitp, NFSATTRBIT_ACL)) { -#ifdef NFS4_ACL_EXTATTR_NAME if (nfsrv_useacl == 0 || ((cred != NULL || p != NULL) && !NFSHASNFS4ACL(vnode_mount(vp)))) { -#endif NFSCLRBIT_ATTRBIT(retbitp, NFSATTRBIT_ACL); -#ifdef NFS4_ACL_EXTATTR_NAME } else if (naclp != NULL) { NFSVOPLOCK(vp, LK_EXCLUSIVE | LK_RETRY, p); error = VOP_ACCESS(vp, VREAD_ACL, cred, p); @@ -1987,7 +1968,6 @@ nfsv4_fillattr(struct nfsrv_descript *nd NFSCLRBIT_ATTRBIT(retbitp, NFSATTRBIT_ACL); } } -#endif } /* * Put out the attribute bitmap for the ones being filled in @@ -2005,11 +1985,8 @@ nfsv4_fillattr(struct nfsrv_descript *nd switch (bitpos) { case NFSATTRBIT_SUPPORTEDATTRS: NFSSETSUPP_ATTRBIT(&attrbits); -#ifdef NFS4_ACL_EXTATTR_NAME if (nfsrv_useacl == 0 || ((cred != NULL || p != NULL) - && !NFSHASNFS4ACL(vnode_mount(vp)))) -#endif - { + && !NFSHASNFS4ACL(vnode_mount(vp)))) { NFSCLRBIT_ATTRBIT(&attrbits,NFSATTRBIT_ACLSUPPORT); NFSCLRBIT_ATTRBIT(&attrbits,NFSATTRBIT_ACL); } @@ -2082,7 +2059,6 @@ nfsv4_fillattr(struct nfsrv_descript *nd /* * Recommended Attributes. (Only the supported ones.) */ -#ifdef NFS4_ACL_EXTATTR_NAME case NFSATTRBIT_ACL: retnum += nfsrv_buildacl(nd, aclp, vnode_vtype(vp), p); break; @@ -2091,7 +2067,6 @@ nfsv4_fillattr(struct nfsrv_descript *nd *tl = txdr_unsigned(NFSV4ACE_SUPTYPES); retnum += NFSX_UNSIGNED; break; -#endif case NFSATTRBIT_CANSETTIME: NFSM_BUILD(tl, u_int32_t *, NFSX_UNSIGNED); if (fsinf.fs_properties & NFSV3FSINFO_CANSETTIME) @@ -2397,10 +2372,8 @@ nfsv4_fillattr(struct nfsrv_descript *nd }; } } -#ifdef NFS4_ACL_EXTATTR_NAME if (naclp != NULL) acl_free(naclp); -#endif *retnump = txdr_unsigned(retnum); return (retnum + prefixnum); } Modified: head/sys/fs/nfs/nfs_var.h ============================================================================== --- head/sys/fs/nfs/nfs_var.h Thu Dec 3 18:02:55 2009 (r200068) +++ head/sys/fs/nfs/nfs_var.h Thu Dec 3 18:03:42 2009 (r200069) @@ -329,7 +329,6 @@ void newnfs_timer(void *); /* nfs_commonacl.c */ int nfsrv_dissectace(struct nfsrv_descript *, struct acl_entry *, int *, int *, NFSPROC_T *); -#ifdef NFS4_ACL_EXTATTR_NAME int nfsrv_buildacl(struct nfsrv_descript *, NFSACL_T *, enum vtype, NFSPROC_T *); int nfsrv_aclaccess(vnode_t, accmode_t, u_int32_t, struct ucred *, @@ -337,7 +336,6 @@ int nfsrv_aclaccess(vnode_t, accmode_t, int nfsrv_setacl(vnode_t, NFSACL_T *, struct ucred *, NFSPROC_T *); int nfsrv_compareacl(NFSACL_T *, NFSACL_T *); -#endif /* nfs_clrpcops.c */ int nfsrpc_null(vnode_t, struct ucred *, NFSPROC_T *); Modified: head/sys/fs/nfs/nfsport.h ============================================================================== --- head/sys/fs/nfs/nfsport.h Thu Dec 3 18:02:55 2009 (r200068) +++ head/sys/fs/nfs/nfsport.h Thu Dec 3 18:03:42 2009 (r200069) @@ -125,11 +125,7 @@ #define NFSPROC_T struct thread #define NFSDEV_T dev_t #define NFSSVCARGS nfssvc_args -#ifdef NFS4_ACL_EXTATTR_NAME #define NFSACL_T struct acl -#else -#define NFSACL_T void -#endif /* * These should be defined as the types used for the corresponding VOP's Modified: head/sys/fs/nfsclient/nfs_clrpcops.c ============================================================================== --- head/sys/fs/nfsclient/nfs_clrpcops.c Thu Dec 3 18:02:55 2009 (r200068) +++ head/sys/fs/nfsclient/nfs_clrpcops.c Thu Dec 3 18:03:42 2009 (r200069) @@ -81,10 +81,8 @@ static int nfsrpc_createv4(vnode_t , cha static int nfsrpc_locku(struct nfsrv_descript *, struct nfsmount *, struct nfscllockowner *, u_int64_t, u_int64_t, u_int32_t, struct ucred *, NFSPROC_T *, int); -#ifdef NFS4_ACL_EXTATTR_NAME static int nfsrpc_setaclrpc(vnode_t, struct ucred *, NFSPROC_T *, struct acl *, nfsv4stateid_t *, void *); -#endif /* * nfs null call from vfs. @@ -983,14 +981,9 @@ nfsrpc_setattr(vnode_t vp, struct vattr if (vap != NULL) error = nfsrpc_setattrrpc(vp, vap, &stateid, cred, p, rnap, attrflagp, stuff); -#ifdef NFS4_ACL_EXTATTR_NAME else error = nfsrpc_setaclrpc(vp, cred, p, aclp, &stateid, stuff); -#else - else - error = EOPNOTSUPP; -#endif if (error == NFSERR_STALESTATEID) nfscl_initiate_recovery(nmp->nm_clp); if (lckp != NULL) @@ -4094,7 +4087,6 @@ nfsrpc_delegreturn(struct nfscldeleg *dp return (error); } -#ifdef NFS4_ACL_EXTATTR_NAME /* * nfs getacl call. */ @@ -4168,5 +4160,3 @@ nfsrpc_setaclrpc(vnode_t vp, struct ucre mbuf_freem(nd->nd_mrep); return (nd->nd_repstat); } - -#endif /* NFS4_ACL_EXTATTR_NAME */ Modified: head/sys/fs/nfsclient/nfs_clvnops.c ============================================================================== --- head/sys/fs/nfsclient/nfs_clvnops.c Thu Dec 3 18:02:55 2009 (r200068) +++ head/sys/fs/nfsclient/nfs_clvnops.c Thu Dec 3 18:03:42 2009 (r200069) @@ -128,10 +128,8 @@ static vop_readlink_t nfs_readlink; static vop_print_t nfs_print; static vop_advlock_t nfs_advlock; static vop_advlockasync_t nfs_advlockasync; -#ifdef NFS4_ACL_EXTATTR_NAME static vop_getacl_t nfs_getacl; static vop_setacl_t nfs_setacl; -#endif /* * Global vfs data structures for nfs @@ -166,10 +164,8 @@ struct vop_vector newnfs_vnodeops = { .vop_strategy = nfs_strategy, .vop_symlink = nfs_symlink, .vop_write = ncl_write, -#ifdef NFS4_ACL_EXTATTR_NAME .vop_getacl = nfs_getacl, .vop_setacl = nfs_setacl, -#endif }; struct vop_vector newnfs_fifoops = { @@ -331,12 +327,9 @@ nfs_access(struct vop_access_args *ap) * unless the file is a socket, fifo, or a block or character * device resident on the filesystem. */ - if ((ap->a_accmode & (VWRITE | VAPPEND -#ifdef NFS4_ACL_EXTATTR_NAME - | VWRITE_NAMED_ATTRS | VDELETE_CHILD | VWRITE_ATTRIBUTES | - VDELETE | VWRITE_ACL | VWRITE_OWNER -#endif - )) != 0 && (vp->v_mount->mnt_flag & MNT_RDONLY) != 0) { + if ((ap->a_accmode & (VWRITE | VAPPEND | VWRITE_NAMED_ATTRS | + VDELETE_CHILD | VWRITE_ATTRIBUTES | VDELETE | VWRITE_ACL | + VWRITE_OWNER)) != 0 && (vp->v_mount->mnt_flag & MNT_RDONLY) != 0) { switch (vp->v_type) { case VREG: case VDIR: @@ -366,10 +359,8 @@ nfs_access(struct vop_access_args *ap) mode |= NFSACCESS_EXTEND; if (ap->a_accmode & VEXEC) mode |= NFSACCESS_EXECUTE; -#ifdef NFS4_ACL_EXTATTR_NAME if (ap->a_accmode & VDELETE) mode |= NFSACCESS_DELETE; -#endif } else { if (ap->a_accmode & VWRITE) mode |= (NFSACCESS_MODIFY | NFSACCESS_EXTEND); @@ -377,12 +368,10 @@ nfs_access(struct vop_access_args *ap) mode |= NFSACCESS_EXTEND; if (ap->a_accmode & VEXEC) mode |= NFSACCESS_LOOKUP; -#ifdef NFS4_ACL_EXTATTR_NAME if (ap->a_accmode & VDELETE) mode |= NFSACCESS_DELETE; if (ap->a_accmode & VDELETE_CHILD) mode |= NFSACCESS_MODIFY; -#endif } /* XXX safety belt, only make blanket request if caching */ if (nfsaccess_cache_timeout > 0) { @@ -3136,7 +3125,6 @@ nfs_lock1(struct vop_lock1_args *ap) ap->a_line)); } -#ifdef NFS4_ACL_EXTATTR_NAME static int nfs_getacl(struct vop_getacl_args *ap) { @@ -3168,5 +3156,3 @@ nfs_setacl(struct vop_setacl_args *ap) } return (error); } - -#endif /* NFS4_ACL_EXTATTR_NAME */ From owner-svn-src-head@FreeBSD.ORG Thu Dec 3 18:13:48 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 325BE1065670; Thu, 3 Dec 2009 18:13:48 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1F1EC8FC15; Thu, 3 Dec 2009 18:13:48 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nB3IDlKt021813; Thu, 3 Dec 2009 18:13:47 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nB3IDlkK021806; Thu, 3 Dec 2009 18:13:47 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <200912031813.nB3IDlkK021806@svn.freebsd.org> From: Nathan Whitehorn Date: Thu, 3 Dec 2009 18:13:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200070 - head/share/man/man4/man4.powerpc X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Dec 2009 18:13:48 -0000 Author: nwhitehorn Date: Thu Dec 3 18:13:47 2009 New Revision: 200070 URL: http://svn.freebsd.org/changeset/base/200070 Log: Add manpages for ams(4), akbd(4), adb(4), and cuda(4), which describe various drivers for Apple Desktop Bus controllers and peripherals. MFC after: 3 days Added: head/share/man/man4/man4.powerpc/adb.4 (contents, props changed) head/share/man/man4/man4.powerpc/akbd.4 (contents, props changed) head/share/man/man4/man4.powerpc/ams.4 (contents, props changed) head/share/man/man4/man4.powerpc/cuda.4 (contents, props changed) Modified: head/share/man/man4/man4.powerpc/Makefile head/share/man/man4/man4.powerpc/pmu.4 Modified: head/share/man/man4/man4.powerpc/Makefile ============================================================================== --- head/share/man/man4/man4.powerpc/Makefile Thu Dec 3 18:03:42 2009 (r200069) +++ head/share/man/man4/man4.powerpc/Makefile Thu Dec 3 18:13:47 2009 (r200070) @@ -1,6 +1,10 @@ # $FreeBSD$ -MAN= bm.4 \ +MAN= adb.4 \ + akbd.4 \ + ams.4 \ + bm.4 \ + cuda.4 \ pmu.4 \ powermac_nvram.4 \ snd_ai2s.4 \ Added: head/share/man/man4/man4.powerpc/adb.4 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/share/man/man4/man4.powerpc/adb.4 Thu Dec 3 18:13:47 2009 (r200070) @@ -0,0 +1,70 @@ +.\"- +.\" Copyright (c) 2009 Nathan Whitehorn +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +.\" DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, +.\" INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +.\" (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +.\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, +.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +.\" ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +.\" POSSIBILITY OF SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd December 3, 2009 +.Dt ADB 4 +.Os +.Sh NAME +.Nm adb +.Nd Apple Desktop Bus +.Sh SYNOPSIS +To compile this driver into the kernel, +place the following lines in your +kernel configuration file: +.Bd -ragged -offset indent +.Cd "device adb" +.Ed +.Sh DESCRIPTION +The +.Nm +driver provides support for the Apple Desktop Bus, which is a simple +multi-drop bus used in general for input peripherals in older Apple +Macintosh hardware. +.Pp +The Apple Desktop Bus provides attachment for up to 16 devices, +including multiple devices of a single type, but not does support +hot-plugging. +.Sh SEE ALSO +Apple Tech Note HW01: ADB - The Untold Story: Space Aliens Ate My Mouse: +.Pa http://developer.apple.com/legacy/mac/library/technotes/hw/hw_01.html +.Pp +.Xr akbd 4 , +.Xr ams 4 , +.Xr cuda 4 , +.Xr pmu 4 +.Sh HISTORY +The +.Nm +device driver appeared in +.Fx 8.0 . +.Sh AUTHORS +.An -nosplit +The +.Nm +driver was written by +.An Nathan Whitehorn +.Aq nwhitehorn@FreeBSD.org . Added: head/share/man/man4/man4.powerpc/akbd.4 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/share/man/man4/man4.powerpc/akbd.4 Thu Dec 3 18:13:47 2009 (r200070) @@ -0,0 +1,76 @@ +.\"- +.\" Copyright (c) 2009 Nathan Whitehorn +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +.\" DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, +.\" INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +.\" (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +.\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, +.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +.\" ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +.\" POSSIBILITY OF SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd December 3, 2009 +.Dt AKBD 4 +.Os +.Sh NAME +.Nm akbd +.Nd ADB Keyboard Driver +.Sh SYNOPSIS +To compile this driver into the kernel, +place the following lines in your +kernel configuration file: +.Bd -ragged -offset indent +.Cd "device adb" +.Ed +.Sh DESCRIPTION +The +.Nm +driver provides support for all keyboards attached to the Apple Desktop +Bus (ADB). +.Sh HARDWARE +Devices supported by the +.Nm +driver include: +.Pp +.Bl -bullet -compact +.It +Apple Extended Keyboard +.It +Apple Keyboard II +.It +Apple iBook Keyboard +.It +Apple PowerBook Keyboard +.El +.Sh SEE ALSO +.Xr adb 4 , +.Xr cuda 4 , +.Xr pmu 4 +.Sh HISTORY +The +.Nm +device driver appeared in +.Fx 8.0 . +.Sh AUTHORS +.An -nosplit +The +.Nm +driver was written by +.An Nathan Whitehorn +.Aq nwhitehorn@FreeBSD.org . Added: head/share/man/man4/man4.powerpc/ams.4 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/share/man/man4/man4.powerpc/ams.4 Thu Dec 3 18:13:47 2009 (r200070) @@ -0,0 +1,87 @@ +.\"- +.\" Copyright (c) 2009 Nathan Whitehorn +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +.\" DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, +.\" INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +.\" (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +.\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, +.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +.\" ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +.\" POSSIBILITY OF SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd December 3, 2009 +.Dt AMS 4 +.Os +.Sh NAME +.Nm ams +.Nd ADB Mouse Driver +.Sh SYNOPSIS +To compile this driver into the kernel, +place the following lines in your +kernel configuration file: +.Bd -ragged -offset indent +.Cd "device adb" +.Ed +.Sh DESCRIPTION +The +.Nm +driver provides support for mice and trackpads attached to the Apple Desktop +Bus (ADB) implementing both the base and extended ADB mouse protocols. +.Sh HARDWARE +Devices supported by the +.Nm +driver include: +.Pp +.Bl -bullet -compact +.It +Apple Mouse +.It +ADB Extended Mouse +.It +MacAlly 2-Button Mouse +.It +Apple iBook Trackpad +.It +Apple PowerBook Trackpad +.El +.Sh SYSCTL VARIABLES +.Bl -tag -width indent +.It Va dev.ams.%d.tapping +On ADB trackpads, setting this sysctl to 1 causes taps on the trackpad to +be interpreted as button clicks. +.El +.Sh SEE ALSO +Apple Tech Note HW01: ADB - The Untold Story: Space Aliens Ate My Mouse: +.Pa http://developer.apple.com/legacy/mac/library/technotes/hw/hw_01.html +.Pp +.Xr adb 4 , +.Xr cuda 4 , +.Xr pmu 4 +.Sh HISTORY +The +.Nm +device driver appeared in +.Fx 8.0 . +.Sh AUTHORS +.An -nosplit +The +.Nm +driver was written by +.An Nathan Whitehorn +.Aq nwhitehorn@FreeBSD.org . Added: head/share/man/man4/man4.powerpc/cuda.4 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/share/man/man4/man4.powerpc/cuda.4 Thu Dec 3 18:13:47 2009 (r200070) @@ -0,0 +1,79 @@ +.\"- +.\" Copyright (c) 2009 Nathan Whitehorn +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +.\" DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, +.\" INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +.\" (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +.\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, +.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +.\" ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +.\" POSSIBILITY OF SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd December 3, 2009 +.Dt CUDA 4 +.Os +.Sh NAME +.Nm cuda +.Nd Apple CUDA I/O Controller Driver +.Sh SYNOPSIS +To compile this driver into the kernel, +place the following lines in your +kernel configuration file: +.Bd -ragged -offset indent +.Cd "device adb" +.Cd "device cuda" +.Ed +.Sh DESCRIPTION +The +.Nm +driver provides support for the CUDA VIA (Versatile Interface Attachment) +chip found in pre-Core99 Apple hardware, such as the Power Macintosh G3. +.Pp +The Apple CUDA controller is a multi-purpose ASIC that provides power +control and an +.Xr adb 4 +interface. +.Sh HARDWARE +Chips supported by the +.Nm +driver include: +.Pp +.Bl -bullet -compact +.It +Apple CUDA I/O Controller +.El +.Sh SEE ALSO +.Xr adb 4 +.Sh HISTORY +The +.Nm +device driver appeared in +.Nx 4.0 , +and then in +.Fx 8.0 . +.Sh AUTHORS +.An -nosplit +The +.Nm +driver was written by +.An Michael Lorenz +.Aq macallan@NetBSD.org +and ported to FreeBSD by +.An Nathan Whitehorn +.Aq nwhitehorn@FreeBSD.org . Modified: head/share/man/man4/man4.powerpc/pmu.4 ============================================================================== --- head/share/man/man4/man4.powerpc/pmu.4 Thu Dec 3 18:03:42 2009 (r200069) +++ head/share/man/man4/man4.powerpc/pmu.4 Thu Dec 3 18:13:47 2009 (r200070) @@ -95,7 +95,8 @@ Current fraction of the battery's maximu .El .Sh SEE ALSO .Xr acpi 4 , -.Xr adb 4 +.Xr adb 4 , +.Xr led 4 .Sh HISTORY The .Nm From owner-svn-src-head@FreeBSD.ORG Thu Dec 3 18:16:15 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5904F1065670; Thu, 3 Dec 2009 18:16:15 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2E9218FC1E; Thu, 3 Dec 2009 18:16:15 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nB3IGF32021913; Thu, 3 Dec 2009 18:16:15 GMT (envelope-from trasz@svn.freebsd.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nB3IGFb8021911; Thu, 3 Dec 2009 18:16:15 GMT (envelope-from trasz@svn.freebsd.org) Message-Id: <200912031816.nB3IGFb8021911@svn.freebsd.org> From: Edward Tomasz Napierala Date: Thu, 3 Dec 2009 18:16:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200071 - head/sys/gnu/fs/reiserfs X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Dec 2009 18:16:15 -0000 Author: trasz Date: Thu Dec 3 18:16:14 2009 New Revision: 200071 URL: http://svn.freebsd.org/changeset/base/200071 Log: Remove unused code. Modified: head/sys/gnu/fs/reiserfs/reiserfs_vfsops.c Modified: head/sys/gnu/fs/reiserfs/reiserfs_vfsops.c ============================================================================== --- head/sys/gnu/fs/reiserfs/reiserfs_vfsops.c Thu Dec 3 18:13:47 2009 (r200070) +++ head/sys/gnu/fs/reiserfs/reiserfs_vfsops.c Thu Dec 3 18:16:14 2009 (r200071) @@ -429,40 +429,11 @@ reiserfs_mountfs(struct vnode *devvp, st struct reiserfs_super_block *rs; struct cdev *dev = devvp->v_rdev; -#if (__FreeBSD_version >= 600000) struct g_consumer *cp; struct bufobj *bo; -#endif //ronly = (mp->mnt_flag & MNT_RDONLY) != 0; -#if (__FreeBSD_version < 600000) - /* - * Disallow multiple mounts of the same device. - * Disallow mounting of a device that is currently in use - * (except for root, which might share swap device for miniroot). - * Flush out any old buffers remaining from a previous use. - */ - if ((error = vfs_mountedon(devvp)) != 0) - return (error); - if (vcount(devvp) > 1) - return (EBUSY); - - error = vinvalbuf(devvp, V_SAVE, td->td_ucred, td, 0, 0); - if (error) { - VOP_UNLOCK(devvp, 0); - return (error); - } - - /* - * Open the device in read-only, 'cause we don't support write - * for now - */ - error = VOP_OPEN(devvp, FREAD, FSCRED, td, NULL); - VOP_UNLOCK(devvp, 0); - if (error) - return (error); -#else DROP_GIANT(); g_topology_lock(); error = g_vfs_open(devvp, &cp, "reiserfs", /* read-only */ 0); @@ -475,7 +446,6 @@ reiserfs_mountfs(struct vnode *devvp, st bo = &devvp->v_bufobj; bo->bo_private = cp; bo->bo_ops = g_vfs_bufops; -#endif if (devvp->v_rdev->si_iosize_max != 0) mp->mnt_iosize_max = devvp->v_rdev->si_iosize_max; @@ -500,10 +470,8 @@ reiserfs_mountfs(struct vnode *devvp, st rmp->rm_mountp = mp; rmp->rm_devvp = devvp; rmp->rm_dev = dev; -#if (__FreeBSD_version >= 600000) rmp->rm_bo = &devvp->v_bufobj; rmp->rm_cp = cp; -#endif /* Set default values for options: non-aggressive tails */ REISERFS_SB(sbi)->s_mount_opt = (1 << REISERFS_SMALLTAIL); @@ -630,9 +598,6 @@ out: } } -#if (__FreeBSD_version < 600000) - (void)VOP_CLOSE(devvp, FREAD, NOCRED, td); -#else if (cp != NULL) { DROP_GIANT(); g_topology_lock(); @@ -640,7 +605,6 @@ out: g_topology_unlock(); PICKUP_GIANT(); } -#endif if (sbi) free(sbi, M_REISERFSMNT); From owner-svn-src-head@FreeBSD.ORG Thu Dec 3 19:16:41 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2A6F41065676; Thu, 3 Dec 2009 19:16:41 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 082BE8FC19; Thu, 3 Dec 2009 19:16:41 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nB3JGe23023361; Thu, 3 Dec 2009 19:16:40 GMT (envelope-from trasz@svn.freebsd.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nB3JGe88023359; Thu, 3 Dec 2009 19:16:40 GMT (envelope-from trasz@svn.freebsd.org) Message-Id: <200912031916.nB3JGe88023359@svn.freebsd.org> From: Edward Tomasz Napierala Date: Thu, 3 Dec 2009 19:16:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200076 - head/usr.sbin/mountd X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Dec 2009 19:16:41 -0000 Author: trasz Date: Thu Dec 3 19:16:40 2009 New Revision: 200076 URL: http://svn.freebsd.org/changeset/base/200076 Log: Description of steps required to setup NFSv4 server is in nfsv4(4); add reference to exports(5), since that's the obvious starting point for searching for this. Modified: head/usr.sbin/mountd/exports.5 Modified: head/usr.sbin/mountd/exports.5 ============================================================================== --- head/usr.sbin/mountd/exports.5 Thu Dec 3 18:50:04 2009 (r200075) +++ head/usr.sbin/mountd/exports.5 Thu Dec 3 19:16:40 2009 (r200076) @@ -28,7 +28,7 @@ .\" @(#)exports.5 8.3 (Berkeley) 3/29/95 .\" $FreeBSD$ .\" -.Dd June 30, 2008 +.Dd December 3, 2009 .Dt EXPORTS 5 .Os .Sh NAME @@ -473,6 +473,7 @@ operations on the server, so long as val The machine grumpy.cis.uoguelph.ca is permitted to perform NFSv4 state operations on the server using AUTH_SYS credentials, as well as Kerberos ones. .Sh SEE ALSO +.Xr nfsv4 4 , .Xr netgroup 5 , .Xr mountd 8 , .Xr nfsd 8 , From owner-svn-src-head@FreeBSD.ORG Thu Dec 3 19:27:12 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CAA8A106566C; Thu, 3 Dec 2009 19:27:12 +0000 (UTC) (envelope-from gabor@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9BB8B8FC08; Thu, 3 Dec 2009 19:27:12 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nB3JRCdu023607; Thu, 3 Dec 2009 19:27:12 GMT (envelope-from gabor@svn.freebsd.org) Received: (from gabor@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nB3JRCgB023605; Thu, 3 Dec 2009 19:27:12 GMT (envelope-from gabor@svn.freebsd.org) Message-Id: <200912031927.nB3JRCgB023605@svn.freebsd.org> From: Gabor Kovesdan Date: Thu, 3 Dec 2009 19:27:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200077 - head/lib/libc/nls X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Dec 2009 19:27:12 -0000 Author: gabor (doc,ports committer) Date: Thu Dec 3 19:27:12 2009 New Revision: 200077 URL: http://svn.freebsd.org/changeset/base/200077 Log: - Update the Spanish NLS catalog Reviewed by: carvay, the.infamous.paul@gmail.com, Joan Picanyol i Puig , Ing . Marcos Luis Ortiz Valmaseda , eskanete@gmail.com, Jose M Rodriguez , Guillermo Hernandez , dani.doni@gmail.com Modified: head/lib/libc/nls/es_ES.ISO8859-1.msg Modified: head/lib/libc/nls/es_ES.ISO8859-1.msg ============================================================================== --- head/lib/libc/nls/es_ES.ISO8859-1.msg Thu Dec 3 19:16:40 2009 (r200076) +++ head/lib/libc/nls/es_ES.ISO8859-1.msg Thu Dec 3 19:27:12 2009 (r200077) @@ -62,7 +62,7 @@ $ EFBIG $ ENOSPC 28 No queda espacio libre en el dispositivo $ ESPIPE -29 Illegal seek +29 Búsqueda ilegal $ EROFS 30 Sistema de ficheros de solo lectura $ EMLINK @@ -88,7 +88,7 @@ $ EMSGSIZE $ EPROTOTYPE 41 Tipo erróneo de protocolo para el socket $ ENOPROTOOPT -42 protocolo no disponible +42 Protocolo no disponible $ EPROTONOSUPPORT 43 Protocolo no contemplado $ ESOCKTNOSUPPORT @@ -176,23 +176,33 @@ $ EOVERFLOW $ ECANCELED 85 Operación cancelada $ EILSEQ -86 Illegal byte sequence +86 Secuencia de bytes ilegal $ ENOATTR 87 Atributo no encontrado $ EDOOFUS 88 Error de programación +$ EBADMSG +89 Mensaje inválido +$ EMULTIHOP +90 Intento de hop multiple +$ ENOLINK +91 El enlace se ha roto +$ EPROTO +92 Fallo de protocolo +$ ENOTCAPABLE +93 Habilidades insuficientes $ $ strsignal() support catalog $ $set 2 $ SIGHUP -1 Fín de línea (Hangup) +1 Fin de línea (Hangup) $ SIGINT 2 Interrumpido $ SIGQUIT 3 Terminado $ SIGILL -4 Illegal instruction +4 Instrucción ilegal $ SIGTRAP 5 Trace/BPT trap $ SIGABRT @@ -247,3 +257,39 @@ $ SIGUSR1 30 Señal definida por el usuario n1 $ SIGUSR2 31 Señal definida por el usuario n2 +$ +$ gai_strerror() support catalog +$ +$set 3 +$ 1 (obsoleto) +1 Tipo de dirección no contemplado +$ EAI_AGAIN +2 Error transitorio en la resolución de nombres +$ EAI_BADFLAGS +3 Valor inválido de ai_flags +$ EAI_FAIL +4 Error no recuperable en la resolución de nombres +$ EAI_FAMILY +5 ai_family no contemplado +$ EAI_MEMORY +6 Error en la asignación de memoria +$ 7 (obsoleto) +7 No hay dirección asociada con el nombre de máquina +$ EAI_NONAME +8 No se dispone nombre de máquina, ni nombre de servicio +$ EAI_SERVICE +9 Nombre de servicio no contemplado en ai_socktype +$ EAI_SOCKTYPE +10 ai_socktype no contemplado +$ EAI_SYSTEM +11 Error de sistema devuelto en errno +$ EAI_BADHINTS +12 Valor inválido de hints +$ EAI_PROTOCOL +13 Protocolo resuelto desconocido +$ EAI_OVERFLOW +14 Búfer de argumentos sobrepasado +$ 0 +32766 Éxito +$ NL_MSGMAX +32767 Error desconocido From owner-svn-src-head@FreeBSD.ORG Thu Dec 3 19:45:08 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 832D3106566C; Thu, 3 Dec 2009 19:45:08 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mail.cksoft.de (mail.cksoft.de [IPv6:2001:4068:10::3]) by mx1.freebsd.org (Postfix) with ESMTP id ECE268FC0C; Thu, 3 Dec 2009 19:45:07 +0000 (UTC) Received: from localhost (amavis.fra.cksoft.de [192.168.74.71]) by mail.cksoft.de (Postfix) with ESMTP id 92C8341C7A5; Thu, 3 Dec 2009 20:45:06 +0100 (CET) X-Virus-Scanned: amavisd-new at cksoft.de Received: from mail.cksoft.de ([192.168.74.103]) by localhost (amavis.fra.cksoft.de [192.168.74.71]) (amavisd-new, port 10024) with ESMTP id C6r-82dK-Yxi; Thu, 3 Dec 2009 20:45:06 +0100 (CET) Received: by mail.cksoft.de (Postfix, from userid 66) id F41E541C796; Thu, 3 Dec 2009 20:45:05 +0100 (CET) Received: from maildrop.int.zabbadoz.net (maildrop.int.zabbadoz.net [10.111.66.10]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.int.zabbadoz.net (Postfix) with ESMTP id A65334448EC; Thu, 3 Dec 2009 19:43:33 +0000 (UTC) Date: Thu, 3 Dec 2009 19:43:33 +0000 (UTC) From: "Bjoern A. Zeeb" X-X-Sender: bz@maildrop.int.zabbadoz.net To: Hajimu UMEMOTO In-Reply-To: <200912031116.nB3BGsm2091411@svn.freebsd.org> Message-ID: <20091203193619.J83957@maildrop.int.zabbadoz.net> References: <200912031116.nB3BGsm2091411@svn.freebsd.org> X-OpenPGP-Key: 0x14003F198FEFA3E77207EE8D2B58B8F83CCF1842 MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r200055 - head/sys/netinet/ipfw X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Dec 2009 19:45:08 -0000 On Thu, 3 Dec 2009, Hajimu UMEMOTO wrote: > Author: ume > Date: Thu Dec 3 11:16:53 2009 > New Revision: 200055 > URL: http://svn.freebsd.org/changeset/base/200055 > > Log: > Teach an IPv6 to the debug prints. > > Modified: > head/sys/netinet/ipfw/ip_fw2.c > > Modified: head/sys/netinet/ipfw/ip_fw2.c > ============================================================================== > --- head/sys/netinet/ipfw/ip_fw2.c Thu Dec 3 09:18:40 2009 (r200054) > +++ head/sys/netinet/ipfw/ip_fw2.c Thu Dec 3 11:16:53 2009 (r200055) > @@ -1050,6 +1050,28 @@ hash_packet(struct ipfw_flow_id *id) > return i; > } > > +static __inline void > +unlink_dyn_rule_print(struct ipfw_flow_id *id) > +{ > + struct in_addr da; > + char src[48], dst[48]; Does it need to be 48 rather than 46? You do not have the [] here. If not INET6_ADDRSTRLEN is what we use elsewhere. I would actually prefer to only have #ifdef INET6 char src[INET6_ADDRSTRLEN|48], .. #else char src[INET_ADDRSTRLEN|18], .. #endif as it's 60 bytes of stack size for people w/o INET6 support (shame on them;-) Some applies for equivalent code further down. Ideally we would also hide the INET things under INET but that's a longer way to go... /bz > +#ifdef INET6 > + if (IS_IP6_FLOW_ID(id)) { > + ip6_sprintf(src, &id->src_ip6); > + ip6_sprintf(dst, &id->dst_ip6); > + } else > +#endif > + { > + da.s_addr = htonl(id->src_ip); > + inet_ntoa_r(da, src); > + da.s_addr = htonl(id->dst_ip); > + inet_ntoa_r(da, dst); > + } > + printf("ipfw: unlink entry %s %d -> %s %d, %d left\n", > + src, id->src_port, dst, id->dst_port, V_dyn_count - 1); > +} -- Bjoern A. Zeeb It will not break if you know what you are doing. From owner-svn-src-head@FreeBSD.ORG Thu Dec 3 19:59:28 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6858F1065692; Thu, 3 Dec 2009 19:59:28 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 56ECD8FC14; Thu, 3 Dec 2009 19:59:28 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nB3JxS0V024299; Thu, 3 Dec 2009 19:59:28 GMT (envelope-from trasz@svn.freebsd.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nB3JxSLY024297; Thu, 3 Dec 2009 19:59:28 GMT (envelope-from trasz@svn.freebsd.org) Message-Id: <200912031959.nB3JxSLY024297@svn.freebsd.org> From: Edward Tomasz Napierala Date: Thu, 3 Dec 2009 19:59:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200079 - head/usr.sbin/nfsd X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Dec 2009 19:59:28 -0000 Author: trasz Date: Thu Dec 3 19:59:27 2009 New Revision: 200079 URL: http://svn.freebsd.org/changeset/base/200079 Log: Cosmetical fixes. Modified: head/usr.sbin/nfsd/nfsv4.4 Modified: head/usr.sbin/nfsd/nfsv4.4 ============================================================================== --- head/usr.sbin/nfsd/nfsv4.4 Thu Dec 3 19:37:52 2009 (r200078) +++ head/usr.sbin/nfsd/nfsv4.4 Thu Dec 3 19:59:27 2009 (r200079) @@ -24,22 +24,20 @@ .\" .\" $FreeBSD$ .\" -.Dd April 30, 2009 +.Dd December 3, 2009 .Dt NFSV4 4 .Os .Sh NAME -.Nm nfsv4 +.Nm NFSv4 .Nd NFS Version 4 Protocol -.Sh SYNOPSIS -experimental client and server with NFSv4 support .Sh DESCRIPTION -The experimental nfs client and server provides support for the +The experimental NFS client and server provides support for the .Tn NFSv4 specification; see .%T "Network File System (NFS) Version 4 Protocol \\*(tNRFC\\*(sP 3530" . The protocol is somewhat similar to NFS Version 3, but differs in significant ways. -It uses a single Compound RPC that concatenates operations to-gether. +It uses a single compound RPC that concatenates operations to-gether. Each of these operations are similar to the RPCs of NFS Version 3. The operations in the compound are performed in order, until one of them fails (returns an error) and then the RPC terminates at that point. @@ -48,10 +46,10 @@ It has integrated locking support, which implies that the server is no longer stateless. As such, the -.Tn NFSv4 -server remains in recovery mode for a Grace period (always greater than the +.Nm +server remains in recovery mode for a grace period (always greater than the lease duration the server uses) after a reboot. -During this Grace period, clients may recover state but not perform other +During this grace period, clients may recover state but not perform other open/lock state changing operations. To provide for correct recovery semantics, a small file described by .Xr stablerestart 5 @@ -61,14 +59,14 @@ the server will not start. If this file is lost, it should be recovered from backups, since creating an empty .Xr stablerestart 5 -file will result in the server starting without providing a Grace Period +file will result in the server starting without providing a grace period for recovery. Note that recovery only occurs when the server machine is rebooted, not when the .Xr nfsd 8 are just restarted. .Pp -It provides several optional features not in NFS Version 3: +It provides several optional features not present in NFS Version 3: .sp .Bd -literal -offset indent -compact - NFS Version 4 ACLs @@ -78,7 +76,7 @@ It provides several optional features no .Ed .Pp The -.Tn NFSv4 +.Nm protocol does not use a separate mount protocol and assumes that the server provides a single file system tree structure, rooted at the point in the local file system tree specified by one or more @@ -131,7 +129,7 @@ by default. However, this can normally be overridden by a command line option or configuration file for the daemon used to do the name<->number mapping. -On FreeBSD, the mapping daemon is called +Under FreeBSD, the mapping daemon is called .Xr nfsuserd 8 and has a command line option that overrides the domain component of the machine's hostname. @@ -143,7 +141,7 @@ report a lot of ``nobody'' and ``nogroup .Pp Although uid/gid numbers are no longer used in the .Nm -protocol, they will still be in the RPC authentication fields when running +protocol, they will still be in the RPC authentication fields when using AUTH_SYS (sec=sys), which is the default. As such, in this case both the user/group name and number spaces must be consistent between the client and server. @@ -154,8 +152,8 @@ with RPCSEC_GSS (sec=krb5, krb5i, krb5p) will go on the wire. .Sh SERVER SETUP .Pp -To set up the experimental nfs server that supports -.Nm +To set up the experimental NFS server that supports +.Nm , you will need to either build a kernel with: .sp .Bd -literal -offset indent -compact @@ -318,13 +316,13 @@ variables. NFS V4 stable restart file .El .Sh SEE ALSO -.Xr stablerestart 5 -.Xr mountd 8 -.Xr nfscbd 8 -.Xr nfsd 8 -.Xr nfsdumpstate 8 -.Xr nfsrevoke 8 -.Xr nfsuserd 8 +.Xr stablerestart 5 , +.Xr mountd 8 , +.Xr nfscbd 8 , +.Xr nfsd 8 , +.Xr nfsdumpstate 8 , +.Xr nfsrevoke 8 , +.Xr nfsuserd 8 , .Sh BUGS At this time, there is no recall of delegations for local file system operations. From owner-svn-src-head@FreeBSD.ORG Thu Dec 3 20:02:26 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AFBB61065692; Thu, 3 Dec 2009 20:02:26 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 857A88FC2F; Thu, 3 Dec 2009 20:02:26 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nB3K2Qeo024461; Thu, 3 Dec 2009 20:02:26 GMT (envelope-from trasz@svn.freebsd.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nB3K2QdG024459; Thu, 3 Dec 2009 20:02:26 GMT (envelope-from trasz@svn.freebsd.org) Message-Id: <200912032002.nB3K2QdG024459@svn.freebsd.org> From: Edward Tomasz Napierala Date: Thu, 3 Dec 2009 20:02:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200080 - head/usr.sbin/nfsd X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Dec 2009 20:02:26 -0000 Author: trasz Date: Thu Dec 3 20:02:26 2009 New Revision: 200080 URL: http://svn.freebsd.org/changeset/base/200080 Log: Cosmetical fixes. Modified: head/usr.sbin/nfsd/stablerestart.5 Modified: head/usr.sbin/nfsd/stablerestart.5 ============================================================================== --- head/usr.sbin/nfsd/stablerestart.5 Thu Dec 3 19:59:27 2009 (r200079) +++ head/usr.sbin/nfsd/stablerestart.5 Thu Dec 3 20:02:26 2009 (r200080) @@ -24,23 +24,23 @@ .\" .\" $FreeBSD$ .\" -.Dd September 7, 2007 +.Dd December 3, 2009 .Dt STABLERESTART 5 .Os .Sh NAME .Nm nfs-stablerestart .Nd handles restart edge conditions for the .Tn NFS -V4 server +v4 server .Sh SYNOPSIS .Nm nfs-stablerestart .Sh DESCRIPTION The .Nm file holds information that allows the -.Tn NFS -V4 server to restart without always returning the NFSERR_NOGRACE error, as described in the -.Tn NFS V4 +.Tn NFSv4 +server to restart without always returning the NFSERR_NOGRACE error, as described in the +.Tn NFSv4 server specification; see .%T "Network File System (NFS) Version 4 Protocol \\*(tNRFC\\*(sP 3530, Section 8.6.3" . .Pp @@ -49,11 +49,11 @@ The first record in the file, as defined last incarnation of the server and the number of boot times that follows. Following this are the number of previous boot times listed in the first record. -The lease duration is used to set the Grace Period. +The lease duration is used to set the grace period. The boot times are used to avoid the unlikely occurrence of a boot time being reused, due to a TOD clock going backwards. This record and the previous boot times with this boot time added is re-written at the -end of the Grace Period. +end of the grace period. .Pp The rest of the file are appended records, as defined by struct nfst_rec in /usr/include/fs/nfs/nfsrvstate.h and are used @@ -77,14 +77,14 @@ a local disk drive that holds the file, .Sh FILES .Bl -tag -width /var/db/nfs-stablerestart -compact .It Pa /var/db/nfs-stablerestart -NFS V4 stable restart file +NFSv4 stable restart file .El .Sh SEE ALSO -.Xr nfsv4 4 +.Xr nfsv4 4 , .Xr nfsd 8 .Sh BUGS -If the file is empty, the NFS V4 server has no choice but to return -NFSERR_NOGRACE for all Reclaim requests. Although correct, this is +If the file is empty, the NFSv4 server has no choice but to return +NFSERR_NOGRACE for all reclaim requests. Although correct, this is a highly undesirable occurrence, so the file should not be lost if at all possible. Nfsd will not create the file if it does not exist and will simply log a failure to start, in the hopes that the From owner-svn-src-head@FreeBSD.ORG Thu Dec 3 20:06:03 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CA3A41065672; Thu, 3 Dec 2009 20:06:03 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B91608FC1A; Thu, 3 Dec 2009 20:06:03 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nB3K63NC024620; Thu, 3 Dec 2009 20:06:03 GMT (envelope-from trasz@svn.freebsd.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nB3K63GV024618; Thu, 3 Dec 2009 20:06:03 GMT (envelope-from trasz@svn.freebsd.org) Message-Id: <200912032006.nB3K63GV024618@svn.freebsd.org> From: Edward Tomasz Napierala Date: Thu, 3 Dec 2009 20:06:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200081 - head/usr.sbin/nfsd X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Dec 2009 20:06:03 -0000 Author: trasz Date: Thu Dec 3 20:06:03 2009 New Revision: 200081 URL: http://svn.freebsd.org/changeset/base/200081 Log: Yet another cosmetic fix. Modified: head/usr.sbin/nfsd/stablerestart.5 Modified: head/usr.sbin/nfsd/stablerestart.5 ============================================================================== --- head/usr.sbin/nfsd/stablerestart.5 Thu Dec 3 20:02:26 2009 (r200080) +++ head/usr.sbin/nfsd/stablerestart.5 Thu Dec 3 20:06:03 2009 (r200081) @@ -29,9 +29,9 @@ .Os .Sh NAME .Nm nfs-stablerestart -.Nd handles restart edge conditions for the -.Tn NFS -v4 server +.Nd restart information for the +.Tn NFSv4 +server .Sh SYNOPSIS .Nm nfs-stablerestart .Sh DESCRIPTION From owner-svn-src-head@FreeBSD.ORG Thu Dec 3 20:17:00 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 03D6D106566C; Thu, 3 Dec 2009 20:17:00 +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 E74098FC0C; Thu, 3 Dec 2009 20:16:59 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nB3KGxcm025030; Thu, 3 Dec 2009 20:16:59 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nB3KGxRj025028; Thu, 3 Dec 2009 20:16:59 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <200912032016.nB3KGxRj025028@svn.freebsd.org> From: Konstantin Belousov Date: Thu, 3 Dec 2009 20:16:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200082 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Dec 2009 20:17:00 -0000 Author: kib Date: Thu Dec 3 20:16:59 2009 New Revision: 200082 URL: http://svn.freebsd.org/changeset/base/200082 Log: Remove wrong assertion. Debugee is allowed to lose a signal. Reported and tested by: jh MFC after: 2 weeks Modified: head/sys/kern/kern_sig.c Modified: head/sys/kern/kern_sig.c ============================================================================== --- head/sys/kern/kern_sig.c Thu Dec 3 20:06:03 2009 (r200081) +++ head/sys/kern/kern_sig.c Thu Dec 3 20:16:59 2009 (r200082) @@ -2492,7 +2492,7 @@ issignal(struct thread *td, int stop_all struct sigacts *ps; struct sigqueue *queue; sigset_t sigpending; - int sig, prop, newsig, signo; + int sig, prop, newsig; p = td->td_proc; ps = p->p_sigacts; @@ -2545,8 +2545,7 @@ issignal(struct thread *td, int stop_all */ if (sigqueue_get(queue, sig, &ksi) == 0) { queue = &p->p_sigqueue; - signo = sigqueue_get(queue, sig, &ksi); - KASSERT(signo == sig, ("signo != sig")); + sigqueue_get(queue, sig, &ksi); } /* From owner-svn-src-head@FreeBSD.ORG Thu Dec 3 20:55:10 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 240551065696; Thu, 3 Dec 2009 20:55:10 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 12BA08FC18; Thu, 3 Dec 2009 20:55:10 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nB3Kt9Ev025805; Thu, 3 Dec 2009 20:55:09 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nB3Kt9EO025803; Thu, 3 Dec 2009 20:55:09 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <200912032055.nB3Kt9EO025803@svn.freebsd.org> From: Nathan Whitehorn Date: Thu, 3 Dec 2009 20:55:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200083 - head/sys/powerpc/aim X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Dec 2009 20:55:10 -0000 Author: nwhitehorn Date: Thu Dec 3 20:55:09 2009 New Revision: 200083 URL: http://svn.freebsd.org/changeset/base/200083 Log: The first argument of dcbz interprets r0 as a literal zero, not the second. This worked before by accident. MFC after: 1 week Modified: head/sys/powerpc/aim/machdep.c Modified: head/sys/powerpc/aim/machdep.c ============================================================================== --- head/sys/powerpc/aim/machdep.c Thu Dec 3 20:16:59 2009 (r200082) +++ head/sys/powerpc/aim/machdep.c Thu Dec 3 20:55:09 2009 (r200083) @@ -374,7 +374,7 @@ powerpc_init(u_int startkernel, u_int en for (cacheline_size = 0; cacheline_size < 0x100; cacheline_size++) cache_check[cacheline_size] = 0xff; - __asm __volatile("dcbz %0,0":: "r" (cache_check) : "memory"); + __asm __volatile("dcbz 0,%0":: "r" (cache_check) : "memory"); /* Find the first byte dcbz did not zero to get the cache line size */ for (cacheline_size = 0; cacheline_size < 0x100 && From owner-svn-src-head@FreeBSD.ORG Thu Dec 3 20:59:28 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 64583106566C; Thu, 3 Dec 2009 20:59:28 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5380F8FC0A; Thu, 3 Dec 2009 20:59:28 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nB3KxS9A026038; Thu, 3 Dec 2009 20:59:28 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nB3KxSUa026036; Thu, 3 Dec 2009 20:59:28 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <200912032059.nB3KxSUa026036@svn.freebsd.org> From: John Baldwin Date: Thu, 3 Dec 2009 20:59:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200084 - head/sys/nfsserver X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Dec 2009 20:59:28 -0000 Author: jhb Date: Thu Dec 3 20:59:28 2009 New Revision: 200084 URL: http://svn.freebsd.org/changeset/base/200084 Log: Properly return an error reply if an NFS remove or link operation fails. Previously the failing operation would allocate an mbuf and construct an error reply, but because the function did not return 0, the NFS server assumed it had failed to generate a reply and would leak the reply mbuf as well as not sending the reply to the NFS client. PR: kern/140853 Submitted by: Ted Faber faber at isi edu (remove) Reviewed by: rmacklem (remove) MFC after: 1 week Modified: head/sys/nfsserver/nfs_serv.c Modified: head/sys/nfsserver/nfs_serv.c ============================================================================== --- head/sys/nfsserver/nfs_serv.c Thu Dec 3 20:55:09 2009 (r200083) +++ head/sys/nfsserver/nfs_serv.c Thu Dec 3 20:59:28 2009 (r200084) @@ -1810,10 +1810,9 @@ out: } ereply: nfsm_reply(NFSX_WCCDATA(v3)); - if (v3) { + if (v3) nfsm_srvwcc_data(dirfor_ret, &dirfor, diraft_ret, &diraft); - error = 0; - } + error = 0; nfsmout: NDFREE(&nd, NDF_ONLY_PNBUF); if (nd.ni_dvp) { @@ -2187,8 +2186,8 @@ ereply: if (v3) { nfsm_srvpostop_attr(getret, &at); nfsm_srvwcc_data(dirfor_ret, &dirfor, diraft_ret, &diraft); - error = 0; } + error = 0; /* fall through */ nfsmout: From owner-svn-src-head@FreeBSD.ORG Thu Dec 3 21:44:42 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0E84F1065670; Thu, 3 Dec 2009 21:44:42 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id F18028FC1F; Thu, 3 Dec 2009 21:44:41 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nB3LifOJ026979; Thu, 3 Dec 2009 21:44:41 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nB3Lifts026977; Thu, 3 Dec 2009 21:44:41 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <200912032144.nB3Lifts026977@svn.freebsd.org> From: Ed Schouten Date: Thu, 3 Dec 2009 21:44:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200085 - head/libexec/ulog-helper X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Dec 2009 21:44:42 -0000 Author: ed Date: Thu Dec 3 21:44:41 2009 New Revision: 200085 URL: http://svn.freebsd.org/changeset/base/200085 Log: Repair breakage to last-minute API change. I changed ulog_log{in,out} to return a void, but forgot to change ulog-helper as well. Reported by: stefanf Modified: head/libexec/ulog-helper/ulog-helper.c Modified: head/libexec/ulog-helper/ulog-helper.c ============================================================================== --- head/libexec/ulog-helper/ulog-helper.c Thu Dec 3 20:59:28 2009 (r200084) +++ head/libexec/ulog-helper/ulog-helper.c Thu Dec 3 21:44:41 2009 (r200085) @@ -68,12 +68,10 @@ main(int argc, char *argv[]) if (argc == 3) host = argv[2]; - if (ulog_login(line, pwd->pw_name, host) != 0) - return (EX_OSFILE); + ulog_login(line, pwd->pw_name, host); return (EX_OK); } else if (argc == 2 && strcmp(argv[1], "logout") == 0) { - if (ulog_logout(line) != 0) - return (EX_OSFILE); + ulog_logout(line); return (EX_OK); } From owner-svn-src-head@FreeBSD.ORG Thu Dec 3 21:47:51 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 89CCB106566C; Thu, 3 Dec 2009 21:47:51 +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 784D28FC15; Thu, 3 Dec 2009 21:47:51 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nB3LlpiF027089; Thu, 3 Dec 2009 21:47:51 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nB3Llph1027086; Thu, 3 Dec 2009 21:47:51 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <200912032147.nB3Llph1027086@svn.freebsd.org> From: Alexander Motin Date: Thu, 3 Dec 2009 21:47:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200086 - head/sys/geom/mirror X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Dec 2009 21:47:51 -0000 Author: mav Date: Thu Dec 3 21:47:51 2009 New Revision: 200086 URL: http://svn.freebsd.org/changeset/base/200086 Log: Change 'load' balancing mode algorithm: - Instead of measuring last request execution time for each drive and choosing one with smallest time, use averaged number of requests, running on each drive. This information is more accurate and timely. It allows to distribute load between drives in more even and predictable way. - For each drive track offset of the last submitted request. If new request offset matches previous one or close for some drive, prefer that drive. It allows to significantly speedup simultaneous sequential reads. PR: kern/113885 Reviewed by: sobomax Modified: head/sys/geom/mirror/g_mirror.c head/sys/geom/mirror/g_mirror.h Modified: head/sys/geom/mirror/g_mirror.c ============================================================================== --- head/sys/geom/mirror/g_mirror.c Thu Dec 3 21:44:41 2009 (r200085) +++ head/sys/geom/mirror/g_mirror.c Thu Dec 3 21:47:51 2009 (r200086) @@ -451,9 +451,6 @@ g_mirror_init_disk(struct g_mirror_softc disk->d_id = md->md_did; disk->d_state = G_MIRROR_DISK_STATE_NONE; disk->d_priority = md->md_priority; - disk->d_delay.sec = 0; - disk->d_delay.frac = 0; - binuptime(&disk->d_last_used); disk->d_flags = md->md_dflags; if (md->md_provider[0] != '\0') disk->d_flags |= G_MIRROR_DISK_FLAG_HARDCODED; @@ -863,16 +860,6 @@ bintime_cmp(struct bintime *bt1, struct } static void -g_mirror_update_delay(struct g_mirror_disk *disk, struct bio *bp) -{ - - if (disk->d_softc->sc_balance != G_MIRROR_BALANCE_LOAD) - return; - binuptime(&disk->d_delay); - bintime_sub(&disk->d_delay, &bp->bio_t0); -} - -static void g_mirror_done(struct bio *bp) { struct g_mirror_softc *sc; @@ -904,8 +891,6 @@ g_mirror_regular_request(struct bio *bp) g_topology_lock(); g_mirror_kill_consumer(sc, bp->bio_from); g_topology_unlock(); - } else { - g_mirror_update_delay(disk, bp); } pbp->bio_inbed++; @@ -1465,30 +1450,35 @@ g_mirror_request_round_robin(struct g_mi g_io_request(cbp, cp); } +#define TRACK_SIZE (1 * 1024 * 1024) +#define LOAD_SCALE 256 +#define ABS(x) (((x) >= 0) ? (x) : (-(x))) + static void g_mirror_request_load(struct g_mirror_softc *sc, struct bio *bp) { struct g_mirror_disk *disk, *dp; struct g_consumer *cp; struct bio *cbp; - struct bintime curtime; + int prio, best; - binuptime(&curtime); - /* - * Find a disk which the smallest load. - */ + /* Find a disk with the smallest load. */ disk = NULL; + best = INT_MAX; LIST_FOREACH(dp, &sc->sc_disks, d_next) { if (dp->d_state != G_MIRROR_DISK_STATE_ACTIVE) continue; - /* If disk wasn't used for more than 2 sec, use it. */ - if (curtime.sec - dp->d_last_used.sec >= 2) { - disk = dp; - break; - } - if (disk == NULL || - bintime_cmp(&dp->d_delay, &disk->d_delay) < 0) { + prio = dp->load; + /* If disk head is precisely in position - highly prefer it. */ + if (dp->d_last_offset == bp->bio_offset) + prio -= 2 * LOAD_SCALE; + else + /* If disk head is close to position - prefer it. */ + if (ABS(dp->d_last_offset - bp->bio_offset) < TRACK_SIZE) + prio -= 1 * LOAD_SCALE; + if (prio <= best) { disk = dp; + best = prio; } } KASSERT(disk != NULL, ("NULL disk for %s.", sc->sc_name)); @@ -1505,12 +1495,18 @@ g_mirror_request_load(struct g_mirror_so cp = disk->d_consumer; cbp->bio_done = g_mirror_done; cbp->bio_to = cp->provider; - binuptime(&disk->d_last_used); G_MIRROR_LOGREQ(3, cbp, "Sending request."); KASSERT(cp->acr >= 1 && cp->acw >= 1 && cp->ace >= 1, ("Consumer %s not opened (r%dw%de%d).", cp->provider->name, cp->acr, cp->acw, cp->ace)); cp->index++; + /* Remember last head position */ + disk->d_last_offset = bp->bio_offset + bp->bio_length; + /* Update loads. */ + LIST_FOREACH(dp, &sc->sc_disks, d_next) { + dp->load = (dp->d_consumer->index * LOAD_SCALE + + dp->load * 7) / 8; + } g_io_request(cbp, cp); } Modified: head/sys/geom/mirror/g_mirror.h ============================================================================== --- head/sys/geom/mirror/g_mirror.h Thu Dec 3 21:44:41 2009 (r200085) +++ head/sys/geom/mirror/g_mirror.h Thu Dec 3 21:47:51 2009 (r200086) @@ -133,8 +133,8 @@ struct g_mirror_disk { struct g_mirror_softc *d_softc; /* Back-pointer to softc. */ int d_state; /* Disk state. */ u_int d_priority; /* Disk priority. */ - struct bintime d_delay; /* Disk delay. */ - struct bintime d_last_used; /* When disk was last used. */ + u_int load; /* Averaged queue length */ + off_t d_last_offset; /* Last read offset */ uint64_t d_flags; /* Additional flags. */ u_int d_genid; /* Disk's generation ID. */ struct g_mirror_disk_sync d_sync;/* Sync information. */ From owner-svn-src-head@FreeBSD.ORG Thu Dec 3 21:55:43 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8D1AF106566B; Thu, 3 Dec 2009 21:55:43 +0000 (UTC) (envelope-from pjd@garage.freebsd.pl) Received: from mail.garage.freebsd.pl (chello089077043238.chello.pl [89.77.43.238]) by mx1.freebsd.org (Postfix) with ESMTP id 3106C8FC19; Thu, 3 Dec 2009 21:55:42 +0000 (UTC) Received: by mail.garage.freebsd.pl (Postfix, from userid 65534) id AF48045CAC; Thu, 3 Dec 2009 22:55:39 +0100 (CET) Received: from localhost (chello089077043238.chello.pl [89.77.43.238]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.garage.freebsd.pl (Postfix) with ESMTP id 559C445684; Thu, 3 Dec 2009 22:55:33 +0100 (CET) Date: Thu, 3 Dec 2009 22:55:33 +0100 From: Pawel Jakub Dawidek To: Alexander Motin Message-ID: <20091203215532.GA2066@garage.freebsd.pl> References: <200912032147.nB3Llph1027086@svn.freebsd.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="bp/iNruPH9dso1Pn" Content-Disposition: inline In-Reply-To: <200912032147.nB3Llph1027086@svn.freebsd.org> User-Agent: Mutt/1.4.2.3i X-PGP-Key-URL: http://people.freebsd.org/~pjd/pjd.asc X-OS: FreeBSD 9.0-CURRENT i386 X-Spam-Checker-Version: SpamAssassin 3.0.4 (2005-06-05) on mail.garage.freebsd.pl X-Spam-Level: X-Spam-Status: No, score=-0.6 required=4.5 tests=BAYES_00,RCVD_IN_SORBS_DUL autolearn=no version=3.0.4 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Will Andrews Subject: Re: svn commit: r200086 - head/sys/geom/mirror X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Dec 2009 21:55:43 -0000 --bp/iNruPH9dso1Pn Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Dec 03, 2009 at 09:47:51PM +0000, Alexander Motin wrote: > Author: mav > Date: Thu Dec 3 21:47:51 2009 > New Revision: 200086 > URL: http://svn.freebsd.org/changeset/base/200086 >=20 > Log: > Change 'load' balancing mode algorithm: > - Instead of measuring last request execution time for each drive and > choosing one with smallest time, use averaged number of requests, runni= ng > on each drive. This information is more accurate and timely. It allows = to > distribute load between drives in more even and predictable way. > - For each drive track offset of the last submitted request. If new req= uest > offset matches previous one or close for some drive, prefer that drive. > It allows to significantly speedup simultaneous sequential reads. > =20 > PR: kern/113885 > Reviewed by: sobomax Hmm, Will send me improved patch few days ago related to this functionality. Could you guys compare the patches, select the best one and commit it (or both if they serve different purposes)? I'm pretty occupied currently and it will take probably few weeks before I can join the discussion. --=20 Pawel Jakub Dawidek http://www.wheel.pl pjd@FreeBSD.org http://www.FreeBSD.org FreeBSD committer Am I Evil? Yes, I Am! --bp/iNruPH9dso1Pn Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.4 (FreeBSD) iD8DBQFLGDPUForvXbEpPzQRArWlAKCv330H/WHYcll/c3QMb1jlMIj06gCgo1J/ TUJc9O747V2BeV6/5NqeQ7k= =qt1X -----END PGP SIGNATURE----- --bp/iNruPH9dso1Pn-- From owner-svn-src-head@FreeBSD.ORG Thu Dec 3 22:33:27 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 093D01065670; Thu, 3 Dec 2009 22:33:27 +0000 (UTC) (envelope-from will@firepipe.net) Received: from mail-yx0-f171.google.com (mail-yx0-f171.google.com [209.85.210.171]) by mx1.freebsd.org (Postfix) with ESMTP id 936B78FC19; Thu, 3 Dec 2009 22:33:26 +0000 (UTC) Received: by yxe1 with SMTP id 1so1634756yxe.3 for ; Thu, 03 Dec 2009 14:33:25 -0800 (PST) Received: by 10.101.205.23 with SMTP id h23mr3005376anq.34.1259878086011; Thu, 03 Dec 2009 14:08:06 -0800 (PST) Received: from cephei.firepipe.net (c-98-245-40-5.hsd1.co.comcast.net [98.245.40.5]) by mx.google.com with ESMTPS id 7sm1258152yxd.62.2009.12.03.14.08.03 (version=TLSv1/SSLv3 cipher=RC4-MD5); Thu, 03 Dec 2009 14:08:04 -0800 (PST) Date: Thu, 3 Dec 2009 15:08:59 -0700 From: Will Andrews To: Pawel Jakub Dawidek Message-ID: <20091203220856.GA73255@cephei.firepipe.net> References: <200912032147.nB3Llph1027086@svn.freebsd.org> <20091203215532.GA2066@garage.freebsd.pl> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="7JfCtLOvnd9MIVvH" Content-Disposition: inline In-Reply-To: <20091203215532.GA2066@garage.freebsd.pl> User-Agent: Mutt/1.5.20 (2009-06-14) Cc: svn-src-head@freebsd.org, Alexander Motin , src-committers@freebsd.org, svn-src-all@freebsd.org Subject: Re: svn commit: r200086 - head/sys/geom/mirror X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Dec 2009 22:33:27 -0000 --7JfCtLOvnd9MIVvH Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Dec 03, 2009 at 10:55:33PM +0100, Pawel Jakub Dawidek wrote: > On Thu, Dec 03, 2009 at 09:47:51PM +0000, Alexander Motin wrote: > > Author: mav > > Date: Thu Dec 3 21:47:51 2009 > > New Revision: 200086 > > URL: http://svn.freebsd.org/changeset/base/200086 > >=20 > > Log: > > Change 'load' balancing mode algorithm: > > - Instead of measuring last request execution time for each drive and > > choosing one with smallest time, use averaged number of requests, run= ning > > on each drive. This information is more accurate and timely. It allow= s to > > distribute load between drives in more even and predictable way. > > - For each drive track offset of the last submitted request. If new r= equest > > offset matches previous one or close for some drive, prefer that driv= e. > > It allows to significantly speedup simultaneous sequential reads. > > =20 > > PR: kern/113885 > > Reviewed by: sobomax >=20 > Hmm, Will send me improved patch few days ago related to this > functionality. Could you guys compare the patches, select the best one > and commit it (or both if they serve different purposes)? I'm pretty > occupied currently and it will take probably few weeks before I can join > the discussion. Mine changes the round-robin algorithm instead of the load one. But mav's patch uses a different method for distributing the load on the providers, whereas mine is just a better-written version of the PR's patch. --=20 wca --7JfCtLOvnd9MIVvH Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.13 (FreeBSD) iD8DBQFLGDb3F47idPgWcsURAsYQAJwP/0R5Vfw2OHil7iWDxkBdvb721QCfQsrx L/BI25kd0XKQuPqE7rNgAF0= =mPrn -----END PGP SIGNATURE----- --7JfCtLOvnd9MIVvH-- From owner-svn-src-head@FreeBSD.ORG Thu Dec 3 23:24:13 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1C222106566C; Thu, 3 Dec 2009 23:24:13 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0A9B98FC08; Thu, 3 Dec 2009 23:24:13 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nB3NOCTN029115; Thu, 3 Dec 2009 23:24:12 GMT (envelope-from thompsa@svn.freebsd.org) Received: (from thompsa@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nB3NOCmL029112; Thu, 3 Dec 2009 23:24:12 GMT (envelope-from thompsa@svn.freebsd.org) Message-Id: <200912032324.nB3NOCmL029112@svn.freebsd.org> From: Andrew Thompson Date: Thu, 3 Dec 2009 23:24:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200087 - head/sys/dev/usb/controller X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Dec 2009 23:24:13 -0000 Author: thompsa Date: Thu Dec 3 23:24:12 2009 New Revision: 200087 URL: http://svn.freebsd.org/changeset/base/200087 Log: Add uhci/ehci controller ids. Submitted by: mitya_cabletv.dp.ua Modified: head/sys/dev/usb/controller/ehci_pci.c head/sys/dev/usb/controller/uhci_pci.c Modified: head/sys/dev/usb/controller/ehci_pci.c ============================================================================== --- head/sys/dev/usb/controller/ehci_pci.c Thu Dec 3 21:47:51 2009 (r200086) +++ head/sys/dev/usb/controller/ehci_pci.c Thu Dec 3 23:24:12 2009 (r200087) @@ -193,6 +193,10 @@ ehci_pci_match(device_t self) return "Intel 82801I (ICH9) USB 2.0 controller"; case 0x293c8086: return "Intel 82801I (ICH9) USB 2.0 controller"; + case 0x3a3a8086: + return "Intel 82801IJ (ICH10) USB 2.0 controller USB-A"; + case 0x3a3c8086: + return "Intel 82801IJ (ICH10) USB 2.0 controller USB-B"; case 0x00e01033: return ("NEC uPD 720100 USB 2.0 controller"); Modified: head/sys/dev/usb/controller/uhci_pci.c ============================================================================== --- head/sys/dev/usb/controller/uhci_pci.c Thu Dec 3 21:47:51 2009 (r200086) +++ head/sys/dev/usb/controller/uhci_pci.c Thu Dec 3 23:24:12 2009 (r200087) @@ -230,6 +230,18 @@ uhci_pci_match(device_t self) return ("Intel 82801I (ICH9) USB controller"); case 0x29398086: return ("Intel 82801I (ICH9) USB controller"); + case 0x3a348086: + return ("Intel 82801IJ (ICH10) USB controller USB-A"); + case 0x3a358086: + return ("Intel 82801IJ (ICH10) USB controller USB-B"); + case 0x3a368086: + return ("Intel 82801IJ (ICH10) USB controller USB-C"); + case 0x3a378086: + return ("Intel 82801IJ (ICH10) USB controller USB-D"); + case 0x3a388086: + return ("Intel 82801IJ (ICH10) USB controller USB-E"); + case 0x3a398086: + return ("Intel 82801IJ (ICH10) USB controller USB-F"); case 0x719a8086: return ("Intel 82443MX USB controller"); From owner-svn-src-head@FreeBSD.ORG Thu Dec 3 23:57:06 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CE0D010656A9; Thu, 3 Dec 2009 23:57:06 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BC27A8FC21; Thu, 3 Dec 2009 23:57:06 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nB3Nv6I0029774; Thu, 3 Dec 2009 23:57:06 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nB3Nv6dx029772; Thu, 3 Dec 2009 23:57:06 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <200912032357.nB3Nv6dx029772@svn.freebsd.org> From: Pyun YongHyeon Date: Thu, 3 Dec 2009 23:57:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200088 - head/sys/dev/bge X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Dec 2009 23:57:07 -0000 Author: yongari Date: Thu Dec 3 23:57:06 2009 New Revision: 200088 URL: http://svn.freebsd.org/changeset/base/200088 Log: Add workaround to overcome hardware limitation which allows only a single outstanding DMA read operation. Most controllers targeted to client with PCIe bus interface(e.g. BCM5761) may have this limitation. All controllers for servers does not have this limitation. Collapsing mbuf chains to reduce number of memory reads before transmitting was most effective way to workaround this. I got about 940Mbps from 850Mbps with mbuf collapsing on BCM5761. However it takes a lot of CPU cycles to collapse mbuf chains so add tunable to control the number of allowed TX buffers before collapsing. The default value is 0 which effectively disables the forced collapsing. For most cases 2 would yield best performance(about 930Mbps) without much sacrificing CPU cycles. Note the collapsing is only activated when the controller is on PCIe bus and the frame does not need TSO operation. TSO does not seem to suffer from the hardware limitation because the payload size is much bigger than normal IP datagram. Thanks to davidch@ who told me the limitation of client controllers and actually gave possible workarounds to mitigate the limitation. Reviewed by: davidch, marius Modified: head/sys/dev/bge/if_bge.c Modified: head/sys/dev/bge/if_bge.c ============================================================================== --- head/sys/dev/bge/if_bge.c Thu Dec 3 23:24:12 2009 (r200087) +++ head/sys/dev/bge/if_bge.c Thu Dec 3 23:57:06 2009 (r200088) @@ -483,12 +483,29 @@ DRIVER_MODULE(bge, pci, bge_driver, bge_ DRIVER_MODULE(miibus, bge, miibus_driver, miibus_devclass, 0, 0); static int bge_allow_asf = 1; +/* + * A common design characteristic for many Broadcom client controllers + * is that they only support a single outstanding DMA read operation + * on the PCIe bus. This means that it will take twice as long to fetch + * a TX frame that is split into header and payload buffers as it does + * to fetch a single, contiguous TX frame (2 reads vs. 1 read). For + * these controllers, coalescing buffers to reduce the number of memory + * reads is effective way to get maximum performance(about 940Mbps). + * Without collapsing TX buffers the maximum TCP bulk transfer + * performance is about 850Mbps. However forcing coalescing mbufs + * consumes a lot of CPU cycles, so leave it off by default. + */ +static int bge_forced_collapse = 0; TUNABLE_INT("hw.bge.allow_asf", &bge_allow_asf); +TUNABLE_INT("hw.bge.forced_collapse", &bge_forced_collapse); SYSCTL_NODE(_hw, OID_AUTO, bge, CTLFLAG_RD, 0, "BGE driver parameters"); SYSCTL_INT(_hw_bge, OID_AUTO, allow_asf, CTLFLAG_RD, &bge_allow_asf, 0, "Allow ASF mode if available"); +SYSCTL_INT(_hw_bge, OID_AUTO, forced_collapse, CTLFLAG_RD, &bge_forced_collapse, + 0, "Number of fragmented TX buffers of a frame allowed before " + "forced collapsing"); #define SPARC64_BLADE_1500_MODEL "SUNW,Sun-Blade-1500" #define SPARC64_BLADE_1500_PATH_BGE "/pci@1f,700000/network@2" @@ -3915,6 +3932,26 @@ bge_encap(struct bge_softc *sc, struct m csum_flags |= BGE_TXBDFLAG_IP_FRAG; } + if ((m->m_pkthdr.csum_flags & CSUM_TSO) == 0 && + bge_forced_collapse > 0 && (sc->bge_flags & BGE_FLAG_PCIE) != 0 && + m->m_next != NULL) { + /* + * Forcedly collapse mbuf chains to overcome hardware + * limitation which only support a single outstanding + * DMA read operation. + */ + if (bge_forced_collapse == 1) + m = m_defrag(m, M_DONTWAIT); + else + m = m_collapse(m, M_DONTWAIT, bge_forced_collapse); + if (m == NULL) { + m_freem(*m_head); + *m_head = NULL; + return (ENOBUFS); + } + *m_head = m; + } + map = sc->bge_cdata.bge_tx_dmamap[idx]; error = bus_dmamap_load_mbuf_sg(sc->bge_cdata.bge_tx_mtag, map, m, segs, &nsegs, BUS_DMA_NOWAIT); From owner-svn-src-head@FreeBSD.ORG Fri Dec 4 03:34:13 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 50E071065672; Fri, 4 Dec 2009 03:34:13 +0000 (UTC) (envelope-from mjacob@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3EF948FC08; Fri, 4 Dec 2009 03:34:13 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nB43YCis039203; Fri, 4 Dec 2009 03:34:12 GMT (envelope-from mjacob@svn.freebsd.org) Received: (from mjacob@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nB43YCwO039201; Fri, 4 Dec 2009 03:34:12 GMT (envelope-from mjacob@svn.freebsd.org) Message-Id: <200912040334.nB43YCwO039201@svn.freebsd.org> From: Matt Jacob Date: Fri, 4 Dec 2009 03:34:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200089 - head/sys/dev/isp X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Dec 2009 03:34:13 -0000 Author: mjacob Date: Fri Dec 4 03:34:12 2009 New Revision: 200089 URL: http://svn.freebsd.org/changeset/base/200089 Log: Fix cases where we've managed to get a Loop UP event prior to initializing the loop down counter, as well as other things. This was brought to my attention with a different fix, more for RELENG_7- this one covers the multiple channel case. PR: 140438 MFC after: 1 month Modified: head/sys/dev/isp/isp_freebsd.c head/sys/dev/isp/isp_freebsd.h Modified: head/sys/dev/isp/isp_freebsd.c ============================================================================== --- head/sys/dev/isp/isp_freebsd.c Thu Dec 3 23:57:06 2009 (r200088) +++ head/sys/dev/isp/isp_freebsd.c Fri Dec 4 03:34:12 2009 (r200089) @@ -133,33 +133,37 @@ isp_attach_chan(ispsoftc_t *isp, struct } #endif } else { + fcparam *fcp = FCPARAM(isp, chan); struct isp_fc *fc = ISP_FC_PC(isp, chan); + ISP_LOCK(isp); fc->sim = sim; fc->path = path; fc->isp = isp; + fc->ready = 1; callout_init_mtx(&fc->ldt, &isp->isp_osinfo.lock, 0); callout_init_mtx(&fc->gdt, &isp->isp_osinfo.lock, 0); - - if (THREAD_CREATE(isp_kthread, fc, &fc->kproc, 0, 0, "%s: fc_thrd%d", device_get_nameunit(isp->isp_osinfo.dev), chan)) { - xpt_free_path(fc->path); - ISP_LOCK(isp); - xpt_bus_deregister(cam_sim_path(fc->sim)); - ISP_UNLOCK(isp); - cam_sim_free(fc->sim, FALSE); - } /* * We start by being "loop down" if we have an initiator role */ - ISP_LOCK(isp); - if ((FCPARAM(isp, chan)->role & ISP_ROLE_INITIATOR) && fc->ldt_running == 0) { + if (fcp->role & ISP_ROLE_INITIATOR) { isp_freeze_loopdown(isp, chan, "isp_attach"); - fc->ldt_running = 1; callout_reset(&fc->ldt, isp_quickboot_time * hz, isp_ldt, fc); isp_prt(isp, ISP_LOGSANCFG|ISP_LOGDEBUG0, "Starting Initial Loop Down Timer @ %lu", (unsigned long) time_uptime); } ISP_UNLOCK(isp); + if (THREAD_CREATE(isp_kthread, fc, &fc->kproc, 0, 0, "%s: fc_thrd%d", device_get_nameunit(isp->isp_osinfo.dev), chan)) { + xpt_free_path(fc->path); + ISP_LOCK(isp); + if (callout_active(&fc->ldt)) { + callout_stop(&fc->ldt); + } + xpt_bus_deregister(cam_sim_path(fc->sim)); + ISP_UNLOCK(isp); + cam_sim_free(fc->sim, FALSE); + return (ENOMEM); + } #ifdef ISP_INTERNAL_TARGET ISP_SET_PC(isp, chan, proc_active, 1); if (THREAD_CREATE(isp_target_thread_fc, fc, &fc->target_proc, 0, 0, "%s: isp_test_tgt%d", device_get_nameunit(isp->isp_osinfo.dev), chan)) { @@ -3935,12 +3939,12 @@ isp_gdt(void *arg) isp_prt(isp, ISP_LOGCONFIG, prom3, chan, lp->portid, tgt, "Gone Device Timeout"); isp_make_gone(isp, chan, tgt); } - if (more_to_do) { - fc->gdt_running = 1; - callout_reset(&fc->gdt, hz, isp_gdt, fc); - } else { - isp_prt(isp, ISP_LOGSANCFG|ISP_LOGDEBUG0, "Chan %d stopping Gone Device Timer", chan); - fc->gdt_running = 0; + if (fc->ready) { + if (more_to_do) { + callout_reset(&fc->gdt, hz, isp_gdt, fc); + } else { + isp_prt(isp, ISP_LOGSANCFG|ISP_LOGDEBUG0, "Chan %d stopping Gone Device Timer", chan); + } } } @@ -4017,6 +4021,7 @@ isp_kthread(void *arg) ispsoftc_t *isp = fc->isp; int chan = fc - isp->isp_osinfo.pc.fc; int slp = 0; + mtx_lock(&isp->isp_osinfo.lock); for (;;) { @@ -4802,6 +4807,7 @@ isp_async(ispsoftc_t *isp, ispasync_t cm char *msg = NULL; target_id_t tgt; fcportdb_t *lp; + struct isp_fc *fc; struct cam_path *tmppath; va_list ap; @@ -4886,7 +4892,6 @@ isp_async(ispsoftc_t *isp, ispasync_t cm /* FALLTHROUGH */ case ISPASYNC_LOOP_DOWN: { - struct isp_fc *fc; if (msg == NULL) { msg = "LOOP Down"; } @@ -4894,20 +4899,21 @@ isp_async(ispsoftc_t *isp, ispasync_t cm bus = va_arg(ap, int); va_end(ap); - FCPARAM(isp, bus)->link_active = 1; + FCPARAM(isp, bus)->link_active = 0; fc = ISP_FC_PC(isp, bus); - /* - * We don't do any simq freezing if we are only in target mode - */ - if (fc->role & ISP_ROLE_INITIATOR) { - if (fc->path) { - isp_freeze_loopdown(isp, bus, msg); - } - if (fc->ldt_running == 0) { - fc->ldt_running = 1; - callout_reset(&fc->ldt, fc->loop_down_limit * hz, isp_ldt, fc); - isp_prt(isp, ISP_LOGSANCFG|ISP_LOGDEBUG0, "starting Loop Down Timer @ %lu", (unsigned long) time_uptime); + if (cmd == ISPASYNC_LOOP_DOWN && fc->ready) { + /* + * We don't do any simq freezing if we are only in target mode + */ + if (fc->role & ISP_ROLE_INITIATOR) { + if (fc->path) { + isp_freeze_loopdown(isp, bus, msg); + } + if (!callout_active(&fc->ldt)) { + callout_reset(&fc->ldt, fc->loop_down_limit * hz, isp_ldt, fc); + isp_prt(isp, ISP_LOGSANCFG|ISP_LOGDEBUG0, "starting Loop Down Timer @ %lu", (unsigned long) time_uptime); + } } } isp_prt(isp, ISP_LOGINFO, "Chan %d: %s", bus, msg); @@ -4917,6 +4923,7 @@ isp_async(ispsoftc_t *isp, ispasync_t cm va_start(ap, cmd); bus = va_arg(ap, int); va_end(ap); + fc = ISP_FC_PC(isp, bus); /* * Now we just note that Loop has come up. We don't * actually do anything because we're waiting for a @@ -4924,8 +4931,8 @@ isp_async(ispsoftc_t *isp, ispasync_t cm * thread to look at the state of the loop again. */ FCPARAM(isp, bus)->link_active = 1; - ISP_FC_PC(isp, bus)->loop_dead = 0; - ISP_FC_PC(isp, bus)->loop_down_time = 0; + fc->loop_dead = 0; + fc->loop_down_time = 0; isp_prt(isp, ISP_LOGINFO, "Chan %d Loop UP", bus); break; case ISPASYNC_DEV_ARRIVED: @@ -4933,8 +4940,9 @@ isp_async(ispsoftc_t *isp, ispasync_t cm bus = va_arg(ap, int); lp = va_arg(ap, fcportdb_t *); va_end(ap); + fc = ISP_FC_PC(isp, bus); lp->reserved = 0; - if ((ISP_FC_PC(isp, bus)->role & ISP_ROLE_INITIATOR) && (lp->roles & (SVC3_TGT_ROLE >> SVC3_ROLE_SHIFT))) { + if ((fc->role & ISP_ROLE_INITIATOR) && (lp->roles & (SVC3_TGT_ROLE >> SVC3_ROLE_SHIFT))) { int dbidx = lp - FCPARAM(isp, bus)->portdb; int i; @@ -4967,6 +4975,7 @@ isp_async(ispsoftc_t *isp, ispasync_t cm bus = va_arg(ap, int); lp = va_arg(ap, fcportdb_t *); va_end(ap); + fc = ISP_FC_PC(isp, bus); lp->reserved = 0; if (isp_change_is_bad) { lp->state = FC_PORTDB_STATE_NIL; @@ -5013,6 +5022,7 @@ isp_async(ispsoftc_t *isp, ispasync_t cm bus = va_arg(ap, int); lp = va_arg(ap, fcportdb_t *); va_end(ap); + fc = ISP_FC_PC(isp, bus); /* * If this has a virtual target and we haven't marked it * that we're going to have isp_gdt tell the OS it's gone, @@ -5025,10 +5035,9 @@ isp_async(ispsoftc_t *isp, ispasync_t cm lp->reserved = 1; lp->new_reserved = ISP_FC_PC(isp, bus)->gone_device_time; lp->state = FC_PORTDB_STATE_ZOMBIE; - if (ISP_FC_PC(isp, bus)->gdt_running == 0) { + if (fc->ready && !callout_active(&fc->gdt)) { isp_prt(isp, ISP_LOGSANCFG|ISP_LOGDEBUG0, "Chan %d starting Gone Device Timer", bus); - ISP_FC_PC(isp, bus)->gdt_running = 1; - callout_reset(&ISP_FC_PC(isp, bus)->gdt, hz, isp_gdt, ISP_FC_PC(isp, bus)); + callout_reset(&fc->gdt, hz, isp_gdt, fc); } tgt = lp->dev_map_idx - 1; isp_prt(isp, ISP_LOGCONFIG, prom2, bus, lp->portid, lp->handle, roles[lp->roles], "gone zombie at", tgt, (uint32_t) (lp->port_wwn >> 32), (uint32_t) lp->port_wwn); @@ -5053,6 +5062,7 @@ isp_async(ispsoftc_t *isp, ispasync_t cm nlstate = reason = 0; } va_end(ap); + fc = ISP_FC_PC(isp, bus); if (evt == ISPASYNC_CHANGE_PDB) { msg = "Chan %d Port Database Changed"; @@ -5065,16 +5075,15 @@ isp_async(ispsoftc_t *isp, ispasync_t cm /* * If the loop down timer is running, cancel it. */ - if (ISP_FC_PC(isp, bus)->ldt_running) { + if (fc->ready && callout_active(&fc->ldt)) { isp_prt(isp, ISP_LOGSANCFG|ISP_LOGDEBUG0, "Stopping Loop Down Timer @ %lu", (unsigned long) time_uptime); - ISP_FC_PC(isp, bus)->ldt_running = 0; - callout_stop(&ISP_FC_PC(isp, bus)->ldt); + callout_stop(&fc->ldt); } isp_prt(isp, ISP_LOGINFO, msg, bus); - if (ISP_FC_PC(isp, bus)->role & ISP_ROLE_INITIATOR) { + if (fc->role & ISP_ROLE_INITIATOR) { isp_freeze_loopdown(isp, bus, msg); } - wakeup(ISP_FC_PC(isp, bus)); + wakeup(fc); break; } #ifdef ISP_TARGET_MODE Modified: head/sys/dev/isp/isp_freebsd.h ============================================================================== --- head/sys/dev/isp/isp_freebsd.h Thu Dec 3 23:57:06 2009 (r200088) +++ head/sys/dev/isp/isp_freebsd.h Fri Dec 4 03:34:12 2009 (r200089) @@ -177,9 +177,9 @@ struct isp_fc { hysteresis : 8, role : 2, gdt_running : 1, - ldt_running : 1, loop_dead : 1, - fcbsy : 1; + fcbsy : 1, + ready : 1; struct callout ldt; /* loop down timer */ struct callout gdt; /* gone device timer */ #ifdef ISP_TARGET_MODE From owner-svn-src-head@FreeBSD.ORG Fri Dec 4 03:45:17 2009 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 70C1E106566C; Fri, 4 Dec 2009 03:45:17 +0000 (UTC) (envelope-from ume@mahoroba.org) Received: from asuka.mahoroba.org (ent.mahoroba.org [IPv6:2001:2f0:104:8010::1]) by mx1.freebsd.org (Postfix) with ESMTP id 29BDC8FC15; Fri, 4 Dec 2009 03:45:16 +0000 (UTC) Received: from ameno.mahoroba.org (IDENT:hobJhK6EHgWy8JD0ry1rSFGvQ3tVXTRiqu5bJBZbCpQWUZyy5HXttOup5MElfBSW@ameno.mahoroba.org [IPv6:2001:2f0:104:8010:20a:79ff:fe69:ee6b]) (user=ume mech=CRAM-MD5 bits=0) by asuka.mahoroba.org (8.14.3/8.14.3) with ESMTP/inet6 id nB43j6GG014512 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 4 Dec 2009 12:45:06 +0900 (JST) (envelope-from ume@mahoroba.org) Date: Fri, 04 Dec 2009 12:45:06 +0900 Message-ID: From: Hajimu UMEMOTO To: "Bjoern A. Zeeb" In-Reply-To: <20091203193619.J83957@maildrop.int.zabbadoz.net> References: <200912031116.nB3BGsm2091411@svn.freebsd.org> <20091203193619.J83957@maildrop.int.zabbadoz.net> User-Agent: xcite1.58> Wanderlust/2.14.0 (Africa) SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (=?ISO-2022-JP-2?B?R29qGyQoRCtXGyhC?=) APEL/10.7 Emacs/23.1 (i386-portbld-freebsd8.0) MULE/6.0 (HANACHIRUSATO) X-Operating-System: FreeBSD 8.0-RELEASE X-PGP-Key: http://www.imasy.or.jp/~ume/publickey.asc X-PGP-Fingerprint: 1F00 0B9E 2164 70FC 6DC5 BF5F 04E9 F086 BF90 71FE Organization: Internet Mutual Aid Society, YOKOHAMA MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.3 (asuka.mahoroba.org [IPv6:2001:2f0:104:8010::1]); Fri, 04 Dec 2009 12:45:06 +0900 (JST) X-Virus-Scanned: clamav-milter 0.95.3 at asuka.mahoroba.org X-Virus-Status: Clean X-Spam-Status: No, score=-2.5 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on asuka.mahoroba.org Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r200055 - head/sys/netinet/ipfw X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Dec 2009 03:45:17 -0000 Hi, >>>>> On Thu, 3 Dec 2009 19:43:33 +0000 (UTC) >>>>> "Bjoern A. Zeeb" said: bz> Does it need to be 48 rather than 46? You do not have the [] here. bz> If not INET6_ADDRSTRLEN is what we use elsewhere. I would actually bz> prefer to only have bz> #ifdef INET6 bz> char src[INET6_ADDRSTRLEN|48], .. bz> #else bz> char src[INET_ADDRSTRLEN|18], .. bz> #endif bz> as it's 60 bytes of stack size for people w/o INET6 support (shame on bz> them;-) Some applies for equivalent code further down. Oops, I'll fix it later. Sincerely, -- Hajimu UMEMOTO @ Internet Mutual Aid Society Yokohama, Japan ume@mahoroba.org ume@{,jp.}FreeBSD.org http://www.imasy.org/~ume/ From owner-svn-src-head@FreeBSD.ORG Fri Dec 4 05:45:46 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CC3D21065670; Fri, 4 Dec 2009 05:45:46 +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 BBDE98FC14; Fri, 4 Dec 2009 05:45:46 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nB45jko0043951; Fri, 4 Dec 2009 05:45:46 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nB45jkjT043949; Fri, 4 Dec 2009 05:45:46 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <200912040545.nB45jkjT043949@svn.freebsd.org> From: Andriy Gapon Date: Fri, 4 Dec 2009 05:45:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200091 - head/sys/dev/ichsmb X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Dec 2009 05:45:46 -0000 Author: avg Date: Fri Dec 4 05:45:46 2009 New Revision: 200091 URL: http://svn.freebsd.org/changeset/base/200091 Log: ichsmb: drop default attachment to generic smbus hardware Attach only to devices known to be supported. This change overrided and undoes r200053. Suggested by: jhb MFC after: 2 weeks (only to stable/8) Modified: head/sys/dev/ichsmb/ichsmb_pci.c Modified: head/sys/dev/ichsmb/ichsmb_pci.c ============================================================================== --- head/sys/dev/ichsmb/ichsmb_pci.c Fri Dec 4 05:31:40 2009 (r200090) +++ head/sys/dev/ichsmb/ichsmb_pci.c Fri Dec 4 05:45:46 2009 (r200091) @@ -67,7 +67,6 @@ __FBSDID("$FreeBSD$"); #include /* PCI unique identifiers */ -#define VENDORID_INTEL 0x8086 #define ID_82801AA 0x24138086 #define ID_82801AB 0x24238086 #define ID_82801BA 0x24438086 @@ -172,13 +171,6 @@ ichsmb_pci_probe(device_t dev) device_set_desc(dev, "Intel 631xESB/6321ESB (ESB2) SMBus controller"); break; default: - if (pci_get_vendor(dev) == VENDORID_INTEL - && pci_get_class(dev) == PCIC_SERIALBUS - && pci_get_subclass(dev) == PCIS_SERIALBUS_SMBUS - && pci_get_progif(dev) == PCIS_SERIALBUS_SMBUS_PROGIF) { - device_set_desc(dev, "Intel SMBus controller"); - return (BUS_PROBE_DEFAULT); /* XXX */ - } return (ENXIO); } From owner-svn-src-head@FreeBSD.ORG Fri Dec 4 09:20:20 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BB5F6106566C; Fri, 4 Dec 2009 09:20:20 +0000 (UTC) (envelope-from trhodes@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id AA1968FC1A; Fri, 4 Dec 2009 09:20:20 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nB49KKog048602; Fri, 4 Dec 2009 09:20:20 GMT (envelope-from trhodes@svn.freebsd.org) Received: (from trhodes@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nB49KKf7048600; Fri, 4 Dec 2009 09:20:20 GMT (envelope-from trhodes@svn.freebsd.org) Message-Id: <200912040920.nB49KKf7048600@svn.freebsd.org> From: Tom Rhodes Date: Fri, 4 Dec 2009 09:20:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200095 - head/lib/libc/string X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Dec 2009 09:20:20 -0000 Author: trhodes Date: Fri Dec 4 09:20:20 2009 New Revision: 200095 URL: http://svn.freebsd.org/changeset/base/200095 Log: Add a missing word to a sentence in the return values section. Modified: head/lib/libc/string/strcmp.3 Modified: head/lib/libc/string/strcmp.3 ============================================================================== --- head/lib/libc/string/strcmp.3 Fri Dec 4 07:10:18 2009 (r200094) +++ head/lib/libc/string/strcmp.3 Fri Dec 4 09:20:20 2009 (r200095) @@ -75,7 +75,7 @@ The .Fn strcmp and .Fn strncmp -return an integer greater than, equal to, or less than 0, according +functions return an integer greater than, equal to, or less than 0, according as the string .Fa s1 is greater than, equal to, or less than the string From owner-svn-src-head@FreeBSD.ORG Fri Dec 4 10:16:39 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 927FE106566C; Fri, 4 Dec 2009 10:16:39 +0000 (UTC) (envelope-from des@des.no) Received: from tim.des.no (tim.des.no [194.63.250.121]) by mx1.freebsd.org (Postfix) with ESMTP id 4A6CA8FC0C; Fri, 4 Dec 2009 10:16:38 +0000 (UTC) Received: from ds4.des.no (des.no [84.49.246.2]) by smtp.des.no (Postfix) with ESMTP id 9247E6D41B; Fri, 4 Dec 2009 10:16:37 +0000 (UTC) Received: by ds4.des.no (Postfix, from userid 1001) id 5CF27844E9; Fri, 4 Dec 2009 11:16:37 +0100 (CET) From: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= To: Kostik Belousov References: <200911261349.nAQDnco2083469@svn.freebsd.org> <200912021926.02346.fluffy@fluffy.khv.ru> <20091202132904.GH2368@deviant.kiev.zoral.com.ua> Date: Fri, 04 Dec 2009 11:16:37 +0100 In-Reply-To: <20091202132904.GH2368@deviant.kiev.zoral.com.ua> (Kostik Belousov's message of "Wed, 2 Dec 2009 15:29:04 +0200") Message-ID: <86pr6vvybe.fsf@ds4.des.no> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.95 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Cc: Dima Panov , svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, cvs-all@freebsd.org Subject: Re: svn commit: r199827 - in head: include lib/libc/compat-43 sys/sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Dec 2009 10:16:39 -0000 Kostik Belousov writes: > No. My interpretation of __FreeBSD_version is that the bump indicates > incompatible change in the interfaces. ...or the introduction of a new interface; see for instance r194210, where simon@ bumped it to mark a new OpenSSL version with new features. It is widely used in the ports tree to determine whether a particular patch should be applied. (actually, that's precisely the reason why __FreeBSD_version was introduced, and it lived in userland for a while before eivind@ moved it into the kernel in 1998) > Sometime it is used to mark the point where big changes hit the tree, > possibly not related to interface change. Bumps are cheap, better one too many than one too few. > Also, __FreeBSD_version denotes the kernel "version". No, it has been bumped for libc changes in the past. DES --=20 Dag-Erling Sm=C3=B8rgrav - des@des.no From owner-svn-src-head@FreeBSD.ORG Fri Dec 4 10:57:02 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 03E7E106566B; Fri, 4 Dec 2009 10:57:02 +0000 (UTC) (envelope-from phk@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E6C228FC17; Fri, 4 Dec 2009 10:57:01 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nB4Av1Jq052923; Fri, 4 Dec 2009 10:57:01 GMT (envelope-from phk@svn.freebsd.org) Received: (from phk@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nB4Av1PI052922; Fri, 4 Dec 2009 10:57:01 GMT (envelope-from phk@svn.freebsd.org) Message-Id: <200912041057.nB4Av1PI052922@svn.freebsd.org> From: Poul-Henning Kamp Date: Fri, 4 Dec 2009 10:57:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200096 - head/tools/tools/sysbuild X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Dec 2009 10:57:02 -0000 Author: phk Date: Fri Dec 4 10:57:01 2009 New Revision: 200096 URL: http://svn.freebsd.org/changeset/base/200096 Log: Add disk-magic for amd64: same as i386. Pass PORTS_OPTS wherever we invoke ports makefiles Add a logfile where we can see the progress of distfile prefetching Modified: head/tools/tools/sysbuild/sysbuild.sh Modified: head/tools/tools/sysbuild/sysbuild.sh ============================================================================== --- head/tools/tools/sysbuild/sysbuild.sh Fri Dec 4 09:20:20 2009 (r200095) +++ head/tools/tools/sysbuild/sysbuild.sh Fri Dec 4 10:57:01 2009 (r200096) @@ -43,6 +43,18 @@ if [ `uname -m` = "i386" ] ; then # Where our build-bits are to be found FREEBSD_PART=`echo $TARGET_PART | sed 's/s[12]a/s3/'` +elif [ `uname -m` = "amd64" ] ; then + TARGET_PART=`df / | sed ' + 1d + s/[ ].*// + s,/dev/,, + s,s1a,s3a, + s,s2a,s1a, + s,s3a,s2a, + '` + + # Where our build-bits are to be found + FREEBSD_PART=`echo $TARGET_PART | sed 's/s[12]a/s3/'` else TARGET_PART=unknown FREEBSD_PART=unknown @@ -162,7 +174,7 @@ ports_recurse() ( else ( cd $d - ports_recurse `make -V _DEPEND_DIRS` + ports_recurse `make -V _DEPEND_DIRS ${PORTS_OPTS}` ) echo $d >> /tmp/_.plist fi @@ -195,7 +207,7 @@ ports_build() ( cd /usr/ports cd $p set +e - make clean + make clean ${PORTS_OPTS} if make install ${PORTS_OPTS} ; then if [ "x${PKG_DIR}" != "x" ] ; then make package ${PORTS_OPTS} @@ -217,9 +229,11 @@ ports_prefetch() ( true > /tmp/_.plist ports_recurse $PORTS_WE_WANT + true > /mnt/_.prefetch # Now checksump/fetch them for p in `cat /tmp/_.plist` do + echo "Prefetching $p" >> /mnt/_.prefetch b=`echo $p | tr / _` ( cd $p @@ -434,6 +448,7 @@ if [ "x${OBJ_PATH}" != "x" ] ; then fi log_it Wait for ports prefetch +log_it "(Tail /mnt/_.prefetch for progress)" wait log_it Move filesystems From owner-svn-src-head@FreeBSD.ORG Fri Dec 4 14:08:57 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8A2D8106566C; Fri, 4 Dec 2009 14:08:57 +0000 (UTC) (envelope-from kuriyama@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 797588FC17; Fri, 4 Dec 2009 14:08:57 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nB4E8v8k056838; Fri, 4 Dec 2009 14:08:57 GMT (envelope-from kuriyama@svn.freebsd.org) Received: (from kuriyama@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nB4E8vZA056836; Fri, 4 Dec 2009 14:08:57 GMT (envelope-from kuriyama@svn.freebsd.org) Message-Id: <200912041408.nB4E8vZA056836@svn.freebsd.org> From: Jun Kuriyama Date: Fri, 4 Dec 2009 14:08:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200099 - head/usr.sbin/ypserv X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Dec 2009 14:08:57 -0000 Author: kuriyama Date: Fri Dec 4 14:08:57 2009 New Revision: 200099 URL: http://svn.freebsd.org/changeset/base/200099 Log: - Replace magic number with YPOLDVERS macro (which may be missed in r14262). Modified: head/usr.sbin/ypserv/yp_main.c Modified: head/usr.sbin/ypserv/yp_main.c ============================================================================== --- head/usr.sbin/ypserv/yp_main.c Fri Dec 4 11:26:52 2009 (r200098) +++ head/usr.sbin/ypserv/yp_main.c Fri Dec 4 14:08:57 2009 (r200099) @@ -295,7 +295,7 @@ main(int argc, char *argv[]) } sock = RPC_ANYSOCK; (void) pmap_unset(YPPROG, YPVERS); - (void) pmap_unset(YPPROG, 1); + (void) pmap_unset(YPPROG, YPOLDVERS); } /* From owner-svn-src-head@FreeBSD.ORG Fri Dec 4 14:12:38 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4C3EE1065672; Fri, 4 Dec 2009 14:12:38 +0000 (UTC) (envelope-from kuriyama@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3BA0C8FC16; Fri, 4 Dec 2009 14:12:38 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nB4ECcUN056960; Fri, 4 Dec 2009 14:12:38 GMT (envelope-from kuriyama@svn.freebsd.org) Received: (from kuriyama@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nB4ECckR056958; Fri, 4 Dec 2009 14:12:38 GMT (envelope-from kuriyama@svn.freebsd.org) Message-Id: <200912041412.nB4ECckR056958@svn.freebsd.org> From: Jun Kuriyama Date: Fri, 4 Dec 2009 14:12:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200100 - head/usr.sbin/ypserv X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Dec 2009 14:12:38 -0000 Author: kuriyama Date: Fri Dec 4 14:12:37 2009 New Revision: 200100 URL: http://svn.freebsd.org/changeset/base/200100 Log: - In ypproc_all_2_svc(), yp_fork() is called only when !debug case. So _exit() in the bottom of this function should be called with the same case. Modified: head/usr.sbin/ypserv/yp_server.c Modified: head/usr.sbin/ypserv/yp_server.c ============================================================================== --- head/usr.sbin/ypserv/yp_server.c Fri Dec 4 14:08:57 2009 (r200099) +++ head/usr.sbin/ypserv/yp_server.c Fri Dec 4 14:12:37 2009 (r200100) @@ -563,7 +563,10 @@ ypproc_all_2_svc(ypreq_nokey *argp, stru * Proper fix for PR #10970: exit here so that we don't risk * having a child spawned from this sub-process. */ - _exit(0); + if (!debug) + _exit(0); + + return &result; } ypresp_master * From owner-svn-src-head@FreeBSD.ORG Fri Dec 4 14:18:31 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4FD6C1065696; Fri, 4 Dec 2009 14:18:31 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3D8CD8FC19; Fri, 4 Dec 2009 14:18:31 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nB4EIVas057111; Fri, 4 Dec 2009 14:18:31 GMT (envelope-from luigi@svn.freebsd.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nB4EIVKp057109; Fri, 4 Dec 2009 14:18:31 GMT (envelope-from luigi@svn.freebsd.org) Message-Id: <200912041418.nB4EIVKp057109@svn.freebsd.org> From: Luigi Rizzo Date: Fri, 4 Dec 2009 14:18:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200101 - head/sbin/ipfw X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Dec 2009 14:18:31 -0000 Author: luigi Date: Fri Dec 4 14:18:30 2009 New Revision: 200101 URL: http://svn.freebsd.org/changeset/base/200101 Log: fix argument type in the call to expand_number Submitted by: gcc 4.3 MFC after: 3 days Modified: head/sbin/ipfw/dummynet.c Modified: head/sbin/ipfw/dummynet.c ============================================================================== --- head/sbin/ipfw/dummynet.c Fri Dec 4 14:12:37 2009 (r200100) +++ head/sbin/ipfw/dummynet.c Fri Dec 4 14:18:30 2009 (r200101) @@ -950,7 +950,7 @@ end_mask: errx(EX_DATAERR, "burst only valid for pipes"); NEED1("burst needs argument\n"); errno = 0; - if (expand_number(av[0], &p.burst) < 0) + if (expand_number(av[0], (int64_t *)&p.burst) < 0) if (errno != ERANGE) errx(EX_DATAERR, "burst: invalid argument"); From owner-svn-src-head@FreeBSD.ORG Fri Dec 4 15:39:38 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 007621065DB6; Fri, 4 Dec 2009 15:39:38 +0000 (UTC) (envelope-from ume@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E3E918FC1C; Fri, 4 Dec 2009 15:39:37 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nB4Fdbd4058937; Fri, 4 Dec 2009 15:39:37 GMT (envelope-from ume@svn.freebsd.org) Received: (from ume@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nB4Fdbhg058935; Fri, 4 Dec 2009 15:39:37 GMT (envelope-from ume@svn.freebsd.org) Message-Id: <200912041539.nB4Fdbhg058935@svn.freebsd.org> From: Hajimu UMEMOTO Date: Fri, 4 Dec 2009 15:39:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200102 - head/sys/netinet/ipfw X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Dec 2009 15:39:38 -0000 Author: ume Date: Fri Dec 4 15:39:37 2009 New Revision: 200102 URL: http://svn.freebsd.org/changeset/base/200102 Log: Use INET_ADDRSTRLEN and INET6_ADDRSTRLEN rather than hard coded number. Spotted by: bz Modified: head/sys/netinet/ipfw/ip_fw2.c Modified: head/sys/netinet/ipfw/ip_fw2.c ============================================================================== --- head/sys/netinet/ipfw/ip_fw2.c Fri Dec 4 14:18:30 2009 (r200101) +++ head/sys/netinet/ipfw/ip_fw2.c Fri Dec 4 15:39:37 2009 (r200102) @@ -899,7 +899,11 @@ ipfw_log(struct ip_fw *f, u_int hlen, st } else { int len; - char src[48], dst[48]; +#ifdef INET6 + char src[INET6_ADDRSTRLEN + 2], dst[INET6_ADDRSTRLEN + 2]; +#else + char src[INET_ADDRSTRLEN], dst[INET_ADDRSTRLEN]; +#endif struct icmphdr *icmp; struct tcphdr *tcp; struct udphdr *udp; @@ -1054,7 +1058,11 @@ static __inline void unlink_dyn_rule_print(struct ipfw_flow_id *id) { struct in_addr da; - char src[48], dst[48]; +#ifdef INET6 + char src[INET6_ADDRSTRLEN], dst[INET6_ADDRSTRLEN]; +#else + char src[INET_ADDRSTRLEN], dst[INET_ADDRSTRLEN]; +#endif #ifdef INET6 if (IS_IP6_FLOW_ID(id)) { @@ -1416,8 +1424,14 @@ add_dyn_rule(struct ipfw_flow_id *id, u_ V_dyn_count++; DEB({ struct in_addr da; - char src[48]; - char dst[48]; +#ifdef INET6 + char src[INET6_ADDRSTRLEN]; + char dst[INET6_ADDRSTRLEN]; +#else + char src[INET_ADDRSTRLEN]; + char dst[INET_ADDRSTRLEN]; +#endif + #ifdef INET6 if (IS_IP6_FLOW_ID(&(r->id))) { ip6_sprintf(src, &r->id.src_ip6); @@ -1490,7 +1504,11 @@ install_state(struct ip_fw *rule, ipfw_i static int last_log; ipfw_dyn_rule *q; struct in_addr da; - char src[48], dst[48]; +#ifdef INET6 + char src[INET6_ADDRSTRLEN + 2], dst[INET6_ADDRSTRLEN + 2]; +#else + char src[INET_ADDRSTRLEN], dst[INET_ADDRSTRLEN]; +#endif src[0] = '\0'; dst[0] = '\0'; From owner-svn-src-head@FreeBSD.ORG Fri Dec 4 20:46:45 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B937A106568B; Fri, 4 Dec 2009 20:46:45 +0000 (UTC) (envelope-from netchild@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A73348FC15; Fri, 4 Dec 2009 20:46:45 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nB4Kkj7g065155; Fri, 4 Dec 2009 20:46:45 GMT (envelope-from netchild@svn.freebsd.org) Received: (from netchild@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nB4KkjYQ065154; Fri, 4 Dec 2009 20:46:45 GMT (envelope-from netchild@svn.freebsd.org) Message-Id: <200912042046.nB4KkjYQ065154@svn.freebsd.org> From: Alexander Leidinger Date: Fri, 4 Dec 2009 20:46:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200109 - head/sys/compat/linux X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Dec 2009 20:46:45 -0000 Author: netchild Date: Fri Dec 4 20:46:45 2009 New Revision: 200109 URL: http://svn.freebsd.org/changeset/base/200109 Log: Import the unchanged v4l videodev.h from the vendor branch. Added: head/sys/compat/linux/linux_videodev.h - copied unchanged from r200108, vendor/v4l/dist/videodev.h Copied: head/sys/compat/linux/linux_videodev.h (from r200108, vendor/v4l/dist/videodev.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/compat/linux/linux_videodev.h Fri Dec 4 20:46:45 2009 (r200109, copy of r200108, vendor/v4l/dist/videodev.h) @@ -0,0 +1,372 @@ +#ifndef __LINUX_VIDEODEV_H +#define __LINUX_VIDEODEV_H + +#include + +#define HAVE_V4L1 1 + +#include + +#ifdef __KERNEL__ + +#include + +extern struct video_device* video_devdata(struct file*); + +#define to_video_device(cd) container_of(cd, struct video_device, class_dev) +static inline void +video_device_create_file(struct video_device *vfd, + struct class_device_attribute *attr) +{ + class_device_create_file(&vfd->class_dev, attr); +} +static inline void +video_device_remove_file(struct video_device *vfd, + struct class_device_attribute *attr) +{ + class_device_remove_file(&vfd->class_dev, attr); +} + +#if OBSOLETE_OWNER /* to be removed in 2.6.15 */ +/* helper functions to access driver private data. */ +static inline void *video_get_drvdata(struct video_device *dev) +{ + return dev->priv; +} + +static inline void video_set_drvdata(struct video_device *dev, void *data) +{ + dev->priv = data; +} +#endif + +extern int video_exclusive_open(struct inode *inode, struct file *file); +extern int video_exclusive_release(struct inode *inode, struct file *file); +#endif /* __KERNEL__ */ + +struct video_capability +{ + char name[32]; + int type; + int channels; /* Num channels */ + int audios; /* Num audio devices */ + int maxwidth; /* Supported width */ + int maxheight; /* And height */ + int minwidth; /* Supported width */ + int minheight; /* And height */ +}; + + +struct video_channel +{ + int channel; + char name[32]; + int tuners; + __u32 flags; +#define VIDEO_VC_TUNER 1 /* Channel has a tuner */ +#define VIDEO_VC_AUDIO 2 /* Channel has audio */ + __u16 type; +#define VIDEO_TYPE_TV 1 +#define VIDEO_TYPE_CAMERA 2 + __u16 norm; /* Norm set by channel */ +}; + +struct video_tuner +{ + int tuner; + char name[32]; + unsigned long rangelow, rangehigh; /* Tuner range */ + __u32 flags; +#define VIDEO_TUNER_PAL 1 +#define VIDEO_TUNER_NTSC 2 +#define VIDEO_TUNER_SECAM 4 +#define VIDEO_TUNER_LOW 8 /* Uses KHz not MHz */ +#define VIDEO_TUNER_NORM 16 /* Tuner can set norm */ +#define VIDEO_TUNER_STEREO_ON 128 /* Tuner is seeing stereo */ +#define VIDEO_TUNER_RDS_ON 256 /* Tuner is seeing an RDS datastream */ +#define VIDEO_TUNER_MBS_ON 512 /* Tuner is seeing an MBS datastream */ + __u16 mode; /* PAL/NTSC/SECAM/OTHER */ +#define VIDEO_MODE_PAL 0 +#define VIDEO_MODE_NTSC 1 +#define VIDEO_MODE_SECAM 2 +#define VIDEO_MODE_AUTO 3 + __u16 signal; /* Signal strength 16bit scale */ +}; + +struct video_picture +{ + __u16 brightness; + __u16 hue; + __u16 colour; + __u16 contrast; + __u16 whiteness; /* Black and white only */ + __u16 depth; /* Capture depth */ + __u16 palette; /* Palette in use */ +#define VIDEO_PALETTE_GREY 1 /* Linear greyscale */ +#define VIDEO_PALETTE_HI240 2 /* High 240 cube (BT848) */ +#define VIDEO_PALETTE_RGB565 3 /* 565 16 bit RGB */ +#define VIDEO_PALETTE_RGB24 4 /* 24bit RGB */ +#define VIDEO_PALETTE_RGB32 5 /* 32bit RGB */ +#define VIDEO_PALETTE_RGB555 6 /* 555 15bit RGB */ +#define VIDEO_PALETTE_YUV422 7 /* YUV422 capture */ +#define VIDEO_PALETTE_YUYV 8 +#define VIDEO_PALETTE_UYVY 9 /* The great thing about standards is ... */ +#define VIDEO_PALETTE_YUV420 10 +#define VIDEO_PALETTE_YUV411 11 /* YUV411 capture */ +#define VIDEO_PALETTE_RAW 12 /* RAW capture (BT848) */ +#define VIDEO_PALETTE_YUV422P 13 /* YUV 4:2:2 Planar */ +#define VIDEO_PALETTE_YUV411P 14 /* YUV 4:1:1 Planar */ +#define VIDEO_PALETTE_YUV420P 15 /* YUV 4:2:0 Planar */ +#define VIDEO_PALETTE_YUV410P 16 /* YUV 4:1:0 Planar */ +#define VIDEO_PALETTE_PLANAR 13 /* start of planar entries */ +#define VIDEO_PALETTE_COMPONENT 7 /* start of component entries */ +}; + +struct video_audio +{ + int audio; /* Audio channel */ + __u16 volume; /* If settable */ + __u16 bass, treble; + __u32 flags; +#define VIDEO_AUDIO_MUTE 1 +#define VIDEO_AUDIO_MUTABLE 2 +#define VIDEO_AUDIO_VOLUME 4 +#define VIDEO_AUDIO_BASS 8 +#define VIDEO_AUDIO_TREBLE 16 +#define VIDEO_AUDIO_BALANCE 32 + char name[16]; +#define VIDEO_SOUND_MONO 1 +#define VIDEO_SOUND_STEREO 2 +#define VIDEO_SOUND_LANG1 4 +#define VIDEO_SOUND_LANG2 8 + __u16 mode; + __u16 balance; /* Stereo balance */ + __u16 step; /* Step actual volume uses */ +}; + +struct video_clip +{ + __s32 x,y; + __s32 width, height; + struct video_clip *next; /* For user use/driver use only */ +}; + +struct video_window +{ + __u32 x,y; /* Position of window */ + __u32 width,height; /* Its size */ + __u32 chromakey; + __u32 flags; + struct video_clip __user *clips; /* Set only */ + int clipcount; +#define VIDEO_WINDOW_INTERLACE 1 +#define VIDEO_WINDOW_CHROMAKEY 16 /* Overlay by chromakey */ +#define VIDEO_CLIP_BITMAP -1 +/* bitmap is 1024x625, a '1' bit represents a clipped pixel */ +#define VIDEO_CLIPMAP_SIZE (128 * 625) +}; + +struct video_capture +{ + __u32 x,y; /* Offsets into image */ + __u32 width, height; /* Area to capture */ + __u16 decimation; /* Decimation divider */ + __u16 flags; /* Flags for capture */ +#define VIDEO_CAPTURE_ODD 0 /* Temporal */ +#define VIDEO_CAPTURE_EVEN 1 +}; + +struct video_buffer +{ + void *base; + int height,width; + int depth; + int bytesperline; +}; + +struct video_mmap +{ + unsigned int frame; /* Frame (0 - n) for double buffer */ + int height,width; + unsigned int format; /* should be VIDEO_PALETTE_* */ +}; + +struct video_key +{ + __u8 key[8]; + __u32 flags; +}; + +struct video_mbuf +{ + int size; /* Total memory to map */ + int frames; /* Frames */ + int offsets[VIDEO_MAX_FRAME]; +}; + +#define VIDEO_NO_UNIT (-1) + +struct video_unit +{ + int video; /* Video minor */ + int vbi; /* VBI minor */ + int radio; /* Radio minor */ + int audio; /* Audio minor */ + int teletext; /* Teletext minor */ +}; + +struct vbi_format { + __u32 sampling_rate; /* in Hz */ + __u32 samples_per_line; + __u32 sample_format; /* VIDEO_PALETTE_RAW only (1 byte) */ + __s32 start[2]; /* starting line for each frame */ + __u32 count[2]; /* count of lines for each frame */ + __u32 flags; +#define VBI_UNSYNC 1 /* can distingues between top/bottom field */ +#define VBI_INTERLACED 2 /* lines are interlaced */ +}; + +/* video_info is biased towards hardware mpeg encode/decode */ +/* but it could apply generically to any hardware compressor/decompressor */ +struct video_info +{ + __u32 frame_count; /* frames output since decode/encode began */ + __u32 h_size; /* current unscaled horizontal size */ + __u32 v_size; /* current unscaled veritcal size */ + __u32 smpte_timecode; /* current SMPTE timecode (for current GOP) */ + __u32 picture_type; /* current picture type */ + __u32 temporal_reference; /* current temporal reference */ + __u8 user_data[256]; /* user data last found in compressed stream */ + /* user_data[0] contains user data flags, user_data[1] has count */ +}; + +/* generic structure for setting playback modes */ +struct video_play_mode +{ + int mode; + int p1; + int p2; +}; + +/* for loading microcode / fpga programming */ +struct video_code +{ + char loadwhat[16]; /* name or tag of file being passed */ + int datasize; + __u8 *data; +}; + +#define VIDIOCGCAP _IOR('v',1,struct video_capability) /* Get capabilities */ +#define VIDIOCGCHAN _IOWR('v',2,struct video_channel) /* Get channel info (sources) */ +#define VIDIOCSCHAN _IOW('v',3,struct video_channel) /* Set channel */ +#define VIDIOCGTUNER _IOWR('v',4,struct video_tuner) /* Get tuner abilities */ +#define VIDIOCSTUNER _IOW('v',5,struct video_tuner) /* Tune the tuner for the current channel */ +#define VIDIOCGPICT _IOR('v',6,struct video_picture) /* Get picture properties */ +#define VIDIOCSPICT _IOW('v',7,struct video_picture) /* Set picture properties */ +#define VIDIOCCAPTURE _IOW('v',8,int) /* Start, end capture */ +#define VIDIOCGWIN _IOR('v',9, struct video_window) /* Get the video overlay window */ +#define VIDIOCSWIN _IOW('v',10, struct video_window) /* Set the video overlay window - passes clip list for hardware smarts , chromakey etc */ +#define VIDIOCGFBUF _IOR('v',11, struct video_buffer) /* Get frame buffer */ +#define VIDIOCSFBUF _IOW('v',12, struct video_buffer) /* Set frame buffer - root only */ +#define VIDIOCKEY _IOR('v',13, struct video_key) /* Video key event - to dev 255 is to all - cuts capture on all DMA windows with this key (0xFFFFFFFF == all) */ +#define VIDIOCGFREQ _IOR('v',14, unsigned long) /* Set tuner */ +#define VIDIOCSFREQ _IOW('v',15, unsigned long) /* Set tuner */ +#define VIDIOCGAUDIO _IOR('v',16, struct video_audio) /* Get audio info */ +#define VIDIOCSAUDIO _IOW('v',17, struct video_audio) /* Audio source, mute etc */ +#define VIDIOCSYNC _IOW('v',18, int) /* Sync with mmap grabbing */ +#define VIDIOCMCAPTURE _IOW('v',19, struct video_mmap) /* Grab frames */ +#define VIDIOCGMBUF _IOR('v',20, struct video_mbuf) /* Memory map buffer info */ +#define VIDIOCGUNIT _IOR('v',21, struct video_unit) /* Get attached units */ +#define VIDIOCGCAPTURE _IOR('v',22, struct video_capture) /* Get subcapture */ +#define VIDIOCSCAPTURE _IOW('v',23, struct video_capture) /* Set subcapture */ +#define VIDIOCSPLAYMODE _IOW('v',24, struct video_play_mode) /* Set output video mode/feature */ +#define VIDIOCSWRITEMODE _IOW('v',25, int) /* Set write mode */ +#define VIDIOCGPLAYINFO _IOR('v',26, struct video_info) /* Get current playback info from hardware */ +#define VIDIOCSMICROCODE _IOW('v',27, struct video_code) /* Load microcode into hardware */ +#define VIDIOCGVBIFMT _IOR('v',28, struct vbi_format) /* Get VBI information */ +#define VIDIOCSVBIFMT _IOW('v',29, struct vbi_format) /* Set VBI information */ + + +#define BASE_VIDIOCPRIVATE 192 /* 192-255 are private */ + +/* VIDIOCSWRITEMODE */ +#define VID_WRITE_MPEG_AUD 0 +#define VID_WRITE_MPEG_VID 1 +#define VID_WRITE_OSD 2 +#define VID_WRITE_TTX 3 +#define VID_WRITE_CC 4 +#define VID_WRITE_MJPEG 5 + +/* VIDIOCSPLAYMODE */ +#define VID_PLAY_VID_OUT_MODE 0 + /* p1: = VIDEO_MODE_PAL, VIDEO_MODE_NTSC, etc ... */ +#define VID_PLAY_GENLOCK 1 + /* p1: 0 = OFF, 1 = ON */ + /* p2: GENLOCK FINE DELAY value */ +#define VID_PLAY_NORMAL 2 +#define VID_PLAY_PAUSE 3 +#define VID_PLAY_SINGLE_FRAME 4 +#define VID_PLAY_FAST_FORWARD 5 +#define VID_PLAY_SLOW_MOTION 6 +#define VID_PLAY_IMMEDIATE_NORMAL 7 +#define VID_PLAY_SWITCH_CHANNELS 8 +#define VID_PLAY_FREEZE_FRAME 9 +#define VID_PLAY_STILL_MODE 10 +#define VID_PLAY_MASTER_MODE 11 + /* p1: see below */ +#define VID_PLAY_MASTER_NONE 1 +#define VID_PLAY_MASTER_VIDEO 2 +#define VID_PLAY_MASTER_AUDIO 3 +#define VID_PLAY_ACTIVE_SCANLINES 12 + /* p1 = first active; p2 = last active */ +#define VID_PLAY_RESET 13 +#define VID_PLAY_END_MARK 14 + + + +#define VID_HARDWARE_BT848 1 +#define VID_HARDWARE_QCAM_BW 2 +#define VID_HARDWARE_PMS 3 +#define VID_HARDWARE_QCAM_C 4 +#define VID_HARDWARE_PSEUDO 5 +#define VID_HARDWARE_SAA5249 6 +#define VID_HARDWARE_AZTECH 7 +#define VID_HARDWARE_SF16MI 8 +#define VID_HARDWARE_RTRACK 9 +#define VID_HARDWARE_ZOLTRIX 10 +#define VID_HARDWARE_SAA7146 11 +#define VID_HARDWARE_VIDEUM 12 /* Reserved for Winnov videum */ +#define VID_HARDWARE_RTRACK2 13 +#define VID_HARDWARE_PERMEDIA2 14 /* Reserved for Permedia2 */ +#define VID_HARDWARE_RIVA128 15 /* Reserved for RIVA 128 */ +#define VID_HARDWARE_PLANB 16 /* PowerMac motherboard video-in */ +#define VID_HARDWARE_BROADWAY 17 /* Broadway project */ +#define VID_HARDWARE_GEMTEK 18 +#define VID_HARDWARE_TYPHOON 19 +#define VID_HARDWARE_VINO 20 /* SGI Indy Vino */ +#define VID_HARDWARE_CADET 21 /* Cadet radio */ +#define VID_HARDWARE_TRUST 22 /* Trust FM Radio */ +#define VID_HARDWARE_TERRATEC 23 /* TerraTec ActiveRadio */ +#define VID_HARDWARE_CPIA 24 +#define VID_HARDWARE_ZR36120 25 /* Zoran ZR36120/ZR36125 */ +#define VID_HARDWARE_ZR36067 26 /* Zoran ZR36067/36060 */ +#define VID_HARDWARE_OV511 27 +#define VID_HARDWARE_ZR356700 28 /* Zoran 36700 series */ +#define VID_HARDWARE_W9966 29 +#define VID_HARDWARE_SE401 30 /* SE401 USB webcams */ +#define VID_HARDWARE_PWC 31 /* Philips webcams */ +#define VID_HARDWARE_MEYE 32 /* Sony Vaio MotionEye cameras */ +#define VID_HARDWARE_CPIA2 33 +#define VID_HARDWARE_VICAM 34 +#define VID_HARDWARE_SF16FMR2 35 +#define VID_HARDWARE_W9968CF 36 +#define VID_HARDWARE_SAA7114H 37 +#define VID_HARDWARE_SN9C102 38 +#define VID_HARDWARE_ARV 39 +#endif /* __LINUX_VIDEODEV_H */ + +/* + * Local variables: + * c-basic-offset: 8 + * End: + */ From owner-svn-src-head@FreeBSD.ORG Fri Dec 4 21:06:55 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5CF4C106566C; Fri, 4 Dec 2009 21:06:55 +0000 (UTC) (envelope-from netchild@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4AA898FC1A; Fri, 4 Dec 2009 21:06:55 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nB4L6tIH065546; Fri, 4 Dec 2009 21:06:55 GMT (envelope-from netchild@svn.freebsd.org) Received: (from netchild@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nB4L6tsr065541; Fri, 4 Dec 2009 21:06:55 GMT (envelope-from netchild@svn.freebsd.org) Message-Id: <200912042106.nB4L6tsr065541@svn.freebsd.org> From: Alexander Leidinger Date: Fri, 4 Dec 2009 21:06:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200110 - head/sys/compat/linux X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Dec 2009 21:06:55 -0000 Author: netchild Date: Fri Dec 4 21:06:54 2009 New Revision: 200110 URL: http://svn.freebsd.org/changeset/base/200110 Log: This is v4l support for the linuxulator. This allows to access FreeBSD native devices which support the v4l API from processes running within the linuxulator, e.g. skype or flash can access the multimedia/pwcbsd driver. Not tested is firmware upload, framebuffer stuff and video tuner stuff due to lack of hardware. The clipping part (VIDIOCSWIN) needs a little bit of further work (partly in progress, but can not be tested due to lack of a suitable device). The submitter tested this sucessfully with Skype and flash apps on amd64 and i386 with the multimedia/pwcbsd driver. Submitted by: J.R. Oldroyd Added: head/sys/compat/linux/linux_videodev_compat.h (contents, props changed) Modified: head/sys/compat/linux/linux_ioctl.c head/sys/compat/linux/linux_ioctl.h head/sys/compat/linux/linux_videodev.h (contents, props changed) Modified: head/sys/compat/linux/linux_ioctl.c ============================================================================== --- head/sys/compat/linux/linux_ioctl.c Fri Dec 4 20:46:45 2009 (r200109) +++ head/sys/compat/linux/linux_ioctl.c Fri Dec 4 21:06:54 2009 (r200110) @@ -78,6 +78,9 @@ __FBSDID("$FreeBSD$"); #include #include +#include +#include + CTASSERT(LINUX_IFNAMSIZ == IFNAMSIZ); static linux_ioctl_function_t linux_ioctl_cdrom; @@ -91,6 +94,7 @@ static linux_ioctl_function_t linux_ioct static linux_ioctl_function_t linux_ioctl_private; static linux_ioctl_function_t linux_ioctl_drm; static linux_ioctl_function_t linux_ioctl_sg; +static linux_ioctl_function_t linux_ioctl_v4l; static linux_ioctl_function_t linux_ioctl_special; static struct linux_ioctl_handler cdrom_handler = @@ -115,6 +119,8 @@ static struct linux_ioctl_handler drm_ha { linux_ioctl_drm, LINUX_IOCTL_DRM_MIN, LINUX_IOCTL_DRM_MAX }; static struct linux_ioctl_handler sg_handler = { linux_ioctl_sg, LINUX_IOCTL_SG_MIN, LINUX_IOCTL_SG_MAX }; +static struct linux_ioctl_handler video_handler = +{ linux_ioctl_v4l, LINUX_IOCTL_VIDEO_MIN, LINUX_IOCTL_VIDEO_MAX }; DATA_SET(linux_ioctl_handler_set, cdrom_handler); DATA_SET(linux_ioctl_handler_set, vfat_handler); @@ -127,6 +133,7 @@ DATA_SET(linux_ioctl_handler_set, termio DATA_SET(linux_ioctl_handler_set, private_handler); DATA_SET(linux_ioctl_handler_set, drm_handler); DATA_SET(linux_ioctl_handler_set, sg_handler); +DATA_SET(linux_ioctl_handler_set, video_handler); struct handler_element { @@ -2589,6 +2596,295 @@ linux_ioctl_sg(struct thread *td, struct } /* + * Video4Linux (V4L) ioctl handler + */ +static int +linux_to_bsd_v4l_tuner(struct l_video_tuner *lvt, struct video_tuner *vt) +{ + vt->tuner = lvt->tuner; + strlcpy(vt->name, lvt->name, LINUX_VIDEO_TUNER_NAME_SIZE); + vt->rangelow = lvt->rangelow; /* possible long size conversion */ + vt->rangehigh = lvt->rangehigh; /* possible long size conversion */ + vt->flags = lvt->flags; + vt->mode = lvt->mode; + vt->signal = lvt->signal; + return (0); +} + +static int +bsd_to_linux_v4l_tuner(struct video_tuner *vt, struct l_video_tuner *lvt) +{ + lvt->tuner = vt->tuner; + strlcpy(lvt->name, vt->name, LINUX_VIDEO_TUNER_NAME_SIZE); + lvt->rangelow = vt->rangelow; /* possible long size conversion */ + lvt->rangehigh = vt->rangehigh; /* possible long size conversion */ + lvt->flags = vt->flags; + lvt->mode = vt->mode; + lvt->signal = vt->signal; + return (0); +} + +#if 0 +static int +linux_to_bsd_v4l_clip(struct l_video_clip *lvc, struct video_clip *vc) +{ + vc->x = lvc->x; + vc->y = lvc->y; + vc->width = lvc->width; + vc->height = lvc->height; + vc->next = PTRIN(lvc->next); /* possible pointer size conversion */ + return (0); +} +#endif + +static int +linux_to_bsd_v4l_window(struct l_video_window *lvw, struct video_window *vw) +{ + vw->x = lvw->x; + vw->y = lvw->y; + vw->width = lvw->width; + vw->height = lvw->height; + vw->chromakey = lvw->chromakey; + vw->flags = lvw->flags; + vw->clips = PTRIN(lvw->clips); /* possible pointer size conversion */ + vw->clipcount = lvw->clipcount; + return (0); +} + +static int +bsd_to_linux_v4l_window(struct video_window *vw, struct l_video_window *lvw) +{ + lvw->x = vw->x; + lvw->y = vw->y; + lvw->width = vw->width; + lvw->height = vw->height; + lvw->chromakey = vw->chromakey; + lvw->flags = vw->flags; + lvw->clips = PTROUT(vw->clips); /* possible pointer size conversion */ + lvw->clipcount = vw->clipcount; + return (0); +} + +static int +linux_to_bsd_v4l_buffer(struct l_video_buffer *lvb, struct video_buffer *vb) +{ + vb->base = PTRIN(lvb->base); /* possible pointer size conversion */ + vb->height = lvb->height; + vb->width = lvb->width; + vb->depth = lvb->depth; + vb->bytesperline = lvb->bytesperline; + return (0); +} + +static int +bsd_to_linux_v4l_buffer(struct video_buffer *vb, struct l_video_buffer *lvb) +{ + lvb->base = PTROUT(vb->base); /* possible pointer size conversion */ + lvb->height = vb->height; + lvb->width = vb->width; + lvb->depth = vb->depth; + lvb->bytesperline = vb->bytesperline; + return (0); +} + +static int +linux_to_bsd_v4l_code(struct l_video_code *lvc, struct video_code *vc) +{ + strlcpy(vc->loadwhat, lvc->loadwhat, LINUX_VIDEO_CODE_LOADWHAT_SIZE); + vc->datasize = lvc->datasize; + vc->data = PTRIN(lvc->data); /* possible pointer size conversion */ + return (0); +} + +#if 0 +static int +linux_v4l_cliplist_copy(struct l_video_window *lvw, struct video_window *vw) +{ + struct video_clip vclip; + struct l_video_clip l_vclip; + struct video_clip **ppvc; + struct l_video_clip *plvc; + int error; + + ppvc = &(vw->clips); + for (plvc = (struct l_video_clip *) PTRIN(lvw->clips); + plvc != NULL; + plvc = (struct l_video_clip *) PTRIN(plvc->next)) { + error = copyin((void *) plvc, &l_vclip, sizeof(l_vclip)); + if (error) return (error); + linux_to_bsd_v4l_clip(&l_vclip, &vclip); + /* XXX: If there can be no concurrency: s/M_NOWAIT/M_WAITOK/ */ + if ((*ppvc = malloc(sizeof(**ppvc), M_LINUX, M_NOWAIT)) == NULL) + return (ENOMEM); /* XXX: linux has no ENOMEM here */ + memcpy(&vclip, *ppvc, sizeof(vclip)); + ppvc = &((*ppvc)->next); + } + return (0); +} + +static int +linux_v4l_cliplist_free(struct video_window *vw) +{ + struct video_clip **ppvc; + struct video_clip **ppvc_next; + + for (ppvc = &(vw->clips); *ppvc != NULL; ppvc = ppvc_next) { + ppvc_next = &((*ppvc)->next); + free(*ppvc, M_LINUX); + } + return (0); +} +#endif + +static int +linux_ioctl_v4l(struct thread *td, struct linux_ioctl_args *args) +{ + struct file *fp; + int error; + struct video_tuner vtun; + struct video_window vwin; + struct video_buffer vbuf; + struct video_code vcode; + struct l_video_tuner l_vtun; + struct l_video_window l_vwin; + struct l_video_buffer l_vbuf; + struct l_video_code l_vcode; + + switch (args->cmd & 0xffff) { + case LINUX_VIDIOCGCAP: args->cmd = VIDIOCGCAP; break; + case LINUX_VIDIOCGCHAN: args->cmd = VIDIOCGCHAN; break; + case LINUX_VIDIOCSCHAN: args->cmd = VIDIOCSCHAN; break; + + case LINUX_VIDIOCGTUNER: + if ((error = fget(td, args->fd, &fp)) != 0) + return (error); + error = fo_ioctl(fp, VIDIOCGTUNER, &vtun, td->td_ucred, td); + if (!error) { + bsd_to_linux_v4l_tuner(&vtun, &l_vtun); + error = copyout(&l_vtun, (void *) args->arg, + sizeof(l_vtun)); + } + fdrop(fp, td); + return (error); + + case LINUX_VIDIOCSTUNER: + if ((error = fget(td, args->fd, &fp)) != 0) + return (error); + error = copyin((void *) args->arg, &l_vtun, sizeof(l_vtun)); + if (error) { + fdrop(fp, td); + return (error); + } + linux_to_bsd_v4l_tuner(&l_vtun, &vtun); + error = fo_ioctl(fp, VIDIOCSMICROCODE, &vtun, td->td_ucred, td); + fdrop(fp, td); + return (error); + + case LINUX_VIDIOCGPICT: args->cmd = VIDIOCGPICT; break; + case LINUX_VIDIOCSPICT: args->cmd = VIDIOCSPICT; break; + case LINUX_VIDIOCCAPTURE: args->cmd = VIDIOCCAPTURE; break; + + case LINUX_VIDIOCGWIN: + if ((error = fget(td, args->fd, &fp)) != 0) + return (error); + error = fo_ioctl(fp, VIDIOCGWIN, &vwin, td->td_ucred, td); + if (!error) { + bsd_to_linux_v4l_window(&vwin, &l_vwin); + error = copyout(&l_vwin, (void *) args->arg, + sizeof(l_vwin)); + } + fdrop(fp, td); + return (error); + + case LINUX_VIDIOCSWIN: + if ((error = fget(td, args->fd, &fp)) != 0) + return (error); + error = copyin((void *) args->arg, &l_vwin, sizeof(l_vwin)); + if (error) { + fdrop(fp, td); + return (error); + } + linux_to_bsd_v4l_window(&l_vwin, &vwin); +#if 0 + /* + * XXX: some Linux apps call SWIN but do not store valid + * values in clipcount or in the clips pointer. Until + * we have someone calling to support this, the code + * to handle the list of video_clip structures is removed. + */ + error = linux_v4l_cliplist_copy(&l_vwin, &vwin); +#endif + if (!error) + error = fo_ioctl(fp, VIDIOCSWIN, &vwin, td->td_ucred, td); + fdrop(fp, td); +#if 0 + linux_v4l_cliplist_free(&vwin); +#endif + return (error); + + case LINUX_VIDIOCGFBUF: + if ((error = fget(td, args->fd, &fp)) != 0) + return (error); + error = fo_ioctl(fp, VIDIOCGFBUF, &vbuf, td->td_ucred, td); + if (!error) { + bsd_to_linux_v4l_buffer(&vbuf, &l_vbuf); + error = copyout(&l_vbuf, (void *) args->arg, + sizeof(l_vbuf)); + } + fdrop(fp, td); + return (error); + + case LINUX_VIDIOCSFBUF: + if ((error = fget(td, args->fd, &fp)) != 0) + return (error); + error = copyin((void *) args->arg, &l_vbuf, sizeof(l_vbuf)); + if (error) { + fdrop(fp, td); + return (error); + } + linux_to_bsd_v4l_buffer(&l_vbuf, &vbuf); + error = fo_ioctl(fp, VIDIOCSFBUF, &vbuf, td->td_ucred, td); + fdrop(fp, td); + return (error); + + case LINUX_VIDIOCKEY: args->cmd = VIDIOCKEY; break; + case LINUX_VIDIOCGFREQ: args->cmd = VIDIOCGFREQ; break; + case LINUX_VIDIOCSFREQ: args->cmd = VIDIOCSFREQ; break; + case LINUX_VIDIOCGAUDIO: args->cmd = VIDIOCGAUDIO; break; + case LINUX_VIDIOCSAUDIO: args->cmd = VIDIOCSAUDIO; break; + case LINUX_VIDIOCSYNC: args->cmd = VIDIOCSYNC; break; + case LINUX_VIDIOCMCAPTURE: args->cmd = VIDIOCMCAPTURE; break; + case LINUX_VIDIOCGMBUF: args->cmd = VIDIOCGMBUF; break; + case LINUX_VIDIOCGUNIT: args->cmd = VIDIOCGUNIT; break; + case LINUX_VIDIOCGCAPTURE: args->cmd = VIDIOCGCAPTURE; break; + case LINUX_VIDIOCSCAPTURE: args->cmd = VIDIOCSCAPTURE; break; + case LINUX_VIDIOCSPLAYMODE: args->cmd = VIDIOCSPLAYMODE; break; + case LINUX_VIDIOCSWRITEMODE: args->cmd = VIDIOCSWRITEMODE; break; + case LINUX_VIDIOCGPLAYINFO: args->cmd = VIDIOCGPLAYINFO; break; + + case LINUX_VIDIOCSMICROCODE: + if ((error = fget(td, args->fd, &fp)) != 0) + return (error); + error = copyin((void *) args->arg, &l_vcode, sizeof(l_vcode)); + if (error) { + fdrop(fp, td); + return (error); + } + linux_to_bsd_v4l_code(&l_vcode, &vcode); + error = fo_ioctl(fp, VIDIOCSTUNER, &vcode, td->td_ucred, td); + fdrop(fp, td); + return (error); + + case LINUX_VIDIOCGVBIFMT: args->cmd = VIDIOCGVBIFMT; break; + case LINUX_VIDIOCSVBIFMT: args->cmd = VIDIOCSVBIFMT; break; + default: return (ENOIOCTL); + } + + error = ioctl(td, (struct ioctl_args *)args); + return (error); +} + +/* * Special ioctl handler */ static int Modified: head/sys/compat/linux/linux_ioctl.h ============================================================================== --- head/sys/compat/linux/linux_ioctl.h Fri Dec 4 20:46:45 2009 (r200109) +++ head/sys/compat/linux/linux_ioctl.h Fri Dec 4 21:06:54 2009 (r200110) @@ -575,4 +575,40 @@ struct ifnet; int linux_ifname(struct ifnet *, char *, size_t); +/* + * video + */ +#define LINUX_VIDIOCGCAP 0x7601 +#define LINUX_VIDIOCGCHAN 0x7602 +#define LINUX_VIDIOCSCHAN 0x7603 +#define LINUX_VIDIOCGTUNER 0x7604 +#define LINUX_VIDIOCSTUNER 0x7605 +#define LINUX_VIDIOCGPICT 0x7606 +#define LINUX_VIDIOCSPICT 0x7607 +#define LINUX_VIDIOCCAPTURE 0x7608 +#define LINUX_VIDIOCGWIN 0x7609 +#define LINUX_VIDIOCSWIN 0x760a +#define LINUX_VIDIOCGFBUF 0x760b +#define LINUX_VIDIOCSFBUF 0x760c +#define LINUX_VIDIOCKEY 0x760d +#define LINUX_VIDIOCGFREQ 0x760e +#define LINUX_VIDIOCSFREQ 0x760f +#define LINUX_VIDIOCGAUDIO 0x7610 +#define LINUX_VIDIOCSAUDIO 0x7611 +#define LINUX_VIDIOCSYNC 0x7623 +#define LINUX_VIDIOCMCAPTURE 0x7613 +#define LINUX_VIDIOCGMBUF 0x7614 +#define LINUX_VIDIOCGUNIT 0x7615 +#define LINUX_VIDIOCGCAPTURE 0x7616 +#define LINUX_VIDIOCSCAPTURE 0x7617 +#define LINUX_VIDIOCSPLAYMODE 0x7618 +#define LINUX_VIDIOCSWRITEMODE 0x7619 +#define LINUX_VIDIOCGPLAYINFO 0x761a +#define LINUX_VIDIOCSMICROCODE 0x761b +#define LINUX_VIDIOCGVBIFMT 0x761c +#define LINUX_VIDIOCSVBIFMT 0x761d + +#define LINUX_IOCTL_VIDEO_MIN LINUX_VIDIOCGCAP +#define LINUX_IOCTL_VIDEO_MAX LINUX_VIDIOCSVBIFMT + #endif /* !_LINUX_IOCTL_H_ */ Modified: head/sys/compat/linux/linux_videodev.h ============================================================================== --- head/sys/compat/linux/linux_videodev.h Fri Dec 4 20:46:45 2009 (r200109) +++ head/sys/compat/linux/linux_videodev.h Fri Dec 4 21:06:54 2009 (r200110) @@ -1,48 +1,41 @@ +/* + * This header comes from linux, but it has no license. The author + * (Alan Cox @ Redhat) gave explicit permissions to use it in FreeBSD. + * The freeBSD vendor branch for v4l gives a more detailed description + * about this. + * + * $FreeBSD$ + */ + #ifndef __LINUX_VIDEODEV_H #define __LINUX_VIDEODEV_H -#include +#include +typedef int32_t __s32; +typedef uint32_t __u32; +typedef uint16_t __u16; +typedef uint8_t __u8; +#if 0 #define HAVE_V4L1 1 #include +#endif -#ifdef __KERNEL__ - -#include - -extern struct video_device* video_devdata(struct file*); - -#define to_video_device(cd) container_of(cd, struct video_device, class_dev) -static inline void -video_device_create_file(struct video_device *vfd, - struct class_device_attribute *attr) -{ - class_device_create_file(&vfd->class_dev, attr); -} -static inline void -video_device_remove_file(struct video_device *vfd, - struct class_device_attribute *attr) -{ - class_device_remove_file(&vfd->class_dev, attr); -} - -#if OBSOLETE_OWNER /* to be removed in 2.6.15 */ -/* helper functions to access driver private data. */ -static inline void *video_get_drvdata(struct video_device *dev) -{ - return dev->priv; -} - -static inline void video_set_drvdata(struct video_device *dev, void *data) -{ - dev->priv = data; -} -#endif - -extern int video_exclusive_open(struct inode *inode, struct file *file); -extern int video_exclusive_release(struct inode *inode, struct file *file); -#endif /* __KERNEL__ */ +#define VID_TYPE_CAPTURE 1 /* Can capture */ +#define VID_TYPE_TUNER 2 /* Can tune */ +#define VID_TYPE_TELETEXT 4 /* Does teletext */ +#define VID_TYPE_OVERLAY 8 /* Overlay onto frame buffer */ +#define VID_TYPE_CHROMAKEY 16 /* Overlay by chromakey */ +#define VID_TYPE_CLIPPING 32 /* Can clip */ +#define VID_TYPE_FRAMERAM 64 /* Uses the frame buffer memory */ +#define VID_TYPE_SCALES 128 /* Scalable */ +#define VID_TYPE_MONOCHROME 256 /* Monochrome only */ +#define VID_TYPE_SUBCAPTURE 512 /* Can capture subareas of the image */ +#define VID_TYPE_MPEG_DECODER 1024 /* Can decode MPEG streams */ +#define VID_TYPE_MPEG_ENCODER 2048 /* Can encode MPEG streams */ +#define VID_TYPE_MJPEG_DECODER 4096 /* Can decode MJPEG streams */ +#define VID_TYPE_MJPEG_ENCODER 8192 /* Can encode MJPEG streams */ struct video_capability { @@ -157,7 +150,7 @@ struct video_window __u32 width,height; /* Its size */ __u32 chromakey; __u32 flags; - struct video_clip __user *clips; /* Set only */ + struct video_clip *clips; /* Set only */ int clipcount; #define VIDEO_WINDOW_INTERLACE 1 #define VIDEO_WINDOW_CHROMAKEY 16 /* Overlay by chromakey */ @@ -197,6 +190,8 @@ struct video_key __u32 flags; }; +#define VIDEO_MAX_FRAME 32 + struct video_mbuf { int size; /* Total memory to map */ Added: head/sys/compat/linux/linux_videodev_compat.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/compat/linux/linux_videodev_compat.h Fri Dec 4 21:06:54 2009 (r200110) @@ -0,0 +1,59 @@ +/* + * $FreeBSD$ + */ + +/* + * This file defines compatibility versions of several video structures + * defined in the Linux videodev.h header (linux_videodev.h). The + * structures defined in this file are the ones that have been determined + * to have 32- to 64-bit size dependencies. + */ + +#ifndef _LINUX_VIDEODEV_COMPAT_H_ +#define _LINUX_VIDEODEV_COMPAT_H_ + +struct l_video_tuner +{ + l_int tuner; +#define LINUX_VIDEO_TUNER_NAME_SIZE 32 + char name[LINUX_VIDEO_TUNER_NAME_SIZE]; + l_ulong rangelow, rangehigh; + uint32_t flags; + uint16_t mode; + uint16_t signal; +}; + +struct l_video_clip +{ + int32_t x, y; + int32_t width, height; + l_uintptr_t next; +}; + +struct l_video_window +{ + uint32_t x, y; + uint32_t width, height; + uint32_t chromakey; + uint32_t flags; + l_uintptr_t clips; + l_int clipcount; +}; + +struct l_video_buffer +{ + l_uintptr_t base; + l_int height, width; + l_int depth; + l_int bytesperline; +}; + +struct l_video_code +{ +#define LINUX_VIDEO_CODE_LOADWHAT_SIZE 16 + char loadwhat[LINUX_VIDEO_CODE_LOADWHAT_SIZE]; + l_int datasize; + l_uintptr_t data; +}; + +#endif /* !_LINUX_VIDEODEV_COMPAT_H_ */ From owner-svn-src-head@FreeBSD.ORG Fri Dec 4 21:52:31 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D7F59106566B; Fri, 4 Dec 2009 21:52:31 +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 C73108FC18; Fri, 4 Dec 2009 21:52:31 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nB4LqVkW066486; Fri, 4 Dec 2009 21:52:31 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nB4LqVGp066484; Fri, 4 Dec 2009 21:52:31 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <200912042152.nB4LqVGp066484@svn.freebsd.org> From: Konstantin Belousov Date: Fri, 4 Dec 2009 21:52:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200111 - head/sys/compat/freebsd32 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Dec 2009 21:52:31 -0000 Author: kib Date: Fri Dec 4 21:52:31 2009 New Revision: 200111 URL: http://svn.freebsd.org/changeset/base/200111 Log: Add several syscall compat32 entries for acl manipulation. They do not require translation of the arguments. Tested by: bsam MFC after: 1 week Modified: head/sys/compat/freebsd32/syscalls.master Modified: head/sys/compat/freebsd32/syscalls.master ============================================================================== --- head/sys/compat/freebsd32/syscalls.master Fri Dec 4 21:06:54 2009 (r200110) +++ head/sys/compat/freebsd32/syscalls.master Fri Dec 4 21:52:31 2009 (r200111) @@ -740,10 +740,14 @@ struct freebsd32_ucontext *oucp, \ const struct freebsd32_ucontext *ucp); } 424 AUE_SWAPOFF UNIMPL swapoff -425 AUE_NULL UNIMPL __acl_get_link -426 AUE_NULL UNIMPL __acl_set_link -427 AUE_NULL UNIMPL __acl_delete_link -428 AUE_NULL UNIMPL __acl_aclcheck_link +425 AUE_NULL NOPROTO { int __acl_get_link(const char *path, \ + acl_type_t type, struct acl *aclp); } +426 AUE_NULL NOPROTO { int __acl_set_link(const char *path, \ + acl_type_t type, struct acl *aclp); } +427 AUE_NULL NOPROTO { int __acl_delete_link(const char *path, \ + acl_type_t type); } +428 AUE_NULL NOPROTO { int __acl_aclcheck_link(const char *path, \ + acl_type_t type, struct acl *aclp); } 429 AUE_SIGWAIT NOPROTO { int sigwait(const sigset_t *set, \ int *sig); } 430 AUE_NULL UNIMPL thr_create; From owner-svn-src-head@FreeBSD.ORG Fri Dec 4 21:53:21 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 20C151065694; Fri, 4 Dec 2009 21:53:21 +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 0F65A8FC1B; Fri, 4 Dec 2009 21:53:21 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nB4LrKGr066542; Fri, 4 Dec 2009 21:53:20 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nB4LrKPs066537; Fri, 4 Dec 2009 21:53:20 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <200912042153.nB4LrKPs066537@svn.freebsd.org> From: Konstantin Belousov Date: Fri, 4 Dec 2009 21:53:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200112 - head/sys/compat/freebsd32 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Dec 2009 21:53:21 -0000 Author: kib Date: Fri Dec 4 21:53:20 2009 New Revision: 200112 URL: http://svn.freebsd.org/changeset/base/200112 Log: Regenerate. Modified: head/sys/compat/freebsd32/freebsd32_proto.h head/sys/compat/freebsd32/freebsd32_syscall.h head/sys/compat/freebsd32/freebsd32_syscalls.c head/sys/compat/freebsd32/freebsd32_sysent.c Modified: head/sys/compat/freebsd32/freebsd32_proto.h ============================================================================== --- head/sys/compat/freebsd32/freebsd32_proto.h Fri Dec 4 21:52:31 2009 (r200111) +++ head/sys/compat/freebsd32/freebsd32_proto.h Fri Dec 4 21:53:20 2009 (r200112) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 198508 2009-10-27 10:55:34Z kib + * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 200111 2009-12-04 21:52:31Z kib */ #ifndef _FREEBSD32_SYSPROTO_H_ Modified: head/sys/compat/freebsd32/freebsd32_syscall.h ============================================================================== --- head/sys/compat/freebsd32/freebsd32_syscall.h Fri Dec 4 21:52:31 2009 (r200111) +++ head/sys/compat/freebsd32/freebsd32_syscall.h Fri Dec 4 21:53:20 2009 (r200112) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 198508 2009-10-27 10:55:34Z kib + * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 200111 2009-12-04 21:52:31Z kib */ #define FREEBSD32_SYS_syscall 0 @@ -311,6 +311,10 @@ #define FREEBSD32_SYS_freebsd32_getcontext 421 #define FREEBSD32_SYS_freebsd32_setcontext 422 #define FREEBSD32_SYS_freebsd32_swapcontext 423 +#define FREEBSD32_SYS___acl_get_link 425 +#define FREEBSD32_SYS___acl_set_link 426 +#define FREEBSD32_SYS___acl_delete_link 427 +#define FREEBSD32_SYS___acl_aclcheck_link 428 #define FREEBSD32_SYS_sigwait 429 #define FREEBSD32_SYS_thr_exit 431 #define FREEBSD32_SYS_thr_self 432 Modified: head/sys/compat/freebsd32/freebsd32_syscalls.c ============================================================================== --- head/sys/compat/freebsd32/freebsd32_syscalls.c Fri Dec 4 21:52:31 2009 (r200111) +++ head/sys/compat/freebsd32/freebsd32_syscalls.c Fri Dec 4 21:53:20 2009 (r200112) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 198508 2009-10-27 10:55:34Z kib + * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 200111 2009-12-04 21:52:31Z kib */ const char *freebsd32_syscallnames[] = { @@ -432,10 +432,10 @@ const char *freebsd32_syscallnames[] = { "freebsd32_setcontext", /* 422 = freebsd32_setcontext */ "freebsd32_swapcontext", /* 423 = freebsd32_swapcontext */ "#424", /* 424 = swapoff */ - "#425", /* 425 = __acl_get_link */ - "#426", /* 426 = __acl_set_link */ - "#427", /* 427 = __acl_delete_link */ - "#428", /* 428 = __acl_aclcheck_link */ + "__acl_get_link", /* 425 = __acl_get_link */ + "__acl_set_link", /* 426 = __acl_set_link */ + "__acl_delete_link", /* 427 = __acl_delete_link */ + "__acl_aclcheck_link", /* 428 = __acl_aclcheck_link */ "sigwait", /* 429 = sigwait */ "#430", /* 430 = thr_create; */ "thr_exit", /* 431 = thr_exit */ Modified: head/sys/compat/freebsd32/freebsd32_sysent.c ============================================================================== --- head/sys/compat/freebsd32/freebsd32_sysent.c Fri Dec 4 21:52:31 2009 (r200111) +++ head/sys/compat/freebsd32/freebsd32_sysent.c Fri Dec 4 21:53:20 2009 (r200112) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 198508 2009-10-27 10:55:34Z kib + * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 200111 2009-12-04 21:52:31Z kib */ #include "opt_compat.h" @@ -469,10 +469,10 @@ struct sysent freebsd32_sysent[] = { { AS(freebsd32_setcontext_args), (sy_call_t *)freebsd32_setcontext, AUE_NULL, NULL, 0, 0, 0 }, /* 422 = freebsd32_setcontext */ { AS(freebsd32_swapcontext_args), (sy_call_t *)freebsd32_swapcontext, AUE_NULL, NULL, 0, 0, 0 }, /* 423 = freebsd32_swapcontext */ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0 }, /* 424 = swapoff */ - { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0 }, /* 425 = __acl_get_link */ - { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0 }, /* 426 = __acl_set_link */ - { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0 }, /* 427 = __acl_delete_link */ - { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0 }, /* 428 = __acl_aclcheck_link */ + { AS(__acl_get_link_args), (sy_call_t *)__acl_get_link, AUE_NULL, NULL, 0, 0, 0 }, /* 425 = __acl_get_link */ + { AS(__acl_set_link_args), (sy_call_t *)__acl_set_link, AUE_NULL, NULL, 0, 0, 0 }, /* 426 = __acl_set_link */ + { AS(__acl_delete_link_args), (sy_call_t *)__acl_delete_link, AUE_NULL, NULL, 0, 0, 0 }, /* 427 = __acl_delete_link */ + { AS(__acl_aclcheck_link_args), (sy_call_t *)__acl_aclcheck_link, AUE_NULL, NULL, 0, 0, 0 }, /* 428 = __acl_aclcheck_link */ { AS(sigwait_args), (sy_call_t *)sigwait, AUE_SIGWAIT, NULL, 0, 0, 0 }, /* 429 = sigwait */ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0 }, /* 430 = thr_create; */ { AS(thr_exit_args), (sy_call_t *)thr_exit, AUE_NULL, NULL, 0, 0, 0 }, /* 431 = thr_exit */ From owner-svn-src-head@FreeBSD.ORG Sat Dec 5 08:32:13 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2D8671065670; Sat, 5 Dec 2009 08:32:13 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1CB2D8FC0C; Sat, 5 Dec 2009 08:32:13 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nB58WCkS078842; Sat, 5 Dec 2009 08:32:12 GMT (envelope-from luigi@svn.freebsd.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nB58WCuI078841; Sat, 5 Dec 2009 08:32:12 GMT (envelope-from luigi@svn.freebsd.org) Message-Id: <200912050832.nB58WCuI078841@svn.freebsd.org> From: Luigi Rizzo Date: Sat, 5 Dec 2009 08:32:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200113 - head/sys/netinet/ipfw X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Dec 2009 08:32:13 -0000 Author: luigi Date: Sat Dec 5 08:32:12 2009 New Revision: 200113 URL: http://svn.freebsd.org/changeset/base/200113 Log: fix build with VNET enabled Reported by: David Wolfskill Modified: head/sys/netinet/ipfw/ip_fw2.c Modified: head/sys/netinet/ipfw/ip_fw2.c ============================================================================== --- head/sys/netinet/ipfw/ip_fw2.c Fri Dec 4 21:53:20 2009 (r200112) +++ head/sys/netinet/ipfw/ip_fw2.c Sat Dec 5 08:32:12 2009 (r200113) @@ -2597,7 +2597,7 @@ do { \ * XXX should not happen here, but optimized out in * the caller. */ - if (fw_one_pass) { + if (V_fw_one_pass) { IPFW_RUNLOCK(chain); return (IP_FW_PASS); } From owner-svn-src-head@FreeBSD.ORG Sat Dec 5 09:13:07 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 448E71065693; Sat, 5 Dec 2009 09:13:07 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3358C8FC20; Sat, 5 Dec 2009 09:13:07 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nB59D6HE079883; Sat, 5 Dec 2009 09:13:06 GMT (envelope-from luigi@svn.freebsd.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nB59D6eH079881; Sat, 5 Dec 2009 09:13:06 GMT (envelope-from luigi@svn.freebsd.org) Message-Id: <200912050913.nB59D6eH079881@svn.freebsd.org> From: Luigi Rizzo Date: Sat, 5 Dec 2009 09:13:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200116 - head/sys/netinet/ipfw X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Dec 2009 09:13:07 -0000 Author: luigi Date: Sat Dec 5 09:13:06 2009 New Revision: 200116 URL: http://svn.freebsd.org/changeset/base/200116 Log: remove a dead block of code, document how the ipfw clients are hooked and the difference in handling the 'enable' variable for layer2 and layer3. The latter needs fixing once i figure out how it worked pre-vnet. MFC after: 7 days Modified: head/sys/netinet/ipfw/ip_fw2.c Modified: head/sys/netinet/ipfw/ip_fw2.c ============================================================================== --- head/sys/netinet/ipfw/ip_fw2.c Sat Dec 5 08:44:55 2009 (r200115) +++ head/sys/netinet/ipfw/ip_fw2.c Sat Dec 5 09:13:06 2009 (r200116) @@ -4915,43 +4915,38 @@ vnet_ipfw_init(const void *unused) ip_fw_default_rule = V_layer3_chain.rules; - if (error) { - IPFW_LOCK_DESTROY(&V_layer3_chain); - printf("leaving ipfw_iattach (2) with error %d\n", error); - return (error); - } -#ifdef VIMAGE /* want a better way to do this */ + /* curvnet is NULL in the !VIMAGE case */ callout_reset(&V_ipfw_timeout, hz, ipfw_tick, curvnet); -#else - callout_reset(&V_ipfw_timeout, hz, ipfw_tick, NULL); -#endif /* First set up some values that are compile time options */ V_ipfw_vnet_ready = 1; /* Open for business */ - /* Hook up the raw inputs */ - V_ip_fw_ctl_ptr = ipfw_ctl; - V_ip_fw_chk_ptr = ipfw_chk; - /* - * Hook us up to pfil. + * Hook the sockopt handler, and the layer2 (V_ip_fw_chk_ptr) + * and pfil hooks for ipv4 and ipv6. Even if the latter two fail + * we still keep the module alive. ipfw[6]_hook return + * either 0 or ENOENT in case of failure, so we can ignore the + * exact return value and just set a flag. + * + * XXX 20091204 note that V_ether_ipfw is checked on each packet, + * whereas V_fw_enable is only checked at vnet load time. + * This must be fixed so that they act in the same way + * (probably hooking the pfil unconditionally, and bypassing + * the processing if V_fw_enable=0). Same for V_fw6_enable */ - if (V_fw_enable) { - if ((error = ipfw_hook()) != 0) { - printf("ipfw_hook() error\n"); - return (error); - } + V_ip_fw_ctl_ptr = ipfw_ctl; + V_ip_fw_chk_ptr = ipfw_chk; + if (V_fw_enable && ipfw_hook() != 0) { + error = ENOENT; /* see ip_fw_pfil.c::ipfw_hook() */ + printf("ipfw_hook() error\n"); } #ifdef INET6 - if (V_fw6_enable) { - if ((error = ipfw6_hook()) != 0) { - printf("ipfw6_hook() error\n"); - /* XXX should we unhook everything else? */ - return (error); - } + if (V_fw6_enable && ipfw6_hook() != 0) { + error = ENOENT; + printf("ipfw6_hook() error\n"); } #endif - return (0); + return (error); } /*********************** @@ -4963,17 +4958,23 @@ vnet_ipfw_uninit(const void *unused) struct ip_fw *reap; V_ipfw_vnet_ready = 0; /* tell new callers to go away */ + /* + * disconnect from ipv4, ipv6, layer2 and sockopt. + * Then grab, release and grab again the WLOCK so we make + * sure the update is propagated and nobody will be in. + */ ipfw_unhook(); #ifdef INET6 ipfw6_unhook(); #endif - /* layer2 and other entrypoints still come in this way. */ V_ip_fw_chk_ptr = NULL; V_ip_fw_ctl_ptr = NULL; + IPFW_WLOCK(&V_layer3_chain); /* We wait on the wlock here until the last user leaves */ IPFW_WUNLOCK(&V_layer3_chain); IPFW_WLOCK(&V_layer3_chain); + callout_drain(&V_ipfw_timeout); flush_tables(&V_layer3_chain); V_layer3_chain.reap = NULL; From owner-svn-src-head@FreeBSD.ORG Sat Dec 5 09:35:49 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3365F1065670; Sat, 5 Dec 2009 09:35:49 +0000 (UTC) (envelope-from simon@nitro.dk) Received: from mx.nitro.dk (unknown [77.75.165.90]) by mx1.freebsd.org (Postfix) with ESMTP id E971B8FC15; Sat, 5 Dec 2009 09:35:48 +0000 (UTC) Received: from frankie.nitro.dk (unknown [192.168.3.39]) by mx.nitro.dk (Postfix) with ESMTP id EA6622D4892; Sat, 5 Dec 2009 09:35:47 +0000 (UTC) Received: by frankie.nitro.dk (Postfix, from userid 2000) id E001EE0459; Sat, 5 Dec 2009 10:35:47 +0100 (CET) Date: Sat, 5 Dec 2009 10:35:47 +0100 From: "Simon L. Nielsen" To: Hajimu UMEMOTO Message-ID: <20091205093546.GA1311@frankie.nitro.dk> References: <200912021505.nB2F5RIt018936@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200912021505.nB2F5RIt018936@svn.freebsd.org> User-Agent: Mutt/1.5.20 (2009-06-14) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r200028 - in head: . etc etc/defaults etc/rc.d X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Dec 2009 09:35:49 -0000 On 2009.12.02 15:05:27 +0000, Hajimu UMEMOTO wrote: > Author: ume > Date: Wed Dec 2 15:05:26 2009 > New Revision: 200028 > URL: http://svn.freebsd.org/changeset/base/200028 > > Log: > Unify rc.firewall and rc.firewall6, and obsolete rc.firewall6 > and rc.d/ip6fw. Great, thanks! I recently set up IPv6 on a workstation and was bitten by rc.firewall and rc.firewall6 getting in each-others way. -- Simon L. Nielsen From owner-svn-src-head@FreeBSD.ORG Sat Dec 5 10:30:54 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A6538106566B; Sat, 5 Dec 2009 10:30:54 +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 9552F8FC15; Sat, 5 Dec 2009 10:30:54 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nB5AUs93082595; Sat, 5 Dec 2009 10:30:54 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nB5AUsfR082593; Sat, 5 Dec 2009 10:30:54 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <200912051030.nB5AUsfR082593@svn.freebsd.org> From: Alexander Motin Date: Sat, 5 Dec 2009 10:30:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200117 - head/sys/dev/ata/chipsets X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Dec 2009 10:30:54 -0000 Author: mav Date: Sat Dec 5 10:30:54 2009 New Revision: 200117 URL: http://svn.freebsd.org/changeset/base/200117 Log: On Soft Reset, read device signature from FIS receive area, instead of PxSIG register. It works better for NVidia chipsets. ahci(4) does the same. PR: kern/140472, i386/138668 Modified: head/sys/dev/ata/chipsets/ata-ahci.c Modified: head/sys/dev/ata/chipsets/ata-ahci.c ============================================================================== --- head/sys/dev/ata/chipsets/ata-ahci.c Sat Dec 5 09:13:06 2009 (r200116) +++ head/sys/dev/ata/chipsets/ata-ahci.c Sat Dec 5 10:30:54 2009 (r200117) @@ -824,11 +824,10 @@ ata_ahci_hardreset(device_t dev, int por static u_int32_t ata_ahci_softreset(device_t dev, int port) { - struct ata_pci_controller *ctlr = device_get_softc(device_get_parent(dev)); struct ata_channel *ch = device_get_softc(dev); - int offset = ch->unit << 7; struct ata_ahci_cmd_tab *ctp = (struct ata_ahci_cmd_tab *)(ch->dma.work + ATA_AHCI_CT_OFFSET); + u_int8_t *fis = ch->dma.work + ATA_AHCI_FB_OFFSET + 0x40; if (bootverbose) device_printf(dev, "software reset port %d...\n", port); @@ -865,7 +864,10 @@ ata_ahci_softreset(device_t dev, int por return (-1); } - return ATA_INL(ctlr->r_res2, ATA_AHCI_P_SIG + offset); + return (((u_int32_t)fis[6] << 24) | + ((u_int32_t)fis[5] << 16) | + ((u_int32_t)fis[4] << 8) | + (u_int32_t)fis[12]); } static void From owner-svn-src-head@FreeBSD.ORG Sat Dec 5 11:51:33 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EE754106566C; Sat, 5 Dec 2009 11:51:32 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DD9038FC14; Sat, 5 Dec 2009 11:51:32 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nB5BpWXG086592; Sat, 5 Dec 2009 11:51:32 GMT (envelope-from luigi@svn.freebsd.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nB5BpWvN086590; Sat, 5 Dec 2009 11:51:32 GMT (envelope-from luigi@svn.freebsd.org) Message-Id: <200912051151.nB5BpWvN086590@svn.freebsd.org> From: Luigi Rizzo Date: Sat, 5 Dec 2009 11:51:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200118 - head/sys/netinet/ipfw X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Dec 2009 11:51:33 -0000 Author: luigi Date: Sat Dec 5 11:51:32 2009 New Revision: 200118 URL: http://svn.freebsd.org/changeset/base/200118 Log: adjust comment in previous commit after Julian's explanation Modified: head/sys/netinet/ipfw/ip_fw2.c Modified: head/sys/netinet/ipfw/ip_fw2.c ============================================================================== --- head/sys/netinet/ipfw/ip_fw2.c Sat Dec 5 10:30:54 2009 (r200117) +++ head/sys/netinet/ipfw/ip_fw2.c Sat Dec 5 11:51:32 2009 (r200118) @@ -4924,15 +4924,16 @@ vnet_ipfw_init(const void *unused) /* * Hook the sockopt handler, and the layer2 (V_ip_fw_chk_ptr) * and pfil hooks for ipv4 and ipv6. Even if the latter two fail - * we still keep the module alive. ipfw[6]_hook return - * either 0 or ENOENT in case of failure, so we can ignore the - * exact return value and just set a flag. + * we still keep the module alive because the sockopt and + * layer2 paths are still useful. + * ipfw[6]_hook return 0 on success, ENOENT on failure, + * so we can ignore the exact return value and just set a flag. * - * XXX 20091204 note that V_ether_ipfw is checked on each packet, - * whereas V_fw_enable is only checked at vnet load time. - * This must be fixed so that they act in the same way - * (probably hooking the pfil unconditionally, and bypassing - * the processing if V_fw_enable=0). Same for V_fw6_enable + * Note that V_fw[6]_enable are manipulated by a SYSCTL_PROC so + * changes in the underlying (per-vnet) variables trigger + * immediate hook()/unhook() calls. + * In layer2 we have the same behaviour, except that V_ether_ipfw + * is checked on each packet because there are no pfil hooks. */ V_ip_fw_ctl_ptr = ipfw_ctl; V_ip_fw_chk_ptr = ipfw_chk; From owner-svn-src-head@FreeBSD.ORG Sat Dec 5 13:12:04 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C37ED106566C; Sat, 5 Dec 2009 13:12:04 +0000 (UTC) (envelope-from stefanf@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B2A1A8FC08; Sat, 5 Dec 2009 13:12:04 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nB5DC4KT088535; Sat, 5 Dec 2009 13:12:04 GMT (envelope-from stefanf@svn.freebsd.org) Received: (from stefanf@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nB5DC4kQ088533; Sat, 5 Dec 2009 13:12:04 GMT (envelope-from stefanf@svn.freebsd.org) Message-Id: <200912051312.nB5DC4kQ088533@svn.freebsd.org> From: Stefan Farfeleder Date: Sat, 5 Dec 2009 13:12:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200120 - head/usr.bin/make X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Dec 2009 13:12:04 -0000 Author: stefanf Date: Sat Dec 5 13:12:04 2009 New Revision: 200120 URL: http://svn.freebsd.org/changeset/base/200120 Log: Add a missing space to the error message when execvp() failed. Modified: head/usr.bin/make/proc.c Modified: head/usr.bin/make/proc.c ============================================================================== --- head/usr.bin/make/proc.c Sat Dec 5 12:51:51 2009 (r200119) +++ head/usr.bin/make/proc.c Sat Dec 5 13:12:04 2009 (r200120) @@ -116,7 +116,7 @@ Proc_Exec(const ProcStuff *ps) execvp(ps->argv[0], ps->argv); write(STDERR_FILENO, ps->argv[0], strlen(ps->argv[0])); - write(STDERR_FILENO, ":", 1); + write(STDERR_FILENO, ": ", 2); write(STDERR_FILENO, strerror(errno), strlen(strerror(errno))); write(STDERR_FILENO, "\n", 1); } else { From owner-svn-src-head@FreeBSD.ORG Sat Dec 5 13:40:51 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D81EA106566C; Sat, 5 Dec 2009 13:40:51 +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 C79B28FC08; Sat, 5 Dec 2009 13:40:51 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nB5DepNx089080; Sat, 5 Dec 2009 13:40:51 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nB5DepkE089078; Sat, 5 Dec 2009 13:40:51 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <200912051340.nB5DepkE089078@svn.freebsd.org> From: Alexander Motin Date: Sat, 5 Dec 2009 13:40:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200121 - head/sys/dev/ata X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Dec 2009 13:40:51 -0000 Author: mav Date: Sat Dec 5 13:40:51 2009 New Revision: 200121 URL: http://svn.freebsd.org/changeset/base/200121 Log: Do not ignore device interrupt if bus mastering is still active. It is normal in case of media read error and some ATAPI cases, when transfer size is unknown beforehand. PCI ATA BM specification tells that in case of such underrun driver should just manually stop DMA engine. DMA engine should same time guarantie that all bus mastering transfers completed at the moment of driver reads interrupt flag asserted. This change should fix interrupt storms and command timeouts in many cases. PR: kern/103602, sparc64/121539, kern/133122, kern/139654 Modified: head/sys/dev/ata/ata-pci.c Modified: head/sys/dev/ata/ata-pci.c ============================================================================== --- head/sys/dev/ata/ata-pci.c Sat Dec 5 13:12:04 2009 (r200120) +++ head/sys/dev/ata/ata-pci.c Sat Dec 5 13:40:51 2009 (r200121) @@ -462,8 +462,7 @@ ata_pci_status(device_t dev) (ch->dma.flags & ATA_DMA_ACTIVE))) { int bmstat = ATA_IDX_INB(ch, ATA_BMSTAT_PORT) & ATA_BMSTAT_MASK; - if ((bmstat & (ATA_BMSTAT_ACTIVE | ATA_BMSTAT_INTERRUPT)) != - ATA_BMSTAT_INTERRUPT) + if ((bmstat & ATA_BMSTAT_INTERRUPT) == 0) return 0; ATA_IDX_OUTB(ch, ATA_BMSTAT_PORT, bmstat & ~ATA_BMSTAT_ERROR); DELAY(1); From owner-svn-src-head@FreeBSD.ORG Sat Dec 5 13:45:22 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1DA0F106568B; Sat, 5 Dec 2009 13:45:22 +0000 (UTC) (envelope-from syrinx@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0CC5B8FC12; Sat, 5 Dec 2009 13:45:22 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nB5DjLWG089208; Sat, 5 Dec 2009 13:45:21 GMT (envelope-from syrinx@svn.freebsd.org) Received: (from syrinx@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nB5DjLVW089206; Sat, 5 Dec 2009 13:45:21 GMT (envelope-from syrinx@svn.freebsd.org) Message-Id: <200912051345.nB5DjLVW089206@svn.freebsd.org> From: Shteryana Shopova Date: Sat, 5 Dec 2009 13:45:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200122 - head/usr.sbin/bsnmpd/modules/snmp_pf X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Dec 2009 13:45:22 -0000 Author: syrinx Date: Sat Dec 5 13:45:21 2009 New Revision: 200122 URL: http://svn.freebsd.org/changeset/base/200122 Log: Make sure enough memory is allocated for a struct pft_entry when refreshing the list of pf tables. OKed by: philip MFC after: 1 week Modified: head/usr.sbin/bsnmpd/modules/snmp_pf/pf_snmp.c Modified: head/usr.sbin/bsnmpd/modules/snmp_pf/pf_snmp.c ============================================================================== --- head/usr.sbin/bsnmpd/modules/snmp_pf/pf_snmp.c Sat Dec 5 13:40:51 2009 (r200121) +++ head/usr.sbin/bsnmpd/modules/snmp_pf/pf_snmp.c Sat Dec 5 13:45:21 2009 (r200122) @@ -1104,7 +1104,7 @@ pft_refresh(void) } for (i = 0; i < numtbls; i++) { - e = malloc(sizeof(struct pfr_tstats)); + e = malloc(sizeof(struct pft_entry)); if (e == NULL) goto err1; e->index = i + 1; From owner-svn-src-head@FreeBSD.ORG Sat Dec 5 14:21:42 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 747E71065672; Sat, 5 Dec 2009 14:21:42 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 635E58FC15; Sat, 5 Dec 2009 14:21:42 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nB5ELgJm090072; Sat, 5 Dec 2009 14:21:42 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nB5ELgQX090070; Sat, 5 Dec 2009 14:21:42 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <200912051421.nB5ELgQX090070@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Sat, 5 Dec 2009 14:21:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200124 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Dec 2009 14:21:42 -0000 Author: pjd Date: Sat Dec 5 14:21:42 2009 New Revision: 200124 URL: http://svn.freebsd.org/changeset/base/200124 Log: Avoid using additional variable for storing an error if we are not going to do anything with it. Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Sat Dec 5 13:53:41 2009 (r200123) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Sat Dec 5 14:21:42 2009 (r200124) @@ -293,7 +293,7 @@ vdev_geom_read_guid(struct g_consumer *c uint64_t psize; off_t offset, size; uint64_t guid; - int error, l, len; + int l, len; g_topology_assert_not(); @@ -316,8 +316,7 @@ vdev_geom_read_guid(struct g_consumer *c if ((offset % pp->sectorsize) != 0) continue; - error = vdev_geom_io(cp, BIO_READ, label, offset, size); - if (error != 0) + if (vdev_geom_io(cp, BIO_READ, label, offset, size) != 0) continue; buf = label->vl_vdev_phys.vp_nvlist; From owner-svn-src-head@FreeBSD.ORG Sat Dec 5 14:24:22 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5D8DD1065676; Sat, 5 Dec 2009 14:24:22 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4C9988FC15; Sat, 5 Dec 2009 14:24:22 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nB5EOMA2090166; Sat, 5 Dec 2009 14:24:22 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nB5EOMj6090164; Sat, 5 Dec 2009 14:24:22 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <200912051424.nB5EOMj6090164@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Sat, 5 Dec 2009 14:24:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200125 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Dec 2009 14:24:22 -0000 Author: pjd Date: Sat Dec 5 14:24:22 2009 New Revision: 200125 URL: http://svn.freebsd.org/changeset/base/200125 Log: Always check guid when opening by path, because we may end up with provider that does have the same name, but only by accident. MFC after: 1 week Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Sat Dec 5 14:21:42 2009 (r200124) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Sat Dec 5 14:24:22 2009 (r200125) @@ -448,7 +448,7 @@ vdev_geom_open_by_guid(vdev_t *vd) } static struct g_consumer * -vdev_geom_open_by_path(vdev_t *vd, int check_guid) +vdev_geom_open_by_path(vdev_t *vd) { struct g_provider *pp; struct g_consumer *cp; @@ -460,7 +460,7 @@ vdev_geom_open_by_path(vdev_t *vd, int c if (pp != NULL) { ZFS_LOG(1, "Found provider by name %s.", vd->vdev_path); cp = vdev_geom_attach(pp, !!(spa_mode & FWRITE)); - if (cp != NULL && check_guid) { + if (cp != NULL) { g_topology_unlock(); guid = vdev_geom_read_guid(cp); g_topology_lock(); @@ -501,7 +501,7 @@ vdev_geom_open(vdev_t *vd, uint64_t *psi if ((owned = mtx_owned(&Giant))) mtx_unlock(&Giant); - cp = vdev_geom_open_by_path(vd, 0); + cp = vdev_geom_open_by_path(vd); if (cp == NULL) { /* * The device at vd->vdev_path doesn't have the expected guid. @@ -510,8 +510,6 @@ vdev_geom_open(vdev_t *vd, uint64_t *psi */ cp = vdev_geom_open_by_guid(vd); } - if (cp == NULL) - cp = vdev_geom_open_by_path(vd, 1); if (cp == NULL) { ZFS_LOG(1, "Provider %s not found.", vd->vdev_path); vd->vdev_stat.vs_aux = VDEV_AUX_OPEN_FAILED; From owner-svn-src-head@FreeBSD.ORG Sat Dec 5 14:33:12 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6CCF81065672; Sat, 5 Dec 2009 14:33:12 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 41E798FC08; Sat, 5 Dec 2009 14:33:12 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nB5EXCYx090563; Sat, 5 Dec 2009 14:33:12 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nB5EXCkW090560; Sat, 5 Dec 2009 14:33:12 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <200912051433.nB5EXCkW090560@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Sat, 5 Dec 2009 14:33:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200126 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Dec 2009 14:33:12 -0000 Author: pjd Date: Sat Dec 5 14:33:11 2009 New Revision: 200126 URL: http://svn.freebsd.org/changeset/base/200126 Log: Fix deadlock when ZVOLs are present and we are replacing dead component or calling scrub when pool is in a degraded state. It will try to taste ZVOLs, which will lead to deadlock, as ZVOL will try to acquire the same locks as replace/scrub is holding already. We can't simply skip provider based on their GEOM class, because ZVOL can have providers build on top of it and we need to skip those as well. We do it by asking for ZFS::iszvol attribute. Any ZVOL-based provider will give us positive answer and we have to skip those providers. This way we remove possibility to create ZFS pools on top of ZVOLs, but it is not very useful anyway. I believe deadlock is still possible in some very complex situations like when we have MD provider on top of UFS file on top of ZVOL. When we try to replace dead component in the pool mentioned ZVOL is based on, there might be a deadlock when ZFS will try to taste MD provider. There is no easy way to detect that, but it isn't very common. MFC after: 1 week Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Sat Dec 5 14:24:22 2009 (r200125) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Sat Dec 5 14:33:11 2009 (r200126) @@ -293,11 +293,16 @@ vdev_geom_read_guid(struct g_consumer *c uint64_t psize; off_t offset, size; uint64_t guid; - int l, len; + int error, l, len, iszvol; g_topology_assert_not(); pp = cp->provider; + ZFS_LOG(1, "Reading guid from %s...", pp->name); + if (g_getattr("ZFS::iszvol", cp, &iszvol) == 0 && iszvol) { + ZFS_LOG(1, "Skipping ZVOL-based provider %s.", pp->name); + return (0); + } psize = pp->mediasize; psize = P2ALIGN(psize, (uint64_t)sizeof(vdev_label_t)); Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c Sat Dec 5 14:24:22 2009 (r200125) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c Sat Dec 5 14:33:11 2009 (r200126) @@ -335,8 +335,11 @@ zvol_start(struct bio *bp) wakeup_one(&zv->zv_queue); mtx_unlock(&zv->zv_queue_mtx); break; - case BIO_DELETE: case BIO_GETATTR: + if (g_handleattr_int(bp, "ZFS::iszvol", 1)) + break; + /* FALLTHROUGH */ + case BIO_DELETE: default: g_io_deliver(bp, EOPNOTSUPP); break; From owner-svn-src-head@FreeBSD.ORG Sat Dec 5 17:45:57 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 11EA9106568B; Sat, 5 Dec 2009 17:45:57 +0000 (UTC) (envelope-from antoine@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0136F8FC19; Sat, 5 Dec 2009 17:45:57 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nB5Hjuxu094290; Sat, 5 Dec 2009 17:45:56 GMT (envelope-from antoine@svn.freebsd.org) Received: (from antoine@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nB5HjuAB094288; Sat, 5 Dec 2009 17:45:56 GMT (envelope-from antoine@svn.freebsd.org) Message-Id: <200912051745.nB5HjuAB094288@svn.freebsd.org> From: Antoine Brodin Date: Sat, 5 Dec 2009 17:45:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200129 - head/sys/vm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Dec 2009 17:45:57 -0000 Author: antoine Date: Sat Dec 5 17:45:56 2009 New Revision: 200129 URL: http://svn.freebsd.org/changeset/base/200129 Log: Remove trailing ";" in UMA_HASH_INSERT and UMA_HASH_REMOVE macros. MFC after: 1 month Modified: head/sys/vm/uma_int.h Modified: head/sys/vm/uma_int.h ============================================================================== --- head/sys/vm/uma_int.h Sat Dec 5 17:08:45 2009 (r200128) +++ head/sys/vm/uma_int.h Sat Dec 5 17:45:56 2009 (r200129) @@ -144,10 +144,10 @@ #define UMA_HASH_INSERT(h, s, mem) \ SLIST_INSERT_HEAD(&(h)->uh_slab_hash[UMA_HASH((h), \ - (mem))], (s), us_hlink); + (mem))], (s), us_hlink) #define UMA_HASH_REMOVE(h, s, mem) \ SLIST_REMOVE(&(h)->uh_slab_hash[UMA_HASH((h), \ - (mem))], (s), uma_slab, us_hlink); + (mem))], (s), uma_slab, us_hlink) /* Hash table for freed address -> slab translation */ From owner-svn-src-head@FreeBSD.ORG Sat Dec 5 17:46:51 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DF803106566C; Sat, 5 Dec 2009 17:46:51 +0000 (UTC) (envelope-from antoine@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CEFF78FC0C; Sat, 5 Dec 2009 17:46:51 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nB5HkpqH094342; Sat, 5 Dec 2009 17:46:51 GMT (envelope-from antoine@svn.freebsd.org) Received: (from antoine@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nB5HkpdX094340; Sat, 5 Dec 2009 17:46:51 GMT (envelope-from antoine@svn.freebsd.org) Message-Id: <200912051746.nB5HkpdX094340@svn.freebsd.org> From: Antoine Brodin Date: Sat, 5 Dec 2009 17:46:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200130 - head X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Dec 2009 17:46:52 -0000 Author: antoine Date: Sat Dec 5 17:46:51 2009 New Revision: 200130 URL: http://svn.freebsd.org/changeset/base/200130 Log: Add more obsolete files. Modified: head/ObsoleteFiles.inc Modified: head/ObsoleteFiles.inc ============================================================================== --- head/ObsoleteFiles.inc Sat Dec 5 17:45:56 2009 (r200129) +++ head/ObsoleteFiles.inc Sat Dec 5 17:46:51 2009 (r200130) @@ -17,8 +17,11 @@ # 20091202: unify rc.firewall and rc.firewall6. OLD_FILES+=etc/rc.d/ip6fw OLD_FILES+=etc/rc.firewall6 +OLD_FILES+=usr/share/examples/etc/rc.firewall6 # 20091117: removal of rc.early(8) link OLD_FILES+=usr/share/man/man8/rc.early.8.gz +# 20091117: usr/share/zoneinfo/GMT link removed +OLD_FILES+=usr/share/zoneinfo/GMT # 20091027: pselect.3 implemented as syscall OLD_FILES+=usr/share/man/man3/pselect.3.gz # 20091005: fusword.9 and susword.9 removed From owner-svn-src-head@FreeBSD.ORG Sat Dec 5 18:02:49 2009 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0718E106566B; Sat, 5 Dec 2009 18:02:49 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail06.syd.optusnet.com.au (mail06.syd.optusnet.com.au [211.29.132.187]) by mx1.freebsd.org (Postfix) with ESMTP id 8D5818FC15; Sat, 5 Dec 2009 18:02:48 +0000 (UTC) Received: from c220-239-235-116.carlnfd3.nsw.optusnet.com.au (c220-239-235-116.carlnfd3.nsw.optusnet.com.au [220.239.235.116]) by mail06.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id nB5I2UrZ024261 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sun, 6 Dec 2009 05:02:45 +1100 Date: Sun, 6 Dec 2009 05:02:30 +1100 (EST) From: Bruce Evans X-X-Sender: bde@delplex.bde.org To: Stefan Farfeleder In-Reply-To: <200912051312.nB5DC4kQ088533@svn.freebsd.org> Message-ID: <20091206034620.C26414@delplex.bde.org> References: <200912051312.nB5DC4kQ088533@svn.freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r200120 - head/usr.bin/make X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Dec 2009 18:02:49 -0000 On Sat, 5 Dec 2009, Stefan Farfeleder wrote: > Log: > Add a missing space to the error message when execvp() failed. > > Modified: > head/usr.bin/make/proc.c > > Modified: head/usr.bin/make/proc.c > ============================================================================== > --- head/usr.bin/make/proc.c Sat Dec 5 12:51:51 2009 (r200119) > +++ head/usr.bin/make/proc.c Sat Dec 5 13:12:04 2009 (r200120) > @@ -116,7 +116,7 @@ Proc_Exec(const ProcStuff *ps) > execvp(ps->argv[0], ps->argv); > Someone broke the formatting by adding this extra blank line. > write(STDERR_FILENO, ps->argv[0], strlen(ps->argv[0])); > - write(STDERR_FILENO, ":", 1); > + write(STDERR_FILENO, ": ", 2); > write(STDERR_FILENO, strerror(errno), strlen(strerror(errno))); > write(STDERR_FILENO, "\n", 1); > } else { > It would be nice if the err() family were not so broken in design and implementation so as to be unusable in signal handlers and other delicate contexts. Then it could just be used here (here we are in vfork context after a failed exec). The err() family uses stdio, so it might flush output stream(s), which would be bad as documented in vfork(2), and probably other things that might be done by stdio would be even worse in vfork() context. (The restructuring that added the above style bug also moved the execvp() far away from the vfork(), so it is unclear even that most things cannot be done in code near here.) Brokenness in the err() family includes not really documenting where the output goes. stdio is not mentioned. [stdio] streams are mentioned, but only in connection with the FreeBSD extension of err_set_file() (without this extension, the err() family could and should always write to the STDERR_FILENO non-stream using code like the above). Output is documented to go "on the standard error output", which should mean to STDERR_FILENO, but output actually goes to err_file (default stderr) using fprintf(). Corresponding brokenness in perror() is to be expected, since perror() is declared in , but perror() is documented to only write to "the standard output file descriptor", and it used to do this very carefully (using local variables), so it was usuable in signal handlers and other delicate contexts including vfork(). But it never documented this safeness, and FreeBSD turned its careful code into nonsense: % RCS file: /home/ncvs/src/lib/libc/stdio/perror.c,v % Working file: perror.c % head: 1.8 % ... % ---------------------------- % revision 1.8 % date: 2002/12/19 09:53:26; author: tjr; state: Exp; lines: +7 -1 % Write the message to stderr, not file descriptor 2, so that perror() % writes to the correct stream if stderr has been redirected with freopen(). The man page still documents writing to fd 2, and writing to stderr defeats not using stdio. The log message and man page are missing mention of the new flushing feature. % ============================================================================= % Index: perror.c % =================================================================== % RCS file: /home/ncvs/src/lib/libc/stdio/perror.c,v % retrieving revision 1.7 % retrieving revision 1.8 % diff -u -2 -r1.7 -r1.8 % --- perror.c 19 Dec 2002 09:50:10 -0000 1.7 % +++ perror.c 19 Dec 2002 09:53:26 -0000 1.8 % @@ -36,5 +36,5 @@ % #endif /* LIBC_SCCS and not lint */ % #include % -__FBSDID("$FreeBSD: src/lib/libc/stdio/perror.c,v 1.7 2002/12/19 09:50:10 tjr Exp $"); % +__FBSDID("$FreeBSD: src/lib/libc/stdio/perror.c,v 1.8 2002/12/19 09:53:26 tjr Exp $"); % % #include "namespace.h" % @@ -47,4 +47,6 @@ % #include % #include "un-namespace.h" % +#include "libc_private.h" % +#include "local.h" % % void % @@ -71,4 +73,8 @@ % v->iov_base = "\n"; % v->iov_len = 1; % - (void)_writev(STDERR_FILENO, iov, (v - iov) + 1); % + FLOCKFILE(stderr); Just locking stderr breaks signal-safeness. % + __sflush(stderr); Flushing also breaks use in [v]fork() after failed exec. Pre-flushing like this might be useful, but the err() family doesn't do any. Here the pre-flush is needed to synchronize with stderr, since the output here (now pointlessly) uses a direct writev. The err() family uses stderr, so it doesn't need to do anything to synchronize with stderr, but it could do more to sync with other streams and it should do more to ensure that its output actually goes out in case stderr is unbuffered (especially since its use of stdio is undocumented, its callers cannot know what synchronization is necessary or possible). % + (void)_writev(stderr->_file, iov, (v - iov) + 1); Maybe stderr->_file can be type-stable or something, so that it can be accessed not too unsafely without locking in signal handlers. The change should have been limited to something like that. % + stderr->_flags &= ~__SOFF; Another state change which must be avoided in delicate contexts. % + FUNLOCKFILE(stderr); The locking is hopefully idempotent, so it is safe in vfork context. % } Both Standard C and POSIX specify perror() to be perfectly broken. They specify it to write to the "standard error stream" (why not just stderr?). Standard C doesn't have STDERR_FILENO, so it cannot do the right thing here except by not really specifying where the output goes. Neither specifies any special synchronization. POSIX (and newer C99?) also specifies that perror() shall not change the orientation of the standard error stream. A non-broken err() would look like the non-broken perror(), except it would have to snprintf() to a local buffer before writev() and thus it could no longer support very long messages. Bruce From owner-svn-src-head@FreeBSD.ORG Sat Dec 5 18:51:44 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7AD421065692; Sat, 5 Dec 2009 18:51:44 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 510418FC0A; Sat, 5 Dec 2009 18:51:44 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nB5Ipiam095740; Sat, 5 Dec 2009 18:51:44 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nB5IpiFJ095738; Sat, 5 Dec 2009 18:51:44 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <200912051851.nB5IpiFJ095738@svn.freebsd.org> From: Ed Schouten Date: Sat, 5 Dec 2009 18:51:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200133 - head/lib/libc/gen X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Dec 2009 18:51:44 -0000 Author: ed Date: Sat Dec 5 18:51:44 2009 New Revision: 200133 URL: http://svn.freebsd.org/changeset/base/200133 Log: Remove (hidden) warning about missing prototypes for fdevname(3). Modified: head/lib/libc/gen/fdevname.c Modified: head/lib/libc/gen/fdevname.c ============================================================================== --- head/lib/libc/gen/fdevname.c Sat Dec 5 18:40:26 2009 (r200132) +++ head/lib/libc/gen/fdevname.c Sat Dec 5 18:51:44 2009 (r200133) @@ -30,6 +30,7 @@ __FBSDID("$FreeBSD$"); #include "namespace.h" #include #include +#include #include "un-namespace.h" char * From owner-svn-src-head@FreeBSD.ORG Sat Dec 5 18:53:05 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 147A81065672; Sat, 5 Dec 2009 18:53:05 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DE7AA8FC0A; Sat, 5 Dec 2009 18:53:04 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nB5Ir4pE095803; Sat, 5 Dec 2009 18:53:04 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nB5Ir4eO095801; Sat, 5 Dec 2009 18:53:04 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <200912051853.nB5Ir4eO095801@svn.freebsd.org> From: Ed Schouten Date: Sat, 5 Dec 2009 18:53:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200134 - head/lib/libc/gen X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Dec 2009 18:53:05 -0000 Author: ed Date: Sat Dec 5 18:53:04 2009 New Revision: 200134 URL: http://svn.freebsd.org/changeset/base/200134 Log: Use ANSI C prototypes inside termios. While there, add a missing __unused to hide a warning in tcsetbreak(). Modified: head/lib/libc/gen/termios.c Modified: head/lib/libc/gen/termios.c ============================================================================== --- head/lib/libc/gen/termios.c Sat Dec 5 18:51:44 2009 (r200133) +++ head/lib/libc/gen/termios.c Sat Dec 5 18:53:04 2009 (r200134) @@ -45,18 +45,14 @@ __FBSDID("$FreeBSD$"); #include "un-namespace.h" int -tcgetattr(fd, t) - int fd; - struct termios *t; +tcgetattr(int fd, struct termios *t) { return (_ioctl(fd, TIOCGETA, t)); } int -tcsetattr(fd, opt, t) - int fd, opt; - const struct termios *t; +tcsetattr(int fd, int opt, const struct termios *t) { struct termios localterm; @@ -88,8 +84,7 @@ tcsetpgrp(int fd, pid_t pgrp) } pid_t -tcgetpgrp(fd) - int fd; +tcgetpgrp(int fd) { int s; @@ -123,25 +118,21 @@ tcsetsid(int fd, pid_t pid) } speed_t -cfgetospeed(t) - const struct termios *t; +cfgetospeed(const struct termios *t) { return (t->c_ospeed); } speed_t -cfgetispeed(t) - const struct termios *t; +cfgetispeed(const struct termios *t) { return (t->c_ispeed); } int -cfsetospeed(t, speed) - struct termios *t; - speed_t speed; +cfsetospeed(struct termios *t, speed_t speed) { t->c_ospeed = speed; @@ -149,9 +140,7 @@ cfsetospeed(t, speed) } int -cfsetispeed(t, speed) - struct termios *t; - speed_t speed; +cfsetispeed(struct termios *t, speed_t speed) { t->c_ispeed = speed; @@ -159,9 +148,7 @@ cfsetispeed(t, speed) } int -cfsetspeed(t, speed) - struct termios *t; - speed_t speed; +cfsetspeed(struct termios *t, speed_t speed) { t->c_ispeed = t->c_ospeed = speed; @@ -173,8 +160,7 @@ cfsetspeed(t, speed) * mode with no characters interpreted, 8-bit data path. */ void -cfmakeraw(t) - struct termios *t; +cfmakeraw(struct termios *t) { t->c_iflag &= ~(IMAXBEL|IXOFF|INPCK|BRKINT|PARMRK|ISTRIP|INLCR|IGNCR|ICRNL|IXON|IGNPAR); @@ -188,8 +174,7 @@ cfmakeraw(t) } int -tcsendbreak(fd, len) - int fd, len; +tcsendbreak(int fd, int len __unused) { struct timeval sleepytime; @@ -204,8 +189,7 @@ tcsendbreak(fd, len) } int -__tcdrain(fd) - int fd; +__tcdrain(int fd) { return (_ioctl(fd, TIOCDRAIN, 0)); } @@ -214,8 +198,7 @@ __weak_reference(__tcdrain, tcdrain); __weak_reference(__tcdrain, _tcdrain); int -tcflush(fd, which) - int fd, which; +tcflush(int fd, int which) { int com; @@ -237,8 +220,7 @@ tcflush(fd, which) } int -tcflow(fd, action) - int fd, action; +tcflow(int fd, int action) { struct termios term; u_char c; From owner-svn-src-head@FreeBSD.ORG Sat Dec 5 18:55:17 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 03585106568D; Sat, 5 Dec 2009 18:55:17 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E682A8FC12; Sat, 5 Dec 2009 18:55:16 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nB5ItGUM096006; Sat, 5 Dec 2009 18:55:16 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nB5ItGQa096004; Sat, 5 Dec 2009 18:55:16 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <200912051855.nB5ItGQa096004@svn.freebsd.org> From: Ed Schouten Date: Sat, 5 Dec 2009 18:55:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200136 - head/lib/libc/gen X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Dec 2009 18:55:17 -0000 Author: ed Date: Sat Dec 5 18:55:16 2009 New Revision: 200136 URL: http://svn.freebsd.org/changeset/base/200136 Log: Remove warnings from exec.c. The entries in the argv array are not const themselves, but sometimes we want to fill in const values. Just make the array const and use __DECONST() to make it const for the execve()-call itself. Also convert the only K&R prototype to ANSI. Modified: head/lib/libc/gen/exec.c Modified: head/lib/libc/gen/exec.c ============================================================================== --- head/lib/libc/gen/exec.c Sat Dec 5 18:54:21 2009 (r200135) +++ head/lib/libc/gen/exec.c Sat Dec 5 18:55:16 2009 (r200136) @@ -54,7 +54,7 @@ int execl(const char *name, const char *arg, ...) { va_list ap; - char **argv; + const char **argv; int n; va_start(ap, arg); @@ -69,18 +69,19 @@ execl(const char *name, const char *arg, } va_start(ap, arg); n = 1; - argv[0] = (char *)arg; + argv[0] = arg; while ((argv[n] = va_arg(ap, char *)) != NULL) n++; va_end(ap); - return (_execve(name, argv, environ)); + return (_execve(name, __DECONST(char **, argv), environ)); } int execle(const char *name, const char *arg, ...) { va_list ap; - char **argv, **envp; + const char **argv; + char **envp; int n; va_start(ap, arg); @@ -95,19 +96,19 @@ execle(const char *name, const char *arg } va_start(ap, arg); n = 1; - argv[0] = (char *)arg; + argv[0] = arg; while ((argv[n] = va_arg(ap, char *)) != NULL) n++; envp = va_arg(ap, char **); va_end(ap); - return (_execve(name, argv, envp)); + return (_execve(name, __DECONST(char **, argv), envp)); } int execlp(const char *name, const char *arg, ...) { va_list ap; - char **argv; + const char **argv; int n; va_start(ap, arg); @@ -122,11 +123,11 @@ execlp(const char *name, const char *arg } va_start(ap, arg); n = 1; - argv[0] = (char *)arg; + argv[0] = arg; while ((argv[n] = va_arg(ap, char *)) != NULL) n++; va_end(ap); - return (execvp(name, argv)); + return (execvp(name, __DECONST(char **, argv))); } int @@ -145,24 +146,21 @@ execvp(const char *name, char * const *a } static int -execvPe(name, path, argv, envp) - const char *name; - const char *path; - char * const *argv; - char * const *envp; +execvPe(const char *name, const char *path, char * const *argv, + char * const *envp) { - char **memp; - int cnt, lp, ln; - char *p; + const char **memp; + size_t cnt, lp, ln; int eacces, save_errno; - char *bp, *cur, buf[MAXPATHLEN]; + char *cur, buf[MAXPATHLEN]; + const char *p, *bp; struct stat sb; eacces = 0; /* If it's an absolute or relative path name, it's easy. */ if (index(name, '/')) { - bp = (char *)name; + bp = name; cur = NULL; goto retry; } @@ -228,7 +226,8 @@ retry: (void)_execve(bp, argv, envp); memp[0] = "sh"; memp[1] = bp; bcopy(argv + 1, memp + 2, cnt * sizeof(char *)); - (void)_execve(_PATH_BSHELL, memp, envp); + (void)_execve(_PATH_BSHELL, + __DECONST(char **, memp), envp); goto done; case ENOMEM: goto done; From owner-svn-src-head@FreeBSD.ORG Sat Dec 5 19:04:21 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7C1641065670; Sat, 5 Dec 2009 19:04:21 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6B1B78FC1D; Sat, 5 Dec 2009 19:04:21 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nB5J4L5F096489; Sat, 5 Dec 2009 19:04:21 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nB5J4LTp096485; Sat, 5 Dec 2009 19:04:21 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <200912051904.nB5J4LTp096485@svn.freebsd.org> From: Ed Schouten Date: Sat, 5 Dec 2009 19:04:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200142 - in head/lib/libc: gen posix1e X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Dec 2009 19:04:21 -0000 Author: ed Date: Sat Dec 5 19:04:21 2009 New Revision: 200142 URL: http://svn.freebsd.org/changeset/base/200142 Log: Don't let the C library depend on . The maximum length of a username has nothing to do with the size of the username in the utmp files. Use MAXLOGNAME, which is defined as 17 (UT_USERSIZE + 1). Modified: head/lib/libc/gen/getlogin.c head/lib/libc/gen/pwcache.c head/lib/libc/posix1e/acl_to_text.c Modified: head/lib/libc/gen/getlogin.c ============================================================================== --- head/lib/libc/gen/getlogin.c Sat Dec 5 19:03:20 2009 (r200141) +++ head/lib/libc/gen/getlogin.c Sat Dec 5 19:04:21 2009 (r200142) @@ -36,7 +36,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include #include Modified: head/lib/libc/gen/pwcache.c ============================================================================== --- head/lib/libc/gen/pwcache.c Sat Dec 5 19:03:20 2009 (r200141) +++ head/lib/libc/gen/pwcache.c Sat Dec 5 19:04:21 2009 (r200142) @@ -33,13 +33,13 @@ static char sccsid[] = "@(#)pwcache.c 8. #include __FBSDID("$FreeBSD$"); +#include #include #include #include #include #include -#include #define NCACHE 64 /* power of 2 */ #define MASK (NCACHE - 1) /* bits to store with */ @@ -50,7 +50,7 @@ user_from_uid(uid_t uid, int nouser) static struct ncache { uid_t uid; int found; - char name[UT_NAMESIZE + 1]; + char name[MAXLOGNAME]; } c_uid[NCACHE]; static int pwopen; struct passwd *pw; @@ -66,11 +66,11 @@ user_from_uid(uid_t uid, int nouser) cp->uid = uid; if (pw != NULL) { cp->found = 1; - (void)strncpy(cp->name, pw->pw_name, UT_NAMESIZE); - cp->name[UT_NAMESIZE] = '\0'; + (void)strncpy(cp->name, pw->pw_name, MAXLOGNAME - 1); + cp->name[MAXLOGNAME - 1] = '\0'; } else { cp->found = 0; - (void)snprintf(cp->name, UT_NAMESIZE, "%u", uid); + (void)snprintf(cp->name, MAXLOGNAME - 1, "%u", uid); if (nouser) return (NULL); } @@ -84,7 +84,7 @@ group_from_gid(gid_t gid, int nogroup) static struct ncache { gid_t gid; int found; - char name[UT_NAMESIZE + 1]; + char name[MAXLOGNAME]; } c_gid[NCACHE]; static int gropen; struct group *gr; @@ -100,11 +100,11 @@ group_from_gid(gid_t gid, int nogroup) cp->gid = gid; if (gr != NULL) { cp->found = 1; - (void)strncpy(cp->name, gr->gr_name, UT_NAMESIZE); - cp->name[UT_NAMESIZE] = '\0'; + (void)strncpy(cp->name, gr->gr_name, MAXLOGNAME - 1); + cp->name[MAXLOGNAME - 1] = '\0'; } else { cp->found = 0; - (void)snprintf(cp->name, UT_NAMESIZE, "%u", gid); + (void)snprintf(cp->name, MAXLOGNAME - 1, "%u", gid); if (nogroup) return (NULL); } Modified: head/lib/libc/posix1e/acl_to_text.c ============================================================================== --- head/lib/libc/posix1e/acl_to_text.c Sat Dec 5 19:03:20 2009 (r200141) +++ head/lib/libc/posix1e/acl_to_text.c Sat Dec 5 19:04:21 2009 (r200142) @@ -39,7 +39,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include "acl_support.h" @@ -58,7 +57,7 @@ _posix1e_acl_to_text(acl_t acl, ssize_t { struct acl *acl_int; char *buf, *tmpbuf; - char name_buf[UT_NAMESIZE+1]; + char name_buf[MAXLOGNAME]; char perm_buf[_POSIX1E_ACL_STRING_PERM_MAXSIZE+1], effective_perm_buf[_POSIX1E_ACL_STRING_PERM_MAXSIZE+1]; int i, error, len; @@ -103,7 +102,7 @@ _posix1e_acl_to_text(acl_t acl, ssize_t goto error_label; error = _posix1e_acl_id_to_name(ae_tag, ae_id, - UT_NAMESIZE+1, name_buf, flags); + MAXLOGNAME, name_buf, flags); if (error) goto error_label; @@ -163,7 +162,7 @@ _posix1e_acl_to_text(acl_t acl, ssize_t goto error_label; error = _posix1e_acl_id_to_name(ae_tag, ae_id, - UT_NAMESIZE+1, name_buf, flags); + MAXLOGNAME, name_buf, flags); if (error) goto error_label; From owner-svn-src-head@FreeBSD.ORG Sat Dec 5 19:31:38 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A465F1065670; Sat, 5 Dec 2009 19:31:38 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9252C8FC17; Sat, 5 Dec 2009 19:31:38 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nB5JVcs4097457; Sat, 5 Dec 2009 19:31:38 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nB5JVcHl097444; Sat, 5 Dec 2009 19:31:38 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <200912051931.nB5JVcHl097444@svn.freebsd.org> From: Ed Schouten Date: Sat, 5 Dec 2009 19:31:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200150 - in head/lib/libc: gen gmon stdio stdlib sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Dec 2009 19:31:38 -0000 Author: ed Date: Sat Dec 5 19:31:38 2009 New Revision: 200150 URL: http://svn.freebsd.org/changeset/base/200150 Log: Fix many "function declaration isn't a prototype" warnings in libc. I've only fixed code that seems to be written by `us'. There are still many warnings like this present in resolv/, rpc/, stdtime/ and yp/. Modified: head/lib/libc/gen/getttyent.c head/lib/libc/gen/nlist.c head/lib/libc/gen/pause.c head/lib/libc/gen/raise.c head/lib/libc/gen/sleep.c head/lib/libc/gen/timezone.c head/lib/libc/gen/usleep.c head/lib/libc/gmon/gmon.c head/lib/libc/stdio/findfp.c head/lib/libc/stdio/funopen.c head/lib/libc/stdlib/system.c head/lib/libc/sys/__error.c Modified: head/lib/libc/gen/getttyent.c ============================================================================== --- head/lib/libc/gen/getttyent.c Sat Dec 5 19:25:29 2009 (r200149) +++ head/lib/libc/gen/getttyent.c Sat Dec 5 19:31:38 2009 (r200150) @@ -55,8 +55,7 @@ static char *skip(char *); static char *value(char *); struct ttyent * -getttynam(tty) - const char *tty; +getttynam(const char *tty) { struct ttyent *t; @@ -71,7 +70,7 @@ getttynam(tty) } struct ttyent * -getttyent() +getttyent(void) { static struct ttyent tty; static char devpts_name[] = "pts/4294967295"; @@ -178,8 +177,7 @@ getttyent() * the next field. */ static char * -skip(p) - char *p; +skip(char *p) { char *t; int c, q; @@ -212,15 +210,14 @@ skip(p) } static char * -value(p) - char *p; +value(char *p) { return ((p = index(p, '=')) ? ++p : NULL); } int -setttyent() +setttyent(void) { DIR *devpts_dir; @@ -254,7 +251,7 @@ setttyent() } int -endttyent() +endttyent(void) { int rval; @@ -272,9 +269,7 @@ endttyent() } static int -isttystat(tty, flag) - const char *tty; - int flag; +isttystat(const char *tty, int flag) { struct ttyent *t; @@ -283,15 +278,14 @@ isttystat(tty, flag) int -isdialuptty(tty) - const char *tty; +isdialuptty(const char *tty) { return isttystat(tty, TTY_DIALUP); } -int isnettty(tty) - const char *tty; +int +isnettty(const char *tty) { return isttystat(tty, TTY_NETWORK); Modified: head/lib/libc/gen/nlist.c ============================================================================== --- head/lib/libc/gen/nlist.c Sat Dec 5 19:25:29 2009 (r200149) +++ head/lib/libc/gen/nlist.c Sat Dec 5 19:31:38 2009 (r200150) @@ -209,8 +209,7 @@ static void elf_sym_to_nlist(struct nlis * as such its use should be restricted. */ int -__elf_is_okay__(ehdr) - Elf_Ehdr *ehdr; +__elf_is_okay__(Elf_Ehdr *ehdr) { int retval = 0; /* Modified: head/lib/libc/gen/pause.c ============================================================================== --- head/lib/libc/gen/pause.c Sat Dec 5 19:25:29 2009 (r200149) +++ head/lib/libc/gen/pause.c Sat Dec 5 19:31:38 2009 (r200150) @@ -40,7 +40,7 @@ __FBSDID("$FreeBSD$"); * Backwards compatible pause. */ int -__pause() +__pause(void) { return sigpause(sigblock(0L)); } Modified: head/lib/libc/gen/raise.c ============================================================================== --- head/lib/libc/gen/raise.c Sat Dec 5 19:25:29 2009 (r200149) +++ head/lib/libc/gen/raise.c Sat Dec 5 19:31:38 2009 (r200150) @@ -40,8 +40,7 @@ __weak_reference(__raise, raise); __weak_reference(__raise, _raise); int -__raise(s) - int s; +__raise(int s) { return(kill(getpid(), s)); } Modified: head/lib/libc/gen/sleep.c ============================================================================== --- head/lib/libc/gen/sleep.c Sat Dec 5 19:25:29 2009 (r200149) +++ head/lib/libc/gen/sleep.c Sat Dec 5 19:31:38 2009 (r200150) @@ -41,8 +41,7 @@ __FBSDID("$FreeBSD$"); #include "un-namespace.h" unsigned int -__sleep(seconds) - unsigned int seconds; +__sleep(unsigned int seconds) { struct timespec time_to_sleep; struct timespec time_remaining; Modified: head/lib/libc/gen/timezone.c ============================================================================== --- head/lib/libc/gen/timezone.c Sat Dec 5 19:25:29 2009 (r200149) +++ head/lib/libc/gen/timezone.c Sat Dec 5 19:31:38 2009 (r200150) @@ -40,7 +40,7 @@ __FBSDID("$FreeBSD$"); #include #define TZ_MAX_CHARS 255 -char *_tztab(); +char *_tztab(int, int); /* * timezone -- @@ -53,9 +53,7 @@ char *_tztab(); static char czone[TZ_MAX_CHARS]; /* space for zone name */ char * -timezone(zone, dst) - int zone, - dst; +timezone(int zone, int dst) { char *beg, *end; @@ -106,9 +104,7 @@ static struct zone { * STANDARD LIBRARY. */ char * -_tztab(zone,dst) - int zone; - int dst; +_tztab(int zone, int dst) { struct zone *zp; char sign; Modified: head/lib/libc/gen/usleep.c ============================================================================== --- head/lib/libc/gen/usleep.c Sat Dec 5 19:25:29 2009 (r200149) +++ head/lib/libc/gen/usleep.c Sat Dec 5 19:31:38 2009 (r200150) @@ -39,8 +39,7 @@ __FBSDID("$FreeBSD$"); #include "un-namespace.h" int -__usleep(useconds) - useconds_t useconds; +__usleep(useconds_t useconds) { struct timespec time_to_sleep; Modified: head/lib/libc/gmon/gmon.c ============================================================================== --- head/lib/libc/gmon/gmon.c Sat Dec 5 19:25:29 2009 (r200149) +++ head/lib/libc/gmon/gmon.c Sat Dec 5 19:31:38 2009 (r200150) @@ -132,7 +132,7 @@ monstartup(lowpc, highpc) } void -_mcleanup() +_mcleanup(void) { int fd; int fromindex; Modified: head/lib/libc/stdio/findfp.c ============================================================================== --- head/lib/libc/stdio/findfp.c Sat Dec 5 19:25:29 2009 (r200149) +++ head/lib/libc/stdio/findfp.c Sat Dec 5 19:31:38 2009 (r200150) @@ -168,7 +168,7 @@ __warn_references(f_prealloc, "warning: this program uses f_prealloc(), which is not recommended."); void -f_prealloc() +f_prealloc(void) { struct glue *g; int n; Modified: head/lib/libc/stdio/funopen.c ============================================================================== --- head/lib/libc/stdio/funopen.c Sat Dec 5 19:25:29 2009 (r200149) +++ head/lib/libc/stdio/funopen.c Sat Dec 5 19:31:38 2009 (r200150) @@ -42,11 +42,11 @@ __FBSDID("$FreeBSD$"); #include "local.h" FILE * -funopen(cookie, readfn, writefn, seekfn, closefn) - const void *cookie; - int (*readfn)(), (*writefn)(); - fpos_t (*seekfn)(void *cookie, fpos_t off, int whence); - int (*closefn)(); +funopen(const void *cookie, + int (*readfn)(void *, char *, int), + int (*writefn)(void *, const char *, int), + fpos_t (*seekfn)(void *, fpos_t, int), + int (*closefn)(void *)) { FILE *fp; int flags; Modified: head/lib/libc/stdlib/system.c ============================================================================== --- head/lib/libc/stdlib/system.c Sat Dec 5 19:25:29 2009 (r200149) +++ head/lib/libc/stdlib/system.c Sat Dec 5 19:31:38 2009 (r200150) @@ -46,8 +46,7 @@ __FBSDID("$FreeBSD$"); #include "libc_private.h" int -__system(command) - const char *command; +__system(const char *command) { pid_t pid, savedpid; int pstat; Modified: head/lib/libc/sys/__error.c ============================================================================== --- head/lib/libc/sys/__error.c Sat Dec 5 19:25:29 2009 (r200149) +++ head/lib/libc/sys/__error.c Sat Dec 5 19:31:38 2009 (r200150) @@ -39,7 +39,7 @@ extern int errno; __weak_reference(__error_unthreaded, __error); int * -__error_unthreaded() +__error_unthreaded(void) { return(&errno); } From owner-svn-src-head@FreeBSD.ORG Sat Dec 5 19:53:29 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6B7431065670; Sat, 5 Dec 2009 19:53:29 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5913B8FC13; Sat, 5 Dec 2009 19:53:29 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nB5JrTQK098047; Sat, 5 Dec 2009 19:53:29 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nB5JrTRs098035; Sat, 5 Dec 2009 19:53:29 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <200912051953.nB5JrTRs098035@svn.freebsd.org> From: Ed Schouten Date: Sat, 5 Dec 2009 19:53:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200153 - head/lib/libulog X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Dec 2009 19:53:29 -0000 Author: ed Date: Sat Dec 5 19:53:29 2009 New Revision: 200153 URL: http://svn.freebsd.org/changeset/base/200153 Log: Massively extend libulog: - Just like struct utmp, store strings inside struct utmpx itself. This is needed to make things like pututxline() work. - Add ut_id and ut_pid fields, even though they have little use in our implementation. - It turns out our "reboot" wtmp entries indicate a system boot, so remove REBOOT_TIME - Implement getutxline() and pututxline - Add getutxuser() and setutxfile(), which allows us to crawl wtmp and lastlog files as well. - Add _ULOG_POSIX_NAMES, so we can already use the POSIX names if we really want to. Added: head/lib/libulog/ulog_pututxline.c (contents, props changed) head/lib/libulog/ulog_setutxfile.3 (contents, props changed) head/lib/libulog/ulog_util.c (contents, props changed) Modified: head/lib/libulog/Makefile head/lib/libulog/Symbol.map head/lib/libulog/ulog.h head/lib/libulog/ulog_getutxent.3 head/lib/libulog/ulog_getutxent.c head/lib/libulog/ulog_internal.h head/lib/libulog/ulog_login.3 head/lib/libulog/ulog_login.c Modified: head/lib/libulog/Makefile ============================================================================== --- head/lib/libulog/Makefile Sat Dec 5 19:44:16 2009 (r200152) +++ head/lib/libulog/Makefile Sat Dec 5 19:53:29 2009 (r200153) @@ -3,15 +3,25 @@ LIB= ulog SHLIB_MAJOR= 0 INCS= ulog.h -SRCS= ulog.h ulog_getutxent.c ulog_internal.h \ - ulog_login.c ulog_login_pseudo.c +SRCS= ulog.h ulog_getutxent.c ulog_internal.h ulog_login.c \ + ulog_login_pseudo.c ulog_pututxline.c ulog_util.c -MAN= ulog_getutxent.3 ulog_login.3 +MAN= ulog_getutxent.3 ulog_login.3 ulog_setutxfile.3 MLINKS+=ulog_getutxent.3 ulog_endutxent.3 \ + ulog_getutxent.3 ulog_getutxline.3 \ + ulog_getutxent.3 ulog_pututxline.3 \ ulog_getutxent.3 ulog_setutxent.3 \ ulog_login.3 ulog_login_pseudo.3 \ ulog_login.3 ulog_logout.3 \ - ulog_login.3 ulog_logout_pseudo.3 + ulog_login.3 ulog_logout_pseudo.3 \ + ulog_setutxfile.3 ulog_getutxuser.3 + +# Add links to -style functions. +MLINKS+=ulog_endutxent.3 endutxent.3 \ + ulog_getutxent.3 getutxent.3 \ + ulog_getutxline.3 getutxline.3 \ + ulog_pututxline.3 pututxline.3 \ + ulog_setutxent.3 setutxent.3 WARNS?= 6 Modified: head/lib/libulog/Symbol.map ============================================================================== --- head/lib/libulog/Symbol.map Sat Dec 5 19:44:16 2009 (r200152) +++ head/lib/libulog/Symbol.map Sat Dec 5 19:53:29 2009 (r200153) @@ -5,9 +5,13 @@ FBSD_1.2 { ulog_endutxent; ulog_getutxent; + ulog_getutxline; + ulog_getutxuser; ulog_login; ulog_login_pseudo; ulog_logout; ulog_logout_pseudo; + ulog_pututxline; ulog_setutxent; + ulog_setutxfile; }; Modified: head/lib/libulog/ulog.h ============================================================================== --- head/lib/libulog/ulog.h Sat Dec 5 19:44:16 2009 (r200152) +++ head/lib/libulog/ulog.h Sat Dec 5 19:53:29 2009 (r200153) @@ -31,6 +31,12 @@ #include #include +#include + +#ifndef _PID_T_DECLARED +typedef __pid_t pid_t; +#define _PID_T_DECLARED +#endif /* * libulog. @@ -42,61 +48,61 @@ * processes as well, provided that they hold a file descriptor to a * pseudo-terminal master device. * - * Unlike struct utmpx, the buffers containing the strings are not - * stored inside struct ulog_utmpx itself. Processes should never - * handcraft these structures anyway. - * * This library (or at least parts of it) will hopefully deprecate over * time, when we provide the API. */ -#define _UTX_USERDISPSIZE 16 -#define _UTX_LINEDISPSIZE 8 -#define _UTX_HOSTDISPSIZE 16 - struct ulog_utmpx { - char *ut_user; -#if 0 - char *ut_id; -#endif - char *ut_line; - char *ut_host; -#if 0 - pid_t ut_pid; -#endif - short ut_type; + char ut_user[32]; + char ut_id[8]; /* XXX: unsupported. */ + char ut_line[32]; + char ut_host[256]; + pid_t ut_pid; /* XXX: unsupported. */ + short ut_type; #define EMPTY 0 -#if 0 #define BOOT_TIME 1 -#endif #define OLD_TIME 2 #define NEW_TIME 3 #define USER_PROCESS 4 -#if 0 -#define INIT_PROCESS 5 -#define LOGIN_PROCESS 6 -#endif +#define INIT_PROCESS 5 /* XXX: unsupported. */ +#define LOGIN_PROCESS 6 /* XXX: unsupported. */ #define DEAD_PROCESS 7 - #define SHUTDOWN_TIME 8 -#define REBOOT_TIME 9 - struct timeval ut_tv; + struct timeval ut_tv; }; __BEGIN_DECLS +/* POSIX routines. */ void ulog_endutxent(void); struct ulog_utmpx *ulog_getutxent(void); #if 0 -struct ulog_utmpx *ulog_getutxid(const struct ulog_utmpx *id); -struct ulog_utmpx *ulog_getutxline(const struct ulog_utmpx *line); -struct ulog_utmpx *ulog_pututxline(const struct ulog_utmpx *utmpx); +struct ulog_utmpx *ulog_getutxid(const struct ulog_utmpx *); #endif +struct ulog_utmpx *ulog_getutxline(const struct ulog_utmpx *); +struct ulog_utmpx *ulog_pututxline(const struct ulog_utmpx *); void ulog_setutxent(void); +/* Extensions. */ +struct ulog_utmpx *ulog_getutxuser(const char *); +int ulog_setutxfile(int, const char *); +#define UTXF_UTMP 0 +#define UTXF_WTMP 1 +#define UTXF_LASTLOG 2 + +/* Login/logout utility functions. */ void ulog_login(const char *, const char *, const char *); void ulog_login_pseudo(int, const char *); void ulog_logout(const char *); void ulog_logout_pseudo(int); __END_DECLS +#ifdef _ULOG_POSIX_NAMES +#define utmpx ulog_utmpx +#define endutxent ulog_endutxent +#define getutxent ulog_getutxent +#define getutxline ulog_getutxline +#define pututxline ulog_pututxline +#define setutxent ulog_setutxent +#endif /* _ULOG_POSIX_NAMES */ + #endif /* !_ULOG_H_ */ Modified: head/lib/libulog/ulog_getutxent.3 ============================================================================== --- head/lib/libulog/ulog_getutxent.3 Sat Dec 5 19:44:16 2009 (r200152) +++ head/lib/libulog/ulog_getutxent.3 Sat Dec 5 19:53:29 2009 (r200153) @@ -24,11 +24,13 @@ .\" .\" $FreeBSD$ .\" -.Dd December 2, 2009 +.Dd December 5, 2009 .Os .Dt ULOG_GETUTXENT 3 .Sh NAME .Nm ulog_getutxent , +.Nm ulog_getutxline , +.Nm ulog_pututxline , .Nm ulog_setutxent , .Nm ulog_endutxent .Nd read user login records @@ -38,6 +40,10 @@ .In ulog.h .Ft struct ulog_utmpx * .Fn ulog_getutxent "void" +.Ft struct ulog_utmpx * +.Fn ulog_getutxline "const struct ulog_utmpx *line" +.Ft struct ulog_utmpx * +.Fn ulog_pututxline "const struct ulog_utmpx *utmpx" .Ft void .Fn ulog_setutxent "void" .Ft void @@ -49,10 +55,12 @@ function returns a pointer to an object, containing stored information of an active user login session. .Bd -literal struct ulog_utmpx { - char *ut_user; /* Username. */ - char *ut_line; /* TTY device. */ - char *ut_host; /* Remote hostname. */ - short ut_type; /* Type of entry. */ + char ut_user[]; /* Username. */ + char ut_id[]; /* Private data. */ + char ut_line[]; /* TTY device. */ + char ut_host[]; /* Remote hostname. */ + pid_t ut_pid; /* Process identifier. */ + short ut_type; /* Type of entry. */ struct timeval ut_tv; /* Timestamp. */ }; .Ed @@ -61,6 +69,9 @@ The fields are as follows: .Bl -tag -width ut_user .It Fa ut_user The username of the logged in user. +.It Fa ut_id +Private data that can be used to later identify the record. +This implementation is not capable of storing this value on disk. .It Fa ut_line The pathname of the TTY device, without the leading .Pa /dev/ @@ -68,6 +79,9 @@ directory. .It Fa ut_host An optional hostname of a remote system, if the login session is provided through a networked login service. +.It Fa ut_pid +Process identifier of the session leader of the login session. +This implementation is not capable of storing this value on disk. .It Fa ut_type The .Fa ut_type @@ -76,28 +90,42 @@ following values: .Bl -tag -width SHUTDOWN_TIME .It Dv EMPTY No valid user accounting information. +.It Dv BOOT_TIME +Identifies time of system boot. .It Dv OLD_TIME Identifies time when system clock changed. .It Dv NEW_TIME Identifies time after system clock changed. .It Dv USER_PROCESS Identifies a process. +.It Dv INIT_PROCESS +Identifies a process spawned by the init process. +.It Dv LOGIN_PROCESS +Identifies the session leader of a logged-in user. .It Dv DEAD_PROCESS Identifies a session leader who has exited. .It Dv SHUTDOWN_TIME Identifies time when system was shut down. -.It Dv REBOOT_TIME -Identifies time when system was rebooted. .El .It Fa ut_tv Timestamp indicating when the entry was last modified. .El .Pp +This implementation guarantees all strings returned in the structure to +be null terminated. +.Pp The .Fn ulog_getutxent function reads the next entry from the utmp file, opening the file if necessary. The +.Fn ulog_getutxline +function reads entries from the utmp file, until finding an entry which +shares the same +.Fa ut_line +as the structure +.Fa line . +The .Fn ulog_setutxent opens the file, closing it first if already opened. The @@ -106,15 +134,50 @@ function closes any open files. .Pp The .Fn ulog_getutxent -function reads from the beginning of the file until and EOF is +and +.Fn ulog_getutxline +functions read from the beginning of the file until and EOF is encountered. +.Pp +The +.Fn ulog_pututxline +function writes a new entry to the file. .Sh RETURN VALUES The .Fn ulog_getutxent -function returns a null pointer on EOF or error. +and +.Fn ulog_getutxline +functions return a null pointer on EOF or error. .Sh SEE ALSO .Xr ulog_login 3 , +.Xr ulog_setutxfile 3 , .Xr utmp 5 +.Sh STANDARDS +This interface is similar to +.In utmpx.h +described in +.St -p1003.1-2008 , +but incompatible. +The underlying file format does not allow a correctly behaving +implementation of the standardized interface. +.Pp +This programming interface has been designed to ease the migration +towards +.In utmpx.h . +If +.Dv _ULOG_POSIX_NAMES +is set before inclusion of +.In ulog.h , +it is also possible to use the +.Vt utmpx +structure and the +.Fn getutxent , +.Fn getutxline , +.Fn pututxline , +.Fn setutxent +and +.Fn endutxent +functions. .Sh HISTORY These functions appeared in .Fx 9.0 . Modified: head/lib/libulog/ulog_getutxent.c ============================================================================== --- head/lib/libulog/ulog_getutxent.c Sat Dec 5 19:44:16 2009 (r200152) +++ head/lib/libulog/ulog_getutxent.c Sat Dec 5 19:53:29 2009 (r200153) @@ -27,6 +27,9 @@ #include __FBSDID("$FreeBSD$"); +#include + +#include #include #include #include @@ -35,6 +38,7 @@ __FBSDID("$FreeBSD$"); #include "ulog_internal.h" static FILE *ufile; +static int ufiletype = -1; void ulog_endutxent(void) @@ -44,56 +48,255 @@ ulog_endutxent(void) ufile = NULL; } -struct ulog_utmpx * -ulog_getutxent(void) -{ - struct futmp ut; - static struct ulog_utmpx utx; +/* + * Conversion from on-disk formats to generic ulog_utmpx structure. + */ - /* Open the utmp file if not already done so. */ - if (ufile == NULL) - ulog_setutxent(); - if (ufile == NULL) - return (NULL); +static void +ulog_futmp_to_utmpx(const struct futmp *ut, struct ulog_utmpx *utx) +{ - if (fread(&ut, sizeof ut, 1, ufile) != 1) - return (NULL); -#define COPY_STRING(field) do { \ - free(utx.ut_ ## field); \ - utx.ut_ ## field = strndup(ut.ut_ ## field, \ - sizeof ut.ut_ ## field); \ - if (utx.ut_ ## field == NULL) \ - utx.ut_ ## field = __DECONST(char *, ""); \ + memset(utx, 0, sizeof *utx); +#define COPY_STRING(field) do { \ + strncpy(utx->ut_ ## field, ut->ut_ ## field, \ + MIN(sizeof utx->ut_ ## field - 1, sizeof ut->ut_ ## field));\ } while (0) COPY_STRING(user); COPY_STRING(line); COPY_STRING(host); - utx.ut_tv.tv_sec = _time32_to_time(ut.ut_time); - utx.ut_tv.tv_usec = 0; -#define MATCH(field, value) (strcmp(utx.ut_ ## field, (value)) == 0) - if (MATCH(user, "date") && MATCH(line, "|")) - utx.ut_type = OLD_TIME; +#undef COPY_STRING +#define MATCH(field, value) (strcmp(utx->ut_ ## field, (value)) == 0) + if (MATCH(user, "reboot") && MATCH(line, "~")) + utx->ut_type = BOOT_TIME; + else if (MATCH(user, "date") && MATCH(line, "|")) + utx->ut_type = OLD_TIME; else if (MATCH(user, "date") && MATCH(line, "{")) - utx.ut_type = NEW_TIME; + utx->ut_type = NEW_TIME; else if (MATCH(user, "shutdown") && MATCH(line, "~")) - utx.ut_type = SHUTDOWN_TIME; - else if (MATCH(user, "reboot") && MATCH(line, "~")) - utx.ut_type = REBOOT_TIME; + utx->ut_type = SHUTDOWN_TIME; else if (MATCH(user, "") && MATCH(host, "")) - utx.ut_type = DEAD_PROCESS; - else if (!MATCH(user, "")) - utx.ut_type = USER_PROCESS; + utx->ut_type = DEAD_PROCESS; + else if (!MATCH(user, "") && !MATCH(line, "") && ut->ut_time != 0) + utx->ut_type = USER_PROCESS; + else + utx->ut_type = EMPTY; + utx->ut_tv.tv_sec = _time32_to_time(ut->ut_time); + utx->ut_tv.tv_usec = 0; +} + +static void +ulog_flastlog_to_utmpx(const struct flastlog *ll, struct ulog_utmpx *utx) +{ + + memset(utx, 0, sizeof *utx); +#define COPY_STRING(field) do { \ + strncpy(utx->ut_ ## field, ll->ll_ ## field, \ + MIN(sizeof utx->ut_ ## field - 1, sizeof ll->ll_ ## field));\ +} while (0) + COPY_STRING(line); + COPY_STRING(host); +#undef COPY_STRING + if (!MATCH(line, "") && ll->ll_time != 0) + utx->ut_type = USER_PROCESS; else - utx.ut_type = EMPTY; - + utx->ut_type = EMPTY; + utx->ut_tv.tv_sec = _time32_to_time(ll->ll_time); + utx->ut_tv.tv_usec = 0; +} + +/* + * File I/O. + */ + +static inline off_t +ulog_tell(void) +{ + + if (ufiletype == UTXF_LASTLOG) + return (ftello(ufile) / sizeof(struct flastlog)); + else + return (ftello(ufile) / sizeof(struct futmp)); +} + +static struct ulog_utmpx * +ulog_read(off_t off, int whence, int resolve_user) +{ + static struct ulog_utmpx utx; + + if (ufile == NULL) + ulog_setutxent(); + if (ufile == NULL) + return (NULL); + + /* Only allow seeking to move forward. */ + if (whence == SEEK_SET && ulog_tell() > off) + return (NULL); + + if (ufiletype == UTXF_LASTLOG) { + struct flastlog ll; + struct passwd *pw = NULL; + uid_t uid; + + if (fseeko(ufile, off * sizeof ll, whence) != 0) + return (NULL); + uid = ulog_tell(); + if (fread(&ll, sizeof ll, 1, ufile) != 1) + return (NULL); + ulog_flastlog_to_utmpx(&ll, &utx); + if (utx.ut_type == USER_PROCESS && resolve_user) + pw = getpwuid(uid); + if (pw != NULL) + strlcpy(utx.ut_user, pw->pw_name, sizeof utx.ut_user); + else + sprintf(utx.ut_user, "%u", (unsigned int)uid); + } else { + struct futmp ut; + + if (fseeko(ufile, off * sizeof(struct futmp), whence) != 0) + return (NULL); + if (fread(&ut, sizeof ut, 1, ufile) != 1) + return (NULL); + ulog_futmp_to_utmpx(&ut, &utx); + } return (&utx); } -void -ulog_setutxent(void) +/* + * getutxent(). + * + * Read the next entry from the file. + */ + +struct ulog_utmpx * +ulog_getutxent(void) +{ + + return ulog_read(0, SEEK_CUR, 1); +} + +/* + * ulog_getutxline(). + * + * Read entries from the file, until reaching an entry which matches the + * provided TTY device name. We can optimize the case for utmp files, + * because they are indexed by TTY device name. + */ + +struct ulog_utmpx * +ulog_getutxline(const struct ulog_utmpx *line) { + struct ulog_utmpx *utx; + + if (ufile == NULL) + ulog_setutxent(); + if (ufile == NULL) + return (NULL); + + if (ufiletype == UTXF_UTMP) { + unsigned int slot; + + slot = ulog_ttyslot(line->ut_line); + if (slot == 0) + return (NULL); + utx = ulog_read(slot, SEEK_SET, 1); + if (utx->ut_type == USER_PROCESS && + strcmp(utx->ut_line, line->ut_line) == 0) + return (utx); + return (NULL); + } else { + for (;;) { + utx = ulog_read(0, SEEK_CUR, 1); + if (utx == NULL) + return (NULL); + if (utx->ut_type == USER_PROCESS && + strcmp(utx->ut_line, line->ut_line) == 0) + return (utx); + } + } +} + +/* + * ulog_getutxuser(). + * + * Read entries from the file, until reaching an entry which matches the + * provided username. We can optimize the case for lastlog files, + * because they are indexed by user ID. + */ + +struct ulog_utmpx * +ulog_getutxuser(const char *user) +{ + struct ulog_utmpx *utx; + + if (ufiletype == UTXF_LASTLOG) { + struct passwd *pw; + + pw = getpwnam(user); + if (pw == NULL) + return (NULL); + utx = ulog_read(pw->pw_uid, SEEK_SET, 0); + if (utx != NULL) + strlcpy(utx->ut_user, user, sizeof utx->ut_user); + return (utx); + } else { + for (;;) { + utx = ulog_read(0, SEEK_CUR, 1); + if (utx == NULL) + return (NULL); + if (utx->ut_type == USER_PROCESS && + strcmp(utx->ut_user, user) == 0) + return (utx); + } + } +} + +/* + * ulog_setutxfile(). + * + * Switch to a different record file. When no filename is provided, the + * system default is opened. + */ + +int +ulog_setutxfile(int type, const char *file) +{ + + /* Supply default files. */ + switch (type) { + case UTXF_UTMP: + if (file == NULL) + file = _PATH_UTMP; + break; + case UTXF_WTMP: + if (file == NULL) + file = _PATH_WTMP; + break; + case UTXF_LASTLOG: + if (file == NULL) + file = _PATH_LASTLOG; + break; + default: + return (-1); + } if (ufile != NULL) fclose(ufile); - ufile = fopen(_PATH_UTMP, "r"); + ufile = fopen(file, "r"); + ufiletype = type; + if (ufile == NULL) + return (-1); + return (0); +} + +/* + * ulog_endutxfile(). + * + * Close any opened files. + */ + +void +ulog_setutxent(void) +{ + + ulog_setutxfile(UTXF_UTMP, NULL); } Modified: head/lib/libulog/ulog_internal.h ============================================================================== --- head/lib/libulog/ulog_internal.h Sat Dec 5 19:44:16 2009 (r200152) +++ head/lib/libulog/ulog_internal.h Sat Dec 5 19:53:29 2009 (r200153) @@ -33,6 +33,8 @@ #include "ulog.h" +unsigned int ulog_ttyslot(const char *); + /* * On-disk format. */ Modified: head/lib/libulog/ulog_login.3 ============================================================================== --- head/lib/libulog/ulog_login.3 Sat Dec 5 19:44:16 2009 (r200152) +++ head/lib/libulog/ulog_login.3 Sat Dec 5 19:53:29 2009 (r200153) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd December 2, 2009 +.Dd December 5, 2009 .Os .Dt ULOG_LOGIN 3 .Sh NAME Modified: head/lib/libulog/ulog_login.c ============================================================================== --- head/lib/libulog/ulog_login.c Sat Dec 5 19:44:16 2009 (r200152) +++ head/lib/libulog/ulog_login.c Sat Dec 5 19:53:29 2009 (r200153) @@ -27,109 +27,48 @@ #include __FBSDID("$FreeBSD$"); -#include -#include +#include #include -#include #include -#include -#include -#include -#include #include "ulog_internal.h" void ulog_login(const char *line, const char *user, const char *host) { - struct futmp fu; - struct flastlog fl; - int fd; + struct ulog_utmpx utx; /* Remove /dev/ component. */ if (strncmp(line, _PATH_DEV, sizeof _PATH_DEV - 1) == 0) line += sizeof _PATH_DEV - 1; - /* Prepare log entries. */ - memset(&fu, 0, sizeof fu); - strlcpy(fu.ut_line, line, sizeof fu.ut_line); - strlcpy(fu.ut_user, user, sizeof fu.ut_user); - if (host != NULL) - strlcpy(fu.ut_host, host, sizeof fu.ut_host); - fu.ut_time = _time_to_time32(time(NULL)); - - fl.ll_time = fu.ut_time; - memcpy(fl.ll_line, fu.ut_line, sizeof fl.ll_line); - memcpy(fl.ll_host, fu.ut_host, sizeof fl.ll_host); - - /* Update utmp entry. */ - if ((fd = open(_PATH_UTMP, O_WRONLY|O_CREAT, 0644)) >= 0) { - struct ttyent *ty; - int idx; - - setttyent(); - for (idx = 1; (ty = getttyent()) != NULL; ++idx) { - if (strcmp(ty->ty_name, line) != 0) - continue; - lseek(fd, (off_t)(idx * sizeof fu), L_SET); - write(fd, &fu, sizeof fu); - break; - } - endttyent(); - close(fd); - } - - /* Add wtmp entry. */ - if ((fd = open(_PATH_WTMP, O_WRONLY|O_APPEND, 0)) >= 0) { - write(fd, &fu, sizeof fu); - close(fd); - } - - /* Update lastlog entry. */ - if ((fd = open(_PATH_LASTLOG, O_WRONLY, 0)) >= 0) { - struct passwd *pw; - - pw = getpwnam(user); - if (pw != NULL) { - lseek(fd, (off_t)(pw->pw_uid * sizeof fl), L_SET); - write(fd, &fl, sizeof fl); - } - close(fd); - } + memset(&utx, 0, sizeof utx); + + /* XXX: ut_id, ut_pid missing. */ + utx.ut_type = USER_PROCESS; + strncpy(utx.ut_line, line, sizeof utx.ut_line); + strncpy(utx.ut_user, user, sizeof utx.ut_user); + strncpy(utx.ut_host, host, sizeof utx.ut_host); + gettimeofday(&utx.ut_tv, NULL); + + ulog_pututxline(&utx); } void ulog_logout(const char *line) { - struct futmp ut; - int fd, found; + struct ulog_utmpx utx; /* Remove /dev/ component. */ if (strncmp(line, _PATH_DEV, sizeof _PATH_DEV - 1) == 0) line += sizeof _PATH_DEV - 1; - /* Mark entry in utmp as logged out. */ - if ((fd = open(_PATH_UTMP, O_RDWR, 0)) < 0) - return; - found = 0; - while (read(fd, &ut, sizeof ut) == sizeof ut) { - if (ut.ut_user[0] == '\0' || - strncmp(ut.ut_line, line, sizeof ut.ut_line) != 0) - continue; - memset(ut.ut_user, 0, sizeof ut.ut_user); - memset(ut.ut_host, 0, sizeof ut.ut_host); - ut.ut_time = _time_to_time32(time(NULL)); - lseek(fd, -(off_t)sizeof ut, L_INCR); - write(fd, &ut, sizeof ut); - found = 1; - } - close(fd); - if (!found) - return; - - /* utmp entry found. Also add logout entry to wtmp. */ - if ((fd = open(_PATH_WTMP, O_WRONLY|O_APPEND, 0)) >= 0) { - write(fd, &ut, sizeof ut); - close(fd); - } + memset(&utx, 0, sizeof utx); + + /* XXX: ut_id, ut_pid missing. ut_line not needed */ + utx.ut_type = DEAD_PROCESS; + strncpy(utx.ut_line, line, sizeof utx.ut_line); + gettimeofday(&utx.ut_tv, NULL); + + ulog_pututxline(&utx); } Added: head/lib/libulog/ulog_pututxline.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libulog/ulog_pututxline.c Sat Dec 5 19:53:29 2009 (r200153) @@ -0,0 +1,208 @@ +/*- + * Copyright (c) 2009 Ed Schouten + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include + +#include "ulog_internal.h" + +static void +ulog_utmpx_to_futmp(const struct ulog_utmpx *utx, struct futmp *ut) +{ + + memset(ut, 0, sizeof *ut); +#define COPY_STRING(field) do { \ + strncpy(ut->ut_ ## field, utx->ut_ ## field, \ + MIN(sizeof ut->ut_ ## field, sizeof utx->ut_ ## field)); \ +} while (0) + switch (utx->ut_type) { + case BOOT_TIME: + strcpy(ut->ut_user, "reboot"); + ut->ut_line[0] = '~'; + break; + case OLD_TIME: + strcpy(ut->ut_user, "date"); + ut->ut_line[0] = '|'; + break; + case NEW_TIME: + strcpy(ut->ut_user, "date"); + ut->ut_line[0] = '{'; + break; + case USER_PROCESS: + COPY_STRING(user); + COPY_STRING(line); + COPY_STRING(host); + break; + case DEAD_PROCESS: + COPY_STRING(line); + break; + case SHUTDOWN_TIME: + strcpy(ut->ut_user, "shutdown"); + ut->ut_line[0] = '~'; + break; + } +#undef COPY_STRING + ut->ut_time = _time_to_time32(utx->ut_tv.tv_sec); +} + +static void +ulog_utmpx_to_flastlog(const struct ulog_utmpx *utx, struct flastlog *ll) +{ + + memset(ll, 0, sizeof *ll); +#define COPY_STRING(field) do { \ + strncpy(ll->ll_ ## field, utx->ut_ ## field, \ + MIN(sizeof ll->ll_ ## field, sizeof utx->ut_ ## field)); \ +} while (0) + switch (utx->ut_type) { + case USER_PROCESS: + COPY_STRING(line); + COPY_STRING(host); + break; + } +#undef COPY_STRING + ll->ll_time = _time_to_time32(utx->ut_tv.tv_sec); +} + +static void +ulog_write_utmp_fast(const struct futmp *ut) +{ + unsigned int idx; + char line[sizeof ut->ut_line + 1]; + int fd; + + if ((fd = open(_PATH_UTMP, O_WRONLY|O_CREAT, 0644)) < 0) + return; + strlcpy(line, ut->ut_line, sizeof line); + idx = ulog_ttyslot(line); + if (idx > 0) { + lseek(fd, (off_t)(idx * sizeof *ut), SEEK_SET); + write(fd, ut, sizeof *ut); + } + close(fd); +} + +static int +ulog_write_utmp_slow(const struct futmp *ut) +{ + struct futmp utf; + int fd, found; + + if ((fd = open(_PATH_UTMP, O_RDWR, 0)) < 0) + return (0); + found = 0; + while (read(fd, &utf, sizeof utf) == sizeof utf) { + if (utf.ut_user[0] == '\0' || + strncmp(utf.ut_line, ut->ut_line, sizeof utf.ut_line) != 0) + continue; + lseek(fd, -(off_t)sizeof utf, SEEK_CUR); + write(fd, &ut, sizeof ut); + found = 1; + } + close(fd); + return (found); +} + +static void +ulog_write_wtmp(const struct futmp *ut) +{ + int fd; + + if ((fd = open(_PATH_WTMP, O_WRONLY|O_APPEND, 0)) < 0) + return; + write(fd, ut, sizeof *ut); + close(fd); +} + +static void +ulog_write_lastlog(const struct flastlog *ll, const char *user) +{ + struct passwd *pw; + int fd; + + if ((fd = open(_PATH_LASTLOG, O_WRONLY, 0)) < 0) + return; + pw = getpwnam(user); + if (pw != NULL) { + lseek(fd, (off_t)(pw->pw_uid * sizeof *ll), SEEK_SET); + write(fd, ll, sizeof *ll); + } + close(fd); +} + +struct ulog_utmpx * +ulog_pututxline(const struct ulog_utmpx *utmpx) +{ + static struct ulog_utmpx utx; + struct futmp ut; + struct flastlog ll; + char user[sizeof utmpx->ut_user + 1]; + + switch (utmpx->ut_type) { + case BOOT_TIME: + case OLD_TIME: + case NEW_TIME: + case SHUTDOWN_TIME: + ulog_utmpx_to_futmp(utmpx, &ut); + + /* Only log to wtmp. */ + ulog_write_wtmp(&ut); + break; + case USER_PROCESS: + ulog_utmpx_to_futmp(utmpx, &ut); + ulog_utmpx_to_flastlog(utmpx, &ll); + + /* Log to utmp, wtmp and lastlog. */ + ulog_write_utmp_fast(&ut); + ulog_write_wtmp(&ut); + strlcpy(user, utmpx->ut_user, sizeof user); + ulog_write_lastlog(&ll, user); + break; + case DEAD_PROCESS: + ulog_utmpx_to_futmp(utmpx, &ut); + + /* Only log to wtmp if logged in utmp. */ + if (ulog_write_utmp_slow(&ut)) + ulog_write_wtmp(&ut); + break; + default: + return (NULL); + } + + /* XXX: Can't we just return utmpx itself? */ + memcpy(&utx, utmpx, sizeof utx); + utx.ut_user[sizeof utx.ut_user - 1] = '\0'; + utx.ut_line[sizeof utx.ut_line - 1] = '\0'; + utx.ut_host[sizeof utx.ut_host - 1] = '\0'; + return (&utx); +} Added: head/lib/libulog/ulog_setutxfile.3 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libulog/ulog_setutxfile.3 Sat Dec 5 19:53:29 2009 (r200153) @@ -0,0 +1,94 @@ +.\" Copyright (c) 2009 Ed Schouten +.\" All rights reserved. *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Sat Dec 5 19:54:37 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 76FA51065696; Sat, 5 Dec 2009 19:54:37 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6657A8FC1B; Sat, 5 Dec 2009 19:54:37 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nB5Jsbpl098108; Sat, 5 Dec 2009 19:54:37 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nB5JsbS5098106; Sat, 5 Dec 2009 19:54:37 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <200912051954.nB5JsbS5098106@svn.freebsd.org> From: Ed Schouten Date: Sat, 5 Dec 2009 19:54:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200154 - head/usr.bin/users X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Dec 2009 19:54:37 -0000 Author: ed Date: Sat Dec 5 19:54:37 2009 New Revision: 200154 URL: http://svn.freebsd.org/changeset/base/200154 Log: Use _ULOG_POSIX_NAMES here, to make eventual porting to easier. By the time we gain a real , it's just a matter of changing the include at the top and -lulog from the Makefile. Modified: head/usr.bin/users/users.c Modified: head/usr.bin/users/users.c ============================================================================== --- head/usr.bin/users/users.c Sat Dec 5 19:53:29 2009 (r200153) +++ head/usr.bin/users/users.c Sat Dec 5 19:54:37 2009 (r200154) @@ -51,6 +51,7 @@ static const char rcsid[] = #include #include #include +#define _ULOG_POSIX_NAMES #include #include @@ -66,7 +67,7 @@ main(int argc, char **argv) int ncnt = 0; int nmax = 0; int cnt; - struct ulog_utmpx *ut; + struct utmpx *ut; int ch; while ((ch = getopt(argc, argv, "")) != -1) @@ -78,8 +79,8 @@ main(int argc, char **argv) argc -= optind; argv += optind; - ulog_setutxent(); - while ((ut = ulog_getutxent()) != NULL) { + setutxent(); + while ((ut = getutxent()) != NULL) { if (ut->ut_type != USER_PROCESS) continue; if (ncnt >= nmax) { @@ -93,7 +94,7 @@ main(int argc, char **argv) (void)strlcpy(names[ncnt], ut->ut_user, sizeof(*names)); ++ncnt; } - ulog_endutxent(); + endutxent(); if (ncnt > 0) { qsort(names, ncnt, sizeof(namebuf), scmp); (void)printf("%s", names[0]); From owner-svn-src-head@FreeBSD.ORG Sat Dec 5 19:55:26 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 737561065676; Sat, 5 Dec 2009 19:55:26 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 49A2F8FC16; Sat, 5 Dec 2009 19:55:26 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nB5JtQ2D098177; Sat, 5 Dec 2009 19:55:26 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nB5JtQCm098175; Sat, 5 Dec 2009 19:55:26 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <200912051955.nB5JtQCm098175@svn.freebsd.org> From: Ed Schouten Date: Sat, 5 Dec 2009 19:55:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200155 - head/usr.bin/users X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Dec 2009 19:55:26 -0000 Author: ed Date: Sat Dec 5 19:55:26 2009 New Revision: 200155 URL: http://svn.freebsd.org/changeset/base/200155 Log: Add WARNS?=6, because it seems to build out of the box. Modified: head/usr.bin/users/Makefile Modified: head/usr.bin/users/Makefile ============================================================================== --- head/usr.bin/users/Makefile Sat Dec 5 19:54:37 2009 (r200154) +++ head/usr.bin/users/Makefile Sat Dec 5 19:55:26 2009 (r200155) @@ -3,6 +3,8 @@ PROG= users +WARNS?= 6 + DPADD= ${LIBULOG} LDADD= -lulog From owner-svn-src-head@FreeBSD.ORG Sat Dec 5 20:05:26 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EC7671065670; Sat, 5 Dec 2009 20:05:25 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C30A38FC0A; Sat, 5 Dec 2009 20:05:25 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nB5K5PaN098415; Sat, 5 Dec 2009 20:05:25 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nB5K5PoZ098412; Sat, 5 Dec 2009 20:05:25 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <200912052005.nB5K5PoZ098412@svn.freebsd.org> From: Ed Schouten Date: Sat, 5 Dec 2009 20:05:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200156 - head/usr.bin/wall X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Dec 2009 20:05:26 -0000 Author: ed Date: Sat Dec 5 20:05:25 2009 New Revision: 200156 URL: http://svn.freebsd.org/changeset/base/200156 Log: Let wall(1) use utmpx. Because our implementation guarantees the strings inside struct utmpx to be null terminated, we don't need to copy everything out, which makes the code nicer to read. Also set WARNS to 6 and add $FreeBSD$ to keep SVN silent. Modified: head/usr.bin/wall/Makefile head/usr.bin/wall/wall.c Modified: head/usr.bin/wall/Makefile ============================================================================== --- head/usr.bin/wall/Makefile Sat Dec 5 19:55:26 2009 (r200155) +++ head/usr.bin/wall/Makefile Sat Dec 5 20:05:25 2009 (r200156) @@ -1,8 +1,14 @@ # @(#)Makefile 8.1 (Berkeley) 6/6/93 +# $FreeBSD$ PROG= wall SRCS= ttymsg.c wall.c BINGRP= tty BINMODE=2555 +WARNS?= 6 + +DPADD= ${LIBULOG} +LDADD= -lulog + .include Modified: head/usr.bin/wall/wall.c ============================================================================== --- head/usr.bin/wall/wall.c Sat Dec 5 19:55:26 2009 (r200155) +++ head/usr.bin/wall/wall.c Sat Dec 5 20:05:25 2009 (r200156) @@ -64,8 +64,9 @@ static const char sccsid[] = "@(#)wall.c #include #include #include +#define _ULOG_POSIX_NAMES +#include #include -#include #include "ttymsg.h" @@ -82,12 +83,12 @@ int mbufsize; char *mbuf; static int -ttystat(char *line, int sz) +ttystat(char *line) { struct stat sb; char ttybuf[MAXPATHLEN]; - (void)snprintf(ttybuf, sizeof(ttybuf), "%s%.*s", _PATH_DEV, sz, line); + (void)snprintf(ttybuf, sizeof(ttybuf), "%s%s", _PATH_DEV, line); if (stat(ttybuf, &sb) == 0) { return (0); } else @@ -98,17 +99,14 @@ int main(int argc, char *argv[]) { struct iovec iov; - struct utmp utmp; + struct utmpx *utmp; int ch; int ingroup; - FILE *fp; struct wallgroup *g; struct group *grp; char **np; const char *p; struct passwd *pw; - char line[sizeof(utmp.ut_line) + 1]; - char username[sizeof(utmp.ut_name) + 1]; (void)setlocale(LC_CTYPE, ""); @@ -145,20 +143,17 @@ main(int argc, char *argv[]) makemsg(*argv); - if (!(fp = fopen(_PATH_UTMP, "r"))) - err(1, "cannot read %s", _PATH_UTMP); iov.iov_base = mbuf; iov.iov_len = mbufsize; /* NOSTRICT */ - while (fread((char *)&utmp, sizeof(utmp), 1, fp) == 1) { - if (!utmp.ut_name[0]) + while ((utmp = getutxent()) != NULL) { + if (utmp->ut_type != USER_PROCESS) continue; - if (ttystat(utmp.ut_line, UT_LINESIZE) != 0) + if (ttystat(utmp->ut_line) != 0) continue; if (grouplist) { ingroup = 0; - strlcpy(username, utmp.ut_name, sizeof(utmp.ut_name)); - pw = getpwnam(username); + pw = getpwnam(utmp->ut_user); if (!pw) continue; for (g = grouplist; g && ingroup == 0; g = g->next) { @@ -168,7 +163,7 @@ main(int argc, char *argv[]) ingroup = 1; else if ((grp = getgrgid(g->gid)) != NULL) { for (np = grp->gr_mem; *np; np++) { - if (strcmp(*np, username) == 0) { + if (strcmp(*np, utmp->ut_user) == 0) { ingroup = 1; break; } @@ -178,9 +173,7 @@ main(int argc, char *argv[]) if (ingroup == 0) continue; } - strncpy(line, utmp.ut_line, sizeof(utmp.ut_line)); - line[sizeof(utmp.ut_line)] = '\0'; - if ((p = ttymsg(&iov, 1, line, 60*5)) != NULL) + if ((p = ttymsg(&iov, 1, utmp->ut_line, 60*5)) != NULL) warnx("%s", p); } exit(0); From owner-svn-src-head@FreeBSD.ORG Sat Dec 5 20:09:50 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 847FB106566B; Sat, 5 Dec 2009 20:09:50 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 739538FC14; Sat, 5 Dec 2009 20:09:50 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nB5K9oCd098580; Sat, 5 Dec 2009 20:09:50 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nB5K9okL098577; Sat, 5 Dec 2009 20:09:50 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <200912052009.nB5K9okL098577@svn.freebsd.org> From: Ed Schouten Date: Sat, 5 Dec 2009 20:09:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200157 - head/bin/date X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Dec 2009 20:09:50 -0000 Author: ed Date: Sat Dec 5 20:09:50 2009 New Revision: 200157 URL: http://svn.freebsd.org/changeset/base/200157 Log: Let date(1) use utmpx instead of logwtmp(). utmpx also has OLD_TIME/NEW_TIME messages, which seem to be intended for the same purpose as how we call logwtmp() here. Modified: head/bin/date/Makefile head/bin/date/date.c Modified: head/bin/date/Makefile ============================================================================== --- head/bin/date/Makefile Sat Dec 5 20:05:25 2009 (r200156) +++ head/bin/date/Makefile Sat Dec 5 20:09:50 2009 (r200157) @@ -3,7 +3,7 @@ PROG= date SRCS= date.c netdate.c vary.c -DPADD= ${LIBUTIL} -LDADD= -lutil +DPADD= ${LIBULOG} +LDADD= -lulog .include Modified: head/bin/date/date.c ============================================================================== --- head/bin/date/date.c Sat Dec 5 20:05:25 2009 (r200156) +++ head/bin/date/date.c Sat Dec 5 20:09:50 2009 (r200157) @@ -48,11 +48,12 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include #include #include +#define _ULOG_POSIX_NAMES +#include #include #include "extern.h" @@ -181,6 +182,7 @@ main(int argc, char *argv[]) static void setthetime(const char *fmt, const char *p, int jflag, int nflag) { + struct utmpx utx; struct tm *lt; struct timeval tv; const char *dot, *t; @@ -271,12 +273,16 @@ setthetime(const char *fmt, const char * if (!jflag) { /* set the time */ if (nflag || netsettime(tval)) { - logwtmp("|", "date", ""); + utx.ut_type = OLD_TIME; + gettimeofday(&utx.ut_tv, NULL); + pututxline(&utx); tv.tv_sec = tval; tv.tv_usec = 0; if (settimeofday(&tv, (struct timezone *)NULL)) err(1, "settimeofday (timeval)"); - logwtmp("{", "date", ""); + utx.ut_type = NEW_TIME; + gettimeofday(&utx.ut_tv, NULL); + pututxline(&utx); } if ((p = getlogin()) == NULL) From owner-svn-src-head@FreeBSD.ORG Sat Dec 5 20:16:28 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D44B8106566B; Sat, 5 Dec 2009 20:16:28 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A946A8FC15; Sat, 5 Dec 2009 20:16:28 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nB5KGScG098743; Sat, 5 Dec 2009 20:16:28 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nB5KGSqw098741; Sat, 5 Dec 2009 20:16:28 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <200912052016.nB5KGSqw098741@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Sat, 5 Dec 2009 20:16:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200158 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Dec 2009 20:16:28 -0000 Author: pjd Date: Sat Dec 5 20:16:28 2009 New Revision: 200158 URL: http://svn.freebsd.org/changeset/base/200158 Log: We have to eventually look for provider without checking guid as this is need for attaching when there is no metadata yet. Before r200125 the order of looking for providers was wrong. It was: 1. Find provider by name. 2. Find provider by guid. 3. Find provider by name and guid. Where it should have been: 1. Find provider by name and guid. 2. Find provider by guid. 3. Find provider by name. MFC after: 1 week Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Sat Dec 5 20:09:50 2009 (r200157) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Sat Dec 5 20:16:28 2009 (r200158) @@ -453,7 +453,7 @@ vdev_geom_open_by_guid(vdev_t *vd) } static struct g_consumer * -vdev_geom_open_by_path(vdev_t *vd) +vdev_geom_open_by_path(vdev_t *vd, int check_guid) { struct g_provider *pp; struct g_consumer *cp; @@ -465,7 +465,7 @@ vdev_geom_open_by_path(vdev_t *vd) if (pp != NULL) { ZFS_LOG(1, "Found provider by name %s.", vd->vdev_path); cp = vdev_geom_attach(pp, !!(spa_mode & FWRITE)); - if (cp != NULL) { + if (cp != NULL && check_guid) { g_topology_unlock(); guid = vdev_geom_read_guid(cp); g_topology_lock(); @@ -506,7 +506,7 @@ vdev_geom_open(vdev_t *vd, uint64_t *psi if ((owned = mtx_owned(&Giant))) mtx_unlock(&Giant); - cp = vdev_geom_open_by_path(vd); + cp = vdev_geom_open_by_path(vd, 1); if (cp == NULL) { /* * The device at vd->vdev_path doesn't have the expected guid. @@ -515,6 +515,8 @@ vdev_geom_open(vdev_t *vd, uint64_t *psi */ cp = vdev_geom_open_by_guid(vd); } + if (cp == NULL) + cp = vdev_geom_open_by_path(vd, 0); if (cp == NULL) { ZFS_LOG(1, "Provider %s not found.", vd->vdev_path); vd->vdev_stat.vs_aux = VDEV_AUX_OPEN_FAILED; From owner-svn-src-head@FreeBSD.ORG Sat Dec 5 20:22:26 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 81A771065670; Sat, 5 Dec 2009 20:22:26 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7055E8FC08; Sat, 5 Dec 2009 20:22:26 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nB5KMQwR098956; Sat, 5 Dec 2009 20:22:26 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nB5KMQNJ098953; Sat, 5 Dec 2009 20:22:26 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <200912052022.nB5KMQNJ098953@svn.freebsd.org> From: Ed Schouten Date: Sat, 5 Dec 2009 20:22:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200160 - head/usr.bin/write X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Dec 2009 20:22:26 -0000 Author: ed Date: Sat Dec 5 20:22:26 2009 New Revision: 200160 URL: http://svn.freebsd.org/changeset/base/200160 Log: Let wall(1) use utmpx. Because our implementation guarantees the strings inside struct utmpx to be null terminated, we don't need to copy everything out, which makes the code nicer to read. Also set WARNS to 6 and add $FreeBSD$ to keep SVN happy. Modified: head/usr.bin/write/Makefile head/usr.bin/write/write.c Modified: head/usr.bin/write/Makefile ============================================================================== --- head/usr.bin/write/Makefile Sat Dec 5 20:17:04 2009 (r200159) +++ head/usr.bin/write/Makefile Sat Dec 5 20:22:26 2009 (r200160) @@ -1,7 +1,13 @@ # @(#)Makefile 8.1 (Berkeley) 6/6/93 +# $FreeBSD$ PROG= write BINMODE=2555 BINGRP= tty +WARNS?= 6 + +DPADD= ${LIBULOG} +LDADD= -lulog + .include Modified: head/usr.bin/write/write.c ============================================================================== --- head/usr.bin/write/write.c Sat Dec 5 20:17:04 2009 (r200159) +++ head/usr.bin/write/write.c Sat Dec 5 20:22:26 2009 (r200160) @@ -62,8 +62,9 @@ __FBSDID("$FreeBSD$"); #include #include #include +#define _ULOG_POSIX_NAMES +#include #include -#include void done(int); void do_write(char *, char *, uid_t); @@ -146,20 +147,17 @@ usage(void) int utmp_chk(char *user, char *tty) { - struct utmp u; - int ufd; + struct utmpx lu, *u; - if ((ufd = open(_PATH_UTMP, O_RDONLY)) < 0) - return(0); /* ignore error, shouldn't happen anyway */ - - while (read(ufd, (char *) &u, sizeof(u)) == sizeof(u)) - if (strncmp(user, u.ut_name, sizeof(u.ut_name)) == 0 && - strncmp(tty, u.ut_line, sizeof(u.ut_line)) == 0) { - (void)close(ufd); + strncpy(lu.ut_line, tty, sizeof lu.ut_line); + setutxent(); + while ((u = getutxline(&lu)) != NULL) + if (u->ut_type == USER_PROCESS && + strcmp(user, u->ut_user) == 0) { + endutxent(); return(0); } - - (void)close(ufd); + endutxent(); return(1); } @@ -177,43 +175,40 @@ utmp_chk(char *user, char *tty) void search_utmp(char *user, char *tty, char *mytty, uid_t myuid) { - struct utmp u; + struct utmpx *u; time_t bestatime, atime; - int ufd, nloggedttys, nttys, msgsok, user_is_me; - char atty[UT_LINESIZE + 1]; - - if ((ufd = open(_PATH_UTMP, O_RDONLY)) < 0) - err(1, "utmp"); + int nloggedttys, nttys, msgsok, user_is_me; nloggedttys = nttys = 0; bestatime = 0; user_is_me = 0; - while (read(ufd, (char *) &u, sizeof(u)) == sizeof(u)) - if (strncmp(user, u.ut_name, sizeof(u.ut_name)) == 0) { + + setutxent(); + while ((u = getutxent()) != NULL) + if (u->ut_type == USER_PROCESS && + strcmp(user, u->ut_user) == 0) { ++nloggedttys; - (void)strncpy(atty, u.ut_line, UT_LINESIZE); - atty[UT_LINESIZE] = '\0'; - if (term_chk(atty, &msgsok, &atime, 0)) + if (term_chk(u->ut_line, &msgsok, &atime, 0)) continue; /* bad term? skip */ if (myuid && !msgsok) continue; /* skip ttys with msgs off */ - if (strcmp(atty, mytty) == 0) { + if (strcmp(u->ut_line, mytty) == 0) { user_is_me = 1; continue; /* don't write to yourself */ } ++nttys; if (atime > bestatime) { bestatime = atime; - (void)strcpy(tty, atty); + (void)strlcpy(tty, u->ut_line, MAXPATHLEN); } } + endutxent(); - (void)close(ufd); if (nloggedttys == 0) errx(1, "%s is not logged in", user); if (nttys == 0) { if (user_is_me) { /* ok, so write to yourself! */ - (void)strcpy(tty, mytty); + (void)strlcpy(tty, mytty, MAXPATHLEN); return; } errx(1, "%s has messages disabled", user); From owner-svn-src-head@FreeBSD.ORG Sat Dec 5 20:26:56 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DA63110656AE; Sat, 5 Dec 2009 20:26:55 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C930F8FC18; Sat, 5 Dec 2009 20:26:55 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nB5KQtUX099121; Sat, 5 Dec 2009 20:26:55 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nB5KQtH6099116; Sat, 5 Dec 2009 20:26:55 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <200912052026.nB5KQtH6099116@svn.freebsd.org> From: Ed Schouten Date: Sat, 5 Dec 2009 20:26:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200161 - in head/sbin: init reboot X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Dec 2009 20:26:56 -0000 Author: ed Date: Sat Dec 5 20:26:55 2009 New Revision: 200161 URL: http://svn.freebsd.org/changeset/base/200161 Log: Let init(8) and reboot(8) use utmpx to log wtmp entries. logwtmp() gets called with the raw strings that are written to disk. For regular user entries, this isn't too bad, but when booting/shutting down, the contents get rather cryptic. Just call the standardized pututxline(). Modified: head/sbin/init/Makefile head/sbin/init/init.c head/sbin/reboot/Makefile head/sbin/reboot/reboot.c Modified: head/sbin/init/Makefile ============================================================================== --- head/sbin/init/Makefile Sat Dec 5 20:22:26 2009 (r200160) +++ head/sbin/init/Makefile Sat Dec 5 20:26:55 2009 (r200161) @@ -6,8 +6,8 @@ MAN= init.8 PRECIOUSPROG= INSTALLFLAGS=-b -B.bak CFLAGS+=-DDEBUGSHELL -DSECURE -DLOGIN_CAP -DCOMPAT_SYSV_INIT -DPADD= ${LIBUTIL} ${LIBCRYPT} -LDADD= -lutil -lcrypt +DPADD= ${LIBUTIL} ${LIBULOG} ${LIBCRYPT} +LDADD= -lutil -lulog -lcrypt NO_SHARED?= YES Modified: head/sbin/init/init.c ============================================================================== --- head/sbin/init/init.c Sat Dec 5 20:22:26 2009 (r200160) +++ head/sbin/init/init.c Sat Dec 5 20:26:55 2009 (r200161) @@ -65,6 +65,8 @@ static const char rcsid[] = #include #include #include +#define _ULOG_POSIX_NAMES +#include #include #include #include @@ -569,10 +571,8 @@ transition(state_t s) static void clear_session_logs(session_t *sp) { - char *line = sp->se_device + sizeof(_PATH_DEV) - 1; - if (logout(line)) - logwtmp(line, "", ""); + ulog_logout(sp->se_device); } /* @@ -775,6 +775,7 @@ single_user(void) static state_func_t runcom(void) { + struct utmpx utx; state_func_t next_transition; if ((next_transition = run_script(_PATH_RUNCOM)) != 0) @@ -782,7 +783,9 @@ runcom(void) runcom_mode = AUTOBOOT; /* the default */ /* NB: should send a message to the session logger to avoid blocking. */ - logwtmp("~", "reboot", ""); + utx.ut_type = BOOT_TIME; + gettimeofday(&utx.ut_tv, NULL); + pututxline(&utx); return (state_func_t) read_ttys; } @@ -1487,13 +1490,16 @@ alrm_handler(int sig) static state_func_t death(void) { + struct utmpx utx; session_t *sp; int i; pid_t pid; static const int death_sigs[2] = { SIGTERM, SIGKILL }; /* NB: should send a message to the session logger to avoid blocking. */ - logwtmp("~", "shutdown", ""); + utx.ut_type = SHUTDOWN_TIME; + gettimeofday(&utx.ut_tv, NULL); + pututxline(&utx); /* * Also revoke the TTY here. Because runshutdown() may reopen Modified: head/sbin/reboot/Makefile ============================================================================== --- head/sbin/reboot/Makefile Sat Dec 5 20:22:26 2009 (r200160) +++ head/sbin/reboot/Makefile Sat Dec 5 20:26:55 2009 (r200161) @@ -2,8 +2,8 @@ # $FreeBSD$ PROG= reboot -DPADD= ${LIBUTIL} -LDADD= -lutil +DPADD= ${LIBULOG} +LDADD= -lulog MAN= reboot.8 nextboot.8 MLINKS= reboot.8 halt.8 reboot.8 fastboot.8 reboot.8 fasthalt.8 Modified: head/sbin/reboot/reboot.c ============================================================================== --- head/sbin/reboot/reboot.c Sat Dec 5 20:22:26 2009 (r200160) +++ head/sbin/reboot/reboot.c Sat Dec 5 20:26:55 2009 (r200161) @@ -42,18 +42,20 @@ static char sccsid[] = "@(#)reboot.c 8.1 __FBSDID("$FreeBSD$"); #include +#include #include #include #include #include #include #include -#include #include #include #include #include #include +#define _ULOG_POSIX_NAMES +#include #include static void usage(void); @@ -64,6 +66,7 @@ int dohalt; int main(int argc, char *argv[]) { + struct utmpx utx; const struct passwd *pw; int ch, howto, i, fd, lflag, nflag, qflag, sverrno; u_int pageins; @@ -140,7 +143,9 @@ main(int argc, char *argv[]) syslog(LOG_CRIT, "rebooted by %s", user); } } - logwtmp("~", "shutdown", ""); + utx.ut_type = SHUTDOWN_TIME; + gettimeofday(&utx.ut_tv, NULL); + pututxline(&utx); /* * Do a sync early on, so disks start transfers while we're off From owner-svn-src-head@FreeBSD.ORG Sat Dec 5 20:36:42 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DFDBB106566C; Sat, 5 Dec 2009 20:36:42 +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 CE4EA8FC0C; Sat, 5 Dec 2009 20:36:42 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nB5KagZ5099371; Sat, 5 Dec 2009 20:36:42 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nB5Kaghv099369; Sat, 5 Dec 2009 20:36:42 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <200912052036.nB5Kaghv099369@svn.freebsd.org> From: Konstantin Belousov Date: Sat, 5 Dec 2009 20:36:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200162 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Dec 2009 20:36:43 -0000 Author: kib Date: Sat Dec 5 20:36:42 2009 New Revision: 200162 URL: http://svn.freebsd.org/changeset/base/200162 Log: Change VOP_FSYNC for zfs vnode from VOP_PANIC to zfs_freebsd_fsync(), both to not panic when fsync(2) is called for fifo on zfs filedescriptor, and to actually fsync fifo inode to permanent storage. PR: kern/141177 Reviewed by: pjd MFC after: 1 week Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Sat Dec 5 20:26:55 2009 (r200161) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Sat Dec 5 20:36:42 2009 (r200162) @@ -5009,7 +5009,7 @@ struct vop_vector zfs_vnodeops = { struct vop_vector zfs_fifoops = { .vop_default = &fifo_specops, - .vop_fsync = VOP_PANIC, + .vop_fsync = zfs_freebsd_fsync, .vop_access = zfs_freebsd_access, .vop_getattr = zfs_freebsd_getattr, .vop_inactive = zfs_freebsd_inactive, From owner-svn-src-head@FreeBSD.ORG Sat Dec 5 20:44:19 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CD1D8106566B; Sat, 5 Dec 2009 20:44:19 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BB8F58FC22; Sat, 5 Dec 2009 20:44:19 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nB5KiJBO099795; Sat, 5 Dec 2009 20:44:19 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nB5KiJPa099792; Sat, 5 Dec 2009 20:44:19 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <200912052044.nB5KiJPa099792@svn.freebsd.org> From: Ed Schouten Date: Sat, 5 Dec 2009 20:44:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200166 - head/usr.bin/who X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Dec 2009 20:44:19 -0000 Author: ed Date: Sat Dec 5 20:44:19 2009 New Revision: 200166 URL: http://svn.freebsd.org/changeset/base/200166 Log: Port who(1) to utmpx. (Un)fortunately there is no standardized interface to switch between utmp database files, so we must call ulog_setutxfile() here. I'm also changing the column widths to magic numbers here. Display layout should in this case not be derived from structure fields sizes. Because I don't want struct utmpx ever to become too small, the fields are too big to reserve all the space. Modified: head/usr.bin/who/Makefile head/usr.bin/who/who.c Modified: head/usr.bin/who/Makefile ============================================================================== --- head/usr.bin/who/Makefile Sat Dec 5 20:43:15 2009 (r200165) +++ head/usr.bin/who/Makefile Sat Dec 5 20:44:19 2009 (r200166) @@ -1,5 +1,11 @@ # @(#)Makefile 8.1 (Berkeley) 6/6/93 +# $FreeBSD$ PROG= who +WARNS= 6 + +DPADD= ${LIBULOG} +LDADD= -lulog + .include Modified: head/usr.bin/who/who.c ============================================================================== --- head/usr.bin/who/who.c Sat Dec 5 20:43:15 2009 (r200165) +++ head/usr.bin/who/who.c Sat Dec 5 20:44:19 2009 (r200166) @@ -44,16 +44,17 @@ __FBSDID("$FreeBSD$"); #include #include #include +#define _ULOG_POSIX_NAMES +#include #include -#include static void heading(void); -static void process_utmp(FILE *); -static void quick(FILE *); -static void row(struct utmp *); +static void process_utmp(void); +static void quick(void); +static void row(struct utmpx *); static int ttywidth(void); static void usage(void); -static void whoami(FILE *); +static void whoami(void); static int Hflag; /* Write column headings */ static int mflag; /* Show info about current terminal */ @@ -66,8 +67,6 @@ int main(int argc, char *argv[]) { int ch; - const char *file; - FILE *fp; setlocale(LC_TIME, ""); @@ -109,27 +108,25 @@ main(int argc, char *argv[]) if (argc > 1) usage(); - if (*argv != NULL) - file = *argv; - else - file = _PATH_UTMP; - if ((fp = fopen(file, "r")) == NULL) - err(1, "%s", file); + if (*argv != NULL) { + if (ulog_setutxfile(UTXF_UTMP, *argv) != 0) + err(1, "%s", *argv); + } if (qflag) - quick(fp); + quick(); else { if (sflag) Tflag = uflag = 0; if (Hflag) heading(); if (mflag) - whoami(fp); + whoami(); else - process_utmp(fp); + process_utmp(); } - fclose(fp); + endutxent(); exit(0); } @@ -146,21 +143,19 @@ static void heading(void) { - printf("%-*s ", UT_NAMESIZE, "NAME"); + printf("%-16s ", "NAME"); if (Tflag) printf("S "); - printf("%-*s ", UT_LINESIZE, "LINE"); - printf("%-*s ", 12, "TIME"); + printf("%-8s %-12s ", "LINE", "TIME"); if (uflag) printf("IDLE "); - printf("%-*s", UT_HOSTSIZE, "FROM"); - putchar('\n'); + printf("%-16s\n", "FROM"); } static void -row(struct utmp *ut) +row(struct utmpx *ut) { - char buf[80], tty[sizeof(_PATH_DEV) + UT_LINESIZE]; + char buf[80], tty[PATH_MAX]; struct stat sb; time_t idle, t; static int d_first = -1; @@ -173,8 +168,7 @@ row(struct utmp *ut) state = '?'; idle = 0; if (Tflag || uflag) { - snprintf(tty, sizeof(tty), "%s%.*s", _PATH_DEV, - UT_LINESIZE, ut->ut_line); + snprintf(tty, sizeof(tty), "%s%s", _PATH_DEV, ut->ut_line); if (stat(tty, &sb) == 0) { state = sb.st_mode & (S_IWOTH|S_IWGRP) ? '+' : '-'; @@ -182,11 +176,11 @@ row(struct utmp *ut) } } - printf("%-*.*s ", UT_NAMESIZE, UT_NAMESIZE, ut->ut_name); + printf("%-16s ", ut->ut_user); if (Tflag) printf("%c ", state); - printf("%-*.*s ", UT_LINESIZE, UT_LINESIZE, ut->ut_line); - t = _time32_to_time(ut->ut_time); + printf("%-8s ", ut->ut_line); + t = ut->ut_tv.tv_sec; tm = localtime(&t); strftime(buf, sizeof(buf), d_first ? "%e %b %R" : "%b %e %R", tm); printf("%-*s ", 12, buf); @@ -200,17 +194,17 @@ row(struct utmp *ut) printf(" old "); } if (*ut->ut_host != '\0') - printf("(%.*s)", UT_HOSTSIZE, ut->ut_host); + printf("(%s)", ut->ut_host); putchar('\n'); } static int -ttystat(char *line, int sz) +ttystat(char *line) { struct stat sb; char ttybuf[MAXPATHLEN]; - (void)snprintf(ttybuf, sizeof(ttybuf), "%s%.*s", _PATH_DEV, sz, line); + (void)snprintf(ttybuf, sizeof(ttybuf), "%s%s", _PATH_DEV, line); if (stat(ttybuf, &sb) == 0) { return (0); } else @@ -218,32 +212,32 @@ ttystat(char *line, int sz) } static void -process_utmp(FILE *fp) +process_utmp(void) { - struct utmp ut; + struct utmpx *utx; - while (fread(&ut, sizeof(ut), 1, fp) == 1) { - if (*ut.ut_name == '\0') + while ((utx = getutxent()) != NULL) { + if (utx->ut_type != USER_PROCESS) continue; - if (ttystat(ut.ut_line, UT_LINESIZE) != 0) + if (ttystat(utx->ut_line) != 0) continue; - row(&ut); + row(utx); } } static void -quick(FILE *fp) +quick(void) { - struct utmp ut; + struct utmpx *utx; int col, ncols, num; ncols = ttywidth(); col = num = 0; - while (fread(&ut, sizeof(ut), 1, fp) == 1) { - if (*ut.ut_name == '\0') + while ((utx = getutxent()) != NULL) { + if (utx->ut_type != USER_PROCESS) continue; - printf("%-*.*s", UT_NAMESIZE, UT_NAMESIZE, ut.ut_name); - if (++col < ncols / (UT_NAMESIZE + 1)) + printf("%-16s", utx->ut_user); + if (++col < ncols / (16 + 1)) putchar(' '); else { col = 0; @@ -258,24 +252,23 @@ quick(FILE *fp) } static void -whoami(FILE *fp) +whoami(void) { - struct utmp ut; + struct utmpx ut, *utx; struct passwd *pwd; - const char *name, *p, *tty; + const char *name, *tty; if ((tty = ttyname(STDIN_FILENO)) == NULL) tty = "tty??"; - else if ((p = strrchr(tty, '/')) != NULL) - tty = p + 1; + else if (strncmp(tty, _PATH_DEV, sizeof _PATH_DEV - 1) == 0) + tty += sizeof _PATH_DEV - 1; + strlcpy(ut.ut_line, tty, sizeof ut.ut_line); /* Search utmp for our tty, dump first matching record. */ - while (fread(&ut, sizeof(ut), 1, fp) == 1) - if (*ut.ut_name != '\0' && strncmp(ut.ut_line, tty, - UT_LINESIZE) == 0) { - row(&ut); - return; - } + if ((utx = getutxline(&ut)) != NULL && utx->ut_type == USER_PROCESS) { + row(utx); + return; + } /* Not found; fill the utmp structure with the information we have. */ memset(&ut, 0, sizeof(ut)); @@ -283,9 +276,8 @@ whoami(FILE *fp) name = pwd->pw_name; else name = "?"; - strncpy(ut.ut_name, name, UT_NAMESIZE); - strncpy(ut.ut_line, tty, UT_LINESIZE); - ut.ut_time = _time_to_time32(time(NULL)); + strlcpy(ut.ut_user, name, sizeof ut.ut_user); + gettimeofday(&ut.ut_tv, NULL); row(&ut); } From owner-svn-src-head@FreeBSD.ORG Sat Dec 5 20:52:12 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 983EF1065670; Sat, 5 Dec 2009 20:52:12 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6DFF28FC12; Sat, 5 Dec 2009 20:52:12 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nB5KqCNa099975; Sat, 5 Dec 2009 20:52:12 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nB5KqCbZ099972; Sat, 5 Dec 2009 20:52:12 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <200912052052.nB5KqCbZ099972@svn.freebsd.org> From: Ed Schouten Date: Sat, 5 Dec 2009 20:52:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200167 - head/usr.bin/systat X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Dec 2009 20:52:12 -0000 Author: ed Date: Sat Dec 5 20:52:11 2009 New Revision: 200167 URL: http://svn.freebsd.org/changeset/base/200167 Log: Let systat's vmstat use utmpx. Modified: head/usr.bin/systat/Makefile head/usr.bin/systat/vmstat.c Modified: head/usr.bin/systat/Makefile ============================================================================== --- head/usr.bin/systat/Makefile Sat Dec 5 20:44:19 2009 (r200166) +++ head/usr.bin/systat/Makefile Sat Dec 5 20:52:11 2009 (r200167) @@ -14,7 +14,7 @@ SRCS+= icmp6.c ip6.c CFLAGS+= -DINET6 .endif -DPADD= ${LIBCURSES} ${LIBM} ${LIBDEVSTAT} ${LIBKVM} -LDADD= -lcursesw -lm -ldevstat -lkvm +DPADD= ${LIBCURSES} ${LIBM} ${LIBDEVSTAT} ${LIBKVM} ${LIBULOG} +LDADD= -lcursesw -lm -ldevstat -lkvm -lulog .include Modified: head/usr.bin/systat/vmstat.c ============================================================================== --- head/usr.bin/systat/vmstat.c Sat Dec 5 20:44:19 2009 (r200166) +++ head/usr.bin/systat/vmstat.c Sat Dec 5 20:52:11 2009 (r200167) @@ -65,8 +65,9 @@ static const char sccsid[] = "@(#)vmstat #include #include #include +#define _ULOG_POSIX_NAMES +#include #include -#include #include #include "systat.h" #include "extern.h" @@ -141,7 +142,6 @@ static void putlongdouble(long double, i static int ucount(void); static int ncpu; -static int ut; static char buf[26]; static time_t t; static double etime; @@ -150,16 +150,10 @@ static long *intrloc; static char **intrname; static int nextintsrow; -struct utmp utmp; - - WINDOW * openkre(void) { - ut = open(_PATH_UTMP, O_RDONLY); - if (ut < 0) - error("No utmp"); return (stdscr); } @@ -167,7 +161,6 @@ void closekre(WINDOW *w) { - (void) close(ut); if (w == NULL) return; wclear(w); @@ -634,14 +627,14 @@ static int ucount(void) { int nusers = 0; + struct utmpx *ut; - if (ut < 0) - return (0); - while (read(ut, &utmp, sizeof(utmp))) - if (utmp.ut_name[0] != '\0') + setutxent(); + while ((ut = getutxent()) != NULL) + if (ut->ut_type == USER_PROCESS) nusers++; + endutxent(); - lseek(ut, 0L, L_SET); return (nusers); } From owner-svn-src-head@FreeBSD.ORG Sat Dec 5 23:23:46 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 750AC1065670; Sat, 5 Dec 2009 23:23:46 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 645768FC17; Sat, 5 Dec 2009 23:23:46 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nB5NNk64003115; Sat, 5 Dec 2009 23:23:46 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nB5NNkcC003113; Sat, 5 Dec 2009 23:23:46 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <200912052323.nB5NNkcC003113@svn.freebsd.org> From: Ed Schouten Date: Sat, 5 Dec 2009 23:23:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200169 - head/rescue/rescue X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Dec 2009 23:23:46 -0000 Author: ed Date: Sat Dec 5 23:23:46 2009 New Revision: 200169 URL: http://svn.freebsd.org/changeset/base/200169 Log: Unbreak rescue(8). We should also link against libulog now. Modified: head/rescue/rescue/Makefile Modified: head/rescue/rescue/Makefile ============================================================================== --- head/rescue/rescue/Makefile Sat Dec 5 21:50:06 2009 (r200168) +++ head/rescue/rescue/Makefile Sat Dec 5 23:23:46 2009 (r200169) @@ -72,7 +72,7 @@ CRUNCH_SRCDIRS+= bin CRUNCH_PROGS_bin= cat chflags chio chmod cp date dd df echo \ ed expr getfacl hostname kenv kill ln ls mkdir mv \ pkill ps pwd realpath rm rmdir setfacl sh stty sync test -CRUNCH_LIBS+= -lcrypt -ledit -lkvm -ll -ltermcap -lutil +CRUNCH_LIBS+= -lcrypt -ledit -lkvm -ll -ltermcap -lulog -lutil # Additional options for specific programs CRUNCH_ALIAS_test= [ From owner-svn-src-head@FreeBSD.ORG Sat Dec 5 23:27:21 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9BEC5106566C; Sat, 5 Dec 2009 23:27:21 +0000 (UTC) (envelope-from oleg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8AE508FC18; Sat, 5 Dec 2009 23:27:21 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nB5NRLuh003223; Sat, 5 Dec 2009 23:27:21 GMT (envelope-from oleg@svn.freebsd.org) Received: (from oleg@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nB5NRLOr003221; Sat, 5 Dec 2009 23:27:21 GMT (envelope-from oleg@svn.freebsd.org) Message-Id: <200912052327.nB5NRLOr003221@svn.freebsd.org> From: Oleg Bulyzhin Date: Sat, 5 Dec 2009 23:27:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200170 - head/sys/netinet/ipfw X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Dec 2009 23:27:21 -0000 Author: oleg Date: Sat Dec 5 23:27:21 2009 New Revision: 200170 URL: http://svn.freebsd.org/changeset/base/200170 Log: Fix burst processing for WF2Q pipes - do not increase available burst size unless pipe is idle. This should fix follwing issues: - 'dummynet: OUCH! pipe should have been idle!' log messages. - exceeding configured pipe bandwidth. MFC after: 1 week Modified: head/sys/netinet/ipfw/ip_dummynet.c Modified: head/sys/netinet/ipfw/ip_dummynet.c ============================================================================== --- head/sys/netinet/ipfw/ip_dummynet.c Sat Dec 5 23:23:46 2009 (r200169) +++ head/sys/netinet/ipfw/ip_dummynet.c Sat Dec 5 23:27:21 2009 (r200170) @@ -1447,7 +1447,9 @@ dummynet_io(struct mbuf **m0, int dir, s q->numbytes += pipe->bandwidth; } } else { /* WF2Q. */ - if (pipe->idle_time < curr_time) { + if (pipe->idle_time < curr_time && + pipe->scheduler_heap.elements == 0 && + pipe->not_eligible_heap.elements == 0) { /* Calculate available burst size. */ pipe->numbytes += (curr_time - pipe->idle_time - 1) * pipe->bandwidth;