From owner-svn-src-stable-7@FreeBSD.ORG Mon Jul 12 17:50:39 2010 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 58B711065670; Mon, 12 Jul 2010 17:50:39 +0000 (UTC) (envelope-from remko@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 47B678FC1C; Mon, 12 Jul 2010 17:50:39 +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 o6CHodUF068249; Mon, 12 Jul 2010 17:50:39 GMT (envelope-from remko@svn.freebsd.org) Received: (from remko@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o6CHodiT068246; Mon, 12 Jul 2010 17:50:39 GMT (envelope-from remko@svn.freebsd.org) Message-Id: <201007121750.o6CHodiT068246@svn.freebsd.org> From: Remko Lodder Date: Mon, 12 Jul 2010 17:50:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r209953 - stable/7/sys/dev/ichwd X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Jul 2010 17:50:39 -0000 Author: remko Date: Mon Jul 12 17:50:38 2010 New Revision: 209953 URL: http://svn.freebsd.org/changeset/base/209953 Log: MFC r202917 Add support for the NM10 chipset. PR: kern/143118 Submitted by: Koshin sumitani Approved by: imp (mentor, implicit) MFC after: 3 days Modified: stable/7/sys/dev/ichwd/ichwd.c stable/7/sys/dev/ichwd/ichwd.h Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/dev/ichwd/ichwd.c ============================================================================== --- stable/7/sys/dev/ichwd/ichwd.c Mon Jul 12 17:46:19 2010 (r209952) +++ stable/7/sys/dev/ichwd/ichwd.c Mon Jul 12 17:50:38 2010 (r209953) @@ -93,6 +93,7 @@ static struct ichwd_device ichwd_devices { DEVICEID_ICH7DH, "Intel ICH7DH watchdog timer", 7 }, { DEVICEID_ICH7M, "Intel ICH7M watchdog timer", 7 }, { DEVICEID_ICH7MDH, "Intel ICH7MDH watchdog timer", 7 }, + { DEVICEID_NM10, "Intel NM10 watchdog timer", 7 }, { DEVICEID_ICH8, "Intel ICH8 watchdog timer", 8 }, { DEVICEID_ICH8DH, "Intel ICH8DH watchdog timer", 8 }, { DEVICEID_ICH8DO, "Intel ICH8DO watchdog timer", 8 }, Modified: stable/7/sys/dev/ichwd/ichwd.h ============================================================================== --- stable/7/sys/dev/ichwd/ichwd.h Mon Jul 12 17:46:19 2010 (r209952) +++ stable/7/sys/dev/ichwd/ichwd.h Mon Jul 12 17:50:38 2010 (r209953) @@ -83,6 +83,7 @@ struct ichwd_softc { #define DEVICEID_ICH7 0x27b8 #define DEVICEID_ICH7DH 0x27b0 #define DEVICEID_ICH7M 0x27b9 +#define DEVICEID_NM10 0x27bc #define DEVICEID_ICH7MDH 0x27bd #define DEVICEID_ICH8 0x2810 #define DEVICEID_ICH8DH 0x2812 From owner-svn-src-stable-7@FreeBSD.ORG Tue Jul 13 02:45:19 2010 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A6066106566B; Tue, 13 Jul 2010 02:45:19 +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 914DA8FC1A; Tue, 13 Jul 2010 02:45: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 o6D2jJhu091943; Tue, 13 Jul 2010 02:45:19 GMT (envelope-from cperciva@svn.freebsd.org) Received: (from cperciva@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o6D2jJQK091941; Tue, 13 Jul 2010 02:45:19 GMT (envelope-from cperciva@svn.freebsd.org) Message-Id: <201007130245.o6D2jJQK091941@svn.freebsd.org> From: Colin Percival Date: Tue, 13 Jul 2010 02:45:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r209964 - head/sys/kern releng/7.1 releng/7.1/sys/conf releng/7.1/sys/kern releng/7.3 releng/7.3/sys/conf releng/7.3/sys/kern releng/8.0 releng/8.0/sys/conf releng/8.0/sys/kern releng/8... X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Jul 2010 02:45:19 -0000 Author: cperciva Date: Tue Jul 13 02:45:17 2010 New Revision: 209964 URL: http://svn.freebsd.org/changeset/base/209964 Log: Correctly copy the M_RDONLY flag when duplicating a reference to an mbuf external buffer. Approved by: so (cperciva) Approved by: re (kensmith) Security: FreeBSD-SA-10:07.mbuf Modified: stable/7/sys/kern/uipc_mbuf.c Changes in other areas also in this revision: Modified: head/sys/kern/uipc_mbuf.c releng/7.1/UPDATING releng/7.1/sys/conf/newvers.sh releng/7.1/sys/kern/uipc_mbuf.c releng/7.3/UPDATING releng/7.3/sys/conf/newvers.sh releng/7.3/sys/kern/uipc_mbuf.c releng/8.0/UPDATING releng/8.0/sys/conf/newvers.sh releng/8.0/sys/kern/uipc_mbuf.c releng/8.1/UPDATING releng/8.1/sys/kern/uipc_mbuf.c stable/8/sys/kern/uipc_mbuf.c Modified: stable/7/sys/kern/uipc_mbuf.c ============================================================================== --- stable/7/sys/kern/uipc_mbuf.c Tue Jul 13 01:24:02 2010 (r209963) +++ stable/7/sys/kern/uipc_mbuf.c Tue Jul 13 02:45:17 2010 (r209964) @@ -301,6 +301,7 @@ mb_dupcl(struct mbuf *n, struct mbuf *m) n->m_ext.ref_cnt = m->m_ext.ref_cnt; n->m_ext.ext_type = m->m_ext.ext_type; n->m_flags |= M_EXT; + n->m_flags |= m->m_flags & M_RDONLY; } /* From owner-svn-src-stable-7@FreeBSD.ORG Tue Jul 13 08:53:41 2010 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6850B106566B; Tue, 13 Jul 2010 08:53:41 +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 586FD8FC08; Tue, 13 Jul 2010 08:53: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 o6D8rfhM074648; Tue, 13 Jul 2010 08:53:41 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o6D8rfGg074646; Tue, 13 Jul 2010 08:53:41 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201007130853.o6D8rfGg074646@svn.freebsd.org> From: Konstantin Belousov Date: Tue, 13 Jul 2010 08:53:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r209985 - stable/7/sys/kern X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Jul 2010 08:53:41 -0000 Author: kib Date: Tue Jul 13 08:53:41 2010 New Revision: 209985 URL: http://svn.freebsd.org/changeset/base/209985 Log: MFC r209742: In revoke(), verify that VCHR vnode indeed belongs to devfs. Modified: stable/7/sys/kern/vfs_syscalls.c Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/kern/vfs_syscalls.c ============================================================================== --- stable/7/sys/kern/vfs_syscalls.c Tue Jul 13 08:45:50 2010 (r209984) +++ stable/7/sys/kern/vfs_syscalls.c Tue Jul 13 08:53:41 2010 (r209985) @@ -3963,7 +3963,7 @@ revoke(td, uap) vfslocked = NDHASGIANT(&nd); vp = nd.ni_vp; NDFREE(&nd, NDF_ONLY_PNBUF); - if (vp->v_type != VCHR) { + if (vp->v_type != VCHR || vp->v_rdev == NULL) { error = EINVAL; goto out; } From owner-svn-src-stable-7@FreeBSD.ORG Tue Jul 13 08:55:52 2010 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EBA601065673; Tue, 13 Jul 2010 08:55:52 +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 DBC158FC1F; Tue, 13 Jul 2010 08:55:52 +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 o6D8tqfl075183; Tue, 13 Jul 2010 08:55:52 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o6D8tqgE075181; Tue, 13 Jul 2010 08:55:52 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201007130855.o6D8tqgE075181@svn.freebsd.org> From: Konstantin Belousov Date: Tue, 13 Jul 2010 08:55:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r209986 - stable/7/sys/dev/md X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Jul 2010 08:55:53 -0000 Author: kib Date: Tue Jul 13 08:55:52 2010 New Revision: 209986 URL: http://svn.freebsd.org/changeset/base/209986 Log: MFC r209743: Calculate nshift only once. Modified: stable/7/sys/dev/md/md.c Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/dev/md/md.c ============================================================================== --- stable/7/sys/dev/md/md.c Tue Jul 13 08:53:41 2010 (r209985) +++ stable/7/sys/dev/md/md.c Tue Jul 13 08:55:52 2010 (r209986) @@ -252,7 +252,7 @@ dimension(off_t size) { off_t rcnt; struct indir *ip; - int i, layer; + int layer; rcnt = size; layer = 0; @@ -260,9 +260,6 @@ dimension(off_t size) rcnt /= NINDIR; layer++; } - /* figure out log2(NINDIR) */ - for (i = NINDIR, nshift = -1; i; nshift++) - i >>= 1; /* * XXX: the top layer is probably not fully populated, so we allocate @@ -1203,6 +1200,11 @@ g_md_init(struct g_class *mp __unused) caddr_t c; u_char *ptr, *name, *type; unsigned len; + int i; + + /* figure out log2(NINDIR) */ + for (i = NINDIR, nshift = -1; i; nshift++) + i >>= 1; mod = NULL; sx_init(&md_sx, "MD config lock"); From owner-svn-src-stable-7@FreeBSD.ORG Tue Jul 13 20:13:38 2010 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A9419106566C; Tue, 13 Jul 2010 20:13:38 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 94FD28FC16; Tue, 13 Jul 2010 20:13: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 o6DKDcqS044204; Tue, 13 Jul 2010 20:13:38 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o6DKDcvS044195; Tue, 13 Jul 2010 20:13:38 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201007132013.o6DKDcvS044195@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Tue, 13 Jul 2010 20:13:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r210019 - in stable/7: share/man/man4 sys/conf sys/modules/netgraph sys/modules/netgraph/patch sys/netgraph X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Jul 2010 20:13:38 -0000 Author: ae Date: Tue Jul 13 20:13:38 2010 New Revision: 210019 URL: http://svn.freebsd.org/changeset/base/210019 Log: MFC r208946: New netgraph node ng_patch(4). It performs data modification of packets passing through. Modifications are restricted to a subset of C language operations on unsigned integers of 8, 16, 32 or 64 bit size. These are: set to new value (=), addition (+=), subtraction (-=), multiplication (*=), division (/=), negation (= -), bitwise AND (&=), bitwise OR (|=), bitwise eXclusive OR (^=), shift left (<<=), shift right (>>=). Several operations are all applied to a packet sequentially in order they were specified by user. Submitted by: Maxim Ignatenko Vadim Goncharov Discussed with: net@ MFC r208947: Fix typo. MFC r208989: Style(9) fixes: * Sort includes * Replace #define to #define * Split declarations and initializations * Split long lines Requested by: kib MFC r209194: * Include sys/systm.h for KASSERT() * Remove unneeded includes and comment * Replace home made OFFSETOF() macro with standard offsetof() Pointed out by: bde Tested by: Vadim Goncharov Approved by: mav (mentor) Added: stable/7/share/man/man4/ng_patch.4 - copied unchanged from r208946, head/share/man/man4/ng_patch.4 stable/7/sys/modules/netgraph/patch/ - copied from r208946, head/sys/modules/netgraph/patch/ stable/7/sys/netgraph/ng_patch.c - copied, changed from r208946, head/sys/netgraph/ng_patch.c stable/7/sys/netgraph/ng_patch.h - copied, changed from r208946, head/sys/netgraph/ng_patch.h Modified: stable/7/share/man/man4/Makefile stable/7/sys/conf/NOTES stable/7/sys/conf/files stable/7/sys/conf/options stable/7/sys/modules/netgraph/Makefile Directory Properties: stable/7/share/man/man4/ (props changed) stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/share/man/man4/Makefile ============================================================================== --- stable/7/share/man/man4/Makefile Tue Jul 13 20:09:14 2010 (r210018) +++ stable/7/share/man/man4/Makefile Tue Jul 13 20:13:38 2010 (r210019) @@ -239,6 +239,7 @@ MAN= aac.4 \ ng_nat.4 \ ng_netflow.4 \ ng_one2many.4 \ + ng_patch.4 \ ng_ppp.4 \ ng_pppoe.4 \ ng_pptpgre.4 \ Copied: stable/7/share/man/man4/ng_patch.4 (from r208946, head/share/man/man4/ng_patch.4) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/7/share/man/man4/ng_patch.4 Tue Jul 13 20:13:38 2010 (r210019, copy of r208946, head/share/man/man4/ng_patch.4) @@ -0,0 +1,235 @@ +.\" Copyright (c) 2010 Maxim Ignatenko +.\" Copyright (c) 2010 Vadim Goncharov +.\" 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 June 9, 2010 +.Dt NG_PATCH 4 +.Os +.Sh NAME +.Nm ng_patch +.Nd "trivial mbuf data modifying netgraph node type" +.Sh SYNOPSIS +.In netgraph/ng_patch.h +.Sh DESCRIPTION +The +.Nm patch +node performs data modification of packets passing through it. +Modifications are restricted to a subset of C language operations +on unsigned integers of 8, 16, 32 or 64 bit size. +These are: set to new value (=), addition (+=), subtraction (-=), +multiplication (*=), division (/=), negation (= -), +bitwise AND (&=), bitwise OR (|=), bitwise eXclusive OR (^=), +shift left (<<=), shift right (>>=). +A negation operation is the one exception: integer is treated as signed +and second operand (the +.Va value ) +is not used. +There may be several modification operations, they are all applied +to a packet sequentially in order they were specified by user. +Data payload of packet is viewed as array of bytes, with zero offset +corresponding to the very first byte of packet headers, and +.Va length +bytes beginning from +.Va offset +are taken as a single integer in network byte order. +.Sh HOOKS +This node type has two hooks: +.Bl -tag -width indent +.It Va in +Packets received on this hook are modified according to rules specified +in config and then forwarded to +.Ar out +hook, if it exists and connected. +Otherwise they are reflected back to the +.Ar in +hook. +.It Va out +Packets received on this hook are forwarded to +.Ar in +hook without any changes. +.El +.Sh CONTROL MESSAGES +This node type supports the generic control messages, plus the following: +.Bl -tag -width indent +.It Dv NGM_PATCH_SETCONFIG Pq Li setconfig +This command sets the sequence of modify operations +that will be applied to incoming data on a hook. +The following +.Vt "struct ng_patch_config" +must be supplied as an argument: +.Bd -literal -offset 4n +struct ng_patch_op { + uint64_t value; + uint32_t offset; + uint16_t length; /* 1,2,4 or 8 bytes */ + uint16_t mode; +}; +/* Patching modes */ +#define NG_PATCH_MODE_SET 1 +#define NG_PATCH_MODE_ADD 2 +#define NG_PATCH_MODE_SUB 3 +#define NG_PATCH_MODE_MUL 4 +#define NG_PATCH_MODE_DIV 5 +#define NG_PATCH_MODE_NEG 6 +#define NG_PATCH_MODE_AND 7 +#define NG_PATCH_MODE_OR 8 +#define NG_PATCH_MODE_XOR 9 +#define NG_PATCH_MODE_SHL 10 +#define NG_PATCH_MODE_SHR 11 + +struct ng_patch_config { + uint32_t count; + uint32_t csum_flags; + struct ng_patch_op ops[]; +}; +.Ed +.Pp +The +.Va csum_flags +can be set to any combination of CSUM_IP, CSUM_TCP, CSUM_SCTP and CSUM_UDP +(other values are ignored) for instructing the IP stack to recalculate the +corresponding checksum before transmitting packet on output interface. +The +.Nm +node does not do any checksum correction by itself. +.It Dv NGM_PATCH_GETCONFIG Pq Li getconfig +This control message obtains current set of modify operations, +returned as +.Vt "struct ng_patch_config" . +.It Dv NGM_PATCH_GET_STATS Pq Li getstats +Returns node statistics as a +.Vt "struct ng_patch_stats" . +.It Dv NGM_PATCH_CLR_STATS Pq Li clrstats +Clear node statistics. +.It Dv NGM_PATCH_GETCLR_STATS Pq Li getclrstats +This command is identical to +.Dv NGM_PATCH_GET_STATS , +except that the statistics are also atomically cleared. +.El +.Sh SHUTDOWN +This node shuts down upon receipt of a +.Dv NGM_SHUTDOWN +control message, or when all hooks have been disconnected. +.Sh EXAMPLES +The +.Nm +node allows to modify TTL and TOS/DSCP fields in IP packets. +Suppose you have two adjacent simplex links to remote network +(e.g.\& satellite), so that the packets expiring in between +will generate unwanted ICMP-replies which have to go forth, not back. +Thus you need to raise TTL of every packet entering link link by 2 +to ensure the TTL will not reach zero there. +So you setup +.Xr ipfw 8 +rule with +.Cm netgraph +action to inject packets going to other end of simplex link by the +following +.Xr ngctl 8 +script: +.Bd -literal -offset 4n +/usr/sbin/ngctl -f- <<-SEQ + mkpeer ipfw: patch 200 in + name ipfw:200 ttl_add + msg ttl_add: setconfig { count=1 csum_flags=1 ops=[ \e + { mode=2 value=3 length=1 offset=8 } ] } +SEQ +/sbin/ipfw add 150 netgraph 200 ip from any to simplex.remote.net +.Ed +.Pp +Here +.Dq Li ttl_add +node of type +.Nm +configured to add (mode +.Dv NG_PATCH_MODE_ADD ) +a +.Va value +of 3 to a one-byte TTL field, which is 9th byte of IP packet header. +.Pp +Another example would be two consecutive modifications of packet TOS +field: say, you need to clear the +.Dv IPTOS_THROUGHPUT +bit and set the +.Dv IPTOS_MINCOST +bit. +So you do: +.Bd -literal -offset 4n +/usr/sbin/ngctl -f- <<-SEQ + mkpeer ipfw: patch 300 in + name ipfw:300 tos_chg + msg tos_chg: setconfig { count=2 csum_flags=1 ops=[ \e + { mode=7 value=0xf7 length=1 offset=1 } \e + { mode=8 value=0x02 length=1 offset=1 } ] } +SEQ +/sbin/ipfw add 160 netgraph 600 ip from any to any not dst-port 80 +.Ed +.Pp +This first does +.Dv NG_PATCH_MODE_AND +clearing the fourth bit and then +.Dv NG_PATCH_MODE_OR +setting the third bit. +.Pp +In both examples the +.Va csum_flags +field indicates that IP checksum (but not TCP or UDP checksum) should be +recalculated before transmit. +.Pp +Note: one should ensure that packets are returned to ipfw after processing +inside +.Xr netgraph 4 , +by setting appropriate +.Xr sysctl 8 +variable: +.Bd -literal -offset 4n +sysctl net.inet.ip.fw.one_pass=0 +.Ed +.Sh SEE ALSO +.Xr netgraph 4 , +.Xr ng_ipfw 4 , +.Xr ngctl 8 +.Sh HISTORY +The +.Nm +node type was implemented in +.Fx 8.1 . +.Sh AUTHORS +.An "Maxim Ignatenko" Aq gelraen.ua@gmail.com . +This manual page was written by +.An "Vadim Goncharov" Aq vadimnuclight@tpu.ru . +.Sh BUGS +Node blindly tries to apply every patching operation to each packet +(except those which offset if greater than length of the packet), +so be sure that you supply only the right packets to it (e.g. changing +bytes in the ARP packets meant to be in IP header could corrupt +them and make your machine unreachable from the network). +.Pp +.Em !!! WARNING !!! +.Pp +Output path of the IP stack assumes correct fields and lengths in the +packets - changing them by mistake to incorrect values can cause +unpredictable results including kernel panics. Modified: stable/7/sys/conf/NOTES ============================================================================== --- stable/7/sys/conf/NOTES Tue Jul 13 20:09:14 2010 (r210018) +++ stable/7/sys/conf/NOTES Tue Jul 13 20:13:38 2010 (r210019) @@ -678,6 +678,7 @@ options NETGRAPH_MPPC_ENCRYPTION options NETGRAPH_NETFLOW options NETGRAPH_NAT options NETGRAPH_ONE2MANY +options NETGRAPH_PATCH options NETGRAPH_PPP options NETGRAPH_PPPOE options NETGRAPH_PPTPGRE Modified: stable/7/sys/conf/files ============================================================================== --- stable/7/sys/conf/files Tue Jul 13 20:09:14 2010 (r210018) +++ stable/7/sys/conf/files Tue Jul 13 20:13:38 2010 (r210019) @@ -1934,6 +1934,7 @@ netgraph/ng_mppc.c optional netgraph_mp netgraph/ng_nat.c optional netgraph_nat netgraph/ng_one2many.c optional netgraph_one2many netgraph/ng_parse.c optional netgraph +netgraph/ng_patch.c optional netgraph_patch netgraph/ng_ppp.c optional netgraph_ppp netgraph/ng_pppoe.c optional netgraph_pppoe netgraph/ng_pptpgre.c optional netgraph_pptpgre Modified: stable/7/sys/conf/options ============================================================================== --- stable/7/sys/conf/options Tue Jul 13 20:09:14 2010 (r210018) +++ stable/7/sys/conf/options Tue Jul 13 20:13:38 2010 (r210019) @@ -464,6 +464,7 @@ NETGRAPH_MPPC_ENCRYPTION opt_netgraph.h NETGRAPH_NAT opt_netgraph.h NETGRAPH_NETFLOW opt_netgraph.h NETGRAPH_ONE2MANY opt_netgraph.h +NETGRAPH_PATCH opt_netgraph.h NETGRAPH_PPP opt_netgraph.h NETGRAPH_PPPOE opt_netgraph.h NETGRAPH_PPTPGRE opt_netgraph.h Modified: stable/7/sys/modules/netgraph/Makefile ============================================================================== --- stable/7/sys/modules/netgraph/Makefile Tue Jul 13 20:09:14 2010 (r210018) +++ stable/7/sys/modules/netgraph/Makefile Tue Jul 13 20:13:38 2010 (r210019) @@ -34,6 +34,7 @@ SUBDIR= async \ netflow \ netgraph \ one2many \ + patch \ ppp \ pppoe \ pptpgre \ Copied and modified: stable/7/sys/netgraph/ng_patch.c (from r208946, head/sys/netgraph/ng_patch.c) ============================================================================== --- head/sys/netgraph/ng_patch.c Wed Jun 9 12:25:57 2010 (r208946, copy source) +++ stable/7/sys/netgraph/ng_patch.c Tue Jul 13 20:13:38 2010 (r210019) @@ -29,12 +29,11 @@ __FBSDID("$FreeBSD$"); #include +#include #include -#include +#include #include -#include -#include -#include /* be64toh(), htobe64() */ +#include #include #include #include @@ -47,16 +46,14 @@ static ng_newhook_t ng_patch_newhook; static ng_rcvdata_t ng_patch_rcvdata; static ng_disconnect_t ng_patch_disconnect; -#define OFFSETOF(s, e) ((char *)&((s *)0)->e - (char *)((s *)0)) - static int -ng_patch_config_getlen(const struct ng_parse_type *type, const u_char *start, - const u_char *buf) +ng_patch_config_getlen(const struct ng_parse_type *type, + const u_char *start, const u_char *buf) { const struct ng_patch_config *p; p = (const struct ng_patch_config *)(buf - - OFFSETOF(struct ng_patch_config, ops)); + offsetof(struct ng_patch_config, ops)); return (p->count); } @@ -158,7 +155,7 @@ struct ng_patch_priv { }; typedef struct ng_patch_priv *priv_p; -#define NG_PATCH_CONF_SIZE(count) (sizeof(struct ng_patch_config) + \ +#define NG_PATCH_CONF_SIZE(count) (sizeof(struct ng_patch_config) + \ (count) * sizeof(struct ng_patch_op)) static void do_patch(priv_p conf, struct mbuf *m); @@ -195,12 +192,14 @@ static int ng_patch_rcvmsg(node_p node, item_p item, hook_p lasthook) { const priv_p privp = NG_NODE_PRIVATE(node); - struct ng_patch_config *conf; + struct ng_patch_config *conf, *newconf; + union patch_val *newval; struct ng_mesg *msg; - struct ng_mesg *resp = NULL; - int i, clear = 0; - int error = 0; + struct ng_mesg *resp; + int i, clear, error; + clear = error = 0; + resp = NULL; NGI_GET_MSG(item, msg); switch (msg->header.typecookie) { case NGM_PATCH_COOKIE: @@ -215,16 +214,15 @@ ng_patch_rcvmsg(node_p node, item_p item break; case NGM_PATCH_SETCONFIG: { - struct ng_patch_config *newconf; - union patch_val *newval; - - if (msg->header.arglen < sizeof(struct ng_patch_config)) { + if (msg->header.arglen < + sizeof(struct ng_patch_config)) { error = EINVAL; break; } conf = (struct ng_patch_config *)msg->data; - if (msg->header.arglen < NG_PATCH_CONF_SIZE(conf->count)) { + if (msg->header.arglen < + NG_PATCH_CONF_SIZE(conf->count)) { error = EINVAL; break; } @@ -248,27 +246,34 @@ ng_patch_rcvmsg(node_p node, item_p item CSUM_SCTP; if (error == 0) { - newconf = malloc(NG_PATCH_CONF_SIZE(conf->count), - M_NETGRAPH, M_WAIT); - newval = malloc(conf->count * sizeof(union patch_val), + newconf = malloc( + NG_PATCH_CONF_SIZE(conf->count), M_NETGRAPH, M_WAIT); + newval = malloc(conf->count * + sizeof(union patch_val), M_NETGRAPH, + M_WAIT); for(i = 0; i < conf->count; i++) { switch (conf->ops[i].length) { case 1: - newval[i].v1 = conf->ops[i].value; + newval[i].v1 = + conf->ops[i].value; break; case 2: - newval[i].v2 = conf->ops[i].value; + newval[i].v2 = + conf->ops[i].value; break; case 4: - newval[i].v4 = conf->ops[i].value; + newval[i].v4 = + conf->ops[i].value; break; case 8: - newval[i].v8 = conf->ops[i].value; + newval[i].v8 = + conf->ops[i].value; break; } } - bcopy(conf, newconf, NG_PATCH_CONF_SIZE(conf->count)); + bcopy(conf, newconf, + NG_PATCH_CONF_SIZE(conf->count)); if (privp->val != NULL) free(privp->val, M_NETGRAPH); privp->val = newval; @@ -310,12 +315,15 @@ ng_patch_rcvmsg(node_p node, item_p item static void do_patch(priv_p privp, struct mbuf *m) { - struct ng_patch_config *conf = privp->config; + struct ng_patch_config *conf; uint64_t buf; - int i, patched = 0; + int i, patched; + conf = privp->config; + patched = 0; for(i = 0; i < conf->count; i++) { - if (conf->ops[i].offset + conf->ops[i].length > m->m_pkthdr.len) + if (conf->ops[i].offset + conf->ops[i].length > + m->m_pkthdr.len) continue; /* for "=" operation we don't need to copy data from mbuf */ @@ -323,7 +331,7 @@ do_patch(priv_p privp, struct mbuf *m) m_copydata(m, conf->ops[i].offset, conf->ops[i].length, (caddr_t)&buf); } - + switch (conf->ops[i].length) { case 1: switch (conf->ops[i].mode) { @@ -550,16 +558,17 @@ ng_patch_shutdown(node_p node) static int ng_patch_disconnect(hook_p hook) { - priv_p priv = NG_NODE_PRIVATE(NG_HOOK_NODE(hook)); + priv_p priv; + priv = NG_NODE_PRIVATE(NG_HOOK_NODE(hook)); if (hook == priv->in) { priv->in = NULL; } if (hook == priv->out) { priv->out = NULL; } - if ((NG_NODE_NUMHOOKS(NG_HOOK_NODE(hook)) == 0) - && (NG_NODE_IS_VALID(NG_HOOK_NODE(hook)))) /* already shutting down? */ + if (NG_NODE_NUMHOOKS(NG_HOOK_NODE(hook)) == 0 && + NG_NODE_IS_VALID(NG_HOOK_NODE(hook))) /* already shutting down? */ ng_rmnode_self(NG_HOOK_NODE(hook)); return (0); } Copied and modified: stable/7/sys/netgraph/ng_patch.h (from r208946, head/sys/netgraph/ng_patch.h) ============================================================================== --- head/sys/netgraph/ng_patch.h Wed Jun 9 12:25:57 2010 (r208946, copy source) +++ stable/7/sys/netgraph/ng_patch.h Tue Jul 13 20:13:38 2010 (r210019) @@ -30,14 +30,14 @@ #define _NETGRAPH_NG_PATCH_H_ /* Node type name. */ -#define NG_PATCH_NODE_TYPE "patch" +#define NG_PATCH_NODE_TYPE "patch" /* Node type cookie. */ -#define NGM_PATCH_COOKIE 1262445509 +#define NGM_PATCH_COOKIE 1262445509 /* Hook names */ -#define NG_PATCH_HOOK_IN "in" -#define NG_PATCH_HOOK_OUT "out" +#define NG_PATCH_HOOK_IN "in" +#define NG_PATCH_HOOK_OUT "out" /* Netgraph commands understood by this node type */ enum { @@ -70,7 +70,7 @@ struct ng_patch_op { uint16_t mode; }; -#define NG_PATCH_OP_TYPE_INFO { \ +#define NG_PATCH_OP_TYPE_INFO { \ { "value", &ng_parse_uint64_type }, \ { "offset", &ng_parse_uint32_type }, \ { "length", &ng_parse_uint16_type }, \ @@ -84,7 +84,7 @@ struct ng_patch_config { struct ng_patch_op ops[]; }; -#define NG_PATCH_CONFIG_TYPE_INFO { \ +#define NG_PATCH_CONFIG_TYPE_INFO { \ { "count", &ng_parse_uint32_type }, \ { "csum_flags", &ng_parse_uint32_type }, \ { "ops", &ng_patch_confarr_type }, \ @@ -97,7 +97,7 @@ struct ng_patch_stats { uint64_t dropped; }; -#define NG_PATCH_STATS_TYPE_INFO { \ +#define NG_PATCH_STATS_TYPE_INFO { \ { "received", &ng_parse_uint64_type }, \ { "patched", &ng_parse_uint64_type }, \ { "dropped", &ng_parse_uint64_type }, \ From owner-svn-src-stable-7@FreeBSD.ORG Wed Jul 14 15:11:30 2010 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 31B591065670; Wed, 14 Jul 2010 15:11:30 +0000 (UTC) (envelope-from mp@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2031C8FC1E; Wed, 14 Jul 2010 15:11: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 o6EFBUHM000936; Wed, 14 Jul 2010 15:11:30 GMT (envelope-from mp@svn.freebsd.org) Received: (from mp@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o6EFBTK6000933; Wed, 14 Jul 2010 15:11:30 GMT (envelope-from mp@svn.freebsd.org) Message-Id: <201007141511.o6EFBTK6000933@svn.freebsd.org> From: Mark Peek Date: Wed, 14 Jul 2010 15:11:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r210057 - stable/7/contrib/tcsh X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 14 Jul 2010 15:11:30 -0000 Author: mp Date: Wed Jul 14 15:11:29 2010 New Revision: 210057 URL: http://svn.freebsd.org/changeset/base/210057 Log: MFC r184072: Actually fix pty detection for autologout setting. Modified: stable/7/contrib/tcsh/sh.c stable/7/contrib/tcsh/tc.const.c Directory Properties: stable/7/contrib/tcsh/ (props changed) Modified: stable/7/contrib/tcsh/sh.c ============================================================================== --- stable/7/contrib/tcsh/sh.c Wed Jul 14 14:52:35 2010 (r210056) +++ stable/7/contrib/tcsh/sh.c Wed Jul 14 15:11:29 2010 (r210057) @@ -462,7 +462,7 @@ main(int argc, char **argv) else cp2 = cp; if (!(((Strncmp(cp2, STRtty, 3) == 0) && Isalpha(cp2[3])) || - Strstr(cp, STRslptssl) != NULL)) { + Strstr(cp, STRptssl) != NULL)) { if (getenv("DISPLAY") == NULL) { /* NOT on X window shells */ setcopy(STRautologout, STRdefautologout, VAR_READWRITE); Modified: stable/7/contrib/tcsh/tc.const.c ============================================================================== --- stable/7/contrib/tcsh/tc.const.c Wed Jul 14 14:52:35 2010 (r210056) +++ stable/7/contrib/tcsh/tc.const.c Wed Jul 14 15:11:29 2010 (r210057) @@ -46,7 +46,7 @@ Char STRautomatic[] = { 'a', 'u', 't', ' Char STRhangup[] = { 'h', 'a', 'n', 'g', 'u', 'p', '\0' }; Char STRaout[] = { 'a', '.', 'o', 'u', 't', '\0' }; Char STRtty[] = { 't', 't', 'y', '\0' }; -Char STRslptssl[] = { '/', 'p', 't', 's', '/', '\0' }; +Char STRptssl[] = { 'p', 't', 's', '/', '\0' }; Char STRany[] = { 'a', 'n', 'y', '\0' }; Char STRstatus[] = { 's', 't', 'a', 't', 'u', 's', '\0' }; Char STR0[] = { '0', '\0' }; From owner-svn-src-stable-7@FreeBSD.ORG Wed Jul 14 15:14:52 2010 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 706591065674; Wed, 14 Jul 2010 15:14:52 +0000 (UTC) (envelope-from mp@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5DA0E8FC29; Wed, 14 Jul 2010 15:14:52 +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 o6EFEqGW001771; Wed, 14 Jul 2010 15:14:52 GMT (envelope-from mp@svn.freebsd.org) Received: (from mp@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o6EFEqWQ001763; Wed, 14 Jul 2010 15:14:52 GMT (envelope-from mp@svn.freebsd.org) Message-Id: <201007141514.o6EFEqWQ001763@svn.freebsd.org> From: Mark Peek Date: Wed, 14 Jul 2010 15:14:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r210059 - stable/7/contrib/tcsh X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 14 Jul 2010 15:14:52 -0000 Author: mp Date: Wed Jul 14 15:14:52 2010 New Revision: 210059 URL: http://svn.freebsd.org/changeset/base/210059 Log: MFC: Update to tcsh 6.17.00. Requested by: gnn Added: stable/7/contrib/tcsh/config.rpath - copied unchanged from r195609, head/contrib/tcsh/config.rpath Deleted: stable/7/contrib/tcsh/Makefile.ADMIN stable/7/contrib/tcsh/RELEASE-PROCEDURE Modified: stable/7/contrib/tcsh/Fixes stable/7/contrib/tcsh/Imakefile stable/7/contrib/tcsh/Makefile.in stable/7/contrib/tcsh/README stable/7/contrib/tcsh/complete.tcsh stable/7/contrib/tcsh/config.guess stable/7/contrib/tcsh/config.h.in stable/7/contrib/tcsh/config.sub stable/7/contrib/tcsh/config_f.h stable/7/contrib/tcsh/configure stable/7/contrib/tcsh/configure.in stable/7/contrib/tcsh/ed.chared.c stable/7/contrib/tcsh/ed.decls.h stable/7/contrib/tcsh/ed.h stable/7/contrib/tcsh/ed.inputl.c stable/7/contrib/tcsh/ed.screen.c stable/7/contrib/tcsh/ed.term.h stable/7/contrib/tcsh/ed.xmap.c stable/7/contrib/tcsh/glob.c stable/7/contrib/tcsh/host.defs stable/7/contrib/tcsh/ma.setp.c stable/7/contrib/tcsh/patchlevel.h stable/7/contrib/tcsh/sh.c stable/7/contrib/tcsh/sh.char.c stable/7/contrib/tcsh/sh.char.h stable/7/contrib/tcsh/sh.decls.h stable/7/contrib/tcsh/sh.dir.c stable/7/contrib/tcsh/sh.dol.c stable/7/contrib/tcsh/sh.err.c stable/7/contrib/tcsh/sh.exec.c stable/7/contrib/tcsh/sh.exp.c stable/7/contrib/tcsh/sh.file.c stable/7/contrib/tcsh/sh.func.c stable/7/contrib/tcsh/sh.glob.c stable/7/contrib/tcsh/sh.h stable/7/contrib/tcsh/sh.lex.c stable/7/contrib/tcsh/sh.proc.c stable/7/contrib/tcsh/sh.proc.h stable/7/contrib/tcsh/sh.sem.c stable/7/contrib/tcsh/sh.set.c stable/7/contrib/tcsh/snames.h stable/7/contrib/tcsh/tc.bind.c stable/7/contrib/tcsh/tc.const.c stable/7/contrib/tcsh/tc.decls.h stable/7/contrib/tcsh/tc.func.c stable/7/contrib/tcsh/tc.os.h stable/7/contrib/tcsh/tc.sig.h stable/7/contrib/tcsh/tc.str.c stable/7/contrib/tcsh/tcsh.man stable/7/contrib/tcsh/tw.color.c stable/7/contrib/tcsh/tw.comp.c stable/7/contrib/tcsh/tw.parse.c Directory Properties: stable/7/contrib/tcsh/ (props changed) Modified: stable/7/contrib/tcsh/Fixes ============================================================================== --- stable/7/contrib/tcsh/Fixes Wed Jul 14 15:14:00 2010 (r210058) +++ stable/7/contrib/tcsh/Fixes Wed Jul 14 15:14:52 2010 (r210059) @@ -1,3 +1,74 @@ + 21. V6.17.00 - 20090710 + 20. Fix dataroot autoconf issue. + 19. Fix directory stuff for unit tests. + 18. Fix small bug in history in loops. + 17. Provide newer config.{guess,sub} + 16. Fix gcc 4 warnings. + 15. Fix memory trashing bug introduced in 10. + 14. V6.16.01 - 20090624 + 13. add missing sigemptyset in goodbye() + 12. add rlimit swapsize from FreeBSD. + 11. restore behavior where a[n-] never prints an error. + 10. always save the whole command, not just the first 80 chars of it. + 9. fix short2str/short2qstr length adjustment in wide chars + (Vitezslav Crhonek) + 8. set histfile=/tmp/history.temp; set savehist=(100 merge); + alias precmd history -S. After that justpr is not restored and commands + don't execute. (Andriy Gapon) + 7. Fix "as" $ modifier from corrupting memory. + set t=demfonsftraftionf; echo $t:as/f// + 6. Make $% work with environment variable (Ron Johnston) + 5. Dragonfly script support (Matthias Schmidt, m65) + 4. Add autoexpand=onlyhistory (Don Estabrook, m66) + 3. Add history in loops (Laurence Darby, m48) + 2. Add missing colorls "rs" variable (Shlomi Fish, m70) + 1. Fix pts detection issue (Ruslan Ermilov) + + 33. V6.16.00 - 20080930 + 32. longjmp clobbered variable fixes. + 31. __GNX__ addition + 30. Windows fork fixes + 28. V6.15.02 - 20080830 + 27. Fix an eval free'ing botch (Per Hedeland) + 26. /bin/echo "`" coredumped because stderror() calls longjmp corrupting + the stack (Mark Davies). We should vet the code for all stderror() + calls that cleanup local stack variables. + 25. foo > ${undef} caused coredumps because of vfork() child corrupting + the state of the parent stack. + 24. $x[A-B] did not complain for A out of range. (Cai Xianchao) + 23. rename setp -> tcsh_setp to avoid conflict with mach (Javier Vasquez) + 22. Fix degree handling by defining __XPG4_CHAR_CLASS__ for solaris + (Mike Sullivan) + 21. Change 'od' to 'od -c' in tests so that they work on big endian machines. + (Martin Kraemer) + 20. Add environment variable COMMAND_LINE to be available in completions + (Marcin Konarski) + 19. V6.15.01 - 20070928 + 18. Evaluate expressions in the proper order (Li Zefan), controlled by + compat_expr. + 17. Don't need to flush() if we are silent. Prevents recursive error issue. + (joshua stein) + 16. Don't execute the jobcmd if the output is not a tty (Charles Ross) + 15. Quote the history in the examples (Johann 'Myrkraverk' Oskarsson) + 14. Mismatch clarification patch (Per Hedeland) + 13. Fix 'repeat n cmd &' abort() (Mike Sullivan) + 12. Fix octal parsing (Li Zefan) + 11. Fix pty detection for autologout setting (Kris Kennaway, Giorgos Keramidas) + 10. kill `foo` got stuck because sigchld was disabled too soon (Mark Peek) + 9. Avoid null pointer dereference in proc cwd (Kurt Miller) + 8. eval "foreach a b c" exits (Anthony Menasse) + 7. Quoting was broken in substitutions (Joe Wells) + 6. QNX patches via pkgsrc + 5. cd - twice from a directory that contained a glob pattern, + expands the glob twice (Mark Santcroos) + 4. MidnightBsd support (Lucas Holt) + 3. Fix history substitution core-dump with no history entries + 2. Merge two character tables that are the same (Martin Kraemer) + 1. On ancient 7 bit locales, punctuation characters are used to + denote special characters such as umlaut, adiaresis, etc. + These characters return true for isalpha/isalnum. Ignore them + because they break parsing (Martin Kraemer) + 74. V6.15.00 - 20070303 73. fix extension eating windows code (christos) 72. fix loop in %R history expansion (christos) Modified: stable/7/contrib/tcsh/Imakefile ============================================================================== --- stable/7/contrib/tcsh/Imakefile Wed Jul 14 15:14:00 2010 (r210058) +++ stable/7/contrib/tcsh/Imakefile Wed Jul 14 15:14:52 2010 (r210059) @@ -1,5 +1,5 @@ XCOMM -XCOMM $tcsh: Imakefile,v 1.85 2006/03/02 18:46:44 christos Exp $ +XCOMM $tcsh: Imakefile,v 1.86 2007/03/19 23:25:02 christos Exp $ XCOMM XCOMM Imakefile for tcsh 6.12 XCOMM Marc Horowitz, MIT SIPB @@ -211,6 +211,10 @@ EXTF=mi.termios.c mi.wait.h mi.varargs.h # define ConfigH bsd4.4 # endif /* FreeBsdArchitecture */ +# ifdef MidnightBSDArchitecture +# define ConfigH bsd4.4 +# endif /* MidnightBsdArchitecture */ + # ifdef i386SVR4Architecture # define ConfigH sysv4 # ifdef DELL Modified: stable/7/contrib/tcsh/Makefile.in ============================================================================== --- stable/7/contrib/tcsh/Makefile.in Wed Jul 14 15:14:00 2010 (r210058) +++ stable/7/contrib/tcsh/Makefile.in Wed Jul 14 15:14:52 2010 (r210059) @@ -1,4 +1,4 @@ -# $tcsh: Makefile.in,v 3.36 2006/08/24 20:56:31 christos Exp $ +# $tcsh: Makefile.in,v 3.40 2009/06/24 22:09:05 christos Exp $ # Makefile.in 4.3 6/11/83 # # C Shell with process control; VM/UNIX VAX Makefile @@ -248,7 +248,7 @@ CPP = @CPP@ # This is set by autoconf. # The -B tells gcc to use /bin/ld. This is to avoid using the gnu ld, which # on the suns does not know how to make dynamically linked binaries. CC = @CC@ # This is set by autoconf. -#CC= gcc -Wall -Wmissing-prototypes -Wstrict-prototypes -Wpointer-arith -Werror -Wmissing-declarations -Wredundant-decls -Wnested-externs -Wsign-compare -Wcast-qual -Wreturn-type -Wswitch -Wshadow -Wwrite-strings +#CC= gcc -Wall -Wmissing-prototypes -Wstrict-prototypes -Wpointer-arith -Werror -Wmissing-declarations -Wredundant-decls -Wnested-externs -Wsign-compare -Wcast-qual -Wreturn-type -Wswitch -Wshadow -Wwrite-strings -Wextra #CC= gcc -Wall -pipe -B/bin/ # -ansi -pedantic #CC= gcc -m486 -pipe -Wall # Generate code for Intel 486 (linux) #CC= shlicc # BSDI2.1 w/ shared libraries @@ -278,7 +278,7 @@ P= prefix=@prefix@ exec_prefix=@exec_prefix@ bindir=@bindir@ -mandir=@mandir@ +mandir=@datarootdir@/man MANSECT=1 DESTBIN=${DESTDIR}${bindir} DESTMAN=${DESTDIR}${mandir}/man${MANSECT} @@ -463,7 +463,7 @@ $(srcdir)/tests/package.m4: $(srcdir)/co echo 'm4_define([AT_PACKAGE_BUGREPORT], [@PACKAGE_BUGREPORT@])'; \ } >$(srcdir)/tests/package.m4 -$(srcdir)/tests/testsuite: tests/package.m4 tests/testsuite.at $(TESTFILES) +$(srcdir)/tests/testsuite: $(srcdir)/tests/package.m4 $(srcdir}/tests/testsuite.at $(TESTFILES) autom4te --language=autotest -I $(srcdir)/tests \ $(srcdir)/tests/testsuite.at -o $@.tmp mv $@.tmp $@ @@ -531,11 +531,16 @@ install.cygwin: install install.man cp ${srcdir}/WishList ${srcdir}/Y2K ${DESTDIR}${prefix}/share/doc/tcsh perl ${srcdir}/tcsh.man2html ${srcdir}/tcsh.man cp -rp tcsh.html ${DESTDIR}${prefix}/share/doc/tcsh + -mkdir -p ${DESTDIR}/etc/defaults/etc/profile.d -mkdir -p ${DESTDIR}/etc/profile.d -mkdir -p ${DESTDIR}/etc/postinstall - cp -p ${srcdir}/cygwin/etc/csh.* ${DESTDIR}/etc - cp -p ${srcdir}/cygwin/etc/profile.d/*.tcsh ${DESTDIR}/etc/profile.d - cp -p ${srcdir}/cygwin/etc/postinstall/tcsh.sh ${DESTDIR}/etc/postinstall + -mkdir -p ${DESTDIR}/etc/preremove + cp -p ${srcdir}/cygwin/csh.cshrc ${DESTDIR}/etc/defaults/etc + cp -p ${srcdir}/cygwin/csh.login ${DESTDIR}/etc/defaults/etc + cp -p ${srcdir}/cygwin/bindkey.tcsh ${DESTDIR}/etc/defaults/etc/profile.d + cp -p ${srcdir}/complete.tcsh ${DESTDIR}/etc/defaults/etc/profile.d + cp -p ${srcdir}/cygwin/postinstall.sh ${DESTDIR}/etc/postinstall/tcsh.sh + cp -p ${srcdir}/cygwin/preremove.sh ${DESTDIR}/etc/preremove/tcsh.sh # Amiga Unix #install.man: tcsh.man Modified: stable/7/contrib/tcsh/README ============================================================================== --- stable/7/contrib/tcsh/README Wed Jul 14 15:14:00 2010 (r210058) +++ stable/7/contrib/tcsh/README Wed Jul 14 15:14:52 2010 (r210059) @@ -1,4 +1,4 @@ -This is tcsh version 6.15. Tcsh is a version of the Berkeley +This is tcsh version 6.17.00. Tcsh is a version of the Berkeley C-Shell, with the addition of: a command line editor, command and file name completion, listing, etc. and a bunch of small additions to the shell itself. Modified: stable/7/contrib/tcsh/complete.tcsh ============================================================================== --- stable/7/contrib/tcsh/complete.tcsh Wed Jul 14 15:14:00 2010 (r210058) +++ stable/7/contrib/tcsh/complete.tcsh Wed Jul 14 15:14:52 2010 (r210059) @@ -1,5 +1,5 @@ # -# $tcsh: complete.tcsh,v 1.47 2006/03/02 18:46:44 christos Exp $ +# $tcsh: complete.tcsh,v 1.51 2007/10/01 21:51:59 christos Exp $ # example file using the new completion code # # Debian GNU/Linux @@ -38,18 +38,18 @@ endif if ($?_complete) then set noglob if ( ! $?hosts ) set hosts - foreach f ($HOME/.hosts /usr/local/etc/csh.hosts $HOME/.rhosts /etc/hosts.equiv) - if ( -r $f ) then - set hosts = ($hosts `grep -v "+" $f | grep -E -v "^#" | tr -s " " " " | cut -f 1`) + foreach f ("$HOME/.hosts" /usr/local/etc/csh.hosts "$HOME/.rhosts" /etc/hosts.equiv) + if ( -r "$f" ) then + set hosts = ($hosts `grep -v "+" "$f" | grep -E -v "^#" | tr -s " " " " | cut -f 1`) endif end - if ( -r $HOME/.netrc ) then - set f=`awk '/machine/ { print $2 }' < $HOME/.netrc` >& /dev/null + if ( -r "$HOME/.netrc" ) then + set f=`awk '/machine/ { print $2 }' < "$HOME/.netrc"` >& /dev/null set hosts=($hosts $f) endif - if ( -r $HOME/.ssh/known_hosts ) then - set f=`cat $HOME/.ssh/known_hosts | cut -f 1 -d \ ` >& /dev/null - set f=`cat $HOME/.ssh/known_hosts | cut -f 1 -d \ | sed -e 's/,/ /g'` >& /dev/null + if ( -r "$HOME/.ssh/known_hosts" ) then + set f=`cat "$HOME/.ssh/known_hosts" | cut -f 1 -d \ ` >& /dev/null + set f=`cat "$HOME/.ssh/known_hosts" | cut -f 1 -d \ | sed -e 's/,/ /g'` >& /dev/null set hosts=($hosts $f) endif unset f @@ -224,7 +224,7 @@ if ($?_complete) then # these should be merged with the MH completion hacks below - jgotts complete {refile,sprev,snext,scan,pick,rmm,inc,folder,show} \ - c@+@F:$HOME/Mail/@ + "c@+@F:$HOME/Mail/@" # these and interrupt handling from Jaap Vermeulen complete {rexec,rxexec,rxterm,rmterm} \ @@ -286,7 +286,7 @@ if ($?_complete) then complete setenv 'p/1/e/' 'c/*:/f/' # these and method of setting hosts from Kimmo Suominen - if ( -f $HOME/.mh_profile && -x "`which folders`" ) then + if ( -f "$HOME/.mh_profile" && -x "`which folders`" ) then if ( ! $?FOLDERS ) setenv FOLDERS "`folders -fast -recurse`" if ( ! $?MHA ) setenv MHA "`ali | sed -e '/^ /d' -e 's/:.*//'`" @@ -505,6 +505,19 @@ if ($?_complete) then logout rdiff release remove rtag status tag unedit \ update watch watchers)/' 'n/-a/(edit unedit commit \ all none)/' 'n/watch/(on off add remove)/' + complete svn 'C@file:///@`'"${HOME}/etc/tcsh/complete.d/svn"'`@@' \ + 'n@ls@(file:/// svn+ssh:// svn://)@@' \ + 'n@help@(add blame cat checkout \ + cleanup commit copy delete export help \ + import info list ls lock log merge mkdir \ + move propdel propedit propget proplist \ + propset resolved revert status switch unlock \ + update)@' 'p@1@(add blame cat checkout \ + cleanup commit copy delete export help \ + import info list ls lock log merge mkdir \ + move propdel propedit propget proplist \ + propset resolved revert status switch unlock \ + update)@' complete cxx 'p/*/f:*.{c++,cxx,c,cc,C,cpp}/' complete detex 'p/*/f:*.tex/' complete edquota 'n/*/u/' @@ -591,14 +604,14 @@ if ($?_complete) then flush-logs flush-status flush-tables flush-privileges \ kill password ping processlist reload refresh \ shutdown status variables version)/' - complete mutt c@-f=@F:${HOME}/Mail/@ \ + complete mutt "c@-f=@F:${HOME}/Mail/@" \ n/-a/f/ \ n/-F/f/ n/-H/f/ \ n/-s/x:''/ \ n/-e/x:''/ \ - n@-b@'`cat ${HOME}/.muttrc-alias | awk '"'"'{print $2 }'"'"\`@ \ - n@-c@'`cat ${HOME}/.muttrc-alias | awk '"'"'{print $2 }'"'"\`@ \ - n@*@'`cat ${HOME}/.muttrc-alias | awk '"'"'{print $2 }'"'"\`@ + n@-b@'`cat "${HOME}/.muttrc-alias" | awk '"'"'{print $2 }'"'"\`@ \ + n@-c@'`cat "${HOME}/.muttrc-alias" | awk '"'"'{print $2 }'"'"\`@ \ + n@*@'`cat "${HOME}/.muttrc-alias" | awk '"'"'{print $2 }'"'"\`@ complete ndc 'n/*/(status dumpdb reload stats trace notrace \ querylog start stop restart )/' if ($?traditional_complete) then @@ -711,14 +724,15 @@ if ($?_complete) then complete unsetenv n/*/e/ set _maildir = /var/mail - if (-r $HOME/.mailrc) then + if (-r "$HOME/.mailrc") then complete mail c/-/"(e i f n s u v)"/ c/*@/\$hosts/ \ - c@+@F:$HOME/Mail@ C@[./\$~]@f@ n/-s/x:''/ \ + "c@+@F:$HOME/Mail@" C@[./\$~]@f@ n/-s/x:''/ \ n@-u@T:$_maildir@ n/-f/f/ \ - n@*@'`sed -n s/alias//p $HOME/.mailrc | tr -s " " " " | cut -f 2`'@ + n@*@'`sed -n s/alias//p "$HOME/.mailrc" | \ + tr -s " " " " | cut -f 2`'@ else complete mail c/-/"(e i f n s u v)"/ c/*@/\$hosts/ \ - c@+@F:$HOME/Mail@ C@[./\$~]@f@ n/-s/x:''/ \ + "c@+@F:$HOME/Mail@" C@[./\$~]@f@ n/-s/x:''/ \ n@-u@T:$_maildir@ n/-f/f/ n/*/u/ endif unset _maildir @@ -1029,23 +1043,41 @@ n@public@'`[ -r /usr/man/manp ]&& \ls -1 N/{-C,--directory}/'`\ls $:-1`'/ \ n/-[0-7]/"(l m h)"/ - # Linux filesystems - complete mount c/-/"(a f F h l n o r s t U v V w)"/ n/-[hV]/n/ \ - n/-o/x:''/ n/-t/x:''/ \ - n/-L/x:'