From owner-svn-src-stable@FreeBSD.ORG Sun Mar 3 00:37:35 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id A1874B71; Sun, 3 Mar 2013 00:37:35 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 7BEE3AD2; Sun, 3 Mar 2013 00:37:35 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r230bZxX008183; Sun, 3 Mar 2013 00:37:35 GMT (envelope-from gjb@svn.freebsd.org) Received: (from gjb@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r230bZIv008182; Sun, 3 Mar 2013 00:37:35 GMT (envelope-from gjb@svn.freebsd.org) Message-Id: <201303030037.r230bZIv008182@svn.freebsd.org> From: Glen Barber Date: Sun, 3 Mar 2013 00:37:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r247677 - stable/9/usr.bin/dc X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Mar 2013 00:37:35 -0000 Author: gjb (doc,ports committer) Date: Sun Mar 3 00:37:34 2013 New Revision: 247677 URL: http://svnweb.freebsd.org/changeset/base/247677 Log: MFC r247441: Properly handle '-h' argument. PR: 176332 Modified: stable/9/usr.bin/dc/dc.c Directory Properties: stable/9/usr.bin/dc/ (props changed) Modified: stable/9/usr.bin/dc/dc.c ============================================================================== --- stable/9/usr.bin/dc/dc.c Sat Mar 2 23:40:42 2013 (r247676) +++ stable/9/usr.bin/dc/dc.c Sun Mar 3 00:37:34 2013 (r247677) @@ -84,7 +84,7 @@ main(int argc, char *argv[]) bool extended_regs = false, preproc_done = false; /* accept and ignore a single dash to be 4.4BSD dc(1) compatible */ - while ((ch = getopt_long(argc, argv, "e:f:Vx", long_options, NULL)) != -1) { + while ((ch = getopt_long(argc, argv, "e:f:hVx", long_options, NULL)) != -1) { switch (ch) { case 'e': if (!preproc_done) From owner-svn-src-stable@FreeBSD.ORG Sun Mar 3 07:09:26 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 6F63D2D7; Sun, 3 Mar 2013 07:09:26 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 5006F87C; Sun, 3 Mar 2013 07:09:26 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r2379Q6e028815; Sun, 3 Mar 2013 07:09:26 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r2379PQD028812; Sun, 3 Mar 2013 07:09:25 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201303030709.r2379PQD028812@svn.freebsd.org> From: Konstantin Belousov Date: Sun, 3 Mar 2013 07:09:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r247685 - stable/9/sys/fs/msdosfs X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Mar 2013 07:09:26 -0000 Author: kib Date: Sun Mar 3 07:09:25 2013 New Revision: 247685 URL: http://svnweb.freebsd.org/changeset/base/247685 Log: MFC r246921: Do not update the fsinfo block on each update of any fat block. Postpone the flush to VFS_SYNC(). Modified: stable/9/sys/fs/msdosfs/msdosfs_fat.c stable/9/sys/fs/msdosfs/msdosfs_vfsops.c stable/9/sys/fs/msdosfs/msdosfsmount.h Directory Properties: stable/9/sys/ (props changed) stable/9/sys/fs/ (props changed) Modified: stable/9/sys/fs/msdosfs/msdosfs_fat.c ============================================================================== --- stable/9/sys/fs/msdosfs/msdosfs_fat.c Sun Mar 3 06:42:36 2013 (r247684) +++ stable/9/sys/fs/msdosfs/msdosfs_fat.c Sun Mar 3 07:09:25 2013 (r247685) @@ -328,29 +328,6 @@ updatefats(pmp, bp, fatbn) printf("updatefats(pmp %p, bp %p, fatbn %lu)\n", pmp, bp, fatbn); #endif - /* - * If we have an FSInfo block, update it. - */ - if (pmp->pm_fsinfo) { - if (bread(pmp->pm_devvp, pmp->pm_fsinfo, pmp->pm_BytesPerSec, - NOCRED, &bpn) != 0) { - /* - * Ignore the error, but turn off FSInfo update for the future. - */ - pmp->pm_fsinfo = 0; - brelse(bpn); - } else { - struct fsinfo *fp = (struct fsinfo *)bpn->b_data; - - putulong(fp->fsinfree, pmp->pm_freeclustercount); - putulong(fp->fsinxtfree, pmp->pm_nxtfree); - if (pmp->pm_flags & MSDOSFSMNT_WAITONFAT) - bwrite(bpn); - else - bdwrite(bpn); - } - } - if (pmp->pm_flags & MSDOSFS_FATMIRROR) { /* * Now copy the block(s) of the modified fat to the other copies of @@ -393,9 +370,6 @@ updatefats(pmp, bp, fatbn) bwrite(bp); else bdwrite(bp); - /* - * Maybe update fsinfo sector here? - */ } /* @@ -431,6 +405,7 @@ usemap_alloc(pmp, cn) pmp->pm_inusemap[cn / N_INUSEBITS] |= 1 << (cn % N_INUSEBITS); KASSERT(pmp->pm_freeclustercount > 0, ("usemap_alloc: too little")); pmp->pm_freeclustercount--; + pmp->pm_flags |= MSDOSFS_FSIMOD; } static __inline void @@ -441,6 +416,7 @@ usemap_free(pmp, cn) MSDOSFS_ASSERT_MP_LOCKED(pmp); pmp->pm_freeclustercount++; + pmp->pm_flags |= MSDOSFS_FSIMOD; KASSERT((pmp->pm_inusemap[cn / N_INUSEBITS] & (1 << (cn % N_INUSEBITS))) != 0, ("Freeing unused sector %ld %ld %x", cn, cn % N_INUSEBITS, (unsigned)pmp->pm_inusemap[cn / N_INUSEBITS])); @@ -742,7 +718,10 @@ chainalloc(pmp, start, count, fillwith, for (cl = start, n = count; n-- > 0;) usemap_alloc(pmp, cl++); - + pmp->pm_nxtfree = start + count; + if (pmp->pm_nxtfree > pmp->pm_maxcluster) + pmp->pm_nxtfree = CLUST_FIRST; + pmp->pm_flags |= MSDOSFS_FSIMOD; error = fatchain(pmp, start, count, fillwith); if (error != 0) return (error); @@ -754,9 +733,6 @@ chainalloc(pmp, start, count, fillwith, *retcluster = start; if (got) *got = count; - pmp->pm_nxtfree = start + count; - if (pmp->pm_nxtfree > pmp->pm_maxcluster) - pmp->pm_nxtfree = CLUST_FIRST; return (0); } Modified: stable/9/sys/fs/msdosfs/msdosfs_vfsops.c ============================================================================== --- stable/9/sys/fs/msdosfs/msdosfs_vfsops.c Sun Mar 3 06:42:36 2013 (r247684) +++ stable/9/sys/fs/msdosfs/msdosfs_vfsops.c Sun Mar 3 07:09:25 2013 (r247685) @@ -897,6 +897,40 @@ msdosfs_statfs(struct mount *mp, struct return (0); } +/* + * If we have an FSInfo block, update it. + */ +static int +msdosfs_fsiflush(struct msdosfsmount *pmp, int waitfor) +{ + struct fsinfo *fp; + struct buf *bp; + int error; + + MSDOSFS_LOCK_MP(pmp); + if (pmp->pm_fsinfo == 0 || (pmp->pm_flags & MSDOSFS_FSIMOD) == 0) { + error = 0; + goto unlock; + } + error = bread(pmp->pm_devvp, pmp->pm_fsinfo, pmp->pm_BytesPerSec, + NOCRED, &bp); + if (error != 0) { + brelse(bp); + goto unlock; + } + fp = (struct fsinfo *)bp->b_data; + putulong(fp->fsinfree, pmp->pm_freeclustercount); + putulong(fp->fsinxtfree, pmp->pm_nxtfree); + pmp->pm_flags &= ~MSDOSFS_FSIMOD; + if (waitfor == MNT_WAIT) + error = bwrite(bp); + else + bawrite(bp); +unlock: + MSDOSFS_UNLOCK_MP(pmp); + return (error); +} + static int msdosfs_sync(struct mount *mp, int waitfor) { @@ -959,6 +993,10 @@ loop: allerror = error; VOP_UNLOCK(pmp->pm_devvp, 0); } + + error = msdosfs_fsiflush(pmp, waitfor); + if (error != 0) + allerror = error; return (allerror); } Modified: stable/9/sys/fs/msdosfs/msdosfsmount.h ============================================================================== --- stable/9/sys/fs/msdosfs/msdosfsmount.h Sun Mar 3 06:42:36 2013 (r247684) +++ stable/9/sys/fs/msdosfs/msdosfsmount.h Sun Mar 3 07:09:25 2013 (r247685) @@ -262,6 +262,7 @@ struct msdosfs_args { #define MSDOSFSMNT_WAITONFAT 0x40000000 /* mounted synchronous */ #define MSDOSFS_FATMIRROR 0x20000000 /* FAT is mirrored */ #define MSDOSFS_LARGEFS 0x10000000 /* perform fileno mapping */ +#define MSDOSFS_FSIMOD 0x01000000 #define MSDOSFS_ARGSMAGIC 0xe4eff300 From owner-svn-src-stable@FreeBSD.ORG Sun Mar 3 07:27:16 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 771334F4; Sun, 3 Mar 2013 07:27:16 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 4EDFF8CF; Sun, 3 Mar 2013 07:27:16 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r237RGo6034492; Sun, 3 Mar 2013 07:27:16 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r237RFDv034489; Sun, 3 Mar 2013 07:27:15 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201303030727.r237RFDv034489@svn.freebsd.org> From: Konstantin Belousov Date: Sun, 3 Mar 2013 07:27:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r247686 - stable/8/sys/fs/msdosfs X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Mar 2013 07:27:16 -0000 Author: kib Date: Sun Mar 3 07:27:15 2013 New Revision: 247686 URL: http://svnweb.freebsd.org/changeset/base/247686 Log: MFC r246921: Do not update the fsinfo block on each update of any fat block. Postpone the flush to VFS_SYNC(). Modified: stable/8/sys/fs/msdosfs/msdosfs_fat.c stable/8/sys/fs/msdosfs/msdosfs_vfsops.c stable/8/sys/fs/msdosfs/msdosfsmount.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/fs/ (props changed) Modified: stable/8/sys/fs/msdosfs/msdosfs_fat.c ============================================================================== --- stable/8/sys/fs/msdosfs/msdosfs_fat.c Sun Mar 3 07:09:25 2013 (r247685) +++ stable/8/sys/fs/msdosfs/msdosfs_fat.c Sun Mar 3 07:27:15 2013 (r247686) @@ -328,29 +328,6 @@ updatefats(pmp, bp, fatbn) printf("updatefats(pmp %p, bp %p, fatbn %lu)\n", pmp, bp, fatbn); #endif - /* - * If we have an FSInfo block, update it. - */ - if (pmp->pm_fsinfo) { - if (bread(pmp->pm_devvp, pmp->pm_fsinfo, pmp->pm_BytesPerSec, - NOCRED, &bpn) != 0) { - /* - * Ignore the error, but turn off FSInfo update for the future. - */ - pmp->pm_fsinfo = 0; - brelse(bpn); - } else { - struct fsinfo *fp = (struct fsinfo *)bpn->b_data; - - putulong(fp->fsinfree, pmp->pm_freeclustercount); - putulong(fp->fsinxtfree, pmp->pm_nxtfree); - if (pmp->pm_flags & MSDOSFSMNT_WAITONFAT) - bwrite(bpn); - else - bdwrite(bpn); - } - } - if (pmp->pm_flags & MSDOSFS_FATMIRROR) { /* * Now copy the block(s) of the modified fat to the other copies of @@ -393,9 +370,6 @@ updatefats(pmp, bp, fatbn) bwrite(bp); else bdwrite(bp); - /* - * Maybe update fsinfo sector here? - */ } /* @@ -431,6 +405,7 @@ usemap_alloc(pmp, cn) pmp->pm_inusemap[cn / N_INUSEBITS] |= 1 << (cn % N_INUSEBITS); KASSERT(pmp->pm_freeclustercount > 0, ("usemap_alloc: too little")); pmp->pm_freeclustercount--; + pmp->pm_flags |= MSDOSFS_FSIMOD; } static __inline void @@ -441,6 +416,7 @@ usemap_free(pmp, cn) MSDOSFS_ASSERT_MP_LOCKED(pmp); pmp->pm_freeclustercount++; + pmp->pm_flags |= MSDOSFS_FSIMOD; KASSERT((pmp->pm_inusemap[cn / N_INUSEBITS] & (1 << (cn % N_INUSEBITS))) != 0, ("Freeing unused sector %ld %ld %x", cn, cn % N_INUSEBITS, (unsigned)pmp->pm_inusemap[cn / N_INUSEBITS])); @@ -742,7 +718,10 @@ chainalloc(pmp, start, count, fillwith, for (cl = start, n = count; n-- > 0;) usemap_alloc(pmp, cl++); - + pmp->pm_nxtfree = start + count; + if (pmp->pm_nxtfree > pmp->pm_maxcluster) + pmp->pm_nxtfree = CLUST_FIRST; + pmp->pm_flags |= MSDOSFS_FSIMOD; error = fatchain(pmp, start, count, fillwith); if (error != 0) return (error); @@ -754,9 +733,6 @@ chainalloc(pmp, start, count, fillwith, *retcluster = start; if (got) *got = count; - pmp->pm_nxtfree = start + count; - if (pmp->pm_nxtfree > pmp->pm_maxcluster) - pmp->pm_nxtfree = CLUST_FIRST; return (0); } Modified: stable/8/sys/fs/msdosfs/msdosfs_vfsops.c ============================================================================== --- stable/8/sys/fs/msdosfs/msdosfs_vfsops.c Sun Mar 3 07:09:25 2013 (r247685) +++ stable/8/sys/fs/msdosfs/msdosfs_vfsops.c Sun Mar 3 07:27:15 2013 (r247686) @@ -893,6 +893,40 @@ msdosfs_statfs(struct mount *mp, struct return (0); } +/* + * If we have an FSInfo block, update it. + */ +static int +msdosfs_fsiflush(struct msdosfsmount *pmp, int waitfor) +{ + struct fsinfo *fp; + struct buf *bp; + int error; + + MSDOSFS_LOCK_MP(pmp); + if (pmp->pm_fsinfo == 0 || (pmp->pm_flags & MSDOSFS_FSIMOD) == 0) { + error = 0; + goto unlock; + } + error = bread(pmp->pm_devvp, pmp->pm_fsinfo, pmp->pm_BytesPerSec, + NOCRED, &bp); + if (error != 0) { + brelse(bp); + goto unlock; + } + fp = (struct fsinfo *)bp->b_data; + putulong(fp->fsinfree, pmp->pm_freeclustercount); + putulong(fp->fsinxtfree, pmp->pm_nxtfree); + pmp->pm_flags &= ~MSDOSFS_FSIMOD; + if (waitfor == MNT_WAIT) + error = bwrite(bp); + else + bawrite(bp); +unlock: + MSDOSFS_UNLOCK_MP(pmp); + return (error); +} + static int msdosfs_sync(struct mount *mp, int waitfor) { @@ -962,6 +996,10 @@ loop: allerror = error; VOP_UNLOCK(pmp->pm_devvp, 0); } + + error = msdosfs_fsiflush(pmp, waitfor); + if (error != 0) + allerror = error; return (allerror); } Modified: stable/8/sys/fs/msdosfs/msdosfsmount.h ============================================================================== --- stable/8/sys/fs/msdosfs/msdosfsmount.h Sun Mar 3 07:09:25 2013 (r247685) +++ stable/8/sys/fs/msdosfs/msdosfsmount.h Sun Mar 3 07:27:15 2013 (r247686) @@ -262,6 +262,7 @@ struct msdosfs_args { #define MSDOSFSMNT_WAITONFAT 0x40000000 /* mounted synchronous */ #define MSDOSFS_FATMIRROR 0x20000000 /* FAT is mirrored */ #define MSDOSFS_LARGEFS 0x10000000 /* perform fileno mapping */ +#define MSDOSFS_FSIMOD 0x01000000 #define MSDOSFS_ARGSMAGIC 0xe4eff300 From owner-svn-src-stable@FreeBSD.ORG Sun Mar 3 07:45:42 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id CB85D7DF; Sun, 3 Mar 2013 07:45:42 +0000 (UTC) (envelope-from dteske@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 99AB9960; Sun, 3 Mar 2013 07:45:42 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r237jf57040066; Sun, 3 Mar 2013 07:45:41 GMT (envelope-from dteske@svn.freebsd.org) Received: (from dteske@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r237jf8K040062; Sun, 3 Mar 2013 07:45:41 GMT (envelope-from dteske@svn.freebsd.org) Message-Id: <201303030745.r237jf8K040062@svn.freebsd.org> From: Devin Teske Date: Sun, 3 Mar 2013 07:45:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r247687 - stable/8/usr.sbin/sysinstall X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Mar 2013 07:45:42 -0000 Author: dteske Date: Sun Mar 3 07:45:40 2013 New Revision: 247687 URL: http://svnweb.freebsd.org/changeset/base/247687 Log: MFS 9->8 r234737: Fix several 'format string is not a literal' warnings in sysinstall. Since sysinstall does not exist anymore in head, this is a direct commit. Modified: stable/8/usr.sbin/sysinstall/dispatch.c stable/8/usr.sbin/sysinstall/install.c stable/8/usr.sbin/sysinstall/label.c stable/8/usr.sbin/sysinstall/modules.c Modified: stable/8/usr.sbin/sysinstall/dispatch.c ============================================================================== --- stable/8/usr.sbin/sysinstall/dispatch.c Sun Mar 3 07:27:15 2013 (r247686) +++ stable/8/usr.sbin/sysinstall/dispatch.c Sun Mar 3 07:45:40 2013 (r247687) @@ -591,7 +591,7 @@ dispatch_load_menu(dialogMenuItem *self) if (err != NULL) { what |= DITEM_FAILURE; if (!variable_get(VAR_NO_ERROR)) - msgConfirm(err); + msgConfirm("%s", err); } return (what); Modified: stable/8/usr.sbin/sysinstall/install.c ============================================================================== --- stable/8/usr.sbin/sysinstall/install.c Sun Mar 3 07:27:15 2013 (r247686) +++ stable/8/usr.sbin/sysinstall/install.c Sun Mar 3 07:45:40 2013 (r247687) @@ -1018,10 +1018,10 @@ performNewfs(PartInfo *pi, char *dname, } if (queue == QUEUE_YES) { - command_shell_add(pi->mountpoint, buffer); + command_shell_add(pi->mountpoint, "%s", buffer); return (0); } else - return (vsystem(buffer)); + return (vsystem("%s", buffer)); } return (0); } Modified: stable/8/usr.sbin/sysinstall/label.c ============================================================================== --- stable/8/usr.sbin/sysinstall/label.c Sun Mar 3 07:27:15 2013 (r247686) +++ stable/8/usr.sbin/sysinstall/label.c Sun Mar 3 07:45:40 2013 (r247687) @@ -978,7 +978,7 @@ diskLabel(Device *dev) } if (msg) { if (req) { - msgConfirm(msg); + msgConfirm("%s", msg); clear_wins(); msg = NULL; } Modified: stable/8/usr.sbin/sysinstall/modules.c ============================================================================== --- stable/8/usr.sbin/sysinstall/modules.c Sun Mar 3 07:27:15 2013 (r247686) +++ stable/8/usr.sbin/sysinstall/modules.c Sun Mar 3 07:45:40 2013 (r247687) @@ -199,7 +199,7 @@ kldBrowser(dialogMenuItem *self) if (err != NULL) { what |= DITEM_FAILURE; if (!variable_get(VAR_NO_ERROR)) - msgConfirm(err); + msgConfirm("%s", err); } return (what); From owner-svn-src-stable@FreeBSD.ORG Sun Mar 3 07:50:34 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 09C2396E; Sun, 3 Mar 2013 07:50:34 +0000 (UTC) (envelope-from dteske@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id E552697C; Sun, 3 Mar 2013 07:50:33 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r237oXsC040720; Sun, 3 Mar 2013 07:50:33 GMT (envelope-from dteske@svn.freebsd.org) Received: (from dteske@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r237oX8k040719; Sun, 3 Mar 2013 07:50:33 GMT (envelope-from dteske@svn.freebsd.org) Message-Id: <201303030750.r237oX8k040719@svn.freebsd.org> From: Devin Teske Date: Sun, 3 Mar 2013 07:50:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r247688 - stable/8/usr.sbin/sysinstall X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Mar 2013 07:50:34 -0000 Author: dteske Date: Sun Mar 3 07:50:33 2013 New Revision: 247688 URL: http://svnweb.freebsd.org/changeset/base/247688 Log: MFS 9->8 r244573: Fix typo. (fixing them as I find them) Modified: stable/8/usr.sbin/sysinstall/ftp.c Modified: stable/8/usr.sbin/sysinstall/ftp.c ============================================================================== --- stable/8/usr.sbin/sysinstall/ftp.c Sun Mar 3 07:45:40 2013 (r247687) +++ stable/8/usr.sbin/sysinstall/ftp.c Sun Mar 3 07:50:33 2013 (r247688) @@ -107,7 +107,7 @@ try: hostname = variable_get(VAR_FTP_HOST); dir = variable_get(VAR_FTP_DIR); if (!hostname || !dir) { - msgConfirm("Missing FTP host or directory specification. FTP media not initialized,"); + msgConfirm("Missing FTP host or directory specification. FTP media not initialized."); netDown(dev); return FALSE; } From owner-svn-src-stable@FreeBSD.ORG Sun Mar 3 07:54:29 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 52669BCB; Sun, 3 Mar 2013 07:54:29 +0000 (UTC) (envelope-from dteske@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 2C9E999C; Sun, 3 Mar 2013 07:54:29 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r237sTYL042877; Sun, 3 Mar 2013 07:54:29 GMT (envelope-from dteske@svn.freebsd.org) Received: (from dteske@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r237sT6p042876; Sun, 3 Mar 2013 07:54:29 GMT (envelope-from dteske@svn.freebsd.org) Message-Id: <201303030754.r237sT6p042876@svn.freebsd.org> From: Devin Teske Date: Sun, 3 Mar 2013 07:54:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r247689 - stable/8/usr.sbin/sysinstall/help X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Mar 2013 07:54:29 -0000 Author: dteske Date: Sun Mar 3 07:54:28 2013 New Revision: 247689 URL: http://svnweb.freebsd.org/changeset/base/247689 Log: MFS 9->8 r245438: Oops, r186202 (4 years ago) forgot to remove Tape from the F1 Help file. Modified: stable/8/usr.sbin/sysinstall/help/media.hlp Modified: stable/8/usr.sbin/sysinstall/help/media.hlp ============================================================================== --- stable/8/usr.sbin/sysinstall/help/media.hlp Sun Mar 3 07:50:33 2013 (r247688) +++ stable/8/usr.sbin/sysinstall/help/media.hlp Sun Mar 3 07:54:28 2013 (r247689) @@ -46,9 +46,3 @@ You can install from the following types If this install method hangs on you or refuses to work properly, you may need to set some special options for your NFS server. See the Options screen for more details. - - - Tape Extract distribution files from tape into a temporary - directory and install from there. If the tape was created - with blocksize other than 20, you may wish to change this - in the Options screen. From owner-svn-src-stable@FreeBSD.ORG Sun Mar 3 08:02:08 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id B2076D98; Sun, 3 Mar 2013 08:02:08 +0000 (UTC) (envelope-from dteske@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 8A5829CA; Sun, 3 Mar 2013 08:02:08 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r238283X045697; Sun, 3 Mar 2013 08:02:08 GMT (envelope-from dteske@svn.freebsd.org) Received: (from dteske@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r23828Ae045695; Sun, 3 Mar 2013 08:02:08 GMT (envelope-from dteske@svn.freebsd.org) Message-Id: <201303030802.r23828Ae045695@svn.freebsd.org> From: Devin Teske Date: Sun, 3 Mar 2013 08:02:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r247690 - stable/8/usr.sbin/sysinstall/help X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Mar 2013 08:02:08 -0000 Author: dteske Date: Sun Mar 3 08:02:07 2013 New Revision: 247690 URL: http://svnweb.freebsd.org/changeset/base/247690 Log: MFS 9->8 r247241: Oops, r186202 (over 4 years ago) forgot to remove Tape from the F1 Help file. Direct commit to stable/9 (no sysinstall in head). MFS 9->8 r247242: Oops, r215291 (over 2 years ago) forgot to remove mention of "medium" from the F1 Help file. Direct commit to stable/9 (no sysinstall in head). Modified: stable/8/usr.sbin/sysinstall/help/options.hlp Modified: stable/8/usr.sbin/sysinstall/help/options.hlp ============================================================================== --- stable/8/usr.sbin/sysinstall/help/options.hlp Sun Mar 3 07:54:28 2013 (r247689) +++ stable/8/usr.sbin/sysinstall/help/options.hlp Sun Mar 3 08:02:07 2013 (r247690) @@ -88,21 +88,12 @@ Editor: Specify which screen editor to setting to `/usr/bin/vi'. -Tape Blocksize: Specify block size in 512 byte blocks of tape. - - This defaults to 20 blocks, which should work with most - tape drive + tar combinations. It may not allow your particular - drive to win any records for speed, however, and the more - adventurous among you might try experimenting with larger sizes. - - Extract Detail: How to show filenames on debug screen as they're extracted. While a distribution is being extracted, the default detail level of "high" will show the full file names as they're extracted. - If you would prefer a more terse form for this, namely dots, select - the "medium" detail level. If you want nothing to be printed - on the debugging screen during extraction, select "low". + If you want nothing to be printed on the debugging screen during + extraction, select "low". Release Name: Which release to attempt to load from installation media. From owner-svn-src-stable@FreeBSD.ORG Sun Mar 3 08:04:12 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 28284F05; Sun, 3 Mar 2013 08:04:12 +0000 (UTC) (envelope-from dteske@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 18E009D2; Sun, 3 Mar 2013 08:04:12 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r2384BYG046066; Sun, 3 Mar 2013 08:04:11 GMT (envelope-from dteske@svn.freebsd.org) Received: (from dteske@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r2384Bcl046065; Sun, 3 Mar 2013 08:04:11 GMT (envelope-from dteske@svn.freebsd.org) Message-Id: <201303030804.r2384Bcl046065@svn.freebsd.org> From: Devin Teske Date: Sun, 3 Mar 2013 08:04:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r247691 - stable/8/usr.sbin/sysinstall X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Mar 2013 08:04:12 -0000 Author: dteske Date: Sun Mar 3 08:04:11 2013 New Revision: 247691 URL: http://svnweb.freebsd.org/changeset/base/247691 Log: MFS 9->8 r244676: Fix another typo while we're here. Modified: stable/8/usr.sbin/sysinstall/http.c Modified: stable/8/usr.sbin/sysinstall/http.c ============================================================================== --- stable/8/usr.sbin/sysinstall/http.c Sun Mar 3 08:02:07 2013 (r247690) +++ stable/8/usr.sbin/sysinstall/http.c Sun Mar 3 08:04:11 2013 (r247691) @@ -253,7 +253,7 @@ mediaGetHTTP(Device *dev, char *file, Bo msgConfirm("Client error %s, you could try an other server",buf); return NULL; } else if (rv >= 300) { - msgConfirm("Error %s,",buf); + msgConfirm("Error %s",buf); return NULL; } else if (rv != 200) { msgConfirm("Error %s when sending %s, you could try an other server",buf, req); From owner-svn-src-stable@FreeBSD.ORG Sun Mar 3 08:17:18 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 09F4F499; Sun, 3 Mar 2013 08:17:18 +0000 (UTC) (envelope-from dteske@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id E4348A30; Sun, 3 Mar 2013 08:17:17 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r238HHHK049850; Sun, 3 Mar 2013 08:17:17 GMT (envelope-from dteske@svn.freebsd.org) Received: (from dteske@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r238HH9o049848; Sun, 3 Mar 2013 08:17:17 GMT (envelope-from dteske@svn.freebsd.org) Message-Id: <201303030817.r238HH9o049848@svn.freebsd.org> From: Devin Teske Date: Sun, 3 Mar 2013 08:17:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r247692 - stable/8/usr.sbin/sysinstall X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Mar 2013 08:17:18 -0000 Author: dteske Date: Sun Mar 3 08:17:17 2013 New Revision: 247692 URL: http://svnweb.freebsd.org/changeset/base/247692 Log: MFS 9->8 r215224: We still support PLIP devices, so mention them in addition to ethernet. Modified: stable/8/usr.sbin/sysinstall/install.c stable/8/usr.sbin/sysinstall/menus.c Modified: stable/8/usr.sbin/sysinstall/install.c ============================================================================== --- stable/8/usr.sbin/sysinstall/install.c Sun Mar 3 08:04:11 2013 (r247691) +++ stable/8/usr.sbin/sysinstall/install.c Sun Mar 3 08:17:17 2013 (r247692) @@ -690,7 +690,7 @@ nodisks: "may do so by typing: /usr/sbin/sysinstall."); } if (mediaDevice->type != DEVICE_TYPE_FTP && mediaDevice->type != DEVICE_TYPE_NFS) { - if (!msgYesNo("Would you like to configure any Ethernet network devices?")) { + if (!msgYesNo("Would you like to configure any Ethernet or PLIP network devices?")) { Device *tmp = tcpDeviceSelect(); if (tmp && !((DevInfo *)tmp->private)->use_dhcp && !msgYesNo("Would you like to bring the %s interface up right now?", tmp->name)) Modified: stable/8/usr.sbin/sysinstall/menus.c ============================================================================== --- stable/8/usr.sbin/sysinstall/menus.c Sun Mar 3 08:04:11 2013 (r247691) +++ stable/8/usr.sbin/sysinstall/menus.c Sun Mar 3 08:17:17 2013 (r247692) @@ -884,7 +884,7 @@ DMenu MenuMediaFTP = { DMenu MenuNetworkDevice = { DMENU_NORMAL_TYPE | DMENU_SELECTION_RETURNS, "Network interface information required", - "Please select the ethernet device to configure.\n\n" + "Please select the ethernet or PLIP device to configure.\n\n" "", "Press F1 to read network configuration manual", "network_device", From owner-svn-src-stable@FreeBSD.ORG Sun Mar 3 08:21:17 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id D87846D7; Sun, 3 Mar 2013 08:21:17 +0000 (UTC) (envelope-from dteske@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id CADB6A5D; Sun, 3 Mar 2013 08:21:17 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r238LHWa052022; Sun, 3 Mar 2013 08:21:17 GMT (envelope-from dteske@svn.freebsd.org) Received: (from dteske@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r238LH2i052020; Sun, 3 Mar 2013 08:21:17 GMT (envelope-from dteske@svn.freebsd.org) Message-Id: <201303030821.r238LH2i052020@svn.freebsd.org> From: Devin Teske Date: Sun, 3 Mar 2013 08:21:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r247693 - stable/8/usr.sbin/sysinstall X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Mar 2013 08:21:17 -0000 Author: dteske Date: Sun Mar 3 08:21:17 2013 New Revision: 247693 URL: http://svnweb.freebsd.org/changeset/base/247693 Log: MFS 9->8 r209778: Add further documentation for netDev in install.cfg to reflect the new usage. Approved by: cperciva Modified: stable/8/usr.sbin/sysinstall/install.cfg Modified: stable/8/usr.sbin/sysinstall/install.cfg ============================================================================== --- stable/8/usr.sbin/sysinstall/install.cfg Sun Mar 3 08:17:17 2013 (r247692) +++ stable/8/usr.sbin/sysinstall/install.cfg Sun Mar 3 08:21:17 2013 (r247693) @@ -20,6 +20,7 @@ netmask=255.255.255.240 ################################ # Which installation device to use - ftp is pointed directly at my local # machine and the installation device is my WD8013 ethernet interface. +# netDev can be set to ANY or a comma-delimited list of interfaces. _ftpPath=ftp://time.cdrom.com/pub netDev=ed0 mediaSetFTP From owner-svn-src-stable@FreeBSD.ORG Sun Mar 3 08:51:57 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 9B3D5A2B; Sun, 3 Mar 2013 08:51:57 +0000 (UTC) (envelope-from dteske@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 8C8C9AE9; Sun, 3 Mar 2013 08:51:57 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r238pve1060793; Sun, 3 Mar 2013 08:51:57 GMT (envelope-from dteske@svn.freebsd.org) Received: (from dteske@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r238pv0r060791; Sun, 3 Mar 2013 08:51:57 GMT (envelope-from dteske@svn.freebsd.org) Message-Id: <201303030851.r238pv0r060791@svn.freebsd.org> From: Devin Teske Date: Sun, 3 Mar 2013 08:51:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r247694 - stable/8/usr.sbin/sysinstall X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Mar 2013 08:51:57 -0000 Author: dteske Date: Sun Mar 3 08:51:56 2013 New Revision: 247694 URL: http://svnweb.freebsd.org/changeset/base/247694 Log: MFS 9->8 r217491 with slight modification: Reduce the amount of text users need to read on each screen. Also try and make it more relevant to modern systems: for example users will be familiar with the MBR but possibly less so with MS-DOS. After installation has finished don't return to the main menu but exit. Slight modification: Ignore the last sentence (need feedback from brucec before carrying that back to 8 where sysinstall is still the main installer). Modified: stable/8/usr.sbin/sysinstall/install.c stable/8/usr.sbin/sysinstall/menus.c Modified: stable/8/usr.sbin/sysinstall/install.c ============================================================================== --- stable/8/usr.sbin/sysinstall/install.c Sun Mar 3 08:21:17 2013 (r247693) +++ stable/8/usr.sbin/sysinstall/install.c Sun Mar 3 08:51:56 2013 (r247694) @@ -635,10 +635,10 @@ installStandard(dialogMenuItem *self) variable_set2(SYSTEM_STATE, "standard", 0); dialog_clear_norefresh(); #ifdef WITH_SLICES - msgConfirm("In the next menu, you will need to set up a DOS-style (\"fdisk\") partitioning\n" + msgConfirm("In the next menu, you will need to set up an MBR partitioning\n" "scheme for your hard disk. If you simply wish to devote all disk space\n" - "to FreeBSD (overwriting anything else that might be on the disk(s) selected)\n" - "then use the (A)ll command to select the default partitioning scheme followed\n" + "to FreeBSD (overwriting anything else that might be on the disk selected)\n" + "then use the (A)ll command to create a single partition followed\n" "by a (Q)uit. If you wish to allocate only free space to FreeBSD, move to a\n" "partition marked \"unused\" and use the (C)reate command."); @@ -653,7 +653,7 @@ nodisks: goto nodisks; } - msgConfirm("Now you need to create BSD partitions inside of the fdisk partition(s)\n" + msgConfirm("Now you need to create BSD partitions inside of the MBR partition(s)\n" "just created. If you have a reasonable amount of disk space (1GB or more)\n" "and don't have any special requirements, simply use the (A)uto command to\n" "allocate space automatically. If you have more specific needs or just don't\n" Modified: stable/8/usr.sbin/sysinstall/menus.c ============================================================================== --- stable/8/usr.sbin/sysinstall/menus.c Sun Mar 3 08:21:17 2013 (r247693) +++ stable/8/usr.sbin/sysinstall/menus.c Sun Mar 3 08:51:56 2013 (r247694) @@ -174,7 +174,7 @@ DMenu MenuIndex = { #ifdef WITH_MICE { " Device, Mouse", "The mouse configuration menu.", NULL, dmenuSubmenu, NULL, &MenuMouse }, #endif - { " Disklabel", "The disk Label editor", NULL, diskLabelEditor }, + { " Disklabel", "The disk label editor", NULL, diskLabelEditor }, { " Dists, All", "Root of the distribution tree.", NULL, dmenuSubmenu, NULL, &MenuDistributions }, { " Dists, Basic", "Basic FreeBSD distribution menu.", NULL, dmenuSubmenu, NULL, &MenuSubDistributions }, { " Dists, Developer", "Select developer's distribution.", checkDistDeveloper, distSetDeveloper }, @@ -213,7 +213,7 @@ DMenu MenuIndex = { { " Media, UFS", "Select UFS installation media.", NULL, mediaSetUFS }, { " Media, FTP", "Select FTP installation media.", NULL, mediaSetFTP }, { " Media, FTP Passive", "Select passive FTP installation media.", NULL, mediaSetFTPPassive }, - { " Media, HTTP", "Select FTP via HTTP proxy installation media.", NULL, mediaSetHTTP }, + { " Media, HTTP", "Select FTP via HTTP proxy install media.", NULL, mediaSetHTTP }, { " Network Interfaces", "Configure network interfaces", NULL, tcpMenuSelect }, { " Networking Services", "The network services menu.", NULL, dmenuSubmenu, NULL, &MenuNetworking }, { " NFS, client", "Set NFS client flag.", dmenuVarCheck, dmenuToggleVariable, NULL, "nfs_client_enable=YES" }, @@ -222,7 +222,7 @@ DMenu MenuIndex = { { " Options", "The options editor.", NULL, optionsEditor }, { " Packages", "The packages collection", NULL, configPackages }, #ifdef WITH_SLICES - { " Partition", "The disk Slice (PC-style partition) Editor", NULL, diskPartitionEditor }, + { " Partition", "The disk slice (PC-style partition) editor", NULL, diskPartitionEditor }, #endif { " PCNFSD", "Run authentication server for PC-NFS.", dmenuVarCheck, configPCNFSD, NULL, "pcnfsd" }, { " Root Password", "Set the system manager's password.", NULL, dmenuSystemCommand, NULL, "passwd root" }, @@ -1215,10 +1215,10 @@ DMenu MenuConfigure = { { " Root Password", "Set the system manager's password", NULL, dmenuSystemCommand, NULL, "passwd root" }, #ifdef WITH_SLICES - { " Fdisk", "The disk Slice (PC-style partition) Editor", + { " Fdisk", "The disk slice (PC-style partition) editor", NULL, diskPartitionEditor }, #endif - { " Label", "The disk Label editor", + { " Label", "The disk label editor", NULL, diskLabelEditor }, { " User Management", "Add user and group information", NULL, dmenuSubmenu, NULL, &MenuUsermgmt }, @@ -1864,10 +1864,7 @@ DMenu MenuSysconsKeymap = { "System Console Keymap", "The system console driver for FreeBSD defaults to a standard\n" "\"PC-98x1\" keyboard map. Users may wish to choose one of the\n" - "other keymaps below.\n" - "Note that sysinstall itself only uses the part of the keyboard map\n" - "which is required to generate the ANSI character subset, but your\n" - "choice of keymap will also be saved for later (fuller) use.", + "other keymaps below.", "Choose a keyboard map", NULL, { { "Japanese PC-98x1", "Japanese PC-98x1 keymap", dmenuVarCheck, dmenuSetKmapVariable, NULL, "keymap=jp.pc98" }, @@ -1879,12 +1876,8 @@ DMenu MenuSysconsKeymap = { DMENU_NORMAL_TYPE | DMENU_SELECTION_RETURNS, "System Console Keymap", "The system console driver for FreeBSD defaults to a standard\n" - "\"American\" keyboard map. Users in other countries (or with\n" - "different keyboard preferences) may wish to choose one of the\n" - "other keymaps below.\n" - "Note that sysinstall itself only uses the part of the keyboard map\n" - "which is required to generate the ANSI character subset, but your\n" - "choice of keymap will also be saved for later (fuller) use.", + "\"US\" keyboard map. Users may wish to choose one of the\n" + "other keymaps below.", "Choose a keyboard map", NULL, { { "Belgian", "Belgian ISO keymap", dmenuVarCheck, dmenuSetKmapVariable, NULL, "keymap=be.iso" }, From owner-svn-src-stable@FreeBSD.ORG Sun Mar 3 08:56:11 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 8A178BB3; Sun, 3 Mar 2013 08:56:11 +0000 (UTC) (envelope-from dteske@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 7BFFFB02; Sun, 3 Mar 2013 08:56:11 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r238uB6E061412; Sun, 3 Mar 2013 08:56:11 GMT (envelope-from dteske@svn.freebsd.org) Received: (from dteske@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r238uBau061411; Sun, 3 Mar 2013 08:56:11 GMT (envelope-from dteske@svn.freebsd.org) Message-Id: <201303030856.r238uBau061411@svn.freebsd.org> From: Devin Teske Date: Sun, 3 Mar 2013 08:56:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r247695 - stable/8/usr.sbin/sysinstall X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Mar 2013 08:56:11 -0000 Author: dteske Date: Sun Mar 3 08:56:10 2013 New Revision: 247695 URL: http://svnweb.freebsd.org/changeset/base/247695 Log: MFS 9->8 the sysinstall portion of r223492: Remove duplicated header files Modified: stable/8/usr.sbin/sysinstall/modules.c Modified: stable/8/usr.sbin/sysinstall/modules.c ============================================================================== --- stable/8/usr.sbin/sysinstall/modules.c Sun Mar 3 08:51:56 2013 (r247694) +++ stable/8/usr.sbin/sysinstall/modules.c Sun Mar 3 08:56:10 2013 (r247695) @@ -32,7 +32,6 @@ #include #include #include -#include #include #include #include From owner-svn-src-stable@FreeBSD.ORG Sun Mar 3 09:10:00 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id B300C49B; Sun, 3 Mar 2013 09:10:00 +0000 (UTC) (envelope-from dteske@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id A4FE5B5C; Sun, 3 Mar 2013 09:10:00 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r239A0VV065403; Sun, 3 Mar 2013 09:10:00 GMT (envelope-from dteske@svn.freebsd.org) Received: (from dteske@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r239A0Bb065396; Sun, 3 Mar 2013 09:10:00 GMT (envelope-from dteske@svn.freebsd.org) Message-Id: <201303030910.r239A0Bb065396@svn.freebsd.org> From: Devin Teske Date: Sun, 3 Mar 2013 09:10:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r247697 - stable/8/usr.sbin/sysinstall X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Mar 2013 09:10:00 -0000 Author: dteske Date: Sun Mar 3 09:09:59 2013 New Revision: 247697 URL: http://svnweb.freebsd.org/changeset/base/247697 Log: MFS 9->8 r209782: Add support for remote logging to syslogd via an install.cfg variable. Approved by: cperciva Modified: stable/8/usr.sbin/sysinstall/install.cfg stable/8/usr.sbin/sysinstall/msg.c stable/8/usr.sbin/sysinstall/sysinstall.h Modified: stable/8/usr.sbin/sysinstall/install.cfg ============================================================================== --- stable/8/usr.sbin/sysinstall/install.cfg Sun Mar 3 09:09:35 2013 (r247696) +++ stable/8/usr.sbin/sysinstall/install.cfg Sun Mar 3 09:09:59 2013 (r247697) @@ -17,6 +17,9 @@ ipaddr=204.216.27.230 netmask=255.255.255.240 ################################ +# Log to a remote syslogd server +syslogdServer=10.0.1.1 + ################################ # Which installation device to use - ftp is pointed directly at my local # machine and the installation device is my WD8013 ethernet interface. Modified: stable/8/usr.sbin/sysinstall/msg.c ============================================================================== --- stable/8/usr.sbin/sysinstall/msg.c Sun Mar 3 09:09:35 2013 (r247696) +++ stable/8/usr.sbin/sysinstall/msg.c Sun Mar 3 09:09:59 2013 (r247697) @@ -34,10 +34,18 @@ * */ -#include "sysinstall.h" -#include #include #include +#include +#include + +#include +#include + +#include +#include + +#include "sysinstall.h" Boolean isDebug(void) @@ -47,6 +55,50 @@ isDebug(void) return (cp = variable_get(VAR_DEBUG)) && strcmp(cp, "no"); } +static Boolean +isNetworkUp(void) +{ + if (!(RunningAsInit) || + (variable_check("NETWORK_CONFIGURED=NO")) != TRUE) { + return TRUE; + } + + return FALSE; +} + +void +msgSyslog(const char *errstr) +{ + struct sockaddr_in server; + struct hostent *hp; + char *host, *line; + int sock; + + if (!isNetworkUp()) + return; + + if (!(host = variable_get(VAR_SYSLOG_SERVER))) + return; + + if (!(hp = gethostbyname2(host, AF_INET))) + return; + + if (!(sock = socket(AF_INET, SOCK_DGRAM, 0))) + return; + + bzero(&server, sizeof(struct sockaddr_in)); + server.sin_family = AF_INET; + server.sin_port = htons(514); + bcopy((char *)hp->h_addr, (char *)&server.sin_addr, hp->h_length); + + asprintf(&line, "<%d>%s", LOG_NOTICE, errstr); + sendto(sock, line, strlen(line), 0, (struct sockaddr *)&server, + sizeof(struct sockaddr_in)); + + close(sock); + free(line); +} + /* Whack up an informational message on the status line, in stand-out */ void msgYap(char *fmt, ...) @@ -99,6 +151,8 @@ msgInfo(char *fmt, ...) attrset(attrs); move(StatusLine, 79); refresh(); + + msgSyslog(errstr); } /* Whack up a warning on the status line */ @@ -120,8 +174,15 @@ msgWarn(char *fmt, ...) mvaddstr(StatusLine, 0, errstr); attrset(attrs); refresh(); - if (OnVTY && isDebug()) - msgDebug("Warning message `%s'\n", errstr); + + /* we don't want this hitting syslog twice */ + if (isDebug()) { + if (OnVTY) + msgDebug("Warning message `%s'\n", errstr); + else + msgSyslog(errstr); + } + } /* Whack up an error on the status line */ @@ -143,8 +204,14 @@ msgError(char *fmt, ...) mvaddstr(StatusLine, 0, errstr); attrset(attrs); refresh(); - if (OnVTY && isDebug()) - msgDebug("Error message `%s'\n", errstr); + + /* we don't want this hitting syslog twice */ + if (isDebug()) { + if (OnVTY) + msgDebug("Error message `%s'\n", errstr); + else + msgSyslog(errstr); + } } /* Whack up a fatal error on the status line */ @@ -174,6 +241,8 @@ msgFatal(char *fmt, ...) refresh(); if (OnVTY) msgDebug("Fatal error `%s'!\n", errstr); + else + msgSyslog(errstr); getch(); systemShutdown(1); } @@ -316,6 +385,9 @@ msgDebug(char *fmt, ...) va_start(args, fmt); vsnprintf((char *)(dbg + strlen(dbg)), FILENAME_MAX, fmt, args); va_end(args); + + msgSyslog(dbg); + write(DebugFD, dbg, strlen(dbg)); } Modified: stable/8/usr.sbin/sysinstall/sysinstall.h ============================================================================== --- stable/8/usr.sbin/sysinstall/sysinstall.h Sun Mar 3 09:09:35 2013 (r247696) +++ stable/8/usr.sbin/sysinstall/sysinstall.h Sun Mar 3 09:09:59 2013 (r247697) @@ -183,6 +183,7 @@ #define VAR_SERIAL_SPEED "serialSpeed" #define VAR_SLOW_ETHER "slowEthernetCard" #define VAR_SWAP_SIZE "swapSize" +#define VAR_SYSLOG_SERVER "syslogdServer" #define VAR_TRY_DHCP "tryDHCP" #define VAR_TRY_RTSOL "tryRTSOL" #define VAR_UFS_PATH "ufs" From owner-svn-src-stable@FreeBSD.ORG Sun Mar 3 09:13:19 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 0CD5C7AB; Sun, 3 Mar 2013 09:13:19 +0000 (UTC) (envelope-from dteske@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id F33ACBD9; Sun, 3 Mar 2013 09:13:18 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r239DIov067690; Sun, 3 Mar 2013 09:13:18 GMT (envelope-from dteske@svn.freebsd.org) Received: (from dteske@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r239DI9p067689; Sun, 3 Mar 2013 09:13:18 GMT (envelope-from dteske@svn.freebsd.org) Message-Id: <201303030913.r239DI9p067689@svn.freebsd.org> From: Devin Teske Date: Sun, 3 Mar 2013 09:13:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r247700 - stable/8/usr.sbin/sysinstall X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Mar 2013 09:13:19 -0000 Author: dteske Date: Sun Mar 3 09:13:18 2013 New Revision: 247700 URL: http://svnweb.freebsd.org/changeset/base/247700 Log: MFS 9->8 r247267: Oops, r55392 (over 13 years ago) forgot to classify the new HTTP Proxy for the options dialog (causing "" to be displayed for the HTTP media type). Modified: stable/8/usr.sbin/sysinstall/options.c Modified: stable/8/usr.sbin/sysinstall/options.c ============================================================================== --- stable/8/usr.sbin/sysinstall/options.c Sun Mar 3 09:13:17 2013 (r247699) +++ stable/8/usr.sbin/sysinstall/options.c Sun Mar 3 09:13:18 2013 (r247700) @@ -75,6 +75,9 @@ mediaCheck(Option *opt) case DEVICE_TYPE_FTP: return "FTP"; + case DEVICE_TYPE_HTTP: + return "HTTP Proxy"; + case DEVICE_TYPE_CDROM: return "CDROM"; From owner-svn-src-stable@FreeBSD.ORG Sun Mar 3 09:21:19 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 4FA6DBB5; Sun, 3 Mar 2013 09:21:19 +0000 (UTC) (envelope-from dteske@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 370DCC1E; Sun, 3 Mar 2013 09:21:19 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r239LJXC070439; Sun, 3 Mar 2013 09:21:19 GMT (envelope-from dteske@svn.freebsd.org) Received: (from dteske@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r239LJ4d070437; Sun, 3 Mar 2013 09:21:19 GMT (envelope-from dteske@svn.freebsd.org) Message-Id: <201303030921.r239LJ4d070437@svn.freebsd.org> From: Devin Teske Date: Sun, 3 Mar 2013 09:21:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r247702 - stable/8/usr.sbin/sysinstall X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Mar 2013 09:21:19 -0000 Author: dteske Date: Sun Mar 3 09:21:18 2013 New Revision: 247702 URL: http://svnweb.freebsd.org/changeset/base/247702 Log: MFS 9->8 r209481: Update the man page to reflect the changes to the netDev configuration variable. Approved by: cperciva MFS 9->8 r209446: Remove unnecessarily inflammatory commentary. Approved by: cperciva Modified: stable/8/usr.sbin/sysinstall/sysinstall.8 Modified: stable/8/usr.sbin/sysinstall/sysinstall.8 ============================================================================== --- stable/8/usr.sbin/sysinstall/sysinstall.8 Sun Mar 3 09:18:15 2013 (r247701) +++ stable/8/usr.sbin/sysinstall/sysinstall.8 Sun Mar 3 09:21:18 2013 (r247702) @@ -642,12 +642,10 @@ The domain name of the host being instal .It defaultrouter The default router for this host (non-optional). .It netDev -Which host interface to use -.Ar ( ed0 -or -.Ar ep0 , -for example. -Non-optional). +Which network interface to use. +Multiple network interfaces may be specified using a comma delimited list. +If netDev is set to ANY, all available network interfaces will be probed and the +first interface found to have a link will be used. (non-optional). .It netInteractive If set, bring up the interactive network setup form even if all relevant configuration variables are already set (optional). @@ -900,8 +898,5 @@ and .Xr bsdlabel 8 for these tasks. .Pp -This utility is a prototype which lasted several years past -its expiration date and is greatly in need of death. -.Pp There are a (great) number of undocumented variables. UTSL. From owner-svn-src-stable@FreeBSD.ORG Sun Mar 3 09:23:52 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id D06B1D36; Sun, 3 Mar 2013 09:23:52 +0000 (UTC) (envelope-from dteske@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id B843EC34; Sun, 3 Mar 2013 09:23:52 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r239NqQ3070817; Sun, 3 Mar 2013 09:23:52 GMT (envelope-from dteske@svn.freebsd.org) Received: (from dteske@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r239NqBE070816; Sun, 3 Mar 2013 09:23:52 GMT (envelope-from dteske@svn.freebsd.org) Message-Id: <201303030923.r239NqBE070816@svn.freebsd.org> From: Devin Teske Date: Sun, 3 Mar 2013 09:23:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r247703 - stable/8/usr.sbin/sysinstall X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Mar 2013 09:23:52 -0000 Author: dteske Date: Sun Mar 3 09:23:52 2013 New Revision: 247703 URL: http://svnweb.freebsd.org/changeset/base/247703 Log: MFS 9->8 r215314: ipv6_enable has been obsoleted in favour of ipv6_activate_all_interfaces. Modified: stable/8/usr.sbin/sysinstall/sysinstall.h Modified: stable/8/usr.sbin/sysinstall/sysinstall.h ============================================================================== --- stable/8/usr.sbin/sysinstall/sysinstall.h Sun Mar 3 09:21:18 2013 (r247702) +++ stable/8/usr.sbin/sysinstall/sysinstall.h Sun Mar 3 09:23:52 2013 (r247703) @@ -130,7 +130,7 @@ #define VAR_INSTALL_CFG "installConfig" #define VAR_INSTALL_ROOT "installRoot" #define VAR_IPADDR "ipaddr" -#define VAR_IPV6_ENABLE "ipv6_enable" +#define VAR_IPV6_ENABLE "ipv6_activate_all_interfaces" #define VAR_IPV6ADDR "ipv6addr" #define VAR_KERN_SECURELEVEL "kern_securelevel" #define VAR_KEYMAP "keymap" From owner-svn-src-stable@FreeBSD.ORG Sun Mar 3 09:26:59 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 446A6EDB; Sun, 3 Mar 2013 09:26:59 +0000 (UTC) (envelope-from dteske@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 1F885CC4; Sun, 3 Mar 2013 09:26:59 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r239QxRX071272; Sun, 3 Mar 2013 09:26:59 GMT (envelope-from dteske@svn.freebsd.org) Received: (from dteske@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r239QwPl071271; Sun, 3 Mar 2013 09:26:58 GMT (envelope-from dteske@svn.freebsd.org) Message-Id: <201303030926.r239QwPl071271@svn.freebsd.org> From: Devin Teske Date: Sun, 3 Mar 2013 09:26:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r247704 - stable/8/usr.sbin/sysinstall X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Mar 2013 09:26:59 -0000 Author: dteske Date: Sun Mar 3 09:26:58 2013 New Revision: 247704 URL: http://svnweb.freebsd.org/changeset/base/247704 Log: MFS 9->8 r244688: Fix error message to be accurate for when ProgName is not "sysinstall" (oops?) Modified: stable/8/usr.sbin/sysinstall/variable.c Modified: stable/8/usr.sbin/sysinstall/variable.c ============================================================================== --- stable/8/usr.sbin/sysinstall/variable.c Sun Mar 3 09:23:52 2013 (r247703) +++ stable/8/usr.sbin/sysinstall/variable.c Sun Mar 3 09:26:58 2013 (r247704) @@ -247,8 +247,8 @@ dump_variables(dialogMenuItem *unused) fp = fopen("/etc/sysinstall.vars", "w"); if (!fp) { - msgConfirm("Unable to write to /etc/%s.vars: %s", - ProgName, strerror(errno)); + msgConfirm("Unable to write to /etc/sysinstall.vars: %s", + strerror(errno)); return DITEM_FAILURE; } From owner-svn-src-stable@FreeBSD.ORG Sun Mar 3 16:16:11 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 36DF3BD4; Sun, 3 Mar 2013 16:16:11 +0000 (UTC) (envelope-from dteske@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 117BAE38; Sun, 3 Mar 2013 16:16:11 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r23GGA7V097684; Sun, 3 Mar 2013 16:16:10 GMT (envelope-from dteske@svn.freebsd.org) Received: (from dteske@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r23GGAWP097683; Sun, 3 Mar 2013 16:16:10 GMT (envelope-from dteske@svn.freebsd.org) Message-Id: <201303031616.r23GGAWP097683@svn.freebsd.org> From: Devin Teske Date: Sun, 3 Mar 2013 16:16:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r247718 - stable/8/usr.sbin/tzsetup X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Mar 2013 16:16:11 -0000 Author: dteske Date: Sun Mar 3 16:16:10 2013 New Revision: 247718 URL: http://svnweb.freebsd.org/changeset/base/247718 Log: MFC r232297: Grammar: tzsetup now has more than one option. Modified: stable/8/usr.sbin/tzsetup/tzsetup.8 Modified: stable/8/usr.sbin/tzsetup/tzsetup.8 ============================================================================== --- stable/8/usr.sbin/tzsetup/tzsetup.8 Sun Mar 3 15:19:49 2013 (r247717) +++ stable/8/usr.sbin/tzsetup/tzsetup.8 Sun Mar 3 16:16:10 2013 (r247718) @@ -49,7 +49,7 @@ utility also determines whether any adju the hardware clock does not keep .Tn UTC . .Pp -The following option is available: +The following options are available: .Bl -tag -offset indent -width Fl .It Fl C Ar chroot_directory Open all files and directories relative to From owner-svn-src-stable@FreeBSD.ORG Sun Mar 3 17:39:30 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 9423AD9; Sun, 3 Mar 2013 17:39:30 +0000 (UTC) (envelope-from dteske@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 6D977113; Sun, 3 Mar 2013 17:39:30 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r23HdUG2022292; Sun, 3 Mar 2013 17:39:30 GMT (envelope-from dteske@svn.freebsd.org) Received: (from dteske@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r23HdUYi022290; Sun, 3 Mar 2013 17:39:30 GMT (envelope-from dteske@svn.freebsd.org) Message-Id: <201303031739.r23HdUYi022290@svn.freebsd.org> From: Devin Teske Date: Sun, 3 Mar 2013 17:39:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r247721 - stable/9/usr.sbin/tzsetup X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Mar 2013 17:39:30 -0000 Author: dteske Date: Sun Mar 3 17:39:29 2013 New Revision: 247721 URL: http://svnweb.freebsd.org/changeset/base/247721 Log: MFC r230005: Use a reasonable-sized buffer when formatting error messages about installing zoneinfo. While we're in the vicinity, add some missing error checking to eliminate an unhelpful error message when unlink() fails. /me is embarrassed by the quality of his 16-year-old code. The whole thing is awful and could stand a complete rewrite. PR: 164038 Submitted by: Devin Teske (but implemented differently) Modified: stable/9/usr.sbin/tzsetup/tzsetup.c Modified: stable/9/usr.sbin/tzsetup/tzsetup.c ============================================================================== --- stable/9/usr.sbin/tzsetup/tzsetup.c Sun Mar 3 17:33:59 2013 (r247720) +++ stable/9/usr.sbin/tzsetup/tzsetup.c Sun Mar 3 17:39:29 2013 (r247721) @@ -56,6 +56,13 @@ __FBSDID("$FreeBSD$"); #define _PATH_DB "/var/db/zoneinfo" #define _PATH_WALL_CMOS_CLOCK "/etc/wall_cmos_clock" +#ifdef PATH_MAX +#define SILLY_BUFFER_SIZE 2*PATH_MAX +#else +#warning "Somebody needs to fix this to dynamically size this buffer." +#define SILLY_BUFFER_SIZE 2048 +#endif + static char path_zonetab[MAXPATHLEN], path_iso3166[MAXPATHLEN], path_zoneinfo[MAXPATHLEN], path_localtime[MAXPATHLEN], path_db[MAXPATHLEN], path_wall_cmos_clock[MAXPATHLEN]; @@ -523,7 +530,7 @@ static int install_zoneinfo_file(const char *zoneinfo_file) { char buf[1024]; - char title[64], prompt[64]; + char title[64], prompt[SILLY_BUFFER_SIZE]; struct stat sb; ssize_t len; int fd1, fd2, copymode; @@ -594,7 +601,18 @@ install_zoneinfo_file(const char *zonein return (DITEM_FAILURE | DITEM_RECREATE); } - unlink(path_localtime); + if (unlink(path_localtime) < 0 && errno != ENOENT) { + snprintf(prompt, sizeof(prompt), + "Could not unlink %s: %s", + path_localtime, strerror(errno)); + if (usedialog) { + snprintf(title, sizeof(title), "Error"); + dialog_msgbox(title, prompt, 8, 72, 1); + } else + fprintf(stderr, "%s\n", prompt); + return (DITEM_FAILURE | DITEM_RECREATE); + } + fd2 = open(path_localtime, O_CREAT | O_EXCL | O_WRONLY, S_IRUSR | S_IRGRP | S_IROTH); if (fd2 < 0) { @@ -640,7 +658,17 @@ install_zoneinfo_file(const char *zonein fprintf(stderr, "%s\n", prompt); return (DITEM_FAILURE | DITEM_RECREATE); } - unlink(path_localtime); + if (unlink(path_localtime) < 0 && errno != ENOENT) { + snprintf(prompt, sizeof(prompt), + "Could not unlink %s: %s", + path_localtime, strerror(errno)); + if (usedialog) { + snprintf(title, sizeof(title), "Error"); + dialog_msgbox(title, prompt, 8, 72, 1); + } else + fprintf(stderr, "%s\n", prompt); + return (DITEM_FAILURE | DITEM_RECREATE); + } if (symlink(zoneinfo_file, path_localtime) < 0) { snprintf(title, sizeof(title), "Error"); snprintf(prompt, sizeof(prompt), From owner-svn-src-stable@FreeBSD.ORG Sun Mar 3 19:00:01 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 1E79294C; Sun, 3 Mar 2013 19:00:01 +0000 (UTC) (envelope-from dteske@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 0FFF12E3; Sun, 3 Mar 2013 19:00:01 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r23J00En046469; Sun, 3 Mar 2013 19:00:00 GMT (envelope-from dteske@svn.freebsd.org) Received: (from dteske@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r23J00U2046463; Sun, 3 Mar 2013 19:00:00 GMT (envelope-from dteske@svn.freebsd.org) Message-Id: <201303031900.r23J00U2046463@svn.freebsd.org> From: Devin Teske Date: Sun, 3 Mar 2013 19:00:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r247722 - stable/9/usr.sbin/tzsetup X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Mar 2013 19:00:01 -0000 Author: dteske Date: Sun Mar 3 18:59:59 2013 New Revision: 247722 URL: http://svnweb.freebsd.org/changeset/base/247722 Log: MFC r227934: Port to new libdialog. Modified: stable/9/usr.sbin/tzsetup/Makefile stable/9/usr.sbin/tzsetup/tzsetup.c Modified: stable/9/usr.sbin/tzsetup/Makefile ============================================================================== --- stable/9/usr.sbin/tzsetup/Makefile Sun Mar 3 17:39:29 2013 (r247721) +++ stable/9/usr.sbin/tzsetup/Makefile Sun Mar 3 18:59:59 2013 (r247722) @@ -3,11 +3,11 @@ PROG= tzsetup MAN= tzsetup.8 -CFLAGS+= -I${.CURDIR}/../../gnu/lib/libodialog -I. +CFLAGS+= -I${.CURDIR}/../../contrib/dialog -I. WARNS?= 3 -DPADD= ${LIBODIALOG} ${LIBNCURSES} -LDADD= -lodialog -lncurses +DPADD= ${LIBDIALOG} ${LIBNCURSESW} ${LIBM} +LDADD= -ldialog -lncursesw -lm .include Modified: stable/9/usr.sbin/tzsetup/tzsetup.c ============================================================================== --- stable/9/usr.sbin/tzsetup/tzsetup.c Sun Mar 3 17:39:29 2013 (r247721) +++ stable/9/usr.sbin/tzsetup/tzsetup.c Sun Mar 3 18:59:59 2013 (r247722) @@ -35,7 +35,6 @@ #include __FBSDID("$FreeBSD$"); -#include #include #include #include @@ -49,6 +48,8 @@ __FBSDID("$FreeBSD$"); #include #include +#include + #define _PATH_ZONETAB "/usr/share/zoneinfo/zone.tab" #define _PATH_ISO3166 "/usr/share/misc/iso3166" #define _PATH_ZONEINFO "/usr/share/zoneinfo" @@ -63,8 +64,130 @@ __FBSDID("$FreeBSD$"); #define SILLY_BUFFER_SIZE 2048 #endif +/* special return codes for `fire' actions */ +#define DITEM_FAILURE 1 + +/* flags - returned in upper 16 bits of return status */ +#define DITEM_LEAVE_MENU (1 << 16) +#define DITEM_RECREATE (1 << 18) + +/* for use in describing more exotic behaviors */ +typedef struct dialogMenuItem { + char *prompt; + char *title; + int (*fire)(struct dialogMenuItem *self); + void *data; +} dialogMenuItem; + +static int +xdialog_count_rows(const char *p) +{ + int rows = 0; + + while ((p = strchr(p, '\n')) != NULL) { + p++; + if (*p == '\0') + break; + rows++; + } + + return rows ? rows : 1; +} + +static int +xdialog_count_columns(const char *p) +{ + int len; + int max_len = 0; + const char *q; + + for (; (q = strchr(p, '\n')) != NULL; p = q + 1) { + len = q - p; + max_len = MAX(max_len, len); + } + + len = strlen(p); + max_len = MAX(max_len, len); + return max_len; +} + +static int +xdialog_menu(const char *title, const char *cprompt, int height, int width, + int menu_height, int item_no, dialogMenuItem *ditems) +{ + int i, result, choice = 0; + DIALOG_LISTITEM *listitems; + DIALOG_VARS save_vars; + + dlg_save_vars(&save_vars); + + /* initialize list items */ + listitems = dlg_calloc(DIALOG_LISTITEM, item_no + 1); + assert_ptr(listitems, "xdialog_menu"); + for (i = 0; i < item_no; i++) { + listitems[i].name = ditems[i].prompt; + listitems[i].text = ditems[i].title; + } + + /* calculate height */ + if (height < 0) + height = xdialog_count_rows(cprompt) + menu_height + 4 + 2; + if (height > LINES) + height = LINES; + + /* calculate width */ + if (width < 0) { + int tag_x = 0; + + for (i = 0; i < item_no; i++) { + int j, l; + + l = strlen(listitems[i].name); + for (j = 0; j < item_no; j++) { + int k = strlen(listitems[j].text); + tag_x = MAX(tag_x, l + k + 2); + } + } + width = MAX(xdialog_count_columns(cprompt), title != NULL ? xdialog_count_columns(title) : 0); + width = MAX(width, tag_x + 4) + 4; + } + width = MAX(width, 24); + if (width > COLS) + width = COLS; + +again: + dialog_vars.default_item = listitems[choice].name; + result = dlg_menu(title, cprompt, height, width, + menu_height, item_no, listitems, &choice, NULL); + switch (result) { + case DLG_EXIT_ESC: + result = -1; + break; + case DLG_EXIT_OK: + if (ditems[choice].fire != NULL) { + int status; + + status = ditems[choice].fire(ditems + choice); + if (status & DITEM_RECREATE) { + dlg_clear(); + goto again; + } + } + result = 0; + break; + case DLG_EXIT_CANCEL: + default: + result = 1; + break; + } + + free(listitems); + dlg_restore_vars(&save_vars); + return result; +} + static char path_zonetab[MAXPATHLEN], path_iso3166[MAXPATHLEN], - path_zoneinfo[MAXPATHLEN], path_localtime[MAXPATHLEN], + path_zoneinfo[MAXPATHLEN], path_localtime[MAXPATHLEN], path_db[MAXPATHLEN], path_wall_cmos_clock[MAXPATHLEN]; static int reallydoit = 1; @@ -84,8 +207,6 @@ static int set_zone_utc(void); struct continent { dialogMenuItem *menu; int nitems; - int ch; - int sc; }; static struct continent africa, america, antarctica, arctic, asia, atlantic; @@ -105,7 +226,7 @@ static struct continent_names { { "Europe", &europe }, { "Indian", &indian }, { "Pacific", &pacific }, - { "UTC", &utc } + { "UTC", &utc } }; static struct continent_items { @@ -141,7 +262,7 @@ continent_country_menu(dialogMenuItem *c int rv; if (strcmp(continent->title, "UTC") == 0) - return set_zone_utc(); + return set_zone_utc(); /* Short cut -- if there's only one country, don't post a menu. */ if (contp->nitems == 1) @@ -159,8 +280,8 @@ continent_country_menu(dialogMenuItem *c } menulen = contp->nitems < 16 ? contp->nitems : 16; - rv = dialog_menu(title, prompt, -1, -1, menulen, -contp->nitems, - contp->menu, 0, &contp->ch, &contp->sc); + rv = xdialog_menu(title, prompt, -1, -1, menulen, contp->nitems, + contp->menu); if (rv == 0) return (DITEM_LEAVE_MENU); return (DITEM_RECREATE); @@ -273,7 +394,7 @@ add_zone_to_country(int lineno, const ch if (tlc[0] < 'A' || tlc[0] > 'Z' || tlc[1] < 'A' || tlc[1] > 'Z') errx(1, "%s:%d: country code `%s' invalid", path_zonetab, lineno, tlc); - + cp = &countries[CODE2INT(tlc)]; if (cp->name == 0) errx(1, "%s:%d: country code `%s' unknown", path_zonetab, @@ -287,7 +408,7 @@ add_zone_to_country(int lineno, const ch zp = malloc(sizeof(*zp)); if (zp == 0) errx(1, "malloc(%zu)", sizeof(*zp)); - + if (cp->nzones == 0) TAILQ_INIT(&cp->zones); @@ -458,9 +579,7 @@ make_menus(void) memset(dmi, 0, sizeof(*dmi)); asprintf(&dmi->prompt, "%d", ++cp->continent->nitems); dmi->title = cp->name; - dmi->checked = 0; dmi->fire = set_zone_whole_country; - dmi->selected = 0; dmi->data = cp; } else { cp->submenu = malloc(cp->nzones * sizeof(*dmi)); @@ -473,9 +592,7 @@ make_menus(void) memset(dmi, 0, sizeof(*dmi)); asprintf(&dmi->prompt, "%d", ++cp->nzones); dmi->title = zp->descr; - dmi->checked = 0; dmi->fire = set_zone_multi; - dmi->selected = 0; dmi->data = zp; for (zp2 = TAILQ_FIRST(&cp->zones); @@ -489,9 +606,7 @@ make_menus(void) memset(dmi, 0, sizeof(*dmi)); asprintf(&dmi->prompt, "%d", ++cont->nitems); dmi->title = cp->name; - dmi->checked = 0; dmi->fire = set_zone_menu; - dmi->selected = 0; dmi->data = cp; } } @@ -510,8 +625,8 @@ set_zone_menu(dialogMenuItem *dmi) snprintf(prompt, sizeof(prompt), "Select a zone which observes the same time as your locality."); menulen = cp->nzones < 16 ? cp->nzones : 16; - rv = dialog_menu(title, prompt, -1, -1, menulen, -cp->nzones, - cp->submenu, 0, 0, 0); + rv = xdialog_menu(title, prompt, -1, -1, menulen, cp->nzones, + cp->submenu); if (rv != 0) return (DITEM_RECREATE); return (DITEM_LEAVE_MENU); @@ -522,7 +637,7 @@ set_zone_utc(void) { if (!confirm_zone(NULL)) return (DITEM_FAILURE | DITEM_RECREATE); - + return (install_zoneinfo_file(NULL)); } @@ -566,7 +681,7 @@ install_zoneinfo_file(const char *zonein "Could not delete %s: %s", path_localtime, strerror(errno)); if (usedialog) - dialog_mesgbox(title, prompt, 8, 72); + dialog_msgbox(title, prompt, 8, 72, 1); else fprintf(stderr, "%s\n", prompt); @@ -578,7 +693,7 @@ install_zoneinfo_file(const char *zonein "Could not delete %s: %s", path_db, strerror(errno)); if (usedialog) - dialog_mesgbox(title, prompt, 8, 72); + dialog_msgbox(title, prompt, 8, 72, 1); else fprintf(stderr, "%s\n", prompt); @@ -586,7 +701,7 @@ install_zoneinfo_file(const char *zonein } return (DITEM_LEAVE_MENU); } - + if (copymode) { fd1 = open(zoneinfo_file, O_RDONLY, 0); if (fd1 < 0) { @@ -595,7 +710,7 @@ install_zoneinfo_file(const char *zonein "Could not open %s: %s", zoneinfo_file, strerror(errno)); if (usedialog) - dialog_mesgbox(title, prompt, 8, 72); + dialog_msgbox(title, prompt, 8, 72, 1); else fprintf(stderr, "%s\n", prompt); return (DITEM_FAILURE | DITEM_RECREATE); @@ -621,7 +736,7 @@ install_zoneinfo_file(const char *zonein "Could not open %s: %s", path_localtime, strerror(errno)); if (usedialog) - dialog_mesgbox(title, prompt, 8, 72); + dialog_msgbox(title, prompt, 8, 72, 1); else fprintf(stderr, "%s\n", prompt); return (DITEM_FAILURE | DITEM_RECREATE); @@ -637,7 +752,7 @@ install_zoneinfo_file(const char *zonein "Error copying %s to %s %s", zoneinfo_file, path_localtime, strerror(errno)); if (usedialog) - dialog_mesgbox(title, prompt, 8, 72); + dialog_msgbox(title, prompt, 8, 72, 1); else fprintf(stderr, "%s\n", prompt); /* Better to leave none than a corrupt one. */ @@ -653,7 +768,7 @@ install_zoneinfo_file(const char *zonein "Cannot access %s: %s", zoneinfo_file, strerror(errno)); if (usedialog) - dialog_mesgbox(title, prompt, 8, 72); + dialog_msgbox(title, prompt, 8, 72, 1); else fprintf(stderr, "%s\n", prompt); return (DITEM_FAILURE | DITEM_RECREATE); @@ -676,7 +791,7 @@ install_zoneinfo_file(const char *zonein path_localtime, zoneinfo_file, strerror(errno)); if (usedialog) - dialog_mesgbox(title, prompt, 8, 72); + dialog_msgbox(title, prompt, 8, 72, 1); else fprintf(stderr, "%s\n", prompt); return (DITEM_FAILURE | DITEM_RECREATE); @@ -695,7 +810,7 @@ install_zoneinfo_file(const char *zonein "Created symbolic link from %s to %s", zoneinfo_file, path_localtime); if (usedialog) - dialog_mesgbox(title, prompt, 8, 72); + dialog_msgbox(title, prompt, 8, 72, 1); else fprintf(stderr, "%s\n", prompt); #endif @@ -729,7 +844,7 @@ confirm_zone(const char *filename) time_t t = time(0); struct tm *tm; int rv; - + setenv("TZ", filename == NULL ? "" : filename, 1); tzset(); tm = localtime(&t); @@ -776,12 +891,6 @@ usage(void) exit(1); } -#if defined(__sparc64__) -#define DIALOG_UTC dialog_yesno -#else -#define DIALOG_UTC dialog_noyes -#endif - int main(int argc, char **argv) { @@ -886,15 +995,24 @@ main(int argc, char **argv) /* FALLTHROUGH */ } - init_dialog(); + init_dialog(stdin, stdout); if (skiputc == 0) { + DIALOG_VARS save_vars; + int yesno; + snprintf(title, sizeof(title), "Select local or UTC (Greenwich Mean Time) clock"); snprintf(prompt, sizeof(prompt), "Is this machine's CMOS clock set to UTC? " "If it is set to local time,\n" "or you don't know, please choose NO here!"); - if (!DIALOG_UTC(title, prompt, 7, 72)) { + dlg_save_vars(&save_vars); +#if !defined(__sparc64__) + dialog_vars.defaultno = TRUE; +#endif + yesno = dialog_yesno(title, prompt, 7, 73); + dlg_restore_vars(&save_vars); + if (!yesno) { if (reallydoit) unlink(path_wall_cmos_clock); } else { @@ -910,7 +1028,7 @@ main(int argc, char **argv) close(fd); } } - dialog_clear_norefresh(); + dlg_clear(); } if (optind == argc - 1) { snprintf(title, sizeof(title), "Default timezone provided"); @@ -918,18 +1036,18 @@ main(int argc, char **argv) "\nUse the default `%s' zone?", argv[optind]); if (!dialog_yesno(title, prompt, 7, 72)) { rv = install_zoneinfo_file(argv[optind]); - dialog_clear(); + dlg_clear(); end_dialog(); exit(rv & ~DITEM_LEAVE_MENU); } - dialog_clear_norefresh(); + dlg_clear(); } snprintf(title, sizeof(title), "Time Zone Selector"); snprintf(prompt, sizeof(prompt), "Select a region"); - dialog_menu(title, prompt, -1, -1, NCONTINENTS, -NCONTINENTS, - continents, 0, NULL, NULL); + xdialog_menu(title, prompt, -1, -1, NCONTINENTS, NCONTINENTS, + continents); - dialog_clear(); + dlg_clear(); end_dialog(); return (0); } From owner-svn-src-stable@FreeBSD.ORG Sun Mar 3 19:02:12 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 99956AC5; Sun, 3 Mar 2013 19:02:12 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 735E22F0; Sun, 3 Mar 2013 19:02:12 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r23J2CPG048493; Sun, 3 Mar 2013 19:02:12 GMT (envelope-from markj@svn.freebsd.org) Received: (from markj@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r23J2Crb048491; Sun, 3 Mar 2013 19:02:12 GMT (envelope-from markj@svn.freebsd.org) Message-Id: <201303031902.r23J2Crb048491@svn.freebsd.org> From: Mark Johnston Date: Sun, 3 Mar 2013 19:02:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r247723 - stable/8/lib/libelf X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Mar 2013 19:02:12 -0000 Author: markj Date: Sun Mar 3 19:02:11 2013 New Revision: 247723 URL: http://svnweb.freebsd.org/changeset/base/247723 Log: MFC r246978: - Make sure to set an error code when trying to obtain a data descriptor for a section of type SHT_NULL. - Update the man page to reflect the fact that elf_getdata() and elf_rawdata() may return with an error of ELF_E_SECTION. Approved by: rstone (co-mentor) Modified: stable/8/lib/libelf/elf_data.c stable/8/lib/libelf/elf_getdata.3 Directory Properties: stable/8/lib/libelf/ (props changed) Modified: stable/8/lib/libelf/elf_data.c ============================================================================== --- stable/8/lib/libelf/elf_data.c Sun Mar 3 18:59:59 2013 (r247722) +++ stable/8/lib/libelf/elf_data.c Sun Mar 3 19:02:11 2013 (r247723) @@ -78,8 +78,10 @@ elf_getdata(Elf_Scn *s, Elf_Data *d) sh_align = s->s_shdr.s_shdr64.sh_addralign; } - if (sh_type == SHT_NULL) + if (sh_type == SHT_NULL) { + LIBELF_SET_ERROR(SECTION, 0); return (NULL); + } if ((elftype = _libelf_xlate_shtype(sh_type)) < ELF_T_FIRST || elftype > ELF_T_LAST || (sh_type != SHT_NOBITS && @@ -217,8 +219,10 @@ elf_rawdata(Elf_Scn *s, Elf_Data *d) sh_align = s->s_shdr.s_shdr64.sh_addralign; } - if (sh_type == SHT_NULL) + if (sh_type == SHT_NULL) { + LIBELF_SET_ERROR(SECTION, 0); return (NULL); + } if ((d = _libelf_allocate_data(s)) == NULL) return (NULL); Modified: stable/8/lib/libelf/elf_getdata.3 ============================================================================== --- stable/8/lib/libelf/elf_getdata.3 Sun Mar 3 18:59:59 2013 (r247722) +++ stable/8/lib/libelf/elf_getdata.3 Sun Mar 3 19:02:11 2013 (r247723) @@ -23,7 +23,7 @@ .\" .\" $FreeBSD$ .\" -.Dd January 26, 2011 +.Dd February 18, 2013 .Dt ELF_GETDATA 3 .Os .Sh NAME @@ -186,6 +186,23 @@ was not associated with section descript .Ar scn . .It Bq Er ELF_E_RESOURCE An out of memory condition was detected. +.It Bq Er ELF_E_SECTION +Section +.Ar scn +had type +.Dv SHT_NULL . +.It Bq Er ELF_E_SECTION +The type of the section +.Ar scn +was not recognized by the library. +.It Bq Er ELF_E_SECTION +The size of the section +.Ar scn +is not a multiple of the file size for its section type. +.It Bq Er ELF_E_SECTION +The file offset for section +.Ar scn +is incorrect. .El .Sh SEE ALSO .Xr elf 3 , From owner-svn-src-stable@FreeBSD.ORG Sun Mar 3 19:02:24 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 20345BDB; Sun, 3 Mar 2013 19:02:24 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id EEBA12F2; Sun, 3 Mar 2013 19:02:23 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r23J2NR7048559; Sun, 3 Mar 2013 19:02:23 GMT (envelope-from markj@svn.freebsd.org) Received: (from markj@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r23J2N58048556; Sun, 3 Mar 2013 19:02:23 GMT (envelope-from markj@svn.freebsd.org) Message-Id: <201303031902.r23J2N58048556@svn.freebsd.org> From: Mark Johnston Date: Sun, 3 Mar 2013 19:02:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r247724 - stable/9/lib/libelf X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Mar 2013 19:02:24 -0000 Author: markj Date: Sun Mar 3 19:02:23 2013 New Revision: 247724 URL: http://svnweb.freebsd.org/changeset/base/247724 Log: MFC r246978: - Make sure to set an error code when trying to obtain a data descriptor for a section of type SHT_NULL. - Update the man page to reflect the fact that elf_getdata() and elf_rawdata() may return with an error of ELF_E_SECTION. Approved by: rstone (co-mentor) Modified: stable/9/lib/libelf/elf_data.c stable/9/lib/libelf/elf_getdata.3 Directory Properties: stable/9/lib/libelf/ (props changed) Modified: stable/9/lib/libelf/elf_data.c ============================================================================== --- stable/9/lib/libelf/elf_data.c Sun Mar 3 19:02:11 2013 (r247723) +++ stable/9/lib/libelf/elf_data.c Sun Mar 3 19:02:23 2013 (r247724) @@ -78,8 +78,10 @@ elf_getdata(Elf_Scn *s, Elf_Data *d) sh_align = s->s_shdr.s_shdr64.sh_addralign; } - if (sh_type == SHT_NULL) + if (sh_type == SHT_NULL) { + LIBELF_SET_ERROR(SECTION, 0); return (NULL); + } if ((elftype = _libelf_xlate_shtype(sh_type)) < ELF_T_FIRST || elftype > ELF_T_LAST || (sh_type != SHT_NOBITS && @@ -219,8 +221,10 @@ elf_rawdata(Elf_Scn *s, Elf_Data *d) sh_align = s->s_shdr.s_shdr64.sh_addralign; } - if (sh_type == SHT_NULL) + if (sh_type == SHT_NULL) { + LIBELF_SET_ERROR(SECTION, 0); return (NULL); + } if ((d = _libelf_allocate_data(s)) == NULL) return (NULL); Modified: stable/9/lib/libelf/elf_getdata.3 ============================================================================== --- stable/9/lib/libelf/elf_getdata.3 Sun Mar 3 19:02:11 2013 (r247723) +++ stable/9/lib/libelf/elf_getdata.3 Sun Mar 3 19:02:23 2013 (r247724) @@ -23,7 +23,7 @@ .\" .\" $FreeBSD$ .\" -.Dd January 26, 2011 +.Dd February 18, 2013 .Dt ELF_GETDATA 3 .Os .Sh NAME @@ -186,6 +186,23 @@ was not associated with section descript .Ar scn . .It Bq Er ELF_E_RESOURCE An out of memory condition was detected. +.It Bq Er ELF_E_SECTION +Section +.Ar scn +had type +.Dv SHT_NULL . +.It Bq Er ELF_E_SECTION +The type of the section +.Ar scn +was not recognized by the library. +.It Bq Er ELF_E_SECTION +The size of the section +.Ar scn +is not a multiple of the file size for its section type. +.It Bq Er ELF_E_SECTION +The file offset for section +.Ar scn +is incorrect. .El .Sh SEE ALSO .Xr elf 3 , From owner-svn-src-stable@FreeBSD.ORG Sun Mar 3 19:12:07 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id D916AF67; Sun, 3 Mar 2013 19:12:07 +0000 (UTC) (envelope-from dteske@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id B1F9B339; Sun, 3 Mar 2013 19:12:07 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r23JC79Q051916; Sun, 3 Mar 2013 19:12:07 GMT (envelope-from dteske@svn.freebsd.org) Received: (from dteske@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r23JC7v4051914; Sun, 3 Mar 2013 19:12:07 GMT (envelope-from dteske@svn.freebsd.org) Message-Id: <201303031912.r23JC7v4051914@svn.freebsd.org> From: Devin Teske Date: Sun, 3 Mar 2013 19:12:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r247726 - stable/9/usr.sbin/tzsetup X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Mar 2013 19:12:07 -0000 Author: dteske Date: Sun Mar 3 19:12:07 2013 New Revision: 247726 URL: http://svnweb.freebsd.org/changeset/base/247726 Log: Dummy commit to show r247722 was (in addition to being an MFC for r227934), an MFC for r227947: calloc +1 DIALOG_LISTITEM to prevent possible wild pointer access in dlg_default_listitem(). and also for r228176: Sync xdialog_menu() implementation with sade. Modified: stable/9/usr.sbin/tzsetup/tzsetup.c Modified: stable/9/usr.sbin/tzsetup/tzsetup.c ============================================================================== --- stable/9/usr.sbin/tzsetup/tzsetup.c Sun Mar 3 19:10:28 2013 (r247725) +++ stable/9/usr.sbin/tzsetup/tzsetup.c Sun Mar 3 19:12:07 2013 (r247726) @@ -33,7 +33,7 @@ */ #include -__FBSDID("$FreeBSD$"); +__FBSDID("$FreeBSD$"); #include #include From owner-svn-src-stable@FreeBSD.ORG Sun Mar 3 19:20:31 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 2D99B1C7; Sun, 3 Mar 2013 19:20:31 +0000 (UTC) (envelope-from dteske@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 070CF36C; Sun, 3 Mar 2013 19:20:31 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r23JKUY3054745; Sun, 3 Mar 2013 19:20:30 GMT (envelope-from dteske@svn.freebsd.org) Received: (from dteske@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r23JKUUx054728; Sun, 3 Mar 2013 19:20:30 GMT (envelope-from dteske@svn.freebsd.org) Message-Id: <201303031920.r23JKUUx054728@svn.freebsd.org> From: Devin Teske Date: Sun, 3 Mar 2013 19:20:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r247727 - stable/9/usr.sbin/tzsetup X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Mar 2013 19:20:31 -0000 Author: dteske Date: Sun Mar 3 19:20:30 2013 New Revision: 247727 URL: http://svnweb.freebsd.org/changeset/base/247727 Log: MFC r230299: Fix #ifdef VERBOSE for UTC case Update verbose output to match what actually happens when selecting the UTC option, and when the -n option is used. Patch updated slightly for new libdialog. PR: bin/164042 Submitted by: dteske Modified: stable/9/usr.sbin/tzsetup/tzsetup.c Modified: stable/9/usr.sbin/tzsetup/tzsetup.c ============================================================================== --- stable/9/usr.sbin/tzsetup/tzsetup.c Sun Mar 3 19:12:07 2013 (r247726) +++ stable/9/usr.sbin/tzsetup/tzsetup.c Sun Mar 3 19:20:30 2013 (r247727) @@ -33,7 +33,7 @@ */ #include -__FBSDID("$FreeBSD$"); +__FBSDID("$FreeBSD$"); #include #include @@ -659,16 +659,19 @@ install_zoneinfo_file(const char *zonein copymode = 1; #ifdef VERBOSE - if (copymode) + snprintf(title, sizeof(title), "Info"); + if (zoneinfo_file == NULL) + snprintf(prompt, sizeof(prompt), + "Removing %s", path_localtime); + else if (copymode) snprintf(prompt, sizeof(prompt), "Copying %s to %s", zoneinfo_file, path_localtime); else snprintf(prompt, sizeof(prompt), "Creating symbolic link %s to %s", - path_localtime, - zoneinfo_file == NULL ? "(UTC)" : zoneinfo_file); + path_localtime, zoneinfo_file); if (usedialog) - dialog_notify(prompt); + dialog_msgbox(title, prompt, 8, 72, 1); else fprintf(stderr, "%s\n", prompt); #endif @@ -699,6 +702,10 @@ install_zoneinfo_file(const char *zonein return (DITEM_FAILURE | DITEM_RECREATE); } +#ifdef VERBOSE + snprintf(prompt, sizeof(prompt), + "Removed %s", path_localtime); +#endif return (DITEM_LEAVE_MENU); } @@ -797,23 +804,23 @@ install_zoneinfo_file(const char *zonein return (DITEM_FAILURE | DITEM_RECREATE); } } - } #ifdef VERBOSE - snprintf(title, sizeof(title), "Done"); - if (copymode) - snprintf(prompt, sizeof(prompt), - "Copied timezone file from %s to %s", zoneinfo_file, - path_localtime); - else - snprintf(prompt, sizeof(prompt), - "Created symbolic link from %s to %s", zoneinfo_file, - path_localtime); - if (usedialog) - dialog_msgbox(title, prompt, 8, 72, 1); - else - fprintf(stderr, "%s\n", prompt); + snprintf(title, sizeof(title), "Done"); + if (copymode) + snprintf(prompt, sizeof(prompt), + "Copied timezone file from %s to %s", + zoneinfo_file, path_localtime); + else + snprintf(prompt, sizeof(prompt), + "Created symbolic link from %s to %s", + zoneinfo_file, path_localtime); + if (usedialog) + dialog_msgbox(title, prompt, 8, 72, 1); + else + fprintf(stderr, "%s\n", prompt); #endif + } /* reallydoit */ return (DITEM_LEAVE_MENU); } From owner-svn-src-stable@FreeBSD.ORG Sun Mar 3 19:26:06 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 1717D4B8; Sun, 3 Mar 2013 19:26:06 +0000 (UTC) (envelope-from dteske@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 090743D5; Sun, 3 Mar 2013 19:26:06 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r23JQ5i7055689; Sun, 3 Mar 2013 19:26:05 GMT (envelope-from dteske@svn.freebsd.org) Received: (from dteske@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r23JQ5ZL055687; Sun, 3 Mar 2013 19:26:05 GMT (envelope-from dteske@svn.freebsd.org) Message-Id: <201303031926.r23JQ5ZL055687@svn.freebsd.org> From: Devin Teske Date: Sun, 3 Mar 2013 19:26:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r247728 - stable/9/usr.sbin/tzsetup X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Mar 2013 19:26:06 -0000 Author: dteske Date: Sun Mar 3 19:26:05 2013 New Revision: 247728 URL: http://svnweb.freebsd.org/changeset/base/247728 Log: MFC r230296: Don't write /var/db/zoneinfo when zone is not actually changed. If the specified zone file does not exist or the -n flag is specified, do not update /var/db/zoneinfo. PR: bin/164039 Submitted by: dteske Modified: stable/9/usr.sbin/tzsetup/tzsetup.c Modified: stable/9/usr.sbin/tzsetup/tzsetup.c ============================================================================== --- stable/9/usr.sbin/tzsetup/tzsetup.c Sun Mar 3 19:20:30 2013 (r247727) +++ stable/9/usr.sbin/tzsetup/tzsetup.c Sun Mar 3 19:26:05 2013 (r247728) @@ -836,9 +836,11 @@ install_zoneinfo(const char *zoneinfo) rv = install_zoneinfo_file(path_zoneinfo_file); /* Save knowledge for later */ - if ((f = fopen(path_db, "w")) != NULL) { - fprintf(f, "%s\n", zoneinfo); - fclose(f); + if (reallydoit && (rv & DITEM_FAILURE) == 0) { + if ((f = fopen(path_db, "w")) != NULL) { + fprintf(f, "%s\n", zoneinfo); + fclose(f); + } } return (rv); From owner-svn-src-stable@FreeBSD.ORG Sun Mar 3 19:31:44 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id CE8146BF; Sun, 3 Mar 2013 19:31:44 +0000 (UTC) (envelope-from dteske@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 9D513403; Sun, 3 Mar 2013 19:31:44 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r23JVi75058028; Sun, 3 Mar 2013 19:31:44 GMT (envelope-from dteske@svn.freebsd.org) Received: (from dteske@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r23JViKf058027; Sun, 3 Mar 2013 19:31:44 GMT (envelope-from dteske@svn.freebsd.org) Message-Id: <201303031931.r23JViKf058027@svn.freebsd.org> From: Devin Teske Date: Sun, 3 Mar 2013 19:31:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r247729 - stable/9/usr.sbin/tzsetup X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Mar 2013 19:31:44 -0000 Author: dteske Date: Sun Mar 3 19:31:44 2013 New Revision: 247729 URL: http://svnweb.freebsd.org/changeset/base/247729 Log: MFC r230520: Clean up reinstall option and remove duplicate code - Move the reinstall logic to be before menus are initialised (menus are not needed when reinstalling a zonefile). - Remove unnecessary re-initialization of path_db. - Update variable name and error message because we now use the zone name relative to /usr/share/zoneinfo, not the full path. PR: bin/164041 Submitted by: dteske Modified: stable/9/usr.sbin/tzsetup/tzsetup.c Modified: stable/9/usr.sbin/tzsetup/tzsetup.c ============================================================================== --- stable/9/usr.sbin/tzsetup/tzsetup.c Sun Mar 3 19:26:05 2013 (r247728) +++ stable/9/usr.sbin/tzsetup/tzsetup.c Sun Mar 3 19:31:44 2013 (r247729) @@ -951,32 +951,16 @@ main(int argc, char **argv) /* Override the user-supplied umask. */ (void)umask(S_IWGRP | S_IWOTH); - read_iso3166_table(); - read_zones(); - sort_countries(); - make_menus(); - if (reinstall == 1) { FILE *f; - char zonefile[MAXPATHLEN]; - char path_db[MAXPATHLEN]; - - zonefile[0] = '\0'; - path_db[0] = '\0'; - if (chrootenv != NULL) { - sprintf(zonefile, "%s/", chrootenv); - sprintf(path_db, "%s/", chrootenv); - } - strcat(zonefile, _PATH_ZONEINFO); - strcat(zonefile, "/"); - strcat(path_db, _PATH_DB); + char zoneinfo[MAXPATHLEN]; if ((f = fopen(path_db, "r")) != NULL) { - if (fgets(zonefile, sizeof(zonefile), f) != NULL) { - zonefile[sizeof(zonefile) - 1] = 0; - if (strlen(zonefile) > 0) { - zonefile[strlen(zonefile) - 1] = 0; - rv = install_zoneinfo(zonefile); + if (fgets(zoneinfo, sizeof(zoneinfo), f) != NULL) { + zoneinfo[sizeof(zoneinfo) - 1] = 0; + if (strlen(zoneinfo) > 0) { + zoneinfo[strlen(zoneinfo) - 1] = 0; + rv = install_zoneinfo(zoneinfo); exit(rv & ~DITEM_LEAVE_MENU); } errx(1, "Error reading %s.\n", path_db); @@ -984,7 +968,7 @@ main(int argc, char **argv) fclose(f); errx(1, "Unable to determine earlier installed zoneinfo " - "file. Check %s", path_db); + "name. Check %s", path_db); } errx(1, "Cannot open %s for reading. Does it exist?", path_db); } @@ -1004,6 +988,11 @@ main(int argc, char **argv) /* FALLTHROUGH */ } + read_iso3166_table(); + read_zones(); + sort_countries(); + make_menus(); + init_dialog(stdin, stdout); if (skiputc == 0) { DIALOG_VARS save_vars; From owner-svn-src-stable@FreeBSD.ORG Sun Mar 3 21:48:41 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 834261F5; Sun, 3 Mar 2013 21:48:41 +0000 (UTC) (envelope-from melifaro@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 668B8AE2; Sun, 3 Mar 2013 21:48:41 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r23Lmf9c099338; Sun, 3 Mar 2013 21:48:41 GMT (envelope-from melifaro@svn.freebsd.org) Received: (from melifaro@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r23LmfgF099335; Sun, 3 Mar 2013 21:48:41 GMT (envelope-from melifaro@svn.freebsd.org) Message-Id: <201303032148.r23LmfgF099335@svn.freebsd.org> From: "Alexander V. Chernikov" Date: Sun, 3 Mar 2013 21:48:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r247732 - in stable/8/sys: kern net security/mac X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Mar 2013 21:48:41 -0000 Author: melifaro Date: Sun Mar 3 21:48:40 2013 New Revision: 247732 URL: http://svnweb.freebsd.org/changeset/base/247732 Log: Merge * r233937 - Improve BPF locking model * r233938 - Improve performace for writer-only BPF users * r233946 - Fix build * r235744 - Fix (new) panic on attaching to non-existent interface * r235745 - Fix old panic when BPF consumer attaches to destroying interface * r235746 - Call bpf_jitter() before acquiring BPF global lock * r235747 - Make most BPF ioctls() SMP-safe. * r236231 - Fix BPF_JITTER code broken by r235746. * r236261 - Save the previous filter right before we set new one. * r236262 - Fix style(9) nits, reduce unnecessary type castings. * r236559 - Fix panic introduced by r235745 * r236806 - Fix typo introduced in r236559. r233937 - Improve BPF locking model. Interface locks and descriptor locks are converted from mutex(9) to rwlock(9). This greately improves performance: in most common case we need to acquire 1 reader lock instead of 2 mutexes. - Remove filter(descriptor) (reader) lock in bpf_mtap[2] This was suggested by glebius@. We protect filter by requesting interface writer lock on filter change. - Cover struct bpf_if under BPF_INTERNAL define. This permits including bpf.h without including rwlock stuff. However, this is is temporary solution, struct bpf_if should be made opaque for any external caller. r233938 - Improve performace for writer-only BPF users. Linux and Solaris (at least OpenSolaris) has PF_PACKET socket families to send raw ethernet frames. The only FreeBSD interface that can be used to send raw frames is BPF. As a result, many programs like cdpd, lldpd, various dhcp stuff uses BPF only to send data. This leads us to the situation when software like cdpd, being run on high-traffic-volume interface significantly reduces overall performance since we have to acquire additional locks for every packet. Here we add sysctl that changes BPF behavior in the following way: If program came and opens BPF socket without explicitly specifyin read filter we assume it to be write-only and add it to special writer-only per-interface list. This makes bpf_peers_present() return 0, so no additional overhead is introduced. After filter is supplied, descriptor is added to original per-interface list permitting packets to be captured. Unfortunately, pcap_open_live() sets catch-all filter itself for the purpose of setting snap length. Fortunately, most programs explicitly sets (event catch-all) filter after that. tcpdump(1) is a good example. So a bit hackis approach is taken: we upgrade description only after second BIOCSETF is received. Sysctl is named net.bpf.optimize_writers and is turned off by default. - While here, document all sysctl variables in bpf.4 r233946 Fix build broken by r233938. r235744 Fix panic on attaching to non-existent interface (introduced by r233937, pointed by hrs@) Fix panic on tcpdump being attached to interface being removed (introduced by r233937, pointed by hrs@ and adrian@) Protect most of bpf_setf() by BPF global lock Add several forgotten assertions (thanks to adrian@) Document current locking model inside bpf.c Document EVENTHANDLER(9) usage inside BPF. r235745 Fix old panic when BPF consumer attaches to destroying interface. 'flags' field is added to the end of bpf_if structure. Currently the only flag is BPFIF_FLAG_DYING which is set on bpf detach and checked by bpf_attachd() Problem can be easily triggered on SMP stable/[89] by the following command (sort of): 'while true; do ifconfig vlan222 create vlan 222 vlandev em0 up ; \ tcpdump -pi vlan222 & ; ifconfig vlan222 destroy ; done' Fix possible use-after-free when BPF detaches itself from interface, freeing bpf_bif memory, while interface is still UP and there can be routes via this interface. Freeing is now delayed till ifnet_departure_event is received via eventhandler(9) api. Convert bpfd rwlock back to mutex due lack of performance gain (currently checking if packet matches filter is done without holding bpfd lock and we have to acquire write lock if packet matches) r235746 Call bpf_jitter() before acquiring BPF global lock due to malloc() being used inside bpf_jitter. Eliminate bpf_buffer_alloc() and allocate BPF buffers on descriptor creation and BIOCSBLEN ioctl. This permits us not to allocate buffers inside bpf_attachd() which is protected by global lock. r235747 Make most BPF ioctls() SMP-safe. r236559 Fix panic introduced by r235745. Panic occurs after first packet traverse renamed interface. Add several comments on locking r236231 Fix BPF_JITTER code broken by r235746. r236261 - Save the previous filter right before we set new one. - Reduce duplicate code and make it little easier to read. r236262 Fix style(9) nits, reduce unnecessary type castings, etc., for bpf_setf(). r236806 Fix typo introduced in r236559. Modified: stable/8/sys/kern/subr_witness.c stable/8/sys/net/bpf.c stable/8/sys/net/bpf.h stable/8/sys/net/bpf_buffer.c stable/8/sys/net/bpf_buffer.h stable/8/sys/net/bpfdesc.h stable/8/sys/security/mac/mac_net.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/kern/ (props changed) stable/8/sys/net/ (props changed) stable/8/sys/security/ (props changed) Modified: stable/8/sys/kern/subr_witness.c ============================================================================== --- stable/8/sys/kern/subr_witness.c Sun Mar 3 20:37:27 2013 (r247731) +++ stable/8/sys/kern/subr_witness.c Sun Mar 3 21:48:40 2013 (r247732) @@ -568,7 +568,7 @@ static struct witness_order_list_entry o * BPF */ { "bpf global lock", &lock_class_mtx_sleep }, - { "bpf interface lock", &lock_class_mtx_sleep }, + { "bpf interface lock", &lock_class_rw }, { "bpf cdev lock", &lock_class_mtx_sleep }, { NULL, NULL }, /* Modified: stable/8/sys/net/bpf.c ============================================================================== --- stable/8/sys/net/bpf.c Sun Mar 3 20:37:27 2013 (r247731) +++ stable/8/sys/net/bpf.c Sun Mar 3 21:48:40 2013 (r247732) @@ -43,6 +43,8 @@ __FBSDID("$FreeBSD$"); #include #include +#include +#include #include #include #include @@ -66,6 +68,7 @@ __FBSDID("$FreeBSD$"); #include #include +#define BPF_INTERNAL #include #include #ifdef BPF_JITTER @@ -139,6 +142,7 @@ static int bpf_bpfd_cnt; static void bpf_attachd(struct bpf_d *, struct bpf_if *); static void bpf_detachd(struct bpf_d *); +static void bpf_detachd_locked(struct bpf_d *); static void bpf_freed(struct bpf_d *); static int bpf_movein(struct uio *, int, struct ifnet *, struct mbuf **, struct sockaddr *, int *, struct bpf_insn *); @@ -150,7 +154,7 @@ static void catchpacket(struct bpf_d *, void (*)(struct bpf_d *, caddr_t, u_int, void *, u_int), struct timeval *); static void reset_d(struct bpf_d *); -static int bpf_setf(struct bpf_d *, struct bpf_program *, u_long cmd); +static int bpf_setf(struct bpf_d *, struct bpf_program *, u_long cmd); static int bpf_getdltlist(struct bpf_d *, struct bpf_dltlist *); static int bpf_setdlt(struct bpf_d *, u_int); static void filt_bpfdetach(struct knote *); @@ -168,6 +172,12 @@ SYSCTL_INT(_net_bpf, OID_AUTO, zerocopy_ SYSCTL_NODE(_net_bpf, OID_AUTO, stats, CTLFLAG_MPSAFE | CTLFLAG_RW, bpf_stats_sysctl, "bpf statistics portal"); +static VNET_DEFINE(int, bpf_optimize_writers) = 0; +#define V_bpf_optimize_writers VNET(bpf_optimize_writers) +SYSCTL_VNET_INT(_net_bpf, OID_AUTO, optimize_writers, + CTLFLAG_RW, &VNET_NAME(bpf_optimize_writers), 0, + "Do not send packets until BPF program is set"); + static d_open_t bpfopen; static d_read_t bpfread; static d_write_t bpfwrite; @@ -189,6 +199,37 @@ static struct cdevsw bpf_cdevsw = { static struct filterops bpfread_filtops = { 1, NULL, filt_bpfdetach, filt_bpfread }; +eventhandler_tag bpf_ifdetach_cookie = NULL; + +/* + * LOCKING MODEL USED BY BPF: + * Locks: + * 1) global lock (BPF_LOCK). Mutex, used to protect interface addition/removal, + * some global counters and every bpf_if reference. + * 2) Interface lock. Rwlock, used to protect list of BPF descriptors and their filters. + * 3) Descriptor lock. Mutex, used to protect BPF buffers and various structure fields + * used by bpf_mtap code. + * + * Lock order: + * + * Global lock, interface lock, descriptor lock + * + * We have to acquire interface lock before descriptor main lock due to BPF_MTAP[2] + * working model. In many places (like bpf_detachd) we start with BPF descriptor + * (and we need to at least rlock it to get reliable interface pointer). This + * gives us potential LOR. As a result, we use global lock to protect from bpf_if + * change in every such place. + * + * Changing d->bd_bif is protected by 1) global lock, 2) interface lock and + * 3) descriptor main wlock. + * Reading bd_bif can be protected by any of these locks, typically global lock. + * + * Changing read/write BPF filter is protected by the same three locks, + * the same applies for reading. + * + * Sleeping in global lock is not allowed due to bpfdetach() using it. + */ + /* * Wrapper functions for various buffering methods. If the set of buffer * modes expands, we will probably want to introduce a switch data structure @@ -282,7 +323,6 @@ bpf_canfreebuf(struct bpf_d *d) static int bpf_canwritebuf(struct bpf_d *d) { - BPFD_LOCK_ASSERT(d); switch (d->bd_bufmode) { @@ -561,17 +601,92 @@ bad: static void bpf_attachd(struct bpf_d *d, struct bpf_if *bp) { + int op_w; + + BPF_LOCK_ASSERT(); + + /* + * Save sysctl value to protect from sysctl change + * between reads + */ + op_w = V_bpf_optimize_writers; + + if (d->bd_bif != NULL) + bpf_detachd_locked(d); /* - * Point d at bp, and add d to the interface's list of listeners. - * Finally, point the driver's bpf cookie at the interface so - * it will divert packets to bpf. + * Point d at bp, and add d to the interface's list. + * Since there are many applicaiotns using BPF for + * sending raw packets only (dhcpd, cdpd are good examples) + * we can delay adding d to the list of active listeners until + * some filter is configured. */ - BPFIF_LOCK(bp); + + BPFIF_WLOCK(bp); + BPFD_LOCK(d); + d->bd_bif = bp; - LIST_INSERT_HEAD(&bp->bif_dlist, d, bd_next); + + if (op_w != 0) { + /* Add to writers-only list */ + LIST_INSERT_HEAD(&bp->bif_wlist, d, bd_next); + /* + * We decrement bd_writer on every filter set operation. + * First BIOCSETF is done by pcap_open_live() to set up + * snap length. After that appliation usually sets its own filter + */ + d->bd_writer = 2; + } else + LIST_INSERT_HEAD(&bp->bif_dlist, d, bd_next); + + BPFD_UNLOCK(d); + BPFIF_WUNLOCK(bp); bpf_bpfd_cnt++; - BPFIF_UNLOCK(bp); + + CTR3(KTR_NET, "%s: bpf_attach called by pid %d, adding to %s list", + __func__, d->bd_pid, d->bd_writer ? "writer" : "active"); + + if (op_w == 0) + EVENTHANDLER_INVOKE(bpf_track, bp->bif_ifp, bp->bif_dlt, 1); +} + +/* + * Add d to the list of active bp filters. + * Reuqires bpf_attachd() to be called before + */ +static void +bpf_upgraded(struct bpf_d *d) +{ + struct bpf_if *bp; + + BPF_LOCK_ASSERT(); + + bp = d->bd_bif; + + /* + * Filter can be set several times without specifying interface. + * Mark d as reader and exit. + */ + if (bp == NULL) { + BPFD_LOCK(d); + d->bd_writer = 0; + BPFD_UNLOCK(d); + return; + } + + BPFIF_WLOCK(bp); + BPFD_LOCK(d); + + /* Remove from writers-only list */ + LIST_REMOVE(d, bd_next); + LIST_INSERT_HEAD(&bp->bif_dlist, d, bd_next); + /* Mark d as reader */ + d->bd_writer = 0; + + BPFD_UNLOCK(d); + BPFIF_WUNLOCK(bp); + + CTR2(KTR_NET, "%s: upgrade required by pid %d", __func__, d->bd_pid); EVENTHANDLER_INVOKE(bpf_track, bp->bif_ifp, bp->bif_dlt, 1); } @@ -582,26 +697,47 @@ bpf_attachd(struct bpf_d *d, struct bpf_ static void bpf_detachd(struct bpf_d *d) { + BPF_LOCK(); + bpf_detachd_locked(d); + BPF_UNLOCK(); +} + +static void +bpf_detachd_locked(struct bpf_d *d) +{ int error; struct bpf_if *bp; struct ifnet *ifp; - bp = d->bd_bif; - BPFIF_LOCK(bp); + CTR2(KTR_NET, "%s: detach required by pid %d", __func__, d->bd_pid); + + BPF_LOCK_ASSERT(); + + /* Check if descriptor is attached */ + if ((bp = d->bd_bif) == NULL) + return; + + BPFIF_WLOCK(bp); BPFD_LOCK(d); - ifp = d->bd_bif->bif_ifp; + + /* Save bd_writer value */ + error = d->bd_writer; /* * Remove d from the interface's descriptor list. */ LIST_REMOVE(d, bd_next); - bpf_bpfd_cnt--; + ifp = bp->bif_ifp; d->bd_bif = NULL; BPFD_UNLOCK(d); - BPFIF_UNLOCK(bp); + BPFIF_WUNLOCK(bp); - EVENTHANDLER_INVOKE(bpf_track, ifp, bp->bif_dlt, 0); + bpf_bpfd_cnt--; + + /* Call event handler iff d is attached */ + if (error == 0) + EVENTHANDLER_INVOKE(bpf_track, ifp, bp->bif_dlt, 0); /* * Check if this descriptor had requested promiscuous mode. @@ -640,10 +776,7 @@ bpf_dtor(void *data) d->bd_state = BPF_IDLE; BPFD_UNLOCK(d); funsetown(&d->bd_sigio); - mtx_lock(&bpf_mtx); - if (d->bd_bif) - bpf_detachd(d); - mtx_unlock(&bpf_mtx); + bpf_detachd(d); #ifdef MAC mac_bpfdesc_destroy(d); #endif /* MAC */ @@ -663,7 +796,7 @@ static int bpfopen(struct cdev *dev, int flags, int fmt, struct thread *td) { struct bpf_d *d; - int error; + int error, size; d = malloc(sizeof(*d), M_BPF, M_WAITOK | M_ZERO); error = devfs_set_cdevpriv(d, bpf_dtor); @@ -681,14 +814,18 @@ bpfopen(struct cdev *dev, int flags, int d->bd_bufmode = BPF_BUFMODE_BUFFER; d->bd_sig = SIGIO; d->bd_direction = BPF_D_INOUT; - d->bd_pid = td->td_proc->p_pid; + BPF_PID_REFRESH(d, td); #ifdef MAC mac_bpfdesc_init(d); mac_bpfdesc_create(td->td_ucred, d); #endif - mtx_init(&d->bd_mtx, devtoname(dev), "bpf cdev lock", MTX_DEF); - callout_init_mtx(&d->bd_callout, &d->bd_mtx, 0); - knlist_init_mtx(&d->bd_sel.si_note, &d->bd_mtx); + mtx_init(&d->bd_lock, devtoname(dev), "bpf cdev lock", MTX_DEF); + callout_init_mtx(&d->bd_callout, &d->bd_lock, 0); + knlist_init_mtx(&d->bd_sel.si_note, &d->bd_lock); + + /* Allocate default buffers */ + size = d->bd_bufsize; + bpf_buffer_ioctl_sblen(d, &size); return (0); } @@ -718,7 +855,7 @@ bpfread(struct cdev *dev, struct uio *ui non_block = ((ioflag & O_NONBLOCK) != 0); BPFD_LOCK(d); - d->bd_pid = curthread->td_proc->p_pid; + BPF_PID_REFRESH_CUR(d); if (d->bd_bufmode != BPF_BUFMODE_BUFFER) { BPFD_UNLOCK(d); return (EOPNOTSUPP); @@ -764,7 +901,7 @@ bpfread(struct cdev *dev, struct uio *ui BPFD_UNLOCK(d); return (EWOULDBLOCK); } - error = msleep(d, &d->bd_mtx, PRINET|PCATCH, + error = msleep(d, &d->bd_lock, PRINET|PCATCH, "bpf", d->bd_rtout); if (error == EINTR || error == ERESTART) { BPFD_UNLOCK(d); @@ -881,8 +1018,9 @@ bpfwrite(struct cdev *dev, struct uio *u if (error != 0) return (error); - d->bd_pid = curthread->td_proc->p_pid; + BPF_PID_REFRESH_CUR(d); d->bd_wcount++; + /* XXX: locking required */ if (d->bd_bif == NULL) { d->bd_wdcount++; return (ENXIO); @@ -903,6 +1041,7 @@ bpfwrite(struct cdev *dev, struct uio *u bzero(&dst, sizeof(dst)); m = NULL; hlen = 0; + /* XXX: bpf_movein() can sleep */ error = bpf_movein(uio, (int)d->bd_bif->bif_dlt, ifp, &m, &dst, &hlen, d->bd_wfilter); if (error) { @@ -962,7 +1101,7 @@ static void reset_d(struct bpf_d *d) { - mtx_assert(&d->bd_mtx, MA_OWNED); + BPFD_LOCK_ASSERT(d); if ((d->bd_hbuf != NULL) && (d->bd_bufmode != BPF_BUFMODE_ZBUF || bpf_canfreebuf(d))) { @@ -1028,7 +1167,7 @@ bpfioctl(struct cdev *dev, u_long cmd, c * Refresh PID associated with this descriptor. */ BPFD_LOCK(d); - d->bd_pid = td->td_proc->p_pid; + BPF_PID_REFRESH(d, td); if (d->bd_state == BPF_WAITING) callout_stop(&d->bd_callout); d->bd_state = BPF_IDLE; @@ -1079,7 +1218,9 @@ bpfioctl(struct cdev *dev, u_long cmd, c case BIOCGDLTLIST32: case BIOCGRTIMEOUT32: case BIOCSRTIMEOUT32: + BPFD_LOCK(d); d->bd_compat32 = 1; + BPFD_UNLOCK(d); } #endif @@ -1124,7 +1265,9 @@ bpfioctl(struct cdev *dev, u_long cmd, c * Get buffer len [for read()]. */ case BIOCGBLEN: + BPFD_LOCK(d); *(u_int *)addr = d->bd_bufsize; + BPFD_UNLOCK(d); break; /* @@ -1179,10 +1322,12 @@ bpfioctl(struct cdev *dev, u_long cmd, c * Get current data link type. */ case BIOCGDLT: + BPF_LOCK(); if (d->bd_bif == NULL) error = EINVAL; else *(u_int *)addr = d->bd_bif->bif_dlt; + BPF_UNLOCK(); break; /* @@ -1197,6 +1342,7 @@ bpfioctl(struct cdev *dev, u_long cmd, c list32 = (struct bpf_dltlist32 *)addr; dltlist.bfl_len = list32->bfl_len; dltlist.bfl_list = PTRIN(list32->bfl_list); + BPF_LOCK(); if (d->bd_bif == NULL) error = EINVAL; else { @@ -1204,31 +1350,37 @@ bpfioctl(struct cdev *dev, u_long cmd, c if (error == 0) list32->bfl_len = dltlist.bfl_len; } + BPF_UNLOCK(); break; } #endif case BIOCGDLTLIST: + BPF_LOCK(); if (d->bd_bif == NULL) error = EINVAL; else error = bpf_getdltlist(d, (struct bpf_dltlist *)addr); + BPF_UNLOCK(); break; /* * Set data link type. */ case BIOCSDLT: + BPF_LOCK(); if (d->bd_bif == NULL) error = EINVAL; else error = bpf_setdlt(d, *(u_int *)addr); + BPF_UNLOCK(); break; /* * Get interface name. */ case BIOCGETIF: + BPF_LOCK(); if (d->bd_bif == NULL) error = EINVAL; else { @@ -1238,13 +1390,16 @@ bpfioctl(struct cdev *dev, u_long cmd, c strlcpy(ifr->ifr_name, ifp->if_xname, sizeof(ifr->ifr_name)); } + BPF_UNLOCK(); break; /* * Set interface. */ case BIOCSETIF: + BPF_LOCK(); error = bpf_setif(d, (struct ifreq *)addr); + BPF_UNLOCK(); break; /* @@ -1327,7 +1482,9 @@ bpfioctl(struct cdev *dev, u_long cmd, c * Set immediate mode. */ case BIOCIMMEDIATE: + BPFD_LOCK(d); d->bd_immediate = *(u_int *)addr; + BPFD_UNLOCK(d); break; case BIOCVERSION: @@ -1343,21 +1500,27 @@ bpfioctl(struct cdev *dev, u_long cmd, c * Get "header already complete" flag */ case BIOCGHDRCMPLT: + BPFD_LOCK(d); *(u_int *)addr = d->bd_hdrcmplt; + BPFD_UNLOCK(d); break; /* * Set "header already complete" flag */ case BIOCSHDRCMPLT: + BPFD_LOCK(d); d->bd_hdrcmplt = *(u_int *)addr ? 1 : 0; + BPFD_UNLOCK(d); break; /* * Get packet direction flag */ case BIOCGDIRECTION: + BPFD_LOCK(d); *(u_int *)addr = d->bd_direction; + BPFD_UNLOCK(d); break; /* @@ -1372,7 +1535,9 @@ bpfioctl(struct cdev *dev, u_long cmd, c case BPF_D_IN: case BPF_D_INOUT: case BPF_D_OUT: + BPFD_LOCK(d); d->bd_direction = direction; + BPFD_UNLOCK(d); break; default: error = EINVAL; @@ -1381,26 +1546,38 @@ bpfioctl(struct cdev *dev, u_long cmd, c break; case BIOCFEEDBACK: + BPFD_LOCK(d); d->bd_feedback = *(u_int *)addr; + BPFD_UNLOCK(d); break; case BIOCLOCK: + BPFD_LOCK(d); d->bd_locked = 1; + BPFD_UNLOCK(d); break; case FIONBIO: /* Non-blocking I/O */ break; case FIOASYNC: /* Send signal on receive packets */ + BPFD_LOCK(d); d->bd_async = *(int *)addr; + BPFD_UNLOCK(d); break; case FIOSETOWN: + /* + * XXX: Add some sort of locking here? + * fsetown() can sleep. + */ error = fsetown(*(int *)addr, &d->bd_sigio); break; case FIOGETOWN: + BPFD_LOCK(d); *(int *)addr = fgetown(&d->bd_sigio); + BPFD_UNLOCK(d); break; /* This is deprecated, FIOSETOWN should be used instead. */ @@ -1421,16 +1598,23 @@ bpfioctl(struct cdev *dev, u_long cmd, c if (sig >= NSIG) error = EINVAL; - else + else { + BPFD_LOCK(d); d->bd_sig = sig; + BPFD_UNLOCK(d); + } break; } case BIOCGRSIG: + BPFD_LOCK(d); *(u_int *)addr = d->bd_sig; + BPFD_UNLOCK(d); break; case BIOCGETBUFMODE: + BPFD_LOCK(d); *(u_int *)addr = d->bd_bufmode; + BPFD_UNLOCK(d); break; case BIOCSETBUFMODE: @@ -1485,19 +1669,31 @@ bpfioctl(struct cdev *dev, u_long cmd, c /* * Set d's packet filter program to fp. If this file already has a filter, * free it and replace it. Returns EINVAL for bogus requests. + * + * Note we need global lock here to serialize bpf_setf() and bpf_setif() calls + * since reading d->bd_bif can't be protected by d or interface lock due to + * lock order. + * + * Additionally, we have to acquire interface write lock due to bpf_mtap() uses + * interface read lock to read all filers. + * */ static int bpf_setf(struct bpf_d *d, struct bpf_program *fp, u_long cmd) { +#ifdef COMPAT_FREEBSD32 + struct bpf_program fp_swab; + struct bpf_program32 *fp32; +#endif struct bpf_insn *fcode, *old; - u_int wfilter, flen, size; #ifdef BPF_JITTER - bpf_jit_filter *ofunc; + bpf_jit_filter *jfunc, *ofunc; #endif -#ifdef COMPAT_FREEBSD32 - struct bpf_program32 *fp32; - struct bpf_program fp_swab; + size_t size; + u_int flen; + int need_upgrade; +#ifdef COMPAT_FREEBSD32 switch (cmd) { case BIOCSETF32: case BIOCSETWF32: @@ -1517,73 +1713,86 @@ bpf_setf(struct bpf_d *d, struct bpf_pro break; } #endif - if (cmd == BIOCSETWF) { - old = d->bd_wfilter; - wfilter = 1; -#ifdef BPF_JITTER - ofunc = NULL; -#endif - } else { - wfilter = 0; - old = d->bd_rfilter; + + fcode = NULL; #ifdef BPF_JITTER - ofunc = d->bd_bfilter; + jfunc = ofunc = NULL; #endif - } - if (fp->bf_insns == NULL) { - if (fp->bf_len != 0) + need_upgrade = 0; + + /* + * Check new filter validness before acquiring any locks. + * Allocate memory for new filter, if needed. + */ + flen = fp->bf_len; + if (flen > bpf_maxinsns || (fp->bf_insns == NULL && flen != 0)) + return (EINVAL); + size = flen * sizeof(*fp->bf_insns); + if (size > 0) { + /* We're setting up new filter. Copy and check actual data. */ + fcode = malloc(size, M_BPF, M_WAITOK); + if (copyin(fp->bf_insns, fcode, size) != 0 || + !bpf_validate(fcode, flen)) { + free(fcode, M_BPF); return (EINVAL); - BPFD_LOCK(d); - if (wfilter) - d->bd_wfilter = NULL; - else { - d->bd_rfilter = NULL; -#ifdef BPF_JITTER - d->bd_bfilter = NULL; -#endif - if (cmd == BIOCSETF) - reset_d(d); } - BPFD_UNLOCK(d); - if (old != NULL) - free((caddr_t)old, M_BPF); #ifdef BPF_JITTER - if (ofunc != NULL) - bpf_destroy_jit_filter(ofunc); + /* Filter is copied inside fcode and is perfectly valid. */ + jfunc = bpf_jitter(fcode, flen); #endif - return (0); } - flen = fp->bf_len; - if (flen > bpf_maxinsns) - return (EINVAL); - size = flen * sizeof(*fp->bf_insns); - fcode = (struct bpf_insn *)malloc(size, M_BPF, M_WAITOK); - if (copyin((caddr_t)fp->bf_insns, (caddr_t)fcode, size) == 0 && - bpf_validate(fcode, (int)flen)) { - BPFD_LOCK(d); - if (wfilter) - d->bd_wfilter = fcode; - else { - d->bd_rfilter = fcode; + BPF_LOCK(); + + /* + * Set up new filter. + * Protect filter change by interface lock. + * Additionally, we are protected by global lock here. + */ + if (d->bd_bif != NULL) + BPFIF_WLOCK(d->bd_bif); + BPFD_LOCK(d); + if (cmd == BIOCSETWF) { + old = d->bd_wfilter; + d->bd_wfilter = fcode; + } else { + old = d->bd_rfilter; + d->bd_rfilter = fcode; #ifdef BPF_JITTER - d->bd_bfilter = bpf_jitter(fcode, flen); + ofunc = d->bd_bfilter; + d->bd_bfilter = jfunc; #endif - if (cmd == BIOCSETF) - reset_d(d); + if (cmd == BIOCSETF) + reset_d(d); + + if (fcode != NULL) { + /* + * Do not require upgrade by first BIOCSETF + * (used to set snaplen) by pcap_open_live(). + */ + if (d->bd_writer != 0 && --d->bd_writer == 0) + need_upgrade = 1; + CTR4(KTR_NET, "%s: filter function set by pid %d, " + "bd_writer counter %d, need_upgrade %d", + __func__, d->bd_pid, d->bd_writer, need_upgrade); } - BPFD_UNLOCK(d); - if (old != NULL) - free((caddr_t)old, M_BPF); + } + BPFD_UNLOCK(d); + if (d->bd_bif != NULL) + BPFIF_WUNLOCK(d->bd_bif); + if (old != NULL) + free(old, M_BPF); #ifdef BPF_JITTER - if (ofunc != NULL) - bpf_destroy_jit_filter(ofunc); + if (ofunc != NULL) + bpf_destroy_jit_filter(ofunc); #endif - return (0); - } - free((caddr_t)fcode, M_BPF); - return (EINVAL); + /* Move d to active readers list. */ + if (need_upgrade) + bpf_upgraded(d); + + BPF_UNLOCK(); + return (0); } /* @@ -1597,28 +1806,30 @@ bpf_setif(struct bpf_d *d, struct ifreq struct bpf_if *bp; struct ifnet *theywant; + BPF_LOCK_ASSERT(); + theywant = ifunit(ifr->ifr_name); if (theywant == NULL || theywant->if_bpf == NULL) return (ENXIO); bp = theywant->if_bpf; + /* Check if interface is not being detached from BPF */ + BPFIF_RLOCK(bp); + if (bp->flags & BPFIF_FLAG_DYING) { + BPFIF_RUNLOCK(bp); + return (ENXIO); + } + BPFIF_RUNLOCK(bp); + /* * Behavior here depends on the buffering model. If we're using * kernel memory buffers, then we can allocate them here. If we're * using zero-copy, then the user process must have registered * buffers by the time we get here. If not, return an error. - * - * XXXRW: There are locking issues here with multi-threaded use: what - * if two threads try to set the interface at once? */ switch (d->bd_bufmode) { case BPF_BUFMODE_BUFFER: - if (d->bd_sbuf == NULL) - bpf_buffer_alloc(d); - KASSERT(d->bd_sbuf != NULL, ("bpf_setif: bd_sbuf NULL")); - break; - case BPF_BUFMODE_ZBUF: if (d->bd_sbuf == NULL) return (EINVAL); @@ -1627,15 +1838,8 @@ bpf_setif(struct bpf_d *d, struct ifreq default: panic("bpf_setif: bufmode %d", d->bd_bufmode); } - if (bp != d->bd_bif) { - if (d->bd_bif) - /* - * Detach if attached to something else. - */ - bpf_detachd(d); - + if (bp != d->bd_bif) bpf_attachd(d, bp); - } BPFD_LOCK(d); reset_d(d); BPFD_UNLOCK(d); @@ -1663,7 +1867,7 @@ bpfpoll(struct cdev *dev, int events, st */ revents = events & (POLLOUT | POLLWRNORM); BPFD_LOCK(d); - d->bd_pid = td->td_proc->p_pid; + BPF_PID_REFRESH(d, td); if (events & (POLLIN | POLLRDNORM)) { if (bpf_ready(d)) revents |= events & (POLLIN | POLLRDNORM); @@ -1698,7 +1902,7 @@ bpfkqfilter(struct cdev *dev, struct kno * Refresh PID associated with this descriptor. */ BPFD_LOCK(d); - d->bd_pid = curthread->td_proc->p_pid; + BPF_PID_REFRESH_CUR(d); kn->kn_fop = &bpfread_filtops; kn->kn_hook = d; knlist_add(&d->bd_sel.si_note, kn, 1); @@ -1754,9 +1958,19 @@ bpf_tap(struct bpf_if *bp, u_char *pkt, struct timeval tv; gottime = 0; - BPFIF_LOCK(bp); + + BPFIF_RLOCK(bp); + LIST_FOREACH(d, &bp->bif_dlist, bd_next) { - BPFD_LOCK(d); + /* + * We are not using any locks for d here because: + * 1) any filter change is protected by interface + * write lock + * 2) destroying/detaching d is protected by interface + * write lock, too + */ + + /* XXX: Do not protect counter for the sake of performance. */ ++d->bd_rcount; /* * NB: We dont call BPF_CHECK_DIRECTION() here since there is no @@ -1772,6 +1986,11 @@ bpf_tap(struct bpf_if *bp, u_char *pkt, #endif slen = bpf_filter(d->bd_rfilter, pkt, pktlen, pktlen); if (slen != 0) { + /* + * Filter matches. Let's to acquire write lock. + */ + BPFD_LOCK(d); + d->bd_fcount++; if (!gottime) { microtime(&tv); @@ -1782,10 +2001,10 @@ bpf_tap(struct bpf_if *bp, u_char *pkt, #endif catchpacket(d, pkt, pktlen, slen, bpf_append_bytes, &tv); + BPFD_UNLOCK(d); } - BPFD_UNLOCK(d); } - BPFIF_UNLOCK(bp); + BPFIF_RUNLOCK(bp); } #define BPF_CHECK_DIRECTION(d, r, i) \ @@ -1794,6 +2013,7 @@ bpf_tap(struct bpf_if *bp, u_char *pkt, /* * Incoming linkage from device drivers, when packet is in an mbuf chain. + * Locking model is explained in bpf_tap(). */ void bpf_mtap(struct bpf_if *bp, struct mbuf *m) @@ -1816,11 +2036,11 @@ bpf_mtap(struct bpf_if *bp, struct mbuf pktlen = m_length(m, NULL); - BPFIF_LOCK(bp); + BPFIF_RLOCK(bp); + LIST_FOREACH(d, &bp->bif_dlist, bd_next) { if (BPF_CHECK_DIRECTION(d, m->m_pkthdr.rcvif, bp->bif_ifp)) continue; - BPFD_LOCK(d); ++d->bd_rcount; #ifdef BPF_JITTER bf = bpf_jitter_enable != 0 ? d->bd_bfilter : NULL; @@ -1831,6 +2051,8 @@ bpf_mtap(struct bpf_if *bp, struct mbuf #endif slen = bpf_filter(d->bd_rfilter, (u_char *)m, pktlen, 0); if (slen != 0) { + BPFD_LOCK(d); + d->bd_fcount++; if (!gottime) { microtime(&tv); @@ -1841,10 +2063,10 @@ bpf_mtap(struct bpf_if *bp, struct mbuf #endif catchpacket(d, (u_char *)m, pktlen, slen, bpf_append_mbuf, &tv); + BPFD_UNLOCK(d); } - BPFD_UNLOCK(d); } - BPFIF_UNLOCK(bp); + BPFIF_RUNLOCK(bp); } /* @@ -1879,14 +2101,17 @@ bpf_mtap2(struct bpf_if *bp, void *data, mb.m_len = dlen; pktlen += dlen; - BPFIF_LOCK(bp); + + BPFIF_RLOCK(bp); + LIST_FOREACH(d, &bp->bif_dlist, bd_next) { if (BPF_CHECK_DIRECTION(d, m->m_pkthdr.rcvif, bp->bif_ifp)) continue; - BPFD_LOCK(d); ++d->bd_rcount; slen = bpf_filter(d->bd_rfilter, (u_char *)&mb, pktlen, 0); if (slen != 0) { + BPFD_LOCK(d); + d->bd_fcount++; if (!gottime) { microtime(&tv); @@ -1897,10 +2122,10 @@ bpf_mtap2(struct bpf_if *bp, void *data, #endif catchpacket(d, (u_char *)&mb, pktlen, slen, bpf_append_mbuf, &tv); + BPFD_UNLOCK(d); } - BPFD_UNLOCK(d); } - BPFIF_UNLOCK(bp); + BPFIF_RUNLOCK(bp); } #undef BPF_CHECK_DIRECTION @@ -2050,7 +2275,7 @@ bpf_freed(struct bpf_d *d) } if (d->bd_wfilter != NULL) free((caddr_t)d->bd_wfilter, M_BPF); - mtx_destroy(&d->bd_mtx); + mtx_destroy(&d->bd_lock); } /* @@ -2080,15 +2305,16 @@ bpfattach2(struct ifnet *ifp, u_int dlt, panic("bpfattach"); LIST_INIT(&bp->bif_dlist); + LIST_INIT(&bp->bif_wlist); bp->bif_ifp = ifp; bp->bif_dlt = dlt; - mtx_init(&bp->bif_mtx, "bpf interface lock", NULL, MTX_DEF); + rw_init(&bp->bif_lock, "bpf interface lock"); KASSERT(*driverp == NULL, ("bpfattach2: driverp already initialized")); *driverp = bp; - mtx_lock(&bpf_mtx); + BPF_LOCK(); LIST_INSERT_HEAD(&bpf_iflist, bp, bif_next); - mtx_unlock(&bpf_mtx); + BPF_UNLOCK(); /* * Compute the length of the bpf header. This is not necessarily @@ -2103,10 +2329,9 @@ bpfattach2(struct ifnet *ifp, u_int dlt, } /* - * Detach bpf from an interface. This involves detaching each descriptor - * associated with the interface, and leaving bd_bif NULL. Notify each - * descriptor as it's detached so that any sleepers wake up and get - * ENXIO. + * Detach bpf from an interface. This involves detaching each descriptor + * associated with the interface. Notify each descriptor as it's detached + * so that any sleepers wake up and get ENXIO. */ void bpfdetach(struct ifnet *ifp) @@ -2119,31 +2344,45 @@ bpfdetach(struct ifnet *ifp) ndetached = 0; #endif + BPF_LOCK(); /* Find all bpf_if struct's which reference ifp and detach them. */ do { - mtx_lock(&bpf_mtx); LIST_FOREACH(bp, &bpf_iflist, bif_next) { if (ifp == bp->bif_ifp) break; } if (bp != NULL) LIST_REMOVE(bp, bif_next); - mtx_unlock(&bpf_mtx); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable@FreeBSD.ORG Sun Mar 3 22:33:14 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 336511A5; Sun, 3 Mar 2013 22:33:14 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 2459ACDA; Sun, 3 Mar 2013 22:33:14 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r23MXDQ9014056; Sun, 3 Mar 2013 22:33:13 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r23MXDcG014055; Sun, 3 Mar 2013 22:33:13 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201303032233.r23MXDcG014055@svn.freebsd.org> From: Jilles Tjoelker Date: Sun, 3 Mar 2013 22:33:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r247733 - stable/8/bin/sh X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Mar 2013 22:33:14 -0000 Author: jilles Date: Sun Mar 3 22:33:13 2013 New Revision: 247733 URL: http://svnweb.freebsd.org/changeset/base/247733 Log: MFC r246371: sh: Do not test for digit_contig in mksyntax. ISO/IEC 9899:1999 (E) 5.2.1p3 guarantees that the values of the characters 0123456789 are contiguous. The generated syntax.c and syntax.h remain the same. Submitted by: Christoph Mallon Modified: stable/8/bin/sh/mksyntax.c Directory Properties: stable/8/bin/sh/ (props changed) Modified: stable/8/bin/sh/mksyntax.c ============================================================================== --- stable/8/bin/sh/mksyntax.c Sun Mar 3 21:48:40 2013 (r247732) +++ stable/8/bin/sh/mksyntax.c Sun Mar 3 22:33:13 2013 (r247733) @@ -105,14 +105,12 @@ static const char *syntax[513]; static int base; static int size; /* number of values which a char variable can have */ static int nbits; /* number of bits in a character */ -static int digit_contig;/* true if digits are contiguous */ static void filltable(const char *); static void init(void); static void add(const char *, const char *); static void print(const char *); static void output_type_macros(void); -static void digit_convert(void); int main(int argc __unused, char **argv __unused) @@ -123,7 +121,6 @@ main(int argc __unused, char **argv __un int i; char buf[80]; int pos; - static char digit[] = "0123456789"; /* Create output files */ if ((cfile = fopen("syntax.c", "w")) == NULL) { @@ -156,11 +153,6 @@ main(int argc __unused, char **argv __un base = 1; if (sign) base += 1 << (nbits - 1); - digit_contig = 1; - for (i = 0 ; i < 10 ; i++) { - if (digit[i] != '0' + i) - digit_contig = 0; - } fputs("#include \n", hfile); fputs("#include \n", hfile); @@ -247,8 +239,6 @@ main(int argc __unused, char **argv __un add("_", "ISUNDER"); add("#?$!-*@", "ISSPECL"); print("is_type"); - if (! digit_contig) - digit_convert(); exit(0); } @@ -339,12 +329,13 @@ print(const char *name) */ static const char *macro[] = { - "#define is_digit(c)\t((is_type+SYNBASE)[c] & ISDIGIT)", + "#define is_digit(c)\t((unsigned int)((c) - '0') <= 9)", "#define is_eof(c)\t((c) == PEOF)", "#define is_alpha(c)\t(((c) < CTLESC || (c) > CTLQUOTEMARK) && isalpha((unsigned char) (c)))", "#define is_name(c)\t(((c) < CTLESC || (c) > CTLQUOTEMARK) && ((c) == '_' || isalpha((unsigned char) (c))))", "#define is_in_name(c)\t(((c) < CTLESC || (c) > CTLQUOTEMARK) && ((c) == '_' || isalnum((unsigned char) (c))))", "#define is_special(c)\t((is_type+SYNBASE)[c] & (ISSPECL|ISDIGIT))", + "#define digit_val(c)\t((c) - '0')", NULL }; @@ -353,41 +344,6 @@ output_type_macros(void) { const char **pp; - if (digit_contig) - macro[0] = "#define is_digit(c)\t((unsigned int)((c) - '0') <= 9)"; for (pp = macro ; *pp ; pp++) fprintf(hfile, "%s\n", *pp); - if (digit_contig) - fputs("#define digit_val(c)\t((c) - '0')\n", hfile); - else - fputs("#define digit_val(c)\t(digit_value[c])\n", hfile); -} - - - -/* - * Output digit conversion table (if digits are not contiguous). - */ - -static void -digit_convert(void) -{ - int maxdigit; - static char digit[] = "0123456789"; - char *p; - int i; - - maxdigit = 0; - for (p = digit ; *p ; p++) - if (*p > maxdigit) - maxdigit = *p; - fputs("extern const char digit_value[];\n", hfile); - fputs("\n\nconst char digit_value[] = {\n", cfile); - for (i = 0 ; i <= maxdigit ; i++) { - for (p = digit ; *p && *p != i ; p++); - if (*p == '\0') - p = digit; - fprintf(cfile, " %d,\n", (int)(p - digit)); - } - fputs("};\n", cfile); } From owner-svn-src-stable@FreeBSD.ORG Mon Mar 4 01:14:07 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id C629B588; Mon, 4 Mar 2013 01:14:07 +0000 (UTC) (envelope-from dteske@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 879B61D4; Mon, 4 Mar 2013 01:14:07 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r241E6B1063605; Mon, 4 Mar 2013 01:14:06 GMT (envelope-from dteske@svn.freebsd.org) Received: (from dteske@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r241E6LF063604; Mon, 4 Mar 2013 01:14:06 GMT (envelope-from dteske@svn.freebsd.org) Message-Id: <201303040114.r241E6LF063604@svn.freebsd.org> From: Devin Teske Date: Mon, 4 Mar 2013 01:14:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r247745 - stable/8/usr.sbin/tzsetup X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Mar 2013 01:14:07 -0000 Author: dteske Date: Mon Mar 4 01:14:06 2013 New Revision: 247745 URL: http://svnweb.freebsd.org/changeset/base/247745 Log: MFC r230005: Use a reasonable-sized buffer when formatting error messages about installing zoneinfo. While we're in the vicinity, add some missing error checking to eliminate an unhelpful error message when unlink() fails. /me is embarrassed by the quality of his 16-year-old code. The whole thing is awful and could stand a complete rewrite. PR: 164038 Submitted by: Devin Teske (but implemented differently) Modified: stable/8/usr.sbin/tzsetup/tzsetup.c Modified: stable/8/usr.sbin/tzsetup/tzsetup.c ============================================================================== --- stable/8/usr.sbin/tzsetup/tzsetup.c Mon Mar 4 00:21:38 2013 (r247744) +++ stable/8/usr.sbin/tzsetup/tzsetup.c Mon Mar 4 01:14:06 2013 (r247745) @@ -56,6 +56,13 @@ __FBSDID("$FreeBSD$"); #define _PATH_DB "/var/db/zoneinfo" #define _PATH_WALL_CMOS_CLOCK "/etc/wall_cmos_clock" +#ifdef PATH_MAX +#define SILLY_BUFFER_SIZE 2*PATH_MAX +#else +#warning "Somebody needs to fix this to dynamically size this buffer." +#define SILLY_BUFFER_SIZE 2048 +#endif + static char path_zonetab[MAXPATHLEN], path_iso3166[MAXPATHLEN], path_zoneinfo[MAXPATHLEN], path_localtime[MAXPATHLEN], path_db[MAXPATHLEN], path_wall_cmos_clock[MAXPATHLEN]; @@ -523,7 +530,7 @@ static int install_zoneinfo_file(const char *zoneinfo_file) { char buf[1024]; - char title[64], prompt[64]; + char title[64], prompt[SILLY_BUFFER_SIZE]; struct stat sb; ssize_t len; int fd1, fd2, copymode; @@ -594,7 +601,18 @@ install_zoneinfo_file(const char *zonein return (DITEM_FAILURE | DITEM_RECREATE); } - unlink(path_localtime); + if (unlink(path_localtime) < 0 && errno != ENOENT) { + snprintf(prompt, sizeof(prompt), + "Could not unlink %s: %s", + path_localtime, strerror(errno)); + if (usedialog) { + snprintf(title, sizeof(title), "Error"); + dialog_msgbox(title, prompt, 8, 72, 1); + } else + fprintf(stderr, "%s\n", prompt); + return (DITEM_FAILURE | DITEM_RECREATE); + } + fd2 = open(path_localtime, O_CREAT | O_EXCL | O_WRONLY, S_IRUSR | S_IRGRP | S_IROTH); if (fd2 < 0) { @@ -640,7 +658,17 @@ install_zoneinfo_file(const char *zonein fprintf(stderr, "%s\n", prompt); return (DITEM_FAILURE | DITEM_RECREATE); } - unlink(path_localtime); + if (unlink(path_localtime) < 0 && errno != ENOENT) { + snprintf(prompt, sizeof(prompt), + "Could not unlink %s: %s", + path_localtime, strerror(errno)); + if (usedialog) { + snprintf(title, sizeof(title), "Error"); + dialog_msgbox(title, prompt, 8, 72, 1); + } else + fprintf(stderr, "%s\n", prompt); + return (DITEM_FAILURE | DITEM_RECREATE); + } if (symlink(zoneinfo_file, path_localtime) < 0) { snprintf(title, sizeof(title), "Error"); snprintf(prompt, sizeof(prompt), From owner-svn-src-stable@FreeBSD.ORG Mon Mar 4 01:22:08 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 41E2F738; Mon, 4 Mar 2013 01:22:08 +0000 (UTC) (envelope-from dteske@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 172A7206; Mon, 4 Mar 2013 01:22:08 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r241M7Kw066295; Mon, 4 Mar 2013 01:22:07 GMT (envelope-from dteske@svn.freebsd.org) Received: (from dteske@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r241M76U066294; Mon, 4 Mar 2013 01:22:07 GMT (envelope-from dteske@svn.freebsd.org) Message-Id: <201303040122.r241M76U066294@svn.freebsd.org> From: Devin Teske Date: Mon, 4 Mar 2013 01:22:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r247746 - stable/8/usr.sbin/tzsetup X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Mar 2013 01:22:08 -0000 Author: dteske Date: Mon Mar 4 01:22:07 2013 New Revision: 247746 URL: http://svnweb.freebsd.org/changeset/base/247746 Log: MFC only the whitespace changes* from r227934: Port to new libdialog. * In other words, no changes to dialog; whitespace changes only. Modified: stable/8/usr.sbin/tzsetup/tzsetup.c Modified: stable/8/usr.sbin/tzsetup/tzsetup.c ============================================================================== --- stable/8/usr.sbin/tzsetup/tzsetup.c Mon Mar 4 01:14:06 2013 (r247745) +++ stable/8/usr.sbin/tzsetup/tzsetup.c Mon Mar 4 01:22:07 2013 (r247746) @@ -64,7 +64,7 @@ __FBSDID("$FreeBSD$"); #endif static char path_zonetab[MAXPATHLEN], path_iso3166[MAXPATHLEN], - path_zoneinfo[MAXPATHLEN], path_localtime[MAXPATHLEN], + path_zoneinfo[MAXPATHLEN], path_localtime[MAXPATHLEN], path_db[MAXPATHLEN], path_wall_cmos_clock[MAXPATHLEN]; static int reallydoit = 1; @@ -105,7 +105,7 @@ static struct continent_names { { "Europe", &europe }, { "Indian", &indian }, { "Pacific", &pacific }, - { "UTC", &utc } + { "UTC", &utc } }; static struct continent_items { @@ -141,7 +141,7 @@ continent_country_menu(dialogMenuItem *c int rv; if (strcmp(continent->title, "UTC") == 0) - return set_zone_utc(); + return set_zone_utc(); /* Short cut -- if there's only one country, don't post a menu. */ if (contp->nitems == 1) @@ -273,7 +273,7 @@ add_zone_to_country(int lineno, const ch if (tlc[0] < 'A' || tlc[0] > 'Z' || tlc[1] < 'A' || tlc[1] > 'Z') errx(1, "%s:%d: country code `%s' invalid", path_zonetab, lineno, tlc); - + cp = &countries[CODE2INT(tlc)]; if (cp->name == 0) errx(1, "%s:%d: country code `%s' unknown", path_zonetab, @@ -287,7 +287,7 @@ add_zone_to_country(int lineno, const ch zp = malloc(sizeof(*zp)); if (zp == 0) errx(1, "malloc(%zu)", sizeof(*zp)); - + if (cp->nzones == 0) TAILQ_INIT(&cp->zones); @@ -522,7 +522,7 @@ set_zone_utc(void) { if (!confirm_zone(NULL)) return (DITEM_FAILURE | DITEM_RECREATE); - + return (install_zoneinfo_file(NULL)); } @@ -586,7 +586,7 @@ install_zoneinfo_file(const char *zonein } return (DITEM_LEAVE_MENU); } - + if (copymode) { fd1 = open(zoneinfo_file, O_RDONLY, 0); if (fd1 < 0) { @@ -729,7 +729,7 @@ confirm_zone(const char *filename) time_t t = time(0); struct tm *tm; int rv; - + setenv("TZ", filename == NULL ? "" : filename, 1); tzset(); tm = localtime(&t); From owner-svn-src-stable@FreeBSD.ORG Mon Mar 4 01:32:25 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 48A168DC; Mon, 4 Mar 2013 01:32:25 +0000 (UTC) (envelope-from dteske@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 1DBBA231; Mon, 4 Mar 2013 01:32:25 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r241WO0I069253; Mon, 4 Mar 2013 01:32:25 GMT (envelope-from dteske@svn.freebsd.org) Received: (from dteske@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r241WOOv069252; Mon, 4 Mar 2013 01:32:24 GMT (envelope-from dteske@svn.freebsd.org) Message-Id: <201303040132.r241WOOv069252@svn.freebsd.org> From: Devin Teske Date: Mon, 4 Mar 2013 01:32:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r247747 - stable/8/usr.sbin/tzsetup X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Mar 2013 01:32:25 -0000 Author: dteske Date: Mon Mar 4 01:32:24 2013 New Revision: 247747 URL: http://svnweb.freebsd.org/changeset/base/247747 Log: MFC r230299: Fix #ifdef VERBOSE for UTC case Update verbose output to match what actually happens when selecting the UTC option, and when the -n option is used. Patch updated slightly for new libdialog. PR: bin/164042 Submitted by: dteske Modified: stable/8/usr.sbin/tzsetup/tzsetup.c Modified: stable/8/usr.sbin/tzsetup/tzsetup.c ============================================================================== --- stable/8/usr.sbin/tzsetup/tzsetup.c Mon Mar 4 01:22:07 2013 (r247746) +++ stable/8/usr.sbin/tzsetup/tzsetup.c Mon Mar 4 01:32:24 2013 (r247747) @@ -544,16 +544,19 @@ install_zoneinfo_file(const char *zonein copymode = 1; #ifdef VERBOSE - if (copymode) + snprintf(title, sizeof(title), "Info"); + if (zoneinfo_file == NULL) + snprintf(prompt, sizeof(prompt), + "Removing %s", path_localtime); + else if (copymode) snprintf(prompt, sizeof(prompt), "Copying %s to %s", zoneinfo_file, path_localtime); else snprintf(prompt, sizeof(prompt), "Creating symbolic link %s to %s", - path_localtime, - zoneinfo_file == NULL ? "(UTC)" : zoneinfo_file); + path_localtime, zoneinfo_file); if (usedialog) - dialog_notify(prompt); + dialog_mesgbox(title, prompt, 8, 72); else fprintf(stderr, "%s\n", prompt); #endif @@ -584,6 +587,10 @@ install_zoneinfo_file(const char *zonein return (DITEM_FAILURE | DITEM_RECREATE); } +#ifdef VERBOSE + snprintf(prompt, sizeof(prompt), + "Removed %s", path_localtime); +#endif return (DITEM_LEAVE_MENU); } @@ -682,23 +689,23 @@ install_zoneinfo_file(const char *zonein return (DITEM_FAILURE | DITEM_RECREATE); } } - } #ifdef VERBOSE - snprintf(title, sizeof(title), "Done"); - if (copymode) - snprintf(prompt, sizeof(prompt), - "Copied timezone file from %s to %s", zoneinfo_file, - path_localtime); - else - snprintf(prompt, sizeof(prompt), - "Created symbolic link from %s to %s", zoneinfo_file, - path_localtime); - if (usedialog) - dialog_mesgbox(title, prompt, 8, 72); - else - fprintf(stderr, "%s\n", prompt); + snprintf(title, sizeof(title), "Done"); + if (copymode) + snprintf(prompt, sizeof(prompt), + "Copied timezone file from %s to %s", + zoneinfo_file, path_localtime); + else + snprintf(prompt, sizeof(prompt), + "Created symbolic link from %s to %s", + zoneinfo_file, path_localtime); + if (usedialog) + dialog_mesgbox(title, prompt, 8, 72); + else + fprintf(stderr, "%s\n", prompt); #endif + } /* reallydoit */ return (DITEM_LEAVE_MENU); } From owner-svn-src-stable@FreeBSD.ORG Mon Mar 4 01:35:57 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 33BF2A5A; Mon, 4 Mar 2013 01:35:57 +0000 (UTC) (envelope-from dteske@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 1BB16241; Mon, 4 Mar 2013 01:35:57 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r241Zuhm069769; Mon, 4 Mar 2013 01:35:56 GMT (envelope-from dteske@svn.freebsd.org) Received: (from dteske@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r241Zu77069768; Mon, 4 Mar 2013 01:35:56 GMT (envelope-from dteske@svn.freebsd.org) Message-Id: <201303040135.r241Zu77069768@svn.freebsd.org> From: Devin Teske Date: Mon, 4 Mar 2013 01:35:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r247748 - stable/8/usr.sbin/tzsetup X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Mar 2013 01:35:57 -0000 Author: dteske Date: Mon Mar 4 01:35:56 2013 New Revision: 247748 URL: http://svnweb.freebsd.org/changeset/base/247748 Log: MFC r230296: Don't write /var/db/zoneinfo when zone is not actually changed. If the specified zone file does not exist or the -n flag is specified, do not update /var/db/zoneinfo. PR: bin/164039 Submitted by: dteske Modified: stable/8/usr.sbin/tzsetup/tzsetup.c Modified: stable/8/usr.sbin/tzsetup/tzsetup.c ============================================================================== --- stable/8/usr.sbin/tzsetup/tzsetup.c Mon Mar 4 01:32:24 2013 (r247747) +++ stable/8/usr.sbin/tzsetup/tzsetup.c Mon Mar 4 01:35:56 2013 (r247748) @@ -721,9 +721,11 @@ install_zoneinfo(const char *zoneinfo) rv = install_zoneinfo_file(path_zoneinfo_file); /* Save knowledge for later */ - if ((f = fopen(path_db, "w")) != NULL) { - fprintf(f, "%s\n", zoneinfo); - fclose(f); + if (reallydoit && (rv & DITEM_FAILURE) == 0) { + if ((f = fopen(path_db, "w")) != NULL) { + fprintf(f, "%s\n", zoneinfo); + fclose(f); + } } return (rv); From owner-svn-src-stable@FreeBSD.ORG Mon Mar 4 01:47:38 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 1CA09CA2; Mon, 4 Mar 2013 01:47:38 +0000 (UTC) (envelope-from dteske@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id D135827F; Mon, 4 Mar 2013 01:47:37 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r241lbZR072878; Mon, 4 Mar 2013 01:47:37 GMT (envelope-from dteske@svn.freebsd.org) Received: (from dteske@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r241lb3L072877; Mon, 4 Mar 2013 01:47:37 GMT (envelope-from dteske@svn.freebsd.org) Message-Id: <201303040147.r241lb3L072877@svn.freebsd.org> From: Devin Teske Date: Mon, 4 Mar 2013 01:47:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r247749 - stable/8/usr.sbin/tzsetup X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Mar 2013 01:47:38 -0000 Author: dteske Date: Mon Mar 4 01:47:37 2013 New Revision: 247749 URL: http://svnweb.freebsd.org/changeset/base/247749 Log: MFC r230520: Clean up reinstall option and remove duplicate code - Move the reinstall logic to be before menus are initialised (menus are not needed when reinstalling a zonefile). - Remove unnecessary re-initialization of path_db. - Update variable name and error message because we now use the zone name relative to /usr/share/zoneinfo, not the full path. pr: bin/164041 Submitted by: dteske Modified: stable/8/usr.sbin/tzsetup/tzsetup.c Modified: stable/8/usr.sbin/tzsetup/tzsetup.c ============================================================================== --- stable/8/usr.sbin/tzsetup/tzsetup.c Mon Mar 4 01:35:56 2013 (r247748) +++ stable/8/usr.sbin/tzsetup/tzsetup.c Mon Mar 4 01:47:37 2013 (r247749) @@ -842,32 +842,16 @@ main(int argc, char **argv) /* Override the user-supplied umask. */ (void)umask(S_IWGRP | S_IWOTH); - read_iso3166_table(); - read_zones(); - sort_countries(); - make_menus(); - if (reinstall == 1) { FILE *f; - char zonefile[MAXPATHLEN]; - char path_db[MAXPATHLEN]; - - zonefile[0] = '\0'; - path_db[0] = '\0'; - if (chrootenv != NULL) { - sprintf(zonefile, "%s/", chrootenv); - sprintf(path_db, "%s/", chrootenv); - } - strcat(zonefile, _PATH_ZONEINFO); - strcat(zonefile, "/"); - strcat(path_db, _PATH_DB); + char zoneinfo[MAXPATHLEN]; if ((f = fopen(path_db, "r")) != NULL) { - if (fgets(zonefile, sizeof(zonefile), f) != NULL) { - zonefile[sizeof(zonefile) - 1] = 0; - if (strlen(zonefile) > 0) { - zonefile[strlen(zonefile) - 1] = 0; - rv = install_zoneinfo(zonefile); + if (fgets(zoneinfo, sizeof(zoneinfo), f) != NULL) { + zoneinfo[sizeof(zoneinfo) - 1] = 0; + if (strlen(zoneinfo) > 0) { + zoneinfo[strlen(zoneinfo) - 1] = 0; + rv = install_zoneinfo(zoneinfo); exit(rv & ~DITEM_LEAVE_MENU); } errx(1, "Error reading %s.\n", path_db); @@ -875,7 +859,7 @@ main(int argc, char **argv) fclose(f); errx(1, "Unable to determine earlier installed zoneinfo " - "file. Check %s", path_db); + "name. Check %s", path_db); } errx(1, "Cannot open %s for reading. Does it exist?", path_db); } @@ -895,6 +879,11 @@ main(int argc, char **argv) /* FALLTHROUGH */ } + read_iso3166_table(); + read_zones(); + sort_countries(); + make_menus(); + init_dialog(); if (skiputc == 0) { snprintf(title, sizeof(title), From owner-svn-src-stable@FreeBSD.ORG Mon Mar 4 05:46:37 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id EE9E0C7D; Mon, 4 Mar 2013 05:46:36 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id DB044D53; Mon, 4 Mar 2013 05:46:36 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r245ka83008718; Mon, 4 Mar 2013 05:46:36 GMT (envelope-from hrs@svn.freebsd.org) Received: (from hrs@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r245ka9l008710; Mon, 4 Mar 2013 05:46:36 GMT (envelope-from hrs@svn.freebsd.org) Message-Id: <201303040546.r245ka9l008710@svn.freebsd.org> From: Hiroki Sato Date: Mon, 4 Mar 2013 05:46:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r247767 - in stable/9: etc sbin/devd X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Mar 2013 05:46:37 -0000 Author: hrs Date: Mon Mar 4 05:46:35 2013 New Revision: 247767 URL: http://svnweb.freebsd.org/changeset/base/247767 Log: MFC r226775: - Add support for a "!" character in regex matching in devd(8). It inverts the logic (true/false) of the matching. - Add "!usbus[0-9]+" to IFNET ATTACH notification handler in the default devd.conf to prevent rc.d/netif from running when usbus[0-9]+ is attached. Modified: stable/9/etc/devd.conf stable/9/sbin/devd/devd.cc stable/9/sbin/devd/devd.conf.5 stable/9/sbin/devd/devd.hh Directory Properties: stable/9/etc/ (props changed) stable/9/sbin/devd/ (props changed) Modified: stable/9/etc/devd.conf ============================================================================== --- stable/9/etc/devd.conf Mon Mar 4 05:26:09 2013 (r247766) +++ stable/9/etc/devd.conf Mon Mar 4 05:46:35 2013 (r247767) @@ -38,6 +38,7 @@ options { # notify 0 { match "system" "IFNET"; + match "subsystem" "!usbus[0-9]+"; match "type" "ATTACH"; action "/etc/pccard_ether $subsystem start"; }; Modified: stable/9/sbin/devd/devd.cc ============================================================================== --- stable/9/sbin/devd/devd.cc Mon Mar 4 05:26:09 2013 (r247766) +++ stable/9/sbin/devd/devd.cc Mon Mar 4 05:46:35 2013 (r247767) @@ -251,7 +251,14 @@ action::do_action(config &c) match::match(config &c, const char *var, const char *re) : _var(var), _re("^") { - _re.append(c.expand_string(string(re))); + if (!c.expand_string(string(re)).empty() && + c.expand_string(string(re)).at(0) == '!') { + _re.append(c.expand_string(string(re)).substr(1)); + _inv = 1; + } else { + _re.append(c.expand_string(string(re))); + _inv = 0; + } _re.append("$"); regcomp(&_regex, _re.c_str(), REG_EXTENDED | REG_NOSUB | REG_ICASE); } @@ -268,10 +275,13 @@ match::do_match(config &c) bool retval; if (Dflag) - fprintf(stderr, "Testing %s=%s against %s\n", _var.c_str(), - value.c_str(), _re.c_str()); + fprintf(stderr, "Testing %s=%s against %s, invert=%d\n", + _var.c_str(), value.c_str(), _re.c_str(), _inv); retval = (regexec(&_regex, value.c_str(), 0, NULL, 0) == 0); + if (_inv == 1) + retval = (retval == 0) ? 1 : 0; + return retval; } Modified: stable/9/sbin/devd/devd.conf.5 ============================================================================== --- stable/9/sbin/devd/devd.conf.5 Mon Mar 4 05:26:09 2013 (r247766) +++ stable/9/sbin/devd/devd.conf.5 Mon Mar 4 05:46:35 2013 (r247767) @@ -41,7 +41,7 @@ .\" ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS .\" SOFTWARE. .\" -.Dd March 8, 2009 +.Dd March 4, 2013 .Dt DEVD.CONF 5 .Os .Sh NAME @@ -121,6 +121,10 @@ Creates a regular expression and assigns .Ar regexp-name . The variable is available throughout the rest of the configuration file. +If the string begins with +.Ql \&! , +it matches if the regular expression formed by the rest of the string +does not match. All regular expressions have an implicit .Ql ^$ around them. Modified: stable/9/sbin/devd/devd.hh ============================================================================== --- stable/9/sbin/devd/devd.hh Mon Mar 4 05:26:09 2013 (r247766) +++ stable/9/sbin/devd/devd.hh Mon Mar 4 05:46:35 2013 (r247767) @@ -92,6 +92,7 @@ public: private: std::string _var; std::string _re; + bool _inv; regex_t _regex; }; From owner-svn-src-stable@FreeBSD.ORG Mon Mar 4 05:46:56 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 38147DE6; Mon, 4 Mar 2013 05:46:56 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 1BDE7D58; Mon, 4 Mar 2013 05:46:56 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r245ktub008794; Mon, 4 Mar 2013 05:46:56 GMT (envelope-from hrs@svn.freebsd.org) Received: (from hrs@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r245ktxQ008788; Mon, 4 Mar 2013 05:46:55 GMT (envelope-from hrs@svn.freebsd.org) Message-Id: <201303040546.r245ktxQ008788@svn.freebsd.org> From: Hiroki Sato Date: Mon, 4 Mar 2013 05:46:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r247768 - in stable/8: etc sbin/devd X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Mar 2013 05:46:56 -0000 Author: hrs Date: Mon Mar 4 05:46:54 2013 New Revision: 247768 URL: http://svnweb.freebsd.org/changeset/base/247768 Log: MFC r226775: - Add support for a "!" character in regex matching in devd(8). It inverts the logic (true/false) of the matching. - Add "!usbus[0-9]+" to IFNET ATTACH notification handler in the default devd.conf to prevent rc.d/netif from running when usbus[0-9]+ is attached. Modified: stable/8/etc/devd.conf stable/8/sbin/devd/devd.cc stable/8/sbin/devd/devd.conf.5 stable/8/sbin/devd/devd.hh Directory Properties: stable/8/etc/ (props changed) stable/8/sbin/devd/ (props changed) Modified: stable/8/etc/devd.conf ============================================================================== --- stable/8/etc/devd.conf Mon Mar 4 05:46:35 2013 (r247767) +++ stable/8/etc/devd.conf Mon Mar 4 05:46:54 2013 (r247768) @@ -38,6 +38,7 @@ options { # notify 0 { match "system" "IFNET"; + match "subsystem" "!usbus[0-9]+"; match "type" "ATTACH"; action "/etc/pccard_ether $subsystem start"; }; Modified: stable/8/sbin/devd/devd.cc ============================================================================== --- stable/8/sbin/devd/devd.cc Mon Mar 4 05:46:35 2013 (r247767) +++ stable/8/sbin/devd/devd.cc Mon Mar 4 05:46:54 2013 (r247768) @@ -167,7 +167,14 @@ match::match(config &c, const char *var, { string pattern = re; _re = "^"; - _re.append(c.expand_string(string(re))); + if (!c.expand_string(string(re)).empty() && + c.expand_string(string(re)).at(0) == '!') { + _re.append(c.expand_string(string(re)).substr(1)); + _inv = 1; + } else { + _re.append(c.expand_string(string(re))); + _inv = 0; + } _re.append("$"); regcomp(&_regex, _re.c_str(), REG_EXTENDED | REG_NOSUB | REG_ICASE); } @@ -184,10 +191,13 @@ match::do_match(config &c) bool retval; if (Dflag) - fprintf(stderr, "Testing %s=%s against %s\n", _var.c_str(), - value.c_str(), _re.c_str()); + fprintf(stderr, "Testing %s=%s against %s, invert=%d\n", + _var.c_str(), value.c_str(), _re.c_str(), _inv); retval = (regexec(&_regex, value.c_str(), 0, NULL, 0) == 0); + if (_inv == 1) + retval = (retval == 0) ? 1 : 0; + return retval; } Modified: stable/8/sbin/devd/devd.conf.5 ============================================================================== --- stable/8/sbin/devd/devd.conf.5 Mon Mar 4 05:46:35 2013 (r247767) +++ stable/8/sbin/devd/devd.conf.5 Mon Mar 4 05:46:54 2013 (r247768) @@ -41,7 +41,7 @@ .\" ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS .\" SOFTWARE. .\" -.Dd March 8, 2009 +.Dd March 4, 2013 .Dt DEVD.CONF 5 .Os .Sh NAME @@ -122,6 +122,10 @@ Creates a regular expression and assigns .Ar regexp-name . The variable is available throughout the rest of the configuration file. +If the string begins with +.Ql \&! , +it matches if the regular expression formed by the rest of the string +does not match. All regular expressions have an implicit .Ql ^$ around them. Modified: stable/8/sbin/devd/devd.hh ============================================================================== --- stable/8/sbin/devd/devd.hh Mon Mar 4 05:46:35 2013 (r247767) +++ stable/8/sbin/devd/devd.hh Mon Mar 4 05:46:54 2013 (r247768) @@ -92,6 +92,7 @@ public: private: std::string _var; std::string _re; + bool _inv; regex_t _regex; }; From owner-svn-src-stable@FreeBSD.ORG Mon Mar 4 11:40:53 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 92177905; Mon, 4 Mar 2013 11:40:53 +0000 (UTC) (envelope-from dteske@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 855C411FD; Mon, 4 Mar 2013 11:40:53 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r24BerKt033247; Mon, 4 Mar 2013 11:40:53 GMT (envelope-from dteske@svn.freebsd.org) Received: (from dteske@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r24Beq4g033246; Mon, 4 Mar 2013 11:40:52 GMT (envelope-from dteske@svn.freebsd.org) Message-Id: <201303041140.r24Beq4g033246@svn.freebsd.org> From: Devin Teske Date: Mon, 4 Mar 2013 11:40:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r247781 - stable/9/usr.sbin/tzsetup X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Mar 2013 11:40:53 -0000 Author: dteske Date: Mon Mar 4 11:40:52 2013 New Revision: 247781 URL: http://svnweb.freebsd.org/changeset/base/247781 Log: MFC r247780: Fix VERBOSE reporting on results when removing _PATH_LOCALTIME for UTC option. PR: bin/164976 Submitted by: dteske Modified: stable/9/usr.sbin/tzsetup/tzsetup.c Modified: stable/9/usr.sbin/tzsetup/tzsetup.c ============================================================================== --- stable/9/usr.sbin/tzsetup/tzsetup.c Mon Mar 4 11:34:31 2013 (r247780) +++ stable/9/usr.sbin/tzsetup/tzsetup.c Mon Mar 4 11:40:52 2013 (r247781) @@ -703,8 +703,13 @@ install_zoneinfo_file(const char *zonein return (DITEM_FAILURE | DITEM_RECREATE); } #ifdef VERBOSE + snprintf(title, sizeof(title), "Done"); snprintf(prompt, sizeof(prompt), "Removed %s", path_localtime); + if (usedialog) + dialog_msgbox(title, prompt, 8, 72, 1); + else + fprintf(stderr, "%s\n", prompt); #endif return (DITEM_LEAVE_MENU); } From owner-svn-src-stable@FreeBSD.ORG Mon Mar 4 11:43:21 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id DE28CA9B; Mon, 4 Mar 2013 11:43:21 +0000 (UTC) (envelope-from dteske@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id D1027121A; Mon, 4 Mar 2013 11:43:21 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r24BhLfV033593; Mon, 4 Mar 2013 11:43:21 GMT (envelope-from dteske@svn.freebsd.org) Received: (from dteske@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r24BhLnS033592; Mon, 4 Mar 2013 11:43:21 GMT (envelope-from dteske@svn.freebsd.org) Message-Id: <201303041143.r24BhLnS033592@svn.freebsd.org> From: Devin Teske Date: Mon, 4 Mar 2013 11:43:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r247782 - stable/8/usr.sbin/tzsetup X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Mar 2013 11:43:22 -0000 Author: dteske Date: Mon Mar 4 11:43:20 2013 New Revision: 247782 URL: http://svnweb.freebsd.org/changeset/base/247782 Log: MFC r247780: Fix VERBOSE reporting on results when removing _PATH_LOCALTIME for UTC option. PR: bin/164976 Submitted by: dteske Modified: stable/8/usr.sbin/tzsetup/tzsetup.c Modified: stable/8/usr.sbin/tzsetup/tzsetup.c ============================================================================== --- stable/8/usr.sbin/tzsetup/tzsetup.c Mon Mar 4 11:40:52 2013 (r247781) +++ stable/8/usr.sbin/tzsetup/tzsetup.c Mon Mar 4 11:43:20 2013 (r247782) @@ -588,8 +588,13 @@ install_zoneinfo_file(const char *zonein return (DITEM_FAILURE | DITEM_RECREATE); } #ifdef VERBOSE + snprintf(title, sizeof(title), "Done"); snprintf(prompt, sizeof(prompt), "Removed %s", path_localtime); + if (usedialog) + dialog_msgbox(title, prompt, 8, 72, 1); + else + fprintf(stderr, "%s\n", prompt); #endif return (DITEM_LEAVE_MENU); } From owner-svn-src-stable@FreeBSD.ORG Mon Mar 4 15:30:39 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 8A8E7DA9; Mon, 4 Mar 2013 15:30:39 +0000 (UTC) (envelope-from gallatin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 63CCD118; Mon, 4 Mar 2013 15:30:39 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r24FUd9E001954; Mon, 4 Mar 2013 15:30:39 GMT (envelope-from gallatin@svn.freebsd.org) Received: (from gallatin@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r24FUdDu001953; Mon, 4 Mar 2013 15:30:39 GMT (envelope-from gallatin@svn.freebsd.org) Message-Id: <201303041530.r24FUdDu001953@svn.freebsd.org> From: Andrew Gallatin Date: Mon, 4 Mar 2013 15:30:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r247794 - stable/9/sys/dev/mxge X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Mar 2013 15:30:39 -0000 Author: gallatin Date: Mon Mar 4 15:30:38 2013 New Revision: 247794 URL: http://svnweb.freebsd.org/changeset/base/247794 Log: MFC r247159 Improvements for newer mxge nics: - Some mxge nics may store the serial number in the SN2 field of the EEPROM. These will also have an SN=0 field, so parse the SN2 field, and give it precedence. - Skip MXGEFW_CMD_UNALIGNED_TEST on mxge nics which do not require it. This saves roughly 10ms per port at device attach time. Modified: stable/9/sys/dev/mxge/if_mxge.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) Modified: stable/9/sys/dev/mxge/if_mxge.c ============================================================================== --- stable/9/sys/dev/mxge/if_mxge.c Mon Mar 4 15:03:52 2013 (r247793) +++ stable/9/sys/dev/mxge/if_mxge.c Mon Mar 4 15:30:38 2013 (r247794) @@ -290,11 +290,12 @@ mxge_parse_strings(mxge_softc_t *sc) #define MXGE_NEXT_STRING(p) while(ptr < limit && *ptr++) char *ptr, *limit; - int i, found_mac; + int i, found_mac, found_sn2; ptr = sc->eeprom_strings; limit = sc->eeprom_strings + MXGE_EEPROM_STRINGS_SIZE; found_mac = 0; + found_sn2 = 0; while (ptr < limit && *ptr != '\0') { if (memcmp(ptr, "MAC=", 4) == 0) { ptr += 1; @@ -310,10 +311,16 @@ mxge_parse_strings(mxge_softc_t *sc) ptr += 3; strncpy(sc->product_code_string, ptr, sizeof (sc->product_code_string) - 1); - } else if (memcmp(ptr, "SN=", 3) == 0) { + } else if (!found_sn2 && (memcmp(ptr, "SN=", 3) == 0)) { ptr += 3; strncpy(sc->serial_number_string, ptr, sizeof (sc->serial_number_string) - 1); + } else if (memcmp(ptr, "SN2=", 4) == 0) { + /* SN2 takes precedence over SN */ + ptr += 4; + found_sn2 = 1; + strncpy(sc->serial_number_string, ptr, + sizeof (sc->serial_number_string) - 1); } MXGE_NEXT_STRING(ptr); } @@ -580,9 +587,10 @@ mxge_firmware_probe(mxge_softc_t *sc) /* * Run a DMA test which watches for unaligned completions and - * aborts on the first one seen. + * aborts on the first one seen. Not required on Z8ES or newer. */ - + if (pci_get_revid(sc->dev) >= MXGE_PCI_REV_Z8ES) + return 0; status = mxge_dma_test(sc, MXGEFW_CMD_UNALIGNED_TEST); if (status == 0) return 0; /* keep the aligned firmware */ From owner-svn-src-stable@FreeBSD.ORG Mon Mar 4 15:32:39 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id BECAAF48; Mon, 4 Mar 2013 15:32:39 +0000 (UTC) (envelope-from gallatin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id B1D1113F; Mon, 4 Mar 2013 15:32:39 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r24FWdCO003692; Mon, 4 Mar 2013 15:32:39 GMT (envelope-from gallatin@svn.freebsd.org) Received: (from gallatin@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r24FWdNG003690; Mon, 4 Mar 2013 15:32:39 GMT (envelope-from gallatin@svn.freebsd.org) Message-Id: <201303041532.r24FWdNG003690@svn.freebsd.org> From: Andrew Gallatin Date: Mon, 4 Mar 2013 15:32:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r247795 - stable/9/sys/dev/mxge X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Mar 2013 15:32:39 -0000 Author: gallatin Date: Mon Mar 4 15:32:38 2013 New Revision: 247795 URL: http://svnweb.freebsd.org/changeset/base/247795 Log: MFC r247160 Bump mxge copyright. Modified: stable/9/sys/dev/mxge/if_mxge.c stable/9/sys/dev/mxge/if_mxge_var.h Directory Properties: stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) Modified: stable/9/sys/dev/mxge/if_mxge.c ============================================================================== --- stable/9/sys/dev/mxge/if_mxge.c Mon Mar 4 15:30:38 2013 (r247794) +++ stable/9/sys/dev/mxge/if_mxge.c Mon Mar 4 15:32:38 2013 (r247795) @@ -1,6 +1,6 @@ /****************************************************************************** -Copyright (c) 2006-2009, Myricom Inc. +Copyright (c) 2006-2013, Myricom Inc. All rights reserved. Redistribution and use in source and binary forms, with or without Modified: stable/9/sys/dev/mxge/if_mxge_var.h ============================================================================== --- stable/9/sys/dev/mxge/if_mxge_var.h Mon Mar 4 15:30:38 2013 (r247794) +++ stable/9/sys/dev/mxge/if_mxge_var.h Mon Mar 4 15:32:38 2013 (r247795) @@ -1,6 +1,6 @@ /******************************************************************************* -Copyright (c) 2006-2009, Myricom Inc. +Copyright (c) 2006-2013, Myricom Inc. All rights reserved. Redistribution and use in source and binary forms, with or without From owner-svn-src-stable@FreeBSD.ORG Mon Mar 4 16:44:20 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 7EAD2286; Mon, 4 Mar 2013 16:44:20 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 70D3B797; Mon, 4 Mar 2013 16:44:20 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r24GiKhM025521; Mon, 4 Mar 2013 16:44:20 GMT (envelope-from ian@svn.freebsd.org) Received: (from ian@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r24GiKhv025520; Mon, 4 Mar 2013 16:44:20 GMT (envelope-from ian@svn.freebsd.org) Message-Id: <201303041644.r24GiKhv025520@svn.freebsd.org> From: Ian Lepore Date: Mon, 4 Mar 2013 16:44:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r247802 - stable/9/sbin/devd X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Mar 2013 16:44:20 -0000 Author: ian Date: Mon Mar 4 16:44:19 2013 New Revision: 247802 URL: http://svnweb.freebsd.org/changeset/base/247802 Log: MFC r246361 ... bump .Dd for content change. Modified: stable/9/sbin/devd/devd.8 Directory Properties: stable/9/sbin/devd/ (props changed) Modified: stable/9/sbin/devd/devd.8 ============================================================================== --- stable/9/sbin/devd/devd.8 Mon Mar 4 16:41:27 2013 (r247801) +++ stable/9/sbin/devd/devd.8 Mon Mar 4 16:44:19 2013 (r247802) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 24, 2005 +.Dd January 30, 2013 .Dt DEVD 8 .Os .Sh NAME From owner-svn-src-stable@FreeBSD.ORG Mon Mar 4 16:50:01 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id CFE4B44A; Mon, 4 Mar 2013 16:50:01 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id C253C7CB; Mon, 4 Mar 2013 16:50:01 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r24Go1PK026357; Mon, 4 Mar 2013 16:50:01 GMT (envelope-from ian@svn.freebsd.org) Received: (from ian@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r24Go1M9026353; Mon, 4 Mar 2013 16:50:01 GMT (envelope-from ian@svn.freebsd.org) Message-Id: <201303041650.r24Go1M9026353@svn.freebsd.org> From: Ian Lepore Date: Mon, 4 Mar 2013 16:50:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r247803 - stable/9/sbin/devd X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Mar 2013 16:50:01 -0000 Author: ian Date: Mon Mar 4 16:50:01 2013 New Revision: 247803 URL: http://svnweb.freebsd.org/changeset/base/247803 Log: MFC r246134 ... Improve devd startup time, by tweaking some string handling routines that are heavily used when parsing config files. Mostly these changes avoid making temporary copies of the strings, and avoid doing byte at a time append operations, on the most-used code path. On a 1.2 GHz ARM processor this reduces the time to parse the config files from 13 to 6 seconds. Modified: stable/9/sbin/devd/devd.cc stable/9/sbin/devd/devd.hh Directory Properties: stable/9/sbin/devd/ (props changed) Modified: stable/9/sbin/devd/devd.cc ============================================================================== --- stable/9/sbin/devd/devd.cc Mon Mar 4 16:44:19 2013 (r247802) +++ stable/9/sbin/devd/devd.cc Mon Mar 4 16:50:01 2013 (r247803) @@ -137,7 +137,7 @@ config cfg; event_proc::event_proc() : _prio(-1) { - // nothing + _epsvec.reserve(4); } event_proc::~event_proc() @@ -241,25 +241,18 @@ my_system(const char *command) bool action::do_action(config &c) { - string s = c.expand_string(_cmd); + string s = c.expand_string(_cmd.c_str()); if (Dflag) fprintf(stderr, "Executing '%s'\n", s.c_str()); my_system(s.c_str()); return (true); } -match::match(config &c, const char *var, const char *re) - : _var(var), _re("^") +match::match(config &c, const char *var, const char *re) : + _inv(re[0] == '!'), + _var(var), + _re(c.expand_string(_inv ? re + 1 : re, "^", "$")) { - if (!c.expand_string(string(re)).empty() && - c.expand_string(string(re)).at(0) == '!') { - _re.append(c.expand_string(string(re)).substr(1)); - _inv = 1; - } else { - _re.append(c.expand_string(string(re))); - _inv = 0; - } - _re.append("$"); regcomp(&_regex, _re.c_str(), REG_EXTENDED | REG_NOSUB | REG_ICASE); } @@ -625,24 +618,37 @@ config::expand_one(const char *&src, str do { buffer.append(src++, 1); } while (is_id_char(*src)); - buffer.append("", 1); dst.append(get_variable(buffer.c_str())); } const string -config::expand_string(const string &s) +config::expand_string(const char *src, const char *prepend, const char *append) { - const char *src; + const char *var_at; string dst; - src = s.c_str(); - while (*src) { - if (*src == '$') - expand_one(src, dst); - else - dst.append(src++, 1); + /* + * 128 bytes is enough for 2427 of 2438 expansions that happen + * while parsing config files, as tested on 2013-01-30. + */ + dst.reserve(128); + + if (prepend != NULL) + dst = prepend; + + for (;;) { + var_at = strchr(src, '$'); + if (var_at == NULL) { + dst.append(src); + break; + } + dst.append(src, var_at - src); + src = var_at; + expand_one(src, dst); } - dst.append("", 1); + + if (append != NULL) + dst.append(append); return (dst); } Modified: stable/9/sbin/devd/devd.hh ============================================================================== --- stable/9/sbin/devd/devd.hh Mon Mar 4 16:44:19 2013 (r247802) +++ stable/9/sbin/devd/devd.hh Mon Mar 4 16:50:01 2013 (r247803) @@ -90,9 +90,9 @@ public: virtual bool do_match(config &); virtual bool do_action(config &) { return true; } private: + bool _inv; std::string _var; std::string _re; - bool _inv; regex_t _regex; }; @@ -162,7 +162,8 @@ public: void pop_var_table(); void set_variable(const char *var, const char *val); const std::string &get_variable(const std::string &var); - const std::string expand_string(const std::string &var); + const std::string expand_string(const char * var, + const char * prepend = NULL, const char * append = NULL); char *set_vars(char *); void find_and_execute(char); protected: From owner-svn-src-stable@FreeBSD.ORG Mon Mar 4 17:35:11 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id DB58E749; Mon, 4 Mar 2013 17:35:11 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id A9A16A1C; Mon, 4 Mar 2013 17:35:11 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r24HZBVw041108; Mon, 4 Mar 2013 17:35:11 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r24HZBof041106; Mon, 4 Mar 2013 17:35:11 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201303041735.r24HZBof041106@svn.freebsd.org> From: John Baldwin Date: Mon, 4 Mar 2013 17:35:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r247805 - stable/8/sys/dev/an X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Mar 2013 17:35:11 -0000 Author: jhb Date: Mon Mar 4 17:35:10 2013 New Revision: 247805 URL: http://svnweb.freebsd.org/changeset/base/247805 Log: MFC 199757: - For 350 chips, don't set various INTR bits in TX control word; turning INTR bits on seems to confuse hardware TX engine. - For 350 chips, set TX desc's buffer physical address before turning on the TX desc valid bit. PR: kern/85886 Modified: stable/8/sys/dev/an/if_an.c stable/8/sys/dev/an/if_anreg.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/dev/ (props changed) stable/8/sys/dev/an/ (props changed) Modified: stable/8/sys/dev/an/if_an.c ============================================================================== --- stable/8/sys/dev/an/if_an.c Mon Mar 4 16:55:16 2013 (r247804) +++ stable/8/sys/dev/an/if_an.c Mon Mar 4 17:35:10 2013 (r247805) @@ -2803,7 +2803,7 @@ an_start(struct ifnet *ifp) tx_frame_802_3.an_tx_802_3_payload_len, (caddr_t)&sc->an_txbuf); - txcontrol = AN_TXCTL_8023; + txcontrol = AN_TXCTL_8023 | AN_TXCTL_HW(sc->mpi350); /* write the txcontrol only */ an_write_data(sc, id, 0x08, (caddr_t)&txcontrol, sizeof(txcontrol)); @@ -2866,7 +2866,7 @@ an_start(struct ifnet *ifp) tx_frame_802_3.an_tx_802_3_payload_len, (caddr_t)&sc->an_txbuf); - txcontrol = AN_TXCTL_8023; + txcontrol = AN_TXCTL_8023 | AN_TXCTL_HW(sc->mpi350); /* write the txcontrol only */ bcopy((caddr_t)&txcontrol, &buf[0x08], sizeof(txcontrol)); @@ -2888,7 +2888,7 @@ an_start(struct ifnet *ifp) tx_frame_802_3.an_tx_802_3_payload_len; an_tx_desc.an_phys = sc->an_tx_buffer[idx].an_dma_paddr; - for (i = 0; i < sizeof(an_tx_desc) / 4 ; i++) { + for (i = sizeof(an_tx_desc) / 4 - 1; i >= 0; i--) { CSR_MEM_AUX_WRITE_4(sc, AN_TX_DESC_OFFSET /* zero for now */ + (0 * sizeof(an_tx_desc)) Modified: stable/8/sys/dev/an/if_anreg.h ============================================================================== --- stable/8/sys/dev/an/if_anreg.h Mon Mar 4 16:55:16 2013 (r247804) +++ stable/8/sys/dev/an/if_anreg.h Mon Mar 4 17:35:10 2013 (r247805) @@ -394,13 +394,18 @@ struct an_txframe_802_3 { #define AN_PAYLOADTYPE_ETHER 0x0000 #define AN_PAYLOADTYPE_LLC 0x0010 -#define AN_TXCTL_80211 \ - (AN_TXCTL_TXOK_INTR|AN_TXCTL_TXERR_INTR|AN_HEADERTYPE_80211| \ - AN_PAYLOADTYPE_LLC|AN_TXCTL_NORELEASE) - -#define AN_TXCTL_8023 \ - (AN_TXCTL_TXOK_INTR|AN_TXCTL_TXERR_INTR|AN_HEADERTYPE_8023| \ - AN_PAYLOADTYPE_ETHER|AN_TXCTL_NORELEASE) +#define AN_TXCTL_80211 (AN_HEADERTYPE_80211|AN_PAYLOADTYPE_LLC) + +#define AN_TXCTL_8023 (AN_HEADERTYPE_8023|AN_PAYLOADTYPE_ETHER) + +/* + * Additions to transmit control bits for MPI350 + */ +#define AN_TXCTL_HW(x) \ + ( x ? (AN_TXCTL_NORELEASE) \ + : \ + (AN_TXCTL_TXOK_INTR|AN_TXCTL_TXERR_INTR|AN_TXCTL_NORELEASE) \ + ) #define AN_TXGAP_80211 0 #define AN_TXGAP_8023 0 From owner-svn-src-stable@FreeBSD.ORG Mon Mar 4 17:39:18 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 6C2D3976; Mon, 4 Mar 2013 17:39:18 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 535EDA47; Mon, 4 Mar 2013 17:39:18 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r24HdI1X041687; Mon, 4 Mar 2013 17:39:18 GMT (envelope-from ian@svn.freebsd.org) Received: (from ian@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r24HdIAI041685; Mon, 4 Mar 2013 17:39:18 GMT (envelope-from ian@svn.freebsd.org) Message-Id: <201303041739.r24HdIAI041685@svn.freebsd.org> From: Ian Lepore Date: Mon, 4 Mar 2013 17:39:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r247806 - stable/8/sbin/devd X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Mar 2013 17:39:18 -0000 Author: ian Date: Mon Mar 4 17:39:17 2013 New Revision: 247806 URL: http://svnweb.freebsd.org/changeset/base/247806 Log: MFC r246121 r246361 ... Fix a descriptor leak in devd. Clients reading /var/run/devd.pipe can close their socket connection any time, and devd only notices that when it gets an error trying to write an event to the client. On a system with no device change activity, clients could connect and disappear repeatedly without devd noticing, leading to an ever-growing list of open socket descriptors in devd. Now devd uses poll(2) looking for POLLHUP on all existing clients every time a new client connection is established, and also periodically (once a minute) to proactively find zombie clients and reap the socket descriptors. It also now has a connection limit, configurable with a new -l command line arg. When the maximum number of connections is reached it stops accepting new connections until some current clients drop off. Bump .Dd in for content change (r246361). Modified: stable/8/sbin/devd/devd.8 stable/8/sbin/devd/devd.cc Directory Properties: stable/8/sbin/devd/ (props changed) Modified: stable/8/sbin/devd/devd.8 ============================================================================== --- stable/8/sbin/devd/devd.8 Mon Mar 4 17:35:10 2013 (r247805) +++ stable/8/sbin/devd/devd.8 Mon Mar 4 17:39:17 2013 (r247806) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 24, 2005 +.Dd January 30, 2013 .Dt DEVD 8 .Os .Sh NAME @@ -35,6 +35,7 @@ .Nm .Op Fl Ddn .Op Fl f Ar file +.Op Fl l Ar num .Sh DESCRIPTION The .Nm @@ -55,6 +56,12 @@ instead of the default If option .Fl f is specified more than once, the last file specified is used. +.It Fl l Ar num +Limit concurrent +.Pa /var/run/devd.pipe +connections to +.Ar num . +The default connection limit is 10. .It Fl n Do not process all pending events before becoming a daemon. Instead, call daemon right away. Modified: stable/8/sbin/devd/devd.cc ============================================================================== --- stable/8/sbin/devd/devd.cc Mon Mar 4 17:35:10 2013 (r247805) +++ stable/8/sbin/devd/devd.cc Mon Mar 4 17:39:17 2013 (r247806) @@ -49,6 +49,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -718,23 +719,58 @@ create_socket(const char *name) return (fd); } +unsigned int max_clients = 10; /* Default, can be overriden on cmdline. */ +unsigned int num_clients; list clients; void notify_clients(const char *data, int len) { - list bad; - list::const_iterator i; + list::iterator i; - for (i = clients.begin(); i != clients.end(); ++i) { - if (write(*i, data, len) <= 0) { - bad.push_back(*i); + /* + * Deliver the data to all clients. Throw clients overboard at the + * first sign of trouble. This reaps clients who've died or closed + * their sockets, and also clients who are alive but failing to keep up + * (or who are maliciously not reading, to consume buffer space in + * kernel memory or tie up the limited number of available connections). + */ + for (i = clients.begin(); i != clients.end(); ) { + if (write(*i, data, len) != len) { + --num_clients; close(*i); - } + i = clients.erase(i); + } else + ++i; } +} + +void +check_clients(void) +{ + int s; + struct pollfd pfd; + list::iterator i; - for (i = bad.begin(); i != bad.end(); ++i) - clients.erase(find(clients.begin(), clients.end(), *i)); + /* + * Check all existing clients to see if any of them have disappeared. + * Normally we reap clients when we get an error trying to send them an + * event. This check eliminates the problem of an ever-growing list of + * zombie clients because we're never writing to them on a system + * without frequent device-change activity. + */ + pfd.events = 0; + for (i = clients.begin(); i != clients.end(); ) { + pfd.fd = *i; + s = poll(&pfd, 1, 0); + if ((s < 0 && s != EINTR ) || + (s > 0 && (pfd.revents & POLLHUP))) { + --num_clients; + close(*i); + i = clients.erase(i); + } else + ++i; + } } void @@ -742,9 +778,18 @@ new_client(int fd) { int s; + /* + * First go reap any zombie clients, then accept the connection, and + * shut down the read side to stop clients from consuming kernel memory + * by sending large buffers full of data we'll never read. + */ + check_clients(); s = accept(fd, NULL, NULL); - if (s != -1) + if (s != -1) { + shutdown(s, SHUT_RD); clients.push_back(s); + ++num_clients; + } } static void @@ -755,6 +800,7 @@ event_loop(void) char buffer[DEVCTL_MAXBUF]; int once = 0; int server_fd, max_fd; + int accepting; timeval tv; fd_set fds; @@ -764,6 +810,7 @@ event_loop(void) if (fcntl(fd, F_SETFD, FD_CLOEXEC) != 0) err(1, "Can't set close-on-exec flag on devctl"); server_fd = create_socket(PIPE); + accepting = 1; max_fd = max(fd, server_fd) + 1; while (1) { if (romeo_must_die) @@ -786,15 +833,38 @@ event_loop(void) once++; } } + /* + * When we've already got the max number of clients, stop + * accepting new connections (don't put server_fd in the set), + * shrink the accept() queue to reject connections quickly, and + * poll the existing clients more often, so that we notice more + * quickly when any of them disappear to free up client slots. + */ FD_ZERO(&fds); FD_SET(fd, &fds); - FD_SET(server_fd, &fds); - rv = select(max_fd, &fds, NULL, NULL, NULL); + if (num_clients < max_clients) { + if (!accepting) { + listen(server_fd, max_clients); + accepting = 1; + } + FD_SET(server_fd, &fds); + tv.tv_sec = 60; + tv.tv_usec = 0; + } else { + if (accepting) { + listen(server_fd, 0); + accepting = 0; + } + tv.tv_sec = 2; + tv.tv_usec = 0; + } + rv = select(max_fd, &fds, NULL, NULL, &tv); if (rv == -1) { if (errno == EINTR) continue; err(1, "select"); - } + } else if (rv == 0) + check_clients(); if (FD_ISSET(fd, &fds)) { rv = read(fd, buffer, sizeof(buffer) - 1); if (rv > 0) { @@ -913,7 +983,8 @@ gensighand(int) static void usage() { - fprintf(stderr, "usage: %s [-Ddn] [-f file]\n", getprogname()); + fprintf(stderr, "usage: %s [-Ddn] [-l connlimit] [-f file]\n", + getprogname()); exit(1); } @@ -942,7 +1013,7 @@ main(int argc, char **argv) int ch; check_devd_enabled(); - while ((ch = getopt(argc, argv, "Ddf:n")) != -1) { + while ((ch = getopt(argc, argv, "Ddf:l:n")) != -1) { switch (ch) { case 'D': Dflag++; @@ -953,6 +1024,9 @@ main(int argc, char **argv) case 'f': configfile = optarg; break; + case 'l': + max_clients = MAX(1, strtoul(optarg, NULL, 0)); + break; case 'n': nflag++; break; From owner-svn-src-stable@FreeBSD.ORG Mon Mar 4 18:28:24 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 9D32E976; Mon, 4 Mar 2013 18:28:24 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 8A636D4D; Mon, 4 Mar 2013 18:28:24 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r24ISORK056870; Mon, 4 Mar 2013 18:28:24 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r24ISOVd056869; Mon, 4 Mar 2013 18:28:24 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201303041828.r24ISOVd056869@svn.freebsd.org> From: John Baldwin Date: Mon, 4 Mar 2013 18:28:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r247808 - stable/8/sys/compat/linprocfs X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Mar 2013 18:28:24 -0000 Author: jhb Date: Mon Mar 4 18:28:24 2013 New Revision: 247808 URL: http://svnweb.freebsd.org/changeset/base/247808 Log: MFC 205541,205592: Implement /proc/filesystems. PR: kern/142595 Modified: stable/8/sys/compat/linprocfs/linprocfs.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/compat/ (props changed) Modified: stable/8/sys/compat/linprocfs/linprocfs.c ============================================================================== --- stable/8/sys/compat/linprocfs/linprocfs.c Mon Mar 4 18:07:28 2013 (r247807) +++ stable/8/sys/compat/linprocfs/linprocfs.c Mon Mar 4 18:28:24 2013 (r247808) @@ -1427,6 +1427,24 @@ linprocfs_docmdline(PFS_FILL_ARGS) return (0); } +/* + * Filler function for proc/filesystems + */ +static int +linprocfs_dofilesystems(PFS_FILL_ARGS) +{ + struct vfsconf *vfsp; + + mtx_lock(&Giant); + TAILQ_FOREACH(vfsp, &vfsconf, vfc_list) { + if (vfsp->vfc_flags & VFCF_SYNTHETIC) + sbuf_printf(sb, "nodev"); + sbuf_printf(sb, "\t%s\n", vfsp->vfc_name); + } + mtx_unlock(&Giant); + return(0); +} + #if 0 /* * Filler function for proc/modules @@ -1462,6 +1480,8 @@ linprocfs_init(PFS_INIT_ARGS) NULL, NULL, NULL, PFS_RD); pfs_create_file(root, "devices", &linprocfs_dodevices, NULL, NULL, NULL, PFS_RD); + pfs_create_file(root, "filesystems", &linprocfs_dofilesystems, + NULL, NULL, NULL, PFS_RD); pfs_create_file(root, "loadavg", &linprocfs_doloadavg, NULL, NULL, NULL, PFS_RD); pfs_create_file(root, "meminfo", &linprocfs_domeminfo, From owner-svn-src-stable@FreeBSD.ORG Mon Mar 4 22:04:15 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 94E2920C; Mon, 4 Mar 2013 22:04:15 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 77E5217EF; Mon, 4 Mar 2013 22:04:15 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r24M4FUv023538; Mon, 4 Mar 2013 22:04:15 GMT (envelope-from ian@svn.freebsd.org) Received: (from ian@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r24M4FI2023536; Mon, 4 Mar 2013 22:04:15 GMT (envelope-from ian@svn.freebsd.org) Message-Id: <201303042204.r24M4FI2023536@svn.freebsd.org> From: Ian Lepore Date: Mon, 4 Mar 2013 22:04:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r247819 - stable/8/sbin/devd X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Mar 2013 22:04:15 -0000 Author: ian Date: Mon Mar 4 22:04:14 2013 New Revision: 247819 URL: http://svnweb.freebsd.org/changeset/base/247819 Log: MFC r209583 ... Expand system into my_system, and add the necessary tidyness that we need. Close the pidfile. Then close all descriptors >= 3 to avoid information leakage to children. This solves the problem of not being able to restart devd when you have, for example, a dhclient forked to configure your network... Modified: stable/8/sbin/devd/devd.cc stable/8/sbin/devd/devd.hh Directory Properties: stable/8/sbin/devd/ (props changed) Modified: stable/8/sbin/devd/devd.cc ============================================================================== --- stable/8/sbin/devd/devd.cc Mon Mar 4 21:52:12 2013 (r247818) +++ stable/8/sbin/devd/devd.cc Mon Mar 4 22:04:14 2013 (r247819) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2002-2003 M. Warner Losh. + * Copyright (c) 2002-2010 M. Warner Losh. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -22,6 +22,35 @@ * 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. + * + * my_system is a variation on lib/libc/stdlib/system.c: + * + * Copyright (c) 1988, 1993 + * The Regents of the University of California. 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. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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. */ /* @@ -41,6 +70,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -50,6 +80,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -153,13 +184,67 @@ action::~action() // nothing } +static int +my_system(const char *command) +{ + pid_t pid, savedpid; + int pstat; + struct sigaction ign, intact, quitact; + sigset_t newsigblock, oldsigblock; + + if (!command) /* just checking... */ + return(1); + + /* + * Ignore SIGINT and SIGQUIT, block SIGCHLD. Remember to save + * existing signal dispositions. + */ + ign.sa_handler = SIG_IGN; + ::sigemptyset(&ign.sa_mask); + ign.sa_flags = 0; + ::sigaction(SIGINT, &ign, &intact); + ::sigaction(SIGQUIT, &ign, &quitact); + ::sigemptyset(&newsigblock); + ::sigaddset(&newsigblock, SIGCHLD); + ::sigprocmask(SIG_BLOCK, &newsigblock, &oldsigblock); + switch (pid = ::fork()) { + case -1: /* error */ + break; + case 0: /* child */ + /* + * Restore original signal dispositions and exec the command. + */ + ::sigaction(SIGINT, &intact, NULL); + ::sigaction(SIGQUIT, &quitact, NULL); + ::sigprocmask(SIG_SETMASK, &oldsigblock, NULL); + /* + * Close the PID file, and all other open descriptors. + * Inherit std{in,out,err} only. + */ + cfg.close_pidfile(); + ::closefrom(3); + ::execl(_PATH_BSHELL, "sh", "-c", command, (char *)NULL); + ::_exit(127); + default: /* parent */ + savedpid = pid; + do { + pid = ::wait4(savedpid, &pstat, 0, (struct rusage *)0); + } while (pid == -1 && errno == EINTR); + break; + } + ::sigaction(SIGINT, &intact, NULL); + ::sigaction(SIGQUIT, &quitact, NULL); + ::sigprocmask(SIG_SETMASK, &oldsigblock, NULL); + return (pid == -1 ? -1 : pstat); +} + bool action::do_action(config &c) { string s = c.expand_string(_cmd); if (Dflag) fprintf(stderr, "Executing '%s'\n", s.c_str()); - ::system(s.c_str()); + my_system(s.c_str()); return (true); } @@ -403,6 +488,13 @@ config::write_pidfile() } void +config::close_pidfile() +{ + + pidfile_close(pfh); +} + +void config::remove_pidfile() { Modified: stable/8/sbin/devd/devd.hh ============================================================================== --- stable/8/sbin/devd/devd.hh Mon Mar 4 21:52:12 2013 (r247818) +++ stable/8/sbin/devd/devd.hh Mon Mar 4 22:04:14 2013 (r247819) @@ -154,6 +154,7 @@ public: void set_pidfile(const char *); void reset(); void parse(); + void close_pidfile(); void open_pidfile(); void write_pidfile(); void remove_pidfile(); From owner-svn-src-stable@FreeBSD.ORG Mon Mar 4 23:15:26 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id AB8385E2; Mon, 4 Mar 2013 23:15:26 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 9DBF21E2; Mon, 4 Mar 2013 23:15:26 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r24NFQdN030849; Mon, 4 Mar 2013 23:15:26 GMT (envelope-from ian@svn.freebsd.org) Received: (from ian@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r24NFQDI030847; Mon, 4 Mar 2013 23:15:26 GMT (envelope-from ian@svn.freebsd.org) Message-Id: <201303042315.r24NFQDI030847@svn.freebsd.org> From: Ian Lepore Date: Mon, 4 Mar 2013 23:15:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r247824 - stable/8/sbin/devd X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Mar 2013 23:15:26 -0000 Author: ian Date: Mon Mar 4 23:15:25 2013 New Revision: 247824 URL: http://svnweb.freebsd.org/changeset/base/247824 Log: MFC ... r210609 - remove unused string r210610 - avoid copy ctors by using prefix operators r213646 - allow spacey things (liberal whitespace parsing) r236388 - libc++ compatibility (add :: prefix to bind() call) r240823 - use O_CLOEXEC for open instead of separate fcntl(2) call r243932 - prefer init expression to assignment in ctor r209583 ... Expand system into my_system, and add the necessary tidyness that we need. Close the pidfile. Then close all descriptors >= 3 to avoid information leakage to children. This solves the problem of not being able to restart devd when you have, for example, a dhclient forked to configure your network... Modified: stable/8/sbin/devd/devd.cc stable/8/sbin/devd/devd.hh Directory Properties: stable/8/sbin/devd/ (props changed) Modified: stable/8/sbin/devd/devd.cc ============================================================================== --- stable/8/sbin/devd/devd.cc Mon Mar 4 23:15:07 2013 (r247823) +++ stable/8/sbin/devd/devd.cc Mon Mar 4 23:15:25 2013 (r247824) @@ -249,10 +249,8 @@ action::do_action(config &c) } match::match(config &c, const char *var, const char *re) - : _var(var) + : _var(var), _re("^") { - string pattern = re; - _re = "^"; if (!c.expand_string(string(re)).empty() && c.expand_string(string(re)).at(0) == '!') { _re.append(c.expand_string(string(re)).substr(1)); @@ -273,7 +271,7 @@ match::~match() bool match::do_match(config &c) { - string value = c.get_variable(_var); + const string &value = c.get_variable(_var); bool retval; if (Dflag) @@ -590,7 +588,7 @@ void config::expand_one(const char *&src, string &dst) { int count; - string buffer, varstr; + string buffer; src++; // $$ -> $ @@ -628,8 +626,7 @@ config::expand_one(const char *&src, str buffer.append(src++, 1); } while (is_id_char(*src)); buffer.append("", 1); - varstr = get_variable(buffer.c_str()); - dst.append(varstr); + dst.append(get_variable(buffer.c_str())); } const string @@ -763,9 +760,13 @@ process_event(char *buffer) if (sp == NULL) return; /* Can't happen? */ *sp++ = '\0'; + while (isspace(*sp)) + sp++; if (strncmp(sp, "at ", 3) == 0) sp += 3; sp = cfg.set_vars(sp); + while (isspace(*sp)) + sp++; if (strncmp(sp, "on ", 3) == 0) cfg.set_variable("bus", sp + 3); break; @@ -776,9 +777,13 @@ process_event(char *buffer) return; /* Can't happen? */ *sp++ = '\0'; cfg.set_variable("device-name", buffer); + while (isspace(*sp)) + sp++; if (strncmp(sp, "at ", 3) == 0) sp += 3; sp = cfg.set_vars(sp); + while (isspace(*sp)) + sp++; if (strncmp(sp, "on ", 3) == 0) cfg.set_variable("bus", sp + 3); break; @@ -803,7 +808,7 @@ create_socket(const char *name) unlink(name); if (fcntl(fd, F_SETFL, O_NONBLOCK) < 0) err(1, "fcntl"); - if (bind(fd, (struct sockaddr *) & sun, slen) < 0) + if (::bind(fd, (struct sockaddr *) & sun, slen) < 0) err(1, "bind"); listen(fd, 4); chown(name, 0, 0); /* XXX - root.wheel */ Modified: stable/8/sbin/devd/devd.hh ============================================================================== --- stable/8/sbin/devd/devd.hh Mon Mar 4 23:15:07 2013 (r247823) +++ stable/8/sbin/devd/devd.hh Mon Mar 4 23:15:25 2013 (r247824) @@ -144,7 +144,7 @@ private: class config { public: - config() { _pidfile = ""; push_var_table(); } + config() : _pidfile("") { push_var_table(); } virtual ~config() { reset(); } void add_attach(int, event_proc *); void add_detach(int, event_proc *); From owner-svn-src-stable@FreeBSD.ORG Mon Mar 4 23:22:38 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 60746862; Mon, 4 Mar 2013 23:22:38 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 3A97623F; Mon, 4 Mar 2013 23:22:38 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r24NMbqC033417; Mon, 4 Mar 2013 23:22:37 GMT (envelope-from ian@svn.freebsd.org) Received: (from ian@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r24NMbea033415; Mon, 4 Mar 2013 23:22:37 GMT (envelope-from ian@svn.freebsd.org) Message-Id: <201303042322.r24NMbea033415@svn.freebsd.org> From: Ian Lepore Date: Mon, 4 Mar 2013 23:22:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r247825 - stable/8/sbin/devd X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Mar 2013 23:22:38 -0000 Author: ian Date: Mon Mar 4 23:22:37 2013 New Revision: 247825 URL: http://svnweb.freebsd.org/changeset/base/247825 Log: MFC r246134 ... Improve devd startup time, by tweaking some string handling routines that are heavily used when parsing config files. Mostly these changes avoid making temporary copies of the strings, and avoid doing byte at a time append operations, on the most-used code path. Modified: stable/8/sbin/devd/devd.cc stable/8/sbin/devd/devd.hh Directory Properties: stable/8/sbin/devd/ (props changed) Modified: stable/8/sbin/devd/devd.cc ============================================================================== --- stable/8/sbin/devd/devd.cc Mon Mar 4 23:15:25 2013 (r247824) +++ stable/8/sbin/devd/devd.cc Mon Mar 4 23:22:37 2013 (r247825) @@ -137,7 +137,7 @@ config cfg; event_proc::event_proc() : _prio(-1) { - // nothing + _epsvec.reserve(4); } event_proc::~event_proc() @@ -241,25 +241,18 @@ my_system(const char *command) bool action::do_action(config &c) { - string s = c.expand_string(_cmd); + string s = c.expand_string(_cmd.c_str()); if (Dflag) fprintf(stderr, "Executing '%s'\n", s.c_str()); my_system(s.c_str()); return (true); } -match::match(config &c, const char *var, const char *re) - : _var(var), _re("^") +match::match(config &c, const char *var, const char *re) : + _inv(re[0] == '!'), + _var(var), + _re(c.expand_string(_inv ? re + 1 : re, "^", "$")) { - if (!c.expand_string(string(re)).empty() && - c.expand_string(string(re)).at(0) == '!') { - _re.append(c.expand_string(string(re)).substr(1)); - _inv = 1; - } else { - _re.append(c.expand_string(string(re))); - _inv = 0; - } - _re.append("$"); regcomp(&_regex, _re.c_str(), REG_EXTENDED | REG_NOSUB | REG_ICASE); } @@ -625,24 +618,37 @@ config::expand_one(const char *&src, str do { buffer.append(src++, 1); } while (is_id_char(*src)); - buffer.append("", 1); dst.append(get_variable(buffer.c_str())); } const string -config::expand_string(const string &s) +config::expand_string(const char *src, const char *prepend, const char *append) { - const char *src; + const char *var_at; string dst; - src = s.c_str(); - while (*src) { - if (*src == '$') - expand_one(src, dst); - else - dst.append(src++, 1); + /* + * 128 bytes is enough for 2427 of 2438 expansions that happen + * while parsing config files, as tested on 2013-01-30. + */ + dst.reserve(128); + + if (prepend != NULL) + dst = prepend; + + for (;;) { + var_at = strchr(src, '$'); + if (var_at == NULL) { + dst.append(src); + break; + } + dst.append(src, var_at - src); + src = var_at; + expand_one(src, dst); } - dst.append("", 1); + + if (append != NULL) + dst.append(append); return (dst); } Modified: stable/8/sbin/devd/devd.hh ============================================================================== --- stable/8/sbin/devd/devd.hh Mon Mar 4 23:15:25 2013 (r247824) +++ stable/8/sbin/devd/devd.hh Mon Mar 4 23:22:37 2013 (r247825) @@ -90,9 +90,9 @@ public: virtual bool do_match(config &); virtual bool do_action(config &) { return true; } private: + bool _inv; std::string _var; std::string _re; - bool _inv; regex_t _regex; }; @@ -162,7 +162,8 @@ public: void pop_var_table(); void set_variable(const char *var, const char *val); const std::string &get_variable(const std::string &var); - const std::string expand_string(const std::string &var); + const std::string expand_string(const char * var, + const char * prepend = NULL, const char * append = NULL); char *set_vars(char *); void find_and_execute(char); protected: From owner-svn-src-stable@FreeBSD.ORG Tue Mar 5 06:41:41 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 213F74A2; Tue, 5 Mar 2013 06:41:41 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 06931332; Tue, 5 Mar 2013 06:41:41 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r256feO9064699; Tue, 5 Mar 2013 06:41:40 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r256fenc064696; Tue, 5 Mar 2013 06:41:40 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201303050641.r256fenc064696@svn.freebsd.org> From: Xin LI Date: Tue, 5 Mar 2013 06:41:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r247827 - in stable: 8/share/man/man4 8/sys/dev/arcmsr 9/share/man/man4 9/sys/dev/arcmsr X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Mar 2013 06:41:41 -0000 Author: delphij Date: Tue Mar 5 06:41:39 2013 New Revision: 247827 URL: http://svnweb.freebsd.org/changeset/base/247827 Log: MFC r247443: Refresh vendor driver version which adds ARC-1224 support. Many thanks to Areca for continuing to support FreeBSD. Submitted by: 黃清隆 Modified: stable/8/share/man/man4/arcmsr.4 stable/8/sys/dev/arcmsr/arcmsr.c stable/8/sys/dev/arcmsr/arcmsr.h Directory Properties: stable/8/share/man/man4/ (props changed) stable/8/sys/ (props changed) stable/8/sys/dev/ (props changed) stable/8/sys/dev/arcmsr/ (props changed) Changes in other areas also in this revision: Modified: stable/9/share/man/man4/arcmsr.4 stable/9/sys/dev/arcmsr/arcmsr.c stable/9/sys/dev/arcmsr/arcmsr.h Directory Properties: stable/9/share/man/man4/ (props changed) stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) Modified: stable/8/share/man/man4/arcmsr.4 ============================================================================== --- stable/8/share/man/man4/arcmsr.4 Tue Mar 5 00:52:14 2013 (r247826) +++ stable/8/share/man/man4/arcmsr.4 Tue Mar 5 06:41:39 2013 (r247827) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd December 18, 2012 +.Dd February 27, 2013 .Dt ARCMSR 4 .Os .Sh NAME @@ -108,6 +108,8 @@ ARC-1222 .It ARC-1223 .It +ARC-1224 +.It ARC-1230 .It ARC-1231 Modified: stable/8/sys/dev/arcmsr/arcmsr.c ============================================================================== --- stable/8/sys/dev/arcmsr/arcmsr.c Tue Mar 5 00:52:14 2013 (r247826) +++ stable/8/sys/dev/arcmsr/arcmsr.c Tue Mar 5 06:41:39 2013 (r247827) @@ -1,16 +1,15 @@ /* -***************************************************************************************** -** O.S : FreeBSD +******************************************************************************** +** OS : FreeBSD ** FILE NAME : arcmsr.c ** BY : Erich Chen, Ching Huang ** Description: SCSI RAID Device Driver for -** ARECA (ARC11XX/ARC12XX/ARC13XX/ARC16XX/ARC188x) SATA/SAS RAID HOST Adapter -** ARCMSR RAID Host adapter -** [RAID controller:INTEL 331(PCI-X) 341(PCI-EXPRESS) chip set] -****************************************************************************************** -************************************************************************ +** ARECA (ARC11XX/ARC12XX/ARC13XX/ARC16XX/ARC188x) +** SATA/SAS RAID HOST Adapter +******************************************************************************** +******************************************************************************** ** -** Copyright (C) 2002 - 2010, Areca Technology Corporation All rights reserved. +** Copyright (C) 2002 - 2012, Areca Technology Corporation All rights reserved. ** ** Redistribution and use in source and binary forms, with or without ** modification, are permitted provided that the following conditions @@ -33,7 +32,7 @@ ** 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. -************************************************************************** +******************************************************************************** ** History ** ** REV# DATE NAME DESCRIPTION @@ -73,7 +72,7 @@ ** 1.20.00.23 01/30/2012 Ching Huang Fixed Request requeued and Retrying command ** 1.20.00.24 06/11/2012 Ching Huang Fixed return sense data condition ** 1.20.00.25 08/17/2012 Ching Huang Fixed hotplug device no function on type A adapter -** 1.20.00.26 12/14/2012 Ching Huang Added support ARC1214 +** 1.20.00.26 12/14/2012 Ching Huang Added support ARC1214,1224 ****************************************************************************************** */ @@ -145,7 +144,7 @@ __FBSDID("$FreeBSD$"); #define arcmsr_callout_init(a) callout_init(a); #endif -#define ARCMSR_DRIVER_VERSION "Driver Version 1.20.00.26 2012-12-14" +#define ARCMSR_DRIVER_VERSION "Driver Version 1.20.00.26 2013-01-08" #include /* ************************************************************************** @@ -168,7 +167,7 @@ static void arcmsr_stop_adapter_bgrb(str static void arcmsr_start_adapter_bgrb(struct AdapterControlBlock *acb); static void arcmsr_iop_init(struct AdapterControlBlock *acb); static void arcmsr_flush_adapter_cache(struct AdapterControlBlock *acb); -static void arcmsr_Read_iop_rqbuffer_data(struct AdapterControlBlock *acb, struct QBUFFER *prbuffer); +static u_int32_t arcmsr_Read_iop_rqbuffer_data(struct AdapterControlBlock *acb, struct QBUFFER *prbuffer); static void arcmsr_Write_data_2iop_wqbuffer(struct AdapterControlBlock *acb); static void arcmsr_abort_allcmd(struct AdapterControlBlock *acb); static void arcmsr_srb_complete(struct CommandControlBlock *srb, int stand_flag); @@ -212,7 +211,11 @@ static device_method_t arcmsr_methods[]= DEVMETHOD(device_suspend, arcmsr_suspend), DEVMETHOD(device_resume, arcmsr_resume), +#if __FreeBSD_version >= 803000 DEVMETHOD_END +#else + { 0, 0 } +#endif }; static driver_t arcmsr_driver={ @@ -1381,13 +1384,61 @@ static void arcmsr_poll(struct cam_sim * ************************************************************************** ************************************************************************** */ -static void arcmsr_Read_iop_rqbuffer_data(struct AdapterControlBlock *acb, +static u_int32_t arcmsr_Read_iop_rqbuffer_data_D(struct AdapterControlBlock *acb, + struct QBUFFER *prbuffer) { + + u_int8_t *pQbuffer; + u_int8_t *buf1 = 0; + u_int32_t *iop_data, *buf2 = 0; + u_int32_t iop_len, data_len; + + iop_data = (u_int32_t *)prbuffer->data; + iop_len = (u_int32_t)prbuffer->data_len; + if ( iop_len > 0 ) + { + buf1 = malloc(128, M_DEVBUF, M_NOWAIT | M_ZERO); + buf2 = (u_int32_t *)buf1; + if( buf1 == NULL) + return (0); + data_len = iop_len; + while(data_len >= 4) + { + *buf2++ = *iop_data++; + data_len -= 4; + } + if(data_len) + *buf2 = *iop_data; + buf2 = (u_int32_t *)buf1; + } + while (iop_len > 0) { + pQbuffer = &acb->rqbuffer[acb->rqbuf_lastindex]; + *pQbuffer = *buf1; + acb->rqbuf_lastindex++; + /* if last, index number set it to 0 */ + acb->rqbuf_lastindex %= ARCMSR_MAX_QBUFFER; + buf1++; + iop_len--; + } + if(buf2) + free( (u_int8_t *)buf2, M_DEVBUF); + /* let IOP know data has been read */ + arcmsr_iop_message_read(acb); + return (1); +} +/* +************************************************************************** +************************************************************************** +*/ +static u_int32_t arcmsr_Read_iop_rqbuffer_data(struct AdapterControlBlock *acb, struct QBUFFER *prbuffer) { u_int8_t *pQbuffer; u_int8_t *iop_data; u_int32_t iop_len; + if(acb->adapter_type == ACB_ADAPTER_TYPE_D) { + return(arcmsr_Read_iop_rqbuffer_data_D(acb, prbuffer)); + } iop_data = (u_int8_t *)prbuffer->data; iop_len = (u_int32_t)prbuffer->data_len; while (iop_len > 0) { @@ -1401,6 +1452,7 @@ static void arcmsr_Read_iop_rqbuffer_dat } /* let IOP know data has been read */ arcmsr_iop_message_read(acb); + return (1); } /* ************************************************************************** @@ -1417,7 +1469,8 @@ static void arcmsr_iop2drv_data_wrote_ha my_empty_len = (acb->rqbuf_lastindex - acb->rqbuf_firstindex - 1) & (ARCMSR_MAX_QBUFFER-1); if(my_empty_len >= prbuffer->data_len) { - arcmsr_Read_iop_rqbuffer_data(acb, prbuffer); + if(arcmsr_Read_iop_rqbuffer_data(acb, prbuffer) == 0) + acb->acb_flags |= ACB_F_IOPDATA_OVERFLOW; } else { acb->acb_flags |= ACB_F_IOPDATA_OVERFLOW; } @@ -1427,6 +1480,50 @@ static void arcmsr_iop2drv_data_wrote_ha ********************************************************************** ********************************************************************** */ +static void arcmsr_Write_data_2iop_wqbuffer_D(struct AdapterControlBlock *acb) +{ + u_int8_t *pQbuffer; + struct QBUFFER *pwbuffer; + u_int8_t *buf1 = 0; + u_int32_t *iop_data, *buf2 = 0; + u_int32_t allxfer_len = 0, data_len; + + if(acb->acb_flags & ACB_F_MESSAGE_WQBUFFER_READ) { + buf1 = malloc(128, M_DEVBUF, M_NOWAIT | M_ZERO); + buf2 = (u_int32_t *)buf1; + if( buf1 == NULL) + return; + + acb->acb_flags &= (~ACB_F_MESSAGE_WQBUFFER_READ); + pwbuffer = arcmsr_get_iop_wqbuffer(acb); + iop_data = (u_int32_t *)pwbuffer->data; + while((acb->wqbuf_firstindex != acb->wqbuf_lastindex) + && (allxfer_len < 124)) { + pQbuffer = &acb->wqbuffer[acb->wqbuf_firstindex]; + *buf1 = *pQbuffer; + acb->wqbuf_firstindex++; + acb->wqbuf_firstindex %= ARCMSR_MAX_QBUFFER; + buf1++; + allxfer_len++; + } + pwbuffer->data_len = allxfer_len; + data_len = allxfer_len; + buf1 = (u_int8_t *)buf2; + while(data_len >= 4) + { + *iop_data++ = *buf2++; + data_len -= 4; + } + if(data_len) + *iop_data = *buf2; + free( buf1, M_DEVBUF); + arcmsr_iop_message_wrote(acb); + } +} +/* +********************************************************************** +********************************************************************** +*/ static void arcmsr_Write_data_2iop_wqbuffer(struct AdapterControlBlock *acb) { u_int8_t *pQbuffer; @@ -1434,6 +1531,10 @@ static void arcmsr_Write_data_2iop_wqbuf u_int8_t *iop_data; int32_t allxfer_len=0; + if(acb->adapter_type == ACB_ADAPTER_TYPE_D) { + arcmsr_Write_data_2iop_wqbuffer_D(acb); + return; + } if(acb->acb_flags & ACB_F_MESSAGE_WQBUFFER_READ) { acb->acb_flags &= (~ACB_F_MESSAGE_WQBUFFER_READ); pwbuffer = arcmsr_get_iop_wqbuffer(acb); @@ -2153,7 +2254,8 @@ u_int32_t arcmsr_iop_ioctlcmd(struct Ada acb->acb_flags &= ~ACB_F_IOPDATA_OVERFLOW; prbuffer = arcmsr_get_iop_rqbuffer(acb); - arcmsr_Read_iop_rqbuffer_data(acb, prbuffer); + if(arcmsr_Read_iop_rqbuffer_data(acb, prbuffer) == 0) + acb->acb_flags |= ACB_F_IOPDATA_OVERFLOW; } pcmdmessagefld->cmdmessage.Length = allxfer_len; pcmdmessagefld->cmdmessage.ReturnCode = ARCMSR_MESSAGE_RETURNCODE_OK; @@ -2374,7 +2476,8 @@ static int arcmsr_iop_message_xfer(struc acb->acb_flags &= ~ACB_F_IOPDATA_OVERFLOW; prbuffer = arcmsr_get_iop_rqbuffer(acb); - arcmsr_Read_iop_rqbuffer_data(acb, prbuffer); + if(arcmsr_Read_iop_rqbuffer_data(acb, prbuffer) == 0) + acb->acb_flags |= ACB_F_IOPDATA_OVERFLOW; } pcmdmessagefld->cmdmessage.Length = allxfer_len; pcmdmessagefld->cmdmessage.ReturnCode = ARCMSR_MESSAGE_RETURNCODE_OK; Modified: stable/8/sys/dev/arcmsr/arcmsr.h ============================================================================== --- stable/8/sys/dev/arcmsr/arcmsr.h Tue Mar 5 00:52:14 2013 (r247826) +++ stable/8/sys/dev/arcmsr/arcmsr.h Tue Mar 5 06:41:39 2013 (r247827) @@ -1,17 +1,14 @@ /* -*********************************************************************************************** -** O.S : FreeBSD +******************************************************************************** +** OS : FreeBSD ** FILE NAME : arcmsr.h ** BY : Erich Chen, Ching Huang ** Description: SCSI RAID Device Driver for -** ARECA SATA/SAS RAID HOST Adapter -** [RAID controller:INTEL 331(PCI-X) 341(PCI-EXPRESS) chip set] -*********************************************************************************************** -************************************************************************ -** Copyright (C) 2002 - 2010, Areca Technology Corporation All rights reserved. -** -** Web site: www.areca.com.tw -** E-mail: erich@areca.com.tw; ching2048@areca.com.tw +** ARECA (ARC11XX/ARC12XX/ARC13XX/ARC16XX/ARC188x) +** SATA/SAS RAID HOST Adapter +******************************************************************************** +******************************************************************************** +** Copyright (C) 2002 - 2012, Areca Technology Corporation All rights reserved. ** ** Redistribution and use in source and binary forms,with or without ** modification,are permitted provided that the following conditions From owner-svn-src-stable@FreeBSD.ORG Tue Mar 5 06:41:40 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 64C934A1; Tue, 5 Mar 2013 06:41:40 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 49CFE331; Tue, 5 Mar 2013 06:41:40 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r256fe3b064691; Tue, 5 Mar 2013 06:41:40 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r256fdl2064685; Tue, 5 Mar 2013 06:41:39 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201303050641.r256fdl2064685@svn.freebsd.org> From: Xin LI Date: Tue, 5 Mar 2013 06:41:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r247827 - in stable: 8/share/man/man4 8/sys/dev/arcmsr 9/share/man/man4 9/sys/dev/arcmsr X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Mar 2013 06:41:40 -0000 Author: delphij Date: Tue Mar 5 06:41:39 2013 New Revision: 247827 URL: http://svnweb.freebsd.org/changeset/base/247827 Log: MFC r247443: Refresh vendor driver version which adds ARC-1224 support. Many thanks to Areca for continuing to support FreeBSD. Submitted by: 黃清隆 Modified: stable/9/share/man/man4/arcmsr.4 stable/9/sys/dev/arcmsr/arcmsr.c stable/9/sys/dev/arcmsr/arcmsr.h Directory Properties: stable/9/share/man/man4/ (props changed) stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) Changes in other areas also in this revision: Modified: stable/8/share/man/man4/arcmsr.4 stable/8/sys/dev/arcmsr/arcmsr.c stable/8/sys/dev/arcmsr/arcmsr.h Directory Properties: stable/8/share/man/man4/ (props changed) stable/8/sys/ (props changed) stable/8/sys/dev/ (props changed) stable/8/sys/dev/arcmsr/ (props changed) Modified: stable/9/share/man/man4/arcmsr.4 ============================================================================== --- stable/9/share/man/man4/arcmsr.4 Tue Mar 5 00:52:14 2013 (r247826) +++ stable/9/share/man/man4/arcmsr.4 Tue Mar 5 06:41:39 2013 (r247827) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd December 18, 2012 +.Dd February 27, 2013 .Dt ARCMSR 4 .Os .Sh NAME @@ -108,6 +108,8 @@ ARC-1222 .It ARC-1223 .It +ARC-1224 +.It ARC-1230 .It ARC-1231 Modified: stable/9/sys/dev/arcmsr/arcmsr.c ============================================================================== --- stable/9/sys/dev/arcmsr/arcmsr.c Tue Mar 5 00:52:14 2013 (r247826) +++ stable/9/sys/dev/arcmsr/arcmsr.c Tue Mar 5 06:41:39 2013 (r247827) @@ -1,16 +1,15 @@ /* -***************************************************************************************** -** O.S : FreeBSD +******************************************************************************** +** OS : FreeBSD ** FILE NAME : arcmsr.c ** BY : Erich Chen, Ching Huang ** Description: SCSI RAID Device Driver for -** ARECA (ARC11XX/ARC12XX/ARC13XX/ARC16XX/ARC188x) SATA/SAS RAID HOST Adapter -** ARCMSR RAID Host adapter -** [RAID controller:INTEL 331(PCI-X) 341(PCI-EXPRESS) chip set] -****************************************************************************************** -************************************************************************ +** ARECA (ARC11XX/ARC12XX/ARC13XX/ARC16XX/ARC188x) +** SATA/SAS RAID HOST Adapter +******************************************************************************** +******************************************************************************** ** -** Copyright (C) 2002 - 2010, Areca Technology Corporation All rights reserved. +** Copyright (C) 2002 - 2012, Areca Technology Corporation All rights reserved. ** ** Redistribution and use in source and binary forms, with or without ** modification, are permitted provided that the following conditions @@ -33,7 +32,7 @@ ** 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. -************************************************************************** +******************************************************************************** ** History ** ** REV# DATE NAME DESCRIPTION @@ -73,7 +72,7 @@ ** 1.20.00.23 01/30/2012 Ching Huang Fixed Request requeued and Retrying command ** 1.20.00.24 06/11/2012 Ching Huang Fixed return sense data condition ** 1.20.00.25 08/17/2012 Ching Huang Fixed hotplug device no function on type A adapter -** 1.20.00.26 12/14/2012 Ching Huang Added support ARC1214 +** 1.20.00.26 12/14/2012 Ching Huang Added support ARC1214,1224 ****************************************************************************************** */ @@ -145,7 +144,7 @@ __FBSDID("$FreeBSD$"); #define arcmsr_callout_init(a) callout_init(a); #endif -#define ARCMSR_DRIVER_VERSION "Driver Version 1.20.00.26 2012-12-14" +#define ARCMSR_DRIVER_VERSION "Driver Version 1.20.00.26 2013-01-08" #include /* ************************************************************************** @@ -168,7 +167,7 @@ static void arcmsr_stop_adapter_bgrb(str static void arcmsr_start_adapter_bgrb(struct AdapterControlBlock *acb); static void arcmsr_iop_init(struct AdapterControlBlock *acb); static void arcmsr_flush_adapter_cache(struct AdapterControlBlock *acb); -static void arcmsr_Read_iop_rqbuffer_data(struct AdapterControlBlock *acb, struct QBUFFER *prbuffer); +static u_int32_t arcmsr_Read_iop_rqbuffer_data(struct AdapterControlBlock *acb, struct QBUFFER *prbuffer); static void arcmsr_Write_data_2iop_wqbuffer(struct AdapterControlBlock *acb); static void arcmsr_abort_allcmd(struct AdapterControlBlock *acb); static void arcmsr_srb_complete(struct CommandControlBlock *srb, int stand_flag); @@ -212,7 +211,11 @@ static device_method_t arcmsr_methods[]= DEVMETHOD(device_suspend, arcmsr_suspend), DEVMETHOD(device_resume, arcmsr_resume), +#if __FreeBSD_version >= 803000 DEVMETHOD_END +#else + { 0, 0 } +#endif }; static driver_t arcmsr_driver={ @@ -1381,13 +1384,61 @@ static void arcmsr_poll(struct cam_sim * ************************************************************************** ************************************************************************** */ -static void arcmsr_Read_iop_rqbuffer_data(struct AdapterControlBlock *acb, +static u_int32_t arcmsr_Read_iop_rqbuffer_data_D(struct AdapterControlBlock *acb, + struct QBUFFER *prbuffer) { + + u_int8_t *pQbuffer; + u_int8_t *buf1 = 0; + u_int32_t *iop_data, *buf2 = 0; + u_int32_t iop_len, data_len; + + iop_data = (u_int32_t *)prbuffer->data; + iop_len = (u_int32_t)prbuffer->data_len; + if ( iop_len > 0 ) + { + buf1 = malloc(128, M_DEVBUF, M_NOWAIT | M_ZERO); + buf2 = (u_int32_t *)buf1; + if( buf1 == NULL) + return (0); + data_len = iop_len; + while(data_len >= 4) + { + *buf2++ = *iop_data++; + data_len -= 4; + } + if(data_len) + *buf2 = *iop_data; + buf2 = (u_int32_t *)buf1; + } + while (iop_len > 0) { + pQbuffer = &acb->rqbuffer[acb->rqbuf_lastindex]; + *pQbuffer = *buf1; + acb->rqbuf_lastindex++; + /* if last, index number set it to 0 */ + acb->rqbuf_lastindex %= ARCMSR_MAX_QBUFFER; + buf1++; + iop_len--; + } + if(buf2) + free( (u_int8_t *)buf2, M_DEVBUF); + /* let IOP know data has been read */ + arcmsr_iop_message_read(acb); + return (1); +} +/* +************************************************************************** +************************************************************************** +*/ +static u_int32_t arcmsr_Read_iop_rqbuffer_data(struct AdapterControlBlock *acb, struct QBUFFER *prbuffer) { u_int8_t *pQbuffer; u_int8_t *iop_data; u_int32_t iop_len; + if(acb->adapter_type == ACB_ADAPTER_TYPE_D) { + return(arcmsr_Read_iop_rqbuffer_data_D(acb, prbuffer)); + } iop_data = (u_int8_t *)prbuffer->data; iop_len = (u_int32_t)prbuffer->data_len; while (iop_len > 0) { @@ -1401,6 +1452,7 @@ static void arcmsr_Read_iop_rqbuffer_dat } /* let IOP know data has been read */ arcmsr_iop_message_read(acb); + return (1); } /* ************************************************************************** @@ -1417,7 +1469,8 @@ static void arcmsr_iop2drv_data_wrote_ha my_empty_len = (acb->rqbuf_lastindex - acb->rqbuf_firstindex - 1) & (ARCMSR_MAX_QBUFFER-1); if(my_empty_len >= prbuffer->data_len) { - arcmsr_Read_iop_rqbuffer_data(acb, prbuffer); + if(arcmsr_Read_iop_rqbuffer_data(acb, prbuffer) == 0) + acb->acb_flags |= ACB_F_IOPDATA_OVERFLOW; } else { acb->acb_flags |= ACB_F_IOPDATA_OVERFLOW; } @@ -1427,6 +1480,50 @@ static void arcmsr_iop2drv_data_wrote_ha ********************************************************************** ********************************************************************** */ +static void arcmsr_Write_data_2iop_wqbuffer_D(struct AdapterControlBlock *acb) +{ + u_int8_t *pQbuffer; + struct QBUFFER *pwbuffer; + u_int8_t *buf1 = 0; + u_int32_t *iop_data, *buf2 = 0; + u_int32_t allxfer_len = 0, data_len; + + if(acb->acb_flags & ACB_F_MESSAGE_WQBUFFER_READ) { + buf1 = malloc(128, M_DEVBUF, M_NOWAIT | M_ZERO); + buf2 = (u_int32_t *)buf1; + if( buf1 == NULL) + return; + + acb->acb_flags &= (~ACB_F_MESSAGE_WQBUFFER_READ); + pwbuffer = arcmsr_get_iop_wqbuffer(acb); + iop_data = (u_int32_t *)pwbuffer->data; + while((acb->wqbuf_firstindex != acb->wqbuf_lastindex) + && (allxfer_len < 124)) { + pQbuffer = &acb->wqbuffer[acb->wqbuf_firstindex]; + *buf1 = *pQbuffer; + acb->wqbuf_firstindex++; + acb->wqbuf_firstindex %= ARCMSR_MAX_QBUFFER; + buf1++; + allxfer_len++; + } + pwbuffer->data_len = allxfer_len; + data_len = allxfer_len; + buf1 = (u_int8_t *)buf2; + while(data_len >= 4) + { + *iop_data++ = *buf2++; + data_len -= 4; + } + if(data_len) + *iop_data = *buf2; + free( buf1, M_DEVBUF); + arcmsr_iop_message_wrote(acb); + } +} +/* +********************************************************************** +********************************************************************** +*/ static void arcmsr_Write_data_2iop_wqbuffer(struct AdapterControlBlock *acb) { u_int8_t *pQbuffer; @@ -1434,6 +1531,10 @@ static void arcmsr_Write_data_2iop_wqbuf u_int8_t *iop_data; int32_t allxfer_len=0; + if(acb->adapter_type == ACB_ADAPTER_TYPE_D) { + arcmsr_Write_data_2iop_wqbuffer_D(acb); + return; + } if(acb->acb_flags & ACB_F_MESSAGE_WQBUFFER_READ) { acb->acb_flags &= (~ACB_F_MESSAGE_WQBUFFER_READ); pwbuffer = arcmsr_get_iop_wqbuffer(acb); @@ -2153,7 +2254,8 @@ u_int32_t arcmsr_iop_ioctlcmd(struct Ada acb->acb_flags &= ~ACB_F_IOPDATA_OVERFLOW; prbuffer = arcmsr_get_iop_rqbuffer(acb); - arcmsr_Read_iop_rqbuffer_data(acb, prbuffer); + if(arcmsr_Read_iop_rqbuffer_data(acb, prbuffer) == 0) + acb->acb_flags |= ACB_F_IOPDATA_OVERFLOW; } pcmdmessagefld->cmdmessage.Length = allxfer_len; pcmdmessagefld->cmdmessage.ReturnCode = ARCMSR_MESSAGE_RETURNCODE_OK; @@ -2374,7 +2476,8 @@ static int arcmsr_iop_message_xfer(struc acb->acb_flags &= ~ACB_F_IOPDATA_OVERFLOW; prbuffer = arcmsr_get_iop_rqbuffer(acb); - arcmsr_Read_iop_rqbuffer_data(acb, prbuffer); + if(arcmsr_Read_iop_rqbuffer_data(acb, prbuffer) == 0) + acb->acb_flags |= ACB_F_IOPDATA_OVERFLOW; } pcmdmessagefld->cmdmessage.Length = allxfer_len; pcmdmessagefld->cmdmessage.ReturnCode = ARCMSR_MESSAGE_RETURNCODE_OK; Modified: stable/9/sys/dev/arcmsr/arcmsr.h ============================================================================== --- stable/9/sys/dev/arcmsr/arcmsr.h Tue Mar 5 00:52:14 2013 (r247826) +++ stable/9/sys/dev/arcmsr/arcmsr.h Tue Mar 5 06:41:39 2013 (r247827) @@ -1,17 +1,14 @@ /* -*********************************************************************************************** -** O.S : FreeBSD +******************************************************************************** +** OS : FreeBSD ** FILE NAME : arcmsr.h ** BY : Erich Chen, Ching Huang ** Description: SCSI RAID Device Driver for -** ARECA SATA/SAS RAID HOST Adapter -** [RAID controller:INTEL 331(PCI-X) 341(PCI-EXPRESS) chip set] -*********************************************************************************************** -************************************************************************ -** Copyright (C) 2002 - 2010, Areca Technology Corporation All rights reserved. -** -** Web site: www.areca.com.tw -** E-mail: erich@areca.com.tw; ching2048@areca.com.tw +** ARECA (ARC11XX/ARC12XX/ARC13XX/ARC16XX/ARC188x) +** SATA/SAS RAID HOST Adapter +******************************************************************************** +******************************************************************************** +** Copyright (C) 2002 - 2012, Areca Technology Corporation All rights reserved. ** ** Redistribution and use in source and binary forms,with or without ** modification,are permitted provided that the following conditions From owner-svn-src-stable@FreeBSD.ORG Tue Mar 5 06:43:54 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 928AA88B; Tue, 5 Mar 2013 06:43:54 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 84AFD352; Tue, 5 Mar 2013 06:43:54 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r256hsEY065119; Tue, 5 Mar 2013 06:43:54 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r256hsKQ065118; Tue, 5 Mar 2013 06:43:54 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201303050643.r256hsKQ065118@svn.freebsd.org> From: Xin LI Date: Tue, 5 Mar 2013 06:43:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r247828 - in stable: 8/sys/dev/mfi 9/sys/dev/mfi X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Mar 2013 06:43:54 -0000 Author: delphij Date: Tue Mar 5 06:43:54 2013 New Revision: 247828 URL: http://svnweb.freebsd.org/changeset/base/247828 Log: MFC r247594: Fix a typo in mfi_stp_cmd() that would give wrong assignment. Submitted by: Sascha Wildner Obtained from: DragonFly rev 0dc98fff2206d7bb78ce5e07ac34d6954e4bd96a Modified: stable/9/sys/dev/mfi/mfi.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) Changes in other areas also in this revision: Modified: stable/8/sys/dev/mfi/mfi.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/dev/ (props changed) stable/8/sys/dev/mfi/ (props changed) Modified: stable/9/sys/dev/mfi/mfi.c ============================================================================== --- stable/9/sys/dev/mfi/mfi.c Tue Mar 5 06:41:39 2013 (r247827) +++ stable/9/sys/dev/mfi/mfi.c Tue Mar 5 06:43:54 2013 (r247828) @@ -2904,7 +2904,7 @@ mfi_stp_cmd(struct mfi_softc *sc, struct cm->cm_frame->stp.sgl.sg64[i].len = ioc->mfi_sgl[i].iov_len; } else { - cm->cm_frame->stp.sgl.sg32[i].len = + cm->cm_frame->stp.sgl.sg32[i].addr = kern_sge[i].phys_addr; cm->cm_frame->stp.sgl.sg32[i].len = ioc->mfi_sgl[i].iov_len; From owner-svn-src-stable@FreeBSD.ORG Tue Mar 5 06:43:54 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id E710588C; Tue, 5 Mar 2013 06:43:54 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id D9840353; Tue, 5 Mar 2013 06:43:54 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r256hsAd065125; Tue, 5 Mar 2013 06:43:54 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r256hsVF065124; Tue, 5 Mar 2013 06:43:54 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201303050643.r256hsVF065124@svn.freebsd.org> From: Xin LI Date: Tue, 5 Mar 2013 06:43:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r247828 - in stable: 8/sys/dev/mfi 9/sys/dev/mfi X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Mar 2013 06:43:55 -0000 Author: delphij Date: Tue Mar 5 06:43:54 2013 New Revision: 247828 URL: http://svnweb.freebsd.org/changeset/base/247828 Log: MFC r247594: Fix a typo in mfi_stp_cmd() that would give wrong assignment. Submitted by: Sascha Wildner Obtained from: DragonFly rev 0dc98fff2206d7bb78ce5e07ac34d6954e4bd96a Modified: stable/8/sys/dev/mfi/mfi.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/dev/ (props changed) stable/8/sys/dev/mfi/ (props changed) Changes in other areas also in this revision: Modified: stable/9/sys/dev/mfi/mfi.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) Modified: stable/8/sys/dev/mfi/mfi.c ============================================================================== --- stable/8/sys/dev/mfi/mfi.c Tue Mar 5 06:41:39 2013 (r247827) +++ stable/8/sys/dev/mfi/mfi.c Tue Mar 5 06:43:54 2013 (r247828) @@ -2904,7 +2904,7 @@ mfi_stp_cmd(struct mfi_softc *sc, struct cm->cm_frame->stp.sgl.sg64[i].len = ioc->mfi_sgl[i].iov_len; } else { - cm->cm_frame->stp.sgl.sg32[i].len = + cm->cm_frame->stp.sgl.sg32[i].addr = kern_sge[i].phys_addr; cm->cm_frame->stp.sgl.sg32[i].len = ioc->mfi_sgl[i].iov_len; From owner-svn-src-stable@FreeBSD.ORG Tue Mar 5 16:04:07 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id A9E4B993; Tue, 5 Mar 2013 16:04:07 +0000 (UTC) (envelope-from tijl@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 917F6AA8; Tue, 5 Mar 2013 16:04:07 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r25G47QJ035411; Tue, 5 Mar 2013 16:04:07 GMT (envelope-from tijl@svn.freebsd.org) Received: (from tijl@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r25G47Ad035410; Tue, 5 Mar 2013 16:04:07 GMT (envelope-from tijl@svn.freebsd.org) Message-Id: <201303051604.r25G47Ad035410@svn.freebsd.org> From: Tijl Coosemans Date: Tue, 5 Mar 2013 16:04:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r247846 - stable/9/libexec/rtld-elf X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Mar 2013 16:04:07 -0000 Author: tijl Date: Tue Mar 5 16:04:07 2013 New Revision: 247846 URL: http://svnweb.freebsd.org/changeset/base/247846 Log: MFC r247396: Map libraries linked with -Ttext-segment=base_addr at base_addr. Normal libraries have base address 0 and are unaffected by this change. PR: 176216 Submitted by: Damjan Jovanovic Reviewed by: kib Modified: stable/9/libexec/rtld-elf/map_object.c Directory Properties: stable/9/libexec/rtld-elf/ (props changed) Modified: stable/9/libexec/rtld-elf/map_object.c ============================================================================== --- stable/9/libexec/rtld-elf/map_object.c Tue Mar 5 15:35:57 2013 (r247845) +++ stable/9/libexec/rtld-elf/map_object.c Tue Mar 5 16:04:07 2013 (r247846) @@ -175,7 +175,7 @@ map_object(int fd, const char *path, con base_vaddr = trunc_page(segs[0]->p_vaddr); base_vlimit = round_page(segs[nsegs]->p_vaddr + segs[nsegs]->p_memsz); mapsize = base_vlimit - base_vaddr; - base_addr = hdr->e_type == ET_EXEC ? (caddr_t) base_vaddr : NULL; + base_addr = (caddr_t) base_vaddr; mapbase = mmap(base_addr, mapsize, PROT_NONE, MAP_ANON | MAP_PRIVATE | MAP_NOCORE, -1, 0); From owner-svn-src-stable@FreeBSD.ORG Tue Mar 5 16:04:15 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id DC5E6B75; Tue, 5 Mar 2013 16:04:15 +0000 (UTC) (envelope-from tijl@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id CF504AAA; Tue, 5 Mar 2013 16:04:15 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r25G4FiU035472; Tue, 5 Mar 2013 16:04:15 GMT (envelope-from tijl@svn.freebsd.org) Received: (from tijl@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r25G4FuS035471; Tue, 5 Mar 2013 16:04:15 GMT (envelope-from tijl@svn.freebsd.org) Message-Id: <201303051604.r25G4FuS035471@svn.freebsd.org> From: Tijl Coosemans Date: Tue, 5 Mar 2013 16:04:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r247847 - stable/8/libexec/rtld-elf X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Mar 2013 16:04:15 -0000 Author: tijl Date: Tue Mar 5 16:04:15 2013 New Revision: 247847 URL: http://svnweb.freebsd.org/changeset/base/247847 Log: MFC r247396: Map libraries linked with -Ttext-segment=base_addr at base_addr. Normal libraries have base address 0 and are unaffected by this change. PR: 176216 Submitted by: Damjan Jovanovic Reviewed by: kib Modified: stable/8/libexec/rtld-elf/map_object.c Directory Properties: stable/8/libexec/rtld-elf/ (props changed) Modified: stable/8/libexec/rtld-elf/map_object.c ============================================================================== --- stable/8/libexec/rtld-elf/map_object.c Tue Mar 5 16:04:07 2013 (r247846) +++ stable/8/libexec/rtld-elf/map_object.c Tue Mar 5 16:04:15 2013 (r247847) @@ -148,7 +148,7 @@ map_object(int fd, const char *path, con base_vaddr = trunc_page(segs[0]->p_vaddr); base_vlimit = round_page(segs[nsegs]->p_vaddr + segs[nsegs]->p_memsz); mapsize = base_vlimit - base_vaddr; - base_addr = hdr->e_type == ET_EXEC ? (caddr_t) base_vaddr : NULL; + base_addr = (caddr_t) base_vaddr; mapbase = mmap(base_addr, mapsize, PROT_NONE, MAP_ANON | MAP_PRIVATE | MAP_NOCORE, -1, 0); From owner-svn-src-stable@FreeBSD.ORG Tue Mar 5 16:37:20 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id B5B67C60; Tue, 5 Mar 2013 16:37:20 +0000 (UTC) (envelope-from gallatin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 990EEE42; Tue, 5 Mar 2013 16:37:20 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r25GbKep045409; Tue, 5 Mar 2013 16:37:20 GMT (envelope-from gallatin@svn.freebsd.org) Received: (from gallatin@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r25GbKmV045408; Tue, 5 Mar 2013 16:37:20 GMT (envelope-from gallatin@svn.freebsd.org) Message-Id: <201303051637.r25GbKmV045408@svn.freebsd.org> From: Andrew Gallatin Date: Tue, 5 Mar 2013 16:37:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r247850 - stable/9/sys/dev/mxge X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Mar 2013 16:37:20 -0000 Author: gallatin Date: Tue Mar 5 16:37:20 2013 New Revision: 247850 URL: http://svnweb.freebsd.org/changeset/base/247850 Log: MFC r247268: Several cleanups and fixes to mxge: - Remove vestigial null pointer tests after malloc(..., M_WAITOK). - Remove vestigal qualhack union - Use strlcpy() instead of the error-prone strncpy() when parsing EEPROM and copying strings - Check the MAC address in the EEPROM strings more strictly. - Expand the macro MXGE_NEXT_STRING() at its only user. Due to a typo, the macro was very confusing. - Remove unnecessary buffer limit check. The buffer is double-NUL terminated per construction. PR: kern/176369 Submitted by: Christoph Mallon Modified: stable/9/sys/dev/mxge/if_mxge.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) Modified: stable/9/sys/dev/mxge/if_mxge.c ============================================================================== --- stable/9/sys/dev/mxge/if_mxge.c Tue Mar 5 16:15:34 2013 (r247849) +++ stable/9/sys/dev/mxge/if_mxge.c Tue Mar 5 16:37:20 2013 (r247850) @@ -287,42 +287,43 @@ mxge_dma_free(mxge_dma_t *dma) static int mxge_parse_strings(mxge_softc_t *sc) { -#define MXGE_NEXT_STRING(p) while(ptr < limit && *ptr++) - - char *ptr, *limit; + char *ptr; int i, found_mac, found_sn2; + char *endptr; ptr = sc->eeprom_strings; - limit = sc->eeprom_strings + MXGE_EEPROM_STRINGS_SIZE; found_mac = 0; found_sn2 = 0; - while (ptr < limit && *ptr != '\0') { - if (memcmp(ptr, "MAC=", 4) == 0) { - ptr += 1; - sc->mac_addr_string = ptr; - for (i = 0; i < 6; i++) { - ptr += 3; - if ((ptr + 2) > limit) + while (*ptr != '\0') { + if (strncmp(ptr, "MAC=", 4) == 0) { + ptr += 4; + for (i = 0;;) { + sc->mac_addr[i] = strtoul(ptr, &endptr, 16); + if (endptr - ptr != 2) + goto abort; + ptr = endptr; + if (++i == 6) + break; + if (*ptr++ != ':') goto abort; - sc->mac_addr[i] = strtoul(ptr, NULL, 16); - found_mac = 1; } - } else if (memcmp(ptr, "PC=", 3) == 0) { + found_mac = 1; + } else if (strncmp(ptr, "PC=", 3) == 0) { ptr += 3; - strncpy(sc->product_code_string, ptr, - sizeof (sc->product_code_string) - 1); - } else if (!found_sn2 && (memcmp(ptr, "SN=", 3) == 0)) { + strlcpy(sc->product_code_string, ptr, + sizeof(sc->product_code_string)); + } else if (!found_sn2 && (strncmp(ptr, "SN=", 3) == 0)) { ptr += 3; - strncpy(sc->serial_number_string, ptr, - sizeof (sc->serial_number_string) - 1); - } else if (memcmp(ptr, "SN2=", 4) == 0) { + strlcpy(sc->serial_number_string, ptr, + sizeof(sc->serial_number_string)); + } else if (strncmp(ptr, "SN2=", 4) == 0) { /* SN2 takes precedence over SN */ ptr += 4; found_sn2 = 1; - strncpy(sc->serial_number_string, ptr, - sizeof (sc->serial_number_string) - 1); + strlcpy(sc->serial_number_string, ptr, + sizeof(sc->serial_number_string)); } - MXGE_NEXT_STRING(ptr); + while (*ptr++ != '\0') {} } if (found_mac) @@ -648,12 +649,6 @@ abort: return (mxge_load_firmware(sc, 0)); } -union qualhack -{ - const char *ro_char; - char *rw_char; -}; - static int mxge_validate_firmware(mxge_softc_t *sc, const mcp_gen_header_t *hdr) { @@ -666,7 +661,7 @@ mxge_validate_firmware(mxge_softc_t *sc, } /* save firmware version for sysctl */ - strncpy(sc->fw_version, hdr->version, sizeof (sc->fw_version)); + strlcpy(sc->fw_version, hdr->version, sizeof(sc->fw_version)); if (mxge_verbose) device_printf(sc->dev, "firmware id: %s\n", hdr->version); @@ -3324,8 +3319,6 @@ mxge_alloc_slice_rings(struct mxge_slice size_t bytes; int err, i; - err = ENOMEM; - /* allocate per-slice receive resources */ ss->rx_small.mask = ss->rx_big.mask = rx_ring_entries - 1; @@ -3334,24 +3327,16 @@ mxge_alloc_slice_rings(struct mxge_slice /* allocate the rx shadow rings */ bytes = rx_ring_entries * sizeof (*ss->rx_small.shadow); ss->rx_small.shadow = malloc(bytes, M_DEVBUF, M_ZERO|M_WAITOK); - if (ss->rx_small.shadow == NULL) - return err; bytes = rx_ring_entries * sizeof (*ss->rx_big.shadow); ss->rx_big.shadow = malloc(bytes, M_DEVBUF, M_ZERO|M_WAITOK); - if (ss->rx_big.shadow == NULL) - return err; /* allocate the rx host info rings */ bytes = rx_ring_entries * sizeof (*ss->rx_small.info); ss->rx_small.info = malloc(bytes, M_DEVBUF, M_ZERO|M_WAITOK); - if (ss->rx_small.info == NULL) - return err; bytes = rx_ring_entries * sizeof (*ss->rx_big.info); ss->rx_big.info = malloc(bytes, M_DEVBUF, M_ZERO|M_WAITOK); - if (ss->rx_big.info == NULL) - return err; /* allocate the rx busdma resources */ err = bus_dma_tag_create(sc->parent_dmat, /* parent */ @@ -3448,8 +3433,6 @@ mxge_alloc_slice_rings(struct mxge_slice bytes = 8 + sizeof (*ss->tx.req_list) * (ss->tx.max_desc + 4); ss->tx.req_bytes = malloc(bytes, M_DEVBUF, M_WAITOK); - if (ss->tx.req_bytes == NULL) - return err; /* ensure req_list entries are aligned to 8 bytes */ ss->tx.req_list = (mcp_kreq_ether_send_t *) ((unsigned long)(ss->tx.req_bytes + 7) & ~7UL); @@ -3458,14 +3441,10 @@ mxge_alloc_slice_rings(struct mxge_slice bytes = sizeof (*ss->tx.seg_list) * ss->tx.max_desc; ss->tx.seg_list = (bus_dma_segment_t *) malloc(bytes, M_DEVBUF, M_WAITOK); - if (ss->tx.seg_list == NULL) - return err; /* allocate the tx host info ring */ bytes = tx_ring_entries * sizeof (*ss->tx.info); ss->tx.info = malloc(bytes, M_DEVBUF, M_ZERO|M_WAITOK); - if (ss->tx.info == NULL) - return err; /* allocate the tx busdma resources */ err = bus_dma_tag_create(sc->parent_dmat, /* parent */ From owner-svn-src-stable@FreeBSD.ORG Tue Mar 5 17:46:13 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 4D122309; Tue, 5 Mar 2013 17:46:13 +0000 (UTC) (envelope-from gallatin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 0E5C521B; Tue, 5 Mar 2013 17:46:13 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r25HkCbN067357; Tue, 5 Mar 2013 17:46:12 GMT (envelope-from gallatin@svn.freebsd.org) Received: (from gallatin@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r25HkCL9067356; Tue, 5 Mar 2013 17:46:12 GMT (envelope-from gallatin@svn.freebsd.org) Message-Id: <201303051746.r25HkCL9067356@svn.freebsd.org> From: Andrew Gallatin Date: Tue, 5 Mar 2013 17:46:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r247851 - stable/8/sys/dev/mxge X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Mar 2013 17:46:13 -0000 Author: gallatin Date: Tue Mar 5 17:46:12 2013 New Revision: 247851 URL: http://svnweb.freebsd.org/changeset/base/247851 Log: MFC r247159 Improvements for newer mxge nics: - Some mxge nics may store the serial number in the SN2 field of the EEPROM. These will also have an SN=0 field, so parse the SN2 field, and give it precedence. - Skip MXGEFW_CMD_UNALIGNED_TEST on mxge nics which do not require it. This saves roughly 10ms per port at device attach time. Modified: stable/8/sys/dev/mxge/if_mxge.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/dev/ (props changed) stable/8/sys/dev/mxge/ (props changed) Modified: stable/8/sys/dev/mxge/if_mxge.c ============================================================================== --- stable/8/sys/dev/mxge/if_mxge.c Tue Mar 5 16:37:20 2013 (r247850) +++ stable/8/sys/dev/mxge/if_mxge.c Tue Mar 5 17:46:12 2013 (r247851) @@ -289,11 +289,12 @@ mxge_parse_strings(mxge_softc_t *sc) #define MXGE_NEXT_STRING(p) while(ptr < limit && *ptr++) char *ptr, *limit; - int i, found_mac; + int i, found_mac, found_sn2; ptr = sc->eeprom_strings; limit = sc->eeprom_strings + MXGE_EEPROM_STRINGS_SIZE; found_mac = 0; + found_sn2 = 0; while (ptr < limit && *ptr != '\0') { if (memcmp(ptr, "MAC=", 4) == 0) { ptr += 1; @@ -309,10 +310,16 @@ mxge_parse_strings(mxge_softc_t *sc) ptr += 3; strncpy(sc->product_code_string, ptr, sizeof (sc->product_code_string) - 1); - } else if (memcmp(ptr, "SN=", 3) == 0) { + } else if (!found_sn2 && (memcmp(ptr, "SN=", 3) == 0)) { ptr += 3; strncpy(sc->serial_number_string, ptr, sizeof (sc->serial_number_string) - 1); + } else if (memcmp(ptr, "SN2=", 4) == 0) { + /* SN2 takes precedence over SN */ + ptr += 4; + found_sn2 = 1; + strncpy(sc->serial_number_string, ptr, + sizeof (sc->serial_number_string) - 1); } MXGE_NEXT_STRING(ptr); } @@ -579,9 +586,10 @@ mxge_firmware_probe(mxge_softc_t *sc) /* * Run a DMA test which watches for unaligned completions and - * aborts on the first one seen. + * aborts on the first one seen. Not required on Z8ES or newer. */ - + if (pci_get_revid(sc->dev) >= MXGE_PCI_REV_Z8ES) + return 0; status = mxge_dma_test(sc, MXGEFW_CMD_UNALIGNED_TEST); if (status == 0) return 0; /* keep the aligned firmware */ From owner-svn-src-stable@FreeBSD.ORG Tue Mar 5 19:20:35 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 6CC2A8B0; Tue, 5 Mar 2013 19:20:35 +0000 (UTC) (envelope-from gallatin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 4FE3E86F; Tue, 5 Mar 2013 19:20:35 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r25JKYMN095716; Tue, 5 Mar 2013 19:20:34 GMT (envelope-from gallatin@svn.freebsd.org) Received: (from gallatin@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r25JKYma095715; Tue, 5 Mar 2013 19:20:34 GMT (envelope-from gallatin@svn.freebsd.org) Message-Id: <201303051920.r25JKYma095715@svn.freebsd.org> From: Andrew Gallatin Date: Tue, 5 Mar 2013 19:20:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r247853 - stable/8/sys/dev/mxge X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Mar 2013 19:20:35 -0000 Author: gallatin Date: Tue Mar 5 19:20:34 2013 New Revision: 247853 URL: http://svnweb.freebsd.org/changeset/base/247853 Log: MFC r247268: Several cleanups and fixes to mxge: - Remove vestigial null pointer tests after malloc(..., M_WAITOK). - Remove vestigal qualhack union - Use strlcpy() instead of the error-prone strncpy() when parsing EEPROM and copying strings - Check the MAC address in the EEPROM strings more strictly. - Expand the macro MXGE_NEXT_STRING() at its only user. Due to a typo, the macro was very confusing. - Remove unnecessary buffer limit check. The buffer is double-NUL terminated per construction. PR: kern/176369 Submitted by: Christoph Mallon Modified: stable/8/sys/dev/mxge/if_mxge.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/dev/ (props changed) stable/8/sys/dev/mxge/ (props changed) Modified: stable/8/sys/dev/mxge/if_mxge.c ============================================================================== --- stable/8/sys/dev/mxge/if_mxge.c Tue Mar 5 18:54:41 2013 (r247852) +++ stable/8/sys/dev/mxge/if_mxge.c Tue Mar 5 19:20:34 2013 (r247853) @@ -286,42 +286,43 @@ mxge_dma_free(mxge_dma_t *dma) static int mxge_parse_strings(mxge_softc_t *sc) { -#define MXGE_NEXT_STRING(p) while(ptr < limit && *ptr++) - - char *ptr, *limit; + char *ptr; int i, found_mac, found_sn2; + char *endptr; ptr = sc->eeprom_strings; - limit = sc->eeprom_strings + MXGE_EEPROM_STRINGS_SIZE; found_mac = 0; found_sn2 = 0; - while (ptr < limit && *ptr != '\0') { - if (memcmp(ptr, "MAC=", 4) == 0) { - ptr += 1; - sc->mac_addr_string = ptr; - for (i = 0; i < 6; i++) { - ptr += 3; - if ((ptr + 2) > limit) + while (*ptr != '\0') { + if (strncmp(ptr, "MAC=", 4) == 0) { + ptr += 4; + for (i = 0;;) { + sc->mac_addr[i] = strtoul(ptr, &endptr, 16); + if (endptr - ptr != 2) + goto abort; + ptr = endptr; + if (++i == 6) + break; + if (*ptr++ != ':') goto abort; - sc->mac_addr[i] = strtoul(ptr, NULL, 16); - found_mac = 1; } - } else if (memcmp(ptr, "PC=", 3) == 0) { + found_mac = 1; + } else if (strncmp(ptr, "PC=", 3) == 0) { ptr += 3; - strncpy(sc->product_code_string, ptr, - sizeof (sc->product_code_string) - 1); - } else if (!found_sn2 && (memcmp(ptr, "SN=", 3) == 0)) { + strlcpy(sc->product_code_string, ptr, + sizeof(sc->product_code_string)); + } else if (!found_sn2 && (strncmp(ptr, "SN=", 3) == 0)) { ptr += 3; - strncpy(sc->serial_number_string, ptr, - sizeof (sc->serial_number_string) - 1); - } else if (memcmp(ptr, "SN2=", 4) == 0) { + strlcpy(sc->serial_number_string, ptr, + sizeof(sc->serial_number_string)); + } else if (strncmp(ptr, "SN2=", 4) == 0) { /* SN2 takes precedence over SN */ ptr += 4; found_sn2 = 1; - strncpy(sc->serial_number_string, ptr, - sizeof (sc->serial_number_string) - 1); + strlcpy(sc->serial_number_string, ptr, + sizeof(sc->serial_number_string)); } - MXGE_NEXT_STRING(ptr); + while (*ptr++ != '\0') {} } if (found_mac) @@ -647,12 +648,6 @@ abort: return (mxge_load_firmware(sc, 0)); } -union qualhack -{ - const char *ro_char; - char *rw_char; -}; - static int mxge_validate_firmware(mxge_softc_t *sc, const mcp_gen_header_t *hdr) { @@ -665,7 +660,7 @@ mxge_validate_firmware(mxge_softc_t *sc, } /* save firmware version for sysctl */ - strncpy(sc->fw_version, hdr->version, sizeof (sc->fw_version)); + strlcpy(sc->fw_version, hdr->version, sizeof(sc->fw_version)); if (mxge_verbose) device_printf(sc->dev, "firmware id: %s\n", hdr->version); @@ -3212,8 +3207,6 @@ mxge_alloc_slice_rings(struct mxge_slice size_t bytes; int err, i; - err = ENOMEM; - /* allocate per-slice receive resources */ ss->rx_small.mask = ss->rx_big.mask = rx_ring_entries - 1; @@ -3222,24 +3215,16 @@ mxge_alloc_slice_rings(struct mxge_slice /* allocate the rx shadow rings */ bytes = rx_ring_entries * sizeof (*ss->rx_small.shadow); ss->rx_small.shadow = malloc(bytes, M_DEVBUF, M_ZERO|M_WAITOK); - if (ss->rx_small.shadow == NULL) - return err; bytes = rx_ring_entries * sizeof (*ss->rx_big.shadow); ss->rx_big.shadow = malloc(bytes, M_DEVBUF, M_ZERO|M_WAITOK); - if (ss->rx_big.shadow == NULL) - return err; /* allocate the rx host info rings */ bytes = rx_ring_entries * sizeof (*ss->rx_small.info); ss->rx_small.info = malloc(bytes, M_DEVBUF, M_ZERO|M_WAITOK); - if (ss->rx_small.info == NULL) - return err; bytes = rx_ring_entries * sizeof (*ss->rx_big.info); ss->rx_big.info = malloc(bytes, M_DEVBUF, M_ZERO|M_WAITOK); - if (ss->rx_big.info == NULL) - return err; /* allocate the rx busdma resources */ err = bus_dma_tag_create(sc->parent_dmat, /* parent */ @@ -3336,8 +3321,6 @@ mxge_alloc_slice_rings(struct mxge_slice bytes = 8 + sizeof (*ss->tx.req_list) * (ss->tx.max_desc + 4); ss->tx.req_bytes = malloc(bytes, M_DEVBUF, M_WAITOK); - if (ss->tx.req_bytes == NULL) - return err; /* ensure req_list entries are aligned to 8 bytes */ ss->tx.req_list = (mcp_kreq_ether_send_t *) ((unsigned long)(ss->tx.req_bytes + 7) & ~7UL); @@ -3346,14 +3329,10 @@ mxge_alloc_slice_rings(struct mxge_slice bytes = sizeof (*ss->tx.seg_list) * ss->tx.max_desc; ss->tx.seg_list = (bus_dma_segment_t *) malloc(bytes, M_DEVBUF, M_WAITOK); - if (ss->tx.seg_list == NULL) - return err; /* allocate the tx host info ring */ bytes = tx_ring_entries * sizeof (*ss->tx.info); ss->tx.info = malloc(bytes, M_DEVBUF, M_ZERO|M_WAITOK); - if (ss->tx.info == NULL) - return err; /* allocate the tx busdma resources */ err = bus_dma_tag_create(sc->parent_dmat, /* parent */ From owner-svn-src-stable@FreeBSD.ORG Wed Mar 6 06:57:19 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 8C5AC157; Wed, 6 Mar 2013 06:57:19 +0000 (UTC) (envelope-from trociny@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 6466165C; Wed, 6 Mar 2013 06:57:19 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r266vJpm008749; Wed, 6 Mar 2013 06:57:19 GMT (envelope-from trociny@svn.freebsd.org) Received: (from trociny@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r266vIdk008745; Wed, 6 Mar 2013 06:57:18 GMT (envelope-from trociny@svn.freebsd.org) Message-Id: <201303060657.r266vIdk008745@svn.freebsd.org> From: Mikolaj Golub Date: Wed, 6 Mar 2013 06:57:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r247866 - stable/9/sbin/hastd X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Mar 2013 06:57:19 -0000 Author: trociny Date: Wed Mar 6 06:57:18 2013 New Revision: 247866 URL: http://svnweb.freebsd.org/changeset/base/247866 Log: MFC r247281: Add i/o error counters to hastd(8) and make hastctl(8) display them. This may be useful for detecting problems with HAST disks. Discussed with and reviewed by: pjd Modified: stable/9/sbin/hastd/control.c stable/9/sbin/hastd/hast.h stable/9/sbin/hastd/primary.c stable/9/sbin/hastd/secondary.c Directory Properties: stable/9/sbin/hastd/ (props changed) Modified: stable/9/sbin/hastd/control.c ============================================================================== --- stable/9/sbin/hastd/control.c Wed Mar 6 06:24:09 2013 (r247865) +++ stable/9/sbin/hastd/control.c Wed Mar 6 06:57:18 2013 (r247866) @@ -207,6 +207,14 @@ control_status_worker(struct hast_resour "stat_flush%u", no); nv_add_uint64(nvout, nv_get_uint64(cnvin, "stat_activemap_update"), "stat_activemap_update%u", no); + nv_add_uint64(nvout, nv_get_uint64(cnvin, "stat_read_error"), + "stat_read_error%u", no); + nv_add_uint64(nvout, nv_get_uint64(cnvin, "stat_write_error"), + "stat_write_error%u", no); + nv_add_uint64(nvout, nv_get_uint64(cnvin, "stat_delete_error"), + "stat_delete_error%u", no); + nv_add_uint64(nvout, nv_get_uint64(cnvin, "stat_flush_error"), + "stat_flush_error%u", no); end: if (cnvin != NULL) nv_free(cnvin); @@ -459,6 +467,16 @@ ctrl_thread(void *arg) nv_add_uint64(nvout, res->hr_stat_flush, "stat_flush"); nv_add_uint64(nvout, res->hr_stat_activemap_update, "stat_activemap_update"); + nv_add_uint64(nvout, res->hr_stat_read_error, + "stat_read_error"); + nv_add_uint64(nvout, res->hr_stat_write_error + + res->hr_stat_activemap_write_error, + "stat_write_error"); + nv_add_uint64(nvout, res->hr_stat_delete_error, + "stat_delete_error"); + nv_add_uint64(nvout, res->hr_stat_flush_error + + res->hr_stat_activemap_flush_error, + "stat_flush_error"); nv_add_int16(nvout, 0, "error"); break; case CONTROL_RELOAD: Modified: stable/9/sbin/hastd/hast.h ============================================================================== --- stable/9/sbin/hastd/hast.h Wed Mar 6 06:24:09 2013 (r247865) +++ stable/9/sbin/hastd/hast.h Wed Mar 6 06:57:18 2013 (r247866) @@ -234,6 +234,18 @@ struct hast_resource { uint64_t hr_stat_flush; /* Number of activemap updates. */ uint64_t hr_stat_activemap_update; + /* Number of local read errors. */ + uint64_t hr_stat_read_error; + /* Number of local write errors. */ + uint64_t hr_stat_write_error; + /* Number of local delete errors. */ + uint64_t hr_stat_delete_error; + /* Number of flush errors. */ + uint64_t hr_stat_flush_error; + /* Number of activemap write errors. */ + uint64_t hr_stat_activemap_write_error; + /* Number of activemap flush errors. */ + uint64_t hr_stat_activemap_flush_error; /* Next resource. */ TAILQ_ENTRY(hast_resource) hr_next; Modified: stable/9/sbin/hastd/primary.c ============================================================================== --- stable/9/sbin/hastd/primary.c Wed Mar 6 06:24:09 2013 (r247865) +++ stable/9/sbin/hastd/primary.c Wed Mar 6 06:57:18 2013 (r247866) @@ -303,6 +303,7 @@ hast_activemap_flush(struct hast_resourc if (pwrite(res->hr_localfd, buf, size, METADATA_SIZE) != (ssize_t)size) { pjdlog_errno(LOG_ERR, "Unable to flush activemap to disk"); + res->hr_stat_activemap_write_error++; return (-1); } if (res->hr_metaflush == 1 && g_flush(res->hr_localfd) == -1) { @@ -313,6 +314,7 @@ hast_activemap_flush(struct hast_resourc } else { pjdlog_errno(LOG_ERR, "Unable to flush disk cache on activemap update"); + res->hr_stat_activemap_flush_error++; return (-1); } } @@ -1792,6 +1794,22 @@ ggate_send_thread(void *arg) "G_GATE_CMD_DONE failed"); } } + if (hio->hio_errors[0]) { + switch (ggio->gctl_cmd) { + case BIO_READ: + res->hr_stat_read_error++; + break; + case BIO_WRITE: + res->hr_stat_write_error++; + break; + case BIO_DELETE: + res->hr_stat_delete_error++; + break; + case BIO_FLUSH: + res->hr_stat_flush_error++; + break; + } + } pjdlog_debug(2, "ggate_send: (%p) Moving request to the free queue.", hio); QUEUE_INSERT2(hio, free); Modified: stable/9/sbin/hastd/secondary.c ============================================================================== --- stable/9/sbin/hastd/secondary.c Wed Mar 6 06:24:09 2013 (r247865) +++ stable/9/sbin/hastd/secondary.c Wed Mar 6 06:57:18 2013 (r247866) @@ -725,6 +725,7 @@ disk_thread(void *arg) pjdlog_errno(LOG_WARNING, "Unable to store cleared activemap"); free(map); + res->hr_stat_activemap_write_error++; break; } free(map); @@ -839,8 +840,23 @@ send_thread(void *arg) PJDLOG_ABORT("Unexpected command (cmd=%hhu).", hio->hio_cmd); } - if (hio->hio_error != 0) + if (hio->hio_error != 0) { + switch (hio->hio_cmd) { + case HIO_READ: + res->hr_stat_read_error++; + break; + case HIO_WRITE: + res->hr_stat_write_error++; + break; + case HIO_DELETE: + res->hr_stat_delete_error++; + break; + case HIO_FLUSH: + res->hr_stat_flush_error++; + break; + } nv_add_int16(nvout, hio->hio_error, "error"); + } if (hast_proto_send(res, res->hr_remoteout, nvout, data, length) == -1) { secondary_exit(EX_TEMPFAIL, "Unable to send reply"); From owner-svn-src-stable@FreeBSD.ORG Wed Mar 6 06:58:12 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 0BD082C7; Wed, 6 Mar 2013 06:58:12 +0000 (UTC) (envelope-from trociny@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id C17B0666; Wed, 6 Mar 2013 06:58:11 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r266wB3e008901; Wed, 6 Mar 2013 06:58:11 GMT (envelope-from trociny@svn.freebsd.org) Received: (from trociny@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r266wB2k008900; Wed, 6 Mar 2013 06:58:11 GMT (envelope-from trociny@svn.freebsd.org) Message-Id: <201303060658.r266wB2k008900@svn.freebsd.org> From: Mikolaj Golub Date: Wed, 6 Mar 2013 06:58:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r247867 - stable/9/sbin/hastctl X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Mar 2013 06:58:12 -0000 Author: trociny Date: Wed Mar 6 06:58:11 2013 New Revision: 247867 URL: http://svnweb.freebsd.org/changeset/base/247867 Log: MFC r247281, r247345: r247281: Add i/o error counters to hastd(8) and make hastctl(8) display them. This may be useful for detecting problems with HAST disks. Discussed with and reviewed by: pjd r247345: Fix casting. Modified: stable/9/sbin/hastctl/hastctl.c Directory Properties: stable/9/sbin/hastctl/ (props changed) Modified: stable/9/sbin/hastctl/hastctl.c ============================================================================== --- stable/9/sbin/hastctl/hastctl.c Wed Mar 6 06:57:18 2013 (r247866) +++ stable/9/sbin/hastctl/hastctl.c Wed Mar 6 06:58:11 2013 (r247867) @@ -342,15 +342,21 @@ control_status(struct nv *nv) (intmax_t)nv_get_uint64(nv, "dirty%u", ii)); printf(" statistics:\n"); printf(" reads: %ju\n", - (uint64_t)nv_get_uint64(nv, "stat_read%u", ii)); + (uintmax_t)nv_get_uint64(nv, "stat_read%u", ii)); printf(" writes: %ju\n", - (uint64_t)nv_get_uint64(nv, "stat_write%u", ii)); + (uintmax_t)nv_get_uint64(nv, "stat_write%u", ii)); printf(" deletes: %ju\n", - (uint64_t)nv_get_uint64(nv, "stat_delete%u", ii)); + (uintmax_t)nv_get_uint64(nv, "stat_delete%u", ii)); printf(" flushes: %ju\n", - (uint64_t)nv_get_uint64(nv, "stat_flush%u", ii)); + (uintmax_t)nv_get_uint64(nv, "stat_flush%u", ii)); printf(" activemap updates: %ju\n", - (uint64_t)nv_get_uint64(nv, "stat_activemap_update%u", ii)); + (uintmax_t)nv_get_uint64(nv, "stat_activemap_update%u", ii)); + printf(" local errors: " + "read: %ju, write: %ju, delete: %ju, flush: %ju\n", + (uintmax_t)nv_get_uint64(nv, "stat_read_error%u", ii), + (uintmax_t)nv_get_uint64(nv, "stat_write_error%u", ii), + (uintmax_t)nv_get_uint64(nv, "stat_delete_error%u", ii), + (uintmax_t)nv_get_uint64(nv, "stat_flush_error%u", ii)); } return (ret); } From owner-svn-src-stable@FreeBSD.ORG Wed Mar 6 06:59:12 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 2ADE543E; Wed, 6 Mar 2013 06:59:12 +0000 (UTC) (envelope-from trociny@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 0F16E67E; Wed, 6 Mar 2013 06:59:12 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r266xBG5009064; Wed, 6 Mar 2013 06:59:11 GMT (envelope-from trociny@svn.freebsd.org) Received: (from trociny@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r266xBva009060; Wed, 6 Mar 2013 06:59:11 GMT (envelope-from trociny@svn.freebsd.org) Message-Id: <201303060659.r266xBva009060@svn.freebsd.org> From: Mikolaj Golub Date: Wed, 6 Mar 2013 06:59:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r247868 - stable/8/sbin/hastd X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Mar 2013 06:59:12 -0000 Author: trociny Date: Wed Mar 6 06:59:10 2013 New Revision: 247868 URL: http://svnweb.freebsd.org/changeset/base/247868 Log: MFC r247281: Add i/o error counters to hastd(8) and make hastctl(8) display them. This may be useful for detecting problems with HAST disks. Discussed with and reviewed by: pjd Modified: stable/8/sbin/hastd/control.c stable/8/sbin/hastd/hast.h stable/8/sbin/hastd/primary.c stable/8/sbin/hastd/secondary.c Directory Properties: stable/8/sbin/hastd/ (props changed) Modified: stable/8/sbin/hastd/control.c ============================================================================== --- stable/8/sbin/hastd/control.c Wed Mar 6 06:58:11 2013 (r247867) +++ stable/8/sbin/hastd/control.c Wed Mar 6 06:59:10 2013 (r247868) @@ -207,6 +207,14 @@ control_status_worker(struct hast_resour "stat_flush%u", no); nv_add_uint64(nvout, nv_get_uint64(cnvin, "stat_activemap_update"), "stat_activemap_update%u", no); + nv_add_uint64(nvout, nv_get_uint64(cnvin, "stat_read_error"), + "stat_read_error%u", no); + nv_add_uint64(nvout, nv_get_uint64(cnvin, "stat_write_error"), + "stat_write_error%u", no); + nv_add_uint64(nvout, nv_get_uint64(cnvin, "stat_delete_error"), + "stat_delete_error%u", no); + nv_add_uint64(nvout, nv_get_uint64(cnvin, "stat_flush_error"), + "stat_flush_error%u", no); end: if (cnvin != NULL) nv_free(cnvin); @@ -459,6 +467,16 @@ ctrl_thread(void *arg) nv_add_uint64(nvout, res->hr_stat_flush, "stat_flush"); nv_add_uint64(nvout, res->hr_stat_activemap_update, "stat_activemap_update"); + nv_add_uint64(nvout, res->hr_stat_read_error, + "stat_read_error"); + nv_add_uint64(nvout, res->hr_stat_write_error + + res->hr_stat_activemap_write_error, + "stat_write_error"); + nv_add_uint64(nvout, res->hr_stat_delete_error, + "stat_delete_error"); + nv_add_uint64(nvout, res->hr_stat_flush_error + + res->hr_stat_activemap_flush_error, + "stat_flush_error"); nv_add_int16(nvout, 0, "error"); break; case CONTROL_RELOAD: Modified: stable/8/sbin/hastd/hast.h ============================================================================== --- stable/8/sbin/hastd/hast.h Wed Mar 6 06:58:11 2013 (r247867) +++ stable/8/sbin/hastd/hast.h Wed Mar 6 06:59:10 2013 (r247868) @@ -234,6 +234,18 @@ struct hast_resource { uint64_t hr_stat_flush; /* Number of activemap updates. */ uint64_t hr_stat_activemap_update; + /* Number of local read errors. */ + uint64_t hr_stat_read_error; + /* Number of local write errors. */ + uint64_t hr_stat_write_error; + /* Number of local delete errors. */ + uint64_t hr_stat_delete_error; + /* Number of flush errors. */ + uint64_t hr_stat_flush_error; + /* Number of activemap write errors. */ + uint64_t hr_stat_activemap_write_error; + /* Number of activemap flush errors. */ + uint64_t hr_stat_activemap_flush_error; /* Next resource. */ TAILQ_ENTRY(hast_resource) hr_next; Modified: stable/8/sbin/hastd/primary.c ============================================================================== --- stable/8/sbin/hastd/primary.c Wed Mar 6 06:58:11 2013 (r247867) +++ stable/8/sbin/hastd/primary.c Wed Mar 6 06:59:10 2013 (r247868) @@ -303,6 +303,7 @@ hast_activemap_flush(struct hast_resourc if (pwrite(res->hr_localfd, buf, size, METADATA_SIZE) != (ssize_t)size) { pjdlog_errno(LOG_ERR, "Unable to flush activemap to disk"); + res->hr_stat_activemap_write_error++; return (-1); } if (res->hr_metaflush == 1 && g_flush(res->hr_localfd) == -1) { @@ -313,6 +314,7 @@ hast_activemap_flush(struct hast_resourc } else { pjdlog_errno(LOG_ERR, "Unable to flush disk cache on activemap update"); + res->hr_stat_activemap_flush_error++; return (-1); } } @@ -1792,6 +1794,22 @@ ggate_send_thread(void *arg) "G_GATE_CMD_DONE failed"); } } + if (hio->hio_errors[0]) { + switch (ggio->gctl_cmd) { + case BIO_READ: + res->hr_stat_read_error++; + break; + case BIO_WRITE: + res->hr_stat_write_error++; + break; + case BIO_DELETE: + res->hr_stat_delete_error++; + break; + case BIO_FLUSH: + res->hr_stat_flush_error++; + break; + } + } pjdlog_debug(2, "ggate_send: (%p) Moving request to the free queue.", hio); QUEUE_INSERT2(hio, free); Modified: stable/8/sbin/hastd/secondary.c ============================================================================== --- stable/8/sbin/hastd/secondary.c Wed Mar 6 06:58:11 2013 (r247867) +++ stable/8/sbin/hastd/secondary.c Wed Mar 6 06:59:10 2013 (r247868) @@ -725,6 +725,7 @@ disk_thread(void *arg) pjdlog_errno(LOG_WARNING, "Unable to store cleared activemap"); free(map); + res->hr_stat_activemap_write_error++; break; } free(map); @@ -839,8 +840,23 @@ send_thread(void *arg) PJDLOG_ABORT("Unexpected command (cmd=%hhu).", hio->hio_cmd); } - if (hio->hio_error != 0) + if (hio->hio_error != 0) { + switch (hio->hio_cmd) { + case HIO_READ: + res->hr_stat_read_error++; + break; + case HIO_WRITE: + res->hr_stat_write_error++; + break; + case HIO_DELETE: + res->hr_stat_delete_error++; + break; + case HIO_FLUSH: + res->hr_stat_flush_error++; + break; + } nv_add_int16(nvout, hio->hio_error, "error"); + } if (hast_proto_send(res, res->hr_remoteout, nvout, data, length) == -1) { secondary_exit(EX_TEMPFAIL, "Unable to send reply"); From owner-svn-src-stable@FreeBSD.ORG Wed Mar 6 06:59:43 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 74A2A5A6; Wed, 6 Mar 2013 06:59:43 +0000 (UTC) (envelope-from trociny@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 4D377685; Wed, 6 Mar 2013 06:59:43 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r266xh8n009162; Wed, 6 Mar 2013 06:59:43 GMT (envelope-from trociny@svn.freebsd.org) Received: (from trociny@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r266xhiC009161; Wed, 6 Mar 2013 06:59:43 GMT (envelope-from trociny@svn.freebsd.org) Message-Id: <201303060659.r266xhiC009161@svn.freebsd.org> From: Mikolaj Golub Date: Wed, 6 Mar 2013 06:59:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r247869 - stable/8/sbin/hastctl X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Mar 2013 06:59:43 -0000 Author: trociny Date: Wed Mar 6 06:59:42 2013 New Revision: 247869 URL: http://svnweb.freebsd.org/changeset/base/247869 Log: MFC r247281, r247345: r247281: Add i/o error counters to hastd(8) and make hastctl(8) display them. This may be useful for detecting problems with HAST disks. Discussed with and reviewed by: pjd r247345: Fix casting. Modified: stable/8/sbin/hastctl/hastctl.c Directory Properties: stable/8/sbin/hastctl/ (props changed) Modified: stable/8/sbin/hastctl/hastctl.c ============================================================================== --- stable/8/sbin/hastctl/hastctl.c Wed Mar 6 06:59:10 2013 (r247868) +++ stable/8/sbin/hastctl/hastctl.c Wed Mar 6 06:59:42 2013 (r247869) @@ -342,15 +342,21 @@ control_status(struct nv *nv) (intmax_t)nv_get_uint64(nv, "dirty%u", ii)); printf(" statistics:\n"); printf(" reads: %ju\n", - (uint64_t)nv_get_uint64(nv, "stat_read%u", ii)); + (uintmax_t)nv_get_uint64(nv, "stat_read%u", ii)); printf(" writes: %ju\n", - (uint64_t)nv_get_uint64(nv, "stat_write%u", ii)); + (uintmax_t)nv_get_uint64(nv, "stat_write%u", ii)); printf(" deletes: %ju\n", - (uint64_t)nv_get_uint64(nv, "stat_delete%u", ii)); + (uintmax_t)nv_get_uint64(nv, "stat_delete%u", ii)); printf(" flushes: %ju\n", - (uint64_t)nv_get_uint64(nv, "stat_flush%u", ii)); + (uintmax_t)nv_get_uint64(nv, "stat_flush%u", ii)); printf(" activemap updates: %ju\n", - (uint64_t)nv_get_uint64(nv, "stat_activemap_update%u", ii)); + (uintmax_t)nv_get_uint64(nv, "stat_activemap_update%u", ii)); + printf(" local errors: " + "read: %ju, write: %ju, delete: %ju, flush: %ju\n", + (uintmax_t)nv_get_uint64(nv, "stat_read_error%u", ii), + (uintmax_t)nv_get_uint64(nv, "stat_write_error%u", ii), + (uintmax_t)nv_get_uint64(nv, "stat_delete_error%u", ii), + (uintmax_t)nv_get_uint64(nv, "stat_flush_error%u", ii)); } return (ret); } From owner-svn-src-stable@FreeBSD.ORG Wed Mar 6 08:03:27 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 51F47545; Wed, 6 Mar 2013 08:03:27 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 445E48D8; Wed, 6 Mar 2013 08:03:27 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2683R3F029661; Wed, 6 Mar 2013 08:03:27 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2683RC0029658; Wed, 6 Mar 2013 08:03:27 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201303060803.r2683RC0029658@svn.freebsd.org> From: Pyun YongHyeon Date: Wed, 6 Mar 2013 08:03:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r247872 - stable/9/sys/dev/msk X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Mar 2013 08:03:27 -0000 Author: yongari Date: Wed Mar 6 08:03:26 2013 New Revision: 247872 URL: http://svnweb.freebsd.org/changeset/base/247872 Log: MFC r247382: RX checksum offloading on old Yukon controllers seem to cause more problems. Disable RX checksum offloading on controllers that don't use new descriptor format but give chance to enable it with ifconfig(8). Modified: stable/9/sys/dev/msk/if_msk.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) Modified: stable/9/sys/dev/msk/if_msk.c ============================================================================== --- stable/9/sys/dev/msk/if_msk.c Wed Mar 6 07:28:20 2013 (r247871) +++ stable/9/sys/dev/msk/if_msk.c Wed Mar 6 08:03:26 2013 (r247872) @@ -1696,6 +1696,12 @@ msk_attach(device_t dev) ifp->if_capabilities |= IFCAP_VLAN_HWCSUM; } ifp->if_capenable = ifp->if_capabilities; + /* + * Disable RX checksum offloading on controllers that don't use + * new descriptor format but give chance to enable it. + */ + if ((sc_if->msk_flags & MSK_FLAG_DESCV2) == 0) + ifp->if_capenable &= ~IFCAP_RXCSUM; /* * Tell the upper layer(s) we support long frames. From owner-svn-src-stable@FreeBSD.ORG Wed Mar 6 08:04:45 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 1A80C6BE; Wed, 6 Mar 2013 08:04:45 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 0874C8E7; Wed, 6 Mar 2013 08:04:45 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2684iQV029932; Wed, 6 Mar 2013 08:04:44 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2684ill029930; Wed, 6 Mar 2013 08:04:44 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201303060804.r2684ill029930@svn.freebsd.org> From: Pyun YongHyeon Date: Wed, 6 Mar 2013 08:04:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r247873 - stable/8/sys/dev/msk X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Mar 2013 08:04:45 -0000 Author: yongari Date: Wed Mar 6 08:04:44 2013 New Revision: 247873 URL: http://svnweb.freebsd.org/changeset/base/247873 Log: MFC r247382: RX checksum offloading on old Yukon controllers seem to cause more problems. Disable RX checksum offloading on controllers that don't use new descriptor format but give chance to enable it with ifconfig(8). Modified: stable/8/sys/dev/msk/if_msk.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/dev/ (props changed) stable/8/sys/dev/msk/ (props changed) Modified: stable/8/sys/dev/msk/if_msk.c ============================================================================== --- stable/8/sys/dev/msk/if_msk.c Wed Mar 6 08:03:26 2013 (r247872) +++ stable/8/sys/dev/msk/if_msk.c Wed Mar 6 08:04:44 2013 (r247873) @@ -1696,6 +1696,12 @@ msk_attach(device_t dev) ifp->if_capabilities |= IFCAP_VLAN_HWCSUM; } ifp->if_capenable = ifp->if_capabilities; + /* + * Disable RX checksum offloading on controllers that don't use + * new descriptor format but give chance to enable it. + */ + if ((sc_if->msk_flags & MSK_FLAG_DESCV2) == 0) + ifp->if_capenable &= ~IFCAP_RXCSUM; /* * Tell the upper layer(s) we support long frames. From owner-svn-src-stable@FreeBSD.ORG Wed Mar 6 09:12:39 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id C9969719; Wed, 6 Mar 2013 09:12:39 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id ADC5ABEF; Wed, 6 Mar 2013 09:12:39 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r269Cd6s051097; Wed, 6 Mar 2013 09:12:39 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r269CcaU051092; Wed, 6 Mar 2013 09:12:38 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201303060912.r269CcaU051092@svn.freebsd.org> From: Andriy Gapon Date: Wed, 6 Mar 2013 09:12:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r247874 - in stable/9/sys: conf kern sys X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Mar 2013 09:12:39 -0000 Author: avg Date: Wed Mar 6 09:12:38 2013 New Revision: 247874 URL: http://svnweb.freebsd.org/changeset/base/247874 Log: MFC r246246,246254: print compiler version in the kernel banner Modified: stable/9/sys/conf/newvers.sh stable/9/sys/kern/init_main.c stable/9/sys/kern/kern_mib.c stable/9/sys/sys/systm.h Directory Properties: stable/9/sys/ (props changed) stable/9/sys/conf/ (props changed) Modified: stable/9/sys/conf/newvers.sh ============================================================================== --- stable/9/sys/conf/newvers.sh Wed Mar 6 08:04:44 2013 (r247873) +++ stable/9/sys/conf/newvers.sh Wed Mar 6 09:12:38 2013 (r247874) @@ -86,6 +86,7 @@ fi touch version v=`cat version` u=${USER:-root} d=`pwd` h=${HOSTNAME:-`hostname`} t=`date` i=`${MAKE:-make} -V KERN_IDENT` +compiler_v=$($(${MAKE:-make} -V CC) -v 2>&1 | grep 'version') for dir in /bin /usr/bin /usr/local/bin; do if [ -x "${dir}/svnversion" ] ; then @@ -141,6 +142,7 @@ $COPYRIGHT char sccs[sizeof(SCCSSTR) > 128 ? sizeof(SCCSSTR) : 128] = SCCSSTR; char version[sizeof(VERSTR) > 256 ? sizeof(VERSTR) : 256] = VERSTR; +char compiler_version[] = "${compiler_v}"; char ostype[] = "${TYPE}"; char osrelease[sizeof(RELSTR) > 32 ? sizeof(RELSTR) : 32] = RELSTR; int osreldate = ${RELDATE}; Modified: stable/9/sys/kern/init_main.c ============================================================================== --- stable/9/sys/kern/init_main.c Wed Mar 6 08:04:44 2013 (r247873) +++ stable/9/sys/kern/init_main.c Wed Mar 6 09:12:38 2013 (r247874) @@ -325,6 +325,7 @@ print_version(void *data __unused) while (len > 0 && version[len - 1] == '\n') len--; printf("%.*s %s\n", len, version, machine); + printf("%s\n", compiler_version); } SYSINIT(announce, SI_SUB_COPYRIGHT, SI_ORDER_FIRST, print_caddr_t, Modified: stable/9/sys/kern/kern_mib.c ============================================================================== --- stable/9/sys/kern/kern_mib.c Wed Mar 6 08:04:44 2013 (r247873) +++ stable/9/sys/kern/kern_mib.c Wed Mar 6 09:12:38 2013 (r247874) @@ -99,6 +99,9 @@ SYSCTL_INT(_kern, KERN_OSREV, osrevision SYSCTL_STRING(_kern, KERN_VERSION, version, CTLFLAG_RD|CTLFLAG_MPSAFE, version, 0, "Kernel version"); +SYSCTL_STRING(_kern, OID_AUTO, compiler_version, CTLFLAG_RD|CTLFLAG_MPSAFE, + compiler_version, 0, "Version of compiler used to compile kernel"); + SYSCTL_STRING(_kern, KERN_OSTYPE, ostype, CTLFLAG_RD|CTLFLAG_MPSAFE| CTLFLAG_CAPRD, ostype, 0, "Operating system type"); Modified: stable/9/sys/sys/systm.h ============================================================================== --- stable/9/sys/sys/systm.h Wed Mar 6 08:04:44 2013 (r247873) +++ stable/9/sys/sys/systm.h Wed Mar 6 09:12:38 2013 (r247874) @@ -49,6 +49,7 @@ extern int cold; /* nonzero if we are d extern int rebooting; /* kern_reboot() has been called. */ extern const char *panicstr; /* panic message */ extern char version[]; /* system version */ +extern char compiler_version[]; /* compiler version */ extern char copyright[]; /* system copyright */ extern int kstack_pages; /* number of kernel stack pages */ From owner-svn-src-stable@FreeBSD.ORG Wed Mar 6 09:16:02 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 78E65A6F; Wed, 6 Mar 2013 09:16:02 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 5D05BC39; Wed, 6 Mar 2013 09:16:02 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r269G2dD051664; Wed, 6 Mar 2013 09:16:02 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r269G1Ri051656; Wed, 6 Mar 2013 09:16:01 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201303060916.r269G1Ri051656@svn.freebsd.org> From: Andriy Gapon Date: Wed, 6 Mar 2013 09:16:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r247875 - in stable/8/sys: conf kern sys X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Mar 2013 09:16:02 -0000 Author: avg Date: Wed Mar 6 09:16:01 2013 New Revision: 247875 URL: http://svnweb.freebsd.org/changeset/base/247875 Log: MFC r246246,246254: print compiler version in the kernel banner Modified: stable/8/sys/conf/newvers.sh stable/8/sys/kern/init_main.c stable/8/sys/kern/kern_mib.c stable/8/sys/sys/systm.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/conf/ (props changed) stable/8/sys/kern/ (props changed) stable/8/sys/sys/ (props changed) Modified: stable/8/sys/conf/newvers.sh ============================================================================== --- stable/8/sys/conf/newvers.sh Wed Mar 6 09:12:38 2013 (r247874) +++ stable/8/sys/conf/newvers.sh Wed Mar 6 09:16:01 2013 (r247875) @@ -86,6 +86,7 @@ fi touch version v=`cat version` u=${USER:-root} d=`pwd` h=${HOSTNAME:-`hostname`} t=`date` i=`${MAKE:-make} -V KERN_IDENT` +compiler_v=$($(${MAKE:-make} -V CC) -v 2>&1 | grep 'version') for dir in /bin /usr/bin /usr/local/bin; do if [ -x "${dir}/svnversion" ] ; then @@ -141,6 +142,7 @@ $COPYRIGHT char sccs[sizeof(SCCSSTR) > 128 ? sizeof(SCCSSTR) : 128] = SCCSSTR; char version[sizeof(VERSTR) > 256 ? sizeof(VERSTR) : 256] = VERSTR; +char compiler_version[] = "${compiler_v}"; char ostype[] = "${TYPE}"; char osrelease[sizeof(RELSTR) > 32 ? sizeof(RELSTR) : 32] = RELSTR; int osreldate = ${RELDATE}; Modified: stable/8/sys/kern/init_main.c ============================================================================== --- stable/8/sys/kern/init_main.c Wed Mar 6 09:12:38 2013 (r247874) +++ stable/8/sys/kern/init_main.c Wed Mar 6 09:16:01 2013 (r247875) @@ -302,6 +302,7 @@ print_version(void *data __unused) while (len > 0 && version[len - 1] == '\n') len--; printf("%.*s %s\n", len, version, machine); + printf("%s\n", compiler_version); } SYSINIT(announce, SI_SUB_COPYRIGHT, SI_ORDER_FIRST, print_caddr_t, Modified: stable/8/sys/kern/kern_mib.c ============================================================================== --- stable/8/sys/kern/kern_mib.c Wed Mar 6 09:12:38 2013 (r247874) +++ stable/8/sys/kern/kern_mib.c Wed Mar 6 09:16:01 2013 (r247875) @@ -99,6 +99,9 @@ SYSCTL_INT(_kern, KERN_OSREV, osrevision SYSCTL_STRING(_kern, KERN_VERSION, version, CTLFLAG_RD|CTLFLAG_MPSAFE, version, 0, "Kernel version"); +SYSCTL_STRING(_kern, OID_AUTO, compiler_version, CTLFLAG_RD|CTLFLAG_MPSAFE, + compiler_version, 0, "Version of compiler used to compile kernel"); + SYSCTL_STRING(_kern, KERN_OSTYPE, ostype, CTLFLAG_RD|CTLFLAG_MPSAFE, ostype, 0, "Operating system type"); Modified: stable/8/sys/sys/systm.h ============================================================================== --- stable/8/sys/sys/systm.h Wed Mar 6 09:12:38 2013 (r247874) +++ stable/8/sys/sys/systm.h Wed Mar 6 09:16:01 2013 (r247875) @@ -49,6 +49,7 @@ extern int cold; /* nonzero if we are d extern int rebooting; /* boot() has been called. */ extern const char *panicstr; /* panic message */ extern char version[]; /* system version */ +extern char compiler_version[]; /* compiler version */ extern char copyright[]; /* system copyright */ extern int kstack_pages; /* number of kernel stack pages */ From owner-svn-src-stable@FreeBSD.ORG Wed Mar 6 09:22:11 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id D4994D23; Wed, 6 Mar 2013 09:22:11 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id A5A54CEC; Wed, 6 Mar 2013 09:22:11 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r269MBWU054138; Wed, 6 Mar 2013 09:22:11 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r269MAFr054133; Wed, 6 Mar 2013 09:22:10 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201303060922.r269MAFr054133@svn.freebsd.org> From: Andriy Gapon Date: Wed, 6 Mar 2013 09:22:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r247876 - in stable/8/sys: amd64/amd64 amd64/include i386/i386 i386/include x86/x86 X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Mar 2013 09:22:11 -0000 Author: avg Date: Wed Mar 6 09:22:10 2013 New Revision: 247876 URL: http://svnweb.freebsd.org/changeset/base/247876 Log: MFC r246247: x86 suspend/resume: suspend pics and pseudo-pics in reverse order Modified: stable/8/sys/amd64/amd64/intr_machdep.c (contents, props changed) stable/8/sys/amd64/include/intr_machdep.h stable/8/sys/i386/i386/intr_machdep.c (contents, props changed) stable/8/sys/i386/include/intr_machdep.h stable/8/sys/x86/x86/local_apic.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/ (props changed) stable/8/sys/i386/ (props changed) stable/8/sys/x86/ (props changed) Modified: stable/8/sys/amd64/amd64/intr_machdep.c ============================================================================== --- stable/8/sys/amd64/amd64/intr_machdep.c Wed Mar 6 09:16:01 2013 (r247875) +++ stable/8/sys/amd64/amd64/intr_machdep.c Wed Mar 6 09:22:10 2013 (r247876) @@ -74,7 +74,7 @@ static int intrcnt_index; static struct intsrc *interrupt_sources[NUM_IO_INTS]; static struct mtx intr_table_lock; static struct mtx intrcnt_lock; -static STAILQ_HEAD(, pic) pics; +static TAILQ_HEAD(pics_head, pic) pics; #ifdef SMP static int assign_cpu; @@ -93,7 +93,7 @@ intr_pic_registered(struct pic *pic) { struct pic *p; - STAILQ_FOREACH(p, &pics, pics) { + TAILQ_FOREACH(p, &pics, pics) { if (p == pic) return (1); } @@ -115,7 +115,7 @@ intr_register_pic(struct pic *pic) if (intr_pic_registered(pic)) error = EBUSY; else { - STAILQ_INSERT_TAIL(&pics, pic, pics); + TAILQ_INSERT_TAIL(&pics, pic, pics); error = 0; } mtx_unlock(&intr_table_lock); @@ -278,7 +278,7 @@ intr_resume(void) atpic_reset(); #endif mtx_lock(&intr_table_lock); - STAILQ_FOREACH(pic, &pics, pics) { + TAILQ_FOREACH(pic, &pics, pics) { if (pic->pic_resume != NULL) pic->pic_resume(pic); } @@ -291,7 +291,7 @@ intr_suspend(void) struct pic *pic; mtx_lock(&intr_table_lock); - STAILQ_FOREACH(pic, &pics, pics) { + TAILQ_FOREACH_REVERSE(pic, &pics, pics_head, pics) { if (pic->pic_suspend != NULL) pic->pic_suspend(pic); } @@ -372,7 +372,7 @@ intr_init(void *dummy __unused) intrcnt_setname("???", 0); intrcnt_index = 1; - STAILQ_INIT(&pics); + TAILQ_INIT(&pics); mtx_init(&intr_table_lock, "intr sources", NULL, MTX_DEF); mtx_init(&intrcnt_lock, "intrcnt", NULL, MTX_SPIN); } Modified: stable/8/sys/amd64/include/intr_machdep.h ============================================================================== --- stable/8/sys/amd64/include/intr_machdep.h Wed Mar 6 09:16:01 2013 (r247875) +++ stable/8/sys/amd64/include/intr_machdep.h Wed Mar 6 09:22:10 2013 (r247876) @@ -94,7 +94,7 @@ struct pic { int (*pic_config_intr)(struct intsrc *, enum intr_trigger, enum intr_polarity); int (*pic_assign_cpu)(struct intsrc *, u_int apic_id); - STAILQ_ENTRY(pic) pics; + TAILQ_ENTRY(pic) pics; }; /* Flags for pic_disable_source() */ Modified: stable/8/sys/i386/i386/intr_machdep.c ============================================================================== --- stable/8/sys/i386/i386/intr_machdep.c Wed Mar 6 09:16:01 2013 (r247875) +++ stable/8/sys/i386/i386/intr_machdep.c Wed Mar 6 09:22:10 2013 (r247876) @@ -65,7 +65,7 @@ static int intrcnt_index; static struct intsrc *interrupt_sources[NUM_IO_INTS]; static struct mtx intr_table_lock; static struct mtx intrcnt_lock; -static STAILQ_HEAD(, pic) pics; +static TAILQ_HEAD(pics_head, pic) pics; #ifdef SMP static int assign_cpu; @@ -84,7 +84,7 @@ intr_pic_registered(struct pic *pic) { struct pic *p; - STAILQ_FOREACH(p, &pics, pics) { + TAILQ_FOREACH(p, &pics, pics) { if (p == pic) return (1); } @@ -106,7 +106,7 @@ intr_register_pic(struct pic *pic) if (intr_pic_registered(pic)) error = EBUSY; else { - STAILQ_INSERT_TAIL(&pics, pic, pics); + TAILQ_INSERT_TAIL(&pics, pic, pics); error = 0; } mtx_unlock(&intr_table_lock); @@ -266,7 +266,7 @@ intr_resume(void) struct pic *pic; mtx_lock(&intr_table_lock); - STAILQ_FOREACH(pic, &pics, pics) { + TAILQ_FOREACH(pic, &pics, pics) { if (pic->pic_resume != NULL) pic->pic_resume(pic); } @@ -279,7 +279,7 @@ intr_suspend(void) struct pic *pic; mtx_lock(&intr_table_lock); - STAILQ_FOREACH(pic, &pics, pics) { + TAILQ_FOREACH_REVERSE(pic, &pics, pics_head, pics) { if (pic->pic_suspend != NULL) pic->pic_suspend(pic); } @@ -360,7 +360,7 @@ intr_init(void *dummy __unused) intrcnt_setname("???", 0); intrcnt_index = 1; - STAILQ_INIT(&pics); + TAILQ_INIT(&pics); mtx_init(&intr_table_lock, "intr sources", NULL, MTX_DEF); mtx_init(&intrcnt_lock, "intrcnt", NULL, MTX_SPIN); } Modified: stable/8/sys/i386/include/intr_machdep.h ============================================================================== --- stable/8/sys/i386/include/intr_machdep.h Wed Mar 6 09:16:01 2013 (r247875) +++ stable/8/sys/i386/include/intr_machdep.h Wed Mar 6 09:22:10 2013 (r247876) @@ -94,7 +94,7 @@ struct pic { int (*pic_config_intr)(struct intsrc *, enum intr_trigger, enum intr_polarity); int (*pic_assign_cpu)(struct intsrc *, u_int apic_id); - STAILQ_ENTRY(pic) pics; + TAILQ_ENTRY(pic) pics; }; /* Flags for pic_disable_source() */ Modified: stable/8/sys/x86/x86/local_apic.c ============================================================================== --- stable/8/sys/x86/x86/local_apic.c Wed Mar 6 09:16:01 2013 (r247875) +++ stable/8/sys/x86/x86/local_apic.c Wed Mar 6 09:22:10 2013 (r247876) @@ -1366,11 +1366,19 @@ apic_setup_io(void *dummy __unused) if (best_enum == NULL) return; + + /* + * Local APIC must be registered before other PICs and pseudo PICs + * for proper suspend/resume order. + */ +#ifndef XEN + intr_register_pic(&lapic_pic); +#endif + retval = best_enum->apic_setup_io(); if (retval != 0) printf("%s: Failed to setup I/O APICs: returned %d\n", best_enum->apic_name, retval); - #ifdef XEN return; #endif @@ -1379,7 +1387,6 @@ apic_setup_io(void *dummy __unused) * properly program the LINT pins. */ lapic_setup(1); - intr_register_pic(&lapic_pic); if (bootverbose) lapic_dump("BSP"); From owner-svn-src-stable@FreeBSD.ORG Wed Mar 6 09:22:46 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id E9C3FE92; Wed, 6 Mar 2013 09:22:46 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id D0B9ACF8; Wed, 6 Mar 2013 09:22:46 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r269Mk6L054247; Wed, 6 Mar 2013 09:22:46 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r269Mk6x054243; Wed, 6 Mar 2013 09:22:46 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201303060922.r269Mk6x054243@svn.freebsd.org> From: Andriy Gapon Date: Wed, 6 Mar 2013 09:22:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r247877 - in stable/9/sys: amd64/include i386/include x86/x86 X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Mar 2013 09:22:47 -0000 Author: avg Date: Wed Mar 6 09:22:45 2013 New Revision: 247877 URL: http://svnweb.freebsd.org/changeset/base/247877 Log: MFC r246247: x86 suspend/resume: suspend pics and pseudo-pics in reverse order Modified: stable/9/sys/amd64/include/intr_machdep.h stable/9/sys/i386/include/intr_machdep.h stable/9/sys/x86/x86/intr_machdep.c stable/9/sys/x86/x86/local_apic.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/amd64/include/intr_machdep.h ============================================================================== --- stable/9/sys/amd64/include/intr_machdep.h Wed Mar 6 09:22:10 2013 (r247876) +++ stable/9/sys/amd64/include/intr_machdep.h Wed Mar 6 09:22:45 2013 (r247877) @@ -94,7 +94,7 @@ struct pic { int (*pic_config_intr)(struct intsrc *, enum intr_trigger, enum intr_polarity); int (*pic_assign_cpu)(struct intsrc *, u_int apic_id); - STAILQ_ENTRY(pic) pics; + TAILQ_ENTRY(pic) pics; }; /* Flags for pic_disable_source() */ Modified: stable/9/sys/i386/include/intr_machdep.h ============================================================================== --- stable/9/sys/i386/include/intr_machdep.h Wed Mar 6 09:22:10 2013 (r247876) +++ stable/9/sys/i386/include/intr_machdep.h Wed Mar 6 09:22:45 2013 (r247877) @@ -94,7 +94,7 @@ struct pic { int (*pic_config_intr)(struct intsrc *, enum intr_trigger, enum intr_polarity); int (*pic_assign_cpu)(struct intsrc *, u_int apic_id); - STAILQ_ENTRY(pic) pics; + TAILQ_ENTRY(pic) pics; }; /* Flags for pic_disable_source() */ Modified: stable/9/sys/x86/x86/intr_machdep.c ============================================================================== --- stable/9/sys/x86/x86/intr_machdep.c Wed Mar 6 09:22:10 2013 (r247876) +++ stable/9/sys/x86/x86/intr_machdep.c Wed Mar 6 09:22:45 2013 (r247877) @@ -78,7 +78,7 @@ static int intrcnt_index; static struct intsrc *interrupt_sources[NUM_IO_INTS]; static struct mtx intr_table_lock; static struct mtx intrcnt_lock; -static STAILQ_HEAD(, pic) pics; +static TAILQ_HEAD(pics_head, pic) pics; #ifdef SMP static int assign_cpu; @@ -102,7 +102,7 @@ intr_pic_registered(struct pic *pic) { struct pic *p; - STAILQ_FOREACH(p, &pics, pics) { + TAILQ_FOREACH(p, &pics, pics) { if (p == pic) return (1); } @@ -124,7 +124,7 @@ intr_register_pic(struct pic *pic) if (intr_pic_registered(pic)) error = EBUSY; else { - STAILQ_INSERT_TAIL(&pics, pic, pics); + TAILQ_INSERT_TAIL(&pics, pic, pics); error = 0; } mtx_unlock(&intr_table_lock); @@ -287,7 +287,7 @@ intr_resume(void) atpic_reset(); #endif mtx_lock(&intr_table_lock); - STAILQ_FOREACH(pic, &pics, pics) { + TAILQ_FOREACH(pic, &pics, pics) { if (pic->pic_resume != NULL) pic->pic_resume(pic); } @@ -300,7 +300,7 @@ intr_suspend(void) struct pic *pic; mtx_lock(&intr_table_lock); - STAILQ_FOREACH(pic, &pics, pics) { + TAILQ_FOREACH_REVERSE(pic, &pics, pics_head, pics) { if (pic->pic_suspend != NULL) pic->pic_suspend(pic); } @@ -381,7 +381,7 @@ intr_init(void *dummy __unused) intrcnt_setname("???", 0); intrcnt_index = 1; - STAILQ_INIT(&pics); + TAILQ_INIT(&pics); mtx_init(&intr_table_lock, "intr sources", NULL, MTX_DEF); mtx_init(&intrcnt_lock, "intrcnt", NULL, MTX_SPIN); } Modified: stable/9/sys/x86/x86/local_apic.c ============================================================================== --- stable/9/sys/x86/x86/local_apic.c Wed Mar 6 09:22:10 2013 (r247876) +++ stable/9/sys/x86/x86/local_apic.c Wed Mar 6 09:22:45 2013 (r247877) @@ -1346,11 +1346,19 @@ apic_setup_io(void *dummy __unused) if (best_enum == NULL) return; + + /* + * Local APIC must be registered before other PICs and pseudo PICs + * for proper suspend/resume order. + */ +#ifndef XEN + intr_register_pic(&lapic_pic); +#endif + retval = best_enum->apic_setup_io(); if (retval != 0) printf("%s: Failed to setup I/O APICs: returned %d\n", best_enum->apic_name, retval); - #ifdef XEN return; #endif @@ -1359,7 +1367,6 @@ apic_setup_io(void *dummy __unused) * properly program the LINT pins. */ lapic_setup(1); - intr_register_pic(&lapic_pic); if (bootverbose) lapic_dump("BSP"); From owner-svn-src-stable@FreeBSD.ORG Wed Mar 6 09:33:05 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id BB8E11AE; Wed, 6 Mar 2013 09:33:05 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 96158D61; Wed, 6 Mar 2013 09:33:05 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r269X5JG057247; Wed, 6 Mar 2013 09:33:05 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r269X5Xo057245; Wed, 6 Mar 2013 09:33:05 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201303060933.r269X5Xo057245@svn.freebsd.org> From: Andriy Gapon Date: Wed, 6 Mar 2013 09:33:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r247878 - in stable/9/sys: amd64/amd64 i386/i386 X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Mar 2013 09:33:05 -0000 Author: avg Date: Wed Mar 6 09:33:04 2013 New Revision: 247878 URL: http://svnweb.freebsd.org/changeset/base/247878 Log: MFC r246248: cpususpend_handler: mark AP as resumed only after fully setting up lapic Modified: stable/9/sys/amd64/amd64/mp_machdep.c stable/9/sys/i386/i386/mp_machdep.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/amd64/amd64/mp_machdep.c ============================================================================== --- stable/9/sys/amd64/amd64/mp_machdep.c Wed Mar 6 09:22:45 2013 (r247877) +++ stable/9/sys/amd64/amd64/mp_machdep.c Wed Mar 6 09:33:04 2013 (r247878) @@ -1430,12 +1430,12 @@ cpususpend_handler(void) while (!CPU_ISSET(cpu, &started_cpus)) ia32_pause(); - CPU_CLR_ATOMIC(cpu, &started_cpus); - CPU_CLR_ATOMIC(cpu, &stopped_cpus); - /* Resume MCA and local APIC */ mca_resume(); lapic_setup(0); + + CPU_CLR_ATOMIC(cpu, &started_cpus); + CPU_CLR_ATOMIC(cpu, &stopped_cpus); } /* Modified: stable/9/sys/i386/i386/mp_machdep.c ============================================================================== --- stable/9/sys/i386/i386/mp_machdep.c Wed Mar 6 09:22:45 2013 (r247877) +++ stable/9/sys/i386/i386/mp_machdep.c Wed Mar 6 09:33:04 2013 (r247878) @@ -1533,12 +1533,12 @@ cpususpend_handler(void) while (!CPU_ISSET(cpu, &started_cpus)) ia32_pause(); - CPU_CLR_ATOMIC(cpu, &started_cpus); - CPU_CLR_ATOMIC(cpu, &stopped_cpus); - /* Resume MCA and local APIC */ mca_resume(); lapic_setup(0); + + CPU_CLR_ATOMIC(cpu, &started_cpus); + CPU_CLR_ATOMIC(cpu, &stopped_cpus); } /* * This is called once the rest of the system is up and running and we're From owner-svn-src-stable@FreeBSD.ORG Wed Mar 6 09:33:17 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 838712CB; Wed, 6 Mar 2013 09:33:17 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 769ACD64; Wed, 6 Mar 2013 09:33:17 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r269XH8v057308; Wed, 6 Mar 2013 09:33:17 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r269XHnE057307; Wed, 6 Mar 2013 09:33:17 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201303060933.r269XHnE057307@svn.freebsd.org> From: Andriy Gapon Date: Wed, 6 Mar 2013 09:33:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r247879 - stable/8/sys/amd64/amd64 X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Mar 2013 09:33:17 -0000 Author: avg Date: Wed Mar 6 09:33:16 2013 New Revision: 247879 URL: http://svnweb.freebsd.org/changeset/base/247879 Log: MFC r246248: cpususpend_handler: mark AP as resumed only after fully setting up lapic Modified: stable/8/sys/amd64/amd64/mp_machdep.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/ (props changed) Modified: stable/8/sys/amd64/amd64/mp_machdep.c ============================================================================== --- stable/8/sys/amd64/amd64/mp_machdep.c Wed Mar 6 09:33:04 2013 (r247878) +++ stable/8/sys/amd64/amd64/mp_machdep.c Wed Mar 6 09:33:16 2013 (r247879) @@ -1365,13 +1365,14 @@ cpususpend_handler(void) while (!(started_cpus & cpumask)) ia32_pause(); - atomic_clear_int(&started_cpus, cpumask); - atomic_clear_int(&stopped_cpus, cpumask); - /* Restore CR3 and enable interrupts */ load_cr3(cr3); mca_resume(); lapic_setup(0); + + atomic_clear_int(&started_cpus, cpumask); + atomic_clear_int(&stopped_cpus, cpumask); + intr_restore(rf); } From owner-svn-src-stable@FreeBSD.ORG Wed Mar 6 10:23:58 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 602D042A; Wed, 6 Mar 2013 10:23:58 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 37C68F6F; Wed, 6 Mar 2013 10:23:58 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r26ANvEG072709; Wed, 6 Mar 2013 10:23:57 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r26ANurj072701; Wed, 6 Mar 2013 10:23:56 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201303061023.r26ANurj072701@svn.freebsd.org> From: Andriy Gapon Date: Wed, 6 Mar 2013 10:23:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r247881 - in stable/9/sys: amd64/acpica dev/acpica i386/acpica ia64/acpica X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Mar 2013 10:23:58 -0000 Author: avg Date: Wed Mar 6 10:23:56 2013 New Revision: 247881 URL: http://svnweb.freebsd.org/changeset/base/247881 Log: MFC r233579,236403,236408: make interrupt flags management closer to head r233579: Restore interrupt state after executing AcpiEnterSleepState(). r236403,236408: acpi_wakeup_machdep/acpi_sleep_machdep The merged changes are modified a bit to account for lots of missing acpi and acpica MFCs. For the same reason MFC to stable/8 is not practical. MFC slackers: iwasaki, jkim Modified: stable/9/sys/amd64/acpica/acpi_wakeup.c stable/9/sys/dev/acpica/acpi.c stable/9/sys/dev/acpica/acpivar.h stable/9/sys/i386/acpica/acpi_wakeup.c stable/9/sys/ia64/acpica/acpi_wakeup.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) Modified: stable/9/sys/amd64/acpica/acpi_wakeup.c ============================================================================== --- stable/9/sys/amd64/acpica/acpi_wakeup.c Wed Mar 6 09:53:38 2013 (r247880) +++ stable/9/sys/amd64/acpica/acpi_wakeup.c Wed Mar 6 10:23:56 2013 (r247881) @@ -76,6 +76,10 @@ static struct pcb **susppcbs; static void **suspfpusave; #endif +#ifdef SMP +static cpuset_t suspcpus; +#endif + int acpi_restorecpu(uint64_t, vm_offset_t); static void *acpi_alloc_wakeup_handler(void); @@ -220,21 +224,14 @@ acpi_wakeup_cpus(struct acpi_softc *sc, int acpi_sleep_machdep(struct acpi_softc *sc, int state) { -#ifdef SMP - cpuset_t wakeup_cpus; -#endif - register_t rf; ACPI_STATUS status; - int ret; - - ret = -1; if (sc->acpi_wakeaddr == 0ul) - return (ret); + return (-1); /* couldn't alloc wake memory */ #ifdef SMP - wakeup_cpus = all_cpus; - CPU_CLR(PCPU_GET(cpuid), &wakeup_cpus); + suspcpus = all_cpus; + CPU_CLR(PCPU_GET(cpuid), &suspcpus); #endif if (acpi_resume_beep != 0) @@ -242,16 +239,15 @@ acpi_sleep_machdep(struct acpi_softc *sc AcpiSetFirmwareWakingVector(WAKECODE_PADDR(sc)); - rf = intr_disable(); intr_suspend(); if (savectx(susppcbs[0])) { ctx_fpusave(suspfpusave[0]); #ifdef SMP - if (!CPU_EMPTY(&wakeup_cpus) && - suspend_cpus(wakeup_cpus) == 0) { + if (!CPU_EMPTY(&suspcpus) && + suspend_cpus(suspcpus) == 0) { device_printf(sc->acpi_dev, "Failed to suspend APs\n"); - goto out; + return (0); /* couldn't sleep */ } #endif @@ -276,41 +272,54 @@ acpi_sleep_machdep(struct acpi_softc *sc device_printf(sc->acpi_dev, "AcpiEnterSleepState failed - %s\n", AcpiFormatException(status)); - goto out; + return (0); /* couldn't sleep */ } for (;;) ia32_pause(); - } else { - pmap_init_pat(); - load_cr3(susppcbs[0]->pcb_cr3); - initializecpu(); - PCPU_SET(switchtime, 0); - PCPU_SET(switchticks, ticks); -#ifdef SMP - if (!CPU_EMPTY(&wakeup_cpus)) - acpi_wakeup_cpus(sc, &wakeup_cpus); -#endif - ret = 0; } -out: + return (1); /* wakeup successfully */ +} + +int +acpi_wakeup_machdep(struct acpi_softc *sc, int state, + int sleep_result, int intr_enabled) +{ + + if (sleep_result == -1) + return (sleep_result); + + if (intr_enabled == 0) { + /* Wakeup MD procedures in interrupt disabled context */ + if (sleep_result == 1) { + pmap_init_pat(); + load_cr3(susppcbs[0]->pcb_cr3); + initializecpu(); + PCPU_SET(switchtime, 0); + PCPU_SET(switchticks, ticks); #ifdef SMP - if (!CPU_EMPTY(&wakeup_cpus)) - restart_cpus(wakeup_cpus); + if (!CPU_EMPTY(&suspcpus)) + acpi_wakeup_cpus(sc, &suspcpus); #endif + } - mca_resume(); - intr_resume(); - intr_restore(rf); - - AcpiSetFirmwareWakingVector(0); +#ifdef SMP + if (!CPU_EMPTY(&suspcpus)) + restart_cpus(suspcpus); +#endif + mca_resume(); + intr_resume(); + } else { + /* Wakeup MD procedures in interrupt enabled context */ + AcpiSetFirmwareWakingVector(0); - if (ret == 0 && mem_range_softc.mr_op != NULL && - mem_range_softc.mr_op->reinit != NULL) - mem_range_softc.mr_op->reinit(&mem_range_softc); + if (sleep_result == 1 && mem_range_softc.mr_op != NULL && + mem_range_softc.mr_op->reinit != NULL) + mem_range_softc.mr_op->reinit(&mem_range_softc); + } - return (ret); + return (sleep_result); } static void * Modified: stable/9/sys/dev/acpica/acpi.c ============================================================================== --- stable/9/sys/dev/acpica/acpi.c Wed Mar 6 09:53:38 2013 (r247880) +++ stable/9/sys/dev/acpica/acpi.c Wed Mar 6 10:23:56 2013 (r247881) @@ -1960,6 +1960,7 @@ static void acpi_shutdown_final(void *arg, int howto) { struct acpi_softc *sc = (struct acpi_softc *)arg; + register_t intr; ACPI_STATUS status; /* @@ -1975,13 +1976,15 @@ acpi_shutdown_final(void *arg, int howto return; } device_printf(sc->acpi_dev, "Powering system off\n"); - ACPI_DISABLE_IRQS(); + intr = intr_disable(); status = AcpiEnterSleepState(ACPI_STATE_S5); - if (ACPI_FAILURE(status)) + if (ACPI_FAILURE(status)) { + intr_restore(intr); device_printf(sc->acpi_dev, "power-off failed - %s\n", AcpiFormatException(status)); - else { + } else { DELAY(1000000); + intr_restore(intr); device_printf(sc->acpi_dev, "power-off failed - timeout\n"); } } else if ((howto & RB_HALT) == 0 && sc->acpi_handle_reboot) { @@ -2652,8 +2655,10 @@ enum acpi_sleep_state { static ACPI_STATUS acpi_EnterSleepState(struct acpi_softc *sc, int state) { - ACPI_STATUS status; + register_t intr; + ACPI_STATUS status; enum acpi_sleep_state slp_state; + int sleep_result; ACPI_FUNCTION_TRACE_U32((char *)(uintptr_t)__func__, state); @@ -2733,15 +2738,24 @@ acpi_EnterSleepState(struct acpi_softc * if (sc->acpi_sleep_delay > 0) DELAY(sc->acpi_sleep_delay * 1000000); + intr = intr_disable(); if (state != ACPI_STATE_S1) { - acpi_sleep_machdep(sc, state); + sleep_result = acpi_sleep_machdep(sc, state); + acpi_wakeup_machdep(sc, state, sleep_result, 0); + intr_restore(intr); + + /* call acpi_wakeup_machdep() again with interrupt enabled */ + acpi_wakeup_machdep(sc, state, sleep_result, 1); + + if (sleep_result == -1) + goto backout; /* Re-enable ACPI hardware on wakeup from sleep state 4. */ if (state == ACPI_STATE_S4) AcpiEnable(); } else { - ACPI_DISABLE_IRQS(); status = AcpiEnterSleepState(state); + intr_restore(intr); if (ACPI_FAILURE(status)) { device_printf(sc->acpi_dev, "AcpiEnterSleepState failed - %s\n", AcpiFormatException(status)); Modified: stable/9/sys/dev/acpica/acpivar.h ============================================================================== --- stable/9/sys/dev/acpica/acpivar.h Wed Mar 6 09:53:38 2013 (r247880) +++ stable/9/sys/dev/acpica/acpivar.h Wed Mar 6 10:23:56 2013 (r247881) @@ -434,6 +434,8 @@ int acpi_disabled(char *subsys); int acpi_machdep_init(device_t dev); void acpi_install_wakeup_handler(struct acpi_softc *sc); int acpi_sleep_machdep(struct acpi_softc *sc, int state); +int acpi_wakeup_machdep(struct acpi_softc *sc, int state, + int sleep_result, int intr_enabled); int acpi_table_quirks(int *quirks); int acpi_machdep_quirks(int *quirks); Modified: stable/9/sys/i386/acpica/acpi_wakeup.c ============================================================================== --- stable/9/sys/i386/acpica/acpi_wakeup.c Wed Mar 6 09:53:38 2013 (r247880) +++ stable/9/sys/i386/acpica/acpi_wakeup.c Wed Mar 6 10:23:56 2013 (r247881) @@ -74,6 +74,10 @@ extern struct pcb **susppcbs; static struct pcb **susppcbs; #endif +#ifdef SMP +static cpuset_t suspcpus; +#endif + static void *acpi_alloc_wakeup_handler(void); static void acpi_stop_beep(void *); @@ -212,22 +216,14 @@ acpi_wakeup_cpus(struct acpi_softc *sc, int acpi_sleep_machdep(struct acpi_softc *sc, int state) { -#ifdef SMP - cpuset_t wakeup_cpus; -#endif - register_t cr3, rf; ACPI_STATUS status; - struct pmap *pm; - int ret; - - ret = -1; if (sc->acpi_wakeaddr == 0ul) - return (ret); + return (-1); /* couldn't alloc wake memory */ #ifdef SMP - wakeup_cpus = all_cpus; - CPU_CLR(PCPU_GET(cpuid), &wakeup_cpus); + suspcpus = all_cpus; + CPU_CLR(PCPU_GET(cpuid), &suspcpus); #endif if (acpi_resume_beep != 0) @@ -235,28 +231,14 @@ acpi_sleep_machdep(struct acpi_softc *sc AcpiSetFirmwareWakingVector(WAKECODE_PADDR(sc)); - rf = intr_disable(); intr_suspend(); - /* - * Temporarily switch to the kernel pmap because it provides - * an identity mapping (setup at boot) for the low physical - * memory region containing the wakeup code. - */ - pm = kernel_pmap; - cr3 = rcr3(); -#ifdef PAE - load_cr3(vtophys(pm->pm_pdpt)); -#else - load_cr3(vtophys(pm->pm_pdir)); -#endif - if (suspendctx(susppcbs[0])) { #ifdef SMP - if (!CPU_EMPTY(&wakeup_cpus) && - suspend_cpus(wakeup_cpus) == 0) { + if (!CPU_EMPTY(&suspcpus) && + suspend_cpus(suspcpus) == 0) { device_printf(sc->acpi_dev, "Failed to suspend APs\n"); - goto out; + return (0); /* couldn't sleep */ } #endif @@ -264,8 +246,6 @@ acpi_sleep_machdep(struct acpi_softc *sc WAKECODE_FIXUP(reset_video, uint8_t, (acpi_reset_video != 0)); WAKECODE_FIXUP(wakeup_cr4, register_t, susppcbs[0]->pcb_cr4); - WAKECODE_FIXUP(wakeup_cr3, register_t, susppcbs[0]->pcb_cr3); - WAKECODE_FIXUP(wakeup_pcb, struct pcb *, susppcbs[0]); /* Call ACPICA to enter the desired sleep state */ @@ -278,41 +258,54 @@ acpi_sleep_machdep(struct acpi_softc *sc device_printf(sc->acpi_dev, "AcpiEnterSleepState failed - %s\n", AcpiFormatException(status)); - goto out; + return (0); /* couldn't sleep */ } for (;;) ia32_pause(); - } else { - pmap_init_pat(); - initializecpu(); - PCPU_SET(switchtime, 0); - PCPU_SET(switchticks, ticks); + } + + return (1); /* wakeup successfully */ +} + +int +acpi_wakeup_machdep(struct acpi_softc *sc, int state, + int sleep_result, int intr_enabled) +{ + + if (sleep_result == -1) + return (sleep_result); + + if (intr_enabled == 0) { + /* Wakeup MD procedures in interrupt disabled context */ + if (sleep_result == 1) { + pmap_init_pat(); + load_cr3(susppcbs[0]->pcb_cr3); + initializecpu(); + PCPU_SET(switchtime, 0); + PCPU_SET(switchticks, ticks); #ifdef SMP - if (!CPU_EMPTY(&wakeup_cpus)) - acpi_wakeup_cpus(sc, &wakeup_cpus); + if (!CPU_EMPTY(&suspcpus)) + acpi_wakeup_cpus(sc, &suspcpus); #endif - ret = 0; - } + } -out: #ifdef SMP - if (!CPU_EMPTY(&wakeup_cpus)) - restart_cpus(wakeup_cpus); + if (!CPU_EMPTY(&suspcpus)) + restart_cpus(suspcpus); #endif + mca_resume(); + intr_resume(); + } else { + /* Wakeup MD procedures in interrupt enabled context */ + AcpiSetFirmwareWakingVector(0); - load_cr3(cr3); - mca_resume(); - intr_resume(); - intr_restore(rf); - - AcpiSetFirmwareWakingVector(0); - - if (ret == 0 && mem_range_softc.mr_op != NULL && - mem_range_softc.mr_op->reinit != NULL) - mem_range_softc.mr_op->reinit(&mem_range_softc); + if (sleep_result == 1 && mem_range_softc.mr_op != NULL && + mem_range_softc.mr_op->reinit != NULL) + mem_range_softc.mr_op->reinit(&mem_range_softc); + } - return (ret); + return (sleep_result); } static void * @@ -373,6 +366,16 @@ acpi_install_wakeup_handler(struct acpi_ /* Save pointers to some global data. */ WAKECODE_FIXUP(wakeup_ret, void *, resumectx); + /* + * Temporarily switch to the kernel pmap because it provides + * an identity mapping (setup at boot) for the low physical + * memory region containing the wakeup code. + */ +#ifdef PAE + WAKECODE_FIXUP(wakeup_cr3, register_t, vtophys(kernel_pmap->pm_pdpt)); +#else + WAKECODE_FIXUP(wakeup_cr3, register_t, vtophys(kernel_pmap->pm_pdir)); +#endif if (bootverbose) device_printf(sc->acpi_dev, "wakeup code va %#x pa %#jx\n", Modified: stable/9/sys/ia64/acpica/acpi_wakeup.c ============================================================================== --- stable/9/sys/ia64/acpica/acpi_wakeup.c Wed Mar 6 09:53:38 2013 (r247880) +++ stable/9/sys/ia64/acpica/acpi_wakeup.c Wed Mar 6 10:23:56 2013 (r247881) @@ -39,6 +39,13 @@ acpi_sleep_machdep(struct acpi_softc *sc return (0); } +int +acpi_wakeup_machdep(struct acpi_softc *sc, int state, + int sleep_result, int intr_enabled) +{ + return (0); +} + void acpi_install_wakeup_handler(struct acpi_softc *sc) { From owner-svn-src-stable@FreeBSD.ORG Wed Mar 6 10:45:46 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id D01328DB; Wed, 6 Mar 2013 10:45:46 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id C150ECD; Wed, 6 Mar 2013 10:45:46 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r26AjkV9078842; Wed, 6 Mar 2013 10:45:46 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r26Ajkaa078840; Wed, 6 Mar 2013 10:45:46 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201303061045.r26Ajkaa078840@svn.freebsd.org> From: Andriy Gapon Date: Wed, 6 Mar 2013 10:45:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r247883 - stable/9/sys/dev/acpica X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Mar 2013 10:45:46 -0000 Author: avg Date: Wed Mar 6 10:45:46 2013 New Revision: 247883 URL: http://svnweb.freebsd.org/changeset/base/247883 Log: MFC r246250,246252: acpi: after wakeup from a state > S1 re-enable SCI_EN with a direct write Modified: stable/9/sys/dev/acpica/acpi.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) Modified: stable/9/sys/dev/acpica/acpi.c ============================================================================== --- stable/9/sys/dev/acpica/acpi.c Wed Mar 6 10:40:50 2013 (r247882) +++ stable/9/sys/dev/acpica/acpi.c Wed Mar 6 10:45:46 2013 (r247883) @@ -2742,6 +2742,19 @@ acpi_EnterSleepState(struct acpi_softc * if (state != ACPI_STATE_S1) { sleep_result = acpi_sleep_machdep(sc, state); acpi_wakeup_machdep(sc, state, sleep_result, 0); + + /* + * XXX According to ACPI specification SCI_EN bit should be restored + * by ACPI platform (BIOS, firmware) to its pre-sleep state. + * Unfortunately some BIOSes fail to do that and that leads to + * unexpected and serious consequences during wake up like a system + * getting stuck in SMI handlers. + * This hack is picked up from Linux, which claims that it follows + * Windows behavior. + */ + if (sleep_result == 1 && state != ACPI_STATE_S4) + AcpiWriteBitRegister(ACPI_BITREG_SCI_ENABLE, ACPI_ENABLE_EVENT); + intr_restore(intr); /* call acpi_wakeup_machdep() again with interrupt enabled */ From owner-svn-src-stable@FreeBSD.ORG Wed Mar 6 10:52:02 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id A3A60E73; Wed, 6 Mar 2013 10:52:02 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 7D7B013A; Wed, 6 Mar 2013 10:52:02 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r26Aq2DO081340; Wed, 6 Mar 2013 10:52:02 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r26Aq2bM081339; Wed, 6 Mar 2013 10:52:02 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201303061052.r26Aq2bM081339@svn.freebsd.org> From: Andriy Gapon Date: Wed, 6 Mar 2013 10:52:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r247884 - stable/9/sys/dev/acpica X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Mar 2013 10:52:02 -0000 Author: avg Date: Wed Mar 6 10:52:01 2013 New Revision: 247884 URL: http://svnweb.freebsd.org/changeset/base/247884 Log: MFC r246251: acpi: clear power button status bit after waking up Modified: stable/9/sys/dev/acpica/acpi.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) Modified: stable/9/sys/dev/acpica/acpi.c ============================================================================== --- stable/9/sys/dev/acpica/acpi.c Wed Mar 6 10:45:46 2013 (r247883) +++ stable/9/sys/dev/acpica/acpi.c Wed Mar 6 10:52:01 2013 (r247884) @@ -2657,6 +2657,7 @@ acpi_EnterSleepState(struct acpi_softc * { register_t intr; ACPI_STATUS status; + ACPI_EVENT_STATUS power_button_status; enum acpi_sleep_state slp_state; int sleep_result; @@ -2755,6 +2756,30 @@ acpi_EnterSleepState(struct acpi_softc * if (sleep_result == 1 && state != ACPI_STATE_S4) AcpiWriteBitRegister(ACPI_BITREG_SCI_ENABLE, ACPI_ENABLE_EVENT); + + if (sleep_result == 1 && state == ACPI_STATE_S3) { + /* + * Prevent mis-interpretation of the wakeup by power button + * as a request for power off. + * Ideally we should post an appropriate wakeup event, + * perhaps using acpi_event_power_button_wake or alike. + * + * Clearing of power button status after wakeup is mandated + * by ACPI specification in section "Fixed Power Button". + * + * XXX As of ACPICA 20121114 AcpiGetEventStatus provides + * status as 0/1 corressponding to inactive/active despite + * its type being ACPI_EVENT_STATUS. In other words, + * we should not test for ACPI_EVENT_FLAG_SET for time being. + */ + if (ACPI_SUCCESS(AcpiGetEventStatus(ACPI_EVENT_POWER_BUTTON, + &power_button_status)) && power_button_status != 0) { + AcpiClearEvent(ACPI_EVENT_POWER_BUTTON); + device_printf(sc->acpi_dev, + "cleared fixed power button status\n"); + } + } + intr_restore(intr); /* call acpi_wakeup_machdep() again with interrupt enabled */ From owner-svn-src-stable@FreeBSD.ORG Wed Mar 6 11:00:48 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 21ADC292; Wed, 6 Mar 2013 11:00:48 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id EFD7C19C; Wed, 6 Mar 2013 11:00:47 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r26B0lK9082807; Wed, 6 Mar 2013 11:00:47 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r26B0l3x082806; Wed, 6 Mar 2013 11:00:47 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201303061100.r26B0l3x082806@svn.freebsd.org> From: Andriy Gapon Date: Wed, 6 Mar 2013 11:00:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r247885 - stable/8/sys/netgraph X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Mar 2013 11:00:48 -0000 Author: avg Date: Wed Mar 6 11:00:47 2013 New Revision: 247885 URL: http://svnweb.freebsd.org/changeset/base/247885 Log: MFC r246245,246324: ng_ether: track interface renaming Modified: stable/8/sys/netgraph/ng_ether.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/netgraph/ (props changed) Modified: stable/8/sys/netgraph/ng_ether.c ============================================================================== --- stable/8/sys/netgraph/ng_ether.c Wed Mar 6 10:52:01 2013 (r247884) +++ stable/8/sys/netgraph/ng_ether.c Wed Mar 6 11:00:47 2013 (r247885) @@ -115,6 +115,8 @@ static ng_rcvdata_t ng_ether_rcvdata; static ng_disconnect_t ng_ether_disconnect; static int ng_ether_mod_event(module_t mod, int event, void *data); +static eventhandler_tag ng_ether_ifnet_arrival_cookie; + /* List of commands and how to convert arguments to/from ASCII */ static const struct ng_cmdlist ng_ether_cmdlist[] = { { @@ -212,6 +214,24 @@ static struct ng_type ng_ether_typestruc NETGRAPH_INIT(ether, &ng_ether_typestruct); /****************************************************************** + UTILITY FUNCTIONS +******************************************************************/ +static void +ng_ether_sanitize_ifname(const char *ifname, char *name) +{ + int i; + + for (i = 0; i < IFNAMSIZ; i++) { + if (ifname[i] == '.' || ifname[i] == ':') + name[i] = '_'; + else + name[i] = ifname[i]; + if (name[i] == '\0') + break; + } +} + +/****************************************************************** ETHERNET FUNCTION HOOKS ******************************************************************/ @@ -284,6 +304,7 @@ ng_ether_output(struct ifnet *ifp, struc static void ng_ether_attach(struct ifnet *ifp) { + char name[IFNAMSIZ]; priv_p priv; node_p node; @@ -321,10 +342,9 @@ ng_ether_attach(struct ifnet *ifp) priv->hwassist = ifp->if_hwassist; /* Try to give the node the same name as the interface */ - if (ng_name_node(node, ifp->if_xname) != 0) { - log(LOG_WARNING, "%s: can't name node %s\n", - __func__, ifp->if_xname); - } + ng_ether_sanitize_ifname(ifp->if_xname, name); + if (ng_name_node(node, name) != 0) + log(LOG_WARNING, "%s: can't name node %s\n", __func__, name); } /* @@ -380,6 +400,38 @@ ng_ether_link_state(struct ifnet *ifp, i } } +/* + * Interface arrival notification handler. + * The notification is produced in two cases: + * o a new interface arrives + * o an existing interface got renamed + * Currently the first case is handled by ng_ether_attach via special + * hook ng_ether_attach_p. + */ +static void +ng_ether_ifnet_arrival_event(void *arg __unused, struct ifnet *ifp) +{ + char name[IFNAMSIZ]; + node_p node; + + /* Only ethernet interfaces are of interest. */ + if (ifp->if_type != IFT_ETHER + && ifp->if_type != IFT_L2VLAN) + return; + + /* + * Just return if it's a new interface without an ng_ether companion. + */ + node = IFP2NG(ifp); + if (node == NULL) + return; + + /* Try to give the node the same name as the new interface name */ + ng_ether_sanitize_ifname(ifp->if_xname, name); + if (ng_name_node(node, name) != 0) + log(LOG_WARNING, "%s: can't re-name node %s\n", __func__, name); +} + /****************************************************************** NETGRAPH NODE METHODS ******************************************************************/ @@ -779,6 +831,9 @@ ng_ether_mod_event(module_t mod, int eve ng_ether_input_orphan_p = ng_ether_input_orphan; ng_ether_link_state_p = ng_ether_link_state; + ng_ether_ifnet_arrival_cookie = + EVENTHANDLER_REGISTER(ifnet_arrival_event, + ng_ether_ifnet_arrival_event, NULL, EVENTHANDLER_PRI_ANY); break; case MOD_UNLOAD: @@ -791,6 +846,9 @@ ng_ether_mod_event(module_t mod, int eve * is MOD_UNLOAD, so there's no need to detach any nodes. */ + EVENTHANDLER_DEREGISTER(ifnet_arrival_event, + ng_ether_ifnet_arrival_cookie); + /* Unregister function hooks */ ng_ether_attach_p = NULL; ng_ether_detach_p = NULL; From owner-svn-src-stable@FreeBSD.ORG Wed Mar 6 11:02:44 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id B671940D; Wed, 6 Mar 2013 11:02:44 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id A8C131AC; Wed, 6 Mar 2013 11:02:44 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r26B2iPD084597; Wed, 6 Mar 2013 11:02:44 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r26B2iGI084596; Wed, 6 Mar 2013 11:02:44 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201303061102.r26B2iGI084596@svn.freebsd.org> From: Andriy Gapon Date: Wed, 6 Mar 2013 11:02:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r247886 - stable/9/sys/netgraph X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Mar 2013 11:02:44 -0000 Author: avg Date: Wed Mar 6 11:02:44 2013 New Revision: 247886 URL: http://svnweb.freebsd.org/changeset/base/247886 Log: MFC r246245,246324: ng_ether: track interface renaming Modified: stable/9/sys/netgraph/ng_ether.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/netgraph/ng_ether.c ============================================================================== --- stable/9/sys/netgraph/ng_ether.c Wed Mar 6 11:00:47 2013 (r247885) +++ stable/9/sys/netgraph/ng_ether.c Wed Mar 6 11:02:44 2013 (r247886) @@ -117,6 +117,8 @@ static ng_rcvdata_t ng_ether_rcvdata; static ng_disconnect_t ng_ether_disconnect; static int ng_ether_mod_event(module_t mod, int event, void *data); +static eventhandler_tag ng_ether_ifnet_arrival_cookie; + /* List of commands and how to convert arguments to/from ASCII */ static const struct ng_cmdlist ng_ether_cmdlist[] = { { @@ -214,6 +216,24 @@ static struct ng_type ng_ether_typestruc NETGRAPH_INIT(ether, &ng_ether_typestruct); /****************************************************************** + UTILITY FUNCTIONS +******************************************************************/ +static void +ng_ether_sanitize_ifname(const char *ifname, char *name) +{ + int i; + + for (i = 0; i < IFNAMSIZ; i++) { + if (ifname[i] == '.' || ifname[i] == ':') + name[i] = '_'; + else + name[i] = ifname[i]; + if (name[i] == '\0') + break; + } +} + +/****************************************************************** ETHERNET FUNCTION HOOKS ******************************************************************/ @@ -286,6 +306,7 @@ ng_ether_output(struct ifnet *ifp, struc static void ng_ether_attach(struct ifnet *ifp) { + char name[IFNAMSIZ]; priv_p priv; node_p node; @@ -323,10 +344,9 @@ ng_ether_attach(struct ifnet *ifp) priv->hwassist = ifp->if_hwassist; /* Try to give the node the same name as the interface */ - if (ng_name_node(node, ifp->if_xname) != 0) { - log(LOG_WARNING, "%s: can't name node %s\n", - __func__, ifp->if_xname); - } + ng_ether_sanitize_ifname(ifp->if_xname, name); + if (ng_name_node(node, name) != 0) + log(LOG_WARNING, "%s: can't name node %s\n", __func__, name); } /* @@ -382,6 +402,38 @@ ng_ether_link_state(struct ifnet *ifp, i } } +/* + * Interface arrival notification handler. + * The notification is produced in two cases: + * o a new interface arrives + * o an existing interface got renamed + * Currently the first case is handled by ng_ether_attach via special + * hook ng_ether_attach_p. + */ +static void +ng_ether_ifnet_arrival_event(void *arg __unused, struct ifnet *ifp) +{ + char name[IFNAMSIZ]; + node_p node; + + /* Only ethernet interfaces are of interest. */ + if (ifp->if_type != IFT_ETHER + && ifp->if_type != IFT_L2VLAN) + return; + + /* + * Just return if it's a new interface without an ng_ether companion. + */ + node = IFP2NG(ifp); + if (node == NULL) + return; + + /* Try to give the node the same name as the new interface name */ + ng_ether_sanitize_ifname(ifp->if_xname, name); + if (ng_name_node(node, name) != 0) + log(LOG_WARNING, "%s: can't re-name node %s\n", __func__, name); +} + /****************************************************************** NETGRAPH NODE METHODS ******************************************************************/ @@ -777,6 +829,9 @@ ng_ether_mod_event(module_t mod, int eve ng_ether_input_orphan_p = ng_ether_input_orphan; ng_ether_link_state_p = ng_ether_link_state; + ng_ether_ifnet_arrival_cookie = + EVENTHANDLER_REGISTER(ifnet_arrival_event, + ng_ether_ifnet_arrival_event, NULL, EVENTHANDLER_PRI_ANY); break; case MOD_UNLOAD: @@ -789,6 +844,9 @@ ng_ether_mod_event(module_t mod, int eve * is MOD_UNLOAD, so there's no need to detach any nodes. */ + EVENTHANDLER_DEREGISTER(ifnet_arrival_event, + ng_ether_ifnet_arrival_cookie); + /* Unregister function hooks */ ng_ether_attach_p = NULL; ng_ether_detach_p = NULL; From owner-svn-src-stable@FreeBSD.ORG Wed Mar 6 11:08:00 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 769A0921; Wed, 6 Mar 2013 11:08:00 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 5A0EB215; Wed, 6 Mar 2013 11:08:00 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r26B8075085681; Wed, 6 Mar 2013 11:08:00 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r26B7x9m085663; Wed, 6 Mar 2013 11:07:59 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201303061107.r26B7x9m085663@svn.freebsd.org> From: Andriy Gapon Date: Wed, 6 Mar 2013 11:07:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r247887 - stable/9/sys/dev/uart X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Mar 2013 11:08:00 -0000 Author: avg Date: Wed Mar 6 11:07:59 2013 New Revision: 247887 URL: http://svnweb.freebsd.org/changeset/base/247887 Log: MFC r246243: uart: add resume method and enable it for attachments on the most common x86 buses Modified: stable/9/sys/dev/uart/uart_bus.h stable/9/sys/dev/uart/uart_bus_acpi.c stable/9/sys/dev/uart/uart_bus_isa.c stable/9/sys/dev/uart/uart_bus_pci.c stable/9/sys/dev/uart/uart_core.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) Modified: stable/9/sys/dev/uart/uart_bus.h ============================================================================== --- stable/9/sys/dev/uart/uart_bus.h Wed Mar 6 11:02:44 2013 (r247886) +++ stable/9/sys/dev/uart/uart_bus.h Wed Mar 6 11:07:59 2013 (r247887) @@ -137,6 +137,7 @@ extern char uart_driver_name[]; int uart_bus_attach(device_t dev); int uart_bus_detach(device_t dev); +int uart_bus_resume(device_t dev); serdev_intr_t *uart_bus_ihand(device_t dev, int ipend); int uart_bus_ipend(device_t dev); int uart_bus_probe(device_t dev, int regshft, int rclk, int rid, int chan); Modified: stable/9/sys/dev/uart/uart_bus_acpi.c ============================================================================== --- stable/9/sys/dev/uart/uart_bus_acpi.c Wed Mar 6 11:02:44 2013 (r247886) +++ stable/9/sys/dev/uart/uart_bus_acpi.c Wed Mar 6 11:07:59 2013 (r247887) @@ -47,6 +47,7 @@ static device_method_t uart_acpi_methods DEVMETHOD(device_probe, uart_acpi_probe), DEVMETHOD(device_attach, uart_bus_attach), DEVMETHOD(device_detach, uart_bus_detach), + DEVMETHOD(device_resume, uart_bus_resume), { 0, 0 } }; Modified: stable/9/sys/dev/uart/uart_bus_isa.c ============================================================================== --- stable/9/sys/dev/uart/uart_bus_isa.c Wed Mar 6 11:02:44 2013 (r247886) +++ stable/9/sys/dev/uart/uart_bus_isa.c Wed Mar 6 11:07:59 2013 (r247887) @@ -50,6 +50,7 @@ static device_method_t uart_isa_methods[ DEVMETHOD(device_probe, uart_isa_probe), DEVMETHOD(device_attach, uart_bus_attach), DEVMETHOD(device_detach, uart_bus_detach), + DEVMETHOD(device_resume, uart_bus_resume), { 0, 0 } }; Modified: stable/9/sys/dev/uart/uart_bus_pci.c ============================================================================== --- stable/9/sys/dev/uart/uart_bus_pci.c Wed Mar 6 11:02:44 2013 (r247886) +++ stable/9/sys/dev/uart/uart_bus_pci.c Wed Mar 6 11:07:59 2013 (r247887) @@ -51,6 +51,7 @@ static device_method_t uart_pci_methods[ DEVMETHOD(device_probe, uart_pci_probe), DEVMETHOD(device_attach, uart_bus_attach), DEVMETHOD(device_detach, uart_bus_detach), + DEVMETHOD(device_resume, uart_bus_resume), DEVMETHOD_END }; Modified: stable/9/sys/dev/uart/uart_core.c ============================================================================== --- stable/9/sys/dev/uart/uart_core.c Wed Mar 6 11:02:44 2013 (r247886) +++ stable/9/sys/dev/uart/uart_core.c Wed Mar 6 11:07:59 2013 (r247887) @@ -577,3 +577,12 @@ uart_bus_detach(device_t dev) return (0); } + +int +uart_bus_resume(device_t dev) +{ + struct uart_softc *sc; + + sc = device_get_softc(dev); + return (UART_ATTACH(sc)); +} From owner-svn-src-stable@FreeBSD.ORG Wed Mar 6 11:11:03 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 5D795AC6; Wed, 6 Mar 2013 11:11:03 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 36C1B234; Wed, 6 Mar 2013 11:11:03 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r26BB3Xe087885; Wed, 6 Mar 2013 11:11:03 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r26BB3X8087884; Wed, 6 Mar 2013 11:11:03 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201303061111.r26BB3X8087884@svn.freebsd.org> From: Andriy Gapon Date: Wed, 6 Mar 2013 11:11:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r247888 - stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Mar 2013 11:11:03 -0000 Author: avg Date: Wed Mar 6 11:11:02 2013 New Revision: 247888 URL: http://svnweb.freebsd.org/changeset/base/247888 Log: MFC r246532: zfs_vget, zfs_fhtovp: properly handle the z_shares_dir object Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c ============================================================================== --- stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Wed Mar 6 11:07:59 2013 (r247887) +++ stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Wed Mar 6 11:11:02 2013 (r247888) @@ -2010,7 +2010,8 @@ zfs_vget(vfs_t *vfsp, ino_t ino, int fla * .zfs/snapshot/ directories, that's why we return EOPNOTSUPP. * This will make NFS to switch to LOOKUP instead of using VGET. */ - if (ino == ZFSCTL_INO_ROOT || ino == ZFSCTL_INO_SNAPDIR) + if (ino == ZFSCTL_INO_ROOT || ino == ZFSCTL_INO_SNAPDIR || + (zfsvfs->z_shares_dir != 0 && ino == zfsvfs->z_shares_dir)) return (EOPNOTSUPP); ZFS_ENTER(zfsvfs); @@ -2102,14 +2103,22 @@ zfs_fhtovp(vfs_t *vfsp, fid_t *fidp, int return (EINVAL); } - /* A zero fid_gen means we are in the .zfs control directories */ - if (fid_gen == 0 && - (object == ZFSCTL_INO_ROOT || object == ZFSCTL_INO_SNAPDIR)) { + /* + * A zero fid_gen means we are in .zfs or the .zfs/snapshot + * directory tree. If the object == zfsvfs->z_shares_dir, then + * we are in the .zfs/shares directory tree. + */ + if ((fid_gen == 0 && + (object == ZFSCTL_INO_ROOT || object == ZFSCTL_INO_SNAPDIR)) || + (zfsvfs->z_shares_dir != 0 && object == zfsvfs->z_shares_dir)) { *vpp = zfsvfs->z_ctldir; ASSERT(*vpp != NULL); if (object == ZFSCTL_INO_SNAPDIR) { VERIFY(zfsctl_root_lookup(*vpp, "snapshot", vpp, NULL, 0, NULL, NULL, NULL, NULL, NULL) == 0); + } else if (object == zfsvfs->z_shares_dir) { + VERIFY(zfsctl_root_lookup(*vpp, "shares", vpp, NULL, + 0, NULL, NULL, NULL, NULL, NULL) == 0); } else { VN_HOLD(*vpp); } From owner-svn-src-stable@FreeBSD.ORG Wed Mar 6 11:11:19 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 4F667C2C; Wed, 6 Mar 2013 11:11:19 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 28F23239; Wed, 6 Mar 2013 11:11:19 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r26BBJjQ087962; Wed, 6 Mar 2013 11:11:19 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r26BBJ3K087961; Wed, 6 Mar 2013 11:11:19 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201303061111.r26BBJ3K087961@svn.freebsd.org> From: Andriy Gapon Date: Wed, 6 Mar 2013 11:11:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r247889 - stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Mar 2013 11:11:19 -0000 Author: avg Date: Wed Mar 6 11:11:18 2013 New Revision: 247889 URL: http://svnweb.freebsd.org/changeset/base/247889 Log: MFC r246532: zfs_vget, zfs_fhtovp: properly handle the z_shares_dir object Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/cddl/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Wed Mar 6 11:11:02 2013 (r247888) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Wed Mar 6 11:11:18 2013 (r247889) @@ -2018,7 +2018,8 @@ zfs_vget(vfs_t *vfsp, ino_t ino, int fla * .zfs/snapshot/ directories, that's why we return EOPNOTSUPP. * This will make NFS to switch to LOOKUP instead of using VGET. */ - if (ino == ZFSCTL_INO_ROOT || ino == ZFSCTL_INO_SNAPDIR) + if (ino == ZFSCTL_INO_ROOT || ino == ZFSCTL_INO_SNAPDIR || + (zfsvfs->z_shares_dir != 0 && ino == zfsvfs->z_shares_dir)) return (EOPNOTSUPP); ZFS_ENTER(zfsvfs); @@ -2108,14 +2109,22 @@ zfs_fhtovp(vfs_t *vfsp, fid_t *fidp, vno return (EINVAL); } - /* A zero fid_gen means we are in the .zfs control directories */ - if (fid_gen == 0 && - (object == ZFSCTL_INO_ROOT || object == ZFSCTL_INO_SNAPDIR)) { + /* + * A zero fid_gen means we are in .zfs or the .zfs/snapshot + * directory tree. If the object == zfsvfs->z_shares_dir, then + * we are in the .zfs/shares directory tree. + */ + if ((fid_gen == 0 && + (object == ZFSCTL_INO_ROOT || object == ZFSCTL_INO_SNAPDIR)) || + (zfsvfs->z_shares_dir != 0 && object == zfsvfs->z_shares_dir)) { *vpp = zfsvfs->z_ctldir; ASSERT(*vpp != NULL); if (object == ZFSCTL_INO_SNAPDIR) { VERIFY(zfsctl_root_lookup(*vpp, "snapshot", vpp, NULL, 0, NULL, NULL, NULL, NULL, NULL) == 0); + } else if (object == zfsvfs->z_shares_dir) { + VERIFY(zfsctl_root_lookup(*vpp, "shares", vpp, NULL, + 0, NULL, NULL, NULL, NULL, NULL) == 0); } else { VN_HOLD(*vpp); } From owner-svn-src-stable@FreeBSD.ORG Wed Mar 6 13:20:55 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 1033) id 09F558A4; Wed, 6 Mar 2013 13:20:55 +0000 (UTC) Date: Wed, 6 Mar 2013 13:20:55 +0000 From: Alexey Dokuchaev To: Andriy Gapon Subject: Re: svn commit: r247884 - stable/9/sys/dev/acpica Message-ID: <20130306132054.GA48880@FreeBSD.org> References: <201303061052.r26Aq2bM081339@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=koi8-r Content-Disposition: inline In-Reply-To: <201303061052.r26Aq2bM081339@svn.freebsd.org> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-stable@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, svn-src-stable-9@freebsd.org X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Mar 2013 13:20:55 -0000 On Wed, Mar 06, 2013 at 10:52:02AM +0000, Andriy Gapon wrote: > New Revision: 247884 > URL: http://svnweb.freebsd.org/changeset/base/247884 > > Log: > MFC r246251: acpi: clear power button status bit after waking up > > Modified: > stable/9/sys/dev/acpica/acpi.c > Directory Properties: > stable/9/sys/ (props changed) > stable/9/sys/dev/ (props changed) Did you have a chance to review/report back on my earlier email about MFCing it to 8-stable (with a patch)? ./danfe From owner-svn-src-stable@FreeBSD.ORG Wed Mar 6 13:38:09 2013 Return-Path: Delivered-To: svn-src-stable@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id A4514D92; Wed, 6 Mar 2013 13:38:09 +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 3052BAA6; Wed, 6 Mar 2013 13:38:07 +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 PAA07553; Wed, 06 Mar 2013 15:38:06 +0200 (EET) (envelope-from avg@FreeBSD.org) Message-ID: <513746BE.7090102@FreeBSD.org> Date: Wed, 06 Mar 2013 15:38:06 +0200 From: Andriy Gapon User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:17.0) Gecko/20130220 Thunderbird/17.0.3 MIME-Version: 1.0 To: Alexey Dokuchaev Subject: Re: svn commit: r247884 - stable/9/sys/dev/acpica References: <201303061052.r26Aq2bM081339@svn.freebsd.org> <20130306132054.GA48880@FreeBSD.org> In-Reply-To: <20130306132054.GA48880@FreeBSD.org> X-Enigmail-Version: 1.5.1 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: svn-src-stable@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, svn-src-stable-9@FreeBSD.org X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Mar 2013 13:38:09 -0000 on 06/03/2013 15:20 Alexey Dokuchaev said the following: > On Wed, Mar 06, 2013 at 10:52:02AM +0000, Andriy Gapon wrote: >> New Revision: 247884 >> URL: http://svnweb.freebsd.org/changeset/base/247884 >> >> Log: >> MFC r246251: acpi: clear power button status bit after waking up >> >> Modified: >> stable/9/sys/dev/acpica/acpi.c >> Directory Properties: >> stable/9/sys/ (props changed) >> stable/9/sys/dev/ (props changed) > > Did you have a chance to review/report back on my earlier email about MFCing > it to 8-stable (with a patch)? Not yet. The change looked OK, but since the code is so different I need to properly examine the change. -- Andriy Gapon From owner-svn-src-stable@FreeBSD.ORG Wed Mar 6 18:44:46 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 45250A33; Wed, 6 Mar 2013 18:44:46 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 377FDE6A; Wed, 6 Mar 2013 18:44:46 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r26IikMj028229; Wed, 6 Mar 2013 18:44:46 GMT (envelope-from np@svn.freebsd.org) Received: (from np@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r26Iik3M028227; Wed, 6 Mar 2013 18:44:46 GMT (envelope-from np@svn.freebsd.org) Message-Id: <201303061844.r26Iik3M028227@svn.freebsd.org> From: Navdeep Parhar Date: Wed, 6 Mar 2013 18:44:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r247896 - stable/9/tools/tools/cxgbetool X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Mar 2013 18:44:46 -0000 Author: np Date: Wed Mar 6 18:44:45 2013 New Revision: 247896 URL: http://svnweb.freebsd.org/changeset/base/247896 Log: MFC r247854: Fix compile warning by including ctype.h for isdigit(). Modified: stable/9/tools/tools/cxgbetool/cxgbetool.c Directory Properties: stable/9/tools/tools/cxgbetool/ (props changed) Modified: stable/9/tools/tools/cxgbetool/cxgbetool.c ============================================================================== --- stable/9/tools/tools/cxgbetool/cxgbetool.c Wed Mar 6 18:39:40 2013 (r247895) +++ stable/9/tools/tools/cxgbetool/cxgbetool.c Wed Mar 6 18:44:45 2013 (r247896) @@ -31,6 +31,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include From owner-svn-src-stable@FreeBSD.ORG Wed Mar 6 18:45:11 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id E7E59CC0; Wed, 6 Mar 2013 18:45:11 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id DAA37E73; Wed, 6 Mar 2013 18:45:11 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r26IjBSa028355; Wed, 6 Mar 2013 18:45:11 GMT (envelope-from np@svn.freebsd.org) Received: (from np@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r26IjBVv028354; Wed, 6 Mar 2013 18:45:11 GMT (envelope-from np@svn.freebsd.org) Message-Id: <201303061845.r26IjBVv028354@svn.freebsd.org> From: Navdeep Parhar Date: Wed, 6 Mar 2013 18:45:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r247897 - stable/8/tools/tools/cxgbetool X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Mar 2013 18:45:12 -0000 Author: np Date: Wed Mar 6 18:45:11 2013 New Revision: 247897 URL: http://svnweb.freebsd.org/changeset/base/247897 Log: MFC r247854: Fix compile warning by including ctype.h for isdigit(). Modified: stable/8/tools/tools/cxgbetool/cxgbetool.c Directory Properties: stable/8/tools/tools/cxgbetool/ (props changed) Modified: stable/8/tools/tools/cxgbetool/cxgbetool.c ============================================================================== --- stable/8/tools/tools/cxgbetool/cxgbetool.c Wed Mar 6 18:44:45 2013 (r247896) +++ stable/8/tools/tools/cxgbetool/cxgbetool.c Wed Mar 6 18:45:11 2013 (r247897) @@ -31,6 +31,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include From owner-svn-src-stable@FreeBSD.ORG Wed Mar 6 20:02:59 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id E461681E; Wed, 6 Mar 2013 20:02:59 +0000 (UTC) (envelope-from pho@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id D5B45303; Wed, 6 Mar 2013 20:02:59 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r26K2bnk050875; Wed, 6 Mar 2013 20:02:47 GMT (envelope-from pho@svn.freebsd.org) Received: (from pho@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r26K2PrL050857; Wed, 6 Mar 2013 20:02:25 GMT (envelope-from pho@svn.freebsd.org) Message-Id: <201303062002.r26K2PrL050857@svn.freebsd.org> From: Peter Holm Date: Wed, 6 Mar 2013 20:02:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r247900 - stable/9/sbin/tunefs X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Mar 2013 20:03:00 -0000 Author: pho Date: Wed Mar 6 20:02:19 2013 New Revision: 247900 URL: http://svnweb.freebsd.org/changeset/base/247900 Log: MFC r247399: The .journal file needs to reside on the ROOTINO which must not extend beyond direct blocks. A typo caused this check to fail. Modified: stable/9/sbin/tunefs/tunefs.c Directory Properties: stable/9/sbin/tunefs/ (props changed) Modified: stable/9/sbin/tunefs/tunefs.c ============================================================================== --- stable/9/sbin/tunefs/tunefs.c Wed Mar 6 19:59:42 2013 (r247899) +++ stable/9/sbin/tunefs/tunefs.c Wed Mar 6 20:02:19 2013 (r247900) @@ -672,7 +672,7 @@ journal_findfile(void) return (ino); } } else { - if ((off_t)dp1->di_size >= lblktosize(&sblock, NDADDR)) { + if ((off_t)dp2->di_size >= lblktosize(&sblock, NDADDR)) { warnx("ROOTINO extends beyond direct blocks."); return (-1); } From owner-svn-src-stable@FreeBSD.ORG Wed Mar 6 21:30:42 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id BBC7DB7; Wed, 6 Mar 2013 21:30:42 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id ACCB69A2; Wed, 6 Mar 2013 21:30:42 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r26LUgnw073889; Wed, 6 Mar 2013 21:30:42 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r26LUgHn073888; Wed, 6 Mar 2013 21:30:42 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201303062130.r26LUgHn073888@svn.freebsd.org> From: Jilles Tjoelker Date: Wed, 6 Mar 2013 21:30:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r247901 - stable/8/tools/regression/bin/sh/builtins X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Mar 2013 21:30:42 -0000 Author: jilles Date: Wed Mar 6 21:30:42 2013 New Revision: 247901 URL: http://svnweb.freebsd.org/changeset/base/247901 Log: MFC r213713 by obrien: Correct regression test to not show a false positive when run as root. Modified: stable/8/tools/regression/bin/sh/builtins/cd1.0 Directory Properties: stable/8/tools/regression/bin/sh/ (props changed) Modified: stable/8/tools/regression/bin/sh/builtins/cd1.0 ============================================================================== --- stable/8/tools/regression/bin/sh/builtins/cd1.0 Wed Mar 6 20:02:19 2013 (r247900) +++ stable/8/tools/regression/bin/sh/builtins/cd1.0 Wed Mar 6 21:30:42 2013 (r247901) @@ -6,12 +6,15 @@ cd $P T=$(mktemp -d sh-test.XXXXXX) chmod 0 $T -cd -L $T 2>/dev/null && exit 1 -[ "$PWD" = "$P" ] -[ "$(pwd)" = "$P" ] -cd -P $T 2>/dev/null && exit 1 -[ "$PWD" = "$P" ] -[ "$(pwd)" = "$P" ] +if [ `id -u` -ne 0 ]; then + # Root can always cd, irregardless of directory permissions. + cd -L $T 2>/dev/null && exit 1 + [ "$PWD" = "$P" ] + [ "$(pwd)" = "$P" ] + cd -P $T 2>/dev/null && exit 1 + [ "$PWD" = "$P" ] + [ "$(pwd)" = "$P" ] +fi chmod 755 $T cd $T From owner-svn-src-stable@FreeBSD.ORG Wed Mar 6 22:12:45 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id D1C0EE50; Wed, 6 Mar 2013 22:12:45 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id B46E2B59; Wed, 6 Mar 2013 22:12:45 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r26MCjCA086449; Wed, 6 Mar 2013 22:12:45 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r26MCj0v086448; Wed, 6 Mar 2013 22:12:45 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201303062212.r26MCj0v086448@svn.freebsd.org> From: Jilles Tjoelker Date: Wed, 6 Mar 2013 22:12:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r247902 - stable/8/bin/sh X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Mar 2013 22:12:45 -0000 Author: jilles Date: Wed Mar 6 22:12:45 2013 New Revision: 247902 URL: http://svnweb.freebsd.org/changeset/base/247902 Log: MFC r246522: sh: Simplify mksyntax and make it fit for cross-compiling. Now it outputs fixed files, which use constants provided by the C standard library to determine appropriate values for the target machine. Before, mksyntax inspected the host machine which resulted in subtle breakage if e.g. char is signed on the host and unsigned on the target such as when cross-compiling on x86 for ARM. Tested by: ian (this patch) Submitted by: Christoph Mallon (patch for head) Modified: stable/8/bin/sh/mksyntax.c Directory Properties: stable/8/bin/sh/ (props changed) Modified: stable/8/bin/sh/mksyntax.c ============================================================================== --- stable/8/bin/sh/mksyntax.c Wed Mar 6 21:30:42 2013 (r247901) +++ stable/8/bin/sh/mksyntax.c Wed Mar 6 22:12:45 2013 (r247902) @@ -101,23 +101,16 @@ static char writer[] = "\ static FILE *cfile; static FILE *hfile; -static const char *syntax[513]; -static int base; -static int size; /* number of values which a char variable can have */ -static int nbits; /* number of bits in a character */ -static void filltable(const char *); -static void init(void); +static void add_default(void); +static void finish(void); +static void init(const char *); static void add(const char *, const char *); -static void print(const char *); static void output_type_macros(void); int main(int argc __unused, char **argv __unused) { - char c; - char d; - int sign; int i; char buf[80]; int pos; @@ -134,28 +127,9 @@ main(int argc __unused, char **argv __un fputs(writer, hfile); fputs(writer, cfile); - /* Determine the characteristics of chars. */ - c = -1; - sign = (c > 0) ? 0 : 1; - for (nbits = 1 ; ; nbits++) { - d = (1 << nbits) - 1; - if (d == c) - break; - } -#if 0 - printf("%s %d bit chars\n", sign? "signed" : "unsigned", nbits); -#endif - if (nbits > 9) { - fputs("Characters can't have more than 9 bits\n", stderr); - exit(2); - } - size = (1 << nbits) + 1; - base = 1; - if (sign) - base += 1 << (nbits - 1); - fputs("#include \n", hfile); fputs("#include \n", hfile); + fputs("#include \n\n", hfile); /* Generate the #define statements in the header file */ fputs("/* Syntax classes */\n", hfile); @@ -176,8 +150,8 @@ main(int argc __unused, char **argv __un fprintf(hfile, "/* %s */\n", is_entry[i].comment); } putc('\n', hfile); - fprintf(hfile, "#define SYNBASE %d\n", base); - fprintf(hfile, "#define PEOF %d\n\n", -base); + fputs("#define SYNBASE (1 - CHAR_MIN)\n", hfile); + fputs("#define PEOF -SYNBASE\n\n", hfile); putc('\n', hfile); fputs("#define BASESYNTAX (basesyntax + SYNBASE)\n", hfile); fputs("#define DQSYNTAX (dqsyntax + SYNBASE)\n", hfile); @@ -188,10 +162,13 @@ main(int argc __unused, char **argv __un putc('\n', hfile); /* Generate the syntax tables. */ + fputs("#include \"parser.h\"\n", cfile); fputs("#include \"shell.h\"\n", cfile); fputs("#include \"syntax.h\"\n\n", cfile); - init(); + fputs("/* syntax table used when not in quotes */\n", cfile); + init("basesyntax"); + add_default(); add("\n", "CNL"); add("\\", "CBACK"); add("'", "CSQUOTE"); @@ -200,9 +177,11 @@ main(int argc __unused, char **argv __un add("$", "CVAR"); add("}", "CENDVAR"); add("<>();&| \t", "CSPCL"); - print("basesyntax"); - init(); + finish(); + fputs("\n/* syntax table used when in double quotes */\n", cfile); + init("dqsyntax"); + add_default(); add("\n", "CNL"); add("\\", "CBACK"); add("\"", "CENDQUOTE"); @@ -211,16 +190,20 @@ main(int argc __unused, char **argv __un add("}", "CENDVAR"); /* ':/' for tilde expansion, '-' for [a\-x] pattern ranges */ add("!*?[=~:/-", "CCTL"); - print("dqsyntax"); - init(); + finish(); + fputs("\n/* syntax table used when in single quotes */\n", cfile); + init("sqsyntax"); + add_default(); add("\n", "CNL"); add("'", "CENDQUOTE"); /* ':/' for tilde expansion, '-' for [a\-x] pattern ranges */ add("!*?[=~:/-", "CCTL"); - print("sqsyntax"); - init(); + finish(); + fputs("\n/* syntax table used when in arithmetic */\n", cfile); + init("arisyntax"); + add_default(); add("\n", "CNL"); add("\\", "CBACK"); add("`", "CBQUOTE"); @@ -230,99 +213,94 @@ main(int argc __unused, char **argv __un add("}", "CENDVAR"); add("(", "CLP"); add(")", "CRP"); - print("arisyntax"); - filltable("0"); + finish(); + fputs("\n/* character classification table */\n", cfile); + init("is_type"); add("0123456789", "ISDIGIT"); add("abcdefghijklmnopqrstucvwxyz", "ISLOWER"); add("ABCDEFGHIJKLMNOPQRSTUCVWXYZ", "ISUPPER"); add("_", "ISUNDER"); add("#?$!-*@", "ISSPECL"); - print("is_type"); + finish(); + exit(0); } - /* - * Clear the syntax table. + * Output the header and declaration of a syntax table. */ static void -filltable(const char *dftval) +init(const char *name) { - int i; + fprintf(hfile, "extern const char %s[];\n", name); + fprintf(cfile, "const char %s[SYNBASE + CHAR_MAX + 1] = {\n", name); +} + - for (i = 0 ; i < size ; i++) - syntax[i] = dftval; +static void +add_one(const char *key, const char *type) +{ + fprintf(cfile, "\t[SYNBASE + %s] = %s,\n", key, type); } /* - * Initialize the syntax table with default values. + * Add default values to the syntax table. */ static void -init(void) +add_default(void) { - filltable("CWORD"); - syntax[0] = "CEOF"; - syntax[base + CTLESC] = "CCTL"; - syntax[base + CTLVAR] = "CCTL"; - syntax[base + CTLENDVAR] = "CCTL"; - syntax[base + CTLBACKQ] = "CCTL"; - syntax[base + CTLBACKQ + CTLQUOTE] = "CCTL"; - syntax[base + CTLARI] = "CCTL"; - syntax[base + CTLENDARI] = "CCTL"; - syntax[base + CTLQUOTEMARK] = "CCTL"; + add_one("PEOF", "CEOF"); + add_one("CTLESC", "CCTL"); + add_one("CTLVAR", "CCTL"); + add_one("CTLENDVAR", "CCTL"); + add_one("CTLBACKQ", "CCTL"); + add_one("CTLBACKQ + CTLQUOTE", "CCTL"); + add_one("CTLARI", "CCTL"); + add_one("CTLENDARI", "CCTL"); + add_one("CTLQUOTEMARK", "CCTL"); } /* - * Add entries to the syntax table. + * Output the footer of a syntax table. */ static void -add(const char *p, const char *type) +finish(void) { - while (*p) - syntax[*p++ + base] = type; + fputs("};\n", cfile); } - /* - * Output the syntax table. + * Add entries to the syntax table. */ static void -print(const char *name) +add(const char *p, const char *type) { - int i; - int col; - - fprintf(hfile, "extern const char %s[];\n", name); - fprintf(cfile, "const char %s[%d] = {\n", name, size); - col = 0; - for (i = 0 ; i < size ; i++) { - if (i == 0) { - fputs(" ", cfile); - } else if ((i & 03) == 0) { - fputs(",\n ", cfile); - col = 0; - } else { - putc(',', cfile); - while (++col < 9 * (i & 03)) - putc(' ', cfile); + for (; *p; ++p) { + char c = *p; + switch (c) { + case '\t': c = 't'; break; + case '\n': c = 'n'; break; + case '\'': c = '\''; break; + case '\\': c = '\\'; break; + + default: + fprintf(cfile, "\t[SYNBASE + '%c'] = %s,\n", c, type); + continue; } - fputs(syntax[i], cfile); - col += strlen(syntax[i]); + fprintf(cfile, "\t[SYNBASE + '\\%c'] = %s,\n", c, type); } - fputs("\n};\n", cfile); } - /* * Output character classification macros (e.g. is_digit). If digits are * contiguous, we can test for them quickly. From owner-svn-src-stable@FreeBSD.ORG Thu Mar 7 06:53:27 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id B7045476; Thu, 7 Mar 2013 06:53:27 +0000 (UTC) (envelope-from bryanv@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 98ED4289; Thu, 7 Mar 2013 06:53:27 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r276rRsp047303; Thu, 7 Mar 2013 06:53:27 GMT (envelope-from bryanv@svn.freebsd.org) Received: (from bryanv@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r276rQdd047292; Thu, 7 Mar 2013 06:53:26 GMT (envelope-from bryanv@svn.freebsd.org) Message-Id: <201303070653.r276rQdd047292@svn.freebsd.org> From: Bryan Venteicher Date: Thu, 7 Mar 2013 06:53:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r247907 - in stable/8/sys: dev/virtio dev/virtio/balloon dev/virtio/block dev/virtio/network dev/virtio/pci dev/virtio/scsi modules/virtio modules/virtio/scsi X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Mar 2013 06:53:27 -0000 Author: bryanv Date: Thu Mar 7 06:53:25 2013 New Revision: 247907 URL: http://svnweb.freebsd.org/changeset/base/247907 Log: MFC r238072,r238360,r240430,r241469,r241470,r241495,r244136,r244200 Sync VirtIO with HEAD. - r238072: Do not include in the local headers. - r238360: Various VirtIO improvements - r240430: No need to leak these into the includer's namespace. - r241469: virtqueue: Fix non-indirect virtqueues - r241470: Add Virtio SCSI driver - r241495: Fix build with PAE enabled - r244136: Remove duplicated lines - r244200: Start taskqueues threads after attach cannot fail Approved by: grehan (mentor) Added: stable/8/sys/dev/virtio/scsi/ - copied from r241470, head/sys/dev/virtio/scsi/ stable/8/sys/modules/virtio/scsi/ - copied from r241470, head/sys/modules/virtio/scsi/ Modified: stable/8/sys/dev/virtio/balloon/virtio_balloon.c stable/8/sys/dev/virtio/balloon/virtio_balloon.h stable/8/sys/dev/virtio/block/virtio_blk.c stable/8/sys/dev/virtio/block/virtio_blk.h stable/8/sys/dev/virtio/network/if_vtnet.c stable/8/sys/dev/virtio/network/virtio_net.h stable/8/sys/dev/virtio/pci/virtio_pci.c stable/8/sys/dev/virtio/pci/virtio_pci.h stable/8/sys/dev/virtio/scsi/virtio_scsi.c stable/8/sys/dev/virtio/virtio.c stable/8/sys/dev/virtio/virtio.h stable/8/sys/dev/virtio/virtio_ring.h stable/8/sys/dev/virtio/virtqueue.c stable/8/sys/dev/virtio/virtqueue.h stable/8/sys/modules/virtio/Makefile Directory Properties: stable/8/sys/ (props changed) stable/8/sys/dev/ (props changed) stable/8/sys/dev/virtio/ (props changed) stable/8/sys/modules/ (props changed) Modified: stable/8/sys/dev/virtio/balloon/virtio_balloon.c ============================================================================== --- stable/8/sys/dev/virtio/balloon/virtio_balloon.c Thu Mar 7 04:42:20 2013 (r247906) +++ stable/8/sys/dev/virtio/balloon/virtio_balloon.c Thu Mar 7 06:53:25 2013 (r247907) @@ -412,7 +412,6 @@ vtballoon_send_page_frames(struct vtball * interrupt handler will wake us up. */ VTBALLOON_LOCK(sc); - while ((c = virtqueue_dequeue(vq, NULL)) == NULL) msleep_spin(sc, VTBALLOON_MTX(sc), "vtbspf", 0); VTBALLOON_UNLOCK(sc); Modified: stable/8/sys/dev/virtio/balloon/virtio_balloon.h ============================================================================== --- stable/8/sys/dev/virtio/balloon/virtio_balloon.h Thu Mar 7 04:42:20 2013 (r247906) +++ stable/8/sys/dev/virtio/balloon/virtio_balloon.h Thu Mar 7 06:53:25 2013 (r247907) @@ -31,8 +31,6 @@ #ifndef _VIRTIO_BALLOON_H #define _VIRTIO_BALLOON_H -#include - /* Feature bits. */ #define VIRTIO_BALLOON_F_MUST_TELL_HOST 0x1 /* Tell before reclaiming pages */ #define VIRTIO_BALLOON_F_STATS_VQ 0x2 /* Memory stats virtqueue */ Modified: stable/8/sys/dev/virtio/block/virtio_blk.c ============================================================================== --- stable/8/sys/dev/virtio/block/virtio_blk.c Thu Mar 7 04:42:20 2013 (r247906) +++ stable/8/sys/dev/virtio/block/virtio_blk.c Thu Mar 7 06:53:25 2013 (r247907) @@ -42,7 +42,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include @@ -119,7 +118,7 @@ static int vtblk_shutdown(device_t); static int vtblk_open(struct disk *); static int vtblk_close(struct disk *); static int vtblk_ioctl(struct disk *, u_long, void *, int, - struct thread *); + struct thread *); static int vtblk_dump(void *, void *, vm_offset_t, off_t, size_t); static void vtblk_strategy(struct bio *); @@ -193,7 +192,7 @@ TUNABLE_INT("hw.vtblk.no_ident", &vtblk_ mtx_assert(VTBLK_MTX((_sc)), MA_NOTOWNED) #define VTBLK_DISK_NAME "vtbd" -#define VTBLK_QUIESCE_TIMEOUT (30 * hz) +#define VTBLK_QUIESCE_TIMEOUT (30 * hz) /* * Each block request uses at least two segments - one for the header @@ -201,8 +200,6 @@ TUNABLE_INT("hw.vtblk.no_ident", &vtblk_ */ #define VTBLK_MIN_SEGMENTS 2 -static uma_zone_t vtblk_req_zone; - static device_method_t vtblk_methods[] = { /* Device methods. */ DEVMETHOD(device_probe, vtblk_probe), @@ -236,19 +233,8 @@ vtblk_modevent(module_t mod, int type, v switch (type) { case MOD_LOAD: - vtblk_req_zone = uma_zcreate("vtblk_request", - sizeof(struct vtblk_request), - NULL, NULL, NULL, NULL, 0, 0); - break; case MOD_QUIESCE: case MOD_UNLOAD: - if (uma_zone_get_cur(vtblk_req_zone) > 0) - error = EBUSY; - else if (type == MOD_UNLOAD) { - uma_zdestroy(vtblk_req_zone); - vtblk_req_zone = NULL; - } - break; case MOD_SHUTDOWN: break; default: @@ -316,7 +302,7 @@ vtblk_attach(device_t dev) } sc->vtblk_max_nsegs = vtblk_maximum_segments(sc, &blkcfg); - if (sc->vtblk_max_nsegs <= VTBLK_MIN_SEGMENTS) { + if (sc->vtblk_max_nsegs <= VTBLK_MIN_SEGMENTS) { error = EINVAL; device_printf(dev, "fewer than minimum number of segments " "allowed: %d\n", sc->vtblk_max_nsegs); @@ -352,8 +338,6 @@ vtblk_attach(device_t dev) device_printf(dev, "cannot allocate taskqueue\n"); goto fail; } - taskqueue_start_threads(&sc->vtblk_tq, 1, PI_DISK, "%s taskq", - device_get_nameunit(dev)); error = virtio_setup_intr(dev, INTR_TYPE_BIO | INTR_ENTROPY); if (error) { @@ -361,6 +345,9 @@ vtblk_attach(device_t dev) goto fail; } + taskqueue_start_threads(&sc->vtblk_tq, 1, PI_DISK, "%s taskq", + device_get_nameunit(dev)); + vtblk_create_disk(sc); virtqueue_enable_intr(sc->vtblk_vq); @@ -493,7 +480,6 @@ vtblk_dump(void *arg, void *virtual, vm_ int error; dp = arg; - error = 0; if ((sc = dp->d_drv1) == NULL) return (ENXIO); @@ -539,7 +525,7 @@ vtblk_strategy(struct bio *bp) return; } -#ifdef INVARIANTS +#ifdef INVARIANTS /* * Prevent read/write buffers spanning too many segments from * getting into the queue. This should only trip if d_maxsize @@ -547,13 +533,13 @@ vtblk_strategy(struct bio *bp) */ if (bp->bio_cmd == BIO_READ || bp->bio_cmd == BIO_WRITE) { int nsegs, max_nsegs; - + nsegs = sglist_count(bp->bio_data, bp->bio_bcount); max_nsegs = sc->vtblk_max_nsegs - VTBLK_MIN_SEGMENTS; KASSERT(nsegs <= max_nsegs, - ("bio spanned too many segments: %d, max: %d", - nsegs, max_nsegs)); + ("bio %p spanned too many segments: %d, max: %d", + bp, nsegs, max_nsegs)); } #endif @@ -800,27 +786,22 @@ vtblk_execute_request(struct vtblk_softc VTBLK_LOCK_ASSERT(sc); sglist_reset(sg); - error = sglist_append(sg, &req->vbr_hdr, - sizeof(struct virtio_blk_outhdr)); - KASSERT(error == 0, ("error adding header to sglist")); - KASSERT(sg->sg_nseg == 1, - ("header spanned multiple segments: %d", sg->sg_nseg)); + + sglist_append(sg, &req->vbr_hdr, sizeof(struct virtio_blk_outhdr)); if (bp->bio_cmd == BIO_READ || bp->bio_cmd == BIO_WRITE) { error = sglist_append(sg, bp->bio_data, bp->bio_bcount); - KASSERT(error == 0, ("error adding buffer to sglist")); + if (error || sg->sg_nseg == sg->sg_maxseg) + panic("%s: data buffer too big bio:%p error:%d", + __FUNCTION__, bp, error); /* BIO_READ means the host writes into our buffer. */ if (bp->bio_cmd == BIO_READ) - writable += sg->sg_nseg - 1; + writable = sg->sg_nseg - 1; } - error = sglist_append(sg, &req->vbr_ack, sizeof(uint8_t)); - KASSERT(error == 0, ("error adding ack to sglist")); writable++; - - KASSERT(sg->sg_nseg >= VTBLK_MIN_SEGMENTS, - ("fewer than min segments: %d", sg->sg_nseg)); + sglist_append(sg, &req->vbr_ack, sizeof(uint8_t)); readable = sg->sg_nseg - writable; @@ -995,12 +976,10 @@ vtblk_flush_dump(struct vtblk_softc *sc) static int vtblk_poll_request(struct vtblk_softc *sc, struct vtblk_request *req) { - device_t dev; struct virtqueue *vq; struct vtblk_request *r; int error; - dev = sc->vtblk_dev; vq = sc->vtblk_vq; if (!virtqueue_empty(vq)) @@ -1013,12 +992,12 @@ vtblk_poll_request(struct vtblk_softc *s virtqueue_notify(vq); r = virtqueue_poll(vq, NULL); - KASSERT(r == req, ("unexpected request response")); + KASSERT(r == req, ("unexpected request response: %p/%p", r, req)); error = vtblk_request_error(req); if (error && bootverbose) { - device_printf(dev, "vtblk_poll_request: IO error: %d\n", - error); + device_printf(sc->vtblk_dev, + "%s: IO error: %d\n", __FUNCTION__, error); } return (error); @@ -1090,6 +1069,20 @@ vtblk_drain(struct vtblk_softc *sc) vtblk_free_requests(sc); } +#ifdef INVARIANTS +static void +vtblk_request_invariants(struct vtblk_request *req) +{ + int hdr_nsegs, ack_nsegs; + + hdr_nsegs = sglist_count(&req->vbr_hdr, sizeof(req->vbr_hdr)); + ack_nsegs = sglist_count(&req->vbr_ack, sizeof(req->vbr_ack)); + + KASSERT(hdr_nsegs == 1, ("request header crossed page boundary")); + KASSERT(ack_nsegs == 1, ("request ack crossed page boundary")); +} +#endif + static int vtblk_alloc_requests(struct vtblk_softc *sc) { @@ -1107,10 +1100,14 @@ vtblk_alloc_requests(struct vtblk_softc nreqs /= VTBLK_MIN_SEGMENTS; for (i = 0; i < nreqs; i++) { - req = uma_zalloc(vtblk_req_zone, M_NOWAIT); + req = malloc(sizeof(struct vtblk_request), M_DEVBUF, M_NOWAIT); if (req == NULL) return (ENOMEM); +#ifdef INVARIANTS + vtblk_request_invariants(req); +#endif + sc->vtblk_request_count++; vtblk_enqueue_request(sc, req); } @@ -1128,10 +1125,11 @@ vtblk_free_requests(struct vtblk_softc * while ((req = vtblk_dequeue_request(sc)) != NULL) { sc->vtblk_request_count--; - uma_zfree(vtblk_req_zone, req); + free(req, M_DEVBUF); } - KASSERT(sc->vtblk_request_count == 0, ("leaked requests")); + KASSERT(sc->vtblk_request_count == 0, + ("leaked requests: %d", sc->vtblk_request_count)); } static struct vtblk_request * Modified: stable/8/sys/dev/virtio/block/virtio_blk.h ============================================================================== --- stable/8/sys/dev/virtio/block/virtio_blk.h Thu Mar 7 04:42:20 2013 (r247906) +++ stable/8/sys/dev/virtio/block/virtio_blk.h Thu Mar 7 06:53:25 2013 (r247907) @@ -31,8 +31,6 @@ #ifndef _VIRTIO_BLK_H #define _VIRTIO_BLK_H -#include - /* Feature bits */ #define VIRTIO_BLK_F_BARRIER 0x0001 /* Does host support barriers? */ #define VIRTIO_BLK_F_SIZE_MAX 0x0002 /* Indicates maximum segment size */ Modified: stable/8/sys/dev/virtio/network/if_vtnet.c ============================================================================== --- stable/8/sys/dev/virtio/network/if_vtnet.c Thu Mar 7 04:42:20 2013 (r247906) +++ stable/8/sys/dev/virtio/network/if_vtnet.c Thu Mar 7 06:53:25 2013 (r247907) @@ -439,18 +439,17 @@ vtnet_attach(device_t dev) ether_ifdetach(ifp); goto fail; } - taskqueue_start_threads(&sc->vtnet_tq, 1, PI_NET, "%s taskq", - device_get_nameunit(dev)); error = virtio_setup_intr(dev, INTR_TYPE_NET); if (error) { device_printf(dev, "cannot setup virtqueue interrupts\n"); - taskqueue_free(sc->vtnet_tq); - sc->vtnet_tq = NULL; ether_ifdetach(ifp); goto fail; } + taskqueue_start_threads(&sc->vtnet_tq, 1, PI_NET, "%s taskq", + device_get_nameunit(dev)); + /* * Device defaults to promiscuous mode for backwards * compatibility. Turn it off if possible. @@ -748,11 +747,9 @@ vtnet_is_link_up(struct vtnet_softc *sc) static void vtnet_update_link_status(struct vtnet_softc *sc) { - device_t dev; struct ifnet *ifp; int link; - dev = sc->vtnet_dev; ifp = sc->vtnet_ifp; link = vtnet_is_link_up(sc); Modified: stable/8/sys/dev/virtio/network/virtio_net.h ============================================================================== --- stable/8/sys/dev/virtio/network/virtio_net.h Thu Mar 7 04:42:20 2013 (r247906) +++ stable/8/sys/dev/virtio/network/virtio_net.h Thu Mar 7 06:53:25 2013 (r247907) @@ -31,8 +31,6 @@ #ifndef _VIRTIO_NET_H #define _VIRTIO_NET_H -#include - /* The feature bitmap for virtio net */ #define VIRTIO_NET_F_CSUM 0x00001 /* Host handles pkts w/ partial csum */ #define VIRTIO_NET_F_GUEST_CSUM 0x00002 /* Guest handles pkts w/ partial csum*/ Modified: stable/8/sys/dev/virtio/pci/virtio_pci.c ============================================================================== --- stable/8/sys/dev/virtio/pci/virtio_pci.c Thu Mar 7 04:42:20 2013 (r247906) +++ stable/8/sys/dev/virtio/pci/virtio_pci.c Thu Mar 7 06:53:25 2013 (r247907) @@ -57,12 +57,15 @@ struct vtpci_softc { struct resource *vtpci_msix_res; uint64_t vtpci_features; uint32_t vtpci_flags; -#define VIRTIO_PCI_FLAG_NO_MSI 0x0001 -#define VIRTIO_PCI_FLAG_MSI 0x0002 -#define VIRTIO_PCI_FLAG_NO_MSIX 0x0010 -#define VIRTIO_PCI_FLAG_MSIX 0x0020 -#define VIRTIO_PCI_FLAG_SHARED_MSIX 0x0040 +#define VTPCI_FLAG_NO_MSI 0x0001 +#define VTPCI_FLAG_NO_MSIX 0x0002 +#define VTPCI_FLAG_LEGACY 0x1000 +#define VTPCI_FLAG_MSI 0x2000 +#define VTPCI_FLAG_MSIX 0x4000 +#define VTPCI_FLAG_SHARED_MSIX 0x8000 +#define VTPCI_FLAG_ITYPE_MASK 0xF000 + /* This "bus" will only ever have one child. */ device_t vtpci_child_dev; struct virtio_feature_desc *vtpci_child_feat_desc; @@ -80,7 +83,8 @@ struct vtpci_softc { int vtpci_nvqs; struct vtpci_virtqueue { struct virtqueue *vq; - + /* Device did not provide a callback for this virtqueue. */ + int no_intr; /* Index into vtpci_intr_res[] below. Unused, then -1. */ int ires_idx; } vtpci_vqx[VIRTIO_MAX_VIRTQUEUES]; @@ -130,24 +134,39 @@ static void vtpci_describe_features(stru uint64_t); static void vtpci_probe_and_attach_child(struct vtpci_softc *); -static int vtpci_alloc_interrupts(struct vtpci_softc *, int, int, - struct vq_alloc_info *); -static int vtpci_alloc_intr_resources(struct vtpci_softc *, int, - struct vq_alloc_info *); -static int vtpci_alloc_msi(struct vtpci_softc *); -static int vtpci_alloc_msix(struct vtpci_softc *, int); +static int vtpci_alloc_msix(struct vtpci_softc *, int); +static int vtpci_alloc_msi(struct vtpci_softc *); +static int vtpci_alloc_intr_msix_pervq(struct vtpci_softc *); +static int vtpci_alloc_intr_msix_shared(struct vtpci_softc *); +static int vtpci_alloc_intr_msi(struct vtpci_softc *); +static int vtpci_alloc_intr_legacy(struct vtpci_softc *); +static int vtpci_alloc_intr_resources(struct vtpci_softc *); + +static int vtpci_setup_legacy_interrupt(struct vtpci_softc *, + enum intr_type); +static int vtpci_setup_msix_interrupts(struct vtpci_softc *, + enum intr_type); +static int vtpci_setup_interrupts(struct vtpci_softc *, enum intr_type); + static int vtpci_register_msix_vector(struct vtpci_softc *, int, int); +static int vtpci_set_host_msix_vectors(struct vtpci_softc *); +static int vtpci_reinit_virtqueue(struct vtpci_softc *, int); static void vtpci_free_interrupts(struct vtpci_softc *); static void vtpci_free_virtqueues(struct vtpci_softc *); +static void vtpci_cleanup_setup_intr_attempt(struct vtpci_softc *); static void vtpci_release_child_resources(struct vtpci_softc *); static void vtpci_reset(struct vtpci_softc *); +static void vtpci_select_virtqueue(struct vtpci_softc *, int); + static int vtpci_legacy_intr(void *); static int vtpci_vq_shared_intr(void *); static int vtpci_vq_intr(void *); static int vtpci_config_intr(void *); +#define vtpci_setup_msi_interrupt vtpci_setup_legacy_interrupt + /* * I/O port read/write wrappers. */ @@ -252,7 +271,7 @@ vtpci_attach(device_t dev) } if (pci_find_extcap(dev, PCIY_MSI, NULL) != 0) - sc->vtpci_flags |= VIRTIO_PCI_FLAG_NO_MSI; + sc->vtpci_flags |= VTPCI_FLAG_NO_MSI; if (pci_find_extcap(dev, PCIY_MSIX, NULL) == 0) { rid = PCIR_BAR(1); @@ -261,7 +280,7 @@ vtpci_attach(device_t dev) } if (sc->vtpci_msix_res == NULL) - sc->vtpci_flags |= VIRTIO_PCI_FLAG_NO_MSIX; + sc->vtpci_flags |= VTPCI_FLAG_NO_MSIX; vtpci_reset(sc); @@ -372,6 +391,16 @@ vtpci_read_ivar(device_t dev, device_t c switch (index) { case VIRTIO_IVAR_DEVTYPE: + case VIRTIO_IVAR_SUBDEVICE: + *result = pci_get_subdevice(dev); + break; + case VIRTIO_IVAR_VENDOR: + *result = pci_get_vendor(dev); + break; + case VIRTIO_IVAR_DEVICE: + *result = pci_get_device(dev); + break; + case VIRTIO_IVAR_SUBVENDOR: *result = pci_get_subdevice(dev); break; default: @@ -442,102 +471,97 @@ vtpci_alloc_virtqueues(device_t dev, int struct vq_alloc_info *vq_info) { struct vtpci_softc *sc; + struct virtqueue *vq; struct vtpci_virtqueue *vqx; struct vq_alloc_info *info; - int queue, error; - uint16_t vq_size; + int idx, error; + uint16_t size; sc = device_get_softc(dev); + error = 0; - if (sc->vtpci_nvqs != 0 || nvqs <= 0 || - nvqs > VIRTIO_MAX_VIRTQUEUES) + if (sc->vtpci_nvqs != 0) + return (EALREADY); + if (nvqs <= 0 || nvqs > VIRTIO_MAX_VIRTQUEUES) return (EINVAL); - error = vtpci_alloc_interrupts(sc, flags, nvqs, vq_info); - if (error) { - device_printf(dev, "cannot allocate interrupts\n"); - return (error); - } - - if (sc->vtpci_flags & VIRTIO_PCI_FLAG_MSIX) { - error = vtpci_register_msix_vector(sc, - VIRTIO_MSI_CONFIG_VECTOR, 0); - if (error) - return (error); - } + if (flags & VIRTIO_ALLOC_VQS_DISABLE_MSIX) + sc->vtpci_flags |= VTPCI_FLAG_NO_MSIX; - for (queue = 0; queue < nvqs; queue++) { - vqx = &sc->vtpci_vqx[queue]; - info = &vq_info[queue]; - - vtpci_write_config_2(sc, VIRTIO_PCI_QUEUE_SEL, queue); - - vq_size = vtpci_read_config_2(sc, VIRTIO_PCI_QUEUE_NUM); - error = virtqueue_alloc(dev, queue, vq_size, - VIRTIO_PCI_VRING_ALIGN, 0xFFFFFFFFUL, info, &vqx->vq); - if (error) - return (error); - - if (sc->vtpci_flags & VIRTIO_PCI_FLAG_MSIX) { - error = vtpci_register_msix_vector(sc, - VIRTIO_MSI_QUEUE_VECTOR, vqx->ires_idx); - if (error) - return (error); + for (idx = 0; idx < nvqs; idx++) { + vqx = &sc->vtpci_vqx[idx]; + info = &vq_info[idx]; + + vtpci_select_virtqueue(sc, idx); + size = vtpci_read_config_2(sc, VIRTIO_PCI_QUEUE_NUM); + + error = virtqueue_alloc(dev, idx, size, VIRTIO_PCI_VRING_ALIGN, + 0xFFFFFFFFUL, info, &vq); + if (error) { + device_printf(dev, + "cannot allocate virtqueue %d: %d\n", idx, error); + break; } vtpci_write_config_4(sc, VIRTIO_PCI_QUEUE_PFN, - virtqueue_paddr(vqx->vq) >> VIRTIO_PCI_QUEUE_ADDR_SHIFT); + virtqueue_paddr(vq) >> VIRTIO_PCI_QUEUE_ADDR_SHIFT); + + vqx->vq = *info->vqai_vq = vq; + vqx->no_intr = info->vqai_intr == NULL; - *info->vqai_vq = vqx->vq; sc->vtpci_nvqs++; } - return (0); + return (error); } static int vtpci_setup_intr(device_t dev, enum intr_type type) { struct vtpci_softc *sc; - struct vtpci_intr_resource *ires; - struct vtpci_virtqueue *vqx; - int i, flags, error; + int attempt, error; sc = device_get_softc(dev); - flags = type | INTR_MPSAFE; - ires = &sc->vtpci_intr_res[0]; - - if ((sc->vtpci_flags & VIRTIO_PCI_FLAG_MSIX) == 0) { - error = bus_setup_intr(dev, ires->irq, flags, - vtpci_legacy_intr, NULL, sc, &ires->intrhand); - return (error); - } - - error = bus_setup_intr(dev, ires->irq, flags, vtpci_config_intr, - NULL, sc, &ires->intrhand); - if (error) - return (error); + for (attempt = 0; attempt < 5; attempt++) { + /* + * Start with the most desirable interrupt configuration and + * fallback towards less desirable ones. + */ + switch (attempt) { + case 0: + error = vtpci_alloc_intr_msix_pervq(sc); + break; + case 1: + error = vtpci_alloc_intr_msix_shared(sc); + break; + case 2: + error = vtpci_alloc_intr_msi(sc); + break; + case 3: + error = vtpci_alloc_intr_legacy(sc); + break; + default: + device_printf(dev, + "exhausted all interrupt allocation attempts\n"); + return (ENXIO); + } - if (sc->vtpci_flags & VIRTIO_PCI_FLAG_SHARED_MSIX) { - ires = &sc->vtpci_intr_res[1]; - error = bus_setup_intr(dev, ires->irq, flags, - vtpci_vq_shared_intr, NULL, sc, &ires->intrhand); + if (error == 0 && vtpci_setup_interrupts(sc, type) == 0) + break; - return (error); + vtpci_cleanup_setup_intr_attempt(sc); } - /* Setup an interrupt handler for each virtqueue. */ - for (i = 0; i < sc->vtpci_nvqs; i++) { - vqx = &sc->vtpci_vqx[i]; - if (vqx->ires_idx < 1) - continue; - - ires = &sc->vtpci_intr_res[vqx->ires_idx]; - error = bus_setup_intr(dev, ires->irq, flags, - vtpci_vq_intr, NULL, vqx->vq, &ires->intrhand); - if (error) - return (error); + if (bootverbose) { + if (sc->vtpci_flags & VTPCI_FLAG_LEGACY) + device_printf(dev, "using legacy interrupt\n"); + else if (sc->vtpci_flags & VTPCI_FLAG_MSI) + device_printf(dev, "using MSI interrupt\n"); + else if (sc->vtpci_flags & VTPCI_FLAG_SHARED_MSIX) + device_printf(dev, "using shared MSIX interrupts\n"); + else + device_printf(dev, "using per VQ MSIX interrupts\n"); } return (0); @@ -554,20 +578,19 @@ static int vtpci_reinit(device_t dev, uint64_t features) { struct vtpci_softc *sc; - struct vtpci_virtqueue *vqx; - struct virtqueue *vq; - int queue, error; - uint16_t vq_size; + int idx, error; sc = device_get_softc(dev); /* - * Redrive the device initialization. This is a bit of an abuse - * of the specification, but both VirtualBox and QEMU/KVM seem - * to play nice. We do not allow the host device to change from - * what was originally negotiated beyond what the guest driver - * changed (MSIX state should not change, number of virtqueues - * and their size remain the same, etc). + * Redrive the device initialization. This is a bit of an abuse of + * the specification, but VirtualBox, QEMU/KVM, and BHyVe seem to + * play nice. + * + * We do not allow the host device to change from what was originally + * negotiated beyond what the guest driver changed. MSIX state should + * not change, number of virtqueues and their size remain the same, etc. + * This will need to be rethought when we want to support migration. */ if (vtpci_get_status(dev) != VIRTIO_CONFIG_STATUS_RESET) @@ -582,34 +605,16 @@ vtpci_reinit(device_t dev, uint64_t feat vtpci_negotiate_features(dev, features); - if (sc->vtpci_flags & VIRTIO_PCI_FLAG_MSIX) { - error = vtpci_register_msix_vector(sc, - VIRTIO_MSI_CONFIG_VECTOR, 0); + for (idx = 0; idx < sc->vtpci_nvqs; idx++) { + error = vtpci_reinit_virtqueue(sc, idx); if (error) return (error); } - for (queue = 0; queue < sc->vtpci_nvqs; queue++) { - vqx = &sc->vtpci_vqx[queue]; - vq = vqx->vq; - - KASSERT(vq != NULL, ("vq %d not allocated", queue)); - vtpci_write_config_2(sc, VIRTIO_PCI_QUEUE_SEL, queue); - - vq_size = vtpci_read_config_2(sc, VIRTIO_PCI_QUEUE_NUM); - error = virtqueue_reinit(vq, vq_size); + if (sc->vtpci_flags & VTPCI_FLAG_MSIX) { + error = vtpci_set_host_msix_vectors(sc); if (error) return (error); - - if (sc->vtpci_flags & VIRTIO_PCI_FLAG_MSIX) { - error = vtpci_register_msix_vector(sc, - VIRTIO_MSI_QUEUE_VECTOR, vqx->ires_idx); - if (error) - return (error); - } - - vtpci_write_config_4(sc, VIRTIO_PCI_QUEUE_PFN, - virtqueue_paddr(vqx->vq) >> VIRTIO_PCI_QUEUE_ADDR_SHIFT); } return (0); @@ -744,7 +749,6 @@ vtpci_probe_and_attach_child(struct vtpc vtpci_set_status(dev, VIRTIO_CONFIG_STATUS_FAILED); vtpci_reset(sc); vtpci_release_child_resources(sc); - /* Reset status for future attempt. */ vtpci_set_status(dev, VIRTIO_CONFIG_STATUS_ACK); } else @@ -752,42 +756,126 @@ vtpci_probe_and_attach_child(struct vtpc } static int -vtpci_alloc_interrupts(struct vtpci_softc *sc, int flags, int nvqs, - struct vq_alloc_info *vq_info) +vtpci_alloc_msix(struct vtpci_softc *sc, int nvectors) +{ + device_t dev; + int nmsix, cnt, required; + + dev = sc->vtpci_dev; + + /* Allocate an additional vector for the config changes. */ + required = nvectors + 1; + + nmsix = pci_msix_count(dev); + if (nmsix < required) + return (1); + + cnt = required; + if (pci_alloc_msix(dev, &cnt) == 0 && cnt >= required) { + sc->vtpci_nintr_res = required; + return (0); + } + + pci_release_msi(dev); + + return (1); +} + +static int +vtpci_alloc_msi(struct vtpci_softc *sc) +{ + device_t dev; + int nmsi, cnt, required; + + dev = sc->vtpci_dev; + required = 1; + + nmsi = pci_msi_count(dev); + if (nmsi < required) + return (1); + + cnt = required; + if (pci_alloc_msi(dev, &cnt) == 0 && cnt >= required) { + sc->vtpci_nintr_res = required; + return (0); + } + + pci_release_msi(dev); + + return (1); +} + +static int +vtpci_alloc_intr_msix_pervq(struct vtpci_softc *sc) { int i, nvectors, error; - /* - * Only allocate a vector for virtqueues that are actually - * expecting an interrupt. - */ - for (nvectors = 0, i = 0; i < nvqs; i++) - if (vq_info[i].vqai_intr != NULL) + if (vtpci_disable_msix != 0 || + sc->vtpci_flags & VTPCI_FLAG_NO_MSIX) + return (ENOTSUP); + + for (nvectors = 0, i = 0; i < sc->vtpci_nvqs; i++) { + if (sc->vtpci_vqx[i].no_intr == 0) nvectors++; + } + + error = vtpci_alloc_msix(sc, nvectors); + if (error) + return (error); + + sc->vtpci_flags |= VTPCI_FLAG_MSIX; + + return (0); +} + +static int +vtpci_alloc_intr_msix_shared(struct vtpci_softc *sc) +{ + int error; if (vtpci_disable_msix != 0 || - sc->vtpci_flags & VIRTIO_PCI_FLAG_NO_MSIX || - flags & VIRTIO_ALLOC_VQS_DISABLE_MSIX || - vtpci_alloc_msix(sc, nvectors) != 0) { - /* - * Use MSI interrupts if available. Otherwise, we fallback - * to legacy interrupts. - */ - if ((sc->vtpci_flags & VIRTIO_PCI_FLAG_NO_MSI) == 0 && - vtpci_alloc_msi(sc) == 0) - sc->vtpci_flags |= VIRTIO_PCI_FLAG_MSI; + sc->vtpci_flags & VTPCI_FLAG_NO_MSIX) + return (ENOTSUP); - sc->vtpci_nintr_res = 1; - } + error = vtpci_alloc_msix(sc, 1); + if (error) + return (error); - error = vtpci_alloc_intr_resources(sc, nvqs, vq_info); + sc->vtpci_flags |= VTPCI_FLAG_MSIX | VTPCI_FLAG_SHARED_MSIX; - return (error); + return (0); } static int -vtpci_alloc_intr_resources(struct vtpci_softc *sc, int nvqs, - struct vq_alloc_info *vq_info) +vtpci_alloc_intr_msi(struct vtpci_softc *sc) +{ + int error; + + /* Only BHyVe supports MSI. */ + if (sc->vtpci_flags & VTPCI_FLAG_NO_MSI) + return (ENOTSUP); + + error = vtpci_alloc_msi(sc); + if (error) + return (error); + + sc->vtpci_flags |= VTPCI_FLAG_MSI; + + return (0); +} + +static int +vtpci_alloc_intr_legacy(struct vtpci_softc *sc) +{ + + sc->vtpci_flags |= VTPCI_FLAG_LEGACY; + sc->vtpci_nintr_res = 1; + + return (0); +} + +static int +vtpci_alloc_intr_resources(struct vtpci_softc *sc) { device_t dev; struct resource *irq; @@ -795,14 +883,14 @@ vtpci_alloc_intr_resources(struct vtpci_ int i, rid, flags, res_idx; dev = sc->vtpci_dev; - flags = RF_ACTIVE; - if ((sc->vtpci_flags & - (VIRTIO_PCI_FLAG_MSI | VIRTIO_PCI_FLAG_MSIX)) == 0) { + if (sc->vtpci_flags & VTPCI_FLAG_LEGACY) { rid = 0; - flags |= RF_SHAREABLE; - } else + flags = RF_ACTIVE | RF_SHAREABLE; + } else { rid = 1; + flags = RF_ACTIVE; + } for (i = 0; i < sc->vtpci_nintr_res; i++) { irq = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid, flags); @@ -814,16 +902,16 @@ vtpci_alloc_intr_resources(struct vtpci_ } /* - * Map the virtqueue into the correct index in vq_intr_res[]. Note the - * first index is reserved for configuration changes notifications. + * Map the virtqueue into the correct index in vq_intr_res[]. The + * first index is reserved for configuration changed notifications. */ - for (i = 0, res_idx = 1; i < nvqs; i++) { + for (i = 0, res_idx = 1; i < sc->vtpci_nvqs; i++) { vqx = &sc->vtpci_vqx[i]; - if (sc->vtpci_flags & VIRTIO_PCI_FLAG_MSIX) { - if (vq_info[i].vqai_intr == NULL) + if (sc->vtpci_flags & VTPCI_FLAG_MSIX) { + if (vqx->no_intr != 0) vqx->ires_idx = -1; - else if (sc->vtpci_flags & VIRTIO_PCI_FLAG_SHARED_MSIX) + else if (sc->vtpci_flags & VTPCI_FLAG_SHARED_MSIX) vqx->ires_idx = res_idx; else vqx->ires_idx = res_idx++; @@ -835,110 +923,180 @@ vtpci_alloc_intr_resources(struct vtpci_ } static int -vtpci_alloc_msi(struct vtpci_softc *sc) +vtpci_setup_legacy_interrupt(struct vtpci_softc *sc, enum intr_type type) { device_t dev; - int nmsi, cnt; + struct vtpci_intr_resource *ires; + int error; dev = sc->vtpci_dev; - nmsi = pci_msi_count(dev); - - if (nmsi < 1) - return (1); - cnt = 1; - if (pci_alloc_msi(dev, &cnt) == 0 && cnt == 1) - return (0); + ires = &sc->vtpci_intr_res[0]; + error = bus_setup_intr(dev, ires->irq, type, vtpci_legacy_intr, NULL, + sc, &ires->intrhand); - return (1); + return (error); } static int -vtpci_alloc_msix(struct vtpci_softc *sc, int nvectors) +vtpci_setup_msix_interrupts(struct vtpci_softc *sc, enum intr_type type) { device_t dev; - int nmsix, cnt, required; + struct vtpci_intr_resource *ires; + struct vtpci_virtqueue *vqx; + int i, error; dev = sc->vtpci_dev; - nmsix = pci_msix_count(dev); - if (nmsix < 1) - return (1); + /* + * The first resource is used for configuration changed interrupts. + */ + ires = &sc->vtpci_intr_res[0]; + error = bus_setup_intr(dev, ires->irq, type, vtpci_config_intr, + NULL, sc, &ires->intrhand); + if (error) + return (error); - /* An additional vector is needed for the config changes. */ - required = nvectors + 1; - if (nmsix >= required) { - cnt = required; - if (pci_alloc_msix(dev, &cnt) == 0 && cnt >= required) - goto out; + if (sc->vtpci_flags & VTPCI_FLAG_SHARED_MSIX) { + ires = &sc->vtpci_intr_res[1]; - pci_release_msi(dev); + error = bus_setup_intr(dev, ires->irq, type, + vtpci_vq_shared_intr, NULL, sc, &ires->intrhand); + if (error) + return (error); + } else { + /* + * Each remaining resource is assigned to a specific virtqueue. + */ + for (i = 0; i < sc->vtpci_nvqs; i++) { + vqx = &sc->vtpci_vqx[i]; + if (vqx->ires_idx < 1) + continue; + + ires = &sc->vtpci_intr_res[vqx->ires_idx]; + error = bus_setup_intr(dev, ires->irq, type, + vtpci_vq_intr, NULL, vqx->vq, &ires->intrhand); + if (error) + return (error); + } } - /* Attempt shared MSIX configuration. */ - required = 2; - if (nmsix >= required) { - cnt = required; - if (pci_alloc_msix(dev, &cnt) == 0 && cnt >= required) { - sc->vtpci_flags |= VIRTIO_PCI_FLAG_SHARED_MSIX; - goto out; - } + error = vtpci_set_host_msix_vectors(sc); + if (error) + return (error); - pci_release_msi(dev); - } + return (0); +} - return (1); +static int +vtpci_setup_interrupts(struct vtpci_softc *sc, enum intr_type type) +{ + int error; -out: - sc->vtpci_nintr_res = required; - sc->vtpci_flags |= VIRTIO_PCI_FLAG_MSIX; + type |= INTR_MPSAFE; + KASSERT(sc->vtpci_flags & VTPCI_FLAG_ITYPE_MASK, + ("no interrupt type selected: %#x", sc->vtpci_flags)); - if (bootverbose) { - if (sc->vtpci_flags & VIRTIO_PCI_FLAG_SHARED_MSIX) - device_printf(dev, "using shared virtqueue MSIX\n"); - else - device_printf(dev, "using per virtqueue MSIX\n"); - } + error = vtpci_alloc_intr_resources(sc); + if (error) + return (error); - return (0); + if (sc->vtpci_flags & VTPCI_FLAG_LEGACY) + error = vtpci_setup_legacy_interrupt(sc, type); + else if (sc->vtpci_flags & VTPCI_FLAG_MSI) + error = vtpci_setup_msi_interrupt(sc, type); + else + error = vtpci_setup_msix_interrupts(sc, type); + + return (error); } static int *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable@FreeBSD.ORG Thu Mar 7 07:02:33 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 5B344841; Thu, 7 Mar 2013 07:02:33 +0000 (UTC) (envelope-from bryanv@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 3E1E02FA; Thu, 7 Mar 2013 07:02:33 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2772Xgu050342; Thu, 7 Mar 2013 07:02:33 GMT (envelope-from bryanv@svn.freebsd.org) Received: (from bryanv@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2772WqR050333; Thu, 7 Mar 2013 07:02:32 GMT (envelope-from bryanv@svn.freebsd.org) Message-Id: <201303070702.r2772WqR050333@svn.freebsd.org> From: Bryan Venteicher Date: Thu, 7 Mar 2013 07:02:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r247908 - stable/8/share/man/man4 X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Mar 2013 07:02:33 -0000 Author: bryanv Date: Thu Mar 7 07:02:31 2013 New Revision: 247908 URL: http://svnweb.freebsd.org/changeset/base/247908 Log: MFC r227652,r230450,r230461,r241470 Include/update the VirtIO man pages. -r227652: Initial import -r230450: General cleanup -r230461: Connect VirtIO-related manpages to the build -r241470: Virtio SCSI driver man page Approved by: grehan (mentor) Added: stable/8/share/man/man4/virtio.4 - copied, changed from r227652, head/share/man/man4/virtio.4 stable/8/share/man/man4/virtio_balloon.4 - copied, changed from r227652, head/share/man/man4/virtio_balloon.4 stable/8/share/man/man4/virtio_blk.4 - copied, changed from r227652, head/share/man/man4/virtio_blk.4 stable/8/share/man/man4/virtio_scsi.4 - copied unchanged from r241470, head/share/man/man4/virtio_scsi.4 stable/8/share/man/man4/vtnet.4 - copied, changed from r227652, head/share/man/man4/vtnet.4 Modified: stable/8/share/man/man4/Makefile Directory Properties: stable/8/share/man/man4/ (props changed) Modified: stable/8/share/man/man4/Makefile ============================================================================== --- stable/8/share/man/man4/Makefile Thu Mar 7 06:53:25 2013 (r247907) +++ stable/8/share/man/man4/Makefile Thu Mar 7 07:02:31 2013 (r247908) @@ -490,11 +490,16 @@ MAN= aac.4 \ viapm.4 \ ${_viawd.4} \ vinum.4 \ + ${_virtio.4} \ + ${_virtio_balloon.4} \ + ${_virtio_blk.4} \ + ${_virtio_scsi.4} \ vkbd.4 \ vlan.4 \ vpo.4 \ vr.4 \ vte.4 \ + ${_vtnet.4} \ watchdog.4 \ wb.4 \ wi.4 \ @@ -642,6 +647,7 @@ MLINKS+=vge.4 if_vge.4 MLINKS+=vlan.4 if_vlan.4 MLINKS+=vpo.4 imm.4 MLINKS+=vr.4 if_vr.4 +MLINKS+=${_vtnet.4} ${_if_vtnet.4} MLINKS+=watchdog.4 SW_WATCHDOG.4 MLINKS+=wb.4 if_wb.4 MLINKS+=wi.4 if_wi.4 @@ -680,6 +686,7 @@ _if_nfe.4= if_nfe.4 _if_nve.4= if_nve.4 _if_nxge.4= if_nxge.4 _if_urtw.4= if_urtw.4 +_if_vtnet.4= if_vtnet.4 _if_wpi.4= if_wpi.4 _ipmi.4= ipmi.4 _io.4= io.4 @@ -691,6 +698,11 @@ _nfsmb.4= nfsmb.4 _nve.4= nve.4 _nvram.4= nvram.4 _nxge.4= nxge.4 +_virtio.4= virtio.4 +_virtio_balloon.4=virtio_balloon.4 +_virtio_blk.4= virtio_blk.4 +_virtio_scsi.4= virtio_scsi.4 +_vtnet.4= vtnet.4 _padlock.4= padlock.4 _rr232x.4= rr232x.4 _speaker.4= speaker.4 Copied and modified: stable/8/share/man/man4/virtio.4 (from r227652, head/share/man/man4/virtio.4) ============================================================================== --- head/share/man/man4/virtio.4 Fri Nov 18 05:43:43 2011 (r227652, copy source) +++ stable/8/share/man/man4/virtio.4 Thu Mar 7 07:02:31 2013 (r247908) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 4, 2011 +.Dd January 22, 2012 .Dt VIRTIO 4 .Os .Sh NAME @@ -48,29 +48,34 @@ virtio_pci_load="YES" .Sh DESCRIPTION VirtIO is a specification for para-virtualized I/O in a virtual machine (VM). Traditionally, the hypervisor emulated real devices such as an Ethernet -interface or disk controller to provide the VM with I/O. This emulation is -often inefficient. +interface or disk controller to provide the VM with I/O. +This emulation is often inefficient. .Pp VirtIO defines an interface for efficient I/O between the hypervisor and VM. -The -.Xr virtio 4 +The +.Xr virtio 4 module provides a shared memory transport called a virtqueue. The .Xr virtio_pci 4 device driver represents an emulated PCI device that the hypervisor makes -available to the VM. This device provides the probing, configuration, and -interrupt notifications need to interact with the hypervisor. +available to the VM. +This device provides the probing, configuration, and +interrupt notifications needed to interact with the hypervisor. .Fx supports the following VirtIO devices: .Bl -hang -offset indent -width xxxxxxxx .It Nm Ethernet An emulated Ethernet device is provided by the -.Xr if_vtnet 4 +.Xr vtnet 4 device driver. .It Nm Block An emulated disk controller is provided by the .Xr virtio_blk 4 device driver. +.It Nm SCSI +An emulated SCSI HBA is provided by the +.Xr virtio_scsi 4 +device driver. .It Nm Balloon A pseudo-device to allow the VM to release memory back to the hypervisor is provided by the @@ -78,9 +83,10 @@ provided by the device driver. .El .Sh SEE ALSO -.Xr if_vtnet 4 , +.Xr virtio_balloon 4 , .Xr virtio_blk 4 , -.Xr virtio_balloon 4 +.Xr virtio_scsi 4 , +.Xr vtnet 4 .Sh HISTORY Support for VirtIO first appeared in .Fx 9.0 . Copied and modified: stable/8/share/man/man4/virtio_balloon.4 (from r227652, head/share/man/man4/virtio_balloon.4) ============================================================================== --- head/share/man/man4/virtio_balloon.4 Fri Nov 18 05:43:43 2011 (r227652, copy source) +++ stable/8/share/man/man4/virtio_balloon.4 Thu Mar 7 07:02:31 2013 (r247908) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 4, 2011 +.Dd January 22, 2012 .Dt VIRTIO_BALLOON 4 .Os .Sh NAME @@ -51,8 +51,8 @@ device driver provides support for VirtI .Pp The memory balloon allows the guest to, at the request of the hypervisor, return memory allocated to the hypervisor so it can -be made available to other guests. The hypervisor can later -signal the balloon to return the memory. +be made available to other guests. +The hypervisor can later signal the balloon to return the memory. .Sh SEE ALSO .Xr virtio 4 .Sh HISTORY Copied and modified: stable/8/share/man/man4/virtio_blk.4 (from r227652, head/share/man/man4/virtio_blk.4) ============================================================================== --- head/share/man/man4/virtio_blk.4 Fri Nov 18 05:43:43 2011 (r227652, copy source) +++ stable/8/share/man/man4/virtio_blk.4 Thu Mar 7 07:02:31 2013 (r247908) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 4, 2011 +.Dd January 22, 2012 .Dt VIRTIO_BLK 4 .Os .Sh NAME @@ -48,7 +48,6 @@ virtio_blk_load="YES" The .Nm device driver provides support for VirtIO block devices. -.Pp .Sh LOADER TUNABLES Tunables can be set at the .Xr loader 8 @@ -57,7 +56,8 @@ prompt before booting the kernel or stor .Bl -tag -width "xxxxxx" .It Va hw.vtblk.no_ident This tunable disables retrieving the device identification string -from the hypervisor. The default value is 0. +from the hypervisor. +The default value is 0. .El .Sh SEE ALSO .Xr virtio 4 Copied: stable/8/share/man/man4/virtio_scsi.4 (from r241470, head/share/man/man4/virtio_scsi.4) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/8/share/man/man4/virtio_scsi.4 Thu Mar 7 07:02:31 2013 (r247908, copy of r241470, head/share/man/man4/virtio_scsi.4) @@ -0,0 +1,92 @@ +.\" Copyright (c) 2012 Bryan Venteicher +.\" 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 24, 2012 +.Dt VIRTIO_SCSI 4 +.Os +.Sh NAME +.Nm virtio_scsi +.Nd VirtIO SCSI 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 virtio_scsi" +.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 +virtio_scsi_load="YES" +.Ed +.Sh DESCRIPTION +The +.Nm +device driver provides support for VirtIO SCSI devices. +.Sh LOADER TUNABLES +Tunables can be set at the +.Xr loader 8 +prompt before booting the kernel or stored in +.Xr loader.conf 5 . +.Bl -tag -width "xxxxxx" +.It Va hw.vtscsi.bus_reset_disable +In the initial QEMU release with VirtIO SCSI support, in-flight +operations were not aborted when stopping the device, rendering +bus reset ineffective. This tunable disables attempts to issue +reset bus commands. The default value is 1. +.El +.Sh DEBUGGING +To enable debugging prints from the +.Nm +driver, set the +.Bd -literal -offset indent +hw.vtscsi.X.debug_level +.Ed +.Pp +variable, where X is the adapter number, either in +.Xr loader.conf 5 +or via +.Xr sysctl 8 . +The following bits have the described effects: +.Bl -tag -width 6n -offset indent +.It 0x01 +Enable informational prints. +.It 0x02 +Enable prints for driver errors. +.It 0x04 +Enable tracing prints. +.El +.Sh SEE ALSO +.Xr virtio 4 +.Sh HISTORY +The +.Nm +driver was written by +.An Bryan Venteicher Aq bryanv@daemoninthecloset.org . +It first appeared in +.Fx 10.0 . Copied and modified: stable/8/share/man/man4/vtnet.4 (from r227652, head/share/man/man4/vtnet.4) ============================================================================== --- head/share/man/man4/vtnet.4 Fri Nov 18 05:43:43 2011 (r227652, copy source) +++ stable/8/share/man/man4/vtnet.4 Thu Mar 7 07:02:31 2013 (r247908) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 4, 2011 +.Dd January 22, 2012 .Dt VTNET 4 .Os .Sh NAME @@ -62,7 +62,6 @@ utility configures the adapter to receiv .Pp For more information on configuring this device, see .Xr ifconfig 8 . -.El .Sh LOADER TUNABLES Tunables can be set at the .Xr loader 8 @@ -70,19 +69,21 @@ prompt before booting the kernel or stor .Xr loader.conf 5 . .Bl -tag -width "xxxxxx" .It Va hw.vtnet.csum_disable -This tunable disables receive and send checksum offload. The default -value is 0. +This tunable disables receive and send checksum offload. +The default value is 0. .It Va hw.vtnet.tso_disable -This tunable disables TSO. The default value is 0. +This tunable disables TSO. +The default value is 0. .It Va hw.vtnet.lro_disable -This tunable disables LRO. The default value is 0. +This tunable disables LRO. +The default value is 0. .El .Sh SEE ALSO .Xr arp 4 , .Xr netintro 4 , .Xr ng_ether 4 , -.Xr vlan 4 , .Xr virtio 4 , +.Xr vlan 4 , .Xr ifconfig 8 .Sh HISTORY The From owner-svn-src-stable@FreeBSD.ORG Thu Mar 7 07:28:07 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 83BDFCBB; Thu, 7 Mar 2013 07:28:07 +0000 (UTC) (envelope-from bryanv@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 671153E7; Thu, 7 Mar 2013 07:28:07 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r277S7MG057252; Thu, 7 Mar 2013 07:28:07 GMT (envelope-from bryanv@svn.freebsd.org) Received: (from bryanv@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r277S69a057240; Thu, 7 Mar 2013 07:28:06 GMT (envelope-from bryanv@svn.freebsd.org) Message-Id: <201303070728.r277S69a057240@svn.freebsd.org> From: Bryan Venteicher Date: Thu, 7 Mar 2013 07:28:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r247909 - in stable/8/sys: amd64/conf conf i386/conf X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Mar 2013 07:28:07 -0000 Author: bryanv Date: Thu Mar 7 07:28:05 2013 New Revision: 247909 URL: http://svnweb.freebsd.org/changeset/base/247909 Log: MFC r245362 Add VirtIO to i386 and amd64 GENERIC Approved by: grehan (mentor) Modified: stable/8/sys/amd64/conf/GENERIC stable/8/sys/amd64/conf/NOTES stable/8/sys/conf/files.amd64 stable/8/sys/conf/files.i386 stable/8/sys/i386/conf/GENERIC stable/8/sys/i386/conf/NOTES Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/ (props changed) stable/8/sys/conf/ (props changed) stable/8/sys/i386/ (props changed) Modified: stable/8/sys/amd64/conf/GENERIC ============================================================================== --- stable/8/sys/amd64/conf/GENERIC Thu Mar 7 07:02:31 2013 (r247908) +++ stable/8/sys/amd64/conf/GENERIC Thu Mar 7 07:28:05 2013 (r247909) @@ -331,3 +331,11 @@ device fwe # Ethernet over FireWire (n device fwip # IP over FireWire (RFC 2734,3146) device dcons # Dumb console driver device dcons_crom # Configuration ROM for dcons + +# VirtIO support +device virtio # Generic VirtIO bus (required) +device virtio_pci # VirtIO PCI device +device vtnet # VirtIO Ethernet device +device virtio_blk # VirtIO Block device +device virtio_scsi # VirtIO SCSI device +device virtio_balloon # VirtIO Memory Balloon device Modified: stable/8/sys/amd64/conf/NOTES ============================================================================== --- stable/8/sys/amd64/conf/NOTES Thu Mar 7 07:02:31 2013 (r247908) +++ stable/8/sys/amd64/conf/NOTES Thu Mar 7 07:28:05 2013 (r247909) @@ -422,6 +422,15 @@ device safe # SafeNet 1141 options SAFE_DEBUG # enable debugging support: hw.safe.debug options SAFE_RNDTEST # enable rndtest support +# +# VirtIO support +device virtio # Generic VirtIO bus (required) +device virtio_pci # VirtIO PCI Interface +device vtnet # VirtIO Ethernet device +device virtio_blk # VirtIO Block device +device virtio_scsi # VirtIO SCSI device +device virtio_balloon # VirtIO Memory Balloon device + ##################################################################### # Modified: stable/8/sys/conf/files.amd64 ============================================================================== --- stable/8/sys/conf/files.amd64 Thu Mar 7 07:02:31 2013 (r247908) +++ stable/8/sys/conf/files.amd64 Thu Mar 7 07:28:05 2013 (r247909) @@ -353,6 +353,15 @@ dev/isci/scil/scif_sas_task_request.c dev/isci/scil/scif_sas_task_request_state_handlers.c optional isci dev/isci/scil/scif_sas_task_request_states.c optional isci dev/isci/scil/scif_sas_timer.c optional isci +dev/virtio/virtio.c optional virtio +dev/virtio/virtqueue.c optional virtio +dev/virtio/virtio_bus_if.m optional virtio +dev/virtio/virtio_if.m optional virtio +dev/virtio/pci/virtio_pci.c optional virtio_pci virtio pci +dev/virtio/network/if_vtnet.c optional vtnet virtio +dev/virtio/block/virtio_blk.c optional virtio_blk virtio +dev/virtio/balloon/virtio_balloon.c optional virtio_balloon virtio +dev/virtio/scsi/virtio_scsi.c optional virtio_scsi virtio scbus isa/syscons_isa.c optional sc isa/vga_isa.c optional vga kern/link_elf_obj.c standard Modified: stable/8/sys/conf/files.i386 ============================================================================== --- stable/8/sys/conf/files.i386 Thu Mar 7 07:02:31 2013 (r247908) +++ stable/8/sys/conf/files.i386 Thu Mar 7 07:28:05 2013 (r247909) @@ -358,6 +358,15 @@ dev/isci/scil/scif_sas_task_request.c dev/isci/scil/scif_sas_task_request_state_handlers.c optional isci dev/isci/scil/scif_sas_task_request_states.c optional isci dev/isci/scil/scif_sas_timer.c optional isci +dev/virtio/virtio.c optional virtio +dev/virtio/virtqueue.c optional virtio +dev/virtio/virtio_bus_if.m optional virtio +dev/virtio/virtio_if.m optional virtio +dev/virtio/pci/virtio_pci.c optional virtio_pci virtio pci +dev/virtio/network/if_vtnet.c optional vtnet virtio +dev/virtio/block/virtio_blk.c optional virtio_blk virtio +dev/virtio/balloon/virtio_balloon.c optional virtio_balloon virtio +dev/virtio/scsi/virtio_scsi.c optional virtio_scsi virtio scbus i386/acpica/OsdEnvironment.c optional acpi i386/acpica/acpi_machdep.c optional acpi i386/acpica/acpi_wakeup.c optional acpi Modified: stable/8/sys/i386/conf/GENERIC ============================================================================== --- stable/8/sys/i386/conf/GENERIC Thu Mar 7 07:02:31 2013 (r247908) +++ stable/8/sys/i386/conf/GENERIC Thu Mar 7 07:28:05 2013 (r247909) @@ -345,3 +345,11 @@ device fwe # Ethernet over FireWire (n device fwip # IP over FireWire (RFC 2734,3146) device dcons # Dumb console driver device dcons_crom # Configuration ROM for dcons + +# VirtIO support +device virtio # Generic VirtIO bus (required) +device virtio_pci # VirtIO PCI device +device vtnet # VirtIO Ethernet device +device virtio_blk # VirtIO Block device +device virtio_scsi # VirtIO SCSI device +device virtio_balloon # VirtIO Memory Balloon device Modified: stable/8/sys/i386/conf/NOTES ============================================================================== --- stable/8/sys/i386/conf/NOTES Thu Mar 7 07:02:31 2013 (r247908) +++ stable/8/sys/i386/conf/NOTES Thu Mar 7 07:28:05 2013 (r247909) @@ -764,6 +764,15 @@ options SAFE_RNDTEST # enable rndtest s # device glxsb # AMD Geode LX Security Block +# +# VirtIO support +device virtio # Generic VirtIO bus (required) +device virtio_pci # VirtIO PCI Interface +device vtnet # VirtIO Ethernet device +device virtio_blk # VirtIO Block device +device virtio_scsi # VirtIO SCSI device +device virtio_balloon # VirtIO Memory Balloon device + ##################################################################### # From owner-svn-src-stable@FreeBSD.ORG Thu Mar 7 19:27:19 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id A90E074F; Thu, 7 Mar 2013 19:27:19 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 8DB42E3D; Thu, 7 Mar 2013 19:27:19 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r27JRJhh077178; Thu, 7 Mar 2013 19:27:19 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r27JRHwV077165; Thu, 7 Mar 2013 19:27:17 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201303071927.r27JRHwV077165@svn.freebsd.org> From: Michael Tuexen Date: Thu, 7 Mar 2013 19:27:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r247920 - in stable/8/sys: netinet netinet6 X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Mar 2013 19:27:19 -0000 Author: tuexen Date: Thu Mar 7 19:27:17 2013 New Revision: 247920 URL: http://svnweb.freebsd.org/changeset/base/247920 Log: MFC r235360: Provide in the association change notification the received ABORT chunk if case of SCTP_COMM_LOST or SCTP_CANT_STR_ASSOC as required by RFC 6458. Modified: stable/8/sys/netinet/sctp_asconf.c stable/8/sys/netinet/sctp_indata.c stable/8/sys/netinet/sctp_input.c stable/8/sys/netinet/sctp_output.c stable/8/sys/netinet/sctp_pcb.c stable/8/sys/netinet/sctp_timer.c stable/8/sys/netinet/sctp_usrreq.c stable/8/sys/netinet/sctputil.c stable/8/sys/netinet/sctputil.h stable/8/sys/netinet6/sctp6_usrreq.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/netinet/ (props changed) stable/8/sys/netinet6/ (props changed) Modified: stable/8/sys/netinet/sctp_asconf.c ============================================================================== --- stable/8/sys/netinet/sctp_asconf.c Thu Mar 7 19:00:00 2013 (r247919) +++ stable/8/sys/netinet/sctp_asconf.c Thu Mar 7 19:27:17 2013 (r247920) @@ -1789,8 +1789,7 @@ sctp_handle_asconf_ack(struct mbuf *m, i */ if (serial_num == (asoc->asconf_seq_out + 1)) { SCTPDBG(SCTP_DEBUG_ASCONF1, "handle_asconf_ack: got unexpected next serial number! Aborting asoc!\n"); - sctp_abort_an_association(stcb->sctp_ep, stcb, - SCTP_CAUSE_ILLEGAL_ASCONF_ACK, NULL, SCTP_SO_NOT_LOCKED); + sctp_abort_an_association(stcb->sctp_ep, stcb, NULL, SCTP_SO_NOT_LOCKED); *abort_no_unlock = 1; return; } Modified: stable/8/sys/netinet/sctp_indata.c ============================================================================== --- stable/8/sys/netinet/sctp_indata.c Thu Mar 7 19:00:00 2013 (r247919) +++ stable/8/sys/netinet/sctp_indata.c Thu Mar 7 19:27:17 2013 (r247920) @@ -607,9 +607,7 @@ protocol_error: *ippp = ((control->sinfo_stream << 16) | control->sinfo_ssn); } stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_1; - sctp_abort_an_association(stcb->sctp_ep, stcb, - SCTP_PEER_FAULTY, oper, SCTP_SO_NOT_LOCKED); - + sctp_abort_an_association(stcb->sctp_ep, stcb, oper, SCTP_SO_NOT_LOCKED); *abort_flag = 1; return; @@ -892,8 +890,7 @@ sctp_queue_data_for_reasm(struct sctp_tc } stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_2; - sctp_abort_an_association(stcb->sctp_ep, stcb, - SCTP_PEER_FAULTY, oper, SCTP_SO_NOT_LOCKED); + sctp_abort_an_association(stcb->sctp_ep, stcb, oper, SCTP_SO_NOT_LOCKED); *abort_flag = 1; } else if (asoc->fragmented_delivery_inprogress && (chk->rec.data.rcv_flags & SCTP_DATA_FIRST_FRAG) == SCTP_DATA_FIRST_FRAG) { @@ -924,8 +921,7 @@ sctp_queue_data_for_reasm(struct sctp_tc *ippp = ((chk->rec.data.stream_number << 16) | chk->rec.data.stream_seq); } stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_3; - sctp_abort_an_association(stcb->sctp_ep, stcb, - SCTP_PEER_FAULTY, oper, SCTP_SO_NOT_LOCKED); + sctp_abort_an_association(stcb->sctp_ep, stcb, oper, SCTP_SO_NOT_LOCKED); *abort_flag = 1; } else if (asoc->fragmented_delivery_inprogress) { /* @@ -961,8 +957,7 @@ sctp_queue_data_for_reasm(struct sctp_tc *ippp = ((chk->rec.data.stream_number << 16) | chk->rec.data.stream_seq); } stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_4; - sctp_abort_an_association(stcb->sctp_ep, - stcb, SCTP_PEER_FAULTY, oper, SCTP_SO_NOT_LOCKED); + sctp_abort_an_association(stcb->sctp_ep, stcb, oper, SCTP_SO_NOT_LOCKED); *abort_flag = 1; } else if ((asoc->fragment_flags & SCTP_DATA_UNORDERED) != SCTP_DATA_UNORDERED && @@ -995,8 +990,7 @@ sctp_queue_data_for_reasm(struct sctp_tc } stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_5; - sctp_abort_an_association(stcb->sctp_ep, - stcb, SCTP_PEER_FAULTY, oper, SCTP_SO_NOT_LOCKED); + sctp_abort_an_association(stcb->sctp_ep, stcb, oper, SCTP_SO_NOT_LOCKED); *abort_flag = 1; } } @@ -1090,8 +1084,7 @@ sctp_queue_data_for_reasm(struct sctp_tc } stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_6; - sctp_abort_an_association(stcb->sctp_ep, - stcb, SCTP_PEER_FAULTY, oper, SCTP_SO_NOT_LOCKED); + sctp_abort_an_association(stcb->sctp_ep, stcb, oper, SCTP_SO_NOT_LOCKED); *abort_flag = 1; return; } @@ -1127,9 +1120,7 @@ sctp_queue_data_for_reasm(struct sctp_tc *ippp = ((chk->rec.data.stream_number << 16) | chk->rec.data.stream_seq); } stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_7; - sctp_abort_an_association(stcb->sctp_ep, - stcb, SCTP_PEER_FAULTY, oper, SCTP_SO_NOT_LOCKED); - + sctp_abort_an_association(stcb->sctp_ep, stcb, oper, SCTP_SO_NOT_LOCKED); *abort_flag = 1; return; } @@ -1166,9 +1157,7 @@ sctp_queue_data_for_reasm(struct sctp_tc *ippp = ((chk->rec.data.stream_number << 16) | chk->rec.data.stream_seq); } stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_8; - sctp_abort_an_association(stcb->sctp_ep, - stcb, SCTP_PEER_FAULTY, oper, SCTP_SO_NOT_LOCKED); - + sctp_abort_an_association(stcb->sctp_ep, stcb, oper, SCTP_SO_NOT_LOCKED); *abort_flag = 1; return; } @@ -1202,9 +1191,7 @@ sctp_queue_data_for_reasm(struct sctp_tc } stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_9; - sctp_abort_an_association(stcb->sctp_ep, - stcb, SCTP_PEER_FAULTY, oper, SCTP_SO_NOT_LOCKED); - + sctp_abort_an_association(stcb->sctp_ep, stcb, oper, SCTP_SO_NOT_LOCKED); *abort_flag = 1; return; } @@ -1247,9 +1234,7 @@ sctp_queue_data_for_reasm(struct sctp_tc *ippp = ((chk->rec.data.stream_number << 16) | chk->rec.data.stream_seq); } stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_10; - sctp_abort_an_association(stcb->sctp_ep, - stcb, SCTP_PEER_FAULTY, oper, SCTP_SO_NOT_LOCKED); - + sctp_abort_an_association(stcb->sctp_ep, stcb, oper, SCTP_SO_NOT_LOCKED); *abort_flag = 1; return; } @@ -1289,9 +1274,7 @@ sctp_queue_data_for_reasm(struct sctp_tc } stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_11; - sctp_abort_an_association(stcb->sctp_ep, - stcb, SCTP_PEER_FAULTY, oper, SCTP_SO_NOT_LOCKED); - + sctp_abort_an_association(stcb->sctp_ep, stcb, oper, SCTP_SO_NOT_LOCKED); *abort_flag = 1; return; } @@ -1328,9 +1311,7 @@ sctp_queue_data_for_reasm(struct sctp_tc } stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_12; - sctp_abort_an_association(stcb->sctp_ep, - stcb, SCTP_PEER_FAULTY, oper, SCTP_SO_NOT_LOCKED); - + sctp_abort_an_association(stcb->sctp_ep, stcb, oper, SCTP_SO_NOT_LOCKED); *abort_flag = 1; return; } @@ -1367,9 +1348,7 @@ sctp_queue_data_for_reasm(struct sctp_tc *ippp = ((chk->rec.data.stream_number << 16) | chk->rec.data.stream_seq); } stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_13; - sctp_abort_an_association(stcb->sctp_ep, - stcb, SCTP_PEER_FAULTY, oper, SCTP_SO_NOT_LOCKED); - + sctp_abort_an_association(stcb->sctp_ep, stcb, oper, SCTP_SO_NOT_LOCKED); *abort_flag = 1; return; } @@ -1531,7 +1510,7 @@ sctp_process_a_data_chunk(struct sctp_tc struct mbuf *op_err; op_err = sctp_generate_invmanparam(SCTP_CAUSE_OUT_OF_RESC); - sctp_abort_an_association(stcb->sctp_ep, stcb, 0, op_err, SCTP_SO_NOT_LOCKED); + sctp_abort_an_association(stcb->sctp_ep, stcb, op_err, SCTP_SO_NOT_LOCKED); *abort_flag = 1; return (0); } @@ -1678,8 +1657,7 @@ sctp_process_a_data_chunk(struct sctp_tc } stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_14; - sctp_abort_an_association(stcb->sctp_ep, stcb, - SCTP_PEER_FAULTY, oper, SCTP_SO_NOT_LOCKED); + sctp_abort_an_association(stcb->sctp_ep, stcb, oper, SCTP_SO_NOT_LOCKED); *abort_flag = 1; return (0); } @@ -1942,9 +1920,7 @@ failed_pdapi_express_del: *ippp = ((strmno << 16) | strmseq); } stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_15; - sctp_abort_an_association(stcb->sctp_ep, stcb, - SCTP_PEER_FAULTY, oper, SCTP_SO_NOT_LOCKED); - + sctp_abort_an_association(stcb->sctp_ep, stcb, oper, SCTP_SO_NOT_LOCKED); *abort_flag = 1; return (0); } else { @@ -1980,9 +1956,7 @@ failed_pdapi_express_del: *ippp = ((strmno << 16) | strmseq); } stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_16; - sctp_abort_an_association(stcb->sctp_ep, - stcb, SCTP_PEER_FAULTY, oper, SCTP_SO_NOT_LOCKED); - + sctp_abort_an_association(stcb->sctp_ep, stcb, oper, SCTP_SO_NOT_LOCKED); *abort_flag = 1; return (0); } @@ -2027,9 +2001,7 @@ failed_pdapi_express_del: *ippp = ((strmno << 16) | strmseq); } stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_17; - sctp_abort_an_association(stcb->sctp_ep, - stcb, SCTP_PEER_FAULTY, oper, SCTP_SO_NOT_LOCKED); - + sctp_abort_an_association(stcb->sctp_ep, stcb, oper, SCTP_SO_NOT_LOCKED); *abort_flag = 1; return (0); } @@ -3878,7 +3850,7 @@ sctp_express_handle_sack(struct sctp_tcb *ippp = htonl(SCTP_FROM_SCTP_INDATA + SCTP_LOC_25); } stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_25; - sctp_abort_an_association(stcb->sctp_ep, stcb, SCTP_PEER_FAULTY, oper, SCTP_SO_NOT_LOCKED); + sctp_abort_an_association(stcb->sctp_ep, stcb, oper, SCTP_SO_NOT_LOCKED); return; #endif } @@ -4240,7 +4212,7 @@ again: *ippp = htonl(SCTP_FROM_SCTP_INDATA + SCTP_LOC_24); } stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_24; - sctp_abort_an_association(stcb->sctp_ep, stcb, SCTP_RESPONSE_TO_USER_REQ, oper, SCTP_SO_NOT_LOCKED); + sctp_abort_an_association(stcb->sctp_ep, stcb, oper, SCTP_SO_NOT_LOCKED); } else { struct sctp_nets *netp; @@ -4463,7 +4435,7 @@ sctp_handle_sack(struct mbuf *m, int off *ippp = htonl(SCTP_FROM_SCTP_INDATA + SCTP_LOC_25); } stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_25; - sctp_abort_an_association(stcb->sctp_ep, stcb, SCTP_PEER_FAULTY, oper, SCTP_SO_NOT_LOCKED); + sctp_abort_an_association(stcb->sctp_ep, stcb, oper, SCTP_SO_NOT_LOCKED); return; } } @@ -4966,7 +4938,7 @@ sctp_handle_sack(struct mbuf *m, int off *ippp = htonl(SCTP_FROM_SCTP_INDATA + SCTP_LOC_31); } stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_31; - sctp_abort_an_association(stcb->sctp_ep, stcb, SCTP_RESPONSE_TO_USER_REQ, oper, SCTP_SO_NOT_LOCKED); + sctp_abort_an_association(stcb->sctp_ep, stcb, oper, SCTP_SO_NOT_LOCKED); return; } else { struct sctp_nets *netp; @@ -5421,8 +5393,7 @@ sctp_handle_forward_tsn(struct sctp_tcb *ippp = new_cum_tsn; } stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_33; - sctp_abort_an_association(stcb->sctp_ep, stcb, - SCTP_PEER_FAULTY, oper, SCTP_SO_NOT_LOCKED); + sctp_abort_an_association(stcb->sctp_ep, stcb, oper, SCTP_SO_NOT_LOCKED); return; } SCTP_STAT_INCR(sctps_fwdtsn_map_over); Modified: stable/8/sys/netinet/sctp_input.c ============================================================================== --- stable/8/sys/netinet/sctp_input.c Thu Mar 7 19:00:00 2013 (r247919) +++ stable/8/sys/netinet/sctp_input.c Thu Mar 7 19:27:17 2013 (r247920) @@ -428,7 +428,7 @@ sctp_process_init_ack(struct mbuf *m, in &abort_flag, (struct sctp_chunkhdr *)cp, &nat_friendly); if (abort_flag) { /* Send an abort and notify peer */ - sctp_abort_an_association(stcb->sctp_ep, stcb, SCTP_CAUSE_PROTOCOL_VIOLATION, op_err, SCTP_SO_NOT_LOCKED); + sctp_abort_an_association(stcb->sctp_ep, stcb, op_err, SCTP_SO_NOT_LOCKED); *abort_no_unlock = 1; return (-1); } @@ -739,7 +739,7 @@ sctp_handle_nat_missing_state(struct sct static void -sctp_handle_abort(struct sctp_abort_chunk *cp, +sctp_handle_abort(struct sctp_abort_chunk *abort, struct sctp_tcb *stcb, struct sctp_nets *net) { #if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING) @@ -747,43 +747,42 @@ sctp_handle_abort(struct sctp_abort_chun #endif uint16_t len; + uint16_t error; SCTPDBG(SCTP_DEBUG_INPUT2, "sctp_handle_abort: handling ABORT\n"); if (stcb == NULL) return; - len = ntohs(cp->ch.chunk_length); + len = ntohs(abort->ch.chunk_length); if (len > sizeof(struct sctp_chunkhdr)) { /* * Need to check the cause codes for our two magic nat * aborts which don't kill the assoc necessarily. */ - struct sctp_abort_chunk *cpnext; struct sctp_missing_nat_state *natc; - uint16_t cause; - cpnext = cp; - cpnext++; - natc = (struct sctp_missing_nat_state *)cpnext; - cause = ntohs(natc->cause); - if (cause == SCTP_CAUSE_NAT_COLLIDING_STATE) { + natc = (struct sctp_missing_nat_state *)(abort + 1); + error = ntohs(natc->cause); + if (error == SCTP_CAUSE_NAT_COLLIDING_STATE) { SCTPDBG(SCTP_DEBUG_INPUT2, "Received Colliding state abort flags:%x\n", - cp->ch.chunk_flags); + abort->ch.chunk_flags); if (sctp_handle_nat_colliding_state(stcb)) { return; } - } else if (cause == SCTP_CAUSE_NAT_MISSING_STATE) { + } else if (error == SCTP_CAUSE_NAT_MISSING_STATE) { SCTPDBG(SCTP_DEBUG_INPUT2, "Received missing state abort flags:%x\n", - cp->ch.chunk_flags); + abort->ch.chunk_flags); if (sctp_handle_nat_missing_state(stcb, net)) { return; } } + } else { + error = 0; } /* stop any receive timers */ sctp_timer_stop(SCTP_TIMER_TYPE_RECV, stcb->sctp_ep, stcb, net, SCTP_FROM_SCTP_INPUT + SCTP_LOC_6); /* notify user of the abort and clean up... */ - sctp_abort_notification(stcb, 0, SCTP_SO_NOT_LOCKED); + sctp_abort_notification(stcb, error, abort, SCTP_SO_NOT_LOCKED); /* free the tcb */ SCTP_STAT_INCR_COUNTER32(sctps_aborted); if ((SCTP_GET_STATE(&stcb->asoc) == SCTP_STATE_OPEN) || @@ -1174,7 +1173,7 @@ sctp_handle_error(struct sctp_chunkhdr * asoc->stale_cookie_count++; if (asoc->stale_cookie_count > asoc->max_init_times) { - sctp_abort_notification(stcb, 0, SCTP_SO_NOT_LOCKED); + sctp_abort_notification(stcb, 0, NULL, SCTP_SO_NOT_LOCKED); /* now free the asoc */ #if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING) so = SCTP_INP_SO(stcb->sctp_ep); Modified: stable/8/sys/netinet/sctp_output.c ============================================================================== --- stable/8/sys/netinet/sctp_output.c Thu Mar 7 19:00:00 2013 (r247919) +++ stable/8/sys/netinet/sctp_output.c Thu Mar 7 19:27:17 2013 (r247920) @@ -6573,9 +6573,7 @@ sctp_sendall_iterator(struct sctp_inpcb * dis-appearing on us. */ atomic_add_int(&stcb->asoc.refcnt, 1); - sctp_abort_an_association(inp, stcb, - SCTP_RESPONSE_TO_USER_REQ, - m, SCTP_SO_NOT_LOCKED); + sctp_abort_an_association(inp, stcb, m, SCTP_SO_NOT_LOCKED); /* * sctp_abort_an_association calls sctp_free_asoc() * free association will NOT free it since we @@ -6669,7 +6667,6 @@ sctp_sendall_iterator(struct sctp_inpcb abort_anyway: atomic_add_int(&stcb->asoc.refcnt, 1); sctp_abort_an_association(stcb->sctp_ep, stcb, - SCTP_RESPONSE_TO_USER_REQ, NULL, SCTP_SO_NOT_LOCKED); atomic_add_int(&stcb->asoc.refcnt, -1); goto no_chunk_output; @@ -9504,7 +9501,7 @@ sctp_chunk_retransmission(struct sctp_in chk->snd_count, SCTP_BASE_SYSCTL(sctp_max_retran_chunk)); atomic_add_int(&stcb->asoc.refcnt, 1); - sctp_abort_an_association(stcb->sctp_ep, stcb, 0, NULL, so_locked); + sctp_abort_an_association(stcb->sctp_ep, stcb, NULL, so_locked); SCTP_TCB_LOCK(stcb); atomic_subtract_int(&stcb->asoc.refcnt, 1); return (SCTP_RETRAN_EXIT); @@ -13138,9 +13135,7 @@ sctp_lower_sosend(struct socket *so, atomic_add_int(&stcb->asoc.refcnt, -1); free_cnt_applied = 0; /* release this lock, otherwise we hang on ourselves */ - sctp_abort_an_association(stcb->sctp_ep, stcb, - SCTP_RESPONSE_TO_USER_REQ, - mm, SCTP_SO_LOCKED); + sctp_abort_an_association(stcb->sctp_ep, stcb, mm, SCTP_SO_LOCKED); /* now relock the stcb so everything is sane */ hold_tcblock = 0; stcb = NULL; @@ -13695,7 +13690,6 @@ dataless_eof: free_cnt_applied = 0; } sctp_abort_an_association(stcb->sctp_ep, stcb, - SCTP_RESPONSE_TO_USER_REQ, NULL, SCTP_SO_LOCKED); /* * now relock the stcb so everything Modified: stable/8/sys/netinet/sctp_pcb.c ============================================================================== --- stable/8/sys/netinet/sctp_pcb.c Thu Mar 7 19:00:00 2013 (r247919) +++ stable/8/sys/netinet/sctp_pcb.c Thu Mar 7 19:27:17 2013 (r247920) @@ -6344,7 +6344,7 @@ sctp_load_addresses_from_init(struct sct * abort this guy */ sctp_abort_an_association(stcb_tmp->sctp_ep, - stcb_tmp, 1, NULL, 0); + stcb_tmp, NULL, SCTP_SO_NOT_LOCKED); goto add_it_now; } SCTP_TCB_UNLOCK(stcb_tmp); @@ -6435,7 +6435,7 @@ sctp_load_addresses_from_init(struct sct * abort this guy */ sctp_abort_an_association(stcb_tmp->sctp_ep, - stcb_tmp, 1, NULL, 0); + stcb_tmp, NULL, SCTP_SO_NOT_LOCKED); goto add_it_now6; } SCTP_TCB_UNLOCK(stcb_tmp); Modified: stable/8/sys/netinet/sctp_timer.c ============================================================================== --- stable/8/sys/netinet/sctp_timer.c Thu Mar 7 19:00:00 2013 (r247919) +++ stable/8/sys/netinet/sctp_timer.c Thu Mar 7 19:27:17 2013 (r247920) @@ -167,7 +167,7 @@ sctp_threshold_management(struct sctp_in *ippp = htonl(SCTP_FROM_SCTP_TIMER + SCTP_LOC_1); } inp->last_abort_code = SCTP_FROM_SCTP_TIMER + SCTP_LOC_1; - sctp_abort_an_association(inp, stcb, SCTP_FAILED_THRESHOLD, oper, SCTP_SO_NOT_LOCKED); + sctp_abort_an_association(inp, stcb, oper, SCTP_SO_NOT_LOCKED); return (1); } return (0); @@ -1066,8 +1066,7 @@ sctp_cookie_timer(struct sctp_inpcb *inp *ippp = htonl(SCTP_FROM_SCTP_TIMER + SCTP_LOC_3); } inp->last_abort_code = SCTP_FROM_SCTP_TIMER + SCTP_LOC_4; - sctp_abort_an_association(inp, stcb, SCTP_INTERNAL_ERROR, - oper, SCTP_SO_NOT_LOCKED); + sctp_abort_an_association(inp, stcb, oper, SCTP_SO_NOT_LOCKED); } else { #ifdef INVARIANTS panic("Cookie timer expires in wrong state?"); Modified: stable/8/sys/netinet/sctp_usrreq.c ============================================================================== --- stable/8/sys/netinet/sctp_usrreq.c Thu Mar 7 19:00:00 2013 (r247919) +++ stable/8/sys/netinet/sctp_usrreq.c Thu Mar 7 19:27:17 2013 (r247920) @@ -229,11 +229,9 @@ sctp_notify(struct sctp_inpcb *inp, struct socket *so; #endif - /* protection */ - int reason; struct icmp *icmph; - + /* protection */ if ((inp == NULL) || (stcb == NULL) || (net == NULL) || (sh == NULL) || (to == NULL)) { if (stcb) @@ -285,8 +283,7 @@ sctp_notify(struct sctp_inpcb *inp, * now is dead. In either case treat it like a OOTB abort * with no TCB */ - reason = SCTP_PEER_FAULTY; - sctp_abort_notification(stcb, reason, SCTP_SO_NOT_LOCKED); + sctp_abort_notification(stcb, 0, NULL, SCTP_SO_NOT_LOCKED); #if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING) so = SCTP_INP_SO(inp); atomic_add_int(&stcb->asoc.refcnt, 1); @@ -1098,7 +1095,6 @@ sctp_shutdown(struct socket *so) } stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_USRREQ + SCTP_LOC_6; sctp_abort_an_association(stcb->sctp_ep, stcb, - SCTP_RESPONSE_TO_USER_REQ, op_err, SCTP_SO_LOCKED); goto skip_unlock; } else { Modified: stable/8/sys/netinet/sctputil.c ============================================================================== --- stable/8/sys/netinet/sctputil.c Thu Mar 7 19:00:00 2013 (r247919) +++ stable/8/sys/netinet/sctputil.c Thu Mar 7 19:27:17 2013 (r247920) @@ -1725,8 +1725,7 @@ sctp_timeout_handler(void *t) break; } SCTP_STAT_INCR(sctps_timoshutdownguard); - sctp_abort_an_association(inp, stcb, - SCTP_SHUTDOWN_GUARD_EXPIRES, NULL, SCTP_SO_NOT_LOCKED); + sctp_abort_an_association(inp, stcb, NULL, SCTP_SO_NOT_LOCKED); /* no need to unlock on tcb its gone */ goto out_decr; @@ -2593,7 +2592,7 @@ sctp_pad_lastmbuf(struct mbuf *m, int pa static void sctp_notify_assoc_change(uint16_t state, struct sctp_tcb *stcb, - uint16_t error, int so_locked + uint16_t error, struct sctp_abort_chunk *abort, int so_locked #if !defined(__APPLE__) && !defined(SCTP_SO_LOCK_TESTING) SCTP_UNUSED #endif @@ -2602,7 +2601,7 @@ sctp_notify_assoc_change(uint16_t state, struct mbuf *m_notify; struct sctp_assoc_change *sac; struct sctp_queued_to_read *control; - size_t len; + size_t notif_len, abort_len; unsigned int i; #if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING) @@ -2652,16 +2651,27 @@ sctp_notify_assoc_change(uint16_t state, /* event not enabled */ return; } - len = sizeof(struct sctp_assoc_change); + notif_len = sizeof(struct sctp_assoc_change); + if (abort != NULL) { + abort_len = htons(abort->ch.chunk_length); + } else { + abort_len = 0; + } if ((state == SCTP_COMM_UP) || (state == SCTP_RESTART)) { - len += SCTP_ASSOC_SUPPORTS_MAX; + notif_len += SCTP_ASSOC_SUPPORTS_MAX; + } else if ((state == SCTP_COMM_LOST) || (state == SCTP_CANT_STR_ASSOC)) { + notif_len += abort_len; } - m_notify = sctp_get_mbuf_for_msg(len, 0, M_DONTWAIT, 1, MT_DATA); - if (m_notify == NULL) - /* no space left */ - return; - SCTP_BUF_LEN(m_notify) = 0; - + m_notify = sctp_get_mbuf_for_msg(notif_len, 0, M_DONTWAIT, 1, MT_DATA); + if (m_notify == NULL) { + /* Retry with smaller value. */ + notif_len = sizeof(struct sctp_assoc_change); + m_notify = sctp_get_mbuf_for_msg(notif_len, 0, M_DONTWAIT, 1, MT_DATA); + if (m_notify == NULL) { + return; + } + } + SCTP_BUF_NEXT(m_notify) = NULL; sac = mtod(m_notify, struct sctp_assoc_change *); sac->sac_type = SCTP_ASSOC_CHANGE; sac->sac_flags = 0; @@ -2672,25 +2682,29 @@ sctp_notify_assoc_change(uint16_t state, sac->sac_outbound_streams = stcb->asoc.streamoutcnt; sac->sac_inbound_streams = stcb->asoc.streamincnt; sac->sac_assoc_id = sctp_get_associd(stcb); - if ((state == SCTP_COMM_UP) || (state == SCTP_RESTART)) { - i = 0; - if (stcb->asoc.peer_supports_prsctp) { - sac->sac_info[i++] = SCTP_ASSOC_SUPPORTS_PR; - } - if (stcb->asoc.peer_supports_auth) { - sac->sac_info[i++] = SCTP_ASSOC_SUPPORTS_AUTH; + if (notif_len > sizeof(struct sctp_assoc_change)) { + if ((state == SCTP_COMM_UP) || (state == SCTP_RESTART)) { + i = 0; + if (stcb->asoc.peer_supports_prsctp) { + sac->sac_info[i++] = SCTP_ASSOC_SUPPORTS_PR; + } + if (stcb->asoc.peer_supports_auth) { + sac->sac_info[i++] = SCTP_ASSOC_SUPPORTS_AUTH; + } + if (stcb->asoc.peer_supports_asconf) { + sac->sac_info[i++] = SCTP_ASSOC_SUPPORTS_ASCONF; + } + sac->sac_info[i++] = SCTP_ASSOC_SUPPORTS_MULTIBUF; + if (stcb->asoc.peer_supports_strreset) { + sac->sac_info[i++] = SCTP_ASSOC_SUPPORTS_RE_CONFIG; + } + sac->sac_length += i; + } else if ((state == SCTP_COMM_LOST) || (state == SCTP_CANT_STR_ASSOC)) { + memcpy(sac->sac_info, abort, abort_len); + sac->sac_length += abort_len; } - if (stcb->asoc.peer_supports_asconf) { - sac->sac_info[i++] = SCTP_ASSOC_SUPPORTS_ASCONF; - } - sac->sac_info[i++] = SCTP_ASSOC_SUPPORTS_MULTIBUF; - if (stcb->asoc.peer_supports_strreset) { - sac->sac_info[i++] = SCTP_ASSOC_SUPPORTS_RE_CONFIG; - } - sac->sac_length += i; } SCTP_BUF_LEN(m_notify) = sac->sac_length; - SCTP_BUF_NEXT(m_notify) = NULL; control = sctp_build_readq_entry(stcb, stcb->asoc.primary_destination, 0, 0, stcb->asoc.context, 0, 0, 0, m_notify); @@ -3500,7 +3514,7 @@ sctp_ulp_notify(uint32_t notification, s switch (notification) { case SCTP_NOTIFY_ASSOC_UP: if (stcb->asoc.assoc_up_sent == 0) { - sctp_notify_assoc_change(SCTP_COMM_UP, stcb, error, so_locked); + sctp_notify_assoc_change(SCTP_COMM_UP, stcb, error, NULL, so_locked); stcb->asoc.assoc_up_sent = 1; } if (stcb->asoc.adaptation_needed && (stcb->asoc.adaptation_sent == 0)) { @@ -3512,7 +3526,7 @@ sctp_ulp_notify(uint32_t notification, s } break; case SCTP_NOTIFY_ASSOC_DOWN: - sctp_notify_assoc_change(SCTP_SHUTDOWN_COMP, stcb, error, so_locked); + sctp_notify_assoc_change(SCTP_SHUTDOWN_COMP, stcb, error, NULL, so_locked); break; case SCTP_NOTIFY_INTERFACE_DOWN: { @@ -3563,9 +3577,9 @@ sctp_ulp_notify(uint32_t notification, s case SCTP_NOTIFY_ASSOC_ABORTED: if ((stcb) && (((stcb->asoc.state & SCTP_STATE_MASK) == SCTP_STATE_COOKIE_WAIT) || ((stcb->asoc.state & SCTP_STATE_MASK) == SCTP_STATE_COOKIE_ECHOED))) { - sctp_notify_assoc_change(SCTP_CANT_STR_ASSOC, stcb, error, so_locked); + sctp_notify_assoc_change(SCTP_CANT_STR_ASSOC, stcb, error, data, so_locked); } else { - sctp_notify_assoc_change(SCTP_COMM_LOST, stcb, error, so_locked); + sctp_notify_assoc_change(SCTP_COMM_LOST, stcb, error, data, so_locked); } break; case SCTP_NOTIFY_PEER_OPENED_STREAM: @@ -3573,7 +3587,7 @@ sctp_ulp_notify(uint32_t notification, s case SCTP_NOTIFY_STREAM_OPENED_OK: break; case SCTP_NOTIFY_ASSOC_RESTART: - sctp_notify_assoc_change(SCTP_RESTART, stcb, error, so_locked); + sctp_notify_assoc_change(SCTP_RESTART, stcb, error, NULL, so_locked); if (stcb->asoc.peer_supports_auth == 0) { sctp_ulp_notify(SCTP_NOTIFY_NO_PEER_AUTH, stcb, 0, NULL, so_locked); @@ -3742,7 +3756,8 @@ sctp_report_all_outbound(struct sctp_tcb } void -sctp_abort_notification(struct sctp_tcb *stcb, int error, int so_locked +sctp_abort_notification(struct sctp_tcb *stcb, uint16_t error, + struct sctp_abort_chunk *abort, int so_locked #if !defined(__APPLE__) && !defined(SCTP_SO_LOCK_TESTING) SCTP_UNUSED #endif @@ -3763,7 +3778,7 @@ sctp_abort_notification(struct sctp_tcb } /* Tell them we lost the asoc */ sctp_report_all_outbound(stcb, 1, so_locked); - sctp_ulp_notify(SCTP_NOTIFY_ASSOC_ABORTED, stcb, error, NULL, so_locked); + sctp_ulp_notify(SCTP_NOTIFY_ASSOC_ABORTED, stcb, error, abort, so_locked); } void @@ -3782,7 +3797,7 @@ sctp_abort_association(struct sctp_inpcb if (stcb != NULL) { /* We have a TCB to abort, send notification too */ vtag = stcb->asoc.peer_vtag; - sctp_abort_notification(stcb, 0, SCTP_SO_NOT_LOCKED); + sctp_abort_notification(stcb, 0, NULL, SCTP_SO_NOT_LOCKED); /* get the assoc vrf id and table id */ vrf_id = stcb->asoc.vrf_id; stcb->asoc.state |= SCTP_STATE_WAS_ABORTED; @@ -3876,7 +3891,7 @@ none_in: void sctp_abort_an_association(struct sctp_inpcb *inp, struct sctp_tcb *stcb, - int error, struct mbuf *op_err, + struct mbuf *op_err, int so_locked #if !defined(__APPLE__) && !defined(SCTP_SO_LOCK_TESTING) SCTP_UNUSED @@ -3904,8 +3919,9 @@ sctp_abort_an_association(struct sctp_in stcb->asoc.state |= SCTP_STATE_WAS_ABORTED; } /* notify the ulp */ - if ((inp->sctp_flags & SCTP_PCB_FLAGS_SOCKET_GONE) == 0) - sctp_abort_notification(stcb, error, so_locked); + if ((inp->sctp_flags & SCTP_PCB_FLAGS_SOCKET_GONE) == 0) { + sctp_abort_notification(stcb, 0, NULL, so_locked); + } /* notify the peer */ sctp_send_abort_tcb(stcb, op_err, so_locked); SCTP_STAT_INCR_COUNTER32(sctps_aborted); Modified: stable/8/sys/netinet/sctputil.h ============================================================================== --- stable/8/sys/netinet/sctputil.h Thu Mar 7 19:00:00 2013 (r247919) +++ stable/8/sys/netinet/sctputil.h Thu Mar 7 19:27:17 2013 (r247920) @@ -179,7 +179,8 @@ sctp_report_all_outbound(struct sctp_tcb int sctp_expand_mapping_array(struct sctp_association *, uint32_t); void -sctp_abort_notification(struct sctp_tcb *, int, int +sctp_abort_notification(struct sctp_tcb *, uint16_t, + struct sctp_abort_chunk *, int #if !defined(__APPLE__) && !defined(SCTP_SO_LOCK_TESTING) SCTP_UNUSED #endif @@ -193,7 +194,7 @@ sctp_abort_association(struct sctp_inpcb /* We choose to abort via user input */ void -sctp_abort_an_association(struct sctp_inpcb *, struct sctp_tcb *, int, +sctp_abort_an_association(struct sctp_inpcb *, struct sctp_tcb *, struct mbuf *, int #if !defined(__APPLE__) && !defined(SCTP_SO_LOCK_TESTING) SCTP_UNUSED Modified: stable/8/sys/netinet6/sctp6_usrreq.c ============================================================================== --- stable/8/sys/netinet6/sctp6_usrreq.c Thu Mar 7 19:00:00 2013 (r247919) +++ stable/8/sys/netinet6/sctp6_usrreq.c Thu Mar 7 19:27:17 2013 (r247920) @@ -388,10 +388,8 @@ sctp6_notify(struct sctp_inpcb *inp, struct socket *so; #endif - /* protection */ - int reason; - + /* protection */ if ((inp == NULL) || (stcb == NULL) || (net == NULL) || (sh == NULL) || (to == NULL)) { if (stcb) @@ -441,8 +439,7 @@ sctp6_notify(struct sctp_inpcb *inp, * now is dead. In either case treat it like a OOTB abort * with no TCB */ - reason = SCTP_PEER_FAULTY; - sctp_abort_notification(stcb, reason, SCTP_SO_NOT_LOCKED); + sctp_abort_notification(stcb, 0, NULL, SCTP_SO_NOT_LOCKED); #if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING) so = SCTP_INP_SO(inp); atomic_add_int(&stcb->asoc.refcnt, 1); From owner-svn-src-stable@FreeBSD.ORG Thu Mar 7 19:30:35 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 991D09A8; Thu, 7 Mar 2013 19:30:35 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 71DA8E6C; Thu, 7 Mar 2013 19:30:35 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r27JUZK9077681; Thu, 7 Mar 2013 19:30:35 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r27JUZUk077680; Thu, 7 Mar 2013 19:30:35 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201303071930.r27JUZUk077680@svn.freebsd.org> From: Michael Tuexen Date: Thu, 7 Mar 2013 19:30:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r247921 - stable/8/sys/netinet X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Mar 2013 19:30:35 -0000 Author: tuexen Date: Thu Mar 7 19:30:34 2013 New Revision: 247921 URL: http://svnweb.freebsd.org/changeset/base/247921 Log: MFC r235402: Ensure the user can read COMM_LOST notifications on 1-to-1 style sockets. Modified: stable/8/sys/netinet/sctputil.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/netinet/ (props changed) Modified: stable/8/sys/netinet/sctputil.c ============================================================================== --- stable/8/sys/netinet/sctputil.c Thu Mar 7 19:27:17 2013 (r247920) +++ stable/8/sys/netinet/sctputil.c Thu Mar 7 19:30:34 2013 (r247921) @@ -2609,10 +2609,82 @@ sctp_notify_assoc_change(uint16_t state, #endif + if (sctp_stcb_is_feature_on(stcb->sctp_ep, stcb, SCTP_PCB_FLAGS_RECVASSOCEVNT)) { + notif_len = sizeof(struct sctp_assoc_change); + if (abort != NULL) { + abort_len = htons(abort->ch.chunk_length); + } else { + abort_len = 0; + } + if ((state == SCTP_COMM_UP) || (state == SCTP_RESTART)) { + notif_len += SCTP_ASSOC_SUPPORTS_MAX; + } else if ((state == SCTP_COMM_LOST) || (state == SCTP_CANT_STR_ASSOC)) { + notif_len += abort_len; + } + m_notify = sctp_get_mbuf_for_msg(notif_len, 0, M_DONTWAIT, 1, MT_DATA); + if (m_notify == NULL) { + /* Retry with smaller value. */ + notif_len = sizeof(struct sctp_assoc_change); + m_notify = sctp_get_mbuf_for_msg(notif_len, 0, M_DONTWAIT, 1, MT_DATA); + if (m_notify == NULL) { + goto set_error; + } + } + SCTP_BUF_NEXT(m_notify) = NULL; + sac = mtod(m_notify, struct sctp_assoc_change *); + sac->sac_type = SCTP_ASSOC_CHANGE; + sac->sac_flags = 0; + sac->sac_length = sizeof(struct sctp_assoc_change); + sac->sac_state = state; + sac->sac_error = error; + /* XXX verify these stream counts */ + sac->sac_outbound_streams = stcb->asoc.streamoutcnt; + sac->sac_inbound_streams = stcb->asoc.streamincnt; + sac->sac_assoc_id = sctp_get_associd(stcb); + if (notif_len > sizeof(struct sctp_assoc_change)) { + if ((state == SCTP_COMM_UP) || (state == SCTP_RESTART)) { + i = 0; + if (stcb->asoc.peer_supports_prsctp) { + sac->sac_info[i++] = SCTP_ASSOC_SUPPORTS_PR; + } + if (stcb->asoc.peer_supports_auth) { + sac->sac_info[i++] = SCTP_ASSOC_SUPPORTS_AUTH; + } + if (stcb->asoc.peer_supports_asconf) { + sac->sac_info[i++] = SCTP_ASSOC_SUPPORTS_ASCONF; + } + sac->sac_info[i++] = SCTP_ASSOC_SUPPORTS_MULTIBUF; + if (stcb->asoc.peer_supports_strreset) { + sac->sac_info[i++] = SCTP_ASSOC_SUPPORTS_RE_CONFIG; + } + sac->sac_length += i; + } else if ((state == SCTP_COMM_LOST) || (state == SCTP_CANT_STR_ASSOC)) { + memcpy(sac->sac_info, abort, abort_len); + sac->sac_length += abort_len; + } + } + SCTP_BUF_LEN(m_notify) = sac->sac_length; + control = sctp_build_readq_entry(stcb, stcb->asoc.primary_destination, + 0, 0, stcb->asoc.context, 0, 0, 0, + m_notify); + if (control != NULL) { + control->length = SCTP_BUF_LEN(m_notify); + /* not that we need this */ + control->tail_mbuf = m_notify; + control->spec_flags = M_NOTIFICATION; + sctp_add_to_readq(stcb->sctp_ep, stcb, + control, + &stcb->sctp_socket->so_rcv, 1, SCTP_READ_LOCK_NOT_HELD, + so_locked); + } else { + sctp_m_freem(m_notify); + } + } /* - * For TCP model AND UDP connected sockets we will send an error up - * when an ABORT comes in. + * For 1-to-1 style sockets, we send up and error when an ABORT + * comes in. */ +set_error: if (((stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) || (stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL)) && ((state == SCTP_COMM_LOST) || (state == SCTP_CANT_STR_ASSOC))) { @@ -2623,127 +2695,34 @@ sctp_notify_assoc_change(uint16_t state, SCTP_LTRACE_ERR_RET(NULL, stcb, NULL, SCTP_FROM_SCTPUTIL, ECONNRESET); stcb->sctp_socket->so_error = ECONNRESET; } - /* Wake ANY sleepers */ -#if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING) - so = SCTP_INP_SO(stcb->sctp_ep); - if (!so_locked) { - atomic_add_int(&stcb->asoc.refcnt, 1); - SCTP_TCB_UNLOCK(stcb); - SCTP_SOCKET_LOCK(so, 1); - SCTP_TCB_LOCK(stcb); - atomic_subtract_int(&stcb->asoc.refcnt, 1); - if (stcb->asoc.state & SCTP_STATE_CLOSED_SOCKET) { - SCTP_SOCKET_UNLOCK(so, 1); - return; - } - } -#endif - socantrcvmore(stcb->sctp_socket); - sorwakeup(stcb->sctp_socket); - sowwakeup(stcb->sctp_socket); + } + /* Wake ANY sleepers */ #if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING) - if (!so_locked) { + so = SCTP_INP_SO(stcb->sctp_ep); + if (!so_locked) { + atomic_add_int(&stcb->asoc.refcnt, 1); + SCTP_TCB_UNLOCK(stcb); + SCTP_SOCKET_LOCK(so, 1); + SCTP_TCB_LOCK(stcb); + atomic_subtract_int(&stcb->asoc.refcnt, 1); + if (stcb->asoc.state & SCTP_STATE_CLOSED_SOCKET) { SCTP_SOCKET_UNLOCK(so, 1); - } -#endif - } - if (sctp_stcb_is_feature_off(stcb->sctp_ep, stcb, SCTP_PCB_FLAGS_RECVASSOCEVNT)) { - /* event not enabled */ - return; - } - notif_len = sizeof(struct sctp_assoc_change); - if (abort != NULL) { - abort_len = htons(abort->ch.chunk_length); - } else { - abort_len = 0; - } - if ((state == SCTP_COMM_UP) || (state == SCTP_RESTART)) { - notif_len += SCTP_ASSOC_SUPPORTS_MAX; - } else if ((state == SCTP_COMM_LOST) || (state == SCTP_CANT_STR_ASSOC)) { - notif_len += abort_len; - } - m_notify = sctp_get_mbuf_for_msg(notif_len, 0, M_DONTWAIT, 1, MT_DATA); - if (m_notify == NULL) { - /* Retry with smaller value. */ - notif_len = sizeof(struct sctp_assoc_change); - m_notify = sctp_get_mbuf_for_msg(notif_len, 0, M_DONTWAIT, 1, MT_DATA); - if (m_notify == NULL) { return; } } - SCTP_BUF_NEXT(m_notify) = NULL; - sac = mtod(m_notify, struct sctp_assoc_change *); - sac->sac_type = SCTP_ASSOC_CHANGE; - sac->sac_flags = 0; - sac->sac_length = sizeof(struct sctp_assoc_change); - sac->sac_state = state; - sac->sac_error = error; - /* XXX verify these stream counts */ - sac->sac_outbound_streams = stcb->asoc.streamoutcnt; - sac->sac_inbound_streams = stcb->asoc.streamincnt; - sac->sac_assoc_id = sctp_get_associd(stcb); - if (notif_len > sizeof(struct sctp_assoc_change)) { - if ((state == SCTP_COMM_UP) || (state == SCTP_RESTART)) { - i = 0; - if (stcb->asoc.peer_supports_prsctp) { - sac->sac_info[i++] = SCTP_ASSOC_SUPPORTS_PR; - } - if (stcb->asoc.peer_supports_auth) { - sac->sac_info[i++] = SCTP_ASSOC_SUPPORTS_AUTH; - } - if (stcb->asoc.peer_supports_asconf) { - sac->sac_info[i++] = SCTP_ASSOC_SUPPORTS_ASCONF; - } - sac->sac_info[i++] = SCTP_ASSOC_SUPPORTS_MULTIBUF; - if (stcb->asoc.peer_supports_strreset) { - sac->sac_info[i++] = SCTP_ASSOC_SUPPORTS_RE_CONFIG; - } - sac->sac_length += i; - } else if ((state == SCTP_COMM_LOST) || (state == SCTP_CANT_STR_ASSOC)) { - memcpy(sac->sac_info, abort, abort_len); - sac->sac_length += abort_len; - } - } - SCTP_BUF_LEN(m_notify) = sac->sac_length; - control = sctp_build_readq_entry(stcb, stcb->asoc.primary_destination, - 0, 0, stcb->asoc.context, 0, 0, 0, - m_notify); - if (control == NULL) { - /* no memory */ - sctp_m_freem(m_notify); - return; - } - control->length = SCTP_BUF_LEN(m_notify); - /* not that we need this */ - control->tail_mbuf = m_notify; - control->spec_flags = M_NOTIFICATION; - sctp_add_to_readq(stcb->sctp_ep, stcb, - control, - &stcb->sctp_socket->so_rcv, 1, SCTP_READ_LOCK_NOT_HELD, - so_locked); - if (state == SCTP_COMM_LOST) { - /* Wake up any sleeper */ -#if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING) - so = SCTP_INP_SO(stcb->sctp_ep); - if (!so_locked) { - atomic_add_int(&stcb->asoc.refcnt, 1); - SCTP_TCB_UNLOCK(stcb); - SCTP_SOCKET_LOCK(so, 1); - SCTP_TCB_LOCK(stcb); - atomic_subtract_int(&stcb->asoc.refcnt, 1); - if (stcb->asoc.state & SCTP_STATE_CLOSED_SOCKET) { - SCTP_SOCKET_UNLOCK(so, 1); - return; - } - } #endif - sctp_sowwakeup(stcb->sctp_ep, stcb->sctp_socket); + if (((stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) || + (stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL)) && + ((state == SCTP_COMM_LOST) || (state == SCTP_CANT_STR_ASSOC))) { + socantrcvmore(stcb->sctp_socket); + } + sorwakeup(stcb->sctp_socket); + sowwakeup(stcb->sctp_socket); #if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING) - if (!so_locked) { - SCTP_SOCKET_UNLOCK(so, 1); - } -#endif + if (!so_locked) { + SCTP_SOCKET_UNLOCK(so, 1); } +#endif } static void @@ -5220,7 +5199,7 @@ restart_nosblocks: (inp->sctp_flags & SCTP_PCB_FLAGS_SOCKET_ALLGONE)) { goto out; } - if (so->so_rcv.sb_state & SBS_CANTRCVMORE) { + if ((so->so_rcv.sb_state & SBS_CANTRCVMORE) && (so->so_rcv.sb_cc == 0)) { if (so->so_error) { error = so->so_error; if ((in_flags & MSG_PEEK) == 0) @@ -5228,7 +5207,6 @@ restart_nosblocks: goto out; } else { if (so->so_rcv.sb_cc == 0) { - SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTPUTIL, ENOTCONN); /* indicate EOF */ error = 0; goto out; From owner-svn-src-stable@FreeBSD.ORG Thu Mar 7 19:32:56 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 59337C3A; Thu, 7 Mar 2013 19:32:56 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 3CA5BE8D; Thu, 7 Mar 2013 19:32:56 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r27JWuNY079591; Thu, 7 Mar 2013 19:32:56 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r27JWtN9079579; Thu, 7 Mar 2013 19:32:55 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201303071932.r27JWtN9079579@svn.freebsd.org> From: Michael Tuexen Date: Thu, 7 Mar 2013 19:32:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r247922 - in stable/8/sys: netinet netinet6 X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Mar 2013 19:32:56 -0000 Author: tuexen Date: Thu Mar 7 19:32:54 2013 New Revision: 247922 URL: http://svnweb.freebsd.org/changeset/base/247922 Log: MFC r235403: Use ECONNABORTED in cases where the ABORT was sent to the peer. Modified: stable/8/sys/netinet/sctp_constants.h stable/8/sys/netinet/sctp_input.c stable/8/sys/netinet/sctp_usrreq.c stable/8/sys/netinet/sctputil.c stable/8/sys/netinet/sctputil.h stable/8/sys/netinet6/sctp6_usrreq.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/netinet/ (props changed) stable/8/sys/netinet6/ (props changed) Modified: stable/8/sys/netinet/sctp_constants.h ============================================================================== --- stable/8/sys/netinet/sctp_constants.h Thu Mar 7 19:30:34 2013 (r247921) +++ stable/8/sys/netinet/sctp_constants.h Thu Mar 7 19:32:54 2013 (r247922) @@ -757,7 +757,7 @@ __FBSDID("$FreeBSD$"); #define SCTP_NOTIFY_INTERFACE_UP 4 #define SCTP_NOTIFY_DG_FAIL 5 #define SCTP_NOTIFY_STRDATA_ERR 6 -#define SCTP_NOTIFY_ASSOC_ABORTED 7 +#define SCTP_NOTIFY_ASSOC_LOC_ABORTED 7 #define SCTP_NOTIFY_PEER_OPENED_STREAM 8 #define SCTP_NOTIFY_STREAM_OPENED_OK 9 #define SCTP_NOTIFY_ASSOC_RESTART 10 @@ -781,7 +781,8 @@ __FBSDID("$FreeBSD$"); #define SCTP_NOTIFY_SENDER_DRY 29 #define SCTP_NOTIFY_STR_RESET_DENIED_OUT 30 #define SCTP_NOTIFY_STR_RESET_DENIED_IN 31 -#define SCTP_NOTIFY_MAX 31 +#define SCTP_NOTIFY_ASSOC_REM_ABORTED 32 +#define SCTP_NOTIFY_MAX 32 /* This is the value for messages that are NOT completely Modified: stable/8/sys/netinet/sctp_input.c ============================================================================== --- stable/8/sys/netinet/sctp_input.c Thu Mar 7 19:30:34 2013 (r247921) +++ stable/8/sys/netinet/sctp_input.c Thu Mar 7 19:32:54 2013 (r247922) @@ -782,7 +782,7 @@ sctp_handle_abort(struct sctp_abort_chun /* stop any receive timers */ sctp_timer_stop(SCTP_TIMER_TYPE_RECV, stcb->sctp_ep, stcb, net, SCTP_FROM_SCTP_INPUT + SCTP_LOC_6); /* notify user of the abort and clean up... */ - sctp_abort_notification(stcb, error, abort, SCTP_SO_NOT_LOCKED); + sctp_abort_notification(stcb, 1, error, abort, SCTP_SO_NOT_LOCKED); /* free the tcb */ SCTP_STAT_INCR_COUNTER32(sctps_aborted); if ((SCTP_GET_STATE(&stcb->asoc) == SCTP_STATE_OPEN) || @@ -1173,7 +1173,7 @@ sctp_handle_error(struct sctp_chunkhdr * asoc->stale_cookie_count++; if (asoc->stale_cookie_count > asoc->max_init_times) { - sctp_abort_notification(stcb, 0, NULL, SCTP_SO_NOT_LOCKED); + sctp_abort_notification(stcb, 0, 0, NULL, SCTP_SO_NOT_LOCKED); /* now free the asoc */ #if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING) so = SCTP_INP_SO(stcb->sctp_ep); Modified: stable/8/sys/netinet/sctp_usrreq.c ============================================================================== --- stable/8/sys/netinet/sctp_usrreq.c Thu Mar 7 19:30:34 2013 (r247921) +++ stable/8/sys/netinet/sctp_usrreq.c Thu Mar 7 19:32:54 2013 (r247922) @@ -283,7 +283,7 @@ sctp_notify(struct sctp_inpcb *inp, * now is dead. In either case treat it like a OOTB abort * with no TCB */ - sctp_abort_notification(stcb, 0, NULL, SCTP_SO_NOT_LOCKED); + sctp_abort_notification(stcb, 1, 0, NULL, SCTP_SO_NOT_LOCKED); #if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING) so = SCTP_INP_SO(inp); atomic_add_int(&stcb->asoc.refcnt, 1); Modified: stable/8/sys/netinet/sctputil.c ============================================================================== --- stable/8/sys/netinet/sctputil.c Thu Mar 7 19:30:34 2013 (r247921) +++ stable/8/sys/netinet/sctputil.c Thu Mar 7 19:32:54 2013 (r247922) @@ -2592,7 +2592,7 @@ sctp_pad_lastmbuf(struct mbuf *m, int pa static void sctp_notify_assoc_change(uint16_t state, struct sctp_tcb *stcb, - uint16_t error, struct sctp_abort_chunk *abort, int so_locked + uint16_t error, struct sctp_abort_chunk *abort, uint8_t from_peer, int so_locked #if !defined(__APPLE__) && !defined(SCTP_SO_LOCK_TESTING) SCTP_UNUSED #endif @@ -2688,12 +2688,17 @@ set_error: if (((stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) || (stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL)) && ((state == SCTP_COMM_LOST) || (state == SCTP_CANT_STR_ASSOC))) { - if (SCTP_GET_STATE(&stcb->asoc) == SCTP_STATE_COOKIE_WAIT) { - SCTP_LTRACE_ERR_RET(NULL, stcb, NULL, SCTP_FROM_SCTPUTIL, ECONNREFUSED); - stcb->sctp_socket->so_error = ECONNREFUSED; + if (from_peer) { + if (SCTP_GET_STATE(&stcb->asoc) == SCTP_STATE_COOKIE_WAIT) { + SCTP_LTRACE_ERR_RET(NULL, stcb, NULL, SCTP_FROM_SCTPUTIL, ECONNREFUSED); + stcb->sctp_socket->so_error = ECONNREFUSED; + } else { + SCTP_LTRACE_ERR_RET(NULL, stcb, NULL, SCTP_FROM_SCTPUTIL, ECONNRESET); + stcb->sctp_socket->so_error = ECONNRESET; + } } else { - SCTP_LTRACE_ERR_RET(NULL, stcb, NULL, SCTP_FROM_SCTPUTIL, ECONNRESET); - stcb->sctp_socket->so_error = ECONNRESET; + SCTP_LTRACE_ERR_RET(NULL, stcb, NULL, SCTP_FROM_SCTPUTIL, ECONNABORTED); + stcb->sctp_socket->so_error = ECONNABORTED; } } /* Wake ANY sleepers */ @@ -3493,7 +3498,7 @@ sctp_ulp_notify(uint32_t notification, s switch (notification) { case SCTP_NOTIFY_ASSOC_UP: if (stcb->asoc.assoc_up_sent == 0) { - sctp_notify_assoc_change(SCTP_COMM_UP, stcb, error, NULL, so_locked); + sctp_notify_assoc_change(SCTP_COMM_UP, stcb, error, NULL, 0, so_locked); stcb->asoc.assoc_up_sent = 1; } if (stcb->asoc.adaptation_needed && (stcb->asoc.adaptation_sent == 0)) { @@ -3505,7 +3510,7 @@ sctp_ulp_notify(uint32_t notification, s } break; case SCTP_NOTIFY_ASSOC_DOWN: - sctp_notify_assoc_change(SCTP_SHUTDOWN_COMP, stcb, error, NULL, so_locked); + sctp_notify_assoc_change(SCTP_SHUTDOWN_COMP, stcb, error, NULL, 0, so_locked); break; case SCTP_NOTIFY_INTERFACE_DOWN: { @@ -3553,12 +3558,20 @@ sctp_ulp_notify(uint32_t notification, s } case SCTP_NOTIFY_STRDATA_ERR: break; - case SCTP_NOTIFY_ASSOC_ABORTED: + case SCTP_NOTIFY_ASSOC_LOC_ABORTED: if ((stcb) && (((stcb->asoc.state & SCTP_STATE_MASK) == SCTP_STATE_COOKIE_WAIT) || ((stcb->asoc.state & SCTP_STATE_MASK) == SCTP_STATE_COOKIE_ECHOED))) { - sctp_notify_assoc_change(SCTP_CANT_STR_ASSOC, stcb, error, data, so_locked); + sctp_notify_assoc_change(SCTP_CANT_STR_ASSOC, stcb, error, data, 0, so_locked); } else { - sctp_notify_assoc_change(SCTP_COMM_LOST, stcb, error, data, so_locked); + sctp_notify_assoc_change(SCTP_COMM_LOST, stcb, error, data, 0, so_locked); + } + break; + case SCTP_NOTIFY_ASSOC_REM_ABORTED: + if ((stcb) && (((stcb->asoc.state & SCTP_STATE_MASK) == SCTP_STATE_COOKIE_WAIT) || + ((stcb->asoc.state & SCTP_STATE_MASK) == SCTP_STATE_COOKIE_ECHOED))) { + sctp_notify_assoc_change(SCTP_CANT_STR_ASSOC, stcb, error, data, 1, so_locked); + } else { + sctp_notify_assoc_change(SCTP_COMM_LOST, stcb, error, data, 1, so_locked); } break; case SCTP_NOTIFY_PEER_OPENED_STREAM: @@ -3566,7 +3579,7 @@ sctp_ulp_notify(uint32_t notification, s case SCTP_NOTIFY_STREAM_OPENED_OK: break; case SCTP_NOTIFY_ASSOC_RESTART: - sctp_notify_assoc_change(SCTP_RESTART, stcb, error, NULL, so_locked); + sctp_notify_assoc_change(SCTP_RESTART, stcb, error, NULL, 0, so_locked); if (stcb->asoc.peer_supports_auth == 0) { sctp_ulp_notify(SCTP_NOTIFY_NO_PEER_AUTH, stcb, 0, NULL, so_locked); @@ -3735,7 +3748,7 @@ sctp_report_all_outbound(struct sctp_tcb } void -sctp_abort_notification(struct sctp_tcb *stcb, uint16_t error, +sctp_abort_notification(struct sctp_tcb *stcb, uint8_t from_peer, uint16_t error, struct sctp_abort_chunk *abort, int so_locked #if !defined(__APPLE__) && !defined(SCTP_SO_LOCK_TESTING) SCTP_UNUSED @@ -3757,7 +3770,11 @@ sctp_abort_notification(struct sctp_tcb } /* Tell them we lost the asoc */ sctp_report_all_outbound(stcb, 1, so_locked); - sctp_ulp_notify(SCTP_NOTIFY_ASSOC_ABORTED, stcb, error, abort, so_locked); + if (from_peer) { + sctp_ulp_notify(SCTP_NOTIFY_ASSOC_REM_ABORTED, stcb, error, abort, so_locked); + } else { + sctp_ulp_notify(SCTP_NOTIFY_ASSOC_LOC_ABORTED, stcb, error, abort, so_locked); + } } void @@ -3776,7 +3793,7 @@ sctp_abort_association(struct sctp_inpcb if (stcb != NULL) { /* We have a TCB to abort, send notification too */ vtag = stcb->asoc.peer_vtag; - sctp_abort_notification(stcb, 0, NULL, SCTP_SO_NOT_LOCKED); + sctp_abort_notification(stcb, 0, 0, NULL, SCTP_SO_NOT_LOCKED); /* get the assoc vrf id and table id */ vrf_id = stcb->asoc.vrf_id; stcb->asoc.state |= SCTP_STATE_WAS_ABORTED; @@ -3899,7 +3916,7 @@ sctp_abort_an_association(struct sctp_in } /* notify the ulp */ if ((inp->sctp_flags & SCTP_PCB_FLAGS_SOCKET_GONE) == 0) { - sctp_abort_notification(stcb, 0, NULL, so_locked); + sctp_abort_notification(stcb, 0, 0, NULL, so_locked); } /* notify the peer */ sctp_send_abort_tcb(stcb, op_err, so_locked); Modified: stable/8/sys/netinet/sctputil.h ============================================================================== --- stable/8/sys/netinet/sctputil.h Thu Mar 7 19:30:34 2013 (r247921) +++ stable/8/sys/netinet/sctputil.h Thu Mar 7 19:32:54 2013 (r247922) @@ -179,7 +179,7 @@ sctp_report_all_outbound(struct sctp_tcb int sctp_expand_mapping_array(struct sctp_association *, uint32_t); void -sctp_abort_notification(struct sctp_tcb *, uint16_t, +sctp_abort_notification(struct sctp_tcb *, uint8_t, uint16_t, struct sctp_abort_chunk *, int #if !defined(__APPLE__) && !defined(SCTP_SO_LOCK_TESTING) SCTP_UNUSED Modified: stable/8/sys/netinet6/sctp6_usrreq.c ============================================================================== --- stable/8/sys/netinet6/sctp6_usrreq.c Thu Mar 7 19:30:34 2013 (r247921) +++ stable/8/sys/netinet6/sctp6_usrreq.c Thu Mar 7 19:32:54 2013 (r247922) @@ -439,7 +439,7 @@ sctp6_notify(struct sctp_inpcb *inp, * now is dead. In either case treat it like a OOTB abort * with no TCB */ - sctp_abort_notification(stcb, 0, NULL, SCTP_SO_NOT_LOCKED); + sctp_abort_notification(stcb, 1, 0, NULL, SCTP_SO_NOT_LOCKED); #if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING) so = SCTP_INP_SO(inp); atomic_add_int(&stcb->asoc.refcnt, 1); From owner-svn-src-stable@FreeBSD.ORG Thu Mar 7 19:34:57 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 7A9B4DC2; Thu, 7 Mar 2013 19:34:57 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 5E1AEEA1; Thu, 7 Mar 2013 19:34:57 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r27JYv9k079933; Thu, 7 Mar 2013 19:34:57 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r27JYvXN079931; Thu, 7 Mar 2013 19:34:57 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201303071934.r27JYvXN079931@svn.freebsd.org> From: Michael Tuexen Date: Thu, 7 Mar 2013 19:34:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r247923 - stable/8/sys/netinet X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Mar 2013 19:34:57 -0000 Author: tuexen Date: Thu Mar 7 19:34:56 2013 New Revision: 247923 URL: http://svnweb.freebsd.org/changeset/base/247923 Log: MFC r235412: Remove unused constants. Modified: stable/8/sys/netinet/sctp_constants.h stable/8/sys/netinet/sctputil.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/netinet/ (props changed) Modified: stable/8/sys/netinet/sctp_constants.h ============================================================================== --- stable/8/sys/netinet/sctp_constants.h Thu Mar 7 19:32:54 2013 (r247922) +++ stable/8/sys/netinet/sctp_constants.h Thu Mar 7 19:34:56 2013 (r247923) @@ -756,34 +756,26 @@ __FBSDID("$FreeBSD$"); #define SCTP_NOTIFY_INTERFACE_DOWN 3 #define SCTP_NOTIFY_INTERFACE_UP 4 #define SCTP_NOTIFY_DG_FAIL 5 -#define SCTP_NOTIFY_STRDATA_ERR 6 +#define SCTP_NOTIFY_SPECIAL_SP_FAIL 6 #define SCTP_NOTIFY_ASSOC_LOC_ABORTED 7 -#define SCTP_NOTIFY_PEER_OPENED_STREAM 8 -#define SCTP_NOTIFY_STREAM_OPENED_OK 9 -#define SCTP_NOTIFY_ASSOC_RESTART 10 -#define SCTP_NOTIFY_HB_RESP 11 -#define SCTP_NOTIFY_ASCONF_SUCCESS 12 -#define SCTP_NOTIFY_ASCONF_FAILED 13 -#define SCTP_NOTIFY_PEER_SHUTDOWN 14 -#define SCTP_NOTIFY_ASCONF_ADD_IP 15 -#define SCTP_NOTIFY_ASCONF_DELETE_IP 16 -#define SCTP_NOTIFY_ASCONF_SET_PRIMARY 17 -#define SCTP_NOTIFY_PARTIAL_DELVIERY_INDICATION 18 -#define SCTP_NOTIFY_INTERFACE_CONFIRMED 20 -#define SCTP_NOTIFY_STR_RESET_RECV 21 -#define SCTP_NOTIFY_STR_RESET_SEND 22 -#define SCTP_NOTIFY_STR_RESET_FAILED_OUT 23 -#define SCTP_NOTIFY_STR_RESET_FAILED_IN 24 -#define SCTP_NOTIFY_AUTH_NEW_KEY 25 -#define SCTP_NOTIFY_AUTH_FREE_KEY 26 -#define SCTP_NOTIFY_SPECIAL_SP_FAIL 27 -#define SCTP_NOTIFY_NO_PEER_AUTH 28 -#define SCTP_NOTIFY_SENDER_DRY 29 -#define SCTP_NOTIFY_STR_RESET_DENIED_OUT 30 -#define SCTP_NOTIFY_STR_RESET_DENIED_IN 31 -#define SCTP_NOTIFY_ASSOC_REM_ABORTED 32 -#define SCTP_NOTIFY_MAX 32 - +#define SCTP_NOTIFY_ASSOC_REM_ABORTED 8 +#define SCTP_NOTIFY_ASSOC_RESTART 9 +#define SCTP_NOTIFY_PEER_SHUTDOWN 10 +#define SCTP_NOTIFY_ASCONF_ADD_IP 11 +#define SCTP_NOTIFY_ASCONF_DELETE_IP 12 +#define SCTP_NOTIFY_ASCONF_SET_PRIMARY 13 +#define SCTP_NOTIFY_PARTIAL_DELVIERY_INDICATION 14 +#define SCTP_NOTIFY_INTERFACE_CONFIRMED 15 +#define SCTP_NOTIFY_STR_RESET_RECV 16 +#define SCTP_NOTIFY_STR_RESET_SEND 17 +#define SCTP_NOTIFY_STR_RESET_FAILED_OUT 18 +#define SCTP_NOTIFY_STR_RESET_FAILED_IN 19 +#define SCTP_NOTIFY_STR_RESET_DENIED_OUT 20 +#define SCTP_NOTIFY_STR_RESET_DENIED_IN 21 +#define SCTP_NOTIFY_AUTH_NEW_KEY 22 +#define SCTP_NOTIFY_AUTH_FREE_KEY 23 +#define SCTP_NOTIFY_NO_PEER_AUTH 24 +#define SCTP_NOTIFY_SENDER_DRY 25 /* This is the value for messages that are NOT completely * copied down where we will start to split the message. Modified: stable/8/sys/netinet/sctputil.c ============================================================================== --- stable/8/sys/netinet/sctputil.c Thu Mar 7 19:32:54 2013 (r247922) +++ stable/8/sys/netinet/sctputil.c Thu Mar 7 19:34:56 2013 (r247923) @@ -3556,8 +3556,6 @@ sctp_ulp_notify(uint32_t notification, s sctp_notify_partial_delivery_indication(stcb, error, val, so_locked); break; } - case SCTP_NOTIFY_STRDATA_ERR: - break; case SCTP_NOTIFY_ASSOC_LOC_ABORTED: if ((stcb) && (((stcb->asoc.state & SCTP_STATE_MASK) == SCTP_STATE_COOKIE_WAIT) || ((stcb->asoc.state & SCTP_STATE_MASK) == SCTP_STATE_COOKIE_ECHOED))) { @@ -3574,10 +3572,6 @@ sctp_ulp_notify(uint32_t notification, s sctp_notify_assoc_change(SCTP_COMM_LOST, stcb, error, data, 1, so_locked); } break; - case SCTP_NOTIFY_PEER_OPENED_STREAM: - break; - case SCTP_NOTIFY_STREAM_OPENED_OK: - break; case SCTP_NOTIFY_ASSOC_RESTART: sctp_notify_assoc_change(SCTP_RESTART, stcb, error, NULL, 0, so_locked); if (stcb->asoc.peer_supports_auth == 0) { @@ -3585,8 +3579,6 @@ sctp_ulp_notify(uint32_t notification, s NULL, so_locked); } break; - case SCTP_NOTIFY_HB_RESP: - break; case SCTP_NOTIFY_STR_RESET_SEND: sctp_notify_stream_reset(stcb, error, ((uint16_t *) data), SCTP_STREAM_RESET_OUTGOING_SSN); break; @@ -3621,10 +3613,6 @@ sctp_ulp_notify(uint32_t notification, s sctp_notify_peer_addr_change(stcb, SCTP_ADDR_MADE_PRIM, data, error); break; - case SCTP_NOTIFY_ASCONF_SUCCESS: - break; - case SCTP_NOTIFY_ASCONF_FAILED: - break; case SCTP_NOTIFY_PEER_SHUTDOWN: sctp_notify_shutdown_event(stcb); break; From owner-svn-src-stable@FreeBSD.ORG Thu Mar 7 19:38:06 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 9C7DCE5; Thu, 7 Mar 2013 19:38:06 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 7F97BEC8; Thu, 7 Mar 2013 19:38:06 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r27Jc60q080422; Thu, 7 Mar 2013 19:38:06 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r27Jc5l9080416; Thu, 7 Mar 2013 19:38:05 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201303071938.r27Jc5l9080416@svn.freebsd.org> From: Michael Tuexen Date: Thu, 7 Mar 2013 19:38:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r247924 - in stable/8/sys: netinet netinet6 X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Mar 2013 19:38:06 -0000 Author: tuexen Date: Thu Mar 7 19:38:04 2013 New Revision: 247924 URL: http://svnweb.freebsd.org/changeset/base/247924 Log: MFC r235414,r235415: Provide the error code in SCTP_PEER_ADDR_CHANGE notifications as specified in RFC 6458. Modified: stable/8/sys/netinet/sctp_indata.c stable/8/sys/netinet/sctp_input.c stable/8/sys/netinet/sctp_output.c stable/8/sys/netinet/sctp_timer.c stable/8/sys/netinet/sctp_usrreq.c stable/8/sys/netinet6/sctp6_usrreq.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/netinet/ (props changed) stable/8/sys/netinet6/ (props changed) Modified: stable/8/sys/netinet/sctp_indata.c ============================================================================== --- stable/8/sys/netinet/sctp_indata.c Thu Mar 7 19:34:56 2013 (r247923) +++ stable/8/sys/netinet/sctp_indata.c Thu Mar 7 19:38:04 2013 (r247924) @@ -4024,7 +4024,7 @@ sctp_express_handle_sack(struct sctp_tcb /* addr came good */ net->dest_state |= SCTP_ADDR_REACHABLE; sctp_ulp_notify(SCTP_NOTIFY_INTERFACE_UP, stcb, - SCTP_RECEIVED_SACK, (void *)net, SCTP_SO_NOT_LOCKED); + 0, (void *)net, SCTP_SO_NOT_LOCKED); } if (net == stcb->asoc.primary_destination) { if (stcb->asoc.alternate) { @@ -4831,7 +4831,7 @@ sctp_handle_sack(struct mbuf *m, int off /* addr came good */ net->dest_state |= SCTP_ADDR_REACHABLE; sctp_ulp_notify(SCTP_NOTIFY_INTERFACE_UP, stcb, - SCTP_RECEIVED_SACK, (void *)net, SCTP_SO_NOT_LOCKED); + 0, (void *)net, SCTP_SO_NOT_LOCKED); } if (net == stcb->asoc.primary_destination) { if (stcb->asoc.alternate) { Modified: stable/8/sys/netinet/sctp_input.c ============================================================================== --- stable/8/sys/netinet/sctp_input.c Thu Mar 7 19:34:56 2013 (r247923) +++ stable/8/sys/netinet/sctp_input.c Thu Mar 7 19:38:04 2013 (r247924) @@ -632,7 +632,7 @@ sctp_handle_heartbeat_ack(struct sctp_he if (!(r_net->dest_state & SCTP_ADDR_REACHABLE)) { r_net->dest_state |= SCTP_ADDR_REACHABLE; sctp_ulp_notify(SCTP_NOTIFY_INTERFACE_UP, stcb, - SCTP_HEARTBEAT_SUCCESS, (void *)r_net, SCTP_SO_NOT_LOCKED); + 0, (void *)r_net, SCTP_SO_NOT_LOCKED); } if (r_net->dest_state & SCTP_ADDR_PF) { r_net->dest_state &= ~SCTP_ADDR_PF; Modified: stable/8/sys/netinet/sctp_output.c ============================================================================== --- stable/8/sys/netinet/sctp_output.c Thu Mar 7 19:34:56 2013 (r247923) +++ stable/8/sys/netinet/sctp_output.c Thu Mar 7 19:38:04 2013 (r247924) @@ -3815,8 +3815,7 @@ sctp_handle_no_route(struct sctp_tcb *st if ((net->dest_state & SCTP_ADDR_REACHABLE) && stcb) { SCTPDBG(SCTP_DEBUG_OUTPUT1, "no route takes interface %p down\n", net); sctp_ulp_notify(SCTP_NOTIFY_INTERFACE_DOWN, - stcb, - SCTP_FAILED_THRESHOLD, + stcb, 0, (void *)net, so_locked); net->dest_state &= ~SCTP_ADDR_REACHABLE; Modified: stable/8/sys/netinet/sctp_timer.c ============================================================================== --- stable/8/sys/netinet/sctp_timer.c Thu Mar 7 19:34:56 2013 (r247923) +++ stable/8/sys/netinet/sctp_timer.c Thu Mar 7 19:38:04 2013 (r247924) @@ -101,8 +101,7 @@ sctp_threshold_management(struct sctp_in net->dest_state &= ~SCTP_ADDR_REQ_PRIMARY; net->dest_state &= ~SCTP_ADDR_PF; sctp_ulp_notify(SCTP_NOTIFY_INTERFACE_DOWN, - stcb, - SCTP_FAILED_THRESHOLD, + stcb, 0, (void *)net, SCTP_SO_NOT_LOCKED); } } else if ((net->pf_threshold < net->failure_threshold) && Modified: stable/8/sys/netinet/sctp_usrreq.c ============================================================================== --- stable/8/sys/netinet/sctp_usrreq.c Thu Mar 7 19:34:56 2013 (r247923) +++ stable/8/sys/netinet/sctp_usrreq.c Thu Mar 7 19:38:04 2013 (r247924) @@ -270,7 +270,7 @@ sctp_notify(struct sctp_inpcb *inp, net->dest_state &= ~SCTP_ADDR_REACHABLE; net->dest_state &= ~SCTP_ADDR_PF; sctp_ulp_notify(SCTP_NOTIFY_INTERFACE_DOWN, - stcb, SCTP_FAILED_THRESHOLD, + stcb, 0, (void *)net, SCTP_SO_NOT_LOCKED); } SCTP_TCB_UNLOCK(stcb); @@ -4794,12 +4794,12 @@ sctp_setopt(struct socket *so, int optna if (net->dest_state & SCTP_ADDR_REACHABLE) { if (net->error_count > paddrp->spp_pathmaxrxt) { net->dest_state &= ~SCTP_ADDR_REACHABLE; - sctp_ulp_notify(SCTP_NOTIFY_INTERFACE_DOWN, stcb, SCTP_RESPONSE_TO_USER_REQ, net, SCTP_SO_LOCKED); + sctp_ulp_notify(SCTP_NOTIFY_INTERFACE_DOWN, stcb, 0, net, SCTP_SO_LOCKED); } } else { if (net->error_count <= paddrp->spp_pathmaxrxt) { net->dest_state |= SCTP_ADDR_REACHABLE; - sctp_ulp_notify(SCTP_NOTIFY_INTERFACE_UP, stcb, SCTP_RESPONSE_TO_USER_REQ, net, SCTP_SO_LOCKED); + sctp_ulp_notify(SCTP_NOTIFY_INTERFACE_UP, stcb, 0, net, SCTP_SO_LOCKED); } } net->failure_threshold = paddrp->spp_pathmaxrxt; @@ -4837,12 +4837,12 @@ sctp_setopt(struct socket *so, int optna if (net->dest_state & SCTP_ADDR_REACHABLE) { if (net->error_count > paddrp->spp_pathmaxrxt) { net->dest_state &= ~SCTP_ADDR_REACHABLE; - sctp_ulp_notify(SCTP_NOTIFY_INTERFACE_DOWN, stcb, SCTP_RESPONSE_TO_USER_REQ, net, SCTP_SO_LOCKED); + sctp_ulp_notify(SCTP_NOTIFY_INTERFACE_DOWN, stcb, 0, net, SCTP_SO_LOCKED); } } else { if (net->error_count <= paddrp->spp_pathmaxrxt) { net->dest_state |= SCTP_ADDR_REACHABLE; - sctp_ulp_notify(SCTP_NOTIFY_INTERFACE_UP, stcb, SCTP_RESPONSE_TO_USER_REQ, net, SCTP_SO_LOCKED); + sctp_ulp_notify(SCTP_NOTIFY_INTERFACE_UP, stcb, 0, net, SCTP_SO_LOCKED); } } net->failure_threshold = paddrp->spp_pathmaxrxt; @@ -5648,12 +5648,12 @@ sctp_setopt(struct socket *so, int optna if (net->dest_state & SCTP_ADDR_REACHABLE) { if (net->failure_threshold > thlds->spt_pathmaxrxt) { net->dest_state &= ~SCTP_ADDR_REACHABLE; - sctp_ulp_notify(SCTP_NOTIFY_INTERFACE_DOWN, stcb, SCTP_RESPONSE_TO_USER_REQ, net, SCTP_SO_LOCKED); + sctp_ulp_notify(SCTP_NOTIFY_INTERFACE_DOWN, stcb, 0, net, SCTP_SO_LOCKED); } } else { if (net->failure_threshold <= thlds->spt_pathmaxrxt) { net->dest_state |= SCTP_ADDR_REACHABLE; - sctp_ulp_notify(SCTP_NOTIFY_INTERFACE_UP, stcb, SCTP_RESPONSE_TO_USER_REQ, net, SCTP_SO_LOCKED); + sctp_ulp_notify(SCTP_NOTIFY_INTERFACE_UP, stcb, 0, net, SCTP_SO_LOCKED); } } net->failure_threshold = thlds->spt_pathmaxrxt; @@ -5677,12 +5677,12 @@ sctp_setopt(struct socket *so, int optna if (net->dest_state & SCTP_ADDR_REACHABLE) { if (net->failure_threshold > thlds->spt_pathmaxrxt) { net->dest_state &= ~SCTP_ADDR_REACHABLE; - sctp_ulp_notify(SCTP_NOTIFY_INTERFACE_DOWN, stcb, SCTP_RESPONSE_TO_USER_REQ, net, SCTP_SO_LOCKED); + sctp_ulp_notify(SCTP_NOTIFY_INTERFACE_DOWN, stcb, 0, net, SCTP_SO_LOCKED); } } else { if (net->failure_threshold <= thlds->spt_pathmaxrxt) { net->dest_state |= SCTP_ADDR_REACHABLE; - sctp_ulp_notify(SCTP_NOTIFY_INTERFACE_UP, stcb, SCTP_RESPONSE_TO_USER_REQ, net, SCTP_SO_LOCKED); + sctp_ulp_notify(SCTP_NOTIFY_INTERFACE_UP, stcb, 0, net, SCTP_SO_LOCKED); } } net->failure_threshold = thlds->spt_pathmaxrxt; Modified: stable/8/sys/netinet6/sctp6_usrreq.c ============================================================================== --- stable/8/sys/netinet6/sctp6_usrreq.c Thu Mar 7 19:34:56 2013 (r247923) +++ stable/8/sys/netinet6/sctp6_usrreq.c Thu Mar 7 19:38:04 2013 (r247924) @@ -426,8 +426,7 @@ sctp6_notify(struct sctp_inpcb *inp, net->dest_state &= ~SCTP_ADDR_REACHABLE; net->dest_state &= ~SCTP_ADDR_PF; sctp_ulp_notify(SCTP_NOTIFY_INTERFACE_DOWN, - stcb, SCTP_FAILED_THRESHOLD, - (void *)net, SCTP_SO_NOT_LOCKED); + stcb, 0, (void *)net, SCTP_SO_NOT_LOCKED); } SCTP_TCB_UNLOCK(stcb); } else if ((icmph->icmp6_code == ICMP_UNREACH_PROTOCOL) || From owner-svn-src-stable@FreeBSD.ORG Thu Mar 7 19:40:16 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 46D14272; Thu, 7 Mar 2013 19:40:16 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 2AE94EE0; Thu, 7 Mar 2013 19:40:16 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r27JeGHr082190; Thu, 7 Mar 2013 19:40:16 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r27JeECj082179; Thu, 7 Mar 2013 19:40:14 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201303071940.r27JeECj082179@svn.freebsd.org> From: Michael Tuexen Date: Thu, 7 Mar 2013 19:40:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r247925 - stable/8/sys/netinet X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Mar 2013 19:40:16 -0000 Author: tuexen Date: Thu Mar 7 19:40:14 2013 New Revision: 247925 URL: http://svnweb.freebsd.org/changeset/base/247925 Log: MFC r235416: Provide in the SCTP_SEND_FAILED and SCTP_SEND_FAILED_EVENT notifications the correct ssf_error or ssfe_error as required by RFC 6458. Modified: stable/8/sys/netinet/sctp_constants.h stable/8/sys/netinet/sctp_indata.c stable/8/sys/netinet/sctp_input.c stable/8/sys/netinet/sctp_output.c stable/8/sys/netinet/sctp_pcb.c stable/8/sys/netinet/sctp_timer.c stable/8/sys/netinet/sctputil.c stable/8/sys/netinet/sctputil.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/netinet/ (props changed) Modified: stable/8/sys/netinet/sctp_constants.h ============================================================================== --- stable/8/sys/netinet/sctp_constants.h Thu Mar 7 19:38:04 2013 (r247924) +++ stable/8/sys/netinet/sctp_constants.h Thu Mar 7 19:40:14 2013 (r247925) @@ -460,18 +460,6 @@ __FBSDID("$FreeBSD$"); #define SCTP_HAS_NAT_SUPPORT 0xc007 #define SCTP_NAT_VTAGS 0xc008 -/* Notification error codes */ -#define SCTP_NOTIFY_DATAGRAM_UNSENT 0x0001 -#define SCTP_NOTIFY_DATAGRAM_SENT 0x0002 -#define SCTP_FAILED_THRESHOLD 0x0004 -#define SCTP_HEARTBEAT_SUCCESS 0x0008 -#define SCTP_RESPONSE_TO_USER_REQ 0x0010 -#define SCTP_INTERNAL_ERROR 0x0020 -#define SCTP_SHUTDOWN_GUARD_EXPIRES 0x0040 -#define SCTP_RECEIVED_SACK 0x0080 -#define SCTP_PEER_FAULTY 0x0100 -#define SCTP_ICMP_REFUSED 0x0200 - /* bits for TOS field */ #define SCTP_ECT0_BIT 0x02 #define SCTP_ECT1_BIT 0x01 @@ -755,27 +743,28 @@ __FBSDID("$FreeBSD$"); #define SCTP_NOTIFY_ASSOC_DOWN 2 #define SCTP_NOTIFY_INTERFACE_DOWN 3 #define SCTP_NOTIFY_INTERFACE_UP 4 -#define SCTP_NOTIFY_DG_FAIL 5 -#define SCTP_NOTIFY_SPECIAL_SP_FAIL 6 -#define SCTP_NOTIFY_ASSOC_LOC_ABORTED 7 -#define SCTP_NOTIFY_ASSOC_REM_ABORTED 8 -#define SCTP_NOTIFY_ASSOC_RESTART 9 -#define SCTP_NOTIFY_PEER_SHUTDOWN 10 -#define SCTP_NOTIFY_ASCONF_ADD_IP 11 -#define SCTP_NOTIFY_ASCONF_DELETE_IP 12 -#define SCTP_NOTIFY_ASCONF_SET_PRIMARY 13 -#define SCTP_NOTIFY_PARTIAL_DELVIERY_INDICATION 14 -#define SCTP_NOTIFY_INTERFACE_CONFIRMED 15 -#define SCTP_NOTIFY_STR_RESET_RECV 16 -#define SCTP_NOTIFY_STR_RESET_SEND 17 -#define SCTP_NOTIFY_STR_RESET_FAILED_OUT 18 -#define SCTP_NOTIFY_STR_RESET_FAILED_IN 19 -#define SCTP_NOTIFY_STR_RESET_DENIED_OUT 20 -#define SCTP_NOTIFY_STR_RESET_DENIED_IN 21 -#define SCTP_NOTIFY_AUTH_NEW_KEY 22 -#define SCTP_NOTIFY_AUTH_FREE_KEY 23 -#define SCTP_NOTIFY_NO_PEER_AUTH 24 -#define SCTP_NOTIFY_SENDER_DRY 25 +#define SCTP_NOTIFY_SENT_DG_FAIL 5 +#define SCTP_NOTIFY_UNSENT_DG_FAIL 6 +#define SCTP_NOTIFY_SPECIAL_SP_FAIL 7 +#define SCTP_NOTIFY_ASSOC_LOC_ABORTED 8 +#define SCTP_NOTIFY_ASSOC_REM_ABORTED 9 +#define SCTP_NOTIFY_ASSOC_RESTART 10 +#define SCTP_NOTIFY_PEER_SHUTDOWN 11 +#define SCTP_NOTIFY_ASCONF_ADD_IP 12 +#define SCTP_NOTIFY_ASCONF_DELETE_IP 13 +#define SCTP_NOTIFY_ASCONF_SET_PRIMARY 14 +#define SCTP_NOTIFY_PARTIAL_DELVIERY_INDICATION 15 +#define SCTP_NOTIFY_INTERFACE_CONFIRMED 16 +#define SCTP_NOTIFY_STR_RESET_RECV 17 +#define SCTP_NOTIFY_STR_RESET_SEND 18 +#define SCTP_NOTIFY_STR_RESET_FAILED_OUT 19 +#define SCTP_NOTIFY_STR_RESET_FAILED_IN 20 +#define SCTP_NOTIFY_STR_RESET_DENIED_OUT 21 +#define SCTP_NOTIFY_STR_RESET_DENIED_IN 22 +#define SCTP_NOTIFY_AUTH_NEW_KEY 23 +#define SCTP_NOTIFY_AUTH_FREE_KEY 24 +#define SCTP_NOTIFY_NO_PEER_AUTH 25 +#define SCTP_NOTIFY_SENDER_DRY 26 /* This is the value for messages that are NOT completely * copied down where we will start to split the message. Modified: stable/8/sys/netinet/sctp_indata.c ============================================================================== --- stable/8/sys/netinet/sctp_indata.c Thu Mar 7 19:38:04 2013 (r247924) +++ stable/8/sys/netinet/sctp_indata.c Thu Mar 7 19:40:14 2013 (r247925) @@ -3194,8 +3194,7 @@ sctp_strike_gap_ack_chunks(struct sctp_t if (timevalcmp(&now, &tp1->rec.data.timetodrop, >)) { /* Yes so drop it */ if (tp1->data != NULL) { - (void)sctp_release_pr_sctp_chunk(stcb, tp1, - (SCTP_RESPONSE_TO_USER_REQ | SCTP_NOTIFY_DATAGRAM_SENT), + (void)sctp_release_pr_sctp_chunk(stcb, tp1, 1, SCTP_SO_NOT_LOCKED); } continue; @@ -3452,8 +3451,7 @@ sctp_strike_gap_ack_chunks(struct sctp_t if (tp1->snd_count > tp1->rec.data.timetodrop.tv_sec) { /* Yes, so drop it */ if (tp1->data != NULL) { - (void)sctp_release_pr_sctp_chunk(stcb, tp1, - (SCTP_RESPONSE_TO_USER_REQ | SCTP_NOTIFY_DATAGRAM_SENT), + (void)sctp_release_pr_sctp_chunk(stcb, tp1, 1, SCTP_SO_NOT_LOCKED); } /* Make sure to flag we had a FR */ @@ -3632,8 +3630,7 @@ sctp_try_advance_peer_ack_point(struct s /* Yes so drop it */ if (tp1->data) { (void)sctp_release_pr_sctp_chunk(stcb, tp1, - (SCTP_RESPONSE_TO_USER_REQ | SCTP_NOTIFY_DATAGRAM_SENT), - SCTP_SO_NOT_LOCKED); + 1, SCTP_SO_NOT_LOCKED); } } else { /* Modified: stable/8/sys/netinet/sctp_input.c ============================================================================== --- stable/8/sys/netinet/sctp_input.c Thu Mar 7 19:38:04 2013 (r247924) +++ stable/8/sys/netinet/sctp_input.c Thu Mar 7 19:40:14 2013 (r247925) @@ -300,8 +300,8 @@ sctp_process_init(struct sctp_init_chunk asoc->send_queue_cnt--; if (chk->data != NULL) { sctp_free_bufspace(stcb, asoc, chk, 1); - sctp_ulp_notify(SCTP_NOTIFY_DG_FAIL, stcb, - SCTP_NOTIFY_DATAGRAM_UNSENT, chk, SCTP_SO_NOT_LOCKED); + sctp_ulp_notify(SCTP_NOTIFY_UNSENT_DG_FAIL, stcb, + 0, chk, SCTP_SO_NOT_LOCKED); if (chk->data) { sctp_m_freem(chk->data); chk->data = NULL; @@ -318,8 +318,7 @@ sctp_process_init(struct sctp_init_chunk TAILQ_REMOVE(&outs->outqueue, sp, next); asoc->stream_queue_cnt--; sctp_ulp_notify(SCTP_NOTIFY_SPECIAL_SP_FAIL, - stcb, SCTP_NOTIFY_DATAGRAM_UNSENT, - sp, SCTP_SO_NOT_LOCKED); + stcb, 0, sp, SCTP_SO_NOT_LOCKED); if (sp->data) { sctp_m_freem(sp->data); sp->data = NULL; @@ -1006,7 +1005,7 @@ sctp_handle_shutdown_ack(struct sctp_shu if (!TAILQ_EMPTY(&asoc->send_queue) || !TAILQ_EMPTY(&asoc->sent_queue) || !stcb->asoc.ss_functions.sctp_ss_is_empty(stcb, asoc)) { - sctp_report_all_outbound(stcb, 0, SCTP_SO_NOT_LOCKED); + sctp_report_all_outbound(stcb, 0, 0, SCTP_SO_NOT_LOCKED); } /* stop the timer */ sctp_timer_stop(SCTP_TIMER_TYPE_SHUTDOWN, stcb->sctp_ep, stcb, net, SCTP_FROM_SCTP_INPUT + SCTP_LOC_9); @@ -1889,7 +1888,7 @@ sctp_process_cookie_existing(struct mbuf /* send up all the data */ SCTP_TCB_SEND_LOCK(stcb); - sctp_report_all_outbound(stcb, 1, SCTP_SO_NOT_LOCKED); + sctp_report_all_outbound(stcb, 0, 1, SCTP_SO_NOT_LOCKED); for (i = 0; i < stcb->asoc.streamoutcnt; i++) { stcb->asoc.strmout[i].stream_no = i; stcb->asoc.strmout[i].next_sequence_sent = 0; @@ -3176,7 +3175,7 @@ sctp_handle_shutdown_complete(struct sct if (!TAILQ_EMPTY(&asoc->send_queue) || !TAILQ_EMPTY(&asoc->sent_queue) || !stcb->asoc.ss_functions.sctp_ss_is_empty(stcb, asoc)) { - sctp_report_all_outbound(stcb, 0, SCTP_SO_NOT_LOCKED); + sctp_report_all_outbound(stcb, 0, 0, SCTP_SO_NOT_LOCKED); } } /* stop the timer */ Modified: stable/8/sys/netinet/sctp_output.c ============================================================================== --- stable/8/sys/netinet/sctp_output.c Thu Mar 7 19:38:04 2013 (r247924) +++ stable/8/sys/netinet/sctp_output.c Thu Mar 7 19:40:14 2013 (r247925) @@ -6091,14 +6091,14 @@ sctp_prune_prsctp(struct sctp_tcb *stcb, * if the mbuf is here */ int ret_spc; - int cause; + uint8_t sent; if (chk->sent > SCTP_DATAGRAM_UNSENT) - cause = SCTP_RESPONSE_TO_USER_REQ | SCTP_NOTIFY_DATAGRAM_SENT; + sent = 1; else - cause = SCTP_RESPONSE_TO_USER_REQ | SCTP_NOTIFY_DATAGRAM_UNSENT; + sent = 0; ret_spc = sctp_release_pr_sctp_chunk(stcb, chk, - cause, + sent, SCTP_SO_LOCKED); freed_spc += ret_spc; if (freed_spc >= dataout) { @@ -6121,8 +6121,7 @@ sctp_prune_prsctp(struct sctp_tcb *stcb, int ret_spc; ret_spc = sctp_release_pr_sctp_chunk(stcb, chk, - SCTP_RESPONSE_TO_USER_REQ | SCTP_NOTIFY_DATAGRAM_UNSENT, - SCTP_SO_LOCKED); + 0, SCTP_SO_LOCKED); freed_spc += ret_spc; if (freed_spc >= dataout) { Modified: stable/8/sys/netinet/sctp_pcb.c ============================================================================== --- stable/8/sys/netinet/sctp_pcb.c Thu Mar 7 19:38:04 2013 (r247924) +++ stable/8/sys/netinet/sctp_pcb.c Thu Mar 7 19:40:14 2013 (r247925) @@ -4987,8 +4987,7 @@ sctp_free_assoc(struct sctp_inpcb *inp, if (so) { /* Still an open socket - report */ sctp_ulp_notify(SCTP_NOTIFY_SPECIAL_SP_FAIL, stcb, - SCTP_NOTIFY_DATAGRAM_UNSENT, - (void *)sp, SCTP_SO_LOCKED); + 0, (void *)sp, SCTP_SO_LOCKED); } if (sp->data) { sctp_m_freem(sp->data); @@ -5048,8 +5047,8 @@ sctp_free_assoc(struct sctp_inpcb *inp, if (chk->data) { if (so) { /* Still a socket? */ - sctp_ulp_notify(SCTP_NOTIFY_DG_FAIL, stcb, - SCTP_NOTIFY_DATAGRAM_UNSENT, chk, SCTP_SO_LOCKED); + sctp_ulp_notify(SCTP_NOTIFY_UNSENT_DG_FAIL, stcb, + 0, chk, SCTP_SO_LOCKED); } if (chk->data) { sctp_m_freem(chk->data); @@ -5072,8 +5071,8 @@ sctp_free_assoc(struct sctp_inpcb *inp, if (chk->data) { if (so) { /* Still a socket? */ - sctp_ulp_notify(SCTP_NOTIFY_DG_FAIL, stcb, - SCTP_NOTIFY_DATAGRAM_SENT, chk, SCTP_SO_LOCKED); + sctp_ulp_notify(SCTP_NOTIFY_SENT_DG_FAIL, stcb, + 0, chk, SCTP_SO_LOCKED); } if (chk->data) { sctp_m_freem(chk->data); Modified: stable/8/sys/netinet/sctp_timer.c ============================================================================== --- stable/8/sys/netinet/sctp_timer.c Thu Mar 7 19:38:04 2013 (r247924) +++ stable/8/sys/netinet/sctp_timer.c Thu Mar 7 19:40:14 2013 (r247925) @@ -614,7 +614,7 @@ start_again: if (chk->data) { (void)sctp_release_pr_sctp_chunk(stcb, chk, - (SCTP_RESPONSE_TO_USER_REQ | SCTP_NOTIFY_DATAGRAM_SENT), + 1, SCTP_SO_NOT_LOCKED); cnt_abandoned++; } @@ -627,7 +627,7 @@ start_again: if (chk->data) { (void)sctp_release_pr_sctp_chunk(stcb, chk, - (SCTP_RESPONSE_TO_USER_REQ | SCTP_NOTIFY_DATAGRAM_SENT), + 1, SCTP_SO_NOT_LOCKED); cnt_abandoned++; } Modified: stable/8/sys/netinet/sctputil.c ============================================================================== --- stable/8/sys/netinet/sctputil.c Thu Mar 7 19:38:04 2013 (r247924) +++ stable/8/sys/netinet/sctputil.c Thu Mar 7 19:40:14 2013 (r247925) @@ -2810,7 +2810,7 @@ sctp_notify_peer_addr_change(struct sctp static void -sctp_notify_send_failed(struct sctp_tcb *stcb, uint32_t error, +sctp_notify_send_failed(struct sctp_tcb *stcb, uint8_t sent, uint32_t error, struct sctp_tmit_chunk *chk, int so_locked #if !defined(__APPLE__) && !defined(SCTP_SO_LOCK_TESTING) SCTP_UNUSED @@ -2844,10 +2844,11 @@ sctp_notify_send_failed(struct sctp_tcb if (sctp_stcb_is_feature_on(stcb->sctp_ep, stcb, SCTP_PCB_FLAGS_RECVNSENDFAILEVNT)) { ssfe = mtod(m_notify, struct sctp_send_failed_event *); ssfe->ssfe_type = SCTP_SEND_FAILED_EVENT; - if (error == SCTP_NOTIFY_DATAGRAM_UNSENT) - ssfe->ssfe_flags = SCTP_DATA_UNSENT; - else + if (sent) { ssfe->ssfe_flags = SCTP_DATA_SENT; + } else { + ssfe->ssfe_flags = SCTP_DATA_UNSENT; + } ssfe->ssfe_length = length; ssfe->ssfe_error = error; /* not exactly what the user sent in, but should be close :) */ @@ -2862,10 +2863,11 @@ sctp_notify_send_failed(struct sctp_tcb } else { ssf = mtod(m_notify, struct sctp_send_failed *); ssf->ssf_type = SCTP_SEND_FAILED; - if (error == SCTP_NOTIFY_DATAGRAM_UNSENT) - ssf->ssf_flags = SCTP_DATA_UNSENT; - else + if (sent) { ssf->ssf_flags = SCTP_DATA_SENT; + } else { + ssf->ssf_flags = SCTP_DATA_UNSENT; + } ssf->ssf_length = length; ssf->ssf_error = error; /* not exactly what the user sent in, but should be close :) */ @@ -2954,10 +2956,7 @@ sctp_notify_send_failed2(struct sctp_tcb if (sctp_stcb_is_feature_on(stcb->sctp_ep, stcb, SCTP_PCB_FLAGS_RECVNSENDFAILEVNT)) { ssfe = mtod(m_notify, struct sctp_send_failed_event *); ssfe->ssfe_type = SCTP_SEND_FAILED; - if (error == SCTP_NOTIFY_DATAGRAM_UNSENT) - ssfe->ssfe_flags = SCTP_DATA_UNSENT; - else - ssfe->ssfe_flags = SCTP_DATA_SENT; + ssfe->ssfe_flags = SCTP_DATA_UNSENT; ssfe->ssfe_length = length; ssfe->ssfe_error = error; /* not exactly what the user sent in, but should be close :) */ @@ -2976,10 +2975,7 @@ sctp_notify_send_failed2(struct sctp_tcb } else { ssf = mtod(m_notify, struct sctp_send_failed *); ssf->ssf_type = SCTP_SEND_FAILED; - if (error == SCTP_NOTIFY_DATAGRAM_UNSENT) - ssf->ssf_flags = SCTP_DATA_UNSENT; - else - ssf->ssf_flags = SCTP_DATA_SENT; + ssf->ssf_flags = SCTP_DATA_UNSENT; ssf->ssf_length = length; ssf->ssf_error = error; /* not exactly what the user sent in, but should be close :) */ @@ -3543,8 +3539,12 @@ sctp_ulp_notify(uint32_t notification, s sctp_notify_send_failed2(stcb, error, (struct sctp_stream_queue_pending *)data, so_locked); break; - case SCTP_NOTIFY_DG_FAIL: - sctp_notify_send_failed(stcb, error, + case SCTP_NOTIFY_SENT_DG_FAIL: + sctp_notify_send_failed(stcb, 1, error, + (struct sctp_tmit_chunk *)data, so_locked); + break; + case SCTP_NOTIFY_UNSENT_DG_FAIL: + sctp_notify_send_failed(stcb, 0, error, (struct sctp_tmit_chunk *)data, so_locked); break; case SCTP_NOTIFY_PARTIAL_DELVIERY_INDICATION: @@ -3642,7 +3642,7 @@ sctp_ulp_notify(uint32_t notification, s } void -sctp_report_all_outbound(struct sctp_tcb *stcb, int holds_lock, int so_locked +sctp_report_all_outbound(struct sctp_tcb *stcb, uint16_t error, int holds_lock, int so_locked #if !defined(__APPLE__) && !defined(SCTP_SO_LOCK_TESTING) SCTP_UNUSED #endif @@ -3677,8 +3677,8 @@ sctp_report_all_outbound(struct sctp_tcb asoc->sent_queue_cnt--; if (chk->data != NULL) { sctp_free_bufspace(stcb, asoc, chk, 1); - sctp_ulp_notify(SCTP_NOTIFY_DG_FAIL, stcb, - SCTP_NOTIFY_DATAGRAM_SENT, chk, so_locked); + sctp_ulp_notify(SCTP_NOTIFY_SENT_DG_FAIL, stcb, + error, chk, so_locked); if (chk->data) { sctp_m_freem(chk->data); chk->data = NULL; @@ -3693,8 +3693,8 @@ sctp_report_all_outbound(struct sctp_tcb asoc->send_queue_cnt--; if (chk->data != NULL) { sctp_free_bufspace(stcb, asoc, chk, 1); - sctp_ulp_notify(SCTP_NOTIFY_DG_FAIL, stcb, - SCTP_NOTIFY_DATAGRAM_UNSENT, chk, so_locked); + sctp_ulp_notify(SCTP_NOTIFY_UNSENT_DG_FAIL, stcb, + error, chk, so_locked); if (chk->data) { sctp_m_freem(chk->data); chk->data = NULL; @@ -3714,7 +3714,7 @@ sctp_report_all_outbound(struct sctp_tcb sctp_free_spbufspace(stcb, asoc, sp); if (sp->data) { sctp_ulp_notify(SCTP_NOTIFY_SPECIAL_SP_FAIL, stcb, - SCTP_NOTIFY_DATAGRAM_UNSENT, (void *)sp, so_locked); + error, (void *)sp, so_locked); if (sp->data) { sctp_m_freem(sp->data); sp->data = NULL; @@ -3757,7 +3757,7 @@ sctp_abort_notification(struct sctp_tcb return; } /* Tell them we lost the asoc */ - sctp_report_all_outbound(stcb, 1, so_locked); + sctp_report_all_outbound(stcb, error, 1, so_locked); if (from_peer) { sctp_ulp_notify(SCTP_NOTIFY_ASSOC_REM_ABORTED, stcb, error, abort, so_locked); } else { @@ -4655,7 +4655,7 @@ sctp_free_bufspace(struct sctp_tcb *stcb int sctp_release_pr_sctp_chunk(struct sctp_tcb *stcb, struct sctp_tmit_chunk *tp1, - int reason, int so_locked + uint8_t sent, int so_locked #if !defined(__APPLE__) && !defined(SCTP_SO_LOCK_TESTING) SCTP_UNUSED #endif @@ -4682,7 +4682,11 @@ sctp_release_pr_sctp_chunk(struct sctp_t sctp_free_bufspace(stcb, &stcb->asoc, tp1, 1); stcb->asoc.peers_rwnd += tp1->send_size; stcb->asoc.peers_rwnd += SCTP_BASE_SYSCTL(sctp_peer_chunk_oh); - sctp_ulp_notify(SCTP_NOTIFY_DG_FAIL, stcb, reason, tp1, so_locked); + if (sent) { + sctp_ulp_notify(SCTP_NOTIFY_SENT_DG_FAIL, stcb, 0, tp1, so_locked); + } else { + sctp_ulp_notify(SCTP_NOTIFY_UNSENT_DG_FAIL, stcb, 0, tp1, so_locked); + } if (tp1->data) { sctp_m_freem(tp1->data); tp1->data = NULL; @@ -4729,7 +4733,11 @@ sctp_release_pr_sctp_chunk(struct sctp_t chk = tp1; ret_sz += tp1->book_size; sctp_free_bufspace(stcb, &stcb->asoc, tp1, 1); - sctp_ulp_notify(SCTP_NOTIFY_DG_FAIL, stcb, reason, tp1, so_locked); + if (sent) { + sctp_ulp_notify(SCTP_NOTIFY_SENT_DG_FAIL, stcb, 0, tp1, so_locked); + } else { + sctp_ulp_notify(SCTP_NOTIFY_UNSENT_DG_FAIL, stcb, 0, tp1, so_locked); + } if (tp1->data) { sctp_m_freem(tp1->data); tp1->data = NULL; Modified: stable/8/sys/netinet/sctputil.h ============================================================================== --- stable/8/sys/netinet/sctputil.h Thu Mar 7 19:38:04 2013 (r247924) +++ stable/8/sys/netinet/sctputil.h Thu Mar 7 19:40:14 2013 (r247925) @@ -170,7 +170,7 @@ sctp_pull_off_control_to_new_inp(struct void sctp_stop_timers_for_shutdown(struct sctp_tcb *); void -sctp_report_all_outbound(struct sctp_tcb *, int, int +sctp_report_all_outbound(struct sctp_tcb *, uint16_t, int, int #if !defined(__APPLE__) && !defined(SCTP_SO_LOCK_TESTING) SCTP_UNUSED #endif @@ -244,7 +244,7 @@ void sctp_print_address_pkt(struct ip *, int sctp_release_pr_sctp_chunk(struct sctp_tcb *, struct sctp_tmit_chunk *, - int, int + uint8_t, int #if !defined(__APPLE__) && !defined(SCTP_SO_LOCK_TESTING) SCTP_UNUSED #endif From owner-svn-src-stable@FreeBSD.ORG Thu Mar 7 20:04:06 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 4ADF7735; Thu, 7 Mar 2013 20:04:06 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 2E78DFA4; Thu, 7 Mar 2013 20:04:06 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r27K45An088833; Thu, 7 Mar 2013 20:04:05 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r27K45Or088830; Thu, 7 Mar 2013 20:04:05 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201303072004.r27K45Or088830@svn.freebsd.org> From: Michael Tuexen Date: Thu, 7 Mar 2013 20:04:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r247926 - stable/8/sys/netinet X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Mar 2013 20:04:06 -0000 Author: tuexen Date: Thu Mar 7 20:04:05 2013 New Revision: 247926 URL: http://svnweb.freebsd.org/changeset/base/247926 Log: MFC r235418: Support SCTP_REMOTE_ERROR notification. ` Modified: stable/8/sys/netinet/sctp_constants.h stable/8/sys/netinet/sctp_input.c stable/8/sys/netinet/sctputil.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/netinet/ (props changed) Modified: stable/8/sys/netinet/sctp_constants.h ============================================================================== --- stable/8/sys/netinet/sctp_constants.h Thu Mar 7 19:40:14 2013 (r247925) +++ stable/8/sys/netinet/sctp_constants.h Thu Mar 7 20:04:05 2013 (r247926) @@ -765,6 +765,7 @@ __FBSDID("$FreeBSD$"); #define SCTP_NOTIFY_AUTH_FREE_KEY 24 #define SCTP_NOTIFY_NO_PEER_AUTH 25 #define SCTP_NOTIFY_SENDER_DRY 26 +#define SCTP_NOTIFY_REMOTE_ERROR 27 /* This is the value for messages that are NOT completely * copied down where we will start to split the message. Modified: stable/8/sys/netinet/sctp_input.c ============================================================================== --- stable/8/sys/netinet/sctp_input.c Thu Mar 7 19:40:14 2013 (r247925) +++ stable/8/sys/netinet/sctp_input.c Thu Mar 7 20:04:05 2013 (r247926) @@ -1111,7 +1111,7 @@ sctp_handle_error(struct sctp_chunkhdr * { int chklen; struct sctp_paramhdr *phdr; - uint16_t error_type; + uint16_t error, error_type; uint16_t error_len; struct sctp_association *asoc; int adjust; @@ -1126,6 +1126,7 @@ sctp_handle_error(struct sctp_chunkhdr * phdr = (struct sctp_paramhdr *)((caddr_t)ch + sizeof(struct sctp_chunkhdr)); chklen = ntohs(ch->chunk_length) - sizeof(struct sctp_chunkhdr); + error = 0; while ((size_t)chklen >= sizeof(struct sctp_paramhdr)) { /* Process an Error Cause */ error_type = ntohs(phdr->param_type); @@ -1136,6 +1137,10 @@ sctp_handle_error(struct sctp_chunkhdr * chklen, error_len); return (0); } + if (error == 0) { + /* report the first error cause */ + error = error_type; + } switch (error_type) { case SCTP_CAUSE_INVALID_STREAM: case SCTP_CAUSE_MISSING_PARAM: @@ -1252,6 +1257,7 @@ sctp_handle_error(struct sctp_chunkhdr * chklen -= adjust; phdr = (struct sctp_paramhdr *)((caddr_t)phdr + adjust); } + sctp_ulp_notify(SCTP_NOTIFY_REMOTE_ERROR, stcb, error, ch, SCTP_SO_NOT_LOCKED); return (0); } Modified: stable/8/sys/netinet/sctputil.c ============================================================================== --- stable/8/sys/netinet/sctputil.c Thu Mar 7 19:40:14 2013 (r247925) +++ stable/8/sys/netinet/sctputil.c Thu Mar 7 20:04:05 2013 (r247926) @@ -3464,6 +3464,63 @@ sctp_notify_stream_reset(struct sctp_tcb } +static void +sctp_notify_remote_error(struct sctp_tcb *stcb, uint16_t error, struct sctp_error_chunk *chunk) +{ + struct mbuf *m_notify; + struct sctp_remote_error *sre; + struct sctp_queued_to_read *control; + size_t notif_len, chunk_len; + + if ((stcb == NULL) || + sctp_stcb_is_feature_off(stcb->sctp_ep, stcb, SCTP_PCB_FLAGS_RECVPEERERR)) { + return; + } + if (chunk != NULL) { + chunk_len = htons(chunk->ch.chunk_length); + } else { + chunk_len = 0; + } + notif_len = sizeof(struct sctp_remote_error) + chunk_len; + m_notify = sctp_get_mbuf_for_msg(notif_len, 0, M_DONTWAIT, 1, MT_DATA); + if (m_notify == NULL) { + /* Retry with smaller value. */ + notif_len = sizeof(struct sctp_remote_error); + m_notify = sctp_get_mbuf_for_msg(notif_len, 0, M_DONTWAIT, 1, MT_DATA); + if (m_notify == NULL) { + return; + } + } + SCTP_BUF_NEXT(m_notify) = NULL; + sre = mtod(m_notify, struct sctp_remote_error *); + sre->sre_type = SCTP_REMOTE_ERROR; + sre->sre_flags = 0; + sre->sre_length = sizeof(struct sctp_remote_error); + sre->sre_error = error; + sre->sre_assoc_id = sctp_get_associd(stcb); + if (notif_len > sizeof(struct sctp_remote_error)) { + memcpy(sre->sre_data, chunk, chunk_len); + sre->sre_length += chunk_len; + } + SCTP_BUF_LEN(m_notify) = sre->sre_length; + control = sctp_build_readq_entry(stcb, stcb->asoc.primary_destination, + 0, 0, stcb->asoc.context, 0, 0, 0, + m_notify); + if (control != NULL) { + control->length = SCTP_BUF_LEN(m_notify); + /* not that we need this */ + control->tail_mbuf = m_notify; + control->spec_flags = M_NOTIFICATION; + sctp_add_to_readq(stcb->sctp_ep, stcb, + control, + &stcb->sctp_socket->so_rcv, 1, + SCTP_READ_LOCK_NOT_HELD, SCTP_SO_NOT_LOCKED); + } else { + sctp_m_freem(m_notify); + } +} + + void sctp_ulp_notify(uint32_t notification, struct sctp_tcb *stcb, uint32_t error, void *data, int so_locked @@ -3634,6 +3691,9 @@ sctp_ulp_notify(uint32_t notification, s case SCTP_NOTIFY_SENDER_DRY: sctp_notify_sender_dry_event(stcb, so_locked); break; + case SCTP_NOTIFY_REMOTE_ERROR: + sctp_notify_remote_error(stcb, error, data); + break; default: SCTPDBG(SCTP_DEBUG_UTIL1, "%s: unknown notification %xh (%u)\n", __FUNCTION__, notification, notification); From owner-svn-src-stable@FreeBSD.ORG Thu Mar 7 20:06:28 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 2DA7D9A5; Thu, 7 Mar 2013 20:06:28 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 15A29FC7; Thu, 7 Mar 2013 20:06:28 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r27K6RWb089400; Thu, 7 Mar 2013 20:06:27 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r27K6RNq089399; Thu, 7 Mar 2013 20:06:27 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201303072006.r27K6RNq089399@svn.freebsd.org> From: Michael Tuexen Date: Thu, 7 Mar 2013 20:06:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r247927 - stable/8/sys/netinet X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Mar 2013 20:06:28 -0000 Author: tuexen Date: Thu Mar 7 20:06:27 2013 New Revision: 247927 URL: http://svnweb.freebsd.org/changeset/base/247927 Log: MFC r235554: Support SCTP_EOF also for 1-to-1 style sockets. Modified: stable/8/sys/netinet/sctp_output.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/netinet/ (props changed) Modified: stable/8/sys/netinet/sctp_output.c ============================================================================== --- stable/8/sys/netinet/sctp_output.c Thu Mar 7 20:04:05 2013 (r247926) +++ stable/8/sys/netinet/sctp_output.c Thu Mar 7 20:06:27 2013 (r247927) @@ -13610,8 +13610,7 @@ skip_preblock: dataless_eof: /* EOF thing ? */ if ((srcv->sinfo_flags & SCTP_EOF) && - (got_all_of_the_send == 1) && - (stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_UDPTYPE)) { + (got_all_of_the_send == 1)) { int cnt; SCTP_STAT_INCR(sctps_sends_with_eof); From owner-svn-src-stable@FreeBSD.ORG Thu Mar 7 20:08:35 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id C4A78B34; Thu, 7 Mar 2013 20:08:35 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 9E251FDD; Thu, 7 Mar 2013 20:08:35 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r27K8Z9g089792; Thu, 7 Mar 2013 20:08:35 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r27K8Zmk089789; Thu, 7 Mar 2013 20:08:35 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201303072008.r27K8Zmk089789@svn.freebsd.org> From: Michael Tuexen Date: Thu, 7 Mar 2013 20:08:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r247928 - stable/8/sys/netinet X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Mar 2013 20:08:35 -0000 Author: tuexen Date: Thu Mar 7 20:08:34 2013 New Revision: 247928 URL: http://svnweb.freebsd.org/changeset/base/247928 Log: MFC r235557: Use a default for max_burst of 4 and l2var of 2. This was discussed with rrs@. Modified: stable/8/sys/netinet/sctp_constants.h stable/8/sys/netinet/sctp_sysctl.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/netinet/ (props changed) Modified: stable/8/sys/netinet/sctp_constants.h ============================================================================== --- stable/8/sys/netinet/sctp_constants.h Thu Mar 7 20:06:27 2013 (r247927) +++ stable/8/sys/netinet/sctp_constants.h Thu Mar 7 20:08:34 2013 (r247928) @@ -348,7 +348,7 @@ __FBSDID("$FreeBSD$"); #define SCTP_NO_FR_UNLESS_SEGMENT_SMALLER 1 /* default max I can burst out after a fast retransmit, 0 disables it */ -#define SCTP_DEF_MAX_BURST 0 +#define SCTP_DEF_MAX_BURST 4 #define SCTP_DEF_HBMAX_BURST 4 #define SCTP_DEF_FRMAX_BURST 4 Modified: stable/8/sys/netinet/sctp_sysctl.h ============================================================================== --- stable/8/sys/netinet/sctp_sysctl.h Thu Mar 7 20:06:27 2013 (r247927) +++ stable/8/sys/netinet/sctp_sysctl.h Thu Mar 7 20:08:34 2013 (r247928) @@ -377,7 +377,7 @@ struct sctp_sysctl { #define SCTPCTL_ABC_L_VAR_DESC "SCTP ABC max increase per SACK (L)" #define SCTPCTL_ABC_L_VAR_MIN 0 #define SCTPCTL_ABC_L_VAR_MAX 0xFFFFFFFF -#define SCTPCTL_ABC_L_VAR_DEFAULT 1 +#define SCTPCTL_ABC_L_VAR_DEFAULT 2 /* max_chained_mbufs: Default max number of small mbufs on a chain */ #define SCTPCTL_MAX_CHAINED_MBUFS_DESC "Default max number of small mbufs on a chain" From owner-svn-src-stable@FreeBSD.ORG Thu Mar 7 20:12:40 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 23F4FCDF; Thu, 7 Mar 2013 20:12:40 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 14748A2; Thu, 7 Mar 2013 20:12:40 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r27KCeRt092209; Thu, 7 Mar 2013 20:12:40 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r27KCWN6092152; Thu, 7 Mar 2013 20:12:32 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201303072012.r27KCWN6092152@svn.freebsd.org> From: Michael Tuexen Date: Thu, 7 Mar 2013 20:12:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r247929 - in stable/8/sys: netinet netinet6 X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Mar 2013 20:12:40 -0000 Author: tuexen Date: Thu Mar 7 20:12:31 2013 New Revision: 247929 URL: http://svnweb.freebsd.org/changeset/base/247929 Log: MFC r235828: Use consistent text at the begining of the files. Modified: stable/8/sys/netinet/sctp.h stable/8/sys/netinet/sctp_asconf.c stable/8/sys/netinet/sctp_asconf.h stable/8/sys/netinet/sctp_auth.c stable/8/sys/netinet/sctp_auth.h stable/8/sys/netinet/sctp_bsd_addr.c stable/8/sys/netinet/sctp_bsd_addr.h stable/8/sys/netinet/sctp_cc_functions.c stable/8/sys/netinet/sctp_constants.h stable/8/sys/netinet/sctp_crc32.c stable/8/sys/netinet/sctp_crc32.h stable/8/sys/netinet/sctp_dtrace_declare.h stable/8/sys/netinet/sctp_dtrace_define.h stable/8/sys/netinet/sctp_header.h stable/8/sys/netinet/sctp_indata.c stable/8/sys/netinet/sctp_indata.h stable/8/sys/netinet/sctp_input.c stable/8/sys/netinet/sctp_input.h stable/8/sys/netinet/sctp_lock_bsd.h stable/8/sys/netinet/sctp_os.h stable/8/sys/netinet/sctp_os_bsd.h stable/8/sys/netinet/sctp_output.c stable/8/sys/netinet/sctp_output.h stable/8/sys/netinet/sctp_pcb.c stable/8/sys/netinet/sctp_pcb.h stable/8/sys/netinet/sctp_peeloff.c stable/8/sys/netinet/sctp_peeloff.h stable/8/sys/netinet/sctp_ss_functions.c stable/8/sys/netinet/sctp_structs.h stable/8/sys/netinet/sctp_sysctl.c stable/8/sys/netinet/sctp_sysctl.h stable/8/sys/netinet/sctp_timer.c stable/8/sys/netinet/sctp_timer.h stable/8/sys/netinet/sctp_uio.h stable/8/sys/netinet/sctp_usrreq.c stable/8/sys/netinet/sctp_var.h stable/8/sys/netinet/sctputil.c stable/8/sys/netinet/sctputil.h stable/8/sys/netinet6/sctp6_usrreq.c stable/8/sys/netinet6/sctp6_var.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/netinet/ (props changed) stable/8/sys/netinet6/ (props changed) Modified: stable/8/sys/netinet/sctp.h ============================================================================== --- stable/8/sys/netinet/sctp.h Thu Mar 7 20:08:34 2013 (r247928) +++ stable/8/sys/netinet/sctp.h Thu Mar 7 20:12:31 2013 (r247929) @@ -1,7 +1,7 @@ /*- * Copyright (c) 2001-2008, by Cisco Systems, Inc. All rights reserved. - * Copyright (c) 2008-2011, by Randall Stewart. All rights reserved. - * Copyright (c) 2008-2011, by Michael Tuexen. All rights reserved. + * Copyright (c) 2008-2012, by Randall Stewart. All rights reserved. + * Copyright (c) 2008-2012, by Michael Tuexen. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: @@ -29,7 +29,6 @@ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ -/* $KAME: sctp.h,v 1.18 2005/03/06 16:04:16 itojun Exp $ */ #include __FBSDID("$FreeBSD$"); @@ -37,6 +36,7 @@ __FBSDID("$FreeBSD$"); #ifndef _NETINET_SCTP_H_ #define _NETINET_SCTP_H_ + #include Modified: stable/8/sys/netinet/sctp_asconf.c ============================================================================== --- stable/8/sys/netinet/sctp_asconf.c Thu Mar 7 20:08:34 2013 (r247928) +++ stable/8/sys/netinet/sctp_asconf.c Thu Mar 7 20:12:31 2013 (r247929) @@ -1,7 +1,7 @@ /*- * Copyright (c) 2001-2007, by Cisco Systems, Inc. All rights reserved. - * Copyright (c) 2008-2011, by Randall Stewart. All rights reserved. - * Copyright (c) 2008-2011, by Michael Tuexen. All rights reserved. + * Copyright (c) 2008-2012, by Randall Stewart. All rights reserved. + * Copyright (c) 2008-2012, by Michael Tuexen. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: @@ -30,10 +30,9 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ -/* $KAME: sctp_asconf.c,v 1.24 2005/03/06 16:04:16 itojun Exp $ */ - #include __FBSDID("$FreeBSD$"); + #include #include #include Modified: stable/8/sys/netinet/sctp_asconf.h ============================================================================== --- stable/8/sys/netinet/sctp_asconf.h Thu Mar 7 20:08:34 2013 (r247928) +++ stable/8/sys/netinet/sctp_asconf.h Thu Mar 7 20:12:31 2013 (r247929) @@ -1,7 +1,7 @@ /*- * Copyright (c) 2001-2007, by Cisco Systems, Inc. All rights reserved. - * Copyright (c) 2008-2011, by Randall Stewart. All rights reserved. - * Copyright (c) 2008-2011, by Michael Tuexen. All rights reserved. + * Copyright (c) 2008-2012, by Randall Stewart. All rights reserved. + * Copyright (c) 2008-2012, by Michael Tuexen. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: @@ -30,8 +30,6 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ -/* $KAME: sctp_asconf.h,v 1.8 2005/03/06 16:04:16 itojun Exp $ */ - #include __FBSDID("$FreeBSD$"); Modified: stable/8/sys/netinet/sctp_auth.c ============================================================================== --- stable/8/sys/netinet/sctp_auth.c Thu Mar 7 20:08:34 2013 (r247928) +++ stable/8/sys/netinet/sctp_auth.c Thu Mar 7 20:12:31 2013 (r247929) @@ -1,7 +1,7 @@ /*- * Copyright (c) 2001-2008, by Cisco Systems, Inc. All rights reserved. - * Copyright (c) 2008-2011, by Randall Stewart. All rights reserved. - * Copyright (c) 2008-2011, by Michael Tuexen. All rights reserved. + * Copyright (c) 2008-2012, by Randall Stewart. All rights reserved. + * Copyright (c) 2008-2012, by Michael Tuexen. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: Modified: stable/8/sys/netinet/sctp_auth.h ============================================================================== --- stable/8/sys/netinet/sctp_auth.h Thu Mar 7 20:08:34 2013 (r247928) +++ stable/8/sys/netinet/sctp_auth.h Thu Mar 7 20:12:31 2013 (r247929) @@ -1,7 +1,7 @@ /*- * Copyright (c) 2001-2008, by Cisco Systems, Inc. All rights reserved. - * Copyright (c) 2008-2011, by Randall Stewart. All rights reserved. - * Copyright (c) 2008-2011, by Michael Tuexen. All rights reserved. + * Copyright (c) 2008-2012, by Randall Stewart. All rights reserved. + * Copyright (c) 2008-2012, by Michael Tuexen. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: @@ -33,8 +33,8 @@ #include __FBSDID("$FreeBSD$"); -#ifndef __SCTP_AUTH_H__ -#define __SCTP_AUTH_H__ +#ifndef _NETINET_SCTP_AUTH_H_ +#define _NETINET_SCTP_AUTH_H_ /* digest lengths */ Modified: stable/8/sys/netinet/sctp_bsd_addr.c ============================================================================== --- stable/8/sys/netinet/sctp_bsd_addr.c Thu Mar 7 20:08:34 2013 (r247928) +++ stable/8/sys/netinet/sctp_bsd_addr.c Thu Mar 7 20:12:31 2013 (r247929) @@ -1,7 +1,7 @@ /*- * Copyright (c) 2001-2007, by Cisco Systems, Inc. All rights reserved. - * Copyright (c) 2008-2011, by Randall Stewart. All rights reserved. - * Copyright (c) 2008-2011, by Michael Tuexen. All rights reserved. + * Copyright (c) 2008-2012, by Randall Stewart. All rights reserved. + * Copyright (c) 2008-2012, by Michael Tuexen. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: @@ -30,8 +30,6 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ -/* $KAME: sctp_output.c,v 1.46 2005/03/06 16:04:17 itojun Exp $ */ - #include __FBSDID("$FreeBSD$"); Modified: stable/8/sys/netinet/sctp_bsd_addr.h ============================================================================== --- stable/8/sys/netinet/sctp_bsd_addr.h Thu Mar 7 20:08:34 2013 (r247928) +++ stable/8/sys/netinet/sctp_bsd_addr.h Thu Mar 7 20:12:31 2013 (r247929) @@ -1,7 +1,7 @@ /*- * Copyright (c) 2001-2007, by Cisco Systems, Inc. All rights reserved. - * Copyright (c) 2008-2011, by Randall Stewart. All rights reserved. - * Copyright (c) 2008-2011, by Michael Tuexen. All rights reserved. + * Copyright (c) 2008-2012, by Randall Stewart. All rights reserved. + * Copyright (c) 2008-2012, by Michael Tuexen. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: @@ -33,8 +33,9 @@ #include __FBSDID("$FreeBSD$"); -#ifndef __sctp_bsd_addr_h__ -#define __sctp_bsd_addr_h__ +#ifndef _NETINET_SCTP_BSD_ADDR_H_ +#define _NETINET_SCTP_BSD_ADDR_H_ + #include #if defined(_KERNEL) || defined(__Userspace__) Modified: stable/8/sys/netinet/sctp_cc_functions.c ============================================================================== --- stable/8/sys/netinet/sctp_cc_functions.c Thu Mar 7 20:08:34 2013 (r247928) +++ stable/8/sys/netinet/sctp_cc_functions.c Thu Mar 7 20:12:31 2013 (r247929) @@ -1,7 +1,7 @@ /*- * Copyright (c) 2001-2007, by Cisco Systems, Inc. All rights reserved. - * Copyright (c) 2008-2011, by Randall Stewart. All rights reserved. - * Copyright (c) 2008-2011, by Michael Tuexen. All rights reserved. + * Copyright (c) 2008-2012, by Randall Stewart. All rights reserved. + * Copyright (c) 2008-2012, by Michael Tuexen. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: @@ -30,6 +30,9 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include +__FBSDID("$FreeBSD$"); + #include #include #include @@ -44,8 +47,6 @@ #include #include #include -#include -__FBSDID("$FreeBSD$"); #define SHIFT_MPTCP_MULTI_N 40 #define SHIFT_MPTCP_MULTI_Z 16 Modified: stable/8/sys/netinet/sctp_constants.h ============================================================================== --- stable/8/sys/netinet/sctp_constants.h Thu Mar 7 20:08:34 2013 (r247928) +++ stable/8/sys/netinet/sctp_constants.h Thu Mar 7 20:12:31 2013 (r247929) @@ -1,7 +1,7 @@ /*- * Copyright (c) 2001-2008, by Cisco Systems, Inc. All rights reserved. - * Copyright (c) 2008-2011, by Randall Stewart. All rights reserved. - * Copyright (c) 2008-2011, by Michael Tuexen. All rights reserved. + * Copyright (c) 2008-2012, by Randall Stewart. All rights reserved. + * Copyright (c) 2008-2012, by Michael Tuexen. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: @@ -30,13 +30,11 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ -/* $KAME: sctp_constants.h,v 1.17 2005/03/06 16:04:17 itojun Exp $ */ - #include __FBSDID("$FreeBSD$"); -#ifndef __sctp_constants_h__ -#define __sctp_constants_h__ +#ifndef _NETINET_SCTP_CONSTANTS_H_ +#define _NETINET_SCTP_CONSTANTS_H_ /* IANA assigned port number for SCTP over UDP encapsulation */ /* For freebsd we cannot bind the port at Modified: stable/8/sys/netinet/sctp_crc32.c ============================================================================== --- stable/8/sys/netinet/sctp_crc32.c Thu Mar 7 20:08:34 2013 (r247928) +++ stable/8/sys/netinet/sctp_crc32.c Thu Mar 7 20:12:31 2013 (r247929) @@ -1,7 +1,7 @@ /*- * Copyright (c) 2001-2007, by Cisco Systems, Inc. All rights reserved. - * Copyright (c) 2008-2011, by Randall Stewart. All rights reserved. - * Copyright (c) 2008-2011, by Michael Tuexen. All rights reserved. + * Copyright (c) 2008-2012, by Randall Stewart. All rights reserved. + * Copyright (c) 2008-2012, by Michael Tuexen. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: @@ -30,9 +30,6 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ -/* $KAME: sctp_crc32.c,v 1.12 2005/03/06 16:04:17 itojun Exp $ */ - - #include __FBSDID("$FreeBSD$"); Modified: stable/8/sys/netinet/sctp_crc32.h ============================================================================== --- stable/8/sys/netinet/sctp_crc32.h Thu Mar 7 20:08:34 2013 (r247928) +++ stable/8/sys/netinet/sctp_crc32.h Thu Mar 7 20:12:31 2013 (r247929) @@ -1,7 +1,7 @@ /*- * Copyright (c) 2001-2007, by Cisco Systems, Inc. All rights reserved. - * Copyright (c) 2008-2011, by Randall Stewart. All rights reserved. - * Copyright (c) 2008-2011, by Michael Tuexen. All rights reserved. + * Copyright (c) 2008-2012, by Randall Stewart. All rights reserved. + * Copyright (c) 2008-2012, by Michael Tuexen. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: @@ -30,13 +30,11 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ -/* $KAME: sctp_crc32.h,v 1.5 2004/08/17 04:06:16 itojun Exp $ */ - #include __FBSDID("$FreeBSD$"); -#ifndef __crc32c_h__ -#define __crc32c_h__ +#ifndef _NETINET_SCTP_CRC32_H_ +#define _NETINET_SCTP_CRC32_H_ #if defined(_KERNEL) #if !defined(SCTP_WITH_NO_CSUM) Modified: stable/8/sys/netinet/sctp_dtrace_declare.h ============================================================================== --- stable/8/sys/netinet/sctp_dtrace_declare.h Thu Mar 7 20:08:34 2013 (r247928) +++ stable/8/sys/netinet/sctp_dtrace_declare.h Thu Mar 7 20:12:31 2013 (r247929) @@ -1,6 +1,6 @@ /*- - * Copyright (c) 2008-2011, by Randall Stewart. All rights reserved. - * Copyright (c) 2008-2011, by Michael Tuexen. All rights reserved. + * Copyright (c) 2008-2012, by Randall Stewart. All rights reserved. + * Copyright (c) 2008-2012, by Michael Tuexen. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: @@ -28,9 +28,13 @@ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ + #include __FBSDID("$FreeBSD$"); -#ifndef __sctp_dtrace_declare_h__ + +#ifndef _NETINET_SCTP_DTRACE_DECLARE_H_ +#define _NETINET_SCTP_DTRACE_DECLARE_H_ + #include "opt_kdtrace.h" #include #include Modified: stable/8/sys/netinet/sctp_dtrace_define.h ============================================================================== --- stable/8/sys/netinet/sctp_dtrace_define.h Thu Mar 7 20:08:34 2013 (r247928) +++ stable/8/sys/netinet/sctp_dtrace_define.h Thu Mar 7 20:12:31 2013 (r247929) @@ -1,6 +1,6 @@ /*- - * Copyright (c) 2008-2011, by Randall Stewart. All rights reserved. - * Copyright (c) 2008-2011, by Michael Tuexen. All rights reserved. + * Copyright (c) 2008-2012, by Randall Stewart. All rights reserved. + * Copyright (c) 2008-2012, by Michael Tuexen. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: @@ -28,9 +28,13 @@ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ + #include __FBSDID("$FreeBSD$"); -#ifndef __sctp_dtrace_define_h__ + +#ifndef _NETINET_SCTP_DTRACE_DEFINE_H_ +#define _NETINET_SCTP_DTRACE_DEFINE_H_ + #include "opt_kdtrace.h" #include #include Modified: stable/8/sys/netinet/sctp_header.h ============================================================================== --- stable/8/sys/netinet/sctp_header.h Thu Mar 7 20:08:34 2013 (r247928) +++ stable/8/sys/netinet/sctp_header.h Thu Mar 7 20:12:31 2013 (r247929) @@ -1,7 +1,7 @@ /*- * Copyright (c) 2001-2007, by Cisco Systems, Inc. All rights reserved. - * Copyright (c) 2008-2011, by Randall Stewart. All rights reserved. - * Copyright (c) 2008-2011, by Michael Tuexen. All rights reserved. + * Copyright (c) 2008-2012, by Randall Stewart. All rights reserved. + * Copyright (c) 2008-2012, by Michael Tuexen. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: @@ -30,13 +30,11 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ -/* $KAME: sctp_header.h,v 1.14 2005/03/06 16:04:17 itojun Exp $ */ - #include __FBSDID("$FreeBSD$"); -#ifndef __sctp_header_h__ -#define __sctp_header_h__ +#ifndef _NETINET_SCTP_HEADER_H_ +#define _NETINET_SCTP_HEADER_H_ #include #include Modified: stable/8/sys/netinet/sctp_indata.c ============================================================================== --- stable/8/sys/netinet/sctp_indata.c Thu Mar 7 20:08:34 2013 (r247928) +++ stable/8/sys/netinet/sctp_indata.c Thu Mar 7 20:12:31 2013 (r247929) @@ -1,7 +1,7 @@ /*- * Copyright (c) 2001-2007, by Cisco Systems, Inc. All rights reserved. - * Copyright (c) 2008-2011, by Randall Stewart. All rights reserved. - * Copyright (c) 2008-2011, by Michael Tuexen. All rights reserved. + * Copyright (c) 2008-2012, by Randall Stewart. All rights reserved. + * Copyright (c) 2008-2012, by Michael Tuexen. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: @@ -30,8 +30,6 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ -/* $KAME: sctp_indata.c,v 1.36 2005/03/06 16:04:17 itojun Exp $ */ - #include __FBSDID("$FreeBSD$"); Modified: stable/8/sys/netinet/sctp_indata.h ============================================================================== --- stable/8/sys/netinet/sctp_indata.h Thu Mar 7 20:08:34 2013 (r247928) +++ stable/8/sys/netinet/sctp_indata.h Thu Mar 7 20:12:31 2013 (r247929) @@ -1,7 +1,7 @@ /*- * Copyright (c) 2001-2007, by Cisco Systems, Inc. All rights reserved. - * Copyright (c) 2008-2011, by Randall Stewart. All rights reserved. - * Copyright (c) 2008-2011, by Michael Tuexen. All rights reserved. + * Copyright (c) 2008-2012, by Randall Stewart. All rights reserved. + * Copyright (c) 2008-2012, by Michael Tuexen. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: @@ -30,13 +30,11 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ -/* $KAME: sctp_indata.h,v 1.9 2005/03/06 16:04:17 itojun Exp $ */ - #include __FBSDID("$FreeBSD$"); -#ifndef __sctp_indata_h__ -#define __sctp_indata_h__ +#ifndef _NETINET_SCTP_INDATA_H_ +#define _NETINET_SCTP_INDATA_H_ #if defined(_KERNEL) || defined(__Userspace__) Modified: stable/8/sys/netinet/sctp_input.c ============================================================================== --- stable/8/sys/netinet/sctp_input.c Thu Mar 7 20:08:34 2013 (r247928) +++ stable/8/sys/netinet/sctp_input.c Thu Mar 7 20:12:31 2013 (r247929) @@ -1,7 +1,7 @@ /*- * Copyright (c) 2001-2008, by Cisco Systems, Inc. All rights reserved. - * Copyright (c) 2008-2011, by Randall Stewart. All rights reserved. - * Copyright (c) 2008-2011, by Michael Tuexen. All rights reserved. + * Copyright (c) 2008-2012, by Randall Stewart. All rights reserved. + * Copyright (c) 2008-2012, by Michael Tuexen. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: @@ -30,8 +30,6 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ -/* $KAME: sctp_input.c,v 1.27 2005/03/06 16:04:17 itojun Exp $ */ - #include __FBSDID("$FreeBSD$"); Modified: stable/8/sys/netinet/sctp_input.h ============================================================================== --- stable/8/sys/netinet/sctp_input.h Thu Mar 7 20:08:34 2013 (r247928) +++ stable/8/sys/netinet/sctp_input.h Thu Mar 7 20:12:31 2013 (r247929) @@ -1,7 +1,7 @@ /*- * Copyright (c) 2001-2007, by Cisco Systems, Inc. All rights reserved. - * Copyright (c) 2008-2011, by Randall Stewart. All rights reserved. - * Copyright (c) 2008-2011, by Michael Tuexen. All rights reserved. + * Copyright (c) 2008-2012, by Randall Stewart. All rights reserved. + * Copyright (c) 2008-2012, by Michael Tuexen. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: @@ -30,13 +30,11 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ -/* $KAME: sctp_input.h,v 1.6 2005/03/06 16:04:17 itojun Exp $ */ - #include __FBSDID("$FreeBSD$"); -#ifndef __sctp_input_h__ -#define __sctp_input_h__ +#ifndef _NETINET_SCTP_INPUT_H_ +#define _NETINET_SCTP_INPUT_H_ #if defined(_KERNEL) || defined(__Userspace__) void Modified: stable/8/sys/netinet/sctp_lock_bsd.h ============================================================================== --- stable/8/sys/netinet/sctp_lock_bsd.h Thu Mar 7 20:08:34 2013 (r247928) +++ stable/8/sys/netinet/sctp_lock_bsd.h Thu Mar 7 20:12:31 2013 (r247929) @@ -1,9 +1,7 @@ -#ifndef __sctp_lock_bsd_h__ -#define __sctp_lock_bsd_h__ /*- * Copyright (c) 2001-2007, by Cisco Systems, Inc. All rights reserved. - * Copyright (c) 2008-2011, by Randall Stewart. All rights reserved. - * Copyright (c) 2008-2011, by Michael Tuexen. All rights reserved. + * Copyright (c) 2008-2012, by Randall Stewart. All rights reserved. + * Copyright (c) 2008-2012, by Michael Tuexen. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: @@ -32,6 +30,12 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include +__FBSDID("$FreeBSD$"); + +#ifndef _NETINET_SCTP_LOCK_BSD_H_ +#define _NETINET_SCTP_LOCK_BSD_H_ + /* * General locking concepts: The goal of our locking is to of course provide * consistency and yet minimize overhead. We will attempt to use @@ -70,9 +74,6 @@ * SCTP_INP_INFO_RLOCK() and then when we want to add a new association to * the SCTP_BASE_INFO() list's we will do a SCTP_INP_INFO_WLOCK(). */ -#include -__FBSDID("$FreeBSD$"); - extern struct sctp_foo_stuff sctp_logoff[]; extern int sctp_logoff_stuff; Modified: stable/8/sys/netinet/sctp_os.h ============================================================================== --- stable/8/sys/netinet/sctp_os.h Thu Mar 7 20:08:34 2013 (r247928) +++ stable/8/sys/netinet/sctp_os.h Thu Mar 7 20:12:31 2013 (r247929) @@ -1,7 +1,7 @@ /*- * Copyright (c) 2006-2007, by Cisco Systems, Inc. All rights reserved. - * Copyright (c) 2008-2011, by Randall Stewart. All rights reserved. - * Copyright (c) 2008-2011, by Michael Tuexen. All rights reserved. + * Copyright (c) 2008-2012, by Randall Stewart. All rights reserved. + * Copyright (c) 2008-2012, by Michael Tuexen. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: @@ -29,10 +29,12 @@ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ + #include __FBSDID("$FreeBSD$"); -#ifndef __sctp_os_h__ -#define __sctp_os_h__ + +#ifndef _NETINET_SCTP_OS_H_ +#define _NETINET_SCTP_OS_H_ /* * General kernel memory allocation: Modified: stable/8/sys/netinet/sctp_os_bsd.h ============================================================================== --- stable/8/sys/netinet/sctp_os_bsd.h Thu Mar 7 20:08:34 2013 (r247928) +++ stable/8/sys/netinet/sctp_os_bsd.h Thu Mar 7 20:12:31 2013 (r247929) @@ -1,7 +1,7 @@ /*- * Copyright (c) 2006-2007, by Cisco Systems, Inc. All rights reserved. - * Copyright (c) 2008-2011, by Randall Stewart. All rights reserved. - * Copyright (c) 2008-2011, by Michael Tuexen. All rights reserved. + * Copyright (c) 2008-2012, by Randall Stewart. All rights reserved. + * Copyright (c) 2008-2012, by Michael Tuexen. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: @@ -29,10 +29,12 @@ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ + #include __FBSDID("$FreeBSD$"); -#ifndef __sctp_os_bsd_h__ -#define __sctp_os_bsd_h__ + +#ifndef _NETINET_SCTP_OS_BSD_H_ +#define _NETINET_SCTP_OS_BSD_H_ /* * includes */ Modified: stable/8/sys/netinet/sctp_output.c ============================================================================== --- stable/8/sys/netinet/sctp_output.c Thu Mar 7 20:08:34 2013 (r247928) +++ stable/8/sys/netinet/sctp_output.c Thu Mar 7 20:12:31 2013 (r247929) @@ -1,7 +1,7 @@ /*- * Copyright (c) 2001-2008, by Cisco Systems, Inc. All rights reserved. - * Copyright (c) 2008-2011, by Randall Stewart. All rights reserved. - * Copyright (c) 2008-2011, by Michael Tuexen. All rights reserved. + * Copyright (c) 2008-2012, by Randall Stewart. All rights reserved. + * Copyright (c) 2008-2012, by Michael Tuexen. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: @@ -30,8 +30,6 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ -/* $KAME: sctp_output.c,v 1.46 2005/03/06 16:04:17 itojun Exp $ */ - #include __FBSDID("$FreeBSD$"); Modified: stable/8/sys/netinet/sctp_output.h ============================================================================== --- stable/8/sys/netinet/sctp_output.h Thu Mar 7 20:08:34 2013 (r247928) +++ stable/8/sys/netinet/sctp_output.h Thu Mar 7 20:12:31 2013 (r247929) @@ -1,7 +1,7 @@ /*- * Copyright (c) 2001-2007, by Cisco Systems, Inc. All rights reserved. - * Copyright (c) 2008-2011, by Randall Stewart. All rights reserved. - * Copyright (c) 2008-2011, by Michael Tuexen. All rights reserved. + * Copyright (c) 2008-2012, by Randall Stewart. All rights reserved. + * Copyright (c) 2008-2012, by Michael Tuexen. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: @@ -30,13 +30,11 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ -/* $KAME: sctp_output.h,v 1.14 2005/03/06 16:04:18 itojun Exp $ */ - #include __FBSDID("$FreeBSD$"); -#ifndef __sctp_output_h__ -#define __sctp_output_h__ +#ifndef _NETINET_SCTP_OUTPUT_H_ +#define _NETINET_SCTP_OUTPUT_H_ #include Modified: stable/8/sys/netinet/sctp_pcb.c ============================================================================== --- stable/8/sys/netinet/sctp_pcb.c Thu Mar 7 20:08:34 2013 (r247928) +++ stable/8/sys/netinet/sctp_pcb.c Thu Mar 7 20:12:31 2013 (r247929) @@ -1,7 +1,7 @@ /*- * Copyright (c) 2001-2008, by Cisco Systems, Inc. All rights reserved. - * Copyright (c) 2008-2011, by Randall Stewart. All rights reserved. - * Copyright (c) 2008-2011, by Michael Tuexen. All rights reserved. + * Copyright (c) 2008-2012, by Randall Stewart. All rights reserved. + * Copyright (c) 2008-2012, by Michael Tuexen. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: @@ -30,8 +30,6 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ -/* $KAME: sctp_pcb.c,v 1.38 2005/03/06 16:04:18 itojun Exp $ */ - #include __FBSDID("$FreeBSD$"); Modified: stable/8/sys/netinet/sctp_pcb.h ============================================================================== --- stable/8/sys/netinet/sctp_pcb.h Thu Mar 7 20:08:34 2013 (r247928) +++ stable/8/sys/netinet/sctp_pcb.h Thu Mar 7 20:12:31 2013 (r247929) @@ -1,7 +1,8 @@ /*- * Copyright (c) 2001-2007, by Cisco Systems, Inc. All rights reserved. - * Copyright (c) 2008-2011, by Randall Stewart. All rights reserved. - * Copyright (c) 2008-2011, by Michael Tuexen. All rights reserved. + * Copyright (c) 2008-2012, by Randall Stewart. All rights reserved. + * Copyright (c) 2008-2012, by Michael Tuexen. All rights reserved. + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * @@ -29,13 +30,11 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ -/* $KAME: sctp_pcb.h,v 1.21 2005/07/16 01:18:47 suz Exp $ */ - #include __FBSDID("$FreeBSD$"); -#ifndef __sctp_pcb_h__ -#define __sctp_pcb_h__ +#ifndef _NETINET_SCTP_PCB_H_ +#define _NETINET_SCTP_PCB_H_ #include #include Modified: stable/8/sys/netinet/sctp_peeloff.c ============================================================================== --- stable/8/sys/netinet/sctp_peeloff.c Thu Mar 7 20:08:34 2013 (r247928) +++ stable/8/sys/netinet/sctp_peeloff.c Thu Mar 7 20:12:31 2013 (r247929) @@ -1,7 +1,7 @@ /*- * Copyright (c) 2001-2007, by Cisco Systems, Inc. All rights reserved. - * Copyright (c) 2008-2011, by Randall Stewart. All rights reserved. - * Copyright (c) 2008-2011, by Michael Tuexen. All rights reserved. + * Copyright (c) 2008-2012, by Randall Stewart. All rights reserved. + * Copyright (c) 2008-2012, by Michael Tuexen. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: @@ -30,11 +30,9 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ - -/* $KAME: sctp_peeloff.c,v 1.13 2005/03/06 16:04:18 itojun Exp $ */ - #include __FBSDID("$FreeBSD$"); + #include #include #include Modified: stable/8/sys/netinet/sctp_peeloff.h ============================================================================== --- stable/8/sys/netinet/sctp_peeloff.h Thu Mar 7 20:08:34 2013 (r247928) +++ stable/8/sys/netinet/sctp_peeloff.h Thu Mar 7 20:12:31 2013 (r247929) @@ -1,7 +1,7 @@ /*- * Copyright (c) 2001-2007, by Cisco Systems, Inc. All rights reserved. - * Copyright (c) 2008-2011, by Randall Stewart. All rights reserved. - * Copyright (c) 2008-2011, by Michael Tuexen. All rights reserved. + * Copyright (c) 2008-2012, by Randall Stewart. All rights reserved. + * Copyright (c) 2008-2012, by Michael Tuexen. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: @@ -30,13 +30,11 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ -/* $KAME: sctp_peeloff.h,v 1.6 2005/03/06 16:04:18 itojun Exp $ */ - #include __FBSDID("$FreeBSD$"); -#ifndef __sctp_peeloff_h__ -#define __sctp_peeloff_h__ +#ifndef _NETINET_SCTP_PEELOFF_H_ +#define _NETINET_SCTP_PEELOFF_H_ Modified: stable/8/sys/netinet/sctp_ss_functions.c ============================================================================== --- stable/8/sys/netinet/sctp_ss_functions.c Thu Mar 7 20:08:34 2013 (r247928) +++ stable/8/sys/netinet/sctp_ss_functions.c Thu Mar 7 20:12:31 2013 (r247929) @@ -1,7 +1,7 @@ /*- - * Copyright (c) 2010-2011, by Michael Tuexen. All rights reserved. - * Copyright (c) 2010-2011, by Randall Stewart. All rights reserved. - * Copyright (c) 2010-2011, by Robin Seggelmann. All rights reserved. + * Copyright (c) 2010-2012, by Michael Tuexen. All rights reserved. + * Copyright (c) 2010-2012, by Randall Stewart. All rights reserved. + * Copyright (c) 2010-2012, by Robin Seggelmann. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: Modified: stable/8/sys/netinet/sctp_structs.h ============================================================================== --- stable/8/sys/netinet/sctp_structs.h Thu Mar 7 20:08:34 2013 (r247928) +++ stable/8/sys/netinet/sctp_structs.h Thu Mar 7 20:12:31 2013 (r247929) @@ -1,7 +1,7 @@ /*- * Copyright (c) 2001-2008, by Cisco Systems, Inc. All rights reserved. - * Copyright (c) 2008-2011, by Randall Stewart. All rights reserved. - * Copyright (c) 2008-2011, by Michael Tuexen. All rights reserved. + * Copyright (c) 2008-2012, by Randall Stewart. All rights reserved. + * Copyright (c) 2008-2012, by Michael Tuexen. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: @@ -30,13 +30,11 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ -/* $KAME: sctp_structs.h,v 1.13 2005/03/06 16:04:18 itojun Exp $ */ - #include __FBSDID("$FreeBSD$"); -#ifndef __sctp_structs_h__ -#define __sctp_structs_h__ +#ifndef _NETINET_SCTP_STRUCTS_H_ +#define _NETINET_SCTP_STRUCTS_H_ #include #include Modified: stable/8/sys/netinet/sctp_sysctl.c ============================================================================== --- stable/8/sys/netinet/sctp_sysctl.c Thu Mar 7 20:08:34 2013 (r247928) +++ stable/8/sys/netinet/sctp_sysctl.c Thu Mar 7 20:12:31 2013 (r247929) @@ -1,7 +1,7 @@ /*- * Copyright (c) 2007, by Cisco Systems, Inc. All rights reserved. - * Copyright (c) 2008-2011, by Randall Stewart. All rights reserved. - * Copyright (c) 2008-2011, by Michael Tuexen. All rights reserved. + * Copyright (c) 2008-2012, by Randall Stewart. All rights reserved. + * Copyright (c) 2008-2012, by Michael Tuexen. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: Modified: stable/8/sys/netinet/sctp_sysctl.h ============================================================================== --- stable/8/sys/netinet/sctp_sysctl.h Thu Mar 7 20:08:34 2013 (r247928) +++ stable/8/sys/netinet/sctp_sysctl.h Thu Mar 7 20:12:31 2013 (r247929) @@ -1,7 +1,7 @@ /*- * Copyright (c) 2007, by Cisco Systems, Inc. All rights reserved. - * Copyright (c) 2008-2011, by Randall Stewart. All rights reserved. - * Copyright (c) 2008-2011, by Michael Tuexen. All rights reserved. + * Copyright (c) 2008-2012, by Randall Stewart. All rights reserved. + * Copyright (c) 2008-2012, by Michael Tuexen. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: @@ -33,8 +33,8 @@ #include __FBSDID("$FreeBSD$"); -#ifndef __sctp_sysctl_h__ -#define __sctp_sysctl_h__ +#ifndef _NETINET_SCTP_SYSCTL_H_ +#define _NETINET_SCTP_SYSCTL_H_ #include #include Modified: stable/8/sys/netinet/sctp_timer.c ============================================================================== --- stable/8/sys/netinet/sctp_timer.c Thu Mar 7 20:08:34 2013 (r247928) +++ stable/8/sys/netinet/sctp_timer.c Thu Mar 7 20:12:31 2013 (r247929) @@ -1,7 +1,7 @@ /*- * Copyright (c) 2001-2007, by Cisco Systems, Inc. All rights reserved. - * Copyright (c) 2008-2011, by Randall Stewart. All rights reserved. - * Copyright (c) 2008-2011, by Michael Tuexen. All rights reserved. + * Copyright (c) 2008-2012, by Randall Stewart. All rights reserved. + * Copyright (c) 2008-2012, by Michael Tuexen. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: @@ -30,8 +30,6 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ -/* $KAME: sctp_timer.c,v 1.29 2005/03/06 16:04:18 itojun Exp $ */ - #include __FBSDID("$FreeBSD$"); Modified: stable/8/sys/netinet/sctp_timer.h ============================================================================== --- stable/8/sys/netinet/sctp_timer.h Thu Mar 7 20:08:34 2013 (r247928) +++ stable/8/sys/netinet/sctp_timer.h Thu Mar 7 20:12:31 2013 (r247929) @@ -1,7 +1,7 @@ /*- * Copyright (c) 2001-2007, by Cisco Systems, Inc. All rights reserved. - * Copyright (c) 2008-2011, by Randall Stewart. All rights reserved. - * Copyright (c) 2008-2011, by Michael Tuexen. All rights reserved. + * Copyright (c) 2008-2012, by Randall Stewart. All rights reserved. + * Copyright (c) 2008-2012, by Michael Tuexen. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: @@ -30,12 +30,11 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ -/* $KAME: sctp_timer.h,v 1.6 2005/03/06 16:04:18 itojun Exp $ */ #include __FBSDID("$FreeBSD$"); -#ifndef __sctp_timer_h__ -#define __sctp_timer_h__ +#ifndef _NETINET_SCTP_TIMER_H_ +#define _NETINET_SCTP_TIMER_H_ #if defined(_KERNEL) || defined(__Userspace__) Modified: stable/8/sys/netinet/sctp_uio.h ============================================================================== --- stable/8/sys/netinet/sctp_uio.h Thu Mar 7 20:08:34 2013 (r247928) +++ stable/8/sys/netinet/sctp_uio.h Thu Mar 7 20:12:31 2013 (r247929) @@ -1,7 +1,7 @@ /*- * Copyright (c) 2001-2007, by Cisco Systems, Inc. All rights reserved. - * Copyright (c) 2008-2011, by Randall Stewart. All rights reserved. - * Copyright (c) 2008-2011, by Michael Tuexen. All rights reserved. + * Copyright (c) 2008-2012, by Randall Stewart. All rights reserved. + * Copyright (c) 2008-2012, by Michael Tuexen. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: @@ -30,12 +30,11 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ -/* $KAME: sctp_uio.h,v 1.11 2005/03/06 16:04:18 itojun Exp $ */ #include __FBSDID("$FreeBSD$"); -#ifndef __sctp_uio_h__ -#define __sctp_uio_h__ +#ifndef _NETINET_SCTP_UIO_H_ +#define _NETINET_SCTP_UIO_H_ #if ! defined(_KERNEL) Modified: stable/8/sys/netinet/sctp_usrreq.c ============================================================================== --- stable/8/sys/netinet/sctp_usrreq.c Thu Mar 7 20:08:34 2013 (r247928) +++ stable/8/sys/netinet/sctp_usrreq.c Thu Mar 7 20:12:31 2013 (r247929) @@ -1,7 +1,7 @@ /*- * Copyright (c) 2001-2008, by Cisco Systems, Inc. All rights reserved. - * Copyright (c) 2008-2011, by Randall Stewart. All rights reserved. - * Copyright (c) 2008-2011, by Michael Tuexen. All rights reserved. + * Copyright (c) 2008-2012, by Randall Stewart. All rights reserved. + * Copyright (c) 2008-2012, by Michael Tuexen. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: @@ -30,10 +30,9 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ -/* $KAME: sctp_usrreq.c,v 1.48 2005/03/07 23:26:08 itojun Exp $ */ - #include __FBSDID("$FreeBSD$"); + #include #include #include Modified: stable/8/sys/netinet/sctp_var.h ============================================================================== --- stable/8/sys/netinet/sctp_var.h Thu Mar 7 20:08:34 2013 (r247928) +++ stable/8/sys/netinet/sctp_var.h Thu Mar 7 20:12:31 2013 (r247929) @@ -1,7 +1,7 @@ /*- * Copyright (c) 2001-2008, by Cisco Systems, Inc. All rights reserved. - * Copyright (c) 2008-2011, by Randall Stewart. All rights reserved. - * Copyright (c) 2008-2011, by Michael Tuexen. All rights reserved. + * Copyright (c) 2008-2012, by Randall Stewart. All rights reserved. + * Copyright (c) 2008-2012, by Michael Tuexen. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: @@ -30,8 +30,6 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ -/* $KAME: sctp_var.h,v 1.24 2005/03/06 16:04:19 itojun Exp $ */ - #include __FBSDID("$FreeBSD$"); Modified: stable/8/sys/netinet/sctputil.c ============================================================================== --- stable/8/sys/netinet/sctputil.c Thu Mar 7 20:08:34 2013 (r247928) +++ stable/8/sys/netinet/sctputil.c Thu Mar 7 20:12:31 2013 (r247929) @@ -1,7 +1,7 @@ /*- * Copyright (c) 2001-2008, by Cisco Systems, Inc. All rights reserved. - * Copyright (c) 2008-2011, by Randall Stewart. All rights reserved. - * Copyright (c) 2008-2011, by Michael Tuexen. All rights reserved. + * Copyright (c) 2008-2012, by Randall Stewart. All rights reserved. + * Copyright (c) 2008-2012, by Michael Tuexen. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: @@ -30,8 +30,6 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ -/* $KAME: sctputil.c,v 1.37 2005/03/07 23:26:09 itojun Exp $ */ - #include __FBSDID("$FreeBSD$"); Modified: stable/8/sys/netinet/sctputil.h ============================================================================== --- stable/8/sys/netinet/sctputil.h Thu Mar 7 20:08:34 2013 (r247928) +++ stable/8/sys/netinet/sctputil.h Thu Mar 7 20:12:31 2013 (r247929) @@ -1,7 +1,7 @@ /*- * Copyright (c) 2001-2007, by Cisco Systems, Inc. All rights reserved. - * Copyright (c) 2008-2011, by Randall Stewart. All rights reserved. - * Copyright (c) 2008-2011, by Michael Tuexen. All rights reserved. + * Copyright (c) 2008-2012, by Randall Stewart. All rights reserved. + * Copyright (c) 2008-2012, by Michael Tuexen. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: @@ -30,14 +30,11 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ - -/* $KAME: sctputil.h,v 1.15 2005/03/06 16:04:19 itojun Exp $ */ - #include __FBSDID("$FreeBSD$"); -#ifndef __sctputil_h__ -#define __sctputil_h__ +#ifndef _NETINET_SCTP_UTIL_H_ +#define _NETINET_SCTP_UTIL_H_ #if defined(_KERNEL) || defined(__Userspace__) Modified: stable/8/sys/netinet6/sctp6_usrreq.c ============================================================================== --- stable/8/sys/netinet6/sctp6_usrreq.c Thu Mar 7 20:08:34 2013 (r247928) +++ stable/8/sys/netinet6/sctp6_usrreq.c Thu Mar 7 20:12:31 2013 (r247929) @@ -1,7 +1,7 @@ /*- * Copyright (c) 2001-2007, by Cisco Systems, Inc. All rights reserved. - * Copyright (c) 2008-2011, by Randall Stewart. All rights reserved. - * Copyright (c) 2008-2011, by Michael Tuexen. All rights reserved. + * Copyright (c) 2008-2012, by Randall Stewart. All rights reserved. + * Copyright (c) 2008-2012, by Michael Tuexen. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: @@ -29,7 +29,6 @@ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ -/* $KAME: sctp6_usrreq.c,v 1.38 2005/08/24 08:08:56 suz Exp $ */ #include __FBSDID("$FreeBSD$"); Modified: stable/8/sys/netinet6/sctp6_var.h ============================================================================== --- stable/8/sys/netinet6/sctp6_var.h Thu Mar 7 20:08:34 2013 (r247928) +++ stable/8/sys/netinet6/sctp6_var.h Thu Mar 7 20:12:31 2013 (r247929) @@ -1,7 +1,7 @@ /*- * Copyright (c) 2001-2007, by Cisco Systems, Inc. All rights reserved. - * Copyright (c) 2008-2011, by Randall Stewart. All rights reserved. - * Copyright (c) 2008-2011, by Michael Tuexen. All rights reserved. + * Copyright (c) 2008-2012, by Randall Stewart. All rights reserved. + * Copyright (c) 2008-2012, by Michael Tuexen. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: @@ -29,14 +29,13 @@ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ -/* $KAME: sctp6_var.h,v 1.7 2004/08/17 04:06:22 itojun Exp $ */ - -#ifndef _NETINET6_SCTP6_VAR_H_ -#define _NETINET6_SCTP6_VAR_H_ #include __FBSDID("$FreeBSD$"); +#ifndef _NETINET6_SCTP6_VAR_H_ +#define _NETINET6_SCTP6_VAR_H_ + #if defined(_KERNEL) SYSCTL_DECL(_net_inet6_sctp6); From owner-svn-src-stable@FreeBSD.ORG Thu Mar 7 20:14:56 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 71434E65; Thu, 7 Mar 2013 20:14:56 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 58BA9B9; Thu, 7 Mar 2013 20:14:56 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r27KEuTV092603; Thu, 7 Mar 2013 20:14:56 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r27KEuf3092602; Thu, 7 Mar 2013 20:14:56 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201303072014.r27KEuf3092602@svn.freebsd.org> From: Michael Tuexen Date: Thu, 7 Mar 2013 20:14:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r247930 - stable/8/sys/netinet X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Mar 2013 20:14:56 -0000 Author: tuexen Date: Thu Mar 7 20:14:55 2013 New Revision: 247930 URL: http://svnweb.freebsd.org/changeset/base/247930 Log: MFC r235903: Add sn_send_failed_event to sctp_notification. Modified: stable/8/sys/netinet/sctp_uio.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/netinet/ (props changed) Modified: stable/8/sys/netinet/sctp_uio.h ============================================================================== --- stable/8/sys/netinet/sctp_uio.h Thu Mar 7 20:12:31 2013 (r247929) +++ stable/8/sys/netinet/sctp_uio.h Thu Mar 7 20:14:55 2013 (r247930) @@ -523,10 +523,10 @@ union sctp_notification { struct sctp_pdapi_event sn_pdapi_event; struct sctp_authkey_event sn_auth_event; struct sctp_sender_dry_event sn_sender_dry_event; + struct sctp_send_failed_event sn_send_failed_event; struct sctp_stream_reset_event sn_strreset_event; struct sctp_assoc_reset_event sn_assocreset_event; struct sctp_stream_change_event sn_strchange_event; - }; /* notification types */ From owner-svn-src-stable@FreeBSD.ORG Thu Mar 7 20:17:31 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 8B41FFE3; Thu, 7 Mar 2013 20:17:31 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 7D8D7CC; Thu, 7 Mar 2013 20:17:31 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r27KHVTW093007; Thu, 7 Mar 2013 20:17:31 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r27KHVL2093006; Thu, 7 Mar 2013 20:17:31 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201303072017.r27KHVL2093006@svn.freebsd.org> From: Michael Tuexen Date: Thu, 7 Mar 2013 20:17:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r247931 - stable/8/sys/netinet X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Mar 2013 20:17:31 -0000 Author: tuexen Date: Thu Mar 7 20:17:30 2013 New Revision: 247931 URL: http://svnweb.freebsd.org/changeset/base/247931 Log: MFC r235990: Undefine SCTP_PACKED before including sctp_uio.h, which doesn't use it. Spotted by Irene Ruengeler. Modified: stable/8/sys/netinet/sctp.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/netinet/ (props changed) Modified: stable/8/sys/netinet/sctp.h ============================================================================== --- stable/8/sys/netinet/sctp.h Thu Mar 7 20:14:55 2013 (r247930) +++ stable/8/sys/netinet/sctp.h Thu Mar 7 20:17:30 2013 (r247931) @@ -556,6 +556,8 @@ struct sctp_error_unrecognized_chunk { #define SCTP_SMALLEST_PMTU 512 /* smallest pmtu allowed when disabling PMTU * discovery */ +#undef SCTP_PACKED + #include /* This dictates the size of the packet @@ -607,7 +609,4 @@ struct sctp_error_unrecognized_chunk { #define SCTP_LOG_AT_SEND_2_OUTQ 0x08000000 #define SCTP_LOG_TRY_ADVANCE 0x10000000 - -#undef SCTP_PACKED - #endif /* !_NETINET_SCTP_H_ */ From owner-svn-src-stable@FreeBSD.ORG Thu Mar 7 20:24:15 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 43C02345; Thu, 7 Mar 2013 20:24:15 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 2589A10A; Thu, 7 Mar 2013 20:24:15 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r27KOFVs095672; Thu, 7 Mar 2013 20:24:15 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r27KOEkK095668; Thu, 7 Mar 2013 20:24:14 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201303072024.r27KOEkK095668@svn.freebsd.org> From: Michael Tuexen Date: Thu, 7 Mar 2013 20:24:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r247932 - in stable/8/sys: netinet netinet6 X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Mar 2013 20:24:15 -0000 Author: tuexen Date: Thu Mar 7 20:24:14 2013 New Revision: 247932 URL: http://svnweb.freebsd.org/changeset/base/247932 Log: MFC r236087: Get rid of SCTP specific code to avoid CRC32C computations on loopback. Just use offloading. Modified: stable/8/sys/netinet/sctp_output.c stable/8/sys/netinet/sctp_sysctl.c stable/8/sys/netinet/sctp_sysctl.h stable/8/sys/netinet6/sctp6_usrreq.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/netinet/ (props changed) stable/8/sys/netinet6/ (props changed) Modified: stable/8/sys/netinet/sctp_output.c ============================================================================== --- stable/8/sys/netinet/sctp_output.c Thu Mar 7 20:17:30 2013 (r247931) +++ stable/8/sys/netinet/sctp_output.c Thu Mar 7 20:24:14 2013 (r247932) @@ -4116,14 +4116,8 @@ sctp_lowlevel_chunk_output(struct sctp_i #if defined(SCTP_WITH_NO_CSUM) SCTP_STAT_INCR(sctps_sendnocrc); #else - if (!(SCTP_BASE_SYSCTL(sctp_no_csum_on_loopback) && - (stcb) && - (stcb->asoc.loopback_scope))) { - sctphdr->checksum = sctp_calculate_cksum(m, sizeof(struct ip) + sizeof(struct udphdr)); - SCTP_STAT_INCR(sctps_sendswcrc); - } else { - SCTP_STAT_INCR(sctps_sendnocrc); - } + sctphdr->checksum = sctp_calculate_cksum(m, sizeof(struct ip) + sizeof(struct udphdr)); + SCTP_STAT_INCR(sctps_sendswcrc); #endif if (V_udp_cksum) { SCTP_ENABLE_UDP_CSUM(o_pak); @@ -4474,14 +4468,8 @@ sctp_lowlevel_chunk_output(struct sctp_i #if defined(SCTP_WITH_NO_CSUM) SCTP_STAT_INCR(sctps_sendnocrc); #else - if (!(SCTP_BASE_SYSCTL(sctp_no_csum_on_loopback) && - (stcb) && - (stcb->asoc.loopback_scope))) { - sctphdr->checksum = sctp_calculate_cksum(m, sizeof(struct ip6_hdr) + sizeof(struct udphdr)); - SCTP_STAT_INCR(sctps_sendswcrc); - } else { - SCTP_STAT_INCR(sctps_sendnocrc); - } + sctphdr->checksum = sctp_calculate_cksum(m, sizeof(struct ip6_hdr) + sizeof(struct udphdr)); + SCTP_STAT_INCR(sctps_sendswcrc); #endif if ((udp->uh_sum = in6_cksum(o_pak, IPPROTO_UDP, sizeof(struct ip6_hdr), packet_length - sizeof(struct ip6_hdr))) == 0) { udp->uh_sum = 0xffff; Modified: stable/8/sys/netinet/sctp_sysctl.c ============================================================================== --- stable/8/sys/netinet/sctp_sysctl.c Thu Mar 7 20:17:30 2013 (r247931) +++ stable/8/sys/netinet/sctp_sysctl.c Thu Mar 7 20:24:14 2013 (r247932) @@ -55,9 +55,6 @@ sctp_init_sysctls() SCTP_BASE_SYSCTL(sctp_multiple_asconfs) = SCTPCTL_MULTIPLEASCONFS_DEFAULT; SCTP_BASE_SYSCTL(sctp_ecn_enable) = SCTPCTL_ECN_ENABLE_DEFAULT; SCTP_BASE_SYSCTL(sctp_strict_sacks) = SCTPCTL_STRICT_SACKS_DEFAULT; -#if !defined(SCTP_WITH_NO_CSUM) - SCTP_BASE_SYSCTL(sctp_no_csum_on_loopback) = SCTPCTL_LOOPBACK_NOCSUM_DEFAULT; -#endif SCTP_BASE_SYSCTL(sctp_peer_chunk_oh) = SCTPCTL_PEER_CHKOH_DEFAULT; SCTP_BASE_SYSCTL(sctp_max_burst_default) = SCTPCTL_MAXBURST_DEFAULT; SCTP_BASE_SYSCTL(sctp_fr_max_burst_default) = SCTPCTL_FRMAXBURST_DEFAULT; @@ -604,9 +601,6 @@ sysctl_sctp_check(SYSCTL_HANDLER_ARGS) RANGECHK(SCTP_BASE_SYSCTL(sctp_auto_asconf), SCTPCTL_AUTOASCONF_MIN, SCTPCTL_AUTOASCONF_MAX); RANGECHK(SCTP_BASE_SYSCTL(sctp_ecn_enable), SCTPCTL_ECN_ENABLE_MIN, SCTPCTL_ECN_ENABLE_MAX); RANGECHK(SCTP_BASE_SYSCTL(sctp_strict_sacks), SCTPCTL_STRICT_SACKS_MIN, SCTPCTL_STRICT_SACKS_MAX); -#if !defined(SCTP_WITH_NO_CSUM) - RANGECHK(SCTP_BASE_SYSCTL(sctp_no_csum_on_loopback), SCTPCTL_LOOPBACK_NOCSUM_MIN, SCTPCTL_LOOPBACK_NOCSUM_MAX); -#endif RANGECHK(SCTP_BASE_SYSCTL(sctp_peer_chunk_oh), SCTPCTL_PEER_CHKOH_MIN, SCTPCTL_PEER_CHKOH_MAX); RANGECHK(SCTP_BASE_SYSCTL(sctp_max_burst_default), SCTPCTL_MAXBURST_MIN, SCTPCTL_MAXBURST_MAX); RANGECHK(SCTP_BASE_SYSCTL(sctp_fr_max_burst_default), SCTPCTL_FRMAXBURST_MIN, SCTPCTL_FRMAXBURST_MAX); @@ -870,11 +864,6 @@ SYSCTL_VNET_PROC(_net_inet_sctp, OID_AUT &SCTP_BASE_SYSCTL(sctp_strict_sacks), 0, sysctl_sctp_check, "IU", SCTPCTL_STRICT_SACKS_DESC); -#if !defined(SCTP_WITH_NO_CSUM) -SYSCTL_VNET_PROC(_net_inet_sctp, OID_AUTO, loopback_nocsum, CTLTYPE_UINT | CTLFLAG_RW, - &SCTP_BASE_SYSCTL(sctp_no_csum_on_loopback), 0, sysctl_sctp_check, "IU", - SCTPCTL_LOOPBACK_NOCSUM_DESC); -#endif SYSCTL_VNET_PROC(_net_inet_sctp, OID_AUTO, peer_chkoh, CTLTYPE_UINT | CTLFLAG_RW, &SCTP_BASE_SYSCTL(sctp_peer_chunk_oh), 0, sysctl_sctp_check, "IU", Modified: stable/8/sys/netinet/sctp_sysctl.h ============================================================================== --- stable/8/sys/netinet/sctp_sysctl.h Thu Mar 7 20:17:30 2013 (r247931) +++ stable/8/sys/netinet/sctp_sysctl.h Thu Mar 7 20:24:14 2013 (r247932) @@ -47,9 +47,6 @@ struct sctp_sysctl { uint32_t sctp_ecn_enable; uint32_t sctp_fr_max_burst_default; uint32_t sctp_strict_sacks; -#if !defined(SCTP_WITH_NO_CSUM) - uint32_t sctp_no_csum_on_loopback; -#endif uint32_t sctp_peer_chunk_oh; uint32_t sctp_max_burst_default; uint32_t sctp_max_chunks_on_queue; Modified: stable/8/sys/netinet6/sctp6_usrreq.c ============================================================================== --- stable/8/sys/netinet6/sctp6_usrreq.c Thu Mar 7 20:17:30 2013 (r247931) +++ stable/8/sys/netinet6/sctp6_usrreq.c Thu Mar 7 20:24:14 2013 (r247932) @@ -150,11 +150,6 @@ sctp6_input(struct mbuf **i_pak, int *of goto sctp_skip_csum; } check = sh->checksum; /* save incoming checksum */ - if ((check == 0) && (SCTP_BASE_SYSCTL(sctp_no_csum_on_loopback)) && - (IN6_ARE_ADDR_EQUAL(&ip6->ip6_src, &ip6->ip6_dst))) { - SCTP_STAT_INCR(sctps_recvnocrc); - goto sctp_skip_csum; - } sh->checksum = 0; /* prepare for calc */ calc_check = sctp_calculate_cksum(m, iphlen); SCTP_STAT_INCR(sctps_recvswcrc); From owner-svn-src-stable@FreeBSD.ORG Thu Mar 7 20:26:52 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id AE19A717; Thu, 7 Mar 2013 20:26:52 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id A1518136; Thu, 7 Mar 2013 20:26:52 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r27KQqL4096216; Thu, 7 Mar 2013 20:26:52 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r27KQqkN096211; Thu, 7 Mar 2013 20:26:52 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201303072026.r27KQqkN096211@svn.freebsd.org> From: Michael Tuexen Date: Thu, 7 Mar 2013 20:26:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r247933 - stable/8/sys/netinet X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Mar 2013 20:26:52 -0000 Author: tuexen Date: Thu Mar 7 20:26:51 2013 New Revision: 247933 URL: http://svnweb.freebsd.org/changeset/base/247933 Log: MFC r236391: Small cleanups. No functional change. Modified: stable/8/sys/netinet/sctp_asconf.c stable/8/sys/netinet/sctputil.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/netinet/ (props changed) Modified: stable/8/sys/netinet/sctp_asconf.c ============================================================================== --- stable/8/sys/netinet/sctp_asconf.c Thu Mar 7 20:24:14 2013 (r247932) +++ stable/8/sys/netinet/sctp_asconf.c Thu Mar 7 20:26:51 2013 (r247933) @@ -48,8 +48,6 @@ __FBSDID("$FreeBSD$"); * SCTP_DEBUG_ASCONF1: protocol info, general info and errors * SCTP_DEBUG_ASCONF2: detailed info */ -#ifdef SCTP_DEBUG -#endif /* SCTP_DEBUG */ static void Modified: stable/8/sys/netinet/sctputil.h ============================================================================== --- stable/8/sys/netinet/sctputil.h Thu Mar 7 20:24:14 2013 (r247932) +++ stable/8/sys/netinet/sctputil.h Thu Mar 7 20:26:51 2013 (r247933) @@ -381,7 +381,5 @@ sctp_auditing(int, struct sctp_inpcb *, void sctp_audit_log(uint8_t, uint8_t); #endif - - #endif /* _KERNEL */ #endif From owner-svn-src-stable@FreeBSD.ORG Thu Mar 7 20:29:55 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 1098A9CB; Thu, 7 Mar 2013 20:29:55 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 03344154; Thu, 7 Mar 2013 20:29:55 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r27KTsPP096738; Thu, 7 Mar 2013 20:29:54 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r27KTsee096733; Thu, 7 Mar 2013 20:29:54 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201303072029.r27KTsee096733@svn.freebsd.org> From: Michael Tuexen Date: Thu, 7 Mar 2013 20:29:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r247934 - stable/8/sys/netinet X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Mar 2013 20:29:55 -0000 Author: tuexen Date: Thu Mar 7 20:29:54 2013 New Revision: 247934 URL: http://svnweb.freebsd.org/changeset/base/247934 Log: MFC r236450: Remove an unused parameter. Modified: stable/8/sys/netinet/sctp_input.c stable/8/sys/netinet/sctputil.c stable/8/sys/netinet/sctputil.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/netinet/ (props changed) Modified: stable/8/sys/netinet/sctp_input.c ============================================================================== --- stable/8/sys/netinet/sctp_input.c Thu Mar 7 20:26:51 2013 (r247933) +++ stable/8/sys/netinet/sctp_input.c Thu Mar 7 20:29:54 2013 (r247934) @@ -4516,7 +4516,7 @@ __attribute__((noinline)) } if (stcb == NULL) { /* no association, so it's out of the blue... */ - sctp_handle_ootb(m, iphlen, *offset, sh, inp, NULL, + sctp_handle_ootb(m, iphlen, *offset, sh, inp, vrf_id, port); *offset = length; if (locked_tcb) { @@ -4554,7 +4554,7 @@ __attribute__((noinline)) SCTP_TCB_UNLOCK(locked_tcb); } sctp_handle_ootb(m, iphlen, *offset, sh, inp, - NULL, vrf_id, port); + vrf_id, port); return (NULL); } } else { @@ -5586,7 +5586,7 @@ sctp_common_input_processing(struct mbuf * NOT respond to any packet.. its OOTB. */ SCTP_TCB_UNLOCK(stcb); - sctp_handle_ootb(m, iphlen, offset, sh, inp, NULL, + sctp_handle_ootb(m, iphlen, offset, sh, inp, vrf_id, port); goto out_now; } @@ -5630,7 +5630,7 @@ sctp_common_input_processing(struct mbuf } if (stcb == NULL) { /* out of the blue DATA chunk */ - sctp_handle_ootb(m, iphlen, offset, sh, inp, NULL, + sctp_handle_ootb(m, iphlen, offset, sh, inp, vrf_id, port); goto out_now; } @@ -5699,7 +5699,7 @@ sctp_common_input_processing(struct mbuf /* * We consider OOTB any data sent during asoc setup. */ - sctp_handle_ootb(m, iphlen, offset, sh, inp, NULL, + sctp_handle_ootb(m, iphlen, offset, sh, inp, vrf_id, port); SCTP_TCB_UNLOCK(stcb); goto out_now; Modified: stable/8/sys/netinet/sctputil.c ============================================================================== --- stable/8/sys/netinet/sctputil.c Thu Mar 7 20:26:51 2013 (r247933) +++ stable/8/sys/netinet/sctputil.c Thu Mar 7 20:29:54 2013 (r247934) @@ -3994,7 +3994,7 @@ sctp_abort_an_association(struct sctp_in void sctp_handle_ootb(struct mbuf *m, int iphlen, int offset, struct sctphdr *sh, - struct sctp_inpcb *inp, struct mbuf *op_err, uint32_t vrf_id, uint16_t port) + struct sctp_inpcb *inp, uint32_t vrf_id, uint16_t port) { struct sctp_chunkhdr *ch, chunk_buf; unsigned int chk_length; @@ -4049,7 +4049,7 @@ sctp_handle_ootb(struct mbuf *m, int iph if ((SCTP_BASE_SYSCTL(sctp_blackhole) == 0) || ((SCTP_BASE_SYSCTL(sctp_blackhole) == 1) && (contains_init_chunk == 0))) { - sctp_send_abort(m, iphlen, sh, 0, op_err, vrf_id, port); + sctp_send_abort(m, iphlen, sh, 0, NULL, vrf_id, port); } } Modified: stable/8/sys/netinet/sctputil.h ============================================================================== --- stable/8/sys/netinet/sctputil.h Thu Mar 7 20:26:51 2013 (r247933) +++ stable/8/sys/netinet/sctputil.h Thu Mar 7 20:29:54 2013 (r247934) @@ -200,7 +200,7 @@ sctp_abort_an_association(struct sctp_in void sctp_handle_ootb(struct mbuf *, int, int, struct sctphdr *, - struct sctp_inpcb *, struct mbuf *, uint32_t, uint16_t); + struct sctp_inpcb *, uint32_t, uint16_t); int sctp_connectx_helper_add(struct sctp_tcb *stcb, struct sockaddr *addr, From owner-svn-src-stable@FreeBSD.ORG Thu Mar 7 20:32:31 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 8EF5EC22; Thu, 7 Mar 2013 20:32:31 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 63F8C16C; Thu, 7 Mar 2013 20:32:31 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r27KWVRo098828; Thu, 7 Mar 2013 20:32:31 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r27KWVLa098827; Thu, 7 Mar 2013 20:32:31 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201303072032.r27KWVLa098827@svn.freebsd.org> From: Michael Tuexen Date: Thu, 7 Mar 2013 20:32:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r247935 - stable/8/sys/netinet X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Mar 2013 20:32:31 -0000 Author: tuexen Date: Thu Mar 7 20:32:30 2013 New Revision: 247935 URL: http://svnweb.freebsd.org/changeset/base/247935 Log: MFC r236492: Don't request data from the IPv6 layer, which is not used. Modified: stable/8/sys/netinet/sctp_output.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/netinet/ (props changed) Modified: stable/8/sys/netinet/sctp_output.c ============================================================================== --- stable/8/sys/netinet/sctp_output.c Thu Mar 7 20:29:54 2013 (r247934) +++ stable/8/sys/netinet/sctp_output.c Thu Mar 7 20:32:30 2013 (r247935) @@ -11047,11 +11047,8 @@ sctp_send_shutdown_complete2(struct mbuf #endif #ifdef INET6 if (ip6_out != NULL) { - struct route_in6 ro; int ret; - struct ifnet *ifp = NULL; - bzero(&ro, sizeof(ro)); mlen = SCTP_BUF_LEN(mout); #ifdef SCTP_PACKET_LOGGING if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_LAST_PACKET_TRACING) @@ -11077,11 +11074,7 @@ sctp_send_shutdown_complete2(struct mbuf SCTP_STAT_INCR(sctps_sendhwcrc); #endif } - SCTP_IP6_OUTPUT(ret, o_pak, &ro, &ifp, NULL, vrf_id); - - /* Free the route if we got one back */ - if (ro.ro_rt) - RTFREE(ro.ro_rt); + SCTP_IP6_OUTPUT(ret, o_pak, NULL, NULL, NULL, vrf_id); } #endif SCTP_STAT_INCR(sctps_sendpackets); @@ -12148,12 +12141,8 @@ sctp_send_abort(struct mbuf *m, int iphl #endif #ifdef INET6 if (ip6_out != NULL) { - struct route_in6 ro; int ret; - struct ifnet *ifp = NULL; - /* zap the stack pointer to the route */ - bzero(&ro, sizeof(ro)); if (port) { udp->uh_ulen = htons(len - sizeof(struct ip6_hdr)); } @@ -12184,11 +12173,7 @@ sctp_send_abort(struct mbuf *m, int iphl SCTP_STAT_INCR(sctps_sendhwcrc); #endif } - SCTP_IP6_OUTPUT(ret, o_pak, &ro, &ifp, NULL, vrf_id); - - /* Free the route if we got one back */ - if (ro.ro_rt) - RTFREE(ro.ro_rt); + SCTP_IP6_OUTPUT(ret, o_pak, NULL, NULL, NULL, vrf_id); } #endif SCTP_STAT_INCR(sctps_sendpackets); @@ -12414,12 +12399,8 @@ sctp_send_operr_to(struct mbuf *m, int i #endif #ifdef INET6 if (ip6_out != NULL) { - struct route_in6 ro; int ret; - struct ifnet *ifp = NULL; - /* zap the stack pointer to the route */ - bzero(&ro, sizeof(ro)); if (port) { udp->uh_ulen = htons(len - sizeof(struct ip6_hdr)); } @@ -12448,11 +12429,7 @@ sctp_send_operr_to(struct mbuf *m, int i SCTP_STAT_INCR(sctps_sendhwcrc); #endif } - SCTP_IP6_OUTPUT(ret, o_pak, &ro, &ifp, NULL, vrf_id); - - /* Free the route if we got one back */ - if (ro.ro_rt) - RTFREE(ro.ro_rt); + SCTP_IP6_OUTPUT(ret, o_pak, NULL, NULL, NULL, vrf_id); } #endif SCTP_STAT_INCR(sctps_sendpackets); From owner-svn-src-stable@FreeBSD.ORG Thu Mar 7 20:34:31 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 6161DDA7; Thu, 7 Mar 2013 20:34:31 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 53A70182; Thu, 7 Mar 2013 20:34:31 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r27KYVwJ099177; Thu, 7 Mar 2013 20:34:31 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r27KYVMI099176; Thu, 7 Mar 2013 20:34:31 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201303072034.r27KYVMI099176@svn.freebsd.org> From: Michael Tuexen Date: Thu, 7 Mar 2013 20:34:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r247936 - stable/8/sys/netinet X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Mar 2013 20:34:31 -0000 Author: tuexen Date: Thu Mar 7 20:34:30 2013 New Revision: 247936 URL: http://svnweb.freebsd.org/changeset/base/247936 Log: MFC r236493: Honor sysctl for TTL. Modified: stable/8/sys/netinet/sctp_output.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/netinet/ (props changed) Modified: stable/8/sys/netinet/sctp_output.c ============================================================================== --- stable/8/sys/netinet/sctp_output.c Thu Mar 7 20:32:30 2013 (r247935) +++ stable/8/sys/netinet/sctp_output.c Thu Mar 7 20:34:30 2013 (r247936) @@ -10923,7 +10923,7 @@ sctp_send_shutdown_complete2(struct mbuf iph_out->ip_tos = (u_char)0; iph_out->ip_id = 0; iph_out->ip_off = 0; - iph_out->ip_ttl = MAXTTL; + iph_out->ip_ttl = MODULE_GLOBAL(ip_defttl); if (port) { iph_out->ip_p = IPPROTO_UDP; } else { @@ -11992,7 +11992,7 @@ sctp_send_abort(struct mbuf *m, int iphl iph_out->ip_tos = (u_char)0; iph_out->ip_id = 0; iph_out->ip_off = 0; - iph_out->ip_ttl = MAXTTL; + iph_out->ip_ttl = MODULE_GLOBAL(ip_defttl); if (port) { iph_out->ip_p = IPPROTO_UDP; } else { @@ -12255,7 +12255,7 @@ sctp_send_operr_to(struct mbuf *m, int i iph_out->ip_tos = (u_char)0; iph_out->ip_id = 0; iph_out->ip_off = 0; - iph_out->ip_ttl = MAXTTL; + iph_out->ip_ttl = MODULE_GLOBAL(ip_defttl); if (port) { iph_out->ip_p = IPPROTO_UDP; } else { From owner-svn-src-stable@FreeBSD.ORG Thu Mar 7 20:36:18 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 115FFF2A; Thu, 7 Mar 2013 20:36:18 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id E418F198; Thu, 7 Mar 2013 20:36:17 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r27KaHGX099462; Thu, 7 Mar 2013 20:36:17 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r27KaHFK099461; Thu, 7 Mar 2013 20:36:17 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201303072036.r27KaHFK099461@svn.freebsd.org> From: Michael Tuexen Date: Thu, 7 Mar 2013 20:36:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r247937 - stable/8/sys/netinet X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Mar 2013 20:36:18 -0000 Author: tuexen Date: Thu Mar 7 20:36:17 2013 New Revision: 247937 URL: http://svnweb.freebsd.org/changeset/base/247937 Log: MFC r236515: Use an existing function to get the source address. Modified: stable/8/sys/netinet/sctp_asconf.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/netinet/ (props changed) Modified: stable/8/sys/netinet/sctp_asconf.c ============================================================================== --- stable/8/sys/netinet/sctp_asconf.c Thu Mar 7 20:34:30 2013 (r247936) +++ stable/8/sys/netinet/sctp_asconf.c Thu Mar 7 20:36:17 2013 (r247937) @@ -856,70 +856,20 @@ send_reply: * this could happen if the source address was just newly * added */ - struct ip *iph; - struct sctphdr *sh; - struct sockaddr_storage from_store; - struct sockaddr *from = (struct sockaddr *)&from_store; + struct sockaddr_storage addr; + struct sockaddr *src = (struct sockaddr *)&addr; SCTPDBG(SCTP_DEBUG_ASCONF1, "handle_asconf: looking up net for IP source address\n"); - /* pullup already done, IP options already stripped */ - iph = mtod(m, struct ip *); - switch (iph->ip_v) { -#ifdef INET - case IPVERSION: - { - struct sockaddr_in *from4; - - sh = (struct sctphdr *)((caddr_t)iph + sizeof(*iph)); - from4 = (struct sockaddr_in *)&from_store; - bzero(from4, sizeof(*from4)); - from4->sin_family = AF_INET; - from4->sin_len = sizeof(struct sockaddr_in); - from4->sin_addr.s_addr = iph->ip_src.s_addr; - from4->sin_port = sh->src_port; - break; - } -#endif -#ifdef INET6 - case IPV6_VERSION >> 4: - { - struct ip6_hdr *ip6; - struct sockaddr_in6 *from6; - - ip6 = mtod(m, struct ip6_hdr *); - sh = (struct sctphdr *)((caddr_t)ip6 + sizeof(*ip6)); - from6 = (struct sockaddr_in6 *)&from_store; - bzero(from6, sizeof(*from6)); - from6->sin6_family = AF_INET6; - from6->sin6_len = sizeof(struct sockaddr_in6); - from6->sin6_addr = ip6->ip6_src; - from6->sin6_port = sh->src_port; - /* - * Get the scopes in properly to the sin6 - * addr's - */ - /* we probably don't need these operations */ - (void)sa6_recoverscope(from6); - sa6_embedscope(from6, - MODULE_GLOBAL(ip6_use_defzone)); - - break; - } -#endif - default: - /* unknown address type */ - from = NULL; - } - if (from != NULL) { - SCTPDBG(SCTP_DEBUG_ASCONF1, "Looking for IP source: "); - SCTPDBG_ADDR(SCTP_DEBUG_ASCONF1, from); - /* look up the from address */ - stcb->asoc.last_control_chunk_from = sctp_findnet(stcb, from); + sctp_asconf_get_source_ip(m, src); + SCTPDBG(SCTP_DEBUG_ASCONF1, "Looking for IP source: "); + SCTPDBG_ADDR(SCTP_DEBUG_ASCONF1, src); + /* look up the from address */ + stcb->asoc.last_control_chunk_from = sctp_findnet(stcb, src); #ifdef SCTP_DEBUG - if (stcb->asoc.last_control_chunk_from == NULL) - SCTPDBG(SCTP_DEBUG_ASCONF1, "handle_asconf: IP source address not found?!\n"); -#endif + if (stcb->asoc.last_control_chunk_from == NULL) { + SCTPDBG(SCTP_DEBUG_ASCONF1, "handle_asconf: IP source address not found?!\n"); } +#endif } } From owner-svn-src-stable@FreeBSD.ORG Thu Mar 7 20:37:57 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id C69EB1C0; Thu, 7 Mar 2013 20:37:57 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id B7D611B2; Thu, 7 Mar 2013 20:37:57 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r27KbvSi099715; Thu, 7 Mar 2013 20:37:57 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r27Kbvn6099713; Thu, 7 Mar 2013 20:37:57 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201303072037.r27Kbvn6099713@svn.freebsd.org> From: Michael Tuexen Date: Thu, 7 Mar 2013 20:37:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r247938 - stable/8/sys/netinet X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Mar 2013 20:37:57 -0000 Author: tuexen Date: Thu Mar 7 20:37:57 2013 New Revision: 247938 URL: http://svnweb.freebsd.org/changeset/base/247938 Log: MFC r236522: Remove code which is not needed. Modified: stable/8/sys/netinet/sctp_pcb.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/netinet/ (props changed) Modified: stable/8/sys/netinet/sctp_pcb.c ============================================================================== --- stable/8/sys/netinet/sctp_pcb.c Thu Mar 7 20:36:17 2013 (r247937) +++ stable/8/sys/netinet/sctp_pcb.c Thu Mar 7 20:37:57 2013 (r247938) @@ -2185,8 +2185,6 @@ sctp_findassociation_addr(struct mbuf *m from6->sin6_addr = ip6->ip6_src; from6->sin6_port = sh->src_port; /* Get the scopes in properly to the sin6 addr's */ - /* we probably don't need these operations */ - (void)sa6_recoverscope(from6); sa6_embedscope(from6, MODULE_GLOBAL(ip6_use_defzone)); break; } @@ -2228,8 +2226,6 @@ sctp_findassociation_addr(struct mbuf *m to6->sin6_addr = ip6->ip6_dst; to6->sin6_port = sh->dest_port; /* Get the scopes in properly to the sin6 addr's */ - /* we probably don't need these operations */ - (void)sa6_recoverscope(to6); sa6_embedscope(to6, MODULE_GLOBAL(ip6_use_defzone)); break; } From owner-svn-src-stable@FreeBSD.ORG Thu Mar 7 20:41:37 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 2B21937D; Thu, 7 Mar 2013 20:41:37 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 1DD4B1CF; Thu, 7 Mar 2013 20:41:37 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r27KfaGP001929; Thu, 7 Mar 2013 20:41:36 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r27KfaWE001928; Thu, 7 Mar 2013 20:41:36 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201303072041.r27KfaWE001928@svn.freebsd.org> From: Michael Tuexen Date: Thu, 7 Mar 2013 20:41:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r247939 - stable/8/sys/netinet X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Mar 2013 20:41:37 -0000 Author: tuexen Date: Thu Mar 7 20:41:36 2013 New Revision: 247939 URL: http://svnweb.freebsd.org/changeset/base/247939 Log: MFC r236949: Small cleanup. Modified: stable/8/sys/netinet/sctputil.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/netinet/ (props changed) Modified: stable/8/sys/netinet/sctputil.c ============================================================================== --- stable/8/sys/netinet/sctputil.c Thu Mar 7 20:37:57 2013 (r247938) +++ stable/8/sys/netinet/sctputil.c Thu Mar 7 20:41:36 2013 (r247939) @@ -2573,15 +2573,13 @@ sctp_pad_lastmbuf(struct mbuf *m, int pa /* find the last mbuf in chain and pad it */ struct mbuf *m_at; - m_at = m; if (last_mbuf) { return (sctp_add_pad_tombuf(last_mbuf, padval)); } else { - while (m_at) { + for (m_at = m; m_at; m_at = SCTP_BUF_NEXT(m_at)) { if (SCTP_BUF_NEXT(m_at) == NULL) { return (sctp_add_pad_tombuf(m_at, padval)); } - m_at = SCTP_BUF_NEXT(m_at); } } SCTP_LTRACE_ERR_RET_PKT(m, NULL, NULL, NULL, SCTP_FROM_SCTPUTIL, EFAULT); From owner-svn-src-stable@FreeBSD.ORG Thu Mar 7 21:08:20 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id E307CBC1; Thu, 7 Mar 2013 21:08:20 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id BBD662EB; Thu, 7 Mar 2013 21:08:20 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r27L8KKG009065; Thu, 7 Mar 2013 21:08:20 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r27L8K0E009062; Thu, 7 Mar 2013 21:08:20 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201303072108.r27L8K0E009062@svn.freebsd.org> From: Michael Tuexen Date: Thu, 7 Mar 2013 21:08:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r247941 - stable/8/sys/netinet X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Mar 2013 21:08:21 -0000 Author: tuexen Date: Thu Mar 7 21:08:19 2013 New Revision: 247941 URL: http://svnweb.freebsd.org/changeset/base/247941 Log: MFC r236956: Unify the sending of ABORT, SHUTDOWN-COMPLETE and ERROR chunks. While there: Fix also some minor bugs and prepare for SCTP/DTLS. Modified: stable/8/sys/netinet/sctp_input.c stable/8/sys/netinet/sctp_output.c stable/8/sys/netinet/sctp_output.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/netinet/ (props changed) Modified: stable/8/sys/netinet/sctp_input.c ============================================================================== --- stable/8/sys/netinet/sctp_input.c Thu Mar 7 20:48:36 2013 (r247940) +++ stable/8/sys/netinet/sctp_input.c Thu Mar 7 21:08:19 2013 (r247941) @@ -1442,7 +1442,7 @@ sctp_process_cookie_existing(struct mbuf ph = mtod(op_err, struct sctp_paramhdr *); ph->param_type = htons(SCTP_CAUSE_COOKIE_IN_SHUTDOWN); ph->param_length = htons(sizeof(struct sctp_paramhdr)); - sctp_send_operr_to(m, iphlen, op_err, cookie->peers_vtag, + sctp_send_operr_to(m, sh, cookie->peers_vtag, op_err, vrf_id, net->port); if (how_indx < sizeof(asoc->cookie_how)) asoc->cookie_how[how_indx] = 2; @@ -2570,7 +2570,7 @@ sctp_handle_cookie_echo(struct mbuf *m, if (tim == 0) tim = now.tv_usec - cookie->time_entered.tv_usec; scm->time_usec = htonl(tim); - sctp_send_operr_to(m, iphlen, op_err, cookie->peers_vtag, + sctp_send_operr_to(m, sh, cookie->peers_vtag, op_err, vrf_id, port); return (NULL); } Modified: stable/8/sys/netinet/sctp_output.c ============================================================================== --- stable/8/sys/netinet/sctp_output.c Thu Mar 7 20:48:36 2013 (r247940) +++ stable/8/sys/netinet/sctp_output.c Thu Mar 7 21:08:19 2013 (r247941) @@ -10854,19 +10854,20 @@ sctp_send_shutdown_complete(struct sctp_ return; } -void -sctp_send_shutdown_complete2(struct mbuf *m, struct sctphdr *sh, - uint32_t vrf_id, uint16_t port) +static void +sctp_send_resp_msg(struct mbuf *m, struct sctphdr *sh, uint32_t vtag, + uint8_t type, struct mbuf *cause, uint32_t vrf_id, uint16_t port) { - /* formulate and SEND a SHUTDOWN-COMPLETE */ struct mbuf *o_pak; struct mbuf *mout; + struct sctphdr *shout; + struct sctp_chunkhdr *ch; struct ip *iph; - struct udphdr *udp = NULL; - int offset_out, len, mlen; - struct sctp_shutdown_complete_msg *comp_cp; + struct udphdr *udp; + int len, cause_len, padding_len, ret; #ifdef INET + sctp_route_t ro; struct ip *iph_out; #endif @@ -10875,31 +10876,59 @@ sctp_send_shutdown_complete2(struct mbuf #endif + /* Compute the length of the cause and add final padding. */ + cause_len = 0; + if (cause != NULL) { + struct mbuf *m_at, *m_last = NULL; + + for (m_at = cause; m_at; m_at = SCTP_BUF_NEXT(m_at)) { + if (SCTP_BUF_NEXT(m_at) == NULL) + m_last = m_at; + cause_len += SCTP_BUF_LEN(m_at); + } + padding_len = cause_len % 4; + if (padding_len != 0) { + padding_len = 4 - padding_len; + } + if (padding_len != 0) { + if (sctp_add_pad_tombuf(m_last, padding_len)) { + sctp_m_freem(cause); + return; + } + } + } else { + padding_len = 0; + } + /* Get an mbuf for the header. */ + len = sizeof(struct sctphdr) + sizeof(struct sctp_chunkhdr); iph = mtod(m, struct ip *); switch (iph->ip_v) { #ifdef INET case IPVERSION: - len = (sizeof(struct ip) + sizeof(struct sctp_shutdown_complete_msg)); + len += sizeof(struct ip); break; #endif #ifdef INET6 case IPV6_VERSION >> 4: - len = (sizeof(struct ip6_hdr) + sizeof(struct sctp_shutdown_complete_msg)); + len += sizeof(struct ip6_hdr); break; #endif default: - return; + break; } if (port) { len += sizeof(struct udphdr); } mout = sctp_get_mbuf_for_msg(len + max_linkhdr, 1, M_DONTWAIT, 1, MT_DATA); if (mout == NULL) { + if (cause) { + sctp_m_freem(cause); + } return; } SCTP_BUF_RESV_UF(mout, max_linkhdr); SCTP_BUF_LEN(mout) = len; - SCTP_BUF_NEXT(mout) = NULL; + SCTP_BUF_NEXT(mout) = cause; if (m->m_flags & M_FLOWID) { mout->m_pkthdr.flowid = m->m_pkthdr.flowid; mout->m_flags |= M_FLOWID; @@ -10910,18 +10939,14 @@ sctp_send_shutdown_complete2(struct mbuf #ifdef INET6 ip6_out = NULL; #endif - offset_out = 0; - switch (iph->ip_v) { #ifdef INET case IPVERSION: iph_out = mtod(mout, struct ip *); - - /* Fill in the IP header for the ABORT */ iph_out->ip_v = IPVERSION; - iph_out->ip_hl = (sizeof(struct ip) / 4); - iph_out->ip_tos = (u_char)0; - iph_out->ip_id = 0; + iph_out->ip_hl = (sizeof(struct ip) >> 2); + iph_out->ip_tos = 0; + iph_out->ip_id = ip_newid(); iph_out->ip_off = 0; iph_out->ip_ttl = MODULE_GLOBAL(ip_defttl); if (port) { @@ -10931,21 +10956,19 @@ sctp_send_shutdown_complete2(struct mbuf } iph_out->ip_src.s_addr = iph->ip_dst.s_addr; iph_out->ip_dst.s_addr = iph->ip_src.s_addr; - - /* let IP layer calculate this */ iph_out->ip_sum = 0; - offset_out += sizeof(*iph_out); - comp_cp = (struct sctp_shutdown_complete_msg *)( - (caddr_t)iph_out + offset_out); + len = sizeof(struct ip); + shout = (struct sctphdr *)((caddr_t)iph_out + len); break; #endif #ifdef INET6 case IPV6_VERSION >> 4: ip6 = (struct ip6_hdr *)iph; ip6_out = mtod(mout, struct ip6_hdr *); - - /* Fill in the IPv6 header for the ABORT */ - ip6_out->ip6_flow = ip6->ip6_flow; + ip6_out->ip6_flow = htonl(0x60000000); + if (V_ip6_auto_flowlabel) { + ip6_out->ip6_flow |= (htonl(ip6_randomflowlabel()) & IPV6_FLOWLABEL_MASK); + } ip6_out->ip6_hlim = MODULE_GLOBAL(ip6_defhlim); if (port) { ip6_out->ip6_nxt = IPPROTO_UDP; @@ -10954,78 +10977,84 @@ sctp_send_shutdown_complete2(struct mbuf } ip6_out->ip6_src = ip6->ip6_dst; ip6_out->ip6_dst = ip6->ip6_src; - /* - * ?? The old code had both the iph len + payload, I think - * this is wrong and would never have worked - */ - ip6_out->ip6_plen = sizeof(struct sctp_shutdown_complete_msg); - offset_out += sizeof(*ip6_out); - comp_cp = (struct sctp_shutdown_complete_msg *)( - (caddr_t)ip6_out + offset_out); + len = sizeof(struct ip6_hdr); + shout = (struct sctphdr *)((caddr_t)ip6_out + len); break; -#endif /* INET6 */ +#endif default: - /* Currently not supported. */ - sctp_m_freem(mout); - return; + len = 0; + shout = mtod(mout, struct sctphdr *); + break; } if (port) { if (htons(SCTP_BASE_SYSCTL(sctp_udp_tunneling_port)) == 0) { sctp_m_freem(mout); return; } - udp = (struct udphdr *)comp_cp; + udp = (struct udphdr *)shout; udp->uh_sport = htons(SCTP_BASE_SYSCTL(sctp_udp_tunneling_port)); udp->uh_dport = port; - udp->uh_ulen = htons(sizeof(struct sctp_shutdown_complete_msg) + sizeof(struct udphdr)); -#ifdef INET - if (iph_out) { - if (V_udp_cksum) { - udp->uh_sum = in_pseudo(iph_out->ip_src.s_addr, iph_out->ip_dst.s_addr, udp->uh_ulen + htons(IPPROTO_UDP)); - } else { - udp->uh_sum = 0; - } - } -#endif - offset_out += sizeof(struct udphdr); - comp_cp = (struct sctp_shutdown_complete_msg *)((caddr_t)comp_cp + sizeof(struct udphdr)); + udp->uh_sum = 0; + udp->uh_ulen = htons(sizeof(struct udphdr) + + sizeof(struct sctphdr) + + sizeof(struct sctp_chunkhdr) + + cause_len + padding_len); + len += sizeof(struct udphdr); + shout = (struct sctphdr *)((caddr_t)shout + sizeof(struct udphdr)); + } else { + udp = NULL; } + shout->src_port = sh->dest_port; + shout->dest_port = sh->src_port; + shout->checksum = 0; + if (vtag) { + shout->v_tag = htonl(vtag); + } else { + shout->v_tag = sh->v_tag; + } + len += sizeof(struct sctphdr); + ch = (struct sctp_chunkhdr *)((caddr_t)shout + sizeof(struct sctphdr)); + ch->chunk_type = type; + if (vtag) { + ch->chunk_flags = 0; + } else { + ch->chunk_flags = SCTP_HAD_NO_TCB; + } + ch->chunk_length = htons(sizeof(struct sctp_chunkhdr) + cause_len); + len += sizeof(struct sctp_chunkhdr); + len += cause_len + padding_len; + if (SCTP_GET_HEADER_FOR_OUTPUT(o_pak)) { - /* no mbuf's */ sctp_m_freem(mout); return; } - /* Now copy in and fill in the ABORT tags etc. */ - comp_cp->sh.src_port = sh->dest_port; - comp_cp->sh.dest_port = sh->src_port; - comp_cp->sh.checksum = 0; - comp_cp->sh.v_tag = sh->v_tag; - comp_cp->shut_cmp.ch.chunk_flags = SCTP_HAD_NO_TCB; - comp_cp->shut_cmp.ch.chunk_type = SCTP_SHUTDOWN_COMPLETE; - comp_cp->shut_cmp.ch.chunk_length = htons(sizeof(struct sctp_shutdown_complete_chunk)); - + SCTP_ATTACH_CHAIN(o_pak, mout, len); #ifdef INET if (iph_out != NULL) { - sctp_route_t ro; - int ret; - - mlen = SCTP_BUF_LEN(mout); - bzero(&ro, sizeof ro); - /* set IPv4 length */ - iph_out->ip_len = mlen; -#ifdef SCTP_PACKET_LOGGING - if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_LAST_PACKET_TRACING) - sctp_packet_log(mout, mlen); + /* zap the stack pointer to the route */ + bzero(&ro, sizeof(sctp_route_t)); + if (port) { + if (V_udp_cksum) { + udp->uh_sum = in_pseudo(iph_out->ip_src.s_addr, iph_out->ip_dst.s_addr, udp->uh_ulen + htons(IPPROTO_UDP)); + } else { + udp->uh_sum = 0; + } + } + iph_out->ip_len = len; +#ifdef SCTP_PACKET_LOGGING + if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_LAST_PACKET_TRACING) { + sctp_packet_log(mout, len); + } #endif if (port) { #if defined(SCTP_WITH_NO_CSUM) SCTP_STAT_INCR(sctps_sendnocrc); #else - comp_cp->sh.checksum = sctp_calculate_cksum(mout, offset_out); + shout->checksum = sctp_calculate_cksum(mout, sizeof(struct ip) + sizeof(struct udphdr)); SCTP_STAT_INCR(sctps_sendswcrc); #endif if (V_udp_cksum) { - SCTP_ENABLE_UDP_CSUM(mout); + SCTP_ENABLE_UDP_CSUM(o_pak); } } else { #if defined(SCTP_WITH_NO_CSUM) @@ -11036,33 +11065,29 @@ sctp_send_shutdown_complete2(struct mbuf SCTP_STAT_INCR(sctps_sendhwcrc); #endif } - SCTP_ATTACH_CHAIN(o_pak, mout, mlen); - /* out it goes */ SCTP_IP_OUTPUT(ret, o_pak, &ro, NULL, vrf_id); - /* Free the route if we got one back */ - if (ro.ro_rt) + if (ro.ro_rt) { RTFREE(ro.ro_rt); + } } #endif #ifdef INET6 if (ip6_out != NULL) { - int ret; - - mlen = SCTP_BUF_LEN(mout); + ip6_out->ip6_plen = len - sizeof(struct ip6_hdr); #ifdef SCTP_PACKET_LOGGING - if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_LAST_PACKET_TRACING) - sctp_packet_log(mout, mlen); + if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_LAST_PACKET_TRACING) { + sctp_packet_log(mout, len); + } #endif - SCTP_ATTACH_CHAIN(o_pak, mout, mlen); if (port) { #if defined(SCTP_WITH_NO_CSUM) SCTP_STAT_INCR(sctps_sendnocrc); #else - comp_cp->sh.checksum = sctp_calculate_cksum(mout, sizeof(struct ip6_hdr) + sizeof(struct udphdr)); + shout->checksum = sctp_calculate_cksum(mout, sizeof(struct ip6_hdr) + sizeof(struct udphdr)); SCTP_STAT_INCR(sctps_sendswcrc); #endif - if ((udp->uh_sum = in6_cksum(o_pak, IPPROTO_UDP, sizeof(struct ip6_hdr), mlen - sizeof(struct ip6_hdr))) == 0) { + if ((udp->uh_sum = in6_cksum(o_pak, IPPROTO_UDP, sizeof(struct ip6_hdr), len - sizeof(struct ip6_hdr))) == 0) { udp->uh_sum = 0xffff; } } else { @@ -11081,7 +11106,13 @@ sctp_send_shutdown_complete2(struct mbuf SCTP_STAT_INCR_COUNTER64(sctps_outpackets); SCTP_STAT_INCR_COUNTER64(sctps_outcontrolchunks); return; +} +void +sctp_send_shutdown_complete2(struct mbuf *m, struct sctphdr *sh, + uint32_t vrf_id, uint16_t port) +{ + sctp_send_resp_msg(m, sh, 0, SCTP_SHUTDOWN_COMPLETE, NULL, vrf_id, port); } void @@ -11913,528 +11944,24 @@ skip_stuff: void sctp_send_abort(struct mbuf *m, int iphlen, struct sctphdr *sh, uint32_t vtag, - struct mbuf *err_cause, uint32_t vrf_id, uint16_t port) + struct mbuf *cause, uint32_t vrf_id, uint16_t port) { - /*- - * Formulate the abort message, and send it back down. - */ - struct mbuf *o_pak; - struct mbuf *mout; - struct sctp_abort_msg *abm; - struct ip *iph; - struct udphdr *udp; - int iphlen_out, len; - -#ifdef INET - struct ip *iph_out; - -#endif -#ifdef INET6 - struct ip6_hdr *ip6, *ip6_out; - -#endif - - /* don't respond to ABORT with ABORT */ + /* Don't respond to an ABORT with an ABORT. */ if (sctp_is_there_an_abort_here(m, iphlen, &vtag)) { - if (err_cause) - sctp_m_freem(err_cause); - return; - } - iph = mtod(m, struct ip *); - switch (iph->ip_v) { -#ifdef INET - case IPVERSION: - len = (sizeof(struct ip) + sizeof(struct sctp_abort_msg)); - break; -#endif -#ifdef INET6 - case IPV6_VERSION >> 4: - len = (sizeof(struct ip6_hdr) + sizeof(struct sctp_abort_msg)); - break; -#endif - default: - if (err_cause) { - sctp_m_freem(err_cause); - } - return; - } - if (port) { - len += sizeof(struct udphdr); - } - mout = sctp_get_mbuf_for_msg(len + max_linkhdr, 1, M_DONTWAIT, 1, MT_DATA); - if (mout == NULL) { - if (err_cause) { - sctp_m_freem(err_cause); - } + if (cause) + sctp_m_freem(cause); return; } - SCTP_BUF_RESV_UF(mout, max_linkhdr); - SCTP_BUF_LEN(mout) = len; - SCTP_BUF_NEXT(mout) = err_cause; - if (m->m_flags & M_FLOWID) { - mout->m_pkthdr.flowid = m->m_pkthdr.flowid; - mout->m_flags |= M_FLOWID; - } -#ifdef INET - iph_out = NULL; -#endif -#ifdef INET6 - ip6_out = NULL; -#endif - switch (iph->ip_v) { -#ifdef INET - case IPVERSION: - iph_out = mtod(mout, struct ip *); - - /* Fill in the IP header for the ABORT */ - iph_out->ip_v = IPVERSION; - iph_out->ip_hl = (sizeof(struct ip) / 4); - iph_out->ip_tos = (u_char)0; - iph_out->ip_id = 0; - iph_out->ip_off = 0; - iph_out->ip_ttl = MODULE_GLOBAL(ip_defttl); - if (port) { - iph_out->ip_p = IPPROTO_UDP; - } else { - iph_out->ip_p = IPPROTO_SCTP; - } - iph_out->ip_src.s_addr = iph->ip_dst.s_addr; - iph_out->ip_dst.s_addr = iph->ip_src.s_addr; - /* let IP layer calculate this */ - iph_out->ip_sum = 0; - - iphlen_out = sizeof(*iph_out); - abm = (struct sctp_abort_msg *)((caddr_t)iph_out + iphlen_out); - break; -#endif -#ifdef INET6 - case IPV6_VERSION >> 4: - ip6 = (struct ip6_hdr *)iph; - ip6_out = mtod(mout, struct ip6_hdr *); - - /* Fill in the IP6 header for the ABORT */ - ip6_out->ip6_flow = ip6->ip6_flow; - ip6_out->ip6_hlim = MODULE_GLOBAL(ip6_defhlim); - if (port) { - ip6_out->ip6_nxt = IPPROTO_UDP; - } else { - ip6_out->ip6_nxt = IPPROTO_SCTP; - } - ip6_out->ip6_src = ip6->ip6_dst; - ip6_out->ip6_dst = ip6->ip6_src; - - iphlen_out = sizeof(*ip6_out); - abm = (struct sctp_abort_msg *)((caddr_t)ip6_out + iphlen_out); - break; -#endif /* INET6 */ - default: - /* Currently not supported */ - sctp_m_freem(mout); - return; - } - - udp = (struct udphdr *)abm; - if (port) { - if (htons(SCTP_BASE_SYSCTL(sctp_udp_tunneling_port)) == 0) { - sctp_m_freem(mout); - return; - } - udp->uh_sport = htons(SCTP_BASE_SYSCTL(sctp_udp_tunneling_port)); - udp->uh_dport = port; - /* set udp->uh_ulen later */ - udp->uh_sum = 0; - iphlen_out += sizeof(struct udphdr); - abm = (struct sctp_abort_msg *)((caddr_t)abm + sizeof(struct udphdr)); - } - abm->sh.src_port = sh->dest_port; - abm->sh.dest_port = sh->src_port; - abm->sh.checksum = 0; - if (vtag == 0) { - abm->sh.v_tag = sh->v_tag; - abm->msg.ch.chunk_flags = SCTP_HAD_NO_TCB; - } else { - abm->sh.v_tag = htonl(vtag); - abm->msg.ch.chunk_flags = 0; - } - abm->msg.ch.chunk_type = SCTP_ABORT_ASSOCIATION; - - if (err_cause) { - struct mbuf *m_tmp = err_cause; - int err_len = 0; - - /* get length of the err_cause chain */ - while (m_tmp != NULL) { - err_len += SCTP_BUF_LEN(m_tmp); - m_tmp = SCTP_BUF_NEXT(m_tmp); - } - len = SCTP_BUF_LEN(mout) + err_len; - if (err_len % 4) { - /* need pad at end of chunk */ - uint32_t cpthis = 0; - int padlen; - - padlen = 4 - (len % 4); - m_copyback(mout, len, padlen, (caddr_t)&cpthis); - len += padlen; - } - abm->msg.ch.chunk_length = htons(sizeof(abm->msg.ch) + err_len); - } else { - len = SCTP_BUF_LEN(mout); - abm->msg.ch.chunk_length = htons(sizeof(abm->msg.ch)); - } - - if (SCTP_GET_HEADER_FOR_OUTPUT(o_pak)) { - /* no mbuf's */ - sctp_m_freem(mout); - return; - } -#ifdef INET - if (iph_out != NULL) { - sctp_route_t ro; - int ret; - - /* zap the stack pointer to the route */ - bzero(&ro, sizeof ro); - if (port) { - udp->uh_ulen = htons(len - sizeof(struct ip)); - if (V_udp_cksum) { - udp->uh_sum = in_pseudo(iph_out->ip_src.s_addr, iph_out->ip_dst.s_addr, udp->uh_ulen + htons(IPPROTO_UDP)); - } else { - udp->uh_sum = 0; - } - } - SCTPDBG(SCTP_DEBUG_OUTPUT2, "sctp_send_abort calling ip_output:\n"); - SCTPDBG_PKT(SCTP_DEBUG_OUTPUT2, iph_out, &abm->sh); - /* set IPv4 length */ - iph_out->ip_len = len; - /* out it goes */ -#ifdef SCTP_PACKET_LOGGING - if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_LAST_PACKET_TRACING) - sctp_packet_log(mout, len); -#endif - SCTP_ATTACH_CHAIN(o_pak, mout, len); - if (port) { -#if defined(SCTP_WITH_NO_CSUM) - SCTP_STAT_INCR(sctps_sendnocrc); -#else - abm->sh.checksum = sctp_calculate_cksum(mout, iphlen_out); - SCTP_STAT_INCR(sctps_sendswcrc); -#endif - if (V_udp_cksum) { - SCTP_ENABLE_UDP_CSUM(o_pak); - } - } else { -#if defined(SCTP_WITH_NO_CSUM) - SCTP_STAT_INCR(sctps_sendnocrc); -#else - mout->m_pkthdr.csum_flags = CSUM_SCTP; - mout->m_pkthdr.csum_data = 0; - SCTP_STAT_INCR(sctps_sendhwcrc); -#endif - } - SCTP_IP_OUTPUT(ret, o_pak, &ro, NULL, vrf_id); - - /* Free the route if we got one back */ - if (ro.ro_rt) - RTFREE(ro.ro_rt); - } -#endif -#ifdef INET6 - if (ip6_out != NULL) { - int ret; - - if (port) { - udp->uh_ulen = htons(len - sizeof(struct ip6_hdr)); - } - SCTPDBG(SCTP_DEBUG_OUTPUT2, "sctp_send_abort calling ip6_output:\n"); - SCTPDBG_PKT(SCTP_DEBUG_OUTPUT2, (struct ip *)ip6_out, &abm->sh); - ip6_out->ip6_plen = len - sizeof(*ip6_out); -#ifdef SCTP_PACKET_LOGGING - if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_LAST_PACKET_TRACING) - sctp_packet_log(mout, len); -#endif - SCTP_ATTACH_CHAIN(o_pak, mout, len); - if (port) { -#if defined(SCTP_WITH_NO_CSUM) - SCTP_STAT_INCR(sctps_sendnocrc); -#else - abm->sh.checksum = sctp_calculate_cksum(mout, sizeof(struct ip6_hdr) + sizeof(struct udphdr)); - SCTP_STAT_INCR(sctps_sendswcrc); -#endif - if ((udp->uh_sum = in6_cksum(o_pak, IPPROTO_UDP, sizeof(struct ip6_hdr), len - sizeof(struct ip6_hdr))) == 0) { - udp->uh_sum = 0xffff; - } - } else { -#if defined(SCTP_WITH_NO_CSUM) - SCTP_STAT_INCR(sctps_sendnocrc); -#else - mout->m_pkthdr.csum_flags = CSUM_SCTP; - mout->m_pkthdr.csum_data = 0; - SCTP_STAT_INCR(sctps_sendhwcrc); -#endif - } - SCTP_IP6_OUTPUT(ret, o_pak, NULL, NULL, NULL, vrf_id); - } -#endif - SCTP_STAT_INCR(sctps_sendpackets); - SCTP_STAT_INCR_COUNTER64(sctps_outpackets); - SCTP_STAT_INCR_COUNTER64(sctps_outcontrolchunks); + sctp_send_resp_msg(m, sh, vtag, SCTP_ABORT_ASSOCIATION, cause, vrf_id, port); + return; } void -sctp_send_operr_to(struct mbuf *m, int iphlen, struct mbuf *scm, uint32_t vtag, - uint32_t vrf_id, uint16_t port) +sctp_send_operr_to(struct mbuf *m, struct sctphdr *sh, uint32_t vtag, + struct mbuf *cause, uint32_t vrf_id, uint16_t port) { - struct mbuf *o_pak; - struct sctphdr *sh, *sh_out; - struct sctp_chunkhdr *ch; - struct ip *iph; - struct udphdr *udp = NULL; - struct mbuf *mout; - int iphlen_out, len; - -#ifdef INET - struct ip *iph_out; - -#endif -#ifdef INET6 - struct ip6_hdr *ip6, *ip6_out; - -#endif - - iph = mtod(m, struct ip *); - sh = (struct sctphdr *)((caddr_t)iph + iphlen); - switch (iph->ip_v) { -#ifdef INET - case IPVERSION: - len = (sizeof(struct ip) + sizeof(struct sctphdr) + sizeof(struct sctp_chunkhdr)); - break; -#endif -#ifdef INET6 - case IPV6_VERSION >> 4: - len = (sizeof(struct ip6_hdr) + sizeof(struct sctphdr) + sizeof(struct sctp_chunkhdr)); - break; -#endif - default: - if (scm) { - sctp_m_freem(scm); - } - return; - } - if (port) { - len += sizeof(struct udphdr); - } - mout = sctp_get_mbuf_for_msg(len + max_linkhdr, 1, M_DONTWAIT, 1, MT_DATA); - if (mout == NULL) { - if (scm) { - sctp_m_freem(scm); - } - return; - } - SCTP_BUF_RESV_UF(mout, max_linkhdr); - SCTP_BUF_LEN(mout) = len; - SCTP_BUF_NEXT(mout) = scm; - if (m->m_flags & M_FLOWID) { - mout->m_pkthdr.flowid = m->m_pkthdr.flowid; - mout->m_flags |= M_FLOWID; - } -#ifdef INET - iph_out = NULL; -#endif -#ifdef INET6 - ip6_out = NULL; -#endif - switch (iph->ip_v) { -#ifdef INET - case IPVERSION: - iph_out = mtod(mout, struct ip *); - - /* Fill in the IP header for the ABORT */ - iph_out->ip_v = IPVERSION; - iph_out->ip_hl = (sizeof(struct ip) / 4); - iph_out->ip_tos = (u_char)0; - iph_out->ip_id = 0; - iph_out->ip_off = 0; - iph_out->ip_ttl = MODULE_GLOBAL(ip_defttl); - if (port) { - iph_out->ip_p = IPPROTO_UDP; - } else { - iph_out->ip_p = IPPROTO_SCTP; - } - iph_out->ip_src.s_addr = iph->ip_dst.s_addr; - iph_out->ip_dst.s_addr = iph->ip_src.s_addr; - /* let IP layer calculate this */ - iph_out->ip_sum = 0; - - iphlen_out = sizeof(struct ip); - sh_out = (struct sctphdr *)((caddr_t)iph_out + iphlen_out); - break; -#endif -#ifdef INET6 - case IPV6_VERSION >> 4: - ip6 = (struct ip6_hdr *)iph; - ip6_out = mtod(mout, struct ip6_hdr *); - - /* Fill in the IP6 header for the ABORT */ - ip6_out->ip6_flow = ip6->ip6_flow; - ip6_out->ip6_hlim = MODULE_GLOBAL(ip6_defhlim); - if (port) { - ip6_out->ip6_nxt = IPPROTO_UDP; - } else { - ip6_out->ip6_nxt = IPPROTO_SCTP; - } - ip6_out->ip6_src = ip6->ip6_dst; - ip6_out->ip6_dst = ip6->ip6_src; - - iphlen_out = sizeof(struct ip6_hdr); - sh_out = (struct sctphdr *)((caddr_t)ip6_out + iphlen_out); - break; -#endif /* INET6 */ - default: - /* Currently not supported */ - sctp_m_freem(mout); - return; - } - - udp = (struct udphdr *)sh_out; - if (port) { - if (htons(SCTP_BASE_SYSCTL(sctp_udp_tunneling_port)) == 0) { - sctp_m_freem(mout); - return; - } - udp->uh_sport = htons(SCTP_BASE_SYSCTL(sctp_udp_tunneling_port)); - udp->uh_dport = port; - /* set udp->uh_ulen later */ - udp->uh_sum = 0; - iphlen_out += sizeof(struct udphdr); - sh_out = (struct sctphdr *)((caddr_t)udp + sizeof(struct udphdr)); - } - sh_out->src_port = sh->dest_port; - sh_out->dest_port = sh->src_port; - sh_out->v_tag = vtag; - sh_out->checksum = 0; - - ch = (struct sctp_chunkhdr *)((caddr_t)sh_out + sizeof(struct sctphdr)); - ch->chunk_type = SCTP_OPERATION_ERROR; - ch->chunk_flags = 0; - - if (scm) { - struct mbuf *m_tmp = scm; - int cause_len = 0; - - /* get length of the err_cause chain */ - while (m_tmp != NULL) { - cause_len += SCTP_BUF_LEN(m_tmp); - m_tmp = SCTP_BUF_NEXT(m_tmp); - } - len = SCTP_BUF_LEN(mout) + cause_len; - if (cause_len % 4) { - /* need pad at end of chunk */ - uint32_t cpthis = 0; - int padlen; - - padlen = 4 - (len % 4); - m_copyback(mout, len, padlen, (caddr_t)&cpthis); - len += padlen; - } - ch->chunk_length = htons(sizeof(struct sctp_chunkhdr) + cause_len); - } else { - len = SCTP_BUF_LEN(mout); - ch->chunk_length = htons(sizeof(struct sctp_chunkhdr)); - } - - if (SCTP_GET_HEADER_FOR_OUTPUT(o_pak)) { - /* no mbuf's */ - sctp_m_freem(mout); - return; - } -#ifdef INET - if (iph_out != NULL) { - sctp_route_t ro; - int ret; - - /* zap the stack pointer to the route */ - bzero(&ro, sizeof ro); - if (port) { - udp->uh_ulen = htons(len - sizeof(struct ip)); - if (V_udp_cksum) { - udp->uh_sum = in_pseudo(iph_out->ip_src.s_addr, iph_out->ip_dst.s_addr, udp->uh_ulen + htons(IPPROTO_UDP)); - } else { - udp->uh_sum = 0; - } - } - /* set IPv4 length */ - iph_out->ip_len = len; - /* out it goes */ -#ifdef SCTP_PACKET_LOGGING - if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_LAST_PACKET_TRACING) - sctp_packet_log(mout, len); -#endif - SCTP_ATTACH_CHAIN(o_pak, mout, len); - if (port) { -#if defined(SCTP_WITH_NO_CSUM) - SCTP_STAT_INCR(sctps_sendnocrc); -#else - sh_out->checksum = sctp_calculate_cksum(mout, iphlen_out); - SCTP_STAT_INCR(sctps_sendswcrc); -#endif - if (V_udp_cksum) { - SCTP_ENABLE_UDP_CSUM(o_pak); - } - } else { -#if defined(SCTP_WITH_NO_CSUM) - SCTP_STAT_INCR(sctps_sendnocrc); -#else - mout->m_pkthdr.csum_flags = CSUM_SCTP; - mout->m_pkthdr.csum_data = 0; - SCTP_STAT_INCR(sctps_sendhwcrc); -#endif - } - SCTP_IP_OUTPUT(ret, o_pak, &ro, NULL, vrf_id); - - /* Free the route if we got one back */ - if (ro.ro_rt) - RTFREE(ro.ro_rt); - } -#endif -#ifdef INET6 - if (ip6_out != NULL) { - int ret; - - if (port) { - udp->uh_ulen = htons(len - sizeof(struct ip6_hdr)); - } - ip6_out->ip6_plen = len - sizeof(*ip6_out); -#ifdef SCTP_PACKET_LOGGING - if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_LAST_PACKET_TRACING) - sctp_packet_log(mout, len); -#endif - SCTP_ATTACH_CHAIN(o_pak, mout, len); - if (port) { -#if defined(SCTP_WITH_NO_CSUM) - SCTP_STAT_INCR(sctps_sendnocrc); -#else - sh_out->checksum = sctp_calculate_cksum(mout, sizeof(struct ip6_hdr) + sizeof(struct udphdr)); - SCTP_STAT_INCR(sctps_sendswcrc); -#endif - if ((udp->uh_sum = in6_cksum(o_pak, IPPROTO_UDP, sizeof(struct ip6_hdr), len - sizeof(struct ip6_hdr))) == 0) { - udp->uh_sum = 0xffff; - } - } else { -#if defined(SCTP_WITH_NO_CSUM) - SCTP_STAT_INCR(sctps_sendnocrc); -#else - mout->m_pkthdr.csum_flags = CSUM_SCTP; - mout->m_pkthdr.csum_data = 0; - SCTP_STAT_INCR(sctps_sendhwcrc); -#endif - } - SCTP_IP6_OUTPUT(ret, o_pak, NULL, NULL, NULL, vrf_id); - } -#endif - SCTP_STAT_INCR(sctps_sendpackets); - SCTP_STAT_INCR_COUNTER64(sctps_outpackets); - SCTP_STAT_INCR_COUNTER64(sctps_outcontrolchunks); + sctp_send_resp_msg(m, sh, vtag, SCTP_OPERATION_ERROR, cause, vrf_id, port); + return; } static struct mbuf * Modified: stable/8/sys/netinet/sctp_output.h ============================================================================== --- stable/8/sys/netinet/sctp_output.h Thu Mar 7 20:48:36 2013 (r247940) +++ stable/8/sys/netinet/sctp_output.h Thu Mar 7 21:08:19 2013 (r247941) @@ -204,7 +204,9 @@ void sctp_send_abort(struct mbuf *, int, struct sctphdr *, uint32_t, struct mbuf *, uint32_t, uint16_t); -void sctp_send_operr_to(struct mbuf *, int, struct mbuf *, uint32_t, uint32_t, uint16_t); +void +sctp_send_operr_to(struct mbuf *, struct sctphdr *, uint32_t, + struct mbuf *, uint32_t, uint16_t); #endif /* _KERNEL || __Userspace__ */ From owner-svn-src-stable@FreeBSD.ORG Thu Mar 7 21:11:16 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 9968CECA; Thu, 7 Mar 2013 21:11:16 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 8BACB30D; Thu, 7 Mar 2013 21:11:16 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r27LBGSP011294; Thu, 7 Mar 2013 21:11:16 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r27LBGIq011293; Thu, 7 Mar 2013 21:11:16 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201303072111.r27LBGIq011293@svn.freebsd.org> From: Michael Tuexen Date: Thu, 7 Mar 2013 21:11:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r247943 - stable/8/sys/netinet6 X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Mar 2013 21:11:16 -0000 Author: tuexen Date: Thu Mar 7 21:11:16 2013 New Revision: 247943 URL: http://svnweb.freebsd.org/changeset/base/247943 Log: MFC r236958: Deliver IPV6_TCLASS, IPV6_HOPLIMIT and IPV6_PKTINFO cmsgs (if requested) on IPV6 sockets, which have been marked to be not IPV6_V6ONLY, for each received IPV4 packet. Modified: stable/8/sys/netinet6/ip6_input.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/netinet6/ (props changed) Modified: stable/8/sys/netinet6/ip6_input.c ============================================================================== --- stable/8/sys/netinet6/ip6_input.c Thu Mar 7 21:10:49 2013 (r247942) +++ stable/8/sys/netinet6/ip6_input.c Thu Mar 7 21:11:16 2013 (r247943) @@ -1236,19 +1236,28 @@ ip6_savecontrol_v4(struct inpcb *inp, st } #endif - if ((ip6->ip6_vfc & IPV6_VERSION_MASK) != IPV6_VERSION) { - if (v4only != NULL) - *v4only = 1; - return (mp); - } - #define IS2292(inp, x, y) (((inp)->inp_flags & IN6P_RFC2292) ? (x) : (y)) /* RFC 2292 sec. 5 */ if ((inp->inp_flags & IN6P_PKTINFO) != 0) { struct in6_pktinfo pi6; - bcopy(&ip6->ip6_dst, &pi6.ipi6_addr, sizeof(struct in6_addr)); - in6_clearscope(&pi6.ipi6_addr); /* XXX */ + if ((ip6->ip6_vfc & IPV6_VERSION_MASK) != IPV6_VERSION) { +#ifdef INET + struct ip *ip; + + ip = mtod(m, struct ip *); + pi6.ipi6_addr.s6_addr32[0] = 0; + pi6.ipi6_addr.s6_addr32[1] = 0; + pi6.ipi6_addr.s6_addr32[2] = IPV6_ADDR_INT32_SMP; + pi6.ipi6_addr.s6_addr32[3] = ip->ip_dst.s_addr; +#else + /* We won't hit this code */ + bzero(&pi6.ipi6_addr, sizeof(struct in6_addr)); +#endif + } else { + bcopy(&ip6->ip6_dst, &pi6.ipi6_addr, sizeof(struct in6_addr)); + in6_clearscope(&pi6.ipi6_addr); /* XXX */ + } pi6.ipi6_ifindex = (m && m->m_pkthdr.rcvif) ? m->m_pkthdr.rcvif->if_index : 0; @@ -1260,8 +1269,21 @@ ip6_savecontrol_v4(struct inpcb *inp, st } if ((inp->inp_flags & IN6P_HOPLIMIT) != 0) { - int hlim = ip6->ip6_hlim & 0xff; + int hlim; + + if ((ip6->ip6_vfc & IPV6_VERSION_MASK) != IPV6_VERSION) { +#ifdef INET + struct ip *ip; + ip = mtod(m, struct ip *); + hlim = ip->ip_ttl; +#else + /* We won't hit this code */ + hlim = 0; +#endif + } else { + hlim = ip6->ip6_hlim & 0xff; + } *mp = sbcreatecontrol((caddr_t) &hlim, sizeof(int), IS2292(inp, IPV6_2292HOPLIMIT, IPV6_HOPLIMIT), IPPROTO_IPV6); @@ -1269,8 +1291,40 @@ ip6_savecontrol_v4(struct inpcb *inp, st mp = &(*mp)->m_next; } - if (v4only != NULL) - *v4only = 0; + if ((inp->inp_flags & IN6P_TCLASS) != 0) { + int tclass; + + if ((ip6->ip6_vfc & IPV6_VERSION_MASK) != IPV6_VERSION) { +#ifdef INET + struct ip *ip; + + ip = mtod(m, struct ip *); + tclass = ip->ip_tos; +#else + /* We won't hit this code */ + tclass = 0; +#endif + } else { + u_int32_t flowinfo; + + flowinfo = (u_int32_t)ntohl(ip6->ip6_flow & IPV6_FLOWINFO_MASK); + flowinfo >>= 20; + tclass = flowinfo & 0xff; + } + *mp = sbcreatecontrol((caddr_t) &tclass, sizeof(int), + IPV6_TCLASS, IPPROTO_IPV6); + if (*mp) + mp = &(*mp)->m_next; + } + + if (v4only != NULL) { + if ((ip6->ip6_vfc & IPV6_VERSION_MASK) != IPV6_VERSION) { + *v4only = 1; + } else { + *v4only = 0; + } + } + return (mp); } @@ -1284,20 +1338,6 @@ ip6_savecontrol(struct inpcb *in6p, stru if (v4only) return; - if ((in6p->inp_flags & IN6P_TCLASS) != 0) { - u_int32_t flowinfo; - int tclass; - - flowinfo = (u_int32_t)ntohl(ip6->ip6_flow & IPV6_FLOWINFO_MASK); - flowinfo >>= 20; - - tclass = flowinfo & 0xff; - *mp = sbcreatecontrol((caddr_t) &tclass, sizeof(tclass), - IPV6_TCLASS, IPPROTO_IPV6); - if (*mp) - mp = &(*mp)->m_next; - } - /* * IPV6_HOPOPTS socket option. Recall that we required super-user * privilege for the option (see ip6_ctloutput), but it might be too From owner-svn-src-stable@FreeBSD.ORG Thu Mar 7 21:17:39 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id D952F100; Thu, 7 Mar 2013 21:17:39 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id B0830339; Thu, 7 Mar 2013 21:17:39 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r27LHdGf012269; Thu, 7 Mar 2013 21:17:39 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r27LHcj4012260; Thu, 7 Mar 2013 21:17:38 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201303072117.r27LHcj4012260@svn.freebsd.org> From: Michael Tuexen Date: Thu, 7 Mar 2013 21:17:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r247944 - in stable/8: lib/libc/net share/man/man4 sys/netinet X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Mar 2013 21:17:39 -0000 Author: tuexen Date: Thu Mar 7 21:17:37 2013 New Revision: 247944 URL: http://svnweb.freebsd.org/changeset/base/247944 Log: MFC r236959: Add a IP_RECVTOS socket option to receive for received UDP/IPv4 packets a cmsg of type IP_RECVTOS which contains the TOS byte. Much like IP_RECVTTL does for TTL. This allows to implement a protocol on top of UDP and implementing ECN. Modified: stable/8/lib/libc/net/sctp_sys_calls.c stable/8/share/man/man4/ip.4 stable/8/sys/netinet/in.h stable/8/sys/netinet/in_pcb.c stable/8/sys/netinet/in_pcb.h stable/8/sys/netinet/ip_input.c stable/8/sys/netinet/ip_output.c Directory Properties: stable/8/ (props changed) stable/8/lib/ (props changed) stable/8/lib/libc/ (props changed) stable/8/share/ (props changed) stable/8/share/man/ (props changed) stable/8/share/man/man4/ (props changed) stable/8/sys/ (props changed) stable/8/sys/netinet/ (props changed) Modified: stable/8/lib/libc/net/sctp_sys_calls.c ============================================================================== --- stable/8/lib/libc/net/sctp_sys_calls.c Thu Mar 7 21:11:16 2013 (r247943) +++ stable/8/lib/libc/net/sctp_sys_calls.c Thu Mar 7 21:17:37 2013 (r247944) @@ -1,7 +1,7 @@ /*- * Copyright (c) 2001-2007, by Cisco Systems, Inc. All rights reserved. - * Copyright (c) 2008-2011, by Randall Stewart. All rights reserved. - * Copyright (c) 2008-2011, by Michael Tuexen. All rights reserved. + * Copyright (c) 2008-2012, by Randall Stewart. All rights reserved. + * Copyright (c) 2008-2012, by Michael Tuexen. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: @@ -32,6 +32,7 @@ #include __FBSDID("$FreeBSD$"); + #include #include #include Modified: stable/8/share/man/man4/ip.4 ============================================================================== --- stable/8/share/man/man4/ip.4 Thu Mar 7 21:11:16 2013 (r247943) +++ stable/8/share/man/man4/ip.4 Thu Mar 7 21:17:37 2013 (r247944) @@ -32,7 +32,7 @@ .\" @(#)ip.4 8.2 (Berkeley) 11/30/93 .\" $FreeBSD$ .\" -.Dd June 1, 2009 +.Dd June 12, 2012 .Dt IP 4 .Os .Sh NAME @@ -165,7 +165,7 @@ The .Vt cmsghdr fields have the following values: .Bd -literal -cmsg_len = sizeof(struct in_addr) +cmsg_len = CMSG_LEN(sizeof(struct in_addr)) cmsg_level = IPPROTO_IP cmsg_type = IP_RECVDSTADDR .Ed @@ -184,7 +184,7 @@ structure followed by the address. The cmsghdr fields should have the following values: .Bd -literal -cmsg_len = sizeof(struct in_addr) +cmsg_len = CMSG_LEN(sizeof(struct in_addr)) cmsg_level = IPPROTO_IP cmsg_type = IP_SENDSRCADDR .Ed @@ -279,13 +279,36 @@ that contains a cmsghdr structure follow .Tn TTL . The cmsghdr fields have the following values: .Bd -literal -cmsg_len = sizeof(u_char) +cmsg_len = CMSG_LEN(sizeof(u_char)) cmsg_level = IPPROTO_IP cmsg_type = IP_RECVTTL .Ed .\" .Pp If the +.Dv IP_RECVTOS +option is enabled on a +.Dv SOCK_DGRAM +socket, the +.Xr recvmsg 2 +call will return the +.Tn IP +.Tn TOS +(type of service) field for a +.Tn UDP +datagram. +The msg_control field in the msghdr structure points to a buffer +that contains a cmsghdr structure followed by the +.Tn TOS . +The cmsghdr fields have the following values: +.Bd -literal +cmsg_len = CMSG_LEN(sizeof(u_char)) +cmsg_level = IPPROTO_IP +cmsg_type = IP_RECVTOS +.Ed +.\" +.Pp +If the .Dv IP_RECVIF option is enabled on a .Dv SOCK_DGRAM @@ -307,7 +330,7 @@ The .Vt cmsghdr fields have the following values: .Bd -literal -cmsg_len = sizeof(struct sockaddr_dl) +cmsg_len = CMSG_LEN(sizeof(struct sockaddr_dl)) cmsg_level = IPPROTO_IP cmsg_type = IP_RECVIF .Ed Modified: stable/8/sys/netinet/in.h ============================================================================== --- stable/8/sys/netinet/in.h Thu Mar 7 21:11:16 2013 (r247943) +++ stable/8/sys/netinet/in.h Thu Mar 7 21:17:37 2013 (r247944) @@ -477,6 +477,7 @@ __END_DECLS #define IP_RECVTTL 65 /* bool; receive IP TTL w/dgram */ #define IP_MINTTL 66 /* minimum TTL for packet or drop */ #define IP_DONTFRAG 67 /* don't fragment packet */ +#define IP_RECVTOS 68 /* bool; receive IP TOS w/dgram */ /* IPv4 Source Filter Multicast API [RFC3678] */ #define IP_ADD_SOURCE_MEMBERSHIP 70 /* join a source-specific group */ Modified: stable/8/sys/netinet/in_pcb.c ============================================================================== --- stable/8/sys/netinet/in_pcb.c Thu Mar 7 21:11:16 2013 (r247943) +++ stable/8/sys/netinet/in_pcb.c Thu Mar 7 21:17:37 2013 (r247944) @@ -1863,6 +1863,10 @@ db_print_inpflags(int inp_flags) db_printf("%sINP_DONTFRAG", comma ? ", " : ""); comma = 1; } + if (inp_flags & INP_RECVTOS) { + db_printf("%sINP_RECVTOS", comma ? ", " : ""); + comma = 1; + } if (inp_flags & IN6P_IPV6_V6ONLY) { db_printf("%sIN6P_IPV6_V6ONLY", comma ? ", " : ""); comma = 1; Modified: stable/8/sys/netinet/in_pcb.h ============================================================================== --- stable/8/sys/netinet/in_pcb.h Thu Mar 7 21:11:16 2013 (r247943) +++ stable/8/sys/netinet/in_pcb.h Thu Mar 7 21:17:37 2013 (r247944) @@ -413,6 +413,7 @@ void inp_4tuple_get(struct inpcb *inp, #define INP_DONTFRAG 0x00000800 /* don't fragment packet */ #define INP_BINDANY 0x00001000 /* allow bind to any address */ #define INP_INHASHLIST 0x00002000 /* in_pcbinshash() has been called */ +#define INP_RECVTOS 0x00004000 /* receive incoming IP TOS */ #define IN6P_IPV6_V6ONLY 0x00008000 /* restrict AF_INET6 socket for v6 */ #define IN6P_PKTINFO 0x00010000 /* receive IP6 dst and I/F */ #define IN6P_HOPLIMIT 0x00020000 /* receive hoplimit */ @@ -432,7 +433,7 @@ void inp_4tuple_get(struct inpcb *inp, #define IN6P_MTU 0x80000000 /* receive path MTU */ #define INP_CONTROLOPTS (INP_RECVOPTS|INP_RECVRETOPTS|INP_RECVDSTADDR|\ - INP_RECVIF|INP_RECVTTL|\ + INP_RECVIF|INP_RECVTTL|INP_RECVTOS|\ IN6P_PKTINFO|IN6P_HOPLIMIT|IN6P_HOPOPTS|\ IN6P_DSTOPTS|IN6P_RTHDR|IN6P_RTHDRDSTOPTS|\ IN6P_TCLASS|IN6P_AUTOFLOWLABEL|IN6P_RFC2292|\ Modified: stable/8/sys/netinet/ip_input.c ============================================================================== --- stable/8/sys/netinet/ip_input.c Thu Mar 7 21:11:16 2013 (r247943) +++ stable/8/sys/netinet/ip_input.c Thu Mar 7 21:17:37 2013 (r247944) @@ -1711,6 +1711,12 @@ makedummy: if (*mp) mp = &(*mp)->m_next; } + if (inp->inp_flags & INP_RECVTOS) { + *mp = sbcreatecontrol((caddr_t) &ip->ip_tos, + sizeof(u_char), IP_RECVTOS, IPPROTO_IP); + if (*mp) + mp = &(*mp)->m_next; + } } /* Modified: stable/8/sys/netinet/ip_output.c ============================================================================== --- stable/8/sys/netinet/ip_output.c Thu Mar 7 21:11:16 2013 (r247943) +++ stable/8/sys/netinet/ip_output.c Thu Mar 7 21:17:37 2013 (r247944) @@ -956,6 +956,7 @@ ip_ctloutput(struct socket *so, struct s case IP_FAITH: case IP_ONESBCAST: case IP_DONTFRAG: + case IP_RECVTOS: error = sooptcopyin(sopt, &optval, sizeof optval, sizeof optval); if (error) @@ -1019,6 +1020,9 @@ ip_ctloutput(struct socket *so, struct s case IP_BINDANY: OPTSET(INP_BINDANY); break; + case IP_RECVTOS: + OPTSET(INP_RECVTOS); + break; } break; #undef OPTSET @@ -1128,6 +1132,7 @@ ip_ctloutput(struct socket *so, struct s case IP_ONESBCAST: case IP_DONTFRAG: case IP_BINDANY: + case IP_RECVTOS: switch (sopt->sopt_name) { case IP_TOS: @@ -1186,6 +1191,9 @@ ip_ctloutput(struct socket *so, struct s case IP_BINDANY: optval = OPTBIT(INP_BINDANY); break; + case IP_RECVTOS: + optval = OPTBIT(INP_RECVTOS); + break; } error = sooptcopyout(sopt, &optval, sizeof optval); break; From owner-svn-src-stable@FreeBSD.ORG Thu Mar 7 21:22:08 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 46EA8311; Thu, 7 Mar 2013 21:22:08 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 21CF8365; Thu, 7 Mar 2013 21:22:08 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r27LM8YR014556; Thu, 7 Mar 2013 21:22:08 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r27LM86f014555; Thu, 7 Mar 2013 21:22:08 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201303072122.r27LM86f014555@svn.freebsd.org> From: Michael Tuexen Date: Thu, 7 Mar 2013 21:22:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r247945 - stable/8/sys/netinet X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Mar 2013 21:22:08 -0000 Author: tuexen Date: Thu Mar 7 21:22:07 2013 New Revision: 247945 URL: http://svnweb.freebsd.org/changeset/base/247945 Log: MFC r236961: Add a cmsg of type IP_TOS for UDP/IPv4 sockets to specify the TOS byte. Modified: stable/8/sys/netinet/udp_usrreq.c Directory Properties: stable/8/ (props changed) stable/8/sys/ (props changed) stable/8/sys/netinet/ (props changed) Modified: stable/8/sys/netinet/udp_usrreq.c ============================================================================== --- stable/8/sys/netinet/udp_usrreq.c Thu Mar 7 21:17:37 2013 (r247944) +++ stable/8/sys/netinet/udp_usrreq.c Thu Mar 7 21:22:07 2013 (r247945) @@ -970,6 +970,7 @@ udp_output(struct inpcb *inp, struct mbu int ipflags; u_short fport, lport; int unlock_udbinfo; + u_char tos; /* * udp_output() may need to temporarily bind or connect the current @@ -985,6 +986,7 @@ udp_output(struct inpcb *inp, struct mbu } src.sin_family = 0; + tos = inp->inp_ip_tos; if (control != NULL) { /* * XXX: Currently, we assume all the optional information is @@ -1022,6 +1024,14 @@ udp_output(struct inpcb *inp, struct mbu *(struct in_addr *)CMSG_DATA(cm); break; + case IP_TOS: + if (cm->cmsg_len != CMSG_LEN(sizeof(u_char))) { + error = EINVAL; + break; + } + tos = *(u_char *)CMSG_DATA(cm); + break; + default: error = ENOPROTOOPT; break; @@ -1239,7 +1249,7 @@ udp_output(struct inpcb *inp, struct mbu ui->ui_sum = 0; ((struct ip *)ui)->ip_len = sizeof (struct udpiphdr) + len; ((struct ip *)ui)->ip_ttl = inp->inp_ip_ttl; /* XXX */ - ((struct ip *)ui)->ip_tos = inp->inp_ip_tos; /* XXX */ + ((struct ip *)ui)->ip_tos = tos; /* XXX */ UDPSTAT_INC(udps_opackets); if (unlock_udbinfo == 2) From owner-svn-src-stable@FreeBSD.ORG Thu Mar 7 21:24:43 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 7A78649E; Thu, 7 Mar 2013 21:24:43 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 5014037E; Thu, 7 Mar 2013 21:24:43 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r27LOhQ7014946; Thu, 7 Mar 2013 21:24:43 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r27LOf17014937; Thu, 7 Mar 2013 21:24:41 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201303072124.r27LOf17014937@svn.freebsd.org> From: Michael Tuexen Date: Thu, 7 Mar 2013 21:24:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r247946 - in stable/8/sys: netinet netinet6 X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Mar 2013 21:24:43 -0000 Author: tuexen Date: Thu Mar 7 21:24:41 2013 New Revision: 247946 URL: http://svnweb.freebsd.org/changeset/base/247946 Log: MFC r237049: Pass flowid explicitly through the stack instead of taking it from the mbuf chain at different places. While there: Fix several bugs related to VRFs. Modified: stable/8/sys/netinet/sctp_indata.c stable/8/sys/netinet/sctp_indata.h stable/8/sys/netinet/sctp_input.c stable/8/sys/netinet/sctp_input.h stable/8/sys/netinet/sctp_output.c stable/8/sys/netinet/sctp_output.h stable/8/sys/netinet/sctputil.c stable/8/sys/netinet/sctputil.h stable/8/sys/netinet6/sctp6_usrreq.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/netinet/ (props changed) stable/8/sys/netinet6/ (props changed) Modified: stable/8/sys/netinet/sctp_indata.c ============================================================================== --- stable/8/sys/netinet/sctp_indata.c Thu Mar 7 21:22:07 2013 (r247945) +++ stable/8/sys/netinet/sctp_indata.c Thu Mar 7 21:24:41 2013 (r247946) @@ -2516,8 +2516,10 @@ doit_again: int sctp_process_data(struct mbuf **mm, int iphlen, int *offset, int length, - struct sctphdr *sh, struct sctp_inpcb *inp, struct sctp_tcb *stcb, - struct sctp_nets *net, uint32_t * high_tsn) + struct sctphdr *sh, struct sctp_inpcb *inp, + struct sctp_tcb *stcb, struct sctp_nets *net, uint32_t * high_tsn, + uint8_t use_mflowid, uint32_t mflowid, + uint32_t vrf_id, uint16_t port) { struct sctp_data_chunk *ch, chunk_buf; struct sctp_association *asoc; @@ -2625,7 +2627,9 @@ sctp_process_data(struct mbuf **mm, int } stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_19; sctp_abort_association(inp, stcb, m, iphlen, sh, - op_err, 0, net->port); + op_err, + use_mflowid, mflowid, + vrf_id, port); return (2); } #ifdef SCTP_AUDITING_ENABLED @@ -2689,7 +2693,11 @@ sctp_process_data(struct mbuf **mm, int struct mbuf *op_err; op_err = sctp_generate_invmanparam(SCTP_CAUSE_PROTOCOL_VIOLATION); - sctp_abort_association(inp, stcb, m, iphlen, sh, op_err, 0, net->port); + sctp_abort_association(inp, stcb, + m, iphlen, + sh, op_err, + use_mflowid, mflowid, + vrf_id, port); return (2); } break; Modified: stable/8/sys/netinet/sctp_indata.h ============================================================================== --- stable/8/sys/netinet/sctp_indata.h Thu Mar 7 21:22:07 2013 (r247945) +++ stable/8/sys/netinet/sctp_indata.h Thu Mar 7 21:24:41 2013 (r247946) @@ -113,7 +113,9 @@ void int sctp_process_data(struct mbuf **, int, int *, int, struct sctphdr *, struct sctp_inpcb *, struct sctp_tcb *, - struct sctp_nets *, uint32_t *); + struct sctp_nets *, uint32_t *, + uint8_t, uint32_t, + uint32_t, uint16_t); void sctp_slide_mapping_arrays(struct sctp_tcb *stcb); Modified: stable/8/sys/netinet/sctp_input.c ============================================================================== --- stable/8/sys/netinet/sctp_input.c Thu Mar 7 21:22:07 2013 (r247945) +++ stable/8/sys/netinet/sctp_input.c Thu Mar 7 21:24:41 2013 (r247946) @@ -81,8 +81,10 @@ sctp_stop_all_cookie_timers(struct sctp_ /* INIT handler */ static void sctp_handle_init(struct mbuf *m, int iphlen, int offset, struct sctphdr *sh, - struct sctp_init_chunk *cp, struct sctp_inpcb *inp, struct sctp_tcb *stcb, - int *abort_no_unlock, uint32_t vrf_id, uint16_t port) + struct sctp_init_chunk *cp, struct sctp_inpcb *inp, + struct sctp_tcb *stcb, int *abort_no_unlock, + uint8_t use_mflowid, uint32_t mflowid, + uint32_t vrf_id, uint16_t port) { struct sctp_init *init; struct mbuf *op_err; @@ -96,6 +98,7 @@ sctp_handle_init(struct mbuf *m, int iph if (ntohs(cp->ch.chunk_length) < sizeof(struct sctp_init_chunk)) { op_err = sctp_generate_invmanparam(SCTP_CAUSE_INVALID_PARAM); sctp_abort_association(inp, stcb, m, iphlen, sh, op_err, + use_mflowid, mflowid, vrf_id, port); if (stcb) *abort_no_unlock = 1; @@ -107,6 +110,7 @@ sctp_handle_init(struct mbuf *m, int iph /* protocol error... send abort */ op_err = sctp_generate_invmanparam(SCTP_CAUSE_INVALID_PARAM); sctp_abort_association(inp, stcb, m, iphlen, sh, op_err, + use_mflowid, mflowid, vrf_id, port); if (stcb) *abort_no_unlock = 1; @@ -116,6 +120,7 @@ sctp_handle_init(struct mbuf *m, int iph /* invalid parameter... send abort */ op_err = sctp_generate_invmanparam(SCTP_CAUSE_INVALID_PARAM); sctp_abort_association(inp, stcb, m, iphlen, sh, op_err, + use_mflowid, mflowid, vrf_id, port); if (stcb) *abort_no_unlock = 1; @@ -125,6 +130,7 @@ sctp_handle_init(struct mbuf *m, int iph /* protocol error... send abort */ op_err = sctp_generate_invmanparam(SCTP_CAUSE_INVALID_PARAM); sctp_abort_association(inp, stcb, m, iphlen, sh, op_err, + use_mflowid, mflowid, vrf_id, port); if (stcb) *abort_no_unlock = 1; @@ -134,6 +140,7 @@ sctp_handle_init(struct mbuf *m, int iph /* protocol error... send abort */ op_err = sctp_generate_invmanparam(SCTP_CAUSE_INVALID_PARAM); sctp_abort_association(inp, stcb, m, iphlen, sh, op_err, + use_mflowid, mflowid, vrf_id, port); if (stcb) *abort_no_unlock = 1; @@ -142,7 +149,9 @@ sctp_handle_init(struct mbuf *m, int iph if (sctp_validate_init_auth_params(m, offset + sizeof(*cp), offset + ntohs(cp->ch.chunk_length))) { /* auth parameter(s) error... send abort */ - sctp_abort_association(inp, stcb, m, iphlen, sh, NULL, vrf_id, port); + sctp_abort_association(inp, stcb, m, iphlen, sh, NULL, + use_mflowid, mflowid, + vrf_id, port); if (stcb) *abort_no_unlock = 1; goto outnow; @@ -169,7 +178,9 @@ sctp_handle_init(struct mbuf *m, int iph * state :-) */ if (SCTP_BASE_SYSCTL(sctp_blackhole) == 0) { - sctp_send_abort(m, iphlen, sh, 0, NULL, vrf_id, port); + sctp_send_abort(m, iphlen, sh, 0, NULL, + use_mflowid, mflowid, + vrf_id, port); } goto outnow; } @@ -180,7 +191,9 @@ sctp_handle_init(struct mbuf *m, int iph sctp_chunk_output(inp, stcb, SCTP_OUTPUT_FROM_CONTROL_PROC, SCTP_SO_NOT_LOCKED); } else { SCTPDBG(SCTP_DEBUG_INPUT3, "sctp_handle_init: sending INIT-ACK\n"); - sctp_send_initiate_ack(inp, stcb, m, iphlen, offset, sh, cp, vrf_id, port, + sctp_send_initiate_ack(inp, stcb, m, iphlen, offset, sh, cp, + use_mflowid, mflowid, + vrf_id, port, ((stcb == NULL) ? SCTP_HOLDS_LOCK : SCTP_NOT_LOCKED)); } outnow: @@ -406,9 +419,11 @@ sctp_process_init(struct sctp_init_chunk * INIT-ACK message processing/consumption returns value < 0 on error */ static int -sctp_process_init_ack(struct mbuf *m, int iphlen, int offset, - struct sctphdr *sh, struct sctp_init_ack_chunk *cp, struct sctp_tcb *stcb, - struct sctp_nets *net, int *abort_no_unlock, uint32_t vrf_id) +sctp_process_init_ack(struct mbuf *m, int iphlen, int offset, struct sctphdr *sh, + struct sctp_init_ack_chunk *cp, struct sctp_tcb *stcb, + struct sctp_nets *net, int *abort_no_unlock, + uint8_t use_mflowid, uint32_t mflowid, + uint32_t vrf_id) { struct sctp_association *asoc; struct mbuf *op_err; @@ -445,8 +460,9 @@ sctp_process_init_ack(struct mbuf *m, in SCTPDBG(SCTP_DEBUG_INPUT1, "Load addresses from INIT causes an abort %d\n", retval); - sctp_abort_association(stcb->sctp_ep, stcb, m, iphlen, sh, - NULL, 0, net->port); + sctp_abort_association(stcb->sctp_ep, stcb, m, iphlen, sh, NULL, + use_mflowid, mflowid, + vrf_id, net->port); *abort_no_unlock = 1; return (-1); } @@ -520,7 +536,9 @@ sctp_process_init_ack(struct mbuf *m, in mp->resv = 0; } sctp_abort_association(stcb->sctp_ep, stcb, m, iphlen, - sh, op_err, vrf_id, net->port); + sh, op_err, + use_mflowid, mflowid, + vrf_id, net->port); *abort_no_unlock = 1; } return (retval); @@ -1260,9 +1278,11 @@ sctp_handle_error(struct sctp_chunkhdr * } static int -sctp_handle_init_ack(struct mbuf *m, int iphlen, int offset, - struct sctphdr *sh, struct sctp_init_ack_chunk *cp, struct sctp_tcb *stcb, - struct sctp_nets *net, int *abort_no_unlock, uint32_t vrf_id) +sctp_handle_init_ack(struct mbuf *m, int iphlen, int offset, struct sctphdr *sh, + struct sctp_init_ack_chunk *cp, struct sctp_tcb *stcb, + struct sctp_nets *net, int *abort_no_unlock, + uint8_t use_mflowid, uint32_t mflowid, + uint32_t vrf_id) { struct sctp_init_ack *init_ack; struct mbuf *op_err; @@ -1279,7 +1299,9 @@ sctp_handle_init_ack(struct mbuf *m, int /* Invalid length */ op_err = sctp_generate_invmanparam(SCTP_CAUSE_INVALID_PARAM); sctp_abort_association(stcb->sctp_ep, stcb, m, iphlen, sh, - op_err, 0, net->port); + op_err, + use_mflowid, mflowid, + vrf_id, net->port); *abort_no_unlock = 1; return (-1); } @@ -1289,7 +1311,9 @@ sctp_handle_init_ack(struct mbuf *m, int /* protocol error... send an abort */ op_err = sctp_generate_invmanparam(SCTP_CAUSE_INVALID_PARAM); sctp_abort_association(stcb->sctp_ep, stcb, m, iphlen, sh, - op_err, 0, net->port); + op_err, + use_mflowid, mflowid, + vrf_id, net->port); *abort_no_unlock = 1; return (-1); } @@ -1297,7 +1321,9 @@ sctp_handle_init_ack(struct mbuf *m, int /* protocol error... send an abort */ op_err = sctp_generate_invmanparam(SCTP_CAUSE_INVALID_PARAM); sctp_abort_association(stcb->sctp_ep, stcb, m, iphlen, sh, - op_err, 0, net->port); + op_err, + use_mflowid, mflowid, + vrf_id, net->port); *abort_no_unlock = 1; return (-1); } @@ -1305,7 +1331,9 @@ sctp_handle_init_ack(struct mbuf *m, int /* protocol error... send an abort */ op_err = sctp_generate_invmanparam(SCTP_CAUSE_INVALID_PARAM); sctp_abort_association(stcb->sctp_ep, stcb, m, iphlen, sh, - op_err, 0, net->port); + op_err, + use_mflowid, mflowid, + vrf_id, net->port); *abort_no_unlock = 1; return (-1); } @@ -1313,7 +1341,9 @@ sctp_handle_init_ack(struct mbuf *m, int /* protocol error... send an abort */ op_err = sctp_generate_invmanparam(SCTP_CAUSE_INVALID_PARAM); sctp_abort_association(stcb->sctp_ep, stcb, m, iphlen, sh, - op_err, 0, net->port); + op_err, + use_mflowid, mflowid, + vrf_id, net->port); *abort_no_unlock = 1; return (-1); } @@ -1336,7 +1366,9 @@ sctp_handle_init_ack(struct mbuf *m, int stcb, 0, (void *)stcb->asoc.primary_destination, SCTP_SO_NOT_LOCKED); } if (sctp_process_init_ack(m, iphlen, offset, sh, cp, stcb, - net, abort_no_unlock, vrf_id) < 0) { + net, abort_no_unlock, + use_mflowid, mflowid, + vrf_id) < 0) { /* error in parsing parameters */ return (-1); } @@ -1391,6 +1423,7 @@ sctp_process_cookie_new(struct mbuf *m, struct sctp_inpcb *inp, struct sctp_nets **netp, struct sockaddr *init_src, int *notification, int auth_skipped, uint32_t auth_offset, uint32_t auth_len, + uint8_t use_mflowid, uint32_t mflowid, uint32_t vrf_id, uint16_t port); @@ -1405,7 +1438,9 @@ sctp_process_cookie_existing(struct mbuf struct sctphdr *sh, struct sctp_state_cookie *cookie, int cookie_len, struct sctp_inpcb *inp, struct sctp_tcb *stcb, struct sctp_nets **netp, struct sockaddr *init_src, int *notification, - uint32_t vrf_id, int auth_skipped, uint32_t auth_offset, uint32_t auth_len, uint16_t port) + int auth_skipped, uint32_t auth_offset, uint32_t auth_len, + uint8_t use_mflowid, uint32_t mflowid, + uint32_t vrf_id, uint16_t port) { struct sctp_association *asoc; struct sctp_init_chunk *init_cp, init_buf; @@ -1443,6 +1478,7 @@ sctp_process_cookie_existing(struct mbuf ph->param_type = htons(SCTP_CAUSE_COOKIE_IN_SHUTDOWN); ph->param_length = htons(sizeof(struct sctp_paramhdr)); sctp_send_operr_to(m, sh, cookie->peers_vtag, op_err, + use_mflowid, mflowid, vrf_id, net->port); if (how_indx < sizeof(asoc->cookie_how)) asoc->cookie_how[how_indx] = 2; @@ -1667,7 +1703,9 @@ sctp_process_cookie_existing(struct mbuf ph = mtod(op_err, struct sctp_paramhdr *); ph->param_type = htons(SCTP_CAUSE_NAT_COLLIDING_STATE); ph->param_length = htons(sizeof(struct sctp_paramhdr)); - sctp_send_abort(m, iphlen, sh, 0, op_err, vrf_id, port); + sctp_send_abort(m, iphlen, sh, 0, op_err, + use_mflowid, mflowid, + vrf_id, port); return (NULL); } if ((ntohl(initack_cp->init.initiate_tag) == asoc->my_vtag) && @@ -1832,6 +1870,7 @@ sctp_process_cookie_existing(struct mbuf return (sctp_process_cookie_new(m, iphlen, offset, sh, cookie, cookie_len, inp, netp, init_src, notification, auth_skipped, auth_offset, auth_len, + use_mflowid, mflowid, vrf_id, port)); } /* @@ -1962,12 +2001,13 @@ sctp_process_cookie_existing(struct mbuf * cookie-echo chunk length: length of the cookie chunk to: where the init * was from returns a new TCB */ -struct sctp_tcb * +static struct sctp_tcb * sctp_process_cookie_new(struct mbuf *m, int iphlen, int offset, struct sctphdr *sh, struct sctp_state_cookie *cookie, int cookie_len, struct sctp_inpcb *inp, struct sctp_nets **netp, struct sockaddr *init_src, int *notification, int auth_skipped, uint32_t auth_offset, uint32_t auth_len, + uint8_t use_mflowid, uint32_t mflowid, uint32_t vrf_id, uint16_t port) { struct sctp_tcb *stcb; @@ -2062,7 +2102,9 @@ sctp_process_cookie_new(struct mbuf *m, op_err = sctp_generate_invmanparam(SCTP_CAUSE_OUT_OF_RESC); sctp_abort_association(inp, (struct sctp_tcb *)NULL, m, iphlen, - sh, op_err, vrf_id, port); + sh, op_err, + use_mflowid, mflowid, + vrf_id, port); return (NULL); } /* get the correct sctp_nets */ @@ -2088,7 +2130,9 @@ sctp_process_cookie_new(struct mbuf *m, atomic_add_int(&stcb->asoc.refcnt, 1); op_err = sctp_generate_invmanparam(SCTP_CAUSE_OUT_OF_RESC); sctp_abort_association(inp, (struct sctp_tcb *)NULL, m, iphlen, - sh, op_err, vrf_id, port); + sh, op_err, + use_mflowid, mflowid, + vrf_id, port); #if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING) SCTP_TCB_UNLOCK(stcb); SCTP_SOCKET_LOCK(so, 1); @@ -2335,7 +2379,9 @@ sctp_handle_cookie_echo(struct mbuf *m, struct sctphdr *sh, struct sctp_cookie_echo_chunk *cp, struct sctp_inpcb **inp_p, struct sctp_tcb **stcb, struct sctp_nets **netp, int auth_skipped, uint32_t auth_offset, uint32_t auth_len, - struct sctp_tcb **locked_tcb, uint32_t vrf_id, uint16_t port) + struct sctp_tcb **locked_tcb, + uint8_t use_mflowid, uint32_t mflowid, + uint32_t vrf_id, uint16_t port) { struct sctp_state_cookie *cookie; struct sctp_tcb *l_stcb = *stcb; @@ -2571,6 +2617,7 @@ sctp_handle_cookie_echo(struct mbuf *m, tim = now.tv_usec - cookie->time_entered.tv_usec; scm->time_usec = htonl(tim); sctp_send_operr_to(m, sh, cookie->peers_vtag, op_err, + use_mflowid, mflowid, vrf_id, port); return (NULL); } @@ -2658,21 +2705,25 @@ sctp_handle_cookie_echo(struct mbuf *m, /* this is the "normal" case... get a new TCB */ *stcb = sctp_process_cookie_new(m, iphlen, offset, sh, cookie, cookie_len, *inp_p, netp, to, ¬ification, - auth_skipped, auth_offset, auth_len, vrf_id, port); + auth_skipped, auth_offset, auth_len, + use_mflowid, mflowid, + vrf_id, port); } else { /* this is abnormal... cookie-echo on existing TCB */ had_a_existing_tcb = 1; *stcb = sctp_process_cookie_existing(m, iphlen, offset, sh, cookie, cookie_len, *inp_p, *stcb, netp, to, - ¬ification, vrf_id, auth_skipped, auth_offset, auth_len, port); + ¬ification, auth_skipped, auth_offset, auth_len, + use_mflowid, mflowid, + vrf_id, port); } if (*stcb == NULL) { /* still no TCB... must be bad cookie-echo */ return (NULL); } - if ((*netp != NULL) && (m->m_flags & M_FLOWID)) { - (*netp)->flowid = m->m_pkthdr.flowid; + if ((*netp != NULL) && (use_mflowid != 0)) { + (*netp)->flowid = mflowid; #ifdef INVARIANTS (*netp)->flowidset = 1; #endif @@ -2745,7 +2796,9 @@ sctp_handle_cookie_echo(struct mbuf *m, SCTPDBG(SCTP_DEBUG_INPUT1, "process_cookie_new: no room for another socket!\n"); op_err = sctp_generate_invmanparam(SCTP_CAUSE_OUT_OF_RESC); sctp_abort_association(*inp_p, NULL, m, iphlen, - sh, op_err, vrf_id, port); + sh, op_err, + use_mflowid, mflowid, + vrf_id, port); #if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING) pcb_so = SCTP_INP_SO(*inp_p); atomic_add_int(&(*stcb)->asoc.refcnt, 1); @@ -4361,6 +4414,7 @@ __attribute__((noinline)) sctp_process_control(struct mbuf *m, int iphlen, int *offset, int length, struct sctphdr *sh, struct sctp_chunkhdr *ch, struct sctp_inpcb *inp, struct sctp_tcb *stcb, struct sctp_nets **netp, int *fwd_tsn_seen, + uint8_t use_mflowid, uint32_t mflowid, uint32_t vrf_id, uint16_t port) { struct sctp_association *asoc; @@ -4517,6 +4571,7 @@ __attribute__((noinline)) if (stcb == NULL) { /* no association, so it's out of the blue... */ sctp_handle_ootb(m, iphlen, *offset, sh, inp, + use_mflowid, mflowid, vrf_id, port); *offset = length; if (locked_tcb) { @@ -4554,6 +4609,7 @@ __attribute__((noinline)) SCTP_TCB_UNLOCK(locked_tcb); } sctp_handle_ootb(m, iphlen, *offset, sh, inp, + use_mflowid, mflowid, vrf_id, port); return (NULL); } @@ -4695,7 +4751,9 @@ process_control_chunks: if ((num_chunks > 1) || (length - *offset > (int)SCTP_SIZE32(chk_length))) { sctp_abort_association(inp, stcb, m, - iphlen, sh, NULL, vrf_id, port); + iphlen, sh, NULL, + use_mflowid, mflowid, + vrf_id, port); *offset = length; return (NULL); } @@ -4705,13 +4763,17 @@ process_control_chunks: op_err = sctp_generate_invmanparam(SCTP_CAUSE_OUT_OF_RESC); sctp_abort_association(inp, stcb, m, - iphlen, sh, op_err, vrf_id, port); + iphlen, sh, op_err, + use_mflowid, mflowid, + vrf_id, port); *offset = length; return (NULL); } sctp_handle_init(m, iphlen, *offset, sh, (struct sctp_init_chunk *)ch, inp, - stcb, &abort_no_unlock, vrf_id, port); + stcb, &abort_no_unlock, + use_mflowid, mflowid, + vrf_id, port); *offset = length; if ((!abort_no_unlock) && (locked_tcb)) { SCTP_TCB_UNLOCK(locked_tcb); @@ -4760,7 +4822,11 @@ process_control_chunks: } if ((netp) && (*netp)) { ret = sctp_handle_init_ack(m, iphlen, *offset, sh, - (struct sctp_init_ack_chunk *)ch, stcb, *netp, &abort_no_unlock, vrf_id); + (struct sctp_init_ack_chunk *)ch, + stcb, *netp, + &abort_no_unlock, + use_mflowid, mflowid, + vrf_id); } else { ret = -1; } @@ -5066,7 +5132,9 @@ process_control_chunks: op_err = sctp_generate_invmanparam(SCTP_CAUSE_OUT_OF_RESC); sctp_abort_association(inp, stcb, m, - iphlen, sh, op_err, vrf_id, port); + iphlen, sh, op_err, + use_mflowid, mflowid, + vrf_id, port); } *offset = length; return (NULL); @@ -5098,6 +5166,8 @@ process_control_chunks: auth_offset, auth_len, &locked_tcb, + use_mflowid, + mflowid, vrf_id, port); } else { @@ -5550,8 +5620,10 @@ __attribute__((noinline)) void sctp_common_input_processing(struct mbuf **mm, int iphlen, int offset, int length, struct sctphdr *sh, struct sctp_chunkhdr *ch, - struct sctp_inpcb *inp, struct sctp_tcb *stcb, struct sctp_nets *net, - uint8_t ecn_bits, uint32_t vrf_id, uint16_t port) + struct sctp_inpcb *inp, struct sctp_tcb *stcb, + struct sctp_nets *net, uint8_t ecn_bits, + uint8_t use_mflowid, uint32_t mflowid, + uint32_t vrf_id, uint16_t port) { /* * Control chunk processing @@ -5587,6 +5659,7 @@ sctp_common_input_processing(struct mbuf */ SCTP_TCB_UNLOCK(stcb); sctp_handle_ootb(m, iphlen, offset, sh, inp, + use_mflowid, mflowid, vrf_id, port); goto out_now; } @@ -5595,7 +5668,9 @@ sctp_common_input_processing(struct mbuf /* process the control portion of the SCTP packet */ /* sa_ignore NO_NULL_CHK */ stcb = sctp_process_control(m, iphlen, &offset, length, sh, ch, - inp, stcb, &net, &fwd_tsn_seen, vrf_id, port); + inp, stcb, &net, &fwd_tsn_seen, + use_mflowid, mflowid, + vrf_id, port); if (stcb) { /* * This covers us if the cookie-echo was there and @@ -5631,6 +5706,7 @@ sctp_common_input_processing(struct mbuf if (stcb == NULL) { /* out of the blue DATA chunk */ sctp_handle_ootb(m, iphlen, offset, sh, inp, + use_mflowid, mflowid, vrf_id, port); goto out_now; } @@ -5700,6 +5776,7 @@ sctp_common_input_processing(struct mbuf * We consider OOTB any data sent during asoc setup. */ sctp_handle_ootb(m, iphlen, offset, sh, inp, + use_mflowid, mflowid, vrf_id, port); SCTP_TCB_UNLOCK(stcb); goto out_now; @@ -5720,7 +5797,9 @@ sctp_common_input_processing(struct mbuf } /* plow through the data chunks while length > offset */ retval = sctp_process_data(mm, iphlen, &offset, length, sh, - inp, stcb, net, &high_tsn); + inp, stcb, net, &high_tsn, + use_mflowid, mflowid, + vrf_id, port); if (retval == 2) { /* * The association aborted, NO UNLOCK needed since @@ -5820,6 +5899,8 @@ sctp_input_with_port(struct mbuf *i_pak, struct sctp_chunkhdr *ch; int refcount_up = 0; int length, mlen, offset; + uint32_t mflowid; + uint8_t use_mflowid; #if !defined(SCTP_WITH_NO_CSUM) uint32_t check, calc_check; @@ -5855,6 +5936,13 @@ sctp_input_with_port(struct mbuf *i_pak, if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_LAST_PACKET_TRACING) sctp_packet_log(m, mlen); #endif + if (m->m_flags & M_FLOWID) { + mflowid = m->m_pkthdr.flowid; + use_mflowid = 1; + } else { + mflowid = 0; + use_mflowid = 0; + } /* * Must take out the iphlen, since mlen expects this (only effect lb * case) @@ -5926,8 +6014,8 @@ sctp_input_with_port(struct mbuf *i_pak, } net->port = port; } - if ((net != NULL) && (m->m_flags & M_FLOWID)) { - net->flowid = m->m_pkthdr.flowid; + if ((net != NULL) && (use_mflowid != 0)) { + net->flowid = mflowid; #ifdef INVARIANTS net->flowidset = 1; #endif @@ -5961,8 +6049,8 @@ sctp_skip_csum_4: } net->port = port; } - if ((net != NULL) && (m->m_flags & M_FLOWID)) { - net->flowid = m->m_pkthdr.flowid; + if ((net != NULL) && (use_mflowid != 0)) { + net->flowid = mflowid; #ifdef INVARIANTS net->flowidset = 1; #endif @@ -5996,7 +6084,9 @@ sctp_skip_csum_4: sh->v_tag = init_chk->init.initiate_tag; } if (ch->chunk_type == SCTP_SHUTDOWN_ACK) { - sctp_send_shutdown_complete2(m, sh, vrf_id, port); + sctp_send_shutdown_complete2(m, sh, + use_mflowid, mflowid, + vrf_id, port); goto bad; } if (ch->chunk_type == SCTP_SHUTDOWN_COMPLETE) { @@ -6006,7 +6096,9 @@ sctp_skip_csum_4: if ((SCTP_BASE_SYSCTL(sctp_blackhole) == 0) || ((SCTP_BASE_SYSCTL(sctp_blackhole) == 1) && (ch->chunk_type != SCTP_INIT))) { - sctp_send_abort(m, iphlen, sh, 0, NULL, vrf_id, port); + sctp_send_abort(m, iphlen, sh, 0, NULL, + use_mflowid, mflowid, + vrf_id, port); } } goto bad; @@ -6035,7 +6127,9 @@ sctp_skip_csum_4: /* sa_ignore NO_NULL_CHK */ sctp_common_input_processing(&m, iphlen, offset, length, sh, ch, - inp, stcb, net, ecn_bits, vrf_id, port); + inp, stcb, net, ecn_bits, + use_mflowid, mflowid, + vrf_id, port); /* inp's ref-count reduced && stcb unlocked */ if (m) { sctp_m_freem(m); Modified: stable/8/sys/netinet/sctp_input.h ============================================================================== --- stable/8/sys/netinet/sctp_input.h Thu Mar 7 21:22:07 2013 (r247945) +++ stable/8/sys/netinet/sctp_input.h Thu Mar 7 21:24:41 2013 (r247946) @@ -39,8 +39,11 @@ __FBSDID("$FreeBSD$"); #if defined(_KERNEL) || defined(__Userspace__) void sctp_common_input_processing(struct mbuf **, int, int, int, - struct sctphdr *, struct sctp_chunkhdr *, struct sctp_inpcb *, - struct sctp_tcb *, struct sctp_nets *, uint8_t, uint32_t, uint16_t); + struct sctphdr *, struct sctp_chunkhdr *, + struct sctp_inpcb *, struct sctp_tcb *, + struct sctp_nets *, uint8_t, + uint8_t, uint32_t, + uint32_t, uint16_t); struct sctp_stream_reset_out_request * sctp_find_stream_reset(struct sctp_tcb *stcb, uint32_t seq, Modified: stable/8/sys/netinet/sctp_output.c ============================================================================== --- stable/8/sys/netinet/sctp_output.c Thu Mar 7 21:22:07 2013 (r247945) +++ stable/8/sys/netinet/sctp_output.c Thu Mar 7 21:24:41 2013 (r247946) @@ -3859,13 +3859,13 @@ sctp_lowlevel_chunk_output(struct sctp_i uint16_t dest_port, uint32_t v_tag, uint16_t port, + union sctp_sockstore *over_addr, + uint8_t use_mflowid, uint32_t mflowid, #if !defined(__APPLE__) && !defined(SCTP_SO_LOCK_TESTING) - int so_locked SCTP_UNUSED, + int so_locked SCTP_UNUSED #else - int so_locked, + int so_locked #endif - union sctp_sockstore *over_addr, - struct mbuf *init ) /* nofragment_flag to tell if IP_DF should be set (IPv4 only) */ { @@ -3951,8 +3951,8 @@ sctp_lowlevel_chunk_output(struct sctp_i m->m_pkthdr.flowid = net->flowid; m->m_flags |= M_FLOWID; } else { - if ((init != NULL) && (init->m_flags & M_FLOWID)) { - m->m_pkthdr.flowid = init->m_pkthdr.flowid; + if (use_mflowid != 0) { + m->m_pkthdr.flowid = mflowid; m->m_flags |= M_FLOWID; } } @@ -4243,8 +4243,8 @@ sctp_lowlevel_chunk_output(struct sctp_i m->m_pkthdr.flowid = net->flowid; m->m_flags |= M_FLOWID; } else { - if ((init != NULL) && (init->m_flags & M_FLOWID)) { - m->m_pkthdr.flowid = init->m_pkthdr.flowid; + if (use_mflowid != 0) { + m->m_pkthdr.flowid = mflowid; m->m_flags |= M_FLOWID; } } @@ -4841,7 +4841,9 @@ sctp_send_initiate(struct sctp_inpcb *in (struct sockaddr *)&net->ro._l_addr, m, 0, NULL, 0, 0, 0, 0, inp->sctp_lport, stcb->rport, htonl(0), - net->port, so_locked, NULL, NULL); + net->port, NULL, + 0, 0, + so_locked); SCTPDBG(SCTP_DEBUG_OUTPUT4, "lowlevel_output - %d\n", ret); SCTP_STAT_INCR_COUNTER64(sctps_outcontrolchunks); (void)SCTP_GETTIME_TIMEVAL(&net->last_sent_time); @@ -5370,8 +5372,10 @@ sctp_are_there_new_addresses(struct sctp */ void sctp_send_initiate_ack(struct sctp_inpcb *inp, struct sctp_tcb *stcb, - struct mbuf *init_pkt, int iphlen, int offset, struct sctphdr *sh, - struct sctp_init_chunk *init_chk, uint32_t vrf_id, uint16_t port, int hold_inp_lock) + struct mbuf *init_pkt, int iphlen, int offset, + struct sctphdr *sh, struct sctp_init_chunk *init_chk, + uint8_t use_mflowid, uint32_t mflowid, + uint32_t vrf_id, uint16_t port, int hold_inp_lock) { struct sctp_association *asoc; struct mbuf *m, *m_at, *m_tmp, *m_cookie, *op_err, *mp_last; @@ -5422,7 +5426,9 @@ sctp_send_initiate_ack(struct sctp_inpcb * though we even set the T bit and copy in the 0 tag.. this * looks no different than if no listener was present. */ - sctp_send_abort(init_pkt, iphlen, sh, 0, NULL, vrf_id, port); + sctp_send_abort(init_pkt, iphlen, sh, 0, NULL, + use_mflowid, mflowid, + vrf_id, port); return; } abort_flag = 0; @@ -5432,7 +5438,9 @@ sctp_send_initiate_ack(struct sctp_inpcb if (abort_flag) { do_a_abort: sctp_send_abort(init_pkt, iphlen, sh, - init_chk->init.initiate_tag, op_err, vrf_id, port); + init_chk->init.initiate_tag, op_err, + use_mflowid, mflowid, + vrf_id, port); return; } m = sctp_get_mbuf_for_msg(MCLBYTES, 0, M_DONTWAIT, 1, MT_DATA); @@ -6034,7 +6042,9 @@ do_a_abort: (void)sctp_lowlevel_chunk_output(inp, NULL, NULL, to, m, 0, NULL, 0, 0, 0, 0, inp->sctp_lport, sh->src_port, init_chk->init.initiate_tag, - port, SCTP_SO_NOT_LOCKED, over_addr, init_pkt); + port, over_addr, + use_mflowid, mflowid, + SCTP_SO_NOT_LOCKED); SCTP_STAT_INCR_COUNTER64(sctps_outcontrolchunks); } @@ -8116,7 +8126,9 @@ again_one_more_time: no_fragmentflg, 0, asconf, inp->sctp_lport, stcb->rport, htonl(stcb->asoc.peer_vtag), - net->port, so_locked, NULL, NULL))) { + net->port, NULL, + 0, 0, + so_locked))) { if (error == ENOBUFS) { asoc->ifp_had_enobuf = 1; SCTP_STAT_INCR(sctps_lowlevelerr); @@ -8388,7 +8400,9 @@ again_one_more_time: no_fragmentflg, 0, asconf, inp->sctp_lport, stcb->rport, htonl(stcb->asoc.peer_vtag), - net->port, so_locked, NULL, NULL))) { + net->port, NULL, + 0, 0, + so_locked))) { if (error == ENOBUFS) { asoc->ifp_had_enobuf = 1; SCTP_STAT_INCR(sctps_lowlevelerr); @@ -8727,7 +8741,9 @@ no_data_fill: asconf, inp->sctp_lport, stcb->rport, htonl(stcb->asoc.peer_vtag), - net->port, so_locked, NULL, NULL))) { + net->port, NULL, + 0, 0, + so_locked))) { /* error, we could not output */ if (error == ENOBUFS) { SCTP_STAT_INCR(sctps_lowlevelerr); @@ -9429,7 +9445,9 @@ sctp_chunk_retransmission(struct sctp_in auth_offset, auth, stcb->asoc.authinfo.active_keyid, no_fragmentflg, 0, 0, inp->sctp_lport, stcb->rport, htonl(stcb->asoc.peer_vtag), - chk->whoTo->port, so_locked, NULL, NULL))) { + chk->whoTo->port, NULL, + 0, 0, + so_locked))) { SCTP_STAT_INCR(sctps_lowlevelerr); return (error); } @@ -9694,7 +9712,9 @@ one_chunk_around: auth_offset, auth, auth_keyid, no_fragmentflg, 0, 0, inp->sctp_lport, stcb->rport, htonl(stcb->asoc.peer_vtag), - net->port, so_locked, NULL, NULL))) { + net->port, NULL, + 0, 0, + so_locked))) { /* error, we could not output */ SCTP_STAT_INCR(sctps_lowlevelerr); return (error); @@ -10812,7 +10832,9 @@ sctp_send_abort_tcb(struct sctp_tcb *stc (struct sockaddr *)&net->ro._l_addr, m_out, auth_offset, auth, stcb->asoc.authinfo.active_keyid, 1, 0, 0, stcb->sctp_ep->sctp_lport, stcb->rport, htonl(stcb->asoc.peer_vtag), - stcb->asoc.primary_destination->port, so_locked, NULL, NULL); + stcb->asoc.primary_destination->port, NULL, + 0, 0, + so_locked); SCTP_STAT_INCR_COUNTER64(sctps_outcontrolchunks); } @@ -10849,14 +10871,18 @@ sctp_send_shutdown_complete(struct sctp_ m_shutdown_comp, 0, NULL, 0, 1, 0, 0, stcb->sctp_ep->sctp_lport, stcb->rport, htonl(vtag), - net->port, SCTP_SO_NOT_LOCKED, NULL, NULL); + net->port, NULL, + 0, 0, + SCTP_SO_NOT_LOCKED); SCTP_STAT_INCR_COUNTER64(sctps_outcontrolchunks); return; } static void sctp_send_resp_msg(struct mbuf *m, struct sctphdr *sh, uint32_t vtag, - uint8_t type, struct mbuf *cause, uint32_t vrf_id, uint16_t port) + uint8_t type, struct mbuf *cause, + uint8_t use_mflowid, uint32_t mflowid, + uint32_t vrf_id, uint16_t port) { struct mbuf *o_pak; struct mbuf *mout; @@ -10929,8 +10955,8 @@ sctp_send_resp_msg(struct mbuf *m, struc SCTP_BUF_RESV_UF(mout, max_linkhdr); SCTP_BUF_LEN(mout) = len; SCTP_BUF_NEXT(mout) = cause; - if (m->m_flags & M_FLOWID) { - mout->m_pkthdr.flowid = m->m_pkthdr.flowid; + if (use_mflowid != 0) { + mout->m_pkthdr.flowid = mflowid; mout->m_flags |= M_FLOWID; } #ifdef INET @@ -11110,9 +11136,12 @@ sctp_send_resp_msg(struct mbuf *m, struc void sctp_send_shutdown_complete2(struct mbuf *m, struct sctphdr *sh, + uint8_t use_mflowid, uint32_t mflowid, uint32_t vrf_id, uint16_t port) { - sctp_send_resp_msg(m, sh, 0, SCTP_SHUTDOWN_COMPLETE, NULL, vrf_id, port); + sctp_send_resp_msg(m, sh, 0, SCTP_SHUTDOWN_COMPLETE, NULL, + use_mflowid, mflowid, + vrf_id, port); } void @@ -11944,7 +11973,9 @@ skip_stuff: void sctp_send_abort(struct mbuf *m, int iphlen, struct sctphdr *sh, uint32_t vtag, - struct mbuf *cause, uint32_t vrf_id, uint16_t port) + struct mbuf *cause, + uint8_t use_mflowid, uint32_t mflowid, + uint32_t vrf_id, uint16_t port) { /* Don't respond to an ABORT with an ABORT. */ if (sctp_is_there_an_abort_here(m, iphlen, &vtag)) { @@ -11952,15 +11983,21 @@ sctp_send_abort(struct mbuf *m, int iphl sctp_m_freem(cause); return; } - sctp_send_resp_msg(m, sh, vtag, SCTP_ABORT_ASSOCIATION, cause, vrf_id, port); + sctp_send_resp_msg(m, sh, vtag, SCTP_ABORT_ASSOCIATION, cause, + use_mflowid, mflowid, + vrf_id, port); return; } void sctp_send_operr_to(struct mbuf *m, struct sctphdr *sh, uint32_t vtag, - struct mbuf *cause, uint32_t vrf_id, uint16_t port) + struct mbuf *cause, + uint8_t use_mflowid, uint32_t mflowid, + uint32_t vrf_id, uint16_t port) { - sctp_send_resp_msg(m, sh, vtag, SCTP_OPERATION_ERROR, cause, vrf_id, port); + sctp_send_resp_msg(m, sh, vtag, SCTP_OPERATION_ERROR, cause, + use_mflowid, mflowid, + vrf_id, port); return; } Modified: stable/8/sys/netinet/sctp_output.h ============================================================================== --- stable/8/sys/netinet/sctp_output.h Thu Mar 7 21:22:07 2013 (r247945) +++ stable/8/sys/netinet/sctp_output.h Thu Mar 7 21:24:41 2013 (r247946) @@ -83,8 +83,9 @@ sctp_send_initiate(struct sctp_inpcb *, ); void -sctp_send_initiate_ack(struct sctp_inpcb *, struct sctp_tcb *, - struct mbuf *, int, int, struct sctphdr *, struct sctp_init_chunk *, +sctp_send_initiate_ack(struct sctp_inpcb *, struct sctp_tcb *, struct mbuf *, + int, int, struct sctphdr *, struct sctp_init_chunk *, + uint8_t, uint32_t, uint32_t, uint16_t, int); struct mbuf * @@ -116,6 +117,7 @@ void sctp_send_shutdown_complete(struct void sctp_send_shutdown_complete2(struct mbuf *, struct sctphdr *, + uint8_t, uint32_t, uint32_t, uint16_t); void sctp_send_asconf(struct sctp_tcb *, struct sctp_nets *, int addr_locked); @@ -202,15 +204,19 @@ sctp_send_str_reset_req(struct sctp_tcb void sctp_send_abort(struct mbuf *, int, struct sctphdr *, uint32_t, - struct mbuf *, uint32_t, uint16_t); + struct mbuf *, + uint8_t, uint32_t, + uint32_t, uint16_t); void sctp_send_operr_to(struct mbuf *, struct sctphdr *, uint32_t, - struct mbuf *, uint32_t, uint16_t); + struct mbuf *, + uint8_t, uint32_t, + uint32_t, uint16_t); #endif /* _KERNEL || __Userspace__ */ -#if defined(_KERNEL) || defined (__Userspace__) +#if defined(_KERNEL) || defined(__Userspace__) int sctp_sosend(struct socket *so, struct sockaddr *addr, Modified: stable/8/sys/netinet/sctputil.c ============================================================================== --- stable/8/sys/netinet/sctputil.c Thu Mar 7 21:22:07 2013 (r247945) +++ stable/8/sys/netinet/sctputil.c Thu Mar 7 21:24:41 2013 (r247946) @@ -3823,7 +3823,9 @@ sctp_abort_notification(struct sctp_tcb void sctp_abort_association(struct sctp_inpcb *inp, struct sctp_tcb *stcb, - struct mbuf *m, int iphlen, struct sctphdr *sh, struct mbuf *op_err, + struct mbuf *m, int iphlen, struct sctphdr *sh, + struct mbuf *op_err, + uint8_t use_mflowid, uint32_t mflowid, uint32_t vrf_id, uint16_t port) { uint32_t vtag; @@ -3842,7 +3844,9 @@ sctp_abort_association(struct sctp_inpcb vrf_id = stcb->asoc.vrf_id; stcb->asoc.state |= SCTP_STATE_WAS_ABORTED; } - sctp_send_abort(m, iphlen, sh, vtag, op_err, vrf_id, port); + sctp_send_abort(m, iphlen, sh, vtag, op_err, + use_mflowid, mflowid, + vrf_id, port); if (stcb != NULL) { /* Ok, now lets free it */ #if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING) @@ -3992,7 +3996,9 @@ sctp_abort_an_association(struct sctp_in void sctp_handle_ootb(struct mbuf *m, int iphlen, int offset, struct sctphdr *sh, - struct sctp_inpcb *inp, uint32_t vrf_id, uint16_t port) + struct sctp_inpcb *inp, + uint8_t use_mflowid, uint32_t mflowid, + uint32_t vrf_id, uint16_t port) { struct sctp_chunkhdr *ch, chunk_buf; unsigned int chk_length; @@ -4035,7 +4041,9 @@ sctp_handle_ootb(struct mbuf *m, int iph */ return; case SCTP_SHUTDOWN_ACK: - sctp_send_shutdown_complete2(m, sh, vrf_id, port); + sctp_send_shutdown_complete2(m, sh, + use_mflowid, mflowid, + vrf_id, port); return; default: break; @@ -4047,7 +4055,9 @@ sctp_handle_ootb(struct mbuf *m, int iph if ((SCTP_BASE_SYSCTL(sctp_blackhole) == 0) || ((SCTP_BASE_SYSCTL(sctp_blackhole) == 1) && (contains_init_chunk == 0))) { - sctp_send_abort(m, iphlen, sh, 0, NULL, vrf_id, port); + sctp_send_abort(m, iphlen, sh, 0, NULL, + use_mflowid, mflowid, + vrf_id, port); } } Modified: stable/8/sys/netinet/sctputil.h ============================================================================== --- stable/8/sys/netinet/sctputil.h Thu Mar 7 21:22:07 2013 (r247945) +++ stable/8/sys/netinet/sctputil.h Thu Mar 7 21:24:41 2013 (r247946) @@ -185,8 +185,10 @@ sctp_abort_notification(struct sctp_tcb /* We abort responding to an IP packet for some reason */ void -sctp_abort_association(struct sctp_inpcb *, struct sctp_tcb *, - struct mbuf *, int, struct sctphdr *, struct mbuf *, uint32_t, uint16_t); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable@FreeBSD.ORG Thu Mar 7 21:27:16 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 0F3936B7; Thu, 7 Mar 2013 21:27:16 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id E709239C; Thu, 7 Mar 2013 21:27:15 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r27LRF6L015350; Thu, 7 Mar 2013 21:27:15 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r27LRFUl015349; Thu, 7 Mar 2013 21:27:15 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201303072127.r27LRFUl015349@svn.freebsd.org> From: Michael Tuexen Date: Thu, 7 Mar 2013 21:27:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r247947 - stable/8/sys/netinet X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Mar 2013 21:27:16 -0000 Author: tuexen Date: Thu Mar 7 21:27:15 2013 New Revision: 247947 URL: http://svnweb.freebsd.org/changeset/base/247947 Log: MFC r237229: Cleanup the UDP decapsulation code. Modified: stable/8/sys/netinet/sctputil.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/netinet/ (props changed) Modified: stable/8/sys/netinet/sctputil.c ============================================================================== --- stable/8/sys/netinet/sctputil.c Thu Mar 7 21:24:41 2013 (r247946) +++ stable/8/sys/netinet/sctputil.c Thu Mar 7 21:27:15 2013 (r247947) @@ -6837,83 +6837,61 @@ sctp_recv_udp_tunneled_packet(struct mbu struct ip *iph; struct mbuf *sp, *last; struct udphdr *uhdr; - uint16_t port = 0; - int header_size = sizeof(struct udphdr) + sizeof(struct sctphdr); + uint16_t port; - /* - * Split out the mbuf chain. Leave the IP header in m, place the - * rest in the sp. - */ if ((m->m_flags & M_PKTHDR) == 0) { /* Can't handle one that is not a pkt hdr */ goto out; } - /* pull the src port */ + /* Pull the src port */ iph = mtod(m, struct ip *); uhdr = (struct udphdr *)((caddr_t)iph + off); - port = uhdr->uh_sport; + /* + * Split out the mbuf chain. Leave the IP header in m, place the + * rest in the sp. + */ sp = m_split(m, off, M_DONTWAIT); if (sp == NULL) { /* Gak, drop packet, we can't do a split */ goto out; } - if (sp->m_pkthdr.len < header_size) { - /* Gak, packet can't have an SCTP header in it - to small */ + if (sp->m_pkthdr.len < sizeof(struct udphdr) + sizeof(struct sctphdr)) { + /* Gak, packet can't have an SCTP header in it - too small */ m_freem(sp); goto out; } - /* ok now pull up the UDP header and SCTP header together */ - sp = m_pullup(sp, header_size); + /* Now pull up the UDP header and SCTP header together */ + sp = m_pullup(sp, sizeof(struct udphdr) + sizeof(struct sctphdr)); if (sp == NULL) { /* Gak pullup failed */ goto out; } - /* trim out the UDP header */ + /* Trim out the UDP header */ m_adj(sp, sizeof(struct udphdr)); /* Now reconstruct the mbuf chain */ - /* 1) find last one */ - last = m; - while (last->m_next != NULL) { - last = last->m_next; - } + for (last = m; last->m_next; last = last->m_next); last->m_next = sp; m->m_pkthdr.len += sp->m_pkthdr.len; - last = m; - while (last != NULL) { - last = last->m_next; - } - /* Now its ready for sctp_input or sctp6_input */ iph = mtod(m, struct ip *); switch (iph->ip_v) { #ifdef INET case IPVERSION: - { - uint16_t len; - - /* its IPv4 */ - len = SCTP_GET_IPV4_LENGTH(iph); - len -= sizeof(struct udphdr); - SCTP_GET_IPV4_LENGTH(iph) = len; - sctp_input_with_port(m, off, port); - break; - } + iph->ip_len -= sizeof(struct udphdr); + sctp_input_with_port(m, off, port); + break; #endif #ifdef INET6 case IPV6_VERSION >> 4: - { - /* its IPv6 - NOT supported */ - goto out; - break; + /* Not yet supported. */ + goto out; + break; - } #endif default: - { - m_freem(m); - break; - } + goto out; + break; } return; out: From owner-svn-src-stable@FreeBSD.ORG Thu Mar 7 21:29:43 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 5E731855; Thu, 7 Mar 2013 21:29:43 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 379CB3D4; Thu, 7 Mar 2013 21:29:43 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r27LThZJ015714; Thu, 7 Mar 2013 21:29:43 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r27LTgnf015709; Thu, 7 Mar 2013 21:29:42 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201303072129.r27LTgnf015709@svn.freebsd.org> From: Michael Tuexen Date: Thu, 7 Mar 2013 21:29:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r247948 - stable/8/sys/netinet X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Mar 2013 21:29:43 -0000 Author: tuexen Date: Thu Mar 7 21:29:42 2013 New Revision: 247948 URL: http://svnweb.freebsd.org/changeset/base/247948 Log: MFC r237230: Add rate limitation for SCTP OOTB responses. Modified: stable/8/sys/netinet/icmp_var.h stable/8/sys/netinet/ip_icmp.c stable/8/sys/netinet/sctp_input.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/netinet/ (props changed) Modified: stable/8/sys/netinet/icmp_var.h ============================================================================== --- stable/8/sys/netinet/icmp_var.h Thu Mar 7 21:27:15 2013 (r247947) +++ stable/8/sys/netinet/icmp_var.h Thu Mar 7 21:29:42 2013 (r247948) @@ -102,7 +102,8 @@ extern int badport_bandlim(int); #define BANDLIM_RST_CLOSEDPORT 3 /* No connection, and no listeners */ #define BANDLIM_RST_OPENPORT 4 /* No connection, listener */ #define BANDLIM_ICMP6_UNREACH 5 -#define BANDLIM_MAX 5 +#define BANDLIM_SCTP_OOTB 6 +#define BANDLIM_MAX 6 #endif #endif Modified: stable/8/sys/netinet/ip_icmp.c ============================================================================== --- stable/8/sys/netinet/ip_icmp.c Thu Mar 7 21:27:15 2013 (r247947) +++ stable/8/sys/netinet/ip_icmp.c Thu Mar 7 21:29:42 2013 (r247948) @@ -987,7 +987,8 @@ badport_bandlim(int which) { "icmp tstamp response" }, { "closed port RST response" }, { "open port RST response" }, - { "icmp6 unreach response" } + { "icmp6 unreach response" }, + { "sctp ootb response" } }; /* Modified: stable/8/sys/netinet/sctp_input.c ============================================================================== --- stable/8/sys/netinet/sctp_input.c Thu Mar 7 21:27:15 2013 (r247947) +++ stable/8/sys/netinet/sctp_input.c Thu Mar 7 21:29:42 2013 (r247948) @@ -6060,15 +6060,8 @@ sctp_skip_csum_4: struct sctp_init_chunk *init_chk, chunk_buf; SCTP_STAT_INCR(sctps_noport); -#ifdef ICMP_BANDLIM - /* - * we use the bandwidth limiting to protect against sending - * too many ABORTS all at once. In this case these count the - * same as an ICMP message. - */ - if (badport_bandlim(0) < 0) + if (badport_bandlim(BANDLIM_SCTP_OOTB) < 0) goto bad; -#endif /* ICMP_BANDLIM */ SCTPDBG(SCTP_DEBUG_INPUT1, "Sending a ABORT from packet entry!\n"); if (ch->chunk_type == SCTP_INITIATION) { From owner-svn-src-stable@FreeBSD.ORG Thu Mar 7 21:31:46 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 6EEB39D9; Thu, 7 Mar 2013 21:31:46 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 4A0B63E9; Thu, 7 Mar 2013 21:31:46 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r27LVki0017651; Thu, 7 Mar 2013 21:31:46 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r27LVk9x017650; Thu, 7 Mar 2013 21:31:46 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201303072131.r27LVk9x017650@svn.freebsd.org> From: Michael Tuexen Date: Thu, 7 Mar 2013 21:31:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r247949 - stable/8/sys/netinet X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Mar 2013 21:31:46 -0000 Author: tuexen Date: Thu Mar 7 21:31:45 2013 New Revision: 247949 URL: http://svnweb.freebsd.org/changeset/base/247949 Log: MFC r237392: Remove redundant #ifdef. Reported by gnn@. Modified: stable/8/sys/netinet/sctp_usrreq.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/netinet/ (props changed) Modified: stable/8/sys/netinet/sctp_usrreq.c ============================================================================== --- stable/8/sys/netinet/sctp_usrreq.c Thu Mar 7 21:29:42 2013 (r247948) +++ stable/8/sys/netinet/sctp_usrreq.c Thu Mar 7 21:31:45 2013 (r247949) @@ -6444,7 +6444,6 @@ sctp_peeraddr(struct socket *so, struct return (0); } -#ifdef INET struct pr_usrreqs sctp_usrreqs = { .pru_abort = sctp_abort, .pru_accept = sctp_accept, @@ -6467,4 +6466,3 @@ struct pr_usrreqs sctp_usrreqs = { }; #endif -#endif From owner-svn-src-stable@FreeBSD.ORG Thu Mar 7 21:34:05 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id E09A6B5B; Thu, 7 Mar 2013 21:34:05 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id D2426400; Thu, 7 Mar 2013 21:34:05 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r27LY532018045; Thu, 7 Mar 2013 21:34:05 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r27LY4ok018038; Thu, 7 Mar 2013 21:34:04 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201303072134.r27LY4ok018038@svn.freebsd.org> From: Michael Tuexen Date: Thu, 7 Mar 2013 21:34:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r247950 - in stable/8/sys: netinet netinet6 X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Mar 2013 21:34:06 -0000 Author: tuexen Date: Thu Mar 7 21:34:04 2013 New Revision: 247950 URL: http://svnweb.freebsd.org/changeset/base/247950 Log: MFC r237540: Do packet logging in a consistent way. Modified: stable/8/sys/netinet/sctp_bsd_addr.c stable/8/sys/netinet/sctp_bsd_addr.h stable/8/sys/netinet/sctp_input.c stable/8/sys/netinet/sctp_os_bsd.h stable/8/sys/netinet/sctp_output.c stable/8/sys/netinet6/sctp6_usrreq.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/netinet/ (props changed) stable/8/sys/netinet6/ (props changed) Modified: stable/8/sys/netinet/sctp_bsd_addr.c ============================================================================== --- stable/8/sys/netinet/sctp_bsd_addr.c Thu Mar 7 21:31:45 2013 (r247949) +++ stable/8/sys/netinet/sctp_bsd_addr.c Thu Mar 7 21:34:04 2013 (r247950) @@ -422,11 +422,12 @@ sctp_get_mbuf_for_msg(unsigned int space #ifdef SCTP_PACKET_LOGGING void -sctp_packet_log(struct mbuf *m, int length) +sctp_packet_log(struct mbuf *m) { int *lenat, thisone; void *copyto; uint32_t *tick_tock; + int length; int total_len; int grabbed_lock = 0; int value, newval, thisend, thisbegin; @@ -436,6 +437,7 @@ sctp_packet_log(struct mbuf *m, int leng * (value) -ticks of log (ticks) o -ip packet o -as logged - * where this started (thisbegin) x <--end points here */ + length = SCTP_HEADER_LEN(m); total_len = SCTP_SIZE32((length + (4 * sizeof(int)))); /* Log a packet to the buffer. */ if (total_len > SCTP_PACKET_LOG_SIZE) { Modified: stable/8/sys/netinet/sctp_bsd_addr.h ============================================================================== --- stable/8/sys/netinet/sctp_bsd_addr.h Thu Mar 7 21:31:45 2013 (r247949) +++ stable/8/sys/netinet/sctp_bsd_addr.h Thu Mar 7 21:34:04 2013 (r247950) @@ -53,7 +53,7 @@ void sctp_gather_internal_ifa_flags(stru #ifdef SCTP_PACKET_LOGGING -void sctp_packet_log(struct mbuf *m, int length); +void sctp_packet_log(struct mbuf *m); int sctp_copy_out_packet_log(uint8_t * target, int length); #endif Modified: stable/8/sys/netinet/sctp_input.c ============================================================================== --- stable/8/sys/netinet/sctp_input.c Thu Mar 7 21:31:45 2013 (r247949) +++ stable/8/sys/netinet/sctp_input.c Thu Mar 7 21:34:04 2013 (r247950) @@ -5932,9 +5932,9 @@ sctp_input_with_port(struct mbuf *i_pak, } } #endif -#ifdef SCTP_PACKET_LOGGING +#ifdef SCTP_PACKET_LOGGING if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_LAST_PACKET_TRACING) - sctp_packet_log(m, mlen); + sctp_packet_log(m); #endif if (m->m_flags & M_FLOWID) { mflowid = m->m_pkthdr.flowid; Modified: stable/8/sys/netinet/sctp_os_bsd.h ============================================================================== --- stable/8/sys/netinet/sctp_os_bsd.h Thu Mar 7 21:31:45 2013 (r247949) +++ stable/8/sys/netinet/sctp_os_bsd.h Thu Mar 7 21:34:04 2013 (r247950) @@ -365,7 +365,7 @@ typedef struct callout sctp_os_timer_t; */ #define SCTP_HEADER_TO_CHAIN(m) (m) #define SCTP_DETACH_HEADER_FROM_CHAIN(m) -#define SCTP_HEADER_LEN(m) (m->m_pkthdr.len) +#define SCTP_HEADER_LEN(m) ((m)->m_pkthdr.len) #define SCTP_GET_HEADER_FOR_OUTPUT(o_pak) 0 #define SCTP_RELEASE_HEADER(m) #define SCTP_RELEASE_PKT(m) sctp_m_freem(m) Modified: stable/8/sys/netinet/sctp_output.c ============================================================================== --- stable/8/sys/netinet/sctp_output.c Thu Mar 7 21:31:45 2013 (r247949) +++ stable/8/sys/netinet/sctp_output.c Thu Mar 7 21:34:04 2013 (r247950) @@ -4107,10 +4107,6 @@ sctp_lowlevel_chunk_output(struct sctp_i sctp_m_freem(m); return (ENOMEM); } -#ifdef SCTP_PACKET_LOGGING - if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_LAST_PACKET_TRACING) - sctp_packet_log(m, packet_length); -#endif SCTP_ATTACH_CHAIN(o_pak, m, packet_length); if (port) { #if defined(SCTP_WITH_NO_CSUM) @@ -4131,6 +4127,10 @@ sctp_lowlevel_chunk_output(struct sctp_i SCTP_STAT_INCR(sctps_sendhwcrc); #endif } +#ifdef SCTP_PACKET_LOGGING + if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_LAST_PACKET_TRACING) + sctp_packet_log(o_pak); +#endif /* send it out. table id is taken from stcb */ #if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING) if ((SCTP_BASE_SYSCTL(sctp_output_unlocked)) && (so_locked)) { @@ -4459,10 +4459,6 @@ sctp_lowlevel_chunk_output(struct sctp_i SCTP_LTRACE_ERR_RET(inp, stcb, NULL, SCTP_FROM_SCTP_OUTPUT, ENOMEM); return (ENOMEM); } -#ifdef SCTP_PACKET_LOGGING - if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_LAST_PACKET_TRACING) - sctp_packet_log(m, packet_length); -#endif SCTP_ATTACH_CHAIN(o_pak, m, packet_length); if (port) { #if defined(SCTP_WITH_NO_CSUM) @@ -4490,6 +4486,10 @@ sctp_lowlevel_chunk_output(struct sctp_i SCTP_SOCKET_UNLOCK(so, 0); } #endif +#ifdef SCTP_PACKET_LOGGING + if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_LAST_PACKET_TRACING) + sctp_packet_log(o_pak); +#endif SCTP_IP6_OUTPUT(ret, o_pak, (struct route_in6 *)ro, &ifp, stcb, vrf_id); #if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING) if ((SCTP_BASE_SYSCTL(sctp_output_unlocked)) && (so_locked)) { @@ -11067,11 +11067,6 @@ sctp_send_resp_msg(struct mbuf *m, struc } } iph_out->ip_len = len; -#ifdef SCTP_PACKET_LOGGING - if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_LAST_PACKET_TRACING) { - sctp_packet_log(mout, len); - } -#endif if (port) { #if defined(SCTP_WITH_NO_CSUM) SCTP_STAT_INCR(sctps_sendnocrc); @@ -11091,6 +11086,11 @@ sctp_send_resp_msg(struct mbuf *m, struc SCTP_STAT_INCR(sctps_sendhwcrc); #endif } +#ifdef SCTP_PACKET_LOGGING + if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_LAST_PACKET_TRACING) { + sctp_packet_log(o_pak); + } +#endif SCTP_IP_OUTPUT(ret, o_pak, &ro, NULL, vrf_id); /* Free the route if we got one back */ if (ro.ro_rt) { @@ -11101,11 +11101,6 @@ sctp_send_resp_msg(struct mbuf *m, struc #ifdef INET6 if (ip6_out != NULL) { ip6_out->ip6_plen = len - sizeof(struct ip6_hdr); -#ifdef SCTP_PACKET_LOGGING - if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_LAST_PACKET_TRACING) { - sctp_packet_log(mout, len); - } -#endif if (port) { #if defined(SCTP_WITH_NO_CSUM) SCTP_STAT_INCR(sctps_sendnocrc); @@ -11125,6 +11120,11 @@ sctp_send_resp_msg(struct mbuf *m, struc SCTP_STAT_INCR(sctps_sendhwcrc); #endif } +#ifdef SCTP_PACKET_LOGGING + if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_LAST_PACKET_TRACING) { + sctp_packet_log(o_pak); + } +#endif SCTP_IP6_OUTPUT(ret, o_pak, NULL, NULL, NULL, vrf_id); } #endif Modified: stable/8/sys/netinet6/sctp6_usrreq.c ============================================================================== --- stable/8/sys/netinet6/sctp6_usrreq.c Thu Mar 7 21:31:45 2013 (r247949) +++ stable/8/sys/netinet6/sctp6_usrreq.c Thu Mar 7 21:34:04 2013 (r247950) @@ -100,10 +100,12 @@ sctp6_input(struct mbuf **i_pak, int *of return (-1); } m = SCTP_HEADER_TO_CHAIN(*i_pak); - pkt_len = SCTP_HEADER_LEN((*i_pak)); + pkt_len = SCTP_HEADER_LEN(*i_pak); -#ifdef SCTP_PACKET_LOGGING - sctp_packet_log(m, pkt_len); +#ifdef SCTP_PACKET_LOGGING + if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_LAST_PACKET_TRACING) { + sctp_packet_log(m); + } #endif if (m->m_flags & M_FLOWID) { mflowid = m->m_pkthdr.flowid; From owner-svn-src-stable@FreeBSD.ORG Thu Mar 7 21:36:05 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 41CD0E46; Thu, 7 Mar 2013 21:36:05 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 03D6D5EF; Thu, 7 Mar 2013 21:36:05 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r27La42U018426; Thu, 7 Mar 2013 21:36:04 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r27La4LE018425; Thu, 7 Mar 2013 21:36:04 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201303072136.r27La4LE018425@svn.freebsd.org> From: Michael Tuexen Date: Thu, 7 Mar 2013 21:36:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r247952 - stable/8/sys/netinet X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Mar 2013 21:36:05 -0000 Author: tuexen Date: Thu Mar 7 21:36:04 2013 New Revision: 247952 URL: http://svnweb.freebsd.org/changeset/base/247952 Log: MFC r237541: Remove redundant check. Modified: stable/8/sys/netinet/sctp_input.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/netinet/ (props changed) Modified: stable/8/sys/netinet/sctp_input.c ============================================================================== --- stable/8/sys/netinet/sctp_input.c Thu Mar 7 21:34:16 2013 (r247951) +++ stable/8/sys/netinet/sctp_input.c Thu Mar 7 21:36:04 2013 (r247952) @@ -2392,7 +2392,7 @@ sctp_handle_cookie_echo(struct mbuf *m, uint8_t calc_sig[SCTP_SIGNATURE_SIZE], tmp_sig[SCTP_SIGNATURE_SIZE]; uint8_t *sig; uint8_t cookie_ok = 0; - unsigned int size_of_pkt, sig_offset, cookie_offset; + unsigned int sig_offset, cookie_offset; unsigned int cookie_len; struct timeval now; struct timeval time_expires; @@ -2434,7 +2434,6 @@ sctp_handle_cookie_echo(struct mbuf *m, lsin->sin_len = sizeof(*lsin); lsin->sin_port = sh->dest_port; lsin->sin_addr.s_addr = iph->ip_dst.s_addr; - size_of_pkt = SCTP_GET_IPV4_LENGTH(iph); break; } #endif @@ -2452,7 +2451,6 @@ sctp_handle_cookie_echo(struct mbuf *m, ip6 = mtod(m, struct ip6_hdr *); lsin6->sin6_port = sh->dest_port; lsin6->sin6_addr = ip6->ip6_dst; - size_of_pkt = SCTP_GET_IPV6_LENGTH(ip6) + iphlen; break; } #endif @@ -2476,11 +2474,10 @@ sctp_handle_cookie_echo(struct mbuf *m, */ return (NULL); } - if (cookie_len > size_of_pkt || - cookie_len < sizeof(struct sctp_cookie_echo_chunk) + + if (cookie_len < sizeof(struct sctp_cookie_echo_chunk) + sizeof(struct sctp_init_chunk) + sizeof(struct sctp_init_ack_chunk) + SCTP_SIGNATURE_SIZE) { - /* cookie too long! or too small */ + /* cookie too small */ return (NULL); } /* @@ -2488,11 +2485,6 @@ sctp_handle_cookie_echo(struct mbuf *m, * calculated in the sctp_hmac_m() call). */ sig_offset = offset + cookie_len - SCTP_SIGNATURE_SIZE; - if (sig_offset > size_of_pkt) { - /* packet not correct size! */ - /* XXX this may already be accounted for earlier... */ - return (NULL); - } m_sig = m_split(m, sig_offset, M_DONTWAIT); if (m_sig == NULL) { /* out of memory or ?? */ From owner-svn-src-stable@FreeBSD.ORG Thu Mar 7 21:38:45 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 6C6D61FB; Thu, 7 Mar 2013 21:38:45 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 574E5616; Thu, 7 Mar 2013 21:38:45 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r27Lcjp9018852; Thu, 7 Mar 2013 21:38:45 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r27LcipM018845; Thu, 7 Mar 2013 21:38:44 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201303072138.r27LcipM018845@svn.freebsd.org> From: Michael Tuexen Date: Thu, 7 Mar 2013 21:38:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r247954 - in stable/8/sys: netinet netinet6 X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Mar 2013 21:38:45 -0000 Author: tuexen Date: Thu Mar 7 21:38:43 2013 New Revision: 247954 URL: http://svnweb.freebsd.org/changeset/base/247954 Log: MFC r237542: Pass the packet length explicitly around. Modified: stable/8/sys/netinet/sctp_indata.c stable/8/sys/netinet/sctp_input.c stable/8/sys/netinet/sctp_output.c stable/8/sys/netinet/sctp_output.h stable/8/sys/netinet6/sctp6_usrreq.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/netinet/ (props changed) stable/8/sys/netinet6/ (props changed) Modified: stable/8/sys/netinet/sctp_indata.c ============================================================================== --- stable/8/sys/netinet/sctp_indata.c Thu Mar 7 21:37:23 2013 (r247953) +++ stable/8/sys/netinet/sctp_indata.c Thu Mar 7 21:38:43 2013 (r247954) @@ -2762,7 +2762,7 @@ sctp_process_data(struct mbuf **mm, int /* * we need to report rwnd overrun drops. */ - sctp_send_packet_dropped(stcb, net, *mm, iphlen, 0); + sctp_send_packet_dropped(stcb, net, *mm, length, iphlen, 0); } if (num_chunks) { /* Modified: stable/8/sys/netinet/sctp_input.c ============================================================================== --- stable/8/sys/netinet/sctp_input.c Thu Mar 7 21:37:23 2013 (r247953) +++ stable/8/sys/netinet/sctp_input.c Thu Mar 7 21:38:43 2013 (r247954) @@ -6013,7 +6013,7 @@ sctp_input_with_port(struct mbuf *i_pak, #endif } if ((inp) && (stcb)) { - sctp_send_packet_dropped(stcb, net, m, iphlen, 1); + sctp_send_packet_dropped(stcb, net, m, mlen + iphlen, iphlen, 1); sctp_chunk_output(inp, stcb, SCTP_OUTPUT_FROM_INPUT_ERROR, SCTP_SO_NOT_LOCKED); } else if ((inp != NULL) && (stcb == NULL)) { refcount_up = 1; Modified: stable/8/sys/netinet/sctp_output.c ============================================================================== --- stable/8/sys/netinet/sctp_output.c Thu Mar 7 21:37:23 2013 (r247953) +++ stable/8/sys/netinet/sctp_output.c Thu Mar 7 21:38:43 2013 (r247954) @@ -11312,21 +11312,15 @@ sctp_send_ecn_echo(struct sctp_tcb *stcb void sctp_send_packet_dropped(struct sctp_tcb *stcb, struct sctp_nets *net, - struct mbuf *m, int iphlen, int bad_crc) + struct mbuf *m, int len, int iphlen, int bad_crc) { struct sctp_association *asoc; struct sctp_pktdrop_chunk *drp; struct sctp_tmit_chunk *chk; uint8_t *datap; - int len; int was_trunc = 0; struct ip *iph; - -#ifdef INET6 - struct ip6_hdr *ip6h; - -#endif - int fullsz = 0, extra = 0; + int fullsz = 0; long spc; int offset; struct sctp_chunkhdr *ch, chunk_buf; @@ -11356,23 +11350,8 @@ sctp_send_packet_dropped(struct sctp_tcb sctp_free_a_chunk(stcb, chk, SCTP_SO_NOT_LOCKED); return; } - switch (iph->ip_v) { -#ifdef INET - case IPVERSION: - /* IPv4 */ - len = chk->send_size = iph->ip_len; - break; -#endif -#ifdef INET6 - case IPV6_VERSION >> 4: - /* IPv6 */ - ip6h = mtod(m, struct ip6_hdr *); - len = chk->send_size = htons(ip6h->ip6_plen); - break; -#endif - default: - return; - } + len -= iphlen; + chk->send_size = len; /* Validate that we do not have an ABORT in here. */ offset = iphlen + sizeof(struct sctphdr); ch = (struct sctp_chunkhdr *)sctp_m_getptr(m, offset, @@ -11408,7 +11387,7 @@ sctp_send_packet_dropped(struct sctp_tcb /* * only send 1 mtu worth, trim off the excess on the end. */ - fullsz = len - extra; + fullsz = len; len = min(stcb->asoc.smallest_mtu, MCLBYTES) - SCTP_MAX_OVERHEAD; was_trunc = 1; } Modified: stable/8/sys/netinet/sctp_output.h ============================================================================== --- stable/8/sys/netinet/sctp_output.h Thu Mar 7 21:37:23 2013 (r247953) +++ stable/8/sys/netinet/sctp_output.h Thu Mar 7 21:38:43 2013 (r247954) @@ -162,7 +162,7 @@ void sctp_send_ecn_echo(struct sctp_tcb void sctp_send_packet_dropped(struct sctp_tcb *, struct sctp_nets *, struct mbuf *, - int, int); + int, int, int); Modified: stable/8/sys/netinet6/sctp6_usrreq.c ============================================================================== --- stable/8/sys/netinet6/sctp6_usrreq.c Thu Mar 7 21:37:23 2013 (r247953) +++ stable/8/sys/netinet6/sctp6_usrreq.c Thu Mar 7 21:38:43 2013 (r247954) @@ -183,7 +183,7 @@ sctp6_input(struct mbuf **i_pak, int *of } /* in6p's ref-count increased && stcb locked */ if ((in6p) && (stcb)) { - sctp_send_packet_dropped(stcb, net, m, iphlen, 1); + sctp_send_packet_dropped(stcb, net, m, pkt_len, iphlen, 1); sctp_chunk_output((struct sctp_inpcb *)in6p, stcb, SCTP_OUTPUT_FROM_INPUT_ERROR, SCTP_SO_NOT_LOCKED); } else if ((in6p != NULL) && (stcb == NULL)) { refcount_up = 1; From owner-svn-src-stable@FreeBSD.ORG Thu Mar 7 21:41:04 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 880043B1; Thu, 7 Mar 2013 21:41:04 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 79E1B638; Thu, 7 Mar 2013 21:41:04 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r27Lf4W1020805; Thu, 7 Mar 2013 21:41:04 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r27Lf28i020791; Thu, 7 Mar 2013 21:41:02 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201303072141.r27Lf28i020791@svn.freebsd.org> From: Michael Tuexen Date: Thu, 7 Mar 2013 21:41:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r247955 - in stable/8/sys: netinet netinet6 X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Mar 2013 21:41:04 -0000 Author: tuexen Date: Thu Mar 7 21:41:02 2013 New Revision: 247955 URL: http://svnweb.freebsd.org/changeset/base/247955 Log: MFC r237565: Whitespace cleanup. Modified: stable/8/sys/netinet/sctp_indata.c stable/8/sys/netinet/sctp_input.c stable/8/sys/netinet/sctp_output.c stable/8/sys/netinet/sctp_sysctl.c stable/8/sys/netinet/sctp_sysctl.h stable/8/sys/netinet/sctp_usrreq.c stable/8/sys/netinet/sctputil.c stable/8/sys/netinet6/sctp6_usrreq.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/netinet/ (props changed) stable/8/sys/netinet6/ (props changed) Modified: stable/8/sys/netinet/sctp_indata.c ============================================================================== --- stable/8/sys/netinet/sctp_indata.c Thu Mar 7 21:38:43 2013 (r247954) +++ stable/8/sys/netinet/sctp_indata.c Thu Mar 7 21:41:02 2013 (r247955) @@ -1529,7 +1529,7 @@ sctp_process_a_data_chunk(struct sctp_tc */ if (stcb->sctp_socket->so_rcv.sb_cc) { /* some to read, wake-up */ -#if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING) +#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) struct socket *so; so = SCTP_INP_SO(stcb->sctp_ep); @@ -1545,7 +1545,7 @@ sctp_process_a_data_chunk(struct sctp_tc } #endif sctp_sorwakeup(stcb->sctp_ep, stcb->sctp_socket); -#if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING) +#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) SCTP_SOCKET_UNLOCK(so, 1); #endif } @@ -3982,7 +3982,7 @@ sctp_express_handle_sack(struct sctp_tcb } /* sa_ignore NO_NULL_CHK */ if (stcb->sctp_socket) { -#if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING) +#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) struct socket *so; #endif @@ -3991,7 +3991,7 @@ sctp_express_handle_sack(struct sctp_tcb /* sa_ignore NO_NULL_CHK */ sctp_wakeup_log(stcb, 1, SCTP_WAKESND_FROM_SACK); } -#if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING) +#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) so = SCTP_INP_SO(stcb->sctp_ep); atomic_add_int(&stcb->asoc.refcnt, 1); SCTP_TCB_UNLOCK(stcb); @@ -4005,7 +4005,7 @@ sctp_express_handle_sack(struct sctp_tcb } #endif sctp_sowwakeup_locked(stcb->sctp_ep, stcb->sctp_socket); -#if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING) +#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) SCTP_SOCKET_UNLOCK(so, 1); #endif } else { @@ -4734,7 +4734,7 @@ sctp_handle_sack(struct mbuf *m, int off } /* sa_ignore NO_NULL_CHK */ if ((wake_him) && (stcb->sctp_socket)) { -#if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING) +#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) struct socket *so; #endif @@ -4742,7 +4742,7 @@ sctp_handle_sack(struct mbuf *m, int off if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_WAKE_LOGGING_ENABLE) { sctp_wakeup_log(stcb, wake_him, SCTP_WAKESND_FROM_SACK); } -#if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING) +#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) so = SCTP_INP_SO(stcb->sctp_ep); atomic_add_int(&stcb->asoc.refcnt, 1); SCTP_TCB_UNLOCK(stcb); @@ -4756,7 +4756,7 @@ sctp_handle_sack(struct mbuf *m, int off } #endif sctp_sowwakeup_locked(stcb->sctp_ep, stcb->sctp_socket); -#if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING) +#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) SCTP_SOCKET_UNLOCK(so, 1); #endif } else { Modified: stable/8/sys/netinet/sctp_input.c ============================================================================== --- stable/8/sys/netinet/sctp_input.c Thu Mar 7 21:38:43 2013 (r247954) +++ stable/8/sys/netinet/sctp_input.c Thu Mar 7 21:41:02 2013 (r247955) @@ -757,7 +757,7 @@ static void sctp_handle_abort(struct sctp_abort_chunk *abort, struct sctp_tcb *stcb, struct sctp_nets *net) { -#if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING) +#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) struct socket *so; #endif @@ -807,7 +807,7 @@ sctp_handle_abort(struct sctp_abort_chun #ifdef SCTP_ASOCLOG_OF_TSNS sctp_print_out_track_log(stcb); #endif -#if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING) +#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) so = SCTP_INP_SO(stcb->sctp_ep); atomic_add_int(&stcb->asoc.refcnt, 1); SCTP_TCB_UNLOCK(stcb); @@ -818,7 +818,7 @@ sctp_handle_abort(struct sctp_abort_chun stcb->asoc.state |= SCTP_STATE_WAS_ABORTED; (void)sctp_free_assoc(stcb->sctp_ep, stcb, SCTP_NORMAL_PROC, SCTP_FROM_SCTP_INPUT + SCTP_LOC_6); -#if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING) +#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) SCTP_SOCKET_UNLOCK(so, 1); #endif SCTPDBG(SCTP_DEBUG_INPUT2, "sctp_handle_abort: finished\n"); @@ -860,7 +860,7 @@ sctp_handle_shutdown(struct sctp_shutdow struct sctp_association *asoc; int some_on_streamwheel; -#if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING) +#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) struct socket *so; #endif @@ -892,7 +892,7 @@ sctp_handle_shutdown(struct sctp_shutdow asoc->control_pdapi->pdapi_aborted = 1; asoc->control_pdapi = NULL; SCTP_INP_READ_UNLOCK(stcb->sctp_ep); -#if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING) +#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) so = SCTP_INP_SO(stcb->sctp_ep); atomic_add_int(&stcb->asoc.refcnt, 1); SCTP_TCB_UNLOCK(stcb); @@ -906,7 +906,7 @@ sctp_handle_shutdown(struct sctp_shutdow } #endif sctp_sorwakeup(stcb->sctp_ep, stcb->sctp_socket); -#if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING) +#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) SCTP_SOCKET_UNLOCK(so, 1); #endif } @@ -966,7 +966,7 @@ sctp_handle_shutdown_ack(struct sctp_shu { struct sctp_association *asoc; -#if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING) +#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) struct socket *so; so = SCTP_INP_SO(stcb->sctp_ep); @@ -1000,7 +1000,7 @@ sctp_handle_shutdown_ack(struct sctp_shu asoc->control_pdapi->pdapi_aborted = 1; asoc->control_pdapi = NULL; SCTP_INP_READ_UNLOCK(stcb->sctp_ep); -#if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING) +#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) atomic_add_int(&stcb->asoc.refcnt, 1); SCTP_TCB_UNLOCK(stcb); SCTP_SOCKET_LOCK(so, 1); @@ -1013,7 +1013,7 @@ sctp_handle_shutdown_ack(struct sctp_shu } #endif sctp_sorwakeup(stcb->sctp_ep, stcb->sctp_socket); -#if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING) +#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) SCTP_SOCKET_UNLOCK(so, 1); #endif } @@ -1037,7 +1037,7 @@ sctp_handle_shutdown_ack(struct sctp_shu } SCTP_STAT_INCR_COUNTER32(sctps_shutdown); /* free the TCB but first save off the ep */ -#if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING) +#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) atomic_add_int(&stcb->asoc.refcnt, 1); SCTP_TCB_UNLOCK(stcb); SCTP_SOCKET_LOCK(so, 1); @@ -1046,7 +1046,7 @@ sctp_handle_shutdown_ack(struct sctp_shu #endif (void)sctp_free_assoc(stcb->sctp_ep, stcb, SCTP_NORMAL_PROC, SCTP_FROM_SCTP_INPUT + SCTP_LOC_10); -#if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING) +#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) SCTP_SOCKET_UNLOCK(so, 1); #endif } @@ -1132,7 +1132,7 @@ sctp_handle_error(struct sctp_chunkhdr * struct sctp_association *asoc; int adjust; -#if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING) +#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) struct socket *so; #endif @@ -1195,7 +1195,7 @@ sctp_handle_error(struct sctp_chunkhdr * asoc->max_init_times) { sctp_abort_notification(stcb, 0, 0, NULL, SCTP_SO_NOT_LOCKED); /* now free the asoc */ -#if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING) +#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) so = SCTP_INP_SO(stcb->sctp_ep); atomic_add_int(&stcb->asoc.refcnt, 1); SCTP_TCB_UNLOCK(stcb); @@ -1205,7 +1205,7 @@ sctp_handle_error(struct sctp_chunkhdr * #endif (void)sctp_free_assoc(stcb->sctp_ep, stcb, SCTP_NORMAL_PROC, SCTP_FROM_SCTP_INPUT + SCTP_LOC_11); -#if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING) +#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) SCTP_SOCKET_UNLOCK(so, 1); #endif return (-1); @@ -1580,7 +1580,7 @@ sctp_process_cookie_existing(struct mbuf (stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL)) && (inp->sctp_socket->so_qlimit == 0) ) { -#if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING) +#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) struct socket *so; #endif @@ -1592,7 +1592,7 @@ sctp_process_cookie_existing(struct mbuf */ stcb->sctp_ep->sctp_flags |= SCTP_PCB_FLAGS_CONNECTED; -#if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING) +#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) so = SCTP_INP_SO(stcb->sctp_ep); atomic_add_int(&stcb->asoc.refcnt, 1); SCTP_TCB_UNLOCK(stcb); @@ -1605,7 +1605,7 @@ sctp_process_cookie_existing(struct mbuf } #endif soisconnected(stcb->sctp_socket); -#if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING) +#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) SCTP_SOCKET_UNLOCK(so, 1); #endif } @@ -1798,13 +1798,13 @@ sctp_process_cookie_existing(struct mbuf if (((stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) || (stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL)) && (inp->sctp_socket->so_qlimit == 0)) { -#if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING) +#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) struct socket *so; #endif stcb->sctp_ep->sctp_flags |= SCTP_PCB_FLAGS_CONNECTED; -#if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING) +#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) so = SCTP_INP_SO(stcb->sctp_ep); atomic_add_int(&stcb->asoc.refcnt, 1); SCTP_TCB_UNLOCK(stcb); @@ -1817,7 +1817,7 @@ sctp_process_cookie_existing(struct mbuf } #endif soisconnected(stcb->sctp_socket); -#if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING) +#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) SCTP_SOCKET_UNLOCK(so, 1); #endif } @@ -2029,7 +2029,7 @@ sctp_process_cookie_new(struct mbuf *m, struct sockaddr_in6 *sin6; #endif -#if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING) +#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) struct socket *so; so = SCTP_INP_SO(inp); @@ -2133,14 +2133,14 @@ sctp_process_cookie_new(struct mbuf *m, sh, op_err, use_mflowid, mflowid, vrf_id, port); -#if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING) +#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) SCTP_TCB_UNLOCK(stcb); SCTP_SOCKET_LOCK(so, 1); SCTP_TCB_LOCK(stcb); #endif (void)sctp_free_assoc(inp, stcb, SCTP_NORMAL_PROC, SCTP_FROM_SCTP_INPUT + SCTP_LOC_16); -#if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING) +#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) SCTP_SOCKET_UNLOCK(so, 1); #endif atomic_subtract_int(&stcb->asoc.refcnt, 1); @@ -2165,13 +2165,13 @@ sctp_process_cookie_new(struct mbuf *m, retval = 0; if (retval < 0) { atomic_add_int(&stcb->asoc.refcnt, 1); -#if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING) +#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) SCTP_TCB_UNLOCK(stcb); SCTP_SOCKET_LOCK(so, 1); SCTP_TCB_LOCK(stcb); #endif (void)sctp_free_assoc(inp, stcb, SCTP_NORMAL_PROC, SCTP_FROM_SCTP_INPUT + SCTP_LOC_16); -#if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING) +#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) SCTP_SOCKET_UNLOCK(so, 1); #endif atomic_subtract_int(&stcb->asoc.refcnt, 1); @@ -2182,13 +2182,13 @@ sctp_process_cookie_new(struct mbuf *m, init_offset + sizeof(struct sctp_init_chunk), initack_offset, sh, init_src)) { atomic_add_int(&stcb->asoc.refcnt, 1); -#if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING) +#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) SCTP_TCB_UNLOCK(stcb); SCTP_SOCKET_LOCK(so, 1); SCTP_TCB_LOCK(stcb); #endif (void)sctp_free_assoc(inp, stcb, SCTP_NORMAL_PROC, SCTP_FROM_SCTP_INPUT + SCTP_LOC_17); -#if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING) +#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) SCTP_SOCKET_UNLOCK(so, 1); #endif atomic_subtract_int(&stcb->asoc.refcnt, 1); @@ -2211,13 +2211,13 @@ sctp_process_cookie_new(struct mbuf *m, SCTPDBG(SCTP_DEBUG_AUTH1, "COOKIE-ECHO: AUTH failed\n"); atomic_add_int(&stcb->asoc.refcnt, 1); -#if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING) +#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) SCTP_TCB_UNLOCK(stcb); SCTP_SOCKET_LOCK(so, 1); SCTP_TCB_LOCK(stcb); #endif (void)sctp_free_assoc(inp, stcb, SCTP_NORMAL_PROC, SCTP_FROM_SCTP_INPUT + SCTP_LOC_18); -#if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING) +#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) SCTP_SOCKET_UNLOCK(so, 1); #endif atomic_subtract_int(&stcb->asoc.refcnt, 1); @@ -2274,13 +2274,13 @@ sctp_process_cookie_new(struct mbuf *m, #endif default: atomic_add_int(&stcb->asoc.refcnt, 1); -#if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING) +#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) SCTP_TCB_UNLOCK(stcb); SCTP_SOCKET_LOCK(so, 1); SCTP_TCB_LOCK(stcb); #endif (void)sctp_free_assoc(inp, stcb, SCTP_NORMAL_PROC, SCTP_FROM_SCTP_INPUT + SCTP_LOC_19); -#if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING) +#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) SCTP_SOCKET_UNLOCK(so, 1); #endif atomic_subtract_int(&stcb->asoc.refcnt, 1); @@ -2301,7 +2301,7 @@ sctp_process_cookie_new(struct mbuf *m, * a bit of protection is worth having.. */ stcb->sctp_ep->sctp_flags |= SCTP_PCB_FLAGS_CONNECTED; -#if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING) +#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) atomic_add_int(&stcb->asoc.refcnt, 1); SCTP_TCB_UNLOCK(stcb); SCTP_SOCKET_LOCK(so, 1); @@ -2313,7 +2313,7 @@ sctp_process_cookie_new(struct mbuf *m, } #endif soisconnected(stcb->sctp_socket); -#if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING) +#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) SCTP_SOCKET_UNLOCK(so, 1); #endif } else if ((stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) && @@ -2780,7 +2780,7 @@ sctp_handle_cookie_echo(struct mbuf *m, if (so == NULL) { struct mbuf *op_err; -#if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING) +#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) struct socket *pcb_so; #endif @@ -2791,7 +2791,7 @@ sctp_handle_cookie_echo(struct mbuf *m, sh, op_err, use_mflowid, mflowid, vrf_id, port); -#if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING) +#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) pcb_so = SCTP_INP_SO(*inp_p); atomic_add_int(&(*stcb)->asoc.refcnt, 1); SCTP_TCB_UNLOCK((*stcb)); @@ -2800,7 +2800,7 @@ sctp_handle_cookie_echo(struct mbuf *m, atomic_subtract_int(&(*stcb)->asoc.refcnt, 1); #endif (void)sctp_free_assoc(*inp_p, *stcb, SCTP_NORMAL_PROC, SCTP_FROM_SCTP_INPUT + SCTP_LOC_20); -#if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING) +#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) SCTP_SOCKET_UNLOCK(pcb_so, 1); #endif return (NULL); @@ -2890,13 +2890,13 @@ sctp_handle_cookie_echo(struct mbuf *m, * Pull it from the incomplete queue and wake the * guy */ -#if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING) +#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) atomic_add_int(&(*stcb)->asoc.refcnt, 1); SCTP_TCB_UNLOCK((*stcb)); SCTP_SOCKET_LOCK(so, 1); #endif soisconnected(so); -#if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING) +#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) SCTP_TCB_LOCK((*stcb)); atomic_subtract_int(&(*stcb)->asoc.refcnt, 1); SCTP_SOCKET_UNLOCK(so, 1); @@ -2954,12 +2954,12 @@ sctp_handle_cookie_ack(struct sctp_cooki sctp_ulp_notify(SCTP_NOTIFY_ASSOC_UP, stcb, 0, NULL, SCTP_SO_NOT_LOCKED); if ((stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) || (stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL)) { -#if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING) +#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) struct socket *so; #endif stcb->sctp_ep->sctp_flags |= SCTP_PCB_FLAGS_CONNECTED; -#if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING) +#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) so = SCTP_INP_SO(stcb->sctp_ep); atomic_add_int(&stcb->asoc.refcnt, 1); SCTP_TCB_UNLOCK(stcb); @@ -2970,7 +2970,7 @@ sctp_handle_cookie_ack(struct sctp_cooki if ((stcb->asoc.state & SCTP_STATE_CLOSED_SOCKET) == 0) { soisconnected(stcb->sctp_socket); } -#if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING) +#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) SCTP_SOCKET_UNLOCK(so, 1); #endif } @@ -3198,7 +3198,7 @@ sctp_handle_shutdown_complete(struct sct { struct sctp_association *asoc; -#if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING) +#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) struct socket *so; #endif @@ -3233,7 +3233,7 @@ sctp_handle_shutdown_complete(struct sct /* free the TCB */ SCTPDBG(SCTP_DEBUG_INPUT2, "sctp_handle_shutdown_complete: calls free-asoc\n"); -#if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING) +#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) so = SCTP_INP_SO(stcb->sctp_ep); atomic_add_int(&stcb->asoc.refcnt, 1); SCTP_TCB_UNLOCK(stcb); @@ -3242,7 +3242,7 @@ sctp_handle_shutdown_complete(struct sct atomic_subtract_int(&stcb->asoc.refcnt, 1); #endif (void)sctp_free_assoc(stcb->sctp_ep, stcb, SCTP_NORMAL_PROC, SCTP_FROM_SCTP_INPUT + SCTP_LOC_23); -#if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING) +#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) SCTP_SOCKET_UNLOCK(so, 1); #endif return; @@ -4429,7 +4429,7 @@ __attribute__((noinline)) int auth_skipped = 0; int asconf_cnt = 0; -#if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING) +#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) struct socket *so; #endif @@ -4787,7 +4787,7 @@ process_control_chunks: } *offset = length; if (stcb) { -#if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING) +#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) so = SCTP_INP_SO(inp); atomic_add_int(&stcb->asoc.refcnt, 1); SCTP_TCB_UNLOCK(stcb); @@ -4796,7 +4796,7 @@ process_control_chunks: atomic_subtract_int(&stcb->asoc.refcnt, 1); #endif (void)sctp_free_assoc(inp, stcb, SCTP_NORMAL_PROC, SCTP_FROM_SCTP_INPUT + SCTP_LOC_27); -#if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING) +#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) SCTP_SOCKET_UNLOCK(so, 1); #endif } @@ -5207,7 +5207,7 @@ process_control_chunks: if ((stcb) && (stcb->asoc.total_output_queue_size)) { ; } else if (stcb) { -#if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING) +#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) so = SCTP_INP_SO(inp); atomic_add_int(&stcb->asoc.refcnt, 1); SCTP_TCB_UNLOCK(stcb); @@ -5216,7 +5216,7 @@ process_control_chunks: atomic_subtract_int(&stcb->asoc.refcnt, 1); #endif (void)sctp_free_assoc(inp, stcb, SCTP_NORMAL_PROC, SCTP_FROM_SCTP_INPUT + SCTP_LOC_27); -#if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING) +#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) SCTP_SOCKET_UNLOCK(so, 1); #endif *offset = length; @@ -5370,7 +5370,7 @@ process_control_chunks: *fwd_tsn_seen = 1; if (inp->sctp_flags & SCTP_PCB_FLAGS_SOCKET_GONE) { /* We are not interested anymore */ -#if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING) +#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) so = SCTP_INP_SO(inp); atomic_add_int(&stcb->asoc.refcnt, 1); SCTP_TCB_UNLOCK(stcb); @@ -5379,7 +5379,7 @@ process_control_chunks: atomic_subtract_int(&stcb->asoc.refcnt, 1); #endif (void)sctp_free_assoc(inp, stcb, SCTP_NORMAL_PROC, SCTP_FROM_SCTP_INPUT + SCTP_LOC_29); -#if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING) +#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) SCTP_SOCKET_UNLOCK(so, 1); #endif *offset = length; @@ -5415,7 +5415,7 @@ process_control_chunks: } if (inp->sctp_flags & SCTP_PCB_FLAGS_SOCKET_GONE) { /* We are not interested anymore */ -#if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING) +#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) so = SCTP_INP_SO(inp); atomic_add_int(&stcb->asoc.refcnt, 1); SCTP_TCB_UNLOCK(stcb); @@ -5424,7 +5424,7 @@ process_control_chunks: atomic_subtract_int(&stcb->asoc.refcnt, 1); #endif (void)sctp_free_assoc(inp, stcb, SCTP_NORMAL_PROC, SCTP_FROM_SCTP_INPUT + SCTP_LOC_30); -#if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING) +#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) SCTP_SOCKET_UNLOCK(so, 1); #endif *offset = length; Modified: stable/8/sys/netinet/sctp_output.c ============================================================================== --- stable/8/sys/netinet/sctp_output.c Thu Mar 7 21:38:43 2013 (r247954) +++ stable/8/sys/netinet/sctp_output.c Thu Mar 7 21:41:02 2013 (r247955) @@ -3892,7 +3892,7 @@ sctp_lowlevel_chunk_output(struct sctp_i struct udphdr *udp = NULL; uint8_t tos_value; -#if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING) +#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) struct socket *so = NULL; #endif @@ -4132,14 +4132,14 @@ sctp_lowlevel_chunk_output(struct sctp_i sctp_packet_log(o_pak); #endif /* send it out. table id is taken from stcb */ -#if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING) +#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) if ((SCTP_BASE_SYSCTL(sctp_output_unlocked)) && (so_locked)) { so = SCTP_INP_SO(inp); SCTP_SOCKET_UNLOCK(so, 0); } #endif SCTP_IP_OUTPUT(ret, o_pak, ro, stcb, vrf_id); -#if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING) +#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) if ((SCTP_BASE_SYSCTL(sctp_output_unlocked)) && (so_locked)) { atomic_add_int(&stcb->asoc.refcnt, 1); SCTP_TCB_UNLOCK(stcb); @@ -4480,7 +4480,7 @@ sctp_lowlevel_chunk_output(struct sctp_i #endif } /* send it out. table id is taken from stcb */ -#if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING) +#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) if ((SCTP_BASE_SYSCTL(sctp_output_unlocked)) && (so_locked)) { so = SCTP_INP_SO(inp); SCTP_SOCKET_UNLOCK(so, 0); @@ -4491,7 +4491,7 @@ sctp_lowlevel_chunk_output(struct sctp_i sctp_packet_log(o_pak); #endif SCTP_IP6_OUTPUT(ret, o_pak, (struct route_in6 *)ro, &ifp, stcb, vrf_id); -#if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING) +#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) if ((SCTP_BASE_SYSCTL(sctp_output_unlocked)) && (so_locked)) { atomic_add_int(&stcb->asoc.refcnt, 1); SCTP_TCB_UNLOCK(stcb); Modified: stable/8/sys/netinet/sctp_sysctl.c ============================================================================== --- stable/8/sys/netinet/sctp_sysctl.c Thu Mar 7 21:38:43 2013 (r247954) +++ stable/8/sys/netinet/sctp_sysctl.c Thu Mar 7 21:41:02 2013 (r247955) @@ -665,7 +665,7 @@ sysctl_sctp_check(SYSCTL_HANDLER_ARGS) #ifdef SCTP_DEBUG RANGECHK(SCTP_BASE_SYSCTL(sctp_debug_on), SCTPCTL_DEBUG_MIN, SCTPCTL_DEBUG_MAX); #endif -#if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING) +#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) RANGECHK(SCTP_BASE_SYSCTL(sctp_output_unlocked), SCTPCTL_OUTPUT_UNLOCKED_MIN, SCTPCTL_OUTPUT_UNLOCKED_MAX); #endif } @@ -1125,7 +1125,7 @@ SYSCTL_VNET_PROC(_net_inet_sctp, OID_AUT #endif -#if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING) +#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) SYSCTL_VNET_PROC(_net_inet_sctp, OID_AUTO, output_unlocked, CTLTYPE_UINT | CTLFLAG_RW, &SCTP_BASE_SYSCTL(sctp_output_unlocked), 0, sysctl_sctp_check, "IU", SCTPCTL_OUTPUT_UNLOCKED_DESC); Modified: stable/8/sys/netinet/sctp_sysctl.h ============================================================================== --- stable/8/sys/netinet/sctp_sysctl.h Thu Mar 7 21:38:43 2013 (r247954) +++ stable/8/sys/netinet/sctp_sysctl.h Thu Mar 7 21:41:02 2013 (r247955) @@ -531,7 +531,7 @@ struct sctp_sysctl { #endif -#if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING) +#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) #define SCTPCTL_OUTPUT_UNLOCKED_DESC "Unlock socket when sending packets down to IP." #define SCTPCTL_OUTPUT_UNLOCKED_MIN 0 #define SCTPCTL_OUTPUT_UNLOCKED_MAX 1 Modified: stable/8/sys/netinet/sctp_usrreq.c ============================================================================== --- stable/8/sys/netinet/sctp_usrreq.c Thu Mar 7 21:38:43 2013 (r247954) +++ stable/8/sys/netinet/sctp_usrreq.c Thu Mar 7 21:41:02 2013 (r247955) @@ -224,7 +224,7 @@ sctp_notify(struct sctp_inpcb *inp, struct sctp_tcb *stcb, struct sctp_nets *net) { -#if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING) +#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) struct socket *so; #endif @@ -283,7 +283,7 @@ sctp_notify(struct sctp_inpcb *inp, * with no TCB */ sctp_abort_notification(stcb, 1, 0, NULL, SCTP_SO_NOT_LOCKED); -#if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING) +#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) so = SCTP_INP_SO(inp); atomic_add_int(&stcb->asoc.refcnt, 1); SCTP_TCB_UNLOCK(stcb); @@ -292,7 +292,7 @@ sctp_notify(struct sctp_inpcb *inp, atomic_subtract_int(&stcb->asoc.refcnt, 1); #endif (void)sctp_free_assoc(inp, stcb, SCTP_NORMAL_PROC, SCTP_FROM_SCTP_USRREQ + SCTP_LOC_2); -#if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING) +#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) SCTP_SOCKET_UNLOCK(so, 1); /* SCTP_TCB_UNLOCK(stcb); MT: I think this is not needed. */ #endif @@ -5810,7 +5810,7 @@ sctp_ctloutput(struct socket *so, struct if (INP_CHECK_SOCKAF(so, AF_INET6)) error = ip6_ctloutput(so, sopt); #endif /* INET6 */ -#if defined(INET) && defined (INET6) +#if defined(INET) && defined(INET6) else #endif #ifdef INET Modified: stable/8/sys/netinet/sctputil.c ============================================================================== --- stable/8/sys/netinet/sctputil.c Thu Mar 7 21:38:43 2013 (r247954) +++ stable/8/sys/netinet/sctputil.c Thu Mar 7 21:41:02 2013 (r247955) @@ -1412,7 +1412,7 @@ sctp_timeout_handler(void *t) struct sctp_nets *net; struct sctp_timer *tmr; -#if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING) +#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) struct socket *so; #endif @@ -1777,7 +1777,7 @@ sctp_timeout_handler(void *t) /* Can we free it yet? */ SCTP_INP_DECR_REF(inp); sctp_timer_stop(SCTP_TIMER_TYPE_ASOCKILL, inp, stcb, NULL, SCTP_FROM_SCTPUTIL + SCTP_LOC_1); -#if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING) +#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) so = SCTP_INP_SO(inp); atomic_add_int(&stcb->asoc.refcnt, 1); SCTP_TCB_UNLOCK(stcb); @@ -1786,7 +1786,7 @@ sctp_timeout_handler(void *t) atomic_subtract_int(&stcb->asoc.refcnt, 1); #endif (void)sctp_free_assoc(inp, stcb, SCTP_NORMAL_PROC, SCTP_FROM_SCTPUTIL + SCTP_LOC_2); -#if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING) +#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) SCTP_SOCKET_UNLOCK(so, 1); #endif /* @@ -2600,7 +2600,7 @@ sctp_notify_assoc_change(uint16_t state, size_t notif_len, abort_len; unsigned int i; -#if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING) +#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) struct socket *so; #endif @@ -2698,7 +2698,7 @@ set_error: } } /* Wake ANY sleepers */ -#if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING) +#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) so = SCTP_INP_SO(stcb->sctp_ep); if (!so_locked) { atomic_add_int(&stcb->asoc.refcnt, 1); @@ -2719,7 +2719,7 @@ set_error: } sorwakeup(stcb->sctp_socket); sowwakeup(stcb->sctp_socket); -#if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING) +#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) if (!so_locked) { SCTP_SOCKET_UNLOCK(so, 1); } @@ -3134,7 +3134,7 @@ sctp_notify_partial_delivery_indication( } if (stcb->sctp_ep && stcb->sctp_socket) { /* This should always be the case */ -#if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING) +#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) struct socket *so; so = SCTP_INP_SO(stcb->sctp_ep); @@ -3151,7 +3151,7 @@ sctp_notify_partial_delivery_indication( } #endif sctp_sorwakeup(stcb->sctp_ep, stcb->sctp_socket); -#if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING) +#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) if (!so_locked) { SCTP_SOCKET_UNLOCK(so, 1); } @@ -3173,7 +3173,7 @@ sctp_notify_shutdown_event(struct sctp_t if ((stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) || (stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL)) { /* mark socket closed for read/write and wakeup! */ -#if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING) +#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) struct socket *so; so = SCTP_INP_SO(stcb->sctp_ep); @@ -3188,7 +3188,7 @@ sctp_notify_shutdown_event(struct sctp_t } #endif socantsendmore(stcb->sctp_socket); -#if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING) +#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) SCTP_SOCKET_UNLOCK(so, 1); #endif } @@ -3830,7 +3830,7 @@ sctp_abort_association(struct sctp_inpcb { uint32_t vtag; -#if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING) +#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) struct socket *so; #endif @@ -3849,7 +3849,7 @@ sctp_abort_association(struct sctp_inpcb vrf_id, port); if (stcb != NULL) { /* Ok, now lets free it */ -#if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING) +#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) so = SCTP_INP_SO(inp); atomic_add_int(&stcb->asoc.refcnt, 1); SCTP_TCB_UNLOCK(stcb); @@ -3863,7 +3863,7 @@ sctp_abort_association(struct sctp_inpcb SCTP_STAT_DECR_GAUGE32(sctps_currestab); } (void)sctp_free_assoc(inp, stcb, SCTP_NORMAL_PROC, SCTP_FROM_SCTPUTIL + SCTP_LOC_4); -#if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING) +#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) SCTP_SOCKET_UNLOCK(so, 1); #endif } @@ -3942,12 +3942,12 @@ sctp_abort_an_association(struct sctp_in #endif ) { -#if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING) +#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) struct socket *so; #endif -#if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING) +#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) so = SCTP_INP_SO(inp); #endif if (stcb == NULL) { @@ -3977,7 +3977,7 @@ sctp_abort_an_association(struct sctp_in #ifdef SCTP_ASOCLOG_OF_TSNS sctp_print_out_track_log(stcb); #endif -#if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING) +#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) if (!so_locked) { atomic_add_int(&stcb->asoc.refcnt, 1); SCTP_TCB_UNLOCK(stcb); @@ -3987,7 +3987,7 @@ sctp_abort_an_association(struct sctp_in } #endif (void)sctp_free_assoc(inp, stcb, SCTP_NORMAL_PROC, SCTP_FROM_SCTPUTIL + SCTP_LOC_5); -#if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING) +#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) if (!so_locked) { SCTP_SOCKET_UNLOCK(so, 1); } @@ -4475,7 +4475,7 @@ sctp_add_to_readq(struct sctp_inpcb *inp if (sctp_is_feature_on(inp, SCTP_PCB_FLAGS_ZERO_COPY_ACTIVE)) { SCTP_ZERO_COPY_EVENT(inp, inp->sctp_socket); } else { -#if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING) +#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) struct socket *so; so = SCTP_INP_SO(inp); @@ -4496,7 +4496,7 @@ sctp_add_to_readq(struct sctp_inpcb *inp } #endif sctp_sorwakeup(inp, inp->sctp_socket); -#if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING) +#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) if (!so_locked) { SCTP_SOCKET_UNLOCK(so, 1); } @@ -4629,7 +4629,7 @@ get_out: if (sctp_is_feature_on(inp, SCTP_PCB_FLAGS_ZERO_COPY_ACTIVE)) { SCTP_ZERO_COPY_EVENT(inp, inp->sctp_socket); } else { -#if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING) +#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) struct socket *so; so = SCTP_INP_SO(inp); @@ -4648,7 +4648,7 @@ get_out: } #endif sctp_sorwakeup(inp, inp->sctp_socket); -#if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING) +#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) SCTP_SOCKET_UNLOCK(so, 1); #endif } @@ -4905,7 +4905,7 @@ sctp_release_pr_sctp_chunk(struct sctp_t SCTP_TCB_SEND_UNLOCK(stcb); } if (do_wakeup_routine) { -#if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING) +#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) struct socket *so; so = SCTP_INP_SO(stcb->sctp_ep); @@ -4923,7 +4923,7 @@ sctp_release_pr_sctp_chunk(struct sctp_t } #endif sctp_sowwakeup(stcb->sctp_ep, stcb->sctp_socket); -#if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING) +#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) if (!so_locked) { SCTP_SOCKET_UNLOCK(so, 1); } Modified: stable/8/sys/netinet6/sctp6_usrreq.c ============================================================================== --- stable/8/sys/netinet6/sctp6_usrreq.c Thu Mar 7 21:38:43 2013 (r247954) +++ stable/8/sys/netinet6/sctp6_usrreq.c Thu Mar 7 21:41:02 2013 (r247955) @@ -395,7 +395,7 @@ sctp6_notify(struct sctp_inpcb *inp, struct sctp_tcb *stcb, struct sctp_nets *net) { -#if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING) +#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) struct socket *so; #endif @@ -450,7 +450,7 @@ sctp6_notify(struct sctp_inpcb *inp, * with no TCB */ sctp_abort_notification(stcb, 1, 0, NULL, SCTP_SO_NOT_LOCKED); -#if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING) +#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) so = SCTP_INP_SO(inp); atomic_add_int(&stcb->asoc.refcnt, 1); SCTP_TCB_UNLOCK(stcb); @@ -459,7 +459,7 @@ sctp6_notify(struct sctp_inpcb *inp, atomic_subtract_int(&stcb->asoc.refcnt, 1); #endif (void)sctp_free_assoc(inp, stcb, SCTP_NORMAL_PROC, SCTP_FROM_SCTP_USRREQ + SCTP_LOC_2); -#if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING) +#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) SCTP_SOCKET_UNLOCK(so, 1); /* SCTP_TCB_UNLOCK(stcb); MT: I think this is not needed. */ #endif From owner-svn-src-stable@FreeBSD.ORG Thu Mar 7 21:43:22 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 71942661; Thu, 7 Mar 2013 21:43:22 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 62E96661; Thu, 7 Mar 2013 21:43:22 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r27LhMgH021128; Thu, 7 Mar 2013 21:43:22 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r27LhMuF021126; Thu, 7 Mar 2013 21:43:22 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201303072143.r27LhMuF021126@svn.freebsd.org> From: Michael Tuexen Date: Thu, 7 Mar 2013 21:43:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r247956 - in stable/8/sys: netinet netinet6 X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Mar 2013 21:43:22 -0000 Author: tuexen Date: Thu Mar 7 21:43:21 2013 New Revision: 247956 URL: http://svnweb.freebsd.org/changeset/base/247956 Log: MFC r237569: Unify sctp_input() and sctp6_input(). Modified: stable/8/sys/netinet/sctp_input.c stable/8/sys/netinet6/sctp6_usrreq.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/netinet/ (props changed) stable/8/sys/netinet6/ (props changed) Modified: stable/8/sys/netinet/sctp_input.c ============================================================================== --- stable/8/sys/netinet/sctp_input.c Thu Mar 7 21:41:02 2013 (r247955) +++ stable/8/sys/netinet/sctp_input.c Thu Mar 7 21:43:21 2013 (r247956) @@ -5885,12 +5885,12 @@ sctp_input_with_port(struct mbuf *i_pak, uint8_t ecn_bits; struct ip *ip; struct sctphdr *sh; + struct sctp_chunkhdr *ch; struct sctp_inpcb *inp = NULL; - struct sctp_nets *net; struct sctp_tcb *stcb = NULL; - struct sctp_chunkhdr *ch; + struct sctp_nets *net = NULL; int refcount_up = 0; - int length, mlen, offset; + int length, offset; uint32_t mflowid; uint8_t use_mflowid; @@ -5899,19 +5899,12 @@ sctp_input_with_port(struct mbuf *i_pak, #endif + iphlen = off; if (SCTP_GET_PKT_VRFID(i_pak, vrf_id)) { SCTP_RELEASE_PKT(i_pak); return; } - mlen = SCTP_HEADER_LEN(i_pak); - iphlen = off; m = SCTP_HEADER_TO_CHAIN(i_pak); - - net = NULL; - SCTP_STAT_INCR(sctps_recvpackets); - SCTP_STAT_INCR_COUNTER64(sctps_inpackets); - - #ifdef SCTP_MBUF_LOGGING /* Log in any input mbufs */ if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_MBUF_LOGGING_ENABLE) { @@ -5925,8 +5918,9 @@ sctp_input_with_port(struct mbuf *i_pak, } #endif #ifdef SCTP_PACKET_LOGGING - if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_LAST_PACKET_TRACING) + if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_LAST_PACKET_TRACING) { sctp_packet_log(m); + } #endif if (m->m_flags & M_FLOWID) { mflowid = m->m_pkthdr.flowid; @@ -5935,17 +5929,11 @@ sctp_input_with_port(struct mbuf *i_pak, mflowid = 0; use_mflowid = 0; } - /* - * Must take out the iphlen, since mlen expects this (only effect lb - * case) - */ - mlen -= iphlen; - - /* - * Get IP, SCTP, and first chunk header together in first mbuf. - */ + SCTP_STAT_INCR(sctps_recvpackets); + SCTP_STAT_INCR_COUNTER64(sctps_inpackets); + /* Get IP, SCTP, and first chunk header together in the first mbuf. */ ip = mtod(m, struct ip *); - offset = iphlen + sizeof(*sh) + sizeof(*ch); + offset = iphlen + sizeof(struct sctphdr) + sizeof(struct sctp_chunkhdr); if (SCTP_BUF_LEN(m) < offset) { if ((m = m_pullup(m, offset)) == 0) { SCTP_STAT_INCR(sctps_hdrops); @@ -5953,28 +5941,26 @@ sctp_input_with_port(struct mbuf *i_pak, } ip = mtod(m, struct ip *); } - /* validate mbuf chain length with IP payload length */ - if (mlen < (SCTP_GET_IPV4_LENGTH(ip) - iphlen)) { + sh = (struct sctphdr *)((caddr_t)ip + iphlen); + ch = (struct sctp_chunkhdr *)((caddr_t)sh + sizeof(struct sctphdr)); + offset -= sizeof(struct sctp_chunkhdr); + length = ip->ip_len + iphlen; + /* Validate mbuf chain length with IP payload length. */ + if (SCTP_HEADER_LEN(i_pak) != length) { + SCTPDBG(SCTP_DEBUG_INPUT1, + "sctp_input() length:%d reported length:%d\n", length, SCTP_HEADER_LEN(i_pak)); SCTP_STAT_INCR(sctps_hdrops); goto bad; } - sh = (struct sctphdr *)((caddr_t)ip + iphlen); - ch = (struct sctp_chunkhdr *)((caddr_t)sh + sizeof(*sh)); - SCTPDBG(SCTP_DEBUG_INPUT1, - "sctp_input() length:%d iphlen:%d\n", mlen, iphlen); - /* SCTP does not allow broadcasts or multicasts */ if (IN_MULTICAST(ntohl(ip->ip_dst.s_addr))) { goto bad; } if (SCTP_IS_IT_BROADCAST(ip->ip_dst, m)) { - /* - * We only look at broadcast if its a front state, All - * others we will not have a tcb for anyway. - */ goto bad; } - /* validate SCTP checksum */ + SCTPDBG(SCTP_DEBUG_INPUT1, + "sctp_input() length:%d iphlen:%d\n", length, iphlen); SCTPDBG(SCTP_DEBUG_CRCOFFLOAD, "sctp_input(): Packet of length %d received on %s with csum_flags 0x%x.\n", m->m_pkthdr.len, @@ -5985,21 +5971,18 @@ sctp_input_with_port(struct mbuf *i_pak, #else if (m->m_pkthdr.csum_flags & CSUM_SCTP_VALID) { SCTP_STAT_INCR(sctps_recvhwcrc); - goto sctp_skip_csum_4; + goto sctp_skip_csum; } - check = sh->checksum; /* save incoming checksum */ - sh->checksum = 0; /* prepare for calc */ + check = sh->checksum; + sh->checksum = 0; calc_check = sctp_calculate_cksum(m, iphlen); sh->checksum = check; SCTP_STAT_INCR(sctps_recvswcrc); if (calc_check != check) { SCTPDBG(SCTP_DEBUG_INPUT1, "Bad CSUM on SCTP packet calc_check:%x check:%x m:%p mlen:%d iphlen:%d\n", - calc_check, check, m, mlen, iphlen); - - stcb = sctp_findassociation_addr(m, - offset - sizeof(*ch), - sh, ch, &inp, &net, - vrf_id); + calc_check, check, m, length, iphlen); + stcb = sctp_findassociation_addr(m, offset, + sh, ch, &inp, &net, vrf_id); if ((net) && (port)) { if (net->port == 0) { sctp_pathmtu_adjustment(stcb, net->mtu - sizeof(struct udphdr)); @@ -6013,7 +5996,7 @@ sctp_input_with_port(struct mbuf *i_pak, #endif } if ((inp) && (stcb)) { - sctp_send_packet_dropped(stcb, net, m, mlen + iphlen, iphlen, 1); + sctp_send_packet_dropped(stcb, net, m, length, iphlen, 1); sctp_chunk_output(inp, stcb, SCTP_OUTPUT_FROM_INPUT_ERROR, SCTP_SO_NOT_LOCKED); } else if ((inp != NULL) && (stcb == NULL)) { refcount_up = 1; @@ -6022,18 +6005,14 @@ sctp_input_with_port(struct mbuf *i_pak, SCTP_STAT_INCR_COUNTER32(sctps_checksumerrors); goto bad; } -sctp_skip_csum_4: +sctp_skip_csum: #endif /* destination port of 0 is illegal, based on RFC2960. */ if (sh->dest_port == 0) { SCTP_STAT_INCR(sctps_hdrops); goto bad; } - /* - * Locate pcb and tcb for datagram sctp_findassociation_addr() wants - * IP/SCTP/first chunk header... - */ - stcb = sctp_findassociation_addr(m, offset - sizeof(*ch), + stcb = sctp_findassociation_addr(m, offset, sh, ch, &inp, &net, vrf_id); if ((net) && (port)) { if (net->port == 0) { @@ -6047,27 +6026,10 @@ sctp_skip_csum_4: net->flowidset = 1; #endif } - /* inp's ref-count increased && stcb locked */ if (inp == NULL) { - struct sctp_init_chunk *init_chk, chunk_buf; - SCTP_STAT_INCR(sctps_noport); if (badport_bandlim(BANDLIM_SCTP_OOTB) < 0) goto bad; - SCTPDBG(SCTP_DEBUG_INPUT1, - "Sending a ABORT from packet entry!\n"); - if (ch->chunk_type == SCTP_INITIATION) { - /* - * we do a trick here to get the INIT tag, dig in - * and get the tag from the INIT and put it in the - * common header. - */ - init_chk = (struct sctp_init_chunk *)sctp_m_getptr(m, - iphlen + sizeof(*sh), sizeof(*init_chk), - (uint8_t *) & chunk_buf); - if (init_chk != NULL) - sh->v_tag = init_chk->init.initiate_tag; - } if (ch->chunk_type == SCTP_SHUTDOWN_ACK) { sctp_send_shutdown_complete2(m, sh, use_mflowid, mflowid, @@ -6091,7 +6053,7 @@ sctp_skip_csum_4: refcount_up = 1; } #ifdef IPSEC - /* + /*- * I very much doubt any of the IPSEC stuff will work but I have no * idea, so I will leave it in place. */ @@ -6100,28 +6062,22 @@ sctp_skip_csum_4: SCTP_STAT_INCR(sctps_hdrops); goto bad; } -#endif /* IPSEC */ - - /* - * common chunk processing - */ - length = ip->ip_len + iphlen; - offset -= sizeof(struct sctp_chunkhdr); +#endif ecn_bits = ip->ip_tos; - /* sa_ignore NO_NULL_CHK */ sctp_common_input_processing(&m, iphlen, offset, length, sh, ch, inp, stcb, net, ecn_bits, use_mflowid, mflowid, vrf_id, port); - /* inp's ref-count reduced && stcb unlocked */ if (m) { sctp_m_freem(m); } if ((inp) && (refcount_up)) { /* reduce ref-count */ + SCTP_INP_WLOCK(inp); SCTP_INP_DECR_REF(inp); + SCTP_INP_WUNLOCK(inp); } return; bad: @@ -6130,7 +6086,9 @@ bad: } if ((inp) && (refcount_up)) { /* reduce ref-count */ + SCTP_INP_WLOCK(inp); SCTP_INP_DECR_REF(inp); + SCTP_INP_WUNLOCK(inp); } if (m) { sctp_m_freem(m); Modified: stable/8/sys/netinet6/sctp6_usrreq.c ============================================================================== --- stable/8/sys/netinet6/sctp6_usrreq.c Thu Mar 7 21:41:02 2013 (r247955) +++ stable/8/sys/netinet6/sctp6_usrreq.c Thu Mar 7 21:43:21 2013 (r247956) @@ -68,22 +68,17 @@ int sctp6_input(struct mbuf **i_pak, int *offp, int proto) { struct mbuf *m; + int iphlen; + uint32_t vrf_id = 0; + uint8_t ecn_bits; struct ip6_hdr *ip6; struct sctphdr *sh; - struct sctp_inpcb *in6p = NULL; - struct sctp_nets *net; - int refcount_up = 0; - uint32_t vrf_id = 0; - -#ifdef IPSEC - struct inpcb *in6p_ip; - -#endif struct sctp_chunkhdr *ch; - int length, offset, iphlen; - uint8_t ecn_bits; + struct sctp_inpcb *inp = NULL; struct sctp_tcb *stcb = NULL; - int pkt_len = 0; + struct sctp_nets *net = NULL; + int refcount_up = 0; + int length, offset; uint32_t mflowid; uint8_t use_mflowid; @@ -91,17 +86,26 @@ sctp6_input(struct mbuf **i_pak, int *of uint32_t check, calc_check; #endif - int off = *offp; uint16_t port = 0; - /* get the VRF and table id's */ + iphlen = *offp; if (SCTP_GET_PKT_VRFID(*i_pak, vrf_id)) { SCTP_RELEASE_PKT(*i_pak); - return (-1); + return (IPPROTO_DONE); } m = SCTP_HEADER_TO_CHAIN(*i_pak); - pkt_len = SCTP_HEADER_LEN(*i_pak); - +#ifdef SCTP_MBUF_LOGGING + /* Log in any input mbufs */ + if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_MBUF_LOGGING_ENABLE) { + struct mbuf *mat; + + for (mat = m; mat; mat = SCTP_BUF_NEXT(mat)) { + if (SCTP_BUF_IS_EXTENDED(mat)) { + sctp_log_mb(mat, SCTP_MBUF_INPUT); + } + } + } +#endif #ifdef SCTP_PACKET_LOGGING if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_LAST_PACKET_TRACING) { sctp_packet_log(m); @@ -114,42 +118,38 @@ sctp6_input(struct mbuf **i_pak, int *of mflowid = 0; use_mflowid = 0; } + SCTP_STAT_INCR(sctps_recvpackets); + SCTP_STAT_INCR_COUNTER64(sctps_inpackets); + /* Get IP, SCTP, and first chunk header together in the first mbuf. */ ip6 = mtod(m, struct ip6_hdr *); - /* Ensure that (sctphdr + sctp_chunkhdr) in a row. */ - IP6_EXTHDR_GET(sh, struct sctphdr *, m, off, - (int)(sizeof(*sh) + sizeof(*ch))); + offset = iphlen + sizeof(struct sctphdr) + sizeof(struct sctp_chunkhdr); + IP6_EXTHDR_GET(sh, struct sctphdr *, m, iphlen, + (int)(sizeof(struct sctphdr) + sizeof(struct sctp_chunkhdr))); if (sh == NULL) { SCTP_STAT_INCR(sctps_hdrops); return (IPPROTO_DONE); } ch = (struct sctp_chunkhdr *)((caddr_t)sh + sizeof(struct sctphdr)); - iphlen = off; - offset = iphlen + sizeof(*sh) + sizeof(*ch); - SCTPDBG(SCTP_DEBUG_INPUT1, - "sctp6_input() length:%d iphlen:%d\n", pkt_len, iphlen); - - -#if defined(NFAITH) && NFAITH > 0 - + offset -= sizeof(struct sctp_chunkhdr); if (faithprefix_p != NULL && (*faithprefix_p) (&ip6->ip6_dst)) { /* XXX send icmp6 host/port unreach? */ goto bad; } -#endif /* NFAITH defined and > 0 */ - SCTP_STAT_INCR(sctps_recvpackets); - SCTP_STAT_INCR_COUNTER64(sctps_inpackets); - SCTPDBG(SCTP_DEBUG_INPUT1, "V6 input gets a packet iphlen:%d pktlen:%d\n", - iphlen, pkt_len); - if (IN6_IS_ADDR_MULTICAST(&ip6->ip6_dst)) { - /* No multi-cast support in SCTP */ + length = ntohs(ip6->ip6_plen) + iphlen; + /* Validate mbuf chain length with IP payload length. */ + if (SCTP_HEADER_LEN(*i_pak) != length) { + SCTPDBG(SCTP_DEBUG_INPUT1, + "sctp6_input() length:%d reported length:%d\n", length, SCTP_HEADER_LEN(*i_pak)); + SCTP_STAT_INCR(sctps_hdrops); goto bad; } - /* destination port of 0 is illegal, based on RFC2960. */ - if (sh->dest_port == 0) + if (IN6_IS_ADDR_MULTICAST(&ip6->ip6_dst)) { goto bad; - + } + SCTPDBG(SCTP_DEBUG_INPUT1, + "sctp6_input() length:%d iphlen:%d\n", length, iphlen); SCTPDBG(SCTP_DEBUG_CRCOFFLOAD, - "sctp_input(): Packet of length %d received on %s with csum_flags 0x%x.\n", + "sctp6_input(): Packet of length %d received on %s with csum_flags 0x%x.\n", m->m_pkthdr.len, if_name(m->m_pkthdr.rcvif), m->m_pkthdr.csum_flags); @@ -160,15 +160,16 @@ sctp6_input(struct mbuf **i_pak, int *of SCTP_STAT_INCR(sctps_recvhwcrc); goto sctp_skip_csum; } - check = sh->checksum; /* save incoming checksum */ - sh->checksum = 0; /* prepare for calc */ + check = sh->checksum; + sh->checksum = 0; calc_check = sctp_calculate_cksum(m, iphlen); + sh->checksum = check; SCTP_STAT_INCR(sctps_recvswcrc); if (calc_check != check) { - SCTPDBG(SCTP_DEBUG_INPUT1, "Bad CSUM on SCTP packet calc_check:%x check:%x m:%p phlen:%d\n", - calc_check, check, m, iphlen); - stcb = sctp_findassociation_addr(m, offset - sizeof(*ch), - sh, ch, &in6p, &net, vrf_id); + SCTPDBG(SCTP_DEBUG_INPUT1, "Bad CSUM on SCTP packet calc_check:%x check:%x m:%p mlen:%d iphlen:%d\n", + calc_check, check, m, length, iphlen); + stcb = sctp_findassociation_addr(m, offset, + sh, ch, &inp, &net, vrf_id); if ((net) && (port)) { if (net->port == 0) { sctp_pathmtu_adjustment(stcb, net->mtu - sizeof(struct udphdr)); @@ -181,28 +182,25 @@ sctp6_input(struct mbuf **i_pak, int *of net->flowidset = 1; #endif } - /* in6p's ref-count increased && stcb locked */ - if ((in6p) && (stcb)) { - sctp_send_packet_dropped(stcb, net, m, pkt_len, iphlen, 1); - sctp_chunk_output((struct sctp_inpcb *)in6p, stcb, SCTP_OUTPUT_FROM_INPUT_ERROR, SCTP_SO_NOT_LOCKED); - } else if ((in6p != NULL) && (stcb == NULL)) { + if ((inp) && (stcb)) { + sctp_send_packet_dropped(stcb, net, m, length, iphlen, 1); + sctp_chunk_output(inp, stcb, SCTP_OUTPUT_FROM_INPUT_ERROR, SCTP_SO_NOT_LOCKED); + } else if ((inp != NULL) && (stcb == NULL)) { refcount_up = 1; } SCTP_STAT_INCR(sctps_badsum); SCTP_STAT_INCR_COUNTER32(sctps_checksumerrors); goto bad; } - sh->checksum = calc_check; - sctp_skip_csum: #endif - net = NULL; - /* - * Locate pcb and tcb for datagram sctp_findassociation_addr() wants - * IP/SCTP/first chunk header... - */ - stcb = sctp_findassociation_addr(m, offset - sizeof(*ch), - sh, ch, &in6p, &net, vrf_id); + /* destination port of 0 is illegal, based on RFC2960. */ + if (sh->dest_port == 0) { + SCTP_STAT_INCR(sctps_hdrops); + goto bad; + } + stcb = sctp_findassociation_addr(m, offset, + sh, ch, &inp, &net, vrf_id); if ((net) && (port)) { if (net->port == 0) { sctp_pathmtu_adjustment(stcb, net->mtu - sizeof(struct udphdr)); @@ -215,25 +213,10 @@ sctp_skip_csum: net->flowidset = 1; #endif } - /* in6p's ref-count increased */ - if (in6p == NULL) { - struct sctp_init_chunk *init_chk, chunk_buf; - + if (inp == NULL) { SCTP_STAT_INCR(sctps_noport); - if (ch->chunk_type == SCTP_INITIATION) { - /* - * we do a trick here to get the INIT tag, dig in - * and get the tag from the INIT and put it in the - * common header. - */ - init_chk = (struct sctp_init_chunk *)sctp_m_getptr(m, - iphlen + sizeof(*sh), sizeof(*init_chk), - (uint8_t *) & chunk_buf); - if (init_chk) - sh->v_tag = init_chk->init.initiate_tag; - else - sh->v_tag = 0; - } + if (badport_bandlim(BANDLIM_SCTP_OOTB) < 0) + goto bad; if (ch->chunk_type == SCTP_SHUTDOWN_ACK) { sctp_send_shutdown_complete2(m, sh, use_mflowid, mflowid, @@ -257,55 +240,46 @@ sctp_skip_csum: refcount_up = 1; } #ifdef IPSEC - /* - * Check AH/ESP integrity. + /*- + * I very much doubt any of the IPSEC stuff will work but I have no + * idea, so I will leave it in place. */ - in6p_ip = (struct inpcb *)in6p; - if (in6p_ip && (ipsec6_in_reject(m, in6p_ip))) { -/* XXX */ + if (inp && ipsec6_in_reject(m, &inp->ip_inp.inp)) { MODULE_GLOBAL(ipsec6stat).in_polvio++; + SCTP_STAT_INCR(sctps_hdrops); goto bad; } -#endif /* IPSEC */ +#endif - /* - * CONTROL chunk processing - */ - offset -= sizeof(*ch); ecn_bits = ((ntohl(ip6->ip6_flow) >> 20) & 0x000000ff); - - /* Length now holds the total packet length payload + iphlen */ - length = ntohs(ip6->ip6_plen) + iphlen; - /* sa_ignore NO_NULL_CHK */ sctp_common_input_processing(&m, iphlen, offset, length, sh, ch, - in6p, stcb, net, ecn_bits, + inp, stcb, net, ecn_bits, use_mflowid, mflowid, vrf_id, port); - /* inp's ref-count reduced && stcb unlocked */ - /* XXX this stuff below gets moved to appropriate parts later... */ - if (m) + if (m) { sctp_m_freem(m); - if ((in6p) && refcount_up) { + } + if ((inp) && (refcount_up)) { /* reduce ref-count */ - SCTP_INP_WLOCK(in6p); - SCTP_INP_DECR_REF(in6p); - SCTP_INP_WUNLOCK(in6p); + SCTP_INP_WLOCK(inp); + SCTP_INP_DECR_REF(inp); + SCTP_INP_WUNLOCK(inp); } return (IPPROTO_DONE); - bad: if (stcb) { SCTP_TCB_UNLOCK(stcb); } - if ((in6p) && refcount_up) { + if ((inp) && (refcount_up)) { /* reduce ref-count */ - SCTP_INP_WLOCK(in6p); - SCTP_INP_DECR_REF(in6p); - SCTP_INP_WUNLOCK(in6p); + SCTP_INP_WLOCK(inp); + SCTP_INP_DECR_REF(inp); + SCTP_INP_WUNLOCK(inp); } - if (m) + if (m) { sctp_m_freem(m); + } return (IPPROTO_DONE); } From owner-svn-src-stable@FreeBSD.ORG Thu Mar 7 22:05:28 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 99295E27; Thu, 7 Mar 2013 22:05:28 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 7414C741; Thu, 7 Mar 2013 22:05:28 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r27M5SHr027640; Thu, 7 Mar 2013 22:05:28 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r27M5SFK027638; Thu, 7 Mar 2013 22:05:28 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201303072205.r27M5SFK027638@svn.freebsd.org> From: Michael Tuexen Date: Thu, 7 Mar 2013 22:05:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r247959 - stable/8/sys/netinet X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Mar 2013 22:05:28 -0000 Author: tuexen Date: Thu Mar 7 22:05:27 2013 New Revision: 247959 URL: http://svnweb.freebsd.org/changeset/base/247959 Log: MFC r238002: Remove dead code (on FreeBSD) as suggested by glebius@. Modified: stable/8/sys/netinet/sctp_output.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/netinet/ (props changed) Modified: stable/8/sys/netinet/sctp_output.c ============================================================================== --- stable/8/sys/netinet/sctp_output.c Thu Mar 7 21:48:05 2013 (r247958) +++ stable/8/sys/netinet/sctp_output.c Thu Mar 7 22:05:27 2013 (r247959) @@ -10893,7 +10893,6 @@ sctp_send_resp_msg(struct mbuf *m, struc int len, cause_len, padding_len, ret; #ifdef INET - sctp_route_t ro; struct ip *iph_out; #endif @@ -11057,8 +11056,6 @@ sctp_send_resp_msg(struct mbuf *m, struc SCTP_ATTACH_CHAIN(o_pak, mout, len); #ifdef INET if (iph_out != NULL) { - /* zap the stack pointer to the route */ - bzero(&ro, sizeof(sctp_route_t)); if (port) { if (V_udp_cksum) { udp->uh_sum = in_pseudo(iph_out->ip_src.s_addr, iph_out->ip_dst.s_addr, udp->uh_ulen + htons(IPPROTO_UDP)); @@ -11091,11 +11088,7 @@ sctp_send_resp_msg(struct mbuf *m, struc sctp_packet_log(o_pak); } #endif - SCTP_IP_OUTPUT(ret, o_pak, &ro, NULL, vrf_id); - /* Free the route if we got one back */ - if (ro.ro_rt) { - RTFREE(ro.ro_rt); - } + SCTP_IP_OUTPUT(ret, o_pak, NULL, NULL, vrf_id); } #endif #ifdef INET6 From owner-svn-src-stable@FreeBSD.ORG Thu Mar 7 23:18:36 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 61E07690; Thu, 7 Mar 2013 23:18:36 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 48CF7A14; Thu, 7 Mar 2013 23:18:36 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r27NIa6A049504; Thu, 7 Mar 2013 23:18:36 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r27NIZLj049502; Thu, 7 Mar 2013 23:18:35 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201303072318.r27NIZLj049502@svn.freebsd.org> From: Michael Tuexen Date: Thu, 7 Mar 2013 23:18:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r247964 - stable/8/sys/netinet6 X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Mar 2013 23:18:36 -0000 Author: tuexen Date: Thu Mar 7 23:18:35 2013 New Revision: 247964 URL: http://svnweb.freebsd.org/changeset/base/247964 Log: MFC r235916: Introduce in6_getscope() to allow more effective checksum computations without the need to copy the address to clear the scope. Modified: stable/8/sys/netinet6/scope6.c stable/8/sys/netinet6/scope6_var.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/netinet6/ (props changed) Modified: stable/8/sys/netinet6/scope6.c ============================================================================== --- stable/8/sys/netinet6/scope6.c Thu Mar 7 22:54:28 2013 (r247963) +++ stable/8/sys/netinet6/scope6.c Thu Mar 7 23:18:35 2013 (r247964) @@ -486,3 +486,16 @@ in6_clearscope(struct in6_addr *in6) return (modified); } + +/* + * Return the scope identifier or zero. + */ +uint16_t +in6_getscope(struct in6_addr *in6) +{ + + if (IN6_IS_SCOPE_LINKLOCAL(in6) || IN6_IS_ADDR_MC_INTFACELOCAL(in6)) + return (in6->s6_addr16[1]); + + return (0); +} Modified: stable/8/sys/netinet6/scope6_var.h ============================================================================== --- stable/8/sys/netinet6/scope6_var.h Thu Mar 7 22:54:28 2013 (r247963) +++ stable/8/sys/netinet6/scope6_var.h Thu Mar 7 23:18:35 2013 (r247964) @@ -54,6 +54,7 @@ int sa6_embedscope __P((struct sockaddr_ int sa6_recoverscope __P((struct sockaddr_in6 *)); int in6_setscope __P((struct in6_addr *, struct ifnet *, u_int32_t *)); int in6_clearscope __P((struct in6_addr *)); +uint16_t in6_getscope(struct in6_addr *); #endif /* _KERNEL */ #endif /* _NETINET6_SCOPE6_VAR_H_ */ From owner-svn-src-stable@FreeBSD.ORG Thu Mar 7 23:23:27 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 47B0C88D; Thu, 7 Mar 2013 23:23:27 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 3248AA4B; Thu, 7 Mar 2013 23:23:27 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r27NNRGD051806; Thu, 7 Mar 2013 23:23:27 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r27NNPJx051792; Thu, 7 Mar 2013 23:23:25 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201303072323.r27NNPJx051792@svn.freebsd.org> From: Michael Tuexen Date: Thu, 7 Mar 2013 23:23:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r247965 - in stable/8/sys: netinet netinet6 X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Mar 2013 23:23:27 -0000 Author: tuexen Date: Thu Mar 7 23:23:25 2013 New Revision: 247965 URL: http://svnweb.freebsd.org/changeset/base/247965 Log: MFC r237715,r238294: Pass the src and dst address of a received packet explicitly around. Modified: stable/8/sys/netinet/sctp_asconf.c stable/8/sys/netinet/sctp_asconf.h stable/8/sys/netinet/sctp_indata.c stable/8/sys/netinet/sctp_indata.h stable/8/sys/netinet/sctp_input.c stable/8/sys/netinet/sctp_input.h stable/8/sys/netinet/sctp_os_bsd.h stable/8/sys/netinet/sctp_output.c stable/8/sys/netinet/sctp_output.h stable/8/sys/netinet/sctp_pcb.c stable/8/sys/netinet/sctp_pcb.h stable/8/sys/netinet/sctp_usrreq.c stable/8/sys/netinet/sctputil.c stable/8/sys/netinet/sctputil.h stable/8/sys/netinet6/sctp6_usrreq.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/netinet/ (props changed) stable/8/sys/netinet6/ (props changed) Modified: stable/8/sys/netinet/sctp_asconf.c ============================================================================== --- stable/8/sys/netinet/sctp_asconf.c Thu Mar 7 23:18:35 2013 (r247964) +++ stable/8/sys/netinet/sctp_asconf.c Thu Mar 7 23:23:25 2013 (r247965) @@ -50,59 +50,8 @@ __FBSDID("$FreeBSD$"); */ -static void -sctp_asconf_get_source_ip(struct mbuf *m, struct sockaddr *sa) -{ - struct ip *iph; - -#ifdef INET - struct sockaddr_in *sin; - -#endif -#ifdef INET6 - struct sockaddr_in6 *sin6; - -#endif - - iph = mtod(m, struct ip *); - switch (iph->ip_v) { -#ifdef INET - case IPVERSION: - { - /* IPv4 source */ - sin = (struct sockaddr_in *)sa; - bzero(sin, sizeof(*sin)); - sin->sin_family = AF_INET; - sin->sin_len = sizeof(struct sockaddr_in); - sin->sin_port = 0; - sin->sin_addr.s_addr = iph->ip_src.s_addr; - break; - } -#endif -#ifdef INET6 - case (IPV6_VERSION >> 4): - { - /* IPv6 source */ - struct ip6_hdr *ip6; - - sin6 = (struct sockaddr_in6 *)sa; - bzero(sin6, sizeof(*sin6)); - sin6->sin6_family = AF_INET6; - sin6->sin6_len = sizeof(struct sockaddr_in6); - sin6->sin6_port = 0; - ip6 = mtod(m, struct ip6_hdr *); - sin6->sin6_addr = ip6->ip6_src; - break; - } -#endif /* INET6 */ - default: - break; - } - return; -} - /* - * draft-ietf-tsvwg-addip-sctp + * RFC 5061 * * An ASCONF parameter queue exists per asoc which holds the pending address * operations. Lists are updated upon receipt of ASCONF-ACK. @@ -194,12 +143,12 @@ sctp_asconf_error_response(uint32_t id, } static struct mbuf * -sctp_process_asconf_add_ip(struct mbuf *m, struct sctp_asconf_paramhdr *aph, +sctp_process_asconf_add_ip(struct sockaddr *src, struct sctp_asconf_paramhdr *aph, struct sctp_tcb *stcb, int send_hb, int response_required) { struct sctp_nets *net; struct mbuf *m_reply = NULL; - struct sockaddr_storage sa_source, sa_store; + struct sockaddr_storage sa_store; struct sctp_paramhdr *ph; uint16_t param_type, param_length, aparam_length; struct sockaddr *sa; @@ -279,11 +228,10 @@ sctp_process_asconf_add_ip(struct mbuf * /* if 0.0.0.0/::0, add the source address instead */ if (zero_address && SCTP_BASE_SYSCTL(sctp_nat_friendly)) { - sa = (struct sockaddr *)&sa_source; - sctp_asconf_get_source_ip(m, sa); + sa = src; SCTPDBG(SCTP_DEBUG_ASCONF1, "process_asconf_add_ip: using source addr "); - SCTPDBG_ADDR(SCTP_DEBUG_ASCONF1, sa); + SCTPDBG_ADDR(SCTP_DEBUG_ASCONF1, src); } /* add the address */ if (bad_address) { @@ -343,11 +291,12 @@ sctp_asconf_del_remote_addrs_except(stru } static struct mbuf * -sctp_process_asconf_delete_ip(struct mbuf *m, struct sctp_asconf_paramhdr *aph, +sctp_process_asconf_delete_ip(struct sockaddr *src, + struct sctp_asconf_paramhdr *aph, struct sctp_tcb *stcb, int response_required) { struct mbuf *m_reply = NULL; - struct sockaddr_storage sa_source, sa_store; + struct sockaddr_storage sa_store; struct sctp_paramhdr *ph; uint16_t param_type, param_length, aparam_length; struct sockaddr *sa; @@ -365,9 +314,6 @@ sctp_process_asconf_delete_ip(struct mbu #endif - /* get the source IP address for src and 0.0.0.0/::0 delete checks */ - sctp_asconf_get_source_ip(m, (struct sockaddr *)&sa_source); - aparam_length = ntohs(aph->ph.param_length); ph = (struct sctp_paramhdr *)(aph + 1); param_type = ntohs(ph->param_type); @@ -424,7 +370,7 @@ sctp_process_asconf_delete_ip(struct mbu } /* make sure the source address is not being deleted */ - if (sctp_cmpaddr(sa, (struct sockaddr *)&sa_source)) { + if (sctp_cmpaddr(sa, src)) { /* trying to delete the source address! */ SCTPDBG(SCTP_DEBUG_ASCONF1, "process_asconf_delete_ip: tried to delete source addr\n"); m_reply = sctp_asconf_error_response(aph->correlation_id, @@ -434,8 +380,7 @@ sctp_process_asconf_delete_ip(struct mbu } /* if deleting 0.0.0.0/::0, delete all addresses except src addr */ if (zero_address && SCTP_BASE_SYSCTL(sctp_nat_friendly)) { - result = sctp_asconf_del_remote_addrs_except(stcb, - (struct sockaddr *)&sa_source); + result = sctp_asconf_del_remote_addrs_except(stcb, src); if (result) { /* src address did not exist? */ @@ -475,12 +420,12 @@ sctp_process_asconf_delete_ip(struct mbu } static struct mbuf * -sctp_process_asconf_set_primary(struct mbuf *m, +sctp_process_asconf_set_primary(struct sockaddr *src, struct sctp_asconf_paramhdr *aph, struct sctp_tcb *stcb, int response_required) { struct mbuf *m_reply = NULL; - struct sockaddr_storage sa_source, sa_store; + struct sockaddr_storage sa_store; struct sctp_paramhdr *ph; uint16_t param_type, param_length, aparam_length; struct sockaddr *sa; @@ -550,11 +495,10 @@ sctp_process_asconf_set_primary(struct m /* if 0.0.0.0/::0, use the source address instead */ if (zero_address && SCTP_BASE_SYSCTL(sctp_nat_friendly)) { - sa = (struct sockaddr *)&sa_source; - sctp_asconf_get_source_ip(m, sa); + sa = src; SCTPDBG(SCTP_DEBUG_ASCONF1, "process_asconf_set_primary: using source addr "); - SCTPDBG_ADDR(SCTP_DEBUG_ASCONF1, sa); + SCTPDBG_ADDR(SCTP_DEBUG_ASCONF1, src); } /* set the primary address */ if (sctp_set_primary_addr(stcb, sa, NULL) == 0) { @@ -626,6 +570,7 @@ sctp_process_asconf_set_primary(struct m */ void sctp_handle_asconf(struct mbuf *m, unsigned int offset, + struct sockaddr *src, struct sctp_asconf_chunk *cp, struct sctp_tcb *stcb, int first) { @@ -762,13 +707,13 @@ sctp_handle_asconf(struct mbuf *m, unsig switch (param_type) { case SCTP_ADD_IP_ADDRESS: asoc->peer_supports_asconf = 1; - m_result = sctp_process_asconf_add_ip(m, aph, stcb, + m_result = sctp_process_asconf_add_ip(src, aph, stcb, (cnt < SCTP_BASE_SYSCTL(sctp_hb_maxburst)), error); cnt++; break; case SCTP_DEL_IP_ADDRESS: asoc->peer_supports_asconf = 1; - m_result = sctp_process_asconf_delete_ip(m, aph, stcb, + m_result = sctp_process_asconf_delete_ip(src, aph, stcb, error); break; case SCTP_ERROR_CAUSE_IND: @@ -776,7 +721,7 @@ sctp_handle_asconf(struct mbuf *m, unsig break; case SCTP_SET_PRIM_ADDR: asoc->peer_supports_asconf = 1; - m_result = sctp_process_asconf_set_primary(m, aph, + m_result = sctp_process_asconf_set_primary(src, aph, stcb, error); break; case SCTP_NAT_VTAGS: @@ -856,11 +801,7 @@ send_reply: * this could happen if the source address was just newly * added */ - struct sockaddr_storage addr; - struct sockaddr *src = (struct sockaddr *)&addr; - SCTPDBG(SCTP_DEBUG_ASCONF1, "handle_asconf: looking up net for IP source address\n"); - sctp_asconf_get_source_ip(m, src); SCTPDBG(SCTP_DEBUG_ASCONF1, "Looking for IP source: "); SCTPDBG_ADDR(SCTP_DEBUG_ASCONF1, src); /* look up the from address */ Modified: stable/8/sys/netinet/sctp_asconf.h ============================================================================== --- stable/8/sys/netinet/sctp_asconf.h Thu Mar 7 23:18:35 2013 (r247964) +++ stable/8/sys/netinet/sctp_asconf.h Thu Mar 7 23:23:25 2013 (r247965) @@ -46,8 +46,8 @@ extern void sctp_asconf_cleanup(struct s extern struct mbuf *sctp_compose_asconf(struct sctp_tcb *, int *, int); extern void -sctp_handle_asconf(struct mbuf *, unsigned int, struct sctp_asconf_chunk *, - struct sctp_tcb *, int i); +sctp_handle_asconf(struct mbuf *, unsigned int, struct sockaddr *, + struct sctp_asconf_chunk *, struct sctp_tcb *, int); extern void sctp_handle_asconf_ack(struct mbuf *, int, struct sctp_asconf_ack_chunk *, Modified: stable/8/sys/netinet/sctp_indata.c ============================================================================== --- stable/8/sys/netinet/sctp_indata.c Thu Mar 7 23:18:35 2013 (r247964) +++ stable/8/sys/netinet/sctp_indata.c Thu Mar 7 23:23:25 2013 (r247965) @@ -2516,6 +2516,7 @@ doit_again: int sctp_process_data(struct mbuf **mm, int iphlen, int *offset, int length, + struct sockaddr *src, struct sockaddr *dst, struct sctphdr *sh, struct sctp_inpcb *inp, struct sctp_tcb *stcb, struct sctp_nets *net, uint32_t * high_tsn, uint8_t use_mflowid, uint32_t mflowid, @@ -2626,8 +2627,8 @@ sctp_process_data(struct mbuf **mm, int } stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_19; - sctp_abort_association(inp, stcb, m, iphlen, sh, - op_err, + sctp_abort_association(inp, stcb, m, iphlen, + src, dst, sh, op_err, use_mflowid, mflowid, vrf_id, port); return (2); @@ -2695,6 +2696,7 @@ sctp_process_data(struct mbuf **mm, int op_err = sctp_generate_invmanparam(SCTP_CAUSE_PROTOCOL_VIOLATION); sctp_abort_association(inp, stcb, m, iphlen, + src, dst, sh, op_err, use_mflowid, mflowid, vrf_id, port); Modified: stable/8/sys/netinet/sctp_indata.h ============================================================================== --- stable/8/sys/netinet/sctp_indata.h Thu Mar 7 23:18:35 2013 (r247964) +++ stable/8/sys/netinet/sctp_indata.h Thu Mar 7 23:23:25 2013 (r247965) @@ -111,7 +111,9 @@ void sctp_update_acked(struct sctp_tcb *, struct sctp_shutdown_chunk *, int *); int -sctp_process_data(struct mbuf **, int, int *, int, struct sctphdr *, +sctp_process_data(struct mbuf **, int, int *, int, + struct sockaddr *src, struct sockaddr *dst, + struct sctphdr *, struct sctp_inpcb *, struct sctp_tcb *, struct sctp_nets *, uint32_t *, uint8_t, uint32_t, Modified: stable/8/sys/netinet/sctp_input.c ============================================================================== --- stable/8/sys/netinet/sctp_input.c Thu Mar 7 23:18:35 2013 (r247964) +++ stable/8/sys/netinet/sctp_input.c Thu Mar 7 23:23:25 2013 (r247965) @@ -80,7 +80,8 @@ sctp_stop_all_cookie_timers(struct sctp_ /* INIT handler */ static void -sctp_handle_init(struct mbuf *m, int iphlen, int offset, struct sctphdr *sh, +sctp_handle_init(struct mbuf *m, int iphlen, int offset, + struct sockaddr *src, struct sockaddr *dst, struct sctphdr *sh, struct sctp_init_chunk *cp, struct sctp_inpcb *inp, struct sctp_tcb *stcb, int *abort_no_unlock, uint8_t use_mflowid, uint32_t mflowid, @@ -97,7 +98,7 @@ sctp_handle_init(struct mbuf *m, int iph /* validate length */ if (ntohs(cp->ch.chunk_length) < sizeof(struct sctp_init_chunk)) { op_err = sctp_generate_invmanparam(SCTP_CAUSE_INVALID_PARAM); - sctp_abort_association(inp, stcb, m, iphlen, sh, op_err, + sctp_abort_association(inp, stcb, m, iphlen, src, dst, sh, op_err, use_mflowid, mflowid, vrf_id, port); if (stcb) @@ -109,7 +110,7 @@ sctp_handle_init(struct mbuf *m, int iph if (init->initiate_tag == 0) { /* protocol error... send abort */ op_err = sctp_generate_invmanparam(SCTP_CAUSE_INVALID_PARAM); - sctp_abort_association(inp, stcb, m, iphlen, sh, op_err, + sctp_abort_association(inp, stcb, m, iphlen, src, dst, sh, op_err, use_mflowid, mflowid, vrf_id, port); if (stcb) @@ -119,7 +120,7 @@ sctp_handle_init(struct mbuf *m, int iph if (ntohl(init->a_rwnd) < SCTP_MIN_RWND) { /* invalid parameter... send abort */ op_err = sctp_generate_invmanparam(SCTP_CAUSE_INVALID_PARAM); - sctp_abort_association(inp, stcb, m, iphlen, sh, op_err, + sctp_abort_association(inp, stcb, m, iphlen, src, dst, sh, op_err, use_mflowid, mflowid, vrf_id, port); if (stcb) @@ -129,7 +130,7 @@ sctp_handle_init(struct mbuf *m, int iph if (init->num_inbound_streams == 0) { /* protocol error... send abort */ op_err = sctp_generate_invmanparam(SCTP_CAUSE_INVALID_PARAM); - sctp_abort_association(inp, stcb, m, iphlen, sh, op_err, + sctp_abort_association(inp, stcb, m, iphlen, src, dst, sh, op_err, use_mflowid, mflowid, vrf_id, port); if (stcb) @@ -139,7 +140,7 @@ sctp_handle_init(struct mbuf *m, int iph if (init->num_outbound_streams == 0) { /* protocol error... send abort */ op_err = sctp_generate_invmanparam(SCTP_CAUSE_INVALID_PARAM); - sctp_abort_association(inp, stcb, m, iphlen, sh, op_err, + sctp_abort_association(inp, stcb, m, iphlen, src, dst, sh, op_err, use_mflowid, mflowid, vrf_id, port); if (stcb) @@ -149,7 +150,7 @@ sctp_handle_init(struct mbuf *m, int iph if (sctp_validate_init_auth_params(m, offset + sizeof(*cp), offset + ntohs(cp->ch.chunk_length))) { /* auth parameter(s) error... send abort */ - sctp_abort_association(inp, stcb, m, iphlen, sh, NULL, + sctp_abort_association(inp, stcb, m, iphlen, src, dst, sh, NULL, use_mflowid, mflowid, vrf_id, port); if (stcb) @@ -178,7 +179,7 @@ sctp_handle_init(struct mbuf *m, int iph * state :-) */ if (SCTP_BASE_SYSCTL(sctp_blackhole) == 0) { - sctp_send_abort(m, iphlen, sh, 0, NULL, + sctp_send_abort(m, iphlen, src, dst, sh, 0, NULL, use_mflowid, mflowid, vrf_id, port); } @@ -191,7 +192,8 @@ sctp_handle_init(struct mbuf *m, int iph sctp_chunk_output(inp, stcb, SCTP_OUTPUT_FROM_CONTROL_PROC, SCTP_SO_NOT_LOCKED); } else { SCTPDBG(SCTP_DEBUG_INPUT3, "sctp_handle_init: sending INIT-ACK\n"); - sctp_send_initiate_ack(inp, stcb, m, iphlen, offset, sh, cp, + sctp_send_initiate_ack(inp, stcb, m, iphlen, offset, src, dst, + sh, cp, use_mflowid, mflowid, vrf_id, port, ((stcb == NULL) ? SCTP_HOLDS_LOCK : SCTP_NOT_LOCKED)); @@ -419,7 +421,8 @@ sctp_process_init(struct sctp_init_chunk * INIT-ACK message processing/consumption returns value < 0 on error */ static int -sctp_process_init_ack(struct mbuf *m, int iphlen, int offset, struct sctphdr *sh, +sctp_process_init_ack(struct mbuf *m, int iphlen, int offset, + struct sockaddr *src, struct sockaddr *dst, struct sctphdr *sh, struct sctp_init_ack_chunk *cp, struct sctp_tcb *stcb, struct sctp_nets *net, int *abort_no_unlock, uint8_t use_mflowid, uint32_t mflowid, @@ -454,13 +457,14 @@ sctp_process_init_ack(struct mbuf *m, in initack_limit = offset + ntohs(cp->ch.chunk_length); /* load all addresses */ if ((retval = sctp_load_addresses_from_init(stcb, m, - (offset + sizeof(struct sctp_init_chunk)), initack_limit, sh, - NULL))) { + (offset + sizeof(struct sctp_init_chunk)), initack_limit, + src, dst, NULL))) { /* Huh, we should abort */ SCTPDBG(SCTP_DEBUG_INPUT1, "Load addresses from INIT causes an abort %d\n", retval); - sctp_abort_association(stcb->sctp_ep, stcb, m, iphlen, sh, NULL, + sctp_abort_association(stcb->sctp_ep, stcb, m, iphlen, + src, dst, sh, NULL, use_mflowid, mflowid, vrf_id, net->port); *abort_no_unlock = 1; @@ -536,7 +540,7 @@ sctp_process_init_ack(struct mbuf *m, in mp->resv = 0; } sctp_abort_association(stcb->sctp_ep, stcb, m, iphlen, - sh, op_err, + src, dst, sh, op_err, use_mflowid, mflowid, vrf_id, net->port); *abort_no_unlock = 1; @@ -1278,7 +1282,8 @@ sctp_handle_error(struct sctp_chunkhdr * } static int -sctp_handle_init_ack(struct mbuf *m, int iphlen, int offset, struct sctphdr *sh, +sctp_handle_init_ack(struct mbuf *m, int iphlen, int offset, + struct sockaddr *src, struct sockaddr *dst, struct sctphdr *sh, struct sctp_init_ack_chunk *cp, struct sctp_tcb *stcb, struct sctp_nets *net, int *abort_no_unlock, uint8_t use_mflowid, uint32_t mflowid, @@ -1298,8 +1303,8 @@ sctp_handle_init_ack(struct mbuf *m, int if (ntohs(cp->ch.chunk_length) < sizeof(struct sctp_init_ack_chunk)) { /* Invalid length */ op_err = sctp_generate_invmanparam(SCTP_CAUSE_INVALID_PARAM); - sctp_abort_association(stcb->sctp_ep, stcb, m, iphlen, sh, - op_err, + sctp_abort_association(stcb->sctp_ep, stcb, m, iphlen, + src, dst, sh, op_err, use_mflowid, mflowid, vrf_id, net->port); *abort_no_unlock = 1; @@ -1310,8 +1315,8 @@ sctp_handle_init_ack(struct mbuf *m, int if (init_ack->initiate_tag == 0) { /* protocol error... send an abort */ op_err = sctp_generate_invmanparam(SCTP_CAUSE_INVALID_PARAM); - sctp_abort_association(stcb->sctp_ep, stcb, m, iphlen, sh, - op_err, + sctp_abort_association(stcb->sctp_ep, stcb, m, iphlen, + src, dst, sh, op_err, use_mflowid, mflowid, vrf_id, net->port); *abort_no_unlock = 1; @@ -1320,8 +1325,8 @@ sctp_handle_init_ack(struct mbuf *m, int if (ntohl(init_ack->a_rwnd) < SCTP_MIN_RWND) { /* protocol error... send an abort */ op_err = sctp_generate_invmanparam(SCTP_CAUSE_INVALID_PARAM); - sctp_abort_association(stcb->sctp_ep, stcb, m, iphlen, sh, - op_err, + sctp_abort_association(stcb->sctp_ep, stcb, m, iphlen, + src, dst, sh, op_err, use_mflowid, mflowid, vrf_id, net->port); *abort_no_unlock = 1; @@ -1330,8 +1335,8 @@ sctp_handle_init_ack(struct mbuf *m, int if (init_ack->num_inbound_streams == 0) { /* protocol error... send an abort */ op_err = sctp_generate_invmanparam(SCTP_CAUSE_INVALID_PARAM); - sctp_abort_association(stcb->sctp_ep, stcb, m, iphlen, sh, - op_err, + sctp_abort_association(stcb->sctp_ep, stcb, m, iphlen, + src, dst, sh, op_err, use_mflowid, mflowid, vrf_id, net->port); *abort_no_unlock = 1; @@ -1340,8 +1345,8 @@ sctp_handle_init_ack(struct mbuf *m, int if (init_ack->num_outbound_streams == 0) { /* protocol error... send an abort */ op_err = sctp_generate_invmanparam(SCTP_CAUSE_INVALID_PARAM); - sctp_abort_association(stcb->sctp_ep, stcb, m, iphlen, sh, - op_err, + sctp_abort_association(stcb->sctp_ep, stcb, m, iphlen, + src, dst, sh, op_err, use_mflowid, mflowid, vrf_id, net->port); *abort_no_unlock = 1; @@ -1365,7 +1370,7 @@ sctp_handle_init_ack(struct mbuf *m, int sctp_ulp_notify(SCTP_NOTIFY_INTERFACE_CONFIRMED, stcb, 0, (void *)stcb->asoc.primary_destination, SCTP_SO_NOT_LOCKED); } - if (sctp_process_init_ack(m, iphlen, offset, sh, cp, stcb, + if (sctp_process_init_ack(m, iphlen, offset, src, dst, sh, cp, stcb, net, abort_no_unlock, use_mflowid, mflowid, vrf_id) < 0) { @@ -1419,6 +1424,7 @@ sctp_handle_init_ack(struct mbuf *m, int static struct sctp_tcb * sctp_process_cookie_new(struct mbuf *m, int iphlen, int offset, + struct sockaddr *src, struct sockaddr *dst, struct sctphdr *sh, struct sctp_state_cookie *cookie, int cookie_len, struct sctp_inpcb *inp, struct sctp_nets **netp, struct sockaddr *init_src, int *notification, @@ -1435,6 +1441,7 @@ sctp_process_cookie_new(struct mbuf *m, */ static struct sctp_tcb * sctp_process_cookie_existing(struct mbuf *m, int iphlen, int offset, + struct sockaddr *src, struct sockaddr *dst, struct sctphdr *sh, struct sctp_state_cookie *cookie, int cookie_len, struct sctp_inpcb *inp, struct sctp_tcb *stcb, struct sctp_nets **netp, struct sockaddr *init_src, int *notification, @@ -1477,7 +1484,7 @@ sctp_process_cookie_existing(struct mbuf ph = mtod(op_err, struct sctp_paramhdr *); ph->param_type = htons(SCTP_CAUSE_COOKIE_IN_SHUTDOWN); ph->param_length = htons(sizeof(struct sctp_paramhdr)); - sctp_send_operr_to(m, sh, cookie->peers_vtag, op_err, + sctp_send_operr_to(src, dst, sh, cookie->peers_vtag, op_err, use_mflowid, mflowid, vrf_id, net->port); if (how_indx < sizeof(asoc->cookie_how)) @@ -1642,7 +1649,7 @@ sctp_process_cookie_existing(struct mbuf */ if (sctp_load_addresses_from_init(stcb, m, init_offset + sizeof(struct sctp_init_chunk), - initack_offset, sh, init_src)) { + initack_offset, src, dst, init_src)) { if (how_indx < sizeof(asoc->cookie_how)) asoc->cookie_how[how_indx] = 4; return (NULL); @@ -1703,7 +1710,7 @@ sctp_process_cookie_existing(struct mbuf ph = mtod(op_err, struct sctp_paramhdr *); ph->param_type = htons(SCTP_CAUSE_NAT_COLLIDING_STATE); ph->param_length = htons(sizeof(struct sctp_paramhdr)); - sctp_send_abort(m, iphlen, sh, 0, op_err, + sctp_send_abort(m, iphlen, src, dst, sh, 0, op_err, use_mflowid, mflowid, vrf_id, port); return (NULL); @@ -1786,7 +1793,7 @@ sctp_process_cookie_existing(struct mbuf } if (sctp_load_addresses_from_init(stcb, m, init_offset + sizeof(struct sctp_init_chunk), - initack_offset, sh, init_src)) { + initack_offset, src, dst, init_src)) { if (how_indx < sizeof(asoc->cookie_how)) asoc->cookie_how[how_indx] = 10; return (NULL); @@ -1867,7 +1874,8 @@ sctp_process_cookie_existing(struct mbuf * cookie_new code since we are allowing a duplicate * association. I hope this works... */ - return (sctp_process_cookie_new(m, iphlen, offset, sh, cookie, cookie_len, + return (sctp_process_cookie_new(m, iphlen, offset, src, dst, + sh, cookie, cookie_len, inp, netp, init_src, notification, auth_skipped, auth_offset, auth_len, use_mflowid, mflowid, @@ -1972,7 +1980,7 @@ sctp_process_cookie_existing(struct mbuf if (sctp_load_addresses_from_init(stcb, m, init_offset + sizeof(struct sctp_init_chunk), - initack_offset, sh, init_src)) { + initack_offset, src, dst, init_src)) { if (how_indx < sizeof(asoc->cookie_how)) asoc->cookie_how[how_indx] = 14; @@ -2003,6 +2011,7 @@ sctp_process_cookie_existing(struct mbuf */ static struct sctp_tcb * sctp_process_cookie_new(struct mbuf *m, int iphlen, int offset, + struct sockaddr *src, struct sockaddr *dst, struct sctphdr *sh, struct sctp_state_cookie *cookie, int cookie_len, struct sctp_inpcb *inp, struct sctp_nets **netp, struct sockaddr *init_src, int *notification, @@ -2102,7 +2111,7 @@ sctp_process_cookie_new(struct mbuf *m, op_err = sctp_generate_invmanparam(SCTP_CAUSE_OUT_OF_RESC); sctp_abort_association(inp, (struct sctp_tcb *)NULL, m, iphlen, - sh, op_err, + src, dst, sh, op_err, use_mflowid, mflowid, vrf_id, port); return (NULL); @@ -2130,7 +2139,7 @@ sctp_process_cookie_new(struct mbuf *m, atomic_add_int(&stcb->asoc.refcnt, 1); op_err = sctp_generate_invmanparam(SCTP_CAUSE_OUT_OF_RESC); sctp_abort_association(inp, (struct sctp_tcb *)NULL, m, iphlen, - sh, op_err, + src, dst, sh, op_err, use_mflowid, mflowid, vrf_id, port); #if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) @@ -2179,8 +2188,8 @@ sctp_process_cookie_new(struct mbuf *m, } /* load all addresses */ if (sctp_load_addresses_from_init(stcb, m, - init_offset + sizeof(struct sctp_init_chunk), initack_offset, sh, - init_src)) { + init_offset + sizeof(struct sctp_init_chunk), initack_offset, + src, dst, init_src)) { atomic_add_int(&stcb->asoc.refcnt, 1); #if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) SCTP_TCB_UNLOCK(stcb); @@ -2376,6 +2385,7 @@ sctp_process_cookie_new(struct mbuf *m, */ static struct mbuf * sctp_handle_cookie_echo(struct mbuf *m, int iphlen, int offset, + struct sockaddr *src, struct sockaddr *dst, struct sctphdr *sh, struct sctp_cookie_echo_chunk *cp, struct sctp_inpcb **inp_p, struct sctp_tcb **stcb, struct sctp_nets **netp, int auth_skipped, uint32_t auth_offset, uint32_t auth_len, @@ -2396,9 +2406,6 @@ sctp_handle_cookie_echo(struct mbuf *m, unsigned int cookie_len; struct timeval now; struct timeval time_expires; - struct sockaddr_storage dest_store; - struct sockaddr *localep_sa = (struct sockaddr *)&dest_store; - struct ip *iph; int notification = 0; struct sctp_nets *netl; int had_a_existing_tcb = 0; @@ -2419,45 +2426,6 @@ sctp_handle_cookie_echo(struct mbuf *m, if (inp_p == NULL) { return (NULL); } - /* First get the destination address setup too. */ - iph = mtod(m, struct ip *); - switch (iph->ip_v) { -#ifdef INET - case IPVERSION: - { - /* its IPv4 */ - struct sockaddr_in *lsin; - - lsin = (struct sockaddr_in *)(localep_sa); - memset(lsin, 0, sizeof(*lsin)); - lsin->sin_family = AF_INET; - lsin->sin_len = sizeof(*lsin); - lsin->sin_port = sh->dest_port; - lsin->sin_addr.s_addr = iph->ip_dst.s_addr; - break; - } -#endif -#ifdef INET6 - case IPV6_VERSION >> 4: - { - /* its IPv6 */ - struct ip6_hdr *ip6; - struct sockaddr_in6 *lsin6; - - lsin6 = (struct sockaddr_in6 *)(localep_sa); - memset(lsin6, 0, sizeof(*lsin6)); - lsin6->sin6_family = AF_INET6; - lsin6->sin6_len = sizeof(struct sockaddr_in6); - ip6 = mtod(m, struct ip6_hdr *); - lsin6->sin6_port = sh->dest_port; - lsin6->sin6_addr = ip6->ip6_dst; - break; - } -#endif - default: - return (NULL); - } - cookie = &cp->cookie; cookie_offset = offset + sizeof(struct sctp_chunkhdr); cookie_len = ntohs(cp->ch.chunk_length); @@ -2608,7 +2576,7 @@ sctp_handle_cookie_echo(struct mbuf *m, if (tim == 0) tim = now.tv_usec - cookie->time_entered.tv_usec; scm->time_usec = htonl(tim); - sctp_send_operr_to(m, sh, cookie->peers_vtag, op_err, + sctp_send_operr_to(src, dst, sh, cookie->peers_vtag, op_err, use_mflowid, mflowid, vrf_id, port); return (NULL); @@ -2652,7 +2620,7 @@ sctp_handle_cookie_echo(struct mbuf *m, } if ((*stcb == NULL) && to) { /* Yep, lets check */ - *stcb = sctp_findassociation_ep_addr(inp_p, to, netp, localep_sa, NULL); + *stcb = sctp_findassociation_ep_addr(inp_p, to, netp, dst, NULL); if (*stcb == NULL) { /* * We should have only got back the same inp. If we @@ -2695,15 +2663,17 @@ sctp_handle_cookie_echo(struct mbuf *m, cookie_len -= SCTP_SIGNATURE_SIZE; if (*stcb == NULL) { /* this is the "normal" case... get a new TCB */ - *stcb = sctp_process_cookie_new(m, iphlen, offset, sh, cookie, - cookie_len, *inp_p, netp, to, ¬ification, + *stcb = sctp_process_cookie_new(m, iphlen, offset, src, dst, sh, + cookie, cookie_len, *inp_p, + netp, to, ¬ification, auth_skipped, auth_offset, auth_len, use_mflowid, mflowid, vrf_id, port); } else { /* this is abnormal... cookie-echo on existing TCB */ had_a_existing_tcb = 1; - *stcb = sctp_process_cookie_existing(m, iphlen, offset, sh, + *stcb = sctp_process_cookie_existing(m, iphlen, offset, + src, dst, sh, cookie, cookie_len, *inp_p, *stcb, netp, to, ¬ification, auth_skipped, auth_offset, auth_len, use_mflowid, mflowid, @@ -2788,7 +2758,7 @@ sctp_handle_cookie_echo(struct mbuf *m, SCTPDBG(SCTP_DEBUG_INPUT1, "process_cookie_new: no room for another socket!\n"); op_err = sctp_generate_invmanparam(SCTP_CAUSE_OUT_OF_RESC); sctp_abort_association(*inp_p, NULL, m, iphlen, - sh, op_err, + src, dst, sh, op_err, use_mflowid, mflowid, vrf_id, port); #if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) @@ -4404,6 +4374,7 @@ __attribute__((noinline)) #endif static struct sctp_tcb * sctp_process_control(struct mbuf *m, int iphlen, int *offset, int length, + struct sockaddr *src, struct sockaddr *dst, struct sctphdr *sh, struct sctp_chunkhdr *ch, struct sctp_inpcb *inp, struct sctp_tcb *stcb, struct sctp_nets **netp, int *fwd_tsn_seen, uint8_t use_mflowid, uint32_t mflowid, @@ -4520,7 +4491,9 @@ __attribute__((noinline)) if (asconf_len < sizeof(struct sctp_asconf_paramhdr)) break; stcb = sctp_findassociation_ep_asconf(m, - *offset, sh, &inp, netp, vrf_id); + *offset, + dst, + sh, &inp, netp, vrf_id); if (stcb != NULL) break; asconf_offset += SCTP_SIZE32(asconf_len); @@ -4562,7 +4535,7 @@ __attribute__((noinline)) } if (stcb == NULL) { /* no association, so it's out of the blue... */ - sctp_handle_ootb(m, iphlen, *offset, sh, inp, + sctp_handle_ootb(m, iphlen, *offset, src, dst, sh, inp, use_mflowid, mflowid, vrf_id, port); *offset = length; @@ -4600,7 +4573,8 @@ __attribute__((noinline)) if (locked_tcb) { SCTP_TCB_UNLOCK(locked_tcb); } - sctp_handle_ootb(m, iphlen, *offset, sh, inp, + sctp_handle_ootb(m, iphlen, *offset, src, dst, + sh, inp, use_mflowid, mflowid, vrf_id, port); return (NULL); @@ -4742,8 +4716,8 @@ process_control_chunks: /* The INIT chunk must be the only chunk. */ if ((num_chunks > 1) || (length - *offset > (int)SCTP_SIZE32(chk_length))) { - sctp_abort_association(inp, stcb, m, - iphlen, sh, NULL, + sctp_abort_association(inp, stcb, m, iphlen, + src, dst, sh, NULL, use_mflowid, mflowid, vrf_id, port); *offset = length; @@ -4754,14 +4728,14 @@ process_control_chunks: struct mbuf *op_err; op_err = sctp_generate_invmanparam(SCTP_CAUSE_OUT_OF_RESC); - sctp_abort_association(inp, stcb, m, - iphlen, sh, op_err, + sctp_abort_association(inp, stcb, m, iphlen, + src, dst, sh, op_err, use_mflowid, mflowid, vrf_id, port); *offset = length; return (NULL); } - sctp_handle_init(m, iphlen, *offset, sh, + sctp_handle_init(m, iphlen, *offset, src, dst, sh, (struct sctp_init_chunk *)ch, inp, stcb, &abort_no_unlock, use_mflowid, mflowid, @@ -4813,7 +4787,8 @@ process_control_chunks: return (NULL); } if ((netp) && (*netp)) { - ret = sctp_handle_init_ack(m, iphlen, *offset, sh, + ret = sctp_handle_init_ack(m, iphlen, *offset, + src, dst, sh, (struct sctp_init_ack_chunk *)ch, stcb, *netp, &abort_no_unlock, @@ -5123,8 +5098,8 @@ process_control_chunks: struct mbuf *op_err; op_err = sctp_generate_invmanparam(SCTP_CAUSE_OUT_OF_RESC); - sctp_abort_association(inp, stcb, m, - iphlen, sh, op_err, + sctp_abort_association(inp, stcb, m, iphlen, + src, dst, sh, op_err, use_mflowid, mflowid, vrf_id, port); } @@ -5151,7 +5126,9 @@ process_control_chunks: if (netp) { ret_buf = sctp_handle_cookie_echo(m, iphlen, - *offset, sh, + *offset, + src, dst, + sh, (struct sctp_cookie_echo_chunk *)ch, &inp, &stcb, netp, auth_skipped, @@ -5314,7 +5291,7 @@ process_control_chunks: __LINE__); } stcb->asoc.overall_error_count = 0; - sctp_handle_asconf(m, *offset, + sctp_handle_asconf(m, *offset, src, (struct sctp_asconf_chunk *)ch, stcb, asconf_cnt == 0); asconf_cnt++; } @@ -5610,8 +5587,9 @@ __attribute__((noinline)) * common input chunk processing (v4 and v6) */ void -sctp_common_input_processing(struct mbuf **mm, int iphlen, int offset, - int length, struct sctphdr *sh, struct sctp_chunkhdr *ch, +sctp_common_input_processing(struct mbuf **mm, int iphlen, int offset, int length, + struct sockaddr *src, struct sockaddr *dst, + struct sctphdr *sh, struct sctp_chunkhdr *ch, struct sctp_inpcb *inp, struct sctp_tcb *stcb, struct sctp_nets *net, uint8_t ecn_bits, uint8_t use_mflowid, uint32_t mflowid, @@ -5650,7 +5628,7 @@ sctp_common_input_processing(struct mbuf * NOT respond to any packet.. its OOTB. */ SCTP_TCB_UNLOCK(stcb); - sctp_handle_ootb(m, iphlen, offset, sh, inp, + sctp_handle_ootb(m, iphlen, offset, src, dst, sh, inp, use_mflowid, mflowid, vrf_id, port); goto out_now; @@ -5659,7 +5637,8 @@ sctp_common_input_processing(struct mbuf if (IS_SCTP_CONTROL(ch)) { /* process the control portion of the SCTP packet */ /* sa_ignore NO_NULL_CHK */ - stcb = sctp_process_control(m, iphlen, &offset, length, sh, ch, + stcb = sctp_process_control(m, iphlen, &offset, length, + src, dst, sh, ch, inp, stcb, &net, &fwd_tsn_seen, use_mflowid, mflowid, vrf_id, port); @@ -5697,7 +5676,7 @@ sctp_common_input_processing(struct mbuf } if (stcb == NULL) { /* out of the blue DATA chunk */ - sctp_handle_ootb(m, iphlen, offset, sh, inp, + sctp_handle_ootb(m, iphlen, offset, src, dst, sh, inp, use_mflowid, mflowid, vrf_id, port); goto out_now; @@ -5767,7 +5746,7 @@ sctp_common_input_processing(struct mbuf /* * We consider OOTB any data sent during asoc setup. */ - sctp_handle_ootb(m, iphlen, offset, sh, inp, + sctp_handle_ootb(m, iphlen, offset, src, dst, sh, inp, use_mflowid, mflowid, vrf_id, port); SCTP_TCB_UNLOCK(stcb); @@ -5788,7 +5767,8 @@ sctp_common_input_processing(struct mbuf break; } /* plow through the data chunks while length > offset */ - retval = sctp_process_data(mm, iphlen, &offset, length, sh, + retval = sctp_process_data(mm, iphlen, &offset, length, + src, dst, sh, inp, stcb, net, &high_tsn, use_mflowid, mflowid, vrf_id, port); @@ -5883,6 +5863,7 @@ sctp_input_with_port(struct mbuf *i_pak, int iphlen; uint32_t vrf_id = 0; uint8_t ecn_bits; + struct sockaddr_in src, dst; struct ip *ip; struct sctphdr *sh; struct sctp_chunkhdr *ch; @@ -5932,18 +5913,27 @@ sctp_input_with_port(struct mbuf *i_pak, SCTP_STAT_INCR(sctps_recvpackets); SCTP_STAT_INCR_COUNTER64(sctps_inpackets); /* Get IP, SCTP, and first chunk header together in the first mbuf. */ - ip = mtod(m, struct ip *); offset = iphlen + sizeof(struct sctphdr) + sizeof(struct sctp_chunkhdr); if (SCTP_BUF_LEN(m) < offset) { - if ((m = m_pullup(m, offset)) == 0) { + if ((m = m_pullup(m, offset)) == NULL) { SCTP_STAT_INCR(sctps_hdrops); return; } - ip = mtod(m, struct ip *); } + ip = mtod(m, struct ip *); sh = (struct sctphdr *)((caddr_t)ip + iphlen); ch = (struct sctp_chunkhdr *)((caddr_t)sh + sizeof(struct sctphdr)); offset -= sizeof(struct sctp_chunkhdr); + memset(&src, 0, sizeof(struct sockaddr_in)); + src.sin_family = AF_INET; + src.sin_len = sizeof(struct sockaddr_in); + src.sin_port = sh->src_port; + src.sin_addr = ip->ip_src; + memset(&dst, 0, sizeof(struct sockaddr_in)); + dst.sin_family = AF_INET; + dst.sin_len = sizeof(struct sockaddr_in); + dst.sin_port = sh->dest_port; + dst.sin_addr = ip->ip_dst; length = ip->ip_len + iphlen; /* Validate mbuf chain length with IP payload length. */ if (SCTP_HEADER_LEN(i_pak) != length) { @@ -5953,10 +5943,10 @@ sctp_input_with_port(struct mbuf *i_pak, goto bad; } /* SCTP does not allow broadcasts or multicasts */ - if (IN_MULTICAST(ntohl(ip->ip_dst.s_addr))) { + if (IN_MULTICAST(ntohl(dst.sin_addr.s_addr))) { goto bad; } - if (SCTP_IS_IT_BROADCAST(ip->ip_dst, m)) { + if (SCTP_IS_IT_BROADCAST(dst.sin_addr, m)) { goto bad; } SCTPDBG(SCTP_DEBUG_INPUT1, @@ -5982,6 +5972,8 @@ sctp_input_with_port(struct mbuf *i_pak, SCTPDBG(SCTP_DEBUG_INPUT1, "Bad CSUM on SCTP packet calc_check:%x check:%x m:%p mlen:%d iphlen:%d\n", calc_check, check, m, length, iphlen); stcb = sctp_findassociation_addr(m, offset, + (struct sockaddr *)&src, + (struct sockaddr *)&dst, sh, ch, &inp, &net, vrf_id); if ((net) && (port)) { if (net->port == 0) { @@ -6013,6 +6005,8 @@ sctp_skip_csum: goto bad; } stcb = sctp_findassociation_addr(m, offset, + (struct sockaddr *)&src, + (struct sockaddr *)&dst, sh, ch, &inp, &net, vrf_id); if ((net) && (port)) { if (net->port == 0) { @@ -6031,7 +6025,9 @@ sctp_skip_csum: if (badport_bandlim(BANDLIM_SCTP_OOTB) < 0) goto bad; if (ch->chunk_type == SCTP_SHUTDOWN_ACK) { - sctp_send_shutdown_complete2(m, sh, + sctp_send_shutdown_complete2((struct sockaddr *)&src, + (struct sockaddr *)&dst, + sh, use_mflowid, mflowid, vrf_id, port); goto bad; @@ -6043,7 +6039,10 @@ sctp_skip_csum: if ((SCTP_BASE_SYSCTL(sctp_blackhole) == 0) || ((SCTP_BASE_SYSCTL(sctp_blackhole) == 1) && (ch->chunk_type != SCTP_INIT))) { - sctp_send_abort(m, iphlen, sh, 0, NULL, + sctp_send_abort(m, iphlen, + (struct sockaddr *)&src, + (struct sockaddr *)&dst, + sh, 0, NULL, use_mflowid, mflowid, vrf_id, port); } @@ -6066,8 +6065,10 @@ sctp_skip_csum: ecn_bits = ip->ip_tos; /* sa_ignore NO_NULL_CHK */ - sctp_common_input_processing(&m, iphlen, offset, length, sh, ch, - inp, stcb, net, ecn_bits, + sctp_common_input_processing(&m, iphlen, offset, length, + (struct sockaddr *)&src, + (struct sockaddr *)&dst, + sh, ch, inp, stcb, net, ecn_bits, use_mflowid, mflowid, vrf_id, port); if (m) { @@ -6119,15 +6120,14 @@ sctp_input(struct mbuf *m, int off) * No flow id built by lower layers fix it so we * create one. */ - ip = mtod(m, struct ip *); - offset = off + sizeof(*sh); + offset = off + sizeof(struct sctphdr); if (SCTP_BUF_LEN(m) < offset) { - if ((m = m_pullup(m, offset)) == 0) { + if ((m = m_pullup(m, offset)) == NULL) { SCTP_STAT_INCR(sctps_hdrops); return; } - ip = mtod(m, struct ip *); } + ip = mtod(m, struct ip *); sh = (struct sctphdr *)((caddr_t)ip + off); tag = htonl(sh->v_tag); flowid = tag ^ ntohs(sh->dest_port) ^ ntohs(sh->src_port); Modified: stable/8/sys/netinet/sctp_input.h ============================================================================== --- stable/8/sys/netinet/sctp_input.h Thu Mar 7 23:18:35 2013 (r247964) +++ stable/8/sys/netinet/sctp_input.h Thu Mar 7 23:23:25 2013 (r247965) @@ -39,6 +39,7 @@ __FBSDID("$FreeBSD$"); #if defined(_KERNEL) || defined(__Userspace__) void sctp_common_input_processing(struct mbuf **, int, int, int, + struct sockaddr *, struct sockaddr *, struct sctphdr *, struct sctp_chunkhdr *, struct sctp_inpcb *, struct sctp_tcb *, struct sctp_nets *, uint8_t, Modified: stable/8/sys/netinet/sctp_os_bsd.h ============================================================================== --- stable/8/sys/netinet/sctp_os_bsd.h Thu Mar 7 23:18:35 2013 (r247964) +++ stable/8/sys/netinet/sctp_os_bsd.h Thu Mar 7 23:23:25 2013 (r247965) @@ -177,18 +177,9 @@ MALLOC_DECLARE(SCTP_M_MCORE); } \ } while (0); \ } -#define SCTPDBG_PKT(level, iph, sh) \ -{ \ - do { \ - if (SCTP_BASE_SYSCTL(sctp_debug_on) & level) { \ - sctp_print_address_pkt(iph, sh); \ - } \ - } while (0); \ -} #else #define SCTPDBG(level, params...) #define SCTPDBG_ADDR(level, addr) *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable@FreeBSD.ORG Thu Mar 7 23:28:09 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 7A01CA3B; Thu, 7 Mar 2013 23:28:09 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 5CE1BA73; Thu, 7 Mar 2013 23:28:09 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r27NS9PN052453; Thu, 7 Mar 2013 23:28:09 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r27NS878052450; Thu, 7 Mar 2013 23:28:08 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201303072328.r27NS878052450@svn.freebsd.org> From: Michael Tuexen Date: Thu, 7 Mar 2013 23:28:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r247966 - in stable/8/sys: netinet netinet6 X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Mar 2013 23:28:09 -0000 Author: tuexen Date: Thu Mar 7 23:28:08 2013 New Revision: 247966 URL: http://svnweb.freebsd.org/changeset/base/247966 Log: MFC r238003,r239091: Move common code parts to sctp_common_input_processing(). Modified: stable/8/sys/netinet/sctp_input.c stable/8/sys/netinet/sctp_input.h stable/8/sys/netinet6/sctp6_usrreq.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/netinet/ (props changed) stable/8/sys/netinet6/ (props changed) Modified: stable/8/sys/netinet/sctp_input.c ============================================================================== --- stable/8/sys/netinet/sctp_input.c Thu Mar 7 23:23:25 2013 (r247965) +++ stable/8/sys/netinet/sctp_input.c Thu Mar 7 23:28:08 2013 (r247966) @@ -5590,26 +5590,141 @@ void sctp_common_input_processing(struct mbuf **mm, int iphlen, int offset, int length, struct sockaddr *src, struct sockaddr *dst, struct sctphdr *sh, struct sctp_chunkhdr *ch, - struct sctp_inpcb *inp, struct sctp_tcb *stcb, - struct sctp_nets *net, uint8_t ecn_bits, +#if !defined(SCTP_WITH_NO_CSUM) + uint8_t compute_crc, +#endif + uint8_t ecn_bits, uint8_t use_mflowid, uint32_t mflowid, uint32_t vrf_id, uint16_t port) { - /* - * Control chunk processing - */ uint32_t high_tsn; int fwd_tsn_seen = 0, data_processed = 0; struct mbuf *m = *mm; int un_sent; int cnt_ctrl_ready = 0; + struct sctp_inpcb *inp = NULL, *inp_decr = NULL; + struct sctp_tcb *stcb = NULL; + struct sctp_nets *net; SCTP_STAT_INCR(sctps_recvdatagrams); #ifdef SCTP_AUDITING_ENABLED sctp_audit_log(0xE0, 1); sctp_auditing(0, inp, stcb, net); #endif +#if !defined(SCTP_WITH_NO_CSUM) + if (compute_crc != 0) { + uint32_t check, calc_check; + check = sh->checksum; + sh->checksum = 0; + calc_check = sctp_calculate_cksum(m, iphlen); + sh->checksum = check; + if (calc_check != check) { + SCTPDBG(SCTP_DEBUG_INPUT1, "Bad CSUM on SCTP packet calc_check:%x check:%x m:%p mlen:%d iphlen:%d\n", + calc_check, check, m, length, iphlen); + stcb = sctp_findassociation_addr(m, offset, src, dst, + sh, ch, &inp, &net, vrf_id); + if ((net != NULL) && (port != 0)) { + if (net->port == 0) { + sctp_pathmtu_adjustment(stcb, net->mtu - sizeof(struct udphdr)); + } + net->port = port; + } + if ((net != NULL) && (use_mflowid != 0)) { + net->flowid = mflowid; +#ifdef INVARIANTS + net->flowidset = 1; +#endif + } + if ((inp != NULL) && (stcb != NULL)) { + sctp_send_packet_dropped(stcb, net, m, length, iphlen, 1); + sctp_chunk_output(inp, stcb, SCTP_OUTPUT_FROM_INPUT_ERROR, SCTP_SO_NOT_LOCKED); + } else if ((inp != NULL) && (stcb == NULL)) { + inp_decr = inp; + } + SCTP_STAT_INCR(sctps_badsum); + SCTP_STAT_INCR_COUNTER32(sctps_checksumerrors); + goto out; + } + } +#endif + /* Destination port of 0 is illegal, based on RFC4960. */ + if (sh->dest_port == 0) { + SCTP_STAT_INCR(sctps_hdrops); + goto out; + } + stcb = sctp_findassociation_addr(m, offset, src, dst, + sh, ch, &inp, &net, vrf_id); + if ((net != NULL) && (port != 0)) { + if (net->port == 0) { + sctp_pathmtu_adjustment(stcb, net->mtu - sizeof(struct udphdr)); + } + net->port = port; + } + if ((net != NULL) && (use_mflowid != 0)) { + net->flowid = mflowid; +#ifdef INVARIANTS + net->flowidset = 1; +#endif + } + if (inp == NULL) { + SCTP_STAT_INCR(sctps_noport); + if (badport_bandlim(BANDLIM_SCTP_OOTB) < 0) { + goto out; + } + if (ch->chunk_type == SCTP_SHUTDOWN_ACK) { + sctp_send_shutdown_complete2(src, dst, sh, + use_mflowid, mflowid, + vrf_id, port); + goto out; + } + if (ch->chunk_type == SCTP_SHUTDOWN_COMPLETE) { + goto out; + } + if (ch->chunk_type != SCTP_ABORT_ASSOCIATION) { + if ((SCTP_BASE_SYSCTL(sctp_blackhole) == 0) || + ((SCTP_BASE_SYSCTL(sctp_blackhole) == 1) && + (ch->chunk_type != SCTP_INIT))) { + sctp_send_abort(m, iphlen, src, dst, + sh, 0, NULL, + use_mflowid, mflowid, + vrf_id, port); + } + } + goto out; + } else if (stcb == NULL) { + inp_decr = inp; + } +#ifdef IPSEC + /*- + * I very much doubt any of the IPSEC stuff will work but I have no + * idea, so I will leave it in place. + */ + if (inp != NULL) { + switch (dst->sa_family) { +#ifdef INET + case AF_INET: + if (ipsec4_in_reject(m, &inp->ip_inp.inp)) { + MODULE_GLOBAL(ipsec4stat).in_polvio++; + SCTP_STAT_INCR(sctps_hdrops); + goto out; + } + break; +#endif +#ifdef INET6 + case AF_INET6: + if (ipsec6_in_reject(m, &inp->ip_inp.inp)) { + MODULE_GLOBAL(ipsec6stat).in_polvio++; + SCTP_STAT_INCR(sctps_hdrops); + goto out; + } + break; +#endif + default: + break; + } + } +#endif SCTPDBG(SCTP_DEBUG_INPUT1, "Ok, Common input processing called, m:%p iphlen:%d offset:%d length:%d stcb:%p\n", m, iphlen, offset, length, stcb); if (stcb) { @@ -5628,10 +5743,11 @@ sctp_common_input_processing(struct mbuf * NOT respond to any packet.. its OOTB. */ SCTP_TCB_UNLOCK(stcb); + stcb = NULL; sctp_handle_ootb(m, iphlen, offset, src, dst, sh, inp, use_mflowid, mflowid, vrf_id, port); - goto out_now; + goto out; } } if (IS_SCTP_CONTROL(ch)) { @@ -5671,21 +5787,19 @@ sctp_common_input_processing(struct mbuf sctp_auth_is_required_chunk(SCTP_DATA, stcb->asoc.local_auth_chunks)) { /* "silently" ignore */ SCTP_STAT_INCR(sctps_recvauthmissing); - SCTP_TCB_UNLOCK(stcb); - goto out_now; + goto out; } if (stcb == NULL) { /* out of the blue DATA chunk */ sctp_handle_ootb(m, iphlen, offset, src, dst, sh, inp, use_mflowid, mflowid, vrf_id, port); - goto out_now; + goto out; } if (stcb->asoc.my_vtag != ntohl(sh->v_tag)) { /* v_tag mismatch! */ SCTP_STAT_INCR(sctps_badvtag); - SCTP_TCB_UNLOCK(stcb); - goto out_now; + goto out; } } @@ -5695,7 +5809,7 @@ sctp_common_input_processing(struct mbuf * packet while processing control, or we're done with this * packet (done or skip rest of data), so we drop it... */ - goto out_now; + goto out; } /* * DATA chunk processing @@ -5749,8 +5863,7 @@ sctp_common_input_processing(struct mbuf sctp_handle_ootb(m, iphlen, offset, src, dst, sh, inp, use_mflowid, mflowid, vrf_id, port); - SCTP_TCB_UNLOCK(stcb); - goto out_now; + goto out; /* sa_ignore NOTREACHED */ break; case SCTP_STATE_EMPTY: /* should not happen */ @@ -5758,8 +5871,7 @@ sctp_common_input_processing(struct mbuf case SCTP_STATE_SHUTDOWN_RECEIVED: /* This is a peer error */ case SCTP_STATE_SHUTDOWN_ACK_SENT: default: - SCTP_TCB_UNLOCK(stcb); - goto out_now; + goto out; /* sa_ignore NOTREACHED */ break; case SCTP_STATE_OPEN: @@ -5777,7 +5889,8 @@ sctp_common_input_processing(struct mbuf * The association aborted, NO UNLOCK needed since * the association is destroyed. */ - goto out_now; + stcb = NULL; + goto out; } data_processed = 1; /* @@ -5834,10 +5947,20 @@ trigger_send: sctp_audit_log(0xE0, 3); sctp_auditing(2, inp, stcb, net); #endif - SCTP_TCB_UNLOCK(stcb); -out_now: +out: + if (stcb != NULL) { + SCTP_TCB_UNLOCK(stcb); + } + if (inp_decr != NULL) { + /* reduce ref-count */ + SCTP_INP_WLOCK(inp_decr); + SCTP_INP_DECR_REF(inp_decr); + SCTP_INP_WUNLOCK(inp_decr); + } #ifdef INVARIANTS - sctp_validate_no_locks(inp); + if (inp != NULL) { + sctp_validate_no_locks(inp); + } #endif return; } @@ -5867,18 +5990,14 @@ sctp_input_with_port(struct mbuf *i_pak, struct ip *ip; struct sctphdr *sh; struct sctp_chunkhdr *ch; - struct sctp_inpcb *inp = NULL; - struct sctp_tcb *stcb = NULL; - struct sctp_nets *net = NULL; - int refcount_up = 0; int length, offset; - uint32_t mflowid; - uint8_t use_mflowid; #if !defined(SCTP_WITH_NO_CSUM) - uint32_t check, calc_check; + uint8_t compute_crc; #endif + uint32_t mflowid; + uint8_t use_mflowid; iphlen = off; if (SCTP_GET_PKT_VRFID(i_pak, vrf_id)) { @@ -5903,6 +6022,11 @@ sctp_input_with_port(struct mbuf *i_pak, sctp_packet_log(m); } #endif + SCTPDBG(SCTP_DEBUG_CRCOFFLOAD, + "sctp_input(): Packet of length %d received on %s with csum_flags 0x%x.\n", + m->m_pkthdr.len, + if_name(m->m_pkthdr.rcvif), + m->m_pkthdr.csum_flags); if (m->m_flags & M_FLOWID) { mflowid = m->m_pkthdr.flowid; use_mflowid = 1; @@ -5936,161 +6060,42 @@ sctp_input_with_port(struct mbuf *i_pak, dst.sin_addr = ip->ip_dst; length = ip->ip_len + iphlen; /* Validate mbuf chain length with IP payload length. */ - if (SCTP_HEADER_LEN(i_pak) != length) { + if (SCTP_HEADER_LEN(m) != length) { SCTPDBG(SCTP_DEBUG_INPUT1, - "sctp_input() length:%d reported length:%d\n", length, SCTP_HEADER_LEN(i_pak)); + "sctp_input() length:%d reported length:%d\n", length, SCTP_HEADER_LEN(m)); SCTP_STAT_INCR(sctps_hdrops); - goto bad; + goto out; } /* SCTP does not allow broadcasts or multicasts */ if (IN_MULTICAST(ntohl(dst.sin_addr.s_addr))) { - goto bad; + goto out; } if (SCTP_IS_IT_BROADCAST(dst.sin_addr, m)) { - goto bad; + goto out; } - SCTPDBG(SCTP_DEBUG_INPUT1, - "sctp_input() length:%d iphlen:%d\n", length, iphlen); - SCTPDBG(SCTP_DEBUG_CRCOFFLOAD, - "sctp_input(): Packet of length %d received on %s with csum_flags 0x%x.\n", - m->m_pkthdr.len, - if_name(m->m_pkthdr.rcvif), - m->m_pkthdr.csum_flags); + ecn_bits = ip->ip_tos; #if defined(SCTP_WITH_NO_CSUM) SCTP_STAT_INCR(sctps_recvnocrc); #else if (m->m_pkthdr.csum_flags & CSUM_SCTP_VALID) { SCTP_STAT_INCR(sctps_recvhwcrc); - goto sctp_skip_csum; - } - check = sh->checksum; - sh->checksum = 0; - calc_check = sctp_calculate_cksum(m, iphlen); - sh->checksum = check; - SCTP_STAT_INCR(sctps_recvswcrc); - if (calc_check != check) { - SCTPDBG(SCTP_DEBUG_INPUT1, "Bad CSUM on SCTP packet calc_check:%x check:%x m:%p mlen:%d iphlen:%d\n", - calc_check, check, m, length, iphlen); - stcb = sctp_findassociation_addr(m, offset, - (struct sockaddr *)&src, - (struct sockaddr *)&dst, - sh, ch, &inp, &net, vrf_id); - if ((net) && (port)) { - if (net->port == 0) { - sctp_pathmtu_adjustment(stcb, net->mtu - sizeof(struct udphdr)); - } - net->port = port; - } - if ((net != NULL) && (use_mflowid != 0)) { - net->flowid = mflowid; -#ifdef INVARIANTS - net->flowidset = 1; -#endif - } - if ((inp) && (stcb)) { - sctp_send_packet_dropped(stcb, net, m, length, iphlen, 1); - sctp_chunk_output(inp, stcb, SCTP_OUTPUT_FROM_INPUT_ERROR, SCTP_SO_NOT_LOCKED); - } else if ((inp != NULL) && (stcb == NULL)) { - refcount_up = 1; - } - SCTP_STAT_INCR(sctps_badsum); - SCTP_STAT_INCR_COUNTER32(sctps_checksumerrors); - goto bad; - } -sctp_skip_csum: -#endif - /* destination port of 0 is illegal, based on RFC2960. */ - if (sh->dest_port == 0) { - SCTP_STAT_INCR(sctps_hdrops); - goto bad; - } - stcb = sctp_findassociation_addr(m, offset, - (struct sockaddr *)&src, - (struct sockaddr *)&dst, - sh, ch, &inp, &net, vrf_id); - if ((net) && (port)) { - if (net->port == 0) { - sctp_pathmtu_adjustment(stcb, net->mtu - sizeof(struct udphdr)); - } - net->port = port; - } - if ((net != NULL) && (use_mflowid != 0)) { - net->flowid = mflowid; -#ifdef INVARIANTS - net->flowidset = 1; -#endif - } - if (inp == NULL) { - SCTP_STAT_INCR(sctps_noport); - if (badport_bandlim(BANDLIM_SCTP_OOTB) < 0) - goto bad; - if (ch->chunk_type == SCTP_SHUTDOWN_ACK) { - sctp_send_shutdown_complete2((struct sockaddr *)&src, - (struct sockaddr *)&dst, - sh, - use_mflowid, mflowid, - vrf_id, port); - goto bad; - } - if (ch->chunk_type == SCTP_SHUTDOWN_COMPLETE) { - goto bad; - } - if (ch->chunk_type != SCTP_ABORT_ASSOCIATION) { - if ((SCTP_BASE_SYSCTL(sctp_blackhole) == 0) || - ((SCTP_BASE_SYSCTL(sctp_blackhole) == 1) && - (ch->chunk_type != SCTP_INIT))) { - sctp_send_abort(m, iphlen, - (struct sockaddr *)&src, - (struct sockaddr *)&dst, - sh, 0, NULL, - use_mflowid, mflowid, - vrf_id, port); - } - } - goto bad; - } else if (stcb == NULL) { - refcount_up = 1; - } -#ifdef IPSEC - /*- - * I very much doubt any of the IPSEC stuff will work but I have no - * idea, so I will leave it in place. - */ - if (inp && ipsec4_in_reject(m, &inp->ip_inp.inp)) { - MODULE_GLOBAL(ipsec4stat).in_polvio++; - SCTP_STAT_INCR(sctps_hdrops); - goto bad; + compute_crc = 0; + } else { + SCTP_STAT_INCR(sctps_recvswcrc); + compute_crc = 1; } #endif - - ecn_bits = ip->ip_tos; - /* sa_ignore NO_NULL_CHK */ sctp_common_input_processing(&m, iphlen, offset, length, (struct sockaddr *)&src, (struct sockaddr *)&dst, - sh, ch, inp, stcb, net, ecn_bits, + sh, ch, +#if !defined(SCTP_WITH_NO_CSUM) + compute_crc, +#endif + ecn_bits, use_mflowid, mflowid, vrf_id, port); - if (m) { - sctp_m_freem(m); - } - if ((inp) && (refcount_up)) { - /* reduce ref-count */ - SCTP_INP_WLOCK(inp); - SCTP_INP_DECR_REF(inp); - SCTP_INP_WUNLOCK(inp); - } - return; -bad: - if (stcb) { - SCTP_TCB_UNLOCK(stcb); - } - if ((inp) && (refcount_up)) { - /* reduce ref-count */ - SCTP_INP_WLOCK(inp); - SCTP_INP_DECR_REF(inp); - SCTP_INP_WUNLOCK(inp); - } +out: if (m) { sctp_m_freem(m); } Modified: stable/8/sys/netinet/sctp_input.h ============================================================================== --- stable/8/sys/netinet/sctp_input.h Thu Mar 7 23:23:25 2013 (r247965) +++ stable/8/sys/netinet/sctp_input.h Thu Mar 7 23:28:08 2013 (r247966) @@ -41,8 +41,10 @@ void sctp_common_input_processing(struct mbuf **, int, int, int, struct sockaddr *, struct sockaddr *, struct sctphdr *, struct sctp_chunkhdr *, - struct sctp_inpcb *, struct sctp_tcb *, - struct sctp_nets *, uint8_t, +#if !defined(SCTP_WITH_NO_CSUM) + uint8_t, +#endif + uint8_t, uint8_t, uint32_t, uint32_t, uint16_t); Modified: stable/8/sys/netinet6/sctp6_usrreq.c ============================================================================== --- stable/8/sys/netinet6/sctp6_usrreq.c Thu Mar 7 23:23:25 2013 (r247965) +++ stable/8/sys/netinet6/sctp6_usrreq.c Thu Mar 7 23:28:08 2013 (r247966) @@ -69,24 +69,20 @@ sctp6_input(struct mbuf **i_pak, int *of { struct mbuf *m; int iphlen; - uint32_t vrf_id = 0; + uint32_t vrf_id; uint8_t ecn_bits; struct sockaddr_in6 src, dst; struct ip6_hdr *ip6; struct sctphdr *sh; struct sctp_chunkhdr *ch; - struct sctp_inpcb *inp = NULL; - struct sctp_tcb *stcb = NULL; - struct sctp_nets *net = NULL; - int refcount_up = 0; int length, offset; - uint32_t mflowid; - uint8_t use_mflowid; #if !defined(SCTP_WITH_NO_CSUM) - uint32_t check, calc_check; + uint8_t compute_crc; #endif + uint32_t mflowid; + uint8_t use_mflowid; uint16_t port = 0; iphlen = *offp; @@ -112,6 +108,11 @@ sctp6_input(struct mbuf **i_pak, int *of sctp_packet_log(m); } #endif + SCTPDBG(SCTP_DEBUG_CRCOFFLOAD, + "sctp6_input(): Packet of length %d received on %s with csum_flags 0x%x.\n", + m->m_pkthdr.len, + if_name(m->m_pkthdr.rcvif), + m->m_pkthdr.csum_flags); if (m->m_flags & M_FLOWID) { mflowid = m->m_pkthdr.flowid; use_mflowid = 1; @@ -122,8 +123,8 @@ sctp6_input(struct mbuf **i_pak, int *of SCTP_STAT_INCR(sctps_recvpackets); SCTP_STAT_INCR_COUNTER64(sctps_inpackets); /* Get IP, SCTP, and first chunk header together in the first mbuf. */ - ip6 = mtod(m, struct ip6_hdr *); offset = iphlen + sizeof(struct sctphdr) + sizeof(struct sctp_chunkhdr); + ip6 = mtod(m, struct ip6_hdr *); IP6_EXTHDR_GET(sh, struct sctphdr *, m, iphlen, (int)(sizeof(struct sctphdr) + sizeof(struct sctp_chunkhdr))); if (sh == NULL) { @@ -138,7 +139,7 @@ sctp6_input(struct mbuf **i_pak, int *of src.sin6_port = sh->src_port; src.sin6_addr = ip6->ip6_src; if (in6_setscope(&src.sin6_addr, m->m_pkthdr.rcvif, NULL) != 0) { - goto bad; + goto out; } memset(&dst, 0, sizeof(struct sockaddr_in6)); dst.sin6_family = AF_INET6; @@ -146,165 +147,46 @@ sctp6_input(struct mbuf **i_pak, int *of dst.sin6_port = sh->dest_port; dst.sin6_addr = ip6->ip6_dst; if (in6_setscope(&dst.sin6_addr, m->m_pkthdr.rcvif, NULL) != 0) { - goto bad; + goto out; } if (faithprefix_p != NULL && (*faithprefix_p) (&dst.sin6_addr)) { /* XXX send icmp6 host/port unreach? */ - goto bad; + goto out; } length = ntohs(ip6->ip6_plen) + iphlen; /* Validate mbuf chain length with IP payload length. */ - if (SCTP_HEADER_LEN(*i_pak) != length) { + if (SCTP_HEADER_LEN(m) != length) { SCTPDBG(SCTP_DEBUG_INPUT1, - "sctp6_input() length:%d reported length:%d\n", length, SCTP_HEADER_LEN(*i_pak)); + "sctp6_input() length:%d reported length:%d\n", length, SCTP_HEADER_LEN(m)); SCTP_STAT_INCR(sctps_hdrops); - goto bad; + goto out; } if (IN6_IS_ADDR_MULTICAST(&ip6->ip6_dst)) { - goto bad; + goto out; } - SCTPDBG(SCTP_DEBUG_INPUT1, - "sctp6_input() length:%d iphlen:%d\n", length, iphlen); - SCTPDBG(SCTP_DEBUG_CRCOFFLOAD, - "sctp6_input(): Packet of length %d received on %s with csum_flags 0x%x.\n", - m->m_pkthdr.len, - if_name(m->m_pkthdr.rcvif), - m->m_pkthdr.csum_flags); + ecn_bits = ((ntohl(ip6->ip6_flow) >> 20) & 0x000000ff); #if defined(SCTP_WITH_NO_CSUM) SCTP_STAT_INCR(sctps_recvnocrc); #else if (m->m_pkthdr.csum_flags & CSUM_SCTP_VALID) { SCTP_STAT_INCR(sctps_recvhwcrc); - goto sctp_skip_csum; - } - check = sh->checksum; - sh->checksum = 0; - calc_check = sctp_calculate_cksum(m, iphlen); - sh->checksum = check; - SCTP_STAT_INCR(sctps_recvswcrc); - if (calc_check != check) { - SCTPDBG(SCTP_DEBUG_INPUT1, "Bad CSUM on SCTP packet calc_check:%x check:%x m:%p mlen:%d iphlen:%d\n", - calc_check, check, m, length, iphlen); - stcb = sctp_findassociation_addr(m, offset, - (struct sockaddr *)&src, - (struct sockaddr *)&dst, - sh, ch, &inp, &net, vrf_id); - if ((net) && (port)) { - if (net->port == 0) { - sctp_pathmtu_adjustment(stcb, net->mtu - sizeof(struct udphdr)); - } - net->port = port; - } - if ((net != NULL) && (use_mflowid != 0)) { - net->flowid = mflowid; -#ifdef INVARIANTS - net->flowidset = 1; -#endif - } - if ((inp) && (stcb)) { - sctp_send_packet_dropped(stcb, net, m, length, iphlen, 1); - sctp_chunk_output(inp, stcb, SCTP_OUTPUT_FROM_INPUT_ERROR, SCTP_SO_NOT_LOCKED); - } else if ((inp != NULL) && (stcb == NULL)) { - refcount_up = 1; - } - SCTP_STAT_INCR(sctps_badsum); - SCTP_STAT_INCR_COUNTER32(sctps_checksumerrors); - goto bad; - } -sctp_skip_csum: -#endif - /* destination port of 0 is illegal, based on RFC2960. */ - if (sh->dest_port == 0) { - SCTP_STAT_INCR(sctps_hdrops); - goto bad; - } - stcb = sctp_findassociation_addr(m, offset, - (struct sockaddr *)&src, - (struct sockaddr *)&dst, - sh, ch, &inp, &net, vrf_id); - if ((net) && (port)) { - if (net->port == 0) { - sctp_pathmtu_adjustment(stcb, net->mtu - sizeof(struct udphdr)); - } - net->port = port; - } - if ((net != NULL) && (use_mflowid != 0)) { - net->flowid = mflowid; -#ifdef INVARIANTS - net->flowidset = 1; -#endif - } - if (inp == NULL) { - SCTP_STAT_INCR(sctps_noport); - if (badport_bandlim(BANDLIM_SCTP_OOTB) < 0) - goto bad; - if (ch->chunk_type == SCTP_SHUTDOWN_ACK) { - sctp_send_shutdown_complete2((struct sockaddr *)&src, - (struct sockaddr *)&dst, - sh, - use_mflowid, mflowid, - vrf_id, port); - goto bad; - } - if (ch->chunk_type == SCTP_SHUTDOWN_COMPLETE) { - goto bad; - } - if (ch->chunk_type != SCTP_ABORT_ASSOCIATION) { - if ((SCTP_BASE_SYSCTL(sctp_blackhole) == 0) || - ((SCTP_BASE_SYSCTL(sctp_blackhole) == 1) && - (ch->chunk_type != SCTP_INIT))) { - sctp_send_abort(m, iphlen, - (struct sockaddr *)&src, - (struct sockaddr *)&dst, - sh, 0, NULL, - use_mflowid, mflowid, - vrf_id, port); - } - } - goto bad; - } else if (stcb == NULL) { - refcount_up = 1; - } -#ifdef IPSEC - /*- - * I very much doubt any of the IPSEC stuff will work but I have no - * idea, so I will leave it in place. - */ - if (inp && ipsec6_in_reject(m, &inp->ip_inp.inp)) { - MODULE_GLOBAL(ipsec6stat).in_polvio++; - SCTP_STAT_INCR(sctps_hdrops); - goto bad; + compute_crc = 0; + } else { + SCTP_STAT_INCR(sctps_recvswcrc); + compute_crc = 1; } #endif - - ecn_bits = ((ntohl(ip6->ip6_flow) >> 20) & 0x000000ff); - /* sa_ignore NO_NULL_CHK */ sctp_common_input_processing(&m, iphlen, offset, length, (struct sockaddr *)&src, (struct sockaddr *)&dst, - sh, ch, inp, stcb, net, ecn_bits, + sh, ch, +#if !defined(SCTP_WITH_NO_CSUM) + compute_crc, +#endif + ecn_bits, use_mflowid, mflowid, vrf_id, port); - if (m) { - sctp_m_freem(m); - } - if ((inp) && (refcount_up)) { - /* reduce ref-count */ - SCTP_INP_WLOCK(inp); - SCTP_INP_DECR_REF(inp); - SCTP_INP_WUNLOCK(inp); - } - return (IPPROTO_DONE); -bad: - if (stcb) { - SCTP_TCB_UNLOCK(stcb); - } - if ((inp) && (refcount_up)) { - /* reduce ref-count */ - SCTP_INP_WLOCK(inp); - SCTP_INP_DECR_REF(inp); - SCTP_INP_WUNLOCK(inp); - } +out: if (m) { sctp_m_freem(m); } From owner-svn-src-stable@FreeBSD.ORG Thu Mar 7 23:31:33 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 365D9C19; Thu, 7 Mar 2013 23:31:33 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 1DC01A8C; Thu, 7 Mar 2013 23:31:33 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r27NVWmH054576; Thu, 7 Mar 2013 23:31:33 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r27NVWXJ054575; Thu, 7 Mar 2013 23:31:32 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201303072331.r27NVWXJ054575@svn.freebsd.org> From: Michael Tuexen Date: Thu, 7 Mar 2013 23:31:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r247967 - stable/8/sys/netinet X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Mar 2013 23:31:33 -0000 Author: tuexen Date: Thu Mar 7 23:31:32 2013 New Revision: 247967 URL: http://svnweb.freebsd.org/changeset/base/247967 Log: MFC r238087: Iniitialize a variable. Modified: stable/8/sys/netinet/sctp_input.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/netinet/ (props changed) Modified: stable/8/sys/netinet/sctp_input.c ============================================================================== --- stable/8/sys/netinet/sctp_input.c Thu Mar 7 23:28:08 2013 (r247966) +++ stable/8/sys/netinet/sctp_input.c Thu Mar 7 23:31:32 2013 (r247967) @@ -5604,7 +5604,7 @@ sctp_common_input_processing(struct mbuf int cnt_ctrl_ready = 0; struct sctp_inpcb *inp = NULL, *inp_decr = NULL; struct sctp_tcb *stcb = NULL; - struct sctp_nets *net; + struct sctp_nets *net = NULL; SCTP_STAT_INCR(sctps_recvdatagrams); #ifdef SCTP_AUDITING_ENABLED From owner-svn-src-stable@FreeBSD.ORG Thu Mar 7 23:35:07 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 755C0DB8; Thu, 7 Mar 2013 23:35:07 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 5D103AA2; Thu, 7 Mar 2013 23:35:07 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r27NZ7jd055132; Thu, 7 Mar 2013 23:35:07 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r27NZ7At055131; Thu, 7 Mar 2013 23:35:07 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201303072335.r27NZ7At055131@svn.freebsd.org> From: Michael Tuexen Date: Thu, 7 Mar 2013 23:35:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r247968 - stable/8/sys/netinet X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Mar 2013 23:35:07 -0000 Author: tuexen Date: Thu Mar 7 23:35:06 2013 New Revision: 247968 URL: http://svnweb.freebsd.org/changeset/base/247968 Log: MFC r238122: Use consistent method to determine IPV4_OUTPUT/IPV6_OUTPUT. Modified: stable/8/sys/netinet/sctp_output.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/netinet/ (props changed) Modified: stable/8/sys/netinet/sctp_output.c ============================================================================== --- stable/8/sys/netinet/sctp_output.c Thu Mar 7 23:31:32 2013 (r247967) +++ stable/8/sys/netinet/sctp_output.c Thu Mar 7 23:35:06 2013 (r247968) @@ -10977,8 +10977,9 @@ sctp_send_resp_msg(struct sockaddr *src, return; } SCTP_ATTACH_CHAIN(o_pak, mout, len); + switch (dst->sa_family) { #ifdef INET - if (ip != NULL) { + case AF_INET: if (port) { if (V_udp_cksum) { udp->uh_sum = in_pseudo(ip->ip_src.s_addr, ip->ip_dst.s_addr, udp->uh_ulen + htons(IPPROTO_UDP)); @@ -11012,10 +11013,10 @@ sctp_send_resp_msg(struct sockaddr *src, } #endif SCTP_IP_OUTPUT(ret, o_pak, NULL, NULL, vrf_id); - } + break; #endif #ifdef INET6 - if (ip6 != NULL) { + case AF_INET6: ip6->ip6_plen = len - sizeof(struct ip6_hdr); if (port) { #if defined(SCTP_WITH_NO_CSUM) @@ -11042,8 +11043,15 @@ sctp_send_resp_msg(struct sockaddr *src, } #endif SCTP_IP6_OUTPUT(ret, o_pak, NULL, NULL, NULL, vrf_id); - } + break; #endif + default: + SCTPDBG(SCTP_DEBUG_OUTPUT1, "Unknown protocol (TSNH) type %d\n", + dst->sa_family); + sctp_m_freem(mout); + SCTP_LTRACE_ERR_RET_PKT(mout, NULL, NULL, NULL, SCTP_FROM_SCTP_OUTPUT, EFAULT); + return; + } SCTP_STAT_INCR(sctps_sendpackets); SCTP_STAT_INCR_COUNTER64(sctps_outpackets); SCTP_STAT_INCR_COUNTER64(sctps_outcontrolchunks); From owner-svn-src-stable@FreeBSD.ORG Thu Mar 7 23:37:54 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 6C2FF1A7; Thu, 7 Mar 2013 23:37:54 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 463E0AC5; Thu, 7 Mar 2013 23:37:54 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r27NbsW1055641; Thu, 7 Mar 2013 23:37:54 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r27NbsrU055640; Thu, 7 Mar 2013 23:37:54 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201303072337.r27NbsrU055640@svn.freebsd.org> From: Michael Tuexen Date: Thu, 7 Mar 2013 23:37:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r247970 - stable/8/sys/netinet X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Mar 2013 23:37:54 -0000 Author: tuexen Date: Thu Mar 7 23:37:53 2013 New Revision: 247970 URL: http://svnweb.freebsd.org/changeset/base/247970 Log: MFC r238454: Bugfix: Send up a COMM UP notification for active 1-to-1 style sockets also in the case where the assoc comes up due to a remotely started handshake (collision case). Modified: stable/8/sys/netinet/sctp_input.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/netinet/ (props changed) Modified: stable/8/sys/netinet/sctp_input.c ============================================================================== --- stable/8/sys/netinet/sctp_input.c Thu Mar 7 23:37:10 2013 (r247969) +++ stable/8/sys/netinet/sctp_input.c Thu Mar 7 23:37:53 2013 (r247970) @@ -2874,14 +2874,12 @@ sctp_handle_cookie_echo(struct mbuf *m, return (m); } } - if ((*inp_p)->sctp_flags & SCTP_PCB_FLAGS_UDPTYPE) { - if (notification) { - sctp_ulp_notify(notification, *stcb, 0, NULL, SCTP_SO_NOT_LOCKED); - } - if (send_int_conf) { - sctp_ulp_notify(SCTP_NOTIFY_INTERFACE_CONFIRMED, - (*stcb), 0, (void *)netl, SCTP_SO_NOT_LOCKED); - } + if (notification) { + sctp_ulp_notify(notification, *stcb, 0, NULL, SCTP_SO_NOT_LOCKED); + } + if (send_int_conf) { + sctp_ulp_notify(SCTP_NOTIFY_INTERFACE_CONFIRMED, + (*stcb), 0, (void *)netl, SCTP_SO_NOT_LOCKED); } return (m); } From owner-svn-src-stable@FreeBSD.ORG Thu Mar 7 23:39:59 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id A77C0360; Thu, 7 Mar 2013 23:39:59 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 90E5CADC; Thu, 7 Mar 2013 23:39:59 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r27Ndxp9055967; Thu, 7 Mar 2013 23:39:59 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r27Ndxd0055966; Thu, 7 Mar 2013 23:39:59 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201303072339.r27Ndxd0055966@svn.freebsd.org> From: Michael Tuexen Date: Thu, 7 Mar 2013 23:39:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r247971 - stable/8/sys/netinet X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Mar 2013 23:39:59 -0000 Author: tuexen Date: Thu Mar 7 23:39:59 2013 New Revision: 247971 URL: http://svnweb.freebsd.org/changeset/base/247971 Log: MFC r238455: Use case for selecting the address family (as in other places). Modified: stable/8/sys/netinet/sctp_pcb.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/netinet/ (props changed) Modified: stable/8/sys/netinet/sctp_pcb.c ============================================================================== --- stable/8/sys/netinet/sctp_pcb.c Thu Mar 7 23:37:53 2013 (r247970) +++ stable/8/sys/netinet/sctp_pcb.c Thu Mar 7 23:39:59 2013 (r247971) @@ -1203,11 +1203,18 @@ sctp_findassociation_ep_addr(struct sctp uint16_t rport; inp = *inp_p; - if (remote->sa_family == AF_INET) { + switch (remote->sa_family) { +#ifdef INET + case AF_INET: rport = (((struct sockaddr_in *)remote)->sin_port); - } else if (remote->sa_family == AF_INET6) { + break; +#endif +#ifdef INET6 + case AF_INET6: rport = (((struct sockaddr_in6 *)remote)->sin6_port); - } else { + break; +#endif + default: return (NULL); } if (locked_tcb) { From owner-svn-src-stable@FreeBSD.ORG Thu Mar 7 23:41:58 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 5CAB25AF; Thu, 7 Mar 2013 23:41:58 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 4EC09AF0; Thu, 7 Mar 2013 23:41:58 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r27NfwEJ057859; Thu, 7 Mar 2013 23:41:58 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r27NfwcJ057858; Thu, 7 Mar 2013 23:41:58 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201303072341.r27NfwcJ057858@svn.freebsd.org> From: Michael Tuexen Date: Thu, 7 Mar 2013 23:41:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r247972 - stable/8/sys/netinet X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Mar 2013 23:41:58 -0000 Author: tuexen Date: Thu Mar 7 23:41:57 2013 New Revision: 247972 URL: http://svnweb.freebsd.org/changeset/base/247972 Log: MFC r238458: Provide the correct notification type (SCTP_SEND_FAILED_EVENT) for unsent messages. Modified: stable/8/sys/netinet/sctputil.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/netinet/ (props changed) Modified: stable/8/sys/netinet/sctputil.c ============================================================================== --- stable/8/sys/netinet/sctputil.c Thu Mar 7 23:39:59 2013 (r247971) +++ stable/8/sys/netinet/sctputil.c Thu Mar 7 23:41:57 2013 (r247972) @@ -2951,7 +2951,7 @@ sctp_notify_send_failed2(struct sctp_tcb SCTP_BUF_LEN(m_notify) = 0; if (sctp_stcb_is_feature_on(stcb->sctp_ep, stcb, SCTP_PCB_FLAGS_RECVNSENDFAILEVNT)) { ssfe = mtod(m_notify, struct sctp_send_failed_event *); - ssfe->ssfe_type = SCTP_SEND_FAILED; + ssfe->ssfe_type = SCTP_SEND_FAILED_EVENT; ssfe->ssfe_flags = SCTP_DATA_UNSENT; ssfe->ssfe_length = length; ssfe->ssfe_error = error; From owner-svn-src-stable@FreeBSD.ORG Thu Mar 7 23:44:04 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id D10F683C; Thu, 7 Mar 2013 23:44:04 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id AEE59B02; Thu, 7 Mar 2013 23:44:04 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r27Ni4CK058289; Thu, 7 Mar 2013 23:44:04 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r27Ni3sa058284; Thu, 7 Mar 2013 23:44:03 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201303072344.r27Ni3sa058284@svn.freebsd.org> From: Michael Tuexen Date: Thu, 7 Mar 2013 23:44:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r247974 - in stable/8/sys: netinet netinet6 X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Mar 2013 23:44:04 -0000 Author: tuexen Date: Thu Mar 7 23:44:02 2013 New Revision: 247974 URL: http://svnweb.freebsd.org/changeset/base/247974 Log: MFC r238475: #ifdef INET and INET6 consistently. This also fixes a bug, where it was done wrong. Modified: stable/8/sys/netinet/sctp_output.c stable/8/sys/netinet/sctp_pcb.c stable/8/sys/netinet/sctp_usrreq.c stable/8/sys/netinet/sctputil.c stable/8/sys/netinet6/sctp6_usrreq.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/netinet/ (props changed) stable/8/sys/netinet6/ (props changed) Modified: stable/8/sys/netinet/sctp_output.c ============================================================================== --- stable/8/sys/netinet/sctp_output.c Thu Mar 7 23:43:03 2013 (r247973) +++ stable/8/sys/netinet/sctp_output.c Thu Mar 7 23:44:02 2013 (r247974) @@ -8437,12 +8437,14 @@ again_one_more_time: } /* now lets add any data within the MTU constraints */ switch (((struct sockaddr *)&net->ro._l_addr)->sa_family) { +#ifdef INET case AF_INET: if (net->mtu > (sizeof(struct ip) + sizeof(struct sctphdr))) omtu = net->mtu - (sizeof(struct ip) + sizeof(struct sctphdr)); else omtu = 0; break; +#endif #ifdef INET6 case AF_INET6: if (net->mtu > (sizeof(struct ip6_hdr) + sizeof(struct sctphdr))) @@ -12170,7 +12172,7 @@ sctp_lower_sosend(struct socket *so, union sctp_sockstore *raddr = (union sctp_sockstore *)addr; switch (raddr->sa.sa_family) { -#if defined(INET) +#ifdef INET case AF_INET: if (raddr->sin.sin_len != sizeof(struct sockaddr_in)) { SCTP_LTRACE_ERR_RET(inp, stcb, net, SCTP_FROM_SCTP_OUTPUT, EINVAL); @@ -12180,7 +12182,7 @@ sctp_lower_sosend(struct socket *so, port = raddr->sin.sin_port; break; #endif -#if defined(INET6) +#ifdef INET6 case AF_INET6: if (raddr->sin6.sin6_len != sizeof(struct sockaddr_in6)) { SCTP_LTRACE_ERR_RET(inp, stcb, net, SCTP_FROM_SCTP_OUTPUT, EINVAL); Modified: stable/8/sys/netinet/sctp_pcb.c ============================================================================== --- stable/8/sys/netinet/sctp_pcb.c Thu Mar 7 23:43:03 2013 (r247973) +++ stable/8/sys/netinet/sctp_pcb.c Thu Mar 7 23:44:02 2013 (r247974) @@ -3013,6 +3013,7 @@ continue_anyway: memset(&store_sa, 0, sizeof(store_sa)); switch (addr->sa_family) { +#ifdef INET case AF_INET: { struct sockaddr_in *sin; @@ -3022,6 +3023,8 @@ continue_anyway: sin->sin_port = 0; break; } +#endif +#ifdef INET6 case AF_INET6: { struct sockaddr_in6 *sin6; @@ -3031,6 +3034,7 @@ continue_anyway: sin6->sin6_port = 0; break; } +#endif default: break; } @@ -5192,12 +5196,16 @@ sctp_destination_is_reachable(struct sct } /* NOTE: all "scope" checks are done when local addresses are added */ switch (destaddr->sa_family) { +#ifdef INET6 case AF_INET6: answer = inp->ip_inp.inp.inp_vflag & INP_IPV6; break; +#endif +#ifdef INET case AF_INET: answer = inp->ip_inp.inp.inp_vflag & INP_IPV4; break; +#endif default: /* invalid family, so it's unreachable */ answer = 0; @@ -5288,7 +5296,7 @@ sctp_add_local_addr_ep(struct sctp_inpcb inp->ip_inp.inp.inp_vflag |= INP_IPV6; break; #endif -#ifdef INET6 +#ifdef INET case AF_INET: inp->ip_inp.inp.inp_vflag |= INP_IPV4; break; Modified: stable/8/sys/netinet/sctp_usrreq.c ============================================================================== --- stable/8/sys/netinet/sctp_usrreq.c Thu Mar 7 23:43:03 2013 (r247973) +++ stable/8/sys/netinet/sctp_usrreq.c Thu Mar 7 23:44:02 2013 (r247974) @@ -38,7 +38,7 @@ __FBSDID("$FreeBSD$"); #include #include #include -#if defined(INET6) +#ifdef INET6 #endif #include #include Modified: stable/8/sys/netinet/sctputil.c ============================================================================== --- stable/8/sys/netinet/sctputil.c Thu Mar 7 23:43:03 2013 (r247973) +++ stable/8/sys/netinet/sctputil.c Thu Mar 7 23:44:02 2013 (r247974) @@ -5637,7 +5637,7 @@ found_one: memcpy(from, &sin6, sizeof(struct sockaddr_in6)); } #endif -#if defined(INET6) +#ifdef INET6 { struct sockaddr_in6 lsa6, *from6; @@ -6534,7 +6534,7 @@ sctp_bindx_delete_address(struct sctp_in return; } addr_touse = sa; -#if defined(INET6) +#ifdef INET6 if (sa->sa_family == AF_INET6) { struct sockaddr_in6 *sin6; Modified: stable/8/sys/netinet6/sctp6_usrreq.c ============================================================================== --- stable/8/sys/netinet6/sctp6_usrreq.c Thu Mar 7 23:43:03 2013 (r247973) +++ stable/8/sys/netinet6/sctp6_usrreq.c Thu Mar 7 23:44:02 2013 (r247974) @@ -38,7 +38,7 @@ __FBSDID("$FreeBSD$"); #include #include #include -#if defined(INET6) +#ifdef INET6 #include #endif #include @@ -57,7 +57,7 @@ __FBSDID("$FreeBSD$"); #ifdef IPSEC #include -#if defined(INET6) +#ifdef INET6 #include #endif /* INET6 */ #endif /* IPSEC */ From owner-svn-src-stable@FreeBSD.ORG Thu Mar 7 23:48:31 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 1FAA5C66; Thu, 7 Mar 2013 23:48:31 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 05382B2D; Thu, 7 Mar 2013 23:48:31 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r27NmUZY059048; Thu, 7 Mar 2013 23:48:30 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r27NmTp1059041; Thu, 7 Mar 2013 23:48:29 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201303072348.r27NmTp1059041@svn.freebsd.org> From: Michael Tuexen Date: Thu, 7 Mar 2013 23:48:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r247977 - in stable/8: sys/netinet sys/netinet6 usr.bin/netstat X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Mar 2013 23:48:31 -0000 Author: tuexen Date: Thu Mar 7 23:48:29 2013 New Revision: 247977 URL: http://svnweb.freebsd.org/changeset/base/247977 Log: MFC r238501,r238514: Changes which improve compilation if neither INET nor INET6 is defined. Modified: stable/8/sys/netinet/sctp_asconf.c stable/8/sys/netinet/sctp_output.c stable/8/sys/netinet/sctp_uio.h stable/8/sys/netinet/sctp_usrreq.c stable/8/sys/netinet6/sctp6_usrreq.c stable/8/usr.bin/netstat/Makefile (contents, props changed) stable/8/usr.bin/netstat/sctp.c (contents, props changed) Directory Properties: stable/8/sys/ (props changed) stable/8/sys/netinet/ (props changed) stable/8/sys/netinet6/ (props changed) stable/8/usr.bin/ (props changed) stable/8/usr.bin/netstat/ (props changed) Modified: stable/8/sys/netinet/sctp_asconf.c ============================================================================== --- stable/8/sys/netinet/sctp_asconf.c Thu Mar 7 23:45:16 2013 (r247976) +++ stable/8/sys/netinet/sctp_asconf.c Thu Mar 7 23:48:29 2013 (r247977) @@ -2747,13 +2747,14 @@ sctp_process_initack_addresses(struct sc struct sctp_paramhdr tmp_param, *ph; uint16_t plen, ptype; struct sctp_ifa *sctp_ifa; - struct sctp_ipv6addr_param addr_store; #ifdef INET6 + struct sctp_ipv6addr_param addr6_store; struct sockaddr_in6 sin6; #endif #ifdef INET + struct sctp_ipv4addr_param addr4_store; struct sockaddr_in sin; #endif @@ -2802,7 +2803,7 @@ sctp_process_initack_addresses(struct sc a6p = (struct sctp_ipv6addr_param *) sctp_m_getptr(m, offset, sizeof(struct sctp_ipv6addr_param), - (uint8_t *) & addr_store); + (uint8_t *) & addr6_store); if (plen != sizeof(struct sctp_ipv6addr_param) || a6p == NULL) { return; @@ -2821,7 +2822,7 @@ sctp_process_initack_addresses(struct sc /* get the entire IPv4 address param */ a4p = (struct sctp_ipv4addr_param *)sctp_m_getptr(m, offset, sizeof(struct sctp_ipv4addr_param), - (uint8_t *) & addr_store); + (uint8_t *) & addr4_store); if (plen != sizeof(struct sctp_ipv4addr_param) || a4p == NULL) { return; @@ -2899,16 +2900,17 @@ sctp_addr_in_initack(struct mbuf *m, uin { struct sctp_paramhdr tmp_param, *ph; uint16_t plen, ptype; - struct sctp_ipv6addr_param addr_store; #ifdef INET struct sockaddr_in *sin; struct sctp_ipv4addr_param *a4p; + struct sctp_ipv6addr_param addr4_store; #endif #ifdef INET6 struct sockaddr_in6 *sin6; struct sctp_ipv6addr_param *a6p; + struct sctp_ipv6addr_param addr6_store; struct sockaddr_in6 sin6_tmp; #endif @@ -2954,7 +2956,7 @@ sctp_addr_in_initack(struct mbuf *m, uin a6p = (struct sctp_ipv6addr_param *) sctp_m_getptr(m, offset, sizeof(struct sctp_ipv6addr_param), - (uint8_t *) & addr_store); + (uint8_t *) & addr6_store); if (a6p == NULL) { return (0); } @@ -2984,7 +2986,7 @@ sctp_addr_in_initack(struct mbuf *m, uin a4p = (struct sctp_ipv4addr_param *) sctp_m_getptr(m, offset, sizeof(struct sctp_ipv4addr_param), - (uint8_t *) & addr_store); + (uint8_t *) & addr4_store); if (a4p == NULL) { return (0); } Modified: stable/8/sys/netinet/sctp_output.c ============================================================================== --- stable/8/sys/netinet/sctp_output.c Thu Mar 7 23:45:16 2013 (r247976) +++ stable/8/sys/netinet/sctp_output.c Thu Mar 7 23:48:29 2013 (r247977) @@ -3799,6 +3799,7 @@ sctp_get_ect(struct sctp_tcb *stcb) } } +#if defined(INET) || defined(INET6) static void sctp_handle_no_route(struct sctp_tcb *stcb, struct sctp_nets *net, @@ -3843,6 +3844,8 @@ sctp_handle_no_route(struct sctp_tcb *st } } +#endif + static int sctp_lowlevel_chunk_output(struct sctp_inpcb *inp, struct sctp_tcb *stcb, /* may be NULL */ @@ -3882,14 +3885,18 @@ sctp_lowlevel_chunk_output(struct sctp_i * interface and smallest_mtu size as well. */ /* Will need ifdefs around this */ - struct mbuf *o_pak; struct mbuf *newm; struct sctphdr *sctphdr; int packet_length; int ret; uint32_t vrf_id; + +#if defined(INET) || defined(INET6) + struct mbuf *o_pak; sctp_route_t *ro = NULL; struct udphdr *udp = NULL; + +#endif uint8_t tos_value; #if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) Modified: stable/8/sys/netinet/sctp_uio.h ============================================================================== --- stable/8/sys/netinet/sctp_uio.h Thu Mar 7 23:45:16 2013 (r247976) +++ stable/8/sys/netinet/sctp_uio.h Thu Mar 7 23:48:29 2013 (r247977) @@ -1124,10 +1124,10 @@ struct sctpstat { #define SCTP_STAT_DECR_GAUGE32(_x) SCTP_STAT_DECR(_x) union sctp_sockstore { -#if defined(INET) || !defined(_KERNEL) +#if defined(INET) struct sockaddr_in sin; #endif -#if defined(INET6) || !defined(_KERNEL) +#if defined(INET6) struct sockaddr_in6 sin6; #endif struct sockaddr sa; Modified: stable/8/sys/netinet/sctp_usrreq.c ============================================================================== --- stable/8/sys/netinet/sctp_usrreq.c Thu Mar 7 23:45:16 2013 (r247976) +++ stable/8/sys/netinet/sctp_usrreq.c Thu Mar 7 23:48:29 2013 (r247977) @@ -5226,7 +5226,6 @@ sctp_setopt(struct socket *so, int optna case SCTP_BINDX_ADD_ADDR: { struct sctp_getaddresses *addrs; - size_t sz; struct thread *td; td = (struct thread *)p; @@ -5234,8 +5233,7 @@ sctp_setopt(struct socket *so, int optna optsize); #ifdef INET if (addrs->addr->sa_family == AF_INET) { - sz = sizeof(struct sctp_getaddresses) - sizeof(struct sockaddr) + sizeof(struct sockaddr_in); - if (optsize < sz) { + if (optsize < sizeof(struct sctp_getaddresses) - sizeof(struct sockaddr) + sizeof(struct sockaddr_in)) { SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL); error = EINVAL; break; @@ -5248,8 +5246,7 @@ sctp_setopt(struct socket *so, int optna #endif #ifdef INET6 if (addrs->addr->sa_family == AF_INET6) { - sz = sizeof(struct sctp_getaddresses) - sizeof(struct sockaddr) + sizeof(struct sockaddr_in6); - if (optsize < sz) { + if (optsize < sizeof(struct sctp_getaddresses) - sizeof(struct sockaddr) + sizeof(struct sockaddr_in6)) { SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL); error = EINVAL; break; @@ -5273,7 +5270,6 @@ sctp_setopt(struct socket *so, int optna case SCTP_BINDX_REM_ADDR: { struct sctp_getaddresses *addrs; - size_t sz; struct thread *td; td = (struct thread *)p; @@ -5281,8 +5277,7 @@ sctp_setopt(struct socket *so, int optna SCTP_CHECK_AND_CAST(addrs, optval, struct sctp_getaddresses, optsize); #ifdef INET if (addrs->addr->sa_family == AF_INET) { - sz = sizeof(struct sctp_getaddresses) - sizeof(struct sockaddr) + sizeof(struct sockaddr_in); - if (optsize < sz) { + if (optsize < sizeof(struct sctp_getaddresses) - sizeof(struct sockaddr) + sizeof(struct sockaddr_in)) { SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL); error = EINVAL; break; @@ -5295,8 +5290,7 @@ sctp_setopt(struct socket *so, int optna #endif #ifdef INET6 if (addrs->addr->sa_family == AF_INET6) { - sz = sizeof(struct sctp_getaddresses) - sizeof(struct sockaddr) + sizeof(struct sockaddr_in6); - if (optsize < sz) { + if (optsize < sizeof(struct sctp_getaddresses) - sizeof(struct sockaddr) + sizeof(struct sockaddr_in6)) { SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL); error = EINVAL; break; Modified: stable/8/sys/netinet6/sctp6_usrreq.c ============================================================================== --- stable/8/sys/netinet6/sctp6_usrreq.c Thu Mar 7 23:45:16 2013 (r247976) +++ stable/8/sys/netinet6/sctp6_usrreq.c Thu Mar 7 23:48:29 2013 (r247977) @@ -34,6 +34,7 @@ __FBSDID("$FreeBSD$"); #include +#ifdef INET6 #include #include #include @@ -1240,3 +1241,5 @@ struct pr_usrreqs sctp6_usrreqs = { .pru_sosend = sctp_sosend, .pru_soreceive = sctp_soreceive }; + +#endif Modified: stable/8/usr.bin/netstat/Makefile ============================================================================== --- stable/8/usr.bin/netstat/Makefile Thu Mar 7 23:45:16 2013 (r247976) +++ stable/8/usr.bin/netstat/Makefile Thu Mar 7 23:48:29 2013 (r247977) @@ -13,6 +13,10 @@ CFLAGS+=-fno-strict-aliasing CFLAGS+=-DIPSEC CFLAGS+=-DSCTP +.if ${MK_INET_SUPPORT} != "no" +CFLAGS+=-DINET +.endif + .if ${MK_INET6_SUPPORT} != "no" SRCS+= inet6.c CFLAGS+=-DINET6 Modified: stable/8/usr.bin/netstat/sctp.c ============================================================================== --- stable/8/usr.bin/netstat/sctp.c Thu Mar 7 23:45:16 2013 (r247976) +++ stable/8/usr.bin/netstat/sctp.c Thu Mar 7 23:48:29 2013 (r247977) @@ -107,6 +107,7 @@ struct xraddr_entry { * If numeric_addr has been supplied, give * numeric value, otherwise try for symbolic name. */ +#ifdef INET static char * inetname(struct in_addr *inp) { @@ -146,6 +147,7 @@ inetname(struct in_addr *inp) } return (line); } +#endif #ifdef INET6 static char ntop_buf[INET6_ADDRSTRLEN]; @@ -197,9 +199,11 @@ sctp_print_address(union sctp_sockstore int width; switch (address->sa.sa_family) { +#ifdef INET case AF_INET: sprintf(line, "%.*s.", Wflag ? 39 : 16, inetname(&address->sin.sin_addr)); break; +#endif #ifdef INET6 case AF_INET6: sprintf(line, "%.*s.", Wflag ? 39 : 16, inet6name(&address->sin6.sin6_addr)); From owner-svn-src-stable@FreeBSD.ORG Thu Mar 7 23:51:08 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 192A4DDE; Thu, 7 Mar 2013 23:51:08 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id CF509B3F; Thu, 7 Mar 2013 23:51:07 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r27Np7kf061012; Thu, 7 Mar 2013 23:51:07 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r27Np7Bu061007; Thu, 7 Mar 2013 23:51:07 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201303072351.r27Np7Bu061007@svn.freebsd.org> From: Michael Tuexen Date: Thu, 7 Mar 2013 23:51:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r247978 - stable/8/sys/netinet X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Mar 2013 23:51:08 -0000 Author: tuexen Date: Thu Mar 7 23:51:07 2013 New Revision: 247978 URL: http://svnweb.freebsd.org/changeset/base/247978 Log: MFC r238550: Fix a refcount bug when freeing an association. While there: Change code to be consistent. Discussed with rrs@. Modified: stable/8/sys/netinet/sctp_pcb.c stable/8/sys/netinet/sctputil.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/netinet/ (props changed) Modified: stable/8/sys/netinet/sctp_pcb.c ============================================================================== --- stable/8/sys/netinet/sctp_pcb.c Thu Mar 7 23:48:29 2013 (r247977) +++ stable/8/sys/netinet/sctp_pcb.c Thu Mar 7 23:51:07 2013 (r247978) @@ -4872,6 +4872,7 @@ sctp_free_assoc(struct sctp_inpcb *inp, /* now clean up any chunks here */ TAILQ_FOREACH_SAFE(sp, &outs->outqueue, next, nsp) { TAILQ_REMOVE(&outs->outqueue, sp, next); + sctp_free_spbufspace(stcb, asoc, sp); if (sp->data) { if (so) { /* Still an open socket - report */ @@ -4882,19 +4883,14 @@ sctp_free_assoc(struct sctp_inpcb *inp, sctp_m_freem(sp->data); sp->data = NULL; sp->tail_mbuf = NULL; + sp->length = 0; } } if (sp->net) { sctp_free_remote_addr(sp->net); sp->net = NULL; } - sctp_free_spbufspace(stcb, asoc, sp); - if (sp->holds_key_ref) - sctp_auth_key_release(stcb, sp->auth_keyid, SCTP_SO_LOCKED); - /* Free the zone stuff */ - SCTP_ZONE_FREE(SCTP_BASE_INFO(ipi_zone_strmoq), sp); - SCTP_DECR_STRMOQ_COUNT(); - /* sa_ignore FREED_MEMORY */ + sctp_free_a_strmoq(stcb, sp, SCTP_SO_LOCKED); } } /* sa_ignore FREED_MEMORY */ Modified: stable/8/sys/netinet/sctputil.c ============================================================================== --- stable/8/sys/netinet/sctputil.c Thu Mar 7 23:48:29 2013 (r247977) +++ stable/8/sys/netinet/sctputil.c Thu Mar 7 23:51:07 2013 (r247978) @@ -3774,6 +3774,8 @@ sctp_report_all_outbound(struct sctp_tcb if (sp->data) { sctp_m_freem(sp->data); sp->data = NULL; + sp->tail_mbuf = NULL; + sp->length = 0; } } if (sp->net) { @@ -4833,7 +4835,7 @@ sctp_release_pr_sctp_chunk(struct sctp_t /* * Pull any data to free up the SB * and allow sender to "add more" - * whilc we will throw away :-) + * while we will throw away :-) */ sctp_free_spbufspace(stcb, &stcb->asoc, sp); @@ -4841,9 +4843,9 @@ sctp_release_pr_sctp_chunk(struct sctp_t do_wakeup_routine = 1; sp->some_taken = 1; sctp_m_freem(sp->data); - sp->length = 0; sp->data = NULL; sp->tail_mbuf = NULL; + sp->length = 0; } break; } From owner-svn-src-stable@FreeBSD.ORG Thu Mar 7 23:53:12 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 1A61CF5; Thu, 7 Mar 2013 23:53:12 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id E922AB4F; Thu, 7 Mar 2013 23:53:11 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r27NrBCa061381; Thu, 7 Mar 2013 23:53:11 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r27NrBNH061380; Thu, 7 Mar 2013 23:53:11 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201303072353.r27NrBNH061380@svn.freebsd.org> From: Michael Tuexen Date: Thu, 7 Mar 2013 23:53:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r247980 - stable/8/sys/netinet X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Mar 2013 23:53:12 -0000 Author: tuexen Date: Thu Mar 7 23:53:11 2013 New Revision: 247980 URL: http://svnweb.freebsd.org/changeset/base/247980 Log: MFC r238790: Fix the sctp_sockstore union such that userland programs don't depend on INET and/or INET6 to be defined and in-tune with how the kernel was compiled. Modified: stable/8/sys/netinet/sctp_uio.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/netinet/ (props changed) Modified: stable/8/sys/netinet/sctp_uio.h ============================================================================== --- stable/8/sys/netinet/sctp_uio.h Thu Mar 7 23:52:15 2013 (r247979) +++ stable/8/sys/netinet/sctp_uio.h Thu Mar 7 23:53:11 2013 (r247980) @@ -1124,12 +1124,8 @@ struct sctpstat { #define SCTP_STAT_DECR_GAUGE32(_x) SCTP_STAT_DECR(_x) union sctp_sockstore { -#if defined(INET) struct sockaddr_in sin; -#endif -#if defined(INET6) struct sockaddr_in6 sin6; -#endif struct sockaddr sa; }; From owner-svn-src-stable@FreeBSD.ORG Thu Mar 7 23:55:44 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 00365282; Thu, 7 Mar 2013 23:55:43 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id CD9E7B6A; Thu, 7 Mar 2013 23:55:43 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r27Nth4Y061806; Thu, 7 Mar 2013 23:55:43 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r27NthRn061805; Thu, 7 Mar 2013 23:55:43 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201303072355.r27NthRn061805@svn.freebsd.org> From: Michael Tuexen Date: Thu, 7 Mar 2013 23:55:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r247981 - stable/8/sys/netinet X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Mar 2013 23:55:44 -0000 Author: tuexen Date: Thu Mar 7 23:55:42 2013 New Revision: 247981 URL: http://svnweb.freebsd.org/changeset/base/247981 Log: MFC r239035: Testing an interface property should depend on the interface, not on an address. Modified: stable/8/sys/netinet/sctp_bsd_addr.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/netinet/ (props changed) Modified: stable/8/sys/netinet/sctp_bsd_addr.c ============================================================================== --- stable/8/sys/netinet/sctp_bsd_addr.c Thu Mar 7 23:53:11 2013 (r247980) +++ stable/8/sys/netinet/sctp_bsd_addr.c Thu Mar 7 23:55:42 2013 (r247981) @@ -152,12 +152,12 @@ sctp_gather_internal_ifa_flags(struct sc static uint32_t -sctp_is_desired_interface_type(struct ifaddr *ifa) +sctp_is_desired_interface_type(struct ifnet *ifn) { int result; /* check the interface type to see if it's one we care about */ - switch (ifa->ifa_ifp->if_type) { + switch (ifn->if_type) { case IFT_ETHER: case IFT_ISO88023: case IFT_ISO88024: @@ -216,6 +216,10 @@ sctp_init_ifns_for_vrf(int vrfid) IFNET_RLOCK(); TAILQ_FOREACH(ifn, &MODULE_GLOBAL(ifnet), if_list) { + if (sctp_is_desired_interface_type(ifn) == 0) { + /* non desired type */ + continue; + } IF_ADDR_RLOCK(ifn); TAILQ_FOREACH(ifa, &ifn->if_addrlist, ifa_list) { if (ifa->ifa_addr == NULL) { @@ -240,10 +244,6 @@ sctp_init_ifns_for_vrf(int vrfid) default: continue; } - if (sctp_is_desired_interface_type(ifa) == 0) { - /* non desired type */ - continue; - } switch (ifa->ifa_addr->sa_family) { #ifdef INET case AF_INET: @@ -317,6 +317,10 @@ sctp_addr_change(struct ifaddr *ifa, int if (ifa->ifa_addr == NULL) { return; } + if (sctp_is_desired_interface_type(ifa->ifa_ifp) == 0) { + /* non desired type */ + return; + } switch (ifa->ifa_addr->sa_family) { #ifdef INET case AF_INET: @@ -338,22 +342,16 @@ sctp_addr_change(struct ifaddr *ifa, int /* non inet/inet6 skip */ return; } - - if (sctp_is_desired_interface_type(ifa) == 0) { - /* non desired type */ - return; - } if (cmd == RTM_ADD) { (void)sctp_add_addr_to_vrf(SCTP_DEFAULT_VRFID, (void *)ifa->ifa_ifp, - ifa->ifa_ifp->if_index, ifa->ifa_ifp->if_type, - ifa->ifa_ifp->if_xname, + ifa->ifa_ifp->if_index, ifa->ifa_ifp->if_type, ifa->ifa_ifp->if_xname, (void *)ifa, ifa->ifa_addr, ifa_flags, 1); } else { sctp_del_addr_from_vrf(SCTP_DEFAULT_VRFID, ifa->ifa_addr, ifa->ifa_ifp->if_index, - ifa->ifa_ifp->if_xname - ); + ifa->ifa_ifp->if_xname); + /* * We don't bump refcount here so when it completes the * final delete will happen. From owner-svn-src-stable@FreeBSD.ORG Thu Mar 7 23:58:19 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 25E7C40E; Thu, 7 Mar 2013 23:58:19 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 002BFB9D; Thu, 7 Mar 2013 23:58:18 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r27NwI8A062173; Thu, 7 Mar 2013 23:58:18 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r27NwIZZ062172; Thu, 7 Mar 2013 23:58:18 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201303072358.r27NwIZZ062172@svn.freebsd.org> From: Michael Tuexen Date: Thu, 7 Mar 2013 23:58:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r247982 - stable/8/sys/netinet X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Mar 2013 23:58:19 -0000 Author: tuexen Date: Thu Mar 7 23:58:18 2013 New Revision: 247982 URL: http://svnweb.freebsd.org/changeset/base/247982 Log: MFC r240007: Fix a typo which results in RTT to be off by a factor of 10, if the RTT is larger than 1 second. Modified: stable/8/sys/netinet/sctputil.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/netinet/ (props changed) Modified: stable/8/sys/netinet/sctputil.c ============================================================================== --- stable/8/sys/netinet/sctputil.c Thu Mar 7 23:55:42 2013 (r247981) +++ stable/8/sys/netinet/sctputil.c Thu Mar 7 23:58:18 2013 (r247982) @@ -2384,7 +2384,7 @@ sctp_calculate_rto(struct sctp_tcb *stcb } timevalsub(&now, old); /* store the current RTT in us */ - net->rtt = (uint64_t) 10000000 *(uint64_t) now.tv_sec + + net->rtt = (uint64_t) 1000000 *(uint64_t) now.tv_sec + (uint64_t) now.tv_usec; /* computer rtt in ms */ From owner-svn-src-stable@FreeBSD.ORG Thu Mar 7 23:59:48 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 63735599; Thu, 7 Mar 2013 23:59:48 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 529DEBE2; Thu, 7 Mar 2013 23:59:48 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r27Nxmlp062404; Thu, 7 Mar 2013 23:59:48 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r27Nxm0a062403; Thu, 7 Mar 2013 23:59:48 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201303072359.r27Nxm0a062403@svn.freebsd.org> From: Michael Tuexen Date: Thu, 7 Mar 2013 23:59:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r247983 - stable/8/sys/netinet X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Mar 2013 23:59:48 -0000 Author: tuexen Date: Thu Mar 7 23:59:47 2013 New Revision: 247983 URL: http://svnweb.freebsd.org/changeset/base/247983 Log: MFC r240114: Whitespace change. Modified: stable/8/sys/netinet/sctputil.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/netinet/ (props changed) Modified: stable/8/sys/netinet/sctputil.c ============================================================================== --- stable/8/sys/netinet/sctputil.c Thu Mar 7 23:58:18 2013 (r247982) +++ stable/8/sys/netinet/sctputil.c Thu Mar 7 23:59:47 2013 (r247983) @@ -2385,7 +2385,7 @@ sctp_calculate_rto(struct sctp_tcb *stcb timevalsub(&now, old); /* store the current RTT in us */ net->rtt = (uint64_t) 1000000 *(uint64_t) now.tv_sec + - (uint64_t) now.tv_usec; + (uint64_t) now.tv_usec; /* computer rtt in ms */ rtt = net->rtt / 1000; From owner-svn-src-stable@FreeBSD.ORG Fri Mar 8 00:01:39 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 5831E740; Fri, 8 Mar 2013 00:01:39 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 300AABF4; Fri, 8 Mar 2013 00:01:39 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2801dsM064469; Fri, 8 Mar 2013 00:01:39 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2801dql064468; Fri, 8 Mar 2013 00:01:39 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201303080001.r2801dql064468@svn.freebsd.org> From: Michael Tuexen Date: Fri, 8 Mar 2013 00:01:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r247984 - stable/8/sys/netinet X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Mar 2013 00:01:39 -0000 Author: tuexen Date: Fri Mar 8 00:01:38 2013 New Revision: 247984 URL: http://svnweb.freebsd.org/changeset/base/247984 Log: MFC r240115: Use the consistenly the size of a variable. This helps to keep the code simpler for the userland implementation. Modified: stable/8/sys/netinet/sctp_output.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/netinet/ (props changed) Modified: stable/8/sys/netinet/sctp_output.c ============================================================================== --- stable/8/sys/netinet/sctp_output.c Thu Mar 7 23:59:47 2013 (r247983) +++ stable/8/sys/netinet/sctp_output.c Fri Mar 8 00:01:38 2013 (r247984) @@ -3371,7 +3371,7 @@ sctp_find_cmsg(int c_type, void *data, s return (found); } m_copydata(control, at, sizeof(cmh), (caddr_t)&cmh); - if (cmh.cmsg_len < CMSG_ALIGN(sizeof(struct cmsghdr))) { + if (cmh.cmsg_len < CMSG_ALIGN(sizeof(cmh))) { /* We dont't have a complete CMSG header. */ return (found); } @@ -3386,11 +3386,11 @@ sctp_find_cmsg(int c_type, void *data, s (cmh.cmsg_type == SCTP_PRINFO) || (cmh.cmsg_type == SCTP_AUTHINFO))))) { if (c_type == cmh.cmsg_type) { - if ((size_t)(cmh.cmsg_len - CMSG_ALIGN(sizeof(struct cmsghdr))) < cpsize) { + if ((size_t)(cmh.cmsg_len - CMSG_ALIGN(sizeof(cmh))) < cpsize) { return (found); } /* It is exactly what we want. Copy it out. */ - m_copydata(control, at + CMSG_ALIGN(sizeof(struct cmsghdr)), cpsize, (caddr_t)data); + m_copydata(control, at + CMSG_ALIGN(sizeof(cmh)), cpsize, (caddr_t)data); return (1); } else { struct sctp_sndrcvinfo *sndrcvinfo; @@ -3404,10 +3404,10 @@ sctp_find_cmsg(int c_type, void *data, s } switch (cmh.cmsg_type) { case SCTP_SNDINFO: - if ((size_t)(cmh.cmsg_len - CMSG_ALIGN(sizeof(struct cmsghdr))) < sizeof(struct sctp_sndinfo)) { + if ((size_t)(cmh.cmsg_len - CMSG_ALIGN(sizeof(cmh))) < sizeof(struct sctp_sndinfo)) { return (found); } - m_copydata(control, at + CMSG_ALIGN(sizeof(struct cmsghdr)), sizeof(struct sctp_sndinfo), (caddr_t)&sndinfo); + m_copydata(control, at + CMSG_ALIGN(sizeof(cmh)), sizeof(struct sctp_sndinfo), (caddr_t)&sndinfo); sndrcvinfo->sinfo_stream = sndinfo.snd_sid; sndrcvinfo->sinfo_flags = sndinfo.snd_flags; sndrcvinfo->sinfo_ppid = sndinfo.snd_ppid; @@ -3415,18 +3415,18 @@ sctp_find_cmsg(int c_type, void *data, s sndrcvinfo->sinfo_assoc_id = sndinfo.snd_assoc_id; break; case SCTP_PRINFO: - if ((size_t)(cmh.cmsg_len - CMSG_ALIGN(sizeof(struct cmsghdr))) < sizeof(struct sctp_prinfo)) { + if ((size_t)(cmh.cmsg_len - CMSG_ALIGN(sizeof(cmh))) < sizeof(struct sctp_prinfo)) { return (found); } - m_copydata(control, at + CMSG_ALIGN(sizeof(struct cmsghdr)), sizeof(struct sctp_prinfo), (caddr_t)&prinfo); + m_copydata(control, at + CMSG_ALIGN(sizeof(cmh)), sizeof(struct sctp_prinfo), (caddr_t)&prinfo); sndrcvinfo->sinfo_timetolive = prinfo.pr_value; sndrcvinfo->sinfo_flags |= prinfo.pr_policy; break; case SCTP_AUTHINFO: - if ((size_t)(cmh.cmsg_len - CMSG_ALIGN(sizeof(struct cmsghdr))) < sizeof(struct sctp_authinfo)) { + if ((size_t)(cmh.cmsg_len - CMSG_ALIGN(sizeof(cmh))) < sizeof(struct sctp_authinfo)) { return (found); } - m_copydata(control, at + CMSG_ALIGN(sizeof(struct cmsghdr)), sizeof(struct sctp_authinfo), (caddr_t)&authinfo); + m_copydata(control, at + CMSG_ALIGN(sizeof(cmh)), sizeof(struct sctp_authinfo), (caddr_t)&authinfo); sndrcvinfo->sinfo_keynumber_valid = 1; sndrcvinfo->sinfo_keynumber = authinfo.auth_keynumber; break; @@ -3466,7 +3466,7 @@ sctp_process_cmsgs_for_init(struct sctp_ return (1); } m_copydata(control, at, sizeof(cmh), (caddr_t)&cmh); - if (cmh.cmsg_len < CMSG_ALIGN(sizeof(struct cmsghdr))) { + if (cmh.cmsg_len < CMSG_ALIGN(sizeof(cmh))) { /* We dont't have a complete CMSG header. */ *error = EINVAL; return (1); @@ -3479,11 +3479,11 @@ sctp_process_cmsgs_for_init(struct sctp_ if (cmh.cmsg_level == IPPROTO_SCTP) { switch (cmh.cmsg_type) { case SCTP_INIT: - if ((size_t)(cmh.cmsg_len - CMSG_ALIGN(sizeof(struct cmsghdr))) < sizeof(struct sctp_initmsg)) { + if ((size_t)(cmh.cmsg_len - CMSG_ALIGN(sizeof(cmh))) < sizeof(struct sctp_initmsg)) { *error = EINVAL; return (1); } - m_copydata(control, at + CMSG_ALIGN(sizeof(struct cmsghdr)), sizeof(struct sctp_initmsg), (caddr_t)&initmsg); + m_copydata(control, at + CMSG_ALIGN(sizeof(cmh)), sizeof(struct sctp_initmsg), (caddr_t)&initmsg); if (initmsg.sinit_max_attempts) stcb->asoc.max_init_times = initmsg.sinit_max_attempts; if (initmsg.sinit_num_ostreams) @@ -3523,7 +3523,7 @@ sctp_process_cmsgs_for_init(struct sctp_ break; #ifdef INET case SCTP_DSTADDRV4: - if ((size_t)(cmh.cmsg_len - CMSG_ALIGN(sizeof(struct cmsghdr))) < sizeof(struct in_addr)) { + if ((size_t)(cmh.cmsg_len - CMSG_ALIGN(sizeof(cmh))) < sizeof(struct in_addr)) { *error = EINVAL; return (1); } @@ -3531,7 +3531,7 @@ sctp_process_cmsgs_for_init(struct sctp_ sin.sin_family = AF_INET; sin.sin_len = sizeof(struct sockaddr_in); sin.sin_port = stcb->rport; - m_copydata(control, at + CMSG_ALIGN(sizeof(struct cmsghdr)), sizeof(struct in_addr), (caddr_t)&sin.sin_addr); + m_copydata(control, at + CMSG_ALIGN(sizeof(cmh)), sizeof(struct in_addr), (caddr_t)&sin.sin_addr); if ((sin.sin_addr.s_addr == INADDR_ANY) || (sin.sin_addr.s_addr == INADDR_BROADCAST) || IN_MULTICAST(ntohl(sin.sin_addr.s_addr))) { @@ -3547,7 +3547,7 @@ sctp_process_cmsgs_for_init(struct sctp_ #endif #ifdef INET6 case SCTP_DSTADDRV6: - if ((size_t)(cmh.cmsg_len - CMSG_ALIGN(sizeof(struct cmsghdr))) < sizeof(struct in6_addr)) { + if ((size_t)(cmh.cmsg_len - CMSG_ALIGN(sizeof(cmh))) < sizeof(struct in6_addr)) { *error = EINVAL; return (1); } @@ -3555,7 +3555,7 @@ sctp_process_cmsgs_for_init(struct sctp_ sin6.sin6_family = AF_INET6; sin6.sin6_len = sizeof(struct sockaddr_in6); sin6.sin6_port = stcb->rport; - m_copydata(control, at + CMSG_ALIGN(sizeof(struct cmsghdr)), sizeof(struct in6_addr), (caddr_t)&sin6.sin6_addr); + m_copydata(control, at + CMSG_ALIGN(sizeof(cmh)), sizeof(struct in6_addr), (caddr_t)&sin6.sin6_addr); if (IN6_IS_ADDR_UNSPECIFIED(&sin6.sin6_addr) || IN6_IS_ADDR_MULTICAST(&sin6.sin6_addr)) { *error = EINVAL; @@ -3623,7 +3623,7 @@ sctp_findassociation_cmsgs(struct sctp_i return (NULL); } m_copydata(control, at, sizeof(cmh), (caddr_t)&cmh); - if (cmh.cmsg_len < CMSG_ALIGN(sizeof(struct cmsghdr))) { + if (cmh.cmsg_len < CMSG_ALIGN(sizeof(cmh))) { /* We dont't have a complete CMSG header. */ *error = EINVAL; return (NULL); @@ -3637,7 +3637,7 @@ sctp_findassociation_cmsgs(struct sctp_i switch (cmh.cmsg_type) { #ifdef INET case SCTP_DSTADDRV4: - if ((size_t)(cmh.cmsg_len - CMSG_ALIGN(sizeof(struct cmsghdr))) < sizeof(struct in_addr)) { + if ((size_t)(cmh.cmsg_len - CMSG_ALIGN(sizeof(cmh))) < sizeof(struct in_addr)) { *error = EINVAL; return (NULL); } @@ -3645,13 +3645,13 @@ sctp_findassociation_cmsgs(struct sctp_i sin.sin_family = AF_INET; sin.sin_len = sizeof(struct sockaddr_in); sin.sin_port = port; - m_copydata(control, at + CMSG_ALIGN(sizeof(struct cmsghdr)), sizeof(struct in_addr), (caddr_t)&sin.sin_addr); + m_copydata(control, at + CMSG_ALIGN(sizeof(cmh)), sizeof(struct in_addr), (caddr_t)&sin.sin_addr); addr = (struct sockaddr *)&sin; break; #endif #ifdef INET6 case SCTP_DSTADDRV6: - if ((size_t)(cmh.cmsg_len - CMSG_ALIGN(sizeof(struct cmsghdr))) < sizeof(struct in6_addr)) { + if ((size_t)(cmh.cmsg_len - CMSG_ALIGN(sizeof(cmh))) < sizeof(struct in6_addr)) { *error = EINVAL; return (NULL); } @@ -3659,7 +3659,7 @@ sctp_findassociation_cmsgs(struct sctp_i sin6.sin6_family = AF_INET6; sin6.sin6_len = sizeof(struct sockaddr_in6); sin6.sin6_port = port; - m_copydata(control, at + CMSG_ALIGN(sizeof(struct cmsghdr)), sizeof(struct in6_addr), (caddr_t)&sin6.sin6_addr); + m_copydata(control, at + CMSG_ALIGN(sizeof(cmh)), sizeof(struct in6_addr), (caddr_t)&sin6.sin6_addr); #ifdef INET if (IN6_IS_ADDR_V4MAPPED(&sin6.sin6_addr)) { in6_sin6_2_sin(&sin, &sin6); From owner-svn-src-stable@FreeBSD.ORG Fri Mar 8 00:03:34 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 381969CD; Fri, 8 Mar 2013 00:03:34 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 27DD8C02; Fri, 8 Mar 2013 00:03:34 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2803YwW064928; Fri, 8 Mar 2013 00:03:34 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2803Wik064914; Fri, 8 Mar 2013 00:03:32 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201303080003.r2803Wik064914@svn.freebsd.org> From: Michael Tuexen Date: Fri, 8 Mar 2013 00:03:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r247986 - stable/8/sys/netinet X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Mar 2013 00:03:34 -0000 Author: tuexen Date: Fri Mar 8 00:03:31 2013 New Revision: 247986 URL: http://svnweb.freebsd.org/changeset/base/247986 Log: MFC r240148: Using %p in a format string requires a void *. Modified: stable/8/sys/netinet/sctp_asconf.c stable/8/sys/netinet/sctp_auth.c stable/8/sys/netinet/sctp_cc_functions.c stable/8/sys/netinet/sctp_indata.c stable/8/sys/netinet/sctp_input.c stable/8/sys/netinet/sctp_output.c stable/8/sys/netinet/sctp_pcb.c stable/8/sys/netinet/sctp_timer.c stable/8/sys/netinet/sctputil.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/netinet/ (props changed) Modified: stable/8/sys/netinet/sctp_asconf.c ============================================================================== --- stable/8/sys/netinet/sctp_asconf.c Fri Mar 8 00:03:07 2013 (r247985) +++ stable/8/sys/netinet/sctp_asconf.c Fri Mar 8 00:03:31 2013 (r247986) @@ -2278,7 +2278,7 @@ sctp_set_primary_ip_address_sa(struct sc /* set primary queuing succeeded */ SCTPDBG(SCTP_DEBUG_ASCONF1, "set_primary_ip_address_sa: queued on tcb=%p, ", - stcb); + (void *)stcb); SCTPDBG_ADDR(SCTP_DEBUG_ASCONF1, sa); if (SCTP_GET_STATE(&stcb->asoc) == SCTP_STATE_OPEN) { #ifdef SCTP_TIMER_BASED_ASCONF @@ -2291,7 +2291,7 @@ sctp_set_primary_ip_address_sa(struct sc } } else { SCTPDBG(SCTP_DEBUG_ASCONF1, "set_primary_ip_address_sa: failed to add to queue on tcb=%p, ", - stcb); + (void *)stcb); SCTPDBG_ADDR(SCTP_DEBUG_ASCONF1, sa); return (-1); } @@ -2314,7 +2314,7 @@ sctp_set_primary_ip_address(struct sctp_ SCTP_SET_PRIM_ADDR)) { /* set primary queuing succeeded */ SCTPDBG(SCTP_DEBUG_ASCONF1, "set_primary_ip_address: queued on stcb=%p, ", - stcb); + (void *)stcb); SCTPDBG_ADDR(SCTP_DEBUG_ASCONF1, &ifa->address.sa); if (SCTP_GET_STATE(&stcb->asoc) == SCTP_STATE_OPEN) { #ifdef SCTP_TIMER_BASED_ASCONF Modified: stable/8/sys/netinet/sctp_auth.c ============================================================================== --- stable/8/sys/netinet/sctp_auth.c Fri Mar 8 00:03:07 2013 (r247985) +++ stable/8/sys/netinet/sctp_auth.c Fri Mar 8 00:03:31 2013 (r247986) @@ -591,7 +591,7 @@ sctp_auth_key_acquire(struct sctp_tcb *s atomic_add_int(&skey->refcount, 1); SCTPDBG(SCTP_DEBUG_AUTH2, "%s: stcb %p key %u refcount acquire to %d\n", - __FUNCTION__, stcb, key_id, skey->refcount); + __FUNCTION__, (void *)stcb, key_id, skey->refcount); } } @@ -612,7 +612,7 @@ sctp_auth_key_release(struct sctp_tcb *s sctp_free_sharedkey(skey); SCTPDBG(SCTP_DEBUG_AUTH2, "%s: stcb %p key %u refcount release to %d\n", - __FUNCTION__, stcb, key_id, skey->refcount); + __FUNCTION__, (void *)stcb, key_id, skey->refcount); /* see if a notification should be generated */ if ((skey->refcount <= 1) && (skey->deactivated)) { @@ -621,7 +621,7 @@ sctp_auth_key_release(struct sctp_tcb *s key_id, 0, so_locked); SCTPDBG(SCTP_DEBUG_AUTH2, "%s: stcb %p key %u no longer used, %d\n", - __FUNCTION__, stcb, key_id, skey->refcount); + __FUNCTION__, (void *)stcb, key_id, skey->refcount); } } } Modified: stable/8/sys/netinet/sctp_cc_functions.c ============================================================================== --- stable/8/sys/netinet/sctp_cc_functions.c Fri Mar 8 00:03:07 2013 (r247985) +++ stable/8/sys/netinet/sctp_cc_functions.c Fri Mar 8 00:03:31 2013 (r247986) @@ -984,7 +984,7 @@ sctp_cwnd_update_exit_pf_common(struct s stcb->asoc.my_vtag, ((stcb->sctp_ep->sctp_lport << 16) | (stcb->rport)), net, old_cwnd, net->cwnd); SCTPDBG(SCTP_DEBUG_INDATA1, "Destination %p moved from PF to reachable with cwnd %d.\n", - net, net->cwnd); + (void *)net, net->cwnd); } Modified: stable/8/sys/netinet/sctp_indata.c ============================================================================== --- stable/8/sys/netinet/sctp_indata.c Fri Mar 8 00:03:07 2013 (r247985) +++ stable/8/sys/netinet/sctp_indata.c Fri Mar 8 00:03:31 2013 (r247986) @@ -4420,7 +4420,7 @@ sctp_handle_sack(struct mbuf *m, int off cum_ack, send_s); if (tp1) { SCTP_PRINTF("Got send_s from tsn:%x + 1 of tp1:%p\n", - tp1->rec.data.TSN_seq, tp1); + tp1->rec.data.TSN_seq, (void *)tp1); } hopeless_peer: *abort_now = 1; Modified: stable/8/sys/netinet/sctp_input.c ============================================================================== --- stable/8/sys/netinet/sctp_input.c Fri Mar 8 00:03:07 2013 (r247985) +++ stable/8/sys/netinet/sctp_input.c Fri Mar 8 00:03:31 2013 (r247986) @@ -91,7 +91,7 @@ sctp_handle_init(struct mbuf *m, int iph struct mbuf *op_err; SCTPDBG(SCTP_DEBUG_INPUT2, "sctp_handle_init: handling INIT tcb:%p\n", - stcb); + (void *)stcb); if (stcb == NULL) { SCTP_INP_RLOCK(inp); } @@ -2652,7 +2652,7 @@ sctp_handle_cookie_echo(struct mbuf *m, SCTP_INP_INCR_REF((*stcb)->sctp_ep); if ((*stcb)->sctp_ep != l_inp) { SCTP_PRINTF("Huh? ep:%p diff then l_inp:%p?\n", - (*stcb)->sctp_ep, l_inp); + (void *)(*stcb)->sctp_ep, (void *)l_inp); } } } @@ -4404,7 +4404,7 @@ __attribute__((noinline)) #endif SCTPDBG(SCTP_DEBUG_INPUT1, "sctp_process_control: iphlen=%u, offset=%u, length=%u stcb:%p\n", - iphlen, *offset, length, stcb); + iphlen, *offset, length, (void *)stcb); /* validate chunk header length... */ if (ntohs(ch->chunk_length) < sizeof(*ch)) { @@ -5023,7 +5023,7 @@ process_control_chunks: break; case SCTP_ABORT_ASSOCIATION: SCTPDBG(SCTP_DEBUG_INPUT3, "SCTP_ABORT, stcb %p\n", - stcb); + (void *)stcb); if ((stcb) && netp && *netp) sctp_handle_abort((struct sctp_abort_chunk *)ch, stcb, *netp); @@ -5032,7 +5032,7 @@ process_control_chunks: break; case SCTP_SHUTDOWN: SCTPDBG(SCTP_DEBUG_INPUT3, "SCTP_SHUTDOWN, stcb %p\n", - stcb); + (void *)stcb); if ((stcb == NULL) || (chk_length != sizeof(struct sctp_shutdown_chunk))) { *offset = length; if (locked_tcb) { @@ -5052,7 +5052,7 @@ process_control_chunks: } break; case SCTP_SHUTDOWN_ACK: - SCTPDBG(SCTP_DEBUG_INPUT3, "SCTP_SHUTDOWN-ACK, stcb %p\n", stcb); + SCTPDBG(SCTP_DEBUG_INPUT3, "SCTP_SHUTDOWN-ACK, stcb %p\n", (void *)stcb); if ((stcb) && (netp) && (*netp)) sctp_handle_shutdown_ack((struct sctp_shutdown_ack_chunk *)ch, stcb, *netp); *offset = length; @@ -5068,7 +5068,7 @@ process_control_chunks: break; case SCTP_COOKIE_ECHO: SCTPDBG(SCTP_DEBUG_INPUT3, - "SCTP_COOKIE-ECHO, stcb %p\n", stcb); + "SCTP_COOKIE-ECHO, stcb %p\n", (void *)stcb); if ((stcb) && (stcb->asoc.total_output_queue_size)) { ; } else { @@ -5170,7 +5170,7 @@ process_control_chunks: } break; case SCTP_COOKIE_ACK: - SCTPDBG(SCTP_DEBUG_INPUT3, "SCTP_COOKIE-ACK, stcb %p\n", stcb); + SCTPDBG(SCTP_DEBUG_INPUT3, "SCTP_COOKIE-ACK, stcb %p\n", (void *)stcb); if ((stcb == NULL) || chk_length != sizeof(struct sctp_cookie_ack_chunk)) { if (locked_tcb) { SCTP_TCB_UNLOCK(locked_tcb); @@ -5260,7 +5260,7 @@ process_control_chunks: } break; case SCTP_SHUTDOWN_COMPLETE: - SCTPDBG(SCTP_DEBUG_INPUT3, "SCTP_SHUTDOWN-COMPLETE, stcb %p\n", stcb); + SCTPDBG(SCTP_DEBUG_INPUT3, "SCTP_SHUTDOWN-COMPLETE, stcb %p\n", (void *)stcb); /* must be first and only chunk */ if ((num_chunks > 1) || (length - *offset > (int)SCTP_SIZE32(chk_length))) { @@ -5619,7 +5619,7 @@ sctp_common_input_processing(struct mbuf sh->checksum = check; if (calc_check != check) { SCTPDBG(SCTP_DEBUG_INPUT1, "Bad CSUM on SCTP packet calc_check:%x check:%x m:%p mlen:%d iphlen:%d\n", - calc_check, check, m, length, iphlen); + calc_check, check, (void *)m, length, iphlen); stcb = sctp_findassociation_addr(m, offset, src, dst, sh, ch, &inp, &net, vrf_id); if ((net != NULL) && (port != 0)) { @@ -5724,13 +5724,13 @@ sctp_common_input_processing(struct mbuf } #endif SCTPDBG(SCTP_DEBUG_INPUT1, "Ok, Common input processing called, m:%p iphlen:%d offset:%d length:%d stcb:%p\n", - m, iphlen, offset, length, stcb); + (void *)m, iphlen, offset, length, (void *)stcb); if (stcb) { /* always clear this before beginning a packet */ stcb->asoc.authenticated = 0; stcb->asoc.seen_a_sack_this_pkt = 0; SCTPDBG(SCTP_DEBUG_INPUT1, "stcb:%p state:%x\n", - stcb, stcb->asoc.state); + (void *)stcb, stcb->asoc.state); if ((stcb->asoc.state & SCTP_STATE_WAS_ABORTED) || (stcb->asoc.state & SCTP_STATE_ABOUT_TO_BE_FREED)) { @@ -5968,9 +5968,9 @@ static void sctp_print_mbuf_chain(struct mbuf *m) { for (; m; m = SCTP_BUF_NEXT(m)) { - SCTP_PRINTF("%p: m_len = %ld\n", m, SCTP_BUF_LEN(m)); + SCTP_PRINTF("%p: m_len = %ld\n", (void *)m, SCTP_BUF_LEN(m)); if (SCTP_BUF_IS_EXTENDED(m)) - SCTP_PRINTF("%p: extend_size = %d\n", m, SCTP_BUF_EXTEND_SIZE(m)); + SCTP_PRINTF("%p: extend_size = %d\n", (void *)m, SCTP_BUF_EXTEND_SIZE(m)); } } Modified: stable/8/sys/netinet/sctp_output.c ============================================================================== --- stable/8/sys/netinet/sctp_output.c Fri Mar 8 00:03:07 2013 (r247985) +++ stable/8/sys/netinet/sctp_output.c Fri Mar 8 00:03:31 2013 (r247986) @@ -2985,7 +2985,7 @@ bound_all_plan_b: } SCTPDBG(SCTP_DEBUG_OUTPUT2, "num preferred:%d on interface:%p cur_addr_num:%d\n", - num_preferred, sctp_ifn, cur_addr_num); + num_preferred, (void *)sctp_ifn, cur_addr_num); /* * Ok we have num_eligible_addr set with how many we can @@ -3022,7 +3022,7 @@ again_with_private_addresses_allowed: goto plan_d; } LIST_FOREACH(sctp_ifa, &emit_ifn->ifalist, next_ifa) { - SCTPDBG(SCTP_DEBUG_OUTPUT2, "ifa:%p\n", sctp_ifa); + SCTPDBG(SCTP_DEBUG_OUTPUT2, "ifa:%p\n", (void *)sctp_ifa); if ((sctp_ifa->localifa_flags & SCTP_ADDR_DEFER_USE) && (non_asoc_addr_ok == 0)) { SCTPDBG(SCTP_DEBUG_OUTPUT2, "Defer\n"); @@ -3072,7 +3072,7 @@ plan_d: * out and see if we can find an acceptable address somewhere * amongst all interfaces. */ - SCTPDBG(SCTP_DEBUG_OUTPUT2, "Trying Plan D looked_at is %p\n", looked_at); + SCTPDBG(SCTP_DEBUG_OUTPUT2, "Trying Plan D looked_at is %p\n", (void *)looked_at); LIST_FOREACH(sctp_ifn, &vrf->ifnlist, next_ifn) { if (dest_is_loop == 0 && SCTP_IFN_IS_IFT_LOOP(sctp_ifn)) { /* wrong base scope */ @@ -3812,7 +3812,7 @@ sctp_handle_no_route(struct sctp_tcb *st SCTPDBG_ADDR(SCTP_DEBUG_OUTPUT1, &net->ro._l_addr.sa); if (net->dest_state & SCTP_ADDR_CONFIRMED) { if ((net->dest_state & SCTP_ADDR_REACHABLE) && stcb) { - SCTPDBG(SCTP_DEBUG_OUTPUT1, "no route takes interface %p down\n", net); + SCTPDBG(SCTP_DEBUG_OUTPUT1, "no route takes interface %p down\n", (void *)net); sctp_ulp_notify(SCTP_NOTIFY_INTERFACE_DOWN, stcb, 0, (void *)net, @@ -4106,7 +4106,7 @@ sctp_lowlevel_chunk_output(struct sctp_i SCTPDBG(SCTP_DEBUG_OUTPUT3, "Destination is %x\n", (uint32_t) (ntohl(ip->ip_dst.s_addr))); SCTPDBG(SCTP_DEBUG_OUTPUT3, "RTP route is %p through\n", - ro->ro_rt); + (void *)ro->ro_rt); if (SCTP_GET_HEADER_FOR_OUTPUT(o_pak)) { /* failed to prepend data, give up */ @@ -12162,7 +12162,7 @@ sctp_lower_sosend(struct socket *so, sndlen = SCTP_HEADER_LEN(i_pak); } SCTPDBG(SCTP_DEBUG_OUTPUT1, "Send called addr:%p send length %d\n", - addr, + (void *)addr, sndlen); if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) && (inp->sctp_socket->so_qlimit)) { Modified: stable/8/sys/netinet/sctp_pcb.c ============================================================================== --- stable/8/sys/netinet/sctp_pcb.c Fri Mar 8 00:03:07 2013 (r247985) +++ stable/8/sys/netinet/sctp_pcb.c Fri Mar 8 00:03:31 2013 (r247986) @@ -553,7 +553,7 @@ sctp_add_addr_to_vrf(uint32_t vrf_id, vo (sctp_ifap->ifn_p->ifn_index == ifn_index)) { SCTPDBG(SCTP_DEBUG_PCB4, "Using existing ifn %s (0x%x) for ifa %p\n", sctp_ifap->ifn_p->ifn_name, ifn_index, - sctp_ifap); + (void *)sctp_ifap); if (new_ifn_af) { /* Remove the created one that we don't want */ sctp_delete_ifn(sctp_ifnp, SCTP_ADDR_LOCKED); @@ -575,7 +575,7 @@ sctp_add_addr_to_vrf(uint32_t vrf_id, vo * old one */ SCTPDBG(SCTP_DEBUG_PCB4, "Moving ifa %p from %s (0x%x) to %s (0x%x)\n", - sctp_ifap, sctp_ifap->ifn_p->ifn_name, + (void *)sctp_ifap, sctp_ifap->ifn_p->ifn_name, sctp_ifap->ifn_p->ifn_index, if_name, ifn_index); /* remove the address from the old ifn */ @@ -587,7 +587,7 @@ sctp_add_addr_to_vrf(uint32_t vrf_id, vo /* repair ifnp which was NULL ? */ sctp_ifap->localifa_flags = SCTP_ADDR_VALID; SCTPDBG(SCTP_DEBUG_PCB4, "Repairing ifn %p for ifa %p\n", - sctp_ifnp, sctp_ifap); + (void *)sctp_ifnp, (void *)sctp_ifap); sctp_add_ifa_to_ifn(sctp_ifnp, sctp_ifap); } goto exit_stage_left; @@ -763,7 +763,7 @@ sctp_del_addr_from_vrf(uint32_t vrf_id, return; } } - SCTPDBG(SCTP_DEBUG_PCB4, "Deleting ifa %p\n", sctp_ifap); + SCTPDBG(SCTP_DEBUG_PCB4, "Deleting ifa %p\n", (void *)sctp_ifap); sctp_ifap->localifa_flags &= SCTP_ADDR_VALID; sctp_ifap->localifa_flags |= SCTP_BEING_DELETED; vrf->total_ifa_count--; @@ -1678,7 +1678,7 @@ sctp_endpoint_probe(struct sockaddr *nam continue; } SCTPDBG(SCTP_DEBUG_PCB1, "Ok laddr->ifa:%p is possible, ", - laddr->ifa); + (void *)laddr->ifa); if (laddr->ifa->localifa_flags & SCTP_BEING_DELETED) { SCTPDBG(SCTP_DEBUG_PCB1, "Huh IFA being deleted\n"); continue; @@ -2181,7 +2181,7 @@ sctp_findassociation_addr(struct mbuf *m retval = sctp_findassociation_addr_sa(src, dst, &inp, netp, find_tcp_pool, vrf_id); } - SCTPDBG(SCTP_DEBUG_PCB1, "retval:%p inp:%p\n", retval, inp); + SCTPDBG(SCTP_DEBUG_PCB1, "retval:%p inp:%p\n", (void *)retval, (void *)inp); if (retval == NULL && inp) { /* Found a EP but not this address */ if ((ch->chunk_type == SCTP_INITIATION) || @@ -2207,7 +2207,7 @@ sctp_findassociation_addr(struct mbuf *m } } } - SCTPDBG(SCTP_DEBUG_PCB1, "retval is %p\n", retval); + SCTPDBG(SCTP_DEBUG_PCB1, "retval is %p\n", (void *)retval); return (retval); } @@ -3100,7 +3100,7 @@ continue_anyway: /* put it in the bucket */ LIST_INSERT_HEAD(head, inp, sctp_hash); SCTPDBG(SCTP_DEBUG_PCB1, "Main hash to bind at head:%p, bound port:%d - in tcp_pool=%d\n", - head, ntohs(lport), port_reuse_active); + (void *)head, ntohs(lport), port_reuse_active); /* set in the port */ inp->sctp_lport = lport; @@ -3368,7 +3368,7 @@ sctp_inpcb_free(struct sctp_inpcb *inp, sctp_streamhead); if (sp == NULL) { SCTP_PRINTF("Error, sp is NULL, locked on sending is %p strm:%d\n", - asoc->asoc.locked_on_sending, + (void *)asoc->asoc.locked_on_sending, asoc->asoc.locked_on_sending->stream_no); } else { if ((sp->length == 0) && (sp->msg_is_complete == 0)) @@ -4341,7 +4341,7 @@ sctp_aloc_assoc(struct sctp_inpcb *inp, LIST_INSERT_HEAD(head, stcb, sctp_tcbhash); } SCTP_INP_WUNLOCK(inp); - SCTPDBG(SCTP_DEBUG_PCB1, "Association %p now allocated\n", stcb); + SCTPDBG(SCTP_DEBUG_PCB1, "Association %p now allocated\n", (void *)stcb); return (stcb); } Modified: stable/8/sys/netinet/sctp_timer.c ============================================================================== --- stable/8/sys/netinet/sctp_timer.c Fri Mar 8 00:03:07 2013 (r247985) +++ stable/8/sys/netinet/sctp_timer.c Fri Mar 8 00:03:31 2013 (r247986) @@ -90,7 +90,7 @@ sctp_threshold_management(struct sctp_in if (net) { net->error_count++; SCTPDBG(SCTP_DEBUG_TIMER4, "Error count for %p now %d thresh:%d\n", - net, net->error_count, + (void *)net, net->error_count, net->failure_threshold); if (net->error_count > net->failure_threshold) { /* We had a threshold failure */ @@ -138,7 +138,7 @@ sctp_threshold_management(struct sctp_in stcb->asoc.overall_error_count++; } SCTPDBG(SCTP_DEBUG_TIMER4, "Overall error count for %p now %d thresh:%u state:%x\n", - &stcb->asoc, stcb->asoc.overall_error_count, + (void *)&stcb->asoc, stcb->asoc.overall_error_count, (uint32_t) threshold, ((net == NULL) ? (uint32_t) 0 : (uint32_t) net->dest_state)); /* @@ -439,7 +439,7 @@ sctp_recover_sent_list(struct sctp_tcb * TAILQ_FOREACH_SAFE(chk, &asoc->sent_queue, sctp_next, nchk) { if (SCTP_TSN_GE(asoc->last_acked_seq, chk->rec.data.TSN_seq)) { SCTP_PRINTF("Found chk:%p tsn:%x <= last_acked_seq:%x\n", - chk, chk->rec.data.TSN_seq, asoc->last_acked_seq); + (void *)chk, chk->rec.data.TSN_seq, asoc->last_acked_seq); TAILQ_REMOVE(&asoc->sent_queue, chk, sctp_next); if (chk->pr_sctp_on) { if (asoc->pr_sctp_cnt != 0) @@ -460,7 +460,7 @@ sctp_recover_sent_list(struct sctp_tcb * } SCTP_PRINTF("after recover order is as follows\n"); TAILQ_FOREACH(chk, &asoc->sent_queue, sctp_next) { - SCTP_PRINTF("chk:%p TSN:%x\n", chk, chk->rec.data.TSN_seq); + SCTP_PRINTF("chk:%p TSN:%x\n", (void *)chk, chk->rec.data.TSN_seq); } } @@ -767,7 +767,7 @@ start_again: if (audit_tf) { SCTPDBG(SCTP_DEBUG_TIMER4, "Audit total flight due to negative value net:%p\n", - net); + (void *)net); stcb->asoc.total_flight = 0; stcb->asoc.total_flight_count = 0; /* Clear all networks flight size */ @@ -775,7 +775,7 @@ start_again: lnets->flight_size = 0; SCTPDBG(SCTP_DEBUG_TIMER4, "Net:%p c-f cwnd:%d ssthresh:%d\n", - lnets, lnets->cwnd, lnets->ssthresh); + (void *)lnets, lnets->cwnd, lnets->ssthresh); } TAILQ_FOREACH(chk, &stcb->asoc.sent_queue, sctp_next) { if (chk->sent < SCTP_DATAGRAM_RESEND) { Modified: stable/8/sys/netinet/sctputil.c ============================================================================== --- stable/8/sys/netinet/sctputil.c Fri Mar 8 00:03:07 2013 (r247985) +++ stable/8/sys/netinet/sctputil.c Fri Mar 8 00:03:31 2013 (r247986) @@ -686,7 +686,7 @@ sctp_auditing(int from, struct sctp_inpc } if (lnet->flight_size != tot_out) { SCTP_PRINTF("net:%p flight was %d corrected to %d\n", - lnet, lnet->flight_size, + (void *)lnet, lnet->flight_size, tot_out); lnet->flight_size = tot_out; } @@ -1434,7 +1434,7 @@ sctp_timeout_handler(void *t) if (tmr->self != (void *)tmr) { /* * SCTP_PRINTF("Stale SCTP timer fired (%p), ignoring...\n", - * tmr); + * (void *)tmr); */ CURVNET_RESTORE(); return; @@ -2112,7 +2112,7 @@ sctp_timer_start(int t_type, struct sctp } if ((to_ticks <= 0) || (tmr == NULL)) { SCTPDBG(SCTP_DEBUG_TIMER1, "%s: %d:software error to_ticks:%d tmr:%p not set ??\n", - __FUNCTION__, t_type, to_ticks, tmr); + __FUNCTION__, t_type, to_ticks, (void *)tmr); return; } if (SCTP_OS_TIMER_PENDING(&tmr->timer)) { From owner-svn-src-stable@FreeBSD.ORG Fri Mar 8 00:05:16 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id EEFBBB47; Fri, 8 Mar 2013 00:05:15 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id E0E49C1A; Fri, 8 Mar 2013 00:05:15 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2805Fp6065298; Fri, 8 Mar 2013 00:05:15 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2805F63065297; Fri, 8 Mar 2013 00:05:15 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201303080005.r2805F63065297@svn.freebsd.org> From: Michael Tuexen Date: Fri, 8 Mar 2013 00:05:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r247987 - stable/8/sys/netinet X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Mar 2013 00:05:16 -0000 Author: tuexen Date: Fri Mar 8 00:05:15 2013 New Revision: 247987 URL: http://svnweb.freebsd.org/changeset/base/247987 Log: MFC r240158: Get rid of a gcc'ism. Modified: stable/8/sys/netinet/sctp_cc_functions.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/netinet/ (props changed) Modified: stable/8/sys/netinet/sctp_cc_functions.c ============================================================================== --- stable/8/sys/netinet/sctp_cc_functions.c Fri Mar 8 00:03:31 2013 (r247986) +++ stable/8/sys/netinet/sctp_cc_functions.c Fri Mar 8 00:05:15 2013 (r247987) @@ -1917,10 +1917,9 @@ measure_achieved_throughput(struct sctp_ return; } net->cc_mod.htcp_ca.bytecount += net->net_ack; - - if (net->cc_mod.htcp_ca.bytecount >= net->cwnd - ((net->cc_mod.htcp_ca.alpha >> 7 ? : 1) * net->mtu) - && now - net->cc_mod.htcp_ca.lasttime >= net->cc_mod.htcp_ca.minRTT - && net->cc_mod.htcp_ca.minRTT > 0) { + if ((net->cc_mod.htcp_ca.bytecount >= net->cwnd - (((net->cc_mod.htcp_ca.alpha >> 7) ? (net->cc_mod.htcp_ca.alpha >> 7) : 1) * net->mtu)) && + (now - net->cc_mod.htcp_ca.lasttime >= net->cc_mod.htcp_ca.minRTT) && + (net->cc_mod.htcp_ca.minRTT > 0)) { uint32_t cur_Bi = net->cc_mod.htcp_ca.bytecount / net->mtu * hz / (now - net->cc_mod.htcp_ca.lasttime); if (htcp_ccount(&net->cc_mod.htcp_ca) <= 3) { From owner-svn-src-stable@FreeBSD.ORG Fri Mar 8 00:07:21 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 6FBBCE0D; Fri, 8 Mar 2013 00:07:21 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 52D61C33; Fri, 8 Mar 2013 00:07:21 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2807L6N065762; Fri, 8 Mar 2013 00:07:21 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2807K2n065756; Fri, 8 Mar 2013 00:07:20 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201303080007.r2807K2n065756@svn.freebsd.org> From: Michael Tuexen Date: Fri, 8 Mar 2013 00:07:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r247989 - stable/8/sys/netinet X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Mar 2013 00:07:21 -0000 Author: tuexen Date: Fri Mar 8 00:07:19 2013 New Revision: 247989 URL: http://svnweb.freebsd.org/changeset/base/247989 Log: MFC r240198: Don't include a structure containing a flexible array in another structure. Modified: stable/8/sys/netinet/sctp_header.h stable/8/sys/netinet/sctp_indata.c stable/8/sys/netinet/sctp_input.c stable/8/sys/netinet/sctp_input.h stable/8/sys/netinet/sctp_structs.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/netinet/ (props changed) Modified: stable/8/sys/netinet/sctp_header.h ============================================================================== --- stable/8/sys/netinet/sctp_header.h Fri Mar 8 00:05:34 2013 (r247988) +++ stable/8/sys/netinet/sctp_header.h Fri Mar 8 00:07:19 2013 (r247989) @@ -510,16 +510,6 @@ struct sctp_stream_reset_add_strm { * streams then the request will need to be an overlay structure. */ -struct sctp_stream_reset_out_req { - struct sctp_chunkhdr ch; - struct sctp_stream_reset_out_request sr_req; -} SCTP_PACKED; - -struct sctp_stream_reset_in_req { - struct sctp_chunkhdr ch; - struct sctp_stream_reset_in_request sr_req; -} SCTP_PACKED; - struct sctp_stream_reset_tsn_req { struct sctp_chunkhdr ch; struct sctp_stream_reset_tsn_request sr_req; Modified: stable/8/sys/netinet/sctp_indata.c ============================================================================== --- stable/8/sys/netinet/sctp_indata.c Fri Mar 8 00:05:34 2013 (r247988) +++ stable/8/sys/netinet/sctp_indata.c Fri Mar 8 00:07:19 2013 (r247989) @@ -2113,7 +2113,7 @@ finish_express_del: */ struct sctp_queued_to_read *ctl, *nctl; - sctp_reset_in_stream(stcb, liste->number_entries, liste->req.list_of_streams); + sctp_reset_in_stream(stcb, liste->number_entries, liste->list_of_streams); TAILQ_REMOVE(&asoc->resetHead, liste, next_resp); SCTP_FREE(liste, SCTP_M_STRESET); /* sa_ignore FREED_MEMORY */ Modified: stable/8/sys/netinet/sctp_input.c ============================================================================== --- stable/8/sys/netinet/sctp_input.c Fri Mar 8 00:05:34 2013 (r247988) +++ stable/8/sys/netinet/sctp_input.c Fri Mar 8 00:07:19 2013 (r247989) @@ -3455,9 +3455,9 @@ process_chunk_drop(struct sctp_tcb *stcb } void -sctp_reset_in_stream(struct sctp_tcb *stcb, int number_entries, uint16_t * list) +sctp_reset_in_stream(struct sctp_tcb *stcb, uint32_t number_entries, uint16_t * list) { - int i; + uint32_t i; uint16_t temp; /* @@ -3511,7 +3511,7 @@ struct sctp_stream_reset_out_request * sctp_find_stream_reset(struct sctp_tcb *stcb, uint32_t seq, struct sctp_tmit_chunk **bchk) { struct sctp_association *asoc; - struct sctp_stream_reset_out_req *req; + struct sctp_chunkhdr *ch; struct sctp_stream_reset_out_request *r; struct sctp_tmit_chunk *chk; int len, clen; @@ -3534,8 +3534,8 @@ sctp_find_stream_reset(struct sctp_tcb * *bchk = chk; } clen = chk->send_size; - req = mtod(chk->data, struct sctp_stream_reset_out_req *); - r = &req->sr_req; + ch = mtod(chk->data, struct sctp_chunkhdr *); + r = (struct sctp_stream_reset_out_request *)(ch + 1); if (ntohl(r->request_seq) == seq) { /* found it */ return (r); @@ -3888,8 +3888,7 @@ sctp_handle_str_reset_request_out(struct } liste->tsn = tsn; liste->number_entries = number_entries; - memcpy(&liste->req, req, - (sizeof(struct sctp_stream_reset_out_request) + (number_entries * sizeof(uint16_t)))); + memcpy(&liste->list_of_streams, req->list_of_streams, number_entries * sizeof(uint16_t)); TAILQ_INSERT_TAIL(&asoc->resetHead, liste, next_resp); asoc->last_reset_action[0] = SCTP_STREAM_RESET_RESULT_PERFORMED; } @@ -4059,7 +4058,7 @@ __attribute__((noinline)) #endif static int sctp_handle_stream_reset(struct sctp_tcb *stcb, struct mbuf *m, int offset, - struct sctp_stream_reset_out_req *sr_req) + struct sctp_chunkhdr *ch_req) { int chk_length, param_len, ptype; struct sctp_paramhdr pstore; @@ -4074,7 +4073,7 @@ __attribute__((noinline)) int num_param = 0; /* now it may be a reset or a reset-response */ - chk_length = ntohs(sr_req->ch.chunk_length); + chk_length = ntohs(ch_req->chunk_length); /* setup for adding the response */ sctp_alloc_a_chunk(stcb, chk); @@ -5413,7 +5412,7 @@ process_control_chunks: */ stcb->asoc.peer_supports_strreset = 1; } - if (sctp_handle_stream_reset(stcb, m, *offset, (struct sctp_stream_reset_out_req *)ch)) { + if (sctp_handle_stream_reset(stcb, m, *offset, ch)) { /* stop processing */ *offset = length; return (NULL); Modified: stable/8/sys/netinet/sctp_input.h ============================================================================== --- stable/8/sys/netinet/sctp_input.h Fri Mar 8 00:05:34 2013 (r247988) +++ stable/8/sys/netinet/sctp_input.h Fri Mar 8 00:07:19 2013 (r247989) @@ -53,7 +53,7 @@ sctp_find_stream_reset(struct sctp_tcb * struct sctp_tmit_chunk **bchk); void -sctp_reset_in_stream(struct sctp_tcb *stcb, int number_entries, +sctp_reset_in_stream(struct sctp_tcb *stcb, uint32_t number_entries, uint16_t * list); Modified: stable/8/sys/netinet/sctp_structs.h ============================================================================== --- stable/8/sys/netinet/sctp_structs.h Fri Mar 8 00:05:34 2013 (r247988) +++ stable/8/sys/netinet/sctp_structs.h Fri Mar 8 00:07:19 2013 (r247989) @@ -77,8 +77,8 @@ TAILQ_HEAD(sctpnetlisthead, sctp_nets); struct sctp_stream_reset_list { TAILQ_ENTRY(sctp_stream_reset_list) next_resp; uint32_t tsn; - int number_entries; - struct sctp_stream_reset_out_request req; + uint32_t number_entries; + uint16_t list_of_streams[]; }; TAILQ_HEAD(sctp_resethead, sctp_stream_reset_list); From owner-svn-src-stable@FreeBSD.ORG Fri Mar 8 00:09:26 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 11A06F87; Fri, 8 Mar 2013 00:09:26 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 03759CB0; Fri, 8 Mar 2013 00:09:26 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2809Pok066171; Fri, 8 Mar 2013 00:09:25 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2809PJv066170; Fri, 8 Mar 2013 00:09:25 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201303080009.r2809PJv066170@svn.freebsd.org> From: Michael Tuexen Date: Fri, 8 Mar 2013 00:09:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r247990 - stable/8/sys/netinet X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Mar 2013 00:09:26 -0000 Author: tuexen Date: Fri Mar 8 00:09:25 2013 New Revision: 247990 URL: http://svnweb.freebsd.org/changeset/base/247990 Log: MFC r240250: Whitespace cleanup. Modified: stable/8/sys/netinet/sctp_asconf.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/netinet/ (props changed) Modified: stable/8/sys/netinet/sctp_asconf.c ============================================================================== --- stable/8/sys/netinet/sctp_asconf.c Fri Mar 8 00:07:19 2013 (r247989) +++ stable/8/sys/netinet/sctp_asconf.c Fri Mar 8 00:09:25 2013 (r247990) @@ -1862,7 +1862,6 @@ sctp_addr_mgmt_assoc(struct sctp_inpcb * { int status; - if ((inp->sctp_flags & SCTP_PCB_FLAGS_BOUNDALL) == 0 || sctp_is_feature_off(inp, SCTP_PCB_FLAGS_DO_ASCONF)) { /* subset bound, no ASCONF allowed case, so ignore */ From owner-svn-src-stable@FreeBSD.ORG Fri Mar 8 00:12:03 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 50DE4182; Fri, 8 Mar 2013 00:12:03 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 41E5FCBA; Fri, 8 Mar 2013 00:12:03 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r280C35d068268; Fri, 8 Mar 2013 00:12:03 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r280C37S068267; Fri, 8 Mar 2013 00:12:03 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201303080012.r280C37S068267@svn.freebsd.org> From: Michael Tuexen Date: Fri, 8 Mar 2013 00:12:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r247991 - stable/8/sys/netinet X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Mar 2013 00:12:03 -0000 Author: tuexen Date: Fri Mar 8 00:12:02 2013 New Revision: 247991 URL: http://svnweb.freebsd.org/changeset/base/247991 Log: MFC r240263: Whitespace changes. Modified: stable/8/sys/netinet/sctp_pcb.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/netinet/ (props changed) Modified: stable/8/sys/netinet/sctp_pcb.c ============================================================================== --- stable/8/sys/netinet/sctp_pcb.c Fri Mar 8 00:09:25 2013 (r247990) +++ stable/8/sys/netinet/sctp_pcb.c Fri Mar 8 00:12:02 2013 (r247991) @@ -2757,7 +2757,6 @@ sctp_inpcb_bind(struct socket *so, struc return (EINVAL); } lport = sin6->sin6_port; - /* * For LOOPBACK the prison_local_ip6() call * will transmute the ipv6 address to the @@ -2795,7 +2794,7 @@ sctp_inpcb_bind(struct socket *so, struc SCTP_INP_INCR_REF(inp); if (lport) { /* - * Did the caller specify a port? if so we must see if a ep + * Did the caller specify a port? if so we must see if an ep * already has this one bound. */ /* got to be root to get at low ports */ @@ -2876,8 +2875,7 @@ continue_anyway: if (bindall) { /* verify that no lport is not used by a singleton */ if ((port_reuse_active == 0) && - (inp_tmp = sctp_isport_inuse(inp, lport, vrf_id)) - ) { + (inp_tmp = sctp_isport_inuse(inp, lport, vrf_id))) { /* Sorry someone already has this one bound */ if ((sctp_is_feature_on(inp, SCTP_PCB_FLAGS_PORTREUSE)) && (sctp_is_feature_on(inp_tmp, SCTP_PCB_FLAGS_PORTREUSE))) { @@ -3043,9 +3041,9 @@ continue_anyway: * zero out the port to find the address! yuck! can't do * this earlier since need port for sctp_pcb_findep() */ - if (sctp_ifap != NULL) + if (sctp_ifap != NULL) { ifa = sctp_ifap; - else { + } else { /* * Note for BSD we hit here always other O/S's will * pass things in via the sctp_ifap argument From owner-svn-src-stable@FreeBSD.ORG Fri Mar 8 00:13:31 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 60AA23D4; Fri, 8 Mar 2013 00:13:31 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 51607CD2; Fri, 8 Mar 2013 00:13:31 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r280DVCX068496; Fri, 8 Mar 2013 00:13:31 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r280DVTo068495; Fri, 8 Mar 2013 00:13:31 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201303080013.r280DVTo068495@svn.freebsd.org> From: Michael Tuexen Date: Fri, 8 Mar 2013 00:13:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r247992 - stable/8/sys/netinet X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Mar 2013 00:13:31 -0000 Author: tuexen Date: Fri Mar 8 00:13:30 2013 New Revision: 247992 URL: http://svnweb.freebsd.org/changeset/base/247992 Log: MFC r240507: Small cleanups. No functional change. Modified: stable/8/sys/netinet/sctputil.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/netinet/ (props changed) Modified: stable/8/sys/netinet/sctputil.c ============================================================================== --- stable/8/sys/netinet/sctputil.c Fri Mar 8 00:12:02 2013 (r247991) +++ stable/8/sys/netinet/sctputil.c Fri Mar 8 00:13:30 2013 (r247992) @@ -58,8 +58,7 @@ extern struct sctp_cc_functions sctp_cc_ extern struct sctp_ss_functions sctp_ss_functions[]; void -sctp_sblog(struct sockbuf *sb, - struct sctp_tcb *stcb, int from, int incr) +sctp_sblog(struct sockbuf *sb, struct sctp_tcb *stcb, int from, int incr) { struct sctp_cwnd_log sctp_clog; @@ -103,7 +102,6 @@ sctp_log_closing(struct sctp_inpcb *inp, sctp_clog.x.misc.log4); } - void rto_logging(struct sctp_nets *net, int from) { @@ -198,8 +196,7 @@ sctp_log_map(uint32_t map, uint32_t cum, } void -sctp_log_fr(uint32_t biggest_tsn, uint32_t biggest_new_tsn, uint32_t tsn, - int from) +sctp_log_fr(uint32_t biggest_tsn, uint32_t biggest_new_tsn, uint32_t tsn, int from) { struct sctp_cwnd_log sctp_clog; @@ -242,8 +239,7 @@ sctp_log_mb(struct mbuf *m, int from) } void -sctp_log_strm_del(struct sctp_queued_to_read *control, struct sctp_queued_to_read *poschk, - int from) +sctp_log_strm_del(struct sctp_queued_to_read *control, struct sctp_queued_to_read *poschk, int from) { struct sctp_cwnd_log sctp_clog; @@ -4215,7 +4211,6 @@ sctp_print_address(struct sockaddr *sa) #ifdef INET6 char ip6buf[INET6_ADDRSTRLEN]; - ip6buf[0] = 0; #endif switch (sa->sa_family) { From owner-svn-src-stable@FreeBSD.ORG Fri Mar 8 00:16:18 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 6C6A35C2; Fri, 8 Mar 2013 00:16:18 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 4F1C5CEE; Fri, 8 Mar 2013 00:16:18 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r280GI70068931; Fri, 8 Mar 2013 00:16:18 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r280GHg0068929; Fri, 8 Mar 2013 00:16:17 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201303080016.r280GHg0068929@svn.freebsd.org> From: Michael Tuexen Date: Fri, 8 Mar 2013 00:16:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r247993 - stable/8/sys/netinet X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Mar 2013 00:16:18 -0000 Author: tuexen Date: Fri Mar 8 00:16:17 2013 New Revision: 247993 URL: http://svnweb.freebsd.org/changeset/base/247993 Log: MFC r240826: Small cleanups. No functional change. Modified: stable/8/sys/netinet/sctp_output.c stable/8/sys/netinet/sctp_output.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/netinet/ (props changed) Modified: stable/8/sys/netinet/sctp_output.c ============================================================================== --- stable/8/sys/netinet/sctp_output.c Fri Mar 8 00:13:30 2013 (r247992) +++ stable/8/sys/netinet/sctp_output.c Fri Mar 8 00:16:17 2013 (r247993) @@ -11399,11 +11399,11 @@ sctp_send_cwr(struct sctp_tcb *stcb, str struct sctp_cwr_chunk *cwr; struct sctp_tmit_chunk *chk; - asoc = &stcb->asoc; SCTP_TCB_LOCK_ASSERT(stcb); if (net == NULL) { return; } + asoc = &stcb->asoc; TAILQ_FOREACH(chk, &asoc->control_send_queue, sctp_next) { if ((chk->rec.chunk_id.id == SCTP_ECN_CWR) && (net == chk->whoTo)) { /* @@ -11458,13 +11458,11 @@ sctp_add_stream_reset_out(struct sctp_tm int number_entries, uint16_t * list, uint32_t seq, uint32_t resp_seq, uint32_t last_sent) { - int len, old_len, i; + uint16_t len, old_len, i; struct sctp_stream_reset_out_request *req_out; struct sctp_chunkhdr *ch; ch = mtod(chk->data, struct sctp_chunkhdr *); - - old_len = len = SCTP_SIZE32(ntohs(ch->chunk_length)); /* get to new offset for the param. */ @@ -11498,19 +11496,16 @@ sctp_add_stream_reset_out(struct sctp_tm return; } - -void +static void sctp_add_stream_reset_in(struct sctp_tmit_chunk *chk, int number_entries, uint16_t * list, uint32_t seq) { - int len, old_len, i; + uint16_t len, old_len, i; struct sctp_stream_reset_in_request *req_in; struct sctp_chunkhdr *ch; ch = mtod(chk->data, struct sctp_chunkhdr *); - - old_len = len = SCTP_SIZE32(ntohs(ch->chunk_length)); /* get to new offset for the param. */ @@ -11542,18 +11537,15 @@ sctp_add_stream_reset_in(struct sctp_tmi return; } - -void +static void sctp_add_stream_reset_tsn(struct sctp_tmit_chunk *chk, uint32_t seq) { - int len, old_len; + uint16_t len, old_len; struct sctp_stream_reset_tsn_request *req_tsn; struct sctp_chunkhdr *ch; ch = mtod(chk->data, struct sctp_chunkhdr *); - - old_len = len = SCTP_SIZE32(ntohs(ch->chunk_length)); /* get to new offset for the param. */ @@ -11577,13 +11569,11 @@ void sctp_add_stream_reset_result(struct sctp_tmit_chunk *chk, uint32_t resp_seq, uint32_t result) { - int len, old_len; + uint16_t len, old_len; struct sctp_stream_reset_response *resp; struct sctp_chunkhdr *ch; ch = mtod(chk->data, struct sctp_chunkhdr *); - - old_len = len = SCTP_SIZE32(ntohs(ch->chunk_length)); /* get to new offset for the param. */ @@ -11602,22 +11592,18 @@ sctp_add_stream_reset_result(struct sctp chk->send_size = SCTP_SIZE32(chk->book_size); SCTP_BUF_LEN(chk->data) = chk->send_size; return; - } - void sctp_add_stream_reset_result_tsn(struct sctp_tmit_chunk *chk, uint32_t resp_seq, uint32_t result, uint32_t send_una, uint32_t recv_next) { - int len, old_len; + uint16_t len, old_len; struct sctp_stream_reset_response_tsn *resp; struct sctp_chunkhdr *ch; ch = mtod(chk->data, struct sctp_chunkhdr *); - - old_len = len = SCTP_SIZE32(ntohs(ch->chunk_length)); /* get to new offset for the param. */ @@ -11645,7 +11631,7 @@ sctp_add_an_out_stream(struct sctp_tmit_ uint32_t seq, uint16_t adding) { - int len, old_len; + uint16_t len, old_len; struct sctp_chunkhdr *ch; struct sctp_stream_reset_add_strm *addstr; @@ -11678,7 +11664,7 @@ sctp_add_an_in_stream(struct sctp_tmit_c uint32_t seq, uint16_t adding) { - int len, old_len; + uint16_t len, old_len; struct sctp_chunkhdr *ch; struct sctp_stream_reset_add_strm *addstr; @@ -11705,8 +11691,6 @@ sctp_add_an_in_stream(struct sctp_tmit_c return; } - - int sctp_send_str_reset_req(struct sctp_tcb *stcb, int number_entries, uint16_t * list, @@ -11715,8 +11699,7 @@ sctp_send_str_reset_req(struct sctp_tcb uint8_t send_tsn_req, uint8_t add_stream, uint16_t adding_o, - uint16_t adding_i, uint8_t peer_asked -) + uint16_t adding_i, uint8_t peer_asked) { struct sctp_association *asoc; Modified: stable/8/sys/netinet/sctp_output.h ============================================================================== --- stable/8/sys/netinet/sctp_output.h Fri Mar 8 00:13:30 2013 (r247992) +++ stable/8/sys/netinet/sctp_output.h Fri Mar 8 00:16:17 2013 (r247993) @@ -173,37 +173,19 @@ void sctp_send_cwr(struct sctp_tcb *, st void -sctp_add_stream_reset_out(struct sctp_tmit_chunk *chk, - int number_entries, uint16_t * list, - uint32_t seq, uint32_t resp_seq, uint32_t last_sent); +sctp_add_stream_reset_out(struct sctp_tmit_chunk *, + int, uint16_t *, uint32_t, uint32_t, uint32_t); void -sctp_add_stream_reset_in(struct sctp_tmit_chunk *chk, - int number_entries, uint16_t * list, - uint32_t seq); + sctp_add_stream_reset_result(struct sctp_tmit_chunk *, uint32_t, uint32_t); void -sctp_add_stream_reset_tsn(struct sctp_tmit_chunk *chk, - uint32_t seq); - -void -sctp_add_stream_reset_result(struct sctp_tmit_chunk *chk, - uint32_t resp_seq, uint32_t result); - -void -sctp_add_stream_reset_result_tsn(struct sctp_tmit_chunk *chk, - uint32_t resp_seq, uint32_t result, - uint32_t send_una, uint32_t recv_next); +sctp_add_stream_reset_result_tsn(struct sctp_tmit_chunk *, + uint32_t, uint32_t, uint32_t, uint32_t); int -sctp_send_str_reset_req(struct sctp_tcb *stcb, - int number_entries, uint16_t * list, - uint8_t send_out_req, - uint8_t send_in_req, - uint8_t send_tsn_req, - uint8_t add_stream, - uint16_t adding_o, - uint16_t adding_i, uint8_t from_peer); +sctp_send_str_reset_req(struct sctp_tcb *, int, uint16_t *, uint8_t, uint8_t, + uint8_t, uint8_t, uint16_t, uint16_t, uint8_t); void sctp_send_abort(struct mbuf *, int, struct sockaddr *, struct sockaddr *, From owner-svn-src-stable@FreeBSD.ORG Fri Mar 8 00:17:58 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id B6B44744; Fri, 8 Mar 2013 00:17:58 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 91141D03; Fri, 8 Mar 2013 00:17:58 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r280HwV2069182; Fri, 8 Mar 2013 00:17:58 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r280HwKA069181; Fri, 8 Mar 2013 00:17:58 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201303080017.r280HwKA069181@svn.freebsd.org> From: Michael Tuexen Date: Fri, 8 Mar 2013 00:17:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r247994 - stable/8/sys/netinet X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Mar 2013 00:17:58 -0000 Author: tuexen Date: Fri Mar 8 00:17:57 2013 New Revision: 247994 URL: http://svnweb.freebsd.org/changeset/base/247994 Log: MFC r240842: Fix a bug related to handling Re-config chunks. It is not true that the association can be removed if the socket is gone. Modified: stable/8/sys/netinet/sctp_input.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/netinet/ (props changed) Modified: stable/8/sys/netinet/sctp_input.c ============================================================================== --- stable/8/sys/netinet/sctp_input.c Fri Mar 8 00:16:17 2013 (r247993) +++ stable/8/sys/netinet/sctp_input.c Fri Mar 8 00:17:57 2013 (r247994) @@ -5387,23 +5387,6 @@ process_control_chunks: *offset = length; return (NULL); } - if (inp->sctp_flags & SCTP_PCB_FLAGS_SOCKET_GONE) { - /* We are not interested anymore */ -#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) - so = SCTP_INP_SO(inp); - atomic_add_int(&stcb->asoc.refcnt, 1); - SCTP_TCB_UNLOCK(stcb); - SCTP_SOCKET_LOCK(so, 1); - SCTP_TCB_LOCK(stcb); - atomic_subtract_int(&stcb->asoc.refcnt, 1); -#endif - (void)sctp_free_assoc(inp, stcb, SCTP_NORMAL_PROC, SCTP_FROM_SCTP_INPUT + SCTP_LOC_30); -#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) - SCTP_SOCKET_UNLOCK(so, 1); -#endif - *offset = length; - return (NULL); - } if (stcb->asoc.peer_supports_strreset == 0) { /* * hmm, peer should have announced this, but From owner-svn-src-stable@FreeBSD.ORG Fri Mar 8 00:19:28 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id CE668A26; Fri, 8 Mar 2013 00:19:28 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id C03E0D14; Fri, 8 Mar 2013 00:19:28 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r280JSL1069440; Fri, 8 Mar 2013 00:19:28 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r280JSE8069439; Fri, 8 Mar 2013 00:19:28 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201303080019.r280JSE8069439@svn.freebsd.org> From: Michael Tuexen Date: Fri, 8 Mar 2013 00:19:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r247995 - stable/8/sys/netinet X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Mar 2013 00:19:28 -0000 Author: tuexen Date: Fri Mar 8 00:19:28 2013 New Revision: 247995 URL: http://svnweb.freebsd.org/changeset/base/247995 Log: MFC r240848: Declare a static function as such. Modified: stable/8/sys/netinet/sctp_output.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/netinet/ (props changed) Modified: stable/8/sys/netinet/sctp_output.c ============================================================================== --- stable/8/sys/netinet/sctp_output.c Fri Mar 8 00:17:57 2013 (r247994) +++ stable/8/sys/netinet/sctp_output.c Fri Mar 8 00:19:28 2013 (r247995) @@ -6417,7 +6417,7 @@ error_out: } } -int +static int sctp_med_chunk_output(struct sctp_inpcb *inp, struct sctp_tcb *stcb, struct sctp_association *asoc, From owner-svn-src-stable@FreeBSD.ORG Fri Mar 8 00:20:56 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 78827BF7; Fri, 8 Mar 2013 00:20:56 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 52B8ED2B; Fri, 8 Mar 2013 00:20:56 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r280KutH071246; Fri, 8 Mar 2013 00:20:56 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r280KuqM071245; Fri, 8 Mar 2013 00:20:56 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201303080020.r280KuqM071245@svn.freebsd.org> From: Michael Tuexen Date: Fri, 8 Mar 2013 00:20:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r247996 - stable/8/sys/netinet X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Mar 2013 00:20:56 -0000 Author: tuexen Date: Fri Mar 8 00:20:55 2013 New Revision: 247996 URL: http://svnweb.freebsd.org/changeset/base/247996 Log: MFC r240849: Whitespace change. Modified: stable/8/sys/netinet/sctp_pcb.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/netinet/ (props changed) Modified: stable/8/sys/netinet/sctp_pcb.c ============================================================================== --- stable/8/sys/netinet/sctp_pcb.c Fri Mar 8 00:19:28 2013 (r247995) +++ stable/8/sys/netinet/sctp_pcb.c Fri Mar 8 00:20:55 2013 (r247996) @@ -3323,8 +3323,7 @@ sctp_inpcb_free(struct sctp_inpcb *inp, continue; } else if (TAILQ_EMPTY(&asoc->asoc.send_queue) && TAILQ_EMPTY(&asoc->asoc.sent_queue) && - (asoc->asoc.stream_queue_cnt == 0) - ) { + (asoc->asoc.stream_queue_cnt == 0)) { if (asoc->asoc.locked_on_sending) { goto abort_anyway; } From owner-svn-src-stable@FreeBSD.ORG Fri Mar 8 00:28:51 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 905C3FE6; Fri, 8 Mar 2013 00:28:51 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 6AEDBD67; Fri, 8 Mar 2013 00:28:51 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r280SpBx072477; Fri, 8 Mar 2013 00:28:51 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r280SpNS072476; Fri, 8 Mar 2013 00:28:51 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201303080028.r280SpNS072476@svn.freebsd.org> From: Michael Tuexen Date: Fri, 8 Mar 2013 00:28:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r247999 - stable/8/sys/netinet X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Mar 2013 00:28:51 -0000 Author: tuexen Date: Fri Mar 8 00:28:50 2013 New Revision: 247999 URL: http://svnweb.freebsd.org/changeset/base/247999 Log: MFC r242326: Add braces (as used elsewhere in the SCTP code). Modified: stable/8/sys/netinet/sctp_output.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/netinet/ (props changed) Modified: stable/8/sys/netinet/sctp_output.c ============================================================================== --- stable/8/sys/netinet/sctp_output.c Fri Mar 8 00:23:42 2013 (r247998) +++ stable/8/sys/netinet/sctp_output.c Fri Mar 8 00:28:50 2013 (r247999) @@ -3981,9 +3981,9 @@ sctp_lowlevel_chunk_output(struct sctp_i } if ((nofragment_flag) && (port == 0)) { ip->ip_off = IP_DF; - } else + } else { ip->ip_off = 0; - + } /* FreeBSD has a function for ip_id's */ ip->ip_id = ip_newid(); From owner-svn-src-stable@FreeBSD.ORG Fri Mar 8 00:34:50 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id DC8D329D; Fri, 8 Mar 2013 00:34:50 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id C2669D8D; Fri, 8 Mar 2013 00:34:50 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r280Yoab074986; Fri, 8 Mar 2013 00:34:50 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r280YoXo074985; Fri, 8 Mar 2013 00:34:50 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201303080034.r280YoXo074985@svn.freebsd.org> From: Michael Tuexen Date: Fri, 8 Mar 2013 00:34:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r248000 - stable/8/lib/libc/net X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Mar 2013 00:34:50 -0000 Author: tuexen Date: Fri Mar 8 00:34:50 2013 New Revision: 248000 URL: http://svnweb.freebsd.org/changeset/base/248000 Log: MFC r242512: Fix errno in a couple of error cases. Modified: stable/8/lib/libc/net/sctp_sys_calls.c Directory Properties: stable/8/lib/ (props changed) stable/8/lib/libc/ (props changed) Modified: stable/8/lib/libc/net/sctp_sys_calls.c ============================================================================== --- stable/8/lib/libc/net/sctp_sys_calls.c Fri Mar 8 00:28:50 2013 (r247999) +++ stable/8/lib/libc/net/sctp_sys_calls.c Fri Mar 8 00:34:50 2013 (r248000) @@ -446,6 +446,7 @@ sctp_getpaddrs(int sd, sctp_assoc_t id, opt_len = (socklen_t) ((size_t)asoc + sizeof(struct sctp_getaddresses)); addrs = calloc(1, (size_t)opt_len); if (addrs == NULL) { + errno = ENOMEM; return (-1); } addrs->sget_assoc_id = id; @@ -774,6 +775,7 @@ sctp_sendx(int sd, const void *msg, size } buf = malloc(len); if (buf == NULL) { + errno = ENOMEM; return (-1); } aa = (int *)buf; @@ -1049,7 +1051,7 @@ sctp_sendv(int sd, CMSG_SPACE(sizeof(struct sctp_authinfo)) + (size_t)addrcnt * CMSG_SPACE(sizeof(struct in6_addr))); if (cmsgbuf == NULL) { - errno = ENOBUFS; + errno = ENOMEM; return (-1); } msg.msg_control = cmsgbuf; From owner-svn-src-stable@FreeBSD.ORG Fri Mar 8 00:41:21 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id DAEBB4D8; Fri, 8 Mar 2013 00:41:21 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id B4AEFDBB; Fri, 8 Mar 2013 00:41:21 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r280fLn1077555; Fri, 8 Mar 2013 00:41:21 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r280fKYM077551; Fri, 8 Mar 2013 00:41:20 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201303080041.r280fKYM077551@svn.freebsd.org> From: Michael Tuexen Date: Fri, 8 Mar 2013 00:41:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r248001 - stable/8/sys/netinet X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Mar 2013 00:41:21 -0000 Author: tuexen Date: Fri Mar 8 00:41:20 2013 New Revision: 248001 URL: http://svnweb.freebsd.org/changeset/base/248001 Log: MFC r242627: Move from early SSN assignment to late SSN assignment. This doesn't change functionality, but makes upcoming change much easier. Developed with rrs@ at the IETF 85. Modified: stable/8/sys/netinet/sctp_input.c stable/8/sys/netinet/sctp_output.c stable/8/sys/netinet/sctp_structs.h stable/8/sys/netinet/sctputil.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/netinet/ (props changed) Modified: stable/8/sys/netinet/sctp_input.c ============================================================================== --- stable/8/sys/netinet/sctp_input.c Fri Mar 8 00:34:50 2013 (r248000) +++ stable/8/sys/netinet/sctp_input.c Fri Mar 8 00:41:20 2013 (r248001) @@ -1942,7 +1942,7 @@ sctp_process_cookie_existing(struct mbuf sctp_report_all_outbound(stcb, 0, 1, SCTP_SO_NOT_LOCKED); for (i = 0; i < stcb->asoc.streamoutcnt; i++) { stcb->asoc.strmout[i].stream_no = i; - stcb->asoc.strmout[i].next_sequence_sent = 0; + stcb->asoc.strmout[i].next_sequence_send = 0; stcb->asoc.strmout[i].last_msg_incomplete = 0; } /* process the INIT-ACK info (my info) */ @@ -3489,7 +3489,7 @@ sctp_reset_out_streams(struct sctp_tcb * if (number_entries == 0) { for (i = 0; i < stcb->asoc.streamoutcnt; i++) { - stcb->asoc.strmout[i].next_sequence_sent = 0; + stcb->asoc.strmout[i].next_sequence_send = 0; } } else if (number_entries) { for (i = 0; i < number_entries; i++) { @@ -3500,7 +3500,7 @@ sctp_reset_out_streams(struct sctp_tcb * /* no such stream */ continue; } - stcb->asoc.strmout[temp].next_sequence_sent = 0; + stcb->asoc.strmout[temp].next_sequence_send = 0; } } sctp_ulp_notify(SCTP_NOTIFY_STR_RESET_SEND, stcb, number_entries, (void *)list, SCTP_SO_NOT_LOCKED); Modified: stable/8/sys/netinet/sctp_output.c ============================================================================== --- stable/8/sys/netinet/sctp_output.c Fri Mar 8 00:34:50 2013 (r248000) +++ stable/8/sys/netinet/sctp_output.c Fri Mar 8 00:41:20 2013 (r248001) @@ -3513,7 +3513,7 @@ sctp_process_cmsgs_for_init(struct sctp_ stcb->asoc.pre_open_streams = stcb->asoc.streamoutcnt; } for (i = 0; i < stcb->asoc.streamoutcnt; i++) { - stcb->asoc.strmout[i].next_sequence_sent = 0; + stcb->asoc.strmout[i].next_sequence_send = 0; TAILQ_INIT(&stcb->asoc.strmout[i].outqueue); stcb->asoc.strmout[i].stream_no = i; stcb->asoc.strmout[i].last_msg_incomplete = 0; @@ -6199,7 +6199,6 @@ sctp_msg_append(struct sctp_tcb *stcb, sp->timetolive = srcv->sinfo_timetolive; sp->ppid = srcv->sinfo_ppid; sp->context = srcv->sinfo_context; - sp->strseq = 0; if (sp->sinfo_flags & SCTP_ADDR_OVER) { sp->net = net; atomic_add_int(&sp->net->ref_count, 1); @@ -6240,10 +6239,6 @@ sctp_msg_append(struct sctp_tcb *stcb, sctp_snd_sb_alloc(stcb, sp->length); atomic_add_int(&stcb->asoc.stream_queue_cnt, 1); TAILQ_INSERT_TAIL(&strm->outqueue, sp, next); - if ((srcv->sinfo_flags & SCTP_UNORDERED) == 0) { - sp->strseq = strm->next_sequence_sent; - strm->next_sequence_sent++; - } stcb->asoc.ss_functions.sctp_ss_add_to_stream(stcb, &stcb->asoc, strm, sp, 1); m = NULL; if (hold_stcb_lock == 0) { @@ -7384,7 +7379,10 @@ dont_do_it: chk->asoc = &stcb->asoc; chk->pad_inplace = 0; chk->no_fr_allowed = 0; - chk->rec.data.stream_seq = sp->strseq; + chk->rec.data.stream_seq = strq->next_sequence_send; + if (rcv_flags & SCTP_DATA_LAST_FRAG) { + strq->next_sequence_send++; + } chk->rec.data.stream_number = sp->stream; chk->rec.data.payloadtype = sp->ppid; chk->rec.data.context = sp->context; @@ -11799,7 +11797,7 @@ sctp_send_str_reset_req(struct sctp_tcb stcb->asoc.ss_functions.sctp_ss_clear(stcb, &stcb->asoc, 0, 1); for (i = 0; i < stcb->asoc.streamoutcnt; i++) { TAILQ_INIT(&stcb->asoc.strmout[i].outqueue); - stcb->asoc.strmout[i].next_sequence_sent = oldstream[i].next_sequence_sent; + stcb->asoc.strmout[i].next_sequence_send = oldstream[i].next_sequence_send; stcb->asoc.strmout[i].last_msg_incomplete = oldstream[i].last_msg_incomplete; stcb->asoc.strmout[i].stream_no = i; stcb->asoc.ss_functions.sctp_ss_init_stream(&stcb->asoc.strmout[i], &oldstream[i]); @@ -11819,7 +11817,7 @@ sctp_send_str_reset_req(struct sctp_tcb /* now the new streams */ stcb->asoc.ss_functions.sctp_ss_init(stcb, &stcb->asoc, 1); for (i = stcb->asoc.streamoutcnt; i < (stcb->asoc.streamoutcnt + adding_o); i++) { - stcb->asoc.strmout[i].next_sequence_sent = 0x0; + stcb->asoc.strmout[i].next_sequence_send = 0x0; TAILQ_INIT(&stcb->asoc.strmout[i].outqueue); stcb->asoc.strmout[i].stream_no = i; stcb->asoc.strmout[i].last_msg_incomplete = 0; @@ -11976,7 +11974,6 @@ sctp_copy_it_in(struct sctp_tcb *stcb, sp->timetolive = srcv->sinfo_timetolive; sp->ppid = srcv->sinfo_ppid; sp->context = srcv->sinfo_context; - sp->strseq = 0; (void)SCTP_GETTIME_TIMEVAL(&sp->ts); sp->stream = srcv->sinfo_stream; @@ -12729,15 +12726,7 @@ skip_preblock: } sctp_snd_sb_alloc(stcb, sp->length); atomic_add_int(&asoc->stream_queue_cnt, 1); - if ((srcv->sinfo_flags & SCTP_UNORDERED) == 0) { - sp->strseq = strm->next_sequence_sent; - if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_LOG_AT_SEND_2_SCTP) { - sctp_misc_ints(SCTP_STRMOUT_LOG_ASSIGN, - (uintptr_t) stcb, sp->length, - (uint32_t) ((srcv->sinfo_stream << 16) | sp->strseq), 0); - } - strm->next_sequence_sent++; - } else { + if (srcv->sinfo_flags & SCTP_UNORDERED) { SCTP_STAT_INCR(sctps_sends_with_unord); } TAILQ_INSERT_TAIL(&strm->outqueue, sp, next); Modified: stable/8/sys/netinet/sctp_structs.h ============================================================================== --- stable/8/sys/netinet/sctp_structs.h Fri Mar 8 00:34:50 2013 (r248000) +++ stable/8/sys/netinet/sctp_structs.h Fri Mar 8 00:41:20 2013 (r248001) @@ -515,7 +515,6 @@ struct sctp_stream_queue_pending { uint32_t context; uint16_t sinfo_flags; uint16_t stream; - uint16_t strseq; uint16_t act_flags; uint16_t auth_keyid; uint8_t holds_key_ref; @@ -588,7 +587,7 @@ struct sctp_stream_out { struct sctp_streamhead outqueue; union scheduling_parameters ss_params; uint16_t stream_no; - uint16_t next_sequence_sent; /* next one I expect to send out */ + uint16_t next_sequence_send; /* next one I expect to send out */ uint8_t last_msg_incomplete; }; Modified: stable/8/sys/netinet/sctputil.c ============================================================================== --- stable/8/sys/netinet/sctputil.c Fri Mar 8 00:34:50 2013 (r248000) +++ stable/8/sys/netinet/sctputil.c Fri Mar 8 00:41:20 2013 (r248001) @@ -1052,7 +1052,7 @@ sctp_init_asoc(struct sctp_inpcb *m, str * that were dropped must be notified to the upper layer as * failed to send. */ - asoc->strmout[i].next_sequence_sent = 0x0; + asoc->strmout[i].next_sequence_send = 0x0; TAILQ_INIT(&asoc->strmout[i].outqueue); asoc->strmout[i].stream_no = i; asoc->strmout[i].last_msg_incomplete = 0; @@ -2973,7 +2973,7 @@ sctp_notify_send_failed2(struct sctp_tcb /* not exactly what the user sent in, but should be close :) */ bzero(&ssf->ssf_info, sizeof(ssf->ssf_info)); ssf->ssf_info.sinfo_stream = sp->stream; - ssf->ssf_info.sinfo_ssn = sp->strseq; + ssf->ssf_info.sinfo_ssn = 0; if (sp->some_taken) { ssf->ssf_info.sinfo_flags = SCTP_DATA_LAST_FRAG; } else { @@ -4774,77 +4774,69 @@ sctp_release_pr_sctp_chunk(struct sctp_t * Still no eom found. That means there is stuff left on the * stream out queue.. yuck. */ - strq = &stcb->asoc.strmout[stream]; SCTP_TCB_SEND_LOCK(stcb); - TAILQ_FOREACH(sp, &strq->outqueue, next) { - /* FIXME: Shouldn't this be a serial number check? */ - if (sp->strseq > seq) { - break; - } - /* Check if its our SEQ */ - if (sp->strseq == seq) { - sp->discard_rest = 1; - /* - * We may need to put a chunk on the queue - * that holds the TSN that would have been - * sent with the LAST bit. - */ + strq = &stcb->asoc.strmout[stream]; + sp = TAILQ_FIRST(&strq->outqueue); + if (sp != NULL) { + sp->discard_rest = 1; + /* + * We may need to put a chunk on the queue that + * holds the TSN that would have been sent with the + * LAST bit. + */ + if (chk == NULL) { + /* Yep, we have to */ + sctp_alloc_a_chunk(stcb, chk); if (chk == NULL) { - /* Yep, we have to */ - sctp_alloc_a_chunk(stcb, chk); - if (chk == NULL) { - /* - * we are hosed. All we can - * do is nothing.. which - * will cause an abort if - * the peer is paying - * attention. - */ - goto oh_well; - } - memset(chk, 0, sizeof(*chk)); - chk->rec.data.rcv_flags = SCTP_DATA_LAST_FRAG; - chk->sent = SCTP_FORWARD_TSN_SKIP; - chk->asoc = &stcb->asoc; - chk->rec.data.stream_seq = sp->strseq; - chk->rec.data.stream_number = sp->stream; - chk->rec.data.payloadtype = sp->ppid; - chk->rec.data.context = sp->context; - chk->flags = sp->act_flags; - if (sp->net) - chk->whoTo = sp->net; - else - chk->whoTo = stcb->asoc.primary_destination; - atomic_add_int(&chk->whoTo->ref_count, 1); - chk->rec.data.TSN_seq = atomic_fetchadd_int(&stcb->asoc.sending_seq, 1); - stcb->asoc.pr_sctp_cnt++; - chk->pr_sctp_on = 1; - TAILQ_INSERT_TAIL(&stcb->asoc.sent_queue, chk, sctp_next); - stcb->asoc.sent_queue_cnt++; - stcb->asoc.pr_sctp_cnt++; - } else { - chk->rec.data.rcv_flags |= SCTP_DATA_LAST_FRAG; - } - oh_well: - if (sp->data) { /* - * Pull any data to free up the SB - * and allow sender to "add more" - * while we will throw away :-) + * we are hosed. All we can do is + * nothing.. which will cause an + * abort if the peer is paying + * attention. */ - sctp_free_spbufspace(stcb, &stcb->asoc, - sp); - ret_sz += sp->length; - do_wakeup_routine = 1; - sp->some_taken = 1; - sctp_m_freem(sp->data); - sp->data = NULL; - sp->tail_mbuf = NULL; - sp->length = 0; + goto oh_well; } - break; + memset(chk, 0, sizeof(*chk)); + chk->rec.data.rcv_flags = SCTP_DATA_LAST_FRAG; + chk->sent = SCTP_FORWARD_TSN_SKIP; + chk->asoc = &stcb->asoc; + chk->rec.data.stream_seq = strq->next_sequence_send; + chk->rec.data.stream_number = sp->stream; + chk->rec.data.payloadtype = sp->ppid; + chk->rec.data.context = sp->context; + chk->flags = sp->act_flags; + if (sp->net) + chk->whoTo = sp->net; + else + chk->whoTo = stcb->asoc.primary_destination; + atomic_add_int(&chk->whoTo->ref_count, 1); + chk->rec.data.TSN_seq = atomic_fetchadd_int(&stcb->asoc.sending_seq, 1); + stcb->asoc.pr_sctp_cnt++; + chk->pr_sctp_on = 1; + TAILQ_INSERT_TAIL(&stcb->asoc.sent_queue, chk, sctp_next); + stcb->asoc.sent_queue_cnt++; + stcb->asoc.pr_sctp_cnt++; + } else { + chk->rec.data.rcv_flags |= SCTP_DATA_LAST_FRAG; + } + strq->next_sequence_send++; + oh_well: + if (sp->data) { + /* + * Pull any data to free up the SB and allow + * sender to "add more" while we will throw + * away :-) + */ + sctp_free_spbufspace(stcb, &stcb->asoc, sp); + ret_sz += sp->length; + do_wakeup_routine = 1; + sp->some_taken = 1; + sctp_m_freem(sp->data); + sp->data = NULL; + sp->tail_mbuf = NULL; + sp->length = 0; } - } /* End tailq_foreach */ + } SCTP_TCB_SEND_UNLOCK(stcb); } if (do_wakeup_routine) { From owner-svn-src-stable@FreeBSD.ORG Fri Mar 8 00:43:50 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id D19FD664; Fri, 8 Mar 2013 00:43:50 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id AA29DDCE; Fri, 8 Mar 2013 00:43:50 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r280hoou077941; Fri, 8 Mar 2013 00:43:50 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r280hooc077934; Fri, 8 Mar 2013 00:43:50 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201303080043.r280hooc077934@svn.freebsd.org> From: Michael Tuexen Date: Fri, 8 Mar 2013 00:43:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r248002 - stable/8/sys/netinet X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Mar 2013 00:43:50 -0000 Author: tuexen Date: Fri Mar 8 00:43:49 2013 New Revision: 248002 URL: http://svnweb.freebsd.org/changeset/base/248002 Log: MFC r242708,r242709: Improve PR-SCTP if used in combination with NR-SACK. Based on work done by Mohammad Rajiullah. Modified: stable/8/sys/netinet/sctp_constants.h stable/8/sys/netinet/sctp_indata.c stable/8/sys/netinet/sctp_output.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/netinet/ (props changed) Modified: stable/8/sys/netinet/sctp_constants.h ============================================================================== --- stable/8/sys/netinet/sctp_constants.h Fri Mar 8 00:41:20 2013 (r248001) +++ stable/8/sys/netinet/sctp_constants.h Fri Mar 8 00:43:49 2013 (r248002) @@ -370,6 +370,7 @@ __FBSDID("$FreeBSD$"); #define SCTP_DATAGRAM_ACKED 10010 #define SCTP_DATAGRAM_MARKED 20010 #define SCTP_FORWARD_TSN_SKIP 30010 +#define SCTP_DATAGRAM_NR_MARKED 40010 /* chunk output send from locations */ #define SCTP_OUTPUT_FROM_USR_SEND 0 Modified: stable/8/sys/netinet/sctp_indata.c ============================================================================== --- stable/8/sys/netinet/sctp_indata.c Fri Mar 8 00:41:20 2013 (r248001) +++ stable/8/sys/netinet/sctp_indata.c Fri Mar 8 00:43:49 2013 (r248002) @@ -2975,9 +2975,10 @@ sctp_process_segment_range(struct sctp_t * All chunks NOT UNSENT fall through here and are marked * (leave PR-SCTP ones that are to skip alone though) */ - if (tp1->sent != SCTP_FORWARD_TSN_SKIP) + if ((tp1->sent != SCTP_FORWARD_TSN_SKIP) && + (tp1->sent != SCTP_DATAGRAM_NR_MARKED)) { tp1->sent = SCTP_DATAGRAM_MARKED; - + } if (tp1->rec.data.chunk_was_revoked) { /* deflate the cwnd */ tp1->whoTo->cwnd -= tp1->book_size; @@ -2985,6 +2986,7 @@ sctp_process_segment_range(struct sctp_t } /* NR Sack code here */ if (nr_sacking) { + tp1->sent = SCTP_DATAGRAM_NR_MARKED; if (tp1->data) { /* * sa_ignore @@ -3600,12 +3602,14 @@ sctp_try_advance_peer_ack_point(struct s } TAILQ_FOREACH_SAFE(tp1, &asoc->sent_queue, sctp_next, tp2) { if (tp1->sent != SCTP_FORWARD_TSN_SKIP && - tp1->sent != SCTP_DATAGRAM_RESEND) { + tp1->sent != SCTP_DATAGRAM_RESEND && + tp1->sent != SCTP_DATAGRAM_NR_MARKED) { /* no chance to advance, out of here */ break; } if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_LOG_TRY_ADVANCE) { - if (tp1->sent == SCTP_FORWARD_TSN_SKIP) { + if ((tp1->sent == SCTP_FORWARD_TSN_SKIP) || + (tp1->sent == SCTP_DATAGRAM_NR_MARKED)) { sctp_misc_ints(SCTP_FWD_TSN_CHECK, asoc->advanced_peer_ack_point, tp1->rec.data.TSN_seq, 0, 0); @@ -3653,7 +3657,8 @@ sctp_try_advance_peer_ack_point(struct s * the chunk, advance our peer ack point and we can check * the next chunk. */ - if (tp1->sent == SCTP_FORWARD_TSN_SKIP) { + if ((tp1->sent == SCTP_FORWARD_TSN_SKIP) || + (tp1->sent == SCTP_DATAGRAM_NR_MARKED)) { /* advance PeerAckPoint goes forward */ if (SCTP_TSN_GT(tp1->rec.data.TSN_seq, asoc->advanced_peer_ack_point)) { asoc->advanced_peer_ack_point = tp1->rec.data.TSN_seq; Modified: stable/8/sys/netinet/sctp_output.c ============================================================================== --- stable/8/sys/netinet/sctp_output.c Fri Mar 8 00:41:20 2013 (r248001) +++ stable/8/sys/netinet/sctp_output.c Fri Mar 8 00:43:49 2013 (r248002) @@ -10157,7 +10157,8 @@ sctp_fill_in_rest: unsigned int cnt_of_skipped = 0; TAILQ_FOREACH(at, &asoc->sent_queue, sctp_next) { - if (at->sent != SCTP_FORWARD_TSN_SKIP) { + if ((at->sent != SCTP_FORWARD_TSN_SKIP) && + (at->sent != SCTP_DATAGRAM_NR_MARKED)) { /* no more to look at */ break; } From owner-svn-src-stable@FreeBSD.ORG Fri Mar 8 00:46:07 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 23FA07E2; Fri, 8 Mar 2013 00:46:07 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id F079BDDF; Fri, 8 Mar 2013 00:46:06 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r280k6cY078370; Fri, 8 Mar 2013 00:46:06 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r280k5p0078364; Fri, 8 Mar 2013 00:46:05 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201303080046.r280k5p0078364@svn.freebsd.org> From: Michael Tuexen Date: Fri, 8 Mar 2013 00:46:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r248003 - stable/8/sys/netinet X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Mar 2013 00:46:07 -0000 Author: tuexen Date: Fri Mar 8 00:46:05 2013 New Revision: 248003 URL: http://svnweb.freebsd.org/changeset/base/248003 Log: MFC r242714: Add per outgoing stream accounting for chunks in the send and sent queue. This provides no functional change, but is a preparation for an upcoming stream reset improvement. Done with rrs@. Modified: stable/8/sys/netinet/sctp_indata.c stable/8/sys/netinet/sctp_input.c stable/8/sys/netinet/sctp_pcb.c stable/8/sys/netinet/sctp_structs.h stable/8/sys/netinet/sctp_timer.c stable/8/sys/netinet/sctputil.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/netinet/ (props changed) Modified: stable/8/sys/netinet/sctp_indata.c ============================================================================== --- stable/8/sys/netinet/sctp_indata.c Fri Mar 8 00:43:49 2013 (r248002) +++ stable/8/sys/netinet/sctp_indata.c Fri Mar 8 00:46:05 2013 (r248003) @@ -3963,7 +3963,15 @@ sctp_express_handle_sack(struct sctp_tcb tp1->whoTo->cwnd -= tp1->book_size; tp1->rec.data.chunk_was_revoked = 0; } - tp1->sent = SCTP_DATAGRAM_ACKED; + if (tp1->sent != SCTP_DATAGRAM_NR_MARKED) { + if (asoc->strmout[tp1->rec.data.stream_number].chunks_on_queues > 0) { + asoc->strmout[tp1->rec.data.stream_number].chunks_on_queues--; +#ifdef INVARIANTS + } else { + panic("No chunks on the queues for sid %u.", tp1->rec.data.stream_number); +#endif + } + } TAILQ_REMOVE(&asoc->sent_queue, tp1, sctp_next); if (tp1->data) { /* sa_ignore NO_NULL_CHK */ @@ -4699,10 +4707,14 @@ sctp_handle_sack(struct mbuf *m, int off if (SCTP_TSN_GT(tp1->rec.data.TSN_seq, cum_ack)) { break; } - if (tp1->sent == SCTP_DATAGRAM_UNSENT) { - /* no more sent on list */ - SCTP_PRINTF("Warning, tp1->sent == %d and its now acked?\n", - tp1->sent); + if (tp1->sent != SCTP_DATAGRAM_NR_MARKED) { + if (asoc->strmout[tp1->rec.data.stream_number].chunks_on_queues > 0) { + asoc->strmout[tp1->rec.data.stream_number].chunks_on_queues--; +#ifdef INVARIANTS + } else { + panic("No chunks on the queues for sid %u.", tp1->rec.data.stream_number); +#endif + } } TAILQ_REMOVE(&asoc->sent_queue, tp1, sctp_next); if (tp1->pr_sctp_on) { Modified: stable/8/sys/netinet/sctp_input.c ============================================================================== --- stable/8/sys/netinet/sctp_input.c Fri Mar 8 00:43:49 2013 (r248002) +++ stable/8/sys/netinet/sctp_input.c Fri Mar 8 00:46:05 2013 (r248003) @@ -311,6 +311,13 @@ sctp_process_init(struct sctp_init_chunk if (chk->rec.data.stream_number >= newcnt) { TAILQ_REMOVE(&asoc->send_queue, chk, sctp_next); asoc->send_queue_cnt--; + if (asoc->strmout[chk->rec.data.stream_number].chunks_on_queues > 0) { + asoc->strmout[chk->rec.data.stream_number].chunks_on_queues--; +#ifdef INVARIANTS + } else { + panic("No chunks on the queues for sid %u.", chk->rec.data.stream_number); +#endif + } if (chk->data != NULL) { sctp_free_bufspace(stcb, asoc, chk, 1); sctp_ulp_notify(SCTP_NOTIFY_UNSENT_DG_FAIL, stcb, Modified: stable/8/sys/netinet/sctp_pcb.c ============================================================================== --- stable/8/sys/netinet/sctp_pcb.c Fri Mar 8 00:43:49 2013 (r248002) +++ stable/8/sys/netinet/sctp_pcb.c Fri Mar 8 00:46:05 2013 (r248003) @@ -4949,6 +4949,15 @@ sctp_free_assoc(struct sctp_inpcb *inp, } /* sent queue SHOULD be empty */ TAILQ_FOREACH_SAFE(chk, &asoc->sent_queue, sctp_next, nchk) { + if (chk->sent != SCTP_DATAGRAM_NR_MARKED) { + if (asoc->strmout[chk->rec.data.stream_number].chunks_on_queues > 0) { + asoc->strmout[chk->rec.data.stream_number].chunks_on_queues--; +#ifdef INVARIANTS + } else { + panic("No chunks on the queues for sid %u.", chk->rec.data.stream_number); +#endif + } + } TAILQ_REMOVE(&asoc->sent_queue, chk, sctp_next); if (chk->data) { if (so) { Modified: stable/8/sys/netinet/sctp_structs.h ============================================================================== --- stable/8/sys/netinet/sctp_structs.h Fri Mar 8 00:43:49 2013 (r248002) +++ stable/8/sys/netinet/sctp_structs.h Fri Mar 8 00:46:05 2013 (r248003) @@ -586,6 +586,7 @@ union scheduling_parameters { struct sctp_stream_out { struct sctp_streamhead outqueue; union scheduling_parameters ss_params; + uint32_t chunks_on_queues; uint16_t stream_no; uint16_t next_sequence_send; /* next one I expect to send out */ uint8_t last_msg_incomplete; Modified: stable/8/sys/netinet/sctp_timer.c ============================================================================== --- stable/8/sys/netinet/sctp_timer.c Fri Mar 8 00:43:49 2013 (r248002) +++ stable/8/sys/netinet/sctp_timer.c Fri Mar 8 00:46:05 2013 (r248003) @@ -440,6 +440,11 @@ sctp_recover_sent_list(struct sctp_tcb * if (SCTP_TSN_GE(asoc->last_acked_seq, chk->rec.data.TSN_seq)) { SCTP_PRINTF("Found chk:%p tsn:%x <= last_acked_seq:%x\n", (void *)chk, chk->rec.data.TSN_seq, asoc->last_acked_seq); + if (chk->sent != SCTP_DATAGRAM_NR_MARKED) { + if (asoc->strmout[chk->rec.data.stream_number].chunks_on_queues > 0) { + asoc->strmout[chk->rec.data.stream_number].chunks_on_queues--; + } + } TAILQ_REMOVE(&asoc->sent_queue, chk, sctp_next); if (chk->pr_sctp_on) { if (asoc->pr_sctp_cnt != 0) Modified: stable/8/sys/netinet/sctputil.c ============================================================================== --- stable/8/sys/netinet/sctputil.c Fri Mar 8 00:43:49 2013 (r248002) +++ stable/8/sys/netinet/sctputil.c Fri Mar 8 00:46:05 2013 (r248003) @@ -3727,6 +3727,15 @@ sctp_report_all_outbound(struct sctp_tcb TAILQ_FOREACH_SAFE(chk, &asoc->sent_queue, sctp_next, nchk) { TAILQ_REMOVE(&asoc->sent_queue, chk, sctp_next); asoc->sent_queue_cnt--; + if (chk->sent != SCTP_DATAGRAM_NR_MARKED) { + if (asoc->strmout[chk->rec.data.stream_number].chunks_on_queues > 0) { + asoc->strmout[chk->rec.data.stream_number].chunks_on_queues--; +#ifdef INVARIANTS + } else { + panic("No chunks on the queues for sid %u.", chk->rec.data.stream_number); +#endif + } + } if (chk->data != NULL) { sctp_free_bufspace(stcb, asoc, chk, 1); sctp_ulp_notify(SCTP_NOTIFY_SENT_DG_FAIL, stcb, @@ -3743,6 +3752,13 @@ sctp_report_all_outbound(struct sctp_tcb TAILQ_FOREACH_SAFE(chk, &asoc->send_queue, sctp_next, nchk) { TAILQ_REMOVE(&asoc->send_queue, chk, sctp_next); asoc->send_queue_cnt--; + if (asoc->strmout[chk->rec.data.stream_number].chunks_on_queues > 0) { + asoc->strmout[chk->rec.data.stream_number].chunks_on_queues--; +#ifdef INVARIANTS + } else { + panic("No chunks on the queues for sid %u.", chk->rec.data.stream_number); +#endif + } if (chk->data != NULL) { sctp_free_bufspace(stcb, asoc, chk, 1); sctp_ulp_notify(SCTP_NOTIFY_UNSENT_DG_FAIL, stcb, From owner-svn-src-stable@FreeBSD.ORG Fri Mar 8 00:48:17 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id F182495A; Fri, 8 Mar 2013 00:48:16 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id C7C84DEE; Fri, 8 Mar 2013 00:48:16 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r280mG1L078769; Fri, 8 Mar 2013 00:48:16 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r280mFmY078755; Fri, 8 Mar 2013 00:48:15 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201303080048.r280mFmY078755@svn.freebsd.org> From: Michael Tuexen Date: Fri, 8 Mar 2013 00:48:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r248004 - stable/8/sys/netinet X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Mar 2013 00:48:17 -0000 Author: tuexen Date: Fri Mar 8 00:48:15 2013 New Revision: 248004 URL: http://svnweb.freebsd.org/changeset/base/248004 Log: MFC r243157: Get the accounting working. We now have counters how many chunks for each SCTP outgoing stream are in the send and sent queue. While there, improve the naming of NR-SACK related constants recently introduced. Modified: stable/8/sys/netinet/sctp_constants.h stable/8/sys/netinet/sctp_indata.c stable/8/sys/netinet/sctp_input.c stable/8/sys/netinet/sctp_output.c stable/8/sys/netinet/sctp_pcb.c stable/8/sys/netinet/sctp_timer.c stable/8/sys/netinet/sctputil.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/netinet/ (props changed) Modified: stable/8/sys/netinet/sctp_constants.h ============================================================================== --- stable/8/sys/netinet/sctp_constants.h Fri Mar 8 00:46:05 2013 (r248003) +++ stable/8/sys/netinet/sctp_constants.h Fri Mar 8 00:48:15 2013 (r248004) @@ -370,7 +370,7 @@ __FBSDID("$FreeBSD$"); #define SCTP_DATAGRAM_ACKED 10010 #define SCTP_DATAGRAM_MARKED 20010 #define SCTP_FORWARD_TSN_SKIP 30010 -#define SCTP_DATAGRAM_NR_MARKED 40010 +#define SCTP_DATAGRAM_NR_ACKED 40010 /* chunk output send from locations */ #define SCTP_OUTPUT_FROM_USR_SEND 0 Modified: stable/8/sys/netinet/sctp_indata.c ============================================================================== --- stable/8/sys/netinet/sctp_indata.c Fri Mar 8 00:46:05 2013 (r248003) +++ stable/8/sys/netinet/sctp_indata.c Fri Mar 8 00:48:15 2013 (r248004) @@ -2976,7 +2976,7 @@ sctp_process_segment_range(struct sctp_t * (leave PR-SCTP ones that are to skip alone though) */ if ((tp1->sent != SCTP_FORWARD_TSN_SKIP) && - (tp1->sent != SCTP_DATAGRAM_NR_MARKED)) { + (tp1->sent != SCTP_DATAGRAM_NR_ACKED)) { tp1->sent = SCTP_DATAGRAM_MARKED; } if (tp1->rec.data.chunk_was_revoked) { @@ -2985,8 +2985,16 @@ sctp_process_segment_range(struct sctp_t tp1->rec.data.chunk_was_revoked = 0; } /* NR Sack code here */ - if (nr_sacking) { - tp1->sent = SCTP_DATAGRAM_NR_MARKED; + if (nr_sacking && + (tp1->sent != SCTP_DATAGRAM_NR_ACKED)) { + if (stcb->asoc.strmout[tp1->rec.data.stream_number].chunks_on_queues > 0) { + stcb->asoc.strmout[tp1->rec.data.stream_number].chunks_on_queues--; +#ifdef INVARIANTS + } else { + panic("No chunks on the queues for sid %u.", tp1->rec.data.stream_number); +#endif + } + tp1->sent = SCTP_DATAGRAM_NR_ACKED; if (tp1->data) { /* * sa_ignore @@ -3091,7 +3099,6 @@ sctp_check_for_revoked(struct sctp_tcb * uint32_t biggest_tsn_acked) { struct sctp_tmit_chunk *tp1; - int tot_revoked = 0; TAILQ_FOREACH(tp1, &asoc->sent_queue, sctp_next) { if (SCTP_TSN_GT(tp1->rec.data.TSN_seq, cumack)) { @@ -3126,7 +3133,6 @@ sctp_check_for_revoked(struct sctp_tcb * * artificial inflation of the flight_size. */ tp1->whoTo->cwnd += tp1->book_size; - tot_revoked++; if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_SACK_LOGGING_ENABLE) { sctp_log_sack(asoc->last_acked_seq, cumack, @@ -3603,13 +3609,13 @@ sctp_try_advance_peer_ack_point(struct s TAILQ_FOREACH_SAFE(tp1, &asoc->sent_queue, sctp_next, tp2) { if (tp1->sent != SCTP_FORWARD_TSN_SKIP && tp1->sent != SCTP_DATAGRAM_RESEND && - tp1->sent != SCTP_DATAGRAM_NR_MARKED) { + tp1->sent != SCTP_DATAGRAM_NR_ACKED) { /* no chance to advance, out of here */ break; } if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_LOG_TRY_ADVANCE) { if ((tp1->sent == SCTP_FORWARD_TSN_SKIP) || - (tp1->sent == SCTP_DATAGRAM_NR_MARKED)) { + (tp1->sent == SCTP_DATAGRAM_NR_ACKED)) { sctp_misc_ints(SCTP_FWD_TSN_CHECK, asoc->advanced_peer_ack_point, tp1->rec.data.TSN_seq, 0, 0); @@ -3658,7 +3664,7 @@ sctp_try_advance_peer_ack_point(struct s * the next chunk. */ if ((tp1->sent == SCTP_FORWARD_TSN_SKIP) || - (tp1->sent == SCTP_DATAGRAM_NR_MARKED)) { + (tp1->sent == SCTP_DATAGRAM_NR_ACKED)) { /* advance PeerAckPoint goes forward */ if (SCTP_TSN_GT(tp1->rec.data.TSN_seq, asoc->advanced_peer_ack_point)) { asoc->advanced_peer_ack_point = tp1->rec.data.TSN_seq; @@ -3963,7 +3969,7 @@ sctp_express_handle_sack(struct sctp_tcb tp1->whoTo->cwnd -= tp1->book_size; tp1->rec.data.chunk_was_revoked = 0; } - if (tp1->sent != SCTP_DATAGRAM_NR_MARKED) { + if (tp1->sent != SCTP_DATAGRAM_NR_ACKED) { if (asoc->strmout[tp1->rec.data.stream_number].chunks_on_queues > 0) { asoc->strmout[tp1->rec.data.stream_number].chunks_on_queues--; #ifdef INVARIANTS @@ -4630,7 +4636,9 @@ sctp_handle_sack(struct mbuf *m, int off tp1->whoTo->cwnd -= tp1->book_size; tp1->rec.data.chunk_was_revoked = 0; } - tp1->sent = SCTP_DATAGRAM_ACKED; + if (tp1->sent != SCTP_DATAGRAM_NR_ACKED) { + tp1->sent = SCTP_DATAGRAM_ACKED; + } } } else { break; @@ -4707,7 +4715,7 @@ sctp_handle_sack(struct mbuf *m, int off if (SCTP_TSN_GT(tp1->rec.data.TSN_seq, cum_ack)) { break; } - if (tp1->sent != SCTP_DATAGRAM_NR_MARKED) { + if (tp1->sent != SCTP_DATAGRAM_NR_ACKED) { if (asoc->strmout[tp1->rec.data.stream_number].chunks_on_queues > 0) { asoc->strmout[tp1->rec.data.stream_number].chunks_on_queues--; #ifdef INVARIANTS Modified: stable/8/sys/netinet/sctp_input.c ============================================================================== --- stable/8/sys/netinet/sctp_input.c Fri Mar 8 00:46:05 2013 (r248003) +++ stable/8/sys/netinet/sctp_input.c Fri Mar 8 00:48:15 2013 (r248004) @@ -1948,6 +1948,7 @@ sctp_process_cookie_existing(struct mbuf sctp_report_all_outbound(stcb, 0, 1, SCTP_SO_NOT_LOCKED); for (i = 0; i < stcb->asoc.streamoutcnt; i++) { + stcb->asoc.strmout[i].chunks_on_queues = 0; stcb->asoc.strmout[i].stream_no = i; stcb->asoc.strmout[i].next_sequence_send = 0; stcb->asoc.strmout[i].last_msg_incomplete = 0; Modified: stable/8/sys/netinet/sctp_output.c ============================================================================== --- stable/8/sys/netinet/sctp_output.c Fri Mar 8 00:46:05 2013 (r248003) +++ stable/8/sys/netinet/sctp_output.c Fri Mar 8 00:48:15 2013 (r248004) @@ -3513,8 +3513,9 @@ sctp_process_cmsgs_for_init(struct sctp_ stcb->asoc.pre_open_streams = stcb->asoc.streamoutcnt; } for (i = 0; i < stcb->asoc.streamoutcnt; i++) { - stcb->asoc.strmout[i].next_sequence_send = 0; TAILQ_INIT(&stcb->asoc.strmout[i].outqueue); + stcb->asoc.strmout[i].chunks_on_queues = 0; + stcb->asoc.strmout[i].next_sequence_send = 0; stcb->asoc.strmout[i].stream_no = i; stcb->asoc.strmout[i].last_msg_incomplete = 0; stcb->asoc.ss_functions.sctp_ss_init_stream(&stcb->asoc.strmout[i], NULL); @@ -7499,6 +7500,7 @@ dont_do_it: *locked = 1; } asoc->chunks_on_out_queue++; + strq->chunks_on_queues++; TAILQ_INSERT_TAIL(&asoc->send_queue, chk, sctp_next); asoc->send_queue_cnt++; out_of: @@ -10158,7 +10160,7 @@ sctp_fill_in_rest: TAILQ_FOREACH(at, &asoc->sent_queue, sctp_next) { if ((at->sent != SCTP_FORWARD_TSN_SKIP) && - (at->sent != SCTP_DATAGRAM_NR_MARKED)) { + (at->sent != SCTP_DATAGRAM_NR_ACKED)) { /* no more to look at */ break; } @@ -11798,6 +11800,7 @@ sctp_send_str_reset_req(struct sctp_tcb stcb->asoc.ss_functions.sctp_ss_clear(stcb, &stcb->asoc, 0, 1); for (i = 0; i < stcb->asoc.streamoutcnt; i++) { TAILQ_INIT(&stcb->asoc.strmout[i].outqueue); + stcb->asoc.strmout[i].chunks_on_queues = oldstream[i].chunks_on_queues; stcb->asoc.strmout[i].next_sequence_send = oldstream[i].next_sequence_send; stcb->asoc.strmout[i].last_msg_incomplete = oldstream[i].last_msg_incomplete; stcb->asoc.strmout[i].stream_no = i; @@ -11818,8 +11821,9 @@ sctp_send_str_reset_req(struct sctp_tcb /* now the new streams */ stcb->asoc.ss_functions.sctp_ss_init(stcb, &stcb->asoc, 1); for (i = stcb->asoc.streamoutcnt; i < (stcb->asoc.streamoutcnt + adding_o); i++) { - stcb->asoc.strmout[i].next_sequence_send = 0x0; TAILQ_INIT(&stcb->asoc.strmout[i].outqueue); + stcb->asoc.strmout[i].chunks_on_queues = 0; + stcb->asoc.strmout[i].next_sequence_send = 0x0; stcb->asoc.strmout[i].stream_no = i; stcb->asoc.strmout[i].last_msg_incomplete = 0; stcb->asoc.ss_functions.sctp_ss_init_stream(&stcb->asoc.strmout[i], NULL); Modified: stable/8/sys/netinet/sctp_pcb.c ============================================================================== --- stable/8/sys/netinet/sctp_pcb.c Fri Mar 8 00:46:05 2013 (r248003) +++ stable/8/sys/netinet/sctp_pcb.c Fri Mar 8 00:48:15 2013 (r248004) @@ -4925,6 +4925,13 @@ sctp_free_assoc(struct sctp_inpcb *inp, } /* pending send queue SHOULD be empty */ TAILQ_FOREACH_SAFE(chk, &asoc->send_queue, sctp_next, nchk) { + if (asoc->strmout[chk->rec.data.stream_number].chunks_on_queues > 0) { + asoc->strmout[chk->rec.data.stream_number].chunks_on_queues--; +#ifdef INVARIANTS + } else { + panic("No chunks on the queues for sid %u.", chk->rec.data.stream_number); +#endif + } TAILQ_REMOVE(&asoc->send_queue, chk, sctp_next); if (chk->data) { if (so) { @@ -4949,7 +4956,7 @@ sctp_free_assoc(struct sctp_inpcb *inp, } /* sent queue SHOULD be empty */ TAILQ_FOREACH_SAFE(chk, &asoc->sent_queue, sctp_next, nchk) { - if (chk->sent != SCTP_DATAGRAM_NR_MARKED) { + if (chk->sent != SCTP_DATAGRAM_NR_ACKED) { if (asoc->strmout[chk->rec.data.stream_number].chunks_on_queues > 0) { asoc->strmout[chk->rec.data.stream_number].chunks_on_queues--; #ifdef INVARIANTS @@ -4977,6 +4984,13 @@ sctp_free_assoc(struct sctp_inpcb *inp, SCTP_DECR_CHK_COUNT(); /* sa_ignore FREED_MEMORY */ } +#ifdef INVARIANTS + for (i = 0; i < stcb->asoc.streamoutcnt; i++) { + if (stcb->asoc.strmout[i].chunks_on_queues > 0) { + panic("%u chunks left for stream %u.", stcb->asoc.strmout[i].chunks_on_queues, i); + } + } +#endif /* control queue MAY not be empty */ TAILQ_FOREACH_SAFE(chk, &asoc->control_send_queue, sctp_next, nchk) { TAILQ_REMOVE(&asoc->control_send_queue, chk, sctp_next); Modified: stable/8/sys/netinet/sctp_timer.c ============================================================================== --- stable/8/sys/netinet/sctp_timer.c Fri Mar 8 00:46:05 2013 (r248003) +++ stable/8/sys/netinet/sctp_timer.c Fri Mar 8 00:48:15 2013 (r248004) @@ -440,7 +440,7 @@ sctp_recover_sent_list(struct sctp_tcb * if (SCTP_TSN_GE(asoc->last_acked_seq, chk->rec.data.TSN_seq)) { SCTP_PRINTF("Found chk:%p tsn:%x <= last_acked_seq:%x\n", (void *)chk, chk->rec.data.TSN_seq, asoc->last_acked_seq); - if (chk->sent != SCTP_DATAGRAM_NR_MARKED) { + if (chk->sent != SCTP_DATAGRAM_NR_ACKED) { if (asoc->strmout[chk->rec.data.stream_number].chunks_on_queues > 0) { asoc->strmout[chk->rec.data.stream_number].chunks_on_queues--; } Modified: stable/8/sys/netinet/sctputil.c ============================================================================== --- stable/8/sys/netinet/sctputil.c Fri Mar 8 00:46:05 2013 (r248003) +++ stable/8/sys/netinet/sctputil.c Fri Mar 8 00:48:15 2013 (r248004) @@ -1054,6 +1054,7 @@ sctp_init_asoc(struct sctp_inpcb *m, str */ asoc->strmout[i].next_sequence_send = 0x0; TAILQ_INIT(&asoc->strmout[i].outqueue); + asoc->strmout[i].chunks_on_queues = 0; asoc->strmout[i].stream_no = i; asoc->strmout[i].last_msg_incomplete = 0; asoc->ss_functions.sctp_ss_init_stream(&asoc->strmout[i], NULL); @@ -3727,7 +3728,7 @@ sctp_report_all_outbound(struct sctp_tcb TAILQ_FOREACH_SAFE(chk, &asoc->sent_queue, sctp_next, nchk) { TAILQ_REMOVE(&asoc->sent_queue, chk, sctp_next); asoc->sent_queue_cnt--; - if (chk->sent != SCTP_DATAGRAM_NR_MARKED) { + if (chk->sent != SCTP_DATAGRAM_NR_ACKED) { if (asoc->strmout[chk->rec.data.stream_number].chunks_on_queues > 0) { asoc->strmout[chk->rec.data.stream_number].chunks_on_queues--; #ifdef INVARIANTS From owner-svn-src-stable@FreeBSD.ORG Fri Mar 8 00:54:49 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id D3F3EB14; Fri, 8 Mar 2013 00:54:49 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id C16EEE12; Fri, 8 Mar 2013 00:54:49 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r280snZ7081380; Fri, 8 Mar 2013 00:54:49 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r280smdP081374; Fri, 8 Mar 2013 00:54:48 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201303080054.r280smdP081374@svn.freebsd.org> From: Michael Tuexen Date: Fri, 8 Mar 2013 00:54:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r248005 - in stable/8/sys: netinet netinet6 X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Mar 2013 00:54:49 -0000 Author: tuexen Date: Fri Mar 8 00:54:48 2013 New Revision: 248005 URL: http://svnweb.freebsd.org/changeset/base/248005 Log: MFC r243186: Add support for SCTP/UDP/IPV6. This completes the support of http://tools.ietf.org/html/draft-ietf-tsvwg-sctp-udp-encaps Modified: stable/8/sys/netinet/sctp_pcb.h stable/8/sys/netinet/sctp_sysctl.c stable/8/sys/netinet/sctputil.c stable/8/sys/netinet/sctputil.h stable/8/sys/netinet6/sctp6_usrreq.c stable/8/sys/netinet6/sctp6_var.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/netinet/ (props changed) stable/8/sys/netinet6/ (props changed) Modified: stable/8/sys/netinet/sctp_pcb.h ============================================================================== --- stable/8/sys/netinet/sctp_pcb.h Fri Mar 8 00:48:15 2013 (r248004) +++ stable/8/sys/netinet/sctp_pcb.h Fri Mar 8 00:54:48 2013 (r248005) @@ -144,7 +144,12 @@ struct sctp_tagblock { struct sctp_epinfo { - struct socket *udp_tun_socket; +#ifdef INET + struct socket *udp4_tun_socket; +#endif +#ifdef INET6 + struct socket *udp6_tun_socket; +#endif struct sctpasochead *sctp_asochash; u_long hashasocmark; Modified: stable/8/sys/netinet/sctp_sysctl.c ============================================================================== --- stable/8/sys/netinet/sctp_sysctl.c Fri Mar 8 00:48:15 2013 (r248004) +++ stable/8/sys/netinet/sctp_sysctl.c Fri Mar 8 00:54:48 2013 (r248005) @@ -549,8 +549,6 @@ skip: if ((var) < (min)) { (var) = (min); } \ else if ((var) > (max)) { (var) = (max); } -/* XXX: Remove the #if after tunneling over IPv6 works also on FreeBSD. */ -#if !defined(__FreeBSD__) || defined(INET) static int sysctl_sctp_udp_tunneling_check(SYSCTL_HANDLER_ARGS) { @@ -582,8 +580,6 @@ out: return (error); } -#endif - static int sysctl_sctp_check(SYSCTL_HANDLER_ARGS) @@ -1067,12 +1063,9 @@ SYSCTL_VNET_PROC(_net_inet_sctp, OID_AUT "Clear SCTP Logging buffer"); #endif -/* XXX: Remove the #if after tunneling over IPv6 works also on FreeBSD. */ -#if !defined(__FreeBSD__) || defined(INET) SYSCTL_VNET_PROC(_net_inet_sctp, OID_AUTO, udp_tunneling_port, CTLTYPE_UINT | CTLFLAG_RW, &SCTP_BASE_SYSCTL(sctp_udp_tunneling_port), 0, sysctl_sctp_udp_tunneling_check, "IU", SCTPCTL_UDP_TUNNELING_PORT_DESC); -#endif SYSCTL_VNET_PROC(_net_inet_sctp, OID_AUTO, enable_sack_immediately, CTLTYPE_UINT | CTLFLAG_RW, &SCTP_BASE_SYSCTL(sctp_enable_sack_immediately), 0, sysctl_sctp_check, "IU", Modified: stable/8/sys/netinet/sctputil.c ============================================================================== --- stable/8/sys/netinet/sctputil.c Fri Mar 8 00:48:15 2013 (r248004) +++ stable/8/sys/netinet/sctputil.c Fri Mar 8 00:54:48 2013 (r248005) @@ -39,6 +39,7 @@ __FBSDID("$FreeBSD$"); #include #include #ifdef INET6 +#include #endif #include #include @@ -48,6 +49,9 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include +#include +#include #ifndef KTR_SCTP @@ -6769,24 +6773,15 @@ sctp_log_trace(uint32_t subsys, const ch } #endif -/* XXX: Remove the #ifdef after tunneling over IPv6 works also on FreeBSD. */ -#ifdef INET -/* We will need to add support - * to bind the ports and such here - * so we can do UDP tunneling. In - * the mean-time, we return error - */ -#include -#include -#include -#ifdef INET6 -#include -#endif - static void sctp_recv_udp_tunneled_packet(struct mbuf *m, int off, struct inpcb *ignored) { struct ip *iph; + +#ifdef INET6 + struct ip6_hdr *ip6; + +#endif struct mbuf *sp, *last; struct udphdr *uhdr; uint16_t port; @@ -6836,10 +6831,10 @@ sctp_recv_udp_tunneled_packet(struct mbu #endif #ifdef INET6 case IPV6_VERSION >> 4: - /* Not yet supported. */ - goto out; + ip6 = mtod(m, struct ip6_hdr *); + ip6->ip6_plen = htons(ntohs(ip6->ip6_plen) - sizeof(struct udphdr)); + sctp6_input_with_port(&m, &off, port); break; - #endif default: goto out; @@ -6853,19 +6848,22 @@ out: void sctp_over_udp_stop(void) { - struct socket *sop; - /* * This function assumes sysctl caller holds sctp_sysctl_info_lock() * for writting! */ - if (SCTP_BASE_INFO(udp_tun_socket) == NULL) { - /* Nothing to do */ - return; +#ifdef INET + if (SCTP_BASE_INFO(udp4_tun_socket) != NULL) { + soclose(SCTP_BASE_INFO(udp4_tun_socket)); + SCTP_BASE_INFO(udp4_tun_socket) = NULL; } - sop = SCTP_BASE_INFO(udp_tun_socket); - soclose(sop); - SCTP_BASE_INFO(udp_tun_socket) = NULL; +#endif +#ifdef INET6 + if (SCTP_BASE_INFO(udp6_tun_socket) != NULL) { + soclose(SCTP_BASE_INFO(udp6_tun_socket)); + SCTP_BASE_INFO(udp6_tun_socket) = NULL; + } +#endif } int @@ -6873,53 +6871,83 @@ sctp_over_udp_start(void) { uint16_t port; int ret; + +#ifdef INET struct sockaddr_in sin; - struct socket *sop = NULL; - struct thread *th; - struct ucred *cred; +#endif +#ifdef INET6 + struct sockaddr_in6 sin6; + +#endif /* * This function assumes sysctl caller holds sctp_sysctl_info_lock() * for writting! */ port = SCTP_BASE_SYSCTL(sctp_udp_tunneling_port); - if (port == 0) { + if (ntohs(port) == 0) { /* Must have a port set */ return (EINVAL); } - if (SCTP_BASE_INFO(udp_tun_socket) != NULL) { +#ifdef INET + if (SCTP_BASE_INFO(udp4_tun_socket) != NULL) { + /* Already running -- must stop first */ + return (EALREADY); + } +#endif +#ifdef INET6 + if (SCTP_BASE_INFO(udp6_tun_socket) != NULL) { /* Already running -- must stop first */ return (EALREADY); } - th = curthread; - cred = th->td_ucred; - if ((ret = socreate(PF_INET, &sop, - SOCK_DGRAM, IPPROTO_UDP, cred, th))) { +#endif +#ifdef INET + if ((ret = socreate(PF_INET, &SCTP_BASE_INFO(udp4_tun_socket), + SOCK_DGRAM, IPPROTO_UDP, + curthread->td_ucred, curthread))) { + sctp_over_udp_stop(); return (ret); } - SCTP_BASE_INFO(udp_tun_socket) = sop; - /* call the special UDP hook */ - ret = udp_set_kernel_tunneling(sop, sctp_recv_udp_tunneled_packet); - if (ret) { - goto exit_stage_left; - } - /* Ok we have a socket, bind it to the port */ - memset(&sin, 0, sizeof(sin)); - sin.sin_len = sizeof(sin); + /* Call the special UDP hook. */ + if ((ret = udp_set_kernel_tunneling(SCTP_BASE_INFO(udp4_tun_socket), + sctp_recv_udp_tunneled_packet))) { + sctp_over_udp_stop(); + return (ret); + } + /* Ok, we have a socket, bind it to the port. */ + memset(&sin, 0, sizeof(struct sockaddr_in)); + sin.sin_len = sizeof(struct sockaddr_in); sin.sin_family = AF_INET; sin.sin_port = htons(port); - ret = sobind(sop, (struct sockaddr *)&sin, th); - if (ret) { - /* Close up we cant get the port */ -exit_stage_left: + if ((ret = sobind(SCTP_BASE_INFO(udp4_tun_socket), + (struct sockaddr *)&sin, curthread))) { sctp_over_udp_stop(); return (ret); } - /* - * Ok we should now get UDP packets directly to our input routine - * sctp_recv_upd_tunneled_packet(). - */ +#endif +#ifdef INET6 + if ((ret = socreate(PF_INET6, &SCTP_BASE_INFO(udp6_tun_socket), + SOCK_DGRAM, IPPROTO_UDP, + curthread->td_ucred, curthread))) { + sctp_over_udp_stop(); + return (ret); + } + /* Call the special UDP hook. */ + if ((ret = udp_set_kernel_tunneling(SCTP_BASE_INFO(udp6_tun_socket), + sctp_recv_udp_tunneled_packet))) { + sctp_over_udp_stop(); + return (ret); + } + /* Ok, we have a socket, bind it to the port. */ + memset(&sin6, 0, sizeof(struct sockaddr_in6)); + sin6.sin6_len = sizeof(struct sockaddr_in6); + sin6.sin6_family = AF_INET6; + sin6.sin6_port = htons(port); + if ((ret = sobind(SCTP_BASE_INFO(udp6_tun_socket), + (struct sockaddr *)&sin6, curthread))) { + sctp_over_udp_stop(); + return (ret); + } +#endif return (0); } - -#endif Modified: stable/8/sys/netinet/sctputil.h ============================================================================== --- stable/8/sys/netinet/sctputil.h Fri Mar 8 00:48:15 2013 (r248004) +++ stable/8/sys/netinet/sctputil.h Fri Mar 8 00:54:48 2013 (r248005) @@ -323,13 +323,9 @@ do { \ } while (0) /* functions to start/stop udp tunneling */ -/* XXX: Remove the #ifdef after tunneling over IPv6 works also on FreeBSD. */ -#ifdef INET void sctp_over_udp_stop(void); int sctp_over_udp_start(void); -#endif - int sctp_soreceive(struct socket *so, struct sockaddr **psa, struct uio *uio, Modified: stable/8/sys/netinet6/sctp6_usrreq.c ============================================================================== --- stable/8/sys/netinet6/sctp6_usrreq.c Fri Mar 8 00:48:15 2013 (r248004) +++ stable/8/sys/netinet6/sctp6_usrreq.c Fri Mar 8 00:54:48 2013 (r248005) @@ -66,7 +66,7 @@ __FBSDID("$FreeBSD$"); extern struct protosw inetsw[]; int -sctp6_input(struct mbuf **i_pak, int *offp, int proto) +sctp6_input_with_port(struct mbuf **i_pak, int *offp, uint16_t port) { struct mbuf *m; int iphlen; @@ -84,7 +84,6 @@ sctp6_input(struct mbuf **i_pak, int *of #endif uint32_t mflowid; uint8_t use_mflowid; - uint16_t port = 0; iphlen = *offp; if (SCTP_GET_PKT_VRFID(*i_pak, vrf_id)) { @@ -195,6 +194,12 @@ out: } +int +sctp6_input(struct mbuf **i_pak, int *offp, int proto SCTP_UNUSED) +{ + return (sctp6_input_with_port(i_pak, offp, 0)); +} + static void sctp6_notify_mbuf(struct sctp_inpcb *inp, struct icmp6_hdr *icmp6, struct sctphdr *sh, struct sctp_tcb *stcb, struct sctp_nets *net) Modified: stable/8/sys/netinet6/sctp6_var.h ============================================================================== --- stable/8/sys/netinet6/sctp6_var.h Fri Mar 8 00:48:15 2013 (r248004) +++ stable/8/sys/netinet6/sctp6_var.h Fri Mar 8 00:54:48 2013 (r248005) @@ -43,6 +43,7 @@ extern struct pr_usrreqs sctp6_usrreqs; int sctp6_input __P((struct mbuf **, int *, int)); +int sctp6_input_with_port __P((struct mbuf **, int *, uint16_t)); int sctp6_output __P((struct sctp_inpcb *, struct mbuf *, struct sockaddr *, struct mbuf *, struct proc *)); From owner-svn-src-stable@FreeBSD.ORG Fri Mar 8 00:56:49 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 8CE2FC9E; Fri, 8 Mar 2013 00:56:49 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 66F93E28; Fri, 8 Mar 2013 00:56:49 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r280ukph081728; Fri, 8 Mar 2013 00:56:46 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r280ukdD081727; Fri, 8 Mar 2013 00:56:46 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201303080056.r280ukdD081727@svn.freebsd.org> From: Michael Tuexen Date: Fri, 8 Mar 2013 00:56:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r248006 - stable/8/lib/libc/net X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Mar 2013 00:56:49 -0000 Author: tuexen Date: Fri Mar 8 00:56:46 2013 New Revision: 248006 URL: http://svnweb.freebsd.org/changeset/base/248006 Log: MFC r243300: Fix the handling of mapped IPv6 addresses in sctp_connectx(). Modified: stable/8/lib/libc/net/sctp_sys_calls.c Directory Properties: stable/8/lib/ (props changed) stable/8/lib/libc/ (props changed) Modified: stable/8/lib/libc/net/sctp_sys_calls.c ============================================================================== --- stable/8/lib/libc/net/sctp_sys_calls.c Fri Mar 8 00:54:48 2013 (r248005) +++ stable/8/lib/libc/net/sctp_sys_calls.c Fri Mar 8 00:56:46 2013 (r248006) @@ -202,7 +202,6 @@ sctp_connectx(int sd, const struct socka return (-1); } if (IN6_IS_ADDR_V4MAPPED(&((struct sockaddr_in6 *)at)->sin6_addr)) { - len += sizeof(struct sockaddr_in); in6_sin6_2_sin((struct sockaddr_in *)cpto, (struct sockaddr_in6 *)at); cpto = ((caddr_t)cpto + sizeof(struct sockaddr_in)); len += sizeof(struct sockaddr_in); From owner-svn-src-stable@FreeBSD.ORG Fri Mar 8 00:58:08 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 250B6E09; Fri, 8 Mar 2013 00:58:08 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 08335E30; Fri, 8 Mar 2013 00:58:08 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r280w7Mm081966; Fri, 8 Mar 2013 00:58:07 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r280w7m3081965; Fri, 8 Mar 2013 00:58:07 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201303080058.r280w7m3081965@svn.freebsd.org> From: Michael Tuexen Date: Fri, 8 Mar 2013 00:58:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r248007 - stable/8/lib/libc/net X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Mar 2013 00:58:08 -0000 Author: tuexen Date: Fri Mar 8 00:58:07 2013 New Revision: 248007 URL: http://svnweb.freebsd.org/changeset/base/248007 Log: MFC r243302: Cleanup the code a bit, which improves the portability. Modified: stable/8/lib/libc/net/sctp_sys_calls.c Directory Properties: stable/8/lib/ (props changed) stable/8/lib/libc/ (props changed) Modified: stable/8/lib/libc/net/sctp_sys_calls.c ============================================================================== --- stable/8/lib/libc/net/sctp_sys_calls.c Fri Mar 8 00:56:46 2013 (r248006) +++ stable/8/lib/libc/net/sctp_sys_calls.c Fri Mar 8 00:58:07 2013 (r248007) @@ -188,15 +188,18 @@ sctp_connectx(int sd, const struct socka cpto = ((caddr_t)buf + sizeof(int)); /* validate all the addresses and get the size */ for (i = 0; i < addrcnt; i++) { - if (at->sa_family == AF_INET) { + switch (at->sa_family) { + case AF_INET: if (at->sa_len != sizeof(struct sockaddr_in)) { errno = EINVAL; return (-1); } - memcpy(cpto, at, at->sa_len); - cpto = ((caddr_t)cpto + at->sa_len); - len += at->sa_len; - } else if (at->sa_family == AF_INET6) { + memcpy(cpto, at, sizeof(struct sockaddr_in)); + cpto = ((caddr_t)cpto + sizeof(struct sockaddr_in)); + len += sizeof(struct sockaddr_in); + at = (struct sockaddr *)((caddr_t)at + sizeof(struct sockaddr_in)); + break; + case AF_INET6: if (at->sa_len != sizeof(struct sockaddr_in6)) { errno = EINVAL; return (-1); @@ -206,11 +209,13 @@ sctp_connectx(int sd, const struct socka cpto = ((caddr_t)cpto + sizeof(struct sockaddr_in)); len += sizeof(struct sockaddr_in); } else { - memcpy(cpto, at, at->sa_len); - cpto = ((caddr_t)cpto + at->sa_len); - len += at->sa_len; + memcpy(cpto, at, sizeof(struct sockaddr_in6)); + cpto = ((caddr_t)cpto + sizeof(struct sockaddr_in6)); + len += sizeof(struct sockaddr_in6); } - } else { + at = (struct sockaddr *)((caddr_t)at + sizeof(struct sockaddr_in6)); + break; + default: errno = EINVAL; return (-1); } @@ -219,7 +224,6 @@ sctp_connectx(int sd, const struct socka errno = E2BIG; return (-1); } - at = (struct sockaddr *)((caddr_t)at + at->sa_len); cnt++; } /* do we have any? */ @@ -260,56 +264,57 @@ sctp_bindx(int sd, struct sockaddr *addr errno = EINVAL; return (-1); } - argsz = (sizeof(struct sockaddr_storage) + - sizeof(struct sctp_getaddresses)); - gaddrs = (struct sctp_getaddresses *)calloc(1, argsz); - if (gaddrs == NULL) { - errno = ENOMEM; - return (-1); - } /* First pre-screen the addresses */ sa = addrs; for (i = 0; i < addrcnt; i++) { - if (sa->sa_family == AF_INET) { - if (sa->sa_len != sizeof(struct sockaddr_in)) - goto out_error; + switch (sa->sa_family) { + case AF_INET: + if (sa->sa_len != sizeof(struct sockaddr_in)) { + errno = EINVAL; + return (-1); + } sin = (struct sockaddr_in *)sa; if (sin->sin_port) { /* non-zero port, check or save */ if (sport) { /* Check against our port */ if (sport != sin->sin_port) { - goto out_error; + errno = EINVAL; + return (-1); } } else { /* save off the port */ sport = sin->sin_port; } } - } else if (sa->sa_family == AF_INET6) { - if (sa->sa_len != sizeof(struct sockaddr_in6)) - goto out_error; + break; + case AF_INET6: + if (sa->sa_len != sizeof(struct sockaddr_in6)) { + errno = EINVAL; + return (-1); + } sin6 = (struct sockaddr_in6 *)sa; if (sin6->sin6_port) { /* non-zero port, check or save */ if (sport) { /* Check against our port */ if (sport != sin6->sin6_port) { - goto out_error; + errno = EINVAL; + return (-1); } } else { /* save off the port */ sport = sin6->sin6_port; } } - } else { - /* invalid address family specified */ - goto out_error; + break; + default: + /* Invalid address family specified. */ + errno = EINVAL; + return (-1); } - sa = (struct sockaddr *)((caddr_t)sa + sa->sa_len); } - sa = addrs; /* * Now if there was a port mentioned, assure that the first address * has that port to make sure it fails or succeeds correctly. @@ -318,20 +323,14 @@ sctp_bindx(int sd, struct sockaddr *addr sin = (struct sockaddr_in *)sa; sin->sin_port = sport; } + argsz = sizeof(struct sctp_getaddresses) + + sizeof(struct sockaddr_storage); + if ((gaddrs = (struct sctp_getaddresses *)malloc(argsz)) == NULL) { + errno = ENOMEM; + return (-1); + } + sa = addrs; for (i = 0; i < addrcnt; i++) { - if (sa->sa_family == AF_INET) { - if (sa->sa_len != sizeof(struct sockaddr_in)) - goto out_error; - } else if (sa->sa_family == AF_INET6) { - if (sa->sa_len != sizeof(struct sockaddr_in6)) - goto out_error; - } else { - /* invalid address family specified */ - out_error: - free(gaddrs); - errno = EINVAL; - return (-1); - } memset(gaddrs, 0, argsz); gaddrs->sget_assoc_id = 0; memcpy(gaddrs->addr, sa, sa->sa_len); From owner-svn-src-stable@FreeBSD.ORG Fri Mar 8 01:00:06 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id E5D3C1B5; Fri, 8 Mar 2013 01:00:05 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id C2535E43; Fri, 8 Mar 2013 01:00:05 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r281057f082375; Fri, 8 Mar 2013 01:00:05 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r28105PS082372; Fri, 8 Mar 2013 01:00:05 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201303080100.r28105PS082372@svn.freebsd.org> From: Michael Tuexen Date: Fri, 8 Mar 2013 01:00:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r248008 - stable/8/sys/netinet X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Mar 2013 01:00:07 -0000 Author: tuexen Date: Fri Mar 8 01:00:05 2013 New Revision: 248008 URL: http://svnweb.freebsd.org/changeset/base/248008 Log: MFC r243516: Remove unused function. Modified: stable/8/sys/netinet/sctp_peeloff.c stable/8/sys/netinet/sctp_peeloff.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/netinet/ (props changed) Modified: stable/8/sys/netinet/sctp_peeloff.c ============================================================================== --- stable/8/sys/netinet/sctp_peeloff.c Fri Mar 8 00:58:07 2013 (r248007) +++ stable/8/sys/netinet/sctp_peeloff.c Fri Mar 8 01:00:05 2013 (r248008) @@ -151,103 +151,3 @@ sctp_do_peeloff(struct socket *head, str return (0); } - - -struct socket * -sctp_get_peeloff(struct socket *head, sctp_assoc_t assoc_id, int *error) -{ - struct socket *newso; - struct sctp_inpcb *inp, *n_inp; - struct sctp_tcb *stcb; - - SCTPDBG(SCTP_DEBUG_PEEL1, "SCTP peel-off called\n"); - inp = (struct sctp_inpcb *)head->so_pcb; - if (inp == NULL) { - SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_PEELOFF, EFAULT); - *error = EFAULT; - return (NULL); - } - stcb = sctp_findassociation_ep_asocid(inp, assoc_id, 1); - if (stcb == NULL) { - SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_PEELOFF, ENOTCONN); - *error = ENOTCONN; - return (NULL); - } - atomic_add_int(&stcb->asoc.refcnt, 1); - SCTP_TCB_UNLOCK(stcb); - CURVNET_SET(head->so_vnet); - newso = sonewconn(head, SS_ISCONNECTED - ); - CURVNET_RESTORE(); - if (newso == NULL) { - SCTPDBG(SCTP_DEBUG_PEEL1, "sctp_peeloff:sonewconn failed\n"); - SCTP_LTRACE_ERR_RET(NULL, stcb, NULL, SCTP_FROM_SCTP_PEELOFF, ENOMEM); - *error = ENOMEM; - atomic_subtract_int(&stcb->asoc.refcnt, 1); - return (NULL); - - } - SCTP_TCB_LOCK(stcb); - atomic_subtract_int(&stcb->asoc.refcnt, 1); - n_inp = (struct sctp_inpcb *)newso->so_pcb; - SOCK_LOCK(head); - n_inp->sctp_flags = (SCTP_PCB_FLAGS_UDPTYPE | - SCTP_PCB_FLAGS_CONNECTED | - SCTP_PCB_FLAGS_IN_TCPPOOL | /* Turn on Blocking IO */ - (SCTP_PCB_COPY_FLAGS & inp->sctp_flags)); - n_inp->sctp_features = inp->sctp_features; - n_inp->sctp_frag_point = inp->sctp_frag_point; - n_inp->sctp_cmt_on_off = inp->sctp_cmt_on_off; - n_inp->sctp_ecn_enable = inp->sctp_ecn_enable; - n_inp->partial_delivery_point = inp->partial_delivery_point; - n_inp->sctp_context = inp->sctp_context; - n_inp->local_strreset_support = inp->local_strreset_support; - n_inp->inp_starting_point_for_iterator = NULL; - - /* copy in the authentication parameters from the original endpoint */ - if (n_inp->sctp_ep.local_hmacs) - sctp_free_hmaclist(n_inp->sctp_ep.local_hmacs); - n_inp->sctp_ep.local_hmacs = - sctp_copy_hmaclist(inp->sctp_ep.local_hmacs); - if (n_inp->sctp_ep.local_auth_chunks) - sctp_free_chunklist(n_inp->sctp_ep.local_auth_chunks); - n_inp->sctp_ep.local_auth_chunks = - sctp_copy_chunklist(inp->sctp_ep.local_auth_chunks); - (void)sctp_copy_skeylist(&inp->sctp_ep.shared_keys, - &n_inp->sctp_ep.shared_keys); - - n_inp->sctp_socket = newso; - if (sctp_is_feature_on(inp, SCTP_PCB_FLAGS_AUTOCLOSE)) { - sctp_feature_off(n_inp, SCTP_PCB_FLAGS_AUTOCLOSE); - n_inp->sctp_ep.auto_close_time = 0; - sctp_timer_stop(SCTP_TIMER_TYPE_AUTOCLOSE, n_inp, stcb, NULL, - SCTP_FROM_SCTP_PEELOFF + SCTP_LOC_1); - } - /* Turn off any non-blocking semantic. */ - SCTP_CLEAR_SO_NBIO(newso); - newso->so_state |= SS_ISCONNECTED; - /* We remove it right away */ - -#ifdef SCTP_LOCK_LOGGING - if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_LOCK_LOGGING_ENABLE) { - sctp_log_lock(inp, (struct sctp_tcb *)NULL, SCTP_LOG_LOCK_SOCK); - } -#endif - TAILQ_REMOVE(&head->so_comp, newso, so_list); - head->so_qlen--; - SOCK_UNLOCK(head); - /* - * Now we must move it from one hash table to another and get the - * stcb in the right place. - */ - sctp_move_pcb_and_assoc(inp, n_inp, stcb); - atomic_add_int(&stcb->asoc.refcnt, 1); - SCTP_TCB_UNLOCK(stcb); - /* - * And now the final hack. We move data in the pending side i.e. - * head to the new socket buffer. Let the GRUBBING begin :-0 - */ - sctp_pull_off_control_to_new_inp(inp, n_inp, stcb, SBL_WAIT); - atomic_subtract_int(&stcb->asoc.refcnt, 1); - return (newso); -} Modified: stable/8/sys/netinet/sctp_peeloff.h ============================================================================== --- stable/8/sys/netinet/sctp_peeloff.h Fri Mar 8 00:58:07 2013 (r248007) +++ stable/8/sys/netinet/sctp_peeloff.h Fri Mar 8 01:00:05 2013 (r248008) @@ -35,18 +35,9 @@ __FBSDID("$FreeBSD$"); #ifndef _NETINET_SCTP_PEELOFF_H_ #define _NETINET_SCTP_PEELOFF_H_ - - - - #if defined(_KERNEL) - int sctp_can_peel_off(struct socket *, sctp_assoc_t); int sctp_do_peeloff(struct socket *, struct socket *, sctp_assoc_t); -struct socket *sctp_get_peeloff(struct socket *, sctp_assoc_t, int *); - - #endif /* _KERNEL */ - -#endif +#endif /* _NETINET_SCTP_PEELOFF_H_ */ From owner-svn-src-stable@FreeBSD.ORG Fri Mar 8 01:01:38 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 715EF505; Fri, 8 Mar 2013 01:01:38 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 63A8EE65; Fri, 8 Mar 2013 01:01:38 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2811cZO084364; Fri, 8 Mar 2013 01:01:38 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2811cAd084363; Fri, 8 Mar 2013 01:01:38 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201303080101.r2811cAd084363@svn.freebsd.org> From: Michael Tuexen Date: Fri, 8 Mar 2013 01:01:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r248009 - stable/8/sys/netinet X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Mar 2013 01:01:38 -0000 Author: tuexen Date: Fri Mar 8 01:01:37 2013 New Revision: 248009 URL: http://svnweb.freebsd.org/changeset/base/248009 Log: MFC r243558: Allow shutdown() to be used on fds returned from sctp_peeloff(). Modified: stable/8/sys/netinet/sctp_usrreq.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/netinet/ (props changed) Modified: stable/8/sys/netinet/sctp_usrreq.c ============================================================================== --- stable/8/sys/netinet/sctp_usrreq.c Fri Mar 8 01:00:05 2013 (r248008) +++ stable/8/sys/netinet/sctp_usrreq.c Fri Mar 8 01:01:37 2013 (r248009) @@ -971,7 +971,8 @@ sctp_shutdown(struct socket *so) } SCTP_INP_RLOCK(inp); /* For UDP model this is a invalid call */ - if (inp->sctp_flags & SCTP_PCB_FLAGS_UDPTYPE) { + if (!((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) || + (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL))) { /* Restore the flags that the soshutdown took away. */ SOCKBUF_LOCK(&so->so_rcv); so->so_rcv.sb_state &= ~SBS_CANTRCVMORE; From owner-svn-src-stable@FreeBSD.ORG Fri Mar 8 01:03:40 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 6DBF867D; Fri, 8 Mar 2013 01:03:40 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 55965E74; Fri, 8 Mar 2013 01:03:40 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2813eCF084802; Fri, 8 Mar 2013 01:03:40 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2813eYu084801; Fri, 8 Mar 2013 01:03:40 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201303080103.r2813eYu084801@svn.freebsd.org> From: Michael Tuexen Date: Fri, 8 Mar 2013 01:03:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r248010 - stable/8/sys/netinet X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Mar 2013 01:03:40 -0000 Author: tuexen Date: Fri Mar 8 01:03:39 2013 New Revision: 248010 URL: http://svnweb.freebsd.org/changeset/base/248010 Log: MFC r243564: Find the endpoint for an incoming packet also if the endpoint comes from sctp_peeloff(). Modified: stable/8/sys/netinet/sctp_pcb.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/netinet/ (props changed) Modified: stable/8/sys/netinet/sctp_pcb.c ============================================================================== --- stable/8/sys/netinet/sctp_pcb.c Fri Mar 8 01:01:37 2013 (r248009) +++ stable/8/sys/netinet/sctp_pcb.c Fri Mar 8 01:03:39 2013 (r248010) @@ -1226,7 +1226,8 @@ sctp_findassociation_ep_addr(struct sctp SCTP_TCB_UNLOCK(locked_tcb); } SCTP_INP_INFO_RLOCK(); - if (inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) { + if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) || + (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL)) { /*- * Now either this guy is our listener or it's the * connector. If it is the one that issued the connect, then From owner-svn-src-stable@FreeBSD.ORG Fri Mar 8 01:05:07 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id EBCB27E8; Fri, 8 Mar 2013 01:05:07 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id C54C4E7D; Fri, 8 Mar 2013 01:05:07 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r28157Bc085142; Fri, 8 Mar 2013 01:05:07 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r28157MR085141; Fri, 8 Mar 2013 01:05:07 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201303080105.r28157MR085141@svn.freebsd.org> From: Michael Tuexen Date: Fri, 8 Mar 2013 01:05:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r248011 - stable/8/sys/netinet X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Mar 2013 01:05:08 -0000 Author: tuexen Date: Fri Mar 8 01:05:07 2013 New Revision: 248011 URL: http://svnweb.freebsd.org/changeset/base/248011 Log: MFC r243565: Add support for sctp_peeloff() also in the front states of the association. Modified: stable/8/sys/netinet/sctp_peeloff.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/netinet/ (props changed) Modified: stable/8/sys/netinet/sctp_peeloff.c ============================================================================== --- stable/8/sys/netinet/sctp_peeloff.c Fri Mar 8 01:03:39 2013 (r248010) +++ stable/8/sys/netinet/sctp_peeloff.c Fri Mar 8 01:05:07 2013 (r248011) @@ -74,9 +74,7 @@ sctp_can_peel_off(struct socket *head, s } state = SCTP_GET_STATE((&stcb->asoc)); if ((state == SCTP_STATE_EMPTY) || - (state == SCTP_STATE_INUSE) || - (state == SCTP_STATE_COOKIE_WAIT) || - (state == SCTP_STATE_COOKIE_ECHOED)) { + (state == SCTP_STATE_INUSE)) { SCTP_TCB_UNLOCK(stcb); SCTP_LTRACE_ERR_RET(inp, stcb, NULL, SCTP_FROM_SCTP_PEELOFF, ENOTCONN); return (ENOTCONN); @@ -105,9 +103,7 @@ sctp_do_peeloff(struct socket *head, str } state = SCTP_GET_STATE((&stcb->asoc)); if ((state == SCTP_STATE_EMPTY) || - (state == SCTP_STATE_INUSE) || - (state == SCTP_STATE_COOKIE_WAIT) || - (state == SCTP_STATE_COOKIE_ECHOED)) { + (state == SCTP_STATE_INUSE)) { SCTP_TCB_UNLOCK(stcb); SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_PEELOFF, ENOTCONN); return (ENOTCONN); From owner-svn-src-stable@FreeBSD.ORG Fri Mar 8 01:10:34 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 104FC992; Fri, 8 Mar 2013 01:10:34 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id DCE83EA4; Fri, 8 Mar 2013 01:10:33 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r281AXNF087613; Fri, 8 Mar 2013 01:10:33 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r281AXow087611; Fri, 8 Mar 2013 01:10:33 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201303080110.r281AXow087611@svn.freebsd.org> From: Michael Tuexen Date: Fri, 8 Mar 2013 01:10:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r248012 - stable/8/sys/netinet X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Mar 2013 01:10:34 -0000 Author: tuexen Date: Fri Mar 8 01:10:33 2013 New Revision: 248012 URL: http://svnweb.freebsd.org/changeset/base/248012 Log: MFC r244021: Ensure that the padding of the last parameter of an INIT chunk is not included in the chunk length as required by RFC 4960. While there, cleanup sctp_send_initiate(). Modified: stable/8/sys/netinet/sctp_output.c stable/8/sys/netinet/sctp_output.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/netinet/ (props changed) Modified: stable/8/sys/netinet/sctp_output.c ============================================================================== --- stable/8/sys/netinet/sctp_output.c Fri Mar 8 01:05:07 2013 (r248011) +++ stable/8/sys/netinet/sctp_output.c Fri Mar 8 01:10:33 2013 (r248012) @@ -1940,27 +1940,27 @@ sctp_is_address_in_scope(struct sctp_ifa } static struct mbuf * -sctp_add_addr_to_mbuf(struct mbuf *m, struct sctp_ifa *ifa) +sctp_add_addr_to_mbuf(struct mbuf *m, struct sctp_ifa *ifa, uint16_t * len) { struct sctp_paramhdr *parmh; struct mbuf *mret; - int len; + uint16_t plen; switch (ifa->address.sa.sa_family) { #ifdef INET case AF_INET: - len = sizeof(struct sctp_ipv4addr_param); + plen = (uint16_t) sizeof(struct sctp_ipv4addr_param); break; #endif #ifdef INET6 case AF_INET6: - len = sizeof(struct sctp_ipv6addr_param); + plen = (uint16_t) sizeof(struct sctp_ipv6addr_param); break; #endif default: return (m); } - if (M_TRAILINGSPACE(m) >= len) { + if (M_TRAILINGSPACE(m) >= plen) { /* easy side we just drop it on the end */ parmh = (struct sctp_paramhdr *)(SCTP_BUF_AT(m, SCTP_BUF_LEN(m))); mret = m; @@ -1970,7 +1970,7 @@ sctp_add_addr_to_mbuf(struct mbuf *m, st while (SCTP_BUF_NEXT(mret) != NULL) { mret = SCTP_BUF_NEXT(mret); } - SCTP_BUF_NEXT(mret) = sctp_get_mbuf_for_msg(len, 0, M_DONTWAIT, 1, MT_DATA); + SCTP_BUF_NEXT(mret) = sctp_get_mbuf_for_msg(plen, 0, M_NOWAIT, 1, MT_DATA); if (SCTP_BUF_NEXT(mret) == NULL) { /* We are hosed, can't add more addresses */ return (m); @@ -1989,9 +1989,9 @@ sctp_add_addr_to_mbuf(struct mbuf *m, st sin = (struct sockaddr_in *)&ifa->address.sin; ipv4p = (struct sctp_ipv4addr_param *)parmh; parmh->param_type = htons(SCTP_IPV4_ADDRESS); - parmh->param_length = htons(len); + parmh->param_length = htons(plen); ipv4p->addr = sin->sin_addr.s_addr; - SCTP_BUF_LEN(mret) += len; + SCTP_BUF_LEN(mret) += plen; break; } #endif @@ -2004,18 +2004,21 @@ sctp_add_addr_to_mbuf(struct mbuf *m, st sin6 = (struct sockaddr_in6 *)&ifa->address.sin6; ipv6p = (struct sctp_ipv6addr_param *)parmh; parmh->param_type = htons(SCTP_IPV6_ADDRESS); - parmh->param_length = htons(len); + parmh->param_length = htons(plen); memcpy(ipv6p->addr, &sin6->sin6_addr, sizeof(ipv6p->addr)); /* clear embedded scope in the address */ in6_clearscope((struct in6_addr *)ipv6p->addr); - SCTP_BUF_LEN(mret) += len; + SCTP_BUF_LEN(mret) += plen; break; } #endif default: return (m); } + if (len != NULL) { + *len += plen; + } return (mret); } @@ -2023,7 +2026,8 @@ sctp_add_addr_to_mbuf(struct mbuf *m, st struct mbuf * sctp_add_addresses_to_i_ia(struct sctp_inpcb *inp, struct sctp_tcb *stcb, struct sctp_scoping *scope, - struct mbuf *m_at, int cnt_inits_to) + struct mbuf *m_at, int cnt_inits_to, + uint16_t * padding_len, uint16_t * chunk_len) { struct sctp_vrf *vrf = NULL; int cnt, limit_out = 0, total_count; @@ -2103,7 +2107,15 @@ skip_count: scope->site_scope, 0) == 0) { continue; } - m_at = sctp_add_addr_to_mbuf(m_at, sctp_ifap); + if ((chunk_len != NULL) && + (padding_len != NULL) && + (*padding_len > 0)) { + memset(mtod(m_at, caddr_t)+*chunk_len, 0, *padding_len); + SCTP_BUF_LEN(m_at) += *padding_len; + *chunk_len += *padding_len; + *padding_len = 0; + } + m_at = sctp_add_addr_to_mbuf(m_at, sctp_ifap, chunk_len); if (limit_out) { cnt++; total_count++; @@ -2178,7 +2190,15 @@ skip_count: scope->site_scope, 0) == 0) { continue; } - m_at = sctp_add_addr_to_mbuf(m_at, laddr->ifa); + if ((chunk_len != NULL) && + (padding_len != NULL) && + (*padding_len > 0)) { + memset(mtod(m_at, caddr_t)+*chunk_len, 0, *padding_len); + SCTP_BUF_LEN(m_at) += *padding_len; + *chunk_len += *padding_len; + *padding_len = 0; + } + m_at = sctp_add_addr_to_mbuf(m_at, laddr->ifa, chunk_len); cnt++; if (cnt >= SCTP_ADDRESS_LIMIT) { break; @@ -4580,21 +4600,19 @@ sctp_send_initiate(struct sctp_inpcb *in #endif ) { - struct mbuf *m, *m_at, *mp_last; + struct sctp_scoping scp; + struct mbuf *m; struct sctp_nets *net; struct sctp_init_chunk *init; struct sctp_supported_addr_param *sup_addr; struct sctp_adaptation_layer_indication *ali; - struct sctp_ecn_supported_param *ecn; - struct sctp_prsctp_supported_param *prsctp; struct sctp_supported_chunk_types_param *pr_supported; + struct sctp_paramhdr *ph; int cnt_inits_to = 0; - int padval, ret; - int num_ext; - int p_len; + int ret; + uint16_t num_ext, chunk_len, padding_len, parameter_len; /* INIT's always go to the primary (and usually ONLY address) */ - mp_last = NULL; net = stcb->asoc.primary_destination; if (net == NULL) { net = TAILQ_FIRST(&stcb->asoc.nets); @@ -4611,15 +4629,12 @@ sctp_send_initiate(struct sctp_inpcb *in } SCTPDBG(SCTP_DEBUG_OUTPUT4, "Sending INIT\n"); #ifdef INET6 - if (((struct sockaddr *)&(net->ro._l_addr))->sa_family == AF_INET6) { + if (net->ro._l_addr.sa.sa_family == AF_INET6) { /* * special hook, if we are sending to link local it will not * show up in our private address count. */ - struct sockaddr_in6 *sin6l; - - sin6l = &net->ro._l_addr.sin6; - if (IN6_IS_ADDR_LINKLOCAL(&sin6l->sin6_addr)) + if (IN6_IS_ADDR_LINKLOCAL(&net->ro._l_addr.sin6.sin6_addr)) cnt_inits_to = 1; } #endif @@ -4637,14 +4652,15 @@ sctp_send_initiate(struct sctp_inpcb *in SCTPDBG(SCTP_DEBUG_OUTPUT4, "Sending INIT - mbuf?\n"); return; } - SCTP_BUF_LEN(m) = sizeof(struct sctp_init_chunk); + chunk_len = (uint16_t) sizeof(struct sctp_init_chunk); + padding_len = 0; /* * assume peer supports asconf in order to be able to queue local * address changes while an INIT is in flight and before the assoc * is established. */ stcb->asoc.peer_supports_asconf = 1; - /* Now lets put the SCTP header in place */ + /* Now lets put the chunk header in place */ init = mtod(m, struct sctp_init_chunk *); /* now the chunk header */ init->ch.chunk_type = SCTP_INITIATION; @@ -4656,84 +4672,112 @@ sctp_send_initiate(struct sctp_inpcb *in /* set up some of the credits. */ init->init.a_rwnd = htonl(max(inp->sctp_socket ? SCTP_SB_LIMIT_RCV(inp->sctp_socket) : 0, SCTP_MINIMAL_RWND)); - init->init.num_outbound_streams = htons(stcb->asoc.pre_open_streams); init->init.num_inbound_streams = htons(stcb->asoc.max_inbound_streams); init->init.initial_tsn = htonl(stcb->asoc.init_seq_number); + +#if defined(INET) || defined(INET6) /* now the address restriction */ /* XXX Should we take the address family of the socket into account? */ - sup_addr = (struct sctp_supported_addr_param *)((caddr_t)init + - sizeof(*init)); + sup_addr = (struct sctp_supported_addr_param *)(mtod(m, caddr_t)+chunk_len); sup_addr->ph.param_type = htons(SCTP_SUPPORTED_ADDRTYPE); #ifdef INET6 #ifdef INET /* we support 2 types: IPv4/IPv6 */ - sup_addr->ph.param_length = htons(sizeof(struct sctp_paramhdr) + 2 * sizeof(uint16_t)); + parameter_len = (uint16_t) (sizeof(struct sctp_paramhdr) + 2 * sizeof(uint16_t)); + sup_addr->ph.param_length = htons(parameter_len); sup_addr->addr_type[0] = htons(SCTP_IPV4_ADDRESS); sup_addr->addr_type[1] = htons(SCTP_IPV6_ADDRESS); + padding_len = 0; #else /* we support 1 type: IPv6 */ - sup_addr->ph.param_length = htons(sizeof(struct sctp_paramhdr) + sizeof(uint16_t)); + parameter_len = (uint16_t) (sizeof(struct sctp_paramhdr) + sizeof(uint16_t)); + sup_addr->ph.param_length = htons(parameter_len); sup_addr->addr_type[0] = htons(SCTP_IPV6_ADDRESS); sup_addr->addr_type[1] = htons(0); /* this is the padding */ + padding_len = (uint16_t) sizeof(uint16_t); #endif #else /* we support 1 type: IPv4 */ - sup_addr->ph.param_length = htons(sizeof(struct sctp_paramhdr) + sizeof(uint16_t)); + parameter_len = (uint16_t) (sizeof(struct sctp_paramhdr) + sizeof(uint16_t)); + sup_addr->ph.param_length = htons(parameter_len); sup_addr->addr_type[0] = htons(SCTP_IPV4_ADDRESS); sup_addr->addr_type[1] = htons(0); /* this is the padding */ + padding_len = (uint16_t) sizeof(uint16_t); #endif - SCTP_BUF_LEN(m) += sizeof(struct sctp_supported_addr_param); - /* adaptation layer indication parameter */ - ali = (struct sctp_adaptation_layer_indication *)((caddr_t)sup_addr + sizeof(struct sctp_supported_addr_param)); + chunk_len += parameter_len; +#endif + /* Adaptation layer indication parameter */ + /* XXX: Should we include this always? */ + if (padding_len > 0) { + memset(mtod(m, caddr_t)+chunk_len, 0, padding_len); + chunk_len += padding_len; + padding_len = 0; + } + parameter_len = (uint16_t) sizeof(struct sctp_adaptation_layer_indication); + ali = (struct sctp_adaptation_layer_indication *)(mtod(m, caddr_t)+chunk_len); ali->ph.param_type = htons(SCTP_ULP_ADAPTATION); - ali->ph.param_length = htons(sizeof(*ali)); + ali->ph.param_length = htons(parameter_len); ali->indication = ntohl(inp->sctp_ep.adaptation_layer_indicator); - SCTP_BUF_LEN(m) += sizeof(*ali); - ecn = (struct sctp_ecn_supported_param *)((caddr_t)ali + sizeof(*ali)); + chunk_len += parameter_len; if (SCTP_BASE_SYSCTL(sctp_inits_include_nat_friendly)) { - /* Add NAT friendly parameter */ - struct sctp_paramhdr *ph; - - ph = (struct sctp_paramhdr *)(mtod(m, caddr_t)+SCTP_BUF_LEN(m)); + /* Add NAT friendly parameter. */ + if (padding_len > 0) { + memset(mtod(m, caddr_t)+chunk_len, 0, padding_len); + chunk_len += padding_len; + padding_len = 0; + } + parameter_len = (uint16_t) sizeof(struct sctp_paramhdr); + ph = (struct sctp_paramhdr *)(mtod(m, caddr_t)+chunk_len); ph->param_type = htons(SCTP_HAS_NAT_SUPPORT); - ph->param_length = htons(sizeof(struct sctp_paramhdr)); - SCTP_BUF_LEN(m) += sizeof(struct sctp_paramhdr); - ecn = (struct sctp_ecn_supported_param *)((caddr_t)ph + sizeof(*ph)); + ph->param_length = htons(parameter_len); + chunk_len += parameter_len; } /* now any cookie time extensions */ if (stcb->asoc.cookie_preserve_req) { struct sctp_cookie_perserve_param *cookie_preserve; - cookie_preserve = (struct sctp_cookie_perserve_param *)(ecn); + if (padding_len > 0) { + memset(mtod(m, caddr_t)+chunk_len, 0, padding_len); + chunk_len += padding_len; + padding_len = 0; + } + parameter_len = (uint16_t) sizeof(struct sctp_cookie_perserve_param); + cookie_preserve = (struct sctp_cookie_perserve_param *)(mtod(m, caddr_t)+chunk_len); cookie_preserve->ph.param_type = htons(SCTP_COOKIE_PRESERVE); - cookie_preserve->ph.param_length = htons( - sizeof(*cookie_preserve)); + cookie_preserve->ph.param_length = htons(parameter_len); cookie_preserve->time = htonl(stcb->asoc.cookie_preserve_req); - SCTP_BUF_LEN(m) += sizeof(*cookie_preserve); - ecn = (struct sctp_ecn_supported_param *)( - (caddr_t)cookie_preserve + sizeof(*cookie_preserve)); stcb->asoc.cookie_preserve_req = 0; + chunk_len += parameter_len; } /* ECN parameter */ if (stcb->asoc.ecn_allowed == 1) { - ecn->ph.param_type = htons(SCTP_ECN_CAPABLE); - ecn->ph.param_length = htons(sizeof(*ecn)); - SCTP_BUF_LEN(m) += sizeof(*ecn); - prsctp = (struct sctp_prsctp_supported_param *)((caddr_t)ecn + - sizeof(*ecn)); - } else { - prsctp = (struct sctp_prsctp_supported_param *)((caddr_t)ecn); + if (padding_len > 0) { + memset(mtod(m, caddr_t)+chunk_len, 0, padding_len); + chunk_len += padding_len; + padding_len = 0; + } + parameter_len = (uint16_t) sizeof(struct sctp_paramhdr); + ph = (struct sctp_paramhdr *)(mtod(m, caddr_t)+chunk_len); + ph->param_type = htons(SCTP_ECN_CAPABLE); + ph->param_length = htons(parameter_len); + chunk_len += parameter_len; + } + /* And now tell the peer we do support PR-SCTP. */ + if (padding_len > 0) { + memset(mtod(m, caddr_t)+chunk_len, 0, padding_len); + chunk_len += padding_len; + padding_len = 0; } - /* And now tell the peer we do pr-sctp */ - prsctp->ph.param_type = htons(SCTP_PRSCTP_SUPPORTED); - prsctp->ph.param_length = htons(sizeof(*prsctp)); - SCTP_BUF_LEN(m) += sizeof(*prsctp); + parameter_len = (uint16_t) sizeof(struct sctp_paramhdr); + ph = (struct sctp_paramhdr *)(mtod(m, caddr_t)+chunk_len); + ph->param_type = htons(SCTP_PRSCTP_SUPPORTED); + ph->param_length = htons(parameter_len); + chunk_len += parameter_len; /* And now tell the peer we do all the extensions */ - pr_supported = (struct sctp_supported_chunk_types_param *) - ((caddr_t)prsctp + sizeof(*prsctp)); + pr_supported = (struct sctp_supported_chunk_types_param *)(mtod(m, caddr_t)+chunk_len); pr_supported->ph.param_type = htons(SCTP_SUPPORTED_CHUNK_EXT); num_ext = 0; pr_supported->chunk_types[num_ext++] = SCTP_ASCONF; @@ -4747,99 +4791,94 @@ sctp_send_initiate(struct sctp_inpcb *in if (stcb->asoc.sctp_nr_sack_on_off == 1) { pr_supported->chunk_types[num_ext++] = SCTP_NR_SELECTIVE_ACK; } - p_len = sizeof(*pr_supported) + num_ext; - pr_supported->ph.param_length = htons(p_len); - bzero((caddr_t)pr_supported + p_len, SCTP_SIZE32(p_len) - p_len); - SCTP_BUF_LEN(m) += SCTP_SIZE32(p_len); - + parameter_len = (uint16_t) sizeof(struct sctp_supported_chunk_types_param) + num_ext; + pr_supported->ph.param_length = htons(parameter_len); + padding_len = SCTP_SIZE32(parameter_len) - parameter_len; + chunk_len += parameter_len; /* add authentication parameters */ if (!SCTP_BASE_SYSCTL(sctp_auth_disable)) { - struct sctp_auth_random *randp; - struct sctp_auth_hmac_algo *hmacs; - struct sctp_auth_chunk_list *chunks; - /* attach RANDOM parameter, if available */ if (stcb->asoc.authinfo.random != NULL) { - randp = (struct sctp_auth_random *)(mtod(m, caddr_t)+SCTP_BUF_LEN(m)); - p_len = sizeof(*randp) + stcb->asoc.authinfo.random_len; + struct sctp_auth_random *randp; + + if (padding_len > 0) { + memset(mtod(m, caddr_t)+chunk_len, 0, padding_len); + chunk_len += padding_len; + padding_len = 0; + } + randp = (struct sctp_auth_random *)(mtod(m, caddr_t)+chunk_len); + parameter_len = (uint16_t) sizeof(struct sctp_auth_random) + stcb->asoc.authinfo.random_len; /* random key already contains the header */ - bcopy(stcb->asoc.authinfo.random->key, randp, p_len); - /* zero out any padding required */ - bzero((caddr_t)randp + p_len, SCTP_SIZE32(p_len) - p_len); - SCTP_BUF_LEN(m) += SCTP_SIZE32(p_len); + memcpy(randp, stcb->asoc.authinfo.random->key, parameter_len); + padding_len = SCTP_SIZE32(parameter_len) - parameter_len; + chunk_len += parameter_len; } /* add HMAC_ALGO parameter */ - hmacs = (struct sctp_auth_hmac_algo *)(mtod(m, caddr_t)+SCTP_BUF_LEN(m)); - p_len = sctp_serialize_hmaclist(stcb->asoc.local_hmacs, - (uint8_t *) hmacs->hmac_ids); - if (p_len > 0) { - p_len += sizeof(*hmacs); + if ((stcb->asoc.local_hmacs != NULL) && + (stcb->asoc.local_hmacs->num_algo > 0)) { + struct sctp_auth_hmac_algo *hmacs; + + if (padding_len > 0) { + memset(mtod(m, caddr_t)+chunk_len, 0, padding_len); + chunk_len += padding_len; + padding_len = 0; + } + hmacs = (struct sctp_auth_hmac_algo *)(mtod(m, caddr_t)+chunk_len); + parameter_len = (uint16_t) (sizeof(struct sctp_auth_hmac_algo) + + stcb->asoc.local_hmacs->num_algo * sizeof(uint16_t)); hmacs->ph.param_type = htons(SCTP_HMAC_LIST); - hmacs->ph.param_length = htons(p_len); - /* zero out any padding required */ - bzero((caddr_t)hmacs + p_len, SCTP_SIZE32(p_len) - p_len); - SCTP_BUF_LEN(m) += SCTP_SIZE32(p_len); + hmacs->ph.param_length = htons(parameter_len); + sctp_serialize_hmaclist(stcb->asoc.local_hmacs, (uint8_t *) hmacs->hmac_ids); + padding_len = SCTP_SIZE32(parameter_len) - parameter_len; + chunk_len += parameter_len; } /* add CHUNKS parameter */ - chunks = (struct sctp_auth_chunk_list *)(mtod(m, caddr_t)+SCTP_BUF_LEN(m)); - p_len = sctp_serialize_auth_chunks(stcb->asoc.local_auth_chunks, - chunks->chunk_types); - if (p_len > 0) { - p_len += sizeof(*chunks); + if (sctp_auth_get_chklist_size(stcb->asoc.local_auth_chunks) > 0) { + struct sctp_auth_chunk_list *chunks; + + if (padding_len > 0) { + memset(mtod(m, caddr_t)+chunk_len, 0, padding_len); + chunk_len += padding_len; + padding_len = 0; + } + chunks = (struct sctp_auth_chunk_list *)(mtod(m, caddr_t)+chunk_len); + parameter_len = (uint16_t) (sizeof(struct sctp_auth_chunk_list) + + sctp_auth_get_chklist_size(stcb->asoc.local_auth_chunks)); chunks->ph.param_type = htons(SCTP_CHUNK_LIST); - chunks->ph.param_length = htons(p_len); - /* zero out any padding required */ - bzero((caddr_t)chunks + p_len, SCTP_SIZE32(p_len) - p_len); - SCTP_BUF_LEN(m) += SCTP_SIZE32(p_len); + chunks->ph.param_length = htons(parameter_len); + sctp_serialize_auth_chunks(stcb->asoc.local_auth_chunks, chunks->chunk_types); + padding_len = SCTP_SIZE32(parameter_len) - parameter_len; + chunk_len += parameter_len; } } - /* now the addresses */ - { - struct sctp_scoping scp; - - /* - * To optimize this we could put the scoping stuff into a - * structure and remove the individual uint8's from the - * assoc structure. Then we could just sifa in the address - * within the stcb. But for now this is a quick hack to get - * the address stuff teased apart. - */ - - scp.ipv4_addr_legal = stcb->asoc.ipv4_addr_legal; - scp.ipv6_addr_legal = stcb->asoc.ipv6_addr_legal; - scp.loopback_scope = stcb->asoc.loopback_scope; - scp.ipv4_local_scope = stcb->asoc.ipv4_local_scope; - scp.local_scope = stcb->asoc.local_scope; - scp.site_scope = stcb->asoc.site_scope; - - sctp_add_addresses_to_i_ia(inp, stcb, &scp, m, cnt_inits_to); - } + SCTP_BUF_LEN(m) = chunk_len; - /* calulate the size and update pkt header and chunk header */ - p_len = 0; - for (m_at = m; m_at; m_at = SCTP_BUF_NEXT(m_at)) { - if (SCTP_BUF_NEXT(m_at) == NULL) - mp_last = m_at; - p_len += SCTP_BUF_LEN(m_at); - } - init->ch.chunk_length = htons(p_len); + /* now the addresses */ /* - * We sifa 0 here to NOT set IP_DF if its IPv4, we ignore the return - * here since the timer will drive a retranmission. - */ + * To optimize this we could put the scoping stuff into a structure + * and remove the individual uint8's from the assoc structure. Then + * we could just sifa in the address within the stcb. But for now + * this is a quick hack to get the address stuff teased apart. + */ + scp.ipv4_addr_legal = stcb->asoc.ipv4_addr_legal; + scp.ipv6_addr_legal = stcb->asoc.ipv6_addr_legal; + scp.loopback_scope = stcb->asoc.loopback_scope; + scp.ipv4_local_scope = stcb->asoc.ipv4_local_scope; + scp.local_scope = stcb->asoc.local_scope; + scp.site_scope = stcb->asoc.site_scope; + sctp_add_addresses_to_i_ia(inp, stcb, &scp, m, cnt_inits_to, &padding_len, &chunk_len); + + init->ch.chunk_length = htons(chunk_len); + if (padding_len > 0) { + struct mbuf *m_at, *mp_last; - /* I don't expect this to execute but we will be safe here */ - padval = p_len % 4; - if ((padval) && (mp_last)) { - /* - * The compiler worries that mp_last may not be set even - * though I think it is impossible :-> however we add - * mp_last here just in case. - */ - ret = sctp_add_pad_tombuf(mp_last, (4 - padval)); - if (ret) { - /* Houston we have a problem, no space */ + mp_last = NULL; + for (m_at = m; m_at; m_at = SCTP_BUF_NEXT(m_at)) { + if (SCTP_BUF_NEXT(m_at) == NULL) + mp_last = m_at; + } + if ((mp_last == NULL) || sctp_add_pad_tombuf(mp_last, padding_len)) { sctp_m_freem(m); return; } @@ -5758,7 +5797,7 @@ do_a_abort: /* I can have what I want :> */ initack->init.num_outbound_streams = htons(i_want); } - /* tell him his limt. */ + /* tell him his limit. */ initack->init.num_inbound_streams = htons(inp->sctp_ep.max_open_streams_intome); @@ -5874,7 +5913,7 @@ do_a_abort: scp.ipv4_local_scope = stc.ipv4_scope; scp.local_scope = stc.local_scope; scp.site_scope = stc.site_scope; - m_at = sctp_add_addresses_to_i_ia(inp, stcb, &scp, m_at, cnt_inits_to); + m_at = sctp_add_addresses_to_i_ia(inp, stcb, &scp, m_at, cnt_inits_to, NULL, NULL); } /* tack on the operational error if present */ Modified: stable/8/sys/netinet/sctp_output.h ============================================================================== --- stable/8/sys/netinet/sctp_output.h Fri Mar 8 01:05:07 2013 (r248011) +++ stable/8/sys/netinet/sctp_output.h Fri Mar 8 01:10:33 2013 (r248012) @@ -46,7 +46,8 @@ sctp_add_addresses_to_i_ia(struct sctp_i struct sctp_tcb *stcb, struct sctp_scoping *scope, struct mbuf *m_at, - int cnt_inits_to); + int cnt_inits_to, + uint16_t * padding_len, uint16_t * chunk_len); int sctp_is_addr_restricted(struct sctp_tcb *, struct sctp_ifa *); From owner-svn-src-stable@FreeBSD.ORG Fri Mar 8 01:12:41 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 3FD1EB5C; Fri, 8 Mar 2013 01:12:41 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 26F5FEB0; Fri, 8 Mar 2013 01:12:41 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r281Cf9P088184; Fri, 8 Mar 2013 01:12:41 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r281CfJC088183; Fri, 8 Mar 2013 01:12:41 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201303080112.r281CfJC088183@svn.freebsd.org> From: Michael Tuexen Date: Fri, 8 Mar 2013 01:12:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r248013 - stable/8/sys/netinet X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Mar 2013 01:12:41 -0000 Author: tuexen Date: Fri Mar 8 01:12:40 2013 New Revision: 248013 URL: http://svnweb.freebsd.org/changeset/base/248013 Log: MFC r244026: Use correct padding of the ABORT chunk in case of an user initiated abort cause is used. Modified: stable/8/sys/netinet/sctp_output.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/netinet/ (props changed) Modified: stable/8/sys/netinet/sctp_output.c ============================================================================== --- stable/8/sys/netinet/sctp_output.c Fri Mar 8 01:10:33 2013 (r248012) +++ stable/8/sys/netinet/sctp_output.c Fri Mar 8 01:12:40 2013 (r248013) @@ -10738,45 +10738,50 @@ sctp_send_abort_tcb(struct sctp_tcb *stc #endif ) { - struct mbuf *m_abort; - struct mbuf *m_out = NULL, *m_end = NULL; - struct sctp_abort_chunk *abort = NULL; - int sz; - uint32_t auth_offset = 0; + struct mbuf *m_abort, *m, *m_last; + struct mbuf *m_out, *m_end = NULL; + struct sctp_abort_chunk *abort; struct sctp_auth_chunk *auth = NULL; struct sctp_nets *net; + uint32_t auth_offset = 0; + uint16_t cause_len, chunk_len, padding_len; + SCTP_TCB_LOCK_ASSERT(stcb); /*- * Add an AUTH chunk, if chunk requires it and save the offset into * the chain for AUTH */ if (sctp_auth_is_required_chunk(SCTP_ABORT_ASSOCIATION, stcb->asoc.peer_auth_chunks)) { - m_out = sctp_add_auth_chunk(m_out, &m_end, &auth, &auth_offset, + m_out = sctp_add_auth_chunk(NULL, &m_end, &auth, &auth_offset, stcb, SCTP_ABORT_ASSOCIATION); SCTP_STAT_INCR_COUNTER64(sctps_outcontrolchunks); + } else { + m_out = NULL; } - SCTP_TCB_LOCK_ASSERT(stcb); m_abort = sctp_get_mbuf_for_msg(sizeof(struct sctp_abort_chunk), 0, M_DONTWAIT, 1, MT_HEADER); if (m_abort == NULL) { - /* no mbuf's */ - if (m_out) + if (m_out) { sctp_m_freem(m_out); + } + if (operr) { + sctp_m_freem(operr); + } return; } /* link in any error */ SCTP_BUF_NEXT(m_abort) = operr; - sz = 0; - if (operr) { - struct mbuf *n; - - n = operr; - while (n) { - sz += SCTP_BUF_LEN(n); - n = SCTP_BUF_NEXT(n); + cause_len = 0; + m_last = NULL; + for (m = operr; m; m = SCTP_BUF_NEXT(m)) { + cause_len += (uint16_t) SCTP_BUF_LEN(m); + if (SCTP_BUF_NEXT(m) == NULL) { + m_last = m; } } - SCTP_BUF_LEN(m_abort) = sizeof(*abort); + SCTP_BUF_LEN(m_abort) = sizeof(struct sctp_abort_chunk); + chunk_len = (uint16_t) sizeof(struct sctp_abort_chunk) + cause_len; + padding_len = SCTP_SIZE32(chunk_len) - chunk_len; if (m_out == NULL) { /* NO Auth chunk prepended, so reserve space in front */ SCTP_BUF_RESV_UF(m_abort, SCTP_MIN_OVERHEAD); @@ -10790,12 +10795,18 @@ sctp_send_abort_tcb(struct sctp_tcb *stc } else { net = stcb->asoc.primary_destination; } - /* fill in the ABORT chunk */ + /* Fill in the ABORT chunk header. */ abort = mtod(m_abort, struct sctp_abort_chunk *); abort->ch.chunk_type = SCTP_ABORT_ASSOCIATION; abort->ch.chunk_flags = 0; - abort->ch.chunk_length = htons(sizeof(*abort) + sz); - + abort->ch.chunk_length = htons(chunk_len); + /* Add padding, if necessary. */ + if (padding_len > 0) { + if ((m_last == NULL) || sctp_add_pad_tombuf(m_last, padding_len)) { + sctp_m_freem(m_out); + return; + } + } (void)sctp_lowlevel_chunk_output(stcb->sctp_ep, stcb, net, (struct sockaddr *)&net->ro._l_addr, m_out, auth_offset, auth, stcb->asoc.authinfo.active_keyid, 1, 0, 0, From owner-svn-src-stable@FreeBSD.ORG Fri Mar 8 01:14:23 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 6D5B9CD1; Fri, 8 Mar 2013 01:14:23 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 5F70FEBC; Fri, 8 Mar 2013 01:14:23 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r281EM7d088458; Fri, 8 Mar 2013 01:14:22 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r281EMGj088457; Fri, 8 Mar 2013 01:14:22 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201303080114.r281EMGj088457@svn.freebsd.org> From: Michael Tuexen Date: Fri, 8 Mar 2013 01:14:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r248014 - stable/8/sys/netinet X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Mar 2013 01:14:23 -0000 Author: tuexen Date: Fri Mar 8 01:14:22 2013 New Revision: 248014 URL: http://svnweb.freebsd.org/changeset/base/248014 Log: MFC r244033: Get it compiling without INET and INET6 support (mainly userland stack). Modified: stable/8/sys/netinet/sctp_output.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/netinet/ (props changed) Modified: stable/8/sys/netinet/sctp_output.c ============================================================================== --- stable/8/sys/netinet/sctp_output.c Fri Mar 8 01:12:40 2013 (r248013) +++ stable/8/sys/netinet/sctp_output.c Fri Mar 8 01:14:22 2013 (r248014) @@ -4604,7 +4604,11 @@ sctp_send_initiate(struct sctp_inpcb *in struct mbuf *m; struct sctp_nets *net; struct sctp_init_chunk *init; + +#if defined(INET) || defined(INET6) struct sctp_supported_addr_param *sup_addr; + +#endif struct sctp_adaptation_layer_indication *ali; struct sctp_supported_chunk_types_param *pr_supported; struct sctp_paramhdr *ph; From owner-svn-src-stable@FreeBSD.ORG Fri Mar 8 01:16:09 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 2D746ED3; Fri, 8 Mar 2013 01:16:09 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 205F5ECF; Fri, 8 Mar 2013 01:16:09 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r281G9TR088757; Fri, 8 Mar 2013 01:16:09 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r281G8k3088756; Fri, 8 Mar 2013 01:16:08 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201303080116.r281G8k3088756@svn.freebsd.org> From: Michael Tuexen Date: Fri, 8 Mar 2013 01:16:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r248015 - stable/8/sys/netinet X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Mar 2013 01:16:09 -0000 Author: tuexen Date: Fri Mar 8 01:16:08 2013 New Revision: 248015 URL: http://svnweb.freebsd.org/changeset/base/248015 Log: MFC r244728: Fix a copy and paste error. Modified: stable/8/sys/netinet/sctputil.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/netinet/ (props changed) Modified: stable/8/sys/netinet/sctputil.c ============================================================================== --- stable/8/sys/netinet/sctputil.c Fri Mar 8 01:14:22 2013 (r248014) +++ stable/8/sys/netinet/sctputil.c Fri Mar 8 01:16:08 2013 (r248015) @@ -4955,7 +4955,7 @@ sctp_get_ifa_hash_val(struct sockaddr *a } #endif #ifdef INET6 - case INET6: + case AF_INET6: { struct sockaddr_in6 *sin6; uint32_t hash_of_addr; From owner-svn-src-stable@FreeBSD.ORG Fri Mar 8 01:17:56 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id A800AE2; Fri, 8 Mar 2013 01:17:56 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 8298DEE7; Fri, 8 Mar 2013 01:17:56 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r281Hu4H089014; Fri, 8 Mar 2013 01:17:56 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r281HuTt089013; Fri, 8 Mar 2013 01:17:56 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201303080117.r281HuTt089013@svn.freebsd.org> From: Michael Tuexen Date: Fri, 8 Mar 2013 01:17:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r248016 - stable/8/sys/netinet X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Mar 2013 01:17:56 -0000 Author: tuexen Date: Fri Mar 8 01:17:55 2013 New Revision: 248016 URL: http://svnweb.freebsd.org/changeset/base/248016 Log: MFC r244729: Minor cleanups of debug messages. Modified: stable/8/sys/netinet/sctp_pcb.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/netinet/ (props changed) Modified: stable/8/sys/netinet/sctp_pcb.c ============================================================================== --- stable/8/sys/netinet/sctp_pcb.c Fri Mar 8 01:16:08 2013 (r248015) +++ stable/8/sys/netinet/sctp_pcb.c Fri Mar 8 01:17:55 2013 (r248016) @@ -2694,9 +2694,9 @@ sctp_inpcb_bind(struct socket *so, struc ip_inp = (struct inpcb *)so->so_pcb; #ifdef SCTP_DEBUG if (addr) { - SCTPDBG(SCTP_DEBUG_PCB1, "Bind called port:%d\n", + SCTPDBG(SCTP_DEBUG_PCB1, "Bind called port: %d\n", ntohs(((struct sockaddr_in *)addr)->sin_port)); - SCTPDBG(SCTP_DEBUG_PCB1, "Addr :"); + SCTPDBG(SCTP_DEBUG_PCB1, "Addr: "); SCTPDBG_ADDR(SCTP_DEBUG_PCB1, addr); } #endif From owner-svn-src-stable@FreeBSD.ORG Fri Mar 8 01:19:47 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 177ED365; Fri, 8 Mar 2013 01:19:47 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 09CB4F08; Fri, 8 Mar 2013 01:19:47 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r281Jkxt089305; Fri, 8 Mar 2013 01:19:46 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r281JkrK089304; Fri, 8 Mar 2013 01:19:46 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201303080119.r281JkrK089304@svn.freebsd.org> From: Michael Tuexen Date: Fri, 8 Mar 2013 01:19:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r248017 - stable/8/sys/netinet X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Mar 2013 01:19:47 -0000 Author: tuexen Date: Fri Mar 8 01:19:46 2013 New Revision: 248017 URL: http://svnweb.freebsd.org/changeset/base/248017 Log: MFC r244730: Some cleanups. Modified: stable/8/sys/netinet/sctp_usrreq.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/netinet/ (props changed) Modified: stable/8/sys/netinet/sctp_usrreq.c ============================================================================== --- stable/8/sys/netinet/sctp_usrreq.c Fri Mar 8 01:17:55 2013 (r248016) +++ stable/8/sys/netinet/sctp_usrreq.c Fri Mar 8 01:19:46 2013 (r248017) @@ -547,27 +547,21 @@ try_again: static int sctp_bind(struct socket *so, struct sockaddr *addr, struct thread *p) { - struct sctp_inpcb *inp = NULL; - int error; + struct sctp_inpcb *inp; -#ifdef INET - if (addr && addr->sa_family != AF_INET) { - /* must be a v4 address! */ - SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL); - return (EINVAL); - } -#endif /* INET6 */ - if (addr && (addr->sa_len != sizeof(struct sockaddr_in))) { - SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL); - return (EINVAL); - } inp = (struct sctp_inpcb *)so->so_pcb; if (inp == NULL) { SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL); return (EINVAL); } - error = sctp_inpcb_bind(so, addr, NULL, p); - return (error); + if (addr != NULL) { + if ((addr->sa_family != AF_INET) || + (addr->sa_len != sizeof(struct sockaddr_in))) { + SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL); + return (EINVAL); + } + } + return (sctp_inpcb_bind(so, addr, NULL, p)); } #endif From owner-svn-src-stable@FreeBSD.ORG Fri Mar 8 01:21:49 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id DA0784E1; Fri, 8 Mar 2013 01:21:49 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id BDAB0F18; Fri, 8 Mar 2013 01:21:49 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r281LnKE091205; Fri, 8 Mar 2013 01:21:49 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r281LmtM091193; Fri, 8 Mar 2013 01:21:48 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201303080121.r281LmtM091193@svn.freebsd.org> From: Michael Tuexen Date: Fri, 8 Mar 2013 01:21:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r248018 - stable/8/sys/netinet X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Mar 2013 01:21:49 -0000 Author: tuexen Date: Fri Mar 8 01:21:48 2013 New Revision: 248018 URL: http://svnweb.freebsd.org/changeset/base/248018 Log: MFC r246588: Fix a bug where HEARTBEATs were still sent in SHUTDOWN_SENT or SHUTDOWN_ACK_SENT state. While there, make the corresponding code consistent. Modified: stable/8/sys/netinet/sctp_indata.c stable/8/sys/netinet/sctp_input.c stable/8/sys/netinet/sctp_output.c stable/8/sys/netinet/sctp_pcb.c stable/8/sys/netinet/sctp_timer.c stable/8/sys/netinet/sctp_usrreq.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/netinet/ (props changed) Modified: stable/8/sys/netinet/sctp_indata.c ============================================================================== --- stable/8/sys/netinet/sctp_indata.c Fri Mar 8 01:19:46 2013 (r248017) +++ stable/8/sys/netinet/sctp_indata.c Fri Mar 8 01:21:48 2013 (r248018) @@ -4262,19 +4262,19 @@ again: (asoc->stream_queue_cnt == 0)) { struct sctp_nets *netp; - if (asoc->alternate) { - netp = asoc->alternate; - } else { - netp = asoc->primary_destination; - } if (asoc->state & SCTP_STATE_PARTIAL_MSG_LEFT) { goto abort_out_now; } SCTP_STAT_DECR_GAUGE32(sctps_currestab); SCTP_SET_STATE(asoc, SCTP_STATE_SHUTDOWN_ACK_SENT); SCTP_CLEAR_SUBSTATE(asoc, SCTP_STATE_SHUTDOWN_PENDING); - sctp_send_shutdown_ack(stcb, netp); sctp_stop_timers_for_shutdown(stcb); + if (asoc->alternate) { + netp = asoc->alternate; + } else { + netp = asoc->primary_destination; + } + sctp_send_shutdown_ack(stcb, netp); sctp_timer_start(SCTP_TIMER_TYPE_SHUTDOWNACK, stcb->sctp_ep, stcb, netp); } @@ -4973,11 +4973,6 @@ sctp_handle_sack(struct mbuf *m, int off } else { struct sctp_nets *netp; - if (asoc->alternate) { - netp = asoc->alternate; - } else { - netp = asoc->primary_destination; - } if ((SCTP_GET_STATE(asoc) == SCTP_STATE_OPEN) || (SCTP_GET_STATE(asoc) == SCTP_STATE_SHUTDOWN_RECEIVED)) { SCTP_STAT_DECR_GAUGE32(sctps_currestab); @@ -4985,6 +4980,11 @@ sctp_handle_sack(struct mbuf *m, int off SCTP_SET_STATE(asoc, SCTP_STATE_SHUTDOWN_SENT); SCTP_CLEAR_SUBSTATE(asoc, SCTP_STATE_SHUTDOWN_PENDING); sctp_stop_timers_for_shutdown(stcb); + if (asoc->alternate) { + netp = asoc->alternate; + } else { + netp = asoc->primary_destination; + } sctp_send_shutdown(stcb, netp); sctp_timer_start(SCTP_TIMER_TYPE_SHUTDOWN, stcb->sctp_ep, stcb, netp); @@ -4996,19 +4996,19 @@ sctp_handle_sack(struct mbuf *m, int off (asoc->stream_queue_cnt == 0)) { struct sctp_nets *netp; - if (asoc->alternate) { - netp = asoc->alternate; - } else { - netp = asoc->primary_destination; - } if (asoc->state & SCTP_STATE_PARTIAL_MSG_LEFT) { goto abort_out_now; } SCTP_STAT_DECR_GAUGE32(sctps_currestab); SCTP_SET_STATE(asoc, SCTP_STATE_SHUTDOWN_ACK_SENT); SCTP_CLEAR_SUBSTATE(asoc, SCTP_STATE_SHUTDOWN_PENDING); - sctp_send_shutdown_ack(stcb, netp); sctp_stop_timers_for_shutdown(stcb); + if (asoc->alternate) { + netp = asoc->alternate; + } else { + netp = asoc->primary_destination; + } + sctp_send_shutdown_ack(stcb, netp); sctp_timer_start(SCTP_TIMER_TYPE_SHUTDOWNACK, stcb->sctp_ep, stcb, netp); return; Modified: stable/8/sys/netinet/sctp_input.c ============================================================================== --- stable/8/sys/netinet/sctp_input.c Fri Mar 8 01:19:46 2013 (r248017) +++ stable/8/sys/netinet/sctp_input.c Fri Mar 8 01:21:48 2013 (r248018) @@ -956,7 +956,6 @@ sctp_handle_shutdown(struct sctp_shutdow } else { /* no outstanding data to send, so move on... */ /* send SHUTDOWN-ACK */ - sctp_send_shutdown_ack(stcb, net); /* move to SHUTDOWN-ACK-SENT state */ if ((SCTP_GET_STATE(asoc) == SCTP_STATE_OPEN) || (SCTP_GET_STATE(asoc) == SCTP_STATE_SHUTDOWN_RECEIVED)) { @@ -965,6 +964,7 @@ sctp_handle_shutdown(struct sctp_shutdow SCTP_SET_STATE(asoc, SCTP_STATE_SHUTDOWN_ACK_SENT); SCTP_CLEAR_SUBSTATE(asoc, SCTP_STATE_SHUTDOWN_PENDING); sctp_stop_timers_for_shutdown(stcb); + sctp_send_shutdown_ack(stcb, net); sctp_timer_start(SCTP_TIMER_TYPE_SHUTDOWNACK, stcb->sctp_ep, stcb, net); } Modified: stable/8/sys/netinet/sctp_output.c ============================================================================== --- stable/8/sys/netinet/sctp_output.c Fri Mar 8 01:19:46 2013 (r248017) +++ stable/8/sys/netinet/sctp_output.c Fri Mar 8 01:21:48 2013 (r248018) @@ -6579,12 +6579,13 @@ sctp_sendall_iterator(struct sctp_inpcb * only send SHUTDOWN the first time * through */ - sctp_send_shutdown(stcb, net); if (SCTP_GET_STATE(asoc) == SCTP_STATE_OPEN) { SCTP_STAT_DECR_GAUGE32(sctps_currestab); } SCTP_SET_STATE(asoc, SCTP_STATE_SHUTDOWN_SENT); SCTP_CLEAR_SUBSTATE(asoc, SCTP_STATE_SHUTDOWN_PENDING); + sctp_stop_timers_for_shutdown(stcb); + sctp_send_shutdown(stcb, net); sctp_timer_start(SCTP_TIMER_TYPE_SHUTDOWN, stcb->sctp_ep, stcb, net); sctp_timer_start(SCTP_TIMER_TYPE_SHUTDOWNGUARD, stcb->sctp_ep, stcb, @@ -13097,18 +13098,19 @@ dataless_eof: (SCTP_GET_STATE(asoc) != SCTP_STATE_SHUTDOWN_ACK_SENT)) { struct sctp_nets *netp; - if (stcb->asoc.alternate) { - netp = stcb->asoc.alternate; - } else { - netp = stcb->asoc.primary_destination; - } /* only send SHUTDOWN the first time through */ - sctp_send_shutdown(stcb, netp); if (SCTP_GET_STATE(asoc) == SCTP_STATE_OPEN) { SCTP_STAT_DECR_GAUGE32(sctps_currestab); } SCTP_SET_STATE(asoc, SCTP_STATE_SHUTDOWN_SENT); SCTP_CLEAR_SUBSTATE(asoc, SCTP_STATE_SHUTDOWN_PENDING); + sctp_stop_timers_for_shutdown(stcb); + if (stcb->asoc.alternate) { + netp = stcb->asoc.alternate; + } else { + netp = stcb->asoc.primary_destination; + } + sctp_send_shutdown(stcb, netp); sctp_timer_start(SCTP_TIMER_TYPE_SHUTDOWN, stcb->sctp_ep, stcb, netp); sctp_timer_start(SCTP_TIMER_TYPE_SHUTDOWNGUARD, stcb->sctp_ep, stcb, Modified: stable/8/sys/netinet/sctp_pcb.c ============================================================================== --- stable/8/sys/netinet/sctp_pcb.c Fri Mar 8 01:19:46 2013 (r248017) +++ stable/8/sys/netinet/sctp_pcb.c Fri Mar 8 01:21:48 2013 (r248018) @@ -3332,22 +3332,23 @@ sctp_inpcb_free(struct sctp_inpcb *inp, (SCTP_GET_STATE(&asoc->asoc) != SCTP_STATE_SHUTDOWN_ACK_SENT)) { struct sctp_nets *netp; - if (asoc->asoc.alternate) { - netp = asoc->asoc.alternate; - } else { - netp = asoc->asoc.primary_destination; - } /* * there is nothing queued to send, * so I send shutdown */ - sctp_send_shutdown(asoc, netp); if ((SCTP_GET_STATE(&asoc->asoc) == SCTP_STATE_OPEN) || (SCTP_GET_STATE(&asoc->asoc) == SCTP_STATE_SHUTDOWN_RECEIVED)) { SCTP_STAT_DECR_GAUGE32(sctps_currestab); } SCTP_SET_STATE(&asoc->asoc, SCTP_STATE_SHUTDOWN_SENT); SCTP_CLEAR_SUBSTATE(&asoc->asoc, SCTP_STATE_SHUTDOWN_PENDING); + sctp_stop_timers_for_shutdown(asoc); + if (asoc->asoc.alternate) { + netp = asoc->asoc.alternate; + } else { + netp = asoc->asoc.primary_destination; + } + sctp_send_shutdown(asoc, netp); sctp_timer_start(SCTP_TIMER_TYPE_SHUTDOWN, asoc->sctp_ep, asoc, netp); sctp_timer_start(SCTP_TIMER_TYPE_SHUTDOWNGUARD, asoc->sctp_ep, asoc, Modified: stable/8/sys/netinet/sctp_timer.c ============================================================================== --- stable/8/sys/netinet/sctp_timer.c Fri Mar 8 01:19:46 2013 (r248017) +++ stable/8/sys/netinet/sctp_timer.c Fri Mar 8 01:21:48 2013 (r248018) @@ -1560,18 +1560,19 @@ sctp_autoclose_timer(struct sctp_inpcb * /* only send SHUTDOWN 1st time thru */ struct sctp_nets *netp; - if (stcb->asoc.alternate) { - netp = stcb->asoc.alternate; - } else { - netp = stcb->asoc.primary_destination; - } - sctp_send_shutdown(stcb, netp); if ((SCTP_GET_STATE(asoc) == SCTP_STATE_OPEN) || (SCTP_GET_STATE(asoc) == SCTP_STATE_SHUTDOWN_RECEIVED)) { SCTP_STAT_DECR_GAUGE32(sctps_currestab); } SCTP_SET_STATE(asoc, SCTP_STATE_SHUTDOWN_SENT); SCTP_CLEAR_SUBSTATE(asoc, SCTP_STATE_SHUTDOWN_PENDING); + sctp_stop_timers_for_shutdown(stcb); + if (stcb->asoc.alternate) { + netp = stcb->asoc.alternate; + } else { + netp = stcb->asoc.primary_destination; + } + sctp_send_shutdown(stcb, netp); sctp_timer_start(SCTP_TIMER_TYPE_SHUTDOWN, stcb->sctp_ep, stcb, netp); Modified: stable/8/sys/netinet/sctp_usrreq.c ============================================================================== --- stable/8/sys/netinet/sctp_usrreq.c Fri Mar 8 01:19:46 2013 (r248017) +++ stable/8/sys/netinet/sctp_usrreq.c Fri Mar 8 01:21:48 2013 (r248018) @@ -794,25 +794,24 @@ sctp_disconnect(struct socket *so) /* only send SHUTDOWN 1st time thru */ struct sctp_nets *netp; - if (stcb->asoc.alternate) { - netp = stcb->asoc.alternate; - } else { - netp = stcb->asoc.primary_destination; - } - sctp_stop_timers_for_shutdown(stcb); - sctp_send_shutdown(stcb, netp); - sctp_chunk_output(stcb->sctp_ep, stcb, SCTP_OUTPUT_FROM_T3, SCTP_SO_LOCKED); if ((SCTP_GET_STATE(asoc) == SCTP_STATE_OPEN) || (SCTP_GET_STATE(asoc) == SCTP_STATE_SHUTDOWN_RECEIVED)) { SCTP_STAT_DECR_GAUGE32(sctps_currestab); } SCTP_SET_STATE(asoc, SCTP_STATE_SHUTDOWN_SENT); SCTP_CLEAR_SUBSTATE(asoc, SCTP_STATE_SHUTDOWN_PENDING); + sctp_stop_timers_for_shutdown(stcb); + if (stcb->asoc.alternate) { + netp = stcb->asoc.alternate; + } else { + netp = stcb->asoc.primary_destination; + } + sctp_send_shutdown(stcb, netp); sctp_timer_start(SCTP_TIMER_TYPE_SHUTDOWN, stcb->sctp_ep, stcb, netp); sctp_timer_start(SCTP_TIMER_TYPE_SHUTDOWNGUARD, stcb->sctp_ep, stcb, netp); - + sctp_chunk_output(stcb->sctp_ep, stcb, SCTP_OUTPUT_FROM_T3, SCTP_SO_LOCKED); } } else { /* @@ -1014,24 +1013,24 @@ sctp_shutdown(struct socket *so) /* only send SHUTDOWN the first time through */ struct sctp_nets *netp; - if (stcb->asoc.alternate) { - netp = stcb->asoc.alternate; - } else { - netp = stcb->asoc.primary_destination; - } - sctp_stop_timers_for_shutdown(stcb); - sctp_send_shutdown(stcb, netp); - sctp_chunk_output(stcb->sctp_ep, stcb, SCTP_OUTPUT_FROM_T3, SCTP_SO_LOCKED); if ((SCTP_GET_STATE(asoc) == SCTP_STATE_OPEN) || (SCTP_GET_STATE(asoc) == SCTP_STATE_SHUTDOWN_RECEIVED)) { SCTP_STAT_DECR_GAUGE32(sctps_currestab); } SCTP_SET_STATE(asoc, SCTP_STATE_SHUTDOWN_SENT); SCTP_CLEAR_SUBSTATE(asoc, SCTP_STATE_SHUTDOWN_PENDING); + sctp_stop_timers_for_shutdown(stcb); + if (stcb->asoc.alternate) { + netp = stcb->asoc.alternate; + } else { + netp = stcb->asoc.primary_destination; + } + sctp_send_shutdown(stcb, netp); sctp_timer_start(SCTP_TIMER_TYPE_SHUTDOWN, stcb->sctp_ep, stcb, netp); sctp_timer_start(SCTP_TIMER_TYPE_SHUTDOWNGUARD, stcb->sctp_ep, stcb, netp); + sctp_chunk_output(stcb->sctp_ep, stcb, SCTP_OUTPUT_FROM_T3, SCTP_SO_LOCKED); } } else { /* From owner-svn-src-stable@FreeBSD.ORG Fri Mar 8 01:24:03 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 2D12E662; Fri, 8 Mar 2013 01:24:03 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 1EB56F29; Fri, 8 Mar 2013 01:24:03 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r281O39u091604; Fri, 8 Mar 2013 01:24:03 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r281O1k3091584; Fri, 8 Mar 2013 01:24:01 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201303080124.r281O1k3091584@svn.freebsd.org> From: Michael Tuexen Date: Fri, 8 Mar 2013 01:24:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r248019 - stable/8/sys/netinet X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Mar 2013 01:24:03 -0000 Author: tuexen Date: Fri Mar 8 01:24:00 2013 New Revision: 248019 URL: http://svnweb.freebsd.org/changeset/base/248019 Log: MFC r246595: Cleanup the handling of address scopes. Announce in the INIT/INIT-ACK only the supported address types. While there, do some whitespace cleanups. Modified: stable/8/sys/netinet/sctp.h stable/8/sys/netinet/sctp_asconf.c stable/8/sys/netinet/sctp_input.c stable/8/sys/netinet/sctp_output.c stable/8/sys/netinet/sctp_output.h stable/8/sys/netinet/sctp_pcb.c stable/8/sys/netinet/sctp_structs.h stable/8/sys/netinet/sctp_sysctl.c stable/8/sys/netinet/sctp_usrreq.c stable/8/sys/netinet/sctputil.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/netinet/ (props changed) Modified: stable/8/sys/netinet/sctp.h ============================================================================== --- stable/8/sys/netinet/sctp.h Fri Mar 8 01:21:48 2013 (r248018) +++ stable/8/sys/netinet/sctp.h Fri Mar 8 01:24:00 2013 (r248019) @@ -500,12 +500,12 @@ struct sctp_error_unrecognized_chunk { #define SCTP_PCB_FLAGS_SOCKET_GONE 0x10000000 #define SCTP_PCB_FLAGS_SOCKET_ALLGONE 0x20000000 #define SCTP_PCB_FLAGS_SOCKET_CANT_READ 0x40000000 + /* flags to copy to new PCB */ #define SCTP_PCB_COPY_FLAGS (SCTP_PCB_FLAGS_BOUNDALL|\ SCTP_PCB_FLAGS_WAKEINPUT|\ SCTP_PCB_FLAGS_BOUND_V6) - /* * PCB Features (in sctp_features bitmask) */ Modified: stable/8/sys/netinet/sctp_asconf.c ============================================================================== --- stable/8/sys/netinet/sctp_asconf.c Fri Mar 8 01:21:48 2013 (r248018) +++ stable/8/sys/netinet/sctp_asconf.c Fri Mar 8 01:24:00 2013 (r248019) @@ -1916,7 +1916,7 @@ sctp_addr_mgmt_assoc(struct sctp_inpcb * return; } if (IN6_IS_ADDR_LINKLOCAL(&sin6->sin6_addr)) { - if (stcb->asoc.local_scope == 0) { + if (stcb->asoc.scope.local_scope == 0) { return; } /* is it the right link local scope? */ @@ -1924,7 +1924,7 @@ sctp_addr_mgmt_assoc(struct sctp_inpcb * return; } } - if (stcb->asoc.site_scope == 0 && + if (stcb->asoc.scope.site_scope == 0 && IN6_IS_ADDR_SITELOCAL(&sin6->sin6_addr)) { return; } @@ -1948,7 +1948,7 @@ sctp_addr_mgmt_assoc(struct sctp_inpcb * /* we skip unspecifed addresses */ return; } - if (stcb->asoc.ipv4_local_scope == 0 && + if (stcb->asoc.scope.ipv4_local_scope == 0 && IN4_ISPRIVATE_ADDRESS(&sin->sin_addr)) { return; } @@ -2106,7 +2106,7 @@ sctp_asconf_iterator_stcb(struct sctp_in continue; } if (IN6_IS_ADDR_LINKLOCAL(&sin6->sin6_addr)) { - if (stcb->asoc.local_scope == 0) { + if (stcb->asoc.scope.local_scope == 0) { continue; } /* is it the right link local scope? */ @@ -2135,7 +2135,7 @@ sctp_asconf_iterator_stcb(struct sctp_in /* we skip unspecifed addresses */ continue; } - if (stcb->asoc.ipv4_local_scope == 0 && + if (stcb->asoc.scope.ipv4_local_scope == 0 && IN4_ISPRIVATE_ADDRESS(&sin->sin_addr)) { continue; } @@ -2198,13 +2198,7 @@ sctp_asconf_iterator_stcb(struct sctp_in } } else { /* Need to check scopes for this guy */ - if (sctp_is_address_in_scope(ifa, - stcb->asoc.ipv4_addr_legal, - stcb->asoc.ipv6_addr_legal, - stcb->asoc.loopback_scope, - stcb->asoc.ipv4_local_scope, - stcb->asoc.local_scope, - stcb->asoc.site_scope, 0) == 0) { + if (sctp_is_address_in_scope(ifa, &stcb->asoc.scope, 0) == 0) { continue; } } @@ -2437,7 +2431,7 @@ sctp_find_valid_localaddr(struct sctp_tc return (NULL); } LIST_FOREACH(sctp_ifn, &vrf->ifnlist, next_ifn) { - if (stcb->asoc.loopback_scope == 0 && + if (stcb->asoc.scope.loopback_scope == 0 && SCTP_IFN_IS_IFT_LOOP(sctp_ifn)) { /* Skip if loopback_scope not set */ continue; @@ -2446,7 +2440,7 @@ sctp_find_valid_localaddr(struct sctp_tc switch (sctp_ifa->address.sa.sa_family) { #ifdef INET case AF_INET: - if (stcb->asoc.ipv4_addr_legal) { + if (stcb->asoc.scope.ipv4_addr_legal) { struct sockaddr_in *sin; sin = (struct sockaddr_in *)&sctp_ifa->address.sa; @@ -2454,7 +2448,7 @@ sctp_find_valid_localaddr(struct sctp_tc /* skip unspecifed addresses */ continue; } - if (stcb->asoc.ipv4_local_scope == 0 && + if (stcb->asoc.scope.ipv4_local_scope == 0 && IN4_ISPRIVATE_ADDRESS(&sin->sin_addr)) continue; @@ -2473,7 +2467,7 @@ sctp_find_valid_localaddr(struct sctp_tc #endif #ifdef INET6 case AF_INET6: - if (stcb->asoc.ipv6_addr_legal) { + if (stcb->asoc.scope.ipv6_addr_legal) { struct sockaddr_in6 *sin6; if (sctp_ifa->localifa_flags & SCTP_ADDR_IFA_UNUSEABLE) { @@ -2487,10 +2481,10 @@ sctp_find_valid_localaddr(struct sctp_tc */ continue; } - if (stcb->asoc.local_scope == 0 && + if (stcb->asoc.scope.local_scope == 0 && IN6_IS_ADDR_LINKLOCAL(&sin6->sin6_addr)) continue; - if (stcb->asoc.site_scope == 0 && + if (stcb->asoc.scope.site_scope == 0 && IN6_IS_ADDR_SITELOCAL(&sin6->sin6_addr)) continue; Modified: stable/8/sys/netinet/sctp_input.c ============================================================================== --- stable/8/sys/netinet/sctp_input.c Fri Mar 8 01:21:48 2013 (r248018) +++ stable/8/sys/netinet/sctp_input.c Fri Mar 8 01:24:00 2013 (r248019) @@ -2130,13 +2130,13 @@ sctp_process_cookie_new(struct mbuf *m, asoc = &stcb->asoc; /* get scope variables out of cookie */ - asoc->ipv4_local_scope = cookie->ipv4_scope; - asoc->site_scope = cookie->site_scope; - asoc->local_scope = cookie->local_scope; - asoc->loopback_scope = cookie->loopback_scope; + asoc->scope.ipv4_local_scope = cookie->ipv4_scope; + asoc->scope.site_scope = cookie->site_scope; + asoc->scope.local_scope = cookie->local_scope; + asoc->scope.loopback_scope = cookie->loopback_scope; - if ((asoc->ipv4_addr_legal != cookie->ipv4_addr_legal) || - (asoc->ipv6_addr_legal != cookie->ipv6_addr_legal)) { + if ((asoc->scope.ipv4_addr_legal != cookie->ipv4_addr_legal) || + (asoc->scope.ipv6_addr_legal != cookie->ipv6_addr_legal)) { struct mbuf *op_err; /* Modified: stable/8/sys/netinet/sctp_output.c ============================================================================== --- stable/8/sys/netinet/sctp_output.c Fri Mar 8 01:21:48 2013 (r248018) +++ stable/8/sys/netinet/sctp_output.c Fri Mar 8 01:24:00 2013 (r248019) @@ -1863,15 +1863,10 @@ struct sack_track sack_array[256] = { int sctp_is_address_in_scope(struct sctp_ifa *ifa, - int ipv4_addr_legal, - int ipv6_addr_legal, - int loopback_scope, - int ipv4_local_scope, - int local_scope SCTP_UNUSED,/* XXX */ - int site_scope, + struct sctp_scoping *scope, int do_update) { - if ((loopback_scope == 0) && + if ((scope->loopback_scope == 0) && (ifa->ifn_p) && SCTP_IFN_IS_IFT_LOOP(ifa->ifn_p)) { /* * skip loopback if not in scope * @@ -1881,7 +1876,7 @@ sctp_is_address_in_scope(struct sctp_ifa switch (ifa->address.sa.sa_family) { #ifdef INET case AF_INET: - if (ipv4_addr_legal) { + if (scope->ipv4_addr_legal) { struct sockaddr_in *sin; sin = (struct sockaddr_in *)&ifa->address.sin; @@ -1889,7 +1884,7 @@ sctp_is_address_in_scope(struct sctp_ifa /* not in scope , unspecified */ return (0); } - if ((ipv4_local_scope == 0) && + if ((scope->ipv4_local_scope == 0) && (IN4_ISPRIVATE_ADDRESS(&sin->sin_addr))) { /* private address not in scope */ return (0); @@ -1901,7 +1896,7 @@ sctp_is_address_in_scope(struct sctp_ifa #endif #ifdef INET6 case AF_INET6: - if (ipv6_addr_legal) { + if (scope->ipv6_addr_legal) { struct sockaddr_in6 *sin6; /* @@ -1924,7 +1919,7 @@ sctp_is_address_in_scope(struct sctp_ifa (IN6_IS_ADDR_LINKLOCAL(&sin6->sin6_addr))) { return (0); } - if ((site_scope == 0) && + if ((scope->site_scope == 0) && (IN6_IS_ADDR_SITELOCAL(&sin6->sin6_addr))) { return (0); } @@ -2063,13 +2058,7 @@ sctp_add_addresses_to_i_ia(struct sctp_i if (sctp_is_addr_restricted(stcb, sctp_ifap)) { continue; } - if (sctp_is_address_in_scope(sctp_ifap, - scope->ipv4_addr_legal, - scope->ipv6_addr_legal, - scope->loopback_scope, - scope->ipv4_local_scope, - scope->local_scope, - scope->site_scope, 1) == 0) { + if (sctp_is_address_in_scope(sctp_ifap, scope, 1) == 0) { continue; } cnt++; @@ -2099,12 +2088,7 @@ skip_count: continue; } if (sctp_is_address_in_scope(sctp_ifap, - scope->ipv4_addr_legal, - scope->ipv6_addr_legal, - scope->loopback_scope, - scope->ipv4_local_scope, - scope->local_scope, - scope->site_scope, 0) == 0) { + scope, 0) == 0) { continue; } if ((chunk_len != NULL) && @@ -2157,12 +2141,7 @@ skip_count: continue; } if (sctp_is_address_in_scope(laddr->ifa, - scope->ipv4_addr_legal, - scope->ipv6_addr_legal, - scope->loopback_scope, - scope->ipv4_local_scope, - scope->local_scope, - scope->site_scope, 1) == 0) { + scope, 1) == 0) { continue; } cnt++; @@ -2182,12 +2161,7 @@ skip_count: continue; } if (sctp_is_address_in_scope(laddr->ifa, - scope->ipv4_addr_legal, - scope->ipv6_addr_legal, - scope->loopback_scope, - scope->ipv4_local_scope, - scope->local_scope, - scope->site_scope, 0) == 0) { + scope, 0) == 0) { continue; } if ((chunk_len != NULL) && @@ -2801,13 +2775,7 @@ sctp_select_nth_preferred_addr_from_ifn_ } #endif if (stcb) { - if (sctp_is_address_in_scope(ifa, - stcb->asoc.ipv4_addr_legal, - stcb->asoc.ipv6_addr_legal, - stcb->asoc.loopback_scope, - stcb->asoc.ipv4_local_scope, - stcb->asoc.local_scope, - stcb->asoc.site_scope, 0) == 0) { + if (sctp_is_address_in_scope(ifa, &stcb->asoc.scope, 0) == 0) { continue; } if (((non_asoc_addr_ok == 0) && @@ -2853,13 +2821,7 @@ sctp_count_num_preferred_boundall(struct continue; } if (stcb) { - if (sctp_is_address_in_scope(ifa, - stcb->asoc.ipv4_addr_legal, - stcb->asoc.ipv6_addr_legal, - stcb->asoc.loopback_scope, - stcb->asoc.ipv4_local_scope, - stcb->asoc.local_scope, - stcb->asoc.site_scope, 0) == 0) { + if (sctp_is_address_in_scope(ifa, &stcb->asoc.scope, 0) == 0) { continue; } if (((non_asoc_addr_ok == 0) && @@ -3055,13 +3017,7 @@ again_with_private_addresses_allowed: continue; } if (stcb) { - if (sctp_is_address_in_scope(sifa, - stcb->asoc.ipv4_addr_legal, - stcb->asoc.ipv6_addr_legal, - stcb->asoc.loopback_scope, - stcb->asoc.ipv4_local_scope, - stcb->asoc.local_scope, - stcb->asoc.site_scope, 0) == 0) { + if (sctp_is_address_in_scope(sifa, &stcb->asoc.scope, 0) == 0) { SCTPDBG(SCTP_DEBUG_OUTPUT2, "NOT in scope\n"); sifa = NULL; continue; @@ -3108,13 +3064,7 @@ plan_d: if (sifa == NULL) continue; if (stcb) { - if (sctp_is_address_in_scope(sifa, - stcb->asoc.ipv4_addr_legal, - stcb->asoc.ipv6_addr_legal, - stcb->asoc.loopback_scope, - stcb->asoc.ipv4_local_scope, - stcb->asoc.local_scope, - stcb->asoc.site_scope, 0) == 0) { + if (sctp_is_address_in_scope(sifa, &stcb->asoc.scope, 0) == 0) { sifa = NULL; continue; } @@ -3135,12 +3085,12 @@ plan_d: } } #ifdef INET - if ((retried == 0) && (stcb->asoc.ipv4_local_scope == 0)) { - stcb->asoc.ipv4_local_scope = 1; + if ((retried == 0) && (stcb->asoc.scope.ipv4_local_scope == 0)) { + stcb->asoc.scope.ipv4_local_scope = 1; retried = 1; goto again_with_private_addresses_allowed; } else if (retried == 1) { - stcb->asoc.ipv4_local_scope = 0; + stcb->asoc.scope.ipv4_local_scope = 0; } #endif out: @@ -3169,12 +3119,7 @@ out: } if (stcb) { if (sctp_is_address_in_scope(tmp_sifa, - stcb->asoc.ipv4_addr_legal, - stcb->asoc.ipv6_addr_legal, - stcb->asoc.loopback_scope, - stcb->asoc.ipv4_local_scope, - stcb->asoc.local_scope, - stcb->asoc.site_scope, 0) == 0) { + &stcb->asoc.scope, 0) == 0) { continue; } if (((non_asoc_addr_ok == 0) && @@ -4600,7 +4545,6 @@ sctp_send_initiate(struct sctp_inpcb *in #endif ) { - struct sctp_scoping scp; struct mbuf *m; struct sctp_nets *net; struct sctp_init_chunk *init; @@ -4680,37 +4624,29 @@ sctp_send_initiate(struct sctp_inpcb *in init->init.num_inbound_streams = htons(stcb->asoc.max_inbound_streams); init->init.initial_tsn = htonl(stcb->asoc.init_seq_number); -#if defined(INET) || defined(INET6) - /* now the address restriction */ - /* XXX Should we take the address family of the socket into account? */ - sup_addr = (struct sctp_supported_addr_param *)(mtod(m, caddr_t)+chunk_len); - sup_addr->ph.param_type = htons(SCTP_SUPPORTED_ADDRTYPE); -#ifdef INET6 -#ifdef INET - /* we support 2 types: IPv4/IPv6 */ - parameter_len = (uint16_t) (sizeof(struct sctp_paramhdr) + 2 * sizeof(uint16_t)); - sup_addr->ph.param_length = htons(parameter_len); - sup_addr->addr_type[0] = htons(SCTP_IPV4_ADDRESS); - sup_addr->addr_type[1] = htons(SCTP_IPV6_ADDRESS); - padding_len = 0; -#else - /* we support 1 type: IPv6 */ - parameter_len = (uint16_t) (sizeof(struct sctp_paramhdr) + sizeof(uint16_t)); - sup_addr->ph.param_length = htons(parameter_len); - sup_addr->addr_type[0] = htons(SCTP_IPV6_ADDRESS); - sup_addr->addr_type[1] = htons(0); /* this is the padding */ - padding_len = (uint16_t) sizeof(uint16_t); -#endif -#else - /* we support 1 type: IPv4 */ - parameter_len = (uint16_t) (sizeof(struct sctp_paramhdr) + sizeof(uint16_t)); - sup_addr->ph.param_length = htons(parameter_len); - sup_addr->addr_type[0] = htons(SCTP_IPV4_ADDRESS); - sup_addr->addr_type[1] = htons(0); /* this is the padding */ - padding_len = (uint16_t) sizeof(uint16_t); -#endif - chunk_len += parameter_len; -#endif + if (stcb->asoc.scope.ipv4_addr_legal || stcb->asoc.scope.ipv6_addr_legal) { + uint8_t i; + + parameter_len = (uint16_t) sizeof(struct sctp_paramhdr); + if (stcb->asoc.scope.ipv4_addr_legal) { + parameter_len += (uint16_t) sizeof(uint16_t); + } + if (stcb->asoc.scope.ipv6_addr_legal) { + parameter_len += (uint16_t) sizeof(uint16_t); + } + sup_addr = (struct sctp_supported_addr_param *)(mtod(m, caddr_t)+chunk_len); + sup_addr->ph.param_type = htons(SCTP_SUPPORTED_ADDRTYPE); + sup_addr->ph.param_length = htons(parameter_len); + i = 0; + if (stcb->asoc.scope.ipv4_addr_legal) { + sup_addr->addr_type[i++] = htons(SCTP_IPV4_ADDRESS); + } + if (stcb->asoc.scope.ipv6_addr_legal) { + sup_addr->addr_type[i++] = htons(SCTP_IPV6_ADDRESS); + } + padding_len = 4 - 2 * i; + chunk_len += parameter_len; + } /* Adaptation layer indication parameter */ /* XXX: Should we include this always? */ if (padding_len > 0) { @@ -4865,13 +4801,7 @@ sctp_send_initiate(struct sctp_inpcb *in * we could just sifa in the address within the stcb. But for now * this is a quick hack to get the address stuff teased apart. */ - scp.ipv4_addr_legal = stcb->asoc.ipv4_addr_legal; - scp.ipv6_addr_legal = stcb->asoc.ipv6_addr_legal; - scp.loopback_scope = stcb->asoc.loopback_scope; - scp.ipv4_local_scope = stcb->asoc.ipv4_local_scope; - scp.local_scope = stcb->asoc.local_scope; - scp.site_scope = stcb->asoc.site_scope; - sctp_add_addresses_to_i_ia(inp, stcb, &scp, m, cnt_inits_to, &padding_len, &chunk_len); + sctp_add_addresses_to_i_ia(inp, stcb, &stcb->asoc.scope, m, cnt_inits_to, &padding_len, &chunk_len); init->ch.chunk_length = htons(chunk_len); if (padding_len > 0) { @@ -5512,24 +5442,16 @@ do_a_abort: */ stc.site_scope = stc.local_scope = stc.loopback_scope = 0; if (inp->sctp_flags & SCTP_PCB_FLAGS_BOUND_V6) { - struct inpcb *in_inp; - - /* Its a V6 socket */ - in_inp = (struct inpcb *)inp; stc.ipv6_addr_legal = 1; - /* Now look at the binding flag to see if V4 will be legal */ - if (SCTP_IPV6_V6ONLY(in_inp) == 0) { - stc.ipv4_addr_legal = 1; - } else { - /* V4 addresses are NOT legal on the association */ + if (SCTP_IPV6_V6ONLY(inp)) { stc.ipv4_addr_legal = 0; + } else { + stc.ipv4_addr_legal = 1; } } else { - /* Its a V4 socket, no - V6 */ - stc.ipv4_addr_legal = 1; stc.ipv6_addr_legal = 0; + stc.ipv4_addr_legal = 1; } - #ifdef SCTP_DONT_DO_PRIVADDR_SCOPE stc.ipv4_scope = 1; #else @@ -5634,10 +5556,10 @@ do_a_abort: #endif - stc.loopback_scope = asoc->loopback_scope; - stc.ipv4_scope = asoc->ipv4_local_scope; - stc.site_scope = asoc->site_scope; - stc.local_scope = asoc->local_scope; + stc.loopback_scope = asoc->scope.loopback_scope; + stc.ipv4_scope = asoc->scope.ipv4_local_scope; + stc.site_scope = asoc->scope.site_scope; + stc.local_scope = asoc->scope.local_scope; #ifdef INET6 /* Why do we not consider IPv4 LL addresses? */ TAILQ_FOREACH(lnet, &asoc->nets, sctp_next) { Modified: stable/8/sys/netinet/sctp_output.h ============================================================================== --- stable/8/sys/netinet/sctp_output.h Fri Mar 8 01:21:48 2013 (r248018) +++ stable/8/sys/netinet/sctp_output.h Fri Mar 8 01:24:00 2013 (r248019) @@ -55,13 +55,9 @@ int sctp_is_addr_restricted(struct sctp_ int sctp_is_address_in_scope(struct sctp_ifa *ifa, - int ipv4_addr_legal, - int ipv6_addr_legal, - int loopback_scope, - int ipv4_local_scope, - int local_scope, - int site_scope, + struct sctp_scoping *scope, int do_update); + int sctp_is_addr_in_ep(struct sctp_inpcb *inp, struct sctp_ifa *ifa); Modified: stable/8/sys/netinet/sctp_pcb.c ============================================================================== --- stable/8/sys/netinet/sctp_pcb.c Fri Mar 8 01:21:48 2013 (r248018) +++ stable/8/sys/netinet/sctp_pcb.c Fri Mar 8 01:24:00 2013 (r248019) @@ -94,11 +94,10 @@ sctp_fill_pcbinfo(struct sctp_pcbinfo *s spcb->readq_count = SCTP_BASE_INFO(ipi_count_readq); spcb->stream_oque = SCTP_BASE_INFO(ipi_count_strmoq); spcb->free_chunks = SCTP_BASE_INFO(ipi_free_chunks); - SCTP_INP_INFO_RUNLOCK(); } -/* +/*- * Addresses are added to VRF's (Virtual Router's). For BSD we * have only the default VRF 0. We maintain a hash list of * VRF's. Each VRF has its own list of sctp_ifn's. Each of @@ -214,7 +213,6 @@ sctp_find_ifn(void *ifn, uint32_t ifn_in } - struct sctp_vrf * sctp_find_vrf(uint32_t vrf_id) { @@ -230,6 +228,7 @@ sctp_find_vrf(uint32_t vrf_id) return (NULL); } + void sctp_free_vrf(struct sctp_vrf *vrf) { @@ -245,6 +244,7 @@ sctp_free_vrf(struct sctp_vrf *vrf) } } + void sctp_free_ifn(struct sctp_ifn *sctp_ifnp) { @@ -258,6 +258,7 @@ sctp_free_ifn(struct sctp_ifn *sctp_ifnp } } + void sctp_update_ifn_mtu(uint32_t ifn_index, uint32_t mtu) { @@ -283,6 +284,7 @@ sctp_free_ifa(struct sctp_ifa *sctp_ifap } } + static void sctp_delete_ifn(struct sctp_ifn *sctp_ifnp, int hold_addr_lock) { @@ -305,12 +307,13 @@ sctp_delete_ifn(struct sctp_ifn *sctp_if sctp_free_ifn(sctp_ifnp); } + void sctp_mark_ifa_addr_down(uint32_t vrf_id, struct sockaddr *addr, const char *if_name, uint32_t ifn_index) { struct sctp_vrf *vrf; - struct sctp_ifa *sctp_ifap = NULL; + struct sctp_ifa *sctp_ifap; SCTP_IPI_ADDR_RLOCK(); vrf = sctp_find_vrf(vrf_id); @@ -348,12 +351,13 @@ out: SCTP_IPI_ADDR_RUNLOCK(); } + void sctp_mark_ifa_addr_up(uint32_t vrf_id, struct sockaddr *addr, const char *if_name, uint32_t ifn_index) { struct sctp_vrf *vrf; - struct sctp_ifa *sctp_ifap = NULL; + struct sctp_ifa *sctp_ifap; SCTP_IPI_ADDR_RLOCK(); vrf = sctp_find_vrf(vrf_id); @@ -391,6 +395,7 @@ out: SCTP_IPI_ADDR_RUNLOCK(); } + /*- * Add an ifa to an ifn. * Register the interface as necessary. @@ -428,6 +433,7 @@ sctp_add_ifa_to_ifn(struct sctp_ifn *sct } } + /*- * Remove an ifa from its ifn. * If no more addresses exist, remove the ifn too. Otherwise, re-register @@ -479,6 +485,7 @@ sctp_remove_ifa_from_ifn(struct sctp_ifa } } + struct sctp_ifa * sctp_add_addr_to_vrf(uint32_t vrf_id, void *ifn, uint32_t ifn_index, uint32_t ifn_type, const char *if_name, void *ifa, @@ -1027,6 +1034,7 @@ sctp_tcb_special_locate(struct sctp_inpc return (NULL); } + static int sctp_does_stcb_own_this_addr(struct sctp_tcb *stcb, struct sockaddr *to) { @@ -1036,19 +1044,12 @@ sctp_does_stcb_own_this_addr(struct sctp struct sctp_ifn *sctp_ifn; struct sctp_ifa *sctp_ifa; - loopback_scope = stcb->asoc.loopback_scope; - ipv4_local_scope = stcb->asoc.ipv4_local_scope; - local_scope = stcb->asoc.local_scope; - site_scope = stcb->asoc.site_scope; - ipv4_addr_legal = ipv6_addr_legal = 0; - if (stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_BOUND_V6) { - ipv6_addr_legal = 1; - if (SCTP_IPV6_V6ONLY(stcb->sctp_ep) == 0) { - ipv4_addr_legal = 1; - } - } else { - ipv4_addr_legal = 1; - } + loopback_scope = stcb->asoc.scope.loopback_scope; + ipv4_local_scope = stcb->asoc.scope.ipv4_local_scope; + local_scope = stcb->asoc.scope.local_scope; + site_scope = stcb->asoc.scope.site_scope; + ipv4_addr_legal = stcb->asoc.scope.ipv4_addr_legal; + ipv6_addr_legal = stcb->asoc.scope.ipv6_addr_legal; SCTP_IPI_ADDR_RLOCK(); vrf = sctp_find_vrf(stcb->asoc.vrf_id); @@ -1183,6 +1184,7 @@ sctp_does_stcb_own_this_addr(struct sctp return (0); } + /* * rules for use * @@ -1471,11 +1473,11 @@ null_return: return (NULL); } + /* * Find an association for a specific endpoint using the association id given * out in the COMM_UP notification */ - struct sctp_tcb * sctp_findasoc_ep_asocid_locked(struct sctp_inpcb *inp, sctp_assoc_t asoc_id, int want_lock) { @@ -1536,6 +1538,9 @@ sctp_findassociation_ep_asocid(struct sc } +/* + * Endpoint probe expects that the INP_INFO is locked. + */ static struct sctp_inpcb * sctp_endpoint_probe(struct sockaddr *nam, struct sctppcbhead *head, uint16_t lport, uint32_t vrf_id) @@ -1552,12 +1557,8 @@ sctp_endpoint_probe(struct sockaddr *nam struct sockaddr_in6 *intf_addr6; #endif - int fnd; - /* - * Endpoint probe expects that the INP_INFO is locked. - */ #ifdef INET sin = NULL; #endif @@ -1893,6 +1894,7 @@ sctp_pcb_findep(struct sockaddr *nam, in return (inp); } + /* * Find an association for an endpoint with the pointer to whom you want to * send to and the endpoint pointer. The address can be IPv4 or IPv6. We may @@ -2144,6 +2146,7 @@ sctp_findassoc_by_vtag(struct sockaddr * return (NULL); } + /* * Find an association with the pointer to the inbound IP packet. This can be * a IPv4 or IPv6 packet. @@ -3743,13 +3746,13 @@ sctp_add_remote_addr(struct sctp_tcb *st stcb->ipv4_local_scope = 1; #else if (IN4_ISPRIVATE_ADDRESS(&sin->sin_addr)) { - stcb->asoc.ipv4_local_scope = 1; + stcb->asoc.scope.ipv4_local_scope = 1; } #endif /* SCTP_DONT_DO_PRIVADDR_SCOPE */ } else { /* Validate the address is in scope */ if ((IN4_ISPRIVATE_ADDRESS(&sin->sin_addr)) && - (stcb->asoc.ipv4_local_scope == 0)) { + (stcb->asoc.scope.ipv4_local_scope == 0)) { addr_inscope = 0; } } @@ -3770,10 +3773,10 @@ sctp_add_remote_addr(struct sctp_tcb *st sin6->sin6_len = sizeof(struct sockaddr_in6); if (set_scope) { if (sctp_is_address_on_local_host(newaddr, stcb->asoc.vrf_id)) { - stcb->asoc.loopback_scope = 1; - stcb->asoc.local_scope = 0; - stcb->asoc.ipv4_local_scope = 1; - stcb->asoc.site_scope = 1; + stcb->asoc.scope.loopback_scope = 1; + stcb->asoc.scope.local_scope = 0; + stcb->asoc.scope.ipv4_local_scope = 1; + stcb->asoc.scope.site_scope = 1; } else if (IN6_IS_ADDR_LINKLOCAL(&sin6->sin6_addr)) { /* * If the new destination is a @@ -3785,26 +3788,26 @@ sctp_add_remote_addr(struct sctp_tcb *st * also be on our private network * for v4 too. */ - stcb->asoc.ipv4_local_scope = 1; - stcb->asoc.site_scope = 1; + stcb->asoc.scope.ipv4_local_scope = 1; + stcb->asoc.scope.site_scope = 1; } else if (IN6_IS_ADDR_SITELOCAL(&sin6->sin6_addr)) { /* * If the new destination is * SITE_LOCAL then we must have site * scope in common. */ - stcb->asoc.site_scope = 1; + stcb->asoc.scope.site_scope = 1; } } else { /* Validate the address is in scope */ if (IN6_IS_ADDR_LOOPBACK(&sin6->sin6_addr) && - (stcb->asoc.loopback_scope == 0)) { + (stcb->asoc.scope.loopback_scope == 0)) { addr_inscope = 0; } else if (IN6_IS_ADDR_LINKLOCAL(&sin6->sin6_addr) && - (stcb->asoc.local_scope == 0)) { + (stcb->asoc.scope.local_scope == 0)) { addr_inscope = 0; } else if (IN6_IS_ADDR_SITELOCAL(&sin6->sin6_addr) && - (stcb->asoc.site_scope == 0)) { + (stcb->asoc.scope.site_scope == 0)) { addr_inscope = 0; } } @@ -3839,10 +3842,10 @@ sctp_add_remote_addr(struct sctp_tcb *st } net->addr_is_local = sctp_is_address_on_local_host(newaddr, stcb->asoc.vrf_id); if (net->addr_is_local && ((set_scope || (from == SCTP_ADDR_IS_CONFIRMED)))) { - stcb->asoc.loopback_scope = 1; - stcb->asoc.ipv4_local_scope = 1; - stcb->asoc.local_scope = 0; - stcb->asoc.site_scope = 1; + stcb->asoc.scope.loopback_scope = 1; + stcb->asoc.scope.ipv4_local_scope = 1; + stcb->asoc.scope.local_scope = 0; + stcb->asoc.scope.site_scope = 1; addr_inscope = 1; } net->failure_threshold = stcb->asoc.def_net_failure; @@ -6071,7 +6074,7 @@ sctp_load_addresses_from_init(struct sct switch (sa->sa_family) { #ifdef INET case AF_INET: - if (stcb->asoc.ipv4_addr_legal) { + if (stcb->asoc.scope.ipv4_addr_legal) { if (sctp_add_remote_addr(stcb, sa, NULL, SCTP_DONOT_SETSCOPE, SCTP_LOAD_ADDR_2)) { return (-1); } @@ -6080,7 +6083,7 @@ sctp_load_addresses_from_init(struct sct #endif #ifdef INET6 case AF_INET6: - if (stcb->asoc.ipv6_addr_legal) { + if (stcb->asoc.scope.ipv6_addr_legal) { if (sctp_add_remote_addr(stcb, sa, NULL, SCTP_DONOT_SETSCOPE, SCTP_LOAD_ADDR_3)) { return (-2); } @@ -6127,7 +6130,7 @@ sctp_load_addresses_from_init(struct sct } #ifdef INET if (ptype == SCTP_IPV4_ADDRESS) { - if (stcb->asoc.ipv4_addr_legal) { + if (stcb->asoc.scope.ipv4_addr_legal) { struct sctp_ipv4addr_param *p4, p4_buf; /* ok get the v4 address and check/add */ @@ -6213,7 +6216,7 @@ sctp_load_addresses_from_init(struct sct #endif #ifdef INET6 if (ptype == SCTP_IPV6_ADDRESS) { - if (stcb->asoc.ipv6_addr_legal) { + if (stcb->asoc.scope.ipv6_addr_legal) { /* ok get the v6 address and check/add */ struct sctp_ipv6addr_param *p6, p6_buf; Modified: stable/8/sys/netinet/sctp_structs.h ============================================================================== --- stable/8/sys/netinet/sctp_structs.h Fri Mar 8 01:21:48 2013 (r248018) +++ stable/8/sys/netinet/sctp_structs.h Fri Mar 8 01:24:00 2013 (r248019) @@ -1175,17 +1175,7 @@ struct sctp_association { */ uint8_t peer_supports_pktdrop; - /* Do we allow V6/V4? */ - uint8_t ipv4_addr_legal; - uint8_t ipv6_addr_legal; - /* Address scoping flags */ - /* scope value for IPv4 */ - uint8_t ipv4_local_scope; - /* scope values for IPv6 */ - uint8_t local_scope; - uint8_t site_scope; - /* loopback scope */ - uint8_t loopback_scope; + struct sctp_scoping scope; /* flags to handle send alternate net tracking */ uint8_t used_alt_onsack; uint8_t used_alt_asconfack; Modified: stable/8/sys/netinet/sctp_sysctl.c ============================================================================== --- stable/8/sys/netinet/sctp_sysctl.c Fri Mar 8 01:21:48 2013 (r248018) +++ stable/8/sys/netinet/sctp_sysctl.c Fri Mar 8 01:24:00 2013 (r248019) @@ -197,29 +197,29 @@ copy_out_local_addresses(struct sctp_inp /* Turn on all the appropriate scope */ if (stcb) { /* use association specific values */ - loopback_scope = stcb->asoc.loopback_scope; - ipv4_local_scope = stcb->asoc.ipv4_local_scope; - local_scope = stcb->asoc.local_scope; - site_scope = stcb->asoc.site_scope; + loopback_scope = stcb->asoc.scope.loopback_scope; + ipv4_local_scope = stcb->asoc.scope.ipv4_local_scope; + local_scope = stcb->asoc.scope.local_scope; + site_scope = stcb->asoc.scope.site_scope; + ipv4_addr_legal = stcb->asoc.scope.ipv4_addr_legal; + ipv6_addr_legal = stcb->asoc.scope.ipv6_addr_legal; } else { - /* use generic values for endpoints */ + /* Use generic values for endpoints. */ loopback_scope = 1; ipv4_local_scope = 1; local_scope = 1; site_scope = 1; - } - - /* use only address families of interest */ - if (inp->sctp_flags & SCTP_PCB_FLAGS_BOUND_V6) { - ipv6_addr_legal = 1; - if (SCTP_IPV6_V6ONLY(inp)) { - ipv4_addr_legal = 0; + if (inp->sctp_flags & SCTP_PCB_FLAGS_BOUND_V6) { + ipv6_addr_legal = 1; + if (SCTP_IPV6_V6ONLY(inp)) { + ipv4_addr_legal = 0; + } else { + ipv4_addr_legal = 1; + } } else { + ipv6_addr_legal = 0; ipv4_addr_legal = 1; } - } else { - ipv4_addr_legal = 1; - ipv6_addr_legal = 0; } /* neither Mac OS X nor FreeBSD support mulitple routing functions */ Modified: stable/8/sys/netinet/sctp_usrreq.c ============================================================================== --- stable/8/sys/netinet/sctp_usrreq.c Fri Mar 8 01:21:48 2013 (r248018) +++ stable/8/sys/netinet/sctp_usrreq.c Fri Mar 8 01:24:00 2013 (r248019) @@ -1143,23 +1143,29 @@ sctp_fill_up_addresses_vrf(struct sctp_i if (stcb) { /* Turn on all the appropriate scope */ - loopback_scope = stcb->asoc.loopback_scope; - ipv4_local_scope = stcb->asoc.ipv4_local_scope; - local_scope = stcb->asoc.local_scope; - site_scope = stcb->asoc.site_scope; + loopback_scope = stcb->asoc.scope.loopback_scope; + ipv4_local_scope = stcb->asoc.scope.ipv4_local_scope; + local_scope = stcb->asoc.scope.local_scope; + site_scope = stcb->asoc.scope.site_scope; + ipv4_addr_legal = stcb->asoc.scope.ipv4_addr_legal; + ipv6_addr_legal = stcb->asoc.scope.ipv6_addr_legal; } else { - /* Turn on ALL scope, since we look at the EP */ - loopback_scope = ipv4_local_scope = local_scope = - site_scope = 1; - } - ipv4_addr_legal = ipv6_addr_legal = 0; - if (inp->sctp_flags & SCTP_PCB_FLAGS_BOUND_V6) { - ipv6_addr_legal = 1; - if (SCTP_IPV6_V6ONLY(inp) == 0) { + /* Use generic values for endpoints. */ + loopback_scope = 1; + ipv4_local_scope = 1; + local_scope = 1; + site_scope = 1; + if (inp->sctp_flags & SCTP_PCB_FLAGS_BOUND_V6) { + ipv6_addr_legal = 1; + if (SCTP_IPV6_V6ONLY(inp)) { + ipv4_addr_legal = 0; + } else { + ipv4_addr_legal = 1; + } + } else { + ipv6_addr_legal = 0; ipv4_addr_legal = 1; } - } else { - ipv4_addr_legal = 1; } vrf = sctp_find_vrf(vrf_id); if (vrf == NULL) { @@ -1298,8 +1304,21 @@ sctp_fill_up_addresses_vrf(struct sctp_i } if (sctp_fill_user_address(sas, &laddr->ifa->address.sa)) continue; - - ((struct sockaddr_in6 *)sas)->sin6_port = inp->sctp_lport; + switch (laddr->ifa->address.sa.sa_family) { +#ifdef INET + case AF_INET: + ((struct sockaddr_in *)sas)->sin_port = inp->sctp_lport; + break; +#endif +#ifdef INET6 + case AF_INET6: + ((struct sockaddr_in6 *)sas)->sin6_port = inp->sctp_lport; + break; +#endif + default: + /* TSNH */ + break; + } sas = (struct sockaddr_storage *)((caddr_t)sas + laddr->ifa->address.sa.sa_len); actual += laddr->ifa->address.sa.sa_len; @@ -5916,7 +5935,7 @@ sctp_connect(struct socket *so, struct s error = EINVAL; goto out_now; } -#endif /* INET6 */ +#endif if ((inp->sctp_flags & SCTP_PCB_FLAGS_UNBOUND) == SCTP_PCB_FLAGS_UNBOUND) { /* Bind a ephemeral port */ @@ -6210,8 +6229,8 @@ sctp_accept(struct socket *so, struct so return (ENOMEM); sin->sin_family = AF_INET; sin->sin_len = sizeof(*sin); - sin->sin_port = ((struct sockaddr_in *)&store)->sin_port; - sin->sin_addr = ((struct sockaddr_in *)&store)->sin_addr; + sin->sin_port = store.sin.sin_port; + sin->sin_addr = store.sin.sin_addr; *addr = (struct sockaddr *)sin; break; } @@ -6226,9 +6245,8 @@ sctp_accept(struct socket *so, struct so return (ENOMEM); sin6->sin6_family = AF_INET6; sin6->sin6_len = sizeof(*sin6); - sin6->sin6_port = ((struct sockaddr_in6 *)&store)->sin6_port; - - sin6->sin6_addr = ((struct sockaddr_in6 *)&store)->sin6_addr; + sin6->sin6_port = store.sin6.sin6_port; + sin6->sin6_addr = store.sin6.sin6_addr; if ((error = sa6_recoverscope(sin6)) != 0) { SCTP_FREE_SONAME(sin6); return (error); Modified: stable/8/sys/netinet/sctputil.c ============================================================================== --- stable/8/sys/netinet/sctputil.c Fri Mar 8 01:21:48 2013 (r248018) +++ stable/8/sys/netinet/sctputil.c Fri Mar 8 01:24:00 2013 (r248019) @@ -878,7 +878,7 @@ sctp_select_a_tag(struct sctp_inpcb *inp } int -sctp_init_asoc(struct sctp_inpcb *m, struct sctp_tcb *stcb, +sctp_init_asoc(struct sctp_inpcb *inp, struct sctp_tcb *stcb, uint32_t override_tag, uint32_t vrf_id) { struct sctp_association *asoc; @@ -899,23 +899,23 @@ sctp_init_asoc(struct sctp_inpcb *m, str asoc = &stcb->asoc; /* init all variables to a known value. */ *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable@FreeBSD.ORG Fri Mar 8 01:25:13 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id E29BC7DC; Fri, 8 Mar 2013 01:25:13 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id B23F1F31; Fri, 8 Mar 2013 01:25:13 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r281PDCS091816; Fri, 8 Mar 2013 01:25:13 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r281PDTB091815; Fri, 8 Mar 2013 01:25:13 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201303080125.r281PDTB091815@svn.freebsd.org> From: Michael Tuexen Date: Fri, 8 Mar 2013 01:25:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r248020 - stable/8/lib/libc/net X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Mar 2013 01:25:14 -0000 Author: tuexen Date: Fri Mar 8 01:25:13 2013 New Revision: 248020 URL: http://svnweb.freebsd.org/changeset/base/248020 Log: MFC r246629: Improve code style. No functional change. Modified: stable/8/lib/libc/net/sctp_sys_calls.c Directory Properties: stable/8/lib/ (props changed) stable/8/lib/libc/ (props changed) Modified: stable/8/lib/libc/net/sctp_sys_calls.c ============================================================================== --- stable/8/lib/libc/net/sctp_sys_calls.c Fri Mar 8 01:24:00 2013 (r248019) +++ stable/8/lib/libc/net/sctp_sys_calls.c Fri Mar 8 01:25:13 2013 (r248020) @@ -580,36 +580,36 @@ sctp_sendmsg(int s, if ((tolen > 0) && ((to == NULL) || (tolen < sizeof(struct sockaddr)))) { errno = EINVAL; - return -1; + return (-1); } if (to && (tolen > 0)) { if (to->sa_family == AF_INET) { if (tolen != sizeof(struct sockaddr_in)) { errno = EINVAL; - return -1; + return (-1); } if ((to->sa_len > 0) && (to->sa_len != sizeof(struct sockaddr_in))) { errno = EINVAL; - return -1; + return (-1); } memcpy(&addr, to, sizeof(struct sockaddr_in)); addr.in.sin_len = sizeof(struct sockaddr_in); } else if (to->sa_family == AF_INET6) { if (tolen != sizeof(struct sockaddr_in6)) { errno = EINVAL; - return -1; + return (-1); } if ((to->sa_len > 0) && (to->sa_len != sizeof(struct sockaddr_in6))) { errno = EINVAL; - return -1; + return (-1); } memcpy(&addr, to, sizeof(struct sockaddr_in6)); addr.in6.sin6_len = sizeof(struct sockaddr_in6); } else { errno = EAFNOSUPPORT; - return -1; + return (-1); } who = (struct sockaddr *)&addr; } @@ -833,7 +833,7 @@ sctp_sendmsgx(int sd, sinfo.sinfo_ssn = stream_no; sinfo.sinfo_timetolive = timetolive; sinfo.sinfo_context = context; - return sctp_sendx(sd, msg, len, addrs, addrcnt, &sinfo, 0); + return (sctp_sendx(sd, msg, len, addrs, addrcnt, &sinfo, 0)); } ssize_t From owner-svn-src-stable@FreeBSD.ORG Fri Mar 8 01:27:19 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 5D58295B; Fri, 8 Mar 2013 01:27:19 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 35665F44; Fri, 8 Mar 2013 01:27:19 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r281RJRE092139; Fri, 8 Mar 2013 01:27:19 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r281RJ2q092138; Fri, 8 Mar 2013 01:27:19 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201303080127.r281RJ2q092138@svn.freebsd.org> From: Michael Tuexen Date: Fri, 8 Mar 2013 01:27:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r248021 - stable/8/sys/netinet X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Mar 2013 01:27:19 -0000 Author: tuexen Date: Fri Mar 8 01:27:18 2013 New Revision: 248021 URL: http://svnweb.freebsd.org/changeset/base/248021 Log: MFC r246635: Make sure that received packets for removed addresses are handled consistently. While there, make variable names consistent. Modified: stable/8/sys/netinet/sctp_pcb.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/netinet/ (props changed) Modified: stable/8/sys/netinet/sctp_pcb.c ============================================================================== --- stable/8/sys/netinet/sctp_pcb.c Fri Mar 8 01:25:13 2013 (r248020) +++ stable/8/sys/netinet/sctp_pcb.c Fri Mar 8 01:27:18 2013 (r248021) @@ -824,6 +824,160 @@ out_now: } +static int +sctp_does_stcb_own_this_addr(struct sctp_tcb *stcb, struct sockaddr *to) +{ + int loopback_scope, ipv4_local_scope, local_scope, site_scope; + int ipv4_addr_legal, ipv6_addr_legal; + struct sctp_vrf *vrf; + struct sctp_ifn *sctp_ifn; + struct sctp_ifa *sctp_ifa; + + loopback_scope = stcb->asoc.scope.loopback_scope; + ipv4_local_scope = stcb->asoc.scope.ipv4_local_scope; + local_scope = stcb->asoc.scope.local_scope; + site_scope = stcb->asoc.scope.site_scope; + ipv4_addr_legal = stcb->asoc.scope.ipv4_addr_legal; + ipv6_addr_legal = stcb->asoc.scope.ipv6_addr_legal; + + SCTP_IPI_ADDR_RLOCK(); + vrf = sctp_find_vrf(stcb->asoc.vrf_id); + if (vrf == NULL) { + /* no vrf, no addresses */ + SCTP_IPI_ADDR_RUNLOCK(); + return (0); + } + if (stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_BOUNDALL) { + LIST_FOREACH(sctp_ifn, &vrf->ifnlist, next_ifn) { + if ((loopback_scope == 0) && + SCTP_IFN_IS_IFT_LOOP(sctp_ifn)) { + continue; + } + LIST_FOREACH(sctp_ifa, &sctp_ifn->ifalist, next_ifa) { + if (sctp_is_addr_restricted(stcb, sctp_ifa) && + (!sctp_is_addr_pending(stcb, sctp_ifa))) { + /* + * We allow pending addresses, where + * we have sent an asconf-add to be + * considered valid. + */ + continue; + } + switch (sctp_ifa->address.sa.sa_family) { +#ifdef INET + case AF_INET: + if (ipv4_addr_legal) { + struct sockaddr_in *sin, + *rsin; + + sin = &sctp_ifa->address.sin; + rsin = (struct sockaddr_in *)to; + if ((ipv4_local_scope == 0) && + IN4_ISPRIVATE_ADDRESS(&sin->sin_addr)) { + continue; + } + if (sin->sin_addr.s_addr == rsin->sin_addr.s_addr) { + SCTP_IPI_ADDR_RUNLOCK(); + return (1); + } + } + break; +#endif +#ifdef INET6 + case AF_INET6: + if (ipv6_addr_legal) { + struct sockaddr_in6 *sin6, + *rsin6; + + sin6 = &sctp_ifa->address.sin6; + rsin6 = (struct sockaddr_in6 *)to; + if (IN6_IS_ADDR_LINKLOCAL(&sin6->sin6_addr)) { + if (local_scope == 0) + continue; + if (sin6->sin6_scope_id == 0) { + if (sa6_recoverscope(sin6) != 0) + continue; + } + } + if ((site_scope == 0) && + (IN6_IS_ADDR_SITELOCAL(&sin6->sin6_addr))) { + continue; + } + if (SCTP6_ARE_ADDR_EQUAL(sin6, rsin6)) { + SCTP_IPI_ADDR_RUNLOCK(); + return (1); + } + } + break; +#endif + default: + /* TSNH */ + break; + } + } + } + } else { + struct sctp_laddr *laddr; + + LIST_FOREACH(laddr, &stcb->sctp_ep->sctp_addr_list, sctp_nxt_addr) { + if (laddr->ifa->localifa_flags & SCTP_BEING_DELETED) { + SCTPDBG(SCTP_DEBUG_PCB1, "ifa being deleted\n"); + continue; + } + if (sctp_is_addr_restricted(stcb, laddr->ifa) && + (!sctp_is_addr_pending(stcb, laddr->ifa))) { + /* + * We allow pending addresses, where we have + * sent an asconf-add to be considered + * valid. + */ + continue; + } + if (laddr->ifa->address.sa.sa_family != to->sa_family) { + continue; + } + switch (to->sa_family) { +#ifdef INET + case AF_INET: + { + struct sockaddr_in *sin, *rsin; + + sin = (struct sockaddr_in *)&laddr->ifa->address.sin; + rsin = (struct sockaddr_in *)to; + if (sin->sin_addr.s_addr == rsin->sin_addr.s_addr) { + SCTP_IPI_ADDR_RUNLOCK(); + return (1); + } + break; + } +#endif +#ifdef INET6 + case AF_INET6: + { + struct sockaddr_in6 *sin6, *rsin6; + + sin6 = (struct sockaddr_in6 *)&laddr->ifa->address.sin6; + rsin6 = (struct sockaddr_in6 *)to; + if (SCTP6_ARE_ADDR_EQUAL(sin6, rsin6)) { + SCTP_IPI_ADDR_RUNLOCK(); + return (1); + } + break; + } + +#endif + default: + /* TSNH */ + break; + } + + } + } + SCTP_IPI_ADDR_RUNLOCK(); + return (0); +} + + static struct sctp_tcb * sctp_tcb_special_locate(struct sctp_inpcb **inp_p, struct sockaddr *from, struct sockaddr *to, struct sctp_nets **netp, uint32_t vrf_id) @@ -906,7 +1060,6 @@ sctp_tcb_special_locate(struct sctp_inpc if (laddr->ifa->address.sa.sa_family == to->sa_family) { /* see if it matches */ - #ifdef INET if (from->sa_family == AF_INET) { struct sockaddr_in *intf_addr, @@ -949,13 +1102,18 @@ sctp_tcb_special_locate(struct sctp_inpc * Ok if we hit here the ep has the address, does it hold * the tcb? */ - + /* XXX: Why don't we TAILQ_FOREACH through sctp_asoc_list? */ stcb = LIST_FIRST(&inp->sctp_asoc_list); if (stcb == NULL) { SCTP_INP_RUNLOCK(inp); continue; } SCTP_TCB_LOCK(stcb); + if (!sctp_does_stcb_own_this_addr(stcb, to)) { + SCTP_TCB_UNLOCK(stcb); + SCTP_INP_RUNLOCK(inp); + continue; + } if (stcb->rport != rport) { /* remote port does not match. */ SCTP_TCB_UNLOCK(stcb); @@ -967,6 +1125,11 @@ sctp_tcb_special_locate(struct sctp_inpc SCTP_INP_RUNLOCK(inp); continue; } + if (!sctp_does_stcb_own_this_addr(stcb, to)) { + SCTP_TCB_UNLOCK(stcb); + SCTP_INP_RUNLOCK(inp); + continue; + } /* Does this TCB have a matching address? */ TAILQ_FOREACH(net, &stcb->asoc.nets, sctp_next) { @@ -1035,156 +1198,6 @@ sctp_tcb_special_locate(struct sctp_inpc } -static int -sctp_does_stcb_own_this_addr(struct sctp_tcb *stcb, struct sockaddr *to) -{ - int loopback_scope, ipv4_local_scope, local_scope, site_scope; - int ipv4_addr_legal, ipv6_addr_legal; - struct sctp_vrf *vrf; - struct sctp_ifn *sctp_ifn; - struct sctp_ifa *sctp_ifa; - - loopback_scope = stcb->asoc.scope.loopback_scope; - ipv4_local_scope = stcb->asoc.scope.ipv4_local_scope; - local_scope = stcb->asoc.scope.local_scope; - site_scope = stcb->asoc.scope.site_scope; - ipv4_addr_legal = stcb->asoc.scope.ipv4_addr_legal; - ipv6_addr_legal = stcb->asoc.scope.ipv6_addr_legal; - - SCTP_IPI_ADDR_RLOCK(); - vrf = sctp_find_vrf(stcb->asoc.vrf_id); - if (vrf == NULL) { - /* no vrf, no addresses */ - SCTP_IPI_ADDR_RUNLOCK(); - return (0); - } - if (stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_BOUNDALL) { - LIST_FOREACH(sctp_ifn, &vrf->ifnlist, next_ifn) { - if ((loopback_scope == 0) && - SCTP_IFN_IS_IFT_LOOP(sctp_ifn)) { - continue; - } - LIST_FOREACH(sctp_ifa, &sctp_ifn->ifalist, next_ifa) { - if (sctp_is_addr_restricted(stcb, sctp_ifa) && - (!sctp_is_addr_pending(stcb, sctp_ifa))) { - /* - * We allow pending addresses, where - * we have sent an asconf-add to be - * considered valid. - */ - continue; - } - switch (sctp_ifa->address.sa.sa_family) { -#ifdef INET - case AF_INET: - if (ipv4_addr_legal) { - struct sockaddr_in *sin, - *rsin; - - sin = &sctp_ifa->address.sin; - rsin = (struct sockaddr_in *)to; - if ((ipv4_local_scope == 0) && - IN4_ISPRIVATE_ADDRESS(&sin->sin_addr)) { - continue; - } - if (sin->sin_addr.s_addr == rsin->sin_addr.s_addr) { - SCTP_IPI_ADDR_RUNLOCK(); - return (1); - } - } - break; -#endif -#ifdef INET6 - case AF_INET6: - if (ipv6_addr_legal) { - struct sockaddr_in6 *sin6, - *rsin6; - - sin6 = &sctp_ifa->address.sin6; - rsin6 = (struct sockaddr_in6 *)to; - if (IN6_IS_ADDR_LINKLOCAL(&sin6->sin6_addr)) { - if (local_scope == 0) - continue; - if (sin6->sin6_scope_id == 0) { - if (sa6_recoverscope(sin6) != 0) - continue; - } - } - if ((site_scope == 0) && - (IN6_IS_ADDR_SITELOCAL(&sin6->sin6_addr))) { - continue; - } - if (SCTP6_ARE_ADDR_EQUAL(sin6, rsin6)) { - SCTP_IPI_ADDR_RUNLOCK(); - return (1); - } - } - break; -#endif - default: - /* TSNH */ - break; - } - } - } - } else { - struct sctp_laddr *laddr; - - LIST_FOREACH(laddr, &stcb->sctp_ep->sctp_addr_list, sctp_nxt_addr) { - if (sctp_is_addr_restricted(stcb, laddr->ifa) && - (!sctp_is_addr_pending(stcb, laddr->ifa))) { - /* - * We allow pending addresses, where we have - * sent an asconf-add to be considered - * valid. - */ - continue; - } - if (laddr->ifa->address.sa.sa_family != to->sa_family) { - continue; - } - switch (to->sa_family) { -#ifdef INET - case AF_INET: - { - struct sockaddr_in *sin, *rsin; - - sin = (struct sockaddr_in *)&laddr->ifa->address.sin; - rsin = (struct sockaddr_in *)to; - if (sin->sin_addr.s_addr == rsin->sin_addr.s_addr) { - SCTP_IPI_ADDR_RUNLOCK(); - return (1); - } - break; - } -#endif -#ifdef INET6 - case AF_INET6: - { - struct sockaddr_in6 *sin6, *rsin6; - - sin6 = (struct sockaddr_in6 *)&laddr->ifa->address.sin6; - rsin6 = (struct sockaddr_in6 *)to; - if (SCTP6_ARE_ADDR_EQUAL(sin6, rsin6)) { - SCTP_IPI_ADDR_RUNLOCK(); - return (1); - } - break; - } - -#endif - default: - /* TSNH */ - break; - } - - } - } - SCTP_IPI_ADDR_RUNLOCK(); - return (0); -} - - /* * rules for use * @@ -1906,20 +1919,20 @@ sctp_findassociation_addr_sa(struct sock uint32_t vrf_id) { struct sctp_inpcb *inp = NULL; - struct sctp_tcb *retval; + struct sctp_tcb *stcb; SCTP_INP_INFO_RLOCK(); if (find_tcp_pool) { if (inp_p != NULL) { - retval = sctp_tcb_special_locate(inp_p, from, to, netp, + stcb = sctp_tcb_special_locate(inp_p, from, to, netp, vrf_id); } else { - retval = sctp_tcb_special_locate(&inp, from, to, netp, + stcb = sctp_tcb_special_locate(&inp, from, to, netp, vrf_id); } - if (retval != NULL) { + if (stcb != NULL) { SCTP_INP_INFO_RUNLOCK(); - return (retval); + return (stcb); } } inp = sctp_pcb_findep(to, 0, 1, vrf_id); @@ -1927,7 +1940,6 @@ sctp_findassociation_addr_sa(struct sock *inp_p = inp; } SCTP_INP_INFO_RUNLOCK(); - if (inp == NULL) { return (NULL); } @@ -1938,13 +1950,13 @@ sctp_findassociation_addr_sa(struct sock * inbound packet side. */ if (inp_p != NULL) { - retval = sctp_findassociation_ep_addr(inp_p, from, netp, to, + stcb = sctp_findassociation_ep_addr(inp_p, from, netp, to, NULL); } else { - retval = sctp_findassociation_ep_addr(&inp, from, netp, to, + stcb = sctp_findassociation_ep_addr(&inp, from, netp, to, NULL); } - return retval; + return (stcb); } @@ -1959,7 +1971,7 @@ sctp_findassociation_special_addr(struct struct sockaddr *dst) { struct sctp_paramhdr *phdr, parm_buf; - struct sctp_tcb *retval; + struct sctp_tcb *stcb; uint32_t ptype, plen; #ifdef INET @@ -1984,7 +1996,7 @@ sctp_findassociation_special_addr(struct sin6.sin6_port = sh->src_port; #endif - retval = NULL; + stcb = NULL; offset += sizeof(struct sctp_init_chunk); phdr = sctp_get_next_param(m, offset, &parm_buf, sizeof(parm_buf)); @@ -2009,10 +2021,10 @@ sctp_findassociation_special_addr(struct p4 = (struct sctp_ipv4addr_param *)phdr; memcpy(&sin4.sin_addr, &p4->addr, sizeof(p4->addr)); /* look it up */ - retval = sctp_findassociation_ep_addr(inp_p, + stcb = sctp_findassociation_ep_addr(inp_p, (struct sockaddr *)&sin4, netp, dst, NULL); - if (retval != NULL) { - return (retval); + if (stcb != NULL) { + return (stcb); } } #endif @@ -2030,10 +2042,10 @@ sctp_findassociation_special_addr(struct p6 = (struct sctp_ipv6addr_param *)phdr; memcpy(&sin6.sin6_addr, &p6->addr, sizeof(p6->addr)); /* look it up */ - retval = sctp_findassociation_ep_addr(inp_p, + stcb = sctp_findassociation_ep_addr(inp_p, (struct sockaddr *)&sin6, netp, dst, NULL); - if (retval != NULL) { - return (retval); + if (stcb != NULL) { + return (stcb); } } #endif @@ -2158,15 +2170,15 @@ sctp_findassociation_addr(struct mbuf *m struct sctp_inpcb **inp_p, struct sctp_nets **netp, uint32_t vrf_id) { int find_tcp_pool; - struct sctp_tcb *retval; + struct sctp_tcb *stcb; struct sctp_inpcb *inp; if (sh->v_tag) { /* we only go down this path if vtag is non-zero */ - retval = sctp_findassoc_by_vtag(src, dst, ntohl(sh->v_tag), + stcb = sctp_findassoc_by_vtag(src, dst, ntohl(sh->v_tag), inp_p, netp, sh->src_port, sh->dest_port, 0, vrf_id, 0); - if (retval) { - return (retval); + if (stcb) { + return (stcb); } } find_tcp_pool = 0; @@ -2178,15 +2190,15 @@ sctp_findassociation_addr(struct mbuf *m find_tcp_pool = 1; } if (inp_p) { - retval = sctp_findassociation_addr_sa(src, dst, inp_p, netp, + stcb = sctp_findassociation_addr_sa(src, dst, inp_p, netp, find_tcp_pool, vrf_id); inp = *inp_p; } else { - retval = sctp_findassociation_addr_sa(src, dst, &inp, netp, + stcb = sctp_findassociation_addr_sa(src, dst, &inp, netp, find_tcp_pool, vrf_id); } - SCTPDBG(SCTP_DEBUG_PCB1, "retval:%p inp:%p\n", (void *)retval, (void *)inp); - if (retval == NULL && inp) { + SCTPDBG(SCTP_DEBUG_PCB1, "stcb:%p inp:%p\n", (void *)stcb, (void *)inp); + if (stcb == NULL && inp) { /* Found a EP but not this address */ if ((ch->chunk_type == SCTP_INITIATION) || (ch->chunk_type == SCTP_INITIATION_ACK)) { @@ -2204,15 +2216,15 @@ sctp_findassociation_addr(struct mbuf *m } return (NULL); } - retval = sctp_findassociation_special_addr(m, + stcb = sctp_findassociation_special_addr(m, offset, sh, &inp, netp, dst); if (inp_p != NULL) { *inp_p = inp; } } } - SCTPDBG(SCTP_DEBUG_PCB1, "retval is %p\n", (void *)retval); - return (retval); + SCTPDBG(SCTP_DEBUG_PCB1, "stcb is %p\n", (void *)stcb); + return (stcb); } /* From owner-svn-src-stable@FreeBSD.ORG Fri Mar 8 01:29:06 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 83730AD6; Fri, 8 Mar 2013 01:29:06 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 5D69EF52; Fri, 8 Mar 2013 01:29:06 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r281T6Qo092422; Fri, 8 Mar 2013 01:29:06 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r281T5MG092416; Fri, 8 Mar 2013 01:29:05 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201303080129.r281T5MG092416@svn.freebsd.org> From: Michael Tuexen Date: Fri, 8 Mar 2013 01:29:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r248022 - stable/8/sys/netinet X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Mar 2013 01:29:06 -0000 Author: tuexen Date: Fri Mar 8 01:29:05 2013 New Revision: 248022 URL: http://svnweb.freebsd.org/changeset/base/248022 Log: MFC r246674: Don't send kernel provided information in the User Initiated ABORT cause, since the user can also provide this kind of information. So the receiver doesn't know who provided the information. While there: Fix a bug where the stack would send a malformed ABORT chunk when using a send() call with SCTP_ABORT|SCT_SENDALL flags. Modified: stable/8/sys/netinet/sctp_indata.c stable/8/sys/netinet/sctp_output.c stable/8/sys/netinet/sctp_pcb.c stable/8/sys/netinet/sctp_usrreq.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/netinet/ (props changed) Modified: stable/8/sys/netinet/sctp_indata.c ============================================================================== --- stable/8/sys/netinet/sctp_indata.c Fri Mar 8 01:27:18 2013 (r248021) +++ stable/8/sys/netinet/sctp_indata.c Fri Mar 8 01:29:05 2013 (r248022) @@ -4221,19 +4221,15 @@ again: abort_out_now: *abort_now = 1; /* XXX */ - oper = sctp_get_mbuf_for_msg((sizeof(struct sctp_paramhdr) + sizeof(uint32_t)), + oper = sctp_get_mbuf_for_msg(sizeof(struct sctp_paramhdr), 0, M_DONTWAIT, 1, MT_DATA); if (oper) { struct sctp_paramhdr *ph; - uint32_t *ippp; - SCTP_BUF_LEN(oper) = sizeof(struct sctp_paramhdr) + - sizeof(uint32_t); + SCTP_BUF_LEN(oper) = sizeof(struct sctp_paramhdr); ph = mtod(oper, struct sctp_paramhdr *); ph->param_type = htons(SCTP_CAUSE_USER_INITIATED_ABT); ph->param_length = htons(SCTP_BUF_LEN(oper)); - ippp = (uint32_t *) (ph + 1); - *ippp = htonl(SCTP_FROM_SCTP_INDATA + SCTP_LOC_24); } stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_24; sctp_abort_an_association(stcb->sctp_ep, stcb, oper, SCTP_SO_NOT_LOCKED); @@ -4953,19 +4949,15 @@ sctp_handle_sack(struct mbuf *m, int off abort_out_now: *abort_now = 1; /* XXX */ - oper = sctp_get_mbuf_for_msg((sizeof(struct sctp_paramhdr) + sizeof(uint32_t)), + oper = sctp_get_mbuf_for_msg(sizeof(struct sctp_paramhdr), 0, M_DONTWAIT, 1, MT_DATA); if (oper) { struct sctp_paramhdr *ph; - uint32_t *ippp; - SCTP_BUF_LEN(oper) = sizeof(struct sctp_paramhdr) + - sizeof(uint32_t); + SCTP_BUF_LEN(oper) = sizeof(struct sctp_paramhdr); ph = mtod(oper, struct sctp_paramhdr *); ph->param_type = htons(SCTP_CAUSE_USER_INITIATED_ABT); ph->param_length = htons(SCTP_BUF_LEN(oper)); - ippp = (uint32_t *) (ph + 1); - *ippp = htonl(SCTP_FROM_SCTP_INDATA + SCTP_LOC_31); } stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_31; sctp_abort_an_association(stcb->sctp_ep, stcb, oper, SCTP_SO_NOT_LOCKED); Modified: stable/8/sys/netinet/sctp_output.c ============================================================================== --- stable/8/sys/netinet/sctp_output.c Fri Mar 8 01:27:18 2013 (r248021) +++ stable/8/sys/netinet/sctp_output.c Fri Mar 8 01:29:05 2013 (r248022) @@ -6447,7 +6447,7 @@ sctp_sendall_iterator(struct sctp_inpcb if (m) { ph = mtod(m, struct sctp_paramhdr *); ph->param_type = htons(SCTP_CAUSE_USER_INITIATED_ABT); - ph->param_length = htons(ca->sndlen); + ph->param_length = htons(sizeof(struct sctp_paramhdr) + ca->sndlen); } /* * We add one here to keep the assoc from @@ -12503,7 +12503,7 @@ sctp_lower_sosend(struct socket *so, /* now move forward the data pointer */ ph = mtod(mm, struct sctp_paramhdr *); ph->param_type = htons(SCTP_CAUSE_USER_INITIATED_ABT); - ph->param_length = htons((sizeof(struct sctp_paramhdr) + tot_out)); + ph->param_length = htons(sizeof(struct sctp_paramhdr) + tot_out); ph++; SCTP_BUF_LEN(mm) = tot_out + sizeof(struct sctp_paramhdr); if (top == NULL) { Modified: stable/8/sys/netinet/sctp_pcb.c ============================================================================== --- stable/8/sys/netinet/sctp_pcb.c Fri Mar 8 01:27:18 2013 (r248021) +++ stable/8/sys/netinet/sctp_pcb.c Fri Mar 8 01:29:05 2013 (r248022) @@ -3308,22 +3308,16 @@ sctp_inpcb_free(struct sctp_inpcb *inp, /* Left with Data unread */ struct mbuf *op_err; - op_err = sctp_get_mbuf_for_msg((sizeof(struct sctp_paramhdr) + sizeof(uint32_t)), + op_err = sctp_get_mbuf_for_msg(sizeof(struct sctp_paramhdr), 0, M_DONTWAIT, 1, MT_DATA); if (op_err) { /* Fill in the user initiated abort */ struct sctp_paramhdr *ph; - uint32_t *ippp; - SCTP_BUF_LEN(op_err) = - sizeof(struct sctp_paramhdr) + sizeof(uint32_t); - ph = mtod(op_err, - struct sctp_paramhdr *); - ph->param_type = htons( - SCTP_CAUSE_USER_INITIATED_ABT); + SCTP_BUF_LEN(op_err) = sizeof(struct sctp_paramhdr); + ph = mtod(op_err, struct sctp_paramhdr *); + ph->param_type = htons(SCTP_CAUSE_USER_INITIATED_ABT); ph->param_length = htons(SCTP_BUF_LEN(op_err)); - ippp = (uint32_t *) (ph + 1); - *ippp = htonl(SCTP_FROM_SCTP_PCB + SCTP_LOC_3); } asoc->sctp_ep->last_abort_code = SCTP_FROM_SCTP_PCB + SCTP_LOC_3; sctp_send_abort_tcb(asoc, op_err, SCTP_SO_LOCKED); @@ -3395,7 +3389,7 @@ sctp_inpcb_free(struct sctp_inpcb *inp, struct mbuf *op_err; abort_anyway: - op_err = sctp_get_mbuf_for_msg((sizeof(struct sctp_paramhdr) + sizeof(uint32_t)), + op_err = sctp_get_mbuf_for_msg(sizeof(struct sctp_paramhdr), 0, M_DONTWAIT, 1, MT_DATA); if (op_err) { /* @@ -3403,18 +3397,11 @@ sctp_inpcb_free(struct sctp_inpcb *inp, * initiated abort */ struct sctp_paramhdr *ph; - uint32_t *ippp; - SCTP_BUF_LEN(op_err) = - (sizeof(struct sctp_paramhdr) + - sizeof(uint32_t)); - ph = mtod(op_err, - struct sctp_paramhdr *); - ph->param_type = htons( - SCTP_CAUSE_USER_INITIATED_ABT); + SCTP_BUF_LEN(op_err) = sizeof(struct sctp_paramhdr); + ph = mtod(op_err, struct sctp_paramhdr *); + ph->param_type = htons(SCTP_CAUSE_USER_INITIATED_ABT); ph->param_length = htons(SCTP_BUF_LEN(op_err)); - ippp = (uint32_t *) (ph + 1); - *ippp = htonl(SCTP_FROM_SCTP_PCB + SCTP_LOC_5); } asoc->sctp_ep->last_abort_code = SCTP_FROM_SCTP_PCB + SCTP_LOC_5; sctp_send_abort_tcb(asoc, op_err, SCTP_SO_LOCKED); @@ -3478,23 +3465,17 @@ sctp_inpcb_free(struct sctp_inpcb *inp, if ((SCTP_GET_STATE(&asoc->asoc) != SCTP_STATE_COOKIE_WAIT) && ((asoc->asoc.state & SCTP_STATE_ABOUT_TO_BE_FREED) == 0)) { struct mbuf *op_err; - uint32_t *ippp; - op_err = sctp_get_mbuf_for_msg((sizeof(struct sctp_paramhdr) + sizeof(uint32_t)), + op_err = sctp_get_mbuf_for_msg(sizeof(struct sctp_paramhdr), 0, M_DONTWAIT, 1, MT_DATA); if (op_err) { /* Fill in the user initiated abort */ struct sctp_paramhdr *ph; - SCTP_BUF_LEN(op_err) = (sizeof(struct sctp_paramhdr) + - sizeof(uint32_t)); + SCTP_BUF_LEN(op_err) = sizeof(struct sctp_paramhdr); ph = mtod(op_err, struct sctp_paramhdr *); - ph->param_type = htons( - SCTP_CAUSE_USER_INITIATED_ABT); + ph->param_type = htons(SCTP_CAUSE_USER_INITIATED_ABT); ph->param_length = htons(SCTP_BUF_LEN(op_err)); - ippp = (uint32_t *) (ph + 1); - *ippp = htonl(SCTP_FROM_SCTP_PCB + SCTP_LOC_7); - } asoc->sctp_ep->last_abort_code = SCTP_FROM_SCTP_PCB + SCTP_LOC_7; sctp_send_abort_tcb(asoc, op_err, SCTP_SO_LOCKED); Modified: stable/8/sys/netinet/sctp_usrreq.c ============================================================================== --- stable/8/sys/netinet/sctp_usrreq.c Fri Mar 8 01:27:18 2013 (r248021) +++ stable/8/sys/netinet/sctp_usrreq.c Fri Mar 8 01:29:05 2013 (r248022) @@ -854,7 +854,7 @@ sctp_disconnect(struct socket *so) struct mbuf *op_err; abort_anyway: - op_err = sctp_get_mbuf_for_msg((sizeof(struct sctp_paramhdr) + sizeof(uint32_t)), + op_err = sctp_get_mbuf_for_msg(sizeof(struct sctp_paramhdr), 0, M_DONTWAIT, 1, MT_DATA); if (op_err) { /* @@ -862,17 +862,11 @@ sctp_disconnect(struct socket *so) * initiated abort */ struct sctp_paramhdr *ph; - uint32_t *ippp; - SCTP_BUF_LEN(op_err) = - (sizeof(struct sctp_paramhdr) + sizeof(uint32_t)); - ph = mtod(op_err, - struct sctp_paramhdr *); - ph->param_type = htons( - SCTP_CAUSE_USER_INITIATED_ABT); + SCTP_BUF_LEN(op_err) = sizeof(struct sctp_paramhdr); + ph = mtod(op_err, struct sctp_paramhdr *); + ph->param_type = htons(SCTP_CAUSE_USER_INITIATED_ABT); ph->param_length = htons(SCTP_BUF_LEN(op_err)); - ippp = (uint32_t *) (ph + 1); - *ippp = htonl(SCTP_FROM_SCTP_USRREQ + SCTP_LOC_4); } stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_USRREQ + SCTP_LOC_4; sctp_send_abort_tcb(stcb, op_err, SCTP_SO_LOCKED); @@ -1069,22 +1063,16 @@ sctp_shutdown(struct socket *so) struct mbuf *op_err; abort_anyway: - op_err = sctp_get_mbuf_for_msg((sizeof(struct sctp_paramhdr) + sizeof(uint32_t)), + op_err = sctp_get_mbuf_for_msg(sizeof(struct sctp_paramhdr), 0, M_DONTWAIT, 1, MT_DATA); if (op_err) { /* Fill in the user initiated abort */ struct sctp_paramhdr *ph; - uint32_t *ippp; - SCTP_BUF_LEN(op_err) = - sizeof(struct sctp_paramhdr) + sizeof(uint32_t); - ph = mtod(op_err, - struct sctp_paramhdr *); - ph->param_type = htons( - SCTP_CAUSE_USER_INITIATED_ABT); + SCTP_BUF_LEN(op_err) = sizeof(struct sctp_paramhdr); + ph = mtod(op_err, struct sctp_paramhdr *); + ph->param_type = htons(SCTP_CAUSE_USER_INITIATED_ABT); ph->param_length = htons(SCTP_BUF_LEN(op_err)); - ippp = (uint32_t *) (ph + 1); - *ippp = htonl(SCTP_FROM_SCTP_USRREQ + SCTP_LOC_6); } stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_USRREQ + SCTP_LOC_6; sctp_abort_an_association(stcb->sctp_ep, stcb, From owner-svn-src-stable@FreeBSD.ORG Fri Mar 8 01:31:15 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id C3984CB4; Fri, 8 Mar 2013 01:31:15 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id A64F6F70; Fri, 8 Mar 2013 01:31:15 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r281VFXT094372; Fri, 8 Mar 2013 01:31:15 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r281VEqZ094367; Fri, 8 Mar 2013 01:31:14 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201303080131.r281VEqZ094367@svn.freebsd.org> From: Michael Tuexen Date: Fri, 8 Mar 2013 01:31:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r248023 - stable/8/sys/netinet X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Mar 2013 01:31:15 -0000 Author: tuexen Date: Fri Mar 8 01:31:14 2013 New Revision: 248023 URL: http://svnweb.freebsd.org/changeset/base/248023 Log: MFC r246687: Send the adaptation layer indication only if set by the user. Modified: stable/8/sys/netinet/sctp_output.c stable/8/sys/netinet/sctp_pcb.c stable/8/sys/netinet/sctp_pcb.h stable/8/sys/netinet/sctp_usrreq.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/netinet/ (props changed) Modified: stable/8/sys/netinet/sctp_output.c ============================================================================== --- stable/8/sys/netinet/sctp_output.c Fri Mar 8 01:29:05 2013 (r248022) +++ stable/8/sys/netinet/sctp_output.c Fri Mar 8 01:31:14 2013 (r248023) @@ -4648,19 +4648,19 @@ sctp_send_initiate(struct sctp_inpcb *in chunk_len += parameter_len; } /* Adaptation layer indication parameter */ - /* XXX: Should we include this always? */ - if (padding_len > 0) { - memset(mtod(m, caddr_t)+chunk_len, 0, padding_len); - chunk_len += padding_len; - padding_len = 0; + if (inp->sctp_ep.adaptation_layer_indicator_provided) { + if (padding_len > 0) { + memset(mtod(m, caddr_t)+chunk_len, 0, padding_len); + chunk_len += padding_len; + padding_len = 0; + } + parameter_len = (uint16_t) sizeof(struct sctp_adaptation_layer_indication); + ali = (struct sctp_adaptation_layer_indication *)(mtod(m, caddr_t)+chunk_len); + ali->ph.param_type = htons(SCTP_ULP_ADAPTATION); + ali->ph.param_length = htons(parameter_len); + ali->indication = ntohl(inp->sctp_ep.adaptation_layer_indicator); + chunk_len += parameter_len; } - parameter_len = (uint16_t) sizeof(struct sctp_adaptation_layer_indication); - ali = (struct sctp_adaptation_layer_indication *)(mtod(m, caddr_t)+chunk_len); - ali->ph.param_type = htons(SCTP_ULP_ADAPTATION); - ali->ph.param_length = htons(parameter_len); - ali->indication = ntohl(inp->sctp_ep.adaptation_layer_indicator); - chunk_len += parameter_len; - if (SCTP_BASE_SYSCTL(sctp_inits_include_nat_friendly)) { /* Add NAT friendly parameter. */ if (padding_len > 0) { @@ -5728,12 +5728,16 @@ do_a_abort: htons(inp->sctp_ep.max_open_streams_intome); /* adaptation layer indication parameter */ - ali = (struct sctp_adaptation_layer_indication *)((caddr_t)initack + sizeof(*initack)); - ali->ph.param_type = htons(SCTP_ULP_ADAPTATION); - ali->ph.param_length = htons(sizeof(*ali)); - ali->indication = ntohl(inp->sctp_ep.adaptation_layer_indicator); - SCTP_BUF_LEN(m) += sizeof(*ali); - ecn = (struct sctp_ecn_supported_param *)((caddr_t)ali + sizeof(*ali)); + if (inp->sctp_ep.adaptation_layer_indicator_provided) { + ali = (struct sctp_adaptation_layer_indication *)((caddr_t)initack + sizeof(*initack)); + ali->ph.param_type = htons(SCTP_ULP_ADAPTATION); + ali->ph.param_length = htons(sizeof(*ali)); + ali->indication = ntohl(inp->sctp_ep.adaptation_layer_indicator); + SCTP_BUF_LEN(m) += sizeof(*ali); + ecn = (struct sctp_ecn_supported_param *)((caddr_t)ali + sizeof(*ali)); + } else { + ecn = (struct sctp_ecn_supported_param *)((caddr_t)initack + sizeof(*initack)); + } /* ECN parameter */ if (((asoc != NULL) && (asoc->ecn_allowed == 1)) || Modified: stable/8/sys/netinet/sctp_pcb.c ============================================================================== --- stable/8/sys/netinet/sctp_pcb.c Fri Mar 8 01:29:05 2013 (r248022) +++ stable/8/sys/netinet/sctp_pcb.c Fri Mar 8 01:31:14 2013 (r248023) @@ -2516,7 +2516,8 @@ sctp_inpcb_alloc(struct socket *so, uint m->pre_open_stream_count = SCTP_BASE_SYSCTL(sctp_nr_outgoing_streams_default); /* Add adaptation cookie */ - m->adaptation_layer_indicator = 0x504C5253; + m->adaptation_layer_indicator = 0; + m->adaptation_layer_indicator_provided = 0; /* seed random number generator */ m->random_counter = 1; Modified: stable/8/sys/netinet/sctp_pcb.h ============================================================================== --- stable/8/sys/netinet/sctp_pcb.h Fri Mar 8 01:29:05 2013 (r248022) +++ stable/8/sys/netinet/sctp_pcb.h Fri Mar 8 01:31:14 2013 (r248023) @@ -323,6 +323,7 @@ struct sctp_pcb { int auto_close_time; uint32_t initial_sequence_debug; uint32_t adaptation_layer_indicator; + uint8_t adaptation_layer_indicator_provided; uint32_t store_at; uint32_t max_burst; uint32_t fr_max_burst; Modified: stable/8/sys/netinet/sctp_usrreq.c ============================================================================== --- stable/8/sys/netinet/sctp_usrreq.c Fri Mar 8 01:29:05 2013 (r248022) +++ stable/8/sys/netinet/sctp_usrreq.c Fri Mar 8 01:31:14 2013 (r248023) @@ -4585,6 +4585,7 @@ sctp_setopt(struct socket *so, int optna SCTP_CHECK_AND_CAST(adap_bits, optval, struct sctp_setadaptation, optsize); SCTP_INP_WLOCK(inp); inp->sctp_ep.adaptation_layer_indicator = adap_bits->ssb_adaptation_ind; + inp->sctp_ep.adaptation_layer_indicator_provided = 1; SCTP_INP_WUNLOCK(inp); break; } From owner-svn-src-stable@FreeBSD.ORG Fri Mar 8 01:33:07 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 8FEEFE3C; Fri, 8 Mar 2013 01:33:07 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 824C6F83; Fri, 8 Mar 2013 01:33:07 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r281X7MV094701; Fri, 8 Mar 2013 01:33:07 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r281X7TD094700; Fri, 8 Mar 2013 01:33:07 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201303080133.r281X7TD094700@svn.freebsd.org> From: Michael Tuexen Date: Fri, 8 Mar 2013 01:33:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r248024 - stable/8/sys/netinet X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Mar 2013 01:33:07 -0000 Author: tuexen Date: Fri Mar 8 01:33:07 2013 New Revision: 248024 URL: http://svnweb.freebsd.org/changeset/base/248024 Log: MFC r247412: Fix a potential race in returning setting errno when an association goes down. Reported by Mozilla in https://bugzilla.mozilla.org/show_bug.cgi?id=845513 Modified: stable/8/sys/netinet/sctputil.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/netinet/ (props changed) Modified: stable/8/sys/netinet/sctputil.c ============================================================================== --- stable/8/sys/netinet/sctputil.c Fri Mar 8 01:31:14 2013 (r248023) +++ stable/8/sys/netinet/sctputil.c Fri Mar 8 01:33:07 2013 (r248024) @@ -2678,6 +2678,7 @@ set_error: if (((stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) || (stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL)) && ((state == SCTP_COMM_LOST) || (state == SCTP_CANT_STR_ASSOC))) { + SOCK_LOCK(stcb->sctp_socket); if (from_peer) { if (SCTP_GET_STATE(&stcb->asoc) == SCTP_STATE_COOKIE_WAIT) { SCTP_LTRACE_ERR_RET(NULL, stcb, NULL, SCTP_FROM_SCTPUTIL, ECONNREFUSED); @@ -2709,7 +2710,7 @@ set_error: if (((stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) || (stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL)) && ((state == SCTP_COMM_LOST) || (state == SCTP_CANT_STR_ASSOC))) { - socantrcvmore(stcb->sctp_socket); + socantrcvmore_locked(stcb->sctp_socket); } sorwakeup(stcb->sctp_socket); sowwakeup(stcb->sctp_socket); From owner-svn-src-stable@FreeBSD.ORG Fri Mar 8 02:38:20 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 164E1EA3; Fri, 8 Mar 2013 02:38:20 +0000 (UTC) (envelope-from bryanv@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 07FC71F9; Fri, 8 Mar 2013 02:38:20 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r282cJFn013754; Fri, 8 Mar 2013 02:38:19 GMT (envelope-from bryanv@svn.freebsd.org) Received: (from bryanv@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r282cJ35013753; Fri, 8 Mar 2013 02:38:19 GMT (envelope-from bryanv@svn.freebsd.org) Message-Id: <201303080238.r282cJ35013753@svn.freebsd.org> From: Bryan Venteicher Date: Fri, 8 Mar 2013 02:38:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r248026 - stable/9/sys/dev/virtio/block X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Mar 2013 02:38:20 -0000 Author: bryanv Date: Fri Mar 8 02:38:19 2013 New Revision: 248026 URL: http://svnweb.freebsd.org/changeset/base/248026 Log: MFC r247829 Only set the barrier flag if the feature was negotiated Approved by: grehan (mentor) Modified: stable/9/sys/dev/virtio/block/virtio_blk.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) Modified: stable/9/sys/dev/virtio/block/virtio_blk.c ============================================================================== --- stable/9/sys/dev/virtio/block/virtio_blk.c Fri Mar 8 01:51:32 2013 (r248025) +++ stable/9/sys/dev/virtio/block/virtio_blk.c Fri Mar 8 02:38:19 2013 (r248026) @@ -72,6 +72,7 @@ struct vtblk_softc { #define VTBLK_FLAG_DETACH 0x0004 #define VTBLK_FLAG_SUSPEND 0x0008 #define VTBLK_FLAG_DUMPING 0x0010 +#define VTBLK_FLAG_BARRIER 0x0020 struct virtqueue *vtblk_vq; struct sglist *vtblk_sglist; @@ -81,7 +82,8 @@ struct vtblk_softc { TAILQ_HEAD(, vtblk_request) vtblk_req_free; TAILQ_HEAD(, vtblk_request) - vtblk_req_ready; + vtblk_req_ready; + struct vtblk_request *vtblk_req_ordered; struct taskqueue *vtblk_tq; struct task vtblk_intr_task; @@ -278,9 +280,10 @@ vtblk_attach(device_t dev) if (virtio_with_feature(dev, VIRTIO_RING_F_INDIRECT_DESC)) sc->vtblk_flags |= VTBLK_FLAG_INDIRECT; - if (virtio_with_feature(dev, VIRTIO_BLK_F_RO)) sc->vtblk_flags |= VTBLK_FLAG_READONLY; + if (virtio_with_feature(dev, VIRTIO_BLK_F_BARRIER)) + sc->vtblk_flags |= VTBLK_FLAG_BARRIER; /* Get local copy of config. */ virtio_read_device_config(dev, 0, &blkcfg, @@ -766,25 +769,45 @@ vtblk_bio_request(struct vtblk_softc *sc bp->bio_cmd); } - if (bp->bio_flags & BIO_ORDERED) - req->vbr_hdr.type |= VIRTIO_BLK_T_BARRIER; - return (req); } static int vtblk_execute_request(struct vtblk_softc *sc, struct vtblk_request *req) { + struct virtqueue *vq; struct sglist *sg; struct bio *bp; - int readable, writable, error; + int ordered, readable, writable, error; + vq = sc->vtblk_vq; sg = sc->vtblk_sglist; bp = req->vbr_bp; + ordered = 0; writable = 0; VTBLK_LOCK_ASSERT(sc); + /* + * Wait until the ordered request completes before + * executing subsequent requests. + */ + if (sc->vtblk_req_ordered != NULL) + return (EBUSY); + + if (bp->bio_flags & BIO_ORDERED) { + if ((sc->vtblk_flags & VTBLK_FLAG_BARRIER) == 0) { + /* + * This request will be executed once all + * the in-flight requests are completed. + */ + if (!virtqueue_empty(vq)) + return (EBUSY); + ordered = 1; + } else + req->vbr_hdr.type |= VIRTIO_BLK_T_BARRIER; + } + sglist_reset(sg); sglist_append(sg, &req->vbr_hdr, sizeof(struct virtio_blk_outhdr)); @@ -802,10 +825,13 @@ vtblk_execute_request(struct vtblk_softc writable++; sglist_append(sg, &req->vbr_ack, sizeof(uint8_t)); - readable = sg->sg_nseg - writable; - return (virtqueue_enqueue(sc->vtblk_vq, req, sg, readable, writable)); + error = virtqueue_enqueue(vq, req, sg, readable, writable); + if (error == 0 && ordered) + sc->vtblk_req_ordered = req; + + return (error); } static int @@ -1013,6 +1039,12 @@ vtblk_finish_completed(struct vtblk_soft while ((req = virtqueue_dequeue(sc->vtblk_vq, NULL)) != NULL) { bp = req->vbr_bp; + if (sc->vtblk_req_ordered != NULL) { + /* This should be the only outstanding request. */ + MPASS(sc->vtblk_req_ordered == req); + sc->vtblk_req_ordered = NULL; + } + error = vtblk_request_error(req); if (error) disk_err(bp, "hard error", -1, 1); @@ -1039,6 +1071,7 @@ vtblk_drain_vq(struct vtblk_softc *sc, i vtblk_enqueue_request(sc, req); } + sc->vtblk_req_ordered = NULL; KASSERT(virtqueue_empty(vq), ("virtqueue not empty")); } From owner-svn-src-stable@FreeBSD.ORG Fri Mar 8 02:40:08 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id F3C1190; Fri, 8 Mar 2013 02:40:07 +0000 (UTC) (envelope-from bryanv@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id E5BD6206; Fri, 8 Mar 2013 02:40:07 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r282e7KM014067; Fri, 8 Mar 2013 02:40:07 GMT (envelope-from bryanv@svn.freebsd.org) Received: (from bryanv@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r282e7Dw014066; Fri, 8 Mar 2013 02:40:07 GMT (envelope-from bryanv@svn.freebsd.org) Message-Id: <201303080240.r282e7Dw014066@svn.freebsd.org> From: Bryan Venteicher Date: Fri, 8 Mar 2013 02:40:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r248027 - stable/8/sys/dev/virtio/block X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Mar 2013 02:40:08 -0000 Author: bryanv Date: Fri Mar 8 02:40:07 2013 New Revision: 248027 URL: http://svnweb.freebsd.org/changeset/base/248027 Log: MFC r247829 Only set the barrier flag if the feature was negotiated Approved by: grehan (mentor) Modified: stable/8/sys/dev/virtio/block/virtio_blk.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/dev/ (props changed) stable/8/sys/dev/virtio/ (props changed) Modified: stable/8/sys/dev/virtio/block/virtio_blk.c ============================================================================== --- stable/8/sys/dev/virtio/block/virtio_blk.c Fri Mar 8 02:38:19 2013 (r248026) +++ stable/8/sys/dev/virtio/block/virtio_blk.c Fri Mar 8 02:40:07 2013 (r248027) @@ -72,6 +72,7 @@ struct vtblk_softc { #define VTBLK_FLAG_DETACH 0x0004 #define VTBLK_FLAG_SUSPEND 0x0008 #define VTBLK_FLAG_DUMPING 0x0010 +#define VTBLK_FLAG_BARRIER 0x0020 struct virtqueue *vtblk_vq; struct sglist *vtblk_sglist; @@ -81,7 +82,8 @@ struct vtblk_softc { TAILQ_HEAD(, vtblk_request) vtblk_req_free; TAILQ_HEAD(, vtblk_request) - vtblk_req_ready; + vtblk_req_ready; + struct vtblk_request *vtblk_req_ordered; struct taskqueue *vtblk_tq; struct task vtblk_intr_task; @@ -278,9 +280,10 @@ vtblk_attach(device_t dev) if (virtio_with_feature(dev, VIRTIO_RING_F_INDIRECT_DESC)) sc->vtblk_flags |= VTBLK_FLAG_INDIRECT; - if (virtio_with_feature(dev, VIRTIO_BLK_F_RO)) sc->vtblk_flags |= VTBLK_FLAG_READONLY; + if (virtio_with_feature(dev, VIRTIO_BLK_F_BARRIER)) + sc->vtblk_flags |= VTBLK_FLAG_BARRIER; /* Get local copy of config. */ virtio_read_device_config(dev, 0, &blkcfg, @@ -766,25 +769,45 @@ vtblk_bio_request(struct vtblk_softc *sc bp->bio_cmd); } - if (bp->bio_flags & BIO_ORDERED) - req->vbr_hdr.type |= VIRTIO_BLK_T_BARRIER; - return (req); } static int vtblk_execute_request(struct vtblk_softc *sc, struct vtblk_request *req) { + struct virtqueue *vq; struct sglist *sg; struct bio *bp; - int readable, writable, error; + int ordered, readable, writable, error; + vq = sc->vtblk_vq; sg = sc->vtblk_sglist; bp = req->vbr_bp; + ordered = 0; writable = 0; VTBLK_LOCK_ASSERT(sc); + /* + * Wait until the ordered request completes before + * executing subsequent requests. + */ + if (sc->vtblk_req_ordered != NULL) + return (EBUSY); + + if (bp->bio_flags & BIO_ORDERED) { + if ((sc->vtblk_flags & VTBLK_FLAG_BARRIER) == 0) { + /* + * This request will be executed once all + * the in-flight requests are completed. + */ + if (!virtqueue_empty(vq)) + return (EBUSY); + ordered = 1; + } else + req->vbr_hdr.type |= VIRTIO_BLK_T_BARRIER; + } + sglist_reset(sg); sglist_append(sg, &req->vbr_hdr, sizeof(struct virtio_blk_outhdr)); @@ -802,10 +825,13 @@ vtblk_execute_request(struct vtblk_softc writable++; sglist_append(sg, &req->vbr_ack, sizeof(uint8_t)); - readable = sg->sg_nseg - writable; - return (virtqueue_enqueue(sc->vtblk_vq, req, sg, readable, writable)); + error = virtqueue_enqueue(vq, req, sg, readable, writable); + if (error == 0 && ordered) + sc->vtblk_req_ordered = req; + + return (error); } static int @@ -1013,6 +1039,12 @@ vtblk_finish_completed(struct vtblk_soft while ((req = virtqueue_dequeue(sc->vtblk_vq, NULL)) != NULL) { bp = req->vbr_bp; + if (sc->vtblk_req_ordered != NULL) { + /* This should be the only outstanding request. */ + MPASS(sc->vtblk_req_ordered == req); + sc->vtblk_req_ordered = NULL; + } + error = vtblk_request_error(req); if (error) disk_err(bp, "hard error", -1, 1); @@ -1039,6 +1071,7 @@ vtblk_drain_vq(struct vtblk_softc *sc, i vtblk_enqueue_request(sc, req); } + sc->vtblk_req_ordered = NULL; KASSERT(virtqueue_empty(vq), ("virtqueue not empty")); } From owner-svn-src-stable@FreeBSD.ORG Fri Mar 8 08:09:26 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id D09F6426; Fri, 8 Mar 2013 08:09:26 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id C3511F9D; Fri, 8 Mar 2013 08:09:26 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2889Qlw014013; Fri, 8 Mar 2013 08:09:26 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2889QLB014012; Fri, 8 Mar 2013 08:09:26 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201303080809.r2889QLB014012@svn.freebsd.org> From: Konstantin Belousov Date: Fri, 8 Mar 2013 08:09:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r248029 - stable/9/sys/kern X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Mar 2013 08:09:26 -0000 Author: kib Date: Fri Mar 8 08:09:26 2013 New Revision: 248029 URL: http://svnweb.freebsd.org/changeset/base/248029 Log: MFC r247560: Make the default implementation of the VOP_VPTOCNP() fail if the directory entry, matched by the inode number, is ".". Modified: stable/9/sys/kern/vfs_default.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/kern/vfs_default.c ============================================================================== --- stable/9/sys/kern/vfs_default.c Fri Mar 8 03:29:05 2013 (r248028) +++ stable/9/sys/kern/vfs_default.c Fri Mar 8 08:09:26 2013 (r248029) @@ -856,8 +856,12 @@ vop_stdvptocnp(struct vop_vptocnp_args * error = ENOMEM; goto out; } - bcopy(dp->d_name, buf + i, dp->d_namlen); - error = 0; + if (dp->d_namlen == 1 && dp->d_name[0] == '.') { + error = ENOENT; + } else { + bcopy(dp->d_name, buf + i, dp->d_namlen); + error = 0; + } goto out; } } while (len > 0 || !eofflag); From owner-svn-src-stable@FreeBSD.ORG Fri Mar 8 08:19:50 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id B68BD6E4; Fri, 8 Mar 2013 08:19:50 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 9E288FE7; Fri, 8 Mar 2013 08:19:50 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r288JohJ017254; Fri, 8 Mar 2013 08:19:50 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r288Jo17017253; Fri, 8 Mar 2013 08:19:50 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201303080819.r288Jo17017253@svn.freebsd.org> From: Konstantin Belousov Date: Fri, 8 Mar 2013 08:19:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r248030 - stable/8/sys/kern X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Mar 2013 08:19:50 -0000 Author: kib Date: Fri Mar 8 08:19:50 2013 New Revision: 248030 URL: http://svnweb.freebsd.org/changeset/base/248030 Log: MFC r247560: Make the default implementation of the VOP_VPTOCNP() fail if the directory entry, matched by the inode number, is ".". Modified: stable/8/sys/kern/vfs_default.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/kern/ (props changed) Modified: stable/8/sys/kern/vfs_default.c ============================================================================== --- stable/8/sys/kern/vfs_default.c Fri Mar 8 08:09:26 2013 (r248029) +++ stable/8/sys/kern/vfs_default.c Fri Mar 8 08:19:50 2013 (r248030) @@ -822,8 +822,12 @@ vop_stdvptocnp(struct vop_vptocnp_args * error = ENOMEM; goto out; } - bcopy(dp->d_name, buf + i, dp->d_namlen); - error = 0; + if (dp->d_namlen == 1 && dp->d_name[0] == '.') { + error = ENOENT; + } else { + bcopy(dp->d_name, buf + i, dp->d_namlen); + error = 0; + } goto out; } } while (len > 0 || !eofflag); From owner-svn-src-stable@FreeBSD.ORG Fri Mar 8 11:25:53 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 267DACD4; Fri, 8 Mar 2013 11:25:53 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 16CD3A0F; Fri, 8 Mar 2013 11:25:53 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r28BPqjJ079270; Fri, 8 Mar 2013 11:25:52 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r28BPqFf079269; Fri, 8 Mar 2013 11:25:52 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201303081125.r28BPqFf079269@svn.freebsd.org> From: Marius Strobl Date: Fri, 8 Mar 2013 11:25:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r248034 - stable/9/sys/kern X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Mar 2013 11:25:53 -0000 Author: marius Date: Fri Mar 8 11:25:52 2013 New Revision: 248034 URL: http://svnweb.freebsd.org/changeset/base/248034 Log: MFC: r247561 - Use strdup(9) instead of reimplementing it. - Use __DECONST instead of strange casts. - Reduce code duplication and simplify name2oid(). PR: 176373 Submitted by: Christoph Mallon Modified: stable/9/sys/kern/kern_sysctl.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/kern/kern_sysctl.c ============================================================================== --- stable/9/sys/kern/kern_sysctl.c Fri Mar 8 10:43:03 2013 (r248033) +++ stable/9/sys/kern/kern_sysctl.c Fri Mar 8 11:25:52 2013 (r248034) @@ -444,9 +444,9 @@ sysctl_remove_oid_locked(struct sysctl_o SYSCTL_SLEEP(&oidp->oid_running, "oidrm", 0); } if (oidp->oid_descr) - free((void *)(uintptr_t)(const void *)oidp->oid_descr, M_SYSCTLOID); - free((void *)(uintptr_t)(const void *)oidp->oid_name, - M_SYSCTLOID); + free(__DECONST(char *, oidp->oid_descr), + M_SYSCTLOID); + free(__DECONST(char *, oidp->oid_name), M_SYSCTLOID); free(oidp, M_SYSCTLOID); } } @@ -462,8 +462,6 @@ sysctl_add_oid(struct sysctl_ctx_list *c int (*handler)(SYSCTL_HANDLER_ARGS), const char *fmt, const char *descr) { struct sysctl_oid *oidp; - ssize_t len; - char *newname; /* You have to hook up somewhere.. */ if (parent == NULL) @@ -490,11 +488,7 @@ sysctl_add_oid(struct sysctl_ctx_list *c SLIST_NEXT(oidp, oid_link) = NULL; oidp->oid_number = number; oidp->oid_refcnt = 1; - len = strlen(name); - newname = malloc(len + 1, M_SYSCTLOID, M_WAITOK); - bcopy(name, newname, len + 1); - newname[len] = '\0'; - oidp->oid_name = newname; + oidp->oid_name = strdup(name, M_SYSCTLOID); oidp->oid_handler = handler; oidp->oid_kind = CTLFLAG_DYN | kind; if ((kind & CTLTYPE) == CTLTYPE_NODE) { @@ -508,12 +502,8 @@ sysctl_add_oid(struct sysctl_ctx_list *c oidp->oid_arg2 = arg2; } oidp->oid_fmt = fmt; - if (descr) { - int len = strlen(descr) + 1; - oidp->oid_descr = malloc(len, M_SYSCTLOID, M_WAITOK); - if (oidp->oid_descr) - strcpy((char *)(uintptr_t)(const void *)oidp->oid_descr, descr); - } + if (descr) + oidp->oid_descr = strdup(descr, M_SYSCTLOID); /* Update the context, if used */ if (clist != NULL) sysctl_ctx_entry_add(clist, oidp); @@ -529,16 +519,12 @@ sysctl_add_oid(struct sysctl_ctx_list *c void sysctl_rename_oid(struct sysctl_oid *oidp, const char *name) { - ssize_t len; char *newname; - void *oldname; + char *oldname; - len = strlen(name); - newname = malloc(len + 1, M_SYSCTLOID, M_WAITOK); - bcopy(name, newname, len + 1); - newname[len] = '\0'; + newname = strdup(name, M_SYSCTLOID); SYSCTL_XLOCK(); - oldname = (void *)(uintptr_t)(const void *)oidp->oid_name; + oldname = __DECONST(char *, oidp->oid_name); oidp->oid_name = newname; SYSCTL_XUNLOCK(); free(oldname, M_SYSCTLOID); @@ -823,39 +809,26 @@ static SYSCTL_NODE(_sysctl, 2, next, CTL static int name2oid(char *name, int *oid, int *len, struct sysctl_oid **oidpp) { - int i; struct sysctl_oid *oidp; struct sysctl_oid_list *lsp = &sysctl__children; char *p; SYSCTL_ASSERT_XLOCKED(); - if (!*name) - return (ENOENT); + for (*len = 0; *len < CTL_MAXNAME;) { + p = strsep(&name, "."); - p = name + strlen(name) - 1 ; - if (*p == '.') - *p = '\0'; - - *len = 0; - - for (p = name; *p && *p != '.'; p++) - ; - i = *p; - if (i == '.') - *p = '\0'; - - oidp = SLIST_FIRST(lsp); - - while (oidp && *len < CTL_MAXNAME) { - if (strcmp(name, oidp->oid_name)) { - oidp = SLIST_NEXT(oidp, oid_link); - continue; + oidp = SLIST_FIRST(lsp); + for (;; oidp = SLIST_NEXT(oidp, oid_link)) { + if (oidp == NULL) + return (ENOENT); + if (strcmp(p, oidp->oid_name) == 0) + break; } *oid++ = oidp->oid_number; (*len)++; - if (!i) { + if (name == NULL || *name == '\0') { if (oidpp) *oidpp = oidp; return (0); @@ -868,13 +841,6 @@ name2oid(char *name, int *oid, int *len, break; lsp = SYSCTL_CHILDREN(oidp); - oidp = SLIST_FIRST(lsp); - name = p+1; - for (p = name; *p && *p != '.'; p++) - ; - i = *p; - if (i == '.') - *p = '\0'; } return (ENOENT); } From owner-svn-src-stable@FreeBSD.ORG Fri Mar 8 11:26:01 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id E7DBDE2D; Fri, 8 Mar 2013 11:26:00 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id DA5F3A13; Fri, 8 Mar 2013 11:26:00 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r28BQ0fV079335; Fri, 8 Mar 2013 11:26:00 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r28BQ0WQ079334; Fri, 8 Mar 2013 11:26:00 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201303081126.r28BQ0WQ079334@svn.freebsd.org> From: Marius Strobl Date: Fri, 8 Mar 2013 11:26:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r248035 - stable/8/sys/kern X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Mar 2013 11:26:01 -0000 Author: marius Date: Fri Mar 8 11:26:00 2013 New Revision: 248035 URL: http://svnweb.freebsd.org/changeset/base/248035 Log: MFC: r247561 - Use strdup(9) instead of reimplementing it. - Use __DECONST instead of strange casts. - Reduce code duplication and simplify name2oid(). PR: 176373 Submitted by: Christoph Mallon Modified: stable/8/sys/kern/kern_sysctl.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/kern/ (props changed) Modified: stable/8/sys/kern/kern_sysctl.c ============================================================================== --- stable/8/sys/kern/kern_sysctl.c Fri Mar 8 11:25:52 2013 (r248034) +++ stable/8/sys/kern/kern_sysctl.c Fri Mar 8 11:26:00 2013 (r248035) @@ -420,9 +420,9 @@ sysctl_remove_oid_locked(struct sysctl_o SYSCTL_SLEEP(&oidp->oid_running, "oidrm", 0); } if (oidp->oid_descr) - free((void *)(uintptr_t)(const void *)oidp->oid_descr, M_SYSCTLOID); - free((void *)(uintptr_t)(const void *)oidp->oid_name, - M_SYSCTLOID); + free(__DECONST(char *, oidp->oid_descr), + M_SYSCTLOID); + free(__DECONST(char *, oidp->oid_name), M_SYSCTLOID); free(oidp, M_SYSCTLOID); } } @@ -439,8 +439,6 @@ sysctl_add_oid(struct sysctl_ctx_list *c int (*handler)(SYSCTL_HANDLER_ARGS), const char *fmt, const char *descr) { struct sysctl_oid *oidp; - ssize_t len; - char *newname; /* You have to hook up somewhere.. */ if (parent == NULL) @@ -467,11 +465,7 @@ sysctl_add_oid(struct sysctl_ctx_list *c SLIST_NEXT(oidp, oid_link) = NULL; oidp->oid_number = number; oidp->oid_refcnt = 1; - len = strlen(name); - newname = malloc(len + 1, M_SYSCTLOID, M_WAITOK); - bcopy(name, newname, len + 1); - newname[len] = '\0'; - oidp->oid_name = newname; + oidp->oid_name = strdup(name, M_SYSCTLOID); oidp->oid_handler = handler; oidp->oid_kind = CTLFLAG_DYN | kind; if ((kind & CTLTYPE) == CTLTYPE_NODE) { @@ -484,12 +478,8 @@ sysctl_add_oid(struct sysctl_ctx_list *c oidp->oid_arg2 = arg2; } oidp->oid_fmt = fmt; - if (descr) { - int len = strlen(descr) + 1; - oidp->oid_descr = malloc(len, M_SYSCTLOID, M_WAITOK); - if (oidp->oid_descr) - strcpy((char *)(uintptr_t)(const void *)oidp->oid_descr, descr); - } + if (descr) + oidp->oid_descr = strdup(descr, M_SYSCTLOID); /* Update the context, if used */ if (clist != NULL) sysctl_ctx_entry_add(clist, oidp); @@ -505,16 +495,12 @@ sysctl_add_oid(struct sysctl_ctx_list *c void sysctl_rename_oid(struct sysctl_oid *oidp, const char *name) { - ssize_t len; char *newname; - void *oldname; + char *oldname; - len = strlen(name); - newname = malloc(len + 1, M_SYSCTLOID, M_WAITOK); - bcopy(name, newname, len + 1); - newname[len] = '\0'; + newname = strdup(name, M_SYSCTLOID); SYSCTL_XLOCK(); - oldname = (void *)(uintptr_t)(const void *)oidp->oid_name; + oldname = __DECONST(char *, oidp->oid_name); oidp->oid_name = newname; SYSCTL_XUNLOCK(); free(oldname, M_SYSCTLOID); @@ -785,39 +771,26 @@ static SYSCTL_NODE(_sysctl, 2, next, CTL static int name2oid(char *name, int *oid, int *len, struct sysctl_oid **oidpp) { - int i; struct sysctl_oid *oidp; struct sysctl_oid_list *lsp = &sysctl__children; char *p; SYSCTL_ASSERT_XLOCKED(); - if (!*name) - return (ENOENT); + for (*len = 0; *len < CTL_MAXNAME;) { + p = strsep(&name, "."); - p = name + strlen(name) - 1 ; - if (*p == '.') - *p = '\0'; - - *len = 0; - - for (p = name; *p && *p != '.'; p++) - ; - i = *p; - if (i == '.') - *p = '\0'; - - oidp = SLIST_FIRST(lsp); - - while (oidp && *len < CTL_MAXNAME) { - if (strcmp(name, oidp->oid_name)) { - oidp = SLIST_NEXT(oidp, oid_link); - continue; + oidp = SLIST_FIRST(lsp); + for (;; oidp = SLIST_NEXT(oidp, oid_link)) { + if (oidp == NULL) + return (ENOENT); + if (strcmp(p, oidp->oid_name) == 0) + break; } *oid++ = oidp->oid_number; (*len)++; - if (!i) { + if (name == NULL || *name == '\0') { if (oidpp) *oidpp = oidp; return (0); @@ -830,13 +803,6 @@ name2oid(char *name, int *oid, int *len, break; lsp = SYSCTL_CHILDREN(oidp); - oidp = SLIST_FIRST(lsp); - name = p+1; - for (p = name; *p && *p != '.'; p++) - ; - i = *p; - if (i == '.') - *p = '\0'; } return (ENOENT); } From owner-svn-src-stable@FreeBSD.ORG Fri Mar 8 11:32:59 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 2CCFC28E; Fri, 8 Mar 2013 11:32:59 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 0E7FFA88; Fri, 8 Mar 2013 11:32:59 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r28BWwYx084534; Fri, 8 Mar 2013 11:32:58 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r28BWwkZ084532; Fri, 8 Mar 2013 11:32:58 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201303081132.r28BWwkZ084532@svn.freebsd.org> From: Marius Strobl Date: Fri, 8 Mar 2013 11:32:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r248036 - stable/9/sys/dev/bce X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Mar 2013 11:32:59 -0000 Author: marius Date: Fri Mar 8 11:32:58 2013 New Revision: 248036 URL: http://svnweb.freebsd.org/changeset/base/248036 Log: MFC: r247565, r247590 - Make tables, device ID strings etc const. - Use NULL instead of 0 for pointers. - Remove redundant bzero(9)'ing of the softc. - Remove redundant/unused softc members. - Don't allocate MSI/MSI-X as RF_SHAREABLE. - Re-use bus accessor macros instead of duplicating them. - In bce_miibus_{read,write}_reg(), remove superfluous limiting of the PHY address (missed in r213893). Modified: stable/9/sys/dev/bce/if_bce.c stable/9/sys/dev/bce/if_bcereg.h Directory Properties: stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) Modified: stable/9/sys/dev/bce/if_bce.c ============================================================================== --- stable/9/sys/dev/bce/if_bce.c Fri Mar 8 11:26:00 2013 (r248035) +++ stable/9/sys/dev/bce/if_bce.c Fri Mar 8 11:32:58 2013 (r248036) @@ -95,7 +95,7 @@ __FBSDID("$FreeBSD$"); /****************************************************************************/ #define BCE_DEVDESC_MAX 64 -static struct bce_type bce_devs[] = { +static const struct bce_type bce_devs[] = { /* BCM5706C Controllers and OEM boards. */ { BRCM_VENDORID, BRCM_DEVICEID_BCM5706, HP_VENDORID, 0x3101, "HP NC370T Multifunction Gigabit Server Adapter" }, @@ -161,7 +161,7 @@ static struct bce_type bce_devs[] = { /****************************************************************************/ /* Supported Flash NVRAM device data. */ /****************************************************************************/ -static struct flash_spec flash_table[] = +static const struct flash_spec flash_table[] = { #define BUFFERED_FLAGS (BCE_NV_BUFFERED | BCE_NV_TRANSLATE) #define NONBUFFERED_FLAGS (BCE_NV_WREN) @@ -258,7 +258,7 @@ static struct flash_spec flash_table[] = * logical-to-physical mapping is required in the * driver. */ -static struct flash_spec flash_5709 = { +static const struct flash_spec flash_5709 = { .flags = BCE_NV_BUFFERED, .page_bits = BCM5709_FLASH_PAGE_BITS, .page_size = BCM5709_FLASH_PAGE_SIZE, @@ -481,8 +481,8 @@ MODULE_DEPEND(bce, pci, 1, 1, 1); MODULE_DEPEND(bce, ether, 1, 1, 1); MODULE_DEPEND(bce, miibus, 1, 1, 1); -DRIVER_MODULE(bce, pci, bce_driver, bce_devclass, 0, 0); -DRIVER_MODULE(miibus, bce, miibus_driver, miibus_devclass, 0, 0); +DRIVER_MODULE(bce, pci, bce_driver, bce_devclass, NULL, NULL); +DRIVER_MODULE(miibus, bce, miibus_driver, miibus_devclass, NULL, NULL); /****************************************************************************/ @@ -647,7 +647,7 @@ SYSCTL_UINT(_hw_bce, OID_AUTO, rx_ticks, static int bce_probe(device_t dev) { - struct bce_type *t; + const struct bce_type *t; struct bce_softc *sc; char *descbuf; u16 vid = 0, did = 0, svid = 0, sdid = 0; @@ -655,7 +655,6 @@ bce_probe(device_t dev) t = bce_devs; sc = device_get_softc(dev); - bzero(sc, sizeof(struct bce_softc)); sc->bce_unit = device_get_unit(dev); sc->bce_dev = dev; @@ -1040,7 +1039,7 @@ bce_attach(device_t dev) struct bce_softc *sc; struct ifnet *ifp; u32 val; - int error, rid, rc = 0; + int count, error, rc = 0, rid; sc = device_get_softc(dev); sc->bce_dev = dev; @@ -1077,6 +1076,7 @@ bce_attach(device_t dev) bce_probe_pci_caps(dev, sc); rid = 1; + count = 0; #if 0 /* Try allocating MSI-X interrupts. */ if ((sc->bce_cap_flags & BCE_MSIX_CAPABLE_FLAG) && @@ -1084,14 +1084,14 @@ bce_attach(device_t dev) ((sc->bce_res_irq = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, RF_ACTIVE)) != NULL)) { - msi_needed = sc->bce_msi_count = 1; + msi_needed = count = 1; - if (((error = pci_alloc_msix(dev, &sc->bce_msi_count)) != 0) || - (sc->bce_msi_count != msi_needed)) { + if (((error = pci_alloc_msix(dev, &count)) != 0) || + (count != msi_needed)) { BCE_PRINTF("%s(%d): MSI-X allocation failed! Requested = %d," "Received = %d, error = %d\n", __FILE__, __LINE__, - msi_needed, sc->bce_msi_count, error); - sc->bce_msi_count = 0; + msi_needed, count, error); + count = 0; pci_release_msi(dev); bus_release_resource(dev, SYS_RES_MEMORY, rid, sc->bce_res_irq); @@ -1100,19 +1100,18 @@ bce_attach(device_t dev) DBPRINT(sc, BCE_INFO_LOAD, "%s(): Using MSI-X interrupt.\n", __FUNCTION__); sc->bce_flags |= BCE_USING_MSIX_FLAG; - sc->bce_intr = bce_intr; } } #endif /* Try allocating a MSI interrupt. */ if ((sc->bce_cap_flags & BCE_MSI_CAPABLE_FLAG) && - (bce_msi_enable >= 1) && (sc->bce_msi_count == 0)) { - sc->bce_msi_count = 1; - if ((error = pci_alloc_msi(dev, &sc->bce_msi_count)) != 0) { + (bce_msi_enable >= 1) && (count == 0)) { + count = 1; + if ((error = pci_alloc_msi(dev, &count)) != 0) { BCE_PRINTF("%s(%d): MSI allocation failed! " "error = %d\n", __FILE__, __LINE__, error); - sc->bce_msi_count = 0; + count = 0; pci_release_msi(dev); } else { DBPRINT(sc, BCE_INFO_LOAD, "%s(): Using MSI " @@ -1120,23 +1119,19 @@ bce_attach(device_t dev) sc->bce_flags |= BCE_USING_MSI_FLAG; if (BCE_CHIP_NUM(sc) == BCE_CHIP_NUM_5709) sc->bce_flags |= BCE_ONE_SHOT_MSI_FLAG; - sc->bce_irq_rid = 1; - sc->bce_intr = bce_intr; + rid = 1; } } /* Try allocating a legacy interrupt. */ - if (sc->bce_msi_count == 0) { + if (count == 0) { DBPRINT(sc, BCE_INFO_LOAD, "%s(): Using INTx interrupt.\n", __FUNCTION__); rid = 0; - sc->bce_intr = bce_intr; } sc->bce_res_irq = bus_alloc_resource_any(dev, SYS_RES_IRQ, - &rid, RF_SHAREABLE | RF_ACTIVE); - - sc->bce_irq_rid = rid; + &rid, RF_ACTIVE | (count != 0 ? 0 : RF_SHAREABLE)); /* Report any IRQ allocation errors. */ if (sc->bce_res_irq == NULL) { @@ -1635,7 +1630,7 @@ bce_shutdown(device_t dev) static u32 bce_reg_rd(struct bce_softc *sc, u32 offset) { - u32 val = bus_space_read_4(sc->bce_btag, sc->bce_bhandle, offset); + u32 val = REG_RD(sc, offset); DBPRINT(sc, BCE_INSANE_REG, "%s(); offset = 0x%08X, val = 0x%08X\n", __FUNCTION__, offset, val); return val; @@ -1653,7 +1648,7 @@ bce_reg_wr16(struct bce_softc *sc, u32 o { DBPRINT(sc, BCE_INSANE_REG, "%s(); offset = 0x%08X, val = 0x%04X\n", __FUNCTION__, offset, val); - bus_space_write_2(sc->bce_btag, sc->bce_bhandle, offset, val); + REG_WR16(sc, offset, val); } @@ -1668,7 +1663,7 @@ bce_reg_wr(struct bce_softc *sc, u32 off { DBPRINT(sc, BCE_INSANE_REG, "%s(); offset = 0x%08X, val = 0x%08X\n", __FUNCTION__, offset, val); - bus_space_write_4(sc->bce_btag, sc->bce_bhandle, offset, val); + REG_WR(sc, offset, val); } #endif @@ -1879,13 +1874,6 @@ bce_miibus_read_reg(device_t dev, int ph sc = device_get_softc(dev); - /* Make sure we are accessing the correct PHY address. */ - if (phy != sc->bce_phy_addr) { - DBPRINT(sc, BCE_INSANE_PHY, "Invalid PHY address %d " - "for PHY read!\n", phy); - return(0); - } - /* * The 5709S PHY is an IEEE Clause 45 PHY * with special mappings to work with IEEE @@ -1968,13 +1956,6 @@ bce_miibus_write_reg(device_t dev, int p sc = device_get_softc(dev); - /* Make sure we are accessing the correct PHY address. */ - if (phy != sc->bce_phy_addr) { - DBPRINT(sc, BCE_INSANE_PHY, "Invalid PHY address %d " - "for PHY write!\n", phy); - return(0); - } - DB_PRINT_PHY_REG(reg, val); /* @@ -2535,7 +2516,7 @@ bce_init_nvram(struct bce_softc *sc) { u32 val; int j, entry_count, rc = 0; - struct flash_spec *flash; + const struct flash_spec *flash; DBENTER(BCE_VERBOSE_NVRAM); @@ -3949,8 +3930,8 @@ bce_release_resources(struct bce_softc * if (sc->bce_res_irq != NULL) { DBPRINT(sc, BCE_INFO_RESET, "Releasing IRQ.\n"); - bus_release_resource(dev, SYS_RES_IRQ, sc->bce_irq_rid, - sc->bce_res_irq); + bus_release_resource(dev, SYS_RES_IRQ, + rman_get_rid(sc->bce_res_irq), sc->bce_res_irq); } if (sc->bce_flags & (BCE_USING_MSI_FLAG | BCE_USING_MSIX_FLAG)) { @@ -11650,4 +11631,3 @@ bce_breakpoint(struct bce_softc *sc) return; } #endif - Modified: stable/9/sys/dev/bce/if_bcereg.h ============================================================================== --- stable/9/sys/dev/bce/if_bcereg.h Fri Mar 8 11:26:00 2013 (r248035) +++ stable/9/sys/dev/bce/if_bcereg.h Fri Mar 8 11:32:58 2013 (r248036) @@ -623,7 +623,7 @@ struct bce_type { u_int16_t bce_did; u_int16_t bce_svid; u_int16_t bce_sdid; - char *bce_name; + const char *bce_name; }; /****************************************************************************/ @@ -717,7 +717,7 @@ struct flash_spec { u32 page_size; u32 addr_mask; u32 total_size; - u8 *name; + const u8 *name; }; @@ -2002,7 +2002,7 @@ struct l2_fhdr { #define BCE_MISC_ENABLE_CLR_BITS_UMP_ENABLE (1L<<27) #define BCE_MISC_ENABLE_CLR_BITS_RV2P_CMD_SCHEDULER_ENABLE (1L<<28) #define BCE_MISC_ENABLE_CLR_BITS_RSVD_FUTURE_ENABLE (0x7L<<29) - + #define BCE_MISC_ENABLE_CLR_DEFAULT 0x17ffffff #define BCE_MISC_CLOCK_CONTROL_BITS 0x00000818 @@ -6319,19 +6319,19 @@ struct fw_info { u32 text_addr; u32 text_len; u32 text_index; - u32 *text; + const u32 *text; /* Data section. */ u32 data_addr; u32 data_len; u32 data_index; - u32 *data; + const u32 *data; /* SBSS section. */ u32 sbss_addr; u32 sbss_len; u32 sbss_index; - u32 *sbss; + const u32 *sbss; /* BSS section. */ u32 bss_addr; @@ -6422,7 +6422,7 @@ struct fw_info { struct bce_softc { - /* Interface info. Must be first!! */ + /* Interface info */ struct ifnet *bce_ifp; /* Parent device handle */ @@ -6452,10 +6452,7 @@ struct bce_softc struct mtx bce_mtx; /* Interrupt handler. */ - driver_intr_t *bce_intr; void *bce_intrhand; - int bce_irq_rid; - int bce_msi_count; /* ASIC Chip ID. */ u32 bce_chipid; @@ -6510,7 +6507,7 @@ struct bce_softc u16 link_speed; /* Flash NVRAM settings */ - struct flash_spec *bce_flash_info; + const struct flash_spec *bce_flash_info; /* Flash NVRAM size */ u32 bce_flash_size; @@ -6519,7 +6516,7 @@ struct bce_softc u32 bce_shmem_base; /* Name string */ - char *bce_name; + const char *bce_name; /* Tracks the version of bootcode firmware. */ char bce_bc_ver[32]; @@ -6835,4 +6832,3 @@ struct bce_softc }; #endif /* __BCEREG_H_DEFINED */ - From owner-svn-src-stable@FreeBSD.ORG Fri Mar 8 11:33:03 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 44825291; Fri, 8 Mar 2013 11:33:03 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 2866EA8B; Fri, 8 Mar 2013 11:33:03 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r28BX3Ro084625; Fri, 8 Mar 2013 11:33:03 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r28BX229084620; Fri, 8 Mar 2013 11:33:02 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201303081133.r28BX229084620@svn.freebsd.org> From: Marius Strobl Date: Fri, 8 Mar 2013 11:33:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r248037 - stable/8/sys/dev/bce X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Mar 2013 11:33:03 -0000 Author: marius Date: Fri Mar 8 11:33:02 2013 New Revision: 248037 URL: http://svnweb.freebsd.org/changeset/base/248037 Log: MFC: r247565, r247590 - Make tables, device ID strings etc const. - Use NULL instead of 0 for pointers. - Remove redundant bzero(9)'ing of the softc. - Remove redundant/unused softc members. - Don't allocate MSI/MSI-X as RF_SHAREABLE. - Re-use bus accessor macros instead of duplicating them. - In bce_miibus_{read,write}_reg(), remove superfluous limiting of the PHY address (missed in r213893, which was MFC'ed to stable/8 in r214909). Modified: stable/8/sys/dev/bce/if_bce.c stable/8/sys/dev/bce/if_bcereg.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/dev/ (props changed) stable/8/sys/dev/bce/ (props changed) Modified: stable/8/sys/dev/bce/if_bce.c ============================================================================== --- stable/8/sys/dev/bce/if_bce.c Fri Mar 8 11:32:58 2013 (r248036) +++ stable/8/sys/dev/bce/if_bce.c Fri Mar 8 11:33:02 2013 (r248037) @@ -95,7 +95,7 @@ __FBSDID("$FreeBSD$"); /****************************************************************************/ #define BCE_DEVDESC_MAX 64 -static struct bce_type bce_devs[] = { +static const struct bce_type bce_devs[] = { /* BCM5706C Controllers and OEM boards. */ { BRCM_VENDORID, BRCM_DEVICEID_BCM5706, HP_VENDORID, 0x3101, "HP NC370T Multifunction Gigabit Server Adapter" }, @@ -161,7 +161,7 @@ static struct bce_type bce_devs[] = { /****************************************************************************/ /* Supported Flash NVRAM device data. */ /****************************************************************************/ -static struct flash_spec flash_table[] = +static const struct flash_spec flash_table[] = { #define BUFFERED_FLAGS (BCE_NV_BUFFERED | BCE_NV_TRANSLATE) #define NONBUFFERED_FLAGS (BCE_NV_WREN) @@ -258,7 +258,7 @@ static struct flash_spec flash_table[] = * logical-to-physical mapping is required in the * driver. */ -static struct flash_spec flash_5709 = { +static const struct flash_spec flash_5709 = { .flags = BCE_NV_BUFFERED, .page_bits = BCM5709_FLASH_PAGE_BITS, .page_size = BCM5709_FLASH_PAGE_SIZE, @@ -481,8 +481,8 @@ MODULE_DEPEND(bce, pci, 1, 1, 1); MODULE_DEPEND(bce, ether, 1, 1, 1); MODULE_DEPEND(bce, miibus, 1, 1, 1); -DRIVER_MODULE(bce, pci, bce_driver, bce_devclass, 0, 0); -DRIVER_MODULE(miibus, bce, miibus_driver, miibus_devclass, 0, 0); +DRIVER_MODULE(bce, pci, bce_driver, bce_devclass, NULL, NULL); +DRIVER_MODULE(miibus, bce, miibus_driver, miibus_devclass, NULL, NULL); /****************************************************************************/ @@ -647,7 +647,7 @@ SYSCTL_UINT(_hw_bce, OID_AUTO, rx_ticks, static int bce_probe(device_t dev) { - struct bce_type *t; + const struct bce_type *t; struct bce_softc *sc; char *descbuf; u16 vid = 0, did = 0, svid = 0, sdid = 0; @@ -655,7 +655,6 @@ bce_probe(device_t dev) t = bce_devs; sc = device_get_softc(dev); - bzero(sc, sizeof(struct bce_softc)); sc->bce_unit = device_get_unit(dev); sc->bce_dev = dev; @@ -1040,7 +1039,7 @@ bce_attach(device_t dev) struct bce_softc *sc; struct ifnet *ifp; u32 val; - int error, rid, rc = 0; + int count, error, rc = 0, rid; sc = device_get_softc(dev); sc->bce_dev = dev; @@ -1077,6 +1076,7 @@ bce_attach(device_t dev) bce_probe_pci_caps(dev, sc); rid = 1; + count = 0; #if 0 /* Try allocating MSI-X interrupts. */ if ((sc->bce_cap_flags & BCE_MSIX_CAPABLE_FLAG) && @@ -1084,14 +1084,14 @@ bce_attach(device_t dev) ((sc->bce_res_irq = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, RF_ACTIVE)) != NULL)) { - msi_needed = sc->bce_msi_count = 1; + msi_needed = count = 1; - if (((error = pci_alloc_msix(dev, &sc->bce_msi_count)) != 0) || - (sc->bce_msi_count != msi_needed)) { + if (((error = pci_alloc_msix(dev, &count)) != 0) || + (count != msi_needed)) { BCE_PRINTF("%s(%d): MSI-X allocation failed! Requested = %d," "Received = %d, error = %d\n", __FILE__, __LINE__, - msi_needed, sc->bce_msi_count, error); - sc->bce_msi_count = 0; + msi_needed, count, error); + count = 0; pci_release_msi(dev); bus_release_resource(dev, SYS_RES_MEMORY, rid, sc->bce_res_irq); @@ -1100,19 +1100,18 @@ bce_attach(device_t dev) DBPRINT(sc, BCE_INFO_LOAD, "%s(): Using MSI-X interrupt.\n", __FUNCTION__); sc->bce_flags |= BCE_USING_MSIX_FLAG; - sc->bce_intr = bce_intr; } } #endif /* Try allocating a MSI interrupt. */ if ((sc->bce_cap_flags & BCE_MSI_CAPABLE_FLAG) && - (bce_msi_enable >= 1) && (sc->bce_msi_count == 0)) { - sc->bce_msi_count = 1; - if ((error = pci_alloc_msi(dev, &sc->bce_msi_count)) != 0) { + (bce_msi_enable >= 1) && (count == 0)) { + count = 1; + if ((error = pci_alloc_msi(dev, &count)) != 0) { BCE_PRINTF("%s(%d): MSI allocation failed! " "error = %d\n", __FILE__, __LINE__, error); - sc->bce_msi_count = 0; + count = 0; pci_release_msi(dev); } else { DBPRINT(sc, BCE_INFO_LOAD, "%s(): Using MSI " @@ -1120,23 +1119,19 @@ bce_attach(device_t dev) sc->bce_flags |= BCE_USING_MSI_FLAG; if (BCE_CHIP_NUM(sc) == BCE_CHIP_NUM_5709) sc->bce_flags |= BCE_ONE_SHOT_MSI_FLAG; - sc->bce_irq_rid = 1; - sc->bce_intr = bce_intr; + rid = 1; } } /* Try allocating a legacy interrupt. */ - if (sc->bce_msi_count == 0) { + if (count == 0) { DBPRINT(sc, BCE_INFO_LOAD, "%s(): Using INTx interrupt.\n", __FUNCTION__); rid = 0; - sc->bce_intr = bce_intr; } sc->bce_res_irq = bus_alloc_resource_any(dev, SYS_RES_IRQ, - &rid, RF_SHAREABLE | RF_ACTIVE); - - sc->bce_irq_rid = rid; + &rid, RF_ACTIVE | (count != 0 ? 0 : RF_SHAREABLE)); /* Report any IRQ allocation errors. */ if (sc->bce_res_irq == NULL) { @@ -1635,7 +1630,7 @@ bce_shutdown(device_t dev) static u32 bce_reg_rd(struct bce_softc *sc, u32 offset) { - u32 val = bus_space_read_4(sc->bce_btag, sc->bce_bhandle, offset); + u32 val = REG_RD(sc, offset); DBPRINT(sc, BCE_INSANE_REG, "%s(); offset = 0x%08X, val = 0x%08X\n", __FUNCTION__, offset, val); return val; @@ -1653,7 +1648,7 @@ bce_reg_wr16(struct bce_softc *sc, u32 o { DBPRINT(sc, BCE_INSANE_REG, "%s(); offset = 0x%08X, val = 0x%04X\n", __FUNCTION__, offset, val); - bus_space_write_2(sc->bce_btag, sc->bce_bhandle, offset, val); + REG_WR16(sc, offset, val); } @@ -1668,7 +1663,7 @@ bce_reg_wr(struct bce_softc *sc, u32 off { DBPRINT(sc, BCE_INSANE_REG, "%s(); offset = 0x%08X, val = 0x%08X\n", __FUNCTION__, offset, val); - bus_space_write_4(sc->bce_btag, sc->bce_bhandle, offset, val); + REG_WR(sc, offset, val); } #endif @@ -1879,13 +1874,6 @@ bce_miibus_read_reg(device_t dev, int ph sc = device_get_softc(dev); - /* Make sure we are accessing the correct PHY address. */ - if (phy != sc->bce_phy_addr) { - DBPRINT(sc, BCE_INSANE_PHY, "Invalid PHY address %d " - "for PHY read!\n", phy); - return(0); - } - /* * The 5709S PHY is an IEEE Clause 45 PHY * with special mappings to work with IEEE @@ -1968,13 +1956,6 @@ bce_miibus_write_reg(device_t dev, int p sc = device_get_softc(dev); - /* Make sure we are accessing the correct PHY address. */ - if (phy != sc->bce_phy_addr) { - DBPRINT(sc, BCE_INSANE_PHY, "Invalid PHY address %d " - "for PHY write!\n", phy); - return(0); - } - DB_PRINT_PHY_REG(reg, val); /* @@ -2535,7 +2516,7 @@ bce_init_nvram(struct bce_softc *sc) { u32 val; int j, entry_count, rc = 0; - struct flash_spec *flash; + const struct flash_spec *flash; DBENTER(BCE_VERBOSE_NVRAM); @@ -3949,8 +3930,8 @@ bce_release_resources(struct bce_softc * if (sc->bce_res_irq != NULL) { DBPRINT(sc, BCE_INFO_RESET, "Releasing IRQ.\n"); - bus_release_resource(dev, SYS_RES_IRQ, sc->bce_irq_rid, - sc->bce_res_irq); + bus_release_resource(dev, SYS_RES_IRQ, + rman_get_rid(sc->bce_res_irq), sc->bce_res_irq); } if (sc->bce_flags & (BCE_USING_MSI_FLAG | BCE_USING_MSIX_FLAG)) { @@ -11650,4 +11631,3 @@ bce_breakpoint(struct bce_softc *sc) return; } #endif - Modified: stable/8/sys/dev/bce/if_bcereg.h ============================================================================== --- stable/8/sys/dev/bce/if_bcereg.h Fri Mar 8 11:32:58 2013 (r248036) +++ stable/8/sys/dev/bce/if_bcereg.h Fri Mar 8 11:33:02 2013 (r248037) @@ -623,7 +623,7 @@ struct bce_type { u_int16_t bce_did; u_int16_t bce_svid; u_int16_t bce_sdid; - char *bce_name; + const char *bce_name; }; /****************************************************************************/ @@ -717,7 +717,7 @@ struct flash_spec { u32 page_size; u32 addr_mask; u32 total_size; - u8 *name; + const u8 *name; }; @@ -2002,7 +2002,7 @@ struct l2_fhdr { #define BCE_MISC_ENABLE_CLR_BITS_UMP_ENABLE (1L<<27) #define BCE_MISC_ENABLE_CLR_BITS_RV2P_CMD_SCHEDULER_ENABLE (1L<<28) #define BCE_MISC_ENABLE_CLR_BITS_RSVD_FUTURE_ENABLE (0x7L<<29) - + #define BCE_MISC_ENABLE_CLR_DEFAULT 0x17ffffff #define BCE_MISC_CLOCK_CONTROL_BITS 0x00000818 @@ -6319,19 +6319,19 @@ struct fw_info { u32 text_addr; u32 text_len; u32 text_index; - u32 *text; + const u32 *text; /* Data section. */ u32 data_addr; u32 data_len; u32 data_index; - u32 *data; + const u32 *data; /* SBSS section. */ u32 sbss_addr; u32 sbss_len; u32 sbss_index; - u32 *sbss; + const u32 *sbss; /* BSS section. */ u32 bss_addr; @@ -6422,7 +6422,7 @@ struct fw_info { struct bce_softc { - /* Interface info. Must be first!! */ + /* Interface info */ struct ifnet *bce_ifp; /* Parent device handle */ @@ -6452,10 +6452,7 @@ struct bce_softc struct mtx bce_mtx; /* Interrupt handler. */ - driver_intr_t *bce_intr; void *bce_intrhand; - int bce_irq_rid; - int bce_msi_count; /* ASIC Chip ID. */ u32 bce_chipid; @@ -6510,7 +6507,7 @@ struct bce_softc u16 link_speed; /* Flash NVRAM settings */ - struct flash_spec *bce_flash_info; + const struct flash_spec *bce_flash_info; /* Flash NVRAM size */ u32 bce_flash_size; @@ -6519,7 +6516,7 @@ struct bce_softc u32 bce_shmem_base; /* Name string */ - char *bce_name; + const char *bce_name; /* Tracks the version of bootcode firmware. */ char bce_bc_ver[32]; @@ -6835,4 +6832,3 @@ struct bce_softc }; #endif /* __BCEREG_H_DEFINED */ - From owner-svn-src-stable@FreeBSD.ORG Fri Mar 8 11:41:48 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id D3E256B0; Fri, 8 Mar 2013 11:41:48 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id B76CFAD0; Fri, 8 Mar 2013 11:41:48 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r28BfmWK087431; Fri, 8 Mar 2013 11:41:48 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r28BfmRt087429; Fri, 8 Mar 2013 11:41:48 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201303081141.r28BfmRt087429@svn.freebsd.org> From: Marius Strobl Date: Fri, 8 Mar 2013 11:41:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r248038 - stable/9/sys/dev/puc X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Mar 2013 11:41:48 -0000 Author: marius Date: Fri Mar 8 11:41:48 2013 New Revision: 248038 URL: http://svnweb.freebsd.org/changeset/base/248038 Log: MFC: r247571 - Apparently, r186520 was just wrong and the clock of Oxford OX16PCI958 is neither DEFAULT_RCLK * 2 nor DEFAULT_RCLK * 10 but plain DEFAULT_RCLK and there's no (open) source indicating otherwise. This was tested with an EXSYS EX-41098-2, whose clock is not configurable and identifies as: puc0@pci0:5:1:0: class=0x070200 card=0x06711415 chip=0x95381415 rev=0x01 hdr=0x00 vendor = 'Oxford Semiconductor Ltd' class = simple comms subclass = multiport serial Note that this exactly matches the card mentioned in PR 129665 so no sub-device/sub-vendor based quirking of the latter is possible. So maybe we should grow some sort of tunable, in case non-default cards such as the latter aren't configurable either (this also wouldn't be the first time an allegedly tested commit turns out to be wrong though). - Make the TiMedia tables const. Modified: stable/9/sys/dev/puc/pucdata.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) stable/9/sys/dev/puc/ (props changed) Modified: stable/9/sys/dev/puc/pucdata.c ============================================================================== --- stable/9/sys/dev/puc/pucdata.c Fri Mar 8 11:33:02 2013 (r248037) +++ stable/9/sys/dev/puc/pucdata.c Fri Mar 8 11:41:48 2013 (r248038) @@ -769,7 +769,7 @@ const struct puc_cfg puc_pci_devices[] = { 0x1415, 0x9538, 0xffff, 0, "Oxford Semiconductor OX16PCI958 UARTs", - DEFAULT_RCLK * 10, + DEFAULT_RCLK, PUC_PORT_8S, 0x18, 0, 8, }, @@ -918,6 +918,7 @@ const struct puc_cfg puc_pci_devices[] = DEFAULT_RCLK * 8, PUC_PORT_4S, 0x10, 0, 8, }, + { 0x14d2, 0xa004, 0xffff, 0, "Titan PCI-800H", DEFAULT_RCLK * 8, @@ -1054,7 +1055,7 @@ const struct puc_cfg puc_pci_devices[] = { 0x9710, 0x9865, 0xa000, 0x3004, "NetMos NM9865 Quad UART", DEFAULT_RCLK, - PUC_PORT_4S, 0x10, 4, 0,0 + PUC_PORT_4S, 0x10, 4, 0, }, { 0x9710, 0x9865, 0xa000, 0x3011, @@ -1414,26 +1415,26 @@ static int puc_config_timedia(struct puc_softc *sc, enum puc_cfg_cmd cmd, int port, intptr_t *res) { - static uint16_t dual[] = { + static const uint16_t dual[] = { 0x0002, 0x4036, 0x4037, 0x4038, 0x4078, 0x4079, 0x4085, 0x4088, 0x4089, 0x5037, 0x5078, 0x5079, 0x5085, 0x6079, 0x7079, 0x8079, 0x8137, 0x8138, 0x8237, 0x8238, 0x9079, 0x9137, 0x9138, 0x9237, 0x9238, 0xA079, 0xB079, 0xC079, 0xD079, 0 }; - static uint16_t quad[] = { + static const uint16_t quad[] = { 0x4055, 0x4056, 0x4095, 0x4096, 0x5056, 0x8156, 0x8157, 0x8256, 0x8257, 0x9056, 0x9156, 0x9157, 0x9158, 0x9159, 0x9256, 0x9257, 0xA056, 0xA157, 0xA158, 0xA159, 0xB056, 0xB157, 0 }; - static uint16_t octa[] = { + static const uint16_t octa[] = { 0x4065, 0x4066, 0x5065, 0x5066, 0x8166, 0x9066, 0x9166, 0x9167, 0x9168, 0xA066, 0xA167, 0xA168, 0 }; - static struct { + static const struct { int ports; - uint16_t *ids; + const uint16_t *ids; } subdevs[] = { { 2, dual }, { 4, quad }, From owner-svn-src-stable@FreeBSD.ORG Fri Mar 8 11:41:53 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id B58496BA; Fri, 8 Mar 2013 11:41:53 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 3849DAD3; Fri, 8 Mar 2013 11:41:53 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r28BfrHb087472; Fri, 8 Mar 2013 11:41:53 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r28BfrL1087471; Fri, 8 Mar 2013 11:41:53 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201303081141.r28BfrL1087471@svn.freebsd.org> From: Marius Strobl Date: Fri, 8 Mar 2013 11:41:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r248039 - stable/8/sys/dev/puc X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Mar 2013 11:41:53 -0000 Author: marius Date: Fri Mar 8 11:41:52 2013 New Revision: 248039 URL: http://svnweb.freebsd.org/changeset/base/248039 Log: MFC: r247571 - Apparently, r186520 was just wrong and the clock of Oxford OX16PCI958 is neither DEFAULT_RCLK * 2 nor DEFAULT_RCLK * 10 but plain DEFAULT_RCLK and there's no (open) source indicating otherwise. This was tested with an EXSYS EX-41098-2, whose clock is not configurable and identifies as: puc0@pci0:5:1:0: class=0x070200 card=0x06711415 chip=0x95381415 rev=0x01 hdr=0x00 vendor = 'Oxford Semiconductor Ltd' class = simple comms subclass = multiport serial Note that this exactly matches the card mentioned in PR 129665 so no sub-device/sub-vendor based quirking of the latter is possible. So maybe we should grow some sort of tunable, in case non-default cards such as the latter aren't configurable either (this also wouldn't be the first time an allegedly tested commit turns out to be wrong though). - Make the TiMedia tables const. Modified: stable/8/sys/dev/puc/pucdata.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/dev/ (props changed) stable/8/sys/dev/puc/ (props changed) Modified: stable/8/sys/dev/puc/pucdata.c ============================================================================== --- stable/8/sys/dev/puc/pucdata.c Fri Mar 8 11:41:48 2013 (r248038) +++ stable/8/sys/dev/puc/pucdata.c Fri Mar 8 11:41:52 2013 (r248039) @@ -769,7 +769,7 @@ const struct puc_cfg puc_pci_devices[] = { 0x1415, 0x9538, 0xffff, 0, "Oxford Semiconductor OX16PCI958 UARTs", - DEFAULT_RCLK * 10, + DEFAULT_RCLK, PUC_PORT_8S, 0x18, 0, 8, }, @@ -893,6 +893,7 @@ const struct puc_cfg puc_pci_devices[] = DEFAULT_RCLK * 8, PUC_PORT_4S, 0x10, 0, 8, }, + { 0x14d2, 0xa004, 0xffff, 0, "Titan PCI-800H", DEFAULT_RCLK * 8, @@ -1029,7 +1030,7 @@ const struct puc_cfg puc_pci_devices[] = { 0x9710, 0x9865, 0xa000, 0x3004, "NetMos NM9865 Quad UART", DEFAULT_RCLK, - PUC_PORT_4S, 0x10, 4, 0,0 + PUC_PORT_4S, 0x10, 4, 0, }, { 0x9710, 0x9865, 0xa000, 0x3011, @@ -1389,26 +1390,26 @@ static int puc_config_timedia(struct puc_softc *sc, enum puc_cfg_cmd cmd, int port, intptr_t *res) { - static uint16_t dual[] = { + static const uint16_t dual[] = { 0x0002, 0x4036, 0x4037, 0x4038, 0x4078, 0x4079, 0x4085, 0x4088, 0x4089, 0x5037, 0x5078, 0x5079, 0x5085, 0x6079, 0x7079, 0x8079, 0x8137, 0x8138, 0x8237, 0x8238, 0x9079, 0x9137, 0x9138, 0x9237, 0x9238, 0xA079, 0xB079, 0xC079, 0xD079, 0 }; - static uint16_t quad[] = { + static const uint16_t quad[] = { 0x4055, 0x4056, 0x4095, 0x4096, 0x5056, 0x8156, 0x8157, 0x8256, 0x8257, 0x9056, 0x9156, 0x9157, 0x9158, 0x9159, 0x9256, 0x9257, 0xA056, 0xA157, 0xA158, 0xA159, 0xB056, 0xB157, 0 }; - static uint16_t octa[] = { + static const uint16_t octa[] = { 0x4065, 0x4066, 0x5065, 0x5066, 0x8166, 0x9066, 0x9166, 0x9167, 0x9168, 0xA066, 0xA167, 0xA168, 0 }; - static struct { + static const struct { int ports; - uint16_t *ids; + const uint16_t *ids; } subdevs[] = { { 2, dual }, { 4, quad }, From owner-svn-src-stable@FreeBSD.ORG Fri Mar 8 12:08:53 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id C8E07FCA; Fri, 8 Mar 2013 12:08:53 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id A2F7FCF4; Fri, 8 Mar 2013 12:08:53 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r28C8qRn094718; Fri, 8 Mar 2013 12:08:52 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r28C8qiE094717; Fri, 8 Mar 2013 12:08:52 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201303081208.r28C8qiE094717@svn.freebsd.org> From: Marius Strobl Date: Fri, 8 Mar 2013 12:08:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r248040 - stable/9/sys/dev/puc X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Mar 2013 12:08:53 -0000 Author: marius Date: Fri Mar 8 12:08:52 2013 New Revision: 248040 URL: http://svnweb.freebsd.org/changeset/base/248040 Log: MFC: r236736 Add support for the Sunix SER5437A dual serial PCI Express card. Modified: stable/9/sys/dev/puc/pucdata.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) stable/9/sys/dev/puc/ (props changed) Modified: stable/9/sys/dev/puc/pucdata.c ============================================================================== --- stable/9/sys/dev/puc/pucdata.c Fri Mar 8 11:41:52 2013 (r248039) +++ stable/9/sys/dev/puc/pucdata.c Fri Mar 8 12:08:52 2013 (r248040) @@ -974,6 +974,12 @@ const struct puc_cfg puc_pci_devices[] = .config_function = puc_config_syba }, + { 0x1fd4, 0x1999, 0xffff, 0, + "Sunix SER5437A", + DEFAULT_RCLK * 8, + PUC_PORT_2S, 0x10, 0, 8, + }, + { 0x5372, 0x6873, 0xffff, 0, "Sun 1040 PCI Quad Serial", DEFAULT_RCLK, From owner-svn-src-stable@FreeBSD.ORG Fri Mar 8 12:09:12 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id A53061C2; Fri, 8 Mar 2013 12:09:12 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 96EFBCF7; Fri, 8 Mar 2013 12:09:12 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r28C9Cok094825; Fri, 8 Mar 2013 12:09:12 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r28C9CxD094824; Fri, 8 Mar 2013 12:09:12 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201303081209.r28C9CxD094824@svn.freebsd.org> From: Marius Strobl Date: Fri, 8 Mar 2013 12:09:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r248041 - stable/8/sys/dev/puc X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Mar 2013 12:09:12 -0000 Author: marius Date: Fri Mar 8 12:09:12 2013 New Revision: 248041 URL: http://svnweb.freebsd.org/changeset/base/248041 Log: MFC: r236736 Add support for the Sunix SER5437A dual serial PCI Express card. MFC: r239048 Add additional Perle Speed LE serial cards PR: kern/168816 Submitted by: Dennis Oyama Modified: stable/8/sys/dev/puc/pucdata.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/dev/ (props changed) stable/8/sys/dev/puc/ (props changed) Modified: stable/8/sys/dev/puc/pucdata.c ============================================================================== --- stable/8/sys/dev/puc/pucdata.c Fri Mar 8 12:08:52 2013 (r248040) +++ stable/8/sys/dev/puc/pucdata.c Fri Mar 8 12:09:12 2013 (r248041) @@ -780,11 +780,36 @@ const struct puc_cfg puc_pci_devices[] = */ { 0x155f, 0x0331, 0xffff, 0, + "Perle Ultraport4 Express", + DEFAULT_RCLK * 8, + PUC_PORT_4S, 0x10, 0, 8, + }, + + { 0x155f, 0xB012, 0xffff, 0, + "Perle Speed2 LE", + DEFAULT_RCLK * 8, + PUC_PORT_2S, 0x10, 0, 8, + }, + + { 0x155f, 0xB022, 0xffff, 0, + "Perle Speed2 LE", + DEFAULT_RCLK * 8, + PUC_PORT_2S, 0x10, 0, 8, + }, + + { 0x155f, 0xB004, 0xffff, 0, "Perle Speed4 LE", DEFAULT_RCLK * 8, PUC_PORT_4S, 0x10, 0, 8, }, + { 0x155f, 0xB008, 0xffff, 0, + "Perle Speed8 LE", + DEFAULT_RCLK * 8, + PUC_PORT_8S, 0x10, 0, 8, + }, + + /* * Oxford Semiconductor PCI Express Expresso family * @@ -949,6 +974,12 @@ const struct puc_cfg puc_pci_devices[] = .config_function = puc_config_syba }, + { 0x1fd4, 0x1999, 0xffff, 0, + "Sunix SER5437A", + DEFAULT_RCLK * 8, + PUC_PORT_2S, 0x10, 0, 8, + }, + { 0x5372, 0x6873, 0xffff, 0, "Sun 1040 PCI Quad Serial", DEFAULT_RCLK, From owner-svn-src-stable@FreeBSD.ORG Fri Mar 8 12:11:38 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 2BCB13F9; Fri, 8 Mar 2013 12:11:38 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 1C6ECD1F; Fri, 8 Mar 2013 12:11:38 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r28CBbFl096981; Fri, 8 Mar 2013 12:11:38 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r28CBbpJ096980; Fri, 8 Mar 2013 12:11:37 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201303081211.r28CBbpJ096980@svn.freebsd.org> From: Marius Strobl Date: Fri, 8 Mar 2013 12:11:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r248042 - stable/9/sys/sparc64/pci X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Mar 2013 12:11:38 -0000 Author: marius Date: Fri Mar 8 12:11:37 2013 New Revision: 248042 URL: http://svnweb.freebsd.org/changeset/base/248042 Log: MFC: r247573 - Remove an unused header. - Use NULL instead of 0 for pointers. - Let ofw_pcib_probe() return BUS_PROBE_DEFAULT instead of 0 so specialized PCI-PCI-bridge drivers may attach instead. - Add WARs for PLX Technology PEX 8114 bridges and PEX 8532 switches. Ideally, these should live in MI code but at least for the latter we're missing the necessary infrastructure there. Modified: stable/9/sys/sparc64/pci/ofw_pcib.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/sparc64/pci/ofw_pcib.c ============================================================================== --- stable/9/sys/sparc64/pci/ofw_pcib.c Fri Mar 8 12:09:12 2013 (r248041) +++ stable/9/sys/sparc64/pci/ofw_pcib.c Fri Mar 8 12:11:37 2013 (r248042) @@ -47,8 +47,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include - #include #include #include @@ -58,8 +56,12 @@ __FBSDID("$FreeBSD$"); #include #include +#define PCI_DEVID_ALI_M5249 0x524910b9 +#define PCI_VENDOR_PLX 0x10b5 + static device_probe_t ofw_pcib_probe; static device_attach_t ofw_pcib_attach; +static ofw_pci_setup_device_t ofw_pcib_setup_device; static device_method_t ofw_pcib_methods[] = { /* Device interface */ @@ -73,6 +75,7 @@ static device_method_t ofw_pcib_methods[ /* ofw_bus interface */ DEVMETHOD(ofw_bus_get_node, ofw_pcib_gen_get_node), + DEVMETHOD(ofw_pci_setup_device, ofw_pcib_setup_device), DEVMETHOD_END }; @@ -81,7 +84,7 @@ static devclass_t pcib_devclass; DEFINE_CLASS_1(pcib, ofw_pcib_driver, ofw_pcib_methods, sizeof(struct ofw_pcib_gen_softc), pcib_driver); -EARLY_DRIVER_MODULE(ofw_pcib, pci, ofw_pcib_driver, pcib_devclass, 0, 0, +EARLY_DRIVER_MODULE(ofw_pcib, pci, ofw_pcib_driver, pcib_devclass, NULL, NULL, BUS_PASS_BUS); MODULE_DEPEND(ofw_pcib, pci, 1, 1, 1); @@ -104,7 +107,7 @@ ofw_pcib_probe(device_t dev) ISDTYPE(pbdtype, OFW_TYPE_PCIE) ? "e" : "", ISDTYPE(dtype, OFW_TYPE_PCIE) ? "e" : ""); device_set_desc_copy(dev, desc); - return (0); + return (BUS_PROBE_DEFAULT); } #undef ISDTYPE @@ -119,7 +122,6 @@ ofw_pcib_attach(device_t dev) sc = device_get_softc(dev); - /* Quirk handling */ switch (pci_get_devid(dev)) { /* * The ALi M5249 found in Fire-based machines by definition must me @@ -127,13 +129,46 @@ ofw_pcib_attach(device_t dev) * don't indicate this in the class code although the ISA I/O range * isn't included in their bridge decode. */ - case 0x524910b9: + case PCI_DEVID_ALI_M5249: sc->ops_pcib_sc.flags |= PCIB_SUBTRACTIVE; break; } + switch (pci_get_vendor(dev)) { + /* + * Concurrently write the primary and secondary bus numbers in order + * to work around a bug in PLX PEX 8114 causing the internal shadow + * copies of these not to be updated when setting them bytewise. + */ + case PCI_VENDOR_PLX: + pci_write_config(dev, PCIR_PRIBUS_1, + pci_read_config(dev, PCIR_SECBUS_1, 1) << 8 | + pci_read_config(dev, PCIR_PRIBUS_1, 1), 2); + break; + } + ofw_pcib_gen_setup(dev); pcib_attach_common(dev); device_add_child(dev, "pci", -1); return (bus_generic_attach(dev)); } + +static void +ofw_pcib_setup_device(device_t bus, device_t child) +{ + int i; + uint16_t reg; + + switch (pci_get_vendor(bus)) { + /* + * For PLX PEX 8532 issue 64 TLPs to the child from the downstream + * port to the child device in order to work around a hardware bug. + */ + case PCI_VENDOR_PLX: + for (i = 0, reg = 0; i < 64; i++) + reg |= pci_get_devid(child); + break; + } + + OFW_PCI_SETUP_DEVICE(device_get_parent(bus), child); +} From owner-svn-src-stable@FreeBSD.ORG Fri Mar 8 12:11:42 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 3A58C3FA; Fri, 8 Mar 2013 12:11:42 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 218ADD21; Fri, 8 Mar 2013 12:11:42 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r28CBglS097024; Fri, 8 Mar 2013 12:11:42 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r28CBfXP097023; Fri, 8 Mar 2013 12:11:41 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201303081211.r28CBfXP097023@svn.freebsd.org> From: Marius Strobl Date: Fri, 8 Mar 2013 12:11:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r248043 - stable/8/sys/sparc64/pci X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Mar 2013 12:11:42 -0000 Author: marius Date: Fri Mar 8 12:11:41 2013 New Revision: 248043 URL: http://svnweb.freebsd.org/changeset/base/248043 Log: MFC: r247573 - Remove an unused header. - Use NULL instead of 0 for pointers. - Let ofw_pcib_probe() return BUS_PROBE_DEFAULT instead of 0 so specialized PCI-PCI-bridge drivers may attach instead. - Add WARs for PLX Technology PEX 8114 bridges and PEX 8532 switches. Ideally, these should live in MI code but at least for the latter we're missing the necessary infrastructure there. Modified: stable/8/sys/sparc64/pci/ofw_pcib.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/sparc64/ (props changed) Modified: stable/8/sys/sparc64/pci/ofw_pcib.c ============================================================================== --- stable/8/sys/sparc64/pci/ofw_pcib.c Fri Mar 8 12:11:37 2013 (r248042) +++ stable/8/sys/sparc64/pci/ofw_pcib.c Fri Mar 8 12:11:41 2013 (r248043) @@ -47,8 +47,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include - #include #include #include @@ -58,8 +56,12 @@ __FBSDID("$FreeBSD$"); #include #include +#define PCI_DEVID_ALI_M5249 0x524910b9 +#define PCI_VENDOR_PLX 0x10b5 + static device_probe_t ofw_pcib_probe; static device_attach_t ofw_pcib_attach; +static ofw_pci_setup_device_t ofw_pcib_setup_device; static device_method_t ofw_pcib_methods[] = { /* Device interface */ @@ -73,6 +75,7 @@ static device_method_t ofw_pcib_methods[ /* ofw_bus interface */ DEVMETHOD(ofw_bus_get_node, ofw_pcib_gen_get_node), + DEVMETHOD(ofw_pci_setup_device, ofw_pcib_setup_device), DEVMETHOD_END }; @@ -81,7 +84,7 @@ static devclass_t pcib_devclass; DEFINE_CLASS_1(pcib, ofw_pcib_driver, ofw_pcib_methods, sizeof(struct ofw_pcib_gen_softc), pcib_driver); -EARLY_DRIVER_MODULE(ofw_pcib, pci, ofw_pcib_driver, pcib_devclass, 0, 0, +EARLY_DRIVER_MODULE(ofw_pcib, pci, ofw_pcib_driver, pcib_devclass, NULL, NULL, BUS_PASS_BUS); MODULE_DEPEND(ofw_pcib, pci, 1, 1, 1); @@ -104,7 +107,7 @@ ofw_pcib_probe(device_t dev) ISDTYPE(pbdtype, OFW_TYPE_PCIE) ? "e" : "", ISDTYPE(dtype, OFW_TYPE_PCIE) ? "e" : ""); device_set_desc_copy(dev, desc); - return (0); + return (BUS_PROBE_DEFAULT); } #undef ISDTYPE @@ -119,7 +122,6 @@ ofw_pcib_attach(device_t dev) sc = device_get_softc(dev); - /* Quirk handling */ switch (pci_get_devid(dev)) { /* * The ALi M5249 found in Fire-based machines by definition must me @@ -127,13 +129,46 @@ ofw_pcib_attach(device_t dev) * don't indicate this in the class code although the ISA I/O range * isn't included in their bridge decode. */ - case 0x524910b9: + case PCI_DEVID_ALI_M5249: sc->ops_pcib_sc.flags |= PCIB_SUBTRACTIVE; break; } + switch (pci_get_vendor(dev)) { + /* + * Concurrently write the primary and secondary bus numbers in order + * to work around a bug in PLX PEX 8114 causing the internal shadow + * copies of these not to be updated when setting them bytewise. + */ + case PCI_VENDOR_PLX: + pci_write_config(dev, PCIR_PRIBUS_1, + pci_read_config(dev, PCIR_SECBUS_1, 1) << 8 | + pci_read_config(dev, PCIR_PRIBUS_1, 1), 2); + break; + } + ofw_pcib_gen_setup(dev); pcib_attach_common(dev); device_add_child(dev, "pci", -1); return (bus_generic_attach(dev)); } + +static void +ofw_pcib_setup_device(device_t bus, device_t child) +{ + int i; + uint16_t reg; + + switch (pci_get_vendor(bus)) { + /* + * For PLX PEX 8532 issue 64 TLPs to the child from the downstream + * port to the child device in order to work around a hardware bug. + */ + case PCI_VENDOR_PLX: + for (i = 0, reg = 0; i < 64; i++) + reg |= pci_get_devid(child); + break; + } + + OFW_PCI_SETUP_DEVICE(device_get_parent(bus), child); +} From owner-svn-src-stable@FreeBSD.ORG Fri Mar 8 12:13:30 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id E04936D1; Fri, 8 Mar 2013 12:13:30 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id C30F8D32; Fri, 8 Mar 2013 12:13:30 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r28CDU2D097411; Fri, 8 Mar 2013 12:13:30 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r28CDUgb097409; Fri, 8 Mar 2013 12:13:30 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201303081213.r28CDUgb097409@svn.freebsd.org> From: Marius Strobl Date: Fri, 8 Mar 2013 12:13:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r248044 - stable/9/sys/sparc64/pci X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Mar 2013 12:13:31 -0000 Author: marius Date: Fri Mar 8 12:13:30 2013 New Revision: 248044 URL: http://svnweb.freebsd.org/changeset/base/248044 Log: MFC: r247574 - In sbbc_pci_attach() just pass the already obtained bus tag and handle instead of acquiring these anew. - Use NULL instead of 0 for pointers. Modified: stable/9/sys/sparc64/pci/sbbc.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/sparc64/pci/sbbc.c ============================================================================== --- stable/9/sys/sparc64/pci/sbbc.c Fri Mar 8 12:11:41 2013 (r248043) +++ stable/9/sys/sparc64/pci/sbbc.c Fri Mar 8 12:13:30 2013 (r248044) @@ -299,7 +299,7 @@ static device_method_t sbbc_pci_methods[ static devclass_t sbbc_devclass; DEFINE_CLASS_0(sbbc, sbbc_driver, sbbc_pci_methods, sizeof(struct sbbc_softc)); -DRIVER_MODULE(sbbc, pci, sbbc_driver, sbbc_devclass, 0, 0); +DRIVER_MODULE(sbbc, pci, sbbc_driver, sbbc_devclass, NULL, NULL); static int sbbc_pci_probe(device_t dev) @@ -358,8 +358,7 @@ sbbc_pci_attach(device_t dev) if (error != 0) device_printf(dev, "failed to attach UART device\n"); } else { - error = sbbc_parse_toc(rman_get_bustag(sc->sc_res), - rman_get_bushandle(sc->sc_res)); + error = sbbc_parse_toc(bst, bsh); if (error != 0) { device_printf(dev, "failed to parse TOC\n"); if (sbbc_console != 0) { @@ -609,7 +608,7 @@ static device_method_t sbbc_uart_sbbc_me DEFINE_CLASS_0(uart, sbbc_uart_driver, sbbc_uart_sbbc_methods, sizeof(struct uart_softc)); -DRIVER_MODULE(uart, sbbc, sbbc_uart_driver, uart_devclass, 0, 0); +DRIVER_MODULE(uart, sbbc, sbbc_uart_driver, uart_devclass, NULL, NULL); static int sbbc_uart_sbbc_probe(device_t dev) From owner-svn-src-stable@FreeBSD.ORG Fri Mar 8 12:13:33 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id BC6DD6D2; Fri, 8 Mar 2013 12:13:33 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 966E6D33; Fri, 8 Mar 2013 12:13:33 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r28CDXJ4097450; Fri, 8 Mar 2013 12:13:33 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r28CDXpT097449; Fri, 8 Mar 2013 12:13:33 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201303081213.r28CDXpT097449@svn.freebsd.org> From: Marius Strobl Date: Fri, 8 Mar 2013 12:13:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r248045 - stable/8/sys/sparc64/pci X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Mar 2013 12:13:33 -0000 Author: marius Date: Fri Mar 8 12:13:33 2013 New Revision: 248045 URL: http://svnweb.freebsd.org/changeset/base/248045 Log: MFC: r247574 - In sbbc_pci_attach() just pass the already obtained bus tag and handle instead of acquiring these anew. - Use NULL instead of 0 for pointers. Modified: stable/8/sys/sparc64/pci/sbbc.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/sparc64/ (props changed) Modified: stable/8/sys/sparc64/pci/sbbc.c ============================================================================== --- stable/8/sys/sparc64/pci/sbbc.c Fri Mar 8 12:13:30 2013 (r248044) +++ stable/8/sys/sparc64/pci/sbbc.c Fri Mar 8 12:13:33 2013 (r248045) @@ -299,7 +299,7 @@ static device_method_t sbbc_pci_methods[ static devclass_t sbbc_devclass; DEFINE_CLASS_0(sbbc, sbbc_driver, sbbc_pci_methods, sizeof(struct sbbc_softc)); -DRIVER_MODULE(sbbc, pci, sbbc_driver, sbbc_devclass, 0, 0); +DRIVER_MODULE(sbbc, pci, sbbc_driver, sbbc_devclass, NULL, NULL); static int sbbc_pci_probe(device_t dev) @@ -358,8 +358,7 @@ sbbc_pci_attach(device_t dev) if (error != 0) device_printf(dev, "failed to attach UART device\n"); } else { - error = sbbc_parse_toc(rman_get_bustag(sc->sc_res), - rman_get_bushandle(sc->sc_res)); + error = sbbc_parse_toc(bst, bsh); if (error != 0) { device_printf(dev, "failed to parse TOC\n"); if (sbbc_console != 0) { @@ -609,7 +608,7 @@ static device_method_t sbbc_uart_sbbc_me DEFINE_CLASS_0(uart, sbbc_uart_driver, sbbc_uart_sbbc_methods, sizeof(struct uart_softc)); -DRIVER_MODULE(uart, sbbc, sbbc_uart_driver, uart_devclass, 0, 0); +DRIVER_MODULE(uart, sbbc, sbbc_uart_driver, uart_devclass, NULL, NULL); static int sbbc_uart_sbbc_probe(device_t dev) From owner-svn-src-stable@FreeBSD.ORG Fri Mar 8 12:44:09 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 0767C15B; Fri, 8 Mar 2013 12:44:09 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id D4302E94; Fri, 8 Mar 2013 12:44:08 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r28Ci8ui006648; Fri, 8 Mar 2013 12:44:08 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r28Ci8kk006647; Fri, 8 Mar 2013 12:44:08 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201303081244.r28Ci8kk006647@svn.freebsd.org> From: Marius Strobl Date: Fri, 8 Mar 2013 12:44:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r248046 - stable/9/sys/dev/cas X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Mar 2013 12:44:09 -0000 Author: marius Date: Fri Mar 8 12:44:08 2013 New Revision: 248046 URL: http://svnweb.freebsd.org/changeset/base/248046 Log: MFC: r247579 - Move reporting of failures to disable RX/TX MAC under bootverbose as at least the Saturn chips of 501-6738 cards may fail to do so the first time, which isn't fatal though. Reported by: Paul Keusemann - Explain why we don't enable infinite bursts on sparc64. - Given that these chips support memory write invalidate, make sure that it's enabled in the command register. Also make sure that PERR# and SERR# assertion is enabled. Modified: stable/9/sys/dev/cas/if_cas.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) Modified: stable/9/sys/dev/cas/if_cas.c ============================================================================== --- stable/9/sys/dev/cas/if_cas.c Fri Mar 8 12:13:33 2013 (r248045) +++ stable/9/sys/dev/cas/if_cas.c Fri Mar 8 12:44:08 2013 (r248046) @@ -824,7 +824,8 @@ cas_disable_rx(struct cas_softc *sc) BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); if (cas_bitwait(sc, CAS_MAC_RX_CONF, CAS_MAC_RX_CONF_EN, 0)) return (1); - device_printf(sc->sc_dev, "cannot disable RX MAC\n"); + if (bootverbose) + device_printf(sc->sc_dev, "cannot disable RX MAC\n"); return (0); } @@ -838,7 +839,8 @@ cas_disable_tx(struct cas_softc *sc) BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); if (cas_bitwait(sc, CAS_MAC_TX_CONF, CAS_MAC_TX_CONF_EN, 0)) return (1); - device_printf(sc->sc_dev, "cannot disable TX MAC\n"); + if (bootverbose) + device_printf(sc->sc_dev, "cannot disable TX MAC\n"); return (0); } @@ -1041,7 +1043,8 @@ cas_init_locked(struct cas_softc *sc) /* * Enable infinite bursts for revisions without PCI issues if * applicable. Doing so greatly improves the TX performance on - * !__sparc64__. + * !__sparc64__ (on sparc64, setting CAS_INF_BURST improves TX + * performance only marginally but hurts RX throughput quite a bit). */ CAS_WRITE_4(sc, CAS_INF_BURST, #if !defined(__sparc64__) @@ -2691,7 +2694,10 @@ cas_pci_attach(device_t dev) return (ENXIO); } - pci_enable_busmaster(dev); + /* PCI configuration */ + pci_write_config(dev, PCIR_COMMAND, + pci_read_config(dev, PCIR_COMMAND, 2) | PCIM_CMD_BUSMASTEREN | + PCIM_CMD_MWRICEN | PCIM_CMD_PERRESPEN | PCIM_CMD_SERRESPEN, 2); sc->sc_dev = dev; if (sc->sc_variant == CAS_CAS && pci_get_devid(dev) < 0x02) From owner-svn-src-stable@FreeBSD.ORG Fri Mar 8 12:44:41 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 7D0DD2C5; Fri, 8 Mar 2013 12:44:41 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 6134EEAC; Fri, 8 Mar 2013 12:44:41 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r28CifV9006744; Fri, 8 Mar 2013 12:44:41 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r28CifFd006741; Fri, 8 Mar 2013 12:44:41 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201303081244.r28CifFd006741@svn.freebsd.org> From: Marius Strobl Date: Fri, 8 Mar 2013 12:44:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r248047 - stable/8/sys/dev/cas X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Mar 2013 12:44:41 -0000 Author: marius Date: Fri Mar 8 12:44:40 2013 New Revision: 248047 URL: http://svnweb.freebsd.org/changeset/base/248047 Log: MFC: r223951 Partially merge r223648 and r223949 from gem(4) (committed to stable/8 in r224367): - Consistently use the newly introduced sc_mac_rxcfg throughout the driver instead of reading the old content of CAS_MAC_RX_CONF. - Increment if_iqdrops instead of if_ierrors in case of RX buffer allocation failure. - According to the Cassini datasheet the RX MAC should also be disabled in cas_setladrf() before changing its configuration. - Add error messages to gem_disable_{r,t}x() and take advantage of these throughout the driver instead of duplicating their functionality all over the place. MFC: r247579 - Move reporting of failures to disable RX/TX MAC under bootverbose as at least the Saturn chips of 501-6738 cards may fail to do so the first time, which isn't fatal though. Reported by: Paul Keusemann - Explain why we don't enable infinite bursts on sparc64. - Given that these chips support memory write invalidate, make sure that it's enabled in the command register. Also make sure that PERR# and SERR# assertion is enabled. Modified: stable/8/sys/dev/cas/if_cas.c stable/8/sys/dev/cas/if_casvar.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/dev/ (props changed) stable/8/sys/dev/cas/ (props changed) Modified: stable/8/sys/dev/cas/if_cas.c ============================================================================== --- stable/8/sys/dev/cas/if_cas.c Fri Mar 8 12:44:08 2013 (r248046) +++ stable/8/sys/dev/cas/if_cas.c Fri Mar 8 12:44:40 2013 (r248047) @@ -768,7 +768,7 @@ cas_reset_rx(struct cas_softc *sc) * Resetting while DMA is in progress can cause a bus hang, so we * disable DMA first. */ - cas_disable_rx(sc); + (void)cas_disable_rx(sc); CAS_WRITE_4(sc, CAS_RX_CONF, 0); CAS_BARRIER(sc, CAS_RX_CONF, 4, BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); @@ -780,7 +780,7 @@ cas_reset_rx(struct cas_softc *sc) ((sc->sc_flags & CAS_SERDES) != 0 ? CAS_RESET_PCS_DIS : 0)); CAS_BARRIER(sc, CAS_RESET, 4, BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); - if (!cas_bitwait(sc, CAS_RESET, CAS_RESET_RX | CAS_RESET_TX, 0)) { + if (!cas_bitwait(sc, CAS_RESET, CAS_RESET_RX, 0)) { device_printf(sc->sc_dev, "cannot reset receiver\n"); return (1); } @@ -795,7 +795,7 @@ cas_reset_tx(struct cas_softc *sc) * Resetting while DMA is in progress can cause a bus hang, so we * disable DMA first. */ - cas_disable_tx(sc); + (void)cas_disable_tx(sc); CAS_WRITE_4(sc, CAS_TX_CONF, 0); CAS_BARRIER(sc, CAS_TX_CONF, 4, BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); @@ -807,7 +807,7 @@ cas_reset_tx(struct cas_softc *sc) ((sc->sc_flags & CAS_SERDES) != 0 ? CAS_RESET_PCS_DIS : 0)); CAS_BARRIER(sc, CAS_RESET, 4, BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); - if (!cas_bitwait(sc, CAS_RESET, CAS_RESET_RX | CAS_RESET_TX, 0)) { + if (!cas_bitwait(sc, CAS_RESET, CAS_RESET_TX, 0)) { device_printf(sc->sc_dev, "cannot reset transmitter\n"); return (1); } @@ -822,7 +822,11 @@ cas_disable_rx(struct cas_softc *sc) CAS_READ_4(sc, CAS_MAC_RX_CONF) & ~CAS_MAC_RX_CONF_EN); CAS_BARRIER(sc, CAS_MAC_RX_CONF, 4, BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); - return (cas_bitwait(sc, CAS_MAC_RX_CONF, CAS_MAC_RX_CONF_EN, 0)); + if (cas_bitwait(sc, CAS_MAC_RX_CONF, CAS_MAC_RX_CONF_EN, 0)) + return (1); + if (bootverbose) + device_printf(sc->sc_dev, "cannot disable RX MAC\n"); + return (0); } static int @@ -833,7 +837,11 @@ cas_disable_tx(struct cas_softc *sc) CAS_READ_4(sc, CAS_MAC_TX_CONF) & ~CAS_MAC_TX_CONF_EN); CAS_BARRIER(sc, CAS_MAC_TX_CONF, 4, BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); - return (cas_bitwait(sc, CAS_MAC_TX_CONF, CAS_MAC_TX_CONF_EN, 0)); + if (cas_bitwait(sc, CAS_MAC_TX_CONF, CAS_MAC_TX_CONF_EN, 0)) + return (1); + if (bootverbose) + device_printf(sc->sc_dev, "cannot disable TX MAC\n"); + return (0); } static inline void @@ -996,7 +1004,6 @@ cas_init_locked(struct cas_softc *sc) cas_init_regs(sc); /* step 5. RX MAC registers & counters */ - cas_setladrf(sc); /* step 6 & 7. Program Ring Base Addresses. */ CAS_WRITE_4(sc, CAS_TX_DESC3_BASE_HI, @@ -1036,7 +1043,8 @@ cas_init_locked(struct cas_softc *sc) /* * Enable infinite bursts for revisions without PCI issues if * applicable. Doing so greatly improves the TX performance on - * !__sparc64__. + * !__sparc64__ (on sparc64, setting CAS_INF_BURST improves TX + * performance only marginally but hurts RX throughput quite a bit). */ CAS_WRITE_4(sc, CAS_INF_BURST, #if !defined(__sparc64__) @@ -1141,23 +1149,20 @@ cas_init_locked(struct cas_softc *sc) /* step 11. Configure Media. */ /* step 12. RX_MAC Configuration Register */ - v = CAS_READ_4(sc, CAS_MAC_RX_CONF) & ~CAS_MAC_RX_CONF_STRPPAD; - v |= CAS_MAC_RX_CONF_EN | CAS_MAC_RX_CONF_STRPFCS; - CAS_WRITE_4(sc, CAS_MAC_RX_CONF, 0); - CAS_BARRIER(sc, CAS_MAC_RX_CONF, 4, - BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); - if (!cas_bitwait(sc, CAS_MAC_RX_CONF, CAS_MAC_RX_CONF_EN, 0)) - device_printf(sc->sc_dev, "cannot configure RX MAC\n"); - CAS_WRITE_4(sc, CAS_MAC_RX_CONF, v); + v = CAS_READ_4(sc, CAS_MAC_RX_CONF); + v &= ~(CAS_MAC_RX_CONF_STRPPAD | CAS_MAC_RX_CONF_EN); + v |= CAS_MAC_RX_CONF_STRPFCS; + sc->sc_mac_rxcfg = v; + /* + * Clear the RX filter and reprogram it. This will also set the + * current RX MAC configuration and enable it. + */ + cas_setladrf(sc); /* step 13. TX_MAC Configuration Register */ v = CAS_READ_4(sc, CAS_MAC_TX_CONF); v |= CAS_MAC_TX_CONF_EN; - CAS_WRITE_4(sc, CAS_MAC_TX_CONF, 0); - CAS_BARRIER(sc, CAS_MAC_TX_CONF, 4, - BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); - if (!cas_bitwait(sc, CAS_MAC_TX_CONF, CAS_MAC_TX_CONF_EN, 0)) - device_printf(sc->sc_dev, "cannot configure TX MAC\n"); + (void)cas_disable_tx(sc); CAS_WRITE_4(sc, CAS_MAC_TX_CONF, v); /* step 14. Issue Transmit Pending command. */ @@ -1753,7 +1758,7 @@ cas_rint(struct cas_softc *sc) (*ifp->if_input)(ifp, m); CAS_LOCK(sc); } else - ifp->if_ierrors++; + ifp->if_iqdrops++; if ((word1 & CAS_RC1_RELEASE_HDR) != 0 && refcount_release(&rxds->rxds_refcount) != 0) @@ -1851,7 +1856,7 @@ cas_rint(struct cas_softc *sc) (*ifp->if_input)(ifp, m); CAS_LOCK(sc); } else - ifp->if_ierrors++; + ifp->if_iqdrops++; if ((word1 & CAS_RC1_RELEASE_DATA) != 0 && refcount_release(&rxds->rxds_refcount) != 0) @@ -2342,8 +2347,8 @@ cas_mii_statchg(device_t dev) * the Cassini+ ASIC Specification. */ - rxcfg = CAS_READ_4(sc, CAS_MAC_RX_CONF); - rxcfg &= ~(CAS_MAC_RX_CONF_EN | CAS_MAC_RX_CONF_CARR); + rxcfg = sc->sc_mac_rxcfg; + rxcfg &= ~CAS_MAC_RX_CONF_CARR; txcfg = CAS_MAC_TX_CONF_EN_IPG0 | CAS_MAC_TX_CONF_NGU | CAS_MAC_TX_CONF_NGUL; if ((IFM_OPTIONS(sc->sc_mii->mii_media_active) & IFM_FDX) != 0) @@ -2352,17 +2357,9 @@ cas_mii_statchg(device_t dev) rxcfg |= CAS_MAC_RX_CONF_CARR; txcfg |= CAS_MAC_TX_CONF_CARR; } - CAS_WRITE_4(sc, CAS_MAC_TX_CONF, 0); - CAS_BARRIER(sc, CAS_MAC_TX_CONF, 4, - BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); - if (!cas_bitwait(sc, CAS_MAC_TX_CONF, CAS_MAC_TX_CONF_EN, 0)) - device_printf(sc->sc_dev, "cannot disable TX MAC\n"); + (void)cas_disable_tx(sc); CAS_WRITE_4(sc, CAS_MAC_TX_CONF, txcfg); - CAS_WRITE_4(sc, CAS_MAC_RX_CONF, 0); - CAS_BARRIER(sc, CAS_MAC_RX_CONF, 4, - BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); - if (!cas_bitwait(sc, CAS_MAC_RX_CONF, CAS_MAC_RX_CONF_EN, 0)) - device_printf(sc->sc_dev, "cannot disable RX MAC\n"); + (void)cas_disable_rx(sc); CAS_WRITE_4(sc, CAS_MAC_RX_CONF, rxcfg); v = CAS_READ_4(sc, CAS_MAC_CTRL_CONF) & @@ -2420,6 +2417,7 @@ cas_mii_statchg(device_t dev) v |= CAS_MAC_XIF_CONF_FDXLED; CAS_WRITE_4(sc, CAS_MAC_XIF_CONF, v); + sc->sc_mac_rxcfg = rxcfg; if ((ifp->if_drv_flags & IFF_DRV_RUNNING) != 0 && (sc->sc_flags & CAS_LINK) != 0) { CAS_WRITE_4(sc, CAS_MAC_TX_CONF, @@ -2534,23 +2532,21 @@ cas_setladrf(struct cas_softc *sc) CAS_LOCK_ASSERT(sc, MA_OWNED); - /* Get the current RX configuration. */ - v = CAS_READ_4(sc, CAS_MAC_RX_CONF); - /* - * Turn off promiscuous mode, promiscuous group mode (all multicast), - * and hash filter. Depending on the case, the right bit will be - * enabled. + * Turn off the RX MAC and the hash filter as required by the Sun + * Cassini programming restrictions. */ - v &= ~(CAS_MAC_RX_CONF_PROMISC | CAS_MAC_RX_CONF_HFILTER | - CAS_MAC_RX_CONF_PGRP); - + v = sc->sc_mac_rxcfg & ~(CAS_MAC_RX_CONF_HFILTER | + CAS_MAC_RX_CONF_EN); CAS_WRITE_4(sc, CAS_MAC_RX_CONF, v); CAS_BARRIER(sc, CAS_MAC_RX_CONF, 4, BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); - if (!cas_bitwait(sc, CAS_MAC_RX_CONF, CAS_MAC_RX_CONF_HFILTER, 0)) - device_printf(sc->sc_dev, "cannot disable RX hash filter\n"); + if (!cas_bitwait(sc, CAS_MAC_RX_CONF, CAS_MAC_RX_CONF_HFILTER | + CAS_MAC_RX_CONF_EN, 0)) + device_printf(sc->sc_dev, + "cannot disable RX MAC or hash filter\n"); + v &= ~(CAS_MAC_RX_CONF_PROMISC | CAS_MAC_RX_CONF_PGRP); if ((ifp->if_flags & IFF_PROMISC) != 0) { v |= CAS_MAC_RX_CONF_PROMISC; goto chipit; @@ -2596,7 +2592,8 @@ cas_setladrf(struct cas_softc *sc) hash[i]); chipit: - CAS_WRITE_4(sc, CAS_MAC_RX_CONF, v); + sc->sc_mac_rxcfg = v; + CAS_WRITE_4(sc, CAS_MAC_RX_CONF, v | CAS_MAC_RX_CONF_EN); } static int cas_pci_attach(device_t dev); @@ -2697,7 +2694,10 @@ cas_pci_attach(device_t dev) return (ENXIO); } - pci_enable_busmaster(dev); + /* PCI configuration */ + pci_write_config(dev, PCIR_COMMAND, + pci_read_config(dev, PCIR_COMMAND, 2) | PCIM_CMD_BUSMASTEREN | + PCIM_CMD_MWRICEN | PCIM_CMD_PERRESPEN | PCIM_CMD_SERRESPEN, 2); sc->sc_dev = dev; if (sc->sc_variant == CAS_CAS && pci_get_devid(dev) < 0x02) Modified: stable/8/sys/dev/cas/if_casvar.h ============================================================================== --- stable/8/sys/dev/cas/if_casvar.h Fri Mar 8 12:44:08 2013 (r248046) +++ stable/8/sys/dev/cas/if_casvar.h Fri Mar 8 12:44:40 2013 (r248047) @@ -196,6 +196,8 @@ struct cas_softc { u_int sc_rxcptr; /* next ready RX completion */ u_int sc_rxdptr; /* next ready RX descriptor */ + uint32_t sc_mac_rxcfg; /* RX MAC conf. % CAS_MAC_RX_CONF_EN */ + int sc_ifflags; }; From owner-svn-src-stable@FreeBSD.ORG Fri Mar 8 12:50:30 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 3F820482; Fri, 8 Mar 2013 12:50:30 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 18138EE8; Fri, 8 Mar 2013 12:50:30 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r28CoTCs009028; Fri, 8 Mar 2013 12:50:29 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r28CoT1g009026; Fri, 8 Mar 2013 12:50:29 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201303081250.r28CoT1g009026@svn.freebsd.org> From: Marius Strobl Date: Fri, 8 Mar 2013 12:50:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r248048 - in stable/9/sys: conf sparc64/pci X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Mar 2013 12:50:30 -0000 Author: marius Date: Fri Mar 8 12:50:29 2013 New Revision: 248048 URL: http://svnweb.freebsd.org/changeset/base/248048 Log: MFC: r247600, r247620 - While Netra X1 generally show no ill effects when registering a power fail interrupt handler, there seems to be either a broken batch of them or a tendency to develop a defect which causes this interrupt to fire inadvertedly. Given that apart from this problem these machines work just fine, add a tunable allowing the setup of the power fail interrupt to be disabled. While at it, remove the DEBUGGER_ON_POWERFAIL compile time option and make that behavior also selectable via the newly added tunable. - Correct an incorrect argument to shutdown_nice(9). - Mark unused parameters as such. - Use NULL instead of 0 for pointers. Modified: stable/9/sys/conf/options.sparc64 stable/9/sys/sparc64/pci/psycho.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/conf/ (props changed) Modified: stable/9/sys/conf/options.sparc64 ============================================================================== --- stable/9/sys/conf/options.sparc64 Fri Mar 8 12:44:40 2013 (r248047) +++ stable/9/sys/conf/options.sparc64 Fri Mar 8 12:50:29 2013 (r248048) @@ -23,7 +23,6 @@ PSM_DEBUG opt_psm.h PSM_HOOKRESUME opt_psm.h PSM_RESETAFTERSUSPEND opt_psm.h -DEBUGGER_ON_POWERFAIL opt_psycho.h PSYCHO_DEBUG opt_psycho.h SCHIZO_DEBUG opt_schizo.h Modified: stable/9/sys/sparc64/pci/psycho.c ============================================================================== --- stable/9/sys/sparc64/pci/psycho.c Fri Mar 8 12:44:40 2013 (r248047) +++ stable/9/sys/sparc64/pci/psycho.c Fri Mar 8 12:50:29 2013 (r248048) @@ -54,6 +54,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -94,7 +95,8 @@ static void psycho_intr_clear(void *); static driver_filter_t psycho_ue; static driver_filter_t psycho_ce; static driver_filter_t psycho_pci_bus; -static driver_filter_t psycho_powerfail; +static driver_filter_t psycho_powerdebug; +static driver_intr_t psycho_powerdown; static driver_intr_t psycho_overtemp; #ifdef PSYCHO_MAP_WAKEUP static driver_filter_t psycho_wakeup; @@ -159,9 +161,16 @@ static devclass_t psycho_devclass; DEFINE_CLASS_0(pcib, psycho_driver, psycho_methods, sizeof(struct psycho_softc)); -EARLY_DRIVER_MODULE(psycho, nexus, psycho_driver, psycho_devclass, 0, 0, +EARLY_DRIVER_MODULE(psycho, nexus, psycho_driver, psycho_devclass, NULL, NULL, BUS_PASS_BUS); +static SYSCTL_NODE(_hw, OID_AUTO, psycho, CTLFLAG_RD, 0, "psycho parameters"); + +static u_int psycho_powerfail = 1; +TUNABLE_INT("hw.psycho.powerfail", &psycho_powerfail); +SYSCTL_UINT(_hw_psycho, OID_AUTO, powerfail, CTLFLAG_RDTUN, &psycho_powerfail, + 0, "powerfail action (0: none, 1: shutdown (default), 2: debugger)"); + static SLIST_HEAD(, psycho_softc) psycho_softcs = SLIST_HEAD_INITIALIZER(psycho_softcs); @@ -612,13 +621,18 @@ psycho_attach(device_t dev) */ psycho_set_intr(sc, 1, PSR_UE_INT_MAP, psycho_ue, NULL); psycho_set_intr(sc, 2, PSR_CE_INT_MAP, psycho_ce, NULL); -#ifdef DEBUGGER_ON_POWERFAIL - psycho_set_intr(sc, 3, PSR_POWER_INT_MAP, psycho_powerfail, - NULL); -#else - psycho_set_intr(sc, 3, PSR_POWER_INT_MAP, NULL, - (driver_intr_t *)psycho_powerfail); -#endif + switch (psycho_powerfail) { + case 0: + break; + case 2: + psycho_set_intr(sc, 3, PSR_POWER_INT_MAP, + psycho_powerdebug, NULL); + break; + default: + psycho_set_intr(sc, 3, PSR_POWER_INT_MAP, NULL, + psycho_powerdown); + break; + } if (sc->sc_mode == PSYCHO_MODE_PSYCHO) { /* * Hummingbirds/Sabres do not have the following two @@ -629,8 +643,8 @@ psycho_attach(device_t dev) * The spare hardware interrupt is used for the * over-temperature interrupt. */ - psycho_set_intr(sc, 4, PSR_SPARE_INT_MAP, - NULL, psycho_overtemp); + psycho_set_intr(sc, 4, PSR_SPARE_INT_MAP, NULL, + psycho_overtemp); #ifdef PSYCHO_MAP_WAKEUP /* * psycho_wakeup() doesn't do anything useful right @@ -837,27 +851,28 @@ psycho_pci_bus(void *arg) } static int -psycho_powerfail(void *arg) +psycho_powerdebug(void *arg __unused) { -#ifdef DEBUGGER_ON_POWERFAIL - struct psycho_softc *sc = arg; kdb_enter(KDB_WHY_POWERFAIL, "powerfail"); -#else + return (FILTER_HANDLED); +} + +static void +psycho_powerdown(void *arg __unused) +{ static int shutdown; /* As the interrupt is cleared we may be called multiple times. */ if (shutdown != 0) - return (FILTER_HANDLED); + return; shutdown++; printf("Power Failure Detected: Shutting down NOW.\n"); - shutdown_nice(0); -#endif - return (FILTER_HANDLED); + shutdown_nice(RB_POWEROFF); } static void -psycho_overtemp(void *arg) +psycho_overtemp(void *arg __unused) { static int shutdown; From owner-svn-src-stable@FreeBSD.ORG Fri Mar 8 12:50:32 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id AA55C483; Fri, 8 Mar 2013 12:50:32 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 8DB90EEA; Fri, 8 Mar 2013 12:50:32 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r28CoW1b009071; Fri, 8 Mar 2013 12:50:32 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r28CoWDY009069; Fri, 8 Mar 2013 12:50:32 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201303081250.r28CoWDY009069@svn.freebsd.org> From: Marius Strobl Date: Fri, 8 Mar 2013 12:50:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r248049 - in stable/8/sys: conf sparc64/pci X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Mar 2013 12:50:32 -0000 Author: marius Date: Fri Mar 8 12:50:31 2013 New Revision: 248049 URL: http://svnweb.freebsd.org/changeset/base/248049 Log: MFC: r247600, r247620 - While Netra X1 generally show no ill effects when registering a power fail interrupt handler, there seems to be either a broken batch of them or a tendency to develop a defect which causes this interrupt to fire inadvertedly. Given that apart from this problem these machines work just fine, add a tunable allowing the setup of the power fail interrupt to be disabled. While at it, remove the DEBUGGER_ON_POWERFAIL compile time option and make that behavior also selectable via the newly added tunable. - Correct an incorrect argument to shutdown_nice(9). - Mark unused parameters as such. - Use NULL instead of 0 for pointers. Modified: stable/8/sys/conf/options.sparc64 stable/8/sys/sparc64/pci/psycho.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/conf/ (props changed) stable/8/sys/sparc64/ (props changed) Modified: stable/8/sys/conf/options.sparc64 ============================================================================== --- stable/8/sys/conf/options.sparc64 Fri Mar 8 12:50:29 2013 (r248048) +++ stable/8/sys/conf/options.sparc64 Fri Mar 8 12:50:31 2013 (r248049) @@ -23,7 +23,6 @@ PSM_DEBUG opt_psm.h PSM_HOOKRESUME opt_psm.h PSM_RESETAFTERSUSPEND opt_psm.h -DEBUGGER_ON_POWERFAIL opt_psycho.h PSYCHO_DEBUG opt_psycho.h SCHIZO_DEBUG opt_schizo.h Modified: stable/8/sys/sparc64/pci/psycho.c ============================================================================== --- stable/8/sys/sparc64/pci/psycho.c Fri Mar 8 12:50:29 2013 (r248048) +++ stable/8/sys/sparc64/pci/psycho.c Fri Mar 8 12:50:31 2013 (r248049) @@ -54,6 +54,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -94,7 +95,8 @@ static void psycho_intr_clear(void *); static driver_filter_t psycho_ue; static driver_filter_t psycho_ce; static driver_filter_t psycho_pci_bus; -static driver_filter_t psycho_powerfail; +static driver_filter_t psycho_powerdebug; +static driver_intr_t psycho_powerdown; static driver_intr_t psycho_overtemp; #ifdef PSYCHO_MAP_WAKEUP static driver_filter_t psycho_wakeup; @@ -159,9 +161,16 @@ static devclass_t psycho_devclass; DEFINE_CLASS_0(pcib, psycho_driver, psycho_methods, sizeof(struct psycho_softc)); -EARLY_DRIVER_MODULE(psycho, nexus, psycho_driver, psycho_devclass, 0, 0, +EARLY_DRIVER_MODULE(psycho, nexus, psycho_driver, psycho_devclass, NULL, NULL, BUS_PASS_BUS); +static SYSCTL_NODE(_hw, OID_AUTO, psycho, CTLFLAG_RD, 0, "psycho parameters"); + +static u_int psycho_powerfail = 1; +TUNABLE_INT("hw.psycho.powerfail", &psycho_powerfail); +SYSCTL_UINT(_hw_psycho, OID_AUTO, powerfail, CTLFLAG_RDTUN, &psycho_powerfail, + 0, "powerfail action (0: none, 1: shutdown (default), 2: debugger)"); + static SLIST_HEAD(, psycho_softc) psycho_softcs = SLIST_HEAD_INITIALIZER(psycho_softcs); @@ -612,13 +621,18 @@ psycho_attach(device_t dev) */ psycho_set_intr(sc, 1, PSR_UE_INT_MAP, psycho_ue, NULL); psycho_set_intr(sc, 2, PSR_CE_INT_MAP, psycho_ce, NULL); -#ifdef DEBUGGER_ON_POWERFAIL - psycho_set_intr(sc, 3, PSR_POWER_INT_MAP, psycho_powerfail, - NULL); -#else - psycho_set_intr(sc, 3, PSR_POWER_INT_MAP, NULL, - (driver_intr_t *)psycho_powerfail); -#endif + switch (psycho_powerfail) { + case 0: + break; + case 2: + psycho_set_intr(sc, 3, PSR_POWER_INT_MAP, + psycho_powerdebug, NULL); + break; + default: + psycho_set_intr(sc, 3, PSR_POWER_INT_MAP, NULL, + psycho_powerdown); + break; + } if (sc->sc_mode == PSYCHO_MODE_PSYCHO) { /* * Hummingbirds/Sabres do not have the following two @@ -629,8 +643,8 @@ psycho_attach(device_t dev) * The spare hardware interrupt is used for the * over-temperature interrupt. */ - psycho_set_intr(sc, 4, PSR_SPARE_INT_MAP, - NULL, psycho_overtemp); + psycho_set_intr(sc, 4, PSR_SPARE_INT_MAP, NULL, + psycho_overtemp); #ifdef PSYCHO_MAP_WAKEUP /* * psycho_wakeup() doesn't do anything useful right @@ -837,27 +851,28 @@ psycho_pci_bus(void *arg) } static int -psycho_powerfail(void *arg) +psycho_powerdebug(void *arg __unused) { -#ifdef DEBUGGER_ON_POWERFAIL - struct psycho_softc *sc = arg; kdb_enter(KDB_WHY_POWERFAIL, "powerfail"); -#else + return (FILTER_HANDLED); +} + +static void +psycho_powerdown(void *arg __unused) +{ static int shutdown; /* As the interrupt is cleared we may be called multiple times. */ if (shutdown != 0) - return (FILTER_HANDLED); + return; shutdown++; printf("Power Failure Detected: Shutting down NOW.\n"); - shutdown_nice(0); -#endif - return (FILTER_HANDLED); + shutdown_nice(RB_POWEROFF); } static void -psycho_overtemp(void *arg) +psycho_overtemp(void *arg __unused) { static int shutdown; From owner-svn-src-stable@FreeBSD.ORG Fri Mar 8 12:52:53 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 52AAF76C; Fri, 8 Mar 2013 12:52:53 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 3A12EF01; Fri, 8 Mar 2013 12:52:53 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r28Cqree009620; Fri, 8 Mar 2013 12:52:53 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r28CqrcC009619; Fri, 8 Mar 2013 12:52:53 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201303081252.r28CqrcC009619@svn.freebsd.org> From: Marius Strobl Date: Fri, 8 Mar 2013 12:52:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r248050 - stable/9/sys/sparc64/sbus X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Mar 2013 12:52:53 -0000 Author: marius Date: Fri Mar 8 12:52:52 2013 New Revision: 248050 URL: http://svnweb.freebsd.org/changeset/base/248050 Log: MFC: r247601, r247621 - Correct an incorrect argument to shutdown_nice(9). - Mark unused parameters as such. - Use NULL instead of 0 for pointers. Modified: stable/9/sys/sparc64/sbus/sbus.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/sparc64/sbus/sbus.c ============================================================================== --- stable/9/sys/sparc64/sbus/sbus.c Fri Mar 8 12:50:31 2013 (r248049) +++ stable/9/sys/sparc64/sbus/sbus.c Fri Mar 8 12:52:52 2013 (r248050) @@ -199,7 +199,7 @@ static driver_t sbus_driver = { static devclass_t sbus_devclass; -EARLY_DRIVER_MODULE(sbus, nexus, sbus_driver, sbus_devclass, 0, 0, +EARLY_DRIVER_MODULE(sbus, nexus, sbus_driver, sbus_devclass, NULL, NULL, BUS_PASS_BUS); MODULE_DEPEND(sbus, nexus, 1, 1, 1); MODULE_VERSION(sbus, 1); @@ -898,7 +898,7 @@ sbus_get_devinfo(device_t bus, device_t * The same needs to be done to PCI controller drivers. */ static void -sbus_overtemp(void *arg) +sbus_overtemp(void *arg __unused) { static int shutdown; @@ -912,7 +912,7 @@ sbus_overtemp(void *arg) /* Try to shut down in time in case of power failure. */ static void -sbus_pwrfail(void *arg) +sbus_pwrfail(void *arg __unused) { static int shutdown; @@ -921,7 +921,7 @@ sbus_pwrfail(void *arg) return; shutdown++; printf("Power failure detected\nShutting down NOW.\n"); - shutdown_nice(0); + shutdown_nice(RB_POWEROFF); } static int From owner-svn-src-stable@FreeBSD.ORG Fri Mar 8 12:52:58 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 083DC76E; Fri, 8 Mar 2013 12:52:58 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id EEA74F03; Fri, 8 Mar 2013 12:52:57 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r28CqvRx009667; Fri, 8 Mar 2013 12:52:57 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r28Cqvfu009666; Fri, 8 Mar 2013 12:52:57 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201303081252.r28Cqvfu009666@svn.freebsd.org> From: Marius Strobl Date: Fri, 8 Mar 2013 12:52:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r248051 - stable/8/sys/sparc64/sbus X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Mar 2013 12:52:58 -0000 Author: marius Date: Fri Mar 8 12:52:57 2013 New Revision: 248051 URL: http://svnweb.freebsd.org/changeset/base/248051 Log: MFC: r247601, r247621 - Correct an incorrect argument to shutdown_nice(9). - Mark unused parameters as such. - Use NULL instead of 0 for pointers. Modified: stable/8/sys/sparc64/sbus/sbus.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/sparc64/ (props changed) Modified: stable/8/sys/sparc64/sbus/sbus.c ============================================================================== --- stable/8/sys/sparc64/sbus/sbus.c Fri Mar 8 12:52:52 2013 (r248050) +++ stable/8/sys/sparc64/sbus/sbus.c Fri Mar 8 12:52:57 2013 (r248051) @@ -199,7 +199,7 @@ static driver_t sbus_driver = { static devclass_t sbus_devclass; -EARLY_DRIVER_MODULE(sbus, nexus, sbus_driver, sbus_devclass, 0, 0, +EARLY_DRIVER_MODULE(sbus, nexus, sbus_driver, sbus_devclass, NULL, NULL, BUS_PASS_BUS); MODULE_DEPEND(sbus, nexus, 1, 1, 1); MODULE_VERSION(sbus, 1); @@ -898,7 +898,7 @@ sbus_get_devinfo(device_t bus, device_t * The same needs to be done to PCI controller drivers. */ static void -sbus_overtemp(void *arg) +sbus_overtemp(void *arg __unused) { static int shutdown; @@ -912,7 +912,7 @@ sbus_overtemp(void *arg) /* Try to shut down in time in case of power failure. */ static void -sbus_pwrfail(void *arg) +sbus_pwrfail(void *arg __unused) { static int shutdown; @@ -921,7 +921,7 @@ sbus_pwrfail(void *arg) return; shutdown++; printf("Power failure detected\nShutting down NOW.\n"); - shutdown_nice(0); + shutdown_nice(RB_POWEROFF); } static int From owner-svn-src-stable@FreeBSD.ORG Fri Mar 8 12:57:59 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 5BE86DEB; Fri, 8 Mar 2013 12:57:59 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 34AC8F3B; Fri, 8 Mar 2013 12:57:59 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r28CvxYP010663; Fri, 8 Mar 2013 12:57:59 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r28Cvx7J010662; Fri, 8 Mar 2013 12:57:59 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201303081257.r28Cvx7J010662@svn.freebsd.org> From: Marius Strobl Date: Fri, 8 Mar 2013 12:57:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r248052 - stable/9/sys/dev/pci X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Mar 2013 12:57:59 -0000 Author: marius Date: Fri Mar 8 12:57:58 2013 New Revision: 248052 URL: http://svnweb.freebsd.org/changeset/base/248052 Log: MFC: r247632 - Complete r231621 (MFC'ed to stable/9 in r232092) by also blacklisting the bridge used by VMware for PCIe devices. While at it, update the comment now that we know that MSI-X doesn't work with ESXi 5.1 for Intel 82576 either and the underlying issue is a bug in the MSI-X allocation code of the hypervisor. Reported by: Harald Schmalzbauer - Make the nomatch table const. Modified: stable/9/sys/dev/pci/pci.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) Modified: stable/9/sys/dev/pci/pci.c ============================================================================== --- stable/9/sys/dev/pci/pci.c Fri Mar 8 12:52:57 2013 (r248051) +++ stable/9/sys/dev/pci/pci.c Fri Mar 8 12:57:58 2013 (r248052) @@ -243,10 +243,11 @@ static const struct pci_quirk pci_quirks { 0x74501022, PCI_QUIRK_DISABLE_MSI, 0, 0 }, /* - * MSI-X doesn't work with at least LSI SAS1068E passed through by - * VMware. + * MSI-X allocation doesn't work properly for devices passed through + * by VMware up to at least ESXi 5.1. */ - { 0x079015ad, PCI_QUIRK_DISABLE_MSI, 0, 0 }, + { 0x079015ad, PCI_QUIRK_DISABLE_MSI, 0, 0 }, /* PCI/PCI-X */ + { 0x07a015ad, PCI_QUIRK_DISABLE_MSI, 0, 0 }, /* PCIe */ /* * Some virtualization environments emulate an older chipset @@ -3572,11 +3573,11 @@ pci_print_child(device_t dev, device_t c return (retval); } -static struct +static const struct { - int class; - int subclass; - char *desc; + int class; + int subclass; + const char *desc; } pci_nomatch_tab[] = { {PCIC_OLD, -1, "old"}, {PCIC_OLD, PCIS_OLD_NONVGA, "non-VGA display device"}, @@ -3668,8 +3669,9 @@ static struct void pci_probe_nomatch(device_t dev, device_t child) { - int i; - char *cp, *scp, *device; + int i; + const char *cp, *scp; + char *device; /* * Look for a listing for this device in a loaded device database. @@ -3702,7 +3704,6 @@ pci_probe_nomatch(device_t dev, device_t printf(" at device %d.%d (no driver attached)\n", pci_get_slot(child), pci_get_function(child)); pci_cfg_save(child, device_get_ivars(child), 1); - return; } /* From owner-svn-src-stable@FreeBSD.ORG Fri Mar 8 12:58:26 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 53177F8E; Fri, 8 Mar 2013 12:58:26 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 2D380F45; Fri, 8 Mar 2013 12:58:26 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r28CwQM5010781; Fri, 8 Mar 2013 12:58:26 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r28CwQvk010780; Fri, 8 Mar 2013 12:58:26 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201303081258.r28CwQvk010780@svn.freebsd.org> From: Marius Strobl Date: Fri, 8 Mar 2013 12:58:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r248053 - stable/8/sys/dev/pci X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Mar 2013 12:58:26 -0000 Author: marius Date: Fri Mar 8 12:58:25 2013 New Revision: 248053 URL: http://svnweb.freebsd.org/changeset/base/248053 Log: - Complete r231621 (MFC'ed to stable/8 in r232093) by also blacklisting the bridge used by VMware for PCIe devices. While at it, update the comment now that we know that MSI-X doesn't work with ESXi 5.1 for Intel 82576 either and the underlying issue is a bug in the MSI-X allocation code of the hypervisor. Reported by: Harald Schmalzbauer - Make the nomatch table const. Modified: stable/8/sys/dev/pci/pci.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/dev/ (props changed) stable/8/sys/dev/pci/ (props changed) Modified: stable/8/sys/dev/pci/pci.c ============================================================================== --- stable/8/sys/dev/pci/pci.c Fri Mar 8 12:57:58 2013 (r248052) +++ stable/8/sys/dev/pci/pci.c Fri Mar 8 12:58:25 2013 (r248053) @@ -249,10 +249,11 @@ static const struct pci_quirk pci_quirks { 0x74501022, PCI_QUIRK_DISABLE_MSI, 0, 0 }, /* - * MSI-X doesn't work with at least LSI SAS1068E passed through by - * VMware. + * MSI-X allocation doesn't work properly for devices passed through + * by VMware up to at least ESXi 5.1. */ - { 0x079015ad, PCI_QUIRK_DISABLE_MSI, 0, 0 }, + { 0x079015ad, PCI_QUIRK_DISABLE_MSI, 0, 0 }, /* PCI/PCI-X */ + { 0x07a015ad, PCI_QUIRK_DISABLE_MSI, 0, 0 }, /* PCIe */ /* * Some virtualization environments emulate an older chipset @@ -3479,11 +3480,11 @@ pci_print_child(device_t dev, device_t c return (retval); } -static struct +static const struct { - int class; - int subclass; - char *desc; + int class; + int subclass; + const char *desc; } pci_nomatch_tab[] = { {PCIC_OLD, -1, "old"}, {PCIC_OLD, PCIS_OLD_NONVGA, "non-VGA display device"}, @@ -3575,8 +3576,9 @@ static struct void pci_probe_nomatch(device_t dev, device_t child) { - int i; - char *cp, *scp, *device; + int i; + const char *cp, *scp; + char *device; /* * Look for a listing for this device in a loaded device database. @@ -3609,7 +3611,6 @@ pci_probe_nomatch(device_t dev, device_t printf(" at device %d.%d (no driver attached)\n", pci_get_slot(child), pci_get_function(child)); pci_cfg_save(child, device_get_ivars(child), 1); - return; } /* From owner-svn-src-stable@FreeBSD.ORG Fri Mar 8 12:59:07 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 30884292; Fri, 8 Mar 2013 12:59:07 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 060B1F5E; Fri, 8 Mar 2013 12:59:07 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r28Cx6Vd010906; Fri, 8 Mar 2013 12:59:06 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r28Cx61v010905; Fri, 8 Mar 2013 12:59:06 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201303081259.r28Cx61v010905@svn.freebsd.org> From: Marius Strobl Date: Fri, 8 Mar 2013 12:59:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org Subject: svn commit: r248054 - stable/7/sys/dev/pci X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Mar 2013 12:59:07 -0000 Author: marius Date: Fri Mar 8 12:59:06 2013 New Revision: 248054 URL: http://svnweb.freebsd.org/changeset/base/248054 Log: MFC: r247632 - Complete r231621 (MFC'ed to stable/7 in r232094) by also blacklisting the bridge used by VMware for PCIe devices. While at it, update the comment now that we know that MSI-X doesn't work with ESXi 5.1 for Intel 82576 either and the underlying issue is a bug in the MSI-X allocation code of the hypervisor. Reported by: Harald Schmalzbauer - Make the nomatch table const. Modified: stable/7/sys/dev/pci/pci.c Directory Properties: stable/7/sys/ (props changed) Modified: stable/7/sys/dev/pci/pci.c ============================================================================== --- stable/7/sys/dev/pci/pci.c Fri Mar 8 12:58:25 2013 (r248053) +++ stable/7/sys/dev/pci/pci.c Fri Mar 8 12:59:06 2013 (r248054) @@ -215,10 +215,11 @@ static const struct pci_quirk const pci_ { 0x74501022, PCI_QUIRK_DISABLE_MSI, 0, 0 }, /* - * MSI-X doesn't work with at least LSI SAS1068E passed through by - * VMware. + * MSI-X allocation doesn't work properly for devices passed through + * by VMware up to at least ESXi 5.1. */ - { 0x079015ad, PCI_QUIRK_DISABLE_MSI, 0, 0 }, + { 0x079015ad, PCI_QUIRK_DISABLE_MSI, 0, 0 }, /* PCI/PCI-X */ + { 0x07a015ad, PCI_QUIRK_DISABLE_MSI, 0, 0 }, /* PCIe */ /* * Some virtualization environments emulate an older chipset @@ -3053,11 +3054,11 @@ pci_print_child(device_t dev, device_t c return (retval); } -static struct +static const struct { - int class; - int subclass; - char *desc; + int class; + int subclass; + const char *desc; } pci_nomatch_tab[] = { {PCIC_OLD, -1, "old"}, {PCIC_OLD, PCIS_OLD_NONVGA, "non-VGA display device"}, @@ -3149,8 +3150,9 @@ static struct void pci_probe_nomatch(device_t dev, device_t child) { - int i; - char *cp, *scp, *device; + int i; + const char *cp, *scp; + char *device; /* * Look for a listing for this device in a loaded device database. @@ -3183,7 +3185,6 @@ pci_probe_nomatch(device_t dev, device_t printf(" at device %d.%d (no driver attached)\n", pci_get_slot(child), pci_get_function(child)); pci_cfg_save(child, (struct pci_devinfo *)device_get_ivars(child), 1); - return; } /* From owner-svn-src-stable@FreeBSD.ORG Fri Mar 8 17:28:43 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 19D05543; Fri, 8 Mar 2013 17:28:43 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id DCFF7790; Fri, 8 Mar 2013 17:28:42 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r28HSgN8094480; Fri, 8 Mar 2013 17:28:42 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r28HSfOB094471; Fri, 8 Mar 2013 17:28:41 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201303081728.r28HSfOB094471@svn.freebsd.org> From: Xin LI Date: Fri, 8 Mar 2013 17:28:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r248057 - in stable/8: crypto/openssl crypto/openssl/apps crypto/openssl/crypto crypto/openssl/crypto/asn1 crypto/openssl/crypto/ec crypto/openssl/crypto/ecdh crypto/openssl/crypto/ecds... X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Mar 2013 17:28:43 -0000 Author: delphij Date: Fri Mar 8 17:28:40 2013 New Revision: 248057 URL: http://svnweb.freebsd.org/changeset/base/248057 Log: Merge OpenSSL 0.9.8y. This is a direct commit to stable/8 as HEAD is on a different release now. Added: stable/8/crypto/openssl/ssl/s3_cbc.c - copied unchanged from r247958, vendor-crypto/openssl/dist-0.9.8/ssl/s3_cbc.c Modified: stable/8/crypto/openssl/CHANGES stable/8/crypto/openssl/Configure stable/8/crypto/openssl/FAQ stable/8/crypto/openssl/Makefile stable/8/crypto/openssl/NEWS stable/8/crypto/openssl/README stable/8/crypto/openssl/apps/Makefile stable/8/crypto/openssl/apps/apps.c stable/8/crypto/openssl/apps/dhparam.c stable/8/crypto/openssl/apps/s_server.c stable/8/crypto/openssl/crypto/asn1/a_strex.c stable/8/crypto/openssl/crypto/asn1/a_verify.c stable/8/crypto/openssl/crypto/asn1/x_pubkey.c stable/8/crypto/openssl/crypto/cryptlib.c stable/8/crypto/openssl/crypto/crypto.h stable/8/crypto/openssl/crypto/ec/ec.h stable/8/crypto/openssl/crypto/ec/ec_key.c stable/8/crypto/openssl/crypto/ecdh/ech_lib.c stable/8/crypto/openssl/crypto/ecdsa/ecs_lib.c stable/8/crypto/openssl/crypto/o_init.c stable/8/crypto/openssl/crypto/ocsp/ocsp_vfy.c stable/8/crypto/openssl/crypto/opensslv.h stable/8/crypto/openssl/crypto/rsa/rsa_oaep.c stable/8/crypto/openssl/crypto/symhacks.h stable/8/crypto/openssl/doc/apps/CA.pl.pod stable/8/crypto/openssl/engines/e_capi.c stable/8/crypto/openssl/openssl.spec stable/8/crypto/openssl/ssl/Makefile stable/8/crypto/openssl/ssl/d1_enc.c stable/8/crypto/openssl/ssl/d1_pkt.c stable/8/crypto/openssl/ssl/s2_clnt.c stable/8/crypto/openssl/ssl/s2_pkt.c stable/8/crypto/openssl/ssl/s3_both.c stable/8/crypto/openssl/ssl/s3_clnt.c stable/8/crypto/openssl/ssl/s3_enc.c stable/8/crypto/openssl/ssl/s3_pkt.c stable/8/crypto/openssl/ssl/s3_srvr.c stable/8/crypto/openssl/ssl/ssl.h stable/8/crypto/openssl/ssl/ssl3.h stable/8/crypto/openssl/ssl/ssl_err.c stable/8/crypto/openssl/ssl/ssl_lib.c stable/8/crypto/openssl/ssl/ssl_locl.h stable/8/crypto/openssl/ssl/t1_enc.c stable/8/crypto/openssl/ssl/t1_lib.c stable/8/crypto/openssl/util/libeay.num stable/8/secure/lib/libcrypto/Makefile.inc stable/8/secure/lib/libcrypto/man/ASN1_OBJECT_new.3 stable/8/secure/lib/libcrypto/man/ASN1_STRING_length.3 stable/8/secure/lib/libcrypto/man/ASN1_STRING_new.3 stable/8/secure/lib/libcrypto/man/ASN1_STRING_print_ex.3 stable/8/secure/lib/libcrypto/man/ASN1_generate_nconf.3 stable/8/secure/lib/libcrypto/man/BIO_ctrl.3 stable/8/secure/lib/libcrypto/man/BIO_f_base64.3 stable/8/secure/lib/libcrypto/man/BIO_f_buffer.3 stable/8/secure/lib/libcrypto/man/BIO_f_cipher.3 stable/8/secure/lib/libcrypto/man/BIO_f_md.3 stable/8/secure/lib/libcrypto/man/BIO_f_null.3 stable/8/secure/lib/libcrypto/man/BIO_f_ssl.3 stable/8/secure/lib/libcrypto/man/BIO_find_type.3 stable/8/secure/lib/libcrypto/man/BIO_new.3 stable/8/secure/lib/libcrypto/man/BIO_push.3 stable/8/secure/lib/libcrypto/man/BIO_read.3 stable/8/secure/lib/libcrypto/man/BIO_s_accept.3 stable/8/secure/lib/libcrypto/man/BIO_s_bio.3 stable/8/secure/lib/libcrypto/man/BIO_s_connect.3 stable/8/secure/lib/libcrypto/man/BIO_s_fd.3 stable/8/secure/lib/libcrypto/man/BIO_s_file.3 stable/8/secure/lib/libcrypto/man/BIO_s_mem.3 stable/8/secure/lib/libcrypto/man/BIO_s_null.3 stable/8/secure/lib/libcrypto/man/BIO_s_socket.3 stable/8/secure/lib/libcrypto/man/BIO_set_callback.3 stable/8/secure/lib/libcrypto/man/BIO_should_retry.3 stable/8/secure/lib/libcrypto/man/BN_BLINDING_new.3 stable/8/secure/lib/libcrypto/man/BN_CTX_new.3 stable/8/secure/lib/libcrypto/man/BN_CTX_start.3 stable/8/secure/lib/libcrypto/man/BN_add.3 stable/8/secure/lib/libcrypto/man/BN_add_word.3 stable/8/secure/lib/libcrypto/man/BN_bn2bin.3 stable/8/secure/lib/libcrypto/man/BN_cmp.3 stable/8/secure/lib/libcrypto/man/BN_copy.3 stable/8/secure/lib/libcrypto/man/BN_generate_prime.3 stable/8/secure/lib/libcrypto/man/BN_mod_inverse.3 stable/8/secure/lib/libcrypto/man/BN_mod_mul_montgomery.3 stable/8/secure/lib/libcrypto/man/BN_mod_mul_reciprocal.3 stable/8/secure/lib/libcrypto/man/BN_new.3 stable/8/secure/lib/libcrypto/man/BN_num_bytes.3 stable/8/secure/lib/libcrypto/man/BN_rand.3 stable/8/secure/lib/libcrypto/man/BN_set_bit.3 stable/8/secure/lib/libcrypto/man/BN_swap.3 stable/8/secure/lib/libcrypto/man/BN_zero.3 stable/8/secure/lib/libcrypto/man/CONF_modules_free.3 stable/8/secure/lib/libcrypto/man/CONF_modules_load_file.3 stable/8/secure/lib/libcrypto/man/CRYPTO_set_ex_data.3 stable/8/secure/lib/libcrypto/man/DH_generate_key.3 stable/8/secure/lib/libcrypto/man/DH_generate_parameters.3 stable/8/secure/lib/libcrypto/man/DH_get_ex_new_index.3 stable/8/secure/lib/libcrypto/man/DH_new.3 stable/8/secure/lib/libcrypto/man/DH_set_method.3 stable/8/secure/lib/libcrypto/man/DH_size.3 stable/8/secure/lib/libcrypto/man/DSA_SIG_new.3 stable/8/secure/lib/libcrypto/man/DSA_do_sign.3 stable/8/secure/lib/libcrypto/man/DSA_dup_DH.3 stable/8/secure/lib/libcrypto/man/DSA_generate_key.3 stable/8/secure/lib/libcrypto/man/DSA_generate_parameters.3 stable/8/secure/lib/libcrypto/man/DSA_get_ex_new_index.3 stable/8/secure/lib/libcrypto/man/DSA_new.3 stable/8/secure/lib/libcrypto/man/DSA_set_method.3 stable/8/secure/lib/libcrypto/man/DSA_sign.3 stable/8/secure/lib/libcrypto/man/DSA_size.3 stable/8/secure/lib/libcrypto/man/ERR_GET_LIB.3 stable/8/secure/lib/libcrypto/man/ERR_clear_error.3 stable/8/secure/lib/libcrypto/man/ERR_error_string.3 stable/8/secure/lib/libcrypto/man/ERR_get_error.3 stable/8/secure/lib/libcrypto/man/ERR_load_crypto_strings.3 stable/8/secure/lib/libcrypto/man/ERR_load_strings.3 stable/8/secure/lib/libcrypto/man/ERR_print_errors.3 stable/8/secure/lib/libcrypto/man/ERR_put_error.3 stable/8/secure/lib/libcrypto/man/ERR_remove_state.3 stable/8/secure/lib/libcrypto/man/ERR_set_mark.3 stable/8/secure/lib/libcrypto/man/EVP_BytesToKey.3 stable/8/secure/lib/libcrypto/man/EVP_DigestInit.3 stable/8/secure/lib/libcrypto/man/EVP_EncryptInit.3 stable/8/secure/lib/libcrypto/man/EVP_OpenInit.3 stable/8/secure/lib/libcrypto/man/EVP_PKEY_new.3 stable/8/secure/lib/libcrypto/man/EVP_PKEY_set1_RSA.3 stable/8/secure/lib/libcrypto/man/EVP_SealInit.3 stable/8/secure/lib/libcrypto/man/EVP_SignInit.3 stable/8/secure/lib/libcrypto/man/EVP_VerifyInit.3 stable/8/secure/lib/libcrypto/man/OBJ_nid2obj.3 stable/8/secure/lib/libcrypto/man/OPENSSL_Applink.3 stable/8/secure/lib/libcrypto/man/OPENSSL_VERSION_NUMBER.3 stable/8/secure/lib/libcrypto/man/OPENSSL_config.3 stable/8/secure/lib/libcrypto/man/OPENSSL_ia32cap.3 stable/8/secure/lib/libcrypto/man/OPENSSL_load_builtin_modules.3 stable/8/secure/lib/libcrypto/man/OpenSSL_add_all_algorithms.3 stable/8/secure/lib/libcrypto/man/PKCS12_create.3 stable/8/secure/lib/libcrypto/man/PKCS12_parse.3 stable/8/secure/lib/libcrypto/man/PKCS7_decrypt.3 stable/8/secure/lib/libcrypto/man/PKCS7_encrypt.3 stable/8/secure/lib/libcrypto/man/PKCS7_sign.3 stable/8/secure/lib/libcrypto/man/PKCS7_verify.3 stable/8/secure/lib/libcrypto/man/RAND_add.3 stable/8/secure/lib/libcrypto/man/RAND_bytes.3 stable/8/secure/lib/libcrypto/man/RAND_cleanup.3 stable/8/secure/lib/libcrypto/man/RAND_egd.3 stable/8/secure/lib/libcrypto/man/RAND_load_file.3 stable/8/secure/lib/libcrypto/man/RAND_set_rand_method.3 stable/8/secure/lib/libcrypto/man/RSA_blinding_on.3 stable/8/secure/lib/libcrypto/man/RSA_check_key.3 stable/8/secure/lib/libcrypto/man/RSA_generate_key.3 stable/8/secure/lib/libcrypto/man/RSA_get_ex_new_index.3 stable/8/secure/lib/libcrypto/man/RSA_new.3 stable/8/secure/lib/libcrypto/man/RSA_padding_add_PKCS1_type_1.3 stable/8/secure/lib/libcrypto/man/RSA_print.3 stable/8/secure/lib/libcrypto/man/RSA_private_encrypt.3 stable/8/secure/lib/libcrypto/man/RSA_public_encrypt.3 stable/8/secure/lib/libcrypto/man/RSA_set_method.3 stable/8/secure/lib/libcrypto/man/RSA_sign.3 stable/8/secure/lib/libcrypto/man/RSA_sign_ASN1_OCTET_STRING.3 stable/8/secure/lib/libcrypto/man/RSA_size.3 stable/8/secure/lib/libcrypto/man/SMIME_read_PKCS7.3 stable/8/secure/lib/libcrypto/man/SMIME_write_PKCS7.3 stable/8/secure/lib/libcrypto/man/X509_NAME_ENTRY_get_object.3 stable/8/secure/lib/libcrypto/man/X509_NAME_add_entry_by_txt.3 stable/8/secure/lib/libcrypto/man/X509_NAME_get_index_by_NID.3 stable/8/secure/lib/libcrypto/man/X509_NAME_print_ex.3 stable/8/secure/lib/libcrypto/man/X509_new.3 stable/8/secure/lib/libcrypto/man/bio.3 stable/8/secure/lib/libcrypto/man/blowfish.3 stable/8/secure/lib/libcrypto/man/bn.3 stable/8/secure/lib/libcrypto/man/bn_internal.3 stable/8/secure/lib/libcrypto/man/buffer.3 stable/8/secure/lib/libcrypto/man/crypto.3 stable/8/secure/lib/libcrypto/man/d2i_ASN1_OBJECT.3 stable/8/secure/lib/libcrypto/man/d2i_DHparams.3 stable/8/secure/lib/libcrypto/man/d2i_DSAPublicKey.3 stable/8/secure/lib/libcrypto/man/d2i_PKCS8PrivateKey.3 stable/8/secure/lib/libcrypto/man/d2i_RSAPublicKey.3 stable/8/secure/lib/libcrypto/man/d2i_X509.3 stable/8/secure/lib/libcrypto/man/d2i_X509_ALGOR.3 stable/8/secure/lib/libcrypto/man/d2i_X509_CRL.3 stable/8/secure/lib/libcrypto/man/d2i_X509_NAME.3 stable/8/secure/lib/libcrypto/man/d2i_X509_REQ.3 stable/8/secure/lib/libcrypto/man/d2i_X509_SIG.3 stable/8/secure/lib/libcrypto/man/des.3 stable/8/secure/lib/libcrypto/man/dh.3 stable/8/secure/lib/libcrypto/man/dsa.3 stable/8/secure/lib/libcrypto/man/ecdsa.3 stable/8/secure/lib/libcrypto/man/engine.3 stable/8/secure/lib/libcrypto/man/err.3 stable/8/secure/lib/libcrypto/man/evp.3 stable/8/secure/lib/libcrypto/man/hmac.3 stable/8/secure/lib/libcrypto/man/lh_stats.3 stable/8/secure/lib/libcrypto/man/lhash.3 stable/8/secure/lib/libcrypto/man/md5.3 stable/8/secure/lib/libcrypto/man/mdc2.3 stable/8/secure/lib/libcrypto/man/pem.3 stable/8/secure/lib/libcrypto/man/rand.3 stable/8/secure/lib/libcrypto/man/rc4.3 stable/8/secure/lib/libcrypto/man/ripemd.3 stable/8/secure/lib/libcrypto/man/rsa.3 stable/8/secure/lib/libcrypto/man/sha.3 stable/8/secure/lib/libcrypto/man/threads.3 stable/8/secure/lib/libcrypto/man/ui.3 stable/8/secure/lib/libcrypto/man/ui_compat.3 stable/8/secure/lib/libcrypto/man/x509.3 stable/8/secure/lib/libssl/Makefile stable/8/secure/lib/libssl/man/SSL_CIPHER_get_name.3 stable/8/secure/lib/libssl/man/SSL_COMP_add_compression_method.3 stable/8/secure/lib/libssl/man/SSL_CTX_add_extra_chain_cert.3 stable/8/secure/lib/libssl/man/SSL_CTX_add_session.3 stable/8/secure/lib/libssl/man/SSL_CTX_ctrl.3 stable/8/secure/lib/libssl/man/SSL_CTX_flush_sessions.3 stable/8/secure/lib/libssl/man/SSL_CTX_free.3 stable/8/secure/lib/libssl/man/SSL_CTX_get_ex_new_index.3 stable/8/secure/lib/libssl/man/SSL_CTX_get_verify_mode.3 stable/8/secure/lib/libssl/man/SSL_CTX_load_verify_locations.3 stable/8/secure/lib/libssl/man/SSL_CTX_new.3 stable/8/secure/lib/libssl/man/SSL_CTX_sess_number.3 stable/8/secure/lib/libssl/man/SSL_CTX_sess_set_cache_size.3 stable/8/secure/lib/libssl/man/SSL_CTX_sess_set_get_cb.3 stable/8/secure/lib/libssl/man/SSL_CTX_sessions.3 stable/8/secure/lib/libssl/man/SSL_CTX_set_cert_store.3 stable/8/secure/lib/libssl/man/SSL_CTX_set_cert_verify_callback.3 stable/8/secure/lib/libssl/man/SSL_CTX_set_cipher_list.3 stable/8/secure/lib/libssl/man/SSL_CTX_set_client_CA_list.3 stable/8/secure/lib/libssl/man/SSL_CTX_set_client_cert_cb.3 stable/8/secure/lib/libssl/man/SSL_CTX_set_default_passwd_cb.3 stable/8/secure/lib/libssl/man/SSL_CTX_set_generate_session_id.3 stable/8/secure/lib/libssl/man/SSL_CTX_set_info_callback.3 stable/8/secure/lib/libssl/man/SSL_CTX_set_max_cert_list.3 stable/8/secure/lib/libssl/man/SSL_CTX_set_mode.3 stable/8/secure/lib/libssl/man/SSL_CTX_set_msg_callback.3 stable/8/secure/lib/libssl/man/SSL_CTX_set_options.3 stable/8/secure/lib/libssl/man/SSL_CTX_set_quiet_shutdown.3 stable/8/secure/lib/libssl/man/SSL_CTX_set_session_cache_mode.3 stable/8/secure/lib/libssl/man/SSL_CTX_set_session_id_context.3 stable/8/secure/lib/libssl/man/SSL_CTX_set_ssl_version.3 stable/8/secure/lib/libssl/man/SSL_CTX_set_timeout.3 stable/8/secure/lib/libssl/man/SSL_CTX_set_tmp_dh_callback.3 stable/8/secure/lib/libssl/man/SSL_CTX_set_tmp_rsa_callback.3 stable/8/secure/lib/libssl/man/SSL_CTX_set_verify.3 stable/8/secure/lib/libssl/man/SSL_CTX_use_certificate.3 stable/8/secure/lib/libssl/man/SSL_SESSION_free.3 stable/8/secure/lib/libssl/man/SSL_SESSION_get_ex_new_index.3 stable/8/secure/lib/libssl/man/SSL_SESSION_get_time.3 stable/8/secure/lib/libssl/man/SSL_accept.3 stable/8/secure/lib/libssl/man/SSL_alert_type_string.3 stable/8/secure/lib/libssl/man/SSL_clear.3 stable/8/secure/lib/libssl/man/SSL_connect.3 stable/8/secure/lib/libssl/man/SSL_do_handshake.3 stable/8/secure/lib/libssl/man/SSL_free.3 stable/8/secure/lib/libssl/man/SSL_get_SSL_CTX.3 stable/8/secure/lib/libssl/man/SSL_get_ciphers.3 stable/8/secure/lib/libssl/man/SSL_get_client_CA_list.3 stable/8/secure/lib/libssl/man/SSL_get_current_cipher.3 stable/8/secure/lib/libssl/man/SSL_get_default_timeout.3 stable/8/secure/lib/libssl/man/SSL_get_error.3 stable/8/secure/lib/libssl/man/SSL_get_ex_data_X509_STORE_CTX_idx.3 stable/8/secure/lib/libssl/man/SSL_get_ex_new_index.3 stable/8/secure/lib/libssl/man/SSL_get_fd.3 stable/8/secure/lib/libssl/man/SSL_get_peer_cert_chain.3 stable/8/secure/lib/libssl/man/SSL_get_peer_certificate.3 stable/8/secure/lib/libssl/man/SSL_get_rbio.3 stable/8/secure/lib/libssl/man/SSL_get_session.3 stable/8/secure/lib/libssl/man/SSL_get_verify_result.3 stable/8/secure/lib/libssl/man/SSL_get_version.3 stable/8/secure/lib/libssl/man/SSL_library_init.3 stable/8/secure/lib/libssl/man/SSL_load_client_CA_file.3 stable/8/secure/lib/libssl/man/SSL_new.3 stable/8/secure/lib/libssl/man/SSL_pending.3 stable/8/secure/lib/libssl/man/SSL_read.3 stable/8/secure/lib/libssl/man/SSL_rstate_string.3 stable/8/secure/lib/libssl/man/SSL_session_reused.3 stable/8/secure/lib/libssl/man/SSL_set_bio.3 stable/8/secure/lib/libssl/man/SSL_set_connect_state.3 stable/8/secure/lib/libssl/man/SSL_set_fd.3 stable/8/secure/lib/libssl/man/SSL_set_session.3 stable/8/secure/lib/libssl/man/SSL_set_shutdown.3 stable/8/secure/lib/libssl/man/SSL_set_verify_result.3 stable/8/secure/lib/libssl/man/SSL_shutdown.3 stable/8/secure/lib/libssl/man/SSL_state_string.3 stable/8/secure/lib/libssl/man/SSL_want.3 stable/8/secure/lib/libssl/man/SSL_write.3 stable/8/secure/lib/libssl/man/d2i_SSL_SESSION.3 stable/8/secure/lib/libssl/man/ssl.3 stable/8/secure/usr.bin/openssl/man/CA.pl.1 stable/8/secure/usr.bin/openssl/man/asn1parse.1 stable/8/secure/usr.bin/openssl/man/ca.1 stable/8/secure/usr.bin/openssl/man/ciphers.1 stable/8/secure/usr.bin/openssl/man/crl.1 stable/8/secure/usr.bin/openssl/man/crl2pkcs7.1 stable/8/secure/usr.bin/openssl/man/dgst.1 stable/8/secure/usr.bin/openssl/man/dhparam.1 stable/8/secure/usr.bin/openssl/man/dsa.1 stable/8/secure/usr.bin/openssl/man/dsaparam.1 stable/8/secure/usr.bin/openssl/man/ec.1 stable/8/secure/usr.bin/openssl/man/ecparam.1 stable/8/secure/usr.bin/openssl/man/enc.1 stable/8/secure/usr.bin/openssl/man/errstr.1 stable/8/secure/usr.bin/openssl/man/gendsa.1 stable/8/secure/usr.bin/openssl/man/genrsa.1 stable/8/secure/usr.bin/openssl/man/nseq.1 stable/8/secure/usr.bin/openssl/man/ocsp.1 stable/8/secure/usr.bin/openssl/man/openssl.1 stable/8/secure/usr.bin/openssl/man/passwd.1 stable/8/secure/usr.bin/openssl/man/pkcs12.1 stable/8/secure/usr.bin/openssl/man/pkcs7.1 stable/8/secure/usr.bin/openssl/man/pkcs8.1 stable/8/secure/usr.bin/openssl/man/rand.1 stable/8/secure/usr.bin/openssl/man/req.1 stable/8/secure/usr.bin/openssl/man/rsa.1 stable/8/secure/usr.bin/openssl/man/rsautl.1 stable/8/secure/usr.bin/openssl/man/s_client.1 stable/8/secure/usr.bin/openssl/man/s_server.1 stable/8/secure/usr.bin/openssl/man/s_time.1 stable/8/secure/usr.bin/openssl/man/sess_id.1 stable/8/secure/usr.bin/openssl/man/smime.1 stable/8/secure/usr.bin/openssl/man/speed.1 stable/8/secure/usr.bin/openssl/man/spkac.1 stable/8/secure/usr.bin/openssl/man/verify.1 stable/8/secure/usr.bin/openssl/man/version.1 stable/8/secure/usr.bin/openssl/man/x509.1 stable/8/secure/usr.bin/openssl/man/x509v3_config.1 Directory Properties: stable/8/crypto/openssl/ (props changed) Modified: stable/8/crypto/openssl/CHANGES ============================================================================== --- stable/8/crypto/openssl/CHANGES Fri Mar 8 15:01:40 2013 (r248056) +++ stable/8/crypto/openssl/CHANGES Fri Mar 8 17:28:40 2013 (r248057) @@ -2,6 +2,35 @@ OpenSSL CHANGES _______________ + Changes between 0.9.8x and 0.9.8y [5 Feb 2013] + + *) Make the decoding of SSLv3, TLS and DTLS CBC records constant time. + + This addresses the flaw in CBC record processing discovered by + Nadhem Alfardan and Kenny Paterson. Details of this attack can be found + at: http://www.isg.rhul.ac.uk/tls/ + + Thanks go to Nadhem Alfardan and Kenny Paterson of the Information + Security Group at Royal Holloway, University of London + (www.isg.rhul.ac.uk) for discovering this flaw and Adam Langley and + Emilia Käsper for the initial patch. + (CVE-2013-0169) + [Emilia Käsper, Adam Langley, Ben Laurie, Andy Polyakov, Steve Henson] + + *) Return an error when checking OCSP signatures when key is NULL. + This fixes a DoS attack. (CVE-2013-0166) + [Steve Henson] + + *) Call OCSP Stapling callback after ciphersuite has been chosen, so + the right response is stapled. Also change SSL_get_certificate() + so it returns the certificate actually sent. + See http://rt.openssl.org/Ticket/Display.html?id=2836. + (This is a backport) + [Rob Stradling ] + + *) Fix possible deadlock when decoding public keys. + [Steve Henson] + Changes between 0.9.8w and 0.9.8x [10 May 2012] *) Sanity check record length before skipping explicit IV in DTLS Modified: stable/8/crypto/openssl/Configure ============================================================================== --- stable/8/crypto/openssl/Configure Fri Mar 8 15:01:40 2013 (r248056) +++ stable/8/crypto/openssl/Configure Fri Mar 8 17:28:40 2013 (r248057) @@ -162,6 +162,7 @@ my %table=( "debug-ben-openbsd","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DPEDANTIC -DDEBUG_SAFESTACK -DOPENSSL_OPENBSD_DEV_CRYPTO -DOPENSSL_NO_ASM -O2 -pedantic -Wall -Wshadow -Werror -pipe::(unknown)::::", "debug-ben-openbsd-debug","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DPEDANTIC -DDEBUG_SAFESTACK -DOPENSSL_OPENBSD_DEV_CRYPTO -DOPENSSL_NO_ASM -g3 -O2 -pedantic -Wall -Wshadow -Werror -pipe::(unknown)::::", "debug-ben-debug", "gcc:$gcc_devteam_warn -DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DDEBUG_SAFESTACK -ggdb3 -O2 -pipe::(unknown)::::::", +"debug-ben-debug-64", "gcc:$gcc_devteam_warn -DBN_DEBUG -DCONF_DEBUG -DDEBUG_SAFESTACK -DDEBUG_UNUSED -g3 -O3 -pipe::${BSDthreads}:::SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_UNROLL:${x86_64_asm}:elf:dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", "debug-ben-debug-noopt", "gcc:$gcc_devteam_warn -DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DDEBUG_SAFESTACK -ggdb3 -pipe::(unknown)::::::", "debug-ben-strict", "gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DCONST_STRICT -O2 -Wall -Wshadow -Werror -Wpointer-arith -Wcast-qual -Wwrite-strings -pipe::(unknown)::::::", "debug-rse","cc:-DTERMIOS -DL_ENDIAN -pipe -O -g -ggdb3 -Wall::(unknown):::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}", @@ -172,10 +173,10 @@ my %table=( "debug-steve-opt", "gcc:$gcc_devteam_warn -m64 -O3 -DL_ENDIAN -DTERMIO -DCONF_DEBUG -DDEBUG_SAFESTACK -g -DMD32_REG_T=int::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_UNROLL:${x86_64_asm}:dlfcn:linux-shared:-fPIC:-m64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", "debug-steve", "gcc:-DL_ENDIAN -DREF_CHECK -DCONF_DEBUG -DDEBUG_SAFESTACK -DCRYPTO_MDEBUG_ALL -DPEDANTIC -m32 -g -pedantic -Wno-long-long -Wall -Werror -Wshadow -pipe::-D_REENTRANT::-rdynamic -ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:linux-shared", "debug-steve-linux-pseudo64", "gcc:-DL_ENDIAN -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DDEBUG_SAFESTACK -DCRYPTO_MDEBUG_ALL -DOPENSSL_NO_ASM -g -mcpu=i486 -Wall -Werror -Wshadow -pipe::-D_REENTRANT::-rdynamic -ldl:SIXTY_FOUR_BIT:${no_asm}:dlfcn:linux-shared", -"debug-levitte-linux-elf","gcc:-DLEVITTE_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_DEBUG -DBN_DEBUG_RAND -DCRYPTO_MDEBUG -DENGINE_CONF_DEBUG -DL_ENDIAN -DTERMIO -D_POSIX_SOURCE -DPEDANTIC -ggdb -g3 -mcpu=i486 -pedantic -ansi -Wall -Wshadow -Wcast-align -Wstrict-prototypes -Wmissing-prototypes -Wno-long-long -Wundef -Wconversion -pipe::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", -"debug-levitte-linux-noasm","gcc:-DLEVITTE_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_DEBUG -DBN_DEBUG_RAND -DCRYPTO_MDEBUG -DENGINE_CONF_DEBUG -DOPENSSL_NO_ASM -DL_ENDIAN -DTERMIO -D_POSIX_SOURCE -DPEDANTIC -ggdb -g3 -mcpu=i486 -pedantic -ansi -Wall -Wshadow -Wcast-align -Wstrict-prototypes -Wmissing-prototypes -Wno-long-long -Wundef -Wconversion -pipe::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${no_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", -"debug-levitte-linux-elf-extreme","gcc:-DLEVITTE_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_DEBUG -DBN_DEBUG_RAND -DCRYPTO_MDEBUG -DENGINE_CONF_DEBUG -DL_ENDIAN -DTERMIO -D_POSIX_SOURCE -DPEDANTIC -ggdb -g3 -mcpu=i486 -pedantic -ansi -Wall -W -Wundef -Wshadow -Wcast-align -Wstrict-prototypes -Wmissing-prototypes -Wno-long-long -Wundef -Wconversion -pipe::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", -"debug-levitte-linux-noasm-extreme","gcc:-DLEVITTE_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_DEBUG -DBN_DEBUG_RAND -DCRYPTO_MDEBUG -DENGINE_CONF_DEBUG -DOPENSSL_NO_ASM -DL_ENDIAN -DTERMIO -D_POSIX_SOURCE -DPEDANTIC -ggdb -g3 -mcpu=i486 -pedantic -ansi -Wall -W -Wundef -Wshadow -Wcast-align -Wstrict-prototypes -Wmissing-prototypes -Wno-long-long -Wundef -Wconversion -pipe::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${no_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", +"debug-levitte-linux-elf","gcc:-DLEVITTE_DEBUG -DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DCRYPTO_MDEBUG -DL_ENDIAN -ggdb -g3 -Wall::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", +"debug-levitte-linux-noasm","gcc:-DLEVITTE_DEBUG -DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DCRYPTO_MDEBUG -DOPENSSL_NO_ASM -DL_ENDIAN -ggdb -g3 -Wall::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${no_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", +"debug-levitte-linux-elf-extreme","gcc:-DLEVITTE_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_DEBUG -DBN_DEBUG_RAND -DCRYPTO_MDEBUG -DENGINE_CONF_DEBUG -DL_ENDIAN -DTERMIO -DPEDANTIC -ggdb -g3 -pedantic -ansi -Wall -W -Wundef -Wshadow -Wcast-align -Wstrict-prototypes -Wmissing-prototypes -Wno-long-long -Wundef -Wconversion -pipe::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", +"debug-levitte-linux-noasm-extreme","gcc:-DLEVITTE_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_DEBUG -DBN_DEBUG_RAND -DCRYPTO_MDEBUG -DENGINE_CONF_DEBUG -DOPENSSL_NO_ASM -DL_ENDIAN -DTERMIO -DPEDANTIC -ggdb -g3 -pedantic -ansi -Wall -W -Wundef -Wshadow -Wcast-align -Wstrict-prototypes -Wmissing-prototypes -Wno-long-long -Wundef -Wconversion -pipe::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${no_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", "debug-geoff","gcc:-DBN_DEBUG -DBN_DEBUG_RAND -DBN_STRICT -DPURIFY -DOPENSSL_NO_DEPRECATED -DOPENSSL_NO_ASM -DOPENSSL_NO_INLINE_ASM -DL_ENDIAN -DTERMIO -DPEDANTIC -O1 -ggdb2 -Wall -Werror -Wundef -pedantic -Wshadow -Wpointer-arith -Wbad-function-cast -Wcast-align -Wsign-compare -Wmissing-prototypes -Wmissing-declarations -Wno-long-long::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${no_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", "debug-linux-pentium","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DCRYPTO_MDEBUG -DL_ENDIAN -DTERMIO -g -mcpu=pentium -Wall::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn", "debug-linux-ppro","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DCRYPTO_MDEBUG -DL_ENDIAN -DTERMIO -g -mcpu=pentiumpro -Wall::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn", @@ -428,8 +429,8 @@ my %table=( "aix64-gcc","gcc:-maix64 -O -DB_ENDIAN::-pthread:AIX::SIXTY_FOUR_BIT_LONG RC4_CHAR::aix_ppc64.o::::::::::dlfcn:aix-shared::-maix64 -shared -Wl,-G:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)::-X64", # Below targets assume AIX 5. Idea is to effectively disregard $OBJECT_MODE # at build time. $OBJECT_MODE is respected at ./config stage! -"aix-cc", "cc:-q32 -O -DB_ENDIAN -qmaxmem=16384 -qro -qroconst::-qthreaded:AIX::BN_LLONG RC4_CHAR::aix_ppc32.o::::::::::dlfcn:aix-shared::-q32 -G:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)::-X 32", -"aix64-cc", "cc:-q64 -O -DB_ENDIAN -qmaxmem=16384 -qro -qroconst::-qthreaded:AIX::SIXTY_FOUR_BIT_LONG RC4_CHAR::aix_ppc64.o::::::::::dlfcn:aix-shared::-q64 -G:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)::-X 64", +"aix-cc", "cc:-q32 -O -DB_ENDIAN -qmaxmem=16384 -qro -qroconst::-qthreaded -D_THREAD_SAFE:AIX::BN_LLONG RC4_CHAR::aix_ppc32.o::::::::::dlfcn:aix-shared::-q32 -G:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)::-X 32", +"aix64-cc", "cc:-q64 -O -DB_ENDIAN -qmaxmem=16384 -qro -qroconst::-qthreaded -D_THREAD_SAFE:AIX::SIXTY_FOUR_BIT_LONG RC4_CHAR::aix_ppc64.o::::::::::dlfcn:aix-shared::-q64 -G:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)::-X 64", # # Cray T90 and similar (SDSC) Modified: stable/8/crypto/openssl/FAQ ============================================================================== --- stable/8/crypto/openssl/FAQ Fri Mar 8 15:01:40 2013 (r248056) +++ stable/8/crypto/openssl/FAQ Fri Mar 8 17:28:40 2013 (r248057) @@ -83,7 +83,7 @@ OpenSSL - Frequently Asked Questions * Which is the current version of OpenSSL? The current version is available from . -OpenSSL 1.0.1c was released on May 10th, 2012. +OpenSSL 1.0.1d was released on Feb 5th, 2013. In addition to the current stable release, you can also access daily snapshots of the OpenSSL development version at Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id BAC2F8BE; Fri, 8 Mar 2013 18:46:22 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id A10FEF76; Fri, 8 Mar 2013 18:46:22 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r28IkMlJ018802; Fri, 8 Mar 2013 18:46:22 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r28IkM9B018798; Fri, 8 Mar 2013 18:46:22 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201303081846.r28IkM9B018798@svn.freebsd.org> From: Xin LI Date: Fri, 8 Mar 2013 18:46:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r248062 - in stable: 8/sys/dev/oce 9/sys/dev/oce X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Mar 2013 18:46:22 -0000 Author: delphij Date: Fri Mar 8 18:46:21 2013 New Revision: 248062 URL: http://svnweb.freebsd.org/changeset/base/248062 Log: MFC r231879,246799,247880,248059: Update driver to version 4.6.95.0. Submitted by: "Duvvuru,Venkat Kumar" Modified: stable/9/sys/dev/oce/oce_hw.c stable/9/sys/dev/oce/oce_hw.h stable/9/sys/dev/oce/oce_if.c stable/9/sys/dev/oce/oce_if.h stable/9/sys/dev/oce/oce_mbox.c stable/9/sys/dev/oce/oce_queue.c stable/9/sys/dev/oce/oce_sysctl.c stable/9/sys/dev/oce/oce_util.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) Changes in other areas also in this revision: Modified: stable/8/sys/dev/oce/oce_hw.c stable/8/sys/dev/oce/oce_hw.h stable/8/sys/dev/oce/oce_if.c stable/8/sys/dev/oce/oce_if.h stable/8/sys/dev/oce/oce_mbox.c stable/8/sys/dev/oce/oce_queue.c stable/8/sys/dev/oce/oce_sysctl.c stable/8/sys/dev/oce/oce_util.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/dev/ (props changed) stable/8/sys/dev/oce/ (props changed) Modified: stable/9/sys/dev/oce/oce_hw.c ============================================================================== --- stable/9/sys/dev/oce/oce_hw.c Fri Mar 8 18:15:07 2013 (r248061) +++ stable/9/sys/dev/oce/oce_hw.c Fri Mar 8 18:46:21 2013 (r248062) @@ -340,8 +340,10 @@ oce_hw_shutdown(POCE_SOFTC sc) oce_stats_free(sc); /* disable hardware interrupts */ oce_hw_intr_disable(sc); +#if defined(INET6) || defined(INET) /* Free LRO resources */ oce_free_lro(sc); +#endif /* Release queue*/ oce_queue_release_all(sc); /*Delete Network Interface*/ @@ -403,11 +405,6 @@ oce_create_nw_interface(POCE_SOFTC sc) sc->if_cap_flags = capab_en_flags; - /* Enable VLAN Promisc on HW */ - rc = oce_config_vlan(sc, (uint8_t) sc->if_id, NULL, 0, 1, 1); - if (rc) - goto error; - /* set default flow control */ rc = oce_set_flow_control(sc, sc->flow_control); if (rc) @@ -475,12 +472,9 @@ oce_hw_start(POCE_SOFTC sc) return 1; if (link.logical_link_status == NTWK_LOGICAL_LINK_UP) { - sc->ifp->if_drv_flags |= IFF_DRV_RUNNING; sc->link_status = NTWK_LOGICAL_LINK_UP; if_link_state_change(sc->ifp, LINK_STATE_UP); } else { - sc->ifp->if_drv_flags &= - ~(IFF_DRV_RUNNING | IFF_DRV_OACTIVE); sc->link_status = NTWK_LOGICAL_LINK_DOWN; if_link_state_change(sc->ifp, LINK_STATE_DOWN); } @@ -494,12 +488,17 @@ oce_hw_start(POCE_SOFTC sc) rc = oce_start_mq(sc->mq); - /* we need to get MCC aync events. - So enable intrs and also arm first EQ + /* we need to get MCC aync events. So enable intrs and arm + first EQ, Other EQs will be armed after interface is UP */ oce_hw_intr_enable(sc); oce_arm_eq(sc, sc->eq[0]->eq_id, 0, TRUE, FALSE); + /* Send first mcc cmd and after that we get gracious + MCC notifications from FW + */ + oce_first_mcc_cmd(sc); + return rc; } @@ -537,8 +536,8 @@ oce_hw_intr_disable(POCE_SOFTC sc) /** - * @brief Function for hardware update multicast filter - * @param sc software handle to the device + * @brief Function for hardware update multicast filter + * @param sc software handle to the device */ int oce_hw_update_multicast(POCE_SOFTC sc) Modified: stable/9/sys/dev/oce/oce_hw.h ============================================================================== --- stable/9/sys/dev/oce/oce_hw.h Fri Mar 8 18:15:07 2013 (r248061) +++ stable/9/sys/dev/oce/oce_hw.h Fri Mar 8 18:46:21 2013 (r248062) @@ -154,6 +154,12 @@ #define ASYNC_EVENT_CODE_LINK_STATE 0x1 #define ASYNC_EVENT_LINK_UP 0x1 #define ASYNC_EVENT_LINK_DOWN 0x0 +#define ASYNC_EVENT_GRP5 0x5 +#define ASYNC_EVENT_CODE_DEBUG 0x6 +#define ASYNC_EVENT_PVID_STATE 0x3 +#define ASYNC_EVENT_DEBUG_QNQ 0x1 +#define ASYNC_EVENT_CODE_SLIPORT 0x11 +#define VLAN_VID_MASK 0x0FFF /* port link_status */ #define ASYNC_EVENT_LOGICAL 0x02 @@ -610,7 +616,10 @@ struct oce_mq_cqe { uint32_t hpi_buffer_cmpl:1; uint32_t completed:1; uint32_t consumed:1; - uint32_t rsvd0:27; + uint32_t rsvd0:3; + uint32_t async_type:8; + uint32_t event_type:8; + uint32_t rsvd1:8; #else /* dw0 */ uint32_t completion_status:16; @@ -618,7 +627,10 @@ struct oce_mq_cqe { /* dw1 dw2 */ uint32_t mq_tag[2]; /* dw3 */ - uint32_t rsvd0:27; + uint32_t rsvd1:8; + uint32_t event_type:8; + uint32_t async_type:8; + uint32_t rsvd0:3; uint32_t consumed:1; uint32_t completed:1; uint32_t hpi_buffer_cmpl:1; @@ -687,6 +699,112 @@ struct oce_async_cqe_link_state { } u0; }; + +/* PVID aync event */ +struct oce_async_event_grp5_pvid_state { + uint8_t enabled; + uint8_t rsvd0; + uint16_t tag; + uint32_t event_tag; + uint32_t rsvd1; + uint32_t code; +}; + +/* async event indicating outer VLAN tag in QnQ */ +struct oce_async_event_qnq { + uint8_t valid; /* Indicates if outer VLAN is valid */ + uint8_t rsvd0; + uint16_t vlan_tag; + uint32_t event_tag; + uint8_t rsvd1[4]; + uint32_t code; +} ; + + +typedef union oce_mq_ext_ctx_u { + uint32_t dw[6]; + struct { + #ifdef _BIG_ENDIAN + /* dw0 */ + uint32_t dw4rsvd1:16; + uint32_t num_pages:16; + /* dw1 */ + uint32_t async_evt_bitmap; + /* dw2 */ + uint32_t cq_id:10; + uint32_t dw5rsvd2:2; + uint32_t ring_size:4; + uint32_t dw5rsvd1:16; + /* dw3 */ + uint32_t valid:1; + uint32_t dw6rsvd1:31; + /* dw4 */ + uint32_t dw7rsvd1:21; + uint32_t async_cq_id:10; + uint32_t async_cq_valid:1; + #else + /* dw0 */ + uint32_t num_pages:16; + uint32_t dw4rsvd1:16; + /* dw1 */ + uint32_t async_evt_bitmap; + /* dw2 */ + uint32_t dw5rsvd1:16; + uint32_t ring_size:4; + uint32_t dw5rsvd2:2; + uint32_t cq_id:10; + /* dw3 */ + uint32_t dw6rsvd1:31; + uint32_t valid:1; + /* dw4 */ + uint32_t async_cq_valid:1; + uint32_t async_cq_id:10; + uint32_t dw7rsvd1:21; + #endif + /* dw5 */ + uint32_t dw8rsvd1; + } v0; + struct { + #ifdef _BIG_ENDIAN + /* dw0 */ + uint32_t cq_id:16; + uint32_t num_pages:16; + /* dw1 */ + uint32_t async_evt_bitmap; + /* dw2 */ + uint32_t dw5rsvd2:12; + uint32_t ring_size:4; + uint32_t async_cq_id:16; + /* dw3 */ + uint32_t valid:1; + uint32_t dw6rsvd1:31; + /* dw4 */ + uint32_t dw7rsvd1:31; + uint32_t async_cq_valid:1; + #else + /* dw0 */ + uint32_t num_pages:16; + uint32_t cq_id:16; + /* dw1 */ + uint32_t async_evt_bitmap; + /* dw2 */ + uint32_t async_cq_id:16; + uint32_t ring_size:4; + uint32_t dw5rsvd2:12; + /* dw3 */ + uint32_t dw6rsvd1:31; + uint32_t valid:1; + /* dw4 */ + uint32_t async_cq_valid:1; + uint32_t dw7rsvd1:31; + #endif + /* dw5 */ + uint32_t dw8rsvd1; + } v1; + +} oce_mq_ext_ctx_t; + + /* MQ mailbox structure */ struct oce_bmbx { struct oce_mbx mbx; @@ -760,6 +878,7 @@ enum COMMON_SUBSYSTEM_OPCODES { OPCODE_COMMON_SET_BEACON_CONFIG = 69, OPCODE_COMMON_GET_BEACON_CONFIG = 70, OPCODE_COMMON_GET_PHYSICAL_LINK_CONFIG = 71, + OPCODE_COMMON_READ_TRANSRECEIVER_DATA = 73, OPCODE_COMMON_GET_OEM_ATTRIBUTES = 76, OPCODE_COMMON_GET_PORT_NAME = 77, OPCODE_COMMON_GET_CONFIG_SIGNATURE = 78, @@ -1342,6 +1461,23 @@ struct mbx_create_common_mq { } params; }; +struct mbx_create_common_mq_ex { + struct mbx_hdr hdr; + union { + struct { + oce_mq_ext_ctx_t context; + struct phys_addr pages[8]; + } req; + + struct { + uint32_t mq_id:16; + uint32_t rsvd0:16; + } rsp; + } params; +}; + + + /* [53] OPCODE_COMMON_DESTROY_MQ */ struct mbx_destroy_common_mq { struct mbx_hdr hdr; @@ -1584,7 +1720,7 @@ enum CQFW_FUNCTION_MODES_SUPPORTED { FNM_BE3_COMPAT_MODE = 0x10000, /* BE3 features */ FNM_VNIC_MODE = 0x20000, /* Set when IBM vNIC mode is set */ FNM_VNTAG_MODE = 0x40000, /* Set when VNTAG mode is set */ - FNM_UMC_MODE = 0x80000, /* Set when UMC mode is set */ + FNM_UMC_MODE = 0x1000000, /* Set when UMC mode is set */ FNM_UMC_DEF_EN = 0x100000, /* Set when UMC Default is set */ FNM_ONE_GB_EN = 0x200000, /* Set when 1GB Default is set */ FNM_VNIC_DEF_VALID = 0x400000, /* Set when VNIC_DEF_EN is valid */ @@ -1641,6 +1777,12 @@ struct mbx_set_common_iface_rx_filter { } params; }; +struct be_set_eqd { + uint32_t eq_id; + uint32_t phase; + uint32_t dm; +}; + /* [41] OPCODE_COMMON_MODIFY_EQ_DELAY */ struct mbx_modify_common_eq_delay { struct mbx_hdr hdr; @@ -1660,6 +1802,76 @@ struct mbx_modify_common_eq_delay { } params; }; +/* [32] OPCODE_COMMON_GET_CNTL_ATTRIBUTES */ + +struct mgmt_hba_attr { + int8_t flashrom_ver_str[32]; + int8_t manufac_name[32]; + uint32_t supp_modes; + int8_t seeprom_ver_lo; + int8_t seeprom_ver_hi; + int8_t rsvd0[2]; + uint32_t ioctl_data_struct_ver; + uint32_t ep_fw_data_struct_ver; + uint8_t ncsi_ver_str[12]; + uint32_t def_ext_to; + int8_t cntl_mod_num[32]; + int8_t cntl_desc[64]; + int8_t cntl_ser_num[32]; + int8_t ip_ver_str[32]; + int8_t fw_ver_str[32]; + int8_t bios_ver_str[32]; + int8_t redboot_ver_str[32]; + int8_t drv_ver_str[32]; + int8_t fw_on_flash_ver_str[32]; + uint32_t funcs_supp; + uint16_t max_cdblen; + uint8_t asic_rev; + uint8_t gen_guid[16]; + uint8_t hba_port_count; + uint16_t default_link_down_timeout; + uint8_t iscsi_ver_min_max; + uint8_t multifunc_dev; + uint8_t cache_valid; + uint8_t hba_status; + uint8_t max_domains_supp; + uint8_t phy_port; + uint32_t fw_post_status; + uint32_t hba_mtu[8]; + uint8_t iSCSI_feat; + uint8_t asic_gen; + uint8_t future_u8[2]; + uint32_t future_u32[3]; +}; + +struct mgmt_cntl_attr { + struct mgmt_hba_attr hba_attr; + uint16_t pci_vendor_id; + uint16_t pci_device_id; + uint16_t pci_sub_vendor_id; + uint16_t pci_sub_system_id; + uint8_t pci_bus_num; + uint8_t pci_dev_num; + uint8_t pci_func_num; + uint8_t interface_type; + uint64_t unique_id; + uint8_t netfilters; + uint8_t rsvd0[3]; + uint32_t future_u32[4]; +}; + +struct mbx_common_get_cntl_attr { + struct mbx_hdr hdr; + union { + struct { + uint32_t rsvd0; + } req; + struct { + struct mgmt_cntl_attr cntl_attr_info; + } rsp; + } params; +}; + /* [59] OPCODE_ADD_COMMON_IFACE_MAC */ struct mbx_add_common_iface_mac { struct mbx_hdr hdr; @@ -1702,6 +1914,23 @@ struct ioctl_common_function_reset { struct mbx_hdr hdr; }; +/* [73] OPCODE_COMMON_READ_TRANSRECEIVER_DATA */ +struct mbx_read_common_transrecv_data { + struct mbx_hdr hdr; + union { + struct { + uint32_t page_num; + uint32_t port; + } req; + struct { + uint32_t page_num; + uint32_t port; + uint32_t page_data[32]; + } rsp; + } params; + +}; + /* [80] OPCODE_COMMON_FUNCTION_LINK_CONFIG */ struct mbx_common_func_link_cfg { struct mbx_hdr hdr; @@ -2027,7 +2256,9 @@ enum RSS_ENABLE_FLAGS { RSS_ENABLE_IPV4 = 0x1, /* (IPV4 HASH enabled ) */ RSS_ENABLE_TCP_IPV4 = 0x2, /* (TCP IPV4 Hash enabled) */ RSS_ENABLE_IPV6 = 0x4, /* (IPV6 HASH enabled) */ - RSS_ENABLE_TCP_IPV6 = 0x8 /* (TCP IPV6 HASH */ + RSS_ENABLE_TCP_IPV6 = 0x8, /* (TCP IPV6 HASH */ + RSS_ENABLE_UDP_IPV4 = 0x10, /* UDP IPV4 HASH */ + RSS_ENABLE_UDP_IPV6 = 0x20 /* UDP IPV6 HASH */ }; #define RSS_ENABLE (RSS_ENABLE_IPV4 | RSS_ENABLE_TCP_IPV4) #define RSS_DISABLE RSS_ENABLE_NONE Modified: stable/9/sys/dev/oce/oce_if.c ============================================================================== --- stable/9/sys/dev/oce/oce_if.c Fri Mar 8 18:15:07 2013 (r248061) +++ stable/9/sys/dev/oce/oce_if.c Fri Mar 8 18:46:21 2013 (r248062) @@ -71,10 +71,6 @@ static int oce_tx(POCE_SOFTC sc, struct static void oce_tx_restart(POCE_SOFTC sc, struct oce_wq *wq); static void oce_tx_complete(struct oce_wq *wq, uint32_t wqe_idx, uint32_t status); -#if defined(INET6) || defined(INET) -static struct mbuf * oce_tso_setup(POCE_SOFTC sc, struct mbuf **mpp, - uint16_t *mss); -#endif static int oce_multiq_transmit(struct ifnet *ifp, struct mbuf *m, struct oce_wq *wq); @@ -82,9 +78,6 @@ static int oce_multiq_transmit(struct i static void oce_discard_rx_comp(struct oce_rq *rq, struct oce_nic_rx_cqe *cqe); static int oce_cqe_vtp_valid(POCE_SOFTC sc, struct oce_nic_rx_cqe *cqe); static int oce_cqe_portid_valid(POCE_SOFTC sc, struct oce_nic_rx_cqe *cqe); -#if defined(INET6) || defined(INET) -static void oce_rx_flush_lro(struct oce_rq *rq); -#endif static void oce_rx(struct oce_rq *rq, uint32_t rqe_idx, struct oce_nic_rx_cqe *cqe); @@ -96,13 +89,21 @@ static int oce_vid_config(POCE_SOFTC sc static void oce_mac_addr_set(POCE_SOFTC sc); static int oce_handle_passthrough(struct ifnet *ifp, caddr_t data); static void oce_local_timer(void *arg); -#if defined(INET6) || defined(INET) -static int oce_init_lro(POCE_SOFTC sc); -#endif static void oce_if_deactivate(POCE_SOFTC sc); static void oce_if_activate(POCE_SOFTC sc); static void setup_max_queues_want(POCE_SOFTC sc); static void update_queues_got(POCE_SOFTC sc); +static void process_link_state(POCE_SOFTC sc, + struct oce_async_cqe_link_state *acqe); +static int oce_tx_asic_stall_verify(POCE_SOFTC sc, struct mbuf *m); +static struct mbuf *oce_insert_vlan_tag(POCE_SOFTC sc, struct mbuf *m, boolean_t *complete); + +/* IP specific */ +#if defined(INET6) || defined(INET) +static int oce_init_lro(POCE_SOFTC sc); +static void oce_rx_flush_lro(struct oce_rq *rq); +static struct mbuf * oce_tso_setup(POCE_SOFTC sc, struct mbuf **mpp); +#endif static device_method_t oce_dispatch[] = { DEVMETHOD(device_probe, oce_probe), @@ -157,10 +158,10 @@ static uint32_t supportedDevices[] = { static int oce_probe(device_t dev) { - uint16_t vendor; - uint16_t device; - int i; - char str[80]; + uint16_t vendor = 0; + uint16_t device = 0; + int i = 0; + char str[256] = {0}; POCE_SOFTC sc; sc = device_get_softc(dev); @@ -170,11 +171,10 @@ oce_probe(device_t dev) vendor = pci_get_vendor(dev); device = pci_get_device(dev); - for (i = 0; i < (sizeof(supportedDevices) / sizeof(uint16_t)); i++) { + for (i = 0; i < (sizeof(supportedDevices) / sizeof(uint32_t)); i++) { if (vendor == ((supportedDevices[i] >> 16) & 0xffff)) { if (device == (supportedDevices[i] & 0xffff)) { - sprintf(str, "%s:%s", - "Emulex CNA NIC function", + sprintf(str, "%s:%s", "Emulex CNA NIC function", component_revision); device_set_desc_copy(dev, str); @@ -228,37 +228,30 @@ oce_attach(device_t dev) if (rc) goto pci_res_free; - setup_max_queues_want(sc); - rc = oce_setup_intr(sc); if (rc) goto mbox_free; - rc = oce_queue_init_all(sc); if (rc) goto intr_free; - rc = oce_attach_ifp(sc); if (rc) goto queues_free; - #if defined(INET6) || defined(INET) rc = oce_init_lro(sc); if (rc) - goto ifp_free; + goto ifp_free; #endif - rc = oce_hw_start(sc); if (rc) goto lro_free; - sc->vlan_attach = EVENTHANDLER_REGISTER(vlan_config, oce_add_vlan, sc, EVENTHANDLER_PRI_FIRST); sc->vlan_detach = EVENTHANDLER_REGISTER(vlan_unconfig, @@ -270,7 +263,6 @@ oce_attach(device_t dev) oce_add_sysctls(sc); - callout_init(&sc->timer, CALLOUT_MPSAFE); rc = callout_reset(&sc->timer, 2 * hz, oce_local_timer, sc); if (rc) @@ -315,9 +307,7 @@ oce_detach(device_t dev) POCE_SOFTC sc = device_get_softc(dev); LOCK(&sc->dev_lock); - oce_if_deactivate(sc); - UNLOCK(&sc->dev_lock); callout_drain(&sc->timer); @@ -359,34 +349,11 @@ oce_ioctl(struct ifnet *ifp, u_long comm uint32_t u; switch (command) { - case SIOCGIFPSRCADDR_IN6: - rc = ether_ioctl(ifp, command, data); - break; - - case SIOCGIFPSRCADDR: - rc = ether_ioctl(ifp, command, data); - break; - - case SIOCGIFSTATUS: - rc = ether_ioctl(ifp, command, data); - break; case SIOCGIFMEDIA: rc = ifmedia_ioctl(ifp, ifr, &sc->media, command); break; - case SIOCSIFMEDIA: - rc = ether_ioctl(ifp, command, data); - break; - - case SIOCGIFGENERIC: - rc = ether_ioctl(ifp, command, data); - break; - - case SIOCGETMIFCNT_IN6: - rc = ether_ioctl(ifp, command, data); - break; - case SIOCSIFMTU: if (ifr->ifr_mtu > OCE_MAX_MTU) rc = EINVAL; @@ -474,7 +441,6 @@ oce_ioctl(struct ifnet *ifp, u_long comm ifp->if_capenable ^= IFCAP_VLAN_HWFILTER; oce_vid_config(sc); } - #if defined(INET6) || defined(INET) if (u & IFCAP_LRO) ifp->if_capenable ^= IFCAP_LRO; @@ -518,7 +484,7 @@ oce_multiq_start(struct ifnet *ifp, stru struct oce_wq *wq = NULL; int queue_index = 0; int status = 0; - + if ((m->m_flags & M_FLOWID) != 0) queue_index = m->m_pkthdr.flowid % sc->nwqs; @@ -601,6 +567,7 @@ oce_intr(void *arg, int pending) eq_arm: oce_arm_eq(sc, eq->eq_id, 0, TRUE, FALSE); + return; } @@ -666,6 +633,8 @@ oce_fast_isr(void *arg) taskqueue_enqueue_fast(ii->tq, &ii->task); + ii->eq->intr++; + return FILTER_HANDLED; } @@ -813,9 +782,7 @@ oce_tx(POCE_SOFTC sc, struct mbuf **mpp, struct oce_nic_frag_wqe *nicfrag; int num_wqes; uint32_t reg_value; -#if defined(INET6) || defined(INET) - uint16_t mss = 0; -#endif + boolean_t complete = TRUE; m = *mpp; if (!m) @@ -826,10 +793,19 @@ oce_tx(POCE_SOFTC sc, struct mbuf **mpp, goto free_ret; } + if(oce_tx_asic_stall_verify(sc, m)) { + m = oce_insert_vlan_tag(sc, m, &complete); + if(!m) { + device_printf(sc->dev, "Insertion unsuccessful\n"); + return 0; + } + + } + if (m->m_pkthdr.csum_flags & CSUM_TSO) { -#if defined(INET6) || defined(INET) /* consolidate packet buffers for TSO/LSO segment offload */ - m = oce_tso_setup(sc, mpp, &mss); +#if defined(INET6) || defined(INET) + m = oce_tso_setup(sc, mpp); #else m = NULL; #endif @@ -873,15 +849,15 @@ retry: nichdr->u0.dw[2] = 0; nichdr->u0.dw[3] = 0; - nichdr->u0.s.complete = 1; + nichdr->u0.s.complete = complete; nichdr->u0.s.event = 1; nichdr->u0.s.crc = 1; nichdr->u0.s.forward = 0; nichdr->u0.s.ipcs = (m->m_pkthdr.csum_flags & CSUM_IP) ? 1 : 0; nichdr->u0.s.udpcs = - (m->m_pkthdr.csum_flags & CSUM_UDP) ? 1 : 0; + (m->m_pkthdr.csum_flags & CSUM_UDP) ? 1 : 0; nichdr->u0.s.tcpcs = - (m->m_pkthdr.csum_flags & CSUM_TCP) ? 1 : 0; + (m->m_pkthdr.csum_flags & CSUM_TCP) ? 1 : 0; nichdr->u0.s.num_wqe = num_wqes; nichdr->u0.s.total_length = m->m_pkthdr.len; if (m->m_flags & M_VLANTAG) { @@ -931,7 +907,7 @@ retry: wq->tx_stats.tx_wrbs += num_wqes; wq->tx_stats.tx_bytes += m->m_pkthdr.len; wq->tx_stats.tx_pkts++; - + bus_dmamap_sync(wq->ring->dma.tag, wq->ring->dma.map, BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); reg_value = (num_wqes << 16) | wq->wq_id; @@ -1012,9 +988,10 @@ oce_tx_restart(POCE_SOFTC sc, struct oce } + #if defined(INET6) || defined(INET) static struct mbuf * -oce_tso_setup(POCE_SOFTC sc, struct mbuf **mpp, uint16_t *mss) +oce_tso_setup(POCE_SOFTC sc, struct mbuf **mpp) { struct mbuf *m; #ifdef INET @@ -1025,12 +1002,10 @@ oce_tso_setup(POCE_SOFTC sc, struct mbuf #endif struct ether_vlan_header *eh; struct tcphdr *th; - int total_len = 0; uint16_t etype; - int ehdrlen = 0; + int total_len = 0, ehdrlen = 0; m = *mpp; - *mss = m->m_pkthdr.tso_segsz; if (M_WRITABLE(m) == 0) { m = m_dup(*mpp, M_DONTWAIT); @@ -1049,7 +1024,6 @@ oce_tso_setup(POCE_SOFTC sc, struct mbuf ehdrlen = ETHER_HDR_LEN; } - switch (etype) { #ifdef INET case ETHERTYPE_IP: @@ -1084,7 +1058,6 @@ oce_tso_setup(POCE_SOFTC sc, struct mbuf } #endif /* INET6 || INET */ - void oce_tx_task(void *arg, int npending) { @@ -1115,22 +1088,26 @@ oce_start(struct ifnet *ifp) POCE_SOFTC sc = ifp->if_softc; struct mbuf *m; int rc = 0; + int def_q = 0; /* Defualt tx queue is 0*/ if ((ifp->if_drv_flags & (IFF_DRV_RUNNING | IFF_DRV_OACTIVE)) != IFF_DRV_RUNNING) return; + + if (!sc->link_status) + return; do { IF_DEQUEUE(&sc->ifp->if_snd, m); if (m == NULL) break; - /* oce_start always uses default TX queue 0 */ - LOCK(&sc->wq[0]->tx_lock); - rc = oce_tx(sc, &m, 0); - UNLOCK(&sc->wq[0]->tx_lock); + + LOCK(&sc->wq[def_q]->tx_lock); + rc = oce_tx(sc, &m, def_q); + UNLOCK(&sc->wq[def_q]->tx_lock); if (rc) { if (m != NULL) { - sc->wq[0]->tx_stats.tx_stops ++; + sc->wq[def_q]->tx_stats.tx_stops ++; ifp->if_drv_flags |= IFF_DRV_OACTIVE; IFQ_DRV_PREPEND(&ifp->if_snd, m); m = NULL; @@ -1140,7 +1117,7 @@ oce_start(struct ifnet *ifp) if (m != NULL) ETHER_BPF_MTAP(ifp, m); - } while (1); + } while (TRUE); return; } @@ -1250,13 +1227,19 @@ oce_rx(struct oce_rq *rq, uint32_t rqe_i uint16_t vtag; len = cqe->u0.s.pkt_size; - vtag = cqe->u0.s.vlan_tag; if (!len) { /*partial DMA workaround for Lancer*/ oce_discard_rx_comp(rq, cqe); goto exit; } + /* Get vlan_tag value */ + if(IS_BE(sc)) + vtag = BSWAP_16(cqe->u0.s.vlan_tag); + else + vtag = cqe->u0.s.vlan_tag; + + for (i = 0; i < cqe->u0.s.num_fragments; i++) { if (rq->packets_out == rq->packets_in) { @@ -1292,7 +1275,7 @@ oce_rx(struct oce_rq *rq, uint32_t rqe_i pd->mbuf->m_pkthdr.csum_data = 0xffff; } if (cqe->u0.s.ip_cksum_pass) { - if (!cqe->u0.s.ip_ver) { //IPV4 + if (!cqe->u0.s.ip_ver) { /* IPV4 */ pd->mbuf->m_pkthdr.csum_flags |= (CSUM_IP_CHECKED|CSUM_IP_VALID); } @@ -1315,24 +1298,20 @@ oce_rx(struct oce_rq *rq, uint32_t rqe_i m->m_pkthdr.flowid = rq->queue_index; m->m_flags |= M_FLOWID; #endif - //This deternies if vlan tag is present + /* This deternies if vlan tag is Valid */ if (oce_cqe_vtp_valid(sc, cqe)) { if (sc->function_mode & FNM_FLEX10_MODE) { - /* FLEX10 */ + /* FLEX10. If QnQ is not set, neglect VLAN */ if (cqe->u0.s.qnq) { - /* If QnQ is not set, neglect VLAN */ - if (IS_BE(sc)) - m->m_pkthdr.ether_vtag = - BSWAP_16(vtag); - else - m->m_pkthdr.ether_vtag = vtag; + m->m_pkthdr.ether_vtag = vtag; m->m_flags |= M_VLANTAG; } - } else { - if (IS_BE(sc)) - m->m_pkthdr.ether_vtag = BSWAP_16(vtag); - else - m->m_pkthdr.ether_vtag = vtag; + } else if (sc->pvid != (vtag & VLAN_VID_MASK)) { + /* In UMC mode generally pvid will be striped by + hw. But in some cases we have seen it comes + with pvid. So if pvid == vlan, neglect vlan. + */ + m->m_pkthdr.ether_vtag = vtag; m->m_flags |= M_VLANTAG; } } @@ -1341,7 +1320,6 @@ oce_rx(struct oce_rq *rq, uint32_t rqe_i #if defined(INET6) || defined(INET) /* Try to queue to LRO */ if (IF_LRO_ENABLED(sc) && - !(m->m_flags & M_VLANTAG) && (cqe->u0.s.ip_cksum_pass) && (cqe->u0.s.l4_cksum_pass) && (!cqe->u0.s.ip_ver) && @@ -1381,13 +1359,6 @@ oce_discard_rx_comp(struct oce_rq *rq, s POCE_SOFTC sc = (POCE_SOFTC) rq->parent; int num_frags = cqe->u0.s.num_fragments; - if (IS_XE201(sc) && cqe->u0.s.error) { - /* Lancer A0 workaround - * num_frags will be 1 more than actual in case of error - */ - if (num_frags) - num_frags -= 1; - } for (i = 0; i < num_frags; i++) { if (rq->packets_out == rq->packets_in) { device_printf(sc->dev, @@ -1417,9 +1388,8 @@ oce_cqe_vtp_valid(POCE_SOFTC sc, struct if (sc->be3_native) { cqe_v1 = (struct oce_nic_rx_cqe_v1 *)cqe; vtp = cqe_v1->u0.s.vlan_tag_present; - } else { + } else vtp = cqe->u0.s.vlan_tag_present; - } return vtp; @@ -1444,7 +1414,6 @@ oce_cqe_portid_valid(POCE_SOFTC sc, stru } - #if defined(INET6) || defined(INET) static void oce_rx_flush_lro(struct oce_rq *rq) @@ -1484,12 +1453,11 @@ oce_init_lro(POCE_SOFTC sc) return rc; } -#endif /* INET6 || INET */ + void oce_free_lro(POCE_SOFTC sc) { -#if defined(INET6) || defined(INET) struct lro_ctrl *lro = NULL; int i = 0; @@ -1498,9 +1466,8 @@ oce_free_lro(POCE_SOFTC sc) if (lro) tcp_lro_free(lro); } -#endif } - +#endif int oce_alloc_rx_bufs(struct oce_rq *rq, int count) @@ -1513,7 +1480,7 @@ oce_alloc_rx_bufs(struct oce_rq *rq, int struct oce_nic_rqe *rqe; pd_rxulp_db_t rxdb_reg; - + bzero(&rxdb_reg, sizeof(pd_rxulp_db_t)); for (i = 0; i < count; i++) { in = rq->packets_in + 1; if (in == OCE_RQ_PACKET_ARRAY_SIZE) @@ -1554,14 +1521,12 @@ oce_alloc_rx_bufs(struct oce_rq *rq, int } if (added != 0) { for (i = added / OCE_MAX_RQ_POSTS; i > 0; i--) { - DELAY(1); rxdb_reg.bits.num_posted = OCE_MAX_RQ_POSTS; rxdb_reg.bits.qid = rq->rq_id; OCE_WRITE_REG32(sc, db, PD_RXULP_DB, rxdb_reg.dw0); added -= OCE_MAX_RQ_POSTS; } if (added > 0) { - DELAY(1); rxdb_reg.bits.qid = rq->rq_id; rxdb_reg.bits.num_posted = added; OCE_WRITE_REG32(sc, db, PD_RXULP_DB, rxdb_reg.dw0); @@ -1596,13 +1561,8 @@ oce_rq_handler(void *arg) } else { rq->rx_stats.rxcp_err++; sc->ifp->if_ierrors++; - if (IS_XE201(sc)) - /* Lancer A0 no buffer workaround */ - oce_discard_rx_comp(rq, cqe); - else - /* Post L3/L4 errors to stack.*/ - oce_rx(rq, cqe->u0.s.frag_index, cqe); - + /* Post L3/L4 errors to stack.*/ + oce_rx(rq, cqe->u0.s.frag_index, cqe); } rq->rx_stats.rx_compl++; cqe->u0.dw[2] = 0; @@ -1622,6 +1582,7 @@ oce_rq_handler(void *arg) if (num_cqes >= (IS_XE201(sc) ? 8 : oce_max_rsp_handled)) break; } + #if defined(INET6) || defined(INET) if (IF_LRO_ENABLED(sc)) oce_rx_flush_lro(rq); @@ -1684,9 +1645,11 @@ oce_attach_ifp(POCE_SOFTC sc) sc->ifp->if_capabilities = OCE_IF_CAPABILITIES; sc->ifp->if_capabilities |= IFCAP_HWCSUM; sc->ifp->if_capabilities |= IFCAP_VLAN_HWFILTER; + #if defined(INET6) || defined(INET) sc->ifp->if_capabilities |= IFCAP_TSO; sc->ifp->if_capabilities |= IFCAP_LRO; + sc->ifp->if_capabilities |= IFCAP_VLAN_HWTSO; #endif sc->ifp->if_capenable = sc->ifp->if_capabilities; @@ -1796,18 +1759,18 @@ oce_handle_passthrough(struct ifnet *ifp uint32_t req_size; struct mbx_hdr req; OCE_DMA_MEM dma_mem; - + struct mbx_common_get_cntl_attr *fw_cmd; if (copyin(priv_data, cookie, strlen(IOCTL_COOKIE))) return EFAULT; - + if (memcmp(cookie, IOCTL_COOKIE, strlen(IOCTL_COOKIE))) return EINVAL; - + ioctl_ptr = (char *)priv_data + strlen(IOCTL_COOKIE); if (copyin(ioctl_ptr, &req, sizeof(struct mbx_hdr))) return EFAULT; - + req_size = le32toh(req.u0.req.request_length); if (req_size > 65536) return EINVAL; @@ -1831,12 +1794,86 @@ oce_handle_passthrough(struct ifnet *ifp if (copyout(OCE_DMAPTR(&dma_mem,char), ioctl_ptr, req_size)) rc = EFAULT; + /* + firmware is filling all the attributes for this ioctl except + the driver version..so fill it + */ + if(req.u0.rsp.opcode == OPCODE_COMMON_GET_CNTL_ATTRIBUTES) { + fw_cmd = (struct mbx_common_get_cntl_attr *) ioctl_ptr; + strncpy(fw_cmd->params.rsp.cntl_attr_info.hba_attr.drv_ver_str, + COMPONENT_REVISION, strlen(COMPONENT_REVISION)); + } + dma_free: oce_dma_free(sc, &dma_mem); return rc; } +static void +oce_eqd_set_periodic(POCE_SOFTC sc) +{ + struct oce_set_eqd set_eqd[OCE_MAX_EQ]; + struct oce_aic_obj *aic; + struct oce_eq *eqo; + uint64_t now = 0, delta; + int eqd, i, num = 0; + uint32_t ips = 0; + int tps; + + for (i = 0 ; i < sc->neqs; i++) { + eqo = sc->eq[i]; + aic = &sc->aic_obj[i]; + /* When setting the static eq delay from the user space */ + if (!aic->enable) { + eqd = aic->et_eqd; + goto modify_eqd; + } + + now = ticks; + + /* Over flow check */ + if ((now < aic->ticks) || (eqo->intr < aic->intr_prev)) + goto done; + + delta = now - aic->ticks; + tps = delta/hz; + + /* Interrupt rate based on elapsed ticks */ + if(tps) + ips = (uint32_t)(eqo->intr - aic->intr_prev) / tps; + *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable@FreeBSD.ORG Fri Mar 8 18:46:23 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 5B46D8BF; Fri, 8 Mar 2013 18:46:23 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 485B3F77; Fri, 8 Mar 2013 18:46:23 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r28IkNbB018814; Fri, 8 Mar 2013 18:46:23 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r28IkMwp018808; Fri, 8 Mar 2013 18:46:22 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201303081846.r28IkMwp018808@svn.freebsd.org> From: Xin LI Date: Fri, 8 Mar 2013 18:46:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r248062 - in stable: 8/sys/dev/oce 9/sys/dev/oce X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Mar 2013 18:46:23 -0000 Author: delphij Date: Fri Mar 8 18:46:21 2013 New Revision: 248062 URL: http://svnweb.freebsd.org/changeset/base/248062 Log: MFC r231879,246799,247880,248059: Update driver to version 4.6.95.0. Submitted by: "Duvvuru,Venkat Kumar" Modified: stable/8/sys/dev/oce/oce_hw.c stable/8/sys/dev/oce/oce_hw.h stable/8/sys/dev/oce/oce_if.c stable/8/sys/dev/oce/oce_if.h stable/8/sys/dev/oce/oce_mbox.c stable/8/sys/dev/oce/oce_queue.c stable/8/sys/dev/oce/oce_sysctl.c stable/8/sys/dev/oce/oce_util.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/dev/ (props changed) stable/8/sys/dev/oce/ (props changed) Changes in other areas also in this revision: Modified: stable/9/sys/dev/oce/oce_hw.c stable/9/sys/dev/oce/oce_hw.h stable/9/sys/dev/oce/oce_if.c stable/9/sys/dev/oce/oce_if.h stable/9/sys/dev/oce/oce_mbox.c stable/9/sys/dev/oce/oce_queue.c stable/9/sys/dev/oce/oce_sysctl.c stable/9/sys/dev/oce/oce_util.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) Modified: stable/8/sys/dev/oce/oce_hw.c ============================================================================== --- stable/8/sys/dev/oce/oce_hw.c Fri Mar 8 18:15:07 2013 (r248061) +++ stable/8/sys/dev/oce/oce_hw.c Fri Mar 8 18:46:21 2013 (r248062) @@ -340,8 +340,10 @@ oce_hw_shutdown(POCE_SOFTC sc) oce_stats_free(sc); /* disable hardware interrupts */ oce_hw_intr_disable(sc); +#if defined(INET6) || defined(INET) /* Free LRO resources */ oce_free_lro(sc); +#endif /* Release queue*/ oce_queue_release_all(sc); /*Delete Network Interface*/ @@ -403,11 +405,6 @@ oce_create_nw_interface(POCE_SOFTC sc) sc->if_cap_flags = capab_en_flags; - /* Enable VLAN Promisc on HW */ - rc = oce_config_vlan(sc, (uint8_t) sc->if_id, NULL, 0, 1, 1); - if (rc) - goto error; - /* set default flow control */ rc = oce_set_flow_control(sc, sc->flow_control); if (rc) @@ -475,12 +472,9 @@ oce_hw_start(POCE_SOFTC sc) return 1; if (link.logical_link_status == NTWK_LOGICAL_LINK_UP) { - sc->ifp->if_drv_flags |= IFF_DRV_RUNNING; sc->link_status = NTWK_LOGICAL_LINK_UP; if_link_state_change(sc->ifp, LINK_STATE_UP); } else { - sc->ifp->if_drv_flags &= - ~(IFF_DRV_RUNNING | IFF_DRV_OACTIVE); sc->link_status = NTWK_LOGICAL_LINK_DOWN; if_link_state_change(sc->ifp, LINK_STATE_DOWN); } @@ -494,12 +488,17 @@ oce_hw_start(POCE_SOFTC sc) rc = oce_start_mq(sc->mq); - /* we need to get MCC aync events. - So enable intrs and also arm first EQ + /* we need to get MCC aync events. So enable intrs and arm + first EQ, Other EQs will be armed after interface is UP */ oce_hw_intr_enable(sc); oce_arm_eq(sc, sc->eq[0]->eq_id, 0, TRUE, FALSE); + /* Send first mcc cmd and after that we get gracious + MCC notifications from FW + */ + oce_first_mcc_cmd(sc); + return rc; } @@ -537,8 +536,8 @@ oce_hw_intr_disable(POCE_SOFTC sc) /** - * @brief Function for hardware update multicast filter - * @param sc software handle to the device + * @brief Function for hardware update multicast filter + * @param sc software handle to the device */ int oce_hw_update_multicast(POCE_SOFTC sc) Modified: stable/8/sys/dev/oce/oce_hw.h ============================================================================== --- stable/8/sys/dev/oce/oce_hw.h Fri Mar 8 18:15:07 2013 (r248061) +++ stable/8/sys/dev/oce/oce_hw.h Fri Mar 8 18:46:21 2013 (r248062) @@ -154,6 +154,12 @@ #define ASYNC_EVENT_CODE_LINK_STATE 0x1 #define ASYNC_EVENT_LINK_UP 0x1 #define ASYNC_EVENT_LINK_DOWN 0x0 +#define ASYNC_EVENT_GRP5 0x5 +#define ASYNC_EVENT_CODE_DEBUG 0x6 +#define ASYNC_EVENT_PVID_STATE 0x3 +#define ASYNC_EVENT_DEBUG_QNQ 0x1 +#define ASYNC_EVENT_CODE_SLIPORT 0x11 +#define VLAN_VID_MASK 0x0FFF /* port link_status */ #define ASYNC_EVENT_LOGICAL 0x02 @@ -610,7 +616,10 @@ struct oce_mq_cqe { uint32_t hpi_buffer_cmpl:1; uint32_t completed:1; uint32_t consumed:1; - uint32_t rsvd0:27; + uint32_t rsvd0:3; + uint32_t async_type:8; + uint32_t event_type:8; + uint32_t rsvd1:8; #else /* dw0 */ uint32_t completion_status:16; @@ -618,7 +627,10 @@ struct oce_mq_cqe { /* dw1 dw2 */ uint32_t mq_tag[2]; /* dw3 */ - uint32_t rsvd0:27; + uint32_t rsvd1:8; + uint32_t event_type:8; + uint32_t async_type:8; + uint32_t rsvd0:3; uint32_t consumed:1; uint32_t completed:1; uint32_t hpi_buffer_cmpl:1; @@ -687,6 +699,112 @@ struct oce_async_cqe_link_state { } u0; }; + +/* PVID aync event */ +struct oce_async_event_grp5_pvid_state { + uint8_t enabled; + uint8_t rsvd0; + uint16_t tag; + uint32_t event_tag; + uint32_t rsvd1; + uint32_t code; +}; + +/* async event indicating outer VLAN tag in QnQ */ +struct oce_async_event_qnq { + uint8_t valid; /* Indicates if outer VLAN is valid */ + uint8_t rsvd0; + uint16_t vlan_tag; + uint32_t event_tag; + uint8_t rsvd1[4]; + uint32_t code; +} ; + + +typedef union oce_mq_ext_ctx_u { + uint32_t dw[6]; + struct { + #ifdef _BIG_ENDIAN + /* dw0 */ + uint32_t dw4rsvd1:16; + uint32_t num_pages:16; + /* dw1 */ + uint32_t async_evt_bitmap; + /* dw2 */ + uint32_t cq_id:10; + uint32_t dw5rsvd2:2; + uint32_t ring_size:4; + uint32_t dw5rsvd1:16; + /* dw3 */ + uint32_t valid:1; + uint32_t dw6rsvd1:31; + /* dw4 */ + uint32_t dw7rsvd1:21; + uint32_t async_cq_id:10; + uint32_t async_cq_valid:1; + #else + /* dw0 */ + uint32_t num_pages:16; + uint32_t dw4rsvd1:16; + /* dw1 */ + uint32_t async_evt_bitmap; + /* dw2 */ + uint32_t dw5rsvd1:16; + uint32_t ring_size:4; + uint32_t dw5rsvd2:2; + uint32_t cq_id:10; + /* dw3 */ + uint32_t dw6rsvd1:31; + uint32_t valid:1; + /* dw4 */ + uint32_t async_cq_valid:1; + uint32_t async_cq_id:10; + uint32_t dw7rsvd1:21; + #endif + /* dw5 */ + uint32_t dw8rsvd1; + } v0; + struct { + #ifdef _BIG_ENDIAN + /* dw0 */ + uint32_t cq_id:16; + uint32_t num_pages:16; + /* dw1 */ + uint32_t async_evt_bitmap; + /* dw2 */ + uint32_t dw5rsvd2:12; + uint32_t ring_size:4; + uint32_t async_cq_id:16; + /* dw3 */ + uint32_t valid:1; + uint32_t dw6rsvd1:31; + /* dw4 */ + uint32_t dw7rsvd1:31; + uint32_t async_cq_valid:1; + #else + /* dw0 */ + uint32_t num_pages:16; + uint32_t cq_id:16; + /* dw1 */ + uint32_t async_evt_bitmap; + /* dw2 */ + uint32_t async_cq_id:16; + uint32_t ring_size:4; + uint32_t dw5rsvd2:12; + /* dw3 */ + uint32_t dw6rsvd1:31; + uint32_t valid:1; + /* dw4 */ + uint32_t async_cq_valid:1; + uint32_t dw7rsvd1:31; + #endif + /* dw5 */ + uint32_t dw8rsvd1; + } v1; + +} oce_mq_ext_ctx_t; + + /* MQ mailbox structure */ struct oce_bmbx { struct oce_mbx mbx; @@ -760,6 +878,7 @@ enum COMMON_SUBSYSTEM_OPCODES { OPCODE_COMMON_SET_BEACON_CONFIG = 69, OPCODE_COMMON_GET_BEACON_CONFIG = 70, OPCODE_COMMON_GET_PHYSICAL_LINK_CONFIG = 71, + OPCODE_COMMON_READ_TRANSRECEIVER_DATA = 73, OPCODE_COMMON_GET_OEM_ATTRIBUTES = 76, OPCODE_COMMON_GET_PORT_NAME = 77, OPCODE_COMMON_GET_CONFIG_SIGNATURE = 78, @@ -1342,6 +1461,23 @@ struct mbx_create_common_mq { } params; }; +struct mbx_create_common_mq_ex { + struct mbx_hdr hdr; + union { + struct { + oce_mq_ext_ctx_t context; + struct phys_addr pages[8]; + } req; + + struct { + uint32_t mq_id:16; + uint32_t rsvd0:16; + } rsp; + } params; +}; + + + /* [53] OPCODE_COMMON_DESTROY_MQ */ struct mbx_destroy_common_mq { struct mbx_hdr hdr; @@ -1584,7 +1720,7 @@ enum CQFW_FUNCTION_MODES_SUPPORTED { FNM_BE3_COMPAT_MODE = 0x10000, /* BE3 features */ FNM_VNIC_MODE = 0x20000, /* Set when IBM vNIC mode is set */ FNM_VNTAG_MODE = 0x40000, /* Set when VNTAG mode is set */ - FNM_UMC_MODE = 0x80000, /* Set when UMC mode is set */ + FNM_UMC_MODE = 0x1000000, /* Set when UMC mode is set */ FNM_UMC_DEF_EN = 0x100000, /* Set when UMC Default is set */ FNM_ONE_GB_EN = 0x200000, /* Set when 1GB Default is set */ FNM_VNIC_DEF_VALID = 0x400000, /* Set when VNIC_DEF_EN is valid */ @@ -1641,6 +1777,12 @@ struct mbx_set_common_iface_rx_filter { } params; }; +struct be_set_eqd { + uint32_t eq_id; + uint32_t phase; + uint32_t dm; +}; + /* [41] OPCODE_COMMON_MODIFY_EQ_DELAY */ struct mbx_modify_common_eq_delay { struct mbx_hdr hdr; @@ -1660,6 +1802,76 @@ struct mbx_modify_common_eq_delay { } params; }; +/* [32] OPCODE_COMMON_GET_CNTL_ATTRIBUTES */ + +struct mgmt_hba_attr { + int8_t flashrom_ver_str[32]; + int8_t manufac_name[32]; + uint32_t supp_modes; + int8_t seeprom_ver_lo; + int8_t seeprom_ver_hi; + int8_t rsvd0[2]; + uint32_t ioctl_data_struct_ver; + uint32_t ep_fw_data_struct_ver; + uint8_t ncsi_ver_str[12]; + uint32_t def_ext_to; + int8_t cntl_mod_num[32]; + int8_t cntl_desc[64]; + int8_t cntl_ser_num[32]; + int8_t ip_ver_str[32]; + int8_t fw_ver_str[32]; + int8_t bios_ver_str[32]; + int8_t redboot_ver_str[32]; + int8_t drv_ver_str[32]; + int8_t fw_on_flash_ver_str[32]; + uint32_t funcs_supp; + uint16_t max_cdblen; + uint8_t asic_rev; + uint8_t gen_guid[16]; + uint8_t hba_port_count; + uint16_t default_link_down_timeout; + uint8_t iscsi_ver_min_max; + uint8_t multifunc_dev; + uint8_t cache_valid; + uint8_t hba_status; + uint8_t max_domains_supp; + uint8_t phy_port; + uint32_t fw_post_status; + uint32_t hba_mtu[8]; + uint8_t iSCSI_feat; + uint8_t asic_gen; + uint8_t future_u8[2]; + uint32_t future_u32[3]; +}; + +struct mgmt_cntl_attr { + struct mgmt_hba_attr hba_attr; + uint16_t pci_vendor_id; + uint16_t pci_device_id; + uint16_t pci_sub_vendor_id; + uint16_t pci_sub_system_id; + uint8_t pci_bus_num; + uint8_t pci_dev_num; + uint8_t pci_func_num; + uint8_t interface_type; + uint64_t unique_id; + uint8_t netfilters; + uint8_t rsvd0[3]; + uint32_t future_u32[4]; +}; + +struct mbx_common_get_cntl_attr { + struct mbx_hdr hdr; + union { + struct { + uint32_t rsvd0; + } req; + struct { + struct mgmt_cntl_attr cntl_attr_info; + } rsp; + } params; +}; + /* [59] OPCODE_ADD_COMMON_IFACE_MAC */ struct mbx_add_common_iface_mac { struct mbx_hdr hdr; @@ -1702,6 +1914,23 @@ struct ioctl_common_function_reset { struct mbx_hdr hdr; }; +/* [73] OPCODE_COMMON_READ_TRANSRECEIVER_DATA */ +struct mbx_read_common_transrecv_data { + struct mbx_hdr hdr; + union { + struct { + uint32_t page_num; + uint32_t port; + } req; + struct { + uint32_t page_num; + uint32_t port; + uint32_t page_data[32]; + } rsp; + } params; + +}; + /* [80] OPCODE_COMMON_FUNCTION_LINK_CONFIG */ struct mbx_common_func_link_cfg { struct mbx_hdr hdr; @@ -2027,7 +2256,9 @@ enum RSS_ENABLE_FLAGS { RSS_ENABLE_IPV4 = 0x1, /* (IPV4 HASH enabled ) */ RSS_ENABLE_TCP_IPV4 = 0x2, /* (TCP IPV4 Hash enabled) */ RSS_ENABLE_IPV6 = 0x4, /* (IPV6 HASH enabled) */ - RSS_ENABLE_TCP_IPV6 = 0x8 /* (TCP IPV6 HASH */ + RSS_ENABLE_TCP_IPV6 = 0x8, /* (TCP IPV6 HASH */ + RSS_ENABLE_UDP_IPV4 = 0x10, /* UDP IPV4 HASH */ + RSS_ENABLE_UDP_IPV6 = 0x20 /* UDP IPV6 HASH */ }; #define RSS_ENABLE (RSS_ENABLE_IPV4 | RSS_ENABLE_TCP_IPV4) #define RSS_DISABLE RSS_ENABLE_NONE Modified: stable/8/sys/dev/oce/oce_if.c ============================================================================== --- stable/8/sys/dev/oce/oce_if.c Fri Mar 8 18:15:07 2013 (r248061) +++ stable/8/sys/dev/oce/oce_if.c Fri Mar 8 18:46:21 2013 (r248062) @@ -71,10 +71,6 @@ static int oce_tx(POCE_SOFTC sc, struct static void oce_tx_restart(POCE_SOFTC sc, struct oce_wq *wq); static void oce_tx_complete(struct oce_wq *wq, uint32_t wqe_idx, uint32_t status); -#if defined(INET6) || defined(INET) -static struct mbuf * oce_tso_setup(POCE_SOFTC sc, struct mbuf **mpp, - uint16_t *mss); -#endif static int oce_multiq_transmit(struct ifnet *ifp, struct mbuf *m, struct oce_wq *wq); @@ -82,9 +78,6 @@ static int oce_multiq_transmit(struct i static void oce_discard_rx_comp(struct oce_rq *rq, struct oce_nic_rx_cqe *cqe); static int oce_cqe_vtp_valid(POCE_SOFTC sc, struct oce_nic_rx_cqe *cqe); static int oce_cqe_portid_valid(POCE_SOFTC sc, struct oce_nic_rx_cqe *cqe); -#if defined(INET6) || defined(INET) -static void oce_rx_flush_lro(struct oce_rq *rq); -#endif static void oce_rx(struct oce_rq *rq, uint32_t rqe_idx, struct oce_nic_rx_cqe *cqe); @@ -96,13 +89,21 @@ static int oce_vid_config(POCE_SOFTC sc static void oce_mac_addr_set(POCE_SOFTC sc); static int oce_handle_passthrough(struct ifnet *ifp, caddr_t data); static void oce_local_timer(void *arg); -#if defined(INET6) || defined(INET) -static int oce_init_lro(POCE_SOFTC sc); -#endif static void oce_if_deactivate(POCE_SOFTC sc); static void oce_if_activate(POCE_SOFTC sc); static void setup_max_queues_want(POCE_SOFTC sc); static void update_queues_got(POCE_SOFTC sc); +static void process_link_state(POCE_SOFTC sc, + struct oce_async_cqe_link_state *acqe); +static int oce_tx_asic_stall_verify(POCE_SOFTC sc, struct mbuf *m); +static struct mbuf *oce_insert_vlan_tag(POCE_SOFTC sc, struct mbuf *m, boolean_t *complete); + +/* IP specific */ +#if defined(INET6) || defined(INET) +static int oce_init_lro(POCE_SOFTC sc); +static void oce_rx_flush_lro(struct oce_rq *rq); +static struct mbuf * oce_tso_setup(POCE_SOFTC sc, struct mbuf **mpp); +#endif static device_method_t oce_dispatch[] = { DEVMETHOD(device_probe, oce_probe), @@ -157,10 +158,10 @@ static uint32_t supportedDevices[] = { static int oce_probe(device_t dev) { - uint16_t vendor; - uint16_t device; - int i; - char str[80]; + uint16_t vendor = 0; + uint16_t device = 0; + int i = 0; + char str[256] = {0}; POCE_SOFTC sc; sc = device_get_softc(dev); @@ -170,11 +171,10 @@ oce_probe(device_t dev) vendor = pci_get_vendor(dev); device = pci_get_device(dev); - for (i = 0; i < (sizeof(supportedDevices) / sizeof(uint16_t)); i++) { + for (i = 0; i < (sizeof(supportedDevices) / sizeof(uint32_t)); i++) { if (vendor == ((supportedDevices[i] >> 16) & 0xffff)) { if (device == (supportedDevices[i] & 0xffff)) { - sprintf(str, "%s:%s", - "Emulex CNA NIC function", + sprintf(str, "%s:%s", "Emulex CNA NIC function", component_revision); device_set_desc_copy(dev, str); @@ -228,37 +228,30 @@ oce_attach(device_t dev) if (rc) goto pci_res_free; - setup_max_queues_want(sc); - rc = oce_setup_intr(sc); if (rc) goto mbox_free; - rc = oce_queue_init_all(sc); if (rc) goto intr_free; - rc = oce_attach_ifp(sc); if (rc) goto queues_free; - #if defined(INET6) || defined(INET) rc = oce_init_lro(sc); if (rc) - goto ifp_free; + goto ifp_free; #endif - rc = oce_hw_start(sc); if (rc) goto lro_free; - sc->vlan_attach = EVENTHANDLER_REGISTER(vlan_config, oce_add_vlan, sc, EVENTHANDLER_PRI_FIRST); sc->vlan_detach = EVENTHANDLER_REGISTER(vlan_unconfig, @@ -270,7 +263,6 @@ oce_attach(device_t dev) oce_add_sysctls(sc); - callout_init(&sc->timer, CALLOUT_MPSAFE); rc = callout_reset(&sc->timer, 2 * hz, oce_local_timer, sc); if (rc) @@ -315,9 +307,7 @@ oce_detach(device_t dev) POCE_SOFTC sc = device_get_softc(dev); LOCK(&sc->dev_lock); - oce_if_deactivate(sc); - UNLOCK(&sc->dev_lock); callout_drain(&sc->timer); @@ -359,34 +349,11 @@ oce_ioctl(struct ifnet *ifp, u_long comm uint32_t u; switch (command) { - case SIOCGIFPSRCADDR_IN6: - rc = ether_ioctl(ifp, command, data); - break; - - case SIOCGIFPSRCADDR: - rc = ether_ioctl(ifp, command, data); - break; - - case SIOCGIFSTATUS: - rc = ether_ioctl(ifp, command, data); - break; case SIOCGIFMEDIA: rc = ifmedia_ioctl(ifp, ifr, &sc->media, command); break; - case SIOCSIFMEDIA: - rc = ether_ioctl(ifp, command, data); - break; - - case SIOCGIFGENERIC: - rc = ether_ioctl(ifp, command, data); - break; - - case SIOCGETMIFCNT_IN6: - rc = ether_ioctl(ifp, command, data); - break; - case SIOCSIFMTU: if (ifr->ifr_mtu > OCE_MAX_MTU) rc = EINVAL; @@ -474,7 +441,6 @@ oce_ioctl(struct ifnet *ifp, u_long comm ifp->if_capenable ^= IFCAP_VLAN_HWFILTER; oce_vid_config(sc); } - #if defined(INET6) || defined(INET) if (u & IFCAP_LRO) ifp->if_capenable ^= IFCAP_LRO; @@ -518,7 +484,7 @@ oce_multiq_start(struct ifnet *ifp, stru struct oce_wq *wq = NULL; int queue_index = 0; int status = 0; - + if ((m->m_flags & M_FLOWID) != 0) queue_index = m->m_pkthdr.flowid % sc->nwqs; @@ -601,6 +567,7 @@ oce_intr(void *arg, int pending) eq_arm: oce_arm_eq(sc, eq->eq_id, 0, TRUE, FALSE); + return; } @@ -666,6 +633,8 @@ oce_fast_isr(void *arg) taskqueue_enqueue_fast(ii->tq, &ii->task); + ii->eq->intr++; + return FILTER_HANDLED; } @@ -813,9 +782,7 @@ oce_tx(POCE_SOFTC sc, struct mbuf **mpp, struct oce_nic_frag_wqe *nicfrag; int num_wqes; uint32_t reg_value; -#if defined(INET6) || defined(INET) - uint16_t mss = 0; -#endif + boolean_t complete = TRUE; m = *mpp; if (!m) @@ -826,10 +793,19 @@ oce_tx(POCE_SOFTC sc, struct mbuf **mpp, goto free_ret; } + if(oce_tx_asic_stall_verify(sc, m)) { + m = oce_insert_vlan_tag(sc, m, &complete); + if(!m) { + device_printf(sc->dev, "Insertion unsuccessful\n"); + return 0; + } + + } + if (m->m_pkthdr.csum_flags & CSUM_TSO) { -#if defined(INET6) || defined(INET) /* consolidate packet buffers for TSO/LSO segment offload */ - m = oce_tso_setup(sc, mpp, &mss); +#if defined(INET6) || defined(INET) + m = oce_tso_setup(sc, mpp); #else m = NULL; #endif @@ -873,15 +849,15 @@ retry: nichdr->u0.dw[2] = 0; nichdr->u0.dw[3] = 0; - nichdr->u0.s.complete = 1; + nichdr->u0.s.complete = complete; nichdr->u0.s.event = 1; nichdr->u0.s.crc = 1; nichdr->u0.s.forward = 0; nichdr->u0.s.ipcs = (m->m_pkthdr.csum_flags & CSUM_IP) ? 1 : 0; nichdr->u0.s.udpcs = - (m->m_pkthdr.csum_flags & CSUM_UDP) ? 1 : 0; + (m->m_pkthdr.csum_flags & CSUM_UDP) ? 1 : 0; nichdr->u0.s.tcpcs = - (m->m_pkthdr.csum_flags & CSUM_TCP) ? 1 : 0; + (m->m_pkthdr.csum_flags & CSUM_TCP) ? 1 : 0; nichdr->u0.s.num_wqe = num_wqes; nichdr->u0.s.total_length = m->m_pkthdr.len; if (m->m_flags & M_VLANTAG) { @@ -931,7 +907,7 @@ retry: wq->tx_stats.tx_wrbs += num_wqes; wq->tx_stats.tx_bytes += m->m_pkthdr.len; wq->tx_stats.tx_pkts++; - + bus_dmamap_sync(wq->ring->dma.tag, wq->ring->dma.map, BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); reg_value = (num_wqes << 16) | wq->wq_id; @@ -1012,9 +988,10 @@ oce_tx_restart(POCE_SOFTC sc, struct oce } + #if defined(INET6) || defined(INET) static struct mbuf * -oce_tso_setup(POCE_SOFTC sc, struct mbuf **mpp, uint16_t *mss) +oce_tso_setup(POCE_SOFTC sc, struct mbuf **mpp) { struct mbuf *m; #ifdef INET @@ -1025,12 +1002,10 @@ oce_tso_setup(POCE_SOFTC sc, struct mbuf #endif struct ether_vlan_header *eh; struct tcphdr *th; - int total_len = 0; uint16_t etype; - int ehdrlen = 0; + int total_len = 0, ehdrlen = 0; m = *mpp; - *mss = m->m_pkthdr.tso_segsz; if (M_WRITABLE(m) == 0) { m = m_dup(*mpp, M_DONTWAIT); @@ -1049,7 +1024,6 @@ oce_tso_setup(POCE_SOFTC sc, struct mbuf ehdrlen = ETHER_HDR_LEN; } - switch (etype) { #ifdef INET case ETHERTYPE_IP: @@ -1084,7 +1058,6 @@ oce_tso_setup(POCE_SOFTC sc, struct mbuf } #endif /* INET6 || INET */ - void oce_tx_task(void *arg, int npending) { @@ -1115,22 +1088,26 @@ oce_start(struct ifnet *ifp) POCE_SOFTC sc = ifp->if_softc; struct mbuf *m; int rc = 0; + int def_q = 0; /* Defualt tx queue is 0*/ if ((ifp->if_drv_flags & (IFF_DRV_RUNNING | IFF_DRV_OACTIVE)) != IFF_DRV_RUNNING) return; + + if (!sc->link_status) + return; do { IF_DEQUEUE(&sc->ifp->if_snd, m); if (m == NULL) break; - /* oce_start always uses default TX queue 0 */ - LOCK(&sc->wq[0]->tx_lock); - rc = oce_tx(sc, &m, 0); - UNLOCK(&sc->wq[0]->tx_lock); + + LOCK(&sc->wq[def_q]->tx_lock); + rc = oce_tx(sc, &m, def_q); + UNLOCK(&sc->wq[def_q]->tx_lock); if (rc) { if (m != NULL) { - sc->wq[0]->tx_stats.tx_stops ++; + sc->wq[def_q]->tx_stats.tx_stops ++; ifp->if_drv_flags |= IFF_DRV_OACTIVE; IFQ_DRV_PREPEND(&ifp->if_snd, m); m = NULL; @@ -1140,7 +1117,7 @@ oce_start(struct ifnet *ifp) if (m != NULL) ETHER_BPF_MTAP(ifp, m); - } while (1); + } while (TRUE); return; } @@ -1248,13 +1225,19 @@ oce_rx(struct oce_rq *rq, uint32_t rqe_i uint16_t vtag; len = cqe->u0.s.pkt_size; - vtag = cqe->u0.s.vlan_tag; if (!len) { /*partial DMA workaround for Lancer*/ oce_discard_rx_comp(rq, cqe); goto exit; } + /* Get vlan_tag value */ + if(IS_BE(sc)) + vtag = BSWAP_16(cqe->u0.s.vlan_tag); + else + vtag = cqe->u0.s.vlan_tag; + + for (i = 0; i < cqe->u0.s.num_fragments; i++) { if (rq->packets_out == rq->packets_in) { @@ -1290,7 +1273,7 @@ oce_rx(struct oce_rq *rq, uint32_t rqe_i pd->mbuf->m_pkthdr.csum_data = 0xffff; } if (cqe->u0.s.ip_cksum_pass) { - if (!cqe->u0.s.ip_ver) { //IPV4 + if (!cqe->u0.s.ip_ver) { /* IPV4 */ pd->mbuf->m_pkthdr.csum_flags |= (CSUM_IP_CHECKED|CSUM_IP_VALID); } @@ -1313,24 +1296,20 @@ oce_rx(struct oce_rq *rq, uint32_t rqe_i m->m_pkthdr.flowid = rq->queue_index; m->m_flags |= M_FLOWID; #endif - //This deternies if vlan tag is present + /* This deternies if vlan tag is Valid */ if (oce_cqe_vtp_valid(sc, cqe)) { if (sc->function_mode & FNM_FLEX10_MODE) { - /* FLEX10 */ + /* FLEX10. If QnQ is not set, neglect VLAN */ if (cqe->u0.s.qnq) { - /* If QnQ is not set, neglect VLAN */ - if (IS_BE(sc)) - m->m_pkthdr.ether_vtag = - BSWAP_16(vtag); - else - m->m_pkthdr.ether_vtag = vtag; + m->m_pkthdr.ether_vtag = vtag; m->m_flags |= M_VLANTAG; } - } else { - if (IS_BE(sc)) - m->m_pkthdr.ether_vtag = BSWAP_16(vtag); - else - m->m_pkthdr.ether_vtag = vtag; + } else if (sc->pvid != (vtag & VLAN_VID_MASK)) { + /* In UMC mode generally pvid will be striped by + hw. But in some cases we have seen it comes + with pvid. So if pvid == vlan, neglect vlan. + */ + m->m_pkthdr.ether_vtag = vtag; m->m_flags |= M_VLANTAG; } } @@ -1339,7 +1318,6 @@ oce_rx(struct oce_rq *rq, uint32_t rqe_i #if defined(INET6) || defined(INET) /* Try to queue to LRO */ if (IF_LRO_ENABLED(sc) && - !(m->m_flags & M_VLANTAG) && (cqe->u0.s.ip_cksum_pass) && (cqe->u0.s.l4_cksum_pass) && (!cqe->u0.s.ip_ver) && @@ -1379,13 +1357,6 @@ oce_discard_rx_comp(struct oce_rq *rq, s POCE_SOFTC sc = (POCE_SOFTC) rq->parent; int num_frags = cqe->u0.s.num_fragments; - if (IS_XE201(sc) && cqe->u0.s.error) { - /* Lancer A0 workaround - * num_frags will be 1 more than actual in case of error - */ - if (num_frags) - num_frags -= 1; - } for (i = 0; i < num_frags; i++) { if (rq->packets_out == rq->packets_in) { device_printf(sc->dev, @@ -1415,9 +1386,8 @@ oce_cqe_vtp_valid(POCE_SOFTC sc, struct if (sc->be3_native) { cqe_v1 = (struct oce_nic_rx_cqe_v1 *)cqe; vtp = cqe_v1->u0.s.vlan_tag_present; - } else { + } else vtp = cqe->u0.s.vlan_tag_present; - } return vtp; @@ -1442,7 +1412,6 @@ oce_cqe_portid_valid(POCE_SOFTC sc, stru } - #if defined(INET6) || defined(INET) static void oce_rx_flush_lro(struct oce_rq *rq) @@ -1482,12 +1451,11 @@ oce_init_lro(POCE_SOFTC sc) return rc; } -#endif /* INET6 || INET */ + void oce_free_lro(POCE_SOFTC sc) { -#if defined(INET6) || defined(INET) struct lro_ctrl *lro = NULL; int i = 0; @@ -1496,9 +1464,8 @@ oce_free_lro(POCE_SOFTC sc) if (lro) tcp_lro_free(lro); } -#endif } - +#endif int oce_alloc_rx_bufs(struct oce_rq *rq, int count) @@ -1511,7 +1478,7 @@ oce_alloc_rx_bufs(struct oce_rq *rq, int struct oce_nic_rqe *rqe; pd_rxulp_db_t rxdb_reg; - + bzero(&rxdb_reg, sizeof(pd_rxulp_db_t)); for (i = 0; i < count; i++) { in = rq->packets_in + 1; if (in == OCE_RQ_PACKET_ARRAY_SIZE) @@ -1552,14 +1519,12 @@ oce_alloc_rx_bufs(struct oce_rq *rq, int } if (added != 0) { for (i = added / OCE_MAX_RQ_POSTS; i > 0; i--) { - DELAY(1); rxdb_reg.bits.num_posted = OCE_MAX_RQ_POSTS; rxdb_reg.bits.qid = rq->rq_id; OCE_WRITE_REG32(sc, db, PD_RXULP_DB, rxdb_reg.dw0); added -= OCE_MAX_RQ_POSTS; } if (added > 0) { - DELAY(1); rxdb_reg.bits.qid = rq->rq_id; rxdb_reg.bits.num_posted = added; OCE_WRITE_REG32(sc, db, PD_RXULP_DB, rxdb_reg.dw0); @@ -1594,13 +1559,8 @@ oce_rq_handler(void *arg) } else { rq->rx_stats.rxcp_err++; sc->ifp->if_ierrors++; - if (IS_XE201(sc)) - /* Lancer A0 no buffer workaround */ - oce_discard_rx_comp(rq, cqe); - else - /* Post L3/L4 errors to stack.*/ - oce_rx(rq, cqe->u0.s.frag_index, cqe); - + /* Post L3/L4 errors to stack.*/ + oce_rx(rq, cqe->u0.s.frag_index, cqe); } rq->rx_stats.rx_compl++; cqe->u0.dw[2] = 0; @@ -1620,6 +1580,7 @@ oce_rq_handler(void *arg) if (num_cqes >= (IS_XE201(sc) ? 8 : oce_max_rsp_handled)) break; } + #if defined(INET6) || defined(INET) if (IF_LRO_ENABLED(sc)) oce_rx_flush_lro(rq); @@ -1682,9 +1643,11 @@ oce_attach_ifp(POCE_SOFTC sc) sc->ifp->if_capabilities = OCE_IF_CAPABILITIES; sc->ifp->if_capabilities |= IFCAP_HWCSUM; sc->ifp->if_capabilities |= IFCAP_VLAN_HWFILTER; + #if defined(INET6) || defined(INET) sc->ifp->if_capabilities |= IFCAP_TSO; sc->ifp->if_capabilities |= IFCAP_LRO; + sc->ifp->if_capabilities |= IFCAP_VLAN_HWTSO; #endif sc->ifp->if_capenable = sc->ifp->if_capabilities; @@ -1794,18 +1757,18 @@ oce_handle_passthrough(struct ifnet *ifp uint32_t req_size; struct mbx_hdr req; OCE_DMA_MEM dma_mem; - + struct mbx_common_get_cntl_attr *fw_cmd; if (copyin(priv_data, cookie, strlen(IOCTL_COOKIE))) return EFAULT; - + if (memcmp(cookie, IOCTL_COOKIE, strlen(IOCTL_COOKIE))) return EINVAL; - + ioctl_ptr = (char *)priv_data + strlen(IOCTL_COOKIE); if (copyin(ioctl_ptr, &req, sizeof(struct mbx_hdr))) return EFAULT; - + req_size = le32toh(req.u0.req.request_length); if (req_size > 65536) return EINVAL; @@ -1829,12 +1792,86 @@ oce_handle_passthrough(struct ifnet *ifp if (copyout(OCE_DMAPTR(&dma_mem,char), ioctl_ptr, req_size)) rc = EFAULT; + /* + firmware is filling all the attributes for this ioctl except + the driver version..so fill it + */ + if(req.u0.rsp.opcode == OPCODE_COMMON_GET_CNTL_ATTRIBUTES) { + fw_cmd = (struct mbx_common_get_cntl_attr *) ioctl_ptr; + strncpy(fw_cmd->params.rsp.cntl_attr_info.hba_attr.drv_ver_str, + COMPONENT_REVISION, strlen(COMPONENT_REVISION)); + } + dma_free: oce_dma_free(sc, &dma_mem); return rc; } +static void +oce_eqd_set_periodic(POCE_SOFTC sc) +{ + struct oce_set_eqd set_eqd[OCE_MAX_EQ]; + struct oce_aic_obj *aic; + struct oce_eq *eqo; + uint64_t now = 0, delta; + int eqd, i, num = 0; + uint32_t ips = 0; + int tps; + + for (i = 0 ; i < sc->neqs; i++) { + eqo = sc->eq[i]; + aic = &sc->aic_obj[i]; + /* When setting the static eq delay from the user space */ + if (!aic->enable) { + eqd = aic->et_eqd; + goto modify_eqd; + } + + now = ticks; + + /* Over flow check */ + if ((now < aic->ticks) || (eqo->intr < aic->intr_prev)) + goto done; + + delta = now - aic->ticks; + tps = delta/hz; + + /* Interrupt rate based on elapsed ticks */ + if(tps) + ips = (uint32_t)(eqo->intr - aic->intr_prev) / tps; + *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable@FreeBSD.ORG Fri Mar 8 19:01:26 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id D14AF49C; Fri, 8 Mar 2013 19:01:26 +0000 (UTC) (envelope-from rstone@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id B883B253; Fri, 8 Mar 2013 19:01:26 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r28J1QQT024349; Fri, 8 Mar 2013 19:01:26 GMT (envelope-from rstone@svn.freebsd.org) Received: (from rstone@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r28J1Qi7024348; Fri, 8 Mar 2013 19:01:26 GMT (envelope-from rstone@svn.freebsd.org) Message-Id: <201303081901.r28J1Qi7024348@svn.freebsd.org> From: Ryan Stone Date: Fri, 8 Mar 2013 19:01:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r248063 - stable/9/sys/dev/aac X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Mar 2013 19:01:26 -0000 Author: rstone Date: Fri Mar 8 19:01:26 2013 New Revision: 248063 URL: http://svnweb.freebsd.org/changeset/base/248063 Log: MFC r240923 Some aac(4) adapters will always report that a direct access device is offline in response to a INQUIRY command that does not retreive vital product data(I personally have observed the behaviour on an Adaptec 2405 and a 5805). Force the peripheral qualifier to "connected" so that upper layers correctly recognize that a disk is present. This bug was uncovered by r216236. Prior to that fix, aac(4) was accidentally clearing the peripheral qualifier for all inquiry commands. This fixes an issue where passthrough devices were not created for disks behind aac(4) controllers suffering from the bug. I have verified that if a disk is not present that we still properly detect that and not create the passthrough device. Sponsored by: Sandvine Incorporated MFC after: 1 week Modified: stable/9/sys/dev/aac/aac_cam.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) Modified: stable/9/sys/dev/aac/aac_cam.c ============================================================================== --- stable/9/sys/dev/aac/aac_cam.c Fri Mar 8 18:46:21 2013 (r248062) +++ stable/9/sys/dev/aac/aac_cam.c Fri Mar 8 19:01:26 2013 (r248063) @@ -527,6 +527,53 @@ aac_cam_poll(struct cam_sim *sim) } static void +aac_cam_fix_inquiry(struct aac_softc *sc, union ccb *ccb) +{ + struct scsi_inquiry_data *inq; + uint8_t *data; + uint8_t device, qual; + + /* If this is an inquiry command, fake things out */ + if (ccb->ccb_h.flags & CAM_CDB_POINTER) + data = ccb->csio.cdb_io.cdb_ptr; + else + data = ccb->csio.cdb_io.cdb_bytes; + + if (data[0] != INQUIRY) + return; + + if (ccb->ccb_h.status == CAM_REQ_CMP) { + inq = (struct scsi_inquiry_data *)ccb->csio.data_ptr; + device = SID_TYPE(inq); + qual = SID_QUAL(inq); + + /* + * We want DASD and PROC devices to only be + * visible through the pass device. + */ + if (((device == T_DIRECT) || + (device == T_PROCESSOR) || + (sc->flags & AAC_FLAGS_CAM_PASSONLY))) { + /* + * Some aac(4) adapters will always report that a direct + * access device is offline in response to a INQUIRY + * command that does not retreive vital product data. + * Force the qualifier to connected so that upper layers + * correctly recognize that a disk is present. + */ + if ((data[1] & SI_EVPD) == 0 && device == T_DIRECT && + qual == SID_QUAL_LU_OFFLINE) + qual = SID_QUAL_LU_CONNECTED; + ccb->csio.data_ptr[0] = (qual << 5) | T_NODEVICE; + } + } else if (ccb->ccb_h.status == CAM_SEL_TIMEOUT && + ccb->ccb_h.target_lun != 0) { + /* fix for INQUIRYs on Lun>0 */ + ccb->ccb_h.status = CAM_DEV_NOT_THERE; + } +} + +static void aac_cam_complete(struct aac_command *cm) { union ccb *ccb; @@ -551,8 +598,6 @@ aac_cam_complete(struct aac_command *cm) /* Take care of SCSI_IO ops. */ if (ccb->ccb_h.func_code == XPT_SCSI_IO) { - u_int8_t command, device; - ccb->csio.scsi_status = srbr->scsi_status; /* Take care of autosense */ @@ -572,31 +617,7 @@ aac_cam_complete(struct aac_command *cm) // scsi_sense_print(&ccb->csio); } - /* If this is an inquiry command, fake things out */ - if (ccb->ccb_h.flags & CAM_CDB_POINTER) - command = ccb->csio.cdb_io.cdb_ptr[0]; - else - command = ccb->csio.cdb_io.cdb_bytes[0]; - - if (command == INQUIRY) { - if (ccb->ccb_h.status == CAM_REQ_CMP) { - device = ccb->csio.data_ptr[0] & 0x1f; - /* - * We want DASD and PROC devices to only be - * visible through the pass device. - */ - if ((device == T_DIRECT) || - (device == T_PROCESSOR) || - (sc->flags & AAC_FLAGS_CAM_PASSONLY)) - ccb->csio.data_ptr[0] = - ((ccb->csio.data_ptr[0] & 0xe0) | - T_NODEVICE); - } else if (ccb->ccb_h.status == CAM_SEL_TIMEOUT && - ccb->ccb_h.target_lun != 0) { - /* fix for INQUIRYs on Lun>0 */ - ccb->ccb_h.status = CAM_DEV_NOT_THERE; - } - } + aac_cam_fix_inquiry(sc, ccb); } } From owner-svn-src-stable@FreeBSD.ORG Fri Mar 8 19:02:46 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 0161774E; Fri, 8 Mar 2013 19:02:46 +0000 (UTC) (envelope-from rstone@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id E783B295; Fri, 8 Mar 2013 19:02:45 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r28J2j0O027555; Fri, 8 Mar 2013 19:02:45 GMT (envelope-from rstone@svn.freebsd.org) Received: (from rstone@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r28J2jap027554; Fri, 8 Mar 2013 19:02:45 GMT (envelope-from rstone@svn.freebsd.org) Message-Id: <201303081902.r28J2jap027554@svn.freebsd.org> From: Ryan Stone Date: Fri, 8 Mar 2013 19:02:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r248064 - stable/8/sys/dev/aac X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Mar 2013 19:02:46 -0000 Author: rstone Date: Fri Mar 8 19:02:45 2013 New Revision: 248064 URL: http://svnweb.freebsd.org/changeset/base/248064 Log: MFC r240923 Some aac(4) adapters will always report that a direct access device is offline in response to a INQUIRY command that does not retreive vital product data(I personally have observed the behaviour on an Adaptec 2405 and a 5805). Force the peripheral qualifier to "connected" so that upper layers correctly recognize that a disk is present. This bug was uncovered by r216236. Prior to that fix, aac(4) was accidentally clearing the peripheral qualifier for all inquiry commands. This fixes an issue where passthrough devices were not created for disks behind aac(4) controllers suffering from the bug. I have verified that if a disk is not present that we still properly detect that and not create the passthrough device. Sponsored by: Sandvine Incorporated MFC after: 1 week Modified: stable/8/sys/dev/aac/aac_cam.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/dev/ (props changed) stable/8/sys/dev/aac/ (props changed) Modified: stable/8/sys/dev/aac/aac_cam.c ============================================================================== --- stable/8/sys/dev/aac/aac_cam.c Fri Mar 8 19:01:26 2013 (r248063) +++ stable/8/sys/dev/aac/aac_cam.c Fri Mar 8 19:02:45 2013 (r248064) @@ -527,6 +527,53 @@ aac_cam_poll(struct cam_sim *sim) } static void +aac_cam_fix_inquiry(struct aac_softc *sc, union ccb *ccb) +{ + struct scsi_inquiry_data *inq; + uint8_t *data; + uint8_t device, qual; + + /* If this is an inquiry command, fake things out */ + if (ccb->ccb_h.flags & CAM_CDB_POINTER) + data = ccb->csio.cdb_io.cdb_ptr; + else + data = ccb->csio.cdb_io.cdb_bytes; + + if (data[0] != INQUIRY) + return; + + if (ccb->ccb_h.status == CAM_REQ_CMP) { + inq = (struct scsi_inquiry_data *)ccb->csio.data_ptr; + device = SID_TYPE(inq); + qual = SID_QUAL(inq); + + /* + * We want DASD and PROC devices to only be + * visible through the pass device. + */ + if (((device == T_DIRECT) || + (device == T_PROCESSOR) || + (sc->flags & AAC_FLAGS_CAM_PASSONLY))) { + /* + * Some aac(4) adapters will always report that a direct + * access device is offline in response to a INQUIRY + * command that does not retreive vital product data. + * Force the qualifier to connected so that upper layers + * correctly recognize that a disk is present. + */ + if ((data[1] & SI_EVPD) == 0 && device == T_DIRECT && + qual == SID_QUAL_LU_OFFLINE) + qual = SID_QUAL_LU_CONNECTED; + ccb->csio.data_ptr[0] = (qual << 5) | T_NODEVICE; + } + } else if (ccb->ccb_h.status == CAM_SEL_TIMEOUT && + ccb->ccb_h.target_lun != 0) { + /* fix for INQUIRYs on Lun>0 */ + ccb->ccb_h.status = CAM_DEV_NOT_THERE; + } +} + +static void aac_cam_complete(struct aac_command *cm) { union ccb *ccb; @@ -551,8 +598,6 @@ aac_cam_complete(struct aac_command *cm) /* Take care of SCSI_IO ops. */ if (ccb->ccb_h.func_code == XPT_SCSI_IO) { - u_int8_t command, device; - ccb->csio.scsi_status = srbr->scsi_status; /* Take care of autosense */ @@ -572,31 +617,7 @@ aac_cam_complete(struct aac_command *cm) // scsi_sense_print(&ccb->csio); } - /* If this is an inquiry command, fake things out */ - if (ccb->ccb_h.flags & CAM_CDB_POINTER) - command = ccb->csio.cdb_io.cdb_ptr[0]; - else - command = ccb->csio.cdb_io.cdb_bytes[0]; - - if (command == INQUIRY) { - if (ccb->ccb_h.status == CAM_REQ_CMP) { - device = ccb->csio.data_ptr[0] & 0x1f; - /* - * We want DASD and PROC devices to only be - * visible through the pass device. - */ - if ((device == T_DIRECT) || - (device == T_PROCESSOR) || - (sc->flags & AAC_FLAGS_CAM_PASSONLY)) - ccb->csio.data_ptr[0] = - ((ccb->csio.data_ptr[0] & 0xe0) | - T_NODEVICE); - } else if (ccb->ccb_h.status == CAM_SEL_TIMEOUT && - ccb->ccb_h.target_lun != 0) { - /* fix for INQUIRYs on Lun>0 */ - ccb->ccb_h.status = CAM_DEV_NOT_THERE; - } - } + aac_cam_fix_inquiry(sc, ccb); } } From owner-svn-src-stable@FreeBSD.ORG Fri Mar 8 19:36:36 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id D336BEA1; Fri, 8 Mar 2013 19:36:36 +0000 (UTC) (envelope-from rstone@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id C574EC41; Fri, 8 Mar 2013 19:36:36 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r28JaaSO037760; Fri, 8 Mar 2013 19:36:36 GMT (envelope-from rstone@svn.freebsd.org) Received: (from rstone@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r28JaaN9037759; Fri, 8 Mar 2013 19:36:36 GMT (envelope-from rstone@svn.freebsd.org) Message-Id: <201303081936.r28JaaN9037759@svn.freebsd.org> From: Ryan Stone Date: Fri, 8 Mar 2013 19:36:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r248066 - stable/9/sys/netgraph X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Mar 2013 19:36:36 -0000 Author: rstone Date: Fri Mar 8 19:36:36 2013 New Revision: 248066 URL: http://svnweb.freebsd.org/changeset/base/248066 Log: MFC r241009 Ensure that all cases that enqueue a netgraph item for delivery by a ngthread properly set the item's depth to 1. In particular, prior to this change if ng_snd_item failed to acquire a lock on a node, the item's depth would not be set at all. This fix ensures that the error code from rcvmsg/ rcvdata is properly passed back to the apply callback. For example, this fixes a bug where an error from rcvmsg/rcvdata would not previously propagate back to a libnetgraph consumer when the message was queued. Reviewed by: mav MFC after: 1 month Sponsored by: Sandvine Incorporated Modified: stable/9/sys/netgraph/ng_base.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/netgraph/ng_base.c ============================================================================== --- stable/9/sys/netgraph/ng_base.c Fri Mar 8 19:16:24 2013 (r248065) +++ stable/9/sys/netgraph/ng_base.c Fri Mar 8 19:36:36 2013 (r248066) @@ -2005,6 +2005,7 @@ ng_queue_rw(node_p node, item_p item, i NGI_SET_WRITER(item); else NGI_SET_READER(item); + item->depth = 1; NG_QUEUE_LOCK(ngq); /* Set OP_PENDING flag and enqueue the item. */ @@ -2283,7 +2284,6 @@ ng_snd_item(item_p item, int flags) } if (queue) { - item->depth = 1; /* Put it on the queue for that node*/ ng_queue_rw(node, item, rw); return ((flags & NG_PROGRESS) ? EINPROGRESS : 0); From owner-svn-src-stable@FreeBSD.ORG Fri Mar 8 19:36:45 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 59D99FC4; Fri, 8 Mar 2013 19:36:45 +0000 (UTC) (envelope-from rstone@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id E1C7BCB9; Fri, 8 Mar 2013 19:36:44 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r28Jai9X037816; Fri, 8 Mar 2013 19:36:44 GMT (envelope-from rstone@svn.freebsd.org) Received: (from rstone@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r28JaiBO037815; Fri, 8 Mar 2013 19:36:44 GMT (envelope-from rstone@svn.freebsd.org) Message-Id: <201303081936.r28JaiBO037815@svn.freebsd.org> From: Ryan Stone Date: Fri, 8 Mar 2013 19:36:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r248067 - stable/8/sys/netgraph X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Mar 2013 19:36:45 -0000 Author: rstone Date: Fri Mar 8 19:36:44 2013 New Revision: 248067 URL: http://svnweb.freebsd.org/changeset/base/248067 Log: MFC r241009 Ensure that all cases that enqueue a netgraph item for delivery by a ngthread properly set the item's depth to 1. In particular, prior to this change if ng_snd_item failed to acquire a lock on a node, the item's depth would not be set at all. This fix ensures that the error code from rcvmsg/ rcvdata is properly passed back to the apply callback. For example, this fixes a bug where an error from rcvmsg/rcvdata would not previously propagate back to a libnetgraph consumer when the message was queued. Reviewed by: mav MFC after: 1 month Sponsored by: Sandvine Incorporated Modified: stable/8/sys/netgraph/ng_base.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/netgraph/ (props changed) Modified: stable/8/sys/netgraph/ng_base.c ============================================================================== --- stable/8/sys/netgraph/ng_base.c Fri Mar 8 19:36:36 2013 (r248066) +++ stable/8/sys/netgraph/ng_base.c Fri Mar 8 19:36:44 2013 (r248067) @@ -1947,6 +1947,7 @@ ng_queue_rw(node_p node, item_p item, i NGI_SET_WRITER(item); else NGI_SET_READER(item); + item->depth = 1; NG_QUEUE_LOCK(ngq); /* Set OP_PENDING flag and enqueue the item. */ @@ -2225,7 +2226,6 @@ ng_snd_item(item_p item, int flags) } if (queue) { - item->depth = 1; /* Put it on the queue for that node*/ ng_queue_rw(node, item, rw); return ((flags & NG_PROGRESS) ? EINPROGRESS : 0); From owner-svn-src-stable@FreeBSD.ORG Fri Mar 8 21:03:36 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 437AB87D; Fri, 8 Mar 2013 21:03:36 +0000 (UTC) (envelope-from rstone@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 1D7AAA4A; Fri, 8 Mar 2013 21:03:36 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r28L3ZSk066456; Fri, 8 Mar 2013 21:03:35 GMT (envelope-from rstone@svn.freebsd.org) Received: (from rstone@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r28L3Z8Z066455; Fri, 8 Mar 2013 21:03:35 GMT (envelope-from rstone@svn.freebsd.org) Message-Id: <201303082103.r28L3Z8Z066455@svn.freebsd.org> From: Ryan Stone Date: Fri, 8 Mar 2013 21:03:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r248071 - stable/9/sys/cddl/dev/dtrace X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Mar 2013 21:03:36 -0000 Author: rstone Date: Fri Mar 8 21:03:35 2013 New Revision: 248071 URL: http://svnweb.freebsd.org/changeset/base/248071 Log: MFC r226452 (by marcel@) Define dtrace_cmpset_long in terms of atomic_cmpset_long and not by virtue of inline assembly. Now this file compiles on all supported architectures. Modified: stable/9/sys/cddl/dev/dtrace/dtrace_debug.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/cddl/dev/dtrace/dtrace_debug.c ============================================================================== --- stable/9/sys/cddl/dev/dtrace/dtrace_debug.c Fri Mar 8 20:33:50 2013 (r248070) +++ stable/9/sys/cddl/dev/dtrace/dtrace_debug.c Fri Mar 8 21:03:35 2013 (r248071) @@ -31,49 +31,9 @@ #ifdef DEBUG -#if defined(__amd64__) -static __inline int -dtrace_cmpset_long(volatile u_long *dst, u_long exp, u_long src) -{ - u_char res; - - __asm __volatile( - " lock ; " - " cmpxchgq %2,%1 ; " - " sete %0 ; " - "1: " - "# dtrace_cmpset_long" - : "=a" (res), /* 0 */ - "=m" (*dst) /* 1 */ - : "r" (src), /* 2 */ - "a" (exp), /* 3 */ - "m" (*dst) /* 4 */ - : "memory"); - - return (res); -} -#elif defined(__i386__) -static __inline int -dtrace_cmpset_long(volatile u_long *dst, u_long exp, u_long src) -{ - u_char res; - - __asm __volatile( - " lock ; " - " cmpxchgl %2,%1 ; " - " sete %0 ; " - "1: " - "# dtrace_cmpset_long" - : "=a" (res), /* 0 */ - "=m" (*dst) /* 1 */ - : "r" (src), /* 2 */ - "a" (exp), /* 3 */ - "m" (*dst) /* 4 */ - : "memory"); +#include - return (res); -} -#endif +#define dtrace_cmpset_long atomic_cmpset_long #define DTRACE_DEBUG_BUFR_SIZE (32 * 1024) From owner-svn-src-stable@FreeBSD.ORG Fri Mar 8 21:04:17 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 42F999EB; Fri, 8 Mar 2013 21:04:17 +0000 (UTC) (envelope-from rstone@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 1B7ECA52; Fri, 8 Mar 2013 21:04:17 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r28L4GBO066610; Fri, 8 Mar 2013 21:04:16 GMT (envelope-from rstone@svn.freebsd.org) Received: (from rstone@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r28L4G3E066609; Fri, 8 Mar 2013 21:04:16 GMT (envelope-from rstone@svn.freebsd.org) Message-Id: <201303082104.r28L4G3E066609@svn.freebsd.org> From: Ryan Stone Date: Fri, 8 Mar 2013 21:04:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r248072 - stable/8/sys/cddl/dev/dtrace X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Mar 2013 21:04:17 -0000 Author: rstone Date: Fri Mar 8 21:04:16 2013 New Revision: 248072 URL: http://svnweb.freebsd.org/changeset/base/248072 Log: MFC r226452 (by marcel@) Define dtrace_cmpset_long in terms of atomic_cmpset_long and not by virtue of inline assembly. Now this file compiles on all supported architectures. Modified: stable/8/sys/cddl/dev/dtrace/dtrace_debug.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/cddl/ (props changed) Modified: stable/8/sys/cddl/dev/dtrace/dtrace_debug.c ============================================================================== --- stable/8/sys/cddl/dev/dtrace/dtrace_debug.c Fri Mar 8 21:03:35 2013 (r248071) +++ stable/8/sys/cddl/dev/dtrace/dtrace_debug.c Fri Mar 8 21:04:16 2013 (r248072) @@ -31,49 +31,9 @@ #ifdef DEBUG -#if defined(__amd64__) -static __inline int -dtrace_cmpset_long(volatile u_long *dst, u_long exp, u_long src) -{ - u_char res; - - __asm __volatile( - " lock ; " - " cmpxchgq %2,%1 ; " - " sete %0 ; " - "1: " - "# dtrace_cmpset_long" - : "=a" (res), /* 0 */ - "=m" (*dst) /* 1 */ - : "r" (src), /* 2 */ - "a" (exp), /* 3 */ - "m" (*dst) /* 4 */ - : "memory"); - - return (res); -} -#elif defined(__i386__) -static __inline int -dtrace_cmpset_long(volatile u_long *dst, u_long exp, u_long src) -{ - u_char res; - - __asm __volatile( - " lock ; " - " cmpxchgl %2,%1 ; " - " sete %0 ; " - "1: " - "# dtrace_cmpset_long" - : "=a" (res), /* 0 */ - "=m" (*dst) /* 1 */ - : "r" (src), /* 2 */ - "a" (exp), /* 3 */ - "m" (*dst) /* 4 */ - : "memory"); +#include - return (res); -} -#endif +#define dtrace_cmpset_long atomic_cmpset_long #define DTRACE_DEBUG_BUFR_SIZE (32 * 1024) From owner-svn-src-stable@FreeBSD.ORG Fri Mar 8 21:07:02 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 7AA92B88; Fri, 8 Mar 2013 21:07:02 +0000 (UTC) (envelope-from rstone@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 5E600A74; Fri, 8 Mar 2013 21:07:02 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r28L72eP067157; Fri, 8 Mar 2013 21:07:02 GMT (envelope-from rstone@svn.freebsd.org) Received: (from rstone@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r28L727F067156; Fri, 8 Mar 2013 21:07:02 GMT (envelope-from rstone@svn.freebsd.org) Message-Id: <201303082107.r28L727F067156@svn.freebsd.org> From: Ryan Stone Date: Fri, 8 Mar 2013 21:07:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r248073 - stable/9/sys/cddl/dev/dtrace X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Mar 2013 21:07:02 -0000 Author: rstone Date: Fri Mar 8 21:07:01 2013 New Revision: 248073 URL: http://svnweb.freebsd.org/changeset/base/248073 Log: MFC r244631 Correct a series of errors in the hand-rolled locking for drace_debug.c: - Use spinlock_enter()/spinlock_exit() to prevent a thread holding a debug lock from being preempted to prevent other threads waiting on that lock from starvation. - Handle the possibility of CPU migration in between the fetch of curcpu and the call to spinlock_enter() by saving curcpu in a local variable. - Use memory barriers to prevent reordering of loads and stores of the data protected by the lock outside of the critical section - Eliminate false sharing of the locks by moving them into the structures that they protect and aligning them to a cacheline boundary. - Record the owning thread in the lock to make debugging future problems easier. Reviewed by: rpaulo (initial version) Modified: stable/9/sys/cddl/dev/dtrace/dtrace_debug.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/cddl/dev/dtrace/dtrace_debug.c ============================================================================== --- stable/9/sys/cddl/dev/dtrace/dtrace_debug.c Fri Mar 8 21:04:16 2013 (r248072) +++ stable/9/sys/cddl/dev/dtrace/dtrace_debug.c Fri Mar 8 21:07:01 2013 (r248073) @@ -33,11 +33,10 @@ #include -#define dtrace_cmpset_long atomic_cmpset_long - #define DTRACE_DEBUG_BUFR_SIZE (32 * 1024) struct dtrace_debug_data { + uintptr_t lock __aligned(CACHE_LINE_SIZE); char bufr[DTRACE_DEBUG_BUFR_SIZE]; char *first; char *last; @@ -46,20 +45,22 @@ struct dtrace_debug_data { static char dtrace_debug_bufr[DTRACE_DEBUG_BUFR_SIZE]; -static volatile u_long dtrace_debug_flag[MAXCPU]; - static void dtrace_debug_lock(int cpu) { - while (dtrace_cmpset_long(&dtrace_debug_flag[cpu], 0, 1) == 0) - /* Loop until the lock is obtained. */ + uintptr_t tid; + + tid = (uintptr_t)curthread; + spinlock_enter(); + while (atomic_cmpset_acq_ptr(&dtrace_debug_data[cpu].lock, 0, tid) == 0) /* Loop until the lock is obtained. */ ; } static void dtrace_debug_unlock(int cpu) { - dtrace_debug_flag[cpu] = 0; + atomic_store_rel_ptr(&dtrace_debug_data[cpu].lock, 0); + spinlock_exit(); } static void @@ -151,10 +152,11 @@ dtrace_debug_output(void) */ static __inline void -dtrace_debug__putc(char c) +dtrace_debug__putc(int cpu, char c) { - struct dtrace_debug_data *d = &dtrace_debug_data[curcpu]; + struct dtrace_debug_data *d; + d = &dtrace_debug_data[cpu]; *d->next++ = c; if (d->next == d->last) @@ -172,24 +174,30 @@ dtrace_debug__putc(char c) static void __used dtrace_debug_putc(char c) { - dtrace_debug_lock(curcpu); + int cpu; + + cpu = curcpu; + dtrace_debug_lock(cpu); - dtrace_debug__putc(c); + dtrace_debug__putc(cpu, c); - dtrace_debug_unlock(curcpu); + dtrace_debug_unlock(cpu); } static void __used dtrace_debug_puts(const char *s) { - dtrace_debug_lock(curcpu); + int cpu; + + cpu = curcpu; + dtrace_debug_lock(cpu); while (*s != '\0') - dtrace_debug__putc(*s++); + dtrace_debug__putc(cpu, *s++); - dtrace_debug__putc('\0'); + dtrace_debug__putc(cpu, '\0'); - dtrace_debug_unlock(curcpu); + dtrace_debug_unlock(cpu); } /* @@ -219,7 +227,7 @@ dtrace_debug_ksprintn(char *nbuf, uintma #define MAXNBUF (sizeof(intmax_t) * NBBY + 1) static void -dtrace_debug_vprintf(const char *fmt, va_list ap) +dtrace_debug_vprintf(int cpu, const char *fmt, va_list ap) { char nbuf[MAXNBUF]; const char *p, *percent, *q; @@ -243,10 +251,10 @@ dtrace_debug_vprintf(const char *fmt, va width = 0; while ((ch = (u_char)*fmt++) != '%' || stop) { if (ch == '\0') { - dtrace_debug__putc('\0'); + dtrace_debug__putc(cpu, '\0'); return; } - dtrace_debug__putc(ch); + dtrace_debug__putc(cpu, ch); } percent = fmt - 1; qflag = 0; lflag = 0; ladjust = 0; sharpflag = 0; neg = 0; @@ -266,7 +274,7 @@ reswitch: switch (ch = (u_char)*fmt++) { ladjust = 1; goto reswitch; case '%': - dtrace_debug__putc(ch); + dtrace_debug__putc(cpu, ch); break; case '*': if (!dot) { @@ -301,7 +309,7 @@ reswitch: switch (ch = (u_char)*fmt++) { num = (u_int)va_arg(ap, int); p = va_arg(ap, char *); for (q = dtrace_debug_ksprintn(nbuf, num, *p++, NULL, 0); *q;) - dtrace_debug__putc(*q--); + dtrace_debug__putc(cpu, *q--); if (num == 0) break; @@ -309,19 +317,19 @@ reswitch: switch (ch = (u_char)*fmt++) { for (tmp = 0; *p;) { n = *p++; if (num & (1 << (n - 1))) { - dtrace_debug__putc(tmp ? ',' : '<'); + dtrace_debug__putc(cpu, tmp ? ',' : '<'); for (; (n = *p) > ' '; ++p) - dtrace_debug__putc(n); + dtrace_debug__putc(cpu, n); tmp = 1; } else for (; *p > ' '; ++p) continue; } if (tmp) - dtrace_debug__putc('>'); + dtrace_debug__putc(cpu, '>'); break; case 'c': - dtrace_debug__putc(va_arg(ap, int)); + dtrace_debug__putc(cpu, va_arg(ap, int)); break; case 'D': up = va_arg(ap, u_char *); @@ -329,12 +337,12 @@ reswitch: switch (ch = (u_char)*fmt++) { if (!width) width = 16; while(width--) { - dtrace_debug__putc(hex2ascii(*up >> 4)); - dtrace_debug__putc(hex2ascii(*up & 0x0f)); + dtrace_debug__putc(cpu, hex2ascii(*up >> 4)); + dtrace_debug__putc(cpu, hex2ascii(*up & 0x0f)); up++; if (width) for (q=p;*q;q++) - dtrace_debug__putc(*q); + dtrace_debug__putc(cpu, *q); } break; case 'd': @@ -406,12 +414,12 @@ reswitch: switch (ch = (u_char)*fmt++) { if (!ladjust && width > 0) while (width--) - dtrace_debug__putc(padc); + dtrace_debug__putc(cpu, padc); while (n--) - dtrace_debug__putc(*p++); + dtrace_debug__putc(cpu, *p++); if (ladjust && width > 0) while (width--) - dtrace_debug__putc(padc); + dtrace_debug__putc(cpu, padc); break; case 't': tflag = 1; @@ -485,32 +493,32 @@ number: if (!ladjust && padc != '0' && width && (width -= tmp) > 0) while (width--) - dtrace_debug__putc(padc); + dtrace_debug__putc(cpu, padc); if (neg) - dtrace_debug__putc('-'); + dtrace_debug__putc(cpu, '-'); if (sharpflag && num != 0) { if (base == 8) { - dtrace_debug__putc('0'); + dtrace_debug__putc(cpu, '0'); } else if (base == 16) { - dtrace_debug__putc('0'); - dtrace_debug__putc('x'); + dtrace_debug__putc(cpu, '0'); + dtrace_debug__putc(cpu, 'x'); } } if (!ladjust && width && (width -= tmp) > 0) while (width--) - dtrace_debug__putc(padc); + dtrace_debug__putc(cpu, padc); while (*p) - dtrace_debug__putc(*p--); + dtrace_debug__putc(cpu, *p--); if (ladjust && width && (width -= tmp) > 0) while (width--) - dtrace_debug__putc(padc); + dtrace_debug__putc(cpu, padc); break; default: while (percent < fmt) - dtrace_debug__putc(*percent++); + dtrace_debug__putc(cpu, *percent++); /* * Since we ignore an formatting argument it is no * longer safe to obey the remaining formatting @@ -522,23 +530,25 @@ number: } } - dtrace_debug__putc('\0'); + dtrace_debug__putc(cpu, '\0'); } void dtrace_debug_printf(const char *fmt, ...) { va_list ap; + int cpu; - dtrace_debug_lock(curcpu); + cpu = curcpu; + dtrace_debug_lock(cpu); va_start(ap, fmt); - dtrace_debug_vprintf(fmt, ap); + dtrace_debug_vprintf(cpu, fmt, ap); va_end(ap); - dtrace_debug_unlock(curcpu); + dtrace_debug_unlock(cpu); } #else From owner-svn-src-stable@FreeBSD.ORG Fri Mar 8 21:07:32 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 4BD54D31; Fri, 8 Mar 2013 21:07:32 +0000 (UTC) (envelope-from rstone@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 2FA89A82; Fri, 8 Mar 2013 21:07:32 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r28L7Wsu067270; Fri, 8 Mar 2013 21:07:32 GMT (envelope-from rstone@svn.freebsd.org) Received: (from rstone@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r28L7W9Z067269; Fri, 8 Mar 2013 21:07:32 GMT (envelope-from rstone@svn.freebsd.org) Message-Id: <201303082107.r28L7W9Z067269@svn.freebsd.org> From: Ryan Stone Date: Fri, 8 Mar 2013 21:07:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r248074 - stable/8/sys/cddl/dev/dtrace X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Mar 2013 21:07:32 -0000 Author: rstone Date: Fri Mar 8 21:07:31 2013 New Revision: 248074 URL: http://svnweb.freebsd.org/changeset/base/248074 Log: MFC r244631 Correct a series of errors in the hand-rolled locking for drace_debug.c: - Use spinlock_enter()/spinlock_exit() to prevent a thread holding a debug lock from being preempted to prevent other threads waiting on that lock from starvation. - Handle the possibility of CPU migration in between the fetch of curcpu and the call to spinlock_enter() by saving curcpu in a local variable. - Use memory barriers to prevent reordering of loads and stores of the data protected by the lock outside of the critical section - Eliminate false sharing of the locks by moving them into the structures that they protect and aligning them to a cacheline boundary. - Record the owning thread in the lock to make debugging future problems easier. Reviewed by: rpaulo (initial version) Modified: stable/8/sys/cddl/dev/dtrace/dtrace_debug.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/cddl/ (props changed) Modified: stable/8/sys/cddl/dev/dtrace/dtrace_debug.c ============================================================================== --- stable/8/sys/cddl/dev/dtrace/dtrace_debug.c Fri Mar 8 21:07:01 2013 (r248073) +++ stable/8/sys/cddl/dev/dtrace/dtrace_debug.c Fri Mar 8 21:07:31 2013 (r248074) @@ -33,11 +33,10 @@ #include -#define dtrace_cmpset_long atomic_cmpset_long - #define DTRACE_DEBUG_BUFR_SIZE (32 * 1024) struct dtrace_debug_data { + uintptr_t lock __aligned(CACHE_LINE_SIZE); char bufr[DTRACE_DEBUG_BUFR_SIZE]; char *first; char *last; @@ -46,20 +45,22 @@ struct dtrace_debug_data { static char dtrace_debug_bufr[DTRACE_DEBUG_BUFR_SIZE]; -static volatile u_long dtrace_debug_flag[MAXCPU]; - static void dtrace_debug_lock(int cpu) { - while (dtrace_cmpset_long(&dtrace_debug_flag[cpu], 0, 1) == 0) - /* Loop until the lock is obtained. */ + uintptr_t tid; + + tid = (uintptr_t)curthread; + spinlock_enter(); + while (atomic_cmpset_acq_ptr(&dtrace_debug_data[cpu].lock, 0, tid) == 0) /* Loop until the lock is obtained. */ ; } static void dtrace_debug_unlock(int cpu) { - dtrace_debug_flag[cpu] = 0; + atomic_store_rel_ptr(&dtrace_debug_data[cpu].lock, 0); + spinlock_exit(); } static void @@ -151,10 +152,11 @@ dtrace_debug_output(void) */ static __inline void -dtrace_debug__putc(char c) +dtrace_debug__putc(int cpu, char c) { - struct dtrace_debug_data *d = &dtrace_debug_data[curcpu]; + struct dtrace_debug_data *d; + d = &dtrace_debug_data[cpu]; *d->next++ = c; if (d->next == d->last) @@ -172,24 +174,30 @@ dtrace_debug__putc(char c) static void __used dtrace_debug_putc(char c) { - dtrace_debug_lock(curcpu); + int cpu; + + cpu = curcpu; + dtrace_debug_lock(cpu); - dtrace_debug__putc(c); + dtrace_debug__putc(cpu, c); - dtrace_debug_unlock(curcpu); + dtrace_debug_unlock(cpu); } static void __used dtrace_debug_puts(const char *s) { - dtrace_debug_lock(curcpu); + int cpu; + + cpu = curcpu; + dtrace_debug_lock(cpu); while (*s != '\0') - dtrace_debug__putc(*s++); + dtrace_debug__putc(cpu, *s++); - dtrace_debug__putc('\0'); + dtrace_debug__putc(cpu, '\0'); - dtrace_debug_unlock(curcpu); + dtrace_debug_unlock(cpu); } /* @@ -219,7 +227,7 @@ dtrace_debug_ksprintn(char *nbuf, uintma #define MAXNBUF (sizeof(intmax_t) * NBBY + 1) static void -dtrace_debug_vprintf(const char *fmt, va_list ap) +dtrace_debug_vprintf(int cpu, const char *fmt, va_list ap) { char nbuf[MAXNBUF]; const char *p, *percent, *q; @@ -243,10 +251,10 @@ dtrace_debug_vprintf(const char *fmt, va width = 0; while ((ch = (u_char)*fmt++) != '%' || stop) { if (ch == '\0') { - dtrace_debug__putc('\0'); + dtrace_debug__putc(cpu, '\0'); return; } - dtrace_debug__putc(ch); + dtrace_debug__putc(cpu, ch); } percent = fmt - 1; qflag = 0; lflag = 0; ladjust = 0; sharpflag = 0; neg = 0; @@ -266,7 +274,7 @@ reswitch: switch (ch = (u_char)*fmt++) { ladjust = 1; goto reswitch; case '%': - dtrace_debug__putc(ch); + dtrace_debug__putc(cpu, ch); break; case '*': if (!dot) { @@ -301,7 +309,7 @@ reswitch: switch (ch = (u_char)*fmt++) { num = (u_int)va_arg(ap, int); p = va_arg(ap, char *); for (q = dtrace_debug_ksprintn(nbuf, num, *p++, NULL, 0); *q;) - dtrace_debug__putc(*q--); + dtrace_debug__putc(cpu, *q--); if (num == 0) break; @@ -309,19 +317,19 @@ reswitch: switch (ch = (u_char)*fmt++) { for (tmp = 0; *p;) { n = *p++; if (num & (1 << (n - 1))) { - dtrace_debug__putc(tmp ? ',' : '<'); + dtrace_debug__putc(cpu, tmp ? ',' : '<'); for (; (n = *p) > ' '; ++p) - dtrace_debug__putc(n); + dtrace_debug__putc(cpu, n); tmp = 1; } else for (; *p > ' '; ++p) continue; } if (tmp) - dtrace_debug__putc('>'); + dtrace_debug__putc(cpu, '>'); break; case 'c': - dtrace_debug__putc(va_arg(ap, int)); + dtrace_debug__putc(cpu, va_arg(ap, int)); break; case 'D': up = va_arg(ap, u_char *); @@ -329,12 +337,12 @@ reswitch: switch (ch = (u_char)*fmt++) { if (!width) width = 16; while(width--) { - dtrace_debug__putc(hex2ascii(*up >> 4)); - dtrace_debug__putc(hex2ascii(*up & 0x0f)); + dtrace_debug__putc(cpu, hex2ascii(*up >> 4)); + dtrace_debug__putc(cpu, hex2ascii(*up & 0x0f)); up++; if (width) for (q=p;*q;q++) - dtrace_debug__putc(*q); + dtrace_debug__putc(cpu, *q); } break; case 'd': @@ -406,12 +414,12 @@ reswitch: switch (ch = (u_char)*fmt++) { if (!ladjust && width > 0) while (width--) - dtrace_debug__putc(padc); + dtrace_debug__putc(cpu, padc); while (n--) - dtrace_debug__putc(*p++); + dtrace_debug__putc(cpu, *p++); if (ladjust && width > 0) while (width--) - dtrace_debug__putc(padc); + dtrace_debug__putc(cpu, padc); break; case 't': tflag = 1; @@ -485,32 +493,32 @@ number: if (!ladjust && padc != '0' && width && (width -= tmp) > 0) while (width--) - dtrace_debug__putc(padc); + dtrace_debug__putc(cpu, padc); if (neg) - dtrace_debug__putc('-'); + dtrace_debug__putc(cpu, '-'); if (sharpflag && num != 0) { if (base == 8) { - dtrace_debug__putc('0'); + dtrace_debug__putc(cpu, '0'); } else if (base == 16) { - dtrace_debug__putc('0'); - dtrace_debug__putc('x'); + dtrace_debug__putc(cpu, '0'); + dtrace_debug__putc(cpu, 'x'); } } if (!ladjust && width && (width -= tmp) > 0) while (width--) - dtrace_debug__putc(padc); + dtrace_debug__putc(cpu, padc); while (*p) - dtrace_debug__putc(*p--); + dtrace_debug__putc(cpu, *p--); if (ladjust && width && (width -= tmp) > 0) while (width--) - dtrace_debug__putc(padc); + dtrace_debug__putc(cpu, padc); break; default: while (percent < fmt) - dtrace_debug__putc(*percent++); + dtrace_debug__putc(cpu, *percent++); /* * Since we ignore an formatting argument it is no * longer safe to obey the remaining formatting @@ -522,23 +530,25 @@ number: } } - dtrace_debug__putc('\0'); + dtrace_debug__putc(cpu, '\0'); } void dtrace_debug_printf(const char *fmt, ...) { va_list ap; + int cpu; - dtrace_debug_lock(curcpu); + cpu = curcpu; + dtrace_debug_lock(cpu); va_start(ap, fmt); - dtrace_debug_vprintf(fmt, ap); + dtrace_debug_vprintf(cpu, fmt, ap); va_end(ap); - dtrace_debug_unlock(curcpu); + dtrace_debug_unlock(cpu); } #else From owner-svn-src-stable@FreeBSD.ORG Sat Mar 9 00:40:02 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 79934AF0; Sat, 9 Mar 2013 00:40:02 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 687D91EB; Sat, 9 Mar 2013 00:40:02 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r290e2oR031493; Sat, 9 Mar 2013 00:40:02 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r290dtU0031413; Sat, 9 Mar 2013 00:39:55 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201303090039.r290dtU0031413@svn.freebsd.org> From: Marius Strobl Date: Sat, 9 Mar 2013 00:39:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r248078 - in stable/9/sys/dev: age alc ale an ath bce bfe bge bm bwi bwn bxe cas ce cm cp cs ctau cx cxgb cxgb/sys cxgbe cxgbe/tom dc de e1000 ed en ep et ex fatm fe firewire fxp gem ha... X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Mar 2013 00:40:02 -0000 Author: marius Date: Sat Mar 9 00:39:54 2013 New Revision: 248078 URL: http://svnweb.freebsd.org/changeset/base/248078 Log: MFC: r243857 (partial) Mechanically substitute flags from historic mbuf allocator with malloc(9) flags in sys/dev. Modified: stable/9/sys/dev/age/if_age.c stable/9/sys/dev/alc/if_alc.c stable/9/sys/dev/ale/if_ale.c stable/9/sys/dev/an/if_an.c stable/9/sys/dev/ath/if_ath_tx.c stable/9/sys/dev/bce/if_bce.c stable/9/sys/dev/bfe/if_bfe.c stable/9/sys/dev/bge/if_bge.c stable/9/sys/dev/bm/if_bm.c stable/9/sys/dev/bwi/if_bwi.c stable/9/sys/dev/bwn/if_bwn.c stable/9/sys/dev/bxe/if_bxe.c stable/9/sys/dev/cas/if_cas.c stable/9/sys/dev/ce/if_ce.c stable/9/sys/dev/cm/smc90cx6.c stable/9/sys/dev/cp/if_cp.c stable/9/sys/dev/cs/if_cs.c stable/9/sys/dev/ctau/if_ct.c stable/9/sys/dev/cx/if_cx.c stable/9/sys/dev/cxgb/cxgb_main.c stable/9/sys/dev/cxgb/cxgb_sge.c stable/9/sys/dev/cxgb/sys/uipc_mvec.c stable/9/sys/dev/cxgbe/t4_sge.c stable/9/sys/dev/cxgbe/tom/t4_ddp.c stable/9/sys/dev/cxgbe/tom/t4_listen.c stable/9/sys/dev/dc/if_dc.c stable/9/sys/dev/de/if_de.c stable/9/sys/dev/e1000/if_em.c stable/9/sys/dev/e1000/if_igb.c stable/9/sys/dev/e1000/if_lem.c stable/9/sys/dev/ed/if_ed.c stable/9/sys/dev/en/midway.c stable/9/sys/dev/ep/if_ep.c stable/9/sys/dev/et/if_et.c stable/9/sys/dev/ex/if_ex.c stable/9/sys/dev/fatm/if_fatm.c stable/9/sys/dev/fe/if_fe.c stable/9/sys/dev/firewire/fwohci.c stable/9/sys/dev/firewire/if_fwe.c stable/9/sys/dev/firewire/if_fwip.c stable/9/sys/dev/fxp/if_fxp.c stable/9/sys/dev/gem/if_gem.c stable/9/sys/dev/hatm/if_hatm_intr.c stable/9/sys/dev/hatm/if_hatm_tx.c stable/9/sys/dev/hifn/hifn7751.c stable/9/sys/dev/hme/if_hme.c stable/9/sys/dev/ie/if_ie.c stable/9/sys/dev/if_ndis/if_ndis.c stable/9/sys/dev/ipw/if_ipw.c stable/9/sys/dev/iwi/if_iwi.c stable/9/sys/dev/iwn/if_iwn.c stable/9/sys/dev/ixgb/if_ixgb.c stable/9/sys/dev/ixgbe/ixgbe.c stable/9/sys/dev/ixgbe/ixv.c stable/9/sys/dev/jme/if_jme.c stable/9/sys/dev/le/lance.c stable/9/sys/dev/lge/if_lge.c stable/9/sys/dev/lmc/if_lmc.c stable/9/sys/dev/malo/if_malo.c stable/9/sys/dev/mge/if_mge.c stable/9/sys/dev/mn/if_mn.c stable/9/sys/dev/msk/if_msk.c stable/9/sys/dev/mwl/if_mwl.c stable/9/sys/dev/mxge/if_mxge.c stable/9/sys/dev/my/if_my.c stable/9/sys/dev/nfe/if_nfe.c stable/9/sys/dev/nge/if_nge.c stable/9/sys/dev/nve/if_nve.c stable/9/sys/dev/nxge/if_nxge.c stable/9/sys/dev/oce/oce_if.c stable/9/sys/dev/patm/if_patm_intr.c stable/9/sys/dev/patm/if_patm_rx.c stable/9/sys/dev/patm/if_patm_tx.c stable/9/sys/dev/pcn/if_pcn.c stable/9/sys/dev/pdq/pdq_freebsd.h stable/9/sys/dev/pdq/pdq_ifsubr.c stable/9/sys/dev/pdq/pdqvar.h stable/9/sys/dev/qlxgb/qla_os.c stable/9/sys/dev/ral/rt2560.c stable/9/sys/dev/ral/rt2661.c stable/9/sys/dev/ral/rt2860.c stable/9/sys/dev/re/if_re.c stable/9/sys/dev/rt/if_rt.c stable/9/sys/dev/safe/safe.c stable/9/sys/dev/sbni/if_sbni.c stable/9/sys/dev/sf/if_sf.c stable/9/sys/dev/sfxge/sfxge_dma.c stable/9/sys/dev/sfxge/sfxge_tx.c stable/9/sys/dev/sge/if_sge.c stable/9/sys/dev/sis/if_sis.c stable/9/sys/dev/sk/if_sk.c stable/9/sys/dev/smc/if_smc.c stable/9/sys/dev/sn/if_sn.c stable/9/sys/dev/snc/dp83932.c stable/9/sys/dev/ste/if_ste.c stable/9/sys/dev/stge/if_stge.c stable/9/sys/dev/ti/if_ti.c stable/9/sys/dev/tl/if_tl.c stable/9/sys/dev/tsec/if_tsec.c stable/9/sys/dev/tx/if_tx.c stable/9/sys/dev/txp/if_txp.c stable/9/sys/dev/ubsec/ubsec.c stable/9/sys/dev/usb/misc/udbp.c stable/9/sys/dev/usb/net/if_axe.c stable/9/sys/dev/usb/net/if_cdce.c stable/9/sys/dev/usb/net/if_usie.c stable/9/sys/dev/usb/net/uhso.c stable/9/sys/dev/usb/net/usb_ethernet.c stable/9/sys/dev/usb/wlan/if_rum.c stable/9/sys/dev/usb/wlan/if_run.c stable/9/sys/dev/usb/wlan/if_uath.c stable/9/sys/dev/usb/wlan/if_upgt.c stable/9/sys/dev/usb/wlan/if_ural.c stable/9/sys/dev/usb/wlan/if_urtw.c stable/9/sys/dev/usb/wlan/if_zyd.c stable/9/sys/dev/vge/if_vge.c stable/9/sys/dev/virtio/network/if_vtnet.c stable/9/sys/dev/vr/if_vr.c stable/9/sys/dev/vte/if_vte.c stable/9/sys/dev/vx/if_vx.c stable/9/sys/dev/vxge/vxge.c stable/9/sys/dev/wb/if_wb.c stable/9/sys/dev/wi/if_wi.c stable/9/sys/dev/wl/if_wl.c stable/9/sys/dev/wpi/if_wpi.c stable/9/sys/dev/xe/if_xe.c stable/9/sys/dev/xen/netfront/netfront.c stable/9/sys/dev/xl/if_xl.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) stable/9/sys/dev/e1000/ (props changed) stable/9/sys/dev/ixgbe/ (props changed) Modified: stable/9/sys/dev/age/if_age.c ============================================================================== --- stable/9/sys/dev/age/if_age.c Fri Mar 8 22:15:00 2013 (r248077) +++ stable/9/sys/dev/age/if_age.c Sat Mar 9 00:39:54 2013 (r248078) @@ -1524,7 +1524,7 @@ age_encap(struct age_softc *sc, struct m if (M_WRITABLE(m) == 0) { /* Get a writable copy. */ - m = m_dup(*m_head, M_DONTWAIT); + m = m_dup(*m_head, M_NOWAIT); /* Release original mbufs. */ m_freem(*m_head); if (m == NULL) { @@ -1602,7 +1602,7 @@ age_encap(struct age_softc *sc, struct m error = bus_dmamap_load_mbuf_sg(sc->age_cdata.age_tx_tag, map, *m_head, txsegs, &nsegs, 0); if (error == EFBIG) { - m = m_collapse(*m_head, M_DONTWAIT, AGE_MAXTXSEGS); + m = m_collapse(*m_head, M_NOWAIT, AGE_MAXTXSEGS); if (m == NULL) { m_freem(*m_head); *m_head = NULL; @@ -3096,7 +3096,7 @@ age_newbuf(struct age_softc *sc, struct AGE_LOCK_ASSERT(sc); - m = m_getcl(M_DONTWAIT, MT_DATA, M_PKTHDR); + m = m_getcl(M_NOWAIT, MT_DATA, M_PKTHDR); if (m == NULL) return (ENOBUFS); m->m_len = m->m_pkthdr.len = MCLBYTES; Modified: stable/9/sys/dev/alc/if_alc.c ============================================================================== --- stable/9/sys/dev/alc/if_alc.c Fri Mar 8 22:15:00 2013 (r248077) +++ stable/9/sys/dev/alc/if_alc.c Sat Mar 9 00:39:54 2013 (r248078) @@ -2047,7 +2047,7 @@ alc_encap(struct alc_softc *sc, struct m if (M_WRITABLE(m) == 0) { /* Get a writable copy. */ - m = m_dup(*m_head, M_DONTWAIT); + m = m_dup(*m_head, M_NOWAIT); /* Release original mbufs. */ m_freem(*m_head); if (m == NULL) { @@ -2125,7 +2125,7 @@ alc_encap(struct alc_softc *sc, struct m error = bus_dmamap_load_mbuf_sg(sc->alc_cdata.alc_tx_tag, map, *m_head, txsegs, &nsegs, 0); if (error == EFBIG) { - m = m_collapse(*m_head, M_DONTWAIT, ALC_MAXTXSEGS); + m = m_collapse(*m_head, M_NOWAIT, ALC_MAXTXSEGS); if (m == NULL) { m_freem(*m_head); *m_head = NULL; @@ -2803,7 +2803,7 @@ alc_newbuf(struct alc_softc *sc, struct bus_dmamap_t map; int nsegs; - m = m_getcl(M_DONTWAIT, MT_DATA, M_PKTHDR); + m = m_getcl(M_NOWAIT, MT_DATA, M_PKTHDR); if (m == NULL) return (ENOBUFS); m->m_len = m->m_pkthdr.len = RX_BUF_SIZE_MAX; @@ -2923,7 +2923,7 @@ alc_fixup_rx(struct ifnet *ifp, struct m * header from the mbuf chain. This can save lots of CPU * cycles for jumbo frame. */ - MGETHDR(n, M_DONTWAIT, MT_DATA); + MGETHDR(n, M_NOWAIT, MT_DATA); if (n == NULL) { ifp->if_iqdrops++; m_freem(m); Modified: stable/9/sys/dev/ale/if_ale.c ============================================================================== --- stable/9/sys/dev/ale/if_ale.c Fri Mar 8 22:15:00 2013 (r248077) +++ stable/9/sys/dev/ale/if_ale.c Sat Mar 9 00:39:54 2013 (r248078) @@ -1640,7 +1640,7 @@ ale_encap(struct ale_softc *sc, struct m if (M_WRITABLE(m) == 0) { /* Get a writable copy. */ - m = m_dup(*m_head, M_DONTWAIT); + m = m_dup(*m_head, M_NOWAIT); /* Release original mbufs. */ m_freem(*m_head); if (m == NULL) { @@ -1657,7 +1657,7 @@ ale_encap(struct ale_softc *sc, struct m if ((sc->ale_flags & ALE_FLAG_TXCSUM_BUG) != 0 && (m->m_pkthdr.csum_flags & ALE_CSUM_FEATURES) != 0 && (mtod(m, intptr_t) & 3) != 0) { - m = m_defrag(*m_head, M_DONTWAIT); + m = m_defrag(*m_head, M_NOWAIT); if (m == NULL) { *m_head = NULL; return (ENOBUFS); @@ -1742,7 +1742,7 @@ ale_encap(struct ale_softc *sc, struct m error = bus_dmamap_load_mbuf_sg(sc->ale_cdata.ale_tx_tag, map, *m_head, txsegs, &nsegs, 0); if (error == EFBIG) { - m = m_collapse(*m_head, M_DONTWAIT, ALE_MAXTXSEGS); + m = m_collapse(*m_head, M_NOWAIT, ALE_MAXTXSEGS); if (m == NULL) { m_freem(*m_head); *m_head = NULL; Modified: stable/9/sys/dev/an/if_an.c ============================================================================== --- stable/9/sys/dev/an/if_an.c Fri Mar 8 22:15:00 2013 (r248077) +++ stable/9/sys/dev/an/if_an.c Sat Mar 9 00:39:54 2013 (r248078) @@ -946,12 +946,12 @@ an_rxeof(struct an_softc *sc) /* dump raw 802.11 packet to bpf and skip ip stack */ BPF_TAP(ifp, bpf_buf, len); } else { - MGETHDR(m, M_DONTWAIT, MT_DATA); + MGETHDR(m, M_NOWAIT, MT_DATA); if (m == NULL) { ifp->if_ierrors++; return; } - MCLGET(m, M_DONTWAIT); + MCLGET(m, M_NOWAIT); if (!(m->m_flags & M_EXT)) { m_freem(m); ifp->if_ierrors++; @@ -1037,12 +1037,12 @@ an_rxeof(struct an_softc *sc) if (an_rx_desc.an_done && !an_rx_desc.an_valid) { buf = sc->an_rx_buffer[count].an_dma_vaddr; - MGETHDR(m, M_DONTWAIT, MT_DATA); + MGETHDR(m, M_NOWAIT, MT_DATA); if (m == NULL) { ifp->if_ierrors++; return; } - MCLGET(m, M_DONTWAIT); + MCLGET(m, M_NOWAIT); if (!(m->m_flags & M_EXT)) { m_freem(m); ifp->if_ierrors++; Modified: stable/9/sys/dev/ath/if_ath_tx.c ============================================================================== --- stable/9/sys/dev/ath/if_ath_tx.c Fri Mar 8 22:15:00 2013 (r248077) +++ stable/9/sys/dev/ath/if_ath_tx.c Sat Mar 9 00:39:54 2013 (r248078) @@ -195,7 +195,7 @@ ath_tx_dmasetup(struct ath_softc *sc, st */ if (bf->bf_nseg > ATH_TXDESC) { /* too many desc's, linearize */ sc->sc_stats.ast_tx_linear++; - m = m_collapse(m0, M_DONTWAIT, ATH_TXDESC); + m = m_collapse(m0, M_NOWAIT, ATH_TXDESC); if (m == NULL) { ath_freetx(m0); sc->sc_stats.ast_tx_nombuf++; Modified: stable/9/sys/dev/bce/if_bce.c ============================================================================== --- stable/9/sys/dev/bce/if_bce.c Fri Mar 8 22:15:00 2013 (r248077) +++ stable/9/sys/dev/bce/if_bce.c Sat Mar 9 00:39:54 2013 (r248078) @@ -5418,9 +5418,9 @@ bce_get_rx_buf(struct bce_softc *sc, str /* This is a new mbuf allocation. */ if (bce_hdr_split == TRUE) - MGETHDR(m_new, M_DONTWAIT, MT_DATA); + MGETHDR(m_new, M_NOWAIT, MT_DATA); else - m_new = m_getjcl(M_DONTWAIT, MT_DATA, M_PKTHDR, + m_new = m_getjcl(M_NOWAIT, MT_DATA, M_PKTHDR, sc->rx_bd_mbuf_alloc_size); if (m_new == NULL) { @@ -5540,7 +5540,7 @@ bce_get_pg_buf(struct bce_softc *sc, str goto bce_get_pg_buf_exit); /* This is a new mbuf allocation. */ - m_new = m_getcl(M_DONTWAIT, MT_DATA, 0); + m_new = m_getcl(M_NOWAIT, MT_DATA, 0); if (m_new == NULL) { sc->mbuf_alloc_failed_count++; rc = ENOBUFS; @@ -7301,7 +7301,7 @@ bce_tso_setup(struct bce_softc *sc, stru /* Controller may modify mbuf chains. */ if (M_WRITABLE(*m_head) == 0) { - m = m_dup(*m_head, M_DONTWAIT); + m = m_dup(*m_head, M_NOWAIT); m_freem(*m_head); if (m == NULL) { sc->mbuf_alloc_failed_count++; @@ -7467,7 +7467,7 @@ bce_tx_encap(struct bce_softc *sc, struc sc->mbuf_frag_count++; /* Try to defrag the mbuf. */ - m0 = m_collapse(*m_head, M_DONTWAIT, BCE_MAX_SEGMENTS); + m0 = m_collapse(*m_head, M_NOWAIT, BCE_MAX_SEGMENTS); if (m0 == NULL) { /* Defrag was unsuccessful */ m_freem(*m_head); Modified: stable/9/sys/dev/bfe/if_bfe.c ============================================================================== --- stable/9/sys/dev/bfe/if_bfe.c Fri Mar 8 22:15:00 2013 (r248077) +++ stable/9/sys/dev/bfe/if_bfe.c Sat Mar 9 00:39:54 2013 (r248078) @@ -792,7 +792,7 @@ bfe_list_newbuf(struct bfe_softc *sc, in u_int32_t ctrl; int nsegs; - m = m_getcl(M_DONTWAIT, MT_DATA, M_PKTHDR); + m = m_getcl(M_NOWAIT, MT_DATA, M_PKTHDR); m->m_len = m->m_pkthdr.len = MCLBYTES; if (bus_dmamap_load_mbuf_sg(sc->bfe_rxmbuf_tag, sc->bfe_rx_sparemap, @@ -1520,7 +1520,7 @@ bfe_encap(struct bfe_softc *sc, struct m error = bus_dmamap_load_mbuf_sg(sc->bfe_txmbuf_tag, r->bfe_map, *m_head, txsegs, &nsegs, 0); if (error == EFBIG) { - m = m_collapse(*m_head, M_DONTWAIT, BFE_MAXTXSEGS); + m = m_collapse(*m_head, M_NOWAIT, BFE_MAXTXSEGS); if (m == NULL) { m_freem(*m_head); *m_head = NULL; Modified: stable/9/sys/dev/bge/if_bge.c ============================================================================== --- stable/9/sys/dev/bge/if_bge.c Fri Mar 8 22:15:00 2013 (r248077) +++ stable/9/sys/dev/bge/if_bge.c Sat Mar 9 00:39:54 2013 (r248078) @@ -1312,12 +1312,12 @@ bge_newbuf_std(struct bge_softc *sc, int if (sc->bge_flags & BGE_FLAG_JUMBO_STD && (sc->bge_ifp->if_mtu + ETHER_HDR_LEN + ETHER_CRC_LEN + ETHER_VLAN_ENCAP_LEN > (MCLBYTES - ETHER_ALIGN))) { - m = m_getjcl(M_DONTWAIT, MT_DATA, M_PKTHDR, MJUM9BYTES); + m = m_getjcl(M_NOWAIT, MT_DATA, M_PKTHDR, MJUM9BYTES); if (m == NULL) return (ENOBUFS); m->m_len = m->m_pkthdr.len = MJUM9BYTES; } else { - m = m_getcl(M_DONTWAIT, MT_DATA, M_PKTHDR); + m = m_getcl(M_NOWAIT, MT_DATA, M_PKTHDR); if (m == NULL) return (ENOBUFS); m->m_len = m->m_pkthdr.len = MCLBYTES; @@ -1368,11 +1368,11 @@ bge_newbuf_jumbo(struct bge_softc *sc, i struct mbuf *m; int error, nsegs; - MGETHDR(m, M_DONTWAIT, MT_DATA); + MGETHDR(m, M_NOWAIT, MT_DATA); if (m == NULL) return (ENOBUFS); - m_cljget(m, M_DONTWAIT, MJUM9BYTES); + m_cljget(m, M_NOWAIT, MJUM9BYTES); if (!(m->m_flags & M_EXT)) { m_freem(m); return (ENOBUFS); @@ -4971,7 +4971,7 @@ bge_cksum_pad(struct mbuf *m) /* Allocate new empty mbuf, pad it. Compact later. */ struct mbuf *n; - MGET(n, M_DONTWAIT, MT_DATA); + MGET(n, M_NOWAIT, MT_DATA); if (n == NULL) return (ENOBUFS); n->m_len = 0; @@ -5013,7 +5013,7 @@ bge_check_short_dma(struct mbuf *m) } if (found > 1) { - n = m_defrag(m, M_DONTWAIT); + n = m_defrag(m, M_NOWAIT); if (n == NULL) m_freem(m); } else @@ -5033,7 +5033,7 @@ bge_setup_tso(struct bge_softc *sc, stru if (M_WRITABLE(m) == 0) { /* Get a writable copy. */ - n = m_dup(m, M_DONTWAIT); + n = m_dup(m, M_NOWAIT); m_freem(m); if (n == NULL) return (NULL); @@ -5150,9 +5150,9 @@ bge_encap(struct bge_softc *sc, struct m * DMA read operation. */ if (sc->bge_forced_collapse == 1) - m = m_defrag(m, M_DONTWAIT); + m = m_defrag(m, M_NOWAIT); else - m = m_collapse(m, M_DONTWAIT, + m = m_collapse(m, M_NOWAIT, sc->bge_forced_collapse); if (m == NULL) m = *m_head; @@ -5164,7 +5164,7 @@ bge_encap(struct bge_softc *sc, struct m error = bus_dmamap_load_mbuf_sg(sc->bge_cdata.bge_tx_mtag, map, m, segs, &nsegs, BUS_DMA_NOWAIT); if (error == EFBIG) { - m = m_collapse(m, M_DONTWAIT, BGE_NSEG_NEW); + m = m_collapse(m, M_NOWAIT, BGE_NSEG_NEW); if (m == NULL) { m_freem(*m_head); *m_head = NULL; Modified: stable/9/sys/dev/bm/if_bm.c ============================================================================== --- stable/9/sys/dev/bm/if_bm.c Fri Mar 8 22:15:00 2013 (r248077) +++ stable/9/sys/dev/bm/if_bm.c Sat Mar 9 00:39:54 2013 (r248078) @@ -540,7 +540,7 @@ bm_dummypacket(struct bm_softc *sc) ifp = sc->sc_ifp; - MGETHDR(m, M_DONTWAIT, MT_DATA); + MGETHDR(m, M_NOWAIT, MT_DATA); if (m == NULL) return; @@ -794,7 +794,7 @@ bm_encap(struct bm_softc *sc, struct mbu *m_head, segs, &nsegs, BUS_DMA_NOWAIT); if (error == EFBIG) { - m = m_collapse(*m_head, M_DONTWAIT, nsegs); + m = m_collapse(*m_head, M_NOWAIT, nsegs); if (m == NULL) { m_freem(*m_head); *m_head = NULL; @@ -1239,7 +1239,7 @@ bm_add_rxbuf(struct bm_softc *sc, int id bus_dma_segment_t segs[1]; int error, nsegs; - m = m_getcl(M_DONTWAIT, MT_DATA, M_PKTHDR); + m = m_getcl(M_NOWAIT, MT_DATA, M_PKTHDR); if (m == NULL) return (ENOBUFS); m->m_len = m->m_pkthdr.len = m->m_ext.ext_size; Modified: stable/9/sys/dev/bwi/if_bwi.c ============================================================================== --- stable/9/sys/dev/bwi/if_bwi.c Fri Mar 8 22:15:00 2013 (r248077) +++ stable/9/sys/dev/bwi/if_bwi.c Sat Mar 9 00:39:54 2013 (r248078) @@ -2533,7 +2533,7 @@ bwi_newbuf(struct bwi_softc *sc, int buf KASSERT(buf_idx < BWI_RX_NDESC, ("buf_idx %d", buf_idx)); - m = m_getcl(M_DONTWAIT, MT_DATA, M_PKTHDR); + m = m_getcl(M_NOWAIT, MT_DATA, M_PKTHDR); if (m == NULL) { error = ENOBUFS; @@ -3014,7 +3014,7 @@ bwi_encap(struct bwi_softc *sc, int idx, /* * Setup the embedded TX header */ - M_PREPEND(m, sizeof(*hdr), M_DONTWAIT); + M_PREPEND(m, sizeof(*hdr), M_NOWAIT); if (m == NULL) { if_printf(ifp, "%s: prepend TX header failed\n", __func__); return ENOBUFS; @@ -3073,7 +3073,7 @@ bwi_encap(struct bwi_softc *sc, int idx, if (error) { /* error == EFBIG */ struct mbuf *m_new; - m_new = m_defrag(m, M_DONTWAIT); + m_new = m_defrag(m, M_NOWAIT); if (m_new == NULL) { if_printf(ifp, "%s: can't defrag TX buffer\n", __func__); @@ -3194,7 +3194,7 @@ bwi_encap_raw(struct bwi_softc *sc, int /* * Setup the embedded TX header */ - M_PREPEND(m, sizeof(*hdr), M_DONTWAIT); + M_PREPEND(m, sizeof(*hdr), M_NOWAIT); if (m == NULL) { if_printf(ifp, "%s: prepend TX header failed\n", __func__); return ENOBUFS; @@ -3248,7 +3248,7 @@ bwi_encap_raw(struct bwi_softc *sc, int __func__, error); goto back; } - m_new = m_defrag(m, M_DONTWAIT); + m_new = m_defrag(m, M_NOWAIT); if (m_new == NULL) { if_printf(ifp, "%s: can't defrag TX buffer\n", __func__); Modified: stable/9/sys/dev/bwn/if_bwn.c ============================================================================== --- stable/9/sys/dev/bwn/if_bwn.c Fri Mar 8 22:15:00 2013 (r248077) +++ stable/9/sys/dev/bwn/if_bwn.c Sat Mar 9 00:39:54 2013 (r248078) @@ -1427,7 +1427,7 @@ bwn_pio_tx_start(struct bwn_mac *mac, st /* * XXX please removes m_defrag(9) */ - m_new = m_defrag(m, M_DONTWAIT); + m_new = m_defrag(m, M_NOWAIT); if (m_new == NULL) { device_printf(sc->sc_dev, "%s: can't defrag TX buffer\n", @@ -1543,7 +1543,7 @@ bwn_dma_tx_start(struct bwn_mac *mac, st if (error) { /* error == EFBIG */ struct mbuf *m_new; - m_new = m_defrag(m, M_DONTWAIT); + m_new = m_defrag(m, M_NOWAIT); if (m_new == NULL) { if_printf(ifp, "%s: can't defrag TX buffer\n", __func__); @@ -9123,7 +9123,7 @@ ready: padding = (macstat & BWN_RX_MAC_PADDING) ? 2 : 0; totlen = len + padding; KASSERT(totlen <= MCLBYTES, ("too big..\n")); - m = m_getcl(M_DONTWAIT, MT_DATA, M_PKTHDR); + m = m_getcl(M_NOWAIT, MT_DATA, M_PKTHDR); if (m == NULL) { device_printf(sc->sc_dev, "%s: out of memory", __func__); goto error; @@ -9182,7 +9182,7 @@ bwn_dma_newbuf(struct bwn_dma_ring *dr, struct mbuf *m; int error; - m = m_getcl(M_DONTWAIT, MT_DATA, M_PKTHDR); + m = m_getcl(M_NOWAIT, MT_DATA, M_PKTHDR); if (m == NULL) { error = ENOBUFS; Modified: stable/9/sys/dev/bxe/if_bxe.c ============================================================================== --- stable/9/sys/dev/bxe/if_bxe.c Fri Mar 8 22:15:00 2013 (r248077) +++ stable/9/sys/dev/bxe/if_bxe.c Sat Mar 9 00:39:54 2013 (r248078) @@ -3752,7 +3752,7 @@ bxe_alloc_buf_rings(struct bxe_softc *sc if (fp != NULL) { fp->br = buf_ring_alloc(BXE_BR_SIZE, - M_DEVBUF, M_DONTWAIT, &fp->mtx); + M_DEVBUF, M_NOWAIT, &fp->mtx); if (fp->br == NULL) { rc = ENOMEM; goto bxe_alloc_buf_rings_exit; @@ -8955,7 +8955,7 @@ bxe_tx_encap(struct bxe_fastpath *fp, st } else if (error == EFBIG) { /* Possibly recoverable with defragmentation. */ fp->mbuf_defrag_attempts++; - m0 = m_defrag(*m_head, M_DONTWAIT); + m0 = m_defrag(*m_head, M_NOWAIT); if (m0 == NULL) { fp->mbuf_defrag_failures++; rc = ENOBUFS; @@ -10462,7 +10462,7 @@ bxe_alloc_tpa_mbuf(struct bxe_fastpath * #endif /* Allocate the new TPA mbuf. */ - m = m_getjcl(M_DONTWAIT, MT_DATA, M_PKTHDR, sc->mbuf_alloc_size); + m = m_getjcl(M_NOWAIT, MT_DATA, M_PKTHDR, sc->mbuf_alloc_size); if (__predict_false(m == NULL)) { fp->mbuf_tpa_alloc_failed++; rc = ENOBUFS; @@ -10656,7 +10656,7 @@ bxe_alloc_rx_sge_mbuf(struct bxe_fastpat #endif /* Allocate a new SGE mbuf. */ - m = m_getjcl(M_DONTWAIT, MT_DATA, M_PKTHDR, SGE_PAGE_SIZE); + m = m_getjcl(M_NOWAIT, MT_DATA, M_PKTHDR, SGE_PAGE_SIZE); if (__predict_false(m == NULL)) { fp->mbuf_sge_alloc_failed++; rc = ENOMEM; @@ -10846,7 +10846,7 @@ bxe_alloc_rx_bd_mbuf(struct bxe_fastpath #endif /* Allocate the new RX BD mbuf. */ - m = m_getjcl(M_DONTWAIT, MT_DATA, M_PKTHDR, sc->mbuf_alloc_size); + m = m_getjcl(M_NOWAIT, MT_DATA, M_PKTHDR, sc->mbuf_alloc_size); if (__predict_false(m == NULL)) { fp->mbuf_rx_bd_alloc_failed++; rc = ENOBUFS; Modified: stable/9/sys/dev/cas/if_cas.c ============================================================================== --- stable/9/sys/dev/cas/if_cas.c Fri Mar 8 22:15:00 2013 (r248077) +++ stable/9/sys/dev/cas/if_cas.c Sat Mar 9 00:39:54 2013 (r248078) @@ -1204,7 +1204,7 @@ cas_load_txmbuf(struct cas_softc *sc, st cflags = 0; if (((*m_head)->m_pkthdr.csum_flags & CAS_CSUM_FEATURES) != 0) { if (M_WRITABLE(*m_head) == 0) { - m = m_dup(*m_head, M_DONTWAIT); + m = m_dup(*m_head, M_NOWAIT); m_freem(*m_head); *m_head = m; if (m == NULL) @@ -1227,7 +1227,7 @@ cas_load_txmbuf(struct cas_softc *sc, st error = bus_dmamap_load_mbuf_sg(sc->sc_tdmatag, txs->txs_dmamap, *m_head, txsegs, &nsegs, BUS_DMA_NOWAIT); if (error == EFBIG) { - m = m_collapse(*m_head, M_DONTWAIT, CAS_NTXSEGS); + m = m_collapse(*m_head, M_NOWAIT, CAS_NTXSEGS); if (m == NULL) { m_freem(*m_head); *m_head = NULL; @@ -1726,7 +1726,7 @@ cas_rint(struct cas_softc *sc) __func__, idx, off, len); #endif rxds = &sc->sc_rxdsoft[idx]; - MGETHDR(m, M_DONTWAIT, MT_DATA); + MGETHDR(m, M_NOWAIT, MT_DATA); if (m != NULL) { refcount_acquire(&rxds->rxds_refcount); bus_dmamap_sync(sc->sc_rdmatag, @@ -1771,7 +1771,7 @@ cas_rint(struct cas_softc *sc) __func__, idx, off, len); #endif rxds = &sc->sc_rxdsoft[idx]; - MGETHDR(m, M_DONTWAIT, MT_DATA); + MGETHDR(m, M_NOWAIT, MT_DATA); if (m != NULL) { refcount_acquire(&rxds->rxds_refcount); off += ETHER_ALIGN; @@ -1808,7 +1808,7 @@ cas_rint(struct cas_softc *sc) #endif rxds2 = &sc->sc_rxdsoft[idx2]; if (m != NULL) { - MGET(m2, M_DONTWAIT, MT_DATA); + MGET(m2, M_NOWAIT, MT_DATA); if (m2 != NULL) { refcount_acquire( &rxds2->rxds_refcount); Modified: stable/9/sys/dev/ce/if_ce.c ============================================================================== --- stable/9/sys/dev/ce/if_ce.c Fri Mar 8 22:15:00 2013 (r248077) +++ stable/9/sys/dev/ce/if_ce.c Sat Mar 9 00:39:54 2013 (r248078) @@ -319,10 +319,10 @@ static struct mbuf *makembuf (void *buf, { struct mbuf *m; - MGETHDR (m, M_DONTWAIT, MT_DATA); + MGETHDR (m, M_NOWAIT, MT_DATA); if (! m) return 0; - MCLGET (m, M_DONTWAIT); + MCLGET (m, M_NOWAIT); if (! (m->m_flags & M_EXT)) { m_freem (m); return 0; Modified: stable/9/sys/dev/cm/smc90cx6.c ============================================================================== --- stable/9/sys/dev/cm/smc90cx6.c Fri Mar 8 22:15:00 2013 (r248077) +++ stable/9/sys/dev/cm/smc90cx6.c Sat Mar 9 00:39:54 2013 (r248078) @@ -502,7 +502,7 @@ cm_srint_locked(vsc) buffer = sc->sc_rx_act ^ 1; /* Allocate header mbuf */ - MGETHDR(m, M_DONTWAIT, MT_DATA); + MGETHDR(m, M_NOWAIT, MT_DATA); if (m == 0) { /* @@ -539,7 +539,7 @@ cm_srint_locked(vsc) */ if ((len + 2 + 2) > MHLEN) { /* attach an mbuf cluster */ - MCLGET(m, M_DONTWAIT); + MCLGET(m, M_NOWAIT); /* Insist on getting a cluster */ if ((m->m_flags & M_EXT) == 0) { Modified: stable/9/sys/dev/cp/if_cp.c ============================================================================== --- stable/9/sys/dev/cp/if_cp.c Fri Mar 8 22:15:00 2013 (r248077) +++ stable/9/sys/dev/cp/if_cp.c Sat Mar 9 00:39:54 2013 (r248078) @@ -203,10 +203,10 @@ static struct mbuf *makembuf (void *buf, { struct mbuf *m; - MGETHDR (m, M_DONTWAIT, MT_DATA); + MGETHDR (m, M_NOWAIT, MT_DATA); if (! m) return 0; - MCLGET (m, M_DONTWAIT); + MCLGET (m, M_NOWAIT); if (! (m->m_flags & M_EXT)) { m_freem (m); return 0; Modified: stable/9/sys/dev/cs/if_cs.c ============================================================================== --- stable/9/sys/dev/cs/if_cs.c Fri Mar 8 22:15:00 2013 (r248077) +++ stable/9/sys/dev/cs/if_cs.c Sat Mar 9 00:39:54 2013 (r248078) @@ -726,12 +726,12 @@ cs_get_packet(struct cs_softc *sc) return (-1); } - MGETHDR(m, M_DONTWAIT, MT_DATA); + MGETHDR(m, M_NOWAIT, MT_DATA); if (m==NULL) return (-1); if (length > MHLEN) { - MCLGET(m, M_DONTWAIT); + MCLGET(m, M_NOWAIT); if (!(m->m_flags & M_EXT)) { m_freem(m); return (-1); Modified: stable/9/sys/dev/ctau/if_ct.c ============================================================================== --- stable/9/sys/dev/ctau/if_ct.c Fri Mar 8 22:15:00 2013 (r248077) +++ stable/9/sys/dev/ctau/if_ct.c Sat Mar 9 00:39:54 2013 (r248078) @@ -205,10 +205,10 @@ static struct mbuf *makembuf (void *buf, { struct mbuf *m; - MGETHDR (m, M_DONTWAIT, MT_DATA); + MGETHDR (m, M_NOWAIT, MT_DATA); if (! m) return 0; - MCLGET (m, M_DONTWAIT); + MCLGET (m, M_NOWAIT); if (! (m->m_flags & M_EXT)) { m_freem (m); return 0; Modified: stable/9/sys/dev/cx/if_cx.c ============================================================================== --- stable/9/sys/dev/cx/if_cx.c Fri Mar 8 22:15:00 2013 (r248077) +++ stable/9/sys/dev/cx/if_cx.c Sat Mar 9 00:39:54 2013 (r248078) @@ -252,13 +252,13 @@ static struct mbuf *makembuf (void *buf, { struct mbuf *m, *o, *p; - MGETHDR (m, M_DONTWAIT, MT_DATA); + MGETHDR (m, M_NOWAIT, MT_DATA); if (! m) return 0; if (len >= MINCLSIZE) - MCLGET (m, M_DONTWAIT); + MCLGET (m, M_NOWAIT); m->m_pkthdr.len = len; m->m_len = 0; @@ -271,13 +271,13 @@ static struct mbuf *makembuf (void *buf, if (! n) { /* Allocate new mbuf. */ o = p; - MGET (p, M_DONTWAIT, MT_DATA); + MGET (p, M_NOWAIT, MT_DATA); if (! p) { m_freem (m); return 0; } if (len >= MINCLSIZE) - MCLGET (p, M_DONTWAIT); + MCLGET (p, M_NOWAIT); p->m_len = 0; o->m_next = p; Modified: stable/9/sys/dev/cxgb/cxgb_main.c ============================================================================== --- stable/9/sys/dev/cxgb/cxgb_main.c Fri Mar 8 22:15:00 2013 (r248077) +++ stable/9/sys/dev/cxgb/cxgb_main.c Sat Mar 9 00:39:54 2013 (r248078) @@ -1442,7 +1442,7 @@ send_pktsched_cmd(struct adapter *adap, struct mbuf *m; struct mngt_pktsched_wr *req; - m = m_gethdr(M_DONTWAIT, MT_DATA); + m = m_gethdr(M_NOWAIT, MT_DATA); if (m) { req = mtod(m, struct mngt_pktsched_wr *); req->wr.wrh_hi = htonl(V_WR_OP(FW_WROPCODE_MNGT)); Modified: stable/9/sys/dev/cxgb/cxgb_sge.c ============================================================================== --- stable/9/sys/dev/cxgb/cxgb_sge.c Fri Mar 8 22:15:00 2013 (r248077) +++ stable/9/sys/dev/cxgb/cxgb_sge.c Sat Mar 9 00:39:54 2013 (r248078) @@ -2710,7 +2710,7 @@ get_packet(adapter_t *adap, unsigned int if (recycle_enable && len <= SGE_RX_COPY_THRES && sopeop == RSPQ_SOP_EOP) { - if ((m = m_gethdr(M_DONTWAIT, MT_DATA)) == NULL) + if ((m = m_gethdr(M_NOWAIT, MT_DATA)) == NULL) goto skip_recycle; cl = mtod(m, void *); memcpy(cl, sd->rxsd_cl, len); @@ -2866,10 +2866,10 @@ process_responses(adapter_t *adap, struc printf("async notification\n"); if (mh->mh_head == NULL) { - mh->mh_head = m_gethdr(M_DONTWAIT, MT_DATA); + mh->mh_head = m_gethdr(M_NOWAIT, MT_DATA); m = mh->mh_head; } else { - m = m_gethdr(M_DONTWAIT, MT_DATA); + m = m_gethdr(M_NOWAIT, MT_DATA); } if (m == NULL) goto no_mem; @@ -2882,7 +2882,7 @@ process_responses(adapter_t *adap, struc rspq->async_notif++; goto skip; } else if (flags & F_RSPD_IMM_DATA_VALID) { - struct mbuf *m = m_gethdr(M_DONTWAIT, MT_DATA); + struct mbuf *m = m_gethdr(M_NOWAIT, MT_DATA); if (m == NULL) { no_mem: Modified: stable/9/sys/dev/cxgb/sys/uipc_mvec.c ============================================================================== --- stable/9/sys/dev/cxgb/sys/uipc_mvec.c Fri Mar 8 22:15:00 2013 (r248077) +++ stable/9/sys/dev/cxgb/sys/uipc_mvec.c Sat Mar 9 00:39:54 2013 (r248078) @@ -98,7 +98,7 @@ retry: printf("mbuf chain too long: %d max allowed %d\n", seg_count, TX_MAX_SEGS); if (!defragged) { - n = m_defrag(*m, M_DONTWAIT); + n = m_defrag(*m, M_NOWAIT); if (n == NULL) { err = ENOBUFS; goto err_out; Modified: stable/9/sys/dev/cxgbe/t4_sge.c ============================================================================== --- stable/9/sys/dev/cxgbe/t4_sge.c Fri Mar 8 22:15:00 2013 (r248077) +++ stable/9/sys/dev/cxgbe/t4_sge.c Sat Mar 9 00:39:54 2013 (r248078) @@ -2763,7 +2763,7 @@ start: sgl->nsegs = 0; rc = bus_dmamap_load_mbuf_sg(txq->tx_tag, txm->map, m, sgl->seg, &sgl->nsegs, BUS_DMA_NOWAIT); if (rc == EFBIG && defragged == 0) { - m = m_defrag(m, M_DONTWAIT); + m = m_defrag(m, M_NOWAIT); if (m == NULL) return (EFBIG); Modified: stable/9/sys/dev/cxgbe/tom/t4_ddp.c ============================================================================== --- stable/9/sys/dev/cxgbe/tom/t4_ddp.c Fri Mar 8 22:15:00 2013 (r248077) +++ stable/9/sys/dev/cxgbe/tom/t4_ddp.c Sat Mar 9 00:39:54 2013 (r248078) @@ -1207,7 +1207,7 @@ deliver: KASSERT(sb->sb_mb != NULL, ("%s: len > 0 && sb->sb_mb empty", __func__)); - m = m_copym(sb->sb_mb, 0, len, M_DONTWAIT); + m = m_copym(sb->sb_mb, 0, len, M_NOWAIT); if (m == NULL) len = 0; /* Don't flush data from sockbuf. */ else Modified: stable/9/sys/dev/cxgbe/tom/t4_listen.c ============================================================================== --- stable/9/sys/dev/cxgbe/tom/t4_listen.c Fri Mar 8 22:15:00 2013 (r248077) +++ stable/9/sys/dev/cxgbe/tom/t4_listen.c Sat Mar 9 00:39:54 2013 (r248078) @@ -1366,7 +1366,7 @@ do_pass_accept_req(struct sge_iq *iq, co * or may not be stashed in the original SYN mbuf passed to us. * Just copy it over instead of dealing with all possibilities. */ - m = m_dup(synqe->syn, M_DONTWAIT); + m = m_dup(synqe->syn, M_NOWAIT); if (m) m->m_pkthdr.rcvif = hw_ifp; Modified: stable/9/sys/dev/dc/if_dc.c ============================================================================== --- stable/9/sys/dev/dc/if_dc.c Fri Mar 8 22:15:00 2013 (r248077) +++ stable/9/sys/dev/dc/if_dc.c Sat Mar 9 00:39:54 2013 (r248078) @@ -2650,7 +2650,7 @@ dc_newbuf(struct dc_softc *sc, int i) bus_dma_segment_t segs[1]; int error, nseg; - m = m_getcl(M_DONTWAIT, MT_DATA, M_PKTHDR); + m = m_getcl(M_NOWAIT, MT_DATA, M_PKTHDR); if (m == NULL) return (ENOBUFS); m->m_len = m->m_pkthdr.len = MCLBYTES; @@ -3387,7 +3387,7 @@ dc_encap(struct dc_softc *sc, struct mbu defragged = 0; if (sc->dc_flags & DC_TX_COALESCE && ((*m_head)->m_next != NULL || sc->dc_flags & DC_TX_ALIGN)) { - m = m_defrag(*m_head, M_DONTWAIT); + m = m_defrag(*m_head, M_NOWAIT); defragged = 1; } else { /* @@ -3402,7 +3402,7 @@ dc_encap(struct dc_softc *sc, struct mbu if (i > DC_TX_LIST_CNT / 4 || DC_TX_LIST_CNT - i + sc->dc_cdata.dc_tx_cnt <= DC_TX_LIST_RSVD) { - m = m_collapse(*m_head, M_DONTWAIT, DC_MAXFRAGS); + m = m_collapse(*m_head, M_NOWAIT, DC_MAXFRAGS); defragged = 1; } } @@ -3419,7 +3419,7 @@ dc_encap(struct dc_softc *sc, struct mbu error = bus_dmamap_load_mbuf_sg(sc->dc_tx_mtag, sc->dc_cdata.dc_tx_map[idx], *m_head, segs, &nseg, 0); if (error == EFBIG) { - if (defragged != 0 || (m = m_collapse(*m_head, M_DONTWAIT, + if (defragged != 0 || (m = m_collapse(*m_head, M_NOWAIT, DC_MAXFRAGS)) == NULL) { m_freem(*m_head); *m_head = NULL; Modified: stable/9/sys/dev/de/if_de.c ============================================================================== --- stable/9/sys/dev/de/if_de.c Fri Mar 8 22:15:00 2013 (r248077) +++ stable/9/sys/dev/de/if_de.c Sat Mar 9 00:39:54 2013 (r248078) @@ -257,7 +257,7 @@ tulip_txprobe(tulip_softc_t * const sc) * to verify the connectivity. */ TULIP_LOCK_ASSERT(sc); - MGETHDR(m, M_DONTWAIT, MT_DATA); + MGETHDR(m, M_NOWAIT, MT_DATA); if (m == NULL) return 0; /* @@ -3517,7 +3517,7 @@ tulip_rx_intr(tulip_softc_t * const sc) ms->m_pkthdr.len = total_len; ms->m_pkthdr.rcvif = ifp; m0 = ms; - ms = m_getcl(M_DONTWAIT, MT_DATA, M_PKTHDR); + ms = m_getcl(M_NOWAIT, MT_DATA, M_PKTHDR); #endif TULIP_UNLOCK(sc); CTR1(KTR_TULIP, "tulip_rx_intr: passing %p to upper layer", m0); @@ -3528,7 +3528,7 @@ tulip_rx_intr(tulip_softc_t * const sc) * If we are priming the TULIP with mbufs, then allocate * a new cluster for the next descriptor. */ - ms = m_getcl(M_DONTWAIT, MT_DATA, M_PKTHDR); + ms = m_getcl(M_NOWAIT, MT_DATA, M_PKTHDR); #ifndef __NO_STRICT_ALIGNMENT skip_input: @@ -3970,7 +3970,7 @@ tulip_txput(tulip_softc_t * const sc, st * to recopy it into one mbuf and then try again. If * we can't recopy it, try again later. */ - m0 = m_defrag(m, M_DONTWAIT); + m0 = m_defrag(m, M_NOWAIT); if (m0 == NULL) { sc->tulip_flags |= TULIP_WANTTXSTART; #if defined(TULIP_DEBUG) Modified: stable/9/sys/dev/e1000/if_em.c ============================================================================== --- stable/9/sys/dev/e1000/if_em.c Fri Mar 8 22:15:00 2013 (r248077) +++ stable/9/sys/dev/e1000/if_em.c Sat Mar 9 00:39:54 2013 (r248078) @@ -1829,7 +1829,7 @@ retry: if (do_tso || (m_head->m_next != NULL && m_head->m_pkthdr.csum_flags & CSUM_OFFLOAD)) { if (M_WRITABLE(*m_headp) == 0) { - m_head = m_dup(*m_headp, M_DONTWAIT); + m_head = m_dup(*m_headp, M_NOWAIT); m_freem(*m_headp); if (m_head == NULL) { *m_headp = NULL; @@ -1946,7 +1946,7 @@ retry: if (error == EFBIG && remap) { struct mbuf *m; - m = m_defrag(*m_headp, M_DONTWAIT); + m = m_defrag(*m_headp, M_NOWAIT); if (m == NULL) { adapter->mbuf_alloc_failed++; m_freem(*m_headp); @@ -3928,7 +3928,7 @@ em_refresh_mbufs(struct rx_ring *rxr, in while (j != limit) { rxbuf = &rxr->rx_buffers[i]; if (rxbuf->m_head == NULL) { - m = m_getjcl(M_DONTWAIT, MT_DATA, + m = m_getjcl(M_NOWAIT, MT_DATA, M_PKTHDR, adapter->rx_mbuf_sz); /* ** If we have a temporary resource shortage @@ -4098,7 +4098,7 @@ em_setup_receive_ring(struct rx_ring *rx continue; } #endif /* DEV_NETMAP */ - rxbuf->m_head = m_getjcl(M_DONTWAIT, MT_DATA, + rxbuf->m_head = m_getjcl(M_NOWAIT, MT_DATA, M_PKTHDR, adapter->rx_mbuf_sz); if (rxbuf->m_head == NULL) { error = ENOBUFS; @@ -4577,7 +4577,7 @@ em_fixup_rx(struct rx_ring *rxr) bcopy(m->m_data, m->m_data + ETHER_HDR_LEN, m->m_len); m->m_data += ETHER_HDR_LEN; } else { - MGETHDR(n, M_DONTWAIT, MT_DATA); + MGETHDR(n, M_NOWAIT, MT_DATA); if (n != NULL) { bcopy(m->m_data, n->m_data, ETHER_HDR_LEN); m->m_data += ETHER_HDR_LEN; Modified: stable/9/sys/dev/e1000/if_igb.c ============================================================================== --- stable/9/sys/dev/e1000/if_igb.c Fri Mar 8 22:15:00 2013 (r248077) +++ stable/9/sys/dev/e1000/if_igb.c Sat Mar 9 00:39:54 2013 (r248078) @@ -1836,7 +1836,7 @@ retry: if (do_tso || (m_head->m_next != NULL && m_head->m_pkthdr.csum_flags & CSUM_OFFLOAD)) { if (M_WRITABLE(*m_headp) == 0) { - m_head = m_dup(*m_headp, M_DONTWAIT); + m_head = m_dup(*m_headp, M_NOWAIT); m_freem(*m_headp); if (m_head == NULL) { *m_headp = NULL; @@ -1941,7 +1941,7 @@ retry: if (error == EFBIG && remap) { struct mbuf *m; - m = m_defrag(*m_headp, M_DONTWAIT); + m = m_defrag(*m_headp, M_NOWAIT); if (m == NULL) { adapter->mbuf_defrag_failed++; m_freem(*m_headp); @@ -3990,7 +3990,7 @@ igb_refresh_mbufs(struct rx_ring *rxr, i if (rxr->hdr_split == FALSE) goto no_split; if (rxbuf->m_head == NULL) { - mh = m_gethdr(M_DONTWAIT, MT_DATA); + mh = m_gethdr(M_NOWAIT, MT_DATA); if (mh == NULL) goto update; } else @@ -4016,7 +4016,7 @@ igb_refresh_mbufs(struct rx_ring *rxr, i htole64(hseg[0].ds_addr); no_split: if (rxbuf->m_pack == NULL) { - mp = m_getjcl(M_DONTWAIT, MT_DATA, + mp = m_getjcl(M_NOWAIT, MT_DATA, M_PKTHDR, adapter->rx_mbuf_sz); if (mp == NULL) goto update; @@ -4232,7 +4232,7 @@ igb_setup_receive_ring(struct rx_ring *r goto skip_head; /* First the header */ - rxbuf->m_head = m_gethdr(M_DONTWAIT, MT_DATA); + rxbuf->m_head = m_gethdr(M_NOWAIT, MT_DATA); if (rxbuf->m_head == NULL) { error = ENOBUFS; goto fail; @@ -4254,7 +4254,7 @@ igb_setup_receive_ring(struct rx_ring *r skip_head: /* Now the payload cluster */ - rxbuf->m_pack = m_getjcl(M_DONTWAIT, MT_DATA, + rxbuf->m_pack = m_getjcl(M_NOWAIT, MT_DATA, M_PKTHDR, adapter->rx_mbuf_sz); if (rxbuf->m_pack == NULL) { error = ENOBUFS; Modified: stable/9/sys/dev/e1000/if_lem.c ============================================================================== --- stable/9/sys/dev/e1000/if_lem.c Fri Mar 8 22:15:00 2013 (r248077) +++ stable/9/sys/dev/e1000/if_lem.c Sat Mar 9 00:39:54 2013 (r248078) @@ -1588,7 +1588,7 @@ lem_xmit(struct adapter *adapter, struct if (error == EFBIG) { struct mbuf *m; - m = m_defrag(*m_headp, M_DONTWAIT); + m = m_defrag(*m_headp, M_NOWAIT); if (m == NULL) { adapter->mbuf_alloc_failed++; m_freem(*m_headp); @@ -3096,7 +3096,7 @@ lem_get_buf(struct adapter *adapter, int struct em_buffer *rx_buffer; int error, nsegs; - m = m_getcl(M_DONTWAIT, MT_DATA, M_PKTHDR); + m = m_getcl(M_NOWAIT, MT_DATA, M_PKTHDR); if (m == NULL) { adapter->mbuf_cluster_failed++; return (ENOBUFS); @@ -3668,7 +3668,7 @@ lem_fixup_rx(struct adapter *adapter) bcopy(m->m_data, m->m_data + ETHER_HDR_LEN, m->m_len); m->m_data += ETHER_HDR_LEN; } else { - MGETHDR(n, M_DONTWAIT, MT_DATA); + MGETHDR(n, M_NOWAIT, MT_DATA); if (n != NULL) { bcopy(m->m_data, n->m_data, ETHER_HDR_LEN); m->m_data += ETHER_HDR_LEN; Modified: stable/9/sys/dev/ed/if_ed.c ============================================================================== --- stable/9/sys/dev/ed/if_ed.c Fri Mar 8 22:15:00 2013 (r248077) +++ stable/9/sys/dev/ed/if_ed.c Sat Mar 9 00:39:54 2013 (r248078) @@ -1268,7 +1268,7 @@ ed_get_packet(struct ed_softc *sc, bus_s struct mbuf *m; /* Allocate a header mbuf */ - MGETHDR(m, M_DONTWAIT, MT_DATA); + MGETHDR(m, M_NOWAIT, MT_DATA); if (m == NULL) return; m->m_pkthdr.rcvif = ifp; @@ -1282,7 +1282,7 @@ ed_get_packet(struct ed_softc *sc, bus_s */ if ((len + 2) > MHLEN) { /* Attach an mbuf cluster */ - MCLGET(m, M_DONTWAIT); + MCLGET(m, M_NOWAIT); /* Insist on getting a cluster */ if ((m->m_flags & M_EXT) == 0) { Modified: stable/9/sys/dev/en/midway.c ============================================================================== --- stable/9/sys/dev/en/midway.c Fri Mar 8 22:15:00 2013 (r248077) +++ stable/9/sys/dev/en/midway.c Sat Mar 9 00:39:54 2013 (r248078) @@ -837,15 +837,15 @@ copy_mbuf(struct mbuf *m) { struct mbuf *new; - MGET(new, M_WAIT, MT_DATA); + MGET(new, M_WAITOK, MT_DATA); if (m->m_flags & M_PKTHDR) { M_MOVE_PKTHDR(new, m); if (m->m_len > MHLEN) - MCLGET(new, M_WAIT); + MCLGET(new, M_WAITOK); } else { if (m->m_len > MLEN) - MCLGET(new, M_WAIT); + MCLGET(new, M_WAITOK); } bcopy(m->m_data, new->m_data, m->m_len); @@ -1925,7 +1925,7 @@ en_mget(struct en_softc *sc, u_int pktle * words at the begin. */ /* called from interrupt context */ - MGETHDR(m, M_DONTWAIT, MT_DATA); + MGETHDR(m, M_NOWAIT, MT_DATA); if (m == NULL) return (NULL); @@ -1940,7 +1940,7 @@ en_mget(struct en_softc *sc, u_int pktle totlen -= m->m_len; /* called from interrupt context */ - tmp = m_getm(m, totlen, M_DONTWAIT, MT_DATA); + tmp = m_getm(m, totlen, M_NOWAIT, MT_DATA); if (tmp == NULL) { m_free(m); return (NULL); @@ -2924,7 +2924,7 @@ en_attach(struct en_softc *sc) &en_utopia_methods); utopia_init_media(&sc->utopia); - MGET(sc->padbuf, M_WAIT, MT_DATA); + MGET(sc->padbuf, M_WAITOK, MT_DATA); bzero(sc->padbuf->m_data, MLEN); if (bus_dma_tag_create(bus_get_dma_tag(sc->dev), 1, 0, Modified: stable/9/sys/dev/ep/if_ep.c ============================================================================== --- stable/9/sys/dev/ep/if_ep.c Fri Mar 8 22:15:00 2013 (r248077) +++ stable/9/sys/dev/ep/if_ep.c Sat Mar 9 00:39:54 2013 (r248078) @@ -747,11 +747,11 @@ read_again: rx_fifo = rx_fifo2 = status & RX_BYTES_MASK; if (EP_FTST(sc, F_RX_FIRST)) { - MGETHDR(m, M_DONTWAIT, MT_DATA); + MGETHDR(m, M_NOWAIT, MT_DATA); if (!m) goto out; if (rx_fifo >= MINCLSIZE) - MCLGET(m, M_DONTWAIT); + MCLGET(m, M_NOWAIT); sc->top = sc->mcur = top = m; #define EROUND ((sizeof(struct ether_header) + 3) & ~3) #define EOFF (EROUND - sizeof(struct ether_header)) @@ -775,11 +775,11 @@ read_again: lenthisone = min(rx_fifo, M_TRAILINGSPACE(m)); if (lenthisone == 0) { /* no room in this one */ mcur = m; - MGET(m, M_DONTWAIT, MT_DATA); + MGET(m, M_NOWAIT, MT_DATA); if (!m) goto out; if (rx_fifo >= MINCLSIZE) - MCLGET(m, M_DONTWAIT); + MCLGET(m, M_NOWAIT); m->m_len = 0; mcur->m_next = m; lenthisone = min(rx_fifo, M_TRAILINGSPACE(m)); Modified: stable/9/sys/dev/et/if_et.c ============================================================================== --- stable/9/sys/dev/et/if_et.c Fri Mar 8 22:15:00 2013 (r248077) +++ stable/9/sys/dev/et/if_et.c Sat Mar 9 00:39:54 2013 (r248078) @@ -2169,7 +2169,7 @@ et_encap(struct et_softc *sc, struct mbu *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable@FreeBSD.ORG Sat Mar 9 02:36:51 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 5196B55D; Sat, 9 Mar 2013 02:36:51 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 39DD172D; Sat, 9 Mar 2013 02:36:51 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r292apHl068008; Sat, 9 Mar 2013 02:36:51 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r292aXWs067894; Sat, 9 Mar 2013 02:36:33 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201303090236.r292aXWs067894@svn.freebsd.org> From: Marius Strobl Date: Sat, 9 Mar 2013 02:36:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r248085 - in stable/9/sys: amd64/amd64 amd64/linux32 arm/arm arm/xscale/i80321 arm/xscale/i8134x arm/xscale/ixp425 cam/ata cam/scsi compat/ia32 compat/linux compat/x86bios dev/aac dev/a... X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Mar 2013 02:36:51 -0000 Author: marius Date: Sat Mar 9 02:36:32 2013 New Revision: 248085 URL: http://svnweb.freebsd.org/changeset/base/248085 Log: MFC: r227309 (partial) Mark all SYSCTL_NODEs static that have no corresponding SYSCTL_DECLs. The SYSCTL_NODE macro defines a list that stores all child-elements of that node. If there's no SYSCTL_DECL macro anywhere else, there's no reason why it shouldn't be static. Modified: stable/9/sys/amd64/amd64/mp_machdep.c stable/9/sys/amd64/amd64/pmap.c stable/9/sys/amd64/linux32/linux32_sysvec.c stable/9/sys/arm/arm/busdma_machdep.c stable/9/sys/arm/xscale/i80321/iq31244_7seg.c stable/9/sys/arm/xscale/i8134x/iq81342_7seg.c stable/9/sys/arm/xscale/ixp425/if_npe.c stable/9/sys/cam/ata/ata_da.c stable/9/sys/cam/ata/ata_pmp.c stable/9/sys/cam/scsi/scsi_cd.c stable/9/sys/cam/scsi/scsi_da.c stable/9/sys/compat/ia32/ia32_sysvec.c stable/9/sys/compat/linux/linux_mib.c stable/9/sys/compat/x86bios/x86bios.c stable/9/sys/dev/aac/aac.c stable/9/sys/dev/acpica/acpi_ec.c stable/9/sys/dev/acpica/acpi_smbat.c stable/9/sys/dev/an/if_an.c stable/9/sys/dev/ata/ata-all.c stable/9/sys/dev/ath/ah_osdep.c stable/9/sys/dev/atkbdc/psm.c stable/9/sys/dev/bce/if_bce.c stable/9/sys/dev/bge/if_bge.c stable/9/sys/dev/bktr/bktr_os.c stable/9/sys/dev/bwn/if_bwn.c stable/9/sys/dev/bxe/if_bxe.c stable/9/sys/dev/cardbus/cardbus.c stable/9/sys/dev/cs/if_cs.c stable/9/sys/dev/dcons/dcons_os.c stable/9/sys/dev/fb/vesa.c stable/9/sys/dev/fdc/fdc.c stable/9/sys/dev/firewire/fwmem.c stable/9/sys/dev/firewire/if_fwe.c stable/9/sys/dev/firewire/if_fwip.c stable/9/sys/dev/firewire/sbp.c stable/9/sys/dev/hifn/hifn7751.c stable/9/sys/dev/ipmi/ipmi.c stable/9/sys/dev/kbd/kbd.c stable/9/sys/dev/malo/if_malo_pci.c stable/9/sys/dev/mmc/mmc.c stable/9/sys/dev/mwl/mwlhal.c stable/9/sys/dev/pccard/pccard.c stable/9/sys/dev/pccbb/pccbb.c stable/9/sys/dev/pccbb/pccbb_isa.c stable/9/sys/dev/rndtest/rndtest.c stable/9/sys/dev/rt/if_rt.c stable/9/sys/dev/safe/safe.c stable/9/sys/dev/sdhci/sdhci.c stable/9/sys/dev/sound/midi/midi.c stable/9/sys/dev/sound/pci/maestro.c stable/9/sys/dev/sound/usb/uaudio.c stable/9/sys/dev/syscons/syscons.c stable/9/sys/dev/ubsec/ubsec.c stable/9/sys/dev/usb/controller/at91dci.c stable/9/sys/dev/usb/controller/atmegadci.c stable/9/sys/dev/usb/controller/avr32dci.c stable/9/sys/dev/usb/controller/ehci.c stable/9/sys/dev/usb/controller/musb_otg.c stable/9/sys/dev/usb/controller/ohci.c stable/9/sys/dev/usb/controller/uhci.c stable/9/sys/dev/usb/controller/usb_controller.c stable/9/sys/dev/usb/controller/uss820dci.c stable/9/sys/dev/usb/controller/xhci.c stable/9/sys/dev/usb/input/atp.c stable/9/sys/dev/usb/input/uep.c stable/9/sys/dev/usb/input/uhid.c stable/9/sys/dev/usb/input/ukbd.c stable/9/sys/dev/usb/input/ums.c stable/9/sys/dev/usb/misc/udbp.c stable/9/sys/dev/usb/net/if_aue.c stable/9/sys/dev/usb/net/if_axe.c stable/9/sys/dev/usb/net/if_cdce.c stable/9/sys/dev/usb/net/if_cue.c stable/9/sys/dev/usb/net/if_ipheth.c stable/9/sys/dev/usb/net/if_kue.c stable/9/sys/dev/usb/net/if_mos.c stable/9/sys/dev/usb/net/if_rue.c stable/9/sys/dev/usb/net/if_udav.c stable/9/sys/dev/usb/net/if_usie.c stable/9/sys/dev/usb/net/uhso.c stable/9/sys/dev/usb/net/usb_ethernet.c stable/9/sys/dev/usb/serial/u3g.c stable/9/sys/dev/usb/serial/ubsa.c stable/9/sys/dev/usb/serial/ubser.c stable/9/sys/dev/usb/serial/uchcom.c stable/9/sys/dev/usb/serial/uftdi.c stable/9/sys/dev/usb/serial/ulpt.c stable/9/sys/dev/usb/serial/umcs.c stable/9/sys/dev/usb/serial/umodem.c stable/9/sys/dev/usb/serial/umoscom.c stable/9/sys/dev/usb/serial/uplcom.c stable/9/sys/dev/usb/serial/usb_serial.c stable/9/sys/dev/usb/serial/uslcom.c stable/9/sys/dev/usb/serial/uvisor.c stable/9/sys/dev/usb/serial/uvscom.c stable/9/sys/dev/usb/storage/umass.c stable/9/sys/dev/usb/storage/urio.c stable/9/sys/dev/usb/usb_dev.c stable/9/sys/dev/usb/usb_generic.c stable/9/sys/dev/usb/usb_hub.c stable/9/sys/dev/usb/usb_process.c stable/9/sys/dev/usb/wlan/if_rum.c stable/9/sys/dev/usb/wlan/if_run.c stable/9/sys/dev/usb/wlan/if_uath.c stable/9/sys/dev/usb/wlan/if_upgt.c stable/9/sys/dev/usb/wlan/if_ural.c stable/9/sys/dev/usb/wlan/if_urtw.c stable/9/sys/dev/usb/wlan/if_zyd.c stable/9/sys/dev/wi/if_wi.c stable/9/sys/dev/xe/if_xe.c stable/9/sys/dev/xen/balloon/balloon.c stable/9/sys/fs/ext2fs/ext2_alloc.c stable/9/sys/fs/pseudofs/pseudofs_vncache.c stable/9/sys/geom/cache/g_cache.c stable/9/sys/geom/concat/g_concat.c stable/9/sys/geom/geom_disk.c stable/9/sys/geom/journal/g_journal.c stable/9/sys/geom/mirror/g_mirror.c stable/9/sys/geom/mountver/g_mountver.c stable/9/sys/geom/multipath/g_multipath.c stable/9/sys/geom/nop/g_nop.c stable/9/sys/geom/raid3/g_raid3.c stable/9/sys/geom/sched/gs_rr.c stable/9/sys/geom/shsec/g_shsec.c stable/9/sys/geom/stripe/g_stripe.c stable/9/sys/geom/vinum/geom_vinum.c stable/9/sys/geom/virstor/g_virstor.c stable/9/sys/geom/zero/g_zero.c stable/9/sys/gnu/fs/xfs/FreeBSD/support/debug.c stable/9/sys/i386/i386/mp_machdep.c stable/9/sys/i386/i386/pmap.c stable/9/sys/ia64/ia64/busdma_machdep.c stable/9/sys/ia64/ia64/machdep.c stable/9/sys/ia64/ia64/mca.c stable/9/sys/ia64/ia64/pmap.c stable/9/sys/kern/kern_clock.c stable/9/sys/kern/kern_cpu.c stable/9/sys/kern/kern_et.c stable/9/sys/kern/kern_jail.c stable/9/sys/kern/kern_ktr.c stable/9/sys/kern/kern_malloc.c stable/9/sys/kern/kern_poll.c stable/9/sys/kern/kern_shutdown.c stable/9/sys/kern/kern_sig.c stable/9/sys/kern/kern_tc.c stable/9/sys/kern/kern_thr.c stable/9/sys/kern/kern_umtx.c stable/9/sys/kern/sched_4bsd.c stable/9/sys/kern/subr_devstat.c stable/9/sys/kern/subr_kdb.c stable/9/sys/kern/subr_lock.c stable/9/sys/kern/subr_prof.c stable/9/sys/kern/subr_rman.c stable/9/sys/kern/subr_sleepqueue.c stable/9/sys/kern/subr_smp.c stable/9/sys/kern/subr_turnstile.c stable/9/sys/kern/subr_witness.c stable/9/sys/kern/uipc_mqueue.c stable/9/sys/kern/uipc_usrreq.c stable/9/sys/kern/vfs_cache.c stable/9/sys/mips/cavium/usb/octusb.c stable/9/sys/mips/mips/busdma_machdep.c stable/9/sys/net/bpf.c stable/9/sys/net/flowtable.c stable/9/sys/net/if_bridge.c stable/9/sys/net/if_enc.c stable/9/sys/net/if_epair.c stable/9/sys/net/if_gif.c stable/9/sys/net/if_gre.c stable/9/sys/net/if_lagg.c stable/9/sys/net/if_mib.c stable/9/sys/net/if_stf.c stable/9/sys/net/if_tap.c stable/9/sys/net/if_tun.c stable/9/sys/net/if_vlan.c stable/9/sys/net/netisr.c stable/9/sys/net/raw_cb.c stable/9/sys/net/rtsock.c stable/9/sys/net80211/ieee80211_hwmp.c stable/9/sys/net80211/ieee80211_mesh.c stable/9/sys/netgraph/atm/ng_atm.c stable/9/sys/netgraph/bluetooth/socket/ng_btsocket_hci_raw.c stable/9/sys/netgraph/bluetooth/socket/ng_btsocket_l2cap.c stable/9/sys/netgraph/bluetooth/socket/ng_btsocket_l2cap_raw.c stable/9/sys/netgraph/bluetooth/socket/ng_btsocket_rfcomm.c stable/9/sys/netgraph/bluetooth/socket/ng_btsocket_sco.c stable/9/sys/netgraph/ng_socket.c stable/9/sys/netinet/accf_http.c stable/9/sys/netinet/if_ether.c stable/9/sys/netinet/igmp.c stable/9/sys/netinet/in_mcast.c stable/9/sys/netinet/in_pcb.c stable/9/sys/netinet/ip_divert.c stable/9/sys/netinet/ip_mroute.c stable/9/sys/netinet/libalias/alias_sctp.c stable/9/sys/netinet/tcp_hostcache.c stable/9/sys/netinet/tcp_input.c stable/9/sys/netinet/tcp_reass.c stable/9/sys/netinet/tcp_syncache.c stable/9/sys/netinet6/in6_mcast.c stable/9/sys/netinet6/in6_src.c stable/9/sys/netinet6/ip6_mroute.c stable/9/sys/netinet6/mld6.c stable/9/sys/netipx/ipx_proto.c stable/9/sys/netpfil/ipfw/ip_dn_io.c stable/9/sys/nlm/nlm_prot_impl.c stable/9/sys/ofed/drivers/infiniband/ulp/sdp/sdp_main.c stable/9/sys/powerpc/fpu/fpu_emu.c stable/9/sys/powerpc/ofw/ofw_syscons.c stable/9/sys/powerpc/powerpc/busdma_machdep.c stable/9/sys/powerpc/ps3/ps3disk.c stable/9/sys/security/audit/audit.c stable/9/sys/security/mac_biba/mac_biba.c stable/9/sys/security/mac_bsdextended/mac_bsdextended.c stable/9/sys/security/mac_ifoff/mac_ifoff.c stable/9/sys/security/mac_lomac/mac_lomac.c stable/9/sys/security/mac_mls/mac_mls.c stable/9/sys/security/mac_partition/mac_partition.c stable/9/sys/security/mac_portacl/mac_portacl.c stable/9/sys/security/mac_seeotheruids/mac_seeotheruids.c stable/9/sys/security/mac_stub/mac_stub.c stable/9/sys/security/mac_test/mac_test.c stable/9/sys/sparc64/sparc64/identcpu.c stable/9/sys/sparc64/sparc64/tick.c stable/9/sys/ufs/ffs/ffs_softdep.c stable/9/sys/vm/memguard.c stable/9/sys/vm/redzone.c stable/9/sys/vm/vm_object.c stable/9/sys/x86/bios/vpd.c stable/9/sys/x86/x86/busdma_machdep.c stable/9/sys/x86/x86/io_apic.c stable/9/sys/x86/x86/mca.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) stable/9/sys/fs/ (props changed) Modified: stable/9/sys/amd64/amd64/mp_machdep.c ============================================================================== --- stable/9/sys/amd64/amd64/mp_machdep.c Sat Mar 9 02:32:23 2013 (r248084) +++ stable/9/sys/amd64/amd64/mp_machdep.c Sat Mar 9 02:36:32 2013 (r248085) @@ -1046,7 +1046,7 @@ start_ap(int apic_id) u_int xhits_gbl[MAXCPU]; u_int xhits_pg[MAXCPU]; u_int xhits_rng[MAXCPU]; -SYSCTL_NODE(_debug, OID_AUTO, xhits, CTLFLAG_RW, 0, ""); +static SYSCTL_NODE(_debug, OID_AUTO, xhits, CTLFLAG_RW, 0, ""); SYSCTL_OPAQUE(_debug_xhits, OID_AUTO, global, CTLFLAG_RW, &xhits_gbl, sizeof(xhits_gbl), "IU", ""); SYSCTL_OPAQUE(_debug_xhits, OID_AUTO, page, CTLFLAG_RW, &xhits_pg, Modified: stable/9/sys/amd64/amd64/pmap.c ============================================================================== --- stable/9/sys/amd64/amd64/pmap.c Sat Mar 9 02:32:23 2013 (r248084) +++ stable/9/sys/amd64/amd64/pmap.c Sat Mar 9 02:36:32 2013 (r248085) @@ -214,7 +214,7 @@ static vm_paddr_t dmaplimit; vm_offset_t kernel_vm_end = VM_MIN_KERNEL_ADDRESS; pt_entry_t pg_nx; -SYSCTL_NODE(_vm, OID_AUTO, pmap, CTLFLAG_RD, 0, "VM/pmap parameters"); +static SYSCTL_NODE(_vm, OID_AUTO, pmap, CTLFLAG_RD, 0, "VM/pmap parameters"); static int pat_works = 1; SYSCTL_INT(_vm_pmap, OID_AUTO, pat_works, CTLFLAG_RD, &pat_works, 1, @@ -839,7 +839,7 @@ pmap_init(void) TAILQ_INIT(&pv_table[i].pv_list); } -SYSCTL_NODE(_vm_pmap, OID_AUTO, pde, CTLFLAG_RD, 0, +static SYSCTL_NODE(_vm_pmap, OID_AUTO, pde, CTLFLAG_RD, 0, "2MB page mapping counters"); static u_long pmap_pde_demotions; @@ -858,7 +858,7 @@ static u_long pmap_pde_promotions; SYSCTL_ULONG(_vm_pmap_pde, OID_AUTO, promotions, CTLFLAG_RD, &pmap_pde_promotions, 0, "2MB page promotions"); -SYSCTL_NODE(_vm_pmap, OID_AUTO, pdpe, CTLFLAG_RD, 0, +static SYSCTL_NODE(_vm_pmap, OID_AUTO, pdpe, CTLFLAG_RD, 0, "1GB page mapping counters"); static u_long pmap_pdpe_demotions; Modified: stable/9/sys/amd64/linux32/linux32_sysvec.c ============================================================================== --- stable/9/sys/amd64/linux32/linux32_sysvec.c Sat Mar 9 02:32:23 2013 (r248084) +++ stable/9/sys/amd64/linux32/linux32_sysvec.c Sat Mar 9 02:36:32 2013 (r248085) @@ -977,7 +977,7 @@ linux_copyout_strings(struct image_param return ((register_t *)stack_base); } -SYSCTL_NODE(_compat, OID_AUTO, linux32, CTLFLAG_RW, 0, +static SYSCTL_NODE(_compat, OID_AUTO, linux32, CTLFLAG_RW, 0, "32-bit Linux emulation"); static u_long linux32_maxdsiz = LINUX32_MAXDSIZ; Modified: stable/9/sys/arm/arm/busdma_machdep.c ============================================================================== --- stable/9/sys/arm/arm/busdma_machdep.c Sat Mar 9 02:32:23 2013 (r248084) +++ stable/9/sys/arm/arm/busdma_machdep.c Sat Mar 9 02:36:32 2013 (r248085) @@ -126,7 +126,7 @@ static int total_bpages; static int busdma_zonecount; static STAILQ_HEAD(, bounce_zone) bounce_zone_list; -SYSCTL_NODE(_hw, OID_AUTO, busdma, CTLFLAG_RD, 0, "Busdma parameters"); +static SYSCTL_NODE(_hw, OID_AUTO, busdma, CTLFLAG_RD, 0, "Busdma parameters"); SYSCTL_INT(_hw_busdma, OID_AUTO, total_bpages, CTLFLAG_RD, &total_bpages, 0, "Total bounce pages"); Modified: stable/9/sys/arm/xscale/i80321/iq31244_7seg.c ============================================================================== --- stable/9/sys/arm/xscale/i80321/iq31244_7seg.c Sat Mar 9 02:32:23 2013 (r248084) +++ stable/9/sys/arm/xscale/i80321/iq31244_7seg.c Sat Mar 9 02:36:32 2013 (r248085) @@ -334,7 +334,7 @@ static const uint8_t snakemap[][2] = { { ~SEG_B, ~SEG_F }, }; -SYSCTL_NODE(_hw, OID_AUTO, sevenseg, CTLFLAG_RD, 0, "7 seg"); +static SYSCTL_NODE(_hw, OID_AUTO, sevenseg, CTLFLAG_RD, 0, "7 seg"); static int freq = 20; SYSCTL_INT(_hw_sevenseg, OID_AUTO, freq, CTLFLAG_RW, &freq, 0, "7 Seg update frequency"); Modified: stable/9/sys/arm/xscale/i8134x/iq81342_7seg.c ============================================================================== --- stable/9/sys/arm/xscale/i8134x/iq81342_7seg.c Sat Mar 9 02:32:23 2013 (r248084) +++ stable/9/sys/arm/xscale/i8134x/iq81342_7seg.c Sat Mar 9 02:36:32 2013 (r248085) @@ -335,7 +335,7 @@ static const uint8_t snakemap[][2] = { { SEG_B, SEG_F }, }; -SYSCTL_NODE(_hw, OID_AUTO, sevenseg, CTLFLAG_RD, 0, "7 seg"); +static SYSCTL_NODE(_hw, OID_AUTO, sevenseg, CTLFLAG_RD, 0, "7 seg"); static int freq = 20; SYSCTL_INT(_hw_sevenseg, OID_AUTO, freq, CTLFLAG_RW, &freq, 0, "7 Seg update frequency"); Modified: stable/9/sys/arm/xscale/ixp425/if_npe.c ============================================================================== --- stable/9/sys/arm/xscale/ixp425/if_npe.c Sat Mar 9 02:32:23 2013 (r248084) +++ stable/9/sys/arm/xscale/ixp425/if_npe.c Sat Mar 9 02:36:32 2013 (r248085) @@ -250,7 +250,8 @@ static int npe_setloopback(struct npe_so /* NB: all tx done processing goes through one queue */ static int tx_doneqid = -1; -SYSCTL_NODE(_hw, OID_AUTO, npe, CTLFLAG_RD, 0, "IXP4XX NPE driver parameters"); +static SYSCTL_NODE(_hw, OID_AUTO, npe, CTLFLAG_RD, 0, + "IXP4XX NPE driver parameters"); static int npe_debug = 0; SYSCTL_INT(_hw_npe, OID_AUTO, debug, CTLFLAG_RW, &npe_debug, Modified: stable/9/sys/cam/ata/ata_da.c ============================================================================== --- stable/9/sys/cam/ata/ata_da.c Sat Mar 9 02:32:23 2013 (r248084) +++ stable/9/sys/cam/ata/ata_da.c Sat Mar 9 02:36:32 2013 (r248085) @@ -467,7 +467,7 @@ static int ada_spindown_suspend = ADA_DE static int ada_read_ahead = ADA_DEFAULT_READ_AHEAD; static int ada_write_cache = ADA_DEFAULT_WRITE_CACHE; -SYSCTL_NODE(_kern_cam, OID_AUTO, ada, CTLFLAG_RD, 0, +static SYSCTL_NODE(_kern_cam, OID_AUTO, ada, CTLFLAG_RD, 0, "CAM Direct Access Disk driver"); SYSCTL_INT(_kern_cam_ada, OID_AUTO, legacy_aliases, CTLFLAG_RW, &ada_legacy_aliases, 0, "Create legacy-like device aliases"); Modified: stable/9/sys/cam/ata/ata_pmp.c ============================================================================== --- stable/9/sys/cam/ata/ata_pmp.c Sat Mar 9 02:32:23 2013 (r248084) +++ stable/9/sys/cam/ata/ata_pmp.c Sat Mar 9 02:36:32 2013 (r248085) @@ -134,7 +134,7 @@ static int pmp_retry_count = PMP_DEFAULT static int pmp_default_timeout = PMP_DEFAULT_TIMEOUT; static int pmp_hide_special = PMP_DEFAULT_HIDE_SPECIAL; -SYSCTL_NODE(_kern_cam, OID_AUTO, pmp, CTLFLAG_RD, 0, +static SYSCTL_NODE(_kern_cam, OID_AUTO, pmp, CTLFLAG_RD, 0, "CAM Direct Access Disk driver"); SYSCTL_INT(_kern_cam_pmp, OID_AUTO, retry_count, CTLFLAG_RW, &pmp_retry_count, 0, "Normal I/O retry count"); Modified: stable/9/sys/cam/scsi/scsi_cd.c ============================================================================== --- stable/9/sys/cam/scsi/scsi_cd.c Sat Mar 9 02:32:23 2013 (r248084) +++ stable/9/sys/cam/scsi/scsi_cd.c Sat Mar 9 02:36:32 2013 (r248085) @@ -304,8 +304,9 @@ static int cd_retry_count = CD_DEFAULT_R static int changer_min_busy_seconds = CHANGER_MIN_BUSY_SECONDS; static int changer_max_busy_seconds = CHANGER_MAX_BUSY_SECONDS; -SYSCTL_NODE(_kern_cam, OID_AUTO, cd, CTLFLAG_RD, 0, "CAM CDROM driver"); -SYSCTL_NODE(_kern_cam_cd, OID_AUTO, changer, CTLFLAG_RD, 0, "CD Changer"); +static SYSCTL_NODE(_kern_cam, OID_AUTO, cd, CTLFLAG_RD, 0, "CAM CDROM driver"); +static SYSCTL_NODE(_kern_cam_cd, OID_AUTO, changer, CTLFLAG_RD, 0, + "CD Changer"); SYSCTL_INT(_kern_cam_cd, OID_AUTO, retry_count, CTLFLAG_RW, &cd_retry_count, 0, "Normal I/O retry count"); TUNABLE_INT("kern.cam.cd.retry_count", &cd_retry_count); Modified: stable/9/sys/cam/scsi/scsi_da.c ============================================================================== --- stable/9/sys/cam/scsi/scsi_da.c Sat Mar 9 02:32:23 2013 (r248084) +++ stable/9/sys/cam/scsi/scsi_da.c Sat Mar 9 02:36:32 2013 (r248085) @@ -892,7 +892,7 @@ static int da_retry_count = DA_DEFAULT_R static int da_default_timeout = DA_DEFAULT_TIMEOUT; static int da_send_ordered = DA_DEFAULT_SEND_ORDERED; -SYSCTL_NODE(_kern_cam, OID_AUTO, da, CTLFLAG_RD, 0, +static SYSCTL_NODE(_kern_cam, OID_AUTO, da, CTLFLAG_RD, 0, "CAM Direct Access Disk driver"); SYSCTL_INT(_kern_cam_da, OID_AUTO, retry_count, CTLFLAG_RW, &da_retry_count, 0, "Normal I/O retry count"); Modified: stable/9/sys/compat/ia32/ia32_sysvec.c ============================================================================== --- stable/9/sys/compat/ia32/ia32_sysvec.c Sat Mar 9 02:32:23 2013 (r248084) +++ stable/9/sys/compat/ia32/ia32_sysvec.c Sat Mar 9 02:36:32 2013 (r248085) @@ -95,7 +95,7 @@ CTASSERT(sizeof(struct ia32_sigframe4) = extern const char *freebsd32_syscallnames[]; -SYSCTL_NODE(_compat, OID_AUTO, ia32, CTLFLAG_RW, 0, "ia32 mode"); +static SYSCTL_NODE(_compat, OID_AUTO, ia32, CTLFLAG_RW, 0, "ia32 mode"); static u_long ia32_maxdsiz = IA32_MAXDSIZ; SYSCTL_ULONG(_compat_ia32, OID_AUTO, maxdsiz, CTLFLAG_RW, &ia32_maxdsiz, 0, ""); Modified: stable/9/sys/compat/linux/linux_mib.c ============================================================================== --- stable/9/sys/compat/linux/linux_mib.c Sat Mar 9 02:32:23 2013 (r248084) +++ stable/9/sys/compat/linux/linux_mib.c Sat Mar 9 02:36:32 2013 (r248085) @@ -136,7 +136,7 @@ static struct linux_prison lprison0 = { static unsigned linux_osd_jail_slot; -SYSCTL_NODE(_compat, OID_AUTO, linux, CTLFLAG_RW, 0, +static SYSCTL_NODE(_compat, OID_AUTO, linux, CTLFLAG_RW, 0, "Linux mode"); static int linux_set_osname(struct thread *td, char *osname); Modified: stable/9/sys/compat/x86bios/x86bios.c ============================================================================== --- stable/9/sys/compat/x86bios/x86bios.c Sat Mar 9 02:32:23 2013 (r248084) +++ stable/9/sys/compat/x86bios/x86bios.c Sat Mar 9 02:36:32 2013 (r248085) @@ -67,7 +67,8 @@ __FBSDID("$FreeBSD$"); static struct mtx x86bios_lock; -SYSCTL_NODE(_debug, OID_AUTO, x86bios, CTLFLAG_RD, NULL, "x86bios debugging"); +static SYSCTL_NODE(_debug, OID_AUTO, x86bios, CTLFLAG_RD, NULL, + "x86bios debugging"); static int x86bios_trace_call; TUNABLE_INT("debug.x86bios.call", &x86bios_trace_call); SYSCTL_INT(_debug_x86bios, OID_AUTO, call, CTLFLAG_RW, &x86bios_trace_call, 0, Modified: stable/9/sys/dev/aac/aac.c ============================================================================== --- stable/9/sys/dev/aac/aac.c Sat Mar 9 02:32:23 2013 (r248084) +++ stable/9/sys/dev/aac/aac.c Sat Mar 9 02:36:32 2013 (r248085) @@ -222,7 +222,7 @@ static struct cdevsw aac_cdevsw = { MALLOC_DEFINE(M_AACBUF, "aacbuf", "Buffers for the AAC driver"); /* sysctl node */ -SYSCTL_NODE(_hw, OID_AUTO, aac, CTLFLAG_RD, 0, "AAC driver parameters"); +static SYSCTL_NODE(_hw, OID_AUTO, aac, CTLFLAG_RD, 0, "AAC driver parameters"); /* * Device Interface Modified: stable/9/sys/dev/acpica/acpi_ec.c ============================================================================== --- stable/9/sys/dev/acpica/acpi_ec.c Sat Mar 9 02:32:23 2013 (r248084) +++ stable/9/sys/dev/acpica/acpi_ec.c Sat Mar 9 02:36:32 2013 (r248085) @@ -178,7 +178,7 @@ struct acpi_ec_softc { ACPI_SERIAL_DECL(ec, "ACPI embedded controller"); -SYSCTL_NODE(_debug_acpi, OID_AUTO, ec, CTLFLAG_RD, NULL, "EC debugging"); +static SYSCTL_NODE(_debug_acpi, OID_AUTO, ec, CTLFLAG_RD, NULL, "EC debugging"); static int ec_burst_mode; TUNABLE_INT("debug.acpi.ec.burst", &ec_burst_mode); Modified: stable/9/sys/dev/acpica/acpi_smbat.c ============================================================================== --- stable/9/sys/dev/acpica/acpi_smbat.c Sat Mar 9 02:32:23 2013 (r248084) +++ stable/9/sys/dev/acpica/acpi_smbat.c Sat Mar 9 02:36:32 2013 (r248085) @@ -62,7 +62,8 @@ static int acpi_smbat_get_bst(device_t d ACPI_SERIAL_DECL(smbat, "ACPI Smart Battery"); -SYSCTL_NODE(_debug_acpi, OID_AUTO, batt, CTLFLAG_RD, NULL, "Battery debugging"); +static SYSCTL_NODE(_debug_acpi, OID_AUTO, batt, CTLFLAG_RD, NULL, + "Battery debugging"); /* On some laptops with smart batteries, enabling battery monitoring * software causes keystrokes from atkbd to be lost. This has also been Modified: stable/9/sys/dev/an/if_an.c ============================================================================== --- stable/9/sys/dev/an/if_an.c Sat Mar 9 02:32:23 2013 (r248084) +++ stable/9/sys/dev/an/if_an.c Sat Mar 9 02:36:32 2013 (r248085) @@ -203,7 +203,8 @@ static char an_conf_cache[256]; /* sysctl vars */ -SYSCTL_NODE(_hw, OID_AUTO, an, CTLFLAG_RD, 0, "Wireless driver parameters"); +static SYSCTL_NODE(_hw, OID_AUTO, an, CTLFLAG_RD, 0, + "Wireless driver parameters"); /* XXX violate ethernet/netgraph callback hooks */ extern void (*ng_ether_attach_p)(struct ifnet *ifp); Modified: stable/9/sys/dev/ata/ata-all.c ============================================================================== --- stable/9/sys/dev/ata/ata-all.c Sat Mar 9 02:32:23 2013 (r248084) +++ stable/9/sys/dev/ata/ata-all.c Sat Mar 9 02:36:32 2013 (r248085) @@ -111,7 +111,7 @@ static int atapi_dma = 1; #endif /* sysctl vars */ -SYSCTL_NODE(_hw, OID_AUTO, ata, CTLFLAG_RD, 0, "ATA driver parameters"); +static SYSCTL_NODE(_hw, OID_AUTO, ata, CTLFLAG_RD, 0, "ATA driver parameters"); #ifndef ATA_CAM TUNABLE_INT("hw.ata.ata_dma", &ata_dma); SYSCTL_INT(_hw_ata, OID_AUTO, ata_dma, CTLFLAG_RDTUN, &ata_dma, 0, Modified: stable/9/sys/dev/ath/ah_osdep.c ============================================================================== --- stable/9/sys/dev/ath/ah_osdep.c Sat Mar 9 02:32:23 2013 (r248084) +++ stable/9/sys/dev/ath/ah_osdep.c Sat Mar 9 02:36:32 2013 (r248085) @@ -76,7 +76,8 @@ extern void DO_HALDEBUG(struct ath_hal * /* NB: put this here instead of the driver to avoid circular references */ SYSCTL_NODE(_hw, OID_AUTO, ath, CTLFLAG_RD, 0, "Atheros driver parameters"); -SYSCTL_NODE(_hw_ath, OID_AUTO, hal, CTLFLAG_RD, 0, "Atheros HAL parameters"); +static SYSCTL_NODE(_hw_ath, OID_AUTO, hal, CTLFLAG_RD, 0, + "Atheros HAL parameters"); #ifdef AH_DEBUG int ath_hal_debug = 0; Modified: stable/9/sys/dev/atkbdc/psm.c ============================================================================== --- stable/9/sys/dev/atkbdc/psm.c Sat Mar 9 02:32:23 2013 (r248084) +++ stable/9/sys/dev/atkbdc/psm.c Sat Mar 9 02:36:32 2013 (r248085) @@ -2265,8 +2265,8 @@ psmtimeout(void *arg) } /* Add all sysctls under the debug.psm and hw.psm nodes */ -SYSCTL_NODE(_debug, OID_AUTO, psm, CTLFLAG_RD, 0, "ps/2 mouse"); -SYSCTL_NODE(_hw, OID_AUTO, psm, CTLFLAG_RD, 0, "ps/2 mouse"); +static SYSCTL_NODE(_debug, OID_AUTO, psm, CTLFLAG_RD, 0, "ps/2 mouse"); +static SYSCTL_NODE(_hw, OID_AUTO, psm, CTLFLAG_RD, 0, "ps/2 mouse"); SYSCTL_INT(_debug_psm, OID_AUTO, loglevel, CTLFLAG_RW, &verbose, 0, "Verbosity level"); Modified: stable/9/sys/dev/bce/if_bce.c ============================================================================== --- stable/9/sys/dev/bce/if_bce.c Sat Mar 9 02:32:23 2013 (r248084) +++ stable/9/sys/dev/bce/if_bce.c Sat Mar 9 02:36:32 2013 (r248085) @@ -488,7 +488,7 @@ DRIVER_MODULE(miibus, bce, miibus_driver /****************************************************************************/ /* Tunable device values */ /****************************************************************************/ -SYSCTL_NODE(_hw, OID_AUTO, bce, CTLFLAG_RD, 0, "bce driver parameters"); +static SYSCTL_NODE(_hw, OID_AUTO, bce, CTLFLAG_RD, 0, "bce driver parameters"); /* Allowable values are TRUE or FALSE */ static int bce_verbose = TRUE; Modified: stable/9/sys/dev/bge/if_bge.c ============================================================================== --- stable/9/sys/dev/bge/if_bge.c Sat Mar 9 02:32:23 2013 (r248084) +++ stable/9/sys/dev/bge/if_bge.c Sat Mar 9 02:36:32 2013 (r248085) @@ -532,7 +532,7 @@ static int bge_allow_asf = 1; TUNABLE_INT("hw.bge.allow_asf", &bge_allow_asf); -SYSCTL_NODE(_hw, OID_AUTO, bge, CTLFLAG_RD, 0, "BGE driver parameters"); +static 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"); Modified: stable/9/sys/dev/bktr/bktr_os.c ============================================================================== --- stable/9/sys/dev/bktr/bktr_os.c Sat Mar 9 02:32:23 2013 (r248084) +++ stable/9/sys/dev/bktr/bktr_os.c Sat Mar 9 02:36:32 2013 (r248085) @@ -108,7 +108,7 @@ int bt848_amsound = 0; /* hard-wire AM int bt848_dolby = 0; #endif -SYSCTL_NODE(_hw, OID_AUTO, bt848, CTLFLAG_RW, 0, "Bt848 Driver mgmt"); +static SYSCTL_NODE(_hw, OID_AUTO, bt848, CTLFLAG_RW, 0, "Bt848 Driver mgmt"); SYSCTL_INT(_hw_bt848, OID_AUTO, card, CTLFLAG_RW, &bt848_card, -1, ""); SYSCTL_INT(_hw_bt848, OID_AUTO, tuner, CTLFLAG_RW, &bt848_tuner, -1, ""); SYSCTL_INT(_hw_bt848, OID_AUTO, reverse_mute, CTLFLAG_RW, &bt848_reverse_mute, -1, ""); Modified: stable/9/sys/dev/bwn/if_bwn.c ============================================================================== --- stable/9/sys/dev/bwn/if_bwn.c Sat Mar 9 02:32:23 2013 (r248084) +++ stable/9/sys/dev/bwn/if_bwn.c Sat Mar 9 02:36:32 2013 (r248085) @@ -73,7 +73,8 @@ __FBSDID("$FreeBSD$"); #include #include -SYSCTL_NODE(_hw, OID_AUTO, bwn, CTLFLAG_RD, 0, "Broadcom driver parameters"); +static SYSCTL_NODE(_hw, OID_AUTO, bwn, CTLFLAG_RD, 0, + "Broadcom driver parameters"); /* * Tunable & sysctl variables. Modified: stable/9/sys/dev/bxe/if_bxe.c ============================================================================== --- stable/9/sys/dev/bxe/if_bxe.c Sat Mar 9 02:32:23 2013 (r248084) +++ stable/9/sys/dev/bxe/if_bxe.c Sat Mar 9 02:36:32 2013 (r248085) @@ -419,7 +419,7 @@ DRIVER_MODULE(bxe, pci, bxe_driver, bxe_ /* * Tunable device values */ -SYSCTL_NODE(_hw, OID_AUTO, bxe, CTLFLAG_RD, 0, "bxe driver parameters"); +static SYSCTL_NODE(_hw, OID_AUTO, bxe, CTLFLAG_RD, 0, "bxe driver parameters"); /* Allowable values are TRUE (1) or FALSE (0). */ static int bxe_dcc_enable = FALSE; Modified: stable/9/sys/dev/cardbus/cardbus.c ============================================================================== --- stable/9/sys/dev/cardbus/cardbus.c Sat Mar 9 02:32:23 2013 (r248084) +++ stable/9/sys/dev/cardbus/cardbus.c Sat Mar 9 02:36:32 2013 (r248085) @@ -54,7 +54,7 @@ __FBSDID("$FreeBSD$"); #include "pcib_if.h" /* sysctl vars */ -SYSCTL_NODE(_hw, OID_AUTO, cardbus, CTLFLAG_RD, 0, "CardBus parameters"); +static SYSCTL_NODE(_hw, OID_AUTO, cardbus, CTLFLAG_RD, 0, "CardBus parameters"); int cardbus_debug = 0; TUNABLE_INT("hw.cardbus.debug", &cardbus_debug); Modified: stable/9/sys/dev/cs/if_cs.c ============================================================================== --- stable/9/sys/dev/cs/if_cs.c Sat Mar 9 02:32:23 2013 (r248084) +++ stable/9/sys/dev/cs/if_cs.c Sat Mar 9 02:36:32 2013 (r248085) @@ -103,7 +103,7 @@ devclass_t cs_devclass; driver_intr_t csintr; /* sysctl vars */ -SYSCTL_NODE(_hw, OID_AUTO, cs, CTLFLAG_RD, 0, "cs device parameters"); +static SYSCTL_NODE(_hw, OID_AUTO, cs, CTLFLAG_RD, 0, "cs device parameters"); int cs_ignore_cksum_failure = 0; TUNABLE_INT("hw.cs.ignore_checksum_failure", &cs_ignore_cksum_failure); Modified: stable/9/sys/dev/dcons/dcons_os.c ============================================================================== --- stable/9/sys/dev/dcons/dcons_os.c Sat Mar 9 02:32:23 2013 (r248084) +++ stable/9/sys/dev/dcons/dcons_os.c Sat Mar 9 02:36:32 2013 (r248085) @@ -93,7 +93,7 @@ static int poll_hz = DCONS_POLL_HZ; static struct dcons_softc sc[DCONS_NPORT]; -SYSCTL_NODE(_kern, OID_AUTO, dcons, CTLFLAG_RD, 0, "Dumb Console"); +static SYSCTL_NODE(_kern, OID_AUTO, dcons, CTLFLAG_RD, 0, "Dumb Console"); SYSCTL_INT(_kern_dcons, OID_AUTO, poll_hz, CTLFLAG_RW, &poll_hz, 0, "dcons polling rate"); Modified: stable/9/sys/dev/fb/vesa.c ============================================================================== --- stable/9/sys/dev/fb/vesa.c Sat Mar 9 02:32:23 2013 (r248084) +++ stable/9/sys/dev/fb/vesa.c Sat Mar 9 02:36:32 2013 (r248085) @@ -98,7 +98,7 @@ static size_t vesa_bios_size; /* VESA video adapter */ static video_adapter_t *vesa_adp; -SYSCTL_NODE(_debug, OID_AUTO, vesa, CTLFLAG_RD, NULL, "VESA debugging"); +static SYSCTL_NODE(_debug, OID_AUTO, vesa, CTLFLAG_RD, NULL, "VESA debugging"); static int vesa_shadow_rom; TUNABLE_INT("debug.vesa.shadow_rom", &vesa_shadow_rom); SYSCTL_INT(_debug_vesa, OID_AUTO, shadow_rom, CTLFLAG_RDTUN, &vesa_shadow_rom, Modified: stable/9/sys/dev/fdc/fdc.c ============================================================================== --- stable/9/sys/dev/fdc/fdc.c Sat Mar 9 02:32:23 2013 (r248084) +++ stable/9/sys/dev/fdc/fdc.c Sat Mar 9 02:36:32 2013 (r248085) @@ -267,7 +267,7 @@ static driver_filter_t fdc_intr_fast; static void fdc_reset(struct fdc_data *); static int fd_probe_disk(struct fd_data *, int *); -SYSCTL_NODE(_debug, OID_AUTO, fdc, CTLFLAG_RW, 0, "fdc driver"); +static SYSCTL_NODE(_debug, OID_AUTO, fdc, CTLFLAG_RW, 0, "fdc driver"); static int fifo_threshold = 8; SYSCTL_INT(_debug_fdc, OID_AUTO, fifo, CTLFLAG_RW, &fifo_threshold, 0, Modified: stable/9/sys/dev/firewire/fwmem.c ============================================================================== --- stable/9/sys/dev/firewire/fwmem.c Sat Mar 9 02:32:23 2013 (r248084) +++ stable/9/sys/dev/firewire/fwmem.c Sat Mar 9 02:36:32 2013 (r248085) @@ -73,7 +73,7 @@ __FBSDID("$FreeBSD$"); static int fwmem_speed=2, fwmem_debug=0; static struct fw_eui64 fwmem_eui64; SYSCTL_DECL(_hw_firewire); -SYSCTL_NODE(_hw_firewire, OID_AUTO, fwmem, CTLFLAG_RD, 0, +static SYSCTL_NODE(_hw_firewire, OID_AUTO, fwmem, CTLFLAG_RD, 0, "FireWire Memory Access"); SYSCTL_UINT(_hw_firewire_fwmem, OID_AUTO, eui64_hi, CTLFLAG_RW, &fwmem_eui64.hi, 0, "Fwmem target EUI64 high"); Modified: stable/9/sys/dev/firewire/if_fwe.c ============================================================================== --- stable/9/sys/dev/firewire/if_fwe.c Sat Mar 9 02:32:23 2013 (r248084) +++ stable/9/sys/dev/firewire/if_fwe.c Sat Mar 9 02:36:32 2013 (r248085) @@ -89,7 +89,7 @@ static int rx_queue_len = FWMAXQUEUE; MALLOC_DEFINE(M_FWE, "if_fwe", "Ethernet over FireWire interface"); SYSCTL_INT(_debug, OID_AUTO, if_fwe_debug, CTLFLAG_RW, &fwedebug, 0, ""); SYSCTL_DECL(_hw_firewire); -SYSCTL_NODE(_hw_firewire, OID_AUTO, fwe, CTLFLAG_RD, 0, +static SYSCTL_NODE(_hw_firewire, OID_AUTO, fwe, CTLFLAG_RD, 0, "Ethernet emulation subsystem"); SYSCTL_INT(_hw_firewire_fwe, OID_AUTO, stream_ch, CTLFLAG_RW, &stream_ch, 0, "Stream channel to use"); Modified: stable/9/sys/dev/firewire/if_fwip.c ============================================================================== --- stable/9/sys/dev/firewire/if_fwip.c Sat Mar 9 02:32:23 2013 (r248084) +++ stable/9/sys/dev/firewire/if_fwip.c Sat Mar 9 02:36:32 2013 (r248085) @@ -102,7 +102,7 @@ static int rx_queue_len = FWMAXQUEUE; MALLOC_DEFINE(M_FWIP, "if_fwip", "IP over FireWire interface"); SYSCTL_INT(_debug, OID_AUTO, if_fwip_debug, CTLFLAG_RW, &fwipdebug, 0, ""); SYSCTL_DECL(_hw_firewire); -SYSCTL_NODE(_hw_firewire, OID_AUTO, fwip, CTLFLAG_RD, 0, +static SYSCTL_NODE(_hw_firewire, OID_AUTO, fwip, CTLFLAG_RD, 0, "Firewire ip subsystem"); SYSCTL_INT(_hw_firewire_fwip, OID_AUTO, rx_queue_len, CTLFLAG_RW, &rx_queue_len, 0, "Length of the receive queue"); Modified: stable/9/sys/dev/firewire/sbp.c ============================================================================== --- stable/9/sys/dev/firewire/sbp.c Sat Mar 9 02:32:23 2013 (r248084) +++ stable/9/sys/dev/firewire/sbp.c Sat Mar 9 02:36:32 2013 (r248085) @@ -132,7 +132,8 @@ static int use_doorbell = 0; static int sbp_tags = 0; SYSCTL_DECL(_hw_firewire); -SYSCTL_NODE(_hw_firewire, OID_AUTO, sbp, CTLFLAG_RD, 0, "SBP-II Subsystem"); +static SYSCTL_NODE(_hw_firewire, OID_AUTO, sbp, CTLFLAG_RD, 0, + "SBP-II Subsystem"); SYSCTL_INT(_debug, OID_AUTO, sbp_debug, CTLFLAG_RW, &debug, 0, "SBP debug flag"); SYSCTL_INT(_hw_firewire_sbp, OID_AUTO, auto_login, CTLFLAG_RW, &auto_login, 0, Modified: stable/9/sys/dev/hifn/hifn7751.c ============================================================================== --- stable/9/sys/dev/hifn/hifn7751.c Sat Mar 9 02:32:23 2013 (r248084) +++ stable/9/sys/dev/hifn/hifn7751.c Sat Mar 9 02:36:32 2013 (r248085) @@ -180,7 +180,8 @@ READ_REG_1(struct hifn_softc *sc, bus_si } #define WRITE_REG_1(sc, reg, val) hifn_write_reg_1(sc, reg, val) -SYSCTL_NODE(_hw, OID_AUTO, hifn, CTLFLAG_RD, 0, "Hifn driver parameters"); +static SYSCTL_NODE(_hw, OID_AUTO, hifn, CTLFLAG_RD, 0, + "Hifn driver parameters"); #ifdef HIFN_DEBUG static int hifn_debug = 0; Modified: stable/9/sys/dev/ipmi/ipmi.c ============================================================================== --- stable/9/sys/dev/ipmi/ipmi.c Sat Mar 9 02:32:23 2013 (r248084) +++ stable/9/sys/dev/ipmi/ipmi.c Sat Mar 9 02:36:32 2013 (r248085) @@ -63,7 +63,8 @@ static void ipmi_dtor(void *arg); int ipmi_attached = 0; static int on = 1; -SYSCTL_NODE(_hw, OID_AUTO, ipmi, CTLFLAG_RD, 0, "IPMI driver parameters"); +static SYSCTL_NODE(_hw, OID_AUTO, ipmi, CTLFLAG_RD, 0, + "IPMI driver parameters"); SYSCTL_INT(_hw_ipmi, OID_AUTO, on, CTLFLAG_RW, &on, 0, ""); Modified: stable/9/sys/dev/kbd/kbd.c ============================================================================== --- stable/9/sys/dev/kbd/kbd.c Sat Mar 9 02:32:23 2013 (r248084) +++ stable/9/sys/dev/kbd/kbd.c Sat Mar 9 02:36:32 2013 (r248085) @@ -81,7 +81,7 @@ static keyboard_switch_t *kbdsw_ini; keyboard_switch_t **kbdsw = &kbdsw_ini; static int keymap_restrict_change; -SYSCTL_NODE(_hw, OID_AUTO, kbd, CTLFLAG_RD, 0, "kbd"); +static SYSCTL_NODE(_hw, OID_AUTO, kbd, CTLFLAG_RD, 0, "kbd"); SYSCTL_INT(_hw_kbd, OID_AUTO, keymap_restrict_change, CTLFLAG_RW, &keymap_restrict_change, 0, "restrict ability to change keymap"); Modified: stable/9/sys/dev/malo/if_malo_pci.c ============================================================================== --- stable/9/sys/dev/malo/if_malo_pci.c Sat Mar 9 02:32:23 2013 (r248084) +++ stable/9/sys/dev/malo/if_malo_pci.c Sat Mar 9 02:36:32 2013 (r248085) @@ -79,7 +79,7 @@ struct malo_pci_softc { * Tunable variables. */ SYSCTL_DECL(_hw_malo); -SYSCTL_NODE(_hw_malo, OID_AUTO, pci, CTLFLAG_RD, 0, +static SYSCTL_NODE(_hw_malo, OID_AUTO, pci, CTLFLAG_RD, 0, "Marvell 88W8335 driver PCI parameters"); static int msi_disable = 0; /* MSI disabled */ Modified: stable/9/sys/dev/mmc/mmc.c ============================================================================== --- stable/9/sys/dev/mmc/mmc.c Sat Mar 9 02:32:23 2013 (r248084) +++ stable/9/sys/dev/mmc/mmc.c Sat Mar 9 02:36:32 2013 (r248085) @@ -106,7 +106,7 @@ struct mmc_ivars { #define CMD_RETRIES 3 -SYSCTL_NODE(_hw, OID_AUTO, mmc, CTLFLAG_RD, NULL, "mmc driver"); +static SYSCTL_NODE(_hw, OID_AUTO, mmc, CTLFLAG_RD, NULL, "mmc driver"); static int mmc_debug; SYSCTL_INT(_hw_mmc, OID_AUTO, debug, CTLFLAG_RW, &mmc_debug, 0, "Debug level"); Modified: stable/9/sys/dev/mwl/mwlhal.c ============================================================================== --- stable/9/sys/dev/mwl/mwlhal.c Sat Mar 9 02:32:23 2013 (r248084) +++ stable/9/sys/dev/mwl/mwlhal.c Sat Mar 9 02:36:32 2013 (r248085) @@ -190,7 +190,8 @@ static void dumpresult(struct mwl_hal_pr #endif /* MWLHAL_DEBUG */ SYSCTL_DECL(_hw_mwl); -SYSCTL_NODE(_hw_mwl, OID_AUTO, hal, CTLFLAG_RD, 0, "Marvell HAL parameters"); +static SYSCTL_NODE(_hw_mwl, OID_AUTO, hal, CTLFLAG_RD, 0, + "Marvell HAL parameters"); static __inline void MWL_HAL_LOCK(struct mwl_hal_priv *mh) Modified: stable/9/sys/dev/pccard/pccard.c ============================================================================== --- stable/9/sys/dev/pccard/pccard.c Sat Mar 9 02:32:23 2013 (r248084) +++ stable/9/sys/dev/pccard/pccard.c Sat Mar 9 02:36:32 2013 (r248085) @@ -59,7 +59,7 @@ __FBSDID("$FreeBSD$"); #define PCCARDDEBUG /* sysctl vars */ -SYSCTL_NODE(_hw, OID_AUTO, pccard, CTLFLAG_RD, 0, "PCCARD parameters"); +static SYSCTL_NODE(_hw, OID_AUTO, pccard, CTLFLAG_RD, 0, "PCCARD parameters"); int pccard_debug = 0; TUNABLE_INT("hw.pccard.debug", &pccard_debug); Modified: stable/9/sys/dev/pccbb/pccbb.c ============================================================================== --- stable/9/sys/dev/pccbb/pccbb.c Sat Mar 9 02:32:23 2013 (r248084) +++ stable/9/sys/dev/pccbb/pccbb.c Sat Mar 9 02:36:32 2013 (r248085) @@ -129,7 +129,7 @@ __FBSDID("$FreeBSD$"); devclass_t cbb_devclass; /* sysctl vars */ -SYSCTL_NODE(_hw, OID_AUTO, cbb, CTLFLAG_RD, 0, "CBB parameters"); +static SYSCTL_NODE(_hw, OID_AUTO, cbb, CTLFLAG_RD, 0, "CBB parameters"); /* There's no way to say TUNEABLE_LONG to get the right types */ u_long cbb_start_mem = CBB_START_MEM; Modified: stable/9/sys/dev/pccbb/pccbb_isa.c ============================================================================== --- stable/9/sys/dev/pccbb/pccbb_isa.c Sat Mar 9 02:32:23 2013 (r248084) +++ stable/9/sys/dev/pccbb/pccbb_isa.c Sat Mar 9 02:36:32 2013 (r248085) @@ -68,7 +68,7 @@ __FBSDID("$FreeBSD$"); *****************************************************************************/ /* sysctl vars */ -SYSCTL_NODE(_hw, OID_AUTO, pcic, CTLFLAG_RD, 0, "PCIC parameters"); +static SYSCTL_NODE(_hw, OID_AUTO, pcic, CTLFLAG_RD, 0, "PCIC parameters"); static int isa_intr_mask = EXCA_INT_MASK_ALLOWED; TUNABLE_INT("hw.cbb.intr_mask", &isa_intr_mask); Modified: stable/9/sys/dev/rndtest/rndtest.c ============================================================================== --- stable/9/sys/dev/rndtest/rndtest.c Sat Mar 9 02:32:23 2013 (r248084) +++ stable/9/sys/dev/rndtest/rndtest.c Sat Mar 9 02:36:32 2013 (r248085) @@ -70,8 +70,8 @@ static const struct rndtest_testfunc { #define RNDTEST_NTESTS (sizeof(rndtest_funcs)/sizeof(rndtest_funcs[0])) -SYSCTL_NODE(_kern, OID_AUTO, rndtest, CTLFLAG_RD, 0, "RNG test parameters"); - +static SYSCTL_NODE(_kern, OID_AUTO, rndtest, CTLFLAG_RD, 0, + "RNG test parameters"); static int rndtest_retest = 120; /* interval in seconds */ SYSCTL_INT(_kern_rndtest, OID_AUTO, retest, CTLFLAG_RW, &rndtest_retest, 0, "retest interval (seconds)"); Modified: stable/9/sys/dev/rt/if_rt.c ============================================================================== --- stable/9/sys/dev/rt/if_rt.c Sat Mar 9 02:32:23 2013 (r248084) +++ stable/9/sys/dev/rt/if_rt.c Sat Mar 9 02:36:32 2013 (r248085) @@ -136,7 +136,7 @@ static int rt_miibus_writereg(device_t, static int rt_ifmedia_upd(struct ifnet *); static void rt_ifmedia_sts(struct ifnet *, struct ifmediareq *); -SYSCTL_NODE(_hw, OID_AUTO, rt, CTLFLAG_RD, 0, "RT driver parameters"); +static SYSCTL_NODE(_hw, OID_AUTO, rt, CTLFLAG_RD, 0, "RT driver parameters"); #ifdef IF_RT_DEBUG static int rt_debug = 0; SYSCTL_INT(_hw_rt, OID_AUTO, debug, CTLFLAG_RW, &rt_debug, 0, Modified: stable/9/sys/dev/safe/safe.c ============================================================================== --- stable/9/sys/dev/safe/safe.c Sat Mar 9 02:32:23 2013 (r248084) +++ stable/9/sys/dev/safe/safe.c Sat Mar 9 02:36:32 2013 (r248085) @@ -143,7 +143,8 @@ static void safe_totalreset(struct safe_ static int safe_free_entry(struct safe_softc *, struct safe_ringentry *); -SYSCTL_NODE(_hw, OID_AUTO, safe, CTLFLAG_RD, 0, "SafeNet driver parameters"); +static SYSCTL_NODE(_hw, OID_AUTO, safe, CTLFLAG_RD, 0, + "SafeNet driver parameters"); #ifdef SAFE_DEBUG static void safe_dump_dmastatus(struct safe_softc *, const char *); Modified: stable/9/sys/dev/sdhci/sdhci.c ============================================================================== --- stable/9/sys/dev/sdhci/sdhci.c Sat Mar 9 02:32:23 2013 (r248084) +++ stable/9/sys/dev/sdhci/sdhci.c Sat Mar 9 02:36:32 2013 (r248085) @@ -158,7 +158,7 @@ struct sdhci_softc { struct sdhci_slot slots[6]; }; -SYSCTL_NODE(_hw, OID_AUTO, sdhci, CTLFLAG_RD, 0, "sdhci driver"); +static SYSCTL_NODE(_hw, OID_AUTO, sdhci, CTLFLAG_RD, 0, "sdhci driver"); int sdhci_debug; TUNABLE_INT("hw.sdhci.debug", &sdhci_debug); Modified: stable/9/sys/dev/sound/midi/midi.c ============================================================================== --- stable/9/sys/dev/sound/midi/midi.c Sat Mar 9 02:32:23 2013 (r248084) +++ stable/9/sys/dev/sound/midi/midi.c Sat Mar 9 02:36:32 2013 (r248085) @@ -239,7 +239,7 @@ static int midi_unload(void); * Misc declr. */ SYSCTL_NODE(_hw, OID_AUTO, midi, CTLFLAG_RD, 0, "Midi driver"); -SYSCTL_NODE(_hw_midi, OID_AUTO, stat, CTLFLAG_RD, 0, "Status device"); +static SYSCTL_NODE(_hw_midi, OID_AUTO, stat, CTLFLAG_RD, 0, "Status device"); int midi_debug; /* XXX: should this be moved into debug.midi? */ Modified: stable/9/sys/dev/sound/pci/maestro.c ============================================================================== --- stable/9/sys/dev/sound/pci/maestro.c Sat Mar 9 02:32:23 2013 (r248084) +++ stable/9/sys/dev/sound/pci/maestro.c Sat Mar 9 02:36:32 2013 (r248085) @@ -191,7 +191,7 @@ static unsigned int powerstate_init = /* XXX: this should move to a device specific sysctl dev.pcm.X.debug.Y via device_get_sysctl_*() as discussed on multimedia@ in msg-id <861wujij2q.fsf@xps.des.no> */ -SYSCTL_NODE(_debug, OID_AUTO, maestro, CTLFLAG_RD, 0, ""); +static SYSCTL_NODE(_debug, OID_AUTO, maestro, CTLFLAG_RD, 0, ""); SYSCTL_UINT(_debug_maestro, OID_AUTO, powerstate_active, CTLFLAG_RW, &powerstate_active, 0, "The Dx power state when active (0-1)"); SYSCTL_UINT(_debug_maestro, OID_AUTO, powerstate_idle, CTLFLAG_RW, Modified: stable/9/sys/dev/sound/usb/uaudio.c ============================================================================== --- stable/9/sys/dev/sound/usb/uaudio.c Sat Mar 9 02:32:23 2013 (r248084) +++ stable/9/sys/dev/sound/usb/uaudio.c Sat Mar 9 02:36:32 2013 (r248085) @@ -98,7 +98,7 @@ static int uaudio_default_channels = 0; #ifdef USB_DEBUG static int uaudio_debug = 0; -SYSCTL_NODE(_hw_usb, OID_AUTO, uaudio, CTLFLAG_RW, 0, "USB uaudio"); +static SYSCTL_NODE(_hw_usb, OID_AUTO, uaudio, CTLFLAG_RW, 0, "USB uaudio"); SYSCTL_INT(_hw_usb_uaudio, OID_AUTO, debug, CTLFLAG_RW, &uaudio_debug, 0, "uaudio debug level"); Modified: stable/9/sys/dev/syscons/syscons.c ============================================================================== --- stable/9/sys/dev/syscons/syscons.c Sat Mar 9 02:32:23 2013 (r248084) +++ stable/9/sys/dev/syscons/syscons.c Sat Mar 9 02:36:32 2013 (r248085) @@ -136,8 +136,8 @@ static int sc_no_suspend_vtswitch = 0; #endif static int sc_susp_scr; -SYSCTL_NODE(_hw, OID_AUTO, syscons, CTLFLAG_RD, 0, "syscons"); -SYSCTL_NODE(_hw_syscons, OID_AUTO, saver, CTLFLAG_RD, 0, "saver"); +static SYSCTL_NODE(_hw, OID_AUTO, syscons, CTLFLAG_RD, 0, "syscons"); +static SYSCTL_NODE(_hw_syscons, OID_AUTO, saver, CTLFLAG_RD, 0, "saver"); SYSCTL_INT(_hw_syscons_saver, OID_AUTO, keybonly, CTLFLAG_RW, &sc_saver_keyb_only, 0, "screen saver interrupted by input only"); SYSCTL_INT(_hw_syscons, OID_AUTO, bell, CTLFLAG_RW, &enable_bell, Modified: stable/9/sys/dev/ubsec/ubsec.c ============================================================================== --- stable/9/sys/dev/ubsec/ubsec.c Sat Mar 9 02:32:23 2013 (r248084) +++ stable/9/sys/dev/ubsec/ubsec.c Sat Mar 9 02:36:32 2013 (r248085) @@ -173,7 +173,8 @@ static int ubsec_ksigbits(struct crparam static void ubsec_kshift_r(u_int, u_int8_t *, u_int, u_int8_t *, u_int); static void ubsec_kshift_l(u_int, u_int8_t *, u_int, u_int8_t *, u_int); -SYSCTL_NODE(_hw, OID_AUTO, ubsec, CTLFLAG_RD, 0, "Broadcom driver parameters"); +static SYSCTL_NODE(_hw, OID_AUTO, ubsec, CTLFLAG_RD, 0, + "Broadcom driver parameters"); #ifdef UBSEC_DEBUG static void ubsec_dump_pb(volatile struct ubsec_pktbuf *); Modified: stable/9/sys/dev/usb/controller/at91dci.c ============================================================================== --- stable/9/sys/dev/usb/controller/at91dci.c Sat Mar 9 02:32:23 2013 (r248084) +++ stable/9/sys/dev/usb/controller/at91dci.c Sat Mar 9 02:36:32 2013 (r248085) @@ -91,7 +91,7 @@ __FBSDID("$FreeBSD$"); #ifdef USB_DEBUG static int at91dcidebug = 0; -SYSCTL_NODE(_hw_usb, OID_AUTO, at91dci, CTLFLAG_RW, 0, "USB at91dci"); +static SYSCTL_NODE(_hw_usb, OID_AUTO, at91dci, CTLFLAG_RW, 0, "USB at91dci"); SYSCTL_INT(_hw_usb_at91dci, OID_AUTO, debug, CTLFLAG_RW, &at91dcidebug, 0, "at91dci debug level"); #endif Modified: stable/9/sys/dev/usb/controller/atmegadci.c ============================================================================== --- stable/9/sys/dev/usb/controller/atmegadci.c Sat Mar 9 02:32:23 2013 (r248084) +++ stable/9/sys/dev/usb/controller/atmegadci.c Sat Mar 9 02:36:32 2013 (r248085) @@ -83,7 +83,8 @@ __FBSDID("$FreeBSD$"); #ifdef USB_DEBUG static int atmegadci_debug = 0; -SYSCTL_NODE(_hw_usb, OID_AUTO, atmegadci, CTLFLAG_RW, 0, "USB ATMEGA DCI"); +static SYSCTL_NODE(_hw_usb, OID_AUTO, atmegadci, CTLFLAG_RW, 0, + "USB ATMEGA DCI"); SYSCTL_INT(_hw_usb_atmegadci, OID_AUTO, debug, CTLFLAG_RW, &atmegadci_debug, 0, "ATMEGA DCI debug level"); #endif Modified: stable/9/sys/dev/usb/controller/avr32dci.c ============================================================================== --- stable/9/sys/dev/usb/controller/avr32dci.c Sat Mar 9 02:32:23 2013 (r248084) +++ stable/9/sys/dev/usb/controller/avr32dci.c Sat Mar 9 02:36:32 2013 (r248085) @@ -83,7 +83,7 @@ __FBSDID("$FreeBSD$"); #ifdef USB_DEBUG static int avr32dci_debug = 0; -SYSCTL_NODE(_hw_usb, OID_AUTO, avr32dci, CTLFLAG_RW, 0, "USB AVR32 DCI"); +static SYSCTL_NODE(_hw_usb, OID_AUTO, avr32dci, CTLFLAG_RW, 0, "USB AVR32 DCI"); SYSCTL_INT(_hw_usb_avr32dci, OID_AUTO, debug, CTLFLAG_RW, &avr32dci_debug, 0, "AVR32 DCI debug level"); #endif Modified: stable/9/sys/dev/usb/controller/ehci.c ============================================================================== --- stable/9/sys/dev/usb/controller/ehci.c Sat Mar 9 02:32:23 2013 (r248084) +++ stable/9/sys/dev/usb/controller/ehci.c Sat Mar 9 02:36:32 2013 (r248085) @@ -94,7 +94,7 @@ static int ehcinohighspeed = 0; static int ehciiaadbug = 0; static int ehcilostintrbug = 0; -SYSCTL_NODE(_hw_usb, OID_AUTO, ehci, CTLFLAG_RW, 0, "USB ehci"); +static SYSCTL_NODE(_hw_usb, OID_AUTO, ehci, CTLFLAG_RW, 0, "USB ehci"); SYSCTL_INT(_hw_usb_ehci, OID_AUTO, debug, CTLFLAG_RW | CTLFLAG_TUN, &ehcidebug, 0, "Debug level"); TUNABLE_INT("hw.usb.ehci.debug", &ehcidebug); Modified: stable/9/sys/dev/usb/controller/musb_otg.c ============================================================================== --- stable/9/sys/dev/usb/controller/musb_otg.c Sat Mar 9 02:32:23 2013 (r248084) +++ stable/9/sys/dev/usb/controller/musb_otg.c Sat Mar 9 02:36:32 2013 (r248085) @@ -85,7 +85,7 @@ #ifdef USB_DEBUG static int musbotgdebug = 0; -SYSCTL_NODE(_hw_usb, OID_AUTO, musbotg, CTLFLAG_RW, 0, "USB musbotg"); +static SYSCTL_NODE(_hw_usb, OID_AUTO, musbotg, CTLFLAG_RW, 0, "USB musbotg"); SYSCTL_INT(_hw_usb_musbotg, OID_AUTO, debug, CTLFLAG_RW, &musbotgdebug, 0, "Debug level"); #endif Modified: stable/9/sys/dev/usb/controller/ohci.c ============================================================================== --- stable/9/sys/dev/usb/controller/ohci.c Sat Mar 9 02:32:23 2013 (r248084) +++ stable/9/sys/dev/usb/controller/ohci.c Sat Mar 9 02:36:32 2013 (r248085) @@ -80,7 +80,7 @@ __FBSDID("$FreeBSD$"); #ifdef USB_DEBUG static int ohcidebug = 0; -SYSCTL_NODE(_hw_usb, OID_AUTO, ohci, CTLFLAG_RW, 0, "USB ohci"); +static SYSCTL_NODE(_hw_usb, OID_AUTO, ohci, CTLFLAG_RW, 0, "USB ohci"); SYSCTL_INT(_hw_usb_ohci, OID_AUTO, debug, CTLFLAG_RW | CTLFLAG_TUN, &ohcidebug, 0, "ohci debug level"); TUNABLE_INT("hw.usb.ohci.debug", &ohcidebug); Modified: stable/9/sys/dev/usb/controller/uhci.c ============================================================================== --- stable/9/sys/dev/usb/controller/uhci.c Sat Mar 9 02:32:23 2013 (r248084) +++ stable/9/sys/dev/usb/controller/uhci.c Sat Mar 9 02:36:32 2013 (r248085) @@ -85,7 +85,7 @@ __FBSDID("$FreeBSD$"); static int uhcidebug = 0; static int uhcinoloop = 0; -SYSCTL_NODE(_hw_usb, OID_AUTO, uhci, CTLFLAG_RW, 0, "USB uhci"); +static SYSCTL_NODE(_hw_usb, OID_AUTO, uhci, CTLFLAG_RW, 0, "USB uhci"); SYSCTL_INT(_hw_usb_uhci, OID_AUTO, debug, CTLFLAG_RW | CTLFLAG_TUN, &uhcidebug, 0, "uhci debug level"); TUNABLE_INT("hw.usb.uhci.debug", &uhcidebug); Modified: stable/9/sys/dev/usb/controller/usb_controller.c ============================================================================== --- stable/9/sys/dev/usb/controller/usb_controller.c Sat Mar 9 02:32:23 2013 (r248084) +++ stable/9/sys/dev/usb/controller/usb_controller.c Sat Mar 9 02:36:32 2013 (r248085) @@ -79,7 +79,7 @@ static void usb_attach_sub(device_t, str #ifdef USB_DEBUG static int usb_ctrl_debug = 0; -SYSCTL_NODE(_hw_usb, OID_AUTO, ctrl, CTLFLAG_RW, 0, "USB controller"); +static SYSCTL_NODE(_hw_usb, OID_AUTO, ctrl, CTLFLAG_RW, 0, "USB controller"); SYSCTL_INT(_hw_usb_ctrl, OID_AUTO, debug, CTLFLAG_RW, &usb_ctrl_debug, 0, "Debug level"); #endif Modified: stable/9/sys/dev/usb/controller/uss820dci.c ============================================================================== --- stable/9/sys/dev/usb/controller/uss820dci.c Sat Mar 9 02:32:23 2013 (r248084) +++ stable/9/sys/dev/usb/controller/uss820dci.c Sat Mar 9 02:36:32 2013 (r248085) @@ -79,7 +79,8 @@ #ifdef USB_DEBUG static int uss820dcidebug = 0; -SYSCTL_NODE(_hw_usb, OID_AUTO, uss820dci, CTLFLAG_RW, 0, "USB uss820dci"); +static SYSCTL_NODE(_hw_usb, OID_AUTO, uss820dci, CTLFLAG_RW, 0, + "USB uss820dci"); SYSCTL_INT(_hw_usb_uss820dci, OID_AUTO, debug, CTLFLAG_RW, &uss820dcidebug, 0, "uss820dci debug level"); #endif Modified: stable/9/sys/dev/usb/controller/xhci.c ============================================================================== --- stable/9/sys/dev/usb/controller/xhci.c Sat Mar 9 02:32:23 2013 (r248084) +++ stable/9/sys/dev/usb/controller/xhci.c Sat Mar 9 02:36:32 2013 (r248085) @@ -87,7 +87,7 @@ __FBSDID("$FreeBSD$"); static int xhcidebug; static int xhciroute; -SYSCTL_NODE(_hw_usb, OID_AUTO, xhci, CTLFLAG_RW, 0, "USB XHCI"); +static SYSCTL_NODE(_hw_usb, OID_AUTO, xhci, CTLFLAG_RW, 0, "USB XHCI"); SYSCTL_INT(_hw_usb_xhci, OID_AUTO, debug, CTLFLAG_RW | CTLFLAG_TUN, &xhcidebug, 0, "Debug level"); TUNABLE_INT("hw.usb.xhci.debug", &xhcidebug); Modified: stable/9/sys/dev/usb/input/atp.c ============================================================================== --- stable/9/sys/dev/usb/input/atp.c Sat Mar 9 02:32:23 2013 (r248084) +++ stable/9/sys/dev/usb/input/atp.c Sat Mar 9 02:36:32 2013 (r248085) @@ -114,7 +114,7 @@ __FBSDID("$FreeBSD$"); /* Tunables */ -SYSCTL_NODE(_hw_usb, OID_AUTO, atp, CTLFLAG_RW, 0, "USB atp"); +static SYSCTL_NODE(_hw_usb, OID_AUTO, atp, CTLFLAG_RW, 0, "USB atp"); #ifdef USB_DEBUG enum atp_log_level { Modified: stable/9/sys/dev/usb/input/uep.c ============================================================================== --- stable/9/sys/dev/usb/input/uep.c Sat Mar 9 02:32:23 2013 (r248084) +++ stable/9/sys/dev/usb/input/uep.c Sat Mar 9 02:36:32 2013 (r248085) @@ -57,7 +57,7 @@ #ifdef USB_DEBUG static int uep_debug = 0; -SYSCTL_NODE(_hw_usb, OID_AUTO, uep, CTLFLAG_RW, 0, "USB uep"); +static SYSCTL_NODE(_hw_usb, OID_AUTO, uep, CTLFLAG_RW, 0, "USB uep"); SYSCTL_INT(_hw_usb_uep, OID_AUTO, debug, CTLFLAG_RW, &uep_debug, 0, "Debug level"); #endif Modified: stable/9/sys/dev/usb/input/uhid.c ============================================================================== --- stable/9/sys/dev/usb/input/uhid.c Sat Mar 9 02:32:23 2013 (r248084) +++ stable/9/sys/dev/usb/input/uhid.c Sat Mar 9 02:36:32 2013 (r248085) @@ -78,7 +78,7 @@ __FBSDID("$FreeBSD$"); #ifdef USB_DEBUG static int uhid_debug = 0; -SYSCTL_NODE(_hw_usb, OID_AUTO, uhid, CTLFLAG_RW, 0, "USB uhid"); +static SYSCTL_NODE(_hw_usb, OID_AUTO, uhid, CTLFLAG_RW, 0, "USB uhid"); SYSCTL_INT(_hw_usb_uhid, OID_AUTO, debug, CTLFLAG_RW, &uhid_debug, 0, "Debug level"); #endif Modified: stable/9/sys/dev/usb/input/ukbd.c ============================================================================== --- stable/9/sys/dev/usb/input/ukbd.c Sat Mar 9 02:32:23 2013 (r248084) +++ stable/9/sys/dev/usb/input/ukbd.c Sat Mar 9 02:36:32 2013 (r248085) @@ -93,7 +93,7 @@ __FBSDID("$FreeBSD$"); static int ukbd_debug = 0; static int ukbd_no_leds = 0; -SYSCTL_NODE(_hw_usb, OID_AUTO, ukbd, CTLFLAG_RW, 0, "USB ukbd"); +static SYSCTL_NODE(_hw_usb, OID_AUTO, ukbd, CTLFLAG_RW, 0, "USB ukbd"); SYSCTL_INT(_hw_usb_ukbd, OID_AUTO, debug, CTLFLAG_RW | CTLFLAG_TUN, &ukbd_debug, 0, "Debug level"); TUNABLE_INT("hw.usb.ukbd.debug", &ukbd_debug); Modified: stable/9/sys/dev/usb/input/ums.c ============================================================================== --- stable/9/sys/dev/usb/input/ums.c Sat Mar 9 02:32:23 2013 (r248084) +++ stable/9/sys/dev/usb/input/ums.c Sat Mar 9 02:36:32 2013 (r248085) @@ -76,7 +76,7 @@ __FBSDID("$FreeBSD$"); #ifdef USB_DEBUG static int ums_debug = 0; -SYSCTL_NODE(_hw_usb, OID_AUTO, ums, CTLFLAG_RW, 0, "USB ums"); +static SYSCTL_NODE(_hw_usb, OID_AUTO, ums, CTLFLAG_RW, 0, "USB ums"); SYSCTL_INT(_hw_usb_ums, OID_AUTO, debug, CTLFLAG_RW, &ums_debug, 0, "Debug level"); #endif Modified: stable/9/sys/dev/usb/misc/udbp.c ============================================================================== --- stable/9/sys/dev/usb/misc/udbp.c Sat Mar 9 02:32:23 2013 (r248084) +++ stable/9/sys/dev/usb/misc/udbp.c Sat Mar 9 02:36:32 2013 (r248085) @@ -96,7 +96,7 @@ __FBSDID("$FreeBSD$"); #ifdef USB_DEBUG static int udbp_debug = 0; -SYSCTL_NODE(_hw_usb, OID_AUTO, udbp, CTLFLAG_RW, 0, "USB udbp"); +static SYSCTL_NODE(_hw_usb, OID_AUTO, udbp, CTLFLAG_RW, 0, "USB udbp"); SYSCTL_INT(_hw_usb_udbp, OID_AUTO, debug, CTLFLAG_RW, &udbp_debug, 0, "udbp debug level"); #endif Modified: stable/9/sys/dev/usb/net/if_aue.c ============================================================================== --- stable/9/sys/dev/usb/net/if_aue.c Sat Mar 9 02:32:23 2013 (r248084) +++ stable/9/sys/dev/usb/net/if_aue.c Sat Mar 9 02:36:32 2013 (r248085) @@ -102,7 +102,7 @@ __FBSDID("$FreeBSD$"); #ifdef USB_DEBUG static int aue_debug = 0; -SYSCTL_NODE(_hw_usb, OID_AUTO, aue, CTLFLAG_RW, 0, "USB aue"); +static SYSCTL_NODE(_hw_usb, OID_AUTO, aue, CTLFLAG_RW, 0, "USB aue"); SYSCTL_INT(_hw_usb_aue, OID_AUTO, debug, CTLFLAG_RW, &aue_debug, 0, "Debug level"); #endif Modified: stable/9/sys/dev/usb/net/if_axe.c ============================================================================== --- stable/9/sys/dev/usb/net/if_axe.c Sat Mar 9 02:32:23 2013 (r248084) +++ stable/9/sys/dev/usb/net/if_axe.c Sat Mar 9 02:36:32 2013 (r248085) @@ -133,7 +133,7 @@ __FBSDID("$FreeBSD$"); #ifdef USB_DEBUG static int axe_debug = 0; -SYSCTL_NODE(_hw_usb, OID_AUTO, axe, CTLFLAG_RW, 0, "USB axe"); +static SYSCTL_NODE(_hw_usb, OID_AUTO, axe, CTLFLAG_RW, 0, "USB axe"); SYSCTL_INT(_hw_usb_axe, OID_AUTO, debug, CTLFLAG_RW, &axe_debug, 0, "Debug level"); #endif Modified: stable/9/sys/dev/usb/net/if_cdce.c ============================================================================== --- stable/9/sys/dev/usb/net/if_cdce.c Sat Mar 9 02:32:23 2013 (r248084) +++ stable/9/sys/dev/usb/net/if_cdce.c Sat Mar 9 02:36:32 2013 (r248085) @@ -111,7 +111,7 @@ static uint32_t cdce_m_crc32(struct mbuf static int cdce_debug = 0; static int cdce_tx_interval = 0; -SYSCTL_NODE(_hw_usb, OID_AUTO, cdce, CTLFLAG_RW, 0, "USB CDC-Ethernet"); +static SYSCTL_NODE(_hw_usb, OID_AUTO, cdce, CTLFLAG_RW, 0, "USB CDC-Ethernet"); SYSCTL_INT(_hw_usb_cdce, OID_AUTO, debug, CTLFLAG_RW, &cdce_debug, 0, "Debug level"); SYSCTL_INT(_hw_usb_cdce, OID_AUTO, interval, CTLFLAG_RW, &cdce_tx_interval, 0, Modified: stable/9/sys/dev/usb/net/if_cue.c ============================================================================== --- stable/9/sys/dev/usb/net/if_cue.c Sat Mar 9 02:32:23 2013 (r248084) +++ stable/9/sys/dev/usb/net/if_cue.c Sat Mar 9 02:36:32 2013 (r248085) @@ -124,7 +124,7 @@ static void cue_reset(struct cue_softc * #ifdef USB_DEBUG static int cue_debug = 0; -SYSCTL_NODE(_hw_usb, OID_AUTO, cue, CTLFLAG_RW, 0, "USB cue"); +static SYSCTL_NODE(_hw_usb, OID_AUTO, cue, CTLFLAG_RW, 0, "USB cue"); SYSCTL_INT(_hw_usb_cue, OID_AUTO, debug, CTLFLAG_RW, &cue_debug, 0, "Debug level"); #endif Modified: stable/9/sys/dev/usb/net/if_ipheth.c ============================================================================== --- stable/9/sys/dev/usb/net/if_ipheth.c Sat Mar 9 02:32:23 2013 (r248084) +++ stable/9/sys/dev/usb/net/if_ipheth.c Sat Mar 9 02:36:32 2013 (r248085) @@ -81,7 +81,7 @@ static uether_fn_t ipheth_setpromisc; #ifdef USB_DEBUG static int ipheth_debug = 0; -SYSCTL_NODE(_hw_usb, OID_AUTO, ipheth, CTLFLAG_RW, 0, "USB iPhone ethernet"); +static SYSCTL_NODE(_hw_usb, OID_AUTO, ipheth, CTLFLAG_RW, 0, "USB iPhone ethernet"); SYSCTL_INT(_hw_usb_ipheth, OID_AUTO, debug, CTLFLAG_RW, &ipheth_debug, 0, "Debug level"); #endif Modified: stable/9/sys/dev/usb/net/if_kue.c ============================================================================== --- stable/9/sys/dev/usb/net/if_kue.c Sat Mar 9 02:32:23 2013 (r248084) +++ stable/9/sys/dev/usb/net/if_kue.c Sat Mar 9 02:36:32 2013 (r248085) @@ -165,7 +165,7 @@ static void kue_reset(struct kue_softc * #ifdef USB_DEBUG static int kue_debug = 0; -SYSCTL_NODE(_hw_usb, OID_AUTO, kue, CTLFLAG_RW, 0, "USB kue"); +static SYSCTL_NODE(_hw_usb, OID_AUTO, kue, CTLFLAG_RW, 0, "USB kue"); SYSCTL_INT(_hw_usb_kue, OID_AUTO, debug, CTLFLAG_RW, &kue_debug, 0, "Debug level"); #endif Modified: stable/9/sys/dev/usb/net/if_mos.c ============================================================================== --- stable/9/sys/dev/usb/net/if_mos.c Sat Mar 9 02:32:23 2013 (r248084) +++ stable/9/sys/dev/usb/net/if_mos.c Sat Mar 9 02:36:32 2013 (r248085) @@ -132,7 +132,7 @@ __FBSDID("$FreeBSD$"); #ifdef USB_DEBUG static int mos_debug = 0; -SYSCTL_NODE(_hw_usb, OID_AUTO, mos, CTLFLAG_RW, 0, "USB mos"); +static SYSCTL_NODE(_hw_usb, OID_AUTO, mos, CTLFLAG_RW, 0, "USB mos"); SYSCTL_INT(_hw_usb_mos, OID_AUTO, debug, CTLFLAG_RW, &mos_debug, 0, "Debug level"); #endif Modified: stable/9/sys/dev/usb/net/if_rue.c ============================================================================== --- stable/9/sys/dev/usb/net/if_rue.c Sat Mar 9 02:32:23 2013 (r248084) +++ stable/9/sys/dev/usb/net/if_rue.c Sat Mar 9 02:36:32 2013 (r248085) @@ -99,7 +99,7 @@ __FBSDID("$FreeBSD$"); #ifdef USB_DEBUG static int rue_debug = 0; -SYSCTL_NODE(_hw_usb, OID_AUTO, rue, CTLFLAG_RW, 0, "USB rue"); +static SYSCTL_NODE(_hw_usb, OID_AUTO, rue, CTLFLAG_RW, 0, "USB rue"); SYSCTL_INT(_hw_usb_rue, OID_AUTO, debug, CTLFLAG_RW, &rue_debug, 0, "Debug level"); #endif Modified: stable/9/sys/dev/usb/net/if_udav.c ============================================================================== --- stable/9/sys/dev/usb/net/if_udav.c Sat Mar 9 02:32:23 2013 (r248084) +++ stable/9/sys/dev/usb/net/if_udav.c Sat Mar 9 02:36:32 2013 (r248085) @@ -193,7 +193,7 @@ static const struct usb_ether_methods ud #ifdef USB_DEBUG static int udav_debug = 0; -SYSCTL_NODE(_hw_usb, OID_AUTO, udav, CTLFLAG_RW, 0, "USB udav"); +static SYSCTL_NODE(_hw_usb, OID_AUTO, udav, CTLFLAG_RW, 0, "USB udav"); SYSCTL_INT(_hw_usb_udav, OID_AUTO, debug, CTLFLAG_RW, &udav_debug, 0, "Debug level"); #endif Modified: stable/9/sys/dev/usb/net/if_usie.c ============================================================================== --- stable/9/sys/dev/usb/net/if_usie.c Sat Mar 9 02:32:23 2013 (r248084) +++ stable/9/sys/dev/usb/net/if_usie.c Sat Mar 9 02:36:32 2013 (r248085) @@ -77,7 +77,7 @@ __FBSDID("$FreeBSD$"); #ifdef USB_DEBUG static int usie_debug = 0; -SYSCTL_NODE(_hw_usb, OID_AUTO, usie, CTLFLAG_RW, 0, "sierra USB modem"); +static SYSCTL_NODE(_hw_usb, OID_AUTO, usie, CTLFLAG_RW, 0, "sierra USB modem"); SYSCTL_INT(_hw_usb_usie, OID_AUTO, debug, CTLFLAG_RW, &usie_debug, 0, "usie debug level"); #endif Modified: stable/9/sys/dev/usb/net/uhso.c ============================================================================== --- stable/9/sys/dev/usb/net/uhso.c Sat Mar 9 02:32:23 2013 (r248084) +++ stable/9/sys/dev/usb/net/uhso.c Sat Mar 9 02:36:32 2013 (r248085) @@ -283,7 +283,7 @@ static const STRUCT_USB_HOST_ID uhso_dev #undef UHSO_DEV }; -SYSCTL_NODE(_hw_usb, OID_AUTO, uhso, CTLFLAG_RW, 0, "USB uhso"); +static SYSCTL_NODE(_hw_usb, OID_AUTO, uhso, CTLFLAG_RW, 0, "USB uhso"); static int uhso_autoswitch = 1; SYSCTL_INT(_hw_usb_uhso, OID_AUTO, auto_switch, CTLFLAG_RW, &uhso_autoswitch, 0, "Automatically switch to modem mode"); Modified: stable/9/sys/dev/usb/net/usb_ethernet.c ============================================================================== --- stable/9/sys/dev/usb/net/usb_ethernet.c Sat Mar 9 02:32:23 2013 (r248084) +++ stable/9/sys/dev/usb/net/usb_ethernet.c Sat Mar 9 02:36:32 2013 (r248085) @@ -57,7 +57,8 @@ __FBSDID("$FreeBSD$"); #include #include -SYSCTL_NODE(_net, OID_AUTO, ue, CTLFLAG_RD, 0, "USB Ethernet parameters"); +static SYSCTL_NODE(_net, OID_AUTO, ue, CTLFLAG_RD, 0, + "USB Ethernet parameters"); #define UE_LOCK(_ue) mtx_lock((_ue)->ue_mtx) #define UE_UNLOCK(_ue) mtx_unlock((_ue)->ue_mtx) Modified: stable/9/sys/dev/usb/serial/u3g.c ============================================================================== --- stable/9/sys/dev/usb/serial/u3g.c Sat Mar 9 02:32:23 2013 (r248084) +++ stable/9/sys/dev/usb/serial/u3g.c Sat Mar 9 02:36:32 2013 (r248085) @@ -67,7 +67,7 @@ #ifdef USB_DEBUG static int u3g_debug = 0; -SYSCTL_NODE(_hw_usb, OID_AUTO, u3g, CTLFLAG_RW, 0, "USB 3g"); +static SYSCTL_NODE(_hw_usb, OID_AUTO, u3g, CTLFLAG_RW, 0, "USB 3g"); SYSCTL_INT(_hw_usb_u3g, OID_AUTO, debug, CTLFLAG_RW, &u3g_debug, 0, "Debug level"); #endif Modified: stable/9/sys/dev/usb/serial/ubsa.c ============================================================================== --- stable/9/sys/dev/usb/serial/ubsa.c Sat Mar 9 02:32:23 2013 (r248084) +++ stable/9/sys/dev/usb/serial/ubsa.c Sat Mar 9 02:36:32 2013 (r248085) @@ -95,7 +95,7 @@ __FBSDID("$FreeBSD$"); #ifdef USB_DEBUG static int ubsa_debug = 0; -SYSCTL_NODE(_hw_usb, OID_AUTO, ubsa, CTLFLAG_RW, 0, "USB ubsa"); +static SYSCTL_NODE(_hw_usb, OID_AUTO, ubsa, CTLFLAG_RW, 0, "USB ubsa"); SYSCTL_INT(_hw_usb_ubsa, OID_AUTO, debug, CTLFLAG_RW, &ubsa_debug, 0, "ubsa debug level"); #endif Modified: stable/9/sys/dev/usb/serial/ubser.c ============================================================================== --- stable/9/sys/dev/usb/serial/ubser.c Sat Mar 9 02:32:23 2013 (r248084) +++ stable/9/sys/dev/usb/serial/ubser.c Sat Mar 9 02:36:32 2013 (r248085) @@ -116,7 +116,7 @@ __FBSDID("$FreeBSD$"); #ifdef USB_DEBUG static int ubser_debug = 0; -SYSCTL_NODE(_hw_usb, OID_AUTO, ubser, CTLFLAG_RW, 0, "USB ubser"); +static SYSCTL_NODE(_hw_usb, OID_AUTO, ubser, CTLFLAG_RW, 0, "USB ubser"); SYSCTL_INT(_hw_usb_ubser, OID_AUTO, debug, CTLFLAG_RW, &ubser_debug, 0, "ubser debug level"); #endif Modified: stable/9/sys/dev/usb/serial/uchcom.c ============================================================================== --- stable/9/sys/dev/usb/serial/uchcom.c Sat Mar 9 02:32:23 2013 (r248084) +++ stable/9/sys/dev/usb/serial/uchcom.c Sat Mar 9 02:36:32 2013 (r248085) @@ -103,7 +103,7 @@ __FBSDID("$FreeBSD$"); #ifdef USB_DEBUG static int uchcom_debug = 0; -SYSCTL_NODE(_hw_usb, OID_AUTO, uchcom, CTLFLAG_RW, 0, "USB uchcom"); +static SYSCTL_NODE(_hw_usb, OID_AUTO, uchcom, CTLFLAG_RW, 0, "USB uchcom"); SYSCTL_INT(_hw_usb_uchcom, OID_AUTO, debug, CTLFLAG_RW, &uchcom_debug, 0, "uchcom debug level"); #endif Modified: stable/9/sys/dev/usb/serial/uftdi.c ============================================================================== --- stable/9/sys/dev/usb/serial/uftdi.c Sat Mar 9 02:32:23 2013 (r248084) +++ stable/9/sys/dev/usb/serial/uftdi.c Sat Mar 9 02:36:32 2013 (r248085) @@ -75,7 +75,7 @@ __FBSDID("$FreeBSD$"); #ifdef USB_DEBUG static int uftdi_debug = 0; -SYSCTL_NODE(_hw_usb, OID_AUTO, uftdi, CTLFLAG_RW, 0, "USB uftdi"); +static SYSCTL_NODE(_hw_usb, OID_AUTO, uftdi, CTLFLAG_RW, 0, "USB uftdi"); SYSCTL_INT(_hw_usb_uftdi, OID_AUTO, debug, CTLFLAG_RW, &uftdi_debug, 0, "Debug level"); #endif Modified: stable/9/sys/dev/usb/serial/ulpt.c ============================================================================== --- stable/9/sys/dev/usb/serial/ulpt.c Sat Mar 9 02:32:23 2013 (r248084) +++ stable/9/sys/dev/usb/serial/ulpt.c Sat Mar 9 02:36:32 2013 (r248085) @@ -74,7 +74,7 @@ __FBSDID("$FreeBSD$"); #ifdef USB_DEBUG static int ulpt_debug = 0; -SYSCTL_NODE(_hw_usb, OID_AUTO, ulpt, CTLFLAG_RW, 0, "USB ulpt"); +static SYSCTL_NODE(_hw_usb, OID_AUTO, ulpt, CTLFLAG_RW, 0, "USB ulpt"); SYSCTL_INT(_hw_usb_ulpt, OID_AUTO, debug, CTLFLAG_RW, &ulpt_debug, 0, "Debug level"); #endif Modified: stable/9/sys/dev/usb/serial/umcs.c ============================================================================== --- stable/9/sys/dev/usb/serial/umcs.c Sat Mar 9 02:32:23 2013 (r248084) *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable@FreeBSD.ORG Sat Mar 9 21:21:30 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id EC1C5222; Sat, 9 Mar 2013 21:21:30 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id DE953A78; Sat, 9 Mar 2013 21:21:30 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r29LLUB8013470; Sat, 9 Mar 2013 21:21:30 GMT (envelope-from gjb@svn.freebsd.org) Received: (from gjb@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r29LLUkV013469; Sat, 9 Mar 2013 21:21:30 GMT (envelope-from gjb@svn.freebsd.org) Message-Id: <201303092121.r29LLUkV013469@svn.freebsd.org> From: Glen Barber Date: Sat, 9 Mar 2013 21:21:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r248115 - stable/9/usr.sbin/sysinstall X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Mar 2013 21:21:31 -0000 Author: gjb (doc,ports committer) Date: Sat Mar 9 21:21:30 2013 New Revision: 248115 URL: http://svnweb.freebsd.org/changeset/base/248115 Log: Update ports count and size in sysinstall(8). This is a direct commit to stable/9. Submitted by: ryusuke Approved by: kib (implicit) Modified: stable/9/usr.sbin/sysinstall/dist.c Modified: stable/9/usr.sbin/sysinstall/dist.c ============================================================================== --- stable/9/usr.sbin/sysinstall/dist.c Sat Mar 9 20:04:47 2013 (r248114) +++ stable/9/usr.sbin/sysinstall/dist.c Sat Mar 9 21:21:30 2013 (r248115) @@ -280,8 +280,8 @@ distMaybeSetPorts(dialogMenuItem *self) { dialog_clear_norefresh(); if (!msgYesNo("Would you like to install the FreeBSD ports collection?\n\n" - "This will give you ready access to over 19,000 ported software packages,\n" - "at a cost of around 445MB of disk space when \"clean\" and possibly\n" + "This will give you ready access to over 24,000 ported software packages,\n" + "at a cost of around 500MB of disk space when \"clean\" and possibly\n" "much more than that when a lot of the distribution tarballs are loaded\n" "(unless you have the extra discs available from a FreeBSD CD/DVD distribution\n" "and can mount them on /cdrom, in which case this is far less of a problem).\n\n" From owner-svn-src-stable@FreeBSD.ORG Sat Mar 9 21:21:47 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id EE3BD37E; Sat, 9 Mar 2013 21:21:47 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id E0FE7A7A; Sat, 9 Mar 2013 21:21:47 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r29LLlOY013537; Sat, 9 Mar 2013 21:21:47 GMT (envelope-from gjb@svn.freebsd.org) Received: (from gjb@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r29LLlH3013536; Sat, 9 Mar 2013 21:21:47 GMT (envelope-from gjb@svn.freebsd.org) Message-Id: <201303092121.r29LLlH3013536@svn.freebsd.org> From: Glen Barber Date: Sat, 9 Mar 2013 21:21:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r248116 - stable/8/usr.sbin/sysinstall X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Mar 2013 21:21:48 -0000 Author: gjb (doc,ports committer) Date: Sat Mar 9 21:21:47 2013 New Revision: 248116 URL: http://svnweb.freebsd.org/changeset/base/248116 Log: Update ports count and size in sysinstall(8). This is a direct commit to stable/8. Submitted by: ryusuke Approved by: re (kib) Modified: stable/8/usr.sbin/sysinstall/dist.c Modified: stable/8/usr.sbin/sysinstall/dist.c ============================================================================== --- stable/8/usr.sbin/sysinstall/dist.c Sat Mar 9 21:21:30 2013 (r248115) +++ stable/8/usr.sbin/sysinstall/dist.c Sat Mar 9 21:21:47 2013 (r248116) @@ -289,8 +289,8 @@ distMaybeSetPorts(dialogMenuItem *self) { dialog_clear_norefresh(); if (!msgYesNo("Would you like to install the FreeBSD ports collection?\n\n" - "This will give you ready access to over 19,000 ported software packages,\n" - "at a cost of around 445MB of disk space when \"clean\" and possibly\n" + "This will give you ready access to over 24,000 ported software packages,\n" + "at a cost of around 500MB of disk space when \"clean\" and possibly\n" "much more than that when a lot of the distribution tarballs are loaded\n" "(unless you have the extra discs available from a FreeBSD CD/DVD distribution\n" "and can mount them on /cdrom, in which case this is far less of a problem).\n\n"