From owner-svn-src-stable-9@FreeBSD.ORG Sun May 6 14:10:57 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 24B171065675; Sun, 6 May 2012 14:10:57 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 103308FC1A; Sun, 6 May 2012 14:10:57 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q46EAuhE017195; Sun, 6 May 2012 14:10:56 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q46EAuUx017192; Sun, 6 May 2012 14:10:56 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201205061410.q46EAuUx017192@svn.freebsd.org> From: Eitan Adler Date: Sun, 6 May 2012 14:10:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r235082 - stable/9/lib/libc/gmon X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 May 2012 14:10:57 -0000 Author: eadler Date: Sun May 6 14:10:56 2012 New Revision: 235082 URL: http://svn.freebsd.org/changeset/base/235082 Log: MFC r234819: Allow users of gprof to get per run output files (using the pid) PR: bin/99800 Approved by: cperciva (implicit) Modified: stable/9/lib/libc/gmon/gmon.c stable/9/lib/libc/gmon/moncontrol.3 Directory Properties: stable/9/lib/libc/ (props changed) Modified: stable/9/lib/libc/gmon/gmon.c ============================================================================== --- stable/9/lib/libc/gmon/gmon.c Sun May 6 13:09:13 2012 (r235081) +++ stable/9/lib/libc/gmon/gmon.c Sun May 6 14:10:56 2012 (r235082) @@ -157,7 +157,12 @@ _mcleanup(void) } moncontrol(0); - snprintf(outname, sizeof(outname), "%s.gmon", _getprogname()); + if (getenv("PROFIL_USE_PID")) + snprintf(outname, sizeof(outname), "%s.%d.gmon", + _getprogname(), getpid()); + else + snprintf(outname, sizeof(outname), "%s.gmon", _getprogname()); + fd = _open(outname, O_CREAT|O_TRUNC|O_WRONLY, 0666); if (fd < 0) { _warn("_mcleanup: %s", outname); Modified: stable/9/lib/libc/gmon/moncontrol.3 ============================================================================== --- stable/9/lib/libc/gmon/moncontrol.3 Sun May 6 13:09:13 2012 (r235081) +++ stable/9/lib/libc/gmon/moncontrol.3 Sun May 6 14:10:56 2012 (r235082) @@ -98,6 +98,12 @@ however, all functions in that address r have their execution time measured. Profiling begins on return from .Fn monstartup . +.Sh ENVIRONMENT +The following environment variables affect the execution of +.Nm : +.Bl -tag -width ".Ev PROFIL_USE_PID" +.It PROFIL_USE_PID +If set, the pid of the process is inserted into the filename. .Sh FILES .Bl -tag -width progname.gmon -compact .It Pa progname.gmon From owner-svn-src-stable-9@FreeBSD.ORG Sun May 6 14:15:33 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7933D106564A; Sun, 6 May 2012 14:15:33 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 644E38FC08; Sun, 6 May 2012 14:15:33 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q46EFXYm017459; Sun, 6 May 2012 14:15:33 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q46EFXlg017457; Sun, 6 May 2012 14:15:33 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201205061415.q46EFXlg017457@svn.freebsd.org> From: Eitan Adler Date: Sun, 6 May 2012 14:15:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r235085 - stable/9/sys/cam/scsi X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 May 2012 14:15:33 -0000 Author: eadler Date: Sun May 6 14:15:32 2012 New Revision: 235085 URL: http://svn.freebsd.org/changeset/base/235085 Log: MFC r234821: Add support for: Olympus FE-210 camera LG UP3S MP3 player Laser MP3-2GA13 MP3 PR: usb/119201 Approved by: cperciva (implicit) Modified: stable/9/sys/cam/scsi/scsi_da.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/cam/scsi/scsi_da.c ============================================================================== --- stable/9/sys/cam/scsi/scsi_da.c Sun May 6 14:11:51 2012 (r235084) +++ stable/9/sys/cam/scsi/scsi_da.c Sun May 6 14:15:32 2012 (r235085) @@ -787,6 +787,27 @@ static struct da_quirk_entry da_quirk_ta { T_DIRECT, SIP_MEDIA_FIXED, "WDC WD??", "???PVT*", "*" }, /*quirks*/DA_Q_4K }, + { + /* + * Olympus FE-210 camera + */ + {T_DIRECT, SIP_MEDIA_REMOVABLE, "OLYMPUS", "FE210*", + "*"}, /*quirks*/ DA_Q_NO_SYNC_CACHE + }, + { + /* + * LG UP3S MP3 player + */ + {T_DIRECT, SIP_MEDIA_REMOVABLE, "LG", "UP3S", + "*"}, /*quirks*/ DA_Q_NO_SYNC_CACHE + }, + { + /* + * Laser MP3-2GA13 MP3 player + */ + {T_DIRECT, SIP_MEDIA_REMOVABLE, "USB 2.0", "(HS) Flash Disk", + "*"}, /*quirks*/ DA_Q_NO_SYNC_CACHE + }, }; static disk_strategy_t dastrategy; From owner-svn-src-stable-9@FreeBSD.ORG Sun May 6 14:22:31 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 5AE39106566C; Sun, 6 May 2012 14:22:31 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 45CFB8FC0C; Sun, 6 May 2012 14:22:31 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q46EMV11017798; Sun, 6 May 2012 14:22:31 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q46EMVSa017796; Sun, 6 May 2012 14:22:31 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201205061422.q46EMVSa017796@svn.freebsd.org> From: Eitan Adler Date: Sun, 6 May 2012 14:22:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r235088 - stable/9/lib/libc/sys X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 May 2012 14:22:31 -0000 Author: eadler Date: Sun May 6 14:22:30 2012 New Revision: 235088 URL: http://svn.freebsd.org/changeset/base/235088 Log: MFC r234820: pread(2) might fail with EBUSY, so document it PR: docs/167201 Approved by: cperciva (implicit) Modified: stable/9/lib/libc/sys/read.2 Directory Properties: stable/9/lib/libc/ (props changed) stable/9/lib/libc/sys/ (props changed) Modified: stable/9/lib/libc/sys/read.2 ============================================================================== --- stable/9/lib/libc/sys/read.2 Sun May 6 14:16:18 2012 (r235087) +++ stable/9/lib/libc/sys/read.2 Sun May 6 14:22:30 2012 (r235088) @@ -164,6 +164,8 @@ argument points outside the allocated address space. .It Bq Er EIO An I/O error occurred while reading from the file system. +.It Bq Er EBUSY +Failed to read from a file, e.g. /proc//regs while is not stopped .It Bq Er EINTR A read from a slow device (i.e.\& one that might block for an arbitrary amount of time) From owner-svn-src-stable-9@FreeBSD.ORG Sun May 6 15:55:02 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 06117106566B; Sun, 6 May 2012 15:55:01 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D4CD58FC14; Sun, 6 May 2012 15:55:01 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q46Ft1vx020929; Sun, 6 May 2012 15:55:01 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q46Ft1g3020924; Sun, 6 May 2012 15:55:01 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201205061555.q46Ft1g3020924@svn.freebsd.org> From: Alexander Motin Date: Sun, 6 May 2012 15:55:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r235092 - stable/9/sys/geom/raid X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 May 2012 15:55:02 -0000 Author: mav Date: Sun May 6 15:55:01 2012 New Revision: 235092 URL: http://svn.freebsd.org/changeset/base/235092 Log: MFC r234601: Add sos@ copyrights to RAID metadata modules, respecting his efforts in decoding metadata formats in ataraid(4) code. Modified: stable/9/sys/geom/raid/md_intel.c stable/9/sys/geom/raid/md_jmicron.c stable/9/sys/geom/raid/md_nvidia.c stable/9/sys/geom/raid/md_promise.c stable/9/sys/geom/raid/md_sii.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/geom/raid/md_intel.c ============================================================================== --- stable/9/sys/geom/raid/md_intel.c Sun May 6 14:50:54 2012 (r235091) +++ stable/9/sys/geom/raid/md_intel.c Sun May 6 15:55:01 2012 (r235092) @@ -1,5 +1,6 @@ /*- * Copyright (c) 2010 Alexander Motin + * Copyright (c) 2000 - 2008 Søren Schmidt * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: stable/9/sys/geom/raid/md_jmicron.c ============================================================================== --- stable/9/sys/geom/raid/md_jmicron.c Sun May 6 14:50:54 2012 (r235091) +++ stable/9/sys/geom/raid/md_jmicron.c Sun May 6 15:55:01 2012 (r235092) @@ -1,5 +1,6 @@ /*- * Copyright (c) 2010 Alexander Motin + * Copyright (c) 2000 - 2008 Søren Schmidt * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: stable/9/sys/geom/raid/md_nvidia.c ============================================================================== --- stable/9/sys/geom/raid/md_nvidia.c Sun May 6 14:50:54 2012 (r235091) +++ stable/9/sys/geom/raid/md_nvidia.c Sun May 6 15:55:01 2012 (r235092) @@ -1,5 +1,6 @@ /*- * Copyright (c) 2011 Alexander Motin + * Copyright (c) 2000 - 2008 Søren Schmidt * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: stable/9/sys/geom/raid/md_promise.c ============================================================================== --- stable/9/sys/geom/raid/md_promise.c Sun May 6 14:50:54 2012 (r235091) +++ stable/9/sys/geom/raid/md_promise.c Sun May 6 15:55:01 2012 (r235092) @@ -1,5 +1,6 @@ /*- * Copyright (c) 2011 Alexander Motin + * Copyright (c) 2000 - 2008 Søren Schmidt * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: stable/9/sys/geom/raid/md_sii.c ============================================================================== --- stable/9/sys/geom/raid/md_sii.c Sun May 6 14:50:54 2012 (r235091) +++ stable/9/sys/geom/raid/md_sii.c Sun May 6 15:55:01 2012 (r235092) @@ -1,5 +1,6 @@ /*- * Copyright (c) 2011 Alexander Motin + * Copyright (c) 2000 - 2008 Søren Schmidt * All rights reserved. * * Redistribution and use in source and binary forms, with or without From owner-svn-src-stable-9@FreeBSD.ORG Sun May 6 20:26:22 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id ED46C106566C; Sun, 6 May 2012 20:26:22 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BDB658FC08; Sun, 6 May 2012 20:26:22 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q46KQM2F030386; Sun, 6 May 2012 20:26:22 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q46KQMEu030383; Sun, 6 May 2012 20:26:22 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <201205062026.q46KQMEu030383@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Sun, 6 May 2012 20:26:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r235103 - stable/9/sys/net X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 May 2012 20:26:23 -0000 Author: bz Date: Sun May 6 20:26:22 2012 New Revision: 235103 URL: http://svn.freebsd.org/changeset/base/235103 Log: MFC r233113: Hide kernel option ROUTETABLES evaluations in the implementation rather than the header file. With this also move RT_MAXFIBS and RT_NUMFIBS into the implemantion to avoid further usage in other code. rt_numfibs is all that should be needed. This allows users to change the number of FIBs from 1..RT_MAXFIBS(16) dynamically using the tunable without the need to change the kernel config for the maximum anymore. This means that the multi-FIB feature is now fully available with GENERIC kernels. The kernel option ROUTETABLES can still be used to set the default numbers of FIBs in absence of the tunable. Modified: stable/9/sys/net/route.c stable/9/sys/net/route.h Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/net/route.c ============================================================================== --- stable/9/sys/net/route.c Sun May 6 19:34:55 2012 (r235102) +++ stable/9/sys/net/route.c Sun May 6 20:26:22 2012 (r235103) @@ -68,6 +68,24 @@ #include +/* We use 4 bits in the mbuf flags, thus we are limited to 16 FIBS. */ +#define RT_MAXFIBS 16 + +/* Kernel config default option. */ +#ifdef ROUTETABLES +#if ROUTETABLES <= 0 +#error "ROUTETABLES defined too low" +#endif +#if ROUTETABLES > RT_MAXFIBS +#error "ROUTETABLES defined too big" +#endif +#define RT_NUMFIBS ROUTETABLES +#endif /* ROUTETABLES */ +/* Initialize to default if not otherwise set. */ +#ifndef RT_NUMFIBS +#define RT_NUMFIBS 1 +#endif + u_int rt_numfibs = RT_NUMFIBS; SYSCTL_UINT(_net, OID_AUTO, fibs, CTLFLAG_RD, &rt_numfibs, 0, ""); /* Modified: stable/9/sys/net/route.h ============================================================================== --- stable/9/sys/net/route.h Sun May 6 19:34:55 2012 (r235102) +++ stable/9/sys/net/route.h Sun May 6 20:26:22 2012 (r235103) @@ -90,27 +90,6 @@ struct rt_metrics { #define RTM_RTTUNIT 1000000 /* units for rtt, rttvar, as units per sec */ #define RTTTOPRHZ(r) ((r) / (RTM_RTTUNIT / PR_SLOWHZ)) -/* MRT compile-time constants */ -#ifdef _KERNEL - #ifndef ROUTETABLES - #define RT_NUMFIBS 1 - #define RT_MAXFIBS 1 - #else - /* while we use 4 bits in the mbuf flags, we are limited to 16 */ - #define RT_MAXFIBS 16 - #if ROUTETABLES > RT_MAXFIBS - #define RT_NUMFIBS RT_MAXFIBS - #error "ROUTETABLES defined too big" - #else - #if ROUTETABLES == 0 - #define RT_NUMFIBS 1 - #else - #define RT_NUMFIBS ROUTETABLES - #endif - #endif - #endif -#endif - #define RT_DEFAULT_FIB 0 /* Explicitly mark fib=0 restricted cases */ extern u_int rt_numfibs; /* number fo usable routing tables */ /* From owner-svn-src-stable-9@FreeBSD.ORG Sun May 6 22:50:07 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BF326106564A; Sun, 6 May 2012 22:50:07 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A2C698FC0A; Sun, 6 May 2012 22:50:07 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q46Mo7N0035293; Sun, 6 May 2012 22:50:07 GMT (envelope-from bapt@svn.freebsd.org) Received: (from bapt@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q46Mo7hB035287; Sun, 6 May 2012 22:50:07 GMT (envelope-from bapt@svn.freebsd.org) Message-Id: <201205062250.q46Mo7hB035287@svn.freebsd.org> From: Baptiste Daroussin Date: Sun, 6 May 2012 22:50:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r235112 - in stable/9/usr.sbin: . pkg X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 May 2012 22:50:07 -0000 Author: bapt Date: Sun May 6 22:50:07 2012 New Revision: 235112 URL: http://svn.freebsd.org/changeset/base/235112 Log: MFC r234313 r234315 r234322 r234351 r234870 bootstrap tool for pkgng. it respects PACKAGESITE, PACKAGEROOT, and a new environment variable ABI (if a user want to use a different API from the base one for its packages) it has no man page on purpose to avoid hidding the pkg(8) man page from the pkgng package. for now uses pkgbeta.FreeBSD.org as default mirror to find its package it respects MK_PKGTOOLS Approved by: des (mentor) Added: stable/9/usr.sbin/pkg/ - copied from r234313, head/usr.sbin/pkg/ Modified: stable/9/usr.sbin/Makefile stable/9/usr.sbin/pkg/Makefile stable/9/usr.sbin/pkg/pkg.c Directory Properties: stable/9/ (props changed) stable/9/usr.sbin/ (props changed) Modified: stable/9/usr.sbin/Makefile ============================================================================== --- stable/9/usr.sbin/Makefile Sun May 6 22:36:10 2012 (r235111) +++ stable/9/usr.sbin/Makefile Sun May 6 22:50:07 2012 (r235112) @@ -256,6 +256,7 @@ SUBDIR+= ftp-proxy .if ${MK_PKGTOOLS} != "no" SUBDIR+= pkg_install +SUBDIR+= pkg .endif # XXX MK_TOOLCHAIN? Modified: stable/9/usr.sbin/pkg/Makefile ============================================================================== --- head/usr.sbin/pkg/Makefile Sun Apr 15 15:13:36 2012 (r234313) +++ stable/9/usr.sbin/pkg/Makefile Sun May 6 22:50:07 2012 (r235112) @@ -4,6 +4,7 @@ PROG= pkg SRC= pkg.c NO_MAN= yes +DPADD= ${LIBARCHIVE} ${LIBELF} ${LIBFETCH} LDADD= -larchive -lelf -lfetch .include Modified: stable/9/usr.sbin/pkg/pkg.c ============================================================================== --- head/usr.sbin/pkg/pkg.c Sun Apr 15 15:13:36 2012 (r234313) +++ stable/9/usr.sbin/pkg/pkg.c Sun May 6 22:50:07 2012 (r235112) @@ -27,11 +27,10 @@ #include __FBSDID("$FreeBSD$"); -#include -#include #include #include #include +#include #include #include @@ -39,24 +38,24 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include +#include #include #include #include #include #include -#include #include "elf_tables.h" #define _LOCALBASE "/usr/local" #define _PKGS_URL "http://pkgbeta.FreeBSD.org" -#define _DEFAULT_TMP "/tmp" static const char * -elf_corres_to_string(struct _elf_corres* m, int e) +elf_corres_to_string(struct _elf_corres *m, int e) { - int i = 0; + int i; for (i = 0; m[i].string != NULL; i++) if (m[i].elf_nb == e) @@ -69,29 +68,30 @@ static int pkg_get_myabi(char *dest, size_t sz) { Elf *elf; - GElf_Ehdr elfhdr; - GElf_Shdr shdr; Elf_Data *data; Elf_Note note; Elf_Scn *scn; char *src, *osname; const char *abi; + GElf_Ehdr elfhdr; + GElf_Shdr shdr; int fd, i, ret; uint32_t version; version = 0; - ret = 0; + ret = -1; scn = NULL; abi = NULL; if (elf_version(EV_CURRENT) == EV_NONE) { - warnx("ELF library initialization failed: %s", elf_errmsg(-1)); - return -1; + warnx("ELF library initialization failed: %s", + elf_errmsg(-1)); + return (-1); } if ((fd = open("/bin/sh", O_RDONLY)) < 0) { warn("open()"); - return -1; + return (-1); } if ((elf = elf_begin(fd, ELF_C_READ, NULL)) == NULL) { @@ -119,13 +119,13 @@ pkg_get_myabi(char *dest, size_t sz) if (scn == NULL) { ret = -1; - warn("fail to get the note section"); + warn("failed to get the note section"); goto cleanup; } data = elf_getdata(scn, NULL); src = data->d_buf; - while (1) { + for (;;) { memcpy(¬e, src, sizeof(Elf_Note)); src += sizeof(Elf_Note); if (note.n_type == NT_VERSION) @@ -143,52 +143,50 @@ pkg_get_myabi(char *dest, size_t sz) osname[i] = (char)tolower(osname[i]); snprintf(dest, sz, "%s:%d:%s:%s", - osname, - version / 100000, - elf_corres_to_string(mach_corres, (int) elfhdr.e_machine), + osname, version / 100000, + elf_corres_to_string(mach_corres, (int)elfhdr.e_machine), elf_corres_to_string(wordsize_corres, - (int)elfhdr.e_ident[EI_CLASS])); + (int)elfhdr.e_ident[EI_CLASS])); + + ret = 0; switch (elfhdr.e_machine) { - case EM_ARM: - snprintf(dest + strlen(dest), sz - strlen(dest), - ":%s:%s:%s", - elf_corres_to_string(endian_corres, - (int) elfhdr.e_ident[EI_DATA]), - (elfhdr.e_flags & EF_ARM_NEW_ABI) > 0 ? - "eabi" : "oabi", - (elfhdr.e_flags & EF_ARM_VFP_FLOAT) > 0 ? - "softfp" : "vfp"); + case EM_ARM: + snprintf(dest + strlen(dest), sz - strlen(dest), + ":%s:%s:%s", elf_corres_to_string(endian_corres, + (int)elfhdr.e_ident[EI_DATA]), + (elfhdr.e_flags & EF_ARM_NEW_ABI) > 0 ? + "eabi" : "oabi", + (elfhdr.e_flags & EF_ARM_VFP_FLOAT) > 0 ? + "softfp" : "vfp"); + break; + case EM_MIPS: + /* + * this is taken from binutils sources: + * include/elf/mips.h + * mapping is figured out from binutils: + * gas/config/tc-mips.c + */ + switch (elfhdr.e_flags & EF_MIPS_ABI) { + case E_MIPS_ABI_O32: + abi = "o32"; break; - case EM_MIPS: - /* - * this is taken from binutils sources: - * include/elf/mips.h - * mapping is figured out from binutils: - * gas/config/tc-mips.c - */ - switch (elfhdr.e_flags & EF_MIPS_ABI) { - case E_MIPS_ABI_O32: - abi = "o32"; - break; - case E_MIPS_ABI_N32: - abi = "n32"; - break; - default: - if (elfhdr.e_ident[EI_DATA] == - ELFCLASS32) - abi = "o32"; - else if (elfhdr.e_ident[EI_DATA] == - ELFCLASS64) - abi = "n64"; - break; - } - snprintf(dest + strlen(dest), sz - strlen(dest), - ":%s:%s", - elf_corres_to_string(endian_corres, - (int) elfhdr.e_ident[EI_DATA]), - abi); + case E_MIPS_ABI_N32: + abi = "n32"; break; + default: + if (elfhdr.e_ident[EI_DATA] == + ELFCLASS32) + abi = "o32"; + else if (elfhdr.e_ident[EI_DATA] == + ELFCLASS64) + abi = "n64"; + break; + } + snprintf(dest + strlen(dest), sz - strlen(dest), + ":%s:%s", elf_corres_to_string(endian_corres, + (int)elfhdr.e_ident[EI_DATA]), abi); + break; } cleanup: @@ -207,17 +205,22 @@ extract_pkg_static(int fd, char *p, int char *end; int ret, r; - ret = 0; + ret = -1; a = archive_read_new(); + if (a == NULL) { + warn("archive_read_new"); + return (ret); + } archive_read_support_compression_all(a); archive_read_support_format_tar(a); - lseek(fd, 0, 0); + if (lseek(fd, 0, 0) == -1) { + warn("lseek"); + goto cleanup; + } if (archive_read_open_fd(a, fd, 4096) != ARCHIVE_OK) { - warnx("archive_read_open_fd: %s", - archive_error_string(a)); - ret = -1; + warnx("archive_read_open_fd: %s", archive_error_string(a)); goto cleanup; } @@ -229,22 +232,22 @@ extract_pkg_static(int fd, char *p, int if (strcmp(end, "/pkg-static") == 0) { r = archive_read_extract(a, ae, - ARCHIVE_EXTRACT_OWNER |ARCHIVE_EXTRACT_PERM| - ARCHIVE_EXTRACT_TIME |ARCHIVE_EXTRACT_ACL | - ARCHIVE_EXTRACT_FFLAGS|ARCHIVE_EXTRACT_XATTR); - snprintf(p, sz, archive_entry_pathname(ae)); + ARCHIVE_EXTRACT_OWNER | ARCHIVE_EXTRACT_PERM | + ARCHIVE_EXTRACT_TIME | ARCHIVE_EXTRACT_ACL | + ARCHIVE_EXTRACT_FFLAGS | ARCHIVE_EXTRACT_XATTR); + strlcpy(p, archive_entry_pathname(ae), sz); break; } } - if (r != ARCHIVE_OK) { + if (r == ARCHIVE_OK) + ret = 0; + else warnx("fail to extract pkg-static"); - ret = -1; - } cleanup: archive_read_finish(a); - return ret; + return (ret); } @@ -255,129 +258,151 @@ install_pkg_static(char *path, char *pkg pid_t pid; switch ((pid = fork())) { - case -1: - return (-1); - case 0: - execl(path, "pkg-static", "add", pkgpath, (char *)NULL); - _exit(1); /* NOT REACHED */ - default: - break; + case -1: + return (-1); + case 0: + execl(path, "pkg-static", "add", pkgpath, (char *)NULL); + _exit(1); + default: + break; } - while (waitpid(pid, &pstat, 0) == -1) { + while (waitpid(pid, &pstat, 0) == -1) if (errno != EINTR) return (-1); - } - return (WEXITSTATUS(pstat)); + if (WEXITSTATUS(pstat)) + return (WEXITSTATUS(pstat)); + else if (WIFSIGNALED(pstat)) + return (128 & (WTERMSIG(pstat))); + return (pstat); } static int bootstrap_pkg(void) { - struct url_stat st; FILE *remote; - time_t begin_dl; - time_t now; - time_t last = 0; + FILE *config; + char *site; char url[MAXPATHLEN]; + char conf[MAXPATHLEN]; char abi[BUFSIZ]; char tmppkg[MAXPATHLEN]; char buf[10240]; char pkgstatic[MAXPATHLEN]; int fd, retry, ret; + struct url_stat st; off_t done, r; + time_t now; + time_t last; done = 0; - ret = 0; - retry = 3; + last = 0; + ret = -1; remote = NULL; + config = NULL; - printf("Bootstraping pkg please wait\n"); + printf("Bootstrapping pkg please wait\n"); if (pkg_get_myabi(abi, MAXPATHLEN) != 0) { - warnx("fail to determine my abi"); - return -1; + warnx("failed to determine the system ABI"); + return (-1); } - if (getenv("PACKAGESITE") != NULL) { - snprintf(url, MAXPATHLEN, "%s/pkg.txz", - getenv("PACKAGESITE")); - } else { + if (getenv("PACKAGESITE") != NULL) + snprintf(url, MAXPATHLEN, "%s/Latest/pkg.txz", getenv("PACKAGESITE")); + else snprintf(url, MAXPATHLEN, "%s/%s/latest/Latest/pkg.txz", getenv("PACKAGEROOT") ? getenv("PACKAGEROOT") : _PKGS_URL, getenv("ABI") ? getenv("ABI") : abi); - } snprintf(tmppkg, MAXPATHLEN, "%s/pkg.txz.XXXXXX", - getenv("TMPDIR") ? getenv("TMPDIR") : "/tmp"); + getenv("TMPDIR") ? getenv("TMPDIR") : _PATH_TMP); if ((fd = mkstemp(tmppkg)) == -1) { warn("mkstemp()"); - return -1; + return (-1); } - while (remote == NULL) { + retry = 3; + do { remote = fetchXGetURL(url, &st, ""); - if (remote == NULL) { - --retry; - if (retry == 0) { - warnx("Error fetching %s: %s", url, - fetchLastErrString); - ret = 1; - goto cleanup; - } + if (remote == NULL) sleep(1); - } - } + } while (remote == NULL && retry-- > 0); + + if (remote == NULL) + goto fetchfail; - begin_dl = time(NULL); while (done < st.size) { if ((r = fread(buf, 1, sizeof(buf), remote)) < 1) break; if (write(fd, buf, r) != r) { warn("write()"); - ret = -1; goto cleanup; } done += r; now = time(NULL); - if (now > last || done == st.size) { + if (now > last || done == st.size) last = now; - } } - if (ferror(remote)) { - warnx("Error fetching %s: %s", url, - fetchLastErrString); - ret = 1; - goto cleanup; - } + if (ferror(remote)) + goto fetchfail; if ((ret = extract_pkg_static(fd, pkgstatic, MAXPATHLEN)) == 0) ret = install_pkg_static(pkgstatic, tmppkg); + snprintf(conf, MAXPATHLEN, "%s/etc/pkg.conf", + getenv("LOCALBASE") ? getenv("LOCALBASE") : _LOCALBASE); + + if (access(conf, R_OK) == -1) { + site = strrchr(url, '/'); + if (site == NULL) + goto cleanup; + site[0] = '\0'; + site = strrchr(url, '/'); + if (site == NULL) + goto cleanup; + site[0] = '\0'; + + config = fopen(conf, "w+"); + if (config == NULL) + goto cleanup; + fprintf(config, "packagesite: %s", url); + fclose(config); + } + + goto cleanup; + +fetchfail: + warnx("Error fetching %s: %s", url, fetchLastErrString); + cleanup: + if (remote != NULL) + fclose(remote); close(fd); unlink(tmppkg); - return 0; + return (ret); } int -main(__unused int argc, char * argv[]) +main(__unused int argc, char *argv[]) { char pkgpath[MAXPATHLEN]; snprintf(pkgpath, MAXPATHLEN, "%s/sbin/pkg", - getenv("LOCALBASE") ? getenv("LOCALBASE"): _LOCALBASE); + getenv("LOCALBASE") ? getenv("LOCALBASE") : _LOCALBASE); if (access(pkgpath, X_OK) == -1) - bootstrap_pkg(); + if (bootstrap_pkg() != 0) + exit(EXIT_FAILURE); execv(pkgpath, argv); - return (EXIT_SUCCESS); + /* NOT REACHED */ + return (EXIT_FAILURE); } From owner-svn-src-stable-9@FreeBSD.ORG Mon May 7 10:46:26 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E87F5106566C; Mon, 7 May 2012 10:46:26 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B8A798FC12; Mon, 7 May 2012 10:46:26 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q47AkQAP060564; Mon, 7 May 2012 10:46:26 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q47AkQUc060561; Mon, 7 May 2012 10:46:26 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201205071046.q47AkQUc060561@svn.freebsd.org> From: Michael Tuexen Date: Mon, 7 May 2012 10:46:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r235123 - stable/9/sys/netinet X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 May 2012 10:46:27 -0000 Author: tuexen Date: Mon May 7 10:46:26 2012 New Revision: 235123 URL: http://svn.freebsd.org/changeset/base/235123 Log: MFC r234832: Add support for missing gauth_number_of_chunks field. This Bug was found by Irene Ruengeler. Modified: stable/9/sys/netinet/sctp_uio.h stable/9/sys/netinet/sctp_usrreq.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/netinet/sctp_uio.h ============================================================================== --- stable/9/sys/netinet/sctp_uio.h Mon May 7 09:00:30 2012 (r235122) +++ stable/9/sys/netinet/sctp_uio.h Mon May 7 10:46:26 2012 (r235123) @@ -660,6 +660,7 @@ struct sctp_authkeyid { /* SCTP_PEER_AUTH_CHUNKS / SCTP_LOCAL_AUTH_CHUNKS */ struct sctp_authchunks { sctp_assoc_t gauth_assoc_id; + uint32_t gauth_number_of_chunks; uint8_t gauth_chunks[]; }; Modified: stable/9/sys/netinet/sctp_usrreq.c ============================================================================== --- stable/9/sys/netinet/sctp_usrreq.c Mon May 7 09:00:30 2012 (r235122) +++ stable/9/sys/netinet/sctp_usrreq.c Mon May 7 10:46:26 2012 (r235123) @@ -2879,6 +2879,7 @@ flags_out: } else { /* copy in the chunks */ (void)sctp_serialize_auth_chunks(chklist, sac->gauth_chunks); + sac->gauth_number_of_chunks = (uint32_t) size; *optsize = sizeof(struct sctp_authchunks) + size; } SCTP_TCB_UNLOCK(stcb); @@ -2897,6 +2898,7 @@ flags_out: } else { /* copy in the chunks */ (void)sctp_serialize_auth_chunks(chklist, sac->gauth_chunks); + sac->gauth_number_of_chunks = (uint32_t) size; *optsize = sizeof(struct sctp_authchunks) + size; } SCTP_INP_RUNLOCK(inp); @@ -2927,6 +2929,7 @@ flags_out: } else { /* copy in the chunks */ (void)sctp_serialize_auth_chunks(chklist, sac->gauth_chunks); + sac->gauth_number_of_chunks = (uint32_t) size; *optsize = sizeof(struct sctp_authchunks) + size; } SCTP_TCB_UNLOCK(stcb); From owner-svn-src-stable-9@FreeBSD.ORG Mon May 7 10:50:27 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 712B51065673; Mon, 7 May 2012 10:50:27 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5B8438FC0A; Mon, 7 May 2012 10:50:27 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q47AoRnp060737; Mon, 7 May 2012 10:50:27 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q47AoRMS060734; Mon, 7 May 2012 10:50:27 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201205071050.q47AoRMS060734@svn.freebsd.org> From: Michael Tuexen Date: Mon, 7 May 2012 10:50:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r235124 - stable/9/sys/netinet X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 May 2012 10:50:27 -0000 Author: tuexen Date: Mon May 7 10:50:26 2012 New Revision: 235124 URL: http://svn.freebsd.org/changeset/base/235124 Log: MFC r234951: Fix another RFC 6458 issue. Spotted by Irene Ruengeler. Modified: stable/9/sys/netinet/sctp_output.c stable/9/sys/netinet/sctp_uio.h Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/netinet/sctp_output.c ============================================================================== --- stable/9/sys/netinet/sctp_output.c Mon May 7 10:46:26 2012 (r235123) +++ stable/9/sys/netinet/sctp_output.c Mon May 7 10:50:26 2012 (r235124) @@ -3430,7 +3430,7 @@ sctp_find_cmsg(int c_type, void *data, s } m_copydata(control, at + CMSG_ALIGN(sizeof(struct cmsghdr)), sizeof(struct sctp_authinfo), (caddr_t)&authinfo); sndrcvinfo->sinfo_keynumber_valid = 1; - sndrcvinfo->sinfo_keynumber = authinfo.auth_keyid; + sndrcvinfo->sinfo_keynumber = authinfo.auth_keynumber; break; default: return (found); Modified: stable/9/sys/netinet/sctp_uio.h ============================================================================== --- stable/9/sys/netinet/sctp_uio.h Mon May 7 10:46:26 2012 (r235123) +++ stable/9/sys/netinet/sctp_uio.h Mon May 7 10:50:26 2012 (r235124) @@ -169,7 +169,7 @@ struct sctp_default_prinfo { }; struct sctp_authinfo { - uint16_t auth_keyid; + uint16_t auth_keynumber; }; struct sctp_rcvinfo { From owner-svn-src-stable-9@FreeBSD.ORG Mon May 7 12:19:49 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E92E51065672; Mon, 7 May 2012 12:19:49 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D36B88FC08; Mon, 7 May 2012 12:19:49 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q47CJn6O064140; Mon, 7 May 2012 12:19:49 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q47CJnxi064137; Mon, 7 May 2012 12:19:49 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201205071219.q47CJnxi064137@svn.freebsd.org> From: Eitan Adler Date: Mon, 7 May 2012 12:19:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r235125 - stable/9/sys/kern X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 May 2012 12:19:50 -0000 Author: eadler Date: Mon May 7 12:19:49 2012 New Revision: 235125 URL: http://svn.freebsd.org/changeset/base/235125 Log: MFC r234131: Return EBADF instead of EMFILE from dup2 when the second argument is outside the range of valid file descriptors PR: kern/164970 Approved by: cperciva (implicit) Modified: stable/9/sys/kern/kern_descrip.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/kern/kern_descrip.c ============================================================================== --- stable/9/sys/kern/kern_descrip.c Mon May 7 10:50:26 2012 (r235124) +++ stable/9/sys/kern/kern_descrip.c Mon May 7 12:19:49 2012 (r235125) @@ -815,7 +815,7 @@ do_dup(struct thread *td, int flags, int maxfd = min((int)lim_cur(p, RLIMIT_NOFILE), maxfilesperproc); PROC_UNLOCK(p); if (new >= maxfd) - return (flags & DUP_FCNTL ? EINVAL : EMFILE); + return (flags & DUP_FCNTL ? EINVAL : EBADF); FILEDESC_XLOCK(fdp); if (old >= fdp->fd_nfiles || fdp->fd_ofiles[old] == NULL) { From owner-svn-src-stable-9@FreeBSD.ORG Mon May 7 14:05:29 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 5CAF71065670; Mon, 7 May 2012 14:05:29 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from bigwig.baldwin.cx (bigknife-pt.tunnel.tserv9.chi1.ipv6.he.net [IPv6:2001:470:1f10:75::2]) by mx1.freebsd.org (Postfix) with ESMTP id 2C0788FC0A; Mon, 7 May 2012 14:05:29 +0000 (UTC) Received: from jhbbsd.localnet (unknown [209.249.190.124]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 95BF7B95A; Mon, 7 May 2012 10:05:28 -0400 (EDT) From: John Baldwin To: Warner Losh Date: Mon, 7 May 2012 09:27:41 -0400 User-Agent: KMail/1.13.5 (FreeBSD/8.2-CBSD-20110714-p13; KDE/4.5.5; amd64; ; ) References: <201205041538.q44FclqK010547@svn.freebsd.org> <201205042141.55089.hselasky@c2i.net> <80963C87-6F37-4AC7-B5E8-132EC5F47D98@bsdimp.com> In-Reply-To: <80963C87-6F37-4AC7-B5E8-132EC5F47D98@bsdimp.com> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201205070927.41775.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Mon, 07 May 2012 10:05:28 -0400 (EDT) Cc: "svn-src-stable@freebsd.org" , "svn-src-all@freebsd.org" , "src-committers@freebsd.org" , "svn-src-stable-9@freebsd.org" , Hans Petter Selasky Subject: Re: svn commit: r235007 - stable/9/sys/dev/pci X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 May 2012 14:05:29 -0000 On Friday, May 04, 2012 5:25:32 pm Warner Losh wrote: > > On May 4, 2012, at 1:41 PM, Hans Petter Selasky wrote: > > > On Friday 04 May 2012 19:18:56 Warner Losh wrote: > >> On May 4, 2012, at 10:26 AM, Hans Petter Selasky wrote: > >>> On Friday 04 May 2012 18:14:16 John Baldwin wrote: > >>>> On Friday, May 04, 2012 11:38:47 am Hans Petter Selasky wrote: > >>>>> Author: hselasky > >>>>> Date: Fri May 4 15:38:47 2012 > >>>>> New Revision: 235007 > >>>>> URL: http://svn.freebsd.org/changeset/base/235007 > >>>>> > >>>>> Log: > >>>>> MFC r233662, r233677 and r233678: > >>>>> > >>>>> Writing zero to BAR actually does not disable it and > >>>>> it is even harmful as hselasky found out. Historically, > >>>>> this code was originated from (OLDCARD) CardBus driver and later > >>>>> leaked into PCI driver when CardBus was newbus'ified and refactored > >>>>> with PCI driver. However, it is not really necessary even for > >>>>> CardBus. > >>>> > >>>> FYI, I've got one bug report on HEAD where these changes broke a > >>>> machine's ATA controller. > >>> > >>> Have you considered adding code to disable the I/O or memory range > >>> instead of writing 0 to the bar in this case? > >> > >> I tried that once upon a time, but was problematical with some bridges that > >> had BARs at non-standard locations that needed the I/O or MEM bit set in > >> order to work... > >> > >> Warner > > > > If the size of the bar is a few megabytes, then moving it to location 0 is > > definitely wrong. Else it might work! > > Only if the bridge passes the transactions for that memory to the PCI bus for decoding. The reason it worked for as long as it did was that we had bridges that passed the memory cycles to DRAM for addresses near 0 and they didn't make it onto the PCI bus. Except in embedded systems, I fail to see how that could have changed in the interim. The physical layout of x86 has actual memory at location 0 and it would be a big performance hit to push those transactions onto the pci bus, so nobody in their right mind would do that. Not true. During NEW_PCIB testing I at one point fat-fingered something such that I had an memory window on a PCI-PCI bridge claim address 0 and the boot promptly hung as soon as that register was written. -- John Baldwin From owner-svn-src-stable-9@FreeBSD.ORG Mon May 7 15:30:54 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 94B95106566C; Mon, 7 May 2012 15:30:54 +0000 (UTC) (envelope-from jh@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2D3318FC0A; Mon, 7 May 2012 15:30:54 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q47FUsAH071089; Mon, 7 May 2012 15:30:54 GMT (envelope-from jh@svn.freebsd.org) Received: (from jh@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q47FUr6P071087; Mon, 7 May 2012 15:30:53 GMT (envelope-from jh@svn.freebsd.org) Message-Id: <201205071530.q47FUr6P071087@svn.freebsd.org> From: Jaakko Heinonen Date: Mon, 7 May 2012 15:30:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r235131 - in stable/9/sys: fs/ext2fs i386/conf kern X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 May 2012 15:30:54 -0000 Author: jh Date: Mon May 7 15:30:53 2012 New Revision: 235131 URL: http://svn.freebsd.org/changeset/base/235131 Log: MFC r234104: Apply changes from r233787 to ext2fs: - Use more natural ip->i_flags instead of vap->va_flags in the final flags check. - Style improvements. No functional change intended. MFC r234139: Restore the blank line incorrectly removed in r234104. Modified: stable/9/sys/fs/ext2fs/ext2_vnops.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) stable/9/sys/fs/ (props changed) stable/9/sys/fs/ntfs/ (props changed) stable/9/sys/i386/conf/XENHVM (props changed) stable/9/sys/kern/subr_witness.c (props changed) Modified: stable/9/sys/fs/ext2fs/ext2_vnops.c ============================================================================== --- stable/9/sys/fs/ext2fs/ext2_vnops.c Mon May 7 15:06:07 2012 (r235130) +++ stable/9/sys/fs/ext2fs/ext2_vnops.c Mon May 7 15:30:53 2012 (r235131) @@ -426,23 +426,23 @@ ext2_setattr(ap) * if securelevel > 0 and any existing system flags are set. */ if (!priv_check_cred(cred, PRIV_VFS_SYSFLAGS, 0)) { - if (ip->i_flags - & (SF_NOUNLINK | SF_IMMUTABLE | SF_APPEND)) { + if (ip->i_flags & + (SF_NOUNLINK | SF_IMMUTABLE | SF_APPEND)) { error = securelevel_gt(cred, 0); if (error) return (error); } ip->i_flags = vap->va_flags; } else { - if (ip->i_flags - & (SF_NOUNLINK | SF_IMMUTABLE | SF_APPEND) || + if (ip->i_flags & + (SF_NOUNLINK | SF_IMMUTABLE | SF_APPEND) || (vap->va_flags & UF_SETTABLE) != vap->va_flags) return (EPERM); ip->i_flags &= SF_SETTABLE; ip->i_flags |= (vap->va_flags & UF_SETTABLE); } ip->i_flag |= IN_CHANGE; - if (vap->va_flags & (IMMUTABLE | APPEND)) + if (ip->i_flags & (IMMUTABLE | APPEND)) return (0); } if (ip->i_flags & (IMMUTABLE | APPEND)) From owner-svn-src-stable-9@FreeBSD.ORG Mon May 7 19:17:10 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 51E1B106566B; Mon, 7 May 2012 19:17:10 +0000 (UTC) (envelope-from ambrisko@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3A03C8FC0A; Mon, 7 May 2012 19:17:10 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q47JHAbw078996; Mon, 7 May 2012 19:17:10 GMT (envelope-from ambrisko@svn.freebsd.org) Received: (from ambrisko@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q47JHAZF078989; Mon, 7 May 2012 19:17:10 GMT (envelope-from ambrisko@svn.freebsd.org) Message-Id: <201205071917.q47JHAZF078989@svn.freebsd.org> From: Doug Ambrisko Date: Mon, 7 May 2012 19:17:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r235135 - stable/9/sys/dev/mfi X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 May 2012 19:17:10 -0000 Author: ambrisko Date: Mon May 7 19:17:09 2012 New Revision: 235135 URL: http://svn.freebsd.org/changeset/base/235135 Log: MFC r235014: Rebuild fix and LBA calculation fix for ThunderBolt based cards. MFC r235016: Some style improvements. MFC r235040: Fix the returns in mfi_tbolt_sync_map_info that I added. PR: 167226 Modified: stable/9/sys/dev/mfi/mfi.c stable/9/sys/dev/mfi/mfi_debug.c stable/9/sys/dev/mfi/mfi_disk.c stable/9/sys/dev/mfi/mfi_tbolt.c stable/9/sys/dev/mfi/mfireg.h stable/9/sys/dev/mfi/mfivar.h Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/dev/mfi/mfi.c ============================================================================== --- stable/9/sys/dev/mfi/mfi.c Mon May 7 18:30:22 2012 (r235134) +++ stable/9/sys/dev/mfi/mfi.c Mon May 7 19:17:09 2012 (r235135) @@ -90,8 +90,6 @@ static int mfi_get_controller_info(struc static int mfi_get_log_state(struct mfi_softc *, struct mfi_evt_log_state **); static int mfi_parse_entries(struct mfi_softc *, int, int); -static int mfi_dcmd_command(struct mfi_softc *, struct mfi_command **, - uint32_t, void **, size_t); static void mfi_data_cb(void *, bus_dma_segment_t *, int, int); static void mfi_startup(void *arg); static void mfi_intr(void *arg); @@ -377,6 +375,7 @@ mfi_attach(struct mfi_softc *sc) TAILQ_INIT(&sc->mfi_syspd_tqh); TAILQ_INIT(&sc->mfi_evt_queue); TASK_INIT(&sc->mfi_evt_task, 0, mfi_handle_evt, sc); + TASK_INIT(&sc->mfi_map_sync_task, 0, mfi_handle_map_sync, sc); TAILQ_INIT(&sc->mfi_aen_pids); TAILQ_INIT(&sc->mfi_cam_ccbq); @@ -696,7 +695,6 @@ mfi_attach(struct mfi_softc *sc) return (EINVAL); } sc->mfi_enable_intr(sc); - sc->map_id = 0; } else { if ((error = mfi_comms_init(sc)) != 0) return (error); @@ -762,6 +760,10 @@ mfi_attach(struct mfi_softc *sc) callout_reset(&sc->mfi_watchdog_callout, MFI_CMD_TIMEOUT * hz, mfi_timeout, sc); + if (sc->mfi_flags & MFI_FLAGS_TBOLT) { + mfi_tbolt_sync_map_info(sc); + } + return (0); } @@ -845,7 +847,7 @@ mfi_release_command(struct mfi_command * mfi_enqueue_free(cm); } -static int +int mfi_dcmd_command(struct mfi_softc *sc, struct mfi_command **cmp, uint32_t opcode, void **bufp, size_t bufsize) { @@ -1286,8 +1288,8 @@ mfi_shutdown(struct mfi_softc *sc) if (sc->mfi_aen_cm != NULL) mfi_abort(sc, sc->mfi_aen_cm); - if (sc->map_update_cmd != NULL) - mfi_abort(sc, sc->map_update_cmd); + if (sc->mfi_map_sync_cm != NULL) + mfi_abort(sc, sc->mfi_map_sync_cm); dcmd = &cm->cm_frame->dcmd; dcmd->header.flags = MFI_FRAME_DIR_NONE; @@ -1317,7 +1319,7 @@ mfi_syspdprobe(struct mfi_softc *sc) /* Add SYSTEM PD's */ error = mfi_dcmd_command(sc, &cm, MFI_DCMD_PD_LIST_QUERY, (void **)&pdlist, sizeof(*pdlist)); - if (error){ + if (error) { device_printf(sc->mfi_dev, "Error while forming SYSTEM PD list\n"); goto out; @@ -1664,9 +1666,9 @@ mfi_aen_complete(struct mfi_command *cm) if (sc->mfi_aen_cm == NULL) return; - if (sc->mfi_aen_cm->cm_aen_abort || + if (sc->cm_aen_abort || hdr->cmd_status == MFI_STAT_INVALID_STATUS) { - sc->mfi_aen_cm->cm_aen_abort = 0; + sc->cm_aen_abort = 0; aborted = 1; } else { sc->mfi_aen_triggered = 1; @@ -1956,6 +1958,7 @@ mfi_add_sys_pd_complete(struct mfi_comma mtx_unlock(&Giant); mtx_lock(&sc->mfi_io_lock); } + static struct mfi_command * mfi_bio_command(struct mfi_softc *sc) { @@ -1963,7 +1966,7 @@ mfi_bio_command(struct mfi_softc *sc) struct mfi_command *cm = NULL; /*reserving two commands to avoid starvation for IOCTL*/ - if (sc->mfi_qstat[MFIQ_FREE].q_length < 2){ + if (sc->mfi_qstat[MFIQ_FREE].q_length < 2) { return (NULL); } if ((bio = mfi_dequeue_bio(sc)) == NULL) { @@ -2385,7 +2388,9 @@ mfi_abort(struct mfi_softc *sc, struct m cm->cm_flags = MFI_CMD_POLLED; if (sc->mfi_aen_cm) - sc->mfi_aen_cm->cm_aen_abort = 1; + sc->cm_aen_abort = 1; + if (sc->mfi_map_sync_cm) + sc->cm_map_abort = 1; mfi_mapcmd(sc, cm); mfi_release_command(cm); @@ -2394,6 +2399,11 @@ mfi_abort(struct mfi_softc *sc, struct m 5 * hz); i++; } + while (i < 5 && sc->mfi_map_sync_cm != NULL) { + msleep(&sc->mfi_map_sync_cm, &sc->mfi_io_lock, 0, "mfiabort", + 5 * hz); + i++; + } return (0); } @@ -2685,12 +2695,12 @@ static int mfi_check_for_sscd(struct mfi int error = 0; if ((cm->cm_frame->dcmd.opcode == MFI_DCMD_CFG_ADD) && - (conf_data->ld[0].params.isSSCD == 1)){ + (conf_data->ld[0].params.isSSCD == 1)) { error = 1; } else if (cm->cm_frame->dcmd.opcode == MFI_DCMD_LD_DELETE) { error = mfi_dcmd_command (sc, &ld_cm, MFI_DCMD_LD_GET_INFO, (void **)&ld_info, sizeof(*ld_info)); - if (error){ + if (error) { device_printf(sc->mfi_dev, "Failed to allocate" "MFI_DCMD_LD_GET_INFO %d", error); if (ld_info) @@ -2700,7 +2710,7 @@ static int mfi_check_for_sscd(struct mfi ld_cm->cm_flags = MFI_CMD_DATAIN; ld_cm->cm_frame->dcmd.mbox[0]= cm->cm_frame->dcmd.mbox[0]; ld_cm->cm_frame->header.target_id = cm->cm_frame->dcmd.mbox[0]; - if (mfi_wait_command(sc, ld_cm) != 0){ + if (mfi_wait_command(sc, ld_cm) != 0) { device_printf(sc->mfi_dev, "failed to get log drv\n"); mfi_release_command(ld_cm); free(ld_info, M_MFIBUF); @@ -3549,9 +3559,9 @@ mfi_timeout(void *data) } mtx_lock(&sc->mfi_io_lock); TAILQ_FOREACH(cm, &sc->mfi_busy, cm_link) { - if (sc->mfi_aen_cm == cm) + if (sc->mfi_aen_cm == cm || sc->mfi_map_sync_cm == cm) continue; - if ((sc->mfi_aen_cm != cm) && (cm->cm_timestamp < deadline)) { + if (cm->cm_timestamp < deadline) { if (sc->adpreset != 0 && sc->issuepend_done == 0) { cm->cm_timestamp = time_uptime; } else { Modified: stable/9/sys/dev/mfi/mfi_debug.c ============================================================================== --- stable/9/sys/dev/mfi/mfi_debug.c Mon May 7 18:30:22 2012 (r235134) +++ stable/9/sys/dev/mfi/mfi_debug.c Mon May 7 19:17:09 2012 (r235135) @@ -172,6 +172,9 @@ mfi_print_dcmd(struct mfi_softc *sc, dev case MFI_DCMD_CLUSTER_RESET_LD: opcode = "CLUSTER_RESET_LD"; break; + case MFI_DCMD_LD_MAP_GET_INFO: + opcode = "LD_MAP_GET_INFO"; + break; default: opcode = "UNKNOWN"; break; Modified: stable/9/sys/dev/mfi/mfi_disk.c ============================================================================== --- stable/9/sys/dev/mfi/mfi_disk.c Mon May 7 18:30:22 2012 (r235134) +++ stable/9/sys/dev/mfi/mfi_disk.c Mon May 7 19:17:09 2012 (r235135) @@ -256,17 +256,17 @@ mfi_disk_strategy(struct bio *bio) return; } - if (controller->adpreset){ + if (controller->adpreset) { bio->bio_error = EBUSY; return; } - if (controller->hw_crit_error){ + if (controller->hw_crit_error) { bio->bio_error = EBUSY; return; } - if (controller->issuepend_done == 0){ + if (controller->issuepend_done == 0) { bio->bio_error = EBUSY; return; } Modified: stable/9/sys/dev/mfi/mfi_tbolt.c ============================================================================== --- stable/9/sys/dev/mfi/mfi_tbolt.c Mon May 7 18:30:22 2012 (r235134) +++ stable/9/sys/dev/mfi/mfi_tbolt.c Mon May 7 19:17:09 2012 (r235135) @@ -82,7 +82,8 @@ map_tbolt_cmd_status(struct mfi_command static void mfi_issue_pending_cmds_again (struct mfi_softc *sc); static void mfi_kill_hba (struct mfi_softc *sc); static void mfi_process_fw_state_chg_isr(void *arg); -uint8_t mfi_tbolt_get_map_info(struct mfi_softc *sc); +static void mfi_sync_map_complete(struct mfi_command *); +static void mfi_queue_map_sync(struct mfi_softc *sc); #define MFI_FUSION_ENABLE_INTERRUPT_MASK (0x00000008) @@ -140,11 +141,12 @@ mfi_tbolt_issue_cmd_ppc(struct mfi_softc MFI_WRITE4(sc, MFI_IQPH, (uint32_t)((uint64_t)bus_add >> 32)); } -/** +/* * mfi_tbolt_adp_reset - For controller reset * @regs: MFI register set */ -int mfi_tbolt_adp_reset(struct mfi_softc *sc) +int +mfi_tbolt_adp_reset(struct mfi_softc *sc) { int retry = 0, i = 0; int HostDiag; @@ -192,12 +194,10 @@ int mfi_tbolt_adp_reset(struct mfi_softc } /* - ******************************************************************************************* - * Description: - * This routine initialize Thunderbolt specific device information - ******************************************************************************************* + * This routine initialize Thunderbolt specific device information */ -void mfi_tbolt_init_globals(struct mfi_softc *sc) +void +mfi_tbolt_init_globals(struct mfi_softc *sc) { /* Initialize single reply size and Message size */ sc->reply_size = MEGASAS_THUNDERBOLT_REPLY_SIZE; @@ -239,16 +239,12 @@ void mfi_tbolt_init_globals(struct mfi_s } /* - **************************************************************************** - * Description: - * This function calculates the memory requirement for Thunderbolt - * controller - * Return Value: - * Total required memory in bytes - **************************************************************************** + * This function calculates the memory requirement for Thunderbolt + * controller, returns the total required memory in bytes */ -uint32_t mfi_tbolt_get_memory_requirement(struct mfi_softc *sc) +uint32_t +mfi_tbolt_get_memory_requirement(struct mfi_softc *sc) { uint32_t size; size = MEGASAS_THUNDERBOLT_MSG_ALLIGNMENT; /* for Alignment */ @@ -260,7 +256,6 @@ uint32_t mfi_tbolt_get_memory_requiremen } /* - **************************************************************************** * Description: * This function will prepare message pools for the Thunderbolt controller * Arguments: @@ -269,9 +264,9 @@ uint32_t mfi_tbolt_get_memory_requiremen * Return Value: * TRUE if successful * FALSE if failed - **************************************************************************** */ -int mfi_tbolt_init_desc_pool(struct mfi_softc *sc, uint8_t* mem_location, +int +mfi_tbolt_init_desc_pool(struct mfi_softc *sc, uint8_t* mem_location, uint32_t tbolt_contg_length) { uint32_t offset = 0; @@ -328,10 +323,7 @@ int mfi_tbolt_init_desc_pool(struct mfi_ } /* - **************************************************************************** - * Description: - * This routine prepare and issue INIT2 frame to the Firmware - **************************************************************************** + * This routine prepare and issue INIT2 frame to the Firmware */ int @@ -442,7 +434,8 @@ mfi_tbolt_init_MFI_queue(struct mfi_soft } -int mfi_tbolt_alloc_cmd(struct mfi_softc *sc) +int +mfi_tbolt_alloc_cmd(struct mfi_softc *sc) { struct mfi_cmd_tbolt *cmd; bus_addr_t io_req_base_phys; @@ -515,7 +508,8 @@ int mfi_tbolt_alloc_cmd(struct mfi_softc return 0; } -int mfi_tbolt_reset(struct mfi_softc *sc) +int +mfi_tbolt_reset(struct mfi_softc *sc) { uint32_t fw_state; @@ -550,7 +544,8 @@ int mfi_tbolt_reset(struct mfi_softc *sc /* * mfi_intr_tbolt - isr entry point */ -void mfi_intr_tbolt(void *arg) +void +mfi_intr_tbolt(void *arg) { struct mfi_softc *sc = (struct mfi_softc *)arg; @@ -568,7 +563,7 @@ void mfi_intr_tbolt(void *arg) return; } -/** +/* * map_cmd_status - Maps FW cmd status to OS cmd status * @cmd : Pointer to cmd * @status : status of cmd returned by FW @@ -581,7 +576,6 @@ map_tbolt_cmd_status(struct mfi_command { switch (status) { - case MFI_STAT_OK: mfi_cmd->cm_frame->header.cmd_status = 0; mfi_cmd->cm_frame->dcmd.header.cmd_status = 0; @@ -614,7 +608,7 @@ map_tbolt_cmd_status(struct mfi_command } } -/** +/* * mfi_tbolt_return_cmd - Return a cmd to free command pool * @instance: Adapter soft state * @cmd: Command packet to be returned to free command pool @@ -627,10 +621,11 @@ mfi_tbolt_return_cmd(struct mfi_softc *s TAILQ_INSERT_TAIL(&sc->mfi_cmd_tbolt_tqh, cmd, next); } -void mfi_tbolt_complete_cmd(struct mfi_softc *sc) +void +mfi_tbolt_complete_cmd(struct mfi_softc *sc) { struct mfi_mpi2_reply_header *desc, *reply_desc; - struct mfi_command *cmd_mfi; /* For MFA Cmds */ + struct mfi_command *cmd_mfi, *cmd_mfi_check; /* For MFA Cmds */ struct mfi_cmd_tbolt *cmd_tbolt; uint16_t smid; uint8_t reply_descript_type; @@ -657,7 +652,6 @@ void mfi_tbolt_complete_cmd(struct mfi_s /* Read Reply descriptor */ while ((val.u.low != 0xFFFFFFFF) && (val.u.high != 0xFFFFFFFF)) { - smid = reply_desc->SMID; if (!smid || smid > sc->mfi_max_fw_cmds + 1) { device_printf(sc->mfi_dev, "smid is %x. Cannot " @@ -669,66 +663,20 @@ void mfi_tbolt_complete_cmd(struct mfi_s cmd_mfi = &sc->mfi_commands[cmd_tbolt->sync_cmd_idx]; scsi_io_req = cmd_tbolt->io_request; - /* Check if internal commands */ status = cmd_mfi->cm_frame->dcmd.header.cmd_status; extStatus = cmd_mfi->cm_frame->dcmd.header.scsi_status; + map_tbolt_cmd_status(cmd_mfi, status, extStatus); - switch (scsi_io_req->Function) { - case MPI2_FUNCTION_LD_IO_REQUEST: - /* Regular Path IO. */ - /* Map the Fw Error Status. */ - map_tbolt_cmd_status(cmd_mfi, status, - extStatus); - if ((cmd_mfi->cm_frame->dcmd.opcode - == MFI_DCMD_LD_MAP_GET_INFO) - && (cmd_mfi->cm_frame->dcmd.mbox[1] == 1)) { - if (cmd_mfi->cm_frame->header.cmd_status - != 0) - device_printf(sc->mfi_dev, - "map sync failed\n"); - else { - sc->map_id++; - device_printf(sc->mfi_dev, - "map sync completed\n"); - mfi_release_command(cmd_mfi); - } - } - if ((cmd_mfi->cm_flags & MFI_ON_MFIQ_BUSY) - == MFI_ON_MFIQ_BUSY - && (cmd_mfi->cm_flags & MFI_CMD_POLLED) == 0) { - /* BHARAT poll workaround */ - mfi_remove_busy(cmd_mfi); - cmd_mfi->cm_error = 0; - mfi_complete(sc, cmd_mfi); - } - mfi_tbolt_return_cmd(sc, cmd_tbolt); - break; - case MPI2_FUNCTION_PASSTHRU_IO_REQUEST: - map_tbolt_cmd_status(cmd_mfi, status, extStatus); - if ((cmd_mfi->cm_frame->dcmd.opcode - == MFI_DCMD_LD_MAP_GET_INFO) - && (cmd_mfi->cm_frame->dcmd.mbox[1] == 1)) { - if (cmd_mfi->cm_frame->header.cmd_status != 0) - device_printf(sc->mfi_dev, - "map sync failed\n"); - else { - sc->map_id++; - device_printf(sc->mfi_dev, - "map sync completed\n"); - mfi_release_command(cmd_mfi); - } - } - if ((cmd_mfi->cm_flags & MFI_ON_MFIQ_BUSY) - == MFI_ON_MFIQ_BUSY - && (cmd_mfi->cm_flags & MFI_CMD_POLLED) == 0) { - /* BHARAT poll workaround */ + /* remove command from busy queue if not polled */ + TAILQ_FOREACH(cmd_mfi_check, &sc->mfi_busy, cm_link) { + if (cmd_mfi_check == cmd_mfi) { mfi_remove_busy(cmd_mfi); - cmd_mfi->cm_error = 0; - mfi_complete(sc, cmd_mfi); + break; } - mfi_tbolt_return_cmd(sc, cmd_tbolt); - break; } + cmd_mfi->cm_error = 0; + mfi_complete(sc, cmd_mfi); + mfi_tbolt_return_cmd(sc, cmd_tbolt); sc->last_reply_idx++; if (sc->last_reply_idx >= sc->mfi_max_fw_cmds) { @@ -763,15 +711,15 @@ void mfi_tbolt_complete_cmd(struct mfi_s return; } -/** +/* * mfi_get_cmd - Get a command from the free pool * @instance: Adapter soft state * * Returns a free command from the pool */ -struct mfi_cmd_tbolt *mfi_tbolt_get_cmd(struct mfi_softc - *sc) +struct mfi_cmd_tbolt * +mfi_tbolt_get_cmd(struct mfi_softc *sc) { struct mfi_cmd_tbolt *cmd = NULL; @@ -876,7 +824,8 @@ mfi_tbolt_build_ldio(struct mfi_softc *s * MFI_SECTOR_LEN; } -int mfi_tbolt_is_ldio(struct mfi_command *mfi_cmd) +int +mfi_tbolt_is_ldio(struct mfi_command *mfi_cmd) { if (mfi_cmd->cm_frame->header.cmd == MFI_CMD_LD_READ || mfi_cmd->cm_frame->header.cmd == MFI_CMD_LD_WRITE) @@ -886,7 +835,8 @@ int mfi_tbolt_is_ldio(struct mfi_command } int -mfi_tbolt_build_io(struct mfi_softc *sc, struct mfi_command *mfi_cmd, struct mfi_cmd_tbolt *cmd) +mfi_tbolt_build_io(struct mfi_softc *sc, struct mfi_command *mfi_cmd, + struct mfi_cmd_tbolt *cmd) { uint32_t device_id; uint32_t sge_count; @@ -949,7 +899,7 @@ mfi_tbolt_build_cdb(struct mfi_softc *sc lba_lo = mfi_cmd->cm_frame->io.lba_lo; lba_hi = mfi_cmd->cm_frame->io.lba_hi; - if ((num_lba <= 0xFF) && (lba_lo <= 0x1FFFFF)) { + if (lba_hi == 0 && (num_lba <= 0xFF) && (lba_lo <= 0x1FFFFF)) { if (mfi_cmd->cm_frame->header.cmd == MFI_CMD_LD_WRITE) /* Read 6 or Write 6 */ cdb[0] = (uint8_t) (0x0A); @@ -962,7 +912,7 @@ mfi_tbolt_build_cdb(struct mfi_softc *sc cdb[1] = (uint8_t) ((lba_lo >> 16) & 0x1F); cdb_len = 6; } - else if ((num_lba <= 0xFFFF) && (lba_lo <= 0xFFFFFFFF)) { + else if (lba_hi == 0 && (num_lba <= 0xFFFF) && (lba_lo <= 0xFFFFFFFF)) { if (mfi_cmd->cm_frame->header.cmd == MFI_CMD_LD_WRITE) /* Read 10 or Write 10 */ cdb[0] = (uint8_t) (0x2A); @@ -975,8 +925,7 @@ mfi_tbolt_build_cdb(struct mfi_softc *sc cdb[3] = (uint8_t) (lba_lo >> 16); cdb[2] = (uint8_t) (lba_lo >> 24); cdb_len = 10; - } - else if ((num_lba > 0xFFFF) && (lba_hi == 0)) { + } else if ((num_lba > 0xFFFF) && (lba_hi == 0)) { if (mfi_cmd->cm_frame->header.cmd == MFI_CMD_LD_WRITE) /* Read 12 or Write 12 */ cdb[0] = (uint8_t) (0xAA); @@ -1152,8 +1101,8 @@ mfi_tbolt_send_frame(struct mfi_softc *s cm->cm_timestamp = time_uptime; mfi_enqueue_busy(cm); } - else { - hdr->cmd_status = 0xff; + else { /* still get interrupts for it */ + hdr->cmd_status = MFI_STAT_INVALID_STATUS; hdr->flags |= MFI_FRAME_DONT_POST_IN_REPLY_QUEUE; } @@ -1189,22 +1138,23 @@ mfi_tbolt_send_frame(struct mfi_softc *s return 0; /* This is a polled command, so busy-wait for it to complete. */ - while (hdr->cmd_status == 0xff) { + while (hdr->cmd_status == MFI_STAT_INVALID_STATUS) { DELAY(1000); tm -= 1; if (tm <= 0) - break; + break; } - if (hdr->cmd_status == 0xff) { + if (hdr->cmd_status == MFI_STAT_INVALID_STATUS) { device_printf(sc->mfi_dev, "Frame %p timed out " - "command 0x%X\n", hdr, cm->cm_frame->dcmd.opcode); + "command 0x%X\n", hdr, cm->cm_frame->dcmd.opcode); return (ETIMEDOUT); } return 0; } -static void mfi_issue_pending_cmds_again (struct mfi_softc *sc) +static void +mfi_issue_pending_cmds_again (struct mfi_softc *sc) { struct mfi_command *cm, *tmp; @@ -1249,7 +1199,8 @@ static void mfi_issue_pending_cmds_again mfi_startio(sc); } -static void mfi_kill_hba (struct mfi_softc *sc) +static void +mfi_kill_hba (struct mfi_softc *sc) { if (sc->mfi_flags & MFI_FLAGS_TBOLT) MFI_WRITE4 (sc, 0x00,MFI_STOP_ADP); @@ -1257,7 +1208,8 @@ static void mfi_kill_hba (struct mfi_sof MFI_WRITE4 (sc, MFI_IDB,MFI_STOP_ADP); } -static void mfi_process_fw_state_chg_isr(void *arg) +static void +mfi_process_fw_state_chg_isr(void *arg) { struct mfi_softc *sc= (struct mfi_softc *)arg; struct mfi_cmd_tbolt *cmd; @@ -1308,9 +1260,9 @@ static void mfi_process_fw_state_chg_isr mfi_release_command(sc->mfi_aen_cm); sc->mfi_aen_cm = NULL; } - if (sc->map_update_cmd) { - mfi_release_command(sc->map_update_cmd); - sc->map_update_cmd = NULL; + if (sc->mfi_map_sync_cm) { + mfi_release_command(sc->mfi_map_sync_cm); + sc->mfi_map_sync_cm = NULL; } mfi_issue_pending_cmds_again(sc); @@ -1337,3 +1289,178 @@ static void mfi_process_fw_state_chg_isr } mtx_unlock(&sc->mfi_io_lock); } + +/* + * The ThunderBolt HW has an option for the driver to directly + * access the underlying disks and operate on the RAID. To + * do this there needs to be a capability to keep the RAID controller + * and driver in sync. The FreeBSD driver does not take advantage + * of this feature since it adds a lot of complexity and slows down + * performance. Performance is gained by using the controller's + * cache etc. + * + * Even though this driver doesn't access the disks directly, an + * AEN like command is used to inform the RAID firmware to "sync" + * with all LD's via the MFI_DCMD_LD_MAP_GET_INFO command. This + * command in write mode will return when the RAID firmware has + * detected a change to the RAID state. Examples of this type + * of change are removing a disk. Once the command returns then + * the driver needs to acknowledge this and "sync" all LD's again. + * This repeats until we shutdown. Then we need to cancel this + * pending command. + * + * If this is not done right the RAID firmware will not remove a + * pulled drive and the RAID won't go degraded etc. Effectively, + * stopping any RAID mangement to functions. + * + * Doing another LD sync, requires the use of an event since the + * driver needs to do a mfi_wait_command and can't do that in an + * interrupt thread. + * + * The driver could get the RAID state via the MFI_DCMD_LD_MAP_GET_INFO + * That requires a bunch of structure and it is simplier to just do + * the MFI_DCMD_LD_GET_LIST versus walking the RAID map. + */ + +void +mfi_tbolt_sync_map_info(struct mfi_softc *sc) +{ + int error = 0, i; + struct mfi_command *cmd; + struct mfi_dcmd_frame *dcmd; + uint32_t context = 0; + union mfi_ld_ref *ld_sync; + size_t ld_size; + struct mfi_frame_header *hdr; + struct mfi_command *cm = NULL; + struct mfi_ld_list *list = NULL; + + if (sc->mfi_map_sync_cm != NULL || sc->cm_map_abort) + return; + + mtx_lock(&sc->mfi_io_lock); + error = mfi_dcmd_command(sc, &cm, MFI_DCMD_LD_GET_LIST, + (void **)&list, sizeof(*list)); + if (error) + goto out; + + cm->cm_flags = MFI_CMD_POLLED | MFI_CMD_DATAIN; + if (mfi_wait_command(sc, cm) != 0) { + device_printf(sc->mfi_dev, "Failed to get device listing\n"); + goto out; + } + + hdr = &cm->cm_frame->header; + if (hdr->cmd_status != MFI_STAT_OK) { + device_printf(sc->mfi_dev, "MFI_DCMD_LD_GET_LIST failed %x\n", + hdr->cmd_status); + goto out; + } + + ld_size = sizeof(*ld_sync) * list->ld_count; + mtx_unlock(&sc->mfi_io_lock); + ld_sync = (union mfi_ld_ref *) malloc(ld_size, M_MFIBUF, + M_WAITOK | M_ZERO); + if (ld_sync == NULL) { + device_printf(sc->mfi_dev, "Failed to allocate sync\n"); + goto out; + } + for (i = 0; i < list->ld_count; i++) { + ld_sync[i].ref = list->ld_list[i].ld.ref; + } + + mtx_lock(&sc->mfi_io_lock); + if ((cmd = mfi_dequeue_free(sc)) == NULL) { + device_printf(sc->mfi_dev, "Failed to get command\n"); + free(ld_sync, M_MFIBUF); + goto out; + } + + context = cmd->cm_frame->header.context; + bzero(cmd->cm_frame, sizeof(union mfi_frame)); + cmd->cm_frame->header.context = context; + + dcmd = &cmd->cm_frame->dcmd; + bzero(dcmd->mbox, MFI_MBOX_SIZE); + dcmd->header.cmd = MFI_CMD_DCMD; + dcmd->header.flags = MFI_FRAME_DIR_WRITE; + dcmd->header.timeout = 0; + dcmd->header.data_len = ld_size; + dcmd->header.scsi_status = 0; + dcmd->opcode = MFI_DCMD_LD_MAP_GET_INFO; + cmd->cm_sg = &dcmd->sgl; + cmd->cm_total_frame_size = MFI_DCMD_FRAME_SIZE; + cmd->cm_data = ld_sync; + cmd->cm_private = ld_sync; + + cmd->cm_len = ld_size; + cmd->cm_complete = mfi_sync_map_complete; + sc->mfi_map_sync_cm = cmd; + + cmd->cm_flags = MFI_CMD_DATAOUT; + cmd->cm_frame->dcmd.mbox[0] = list->ld_count; + cmd->cm_frame->dcmd.mbox[1] = MFI_DCMD_MBOX_PEND_FLAG; + + if ((error = mfi_mapcmd(sc, cmd)) != 0) { + device_printf(sc->mfi_dev, "failed to send map sync\n"); + free(ld_sync, M_MFIBUF); + sc->mfi_map_sync_cm = NULL; + mfi_requeue_ready(cmd); + goto out; + } + +out: + if (list) + free(list, M_MFIBUF); + if (cm) + mfi_release_command(cm); + mtx_unlock(&sc->mfi_io_lock); +} + +static void +mfi_sync_map_complete(struct mfi_command *cm) +{ + struct mfi_frame_header *hdr; + struct mfi_softc *sc; + int aborted = 0; + + sc = cm->cm_sc; + mtx_assert(&sc->mfi_io_lock, MA_OWNED); + + hdr = &cm->cm_frame->header; + + if (sc->mfi_map_sync_cm == NULL) + return; + + if (sc->cm_map_abort || + hdr->cmd_status == MFI_STAT_INVALID_STATUS) { + sc->cm_map_abort = 0; + aborted = 1; + } + + free(cm->cm_data, M_MFIBUF); + sc->mfi_map_sync_cm = NULL; + wakeup(&sc->mfi_map_sync_cm); + mfi_release_command(cm); + + /* set it up again so the driver can catch more events */ + if (!aborted) { + mfi_queue_map_sync(sc); + } +} + +static void +mfi_queue_map_sync(struct mfi_softc *sc) +{ + mtx_assert(&sc->mfi_io_lock, MA_OWNED); + taskqueue_enqueue(taskqueue_swi, &sc->mfi_map_sync_task); +} + +void +mfi_handle_map_sync(void *context, int pending) +{ + struct mfi_softc *sc; + + sc = context; + mfi_tbolt_sync_map_info(sc); +} Modified: stable/9/sys/dev/mfi/mfireg.h ============================================================================== --- stable/9/sys/dev/mfi/mfireg.h Mon May 7 18:30:22 2012 (r235134) +++ stable/9/sys/dev/mfi/mfireg.h Mon May 7 19:17:09 2012 (r235135) @@ -403,6 +403,7 @@ typedef enum { #define MR_EVT_CTRL_HOST_BUS_SCAN_REQUESTED 0x0152 #define MR_EVT_PD_REMOVED 0x0070 #define MR_EVT_PD_INSERTED 0x005b +#define MR_EVT_LD_CHANGE 0x0051 typedef enum { MR_LD_CACHE_WRITE_BACK = 0x01, Modified: stable/9/sys/dev/mfi/mfivar.h ============================================================================== --- stable/9/sys/dev/mfi/mfivar.h Mon May 7 18:30:22 2012 (r235134) +++ stable/9/sys/dev/mfi/mfivar.h Mon May 7 19:17:09 2012 (r235135) @@ -105,7 +105,6 @@ struct mfi_command { #define MFI_ON_MFIQ_READY (1<<6) #define MFI_ON_MFIQ_BUSY (1<<7) #define MFI_ON_MFIQ_MASK ((1<<5)|(1<<6)|(1<<7)) - int cm_aen_abort; uint8_t retry_for_fw_reset; void (* cm_complete)(struct mfi_command *cm); void *cm_private; @@ -216,9 +215,13 @@ struct mfi_softc { TAILQ_HEAD(,mfi_evt_queue_elm) mfi_evt_queue; struct task mfi_evt_task; + struct task mfi_map_sync_task; TAILQ_HEAD(,mfi_aen) mfi_aen_pids; struct mfi_command *mfi_aen_cm; struct mfi_command *mfi_skinny_cm; + struct mfi_command *mfi_map_sync_cm; + int cm_aen_abort; + int cm_map_abort; uint32_t mfi_aen_triggered; uint32_t mfi_poll_waiting; uint32_t mfi_boot_seq_num; @@ -303,8 +306,6 @@ struct mfi_softc { /* ThunderBolt */ uint32_t mfi_tbolt; uint32_t MFA_enabled; - uint64_t map_id; - struct mfi_command *map_update_cmd; /* Single Reply structure size */ uint16_t reply_size; /* Singler message size. */ @@ -417,7 +418,10 @@ extern int mfi_tbolt_alloc_cmd(struct mf extern int mfi_tbolt_send_frame(struct mfi_softc *sc, struct mfi_command *cm); extern int mfi_tbolt_adp_reset(struct mfi_softc *sc); extern int mfi_tbolt_reset(struct mfi_softc *sc); -extern int mfi_tbolt_sync_map_info(struct mfi_softc *sc); +extern void mfi_tbolt_sync_map_info(struct mfi_softc *sc); +extern void mfi_handle_map_sync(void *context, int pending); +extern int mfi_dcmd_command(struct mfi_softc *, struct mfi_command **, + uint32_t, void **, size_t); #define MFIQ_ADD(sc, qname) \ do { \ From owner-svn-src-stable-9@FreeBSD.ORG Tue May 8 01:30:43 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B24E8106566B; Tue, 8 May 2012 01:30:43 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from harmony.bsdimp.com (bsdimp.com [199.45.160.85]) by mx1.freebsd.org (Postfix) with ESMTP id 5E14A8FC0A; Tue, 8 May 2012 01:30:43 +0000 (UTC) Received: from [10.0.133.83] (67-210-169.34.static.tel-ott.com [67.210.169.34] (may be forged)) (authenticated bits=0) by harmony.bsdimp.com (8.14.4/8.14.3) with ESMTP id q481TqHH069883 (version=TLSv1/SSLv3 cipher=DHE-DSS-AES128-SHA bits=128 verify=NO); Mon, 7 May 2012 19:30:25 -0600 (MDT) (envelope-from imp@bsdimp.com) Mime-Version: 1.0 (Apple Message framework v1084) Content-Type: text/plain; charset=us-ascii From: Warner Losh In-Reply-To: <201205070927.41775.jhb@freebsd.org> Date: Mon, 7 May 2012 21:29:50 -0400 Content-Transfer-Encoding: quoted-printable Message-Id: References: <201205041538.q44FclqK010547@svn.freebsd.org> <201205042141.55089.hselasky@c2i.net> <80963C87-6F37-4AC7-B5E8-132EC5F47D98@bsdimp.com> <201205070927.41775.jhb@freebsd.org> To: John Baldwin X-Mailer: Apple Mail (2.1084) X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.0.1 (harmony.bsdimp.com [10.0.0.6]); Mon, 07 May 2012 19:30:27 -0600 (MDT) Cc: "svn-src-stable@freebsd.org" , "svn-src-all@freebsd.org" , "src-committers@freebsd.org" , "svn-src-stable-9@freebsd.org" , Hans Petter Selasky Subject: Re: svn commit: r235007 - stable/9/sys/dev/pci X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 May 2012 01:30:43 -0000 On May 7, 2012, at 9:27 AM, John Baldwin wrote: > On Friday, May 04, 2012 5:25:32 pm Warner Losh wrote: >>=20 >> On May 4, 2012, at 1:41 PM, Hans Petter Selasky wrote: >>=20 >>> On Friday 04 May 2012 19:18:56 Warner Losh wrote: >>>> On May 4, 2012, at 10:26 AM, Hans Petter Selasky wrote: >>>>> On Friday 04 May 2012 18:14:16 John Baldwin wrote: >>>>>> On Friday, May 04, 2012 11:38:47 am Hans Petter Selasky wrote: >>>>>>> Author: hselasky >>>>>>> Date: Fri May 4 15:38:47 2012 >>>>>>> New Revision: 235007 >>>>>>> URL: http://svn.freebsd.org/changeset/base/235007 >>>>>>>=20 >>>>>>> Log: >>>>>>> MFC r233662, r233677 and r233678: >>>>>>>=20 >>>>>>> Writing zero to BAR actually does not disable it and >>>>>>> it is even harmful as hselasky found out. Historically, >>>>>>> this code was originated from (OLDCARD) CardBus driver and later >>>>>>> leaked into PCI driver when CardBus was newbus'ified and = refactored >>>>>>> with PCI driver. However, it is not really necessary even for >>>>>>> CardBus. >>>>>>=20 >>>>>> FYI, I've got one bug report on HEAD where these changes broke a >>>>>> machine's ATA controller. >>>>>=20 >>>>> Have you considered adding code to disable the I/O or memory range >>>>> instead of writing 0 to the bar in this case? >>>>=20 >>>> I tried that once upon a time, but was problematical with some = bridges=20 > that >>>> had BARs at non-standard locations that needed the I/O or MEM bit = set in >>>> order to work... >>>>=20 >>>> Warner >>>=20 >>> If the size of the bar is a few megabytes, then moving it to = location 0 is=20 >>> definitely wrong. Else it might work! >>=20 >> Only if the bridge passes the transactions for that memory to the PCI = bus=20 > for decoding. The reason it worked for as long as it did was that we = had=20 > bridges that passed the memory cycles to DRAM for addresses near 0 and = they=20 > didn't make it onto the PCI bus. Except in embedded systems, I fail = to see=20 > how that could have changed in the interim. The physical layout of = x86 has=20 > actual memory at location 0 and it would be a big performance hit to = push=20 > those transactions onto the pci bus, so nobody in their right mind = would do=20 > that. >=20 > Not true. During NEW_PCIB testing I at one point fat-fingered = something such > that I had an memory window on a PCI-PCI bridge claim address 0 and = the boot > promptly hung as soon as that register was written. I'll grant that for bridges... The code in question just does devices = though... Still, something we should avoid... Warner From owner-svn-src-stable-9@FreeBSD.ORG Tue May 8 16:36:33 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 5E82A1065673; Tue, 8 May 2012 16:36:33 +0000 (UTC) (envelope-from jlh@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 487CC8FC12; Tue, 8 May 2012 16:36:33 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q48GaXxP043644; Tue, 8 May 2012 16:36:33 GMT (envelope-from jlh@svn.freebsd.org) Received: (from jlh@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q48GaXBb043637; Tue, 8 May 2012 16:36:33 GMT (envelope-from jlh@svn.freebsd.org) Message-Id: <201205081636.q48GaXBb043637@svn.freebsd.org> From: Jeremie Le Hen Date: Tue, 8 May 2012 16: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 X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r235139 - in stable/9: lib lib/libc/stdio lib/libstdbuf usr.bin usr.bin/stdbuf X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 May 2012 16:36:33 -0000 Author: jlh Date: Tue May 8 16:36:32 2012 New Revision: 235139 URL: http://svn.freebsd.org/changeset/base/235139 Log: MFC r234772: Import stdbuf(1) and the shared library it relies on. This tool changes the default buffering behaviour of standard stdio streams. It only works on dynamic binaries. To make it work for static ones it would require cluttering stdio because there no single entry point. PR: 166660 Reviewed by: current@, jhb Approved by: kib (mentor) MFC after: 1 week MFC r234773: Fix small documentation mistakes. Submitted by: brueffer Approved by: kib (mentor) MFC r234779: Use standard getopt(3) error message. Submitted by: jilles Approved by: kib (mentor) Added: - copied from r234772, head/lib/libstdbuf/ - copied from r234772, head/usr.bin/stdbuf/ Directory Properties: stable/9/lib/libstdbuf/ (props changed) stable/9/usr.bin/stdbuf/ (props changed) Modified: stable/9/lib/Makefile stable/9/lib/libc/stdio/setbuf.3 stable/9/lib/libstdbuf/libstdbuf.3 stable/9/usr.bin/Makefile stable/9/usr.bin/stdbuf/stdbuf.c Directory Properties: stable/9/lib/ (props changed) stable/9/lib/libc/ (props changed) stable/9/usr.bin/ (props changed) Modified: stable/9/lib/Makefile ============================================================================== --- stable/9/lib/Makefile Tue May 8 15:18:35 2012 (r235138) +++ stable/9/lib/Makefile Tue May 8 16:36:32 2012 (r235139) @@ -100,6 +100,7 @@ SUBDIR= ${SUBDIR_ORDERED} \ ${_libsmdb} \ ${_libsmutil} \ libstand \ + libstdbuf \ ${_libtelnet} \ ${_libthr} \ libthread_db \ Modified: stable/9/lib/libc/stdio/setbuf.3 ============================================================================== --- stable/9/lib/libc/stdio/setbuf.3 Tue May 8 15:18:35 2012 (r235138) +++ stable/9/lib/libc/stdio/setbuf.3 Tue May 8 16:36:32 2012 (r235139) @@ -83,6 +83,9 @@ normally does) it is line buffered. The standard error stream .Dv stderr is always unbuffered. +Note that these defaults may be altered using the +.Xr stdbuf 1 +utility. .Pp The .Fn setvbuf @@ -177,6 +180,7 @@ function returns what the equivalent .Fn setvbuf would have returned. .Sh SEE ALSO +.Xr stdbuf 1 , .Xr fclose 3 , .Xr fopen 3 , .Xr fread 3 , Modified: stable/9/lib/libstdbuf/libstdbuf.3 ============================================================================== --- head/lib/libstdbuf/libstdbuf.3 Sat Apr 28 20:52:20 2012 (r234772) +++ stable/9/lib/libstdbuf/libstdbuf.3 Tue May 8 16:36:32 2012 (r235139) @@ -43,7 +43,7 @@ an utility, .Xr stdbuf 1 , can be used to run a command with the appropriate environment variables. .Sh ENVIRONMENT -Each stream can be configured indepentently through the following +Each stream can be configured independently through the following environment variables (values are defined below): .Bl -tag -width size -offset indent .It Ev _STDBUF_I Modified: stable/9/usr.bin/Makefile ============================================================================== --- stable/9/usr.bin/Makefile Tue May 8 15:18:35 2012 (r235138) +++ stable/9/usr.bin/Makefile Tue May 8 16:36:32 2012 (r235139) @@ -143,6 +143,7 @@ SUBDIR= alias \ sockstat \ split \ stat \ + stdbuf \ su \ systat \ tabs \ Modified: stable/9/usr.bin/stdbuf/stdbuf.c ============================================================================== --- head/usr.bin/stdbuf/stdbuf.c Sat Apr 28 20:52:20 2012 (r234772) +++ stable/9/usr.bin/stdbuf/stdbuf.c Tue May 8 16:36:32 2012 (r235139) @@ -52,7 +52,7 @@ main(int argc, char *argv[]) int i; ibuf = obuf = ebuf = NULL; - while ((i = getopt(argc, argv, ":e:i:o:")) != -1) { + while ((i = getopt(argc, argv, "e:i:o:")) != -1) { switch (i) { case 'e': ebuf = optarg; @@ -63,13 +63,8 @@ main(int argc, char *argv[]) case 'o': obuf = optarg; break; - case ':': - warnx("Missing argument for option -%c", optopt); - usage(1); - break; case '?': default: - warnx("Unknown option: %c", optopt); usage(1); break; } From owner-svn-src-stable-9@FreeBSD.ORG Wed May 9 00:56:51 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id E310D10656F6; Wed, 9 May 2012 00:56:51 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CC79F8FC17; Wed, 9 May 2012 00:56:51 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q490up07059040; Wed, 9 May 2012 00:56:51 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q490up4O059037; Wed, 9 May 2012 00:56:51 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201205090056.q490up4O059037@svn.freebsd.org> From: Eitan Adler Date: Wed, 9 May 2012 00:56:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r235149 - in stable/9/share/man: man5 man7 X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 May 2012 00:56:52 -0000 Author: eadler Date: Wed May 9 00:56:51 2012 New Revision: 235149 URL: http://svn.freebsd.org/changeset/base/235149 Log: MFC r234935: Prefer the use of csup to cvsup when talking about the binary. PR: docs/167459 Approved by: cperciva (implicit) Modified: stable/9/share/man/man5/make.conf.5 stable/9/share/man/man7/development.7 Directory Properties: stable/9/share/man/man5/ (props changed) stable/9/share/man/man7/ (props changed) Modified: stable/9/share/man/man5/make.conf.5 ============================================================================== --- stable/9/share/man/man5/make.conf.5 Wed May 9 00:56:26 2012 (r235148) +++ stable/9/share/man/man5/make.conf.5 Wed May 9 00:56:51 2012 (r235149) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd December 11, 2011 +.Dd May 02, 2012 .Dt MAKE.CONF 5 .Os .Sh NAME @@ -318,7 +318,7 @@ The hostname of the sup server to use wh .It Va SUP_UPDATE .Pq Vt bool Set this to use -.Xr cvsup 1 +.Xr csup 1 to update your .Pa src , ports , doc and Modified: stable/9/share/man/man7/development.7 ============================================================================== --- stable/9/share/man/man7/development.7 Wed May 9 00:56:26 2012 (r235148) +++ stable/9/share/man/man7/development.7 Wed May 9 00:56:51 2012 (r235149) @@ -23,7 +23,7 @@ .\" .\" $FreeBSD$ .\" -.Dd December 21, 2002 +.Dd May 02, 2012 .Dt DEVELOPMENT 7 .Os .Sh NAME @@ -89,7 +89,7 @@ I recommend a partition of at least 5GB. .Pp On the master server, use -.Xr cvsup 1 Pq Pa ports/net/cvsup +.Xr csup 1 to automatically pull down and maintain the .Fx @@ -108,23 +108,23 @@ The job should look something like this (please randomize the time of day!). Note that you can use the -.Xr cvsup 1 +.Xr csup 1 configuration file example directly from .Pa /usr/share/examples without modification by supplying appropriate arguments to -.Xr cvsup 1 . +.Xr csup 1 . .Bd -literal -offset 4n -33 6 * * * /usr/local/bin/cvsup -g -r 20 -L 2 -h cvsup.freebsd.org /usr/share/examples/cvsup/cvs-supfile +33 6 * * * /usr/bin/csup -r 20 -L 2 -h cvsup.freebsd.org /usr/share/examples/cvsup/cvs-supfile .Ed .Pp Run the -.Xr cvsup 1 +.Xr csup 1 manually the first time to pull down the archive. It could take all day depending on how fast your connection is! You will run all -.Xr cvsup 1 +.Xr csup 1 and .Xr cvs 1 operations as @@ -555,7 +555,7 @@ Since the main tree is based on CVS, the former is convenient. .Pp First, you need to modify your -.Xr cvsup 1 +.Xr csup 1 environment to avoid it modifying the local changes you have committed to the repository. It is important to remove the @@ -568,7 +568,7 @@ subdirectory to your .Pa refuse file. For more information, see -.Xr cvsup 1 . +.Xr csup 1 . .Pp The .Fx @@ -598,13 +598,13 @@ For more information on using CVS, see .Pp .Sy WARNING! The -.Xr cvsup 1 +.Xr csup 1 utility may blow away changes made on a local branch in some situations. This has been reported to occur when the master CVS repository is directly manipulated or an RCS file is changed. At this point, -.Xr cvsup 1 +.Xr csup 1 notices that the client and server have entirely different RCS files, so it does a full replace instead of trying to send just deltas. @@ -619,7 +619,7 @@ Bottom line is, if you value your local should back it up before every update. .Sh UPDATING VIA CVS The advantage of using -.Xr cvsup 1 +.Xr csup 1 to maintain an updated copy of the CVS repository instead of using it to maintain source trees directly is that you can then pick and choose when you bring your source tree (or pieces of your From owner-svn-src-stable-9@FreeBSD.ORG Wed May 9 08:18:22 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 9ECFD1065675; Wed, 9 May 2012 08:18:22 +0000 (UTC) (envelope-from pho@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 887B18FC20; Wed, 9 May 2012 08:18:22 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q498IMop073277; Wed, 9 May 2012 08:18:22 GMT (envelope-from pho@svn.freebsd.org) Received: (from pho@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q498IMRi073275; Wed, 9 May 2012 08:18:22 GMT (envelope-from pho@svn.freebsd.org) Message-Id: <201205090818.q498IMRi073275@svn.freebsd.org> From: Peter Holm Date: Wed, 9 May 2012 08:18:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r235157 - stable/9/sys/dev/sound/pcm X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 May 2012 08:18:22 -0000 Author: pho Date: Wed May 9 08:18:22 2012 New Revision: 235157 URL: http://svn.freebsd.org/changeset/base/235157 Log: MFC: r234932 Added D_TRACKCLOSE to sndstat_cdevsw to fix the situation when another process is in open() or stat() for the device node, then close() from the owning process does not result in cdevsw close method call. This fixes the pemanent "Device busy" seen. Changed the sndstat_lock from mutex to sx. This allows to extend the region covered by the lock, to include the uiomove() call in sndstat_read() and bufptr increment. This fixes the "panic: sbuf_put_byte called with finished or corrupt sbuf" seen. Modified: stable/9/sys/dev/sound/pcm/sndstat.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/dev/sound/pcm/sndstat.c ============================================================================== --- stable/9/sys/dev/sound/pcm/sndstat.c Wed May 9 08:07:08 2012 (r235156) +++ stable/9/sys/dev/sound/pcm/sndstat.c Wed May 9 08:18:22 2012 (r235157) @@ -53,6 +53,7 @@ static struct cdevsw sndstat_cdevsw = { .d_close = sndstat_close, .d_read = sndstat_read, .d_name = "sndstat", + .d_flags = D_TRACKCLOSE, }; struct sndstat_entry { @@ -63,7 +64,7 @@ struct sndstat_entry { int type, unit; }; -static struct mtx sndstat_lock; +static struct sx sndstat_lock; static struct sbuf sndstat_sbuf; static struct cdev *sndstat_dev = NULL; static int sndstat_bufptr = -1; @@ -93,16 +94,14 @@ sysctl_hw_snd_sndstat_pid(SYSCTL_HANDLER if (sndstat_dev == NULL) return (EINVAL); - mtx_lock(&sndstat_lock); + sx_xlock(&sndstat_lock); val = (int)SNDSTAT_PID(sndstat_dev); - mtx_unlock(&sndstat_lock); err = sysctl_handle_int(oidp, &val, 0, req); if (err == 0 && req->newptr != NULL && val == 0) { - mtx_lock(&sndstat_lock); SNDSTAT_FLUSH(); SNDSTAT_PID_SET(sndstat_dev, 0); - mtx_unlock(&sndstat_lock); } + sx_unlock(&sndstat_lock); return (err); } SYSCTL_PROC(_hw_snd, OID_AUTO, sndstat_pid, CTLTYPE_INT | CTLFLAG_RW, @@ -119,12 +118,10 @@ sysctl_hw_sndverbose(SYSCTL_HANDLER_ARGS verbose = snd_verbose; error = sysctl_handle_int(oidp, &verbose, 0, req); if (error == 0 && req->newptr != NULL) { - mtx_lock(&sndstat_lock); if (verbose < 0 || verbose > 4) error = EINVAL; else snd_verbose = verbose; - mtx_unlock(&sndstat_lock); } return error; } @@ -137,20 +134,19 @@ sndstat_open(struct cdev *i_dev, int fla if (sndstat_dev == NULL || i_dev != sndstat_dev) return EBADF; - mtx_lock(&sndstat_lock); + sx_xlock(&sndstat_lock); if (SNDSTAT_PID(i_dev) != 0) { - mtx_unlock(&sndstat_lock); + sx_unlock(&sndstat_lock); return EBUSY; } SNDSTAT_PID_SET(i_dev, td->td_proc->p_pid); - mtx_unlock(&sndstat_lock); if (sbuf_new(&sndstat_sbuf, NULL, 4096, SBUF_AUTOEXTEND) == NULL) { - mtx_lock(&sndstat_lock); SNDSTAT_PID_SET(i_dev, 0); - mtx_unlock(&sndstat_lock); + sx_unlock(&sndstat_lock); return ENXIO; } sndstat_bufptr = 0; + sx_unlock(&sndstat_lock); return 0; } @@ -160,16 +156,16 @@ sndstat_close(struct cdev *i_dev, int fl if (sndstat_dev == NULL || i_dev != sndstat_dev) return EBADF; - mtx_lock(&sndstat_lock); + sx_xlock(&sndstat_lock); if (SNDSTAT_PID(i_dev) == 0) { - mtx_unlock(&sndstat_lock); + sx_unlock(&sndstat_lock); return EBADF; } SNDSTAT_FLUSH(); SNDSTAT_PID_SET(i_dev, 0); - mtx_unlock(&sndstat_lock); + sx_unlock(&sndstat_lock); return 0; } @@ -182,20 +178,18 @@ sndstat_read(struct cdev *i_dev, struct if (sndstat_dev == NULL || i_dev != sndstat_dev) return EBADF; - mtx_lock(&sndstat_lock); + sx_xlock(&sndstat_lock); if (SNDSTAT_PID(i_dev) != buf->uio_td->td_proc->p_pid || sndstat_bufptr == -1) { - mtx_unlock(&sndstat_lock); + sx_unlock(&sndstat_lock); return EBADF; } - mtx_unlock(&sndstat_lock); if (sndstat_bufptr == 0) { err = (sndstat_prepare(&sndstat_sbuf) > 0) ? 0 : ENOMEM; if (err) { - mtx_lock(&sndstat_lock); SNDSTAT_FLUSH(); - mtx_unlock(&sndstat_lock); + sx_unlock(&sndstat_lock); return err; } } @@ -203,6 +197,7 @@ sndstat_read(struct cdev *i_dev, struct l = min(buf->uio_resid, sbuf_len(&sndstat_sbuf) - sndstat_bufptr); err = (l > 0)? uiomove(sbuf_data(&sndstat_sbuf) + sndstat_bufptr, l, buf) : 0; sndstat_bufptr += l; + sx_unlock(&sndstat_lock); return err; } @@ -228,13 +223,13 @@ sndstat_acquire(struct thread *td) if (sndstat_dev == NULL) return EBADF; - mtx_lock(&sndstat_lock); + sx_xlock(&sndstat_lock); if (SNDSTAT_PID(sndstat_dev) != 0) { - mtx_unlock(&sndstat_lock); + sx_unlock(&sndstat_lock); return EBUSY; } SNDSTAT_PID_SET(sndstat_dev, td->td_proc->p_pid); - mtx_unlock(&sndstat_lock); + sx_unlock(&sndstat_lock); return 0; } @@ -244,13 +239,13 @@ sndstat_release(struct thread *td) if (sndstat_dev == NULL) return EBADF; - mtx_lock(&sndstat_lock); + sx_xlock(&sndstat_lock); if (SNDSTAT_PID(sndstat_dev) != td->td_proc->p_pid) { - mtx_unlock(&sndstat_lock); + sx_unlock(&sndstat_lock); return EBADF; } SNDSTAT_PID_SET(sndstat_dev, 0); - mtx_unlock(&sndstat_lock); + sx_unlock(&sndstat_lock); return 0; } @@ -284,12 +279,12 @@ sndstat_register(device_t dev, char *str ent->unit = unit; ent->handler = handler; - mtx_lock(&sndstat_lock); + sx_xlock(&sndstat_lock); SLIST_INSERT_HEAD(&sndstat_devlist, ent, link); if (type == SS_TYPE_MODULE) sndstat_files++; sndstat_maxunit = (unit > sndstat_maxunit)? unit : sndstat_maxunit; - mtx_unlock(&sndstat_lock); + sx_unlock(&sndstat_lock); return 0; } @@ -305,17 +300,17 @@ sndstat_unregister(device_t dev) { struct sndstat_entry *ent; - mtx_lock(&sndstat_lock); + sx_xlock(&sndstat_lock); SLIST_FOREACH(ent, &sndstat_devlist, link) { if (ent->dev == dev) { SLIST_REMOVE(&sndstat_devlist, ent, sndstat_entry, link); - mtx_unlock(&sndstat_lock); + sx_unlock(&sndstat_lock); free(ent, M_DEVBUF); return 0; } } - mtx_unlock(&sndstat_lock); + sx_unlock(&sndstat_lock); return ENXIO; } @@ -325,18 +320,18 @@ sndstat_unregisterfile(char *str) { struct sndstat_entry *ent; - mtx_lock(&sndstat_lock); + sx_xlock(&sndstat_lock); SLIST_FOREACH(ent, &sndstat_devlist, link) { if (ent->dev == NULL && ent->str == str) { SLIST_REMOVE(&sndstat_devlist, ent, sndstat_entry, link); sndstat_files--; - mtx_unlock(&sndstat_lock); + sx_unlock(&sndstat_lock); free(ent, M_DEVBUF); return 0; } } - mtx_unlock(&sndstat_lock); + sx_unlock(&sndstat_lock); return ENXIO; } @@ -399,7 +394,7 @@ sndstat_init(void) { if (sndstat_dev != NULL) return EINVAL; - mtx_init(&sndstat_lock, "sndstat", "sndstat lock", MTX_DEF); + sx_init(&sndstat_lock, "sndstat lock"); sndstat_dev = make_dev(&sndstat_cdevsw, SND_DEV_STATUS, UID_ROOT, GID_WHEEL, 0444, "sndstat"); return 0; @@ -411,20 +406,20 @@ sndstat_uninit(void) if (sndstat_dev == NULL) return EINVAL; - mtx_lock(&sndstat_lock); + sx_xlock(&sndstat_lock); if (SNDSTAT_PID(sndstat_dev) != curthread->td_proc->p_pid) { - mtx_unlock(&sndstat_lock); + sx_unlock(&sndstat_lock); return EBUSY; } - SNDSTAT_FLUSH(); - - mtx_unlock(&sndstat_lock); - + /* XXXPHO: use destroy_dev_sched() */ destroy_dev(sndstat_dev); sndstat_dev = NULL; - mtx_destroy(&sndstat_lock); + SNDSTAT_FLUSH(); + + sx_unlock(&sndstat_lock); + sx_destroy(&sndstat_lock); return 0; } From owner-svn-src-stable-9@FreeBSD.ORG Wed May 9 13:42:53 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 943C51065675; Wed, 9 May 2012 13:42:53 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7C3A88FC08; Wed, 9 May 2012 13:42:53 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q49DgrMx085370; Wed, 9 May 2012 13:42:53 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q49Dgr9J085359; Wed, 9 May 2012 13:42:53 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201205091342.q49Dgr9J085359@svn.freebsd.org> From: Michael Tuexen Date: Wed, 9 May 2012 13:42:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r235164 - stable/9/sys/netinet X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 May 2012 13:42:53 -0000 Author: tuexen Date: Wed May 9 13:42:52 2012 New Revision: 235164 URL: http://svn.freebsd.org/changeset/base/235164 Log: MFC r234995: Use SCTP_PRINTF() instead of printf() in all SCTP sources. Modified: stable/9/sys/netinet/sctp_auth.c stable/9/sys/netinet/sctp_bsd_addr.c stable/9/sys/netinet/sctp_cc_functions.c stable/9/sys/netinet/sctp_crc32.c stable/9/sys/netinet/sctp_indata.c stable/9/sys/netinet/sctp_input.c stable/9/sys/netinet/sctp_os_bsd.h stable/9/sys/netinet/sctp_output.c stable/9/sys/netinet/sctp_pcb.c stable/9/sys/netinet/sctputil.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/netinet/sctp_auth.c ============================================================================== --- stable/9/sys/netinet/sctp_auth.c Wed May 9 13:08:26 2012 (r235163) +++ stable/9/sys/netinet/sctp_auth.c Wed May 9 13:42:52 2012 (r235164) @@ -284,16 +284,16 @@ sctp_print_key(sctp_key_t * key, const c uint32_t i; if (key == NULL) { - printf("%s: [Null key]\n", str); + SCTP_PRINTF("%s: [Null key]\n", str); return; } - printf("%s: len %u, ", str, key->keylen); + SCTP_PRINTF("%s: len %u, ", str, key->keylen); if (key->keylen) { for (i = 0; i < key->keylen; i++) - printf("%02x", key->key[i]); - printf("\n"); + SCTP_PRINTF("%02x", key->key[i]); + SCTP_PRINTF("\n"); } else { - printf("[Null key]\n"); + SCTP_PRINTF("[Null key]\n"); } } @@ -303,16 +303,16 @@ sctp_show_key(sctp_key_t * key, const ch uint32_t i; if (key == NULL) { - printf("%s: [Null key]\n", str); + SCTP_PRINTF("%s: [Null key]\n", str); return; } - printf("%s: len %u, ", str, key->keylen); + SCTP_PRINTF("%s: len %u, ", str, key->keylen); if (key->keylen) { for (i = 0; i < key->keylen; i++) - printf("%02x", key->key[i]); - printf("\n"); + SCTP_PRINTF("%02x", key->key[i]); + SCTP_PRINTF("\n"); } else { - printf("[Null key]\n"); + SCTP_PRINTF("[Null key]\n"); } } Modified: stable/9/sys/netinet/sctp_bsd_addr.c ============================================================================== --- stable/9/sys/netinet/sctp_bsd_addr.c Wed May 9 13:08:26 2012 (r235163) +++ stable/9/sys/netinet/sctp_bsd_addr.c Wed May 9 13:42:52 2012 (r235164) @@ -483,7 +483,7 @@ again_locked: } /* Sanity check */ if (thisend >= SCTP_PACKET_LOG_SIZE) { - printf("Insanity stops a log thisbegin:%d thisend:%d writers:%d lock:%d end:%d\n", + SCTP_PRINTF("Insanity stops a log thisbegin:%d thisend:%d writers:%d lock:%d end:%d\n", thisbegin, thisend, SCTP_BASE_VAR(packet_log_writers), Modified: stable/9/sys/netinet/sctp_cc_functions.c ============================================================================== --- stable/9/sys/netinet/sctp_cc_functions.c Wed May 9 13:08:26 2012 (r235163) +++ stable/9/sys/netinet/sctp_cc_functions.c Wed May 9 13:42:52 2012 (r235164) @@ -1594,9 +1594,7 @@ sctp_hs_cwnd_increase(struct sctp_tcb *s cur_val = net->cwnd >> 10; indx = SCTP_HS_TABLE_SIZE - 1; -#ifdef SCTP_DEBUG - printf("HS CC CAlled.\n"); -#endif + if (cur_val < sctp_cwnd_adjust[0].cwnd) { /* normal mode */ if (net->net_ack > net->mtu) { Modified: stable/9/sys/netinet/sctp_crc32.c ============================================================================== --- stable/9/sys/netinet/sctp_crc32.c Wed May 9 13:08:26 2012 (r235163) +++ stable/9/sys/netinet/sctp_crc32.c Wed May 9 13:42:52 2012 (r235164) @@ -134,7 +134,7 @@ sctp_delayed_cksum(struct mbuf *m, uint3 offset += offsetof(struct sctphdr, checksum); if (offset + sizeof(uint32_t) > (uint32_t) (m->m_len)) { - printf("sctp_delayed_cksum(): m->len: %d, off: %d.\n", + SCTP_PRINTF("sctp_delayed_cksum(): m->len: %d, off: %d.\n", (uint32_t) m->m_len, offset); /* * XXX this shouldn't happen, but if it does, the correct Modified: stable/9/sys/netinet/sctp_indata.c ============================================================================== --- stable/9/sys/netinet/sctp_indata.c Wed May 9 13:08:26 2012 (r235163) +++ stable/9/sys/netinet/sctp_indata.c Wed May 9 13:42:52 2012 (r235164) @@ -328,7 +328,7 @@ sctp_mark_non_revokable(struct sctp_asso } SCTP_CALC_TSN_TO_GAP(gap, tsn, asoc->mapping_array_base_tsn); if (!SCTP_IS_TSN_PRESENT(asoc->mapping_array, gap)) { - printf("gap:%x tsn:%x\n", gap, tsn); + SCTP_PRINTF("gap:%x tsn:%x\n", gap, tsn); sctp_print_mapping_array(asoc); #ifdef INVARIANTS panic("Things are really messed up now!!"); @@ -2308,7 +2308,7 @@ sctp_slide_mapping_arrays(struct sctp_tc #ifdef INVARIANTS for (i = 0; i < asoc->mapping_array_size; i++) { if ((asoc->mapping_array[i]) || (asoc->nr_mapping_array[i])) { - printf("Error Mapping array's not clean at clear\n"); + SCTP_PRINTF("Error Mapping array's not clean at clear\n"); sctp_print_mapping_array(asoc); } } @@ -2330,7 +2330,7 @@ sctp_slide_mapping_arrays(struct sctp_tc #ifdef INVARIANTS panic("impossible slide"); #else - printf("impossible slide lgap:%x slide_end:%x slide_from:%x? at:%d\n", + SCTP_PRINTF("impossible slide lgap:%x slide_end:%x slide_from:%x? at:%d\n", lgap, slide_end, slide_from, at); return; #endif @@ -2339,7 +2339,7 @@ sctp_slide_mapping_arrays(struct sctp_tc #ifdef INVARIANTS panic("would overrun buffer"); #else - printf("Gak, would have overrun map end:%d slide_end:%d\n", + SCTP_PRINTF("Gak, would have overrun map end:%d slide_end:%d\n", asoc->mapping_array_size, slide_end); slide_end = asoc->mapping_array_size; #endif @@ -3489,7 +3489,10 @@ sctp_strike_gap_ack_chunks(struct sctp_t continue; } } - /* printf("OK, we are now ready to FR this guy\n"); */ + /* + * SCTP_PRINTF("OK, we are now ready to FR this + * guy\n"); + */ if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_FR_LOGGING_ENABLE) { sctp_log_fr(tp1->rec.data.TSN_seq, tp1->snd_count, 0, SCTP_FR_MARKED); @@ -3557,7 +3560,7 @@ sctp_strike_gap_ack_chunks(struct sctp_t tot_retrans++; /* mark the sending seq for possible subsequent FR's */ /* - * printf("Marking TSN for FR new value %x\n", + * SCTP_PRINTF("Marking TSN for FR new value %x\n", * (uint32_t)tpi->rec.data.TSN_seq); */ if (TAILQ_EMPTY(&asoc->send_queue)) { @@ -3709,11 +3712,10 @@ sctp_fs_audit(struct sctp_association *a TAILQ_FOREACH(chk, &asoc->sent_queue, sctp_next) { if (chk->sent < SCTP_DATAGRAM_RESEND) { - printf("Chk TSN:%u size:%d inflight cnt:%d\n", + SCTP_PRINTF("Chk TSN:%u size:%d inflight cnt:%d\n", chk->rec.data.TSN_seq, chk->send_size, - chk->snd_count - ); + chk->snd_count); inflight++; } else if (chk->sent == SCTP_DATAGRAM_RESEND) { resend++; @@ -3730,7 +3732,7 @@ sctp_fs_audit(struct sctp_association *a #ifdef INVARIANTS panic("Flight size-express incorrect? \n"); #else - printf("asoc->total_flight:%d cnt:%d\n", + SCTP_PRINTF("asoc->total_flight:%d cnt:%d\n", entry_flight, entry_cnt); SCTP_PRINTF("Flight size-express incorrect F:%d I:%d R:%d Ab:%d ACK:%d\n", @@ -3895,7 +3897,7 @@ sctp_express_handle_sack(struct sctp_tcb TAILQ_FOREACH_SAFE(tp1, &asoc->sent_queue, sctp_next, tp2) { if (SCTP_TSN_GE(cumack, tp1->rec.data.TSN_seq)) { if (tp1->sent == SCTP_DATAGRAM_UNSENT) { - printf("Warning, an unsent is now acked?\n"); + SCTP_PRINTF("Warning, an unsent is now acked?\n"); } if (tp1->sent < SCTP_DATAGRAM_ACKED) { /* @@ -4437,10 +4439,10 @@ sctp_handle_sack(struct mbuf *m, int off * no way, we have not even sent this TSN out yet. * Peer is hopelessly messed up with us. */ - printf("NEW cum_ack:%x send_s:%x is smaller or equal\n", + SCTP_PRINTF("NEW cum_ack:%x send_s:%x is smaller or equal\n", cum_ack, send_s); if (tp1) { - printf("Got send_s from tsn:%x + 1 of tp1:%p\n", + SCTP_PRINTF("Got send_s from tsn:%x + 1 of tp1:%p\n", tp1->rec.data.TSN_seq, tp1); } hopeless_peer: @@ -4681,10 +4683,8 @@ sctp_handle_sack(struct mbuf *m, int off * peer is either confused or we are under * attack. We must abort. */ - printf("Hopeless peer! biggest_tsn_acked:%x largest seq:%x\n", - biggest_tsn_acked, - send_s); - + SCTP_PRINTF("Hopeless peer! biggest_tsn_acked:%x largest seq:%x\n", + biggest_tsn_acked, send_s); goto hopeless_peer; } } @@ -4719,7 +4719,7 @@ sctp_handle_sack(struct mbuf *m, int off } if (tp1->sent == SCTP_DATAGRAM_UNSENT) { /* no more sent on list */ - printf("Warning, tp1->sent == %d and its now acked?\n", + SCTP_PRINTF("Warning, tp1->sent == %d and its now acked?\n", tp1->sent); } TAILQ_REMOVE(&asoc->sent_queue, tp1, sctp_next); Modified: stable/9/sys/netinet/sctp_input.c ============================================================================== --- stable/9/sys/netinet/sctp_input.c Wed May 9 13:08:26 2012 (r235163) +++ stable/9/sys/netinet/sctp_input.c Wed May 9 13:42:52 2012 (r235164) @@ -786,12 +786,12 @@ sctp_handle_abort(struct sctp_abort_chun sctp_abort_notification(stcb, 0, SCTP_SO_NOT_LOCKED); /* free the tcb */ #if defined(SCTP_PANIC_ON_ABORT) - printf("stcb:%p state:%d rport:%d net:%p\n", + SCTP_PRINTF("stcb:%p state:%d rport:%d net:%p\n", stcb, stcb->asoc.state, stcb->rport, net); if (!(stcb->asoc.state & SCTP_STATE_CLOSED_SOCKET)) { panic("Received an ABORT"); } else { - printf("No panic its in state %x closed\n", stcb->asoc.state); + SCTP_PRINTF("No panic its in state %x closed\n", stcb->asoc.state); } #endif SCTP_STAT_INCR_COUNTER32(sctps_aborted); @@ -5792,9 +5792,9 @@ static void sctp_print_mbuf_chain(struct mbuf *m) { for (; m; m = SCTP_BUF_NEXT(m)) { - printf("%p: m_len = %ld\n", m, SCTP_BUF_LEN(m)); + SCTP_PRINTF("%p: m_len = %ld\n", m, SCTP_BUF_LEN(m)); if (SCTP_BUF_IS_EXTENDED(m)) - printf("%p: extend_size = %d\n", m, SCTP_BUF_EXTEND_SIZE(m)); + SCTP_PRINTF("%p: extend_size = %d\n", m, SCTP_BUF_EXTEND_SIZE(m)); } } Modified: stable/9/sys/netinet/sctp_os_bsd.h ============================================================================== --- stable/9/sys/netinet/sctp_os_bsd.h Wed May 9 13:08:26 2012 (r235163) +++ stable/9/sys/netinet/sctp_os_bsd.h Wed May 9 13:42:52 2012 (r235164) @@ -157,12 +157,13 @@ MALLOC_DECLARE(SCTP_M_MCORE); */ #define USER_ADDR_NULL (NULL) /* FIX ME: temp */ +#define SCTP_PRINTF(params...) printf(params) #if defined(SCTP_DEBUG) #define SCTPDBG(level, params...) \ { \ do { \ if (SCTP_BASE_SYSCTL(sctp_debug_on) & level ) { \ - printf(params); \ + SCTP_PRINTF(params); \ } \ } while (0); \ } @@ -187,7 +188,6 @@ MALLOC_DECLARE(SCTP_M_MCORE); #define SCTPDBG_ADDR(level, addr) #define SCTPDBG_PKT(level, iph, sh) #endif -#define SCTP_PRINTF(params...) printf(params) #ifdef SCTP_LTRACE_CHUNKS #define SCTP_LTRACE_CHK(a, b, c, d) if(SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_LTRACE_CHUNK_ENABLE) SCTP_CTR6(KTR_SUBSYS, "SCTP:%d[%d]:%x-%x-%x-%x", SCTP_LOG_CHUNK_PROC, 0, a, b, c, d) @@ -196,12 +196,14 @@ MALLOC_DECLARE(SCTP_M_MCORE); #endif #ifdef SCTP_LTRACE_ERRORS -#define SCTP_LTRACE_ERR_RET_PKT(m, inp, stcb, net, file, err) if(SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_LTRACE_ERROR_ENABLE) \ - printf("mbuf:%p inp:%p stcb:%p net:%p file:%x line:%d error:%d\n", \ - m, inp, stcb, net, file, __LINE__, err); -#define SCTP_LTRACE_ERR_RET(inp, stcb, net, file, err) if(SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_LTRACE_ERROR_ENABLE) \ - printf("inp:%p stcb:%p net:%p file:%x line:%d error:%d\n", \ - inp, stcb, net, file, __LINE__, err); +#define SCTP_LTRACE_ERR_RET_PKT(m, inp, stcb, net, file, err) \ + if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_LTRACE_ERROR_ENABLE) \ + SCTP_PRINTF("mbuf:%p inp:%p stcb:%p net:%p file:%x line:%d error:%d\n", \ + m, inp, stcb, net, file, __LINE__, err); +#define SCTP_LTRACE_ERR_RET(inp, stcb, net, file, err) \ + if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_LTRACE_ERROR_ENABLE) \ + SCTP_PRINTF("inp:%p stcb:%p net:%p file:%x line:%d error:%d\n", \ + inp, stcb, net, file, __LINE__, err); #else #define SCTP_LTRACE_ERR_RET_PKT(m, inp, stcb, net, file, err) #define SCTP_LTRACE_ERR_RET(inp, stcb, net, file, err) Modified: stable/9/sys/netinet/sctp_output.c ============================================================================== --- stable/9/sys/netinet/sctp_output.c Wed May 9 13:08:26 2012 (r235163) +++ stable/9/sys/netinet/sctp_output.c Wed May 9 13:42:52 2012 (r235164) @@ -3062,7 +3062,7 @@ again_with_private_addresses_allowed: continue; } } else { - printf("Stcb is null - no print\n"); + SCTP_PRINTF("Stcb is null - no print\n"); } atomic_add_int(&sifa->refcount, 1); goto out; @@ -9493,7 +9493,7 @@ sctp_chunk_retransmission(struct sctp_in continue; } if (chk->data == NULL) { - printf("TSN:%x chk->snd_count:%d chk->sent:%d can't retran - no data\n", + SCTP_PRINTF("TSN:%x chk->snd_count:%d chk->sent:%d can't retran - no data\n", chk->rec.data.TSN_seq, chk->snd_count, chk->sent); continue; } @@ -13840,7 +13840,7 @@ out_unlocked: if (inp) { sctp_validate_no_locks(inp); } else { - printf("Warning - inp is NULL so cant validate locks\n"); + SCTP_PRINTF("Warning - inp is NULL so cant validate locks\n"); } #endif if (top) { Modified: stable/9/sys/netinet/sctp_pcb.c ============================================================================== --- stable/9/sys/netinet/sctp_pcb.c Wed May 9 13:08:26 2012 (r235163) +++ stable/9/sys/netinet/sctp_pcb.c Wed May 9 13:42:52 2012 (r235164) @@ -2426,8 +2426,8 @@ sctp_findassociation_ep_asconf(struct mb stcb = sctp_findassoc_by_vtag(NULL, to, ntohl(sh->v_tag), inp_p, netp, sh->src_port, sh->dest_port, 1, vrf_id, 0); /* - * printf("findassociation_ep_asconf: zero lookup address - * finds stcb 0x%x\n", (uint32_t)stcb); + * SCTP_PRINTF("findassociation_ep_asconf: zero lookup + * address finds stcb 0x%x\n", (uint32_t)stcb); */ } else { stcb = sctp_findassociation_ep_addr(inp_p, @@ -5745,7 +5745,7 @@ skip_sleep: if (v6 == 0) { sctp_input_with_port(m, off, 0); } else { - printf("V6 not yet supported\n"); + SCTP_PRINTF("V6 not yet supported\n"); sctp_m_freem(m); } CURVNET_RESTORE(); @@ -6276,8 +6276,8 @@ sctp_load_addresses_from_init(struct sct ptype = ntohs(phdr->param_type); plen = ntohs(phdr->param_length); /* - * printf("ptype => %0x, plen => %d\n", (uint32_t)ptype, - * (int)plen); + * SCTP_PRINTF("ptype => %0x, plen => %d\n", + * (uint32_t)ptype, (int)plen); */ if (offset + plen > limit) { break; Modified: stable/9/sys/netinet/sctputil.c ============================================================================== --- stable/9/sys/netinet/sctputil.c Wed May 9 13:08:26 2012 (r235163) +++ stable/9/sys/netinet/sctputil.c Wed May 9 13:42:52 2012 (r235164) @@ -1127,7 +1127,7 @@ sctp_print_mapping_array(struct sctp_ass { unsigned int i, limit; - printf("Mapping array size: %d, baseTSN: %8.8x, cumAck: %8.8x, highestTSN: (%8.8x, %8.8x).\n", + SCTP_PRINTF("Mapping array size: %d, baseTSN: %8.8x, cumAck: %8.8x, highestTSN: (%8.8x, %8.8x).\n", asoc->mapping_array_size, asoc->mapping_array_base_tsn, asoc->cumulative_tsn, @@ -1138,23 +1138,23 @@ sctp_print_mapping_array(struct sctp_ass break; } } - printf("Renegable mapping array (last %d entries are zero):\n", asoc->mapping_array_size - limit); + SCTP_PRINTF("Renegable mapping array (last %d entries are zero):\n", asoc->mapping_array_size - limit); for (i = 0; i < limit; i++) { - printf("%2.2x%c", asoc->mapping_array[i], ((i + 1) % 16) ? ' ' : '\n'); + SCTP_PRINTF("%2.2x%c", asoc->mapping_array[i], ((i + 1) % 16) ? ' ' : '\n'); } if (limit % 16) - printf("\n"); + SCTP_PRINTF("\n"); for (limit = asoc->mapping_array_size; limit > 1; limit--) { if (asoc->nr_mapping_array[limit - 1]) { break; } } - printf("Non renegable mapping array (last %d entries are zero):\n", asoc->mapping_array_size - limit); + SCTP_PRINTF("Non renegable mapping array (last %d entries are zero):\n", asoc->mapping_array_size - limit); for (i = 0; i < limit; i++) { - printf("%2.2x%c", asoc->nr_mapping_array[i], ((i + 1) % 16) ? ' ' : '\n'); + SCTP_PRINTF("%2.2x%c", asoc->nr_mapping_array[i], ((i + 1) % 16) ? ' ' : '\n'); } if (limit % 16) - printf("\n"); + SCTP_PRINTF("\n"); } int @@ -1292,7 +1292,7 @@ select_a_new_ep: goto no_stcb; } /* If we reach here huh? */ - printf("Unknown it ctl flag %x\n", + SCTP_PRINTF("Unknown it ctl flag %x\n", sctp_it_ctl.iterator_flags); sctp_it_ctl.iterator_flags = 0; } @@ -5392,7 +5392,7 @@ found_one: #ifdef INVARIANTS panic("refcnt already incremented"); #else - printf("refcnt already incremented?\n"); + SCTP_PRINTF("refcnt already incremented?\n"); #endif } else { atomic_add_int(&stcb->asoc.refcnt, 1); From owner-svn-src-stable-9@FreeBSD.ORG Wed May 9 13:47:21 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id AC1CC106566B; Wed, 9 May 2012 13:47:21 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9706B8FC0C; Wed, 9 May 2012 13:47:21 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q49DlLMO085568; Wed, 9 May 2012 13:47:21 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q49DlLIM085566; Wed, 9 May 2012 13:47:21 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201205091347.q49DlLIM085566@svn.freebsd.org> From: Michael Tuexen Date: Wed, 9 May 2012 13:47:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r235165 - stable/9/sys/netinet X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 May 2012 13:47:21 -0000 Author: tuexen Date: Wed May 9 13:47:21 2012 New Revision: 235165 URL: http://svn.freebsd.org/changeset/base/235165 Log: MFC r234996: Call panic() only under INVARIANTS. Modified: stable/9/sys/netinet/sctp_crc32.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/netinet/sctp_crc32.c ============================================================================== --- stable/9/sys/netinet/sctp_crc32.c Wed May 9 13:42:52 2012 (r235164) +++ stable/9/sys/netinet/sctp_crc32.c Wed May 9 13:47:21 2012 (r235165) @@ -124,7 +124,9 @@ void sctp_delayed_cksum(struct mbuf *m, uint32_t offset) { #if defined(SCTP_WITH_NO_CSUM) +#ifdef INVARIANTS panic("sctp_delayed_cksum() called when using no SCTP CRC."); +#endif #else uint32_t checksum; From owner-svn-src-stable-9@FreeBSD.ORG Wed May 9 13:52:24 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 88594106564A; Wed, 9 May 2012 13:52:24 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 72A598FC18; Wed, 9 May 2012 13:52:24 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q49DqOgw085768; Wed, 9 May 2012 13:52:24 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q49DqOne085766; Wed, 9 May 2012 13:52:24 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201205091352.q49DqOne085766@svn.freebsd.org> From: Michael Tuexen Date: Wed, 9 May 2012 13:52:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r235166 - stable/9/lib/libc/net X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 May 2012 13:52:24 -0000 Author: tuexen Date: Wed May 9 13:52:24 2012 New Revision: 235166 URL: http://svn.freebsd.org/changeset/base/235166 Log: MFC r234997: Remove debug output. Modified: stable/9/lib/libc/net/sctp_sys_calls.c Directory Properties: stable/9/lib/libc/ (props changed) Modified: stable/9/lib/libc/net/sctp_sys_calls.c ============================================================================== --- stable/9/lib/libc/net/sctp_sys_calls.c Wed May 9 13:47:21 2012 (r235165) +++ stable/9/lib/libc/net/sctp_sys_calls.c Wed May 9 13:52:24 2012 (r235166) @@ -800,7 +800,6 @@ continue_send: } sinfo->sinfo_assoc_id = sctp_getassocid(sd, addrs); if (sinfo->sinfo_assoc_id == 0) { - printf("Huh, can't get associd? TSNH!\n"); (void)setsockopt(sd, IPPROTO_SCTP, SCTP_CONNECT_X_COMPLETE, (void *)addrs, (socklen_t) addrs->sa_len); errno = ENOENT; From owner-svn-src-stable-9@FreeBSD.ORG Wed May 9 13:57:12 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 539D11065670; Wed, 9 May 2012 13:57:12 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3E1D58FC16; Wed, 9 May 2012 13:57:12 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q49DvC8G085977; Wed, 9 May 2012 13:57:12 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q49DvBq1085973; Wed, 9 May 2012 13:57:12 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201205091357.q49DvBq1085973@svn.freebsd.org> From: Michael Tuexen Date: Wed, 9 May 2012 13:57:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r235167 - stable/9/sys/netinet X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 May 2012 13:57:12 -0000 Author: tuexen Date: Wed May 9 13:57:11 2012 New Revision: 235167 URL: http://svn.freebsd.org/changeset/base/235167 Log: MFC r235009: Add support for SCTP_STREAM_CHANGE_EVENT, SCTP_ASSOC_RESET_EVENT as required by RFC 6525. This also fixes SCTP_STREAM_RESET_EVENT. Modified: stable/9/sys/netinet/sctp.h stable/9/sys/netinet/sctp_usrreq.c stable/9/sys/netinet/sctputil.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/netinet/sctp.h ============================================================================== --- stable/9/sys/netinet/sctp.h Wed May 9 13:52:24 2012 (r235166) +++ stable/9/sys/netinet/sctp.h Wed May 9 13:57:11 2012 (r235167) @@ -511,35 +511,37 @@ struct sctp_error_unrecognized_chunk { /* * PCB Features (in sctp_features bitmask) */ -#define SCTP_PCB_FLAGS_DO_NOT_PMTUD 0x00000001 -#define SCTP_PCB_FLAGS_EXT_RCVINFO 0x00000002 /* deprecated */ -#define SCTP_PCB_FLAGS_DONOT_HEARTBEAT 0x00000004 -#define SCTP_PCB_FLAGS_FRAG_INTERLEAVE 0x00000008 -#define SCTP_PCB_FLAGS_INTERLEAVE_STRMS 0x00000010 -#define SCTP_PCB_FLAGS_DO_ASCONF 0x00000020 -#define SCTP_PCB_FLAGS_AUTO_ASCONF 0x00000040 -#define SCTP_PCB_FLAGS_ZERO_COPY_ACTIVE 0x00000080 +#define SCTP_PCB_FLAGS_DO_NOT_PMTUD 0x00000001 +#define SCTP_PCB_FLAGS_EXT_RCVINFO 0x00000002 /* deprecated */ +#define SCTP_PCB_FLAGS_DONOT_HEARTBEAT 0x00000004 +#define SCTP_PCB_FLAGS_FRAG_INTERLEAVE 0x00000008 +#define SCTP_PCB_FLAGS_INTERLEAVE_STRMS 0x00000010 +#define SCTP_PCB_FLAGS_DO_ASCONF 0x00000020 +#define SCTP_PCB_FLAGS_AUTO_ASCONF 0x00000040 +#define SCTP_PCB_FLAGS_ZERO_COPY_ACTIVE 0x00000080 /* socket options */ -#define SCTP_PCB_FLAGS_NODELAY 0x00000100 -#define SCTP_PCB_FLAGS_AUTOCLOSE 0x00000200 -#define SCTP_PCB_FLAGS_RECVDATAIOEVNT 0x00000400 /* deprecated */ -#define SCTP_PCB_FLAGS_RECVASSOCEVNT 0x00000800 -#define SCTP_PCB_FLAGS_RECVPADDREVNT 0x00001000 -#define SCTP_PCB_FLAGS_RECVPEERERR 0x00002000 -#define SCTP_PCB_FLAGS_RECVSENDFAILEVNT 0x00004000 -#define SCTP_PCB_FLAGS_RECVSHUTDOWNEVNT 0x00008000 -#define SCTP_PCB_FLAGS_ADAPTATIONEVNT 0x00010000 -#define SCTP_PCB_FLAGS_PDAPIEVNT 0x00020000 -#define SCTP_PCB_FLAGS_AUTHEVNT 0x00040000 -#define SCTP_PCB_FLAGS_STREAM_RESETEVNT 0x00080000 -#define SCTP_PCB_FLAGS_NO_FRAGMENT 0x00100000 -#define SCTP_PCB_FLAGS_EXPLICIT_EOR 0x00400000 -#define SCTP_PCB_FLAGS_NEEDS_MAPPED_V4 0x00800000 -#define SCTP_PCB_FLAGS_MULTIPLE_ASCONFS 0x01000000 -#define SCTP_PCB_FLAGS_PORTREUSE 0x02000000 -#define SCTP_PCB_FLAGS_DRYEVNT 0x04000000 -#define SCTP_PCB_FLAGS_RECVRCVINFO 0x08000000 -#define SCTP_PCB_FLAGS_RECVNXTINFO 0x10000000 +#define SCTP_PCB_FLAGS_NODELAY 0x00000100 +#define SCTP_PCB_FLAGS_AUTOCLOSE 0x00000200 +#define SCTP_PCB_FLAGS_RECVDATAIOEVNT 0x00000400 /* deprecated */ +#define SCTP_PCB_FLAGS_RECVASSOCEVNT 0x00000800 +#define SCTP_PCB_FLAGS_RECVPADDREVNT 0x00001000 +#define SCTP_PCB_FLAGS_RECVPEERERR 0x00002000 +#define SCTP_PCB_FLAGS_RECVSENDFAILEVNT 0x00004000 +#define SCTP_PCB_FLAGS_RECVSHUTDOWNEVNT 0x00008000 +#define SCTP_PCB_FLAGS_ADAPTATIONEVNT 0x00010000 +#define SCTP_PCB_FLAGS_PDAPIEVNT 0x00020000 +#define SCTP_PCB_FLAGS_AUTHEVNT 0x00040000 +#define SCTP_PCB_FLAGS_STREAM_RESETEVNT 0x00080000 +#define SCTP_PCB_FLAGS_NO_FRAGMENT 0x00100000 +#define SCTP_PCB_FLAGS_EXPLICIT_EOR 0x00400000 +#define SCTP_PCB_FLAGS_NEEDS_MAPPED_V4 0x00800000 +#define SCTP_PCB_FLAGS_MULTIPLE_ASCONFS 0x01000000 +#define SCTP_PCB_FLAGS_PORTREUSE 0x02000000 +#define SCTP_PCB_FLAGS_DRYEVNT 0x04000000 +#define SCTP_PCB_FLAGS_RECVRCVINFO 0x08000000 +#define SCTP_PCB_FLAGS_RECVNXTINFO 0x10000000 +#define SCTP_PCB_FLAGS_ASSOC_RESETEVNT 0x20000000 +#define SCTP_PCB_FLAGS_STREAM_CHANGEEVNT 0x40000000 /*- * mobility_features parameters (by micchie).Note @@ -547,9 +549,9 @@ struct sctp_error_unrecognized_chunk { * sctp_mobility_features flags.. not the sctp_features * flags. */ -#define SCTP_MOBILITY_BASE 0x00000001 -#define SCTP_MOBILITY_FASTHANDOFF 0x00000002 -#define SCTP_MOBILITY_PRIM_DELETED 0x00000004 +#define SCTP_MOBILITY_BASE 0x00000001 +#define SCTP_MOBILITY_FASTHANDOFF 0x00000002 +#define SCTP_MOBILITY_PRIM_DELETED 0x00000004 #define SCTP_SMALLEST_PMTU 512 /* smallest pmtu allowed when disabling PMTU Modified: stable/9/sys/netinet/sctp_usrreq.c ============================================================================== --- stable/9/sys/netinet/sctp_usrreq.c Wed May 9 13:52:24 2012 (r235166) +++ stable/9/sys/netinet/sctp_usrreq.c Wed May 9 13:57:11 2012 (r235167) @@ -2983,6 +2983,12 @@ flags_out: SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, ENOTSUP); error = ENOTSUP; break; + case SCTP_ASSOC_RESET_EVENT: + event_type = SCTP_PCB_FLAGS_ASSOC_RESETEVNT; + break; + case SCTP_STREAM_CHANGE_EVENT: + event_type = SCTP_PCB_FLAGS_STREAM_CHANGEEVNT; + break; default: event_type = 0; SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL); @@ -5379,6 +5385,12 @@ sctp_setopt(struct socket *so, int optna SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, ENOTSUP); error = ENOTSUP; break; + case SCTP_ASSOC_RESET_EVENT: + event_type = SCTP_PCB_FLAGS_ASSOC_RESETEVNT; + break; + case SCTP_STREAM_CHANGE_EVENT: + event_type = SCTP_PCB_FLAGS_STREAM_CHANGEEVNT; + break; default: event_type = 0; SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL); Modified: stable/9/sys/netinet/sctputil.c ============================================================================== --- stable/9/sys/netinet/sctputil.c Wed May 9 13:52:24 2012 (r235166) +++ stable/9/sys/netinet/sctputil.c Wed May 9 13:57:11 2012 (r235167) @@ -3214,7 +3214,7 @@ sctp_notify_stream_reset_add(struct sctp struct sctp_stream_change_event *stradd; int len; - if (sctp_stcb_is_feature_off(stcb->sctp_ep, stcb, SCTP_PCB_FLAGS_STREAM_RESETEVNT)) { + if (sctp_stcb_is_feature_off(stcb->sctp_ep, stcb, SCTP_PCB_FLAGS_STREAM_CHANGEEVNT)) { /* event not enabled */ return; } @@ -3275,7 +3275,7 @@ sctp_notify_stream_reset_tsn(struct sctp struct sctp_assoc_reset_event *strasoc; int len; - if (sctp_stcb_is_feature_off(stcb->sctp_ep, stcb, SCTP_PCB_FLAGS_STREAM_RESETEVNT)) { + if (sctp_stcb_is_feature_off(stcb->sctp_ep, stcb, SCTP_PCB_FLAGS_ASSOC_RESETEVNT)) { /* event not enabled */ return; } From owner-svn-src-stable-9@FreeBSD.ORG Wed May 9 14:00:58 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 948AD106564A; Wed, 9 May 2012 14:00:58 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 756148FC0C; Wed, 9 May 2012 14:00:58 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q49E0wdl086164; Wed, 9 May 2012 14:00:58 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q49E0wCS086162; Wed, 9 May 2012 14:00:58 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201205091400.q49E0wCS086162@svn.freebsd.org> From: Michael Tuexen Date: Wed, 9 May 2012 14:00:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r235168 - stable/9/sys/netinet X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 May 2012 14:00:58 -0000 Author: tuexen Date: Wed May 9 14:00:58 2012 New Revision: 235168 URL: http://svn.freebsd.org/changeset/base/235168 Log: MFC r235021: Add support for the SCTP_ENABLE_STREAM_RESET socket option to getsockopt(). This improves the support of RFC 6525. Modified: stable/9/sys/netinet/sctp_usrreq.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/netinet/sctp_usrreq.c ============================================================================== --- stable/9/sys/netinet/sctp_usrreq.c Wed May 9 13:57:11 2012 (r235167) +++ stable/9/sys/netinet/sctp_usrreq.c Wed May 9 14:00:58 2012 (r235168) @@ -3296,6 +3296,33 @@ flags_out: } break; } + case SCTP_ENABLE_STREAM_RESET: + { + struct sctp_assoc_value *av; + + SCTP_CHECK_AND_CAST(av, optval, struct sctp_assoc_value, *optsize); + SCTP_FIND_STCB(inp, stcb, av->assoc_id); + + if (stcb) { + av->assoc_value = (uint32_t) stcb->asoc.local_strreset_support; + SCTP_TCB_UNLOCK(stcb); + } else { + if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) || + (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) || + (av->assoc_id == SCTP_FUTURE_ASSOC)) { + SCTP_INP_RLOCK(inp); + av->assoc_value = (uint32_t) inp->local_strreset_support; + SCTP_INP_RUNLOCK(inp); + } else { + SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL); + error = EINVAL; + } + } + if (error == 0) { + *optsize = sizeof(struct sctp_assoc_value); + } + break; + } default: SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, ENOPROTOOPT); error = ENOPROTOOPT; @@ -4096,7 +4123,6 @@ sctp_setopt(struct socket *so, int optna case SCTP_ENABLE_STREAM_RESET: { struct sctp_assoc_value *av; - uint8_t set_value = 0; SCTP_CHECK_AND_CAST(av, optval, struct sctp_assoc_value, optsize); if (av->assoc_value & (~SCTP_ENABLE_VALUE_MASK)) { @@ -4104,10 +4130,9 @@ sctp_setopt(struct socket *so, int optna error = EINVAL; break; } - set_value = av->assoc_value & SCTP_ENABLE_VALUE_MASK; SCTP_FIND_STCB(inp, stcb, av->assoc_id); if (stcb) { - stcb->asoc.local_strreset_support = set_value; + stcb->asoc.local_strreset_support = (uint8_t) av->assoc_value; SCTP_TCB_UNLOCK(stcb); } else { if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) || @@ -4115,7 +4140,7 @@ sctp_setopt(struct socket *so, int optna (av->assoc_id == SCTP_FUTURE_ASSOC) || (av->assoc_id == SCTP_ALL_ASSOC)) { SCTP_INP_WLOCK(inp); - inp->local_strreset_support = set_value; + inp->local_strreset_support = (uint8_t) av->assoc_value; SCTP_INP_WUNLOCK(inp); } if ((av->assoc_id == SCTP_CURRENT_ASSOC) || @@ -4123,7 +4148,7 @@ sctp_setopt(struct socket *so, int optna SCTP_INP_RLOCK(inp); LIST_FOREACH(stcb, &inp->sctp_asoc_list, sctp_tcblist) { SCTP_TCB_LOCK(stcb); - stcb->asoc.local_strreset_support = set_value; + stcb->asoc.local_strreset_support = (uint8_t) av->assoc_value; SCTP_TCB_UNLOCK(stcb); } SCTP_INP_RUNLOCK(inp); From owner-svn-src-stable-9@FreeBSD.ORG Wed May 9 14:03:50 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id C23251065672; Wed, 9 May 2012 14:03:50 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 92BBB8FC12; Wed, 9 May 2012 14:03:50 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q49E3oNT086300; Wed, 9 May 2012 14:03:50 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q49E3oaC086298; Wed, 9 May 2012 14:03:50 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201205091403.q49E3oaC086298@svn.freebsd.org> From: Michael Tuexen Date: Wed, 9 May 2012 14:03:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r235169 - stable/9/sys/netinet X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 May 2012 14:03:50 -0000 Author: tuexen Date: Wed May 9 14:03:50 2012 New Revision: 235169 URL: http://svn.freebsd.org/changeset/base/235169 Log: MFC r235057: Do error checking for the SCTP_RESET_STREAMS, SCTP_RESET_ASSOC, and SCTP_ADD_STREAMS socket options as specified by RFC 6525. Modified: stable/9/sys/netinet/sctp_usrreq.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/netinet/sctp_usrreq.c ============================================================================== --- stable/9/sys/netinet/sctp_usrreq.c Wed May 9 14:00:58 2012 (r235168) +++ stable/9/sys/netinet/sctp_usrreq.c Wed May 9 14:03:50 2012 (r235169) @@ -4164,7 +4164,6 @@ sctp_setopt(struct socket *so, int optna SCTP_CHECK_AND_CAST(strrst, optval, struct sctp_reset_streams, optsize); SCTP_FIND_STCB(inp, stcb, strrst->srs_assoc_id); - if (stcb == NULL) { SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, ENOENT); error = ENOENT; @@ -4179,15 +4178,6 @@ sctp_setopt(struct socket *so, int optna SCTP_TCB_UNLOCK(stcb); break; } - if (!(stcb->asoc.local_strreset_support & SCTP_ENABLE_RESET_STREAM_REQ)) { - /* - * User did not enable the operation. - */ - SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EPERM); - error = EPERM; - SCTP_TCB_UNLOCK(stcb); - break; - } if (stcb->asoc.stream_reset_outstanding) { SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EALREADY); error = EALREADY; @@ -4246,6 +4236,21 @@ sctp_setopt(struct socket *so, int optna error = ENOENT; break; } + if (stcb->asoc.peer_supports_strreset == 0) { + /* + * Peer does not support the chunk type. + */ + SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EOPNOTSUPP); + error = EOPNOTSUPP; + SCTP_TCB_UNLOCK(stcb); + break; + } + if (stcb->asoc.stream_reset_outstanding) { + SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EALREADY); + error = EALREADY; + SCTP_TCB_UNLOCK(stcb); + break; + } if ((stradd->sas_outstrms == 0) && (stradd->sas_instrms == 0)) { error = EINVAL; @@ -4309,15 +4314,6 @@ sctp_setopt(struct socket *so, int optna SCTP_TCB_UNLOCK(stcb); break; } - if (!(stcb->asoc.local_strreset_support & SCTP_ENABLE_RESET_ASSOC_REQ)) { - /* - * User did not enable the operation. - */ - SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EPERM); - error = EPERM; - SCTP_TCB_UNLOCK(stcb); - break; - } if (stcb->asoc.stream_reset_outstanding) { SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EALREADY); error = EALREADY; From owner-svn-src-stable-9@FreeBSD.ORG Wed May 9 14:07:12 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DE9DE106566B; Wed, 9 May 2012 14:07:12 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C7F4D8FC15; Wed, 9 May 2012 14:07:12 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q49E7C1h086452; Wed, 9 May 2012 14:07:12 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q49E7CaQ086449; Wed, 9 May 2012 14:07:12 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201205091407.q49E7CaQ086449@svn.freebsd.org> From: Michael Tuexen Date: Wed, 9 May 2012 14:07:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r235170 - stable/9/sys/netinet X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 May 2012 14:07:13 -0000 Author: tuexen Date: Wed May 9 14:07:12 2012 New Revision: 235170 URL: http://svn.freebsd.org/changeset/base/235170 Log: MFC r235064: Honor SCTP_ENABLE_STREAM_RESET socket option when processing incoming requests. Fix also the provided result in the response and use names as specified in RFC 6525. Modified: stable/9/sys/netinet/sctp_header.h stable/9/sys/netinet/sctp_input.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/netinet/sctp_header.h ============================================================================== --- stable/9/sys/netinet/sctp_header.h Wed May 9 14:03:50 2012 (r235169) +++ stable/9/sys/netinet/sctp_header.h Wed May 9 14:07:12 2012 (r235170) @@ -499,12 +499,13 @@ struct sctp_stream_reset_add_strm { uint16_t reserved; } SCTP_PACKED; -#define SCTP_STREAM_RESET_NOTHING 0x00000000 /* Nothing for me to do */ -#define SCTP_STREAM_RESET_PERFORMED 0x00000001 /* Did it */ -#define SCTP_STREAM_RESET_REJECT 0x00000002 /* refused to do it */ -#define SCTP_STREAM_RESET_ERROR_STR 0x00000003 /* bad Stream no */ -#define SCTP_STREAM_RESET_TRY_LATER 0x00000004 /* collision, try again */ -#define SCTP_STREAM_RESET_BAD_SEQNO 0x00000005 /* bad str-reset seq no */ +#define SCTP_STREAM_RESET_RESULT_NOTHING_TO_DO 0x00000000 /* XXX: unused */ +#define SCTP_STREAM_RESET_RESULT_PERFORMED 0x00000001 +#define SCTP_STREAM_RESET_RESULT_DENIED 0x00000002 +#define SCTP_STREAM_RESET_RESULT_ERR__WRONG_SSN 0x00000003 /* XXX: unused */ +#define SCTP_STREAM_RESET_RESULT_ERR_IN_PROGRESS 0x00000004 +#define SCTP_STREAM_RESET_RESULT_ERR_BAD_SEQNO 0x00000005 +#define SCTP_STREAM_RESET_RESULT_IN_PROGRESS 0x00000006 /* XXX: unused */ /* * convience structures, note that if you are making a request for specific Modified: stable/9/sys/netinet/sctp_input.c ============================================================================== --- stable/9/sys/netinet/sctp_input.c Wed May 9 14:03:50 2012 (r235169) +++ stable/9/sys/netinet/sctp_input.c Wed May 9 14:07:12 2012 (r235170) @@ -3599,7 +3599,7 @@ sctp_handle_stream_reset_response(struct asoc->stream_reset_out_is_outstanding = 0; if (asoc->stream_reset_outstanding) asoc->stream_reset_outstanding--; - if (action == SCTP_STREAM_RESET_PERFORMED) { + if (action == SCTP_STREAM_RESET_RESULT_PERFORMED) { /* do it */ sctp_reset_out_streams(stcb, number_entries, srparam->list_of_streams); } else { @@ -3610,7 +3610,7 @@ sctp_handle_stream_reset_response(struct number_entries = (lparm_len - sizeof(struct sctp_stream_reset_in_request)) / sizeof(uint16_t); if (asoc->stream_reset_outstanding) asoc->stream_reset_outstanding--; - if (action != SCTP_STREAM_RESET_PERFORMED) { + if (action != SCTP_STREAM_RESET_RESULT_PERFORMED) { sctp_ulp_notify(SCTP_NOTIFY_STR_RESET_FAILED_IN, stcb, number_entries, srparam->list_of_streams, SCTP_SO_NOT_LOCKED); } @@ -3626,7 +3626,7 @@ sctp_handle_stream_reset_response(struct stcb->asoc.strm_pending_add_size = 0; if (asoc->stream_reset_outstanding) asoc->stream_reset_outstanding--; - if (action == SCTP_STREAM_RESET_PERFORMED) { + if (action == SCTP_STREAM_RESET_RESULT_PERFORMED) { /* Put the new streams into effect */ stcb->asoc.streamoutcnt += num_stream; sctp_notify_stream_reset_add(stcb, stcb->asoc.streamincnt, stcb->asoc.streamoutcnt, 0); @@ -3637,7 +3637,7 @@ sctp_handle_stream_reset_response(struct } else if (type == SCTP_STR_RESET_ADD_IN_STREAMS) { if (asoc->stream_reset_outstanding) asoc->stream_reset_outstanding--; - if (action != SCTP_STREAM_RESET_PERFORMED) { + if (action != SCTP_STREAM_RESET_RESULT_PERFORMED) { sctp_notify_stream_reset_add(stcb, stcb->asoc.streamincnt, stcb->asoc.streamoutcnt, SCTP_STREAM_CHANGED_DENIED); } @@ -3655,7 +3655,7 @@ sctp_handle_stream_reset_response(struct /* huh ? */ return (0); } - if (action == SCTP_STREAM_RESET_PERFORMED) { + if (action == SCTP_STREAM_RESET_RESULT_PERFORMED) { resp = (struct sctp_stream_reset_response_tsn *)respin; asoc->stream_reset_outstanding--; fwdtsn.ch.chunk_length = htons(sizeof(struct sctp_forward_tsn_chunk)); @@ -3714,10 +3714,12 @@ sctp_handle_str_reset_request_in(struct seq = ntohl(req->request_seq); if (asoc->str_reset_seq_in == seq) { - if (trunc) { + asoc->last_reset_action[1] = asoc->last_reset_action[0]; + if (!(asoc->local_strreset_support & SCTP_ENABLE_RESET_STREAM_REQ)) { + asoc->last_reset_action[0] = SCTP_STREAM_RESET_RESULT_DENIED; + } else if (trunc) { /* Can't do it, since they exceeded our buffer size */ - asoc->last_reset_action[1] = asoc->last_reset_action[0]; - asoc->last_reset_action[0] = SCTP_STREAM_RESET_REJECT; + asoc->last_reset_action[0] = SCTP_STREAM_RESET_RESULT_DENIED; } else if (stcb->asoc.stream_reset_out_is_outstanding == 0) { len = ntohs(req->ph.param_length); number_entries = ((len - sizeof(struct sctp_stream_reset_in_request)) / sizeof(uint16_t)); @@ -3725,9 +3727,7 @@ sctp_handle_str_reset_request_in(struct temp = ntohs(req->list_of_streams[i]); req->list_of_streams[i] = temp; } - /* move the reset action back one */ - asoc->last_reset_action[1] = asoc->last_reset_action[0]; - asoc->last_reset_action[0] = SCTP_STREAM_RESET_PERFORMED; + asoc->last_reset_action[0] = SCTP_STREAM_RESET_RESULT_PERFORMED; sctp_add_stream_reset_out(chk, number_entries, req->list_of_streams, asoc->str_reset_seq_out, seq, (asoc->sending_seq - 1)); @@ -3737,8 +3737,7 @@ sctp_handle_str_reset_request_in(struct stcb->asoc.stream_reset_outstanding++; } else { /* Can't do it, since we have sent one out */ - asoc->last_reset_action[1] = asoc->last_reset_action[0]; - asoc->last_reset_action[0] = SCTP_STREAM_RESET_TRY_LATER; + asoc->last_reset_action[0] = SCTP_STREAM_RESET_RESULT_ERR_IN_PROGRESS; } sctp_add_stream_reset_result(chk, seq, asoc->last_reset_action[0]); asoc->str_reset_seq_in++; @@ -3747,7 +3746,7 @@ sctp_handle_str_reset_request_in(struct } else if (asoc->str_reset_seq_in - 2 == seq) { sctp_add_stream_reset_result(chk, seq, asoc->last_reset_action[1]); } else { - sctp_add_stream_reset_result(chk, seq, SCTP_STREAM_RESET_BAD_SEQNO); + sctp_add_stream_reset_result(chk, seq, SCTP_STREAM_RESET_RESULT_ERR_BAD_SEQNO); } } @@ -3769,7 +3768,13 @@ sctp_handle_str_reset_request_tsn(struct seq = ntohl(req->request_seq); if (asoc->str_reset_seq_in == seq) { - fwdtsn.ch.chunk_length = htons(sizeof(struct sctp_forward_tsn_chunk)); + if (!(asoc->local_strreset_support & SCTP_ENABLE_CHANGE_ASSOC_REQ)) { + stcb->asoc.last_reset_action[1] = stcb->asoc.last_reset_action[0]; + stcb->asoc.last_reset_action[0] = SCTP_STREAM_RESET_RESULT_PERFORMED; + + asoc->last_reset_action[0] = SCTP_STREAM_RESET_RESULT_DENIED; + } else + fwdtsn.ch.chunk_length = htons(sizeof(struct sctp_forward_tsn_chunk)); fwdtsn.ch.chunk_type = SCTP_FORWARD_CUM_TSN; fwdtsn.ch.chunk_flags = 0; fwdtsn.new_cumulative_tsn = htonl(stcb->asoc.highest_tsn_inside_map + 1); @@ -3777,45 +3782,41 @@ sctp_handle_str_reset_request_tsn(struct if (abort_flag) { return (1); } - stcb->asoc.highest_tsn_inside_map += SCTP_STREAM_RESET_TSN_DELTA; + asoc->highest_tsn_inside_map += SCTP_STREAM_RESET_TSN_DELTA; if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_MAP_LOGGING_ENABLE) { sctp_log_map(0, 10, asoc->highest_tsn_inside_map, SCTP_MAP_SLIDE_RESULT); } - stcb->asoc.tsn_last_delivered = stcb->asoc.cumulative_tsn = stcb->asoc.highest_tsn_inside_map; - stcb->asoc.mapping_array_base_tsn = stcb->asoc.highest_tsn_inside_map + 1; - memset(stcb->asoc.mapping_array, 0, stcb->asoc.mapping_array_size); - stcb->asoc.highest_tsn_inside_nr_map = stcb->asoc.highest_tsn_inside_map; - memset(stcb->asoc.nr_mapping_array, 0, stcb->asoc.mapping_array_size); - atomic_add_int(&stcb->asoc.sending_seq, 1); + asoc->tsn_last_delivered = asoc->cumulative_tsn = asoc->highest_tsn_inside_map; + asoc->mapping_array_base_tsn = asoc->highest_tsn_inside_map + 1; + memset(asoc->mapping_array, 0, asoc->mapping_array_size); + asoc->highest_tsn_inside_nr_map = asoc->highest_tsn_inside_map; + memset(asoc->nr_mapping_array, 0, asoc->mapping_array_size); + atomic_add_int(&asoc->sending_seq, 1); /* save off historical data for retrans */ - stcb->asoc.last_sending_seq[1] = stcb->asoc.last_sending_seq[0]; - stcb->asoc.last_sending_seq[0] = stcb->asoc.sending_seq; - stcb->asoc.last_base_tsnsent[1] = stcb->asoc.last_base_tsnsent[0]; - stcb->asoc.last_base_tsnsent[0] = stcb->asoc.mapping_array_base_tsn; + asoc->last_sending_seq[1] = asoc->last_sending_seq[0]; + asoc->last_sending_seq[0] = asoc->sending_seq; + asoc->last_base_tsnsent[1] = asoc->last_base_tsnsent[0]; + asoc->last_base_tsnsent[0] = asoc->mapping_array_base_tsn; sctp_add_stream_reset_result_tsn(chk, ntohl(req->request_seq), - SCTP_STREAM_RESET_PERFORMED, - stcb->asoc.sending_seq, - stcb->asoc.mapping_array_base_tsn); + SCTP_STREAM_RESET_RESULT_PERFORMED, + asoc->sending_seq, + asoc->mapping_array_base_tsn); sctp_reset_out_streams(stcb, 0, (uint16_t *) NULL); sctp_reset_in_stream(stcb, 0, (uint16_t *) NULL); - stcb->asoc.last_reset_action[1] = stcb->asoc.last_reset_action[0]; - stcb->asoc.last_reset_action[0] = SCTP_STREAM_RESET_PERFORMED; - sctp_notify_stream_reset_tsn(stcb, stcb->asoc.sending_seq, (stcb->asoc.mapping_array_base_tsn + 1), 0); + asoc->last_reset_action[1] = asoc->last_reset_action[0]; + asoc->last_reset_action[0] = SCTP_STREAM_RESET_RESULT_PERFORMED; + sctp_notify_stream_reset_tsn(stcb, asoc->sending_seq, (asoc->mapping_array_base_tsn + 1), 0); asoc->str_reset_seq_in++; } else if (asoc->str_reset_seq_in - 1 == seq) { sctp_add_stream_reset_result_tsn(chk, seq, asoc->last_reset_action[0], - stcb->asoc.last_sending_seq[0], - stcb->asoc.last_base_tsnsent[0] - ); + asoc->last_sending_seq[0], asoc->last_base_tsnsent[0]); } else if (asoc->str_reset_seq_in - 2 == seq) { sctp_add_stream_reset_result_tsn(chk, seq, asoc->last_reset_action[1], - stcb->asoc.last_sending_seq[1], - stcb->asoc.last_base_tsnsent[1] - ); + asoc->last_sending_seq[1], asoc->last_base_tsnsent[1]); } else { - sctp_add_stream_reset_result(chk, seq, SCTP_STREAM_RESET_BAD_SEQNO); + sctp_add_stream_reset_result(chk, seq, SCTP_STREAM_RESET_RESULT_ERR_BAD_SEQNO); } return (0); } @@ -3846,12 +3847,14 @@ sctp_handle_str_reset_request_out(struct /* move the reset action back one */ asoc->last_reset_action[1] = asoc->last_reset_action[0]; - if (trunc) { - asoc->last_reset_action[0] = SCTP_STREAM_RESET_REJECT; + if (!(asoc->local_strreset_support & SCTP_ENABLE_RESET_STREAM_REQ)) { + asoc->last_reset_action[0] = SCTP_STREAM_RESET_RESULT_DENIED; + } else if (trunc) { + asoc->last_reset_action[0] = SCTP_STREAM_RESET_RESULT_DENIED; } else if (SCTP_TSN_GE(asoc->cumulative_tsn, tsn)) { /* we can do it now */ sctp_reset_in_stream(stcb, number_entries, req->list_of_streams); - asoc->last_reset_action[0] = SCTP_STREAM_RESET_PERFORMED; + asoc->last_reset_action[0] = SCTP_STREAM_RESET_RESULT_PERFORMED; } else { /* * we must queue it up and thus wait for the TSN's @@ -3865,8 +3868,8 @@ sctp_handle_str_reset_request_out(struct siz, SCTP_M_STRESET); if (liste == NULL) { /* gak out of memory */ - sctp_add_stream_reset_result(chk, seq, SCTP_STREAM_RESET_REJECT); - asoc->last_reset_action[0] = SCTP_STREAM_RESET_REJECT; + asoc->last_reset_action[0] = SCTP_STREAM_RESET_RESULT_DENIED; + sctp_add_stream_reset_result(chk, seq, asoc->last_reset_action[0]); return; } liste->tsn = tsn; @@ -3874,7 +3877,7 @@ sctp_handle_str_reset_request_out(struct memcpy(&liste->req, req, (sizeof(struct sctp_stream_reset_out_request) + (number_entries * sizeof(uint16_t)))); TAILQ_INSERT_TAIL(&asoc->resetHead, liste, next_resp); - asoc->last_reset_action[0] = SCTP_STREAM_RESET_PERFORMED; + asoc->last_reset_action[0] = SCTP_STREAM_RESET_RESULT_PERFORMED; } sctp_add_stream_reset_result(chk, seq, asoc->last_reset_action[0]); asoc->str_reset_seq_in++; @@ -3891,7 +3894,7 @@ sctp_handle_str_reset_request_out(struct */ sctp_add_stream_reset_result(chk, seq, asoc->last_reset_action[1]); } else { - sctp_add_stream_reset_result(chk, seq, SCTP_STREAM_RESET_BAD_SEQNO); + sctp_add_stream_reset_result(chk, seq, SCTP_STREAM_RESET_RESULT_ERR_BAD_SEQNO); } } @@ -3914,12 +3917,14 @@ sctp_handle_str_reset_add_strm(struct sc /* Now what would be the new total? */ if (asoc->str_reset_seq_in == seq) { num_stream += stcb->asoc.streamincnt; - if ((num_stream > stcb->asoc.max_inbound_streams) || + stcb->asoc.last_reset_action[1] = stcb->asoc.last_reset_action[0]; + if (!(asoc->local_strreset_support & SCTP_ENABLE_CHANGE_ASSOC_REQ)) { + asoc->last_reset_action[0] = SCTP_STREAM_RESET_RESULT_DENIED; + } else if ((num_stream > stcb->asoc.max_inbound_streams) || (num_stream > 0xffff)) { /* We must reject it they ask for to many */ denied: - stcb->asoc.last_reset_action[1] = stcb->asoc.last_reset_action[0]; - stcb->asoc.last_reset_action[0] = SCTP_STREAM_RESET_REJECT; + stcb->asoc.last_reset_action[0] = SCTP_STREAM_RESET_RESULT_DENIED; } else { /* Ok, we can do that :-) */ struct sctp_stream_in *oldstrm; @@ -3955,8 +3960,7 @@ sctp_handle_str_reset_add_strm(struct sc SCTP_FREE(oldstrm, SCTP_M_STRMI); /* update the size */ stcb->asoc.streamincnt = num_stream; - stcb->asoc.last_reset_action[1] = stcb->asoc.last_reset_action[0]; - stcb->asoc.last_reset_action[0] = SCTP_STREAM_RESET_PERFORMED; + stcb->asoc.last_reset_action[0] = SCTP_STREAM_RESET_RESULT_PERFORMED; sctp_notify_stream_reset_add(stcb, stcb->asoc.streamincnt, stcb->asoc.streamoutcnt, 0); } sctp_add_stream_reset_result(chk, seq, asoc->last_reset_action[0]); @@ -3974,7 +3978,7 @@ sctp_handle_str_reset_add_strm(struct sc */ sctp_add_stream_reset_result(chk, seq, asoc->last_reset_action[1]); } else { - sctp_add_stream_reset_result(chk, seq, SCTP_STREAM_RESET_BAD_SEQNO); + sctp_add_stream_reset_result(chk, seq, SCTP_STREAM_RESET_RESULT_ERR_BAD_SEQNO); } } @@ -3996,10 +4000,12 @@ sctp_handle_str_reset_add_out_strm(struc num_stream = ntohs(str_add->number_of_streams); /* Now what would be the new total? */ if (asoc->str_reset_seq_in == seq) { - if (stcb->asoc.stream_reset_outstanding) { + stcb->asoc.last_reset_action[1] = stcb->asoc.last_reset_action[0]; + if (!(asoc->local_strreset_support & SCTP_ENABLE_CHANGE_ASSOC_REQ)) { + asoc->last_reset_action[0] = SCTP_STREAM_RESET_RESULT_DENIED; + } else if (stcb->asoc.stream_reset_outstanding) { /* We must reject it we have something pending */ - stcb->asoc.last_reset_action[1] = stcb->asoc.last_reset_action[0]; - stcb->asoc.last_reset_action[0] = SCTP_STREAM_RESET_REJECT; + stcb->asoc.last_reset_action[0] = SCTP_STREAM_RESET_RESULT_ERR_IN_PROGRESS; } else { /* Ok, we can do that :-) */ int mychk; @@ -4007,14 +4013,12 @@ sctp_handle_str_reset_add_out_strm(struc mychk = stcb->asoc.streamoutcnt; mychk += num_stream; if (mychk < 0x10000) { - stcb->asoc.last_reset_action[1] = stcb->asoc.last_reset_action[0]; - stcb->asoc.last_reset_action[0] = SCTP_STREAM_RESET_PERFORMED; + stcb->asoc.last_reset_action[0] = SCTP_STREAM_RESET_RESULT_PERFORMED; if (sctp_send_str_reset_req(stcb, 0, NULL, 0, 0, 0, 1, num_stream, 0, 1)) { - stcb->asoc.last_reset_action[0] = SCTP_STREAM_RESET_REJECT; + stcb->asoc.last_reset_action[0] = SCTP_STREAM_RESET_RESULT_DENIED; } } else { - stcb->asoc.last_reset_action[1] = stcb->asoc.last_reset_action[0]; - stcb->asoc.last_reset_action[0] = SCTP_STREAM_RESET_REJECT; + stcb->asoc.last_reset_action[0] = SCTP_STREAM_RESET_RESULT_DENIED; } } sctp_add_stream_reset_result(chk, seq, stcb->asoc.last_reset_action[0]); @@ -4032,7 +4036,7 @@ sctp_handle_str_reset_add_out_strm(struc */ sctp_add_stream_reset_result(chk, seq, asoc->last_reset_action[1]); } else { - sctp_add_stream_reset_result(chk, seq, SCTP_STREAM_RESET_BAD_SEQNO); + sctp_add_stream_reset_result(chk, seq, SCTP_STREAM_RESET_RESULT_ERR_BAD_SEQNO); } } @@ -4046,7 +4050,6 @@ __attribute__((noinline)) int chk_length, param_len, ptype; struct sctp_paramhdr pstore; uint8_t cstore[SCTP_CHUNK_BUFFER_SIZE]; - uint32_t seq = 0; int num_req = 0; int trunc = 0; @@ -4124,7 +4127,7 @@ strres_nochunk: seq = ntohl(req_out->response_seq); if (seq == stcb->asoc.str_reset_seq_out) { /* implicit ack */ - (void)sctp_handle_stream_reset_response(stcb, seq, SCTP_STREAM_RESET_PERFORMED, NULL); + (void)sctp_handle_stream_reset_response(stcb, seq, SCTP_STREAM_RESET_RESULT_PERFORMED, NULL); } } sctp_handle_str_reset_request_out(stcb, chk, req_out, trunc); From owner-svn-src-stable-9@FreeBSD.ORG Wed May 9 14:12:08 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CD317106566B; Wed, 9 May 2012 14:12:08 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B744B8FC1A; Wed, 9 May 2012 14:12:08 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q49EC8Gj086661; Wed, 9 May 2012 14:12:08 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q49EC8OK086656; Wed, 9 May 2012 14:12:08 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201205091412.q49EC8OK086656@svn.freebsd.org> From: Michael Tuexen Date: Wed, 9 May 2012 14:12:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r235171 - stable/9/sys/netinet X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 May 2012 14:12:08 -0000 Author: tuexen Date: Wed May 9 14:12:08 2012 New Revision: 235171 URL: http://svn.freebsd.org/changeset/base/235171 Log: MFC r235066: Provide the flags in the SCTP stream reconfig related notification as specified in RFC 6525. Modified: stable/9/sys/netinet/sctp_constants.h stable/9/sys/netinet/sctp_input.c stable/9/sys/netinet/sctp_uio.h stable/9/sys/netinet/sctputil.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/netinet/sctp_constants.h ============================================================================== --- stable/9/sys/netinet/sctp_constants.h Wed May 9 14:07:12 2012 (r235170) +++ stable/9/sys/netinet/sctp_constants.h Wed May 9 14:12:08 2012 (r235171) @@ -779,10 +779,9 @@ __FBSDID("$FreeBSD$"); #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_ADD_OK 30 -#define SCTP_NOTIFY_STR_RESET_ADD_FAIL 31 -#define SCTP_NOTIFY_STR_RESET_INSTREAM_ADD_OK 32 -#define SCTP_NOTIFY_MAX 32 +#define SCTP_NOTIFY_STR_RESET_DENIED_OUT 30 +#define SCTP_NOTIFY_STR_RESET_DENIED_IN 31 +#define SCTP_NOTIFY_MAX 31 /* This is the value for messages that are NOT completely Modified: stable/9/sys/netinet/sctp_input.c ============================================================================== --- stable/9/sys/netinet/sctp_input.c Wed May 9 14:07:12 2012 (r235170) +++ stable/9/sys/netinet/sctp_input.c Wed May 9 14:12:08 2012 (r235171) @@ -3602,6 +3602,8 @@ sctp_handle_stream_reset_response(struct if (action == SCTP_STREAM_RESET_RESULT_PERFORMED) { /* do it */ sctp_reset_out_streams(stcb, number_entries, srparam->list_of_streams); + } else if (action == SCTP_STREAM_RESET_RESULT_DENIED) { + sctp_ulp_notify(SCTP_NOTIFY_STR_RESET_DENIED_OUT, stcb, number_entries, srparam->list_of_streams, SCTP_SO_NOT_LOCKED); } else { sctp_ulp_notify(SCTP_NOTIFY_STR_RESET_FAILED_OUT, stcb, number_entries, srparam->list_of_streams, SCTP_SO_NOT_LOCKED); } @@ -3610,7 +3612,10 @@ sctp_handle_stream_reset_response(struct number_entries = (lparm_len - sizeof(struct sctp_stream_reset_in_request)) / sizeof(uint16_t); if (asoc->stream_reset_outstanding) asoc->stream_reset_outstanding--; - if (action != SCTP_STREAM_RESET_RESULT_PERFORMED) { + if (action == SCTP_STREAM_RESET_RESULT_DENIED) { + sctp_ulp_notify(SCTP_NOTIFY_STR_RESET_DENIED_IN, stcb, + number_entries, srparam->list_of_streams, SCTP_SO_NOT_LOCKED); + } else if (action != SCTP_STREAM_RESET_RESULT_PERFORMED) { sctp_ulp_notify(SCTP_NOTIFY_STR_RESET_FAILED_IN, stcb, number_entries, srparam->list_of_streams, SCTP_SO_NOT_LOCKED); } @@ -3630,16 +3635,22 @@ sctp_handle_stream_reset_response(struct /* Put the new streams into effect */ stcb->asoc.streamoutcnt += num_stream; sctp_notify_stream_reset_add(stcb, stcb->asoc.streamincnt, stcb->asoc.streamoutcnt, 0); + } else if (action == SCTP_STREAM_RESET_RESULT_DENIED) { + sctp_notify_stream_reset_add(stcb, stcb->asoc.streamincnt, stcb->asoc.streamoutcnt, + SCTP_STREAM_CHANGE_DENIED); } else { sctp_notify_stream_reset_add(stcb, stcb->asoc.streamincnt, stcb->asoc.streamoutcnt, - SCTP_STREAM_CHANGED_DENIED); + SCTP_STREAM_CHANGE_FAILED); } } else if (type == SCTP_STR_RESET_ADD_IN_STREAMS) { if (asoc->stream_reset_outstanding) asoc->stream_reset_outstanding--; - if (action != SCTP_STREAM_RESET_RESULT_PERFORMED) { + if (action == SCTP_STREAM_RESET_RESULT_DENIED) { sctp_notify_stream_reset_add(stcb, stcb->asoc.streamincnt, stcb->asoc.streamoutcnt, - SCTP_STREAM_CHANGED_DENIED); + SCTP_STREAM_CHANGE_DENIED); + } else if (action != SCTP_STREAM_RESET_RESULT_PERFORMED) { + sctp_notify_stream_reset_add(stcb, stcb->asoc.streamincnt, stcb->asoc.streamoutcnt, + SCTP_STREAM_CHANGE_FAILED); } } else if (type == SCTP_STR_RESET_TSN_REQUEST) { /** @@ -3682,9 +3693,12 @@ sctp_handle_stream_reset_response(struct sctp_reset_out_streams(stcb, 0, (uint16_t *) NULL); sctp_reset_in_stream(stcb, 0, (uint16_t *) NULL); sctp_notify_stream_reset_tsn(stcb, stcb->asoc.sending_seq, (stcb->asoc.mapping_array_base_tsn + 1), 0); + } else if (action == SCTP_STREAM_RESET_RESULT_DENIED) { + sctp_notify_stream_reset_tsn(stcb, stcb->asoc.sending_seq, (stcb->asoc.mapping_array_base_tsn + 1), + SCTP_ASSOC_RESET_DENIED); } else { sctp_notify_stream_reset_tsn(stcb, stcb->asoc.sending_seq, (stcb->asoc.mapping_array_base_tsn + 1), - SCTP_STREAM_RESET_FAILED); + SCTP_ASSOC_RESET_FAILED); } } /* get rid of the request and get the request flags */ Modified: stable/9/sys/netinet/sctp_uio.h ============================================================================== --- stable/9/sys/netinet/sctp_uio.h Wed May 9 14:07:12 2012 (r235170) +++ stable/9/sys/netinet/sctp_uio.h Wed May 9 14:12:08 2012 (r235171) @@ -454,7 +454,6 @@ struct sctp_stream_reset_event { #define SCTP_STREAM_RESET_OUTGOING_SSN 0x0002 #define SCTP_STREAM_RESET_DENIED 0x0004 #define SCTP_STREAM_RESET_FAILED 0x0008 -#define SCTP_STREAM_CHANGED_DENIED 0x0010 /* * Assoc reset event - subscribe to SCTP_ASSOC_RESET_EVENT Modified: stable/9/sys/netinet/sctputil.c ============================================================================== --- stable/9/sys/netinet/sctputil.c Wed May 9 14:07:12 2012 (r235170) +++ stable/9/sys/netinet/sctputil.c Wed May 9 14:12:08 2012 (r235171) @@ -3507,10 +3507,18 @@ sctp_ulp_notify(uint32_t notification, s sctp_notify_stream_reset(stcb, error, ((uint16_t *) data), (SCTP_STREAM_RESET_OUTGOING_SSN | SCTP_STREAM_RESET_FAILED)); break; + case SCTP_NOTIFY_STR_RESET_DENIED_OUT: + sctp_notify_stream_reset(stcb, error, ((uint16_t *) data), + (SCTP_STREAM_RESET_OUTGOING_SSN | SCTP_STREAM_RESET_DENIED)); + break; case SCTP_NOTIFY_STR_RESET_FAILED_IN: sctp_notify_stream_reset(stcb, error, ((uint16_t *) data), (SCTP_STREAM_RESET_INCOMING | SCTP_STREAM_RESET_FAILED)); break; + case SCTP_NOTIFY_STR_RESET_DENIED_IN: + sctp_notify_stream_reset(stcb, error, ((uint16_t *) data), + (SCTP_STREAM_RESET_INCOMING | SCTP_STREAM_RESET_DENIED)); + break; case SCTP_NOTIFY_ASCONF_ADD_IP: sctp_notify_peer_addr_change(stcb, SCTP_ADDR_ADDED, data, error); From owner-svn-src-stable-9@FreeBSD.ORG Wed May 9 14:16:00 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1952B1065672; Wed, 9 May 2012 14:16:00 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id EAA228FC15; Wed, 9 May 2012 14:15:59 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q49EFxcj086831; Wed, 9 May 2012 14:15:59 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q49EFxri086826; Wed, 9 May 2012 14:15:59 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201205091415.q49EFxri086826@svn.freebsd.org> From: Michael Tuexen Date: Wed, 9 May 2012 14:15:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r235172 - stable/9/sys/netinet X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 May 2012 14:16:00 -0000 Author: tuexen Date: Wed May 9 14:15:59 2012 New Revision: 235172 URL: http://svn.freebsd.org/changeset/base/235172 Log: MFC r235075: Add support for SCTP_SEND_FAILED_EVENT as required by RFC 6458. Modified: stable/9/sys/netinet/sctp.h stable/9/sys/netinet/sctp_uio.h stable/9/sys/netinet/sctp_usrreq.c stable/9/sys/netinet/sctputil.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/netinet/sctp.h ============================================================================== --- stable/9/sys/netinet/sctp.h Wed May 9 14:12:08 2012 (r235171) +++ stable/9/sys/netinet/sctp.h Wed May 9 14:15:59 2012 (r235172) @@ -526,7 +526,7 @@ struct sctp_error_unrecognized_chunk { #define SCTP_PCB_FLAGS_RECVASSOCEVNT 0x00000800 #define SCTP_PCB_FLAGS_RECVPADDREVNT 0x00001000 #define SCTP_PCB_FLAGS_RECVPEERERR 0x00002000 -#define SCTP_PCB_FLAGS_RECVSENDFAILEVNT 0x00004000 +#define SCTP_PCB_FLAGS_RECVSENDFAILEVNT 0x00004000 /* deprecated */ #define SCTP_PCB_FLAGS_RECVSHUTDOWNEVNT 0x00008000 #define SCTP_PCB_FLAGS_ADAPTATIONEVNT 0x00010000 #define SCTP_PCB_FLAGS_PDAPIEVNT 0x00020000 @@ -542,6 +542,7 @@ struct sctp_error_unrecognized_chunk { #define SCTP_PCB_FLAGS_RECVNXTINFO 0x10000000 #define SCTP_PCB_FLAGS_ASSOC_RESETEVNT 0x20000000 #define SCTP_PCB_FLAGS_STREAM_CHANGEEVNT 0x40000000 +#define SCTP_PCB_FLAGS_RECVNSENDFAILEVNT 0x80000000 /*- * mobility_features parameters (by micchie).Note Modified: stable/9/sys/netinet/sctp_uio.h ============================================================================== --- stable/9/sys/netinet/sctp_uio.h Wed May 9 14:12:08 2012 (r235171) +++ stable/9/sys/netinet/sctp_uio.h Wed May 9 14:15:59 2012 (r235172) @@ -343,7 +343,7 @@ struct sctp_remote_error { uint8_t sre_data[4]; }; -/* data send failure event */ +/* data send failure event (deprecated) */ struct sctp_send_failed { uint16_t ssf_type; uint16_t ssf_flags; @@ -354,6 +354,17 @@ struct sctp_send_failed { uint8_t ssf_data[]; }; +/* data send failure event (not deprecated) */ +struct sctp_send_failed_event { + uint16_t ssfe_type; + uint16_t ssfe_flags; + uint32_t ssfe_length; + uint32_t ssfe_error; + struct sctp_sndinfo ssfe_info; + sctp_assoc_t ssfe_assoc_id; + uint8_t ssfe_data[]; +}; + /* flag that indicates state of data */ #define SCTP_DATA_UNSENT 0x0001 /* inqueue never on wire */ #define SCTP_DATA_SENT 0x0002 /* on wire at failure */ @@ -513,22 +524,22 @@ union sctp_notification { }; /* notification types */ -#define SCTP_ASSOC_CHANGE 0x0001 -#define SCTP_PEER_ADDR_CHANGE 0x0002 -#define SCTP_REMOTE_ERROR 0x0003 -#define SCTP_SEND_FAILED 0x0004 -#define SCTP_SHUTDOWN_EVENT 0x0005 -#define SCTP_ADAPTATION_INDICATION 0x0006 +#define SCTP_ASSOC_CHANGE 0x0001 +#define SCTP_PEER_ADDR_CHANGE 0x0002 +#define SCTP_REMOTE_ERROR 0x0003 +#define SCTP_SEND_FAILED 0x0004 +#define SCTP_SHUTDOWN_EVENT 0x0005 +#define SCTP_ADAPTATION_INDICATION 0x0006 /* same as above */ -#define SCTP_ADAPTION_INDICATION 0x0006 -#define SCTP_PARTIAL_DELIVERY_EVENT 0x0007 -#define SCTP_AUTHENTICATION_EVENT 0x0008 -#define SCTP_STREAM_RESET_EVENT 0x0009 -#define SCTP_SENDER_DRY_EVENT 0x000a -#define SCTP_NOTIFICATIONS_STOPPED_EVENT 0x000b /* we don't send this */ -#define SCTP_ASSOC_RESET_EVENT 0x000c -#define SCTP_STREAM_CHANGE_EVENT 0x000d - +#define SCTP_ADAPTION_INDICATION 0x0006 +#define SCTP_PARTIAL_DELIVERY_EVENT 0x0007 +#define SCTP_AUTHENTICATION_EVENT 0x0008 +#define SCTP_STREAM_RESET_EVENT 0x0009 +#define SCTP_SENDER_DRY_EVENT 0x000a +#define SCTP_NOTIFICATIONS_STOPPED_EVENT 0x000b /* we don't send this */ +#define SCTP_ASSOC_RESET_EVENT 0x000c +#define SCTP_STREAM_CHANGE_EVENT 0x000d +#define SCTP_SEND_FAILED_EVENT 0x000e /* * socket option structs */ Modified: stable/9/sys/netinet/sctp_usrreq.c ============================================================================== --- stable/9/sys/netinet/sctp_usrreq.c Wed May 9 14:12:08 2012 (r235171) +++ stable/9/sys/netinet/sctp_usrreq.c Wed May 9 14:15:59 2012 (r235172) @@ -2989,6 +2989,9 @@ flags_out: case SCTP_STREAM_CHANGE_EVENT: event_type = SCTP_PCB_FLAGS_STREAM_CHANGEEVNT; break; + case SCTP_SEND_FAILED_EVENT: + event_type = SCTP_PCB_FLAGS_RECVNSENDFAILEVNT; + break; default: event_type = 0; SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL); @@ -5412,6 +5415,9 @@ sctp_setopt(struct socket *so, int optna case SCTP_STREAM_CHANGE_EVENT: event_type = SCTP_PCB_FLAGS_STREAM_CHANGEEVNT; break; + case SCTP_SEND_FAILED_EVENT: + event_type = SCTP_PCB_FLAGS_RECVNSENDFAILEVNT; + break; default: event_type = 0; SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL); Modified: stable/9/sys/netinet/sctputil.c ============================================================================== --- stable/9/sys/netinet/sctputil.c Wed May 9 14:12:08 2012 (r235171) +++ stable/9/sys/netinet/sctputil.c Wed May 9 14:15:59 2012 (r235172) @@ -2798,39 +2798,66 @@ sctp_notify_send_failed(struct sctp_tcb { struct mbuf *m_notify; struct sctp_send_failed *ssf; + struct sctp_send_failed_event *ssfe; struct sctp_queued_to_read *control; int length; if ((stcb == NULL) || - sctp_stcb_is_feature_off(stcb->sctp_ep, stcb, SCTP_PCB_FLAGS_RECVSENDFAILEVNT)) { + (sctp_stcb_is_feature_off(stcb->sctp_ep, stcb, SCTP_PCB_FLAGS_RECVSENDFAILEVNT) && + sctp_stcb_is_feature_off(stcb->sctp_ep, stcb, SCTP_PCB_FLAGS_RECVNSENDFAILEVNT))) { /* event not enabled */ return; } - m_notify = sctp_get_mbuf_for_msg(sizeof(struct sctp_send_failed), 0, M_DONTWAIT, 1, MT_DATA); + if (sctp_stcb_is_feature_on(stcb->sctp_ep, stcb, SCTP_PCB_FLAGS_RECVNSENDFAILEVNT)) { + length = sizeof(struct sctp_send_failed_event); + } else { + length = sizeof(struct sctp_send_failed); + } + m_notify = sctp_get_mbuf_for_msg(length, 0, M_DONTWAIT, 1, MT_DATA); if (m_notify == NULL) /* no space left */ return; - length = sizeof(struct sctp_send_failed) + chk->send_size; + length += chk->send_size; length -= sizeof(struct sctp_data_chunk); SCTP_BUF_LEN(m_notify) = 0; - 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_length = length; - ssf->ssf_error = error; - /* not exactly what the user sent in, but should be close :) */ - bzero(&ssf->ssf_info, sizeof(ssf->ssf_info)); - ssf->ssf_info.sinfo_stream = chk->rec.data.stream_number; - ssf->ssf_info.sinfo_ssn = chk->rec.data.stream_seq; - ssf->ssf_info.sinfo_flags = chk->rec.data.rcv_flags; - ssf->ssf_info.sinfo_ppid = chk->rec.data.payloadtype; - ssf->ssf_info.sinfo_context = chk->rec.data.context; - ssf->ssf_info.sinfo_assoc_id = sctp_get_associd(stcb); - ssf->ssf_assoc_id = sctp_get_associd(stcb); - + 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 + ssfe->ssfe_flags = SCTP_DATA_SENT; + ssfe->ssfe_length = length; + ssfe->ssfe_error = error; + /* not exactly what the user sent in, but should be close :) */ + bzero(&ssfe->ssfe_info, sizeof(ssfe->ssfe_info)); + ssfe->ssfe_info.snd_sid = chk->rec.data.stream_number; + ssfe->ssfe_info.snd_flags = chk->rec.data.rcv_flags; + ssfe->ssfe_info.snd_ppid = chk->rec.data.payloadtype; + ssfe->ssfe_info.snd_context = chk->rec.data.context; + ssfe->ssfe_info.snd_assoc_id = sctp_get_associd(stcb); + ssfe->ssfe_assoc_id = sctp_get_associd(stcb); + SCTP_BUF_LEN(m_notify) = sizeof(struct sctp_send_failed_event); + } 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_length = length; + ssf->ssf_error = error; + /* not exactly what the user sent in, but should be close :) */ + bzero(&ssf->ssf_info, sizeof(ssf->ssf_info)); + ssf->ssf_info.sinfo_stream = chk->rec.data.stream_number; + ssf->ssf_info.sinfo_ssn = chk->rec.data.stream_seq; + ssf->ssf_info.sinfo_flags = chk->rec.data.rcv_flags; + ssf->ssf_info.sinfo_ppid = chk->rec.data.payloadtype; + ssf->ssf_info.sinfo_context = chk->rec.data.context; + ssf->ssf_info.sinfo_assoc_id = sctp_get_associd(stcb); + ssf->ssf_assoc_id = sctp_get_associd(stcb); + SCTP_BUF_LEN(m_notify) = sizeof(struct sctp_send_failed); + } if (chk->data) { /* * trim off the sctp chunk header(it should be there) @@ -2842,7 +2869,6 @@ sctp_notify_send_failed(struct sctp_tcb } } SCTP_BUF_NEXT(m_notify) = chk->data; - SCTP_BUF_LEN(m_notify) = sizeof(struct sctp_send_failed); /* Steal off the mbuf */ chk->data = NULL; /* @@ -2882,43 +2908,75 @@ sctp_notify_send_failed2(struct sctp_tcb { struct mbuf *m_notify; struct sctp_send_failed *ssf; + struct sctp_send_failed_event *ssfe; struct sctp_queued_to_read *control; int length; if ((stcb == NULL) || - sctp_stcb_is_feature_off(stcb->sctp_ep, stcb, SCTP_PCB_FLAGS_RECVSENDFAILEVNT)) { + (sctp_stcb_is_feature_off(stcb->sctp_ep, stcb, SCTP_PCB_FLAGS_RECVSENDFAILEVNT) && + sctp_stcb_is_feature_off(stcb->sctp_ep, stcb, SCTP_PCB_FLAGS_RECVNSENDFAILEVNT))) { /* event not enabled */ return; } - length = sizeof(struct sctp_send_failed) + sp->length; - m_notify = sctp_get_mbuf_for_msg(sizeof(struct sctp_send_failed), 0, M_DONTWAIT, 1, MT_DATA); - if (m_notify == NULL) + if (sctp_stcb_is_feature_on(stcb->sctp_ep, stcb, SCTP_PCB_FLAGS_RECVNSENDFAILEVNT)) { + length = sizeof(struct sctp_send_failed_event); + } else { + length = sizeof(struct sctp_send_failed); + } + m_notify = sctp_get_mbuf_for_msg(length, 0, M_DONTWAIT, 1, MT_DATA); + if (m_notify == NULL) { /* no space left */ return; + } + length += sp->length; SCTP_BUF_LEN(m_notify) = 0; - 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_length = length; - ssf->ssf_error = error; - /* 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; - if (sp->some_taken) { - ssf->ssf_info.sinfo_flags = SCTP_DATA_LAST_FRAG; + 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_length = length; + ssfe->ssfe_error = error; + /* not exactly what the user sent in, but should be close :) */ + bzero(&ssfe->ssfe_info, sizeof(ssfe->ssfe_info)); + ssfe->ssfe_info.snd_sid = sp->stream; + if (sp->some_taken) { + ssfe->ssfe_info.snd_flags = SCTP_DATA_LAST_FRAG; + } else { + ssfe->ssfe_info.snd_flags = SCTP_DATA_NOT_FRAG; + } + ssfe->ssfe_info.snd_ppid = sp->ppid; + ssfe->ssfe_info.snd_context = sp->context; + ssfe->ssfe_info.snd_assoc_id = sctp_get_associd(stcb); + ssfe->ssfe_assoc_id = sctp_get_associd(stcb); + SCTP_BUF_LEN(m_notify) = sizeof(struct sctp_send_failed_event); } else { - ssf->ssf_info.sinfo_flags = SCTP_DATA_NOT_FRAG; + 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_length = length; + ssf->ssf_error = error; + /* 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; + if (sp->some_taken) { + ssf->ssf_info.sinfo_flags = SCTP_DATA_LAST_FRAG; + } else { + ssf->ssf_info.sinfo_flags = SCTP_DATA_NOT_FRAG; + } + ssf->ssf_info.sinfo_ppid = sp->ppid; + ssf->ssf_info.sinfo_context = sp->context; + ssf->ssf_info.sinfo_assoc_id = sctp_get_associd(stcb); + ssf->ssf_assoc_id = sctp_get_associd(stcb); + SCTP_BUF_LEN(m_notify) = sizeof(struct sctp_send_failed); } - ssf->ssf_info.sinfo_ppid = sp->ppid; - ssf->ssf_info.sinfo_context = sp->context; - ssf->ssf_info.sinfo_assoc_id = sctp_get_associd(stcb); - ssf->ssf_assoc_id = sctp_get_associd(stcb); SCTP_BUF_NEXT(m_notify) = sp->data; - SCTP_BUF_LEN(m_notify) = sizeof(struct sctp_send_failed); /* Steal off the mbuf */ sp->data = NULL; From owner-svn-src-stable-9@FreeBSD.ORG Wed May 9 14:19:07 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 78984106564A; Wed, 9 May 2012 14:19:07 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 591A48FC0C; Wed, 9 May 2012 14:19:07 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q49EJ7S1086991; Wed, 9 May 2012 14:19:07 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q49EJ7CI086986; Wed, 9 May 2012 14:19:07 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201205091419.q49EJ7CI086986@svn.freebsd.org> From: Michael Tuexen Date: Wed, 9 May 2012 14:19:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r235173 - stable/9/sys/netinet X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 May 2012 14:19:07 -0000 Author: tuexen Date: Wed May 9 14:19:06 2012 New Revision: 235173 URL: http://svn.freebsd.org/changeset/base/235173 Log: MFC r235077: Remove debug code. Modified: stable/9/sys/netinet/sctp_input.c stable/9/sys/netinet/sctp_pcb.c stable/9/sys/netinet/sctp_usrreq.c stable/9/sys/netinet/sctputil.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/netinet/sctp_input.c ============================================================================== --- stable/9/sys/netinet/sctp_input.c Wed May 9 14:15:59 2012 (r235172) +++ stable/9/sys/netinet/sctp_input.c Wed May 9 14:19:06 2012 (r235173) @@ -785,15 +785,6 @@ sctp_handle_abort(struct sctp_abort_chun /* notify user of the abort and clean up... */ sctp_abort_notification(stcb, 0, SCTP_SO_NOT_LOCKED); /* free the tcb */ -#if defined(SCTP_PANIC_ON_ABORT) - SCTP_PRINTF("stcb:%p state:%d rport:%d net:%p\n", - stcb, stcb->asoc.state, stcb->rport, net); - if (!(stcb->asoc.state & SCTP_STATE_CLOSED_SOCKET)) { - panic("Received an ABORT"); - } else { - SCTP_PRINTF("No panic its in state %x closed\n", stcb->asoc.state); - } -#endif SCTP_STAT_INCR_COUNTER32(sctps_aborted); if ((SCTP_GET_STATE(&stcb->asoc) == SCTP_STATE_OPEN) || (SCTP_GET_STATE(&stcb->asoc) == SCTP_STATE_SHUTDOWN_RECEIVED)) { Modified: stable/9/sys/netinet/sctp_pcb.c ============================================================================== --- stable/9/sys/netinet/sctp_pcb.c Wed May 9 14:15:59 2012 (r235172) +++ stable/9/sys/netinet/sctp_pcb.c Wed May 9 14:19:06 2012 (r235173) @@ -3426,9 +3426,6 @@ sctp_inpcb_free(struct sctp_inpcb *inp, *ippp = htonl(SCTP_FROM_SCTP_PCB + SCTP_LOC_3); } asoc->sctp_ep->last_abort_code = SCTP_FROM_SCTP_PCB + SCTP_LOC_3; -#if defined(SCTP_PANIC_ON_ABORT) - panic("inpcb_free does an abort"); -#endif sctp_send_abort_tcb(asoc, op_err, SCTP_SO_LOCKED); SCTP_STAT_INCR_COUNTER32(sctps_aborted); if ((SCTP_GET_STATE(&asoc->asoc) == SCTP_STATE_OPEN) || @@ -3520,10 +3517,6 @@ sctp_inpcb_free(struct sctp_inpcb *inp, *ippp = htonl(SCTP_FROM_SCTP_PCB + SCTP_LOC_5); } asoc->sctp_ep->last_abort_code = SCTP_FROM_SCTP_PCB + SCTP_LOC_5; -#if defined(SCTP_PANIC_ON_ABORT) - panic("inpcb_free does an abort"); -#endif - sctp_send_abort_tcb(asoc, op_err, SCTP_SO_LOCKED); SCTP_STAT_INCR_COUNTER32(sctps_aborted); if ((SCTP_GET_STATE(&asoc->asoc) == SCTP_STATE_OPEN) || @@ -3604,9 +3597,6 @@ sctp_inpcb_free(struct sctp_inpcb *inp, } asoc->sctp_ep->last_abort_code = SCTP_FROM_SCTP_PCB + SCTP_LOC_7; -#if defined(SCTP_PANIC_ON_ABORT) - panic("inpcb_free does an abort"); -#endif sctp_send_abort_tcb(asoc, op_err, SCTP_SO_LOCKED); SCTP_STAT_INCR_COUNTER32(sctps_aborted); } else if (asoc->asoc.state & SCTP_STATE_ABOUT_TO_BE_FREED) { Modified: stable/9/sys/netinet/sctp_usrreq.c ============================================================================== --- stable/9/sys/netinet/sctp_usrreq.c Wed May 9 14:15:59 2012 (r235172) +++ stable/9/sys/netinet/sctp_usrreq.c Wed May 9 14:19:06 2012 (r235173) @@ -780,9 +780,6 @@ sctp_disconnect(struct socket *so) ph->param_type = htons(SCTP_CAUSE_USER_INITIATED_ABT); ph->param_length = htons(SCTP_BUF_LEN(err)); } -#if defined(SCTP_PANIC_ON_ABORT) - panic("disconnect does an abort"); -#endif sctp_send_abort_tcb(stcb, err, SCTP_SO_LOCKED); SCTP_STAT_INCR_COUNTER32(sctps_aborted); } @@ -888,10 +885,6 @@ sctp_disconnect(struct socket *so) ippp = (uint32_t *) (ph + 1); *ippp = htonl(SCTP_FROM_SCTP_USRREQ + SCTP_LOC_4); } -#if defined(SCTP_PANIC_ON_ABORT) - panic("disconnect does an abort"); -#endif - stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_USRREQ + SCTP_LOC_4; sctp_send_abort_tcb(stcb, op_err, SCTP_SO_LOCKED); SCTP_STAT_INCR_COUNTER32(sctps_aborted); @@ -1103,9 +1096,6 @@ sctp_shutdown(struct socket *so) ippp = (uint32_t *) (ph + 1); *ippp = htonl(SCTP_FROM_SCTP_USRREQ + SCTP_LOC_6); } -#if defined(SCTP_PANIC_ON_ABORT) - panic("shutdown does an abort"); -#endif 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, Modified: stable/9/sys/netinet/sctputil.c ============================================================================== --- stable/9/sys/netinet/sctputil.c Wed May 9 14:15:59 2012 (r235172) +++ stable/9/sys/netinet/sctputil.c Wed May 9 14:19:06 2012 (r235173) @@ -3881,9 +3881,6 @@ sctp_abort_an_association(struct sctp_in if ((inp->sctp_flags & SCTP_PCB_FLAGS_SOCKET_GONE) == 0) sctp_abort_notification(stcb, error, so_locked); /* notify the peer */ -#if defined(SCTP_PANIC_ON_ABORT) - panic("aborting an association"); -#endif sctp_send_abort_tcb(stcb, op_err, so_locked); SCTP_STAT_INCR_COUNTER32(sctps_aborted); if ((SCTP_GET_STATE(&stcb->asoc) == SCTP_STATE_OPEN) || From owner-svn-src-stable-9@FreeBSD.ORG Wed May 9 14:25:15 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id CDAC51065670; Wed, 9 May 2012 14:25:15 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9E6B18FC17; Wed, 9 May 2012 14:25:15 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q49EPFkh087269; Wed, 9 May 2012 14:25:15 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q49EPF7c087266; Wed, 9 May 2012 14:25:15 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201205091425.q49EPF7c087266@svn.freebsd.org> From: Michael Tuexen Date: Wed, 9 May 2012 14:25:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r235175 - stable/9/sys/netinet X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 May 2012 14:25:15 -0000 Author: tuexen Date: Wed May 9 14:25:15 2012 New Revision: 235175 URL: http://svn.freebsd.org/changeset/base/235175 Log: MFC r235081: Add support for the sac_info field in struct sctp_assoc_change as required by RFC 6458. Modified: stable/9/sys/netinet/sctp_uio.h stable/9/sys/netinet/sctputil.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/netinet/sctp_uio.h ============================================================================== --- stable/9/sys/netinet/sctp_uio.h Wed May 9 14:24:39 2012 (r235174) +++ stable/9/sys/netinet/sctp_uio.h Wed May 9 14:25:15 2012 (r235175) @@ -296,16 +296,23 @@ struct sctp_assoc_change { uint16_t sac_outbound_streams; uint16_t sac_inbound_streams; sctp_assoc_t sac_assoc_id; + uint8_t sac_info[]; }; /* sac_state values */ -#define SCTP_COMM_UP 0x0001 -#define SCTP_COMM_LOST 0x0002 -#define SCTP_RESTART 0x0003 -#define SCTP_SHUTDOWN_COMP 0x0004 -#define SCTP_CANT_STR_ASSOC 0x0005 - - +#define SCTP_COMM_UP 0x0001 +#define SCTP_COMM_LOST 0x0002 +#define SCTP_RESTART 0x0003 +#define SCTP_SHUTDOWN_COMP 0x0004 +#define SCTP_CANT_STR_ASSOC 0x0005 + +/* sac_info values */ +#define SCTP_ASSOC_SUPPORTS_PR 0x01 +#define SCTP_ASSOC_SUPPORTS_AUTH 0x02 +#define SCTP_ASSOC_SUPPORTS_ASCONF 0x03 +#define SCTP_ASSOC_SUPPORTS_MULTIBUF 0x04 +#define SCTP_ASSOC_SUPPORTS_RE_CONFIG 0x05 +#define SCTP_ASSOC_SUPPORTS_MAX 0x05 /* * Address event */ Modified: stable/9/sys/netinet/sctputil.c ============================================================================== --- stable/9/sys/netinet/sctputil.c Wed May 9 14:24:39 2012 (r235174) +++ stable/9/sys/netinet/sctputil.c Wed May 9 14:25:15 2012 (r235175) @@ -2602,6 +2602,7 @@ sctp_notify_assoc_change(uint32_t event, struct mbuf *m_notify; struct sctp_assoc_change *sac; struct sctp_queued_to_read *control; + unsigned int i; #if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING) struct socket *so; @@ -2666,7 +2667,22 @@ sctp_notify_assoc_change(uint32_t event, sac->sac_outbound_streams = stcb->asoc.streamoutcnt; sac->sac_inbound_streams = stcb->asoc.streamincnt; sac->sac_assoc_id = sctp_get_associd(stcb); - SCTP_BUF_LEN(m_notify) = sizeof(struct sctp_assoc_change); + 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; + 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, From owner-svn-src-stable-9@FreeBSD.ORG Wed May 9 14:27:42 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C1235106564A; Wed, 9 May 2012 14:27:42 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 91CBB8FC17; Wed, 9 May 2012 14:27:42 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q49ERgB2087402; Wed, 9 May 2012 14:27:42 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q49ERgfL087399; Wed, 9 May 2012 14:27:42 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201205091427.q49ERgfL087399@svn.freebsd.org> From: Michael Tuexen Date: Wed, 9 May 2012 14:27:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r235176 - stable/9/sys/netinet X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 May 2012 14:27:42 -0000 Author: tuexen Date: Wed May 9 14:27:42 2012 New Revision: 235176 URL: http://svn.freebsd.org/changeset/base/235176 Log: MFC r235091: Address clang warnings. Modified: stable/9/sys/netinet/sctp_usrreq.c stable/9/sys/netinet/sctputil.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/netinet/sctp_usrreq.c ============================================================================== --- stable/9/sys/netinet/sctp_usrreq.c Wed May 9 14:25:15 2012 (r235175) +++ stable/9/sys/netinet/sctp_usrreq.c Wed May 9 14:27:42 2012 (r235176) @@ -5838,7 +5838,6 @@ sctp_ctloutput(struct socket *so, struct { void *optval = NULL; size_t optsize = 0; - struct sctp_inpcb *inp; void *p; int error = 0; @@ -5856,12 +5855,11 @@ sctp_ctloutput(struct socket *so, struct #endif return (error); } - inp = (struct sctp_inpcb *)so->so_pcb; optsize = sopt->sopt_valsize; if (optsize) { SCTP_MALLOC(optval, void *, optsize, SCTP_M_SOCKOPT); if (optval == NULL) { - SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, ENOBUFS); + SCTP_LTRACE_ERR_RET(so->so_pcb, NULL, NULL, SCTP_FROM_SCTP_USRREQ, ENOBUFS); return (ENOBUFS); } error = sooptcopyin(sopt, optval, optsize, optsize); @@ -5876,7 +5874,7 @@ sctp_ctloutput(struct socket *so, struct } else if (sopt->sopt_dir == SOPT_GET) { error = sctp_getopt(so, sopt->sopt_name, optval, &optsize, p); } else { - SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL); + SCTP_LTRACE_ERR_RET(so->so_pcb, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL); error = EINVAL; } if ((error == 0) && (optval != NULL)) { Modified: stable/9/sys/netinet/sctputil.c ============================================================================== --- stable/9/sys/netinet/sctputil.c Wed May 9 14:25:15 2012 (r235175) +++ stable/9/sys/netinet/sctputil.c Wed May 9 14:27:42 2012 (r235176) @@ -3288,7 +3288,8 @@ sctp_notify_stream_reset_add(struct sctp struct sctp_stream_change_event *stradd; int len; - if (sctp_stcb_is_feature_off(stcb->sctp_ep, stcb, SCTP_PCB_FLAGS_STREAM_CHANGEEVNT)) { + if ((stcb == NULL) || + (sctp_stcb_is_feature_off(stcb->sctp_ep, stcb, SCTP_PCB_FLAGS_STREAM_CHANGEEVNT))) { /* event not enabled */ return; } @@ -3349,7 +3350,8 @@ sctp_notify_stream_reset_tsn(struct sctp struct sctp_assoc_reset_event *strasoc; int len; - if (sctp_stcb_is_feature_off(stcb->sctp_ep, stcb, SCTP_PCB_FLAGS_ASSOC_RESETEVNT)) { + if ((stcb == NULL) || + (sctp_stcb_is_feature_off(stcb->sctp_ep, stcb, SCTP_PCB_FLAGS_ASSOC_RESETEVNT))) { /* event not enabled */ return; } @@ -3407,7 +3409,8 @@ sctp_notify_stream_reset(struct sctp_tcb struct sctp_stream_reset_event *strreset; int len; - if (sctp_stcb_is_feature_off(stcb->sctp_ep, stcb, SCTP_PCB_FLAGS_STREAM_RESETEVNT)) { + if ((stcb == NULL) || + (sctp_stcb_is_feature_off(stcb->sctp_ep, stcb, SCTP_PCB_FLAGS_STREAM_RESETEVNT))) { /* event not enabled */ return; } From owner-svn-src-stable-9@FreeBSD.ORG Wed May 9 14:28:22 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 1043010656D1; Wed, 9 May 2012 14:28:22 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id EE9D78FC08; Wed, 9 May 2012 14:28:21 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q49ESLac087471; Wed, 9 May 2012 14:28:21 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q49ESLiB087469; Wed, 9 May 2012 14:28:21 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201205091428.q49ESLiB087469@svn.freebsd.org> From: Konstantin Belousov Date: Wed, 9 May 2012 14:28:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r235177 - stable/9/sys/sys X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 May 2012 14:28:22 -0000 Author: kib Date: Wed May 9 14:28:21 2012 New Revision: 235177 URL: http://svn.freebsd.org/changeset/base/235177 Log: MFC r235099: Add definition for the -z nodefaultlib flag. Modified: stable/9/sys/sys/elf_common.h Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/sys/elf_common.h ============================================================================== --- stable/9/sys/sys/elf_common.h Wed May 9 14:27:42 2012 (r235176) +++ stable/9/sys/sys/elf_common.h Wed May 9 14:28:21 2012 (r235177) @@ -478,6 +478,7 @@ typedef struct { #define DF_1_LOADFLTR 0x00000010 /* Immediate loading of filtees */ #define DF_1_NOOPEN 0x00000040 /* Do not allow loading on dlopen() */ #define DF_1_ORIGIN 0x00000080 /* Process $ORIGIN */ +#define DF_1_NODEFLIB 0x00000800 /* Do not search default paths */ /* Values for n_type. Used in core files. */ #define NT_PRSTATUS 1 /* Process status. */ From owner-svn-src-stable-9@FreeBSD.ORG Thu May 10 10:02:57 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 6F01B10656A7; Thu, 10 May 2012 10:02:57 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4D9EA8FC17; Thu, 10 May 2012 10:02:57 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q4AA2vkY027770; Thu, 10 May 2012 10:02:57 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q4AA2v4u027767; Thu, 10 May 2012 10:02:57 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201205101002.q4AA2v4u027767@svn.freebsd.org> From: Konstantin Belousov Date: Thu, 10 May 2012 10:02:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r235220 - in stable/9/sys: kern sys X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 May 2012 10:02:57 -0000 Author: kib Date: Thu May 10 10:02:56 2012 New Revision: 235220 URL: http://svn.freebsd.org/changeset/base/235220 Log: MFC r234952: Mark the migrating callouts with CALLOUT_DFRMIGRATION flag. The flag is cleared by callout_stop_safe() when the function detects a migration, besides returning the success. The softclock() rechecks the flag for migrating callout and cancels its execution if the flag was cleared meantime. PR: misc/166340 Modified: stable/9/sys/kern/kern_timeout.c stable/9/sys/sys/callout.h Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/kern/kern_timeout.c ============================================================================== --- stable/9/sys/kern/kern_timeout.c Thu May 10 09:47:04 2012 (r235219) +++ stable/9/sys/kern/kern_timeout.c Thu May 10 10:02:56 2012 (r235220) @@ -645,6 +645,32 @@ softclock(void *arg) cc_cme_cleanup(cc); /* + * Handle deferred callout stops + */ + if ((c->c_flags & CALLOUT_DFRMIGRATION) + == 0) { + CTR3(KTR_CALLOUT, + "deferred cancelled %p func %p arg %p", + c, new_func, new_arg); + if (cc->cc_next == c) { + cc->cc_next = + TAILQ_NEXT(c, + c_links.tqe); + } + if (c->c_flags & + CALLOUT_LOCAL_ALLOC) { + c->c_func = NULL; + SLIST_INSERT_HEAD( + &cc->cc_callfree, c, + c_links.sle); + } + goto nextc; + } else { + c->c_flags &= ~ + CALLOUT_DFRMIGRATION; + } + + /* * It should be assert here that the * callout is not destroyed but that * is not easy. @@ -659,6 +685,9 @@ softclock(void *arg) panic("migration should not happen"); #endif } +#ifdef SMP +nextc: +#endif steps = 0; c = cc->cc_next; } @@ -814,6 +843,7 @@ callout_reset_on(struct callout *c, int cc->cc_migration_ticks = to_ticks; cc->cc_migration_func = ftn; cc->cc_migration_arg = arg; + c->c_flags |= CALLOUT_DFRMIGRATION; CTR5(KTR_CALLOUT, "migration of %p func %p arg %p in %d to %u deferred", c, c->c_func, c->c_arg, to_ticks, cpu); @@ -984,6 +1014,12 @@ again: CC_UNLOCK(cc); KASSERT(!sq_locked, ("sleepqueue chain locked")); return (1); + } else if ((c->c_flags & CALLOUT_DFRMIGRATION) != 0) { + c->c_flags &= ~CALLOUT_DFRMIGRATION; + CTR3(KTR_CALLOUT, "postponing stop %p func %p arg %p", + c, c->c_func, c->c_arg); + CC_UNLOCK(cc); + return (1); } CTR3(KTR_CALLOUT, "failed to stop %p func %p arg %p", c, c->c_func, c->c_arg); Modified: stable/9/sys/sys/callout.h ============================================================================== --- stable/9/sys/sys/callout.h Thu May 10 09:47:04 2012 (r235219) +++ stable/9/sys/sys/callout.h Thu May 10 10:02:56 2012 (r235220) @@ -46,6 +46,7 @@ #define CALLOUT_MPSAFE 0x0008 /* callout handler is mp safe */ #define CALLOUT_RETURNUNLOCKED 0x0010 /* handler returns with mtx unlocked */ #define CALLOUT_SHAREDLOCK 0x0020 /* callout lock held in shared mode */ +#define CALLOUT_DFRMIGRATION 0x0040 /* callout in deferred migration mode */ struct callout_handle { struct callout *callout; From owner-svn-src-stable-9@FreeBSD.ORG Thu May 10 10:16:22 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8A243106566B; Thu, 10 May 2012 10:16:22 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 692068FC08; Thu, 10 May 2012 10:16:22 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q4AAGMOv028206; Thu, 10 May 2012 10:16:22 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q4AAGMAu028204; Thu, 10 May 2012 10:16:22 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201205101016.q4AAGMAu028204@svn.freebsd.org> From: Konstantin Belousov Date: Thu, 10 May 2012 10:16:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r235221 - stable/9/sys/kern X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 May 2012 10:16:22 -0000 Author: kib Date: Thu May 10 10:16:21 2012 New Revision: 235221 URL: http://svn.freebsd.org/changeset/base/235221 Log: MFC r234981: Move the code to call the callout callback into the helper function softclock_call_cc(). While there, move some common code to callout_cc_del(). Modified: stable/9/sys/kern/kern_timeout.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/kern/kern_timeout.c ============================================================================== --- stable/9/sys/kern/kern_timeout.c Thu May 10 10:02:56 2012 (r235220) +++ stable/9/sys/kern/kern_timeout.c Thu May 10 10:16:21 2012 (r235221) @@ -437,6 +437,181 @@ callout_cc_add(struct callout *c, struct } } +static void +callout_cc_del(struct callout *c, struct callout_cpu *cc) +{ + + if (cc->cc_next == c) + cc->cc_next = TAILQ_NEXT(c, c_links.tqe); + if (c->c_flags & CALLOUT_LOCAL_ALLOC) { + c->c_func = NULL; + SLIST_INSERT_HEAD(&cc->cc_callfree, c, c_links.sle); + } +} + +static struct callout * +softclock_call_cc(struct callout *c, struct callout_cpu *cc, int *mpcalls, + int *lockcalls, int *gcalls) +{ + void (*c_func)(void *); + void *c_arg; + struct lock_class *class; + struct lock_object *c_lock; + int c_flags, sharedlock; +#ifdef SMP + struct callout_cpu *new_cc; + void (*new_func)(void *); + void *new_arg; + int new_cpu, new_ticks; +#endif +#ifdef DIAGNOSTIC + struct bintime bt1, bt2; + struct timespec ts2; + static uint64_t maxdt = 36893488147419102LL; /* 2 msec */ + static timeout_t *lastfunc; +#endif + + cc->cc_next = TAILQ_NEXT(c, c_links.tqe); + class = (c->c_lock != NULL) ? LOCK_CLASS(c->c_lock) : NULL; + sharedlock = (c->c_flags & CALLOUT_SHAREDLOCK) ? 0 : 1; + c_lock = c->c_lock; + c_func = c->c_func; + c_arg = c->c_arg; + c_flags = c->c_flags; + if (c->c_flags & CALLOUT_LOCAL_ALLOC) + c->c_flags = CALLOUT_LOCAL_ALLOC; + else + c->c_flags &= ~CALLOUT_PENDING; + cc->cc_curr = c; + cc->cc_cancel = 0; + CC_UNLOCK(cc); + if (c_lock != NULL) { + class->lc_lock(c_lock, sharedlock); + /* + * The callout may have been cancelled + * while we switched locks. + */ + if (cc->cc_cancel) { + class->lc_unlock(c_lock); + goto skip; + } + /* The callout cannot be stopped now. */ + cc->cc_cancel = 1; + + if (c_lock == &Giant.lock_object) { + (*gcalls)++; + CTR3(KTR_CALLOUT, "callout %p func %p arg %p", + c, c_func, c_arg); + } else { + (*lockcalls)++; + CTR3(KTR_CALLOUT, "callout lock %p func %p arg %p", + c, c_func, c_arg); + } + } else { + (*mpcalls)++; + CTR3(KTR_CALLOUT, "callout mpsafe %p func %p arg %p", + c, c_func, c_arg); + } +#ifdef DIAGNOSTIC + binuptime(&bt1); +#endif + THREAD_NO_SLEEPING(); + SDT_PROBE(callout_execute, kernel, , callout_start, c, 0, 0, 0, 0); + c_func(c_arg); + SDT_PROBE(callout_execute, kernel, , callout_end, c, 0, 0, 0, 0); + THREAD_SLEEPING_OK(); +#ifdef DIAGNOSTIC + binuptime(&bt2); + bintime_sub(&bt2, &bt1); + if (bt2.frac > maxdt) { + if (lastfunc != c_func || bt2.frac > maxdt * 2) { + bintime2timespec(&bt2, &ts2); + printf( + "Expensive timeout(9) function: %p(%p) %jd.%09ld s\n", + c_func, c_arg, (intmax_t)ts2.tv_sec, ts2.tv_nsec); + } + maxdt = bt2.frac; + lastfunc = c_func; + } +#endif + CTR1(KTR_CALLOUT, "callout %p finished", c); + if ((c_flags & CALLOUT_RETURNUNLOCKED) == 0) + class->lc_unlock(c_lock); +skip: + CC_LOCK(cc); + /* + * If the current callout is locally allocated (from + * timeout(9)) then put it on the freelist. + * + * Note: we need to check the cached copy of c_flags because + * if it was not local, then it's not safe to deref the + * callout pointer. + */ + if (c_flags & CALLOUT_LOCAL_ALLOC) { + KASSERT(c->c_flags == CALLOUT_LOCAL_ALLOC, + ("corrupted callout")); + c->c_func = NULL; + SLIST_INSERT_HEAD(&cc->cc_callfree, c, c_links.sle); + } + cc->cc_curr = NULL; + if (cc->cc_waiting) { + /* + * There is someone waiting for the + * callout to complete. + * If the callout was scheduled for + * migration just cancel it. + */ + if (cc_cme_migrating(cc)) + cc_cme_cleanup(cc); + cc->cc_waiting = 0; + CC_UNLOCK(cc); + wakeup(&cc->cc_waiting); + CC_LOCK(cc); + } else if (cc_cme_migrating(cc)) { +#ifdef SMP + /* + * If the callout was scheduled for + * migration just perform it now. + */ + new_cpu = cc->cc_migration_cpu; + new_ticks = cc->cc_migration_ticks; + new_func = cc->cc_migration_func; + new_arg = cc->cc_migration_arg; + cc_cme_cleanup(cc); + + /* + * Handle deferred callout stops + */ + if ((c->c_flags & CALLOUT_DFRMIGRATION) == 0) { + CTR3(KTR_CALLOUT, + "deferred cancelled %p func %p arg %p", + c, new_func, new_arg); + callout_cc_del(c, cc); + goto nextc; + } + + c->c_flags &= ~CALLOUT_DFRMIGRATION; + + /* + * It should be assert here that the + * callout is not destroyed but that + * is not easy. + */ + new_cc = callout_cpu_switch(c, cc, new_cpu); + callout_cc_add(c, new_cc, new_ticks, new_func, new_arg, + new_cpu); + CC_UNLOCK(new_cc); + CC_LOCK(cc); +#else + panic("migration should not happen"); +#endif + } +#ifdef SMP +nextc: +#endif + return (cc->cc_next); +} + /* * The callout mechanism is based on the work of Adam M. Costello and * George Varghese, published in a technical report entitled "Redesigning @@ -465,12 +640,6 @@ softclock(void *arg) int mpcalls; int lockcalls; int gcalls; -#ifdef DIAGNOSTIC - struct bintime bt1, bt2; - struct timespec ts2; - static uint64_t maxdt = 36893488147419102LL; /* 2 msec */ - static timeout_t *lastfunc; -#endif #ifndef MAX_SOFTCLOCK_STEPS #define MAX_SOFTCLOCK_STEPS 100 /* Maximum allowed value of steps. */ @@ -492,7 +661,7 @@ softclock(void *arg) cc->cc_softticks++; bucket = &cc->cc_callwheel[curticks & callwheelmask]; c = TAILQ_FIRST(bucket); - while (c) { + while (c != NULL) { depth++; if (c->c_time != curticks) { c = TAILQ_NEXT(c, c_links.tqe); @@ -507,189 +676,10 @@ softclock(void *arg) steps = 0; } } else { - void (*c_func)(void *); - void *c_arg; - struct lock_class *class; - struct lock_object *c_lock; - int c_flags, sharedlock; - - cc->cc_next = TAILQ_NEXT(c, c_links.tqe); TAILQ_REMOVE(bucket, c, c_links.tqe); - class = (c->c_lock != NULL) ? - LOCK_CLASS(c->c_lock) : NULL; - sharedlock = (c->c_flags & CALLOUT_SHAREDLOCK) ? - 0 : 1; - c_lock = c->c_lock; - c_func = c->c_func; - c_arg = c->c_arg; - c_flags = c->c_flags; - if (c->c_flags & CALLOUT_LOCAL_ALLOC) { - c->c_flags = CALLOUT_LOCAL_ALLOC; - } else { - c->c_flags = - (c->c_flags & ~CALLOUT_PENDING); - } - cc->cc_curr = c; - cc->cc_cancel = 0; - CC_UNLOCK(cc); - if (c_lock != NULL) { - class->lc_lock(c_lock, sharedlock); - /* - * The callout may have been cancelled - * while we switched locks. - */ - if (cc->cc_cancel) { - class->lc_unlock(c_lock); - goto skip; - } - /* The callout cannot be stopped now. */ - cc->cc_cancel = 1; - - if (c_lock == &Giant.lock_object) { - gcalls++; - CTR3(KTR_CALLOUT, - "callout %p func %p arg %p", - c, c_func, c_arg); - } else { - lockcalls++; - CTR3(KTR_CALLOUT, "callout lock" - " %p func %p arg %p", - c, c_func, c_arg); - } - } else { - mpcalls++; - CTR3(KTR_CALLOUT, - "callout mpsafe %p func %p arg %p", - c, c_func, c_arg); - } -#ifdef DIAGNOSTIC - binuptime(&bt1); -#endif - THREAD_NO_SLEEPING(); - SDT_PROBE(callout_execute, kernel, , - callout_start, c, 0, 0, 0, 0); - c_func(c_arg); - SDT_PROBE(callout_execute, kernel, , - callout_end, c, 0, 0, 0, 0); - THREAD_SLEEPING_OK(); -#ifdef DIAGNOSTIC - binuptime(&bt2); - bintime_sub(&bt2, &bt1); - if (bt2.frac > maxdt) { - if (lastfunc != c_func || - bt2.frac > maxdt * 2) { - bintime2timespec(&bt2, &ts2); - printf( - "Expensive timeout(9) function: %p(%p) %jd.%09ld s\n", - c_func, c_arg, - (intmax_t)ts2.tv_sec, - ts2.tv_nsec); - } - maxdt = bt2.frac; - lastfunc = c_func; - } -#endif - CTR1(KTR_CALLOUT, "callout %p finished", c); - if ((c_flags & CALLOUT_RETURNUNLOCKED) == 0) - class->lc_unlock(c_lock); - skip: - CC_LOCK(cc); - /* - * If the current callout is locally - * allocated (from timeout(9)) - * then put it on the freelist. - * - * Note: we need to check the cached - * copy of c_flags because if it was not - * local, then it's not safe to deref the - * callout pointer. - */ - if (c_flags & CALLOUT_LOCAL_ALLOC) { - KASSERT(c->c_flags == - CALLOUT_LOCAL_ALLOC, - ("corrupted callout")); - c->c_func = NULL; - SLIST_INSERT_HEAD(&cc->cc_callfree, c, - c_links.sle); - } - cc->cc_curr = NULL; - if (cc->cc_waiting) { - - /* - * There is someone waiting for the - * callout to complete. - * If the callout was scheduled for - * migration just cancel it. - */ - if (cc_cme_migrating(cc)) - cc_cme_cleanup(cc); - cc->cc_waiting = 0; - CC_UNLOCK(cc); - wakeup(&cc->cc_waiting); - CC_LOCK(cc); - } else if (cc_cme_migrating(cc)) { -#ifdef SMP - struct callout_cpu *new_cc; - void (*new_func)(void *); - void *new_arg; - int new_cpu, new_ticks; - - /* - * If the callout was scheduled for - * migration just perform it now. - */ - new_cpu = cc->cc_migration_cpu; - new_ticks = cc->cc_migration_ticks; - new_func = cc->cc_migration_func; - new_arg = cc->cc_migration_arg; - cc_cme_cleanup(cc); - - /* - * Handle deferred callout stops - */ - if ((c->c_flags & CALLOUT_DFRMIGRATION) - == 0) { - CTR3(KTR_CALLOUT, - "deferred cancelled %p func %p arg %p", - c, new_func, new_arg); - if (cc->cc_next == c) { - cc->cc_next = - TAILQ_NEXT(c, - c_links.tqe); - } - if (c->c_flags & - CALLOUT_LOCAL_ALLOC) { - c->c_func = NULL; - SLIST_INSERT_HEAD( - &cc->cc_callfree, c, - c_links.sle); - } - goto nextc; - } else { - c->c_flags &= ~ - CALLOUT_DFRMIGRATION; - } - - /* - * It should be assert here that the - * callout is not destroyed but that - * is not easy. - */ - new_cc = callout_cpu_switch(c, cc, - new_cpu); - callout_cc_add(c, new_cc, new_ticks, - new_func, new_arg, new_cpu); - CC_UNLOCK(new_cc); - CC_LOCK(cc); -#else - panic("migration should not happen"); -#endif - } -#ifdef SMP -nextc: -#endif + c = softclock_call_cc(c, cc, &mpcalls, + &lockcalls, &gcalls); steps = 0; - c = cc->cc_next; } } } @@ -1032,19 +1022,12 @@ again: c->c_flags &= ~(CALLOUT_ACTIVE | CALLOUT_PENDING); - if (cc->cc_next == c) { - cc->cc_next = TAILQ_NEXT(c, c_links.tqe); - } - TAILQ_REMOVE(&cc->cc_callwheel[c->c_time & callwheelmask], c, - c_links.tqe); - CTR3(KTR_CALLOUT, "cancelled %p func %p arg %p", c, c->c_func, c->c_arg); + TAILQ_REMOVE(&cc->cc_callwheel[c->c_time & callwheelmask], c, + c_links.tqe); + callout_cc_del(c, cc); - if (c->c_flags & CALLOUT_LOCAL_ALLOC) { - c->c_func = NULL; - SLIST_INSERT_HEAD(&cc->cc_callfree, c, c_links.sle); - } CC_UNLOCK(cc); return (1); } From owner-svn-src-stable-9@FreeBSD.ORG Thu May 10 20:35:51 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3CD68106564A; Thu, 10 May 2012 20:35:51 +0000 (UTC) (envelope-from daichi@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 245818FC0A; Thu, 10 May 2012 20:35:51 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q4AKZpuW050760; Thu, 10 May 2012 20:35:51 GMT (envelope-from daichi@svn.freebsd.org) Received: (from daichi@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q4AKZog1050756; Thu, 10 May 2012 20:35:50 GMT (envelope-from daichi@svn.freebsd.org) Message-Id: <201205102035.q4AKZog1050756@svn.freebsd.org> From: Daichi GOTO Date: Thu, 10 May 2012 20:35:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r235243 - stable/9/sys/fs/unionfs X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 May 2012 20:35:51 -0000 Author: daichi Date: Thu May 10 20:35:50 2012 New Revision: 235243 URL: http://svn.freebsd.org/changeset/base/235243 Log: MFC: 234867 and 234944 - fixed a vnode lock hang-up issue. - fixed an incorrect lock status issue. - fixed an incorrect lock issue of unionfs root vnode removed. (pointed out by keith) - fixed an infinity loop issue. (pointed out by dumbbell) - changed to do LK_RELEASE expressly when unlocked. - fixed a unionfs_readdir math issue Submitted by: ozawa@ongs.co.jp, Matthew Fleming Modified: stable/9/sys/fs/unionfs/union_subr.c stable/9/sys/fs/unionfs/union_vfsops.c stable/9/sys/fs/unionfs/union_vnops.c Modified: stable/9/sys/fs/unionfs/union_subr.c ============================================================================== --- stable/9/sys/fs/unionfs/union_subr.c Thu May 10 20:31:08 2012 (r235242) +++ stable/9/sys/fs/unionfs/union_subr.c Thu May 10 20:35:50 2012 (r235243) @@ -2,8 +2,8 @@ * Copyright (c) 1994 Jan-Simon Pendry * Copyright (c) 1994 * The Regents of the University of California. All rights reserved. - * Copyright (c) 2005, 2006 Masanori Ozawa , ONGS Inc. - * Copyright (c) 2006 Daichi Goto + * Copyright (c) 2005, 2006, 2012 Masanori Ozawa , ONGS Inc. + * Copyright (c) 2006, 2012 Daichi Goto * * This code is derived from software contributed to Berkeley by * Jan-Simon Pendry. @@ -350,19 +350,22 @@ unionfs_noderem(struct vnode *vp, struct uvp = unp->un_uppervp; dvp = unp->un_dvp; unp->un_lowervp = unp->un_uppervp = NULLVP; - vp->v_vnlock = &(vp->v_lock); vp->v_data = NULL; - lockmgr(vp->v_vnlock, LK_EXCLUSIVE | LK_INTERLOCK, VI_MTX(vp)); + vp->v_object = NULL; + VI_UNLOCK(vp); + if (lvp != NULLVP) - VOP_UNLOCK(lvp, 0); + VOP_UNLOCK(lvp, LK_RELEASE); if (uvp != NULLVP) - VOP_UNLOCK(uvp, 0); - vp->v_object = NULL; + VOP_UNLOCK(uvp, LK_RELEASE); if (dvp != NULLVP && unp->un_hash.le_prev != NULL) unionfs_rem_cached_vnode(unp, dvp); + if (lockmgr(vp->v_vnlock, LK_EXCLUSIVE, VI_MTX(vp)) != 0) + panic("the lock for deletion is unacquirable."); + if (lvp != NULLVP) { vfslocked = VFS_LOCK_GIANT(lvp->v_mount); vrele(lvp); @@ -550,7 +553,7 @@ unionfs_relookup(struct vnode *dvp, stru cn->cn_flags |= (cnp->cn_flags & SAVESTART); vref(dvp); - VOP_UNLOCK(dvp, 0); + VOP_UNLOCK(dvp, LK_RELEASE); if ((error = relookup(dvp, vpp, cn))) { uma_zfree(namei_zone, cn->cn_pnbuf); @@ -955,7 +958,7 @@ unionfs_vn_create_on_upper(struct vnode *vpp = vp; unionfs_vn_create_on_upper_free_out1: - VOP_UNLOCK(udvp, 0); + VOP_UNLOCK(udvp, LK_RELEASE); unionfs_vn_create_on_upper_free_out2: if (cn.cn_flags & HASBUF) { Modified: stable/9/sys/fs/unionfs/union_vfsops.c ============================================================================== --- stable/9/sys/fs/unionfs/union_vfsops.c Thu May 10 20:31:08 2012 (r235242) +++ stable/9/sys/fs/unionfs/union_vfsops.c Thu May 10 20:35:50 2012 (r235243) @@ -1,8 +1,8 @@ /*- * Copyright (c) 1994, 1995 The Regents of the University of California. * Copyright (c) 1994, 1995 Jan-Simon Pendry. - * Copyright (c) 2005, 2006 Masanori Ozawa , ONGS Inc. - * Copyright (c) 2006 Daichi Goto + * Copyright (c) 2005, 2006, 2012 Masanori Ozawa , ONGS Inc. + * Copyright (c) 2006, 2012 Daichi Goto * All rights reserved. * * This code is derived from software donated to Berkeley by @@ -165,7 +165,7 @@ unionfs_domount(struct mount *mp) uid = va.va_uid; gid = va.va_gid; } - VOP_UNLOCK(mp->mnt_vnodecovered, 0); + VOP_UNLOCK(mp->mnt_vnodecovered, LK_RELEASE); if (error) return (error); @@ -250,7 +250,7 @@ unionfs_domount(struct mount *mp) * Save reference */ if (below) { - VOP_UNLOCK(upperrootvp, 0); + VOP_UNLOCK(upperrootvp, LK_RELEASE); vn_lock(lowerrootvp, LK_EXCLUSIVE | LK_RETRY); ump->um_lowervp = upperrootvp; ump->um_uppervp = lowerrootvp; @@ -281,7 +281,7 @@ unionfs_domount(struct mount *mp) /* * Unlock the node */ - VOP_UNLOCK(ump->um_uppervp, 0); + VOP_UNLOCK(ump->um_uppervp, LK_RELEASE); /* * Get the unionfs root vnode. Modified: stable/9/sys/fs/unionfs/union_vnops.c ============================================================================== --- stable/9/sys/fs/unionfs/union_vnops.c Thu May 10 20:31:08 2012 (r235242) +++ stable/9/sys/fs/unionfs/union_vnops.c Thu May 10 20:35:50 2012 (r235243) @@ -2,8 +2,8 @@ * Copyright (c) 1992, 1993, 1994, 1995 Jan-Simon Pendry. * Copyright (c) 1992, 1993, 1994, 1995 * The Regents of the University of California. - * Copyright (c) 2005, 2006 Masanori Ozawa , ONGS Inc. - * Copyright (c) 2006 Daichi Goto + * Copyright (c) 2005, 2006, 2012 Masanori Ozawa , ONGS Inc. + * Copyright (c) 2006, 2012 Daichi Goto * All rights reserved. * * This code is derived from software contributed to Berkeley by @@ -75,21 +75,6 @@ KASSERT(((vp)->v_op == &unionfs_vnodeops), \ ("unionfs: it is not unionfs-vnode")) -/* lockmgr lock <-> reverse table */ -struct lk_lr_table { - int lock; - int revlock; -}; - -static struct lk_lr_table un_llt[] = { - {LK_SHARED, LK_RELEASE}, - {LK_EXCLUSIVE, LK_RELEASE}, - {LK_UPGRADE, LK_DOWNGRADE}, - {LK_DOWNGRADE, LK_UPGRADE}, - {0, 0} -}; - - static int unionfs_lookup(struct vop_cachedlookup_args *ap) { @@ -141,7 +126,7 @@ unionfs_lookup(struct vop_cachedlookup_a if (udvp != NULLVP) { dtmpvp = udvp; if (ldvp != NULLVP) - VOP_UNLOCK(ldvp, 0); + VOP_UNLOCK(ldvp, LK_RELEASE); } else dtmpvp = ldvp; @@ -149,7 +134,7 @@ unionfs_lookup(struct vop_cachedlookup_a error = VOP_LOOKUP(dtmpvp, &vp, cnp); if (dtmpvp == udvp && ldvp != NULLVP) { - VOP_UNLOCK(udvp, 0); + VOP_UNLOCK(udvp, LK_RELEASE); vn_lock(dvp, LK_EXCLUSIVE | LK_RETRY); } @@ -161,10 +146,10 @@ unionfs_lookup(struct vop_cachedlookup_a */ if (nameiop == DELETE || nameiop == RENAME || (cnp->cn_lkflags & LK_TYPE_MASK)) - VOP_UNLOCK(vp, 0); + VOP_UNLOCK(vp, LK_RELEASE); vrele(vp); - VOP_UNLOCK(dvp, 0); + VOP_UNLOCK(dvp, LK_RELEASE); *(ap->a_vpp) = dunp->un_dvp; vref(dunp->un_dvp); @@ -202,7 +187,7 @@ unionfs_lookup(struct vop_cachedlookup_a } if (nameiop == DELETE || nameiop == RENAME || (cnp->cn_lkflags & LK_TYPE_MASK)) - VOP_UNLOCK(uvp, 0); + VOP_UNLOCK(uvp, LK_RELEASE); } /* check whiteout */ @@ -246,7 +231,7 @@ unionfs_lookup(struct vop_cachedlookup_a return (lerror); } if (cnp->cn_lkflags & LK_TYPE_MASK) - VOP_UNLOCK(lvp, 0); + VOP_UNLOCK(lvp, LK_RELEASE); } } @@ -281,7 +266,7 @@ unionfs_lookup(struct vop_cachedlookup_a goto unionfs_lookup_out; if (LK_SHARED == (cnp->cn_lkflags & LK_TYPE_MASK)) - VOP_UNLOCK(vp, 0); + VOP_UNLOCK(vp, LK_RELEASE); if (LK_EXCLUSIVE != VOP_ISLOCKED(vp)) { vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); lockflag = 1; @@ -289,7 +274,7 @@ unionfs_lookup(struct vop_cachedlookup_a error = unionfs_mkshadowdir(MOUNTTOUNIONFSMOUNT(dvp->v_mount), udvp, VTOUNIONFS(vp), cnp, td); if (lockflag != 0) - VOP_UNLOCK(vp, 0); + VOP_UNLOCK(vp, LK_RELEASE); if (error != 0) { UNIONFSDEBUG("unionfs_lookup: Unable to create shadow dir."); if ((cnp->cn_lkflags & LK_TYPE_MASK) == LK_EXCLUSIVE) @@ -386,7 +371,7 @@ unionfs_create(struct vop_create_args *a if (vp->v_type == VSOCK) *(ap->a_vpp) = vp; else { - VOP_UNLOCK(vp, 0); + VOP_UNLOCK(vp, LK_RELEASE); error = unionfs_nodeget(ap->a_dvp->v_mount, vp, NULLVP, ap->a_dvp, ap->a_vpp, cnp, curthread); vrele(vp); @@ -460,7 +445,7 @@ unionfs_mknod(struct vop_mknod_args *ap) if (vp->v_type == VSOCK) *(ap->a_vpp) = vp; else { - VOP_UNLOCK(vp, 0); + VOP_UNLOCK(vp, LK_RELEASE); error = unionfs_nodeget(ap->a_dvp->v_mount, vp, NULLVP, ap->a_dvp, ap->a_vpp, cnp, curthread); vrele(vp); @@ -564,6 +549,7 @@ unionfs_close(struct vop_close_args *ap) struct unionfs_node_status *unsp; struct ucred *cred; struct thread *td; + struct vnode *vp; struct vnode *ovp; UNIONFS_INTERNAL_DEBUG("unionfs_close: enter\n"); @@ -571,12 +557,14 @@ unionfs_close(struct vop_close_args *ap) KASSERT_UNIONFS_VNODE(ap->a_vp); locked = 0; - unp = VTOUNIONFS(ap->a_vp); + vp = ap->a_vp; + unp = VTOUNIONFS(vp); cred = ap->a_cred; td = ap->a_td; - if (VOP_ISLOCKED(ap->a_vp) != LK_EXCLUSIVE) { - vn_lock(ap->a_vp, LK_EXCLUSIVE | LK_RETRY); + if (VOP_ISLOCKED(vp) != LK_EXCLUSIVE) { + if (vn_lock(vp, LK_UPGRADE) != 0) + vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); locked = 1; } unionfs_get_node_status(unp, td, &unsp); @@ -599,7 +587,7 @@ unionfs_close(struct vop_close_args *ap) if (error != 0) goto unionfs_close_abort; - ap->a_vp->v_object = ovp->v_object; + vp->v_object = ovp->v_object; if (ovp == unp->un_uppervp) { unsp->uns_upper_opencnt--; @@ -610,7 +598,7 @@ unionfs_close(struct vop_close_args *ap) unsp->uns_lower_opencnt--; } if (unsp->uns_lower_opencnt > 0) - ap->a_vp->v_object = unp->un_lowervp->v_object; + vp->v_object = unp->un_lowervp->v_object; } } else unsp->uns_lower_opencnt--; @@ -619,7 +607,7 @@ unionfs_close_abort: unionfs_tryrem_node_status(unp, unsp); if (locked != 0) - VOP_UNLOCK(ap->a_vp, 0); + vn_lock(vp, LK_DOWNGRADE | LK_RETRY); UNIONFS_INTERNAL_DEBUG("unionfs_close: leave (%d)\n", error); @@ -914,7 +902,7 @@ unionfs_ioctl(struct vop_ioctl_args *ap) unionfs_get_node_status(unp, ap->a_td, &unsp); ovp = (unsp->uns_upper_opencnt ? unp->un_uppervp : unp->un_lowervp); unionfs_tryrem_node_status(unp, unsp); - VOP_UNLOCK(ap->a_vp, 0); + VOP_UNLOCK(ap->a_vp, LK_RELEASE); if (ovp == NULLVP) return (EBADF); @@ -941,7 +929,7 @@ unionfs_poll(struct vop_poll_args *ap) unionfs_get_node_status(unp, ap->a_td, &unsp); ovp = (unsp->uns_upper_opencnt ? unp->un_uppervp : unp->un_lowervp); unionfs_tryrem_node_status(unp, unsp); - VOP_UNLOCK(ap->a_vp, 0); + VOP_UNLOCK(ap->a_vp, LK_RELEASE); if (ovp == NULLVP) return (EBADF); @@ -1001,7 +989,7 @@ unionfs_remove(struct vop_remove_args *a ump = NULL; vp = uvp = lvp = NULLVP; /* search vnode */ - VOP_UNLOCK(ap->a_vp, 0); + VOP_UNLOCK(ap->a_vp, LK_RELEASE); error = unionfs_relookup(udvp, &vp, cnp, &cn, td, cnp->cn_nameptr, strlen(cnp->cn_nameptr), DELETE); if (error != 0 && error != ENOENT) { @@ -1204,7 +1192,7 @@ unionfs_rename(struct vop_rename_args *a if ((error = vn_lock(fvp, LK_EXCLUSIVE)) != 0) goto unionfs_rename_abort; error = unionfs_copyfile(unp, 1, fcnp->cn_cred, td); - VOP_UNLOCK(fvp, 0); + VOP_UNLOCK(fvp, LK_RELEASE); if (error != 0) goto unionfs_rename_abort; break; @@ -1212,7 +1200,7 @@ unionfs_rename(struct vop_rename_args *a if ((error = vn_lock(fvp, LK_EXCLUSIVE)) != 0) goto unionfs_rename_abort; error = unionfs_mkshadowdir(ump, rfdvp, unp, fcnp, td); - VOP_UNLOCK(fvp, 0); + VOP_UNLOCK(fvp, LK_RELEASE); if (error != 0) goto unionfs_rename_abort; break; @@ -1269,13 +1257,13 @@ unionfs_rename(struct vop_rename_args *a if ((error = vn_lock(fdvp, LK_EXCLUSIVE)) != 0) goto unionfs_rename_abort; error = unionfs_relookup_for_delete(fdvp, fcnp, td); - VOP_UNLOCK(fdvp, 0); + VOP_UNLOCK(fdvp, LK_RELEASE); if (error != 0) goto unionfs_rename_abort; /* Locke of tvp is canceled in order to avoid recursive lock. */ if (tvp != NULLVP && tvp != tdvp) - VOP_UNLOCK(tvp, 0); + VOP_UNLOCK(tvp, LK_RELEASE); error = unionfs_relookup_for_rename(tdvp, tcnp, td); if (tvp != NULLVP && tvp != tdvp) vn_lock(tvp, LK_EXCLUSIVE | LK_RETRY); @@ -1293,11 +1281,11 @@ unionfs_rename(struct vop_rename_args *a } if (ltdvp != NULLVP) - VOP_UNLOCK(ltdvp, 0); + VOP_UNLOCK(ltdvp, LK_RELEASE); if (tdvp != rtdvp) vrele(tdvp); if (ltvp != NULLVP) - VOP_UNLOCK(ltvp, 0); + VOP_UNLOCK(ltvp, LK_RELEASE); if (tvp != rtvp && tvp != NULLVP) { if (rtvp == NULLVP) vput(tvp); @@ -1371,7 +1359,7 @@ unionfs_mkdir(struct vop_mkdir_args *ap) } if ((error = VOP_MKDIR(udvp, &uvp, cnp, ap->a_vap)) == 0) { - VOP_UNLOCK(uvp, 0); + VOP_UNLOCK(uvp, LK_RELEASE); cnp->cn_lkflags = LK_EXCLUSIVE; error = unionfs_nodeget(ap->a_dvp->v_mount, uvp, NULLVP, ap->a_dvp, ap->a_vpp, cnp, td); @@ -1427,7 +1415,9 @@ unionfs_rmdir(struct vop_rmdir_args *ap) ump = MOUNTTOUNIONFSMOUNT(ap->a_vp->v_mount); if (ump->um_whitemode == UNIONFS_WHITE_ALWAYS || lvp != NULLVP) cnp->cn_flags |= DOWHITEOUT; - error = VOP_RMDIR(udvp, uvp, cnp); + error = unionfs_relookup_for_delete(ap->a_dvp, cnp, td); + if (!error) + error = VOP_RMDIR(udvp, uvp, cnp); } else if (lvp != NULLVP) error = unionfs_mkwhiteout(udvp, cnp, td, unp->un_path); @@ -1467,7 +1457,7 @@ unionfs_symlink(struct vop_symlink_args if (udvp != NULLVP) { error = VOP_SYMLINK(udvp, &uvp, cnp, ap->a_vap, ap->a_target); if (error == 0) { - VOP_UNLOCK(uvp, 0); + VOP_UNLOCK(uvp, LK_RELEASE); cnp->cn_lkflags = LK_EXCLUSIVE; error = unionfs_nodeget(ap->a_dvp->v_mount, uvp, NULLVP, ap->a_dvp, ap->a_vpp, cnp, td); @@ -1487,9 +1477,11 @@ unionfs_readdir(struct vop_readdir_args int error; int eofflag; int locked; + int uio_offset_bk; struct unionfs_node *unp; struct unionfs_node_status *unsp; struct uio *uio; + struct vnode *vp; struct vnode *uvp; struct vnode *lvp; struct thread *td; @@ -1505,41 +1497,50 @@ unionfs_readdir(struct vop_readdir_args error = 0; eofflag = 0; locked = 0; - unp = VTOUNIONFS(ap->a_vp); + uio_offset_bk = 0; uio = ap->a_uio; - uvp = unp->un_uppervp; - lvp = unp->un_lowervp; + uvp = NULLVP; + lvp = NULLVP; td = uio->uio_td; ncookies_bk = 0; cookies_bk = NULL; - if (ap->a_vp->v_type != VDIR) + vp = ap->a_vp; + if (vp->v_type != VDIR) return (ENOTDIR); - /* check opaque */ - if (uvp != NULLVP && lvp != NULLVP) { - if ((error = VOP_GETATTR(uvp, &va, ap->a_cred)) != 0) - goto unionfs_readdir_exit; - if (va.va_flags & OPAQUE) - lvp = NULLVP; - } - /* check the open count. unionfs needs to open before readdir. */ - if (VOP_ISLOCKED(ap->a_vp) != LK_EXCLUSIVE) { - vn_lock(ap->a_vp, LK_UPGRADE | LK_RETRY); + if (VOP_ISLOCKED(vp) != LK_EXCLUSIVE) { + if (vn_lock(vp, LK_UPGRADE) != 0) + vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); locked = 1; } - unionfs_get_node_status(unp, td, &unsp); - if ((uvp != NULLVP && unsp->uns_upper_opencnt <= 0) || - (lvp != NULLVP && unsp->uns_lower_opencnt <= 0)) { - unionfs_tryrem_node_status(unp, unsp); + unp = VTOUNIONFS(vp); + if (unp == NULL) error = EBADF; + else { + uvp = unp->un_uppervp; + lvp = unp->un_lowervp; + unionfs_get_node_status(unp, td, &unsp); + if ((uvp != NULLVP && unsp->uns_upper_opencnt <= 0) || + (lvp != NULLVP && unsp->uns_lower_opencnt <= 0)) { + unionfs_tryrem_node_status(unp, unsp); + error = EBADF; + } } - if (locked == 1) - vn_lock(ap->a_vp, LK_DOWNGRADE | LK_RETRY); + if (locked) + vn_lock(vp, LK_DOWNGRADE | LK_RETRY); if (error != 0) goto unionfs_readdir_exit; + /* check opaque */ + if (uvp != NULLVP && lvp != NULLVP) { + if ((error = VOP_GETATTR(uvp, &va, ap->a_cred)) != 0) + goto unionfs_readdir_exit; + if (va.va_flags & OPAQUE) + lvp = NULLVP; + } + /* upper only */ if (uvp != NULLVP && lvp == NULLVP) { error = VOP_READDIR(uvp, uio, ap->a_cred, ap->a_eofflag, @@ -1576,7 +1577,7 @@ unionfs_readdir(struct vop_readdir_args unsp->uns_readdir_status = 1; /* - * ufs(and other fs) needs size of uio_resid larger than + * UFS(and other FS) needs size of uio_resid larger than * DIRBLKSIZ. * size of DIRBLKSIZ equals DEV_BSIZE. * (see: ufs/ufs/ufs_vnops.c ufs_readdir func , ufs/ufs/dir.h) @@ -1585,7 +1586,7 @@ unionfs_readdir(struct vop_readdir_args goto unionfs_readdir_exit; /* - * backup cookies + * Backup cookies. * It prepares to readdir in lower. */ if (ap->a_ncookies != NULL) { @@ -1601,6 +1602,11 @@ unionfs_readdir(struct vop_readdir_args /* initialize for readdir in lower */ if (unsp->uns_readdir_status == 1) { unsp->uns_readdir_status = 2; + /* + * Backup uio_offset. See the comment after the + * VOP_READDIR call on the lower layer. + */ + uio_offset_bk = uio->uio_offset; uio->uio_offset = 0; } @@ -1612,6 +1618,19 @@ unionfs_readdir(struct vop_readdir_args error = VOP_READDIR(lvp, uio, ap->a_cred, ap->a_eofflag, ap->a_ncookies, ap->a_cookies); + /* + * We can't return an uio_offset of 0: this would trigger an + * infinite loop, because the next call to unionfs_readdir would + * always restart with the upper layer (uio_offset == 0) and + * always return some data. + * + * This happens when the lower layer root directory is removed. + * (A root directory deleting of unionfs should not be permitted. + * But current VFS can not do it.) + */ + if (uio->uio_offset == 0) + uio->uio_offset = uio_offset_bk; + if (cookies_bk != NULL) { /* merge cookies */ int size; @@ -1623,7 +1642,7 @@ unionfs_readdir(struct vop_readdir_args pos = newcookies; memcpy(pos, cookies_bk, ncookies_bk * sizeof(u_long)); - pos += ncookies_bk * sizeof(u_long); + pos += ncookies_bk; memcpy(pos, *(ap->a_cookies), *(ap->a_ncookies) * sizeof(u_long)); free(cookies_bk, M_TEMP); free(*(ap->a_cookies), M_TEMP); @@ -1743,18 +1762,66 @@ unionfs_print(struct vop_print_args *ap) } static int -unionfs_get_llt_revlock(int flags) +unionfs_islocked(struct vop_islocked_args *ap) { - int count; + struct unionfs_node *unp; - flags &= LK_TYPE_MASK; - for (count = 0; un_llt[count].lock != 0; count++) { - if (flags == un_llt[count].lock) { - return un_llt[count].revlock; - } + KASSERT_UNIONFS_VNODE(ap->a_vp); + + unp = VTOUNIONFS(ap->a_vp); + if (unp == NULL) + return (vop_stdislocked(ap)); + + if (unp->un_uppervp != NULLVP) + return (VOP_ISLOCKED(unp->un_uppervp)); + if (unp->un_lowervp != NULLVP) + return (VOP_ISLOCKED(unp->un_lowervp)); + return (vop_stdislocked(ap)); +} + +static int +unionfs_get_llt_revlock(struct vnode *vp, int flags) +{ + int revlock; + + revlock = 0; + + switch (flags & LK_TYPE_MASK) { + case LK_SHARED: + if (VOP_ISLOCKED(vp) == LK_EXCLUSIVE) + revlock = LK_UPGRADE; + else + revlock = LK_RELEASE; + break; + case LK_EXCLUSIVE: + case LK_UPGRADE: + revlock = LK_RELEASE; + break; + case LK_DOWNGRADE: + revlock = LK_UPGRADE; + break; + default: + break; } - return 0; + return (revlock); +} + +/* + * The state of an acquired lock is adjusted similarly to + * the time of error generating. + * flags: LK_RELEASE or LK_UPGRADE + */ +static void +unionfs_revlock(struct vnode *vp, int flags) +{ + if (flags & LK_RELEASE) + VOP_UNLOCK(vp, flags); + else { + /* UPGRADE */ + if (vn_lock(vp, flags) != 0) + vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); + } } static int @@ -1763,6 +1830,7 @@ unionfs_lock(struct vop_lock1_args *ap) int error; int flags; int revlock; + int interlock; int uhold; struct mount *mp; struct unionfs_mount *ump; @@ -1774,15 +1842,13 @@ unionfs_lock(struct vop_lock1_args *ap) KASSERT_UNIONFS_VNODE(ap->a_vp); error = 0; + interlock = 1; uhold = 0; flags = ap->a_flags; vp = ap->a_vp; if (LK_RELEASE == (flags & LK_TYPE_MASK) || !(flags & LK_TYPE_MASK)) - return (VOP_UNLOCK(vp, flags)); - - if ((revlock = unionfs_get_llt_revlock(flags)) == 0) - panic("unknown lock type: 0x%x", flags & LK_TYPE_MASK); + return (VOP_UNLOCK(vp, flags | LK_RELEASE)); if ((flags & LK_INTERLOCK) == 0) VI_LOCK(vp); @@ -1798,6 +1864,9 @@ unionfs_lock(struct vop_lock1_args *ap) lvp = unp->un_lowervp; uvp = unp->un_uppervp; + if ((revlock = unionfs_get_llt_revlock(vp, flags)) == 0) + panic("unknown lock type: 0x%x", flags & LK_TYPE_MASK); + if ((mp->mnt_kern_flag & MNTK_MPSAFE) != 0 && (vp->v_iflag & VI_OWEINACT) != 0) flags |= LK_NOWAIT; @@ -1811,6 +1880,23 @@ unionfs_lock(struct vop_lock1_args *ap) flags |= LK_CANRECURSE; if (lvp != NULLVP) { + if (uvp != NULLVP && flags & LK_UPGRADE) { + /* Share Lock is once released and a deadlock is avoided. */ + VI_LOCK_FLAGS(uvp, MTX_DUPOK); + vholdl(uvp); + uhold = 1; + VI_UNLOCK(vp); + VOP_UNLOCK(uvp, LK_RELEASE | LK_INTERLOCK); + VI_LOCK(vp); + unp = VTOUNIONFS(vp); + if (unp == NULL) { + /* vnode is released. */ + VI_UNLOCK(vp); + VOP_UNLOCK(lvp, LK_RELEASE); + vdrop(uvp); + return (EBUSY); + } + } VI_LOCK_FLAGS(lvp, MTX_DUPOK); flags |= LK_INTERLOCK; vholdl(lvp); @@ -1823,19 +1909,28 @@ unionfs_lock(struct vop_lock1_args *ap) VI_LOCK(vp); unp = VTOUNIONFS(vp); if (unp == NULL) { + /* vnode is released. */ VI_UNLOCK(vp); if (error == 0) - VOP_UNLOCK(lvp, 0); + VOP_UNLOCK(lvp, LK_RELEASE); vdrop(lvp); + if (uhold != 0) + vdrop(uvp); return (vop_stdlock(ap)); } } if (error == 0 && uvp != NULLVP) { + if (uhold && flags & LK_UPGRADE) { + flags &= ~LK_TYPE_MASK; + flags |= LK_EXCLUSIVE; + } VI_LOCK_FLAGS(uvp, MTX_DUPOK); flags |= LK_INTERLOCK; - vholdl(uvp); - uhold = 1; + if (uhold == 0) { + vholdl(uvp); + uhold = 1; + } VI_UNLOCK(vp); ap->a_flags &= ~LK_INTERLOCK; @@ -1845,30 +1940,27 @@ unionfs_lock(struct vop_lock1_args *ap) VI_LOCK(vp); unp = VTOUNIONFS(vp); if (unp == NULL) { + /* vnode is released. */ VI_UNLOCK(vp); - if (error == 0) { - VOP_UNLOCK(uvp, 0); - if (lvp != NULLVP) - VOP_UNLOCK(lvp, 0); - } - if (lvp != NULLVP) - vdrop(lvp); + if (error == 0) + VOP_UNLOCK(uvp, LK_RELEASE); vdrop(uvp); + if (lvp != NULLVP) { + VOP_UNLOCK(lvp, LK_RELEASE); + vdrop(lvp); + } return (vop_stdlock(ap)); } - if (error != 0 && lvp != NULLVP) { + /* rollback */ VI_UNLOCK(vp); - if ((revlock & LK_TYPE_MASK) == LK_RELEASE) - VOP_UNLOCK(lvp, revlock); - else - vn_lock(lvp, revlock | LK_RETRY); - goto unionfs_lock_abort; + unionfs_revlock(lvp, revlock); + interlock = 0; } } - VI_UNLOCK(vp); -unionfs_lock_abort: + if (interlock) + VI_UNLOCK(vp); if (lvp != NULLVP) vdrop(lvp); if (uhold != 0) @@ -2013,7 +2105,7 @@ unionfs_advlock(struct vop_advlock_args unionfs_tryrem_node_status(unp, unsp); } - VOP_UNLOCK(vp, 0); + VOP_UNLOCK(vp, LK_RELEASE); error = VOP_ADVLOCK(uvp, ap->a_id, ap->a_op, ap->a_fl, ap->a_flags); @@ -2022,7 +2114,7 @@ unionfs_advlock(struct vop_advlock_args return error; unionfs_advlock_abort: - VOP_UNLOCK(vp, 0); + VOP_UNLOCK(vp, LK_RELEASE); UNIONFS_INTERNAL_DEBUG("unionfs_advlock: leave (%d)\n", error); @@ -2150,7 +2242,8 @@ unionfs_openextattr(struct vop_openextat error = VOP_OPENEXTATTR(tvp, ap->a_cred, ap->a_td); if (error == 0) { - vn_lock(vp, LK_UPGRADE | LK_RETRY); + if (vn_lock(vp, LK_UPGRADE) != 0) + vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); if (tvp == unp->un_uppervp) unp->un_flag |= UNIONFS_OPENEXTU; else @@ -2186,7 +2279,8 @@ unionfs_closeextattr(struct vop_closeext error = VOP_CLOSEEXTATTR(tvp, ap->a_commit, ap->a_cred, ap->a_td); if (error == 0) { - vn_lock(vp, LK_UPGRADE | LK_RETRY); + if (vn_lock(vp, LK_UPGRADE) != 0) + vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); if (tvp == unp->un_uppervp) unp->un_flag &= ~UNIONFS_OPENEXTU; else @@ -2435,6 +2529,7 @@ struct vop_vector unionfs_vnodeops = { .vop_getextattr = unionfs_getextattr, .vop_getwritemount = unionfs_getwritemount, .vop_inactive = unionfs_inactive, + .vop_islocked = unionfs_islocked, .vop_ioctl = unionfs_ioctl, .vop_link = unionfs_link, .vop_listextattr = unionfs_listextattr, From owner-svn-src-stable-9@FreeBSD.ORG Thu May 10 22:36:02 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 134A11065673; Thu, 10 May 2012 22:36:02 +0000 (UTC) (envelope-from daichi@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D97E78FC0C; Thu, 10 May 2012 22:36:01 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q4AMa1sH054749; Thu, 10 May 2012 22:36:01 GMT (envelope-from daichi@svn.freebsd.org) Received: (from daichi@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q4AMa1pJ054748; Thu, 10 May 2012 22:36:01 GMT (envelope-from daichi@svn.freebsd.org) Message-Id: <201205102236.q4AMa1pJ054748@svn.freebsd.org> From: Daichi GOTO Date: Thu, 10 May 2012 22:36:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r235249 - in stable/9/sys: . fs X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 May 2012 22:36:02 -0000 Author: daichi Date: Thu May 10 22:36:01 2012 New Revision: 235249 URL: http://svn.freebsd.org/changeset/base/235249 Log: Added forgotten r234867,234944 mergeinfo Modified: Directory Properties: stable/9/sys/ (props changed) stable/9/sys/fs/ (props changed) From owner-svn-src-stable-9@FreeBSD.ORG Fri May 11 01:24:17 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9DABA1065689; Fri, 11 May 2012 01:24:17 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6EBFE8FC16; Fri, 11 May 2012 01:24:17 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q4B1OHLX059955; Fri, 11 May 2012 01:24:17 GMT (envelope-from emaste@svn.freebsd.org) Received: (from emaste@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q4B1OHPi059953; Fri, 11 May 2012 01:24:17 GMT (envelope-from emaste@svn.freebsd.org) Message-Id: <201205110124.q4B1OHPi059953@svn.freebsd.org> From: Ed Maste Date: Fri, 11 May 2012 01:24:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r235253 - stable/9/lib/libfetch X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 May 2012 01:24:17 -0000 Author: emaste Date: Fri May 11 01:24:16 2012 New Revision: 235253 URL: http://svn.freebsd.org/changeset/base/235253 Log: MFC r234138: Support percent-encoded user and password RFC 1738 specifies that any ":", "@", or "/" within a user name or password in a URL is percent-encoded, to avoid ambiguity with the use of those characters as URL component separators. Modified: stable/9/lib/libfetch/fetch.c Directory Properties: stable/9/lib/libfetch/ (props changed) Modified: stable/9/lib/libfetch/fetch.c ============================================================================== --- stable/9/lib/libfetch/fetch.c Fri May 11 00:19:06 2012 (r235252) +++ stable/9/lib/libfetch/fetch.c Fri May 11 01:24:16 2012 (r235253) @@ -289,6 +289,49 @@ fetchMakeURL(const char *scheme, const c } /* + * Return value of the given hex digit. + */ +static int +fetch_hexval(char ch) +{ + + if (ch >= '0' && ch <= '9') + return (ch - '0'); + else if (ch >= 'a' && ch <= 'f') + return (ch - 'a' + 10); + else if (ch >= 'A' && ch <= 'F') + return (ch - 'A' + 10); + return (-1); +} + +/* + * Decode percent-encoded URL component from src into dst, stopping at end + * of string, or at @ or : separators. Returns a pointer to the unhandled + * part of the input string (null terminator, @, or :). No terminator is + * written to dst (it is the caller's responsibility). + */ +static const char * +fetch_pctdecode(char *dst, const char *src, size_t dlen) +{ + int d1, d2; + char c; + const char *s; + + for (s = src; *s != '\0' && *s != '@' && *s != ':'; s++) { + if (s[0] == '%' && (d1 = fetch_hexval(s[1])) >= 0 && + (d2 = fetch_hexval(s[2])) >= 0 && (d1 > 0 || d2 > 0)) { + c = d1 << 4 | d2; + s += 2; + } else { + c = *s; + } + if (dlen-- > 0) + *dst++ = c; + } + return (s); +} + +/* * Split an URL into components. URL syntax is: * [method:/][/[user[:pwd]@]host[:port]/][document] * This almost, but not quite, RFC1738 URL syntax. @@ -329,15 +372,11 @@ fetchParseURL(const char *URL) p = strpbrk(URL, "/@"); if (p && *p == '@') { /* username */ - for (q = URL, i = 0; (*q != ':') && (*q != '@'); q++) - if (i < URL_USERLEN) - u->user[i++] = *q; + q = fetch_pctdecode(u->user, URL, URL_USERLEN); /* password */ if (*q == ':') - for (q++, i = 0; (*q != ':') && (*q != '@'); q++) - if (i < URL_PWDLEN) - u->pwd[i++] = *q; + q = fetch_pctdecode(u->pwd, ++q, URL_PWDLEN); p++; } else { From owner-svn-src-stable-9@FreeBSD.ORG Fri May 11 04:02:18 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 46A71106564A; Fri, 11 May 2012 04:02:18 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 30BF98FC08; Fri, 11 May 2012 04:02:18 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q4B42IMS065341; Fri, 11 May 2012 04:02:18 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q4B42Hjc065339; Fri, 11 May 2012 04:02:17 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201205110402.q4B42Hjc065339@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Fri, 11 May 2012 04:02:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r235258 - stable/9/sbin/geom/class/part X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 May 2012 04:02:18 -0000 Author: ae Date: Fri May 11 04:02:17 2012 New Revision: 235258 URL: http://svn.freebsd.org/changeset/base/235258 Log: MFC r235033: Don't ignore start offset value when user specifies it together with alignment. PR: bin/167567 Tested by: Warren Block Modified: stable/9/sbin/geom/class/part/geom_part.c Directory Properties: stable/9/sbin/geom/class/part/ (props changed) Modified: stable/9/sbin/geom/class/part/geom_part.c ============================================================================== --- stable/9/sbin/geom/class/part/geom_part.c Fri May 11 03:17:32 2012 (r235257) +++ stable/9/sbin/geom/class/part/geom_part.c Fri May 11 04:02:17 2012 (r235258) @@ -507,6 +507,8 @@ gpart_autofill(struct gctl_req *req) grade = ~0ULL; a_first = ALIGNUP(first + offset, alignment); last = ALIGNDOWN(last + offset, alignment); + if (a_first < start) + a_first = start; while ((pp = find_provider(gp, first)) != NULL) { s = find_provcfg(pp, "start"); lba = (off_t)strtoimax(s, NULL, 0); @@ -536,7 +538,8 @@ gpart_autofill(struct gctl_req *req) s = find_provcfg(pp, "end"); first = (off_t)strtoimax(s, NULL, 0) + 1; - a_first = ALIGNUP(first + offset, alignment); + if (first > a_first) + a_first = ALIGNUP(first + offset, alignment); } if (a_first <= last) { /* Free space [first-last] */ From owner-svn-src-stable-9@FreeBSD.ORG Fri May 11 04:10:24 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 48C561065693; Fri, 11 May 2012 04:10:24 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 306AE8FC0A; Fri, 11 May 2012 04:10:24 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q4B4AOK1065653; Fri, 11 May 2012 04:10:24 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q4B4ANKv065641; Fri, 11 May 2012 04:10:23 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201205110410.q4B4ANKv065641@svn.freebsd.org> From: Attilio Rao Date: Fri, 11 May 2012 04:10:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r235260 - in stable/9/sys: amd64/amd64 amd64/include i386/conf i386/i386 i386/include kern pc98/pc98 sparc64/include sparc64/sparc64 x86/x86 X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 May 2012 04:10:24 -0000 Author: attilio Date: Fri May 11 04:10:23 2012 New Revision: 235260 URL: http://svn.freebsd.org/changeset/base/235260 Log: MFC r233961,234074,234105,234564,234723,234989,235231-235232: - Fix a bug in x86 and sparc64 where the intr cpu mask does only enables the BSP. - Remove the SMP constraints for intr_add_cpu Modified: stable/9/sys/amd64/amd64/machdep.c stable/9/sys/amd64/amd64/mp_machdep.c stable/9/sys/amd64/include/intr_machdep.h stable/9/sys/i386/i386/machdep.c stable/9/sys/i386/i386/mp_machdep.c stable/9/sys/i386/include/intr_machdep.h stable/9/sys/pc98/pc98/machdep.c stable/9/sys/sparc64/include/intr_machdep.h stable/9/sys/sparc64/sparc64/intr_machdep.c stable/9/sys/sparc64/sparc64/machdep.c stable/9/sys/x86/x86/intr_machdep.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) stable/9/sys/fs/ (props changed) stable/9/sys/fs/ntfs/ (props changed) stable/9/sys/i386/conf/XENHVM (props changed) stable/9/sys/kern/subr_witness.c (props changed) Modified: stable/9/sys/amd64/amd64/machdep.c ============================================================================== --- stable/9/sys/amd64/amd64/machdep.c Fri May 11 04:02:37 2012 (r235259) +++ stable/9/sys/amd64/amd64/machdep.c Fri May 11 04:10:23 2012 (r235260) @@ -295,6 +295,11 @@ cpu_startup(dummy) vm_pager_bufferinit(); cpu_setregs(); + + /* + * Add BSP as an interrupt target. + */ + intr_add_cpu(0); } /* Modified: stable/9/sys/amd64/amd64/mp_machdep.c ============================================================================== --- stable/9/sys/amd64/amd64/mp_machdep.c Fri May 11 04:02:37 2012 (r235259) +++ stable/9/sys/amd64/amd64/mp_machdep.c Fri May 11 04:10:23 2012 (r235260) @@ -785,8 +785,6 @@ init_secondary(void) * We tell the I/O APIC code about all the CPUs we want to receive * interrupts. If we don't want certain CPUs to receive IRQs we * can simply not tell the I/O APIC code about them in this function. - * We also do not tell it about the BSP since it tells itself about - * the BSP internally to work with UP kernels and on UP machines. */ static void set_interrupt_apic_ids(void) @@ -797,8 +795,6 @@ set_interrupt_apic_ids(void) apic_id = cpu_apic_ids[i]; if (apic_id == -1) continue; - if (cpu_info[apic_id].cpu_bsp) - continue; if (cpu_info[apic_id].cpu_disabled) continue; Modified: stable/9/sys/amd64/include/intr_machdep.h ============================================================================== --- stable/9/sys/amd64/include/intr_machdep.h Fri May 11 04:02:37 2012 (r235259) +++ stable/9/sys/amd64/include/intr_machdep.h Fri May 11 04:10:23 2012 (r235260) @@ -140,9 +140,7 @@ int elcr_probe(void); enum intr_trigger elcr_read_trigger(u_int irq); void elcr_resume(void); void elcr_write_trigger(u_int irq, enum intr_trigger trigger); -#ifdef SMP void intr_add_cpu(u_int cpu); -#endif int intr_add_handler(const char *name, int vector, driver_filter_t filter, driver_intr_t handler, void *arg, enum intr_type flags, void **cookiep); Modified: stable/9/sys/i386/i386/machdep.c ============================================================================== --- stable/9/sys/i386/i386/machdep.c Fri May 11 04:02:37 2012 (r235259) +++ stable/9/sys/i386/i386/machdep.c Fri May 11 04:10:23 2012 (r235260) @@ -336,6 +336,11 @@ cpu_startup(dummy) #ifndef XEN cpu_setregs(); #endif + + /* + * Add BSP as an interrupt target. + */ + intr_add_cpu(0); } /* Modified: stable/9/sys/i386/i386/mp_machdep.c ============================================================================== --- stable/9/sys/i386/i386/mp_machdep.c Fri May 11 04:02:37 2012 (r235259) +++ stable/9/sys/i386/i386/mp_machdep.c Fri May 11 04:10:23 2012 (r235260) @@ -822,8 +822,6 @@ init_secondary(void) * We tell the I/O APIC code about all the CPUs we want to receive * interrupts. If we don't want certain CPUs to receive IRQs we * can simply not tell the I/O APIC code about them in this function. - * We also do not tell it about the BSP since it tells itself about - * the BSP internally to work with UP kernels and on UP machines. */ static void set_interrupt_apic_ids(void) @@ -834,8 +832,6 @@ set_interrupt_apic_ids(void) apic_id = cpu_apic_ids[i]; if (apic_id == -1) continue; - if (cpu_info[apic_id].cpu_bsp) - continue; if (cpu_info[apic_id].cpu_disabled) continue; Modified: stable/9/sys/i386/include/intr_machdep.h ============================================================================== --- stable/9/sys/i386/include/intr_machdep.h Fri May 11 04:02:37 2012 (r235259) +++ stable/9/sys/i386/include/intr_machdep.h Fri May 11 04:10:23 2012 (r235260) @@ -131,9 +131,7 @@ int elcr_probe(void); enum intr_trigger elcr_read_trigger(u_int irq); void elcr_resume(void); void elcr_write_trigger(u_int irq, enum intr_trigger trigger); -#ifdef SMP void intr_add_cpu(u_int cpu); -#endif int intr_add_handler(const char *name, int vector, driver_filter_t filter, driver_intr_t handler, void *arg, enum intr_type flags, void **cookiep); #ifdef SMP Modified: stable/9/sys/pc98/pc98/machdep.c ============================================================================== --- stable/9/sys/pc98/pc98/machdep.c Fri May 11 04:02:37 2012 (r235259) +++ stable/9/sys/pc98/pc98/machdep.c Fri May 11 04:10:23 2012 (r235260) @@ -271,6 +271,11 @@ cpu_startup(dummy) bufinit(); vm_pager_bufferinit(); cpu_setregs(); + + /* + * Add BSP as an interrupt target. + */ + intr_add_cpu(0); } /* Modified: stable/9/sys/sparc64/include/intr_machdep.h ============================================================================== --- stable/9/sys/sparc64/include/intr_machdep.h Fri May 11 04:02:37 2012 (r235259) +++ stable/9/sys/sparc64/include/intr_machdep.h Fri May 11 04:10:23 2012 (r235260) @@ -91,10 +91,10 @@ struct intr_vector { extern ih_func_t *intr_handlers[]; extern struct intr_vector intr_vectors[]; -#ifdef SMP void intr_add_cpu(u_int cpu); -#endif +#ifdef SMP int intr_bind(int vec, u_char cpu); +#endif int intr_describe(int vec, void *ih, const char *descr); void intr_setup(int level, ih_func_t *ihf, int pri, iv_func_t *ivf, void *iva); Modified: stable/9/sys/sparc64/sparc64/intr_machdep.c ============================================================================== --- stable/9/sys/sparc64/sparc64/intr_machdep.c Fri May 11 04:02:37 2012 (r235259) +++ stable/9/sys/sparc64/sparc64/intr_machdep.c Fri May 11 04:10:23 2012 (r235260) @@ -554,4 +554,11 @@ intr_shuffle_irqs(void *arg __unused) } SYSINIT(intr_shuffle_irqs, SI_SUB_SMP, SI_ORDER_SECOND, intr_shuffle_irqs, NULL); +#else /* !SMP */ +/* Use an empty stub for compatibility. */ +void +intr_add_cpu(u_int cpu __unused) +{ + +} #endif Modified: stable/9/sys/sparc64/sparc64/machdep.c ============================================================================== --- stable/9/sys/sparc64/sparc64/machdep.c Fri May 11 04:02:37 2012 (r235259) +++ stable/9/sys/sparc64/sparc64/machdep.c Fri May 11 04:10:23 2012 (r235260) @@ -197,12 +197,10 @@ cpu_startup(void *arg) cpu_identify(rdpr(ver), PCPU_GET(clock), curcpu); -#ifdef SMP /* * Add BSP as an interrupt target. */ intr_add_cpu(0); -#endif } void Modified: stable/9/sys/x86/x86/intr_machdep.c ============================================================================== --- stable/9/sys/x86/x86/intr_machdep.c Fri May 11 04:02:37 2012 (r235259) +++ stable/9/sys/x86/x86/intr_machdep.c Fri May 11 04:10:23 2012 (r235260) @@ -525,9 +525,6 @@ intr_shuffle_irqs(void *arg __unused) return; #endif - /* The BSP is always a valid target. */ - CPU_SETOF(0, &intr_cpus); - /* Don't bother on UP. */ if (mp_ncpus == 1) return; @@ -568,4 +565,11 @@ intr_next_cpu(void) return (PCPU_GET(apic_id)); } + +/* Use an empty stub for compatibility. */ +void +intr_add_cpu(u_int cpu __unused) +{ + +} #endif From owner-svn-src-stable-9@FreeBSD.ORG Fri May 11 14:29:47 2012 Return-Path: Delivered-To: svn-src-stable-9@FreeBSD.ORG Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 28A6D106566B; Fri, 11 May 2012 14:29:47 +0000 (UTC) (envelope-from ache@vniz.net) Received: from vniz.net (vniz.net [194.87.13.69]) by mx1.freebsd.org (Postfix) with ESMTP id 90B228FC0A; Fri, 11 May 2012 14:29:46 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by vniz.net (8.14.5/8.14.5) with ESMTP id q4BEKQgD018853; Fri, 11 May 2012 18:20:26 +0400 (MSK) (envelope-from ache@vniz.net) Received: (from ache@localhost) by localhost (8.14.5/8.14.5/Submit) id q4BEKQXZ018852; Fri, 11 May 2012 18:20:26 +0400 (MSK) (envelope-from ache) Date: Fri, 11 May 2012 18:20:26 +0400 From: Andrey Chernov To: Ed Maste Message-ID: <20120511142026.GA18778@vniz.net> Mail-Followup-To: Andrey Chernov , Ed Maste , src-committers@FreeBSD.ORG, svn-src-all@FreeBSD.ORG, svn-src-stable@FreeBSD.ORG, svn-src-stable-9@FreeBSD.ORG References: <201205110124.q4B1OHPi059953@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201205110124.q4B1OHPi059953@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 Subject: Re: svn commit: r235253 - stable/9/lib/libfetch X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 May 2012 14:29:47 -0000 On Fri, May 11, 2012 at 01:24:17AM +0000, Ed Maste wrote: > Author: emaste > Date: Fri May 11 01:24:16 2012 > New Revision: 235253 > URL: http://svn.freebsd.org/changeset/base/235253 > > Log: > MFC r234138: > > Support percent-encoded user and password > > RFC 1738 specifies that any ":", "@", or "/" within a user name or > password in a URL is percent-encoded, to avoid ambiguity with the use > of those characters as URL component separators. RFC 1738 is a bit old, see http://tools.ietf.org/html/rfc3986#section-2.2 which require more characters to be escaped in the URI. -- http://ache.vniz.net/ From owner-svn-src-stable-9@FreeBSD.ORG Sat May 12 00:40:44 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id F2043106566B; Sat, 12 May 2012 00:40:44 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DCF608FC0A; Sat, 12 May 2012 00:40:44 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q4C0ei5u007597; Sat, 12 May 2012 00:40:44 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q4C0eiFh007595; Sat, 12 May 2012 00:40:44 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201205120040.q4C0eiFh007595@svn.freebsd.org> From: Eitan Adler Date: Sat, 12 May 2012 00:40:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r235303 - stable/9/lib/libc/stdio X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 12 May 2012 00:40:45 -0000 Author: eadler Date: Sat May 12 00:40:44 2012 New Revision: 235303 URL: http://svn.freebsd.org/changeset/base/235303 Log: MFC r235202: Remove reference to non-existent FreeBSD Security Architecture Approved by: cperciva (implicit) Modified: stable/9/lib/libc/stdio/fgets.3 Directory Properties: stable/9/lib/libc/ (props changed) Modified: stable/9/lib/libc/stdio/fgets.3 ============================================================================== --- stable/9/lib/libc/stdio/fgets.3 Sat May 12 00:30:54 2012 (r235302) +++ stable/9/lib/libc/stdio/fgets.3 Sat May 12 00:40:44 2012 (r235303) @@ -32,7 +32,7 @@ .\" @(#)fgets.3 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd June 4, 1993 +.Dd May 5, 2012 .Dt FGETS 3 .Os .Sh NAME @@ -154,5 +154,3 @@ a buffer overflow attack. It is strongly suggested that the .Fn fgets function be used in all cases. -(See -the FSA.) From owner-svn-src-stable-9@FreeBSD.ORG Sat May 12 00:43:15 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 476D31065672; Sat, 12 May 2012 00:43:15 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 321068FC0C; Sat, 12 May 2012 00:43:15 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q4C0hFhl007719; Sat, 12 May 2012 00:43:15 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q4C0hFpH007717; Sat, 12 May 2012 00:43:15 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201205120043.q4C0hFpH007717@svn.freebsd.org> From: Eitan Adler Date: Sat, 12 May 2012 00:43:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r235304 - stable/9/etc/mtree X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 12 May 2012 00:43:15 -0000 Author: eadler Date: Sat May 12 00:43:14 2012 New Revision: 235304 URL: http://svn.freebsd.org/changeset/base/235304 Log: MFC r235203: fix spacing in mtree file Approved by: cperciva (implicit) Modified: stable/9/etc/mtree/BSD.usr.dist Directory Properties: stable/9/etc/ (props changed) Modified: stable/9/etc/mtree/BSD.usr.dist ============================================================================== --- stable/9/etc/mtree/BSD.usr.dist Sat May 12 00:40:44 2012 (r235303) +++ stable/9/etc/mtree/BSD.usr.dist Sat May 12 00:43:14 2012 (r235304) @@ -209,8 +209,8 @@ .. bootforth .. - csh - .. + csh + .. cvs contrib .. From owner-svn-src-stable-9@FreeBSD.ORG Sat May 12 00:47:21 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id BDF26106567A; Sat, 12 May 2012 00:47:21 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A87EF8FC08; Sat, 12 May 2012 00:47:21 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q4C0lLOm008030; Sat, 12 May 2012 00:47:21 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q4C0lLsm008027; Sat, 12 May 2012 00:47:21 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201205120047.q4C0lLsm008027@svn.freebsd.org> From: Eitan Adler Date: Sat, 12 May 2012 00:47:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r235309 - stable/9/sbin/md5 X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 12 May 2012 00:47:21 -0000 Author: eadler Date: Sat May 12 00:47:21 2012 New Revision: 235309 URL: http://svn.freebsd.org/changeset/base/235309 Log: MFC r235205: Document the -c option in --help output Approved by: cperciva (implicit) Modified: stable/9/sbin/md5/md5.c Directory Properties: stable/9/sbin/md5/ (props changed) Modified: stable/9/sbin/md5/md5.c ============================================================================== --- stable/9/sbin/md5/md5.c Sat May 12 00:46:59 2012 (r235308) +++ stable/9/sbin/md5/md5.c Sat May 12 00:47:21 2012 (r235309) @@ -372,6 +372,6 @@ static void usage(Algorithm_t *alg) { - fprintf(stderr, "usage: %s [-pqrtx] [-s string] [files ...]\n", alg->progname); + fprintf(stderr, "usage: %s [-pqrtx] [-c string] [-s string] [files ...]\n", alg->progname); exit(1); } From owner-svn-src-stable-9@FreeBSD.ORG Sat May 12 00:49:15 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4320A10656D6; Sat, 12 May 2012 00:49:15 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2DC658FC19; Sat, 12 May 2012 00:49:15 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q4C0nFit008188; Sat, 12 May 2012 00:49:15 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q4C0nEuj008186; Sat, 12 May 2012 00:49:14 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201205120049.q4C0nEuj008186@svn.freebsd.org> From: Eitan Adler Date: Sat, 12 May 2012 00:49:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r235310 - stable/9/usr.sbin/portsnap/portsnap X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 12 May 2012 00:49:15 -0000 Author: eadler Date: Sat May 12 00:49:14 2012 New Revision: 235310 URL: http://svn.freebsd.org/changeset/base/235310 Log: MFC r235208: make it easier for users used to a VCS that allows up to be a shortcut for update. Approved by: cperciva (implicit) Modified: stable/9/usr.sbin/portsnap/portsnap/portsnap.sh Directory Properties: stable/9/usr.sbin/portsnap/ (props changed) Modified: stable/9/usr.sbin/portsnap/portsnap/portsnap.sh ============================================================================== --- stable/9/usr.sbin/portsnap/portsnap/portsnap.sh Sat May 12 00:47:21 2012 (r235309) +++ stable/9/usr.sbin/portsnap/portsnap/portsnap.sh Sat May 12 00:49:14 2012 (r235310) @@ -143,6 +143,9 @@ parse_cmdline() { cron | extract | fetch | update | alfred) COMMANDS="${COMMANDS} $1" ;; + up) + COMMANDS="${COMMANDS} update" + ;; *) if [ $# -gt 1 ]; then usage; fi if echo ${COMMANDS} | grep -vq extract; then From owner-svn-src-stable-9@FreeBSD.ORG Sat May 12 00:55:03 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 111DF106566B; Sat, 12 May 2012 00:55:03 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E3F4F8FC15; Sat, 12 May 2012 00:55:02 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q4C0t2bj008471; Sat, 12 May 2012 00:55:02 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q4C0t2gq008469; Sat, 12 May 2012 00:55:02 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201205120055.q4C0t2gq008469@svn.freebsd.org> From: Eitan Adler Date: Sat, 12 May 2012 00:55:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r235313 - stable/9/share/man/man4 X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 12 May 2012 00:55:03 -0000 Author: eadler Date: Sat May 12 00:55:02 2012 New Revision: 235313 URL: http://svn.freebsd.org/changeset/base/235313 Log: MFC r232496: Fix a variety of grammar nits and errors Approved by: cperciva (implicit) Modified: stable/9/share/man/man4/jme.4 Directory Properties: stable/9/share/man/man4/ (props changed) Modified: stable/9/share/man/man4/jme.4 ============================================================================== --- stable/9/share/man/man4/jme.4 Sat May 12 00:51:54 2012 (r235312) +++ stable/9/share/man/man4/jme.4 Sat May 12 00:55:02 2012 (r235313) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 29, 2011 +.Dd March 4, 2012 .Dt JME 4 .Os .Sh NAME @@ -130,23 +130,26 @@ variables and tunables: .Bl -tag -width "xxxxxx" .It Va dev.jme.%d.tx_coal_to -Maximum amount of time to delay for Tx completion interrupt in -units of 1us. -The accepted range is 1 to 65535, the default is 100 (100us). +This variable sets the maximum amount of time to delay +before sending a Tx completion interrupt, in microseconds. +The accepted range is 1 to 65535; the default is 100 (100us). .It Va dev.jme.%d.tx_coal_pkt -Maximum number of packets to fire Tx completion interrupt. -The accepted range is 1 to 255, the default is 8. +This variable sets the maximum number of outgoing packets which may be +coalesced together into a single Tx completion interrupt. +The accepted range is 1 to 255; the default is 8. .It Va dev.jme.%d.rx_coal_to -Maximum amount of time to delay for Rx completion interrupt in -units of 1us. -The accepted range is 1 to 65535, the default is 100 (100us). +This variable sets the maximum amount of time to wait for +additional packets to arrive (for possible packet coalescing) +before firing an Rx completion interrupt, in microseconds. +The accepted range is 1 to 65535; the default is 100 (100us). .It Va dev.jme.%d.rx_coal_pkt -Maximum number of packets to fire Rx completion interrupt. -The accepted range is 1 to 255, the default is 2. +This variable sets the maximum number of incoming packets which may be +coalesced into a single Rx completion interrupt. +The accepted range is 1 to 255; the default is 2. .It Va dev.jme.%d.process_limit -Maximum amount of Rx events to be processed in the event loop before -rescheduling a taskqueue. -The accepted range is 10 to 255, the default value is 128 events. +This variable sets the maximum number of events that will be processed +in a single batch before the handler is requeued into a taskqueue. +The accepted range is 10 to 255; the default value is 128 events. The interface does not need to be brought down and up again before a change takes effect. .El @@ -173,22 +176,22 @@ driver tries to avoid unnecessary statio controllers that use eFuse to store station address. The number of times that eFuse can be safely reprogrammed is 16 at most. -In addition, there is no way to restore factory default station -address once station address is reprogrammed via eFuse. -It is highly recommended not to reprogram station address and -it is responsibility of administrator to store original station -address into a safe place when station address should be changed. +In addition, there is no way to restore the factory default station +address once the station address has been reprogrammed via eFuse. +It is highly recommended not to reprogram the station address and +it is the responsibility of the administrator to store the original station +address in a safe place when station address is changed. .Pp There are two known 1000baseT link establishment issues with JMC25x. If the full mask revision number of JMC25x controller is less than -or equal to 4 and link partner enabled IEEE 802.3az Energy Efficient -Ethernet feature, the controller would not be able to establish a +or equal to 4 and the link partner enabled the IEEE 802.3az Energy Efficient +Ethernet feature, the controller will not be able to establish a 1000baseT link. -Also if the length of cable is longer than 120 meters, controller +Also, if the length of the cable is longer than 120 meters, the controller can not establish a 1000baseT link. -The known workaround for the issue is to force manual link +The known workaround for these issues is to force manual link configuration with 100baseTX instead of relying on auto-negotiation. -The full mask revision number of controller could be checked with +The full mask revision number of controller can be checked with the verbose kernel boot option. -Use lower nibble of chip revision number to get full mask revision of -the controller. +Use the lower nibble of the chip revision number to get the +full mask revision of the controller. From owner-svn-src-stable-9@FreeBSD.ORG Sat May 12 08:22:42 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0DFF1106564A; Sat, 12 May 2012 08:22:42 +0000 (UTC) (envelope-from bschmidt@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E95668FC0C; Sat, 12 May 2012 08:22:41 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q4C8MfOf022957; Sat, 12 May 2012 08:22:41 GMT (envelope-from bschmidt@svn.freebsd.org) Received: (from bschmidt@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q4C8MfiJ022953; Sat, 12 May 2012 08:22:41 GMT (envelope-from bschmidt@svn.freebsd.org) Message-Id: <201205120822.q4C8MfiJ022953@svn.freebsd.org> From: Bernhard Schmidt Date: Sat, 12 May 2012 08:22:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r235328 - in stable/9/usr.sbin/wpa: . hostapd wpa_supplicant X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 12 May 2012 08:22:42 -0000 Author: bschmidt Date: Sat May 12 08:22:41 2012 New Revision: 235328 URL: http://svn.freebsd.org/changeset/base/235328 Log: MFC r234711, r234756-234759, r234786: r234711: fix EAP server support after the 0.7.3 import: - eap_xxx.c files have been renamed to eap_server_xxx.c - additional crypto files are required for some options - EAP_MD5 and EAP_GTC is now enabled by default to match vendor config - move each file on its own line to hopefully make further diffs easier to read EAP_SERVER is now enabled by default. Fiddling with HOSTAPD_CFLAGS in src.conf is no longer required to get a basic WPA-EAP/radius setup running. [1] r234756-234758: - Follow up r234711 and do same for the supplicant, one file/option per line. While here merge the options which are always enabled. - enable EAP_GTC and EAP_OTP to match upstream's default configuration - not only the file names have changed from eap_xxx.c to eap_server_xxx.c, the defines too r234759: Move crypto stuff into a common Makefile. While here fix the WITHOUT_OPENSSL build by using the wpa's internal crypto support if openssl is not available, this allows us to unconditionally enable EAP support. r234786: Fix WITHOUT_EXAMPLES build: While removing unnecessary entries from .PATH.c I missed that for the examples WPA_SUPPLICANT_DISTDIR/HOSTAPD_DISTDIR is explicitly added to .PATH. Added: stable/9/usr.sbin/wpa/Makefile.crypto - copied unchanged from r234759, head/usr.sbin/wpa/Makefile.crypto Modified: stable/9/usr.sbin/wpa/Makefile.inc stable/9/usr.sbin/wpa/hostapd/Makefile stable/9/usr.sbin/wpa/wpa_supplicant/Makefile Directory Properties: stable/9/usr.sbin/wpa/ (props changed) stable/9/usr.sbin/wpa/wpa_supplicant/ (props changed) Copied: stable/9/usr.sbin/wpa/Makefile.crypto (from r234759, head/usr.sbin/wpa/Makefile.crypto) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/9/usr.sbin/wpa/Makefile.crypto Sat May 12 08:22:41 2012 (r235328, copy of r234759, head/usr.sbin/wpa/Makefile.crypto) @@ -0,0 +1,121 @@ +# $FreeBSD$ + +.if ${MK_OPENSSL} != "no" && !defined(RELEASE_CRUNCH) +SRCS+= crypto_openssl.c +DPADD+= ${LIBSSL} ${LIBCRYPTO} +LDADD+= -lssl -lcrypto +.else +CFLAGS+=-DCONFIG_CRYPTO_INTERNAL +SRCS+= crypto_internal.c +CONFIG_INTERNAL_AES=y +CONFIG_INTERNAL_DES=y +CONFIG_INTERNAL_MD4=y +CONFIG_INTERNAL_MD5=y +CONFIG_INTERNAL_RC4=y +CONFIG_INTERNAL_SHA1=y +CONFIG_INTERNAL_SHA256=y +CONFIG_INTERNAL_TLS=y +NEED_AES_ENC=true +.endif + +.if defined(TLS_FUNCS) +NEED_TLS_PRF=y +.if defined(CONFIG_INTERNAL_TLS) +CFLAGS+=-DCONFIG_INTERNAL_LIBTOMMATH \ + -DCONFIG_TLS_INTERNAL_CLIENT +SRCS+= asn1.c \ + bignum.c \ + crypto_internal-cipher.c \ + crypto_internal-modexp.c \ + crypto_internal-rsa.c \ + pkcs1.c \ + pkcs5.c \ + pkcs8.c \ + rsa.c \ + tls_internal.c \ + tlsv1_common.c \ + tlsv1_record.c \ + tlsv1_cred.c \ + tlsv1_client.c \ + tlsv1_client_write.c \ + tlsv1_client_read.c \ + x509v3.c +NEED_DES=y +NEED_MD4=y +NEED_RC4=y +.else +CFLAGS+=-DEAP_TLS_OPENSSL +SRCS+= tls_openssl.c +.endif +.endif + +.if defined(CONFIG_INTERNAL_AES) +SRCS+= aes-internal.c \ + aes-internal-dec.c \ + aes-internal-enc.c +.endif + +.if defined(NEED_AES_CBC) +SRCS+= aes-cbc.c +.endif + +.if defined(NEED_AES_EAX) +SRCS+= aes-eax.c +NEED_AES_CTR=y +.endif + +.if defined(NEED_AES_CTR) +SRCS+= aes-ctr.c +.endif + +.if defined(NEED_AES_ENCBLOCK) +SRCS+= aes-encblock.c +.endif + +.if defined(NEED_AES_OMAC1) +SRCS+= aes-omac1.c +.endif + +.if defined(NEED_DES) +.if defined(CONFIG_INTERNAL_DES) +SRCS+= des-internal.c +.endif +.endif + +.if defined(NEED_MD4) +.if defined(CONFIG_INTERNAL_MD4) +SRCS+= md4-internal.c +.endif +.endif + +.if defined(CONFIG_INTERNAL_MD5) +SRCS+= md5-internal.c +.endif + +.if defined(NEED_FIPS186_2_PRF) +.if defined(CONFIG_INTERNAL_SHA1) +SRCS+= fips_prf_internal.c +.else +SRCS+= fips_prf_openssl.c +.endif +.endif + +.if defined(CONFIG_INTERNAL_RC4) +SRCS+= rc4.c +.endif + +.if defined(CONFIG_INTERNAL_SHA1) +SRCS+= sha1-internal.c +.endif + +.if defined(NEED_SHA256) +CFLAGS+=-DCONFIG_SHA256 +SRCS+= sha256.c +.if defined(CONFIG_INTERNAL_SHA256) +SRCS+= sha256-internal.c +.endif +.endif + +.if defined(NEED_TLS_PRF) +SRCS+= sha1-tlsprf.c +.endif Modified: stable/9/usr.sbin/wpa/Makefile.inc ============================================================================== --- stable/9/usr.sbin/wpa/Makefile.inc Sat May 12 07:52:45 2012 (r235327) +++ stable/9/usr.sbin/wpa/Makefile.inc Sat May 12 08:22:41 2012 (r235328) @@ -7,17 +7,26 @@ WPA_SUPPLICANT_DISTDIR?=${WPA_DISTDIR}/w HOSTAPD_DISTDIR?= ${WPA_DISTDIR}/hostapd .PATH.c:${.CURDIR}/.. \ + ${WPA_DISTDIR}/src/ap \ ${WPA_DISTDIR}/src/common \ ${WPA_DISTDIR}/src/crypto \ + ${WPA_DISTDIR}/src/eapol_auth \ ${WPA_DISTDIR}/src/eap_common \ + ${WPA_DISTDIR}/src/eap_peer \ + ${WPA_DISTDIR}/src/eap_server \ ${WPA_DISTDIR}/src/eapol_supp \ ${WPA_DISTDIR}/src/l2_packet \ + ${WPA_DISTDIR}/src/radius \ + ${WPA_DISTDIR}/src/rsn_supp \ + ${WPA_DISTDIR}/src/tls \ ${WPA_DISTDIR}/src/utils CFLAGS+=-I${.CURDIR} +CFLAGS+=-I${HOSTAPD_DISTDIR} CFLAGS+=-I${WPA_DISTDIR}/src CFLAGS+=-I${WPA_DISTDIR}/src/common CFLAGS+=-I${WPA_DISTDIR}/src/crypto +CFLAGS+=-I${WPA_DISTDIR}/src/drivers CFLAGS+=-I${WPA_DISTDIR}/src/l2_packet CFLAGS+=-I${WPA_DISTDIR}/src/utils Modified: stable/9/usr.sbin/wpa/hostapd/Makefile ============================================================================== --- stable/9/usr.sbin/wpa/hostapd/Makefile Sat May 12 07:52:45 2012 (r235327) +++ stable/9/usr.sbin/wpa/hostapd/Makefile Sat May 12 08:22:41 2012 (r235328) @@ -3,32 +3,58 @@ .include "${.CURDIR}/../Makefile.inc" .PATH.c:${HOSTAPD_DISTDIR} \ - ${WPA_DISTDIR}/src/ap \ - ${WPA_DISTDIR}/src/eap_server \ - ${WPA_DISTDIR}/src/eap_common \ - ${WPA_DISTDIR}/src/eapol_auth \ - ${WPA_DISTDIR}/src/drivers \ - ${WPA_DISTDIR}/src/radius \ - ${WPA_DISTDIR} + ${WPA_DISTDIR}/src/drivers PROG= hostapd -SRCS= accounting.c aes-wrap.c ap_config.c \ - ap_drv_ops.c ap_mlme.c authsrv.c \ - chap.c common.c config_file.c ctrl_iface.c crypto_openssl.c \ - ctrl_iface_ap.c drivers.c drv_callbacks.c dump_state.c \ - eap_common.c eap_peap_common.c eap_register.c eap_server.c \ - eap_server_gtc.c eap_server_identity.c eap_server_md5.c \ - eap_server_methods.c eap_server_mschapv2.c eap_server_peap.c \ - eap_server_tls.c eap_server_tls_common.c eap_server_ttls.c \ - eapol_auth_dump.c eapol_auth_sm.c eloop.c hostapd.c ieee802_11_auth.c \ - ieee802_11_common.c ieee802_11_ht.c ieee802_1x.c ip_addr.c \ - md5.c main.c ms_funcs.c peerkey_auth.c pmksa_cache_auth.c \ - preauth_auth.c radius.c radius_client.c sta_info.c \ - sha1-pbkdf2.c sha1-tlsprf.c sha1-tprf.c sha1.c \ - tkip_countermeasures.c utils.c \ - vlan_init.c wpa_auth.c wpa_auth_glue.c wpa_auth_ie.c wpa_common.c \ - wpa_debug.c wpabuf.c -SRCS+= l2_packet_freebsd.c driver_freebsd.c os_unix.c +SRCS= accounting.c \ + aes-wrap.c \ + ap_config.c \ + ap_drv_ops.c \ + ap_mlme.c \ + authsrv.c \ + base64.c \ + chap.c \ + common.c \ + config_file.c \ + ctrl_iface.c \ + ctrl_iface_ap.c \ + drivers.c \ + drv_callbacks.c \ + eap_common.c \ + eap_peap_common.c \ + eap_register.c \ + eapol_auth_dump.c \ + eapol_auth_sm.c \ + eap_server.c \ + eap_server_methods.c \ + eloop.c \ + hostapd.c \ + ieee802_11_auth.c \ + ieee802_11_common.c \ + ieee802_1x.c \ + ip_addr.c \ + main.c \ + md5.c \ + ms_funcs.c \ + os_unix.c \ + peerkey_auth.c \ + pmksa_cache_auth.c \ + preauth_auth.c \ + radius.c \ + radius_client.c \ + sha1-pbkdf2.c \ + sha1.c \ + sta_info.c \ + tkip_countermeasures.c \ + utils.c \ + vlan_init.c \ + wpa_auth.c \ + wpa_auth_glue.c \ + wpa_auth_ie.c \ + wpa_common.c \ + wpa_debug.c \ + wpabuf.c +SRCS+= l2_packet_freebsd.c driver_freebsd.c MAN= hostapd.8 hostapd.conf.5 @@ -38,16 +64,17 @@ FILESDIR= ${SHAREDIR}/examples/hostapd FILES= hostapd.conf hostapd.eap_user hostapd.wpa_psk .endif -CFLAGS+= -I${HOSTAPD_DISTDIR} -I${WPA_DISTDIR}/src/drivers - -CFLAGS+= -DCONFIG_DRIVER_BSD -DHOSTAPD -CFLAGS+= -DCONFIG_DRIVER_RADIUS_ACL +CFLAGS+=-DCONFIG_DRIVER_BSD \ + -DHOSTAPD \ + -DCONFIG_DRIVER_RADIUS_ACL \ + -DCONFIG_RSN_PREAUTH \ + -DCONFIG_PEERKEY .if ${MK_INET6} != "no" CFLAGS+= -DCONFIG_IPV6 .endif #CFLAGS+= -g -DPADD+= ${LIBPCAP} ${LIBSSL} -LDADD+= -lpcap -lssl +DPADD+= ${LIBPCAP} +LDADD+= -lpcap # User customizations for wpa_supplicant/hostapd build environment CFLAGS+=${HOSTAPD_CFLAGS} @@ -55,74 +82,63 @@ CFLAGS+=${HOSTAPD_CFLAGS} LDADD+=${HOSTAPD_LDADD} #LDFLAGS+=${HOSTAPD_LDFLAGS} -.if !empty(CFLAGS:M*-DEAP_SERVER) -#SRCS+= eap.c eap_methods.c eap_identity.c - -.if ${MK_OPENSSL} != "no" && !defined(RELEASE_CRUNCH) - -CFLAGS+=-DEAP_TLS -DEAP_PEAP -DEAP_MSCHAPv2 -DEAP_PSK \ - -DEAP_TLS_FUNCS -DEAP_TLS_OPENSSL -SRCS+= crypto_openssl.c -SRCS+= eap_tls.c eap_peap.c eap_peap_common.c eap_mschapv2.c \ - eap_psk.c eap_psk_common.c \ - eap_tls_common.c tls_openssl.c ms_funcs.c chap.c - -CFLAGS+=-DEAP_TTLS -DEAP_MD5 -SRCS+= eap_ttls.c eap_md5.c - -.if !empty(CFLAGS:M*-DEAP_GTC) -SRCS+= eap_gtc.c -.endif - -.if !empty(CFLAGS:M*-DEAP_AKA) -NEED_SIM_COMMON= true -SRCS+= eap_aka.c -.endif - -.if !empty(CFLAGS:M*-DEAP_SIM) -NEED_SIM_COMMON= true -SRCS+= eap_sim.c +CFLAGS+=-DDPKCS12_FUNCS \ + -DEAP_SERVER \ + -DEAP_SERVER_GTC \ + -DEAP_SERVER_IDENTITY \ + -DEAP_SERVER_MD5 \ + -DEAP_SERVER_MSCHAPV2 \ + -DEAP_SERVER_PEAP \ + -DEAP_SERVER_TLS \ + -DEAP_SERVER_TTLS \ + -DEAP_TLS_FUNCS \ + -DCONFIG_NO_DUMP_STATE +SRCS+= dump_state.c \ + eap_server_gtc.c \ + eap_server_identity.c \ + eap_server_md5.c \ + eap_server_mschapv2.c \ + eap_server_peap.c \ + eap_server_tls.c \ + eap_server_tls_common.c \ + eap_server_ttls.c +TLS_FUNCS=y +NEED_SHA256=y + +.if !empty(CFLAGS:M*-DEAP_SERVER_AKA) +SRCS+= eap_server_aka.c +NEED_SIM_COMMON=y +.endif + +.if !empty(CFLAGS:M*-DEAP_SERVER_SIM) +SRCS+= eap_server_sim.c +NEED_SIM_COMMON=y .endif .if defined(NEED_SIM_COMMON) -SRCS+= eap_sim_common.c eap_sim_db.c +SRCS+= eap_sim_common.c \ + eap_sim_db.c +NEED_AES_CBC=y +NEED_FIPS186_2_PRF=y .endif -.if !empty(CFLAGS:M*-DEAP_GPSK) +.if !empty(CFLAGS:M*-DEAP_SERVER_GPSK) CFLAGS+=-DEAP_GPSK_SHA256 -SRCS+= eap_gpsk.c eap_gpsk_common.c -NEED_SHA256= true -.endif - -.if !empty(CFLAGS:M*-DEAP_PAX) -SRCS+= eap_pax.c eap_pax_common.c -.endif - -.if !empty(CFLAGS:M*-DEAP_SAKE) -SRCS+= eap_sake.c eap_sake_common.c -.endif - -DPADD+= ${LIBSSL} ${LIBCRYPTO} -LDADD+= -lssl -lcrypto -.else -NEED_TLS_NONE= true +SRCS+= eap_server_gpsk.c \ + eap_gpsk_common.c +NEED_AES_OMAC1=y .endif -.else -NEED_TLS_NONE= true +.if !empty(CFLAGS:M*-DEAP_SERVER_PAX) +SRCS+= eap_server_pax.c \ + eap_pax_common.c .endif -.if defined(NEED_SHA256) -CFLAGS+=-DINTERNAL_SHA256 -SRCS+= sha256.c +.if !empty(CFLAGS:M*-DEAP_SERVER_SAKE) +SRCS+= eap_server_sake.c \ + eap_sake_common.c .endif -.if defined(NEED_TLS_NONE) -CFLAGS+= -DEAP_TLS_NONE -CFLAGS+= -DINTERNAL_AES -CFLAGS+= -DINTERNAL_SHA1 -CFLAGS+= -DINTERNAL_MD5 -SRCS+= tls_none.c -.endif +.include "${.CURDIR}/../Makefile.crypto" .include Modified: stable/9/usr.sbin/wpa/wpa_supplicant/Makefile ============================================================================== --- stable/9/usr.sbin/wpa/wpa_supplicant/Makefile Sat May 12 07:52:45 2012 (r235327) +++ stable/9/usr.sbin/wpa/wpa_supplicant/Makefile Sat May 12 08:22:41 2012 (r235328) @@ -3,23 +3,44 @@ .include "${.CURDIR}/../Makefile.inc" .PATH.c:${WPA_SUPPLICANT_DISTDIR} \ - ${WPA_DISTDIR}/src/drivers \ - ${WPA_DISTDIR}/src/eap_peer \ - ${WPA_DISTDIR}/src/rsn_supp \ - ${WPA_DISTDIR}/src/crypto + ${WPA_DISTDIR}/src/drivers PROG= wpa_supplicant -SRCS= aes-cbc.c aes-ctr.c aes-eax.c aes-encblock.c \ - aes-internal.c aes-omac1.c aes-unwrap.c \ - aes-wrap.c bss.c blacklist.c common.c config.c ctrl_iface.c \ - ctrl_iface_unix.c drivers.c eloop.c events.c l2_packet_freebsd.c main.c\ - md5.c notify.c preauth.c pmksa_cache.c scan.c \ - sha1-pbkdf2.c sha1-tlsprf.c sha1-tprf.c sha1.c \ - wpa.c wpa_common.c wpa_debug.c wpa_ie.c wpa_supplicant.c \ - wpabuf.c wpas_glue.c \ - driver_ndis.c Packet32.c \ +SRCS= aes-unwrap.c \ + base64.c \ + blacklist.c \ + bss.c \ + common.c \ + config.c \ + config_file.c \ + ctrl_iface.c \ + ctrl_iface_unix.c \ + driver_ndis.c \ driver_wired.c \ - driver_freebsd.c os_unix.c + drivers.c \ + eap_register.c \ + eloop.c \ + events.c \ + main.c \ + md5.c \ + notify.c \ + os_unix.c \ + peerkey.c \ + pmksa_cache.c \ + preauth.c \ + scan.c \ + sha1-pbkdf2.c \ + sha1.c \ + wpa.c \ + wpa_common.c \ + wpa_debug.c \ + wpa_ie.c \ + wpa_supplicant.c \ + wpabuf.c \ + wpas_glue.c +SRCS+= driver_freebsd.c \ + l2_packet_freebsd.c \ + Packet32.c MAN= wpa_supplicant.8 wpa_supplicant.conf.5 @@ -29,23 +50,19 @@ FILESDIR= ${SHAREDIR}/examples/etc FILES= wpa_supplicant.conf .endif -CFLAGS+=-I${WPA_SUPPLICANT_DISTDIR} -CFLAGS+=-I${WPA_DISTDIR}/src/drivers -CFLAGS+=-I${WPA_DISTDIR}/src/rsn_supp - -CFLAGS+= -DCONFIG_DRIVER_BSD -CFLAGS+= -DCONFIG_DRIVER_NDIS -CFLAGS+= -DCONFIG_DRIVER_WIRED -CFLAGS+= -DCONFIG_TERMINATE_ONLASTIF -CFLAGS+= -DCONFIG_DEBUG_SYSLOG +CFLAGS+=-DCONFIG_BACKEND_FILE \ + -DCONFIG_DEBUG_SYSLOG \ + -DCONFIG_DRIVER_BSD \ + -DCONFIG_DRIVER_NDIS \ + -DCONFIG_DRIVER_WIRED \ + -DCONFIG_PEERKEY \ + -DCONFIG_SMARTCARD \ + -DCONFIG_TERMINATE_ONLASTIF \ + -DPKCS12_FUNCS #CFLAGS+= -g DPADD+= ${LIBPCAP} LDADD+= -lpcap -# NB: we only support wpa_supplicant.conf file -SRCS+= config_file.c base64.c -CFLAGS+=-DCONFIG_BACKEND_FILE - # User customizations to the wpa_supplicant build environment CFLAGS+=${WPA_SUPPLICANT_CFLAGS} #DPADD+=${WPA_SUPPLICANT_DPADD} @@ -53,43 +70,58 @@ LDADD+=${WPA_SUPPLICANT_LDADD} #LDFLAGS+=${WPA_SUPPLICANT_LDFLAGS} .if ${MK_WPA_SUPPLICANT_EAPOL} != "no" -SRCS+= eapol_supp_sm.c eap.c eap_common.c eap_methods.c eap_register.c -CFLAGS+= -DIEEE8021X_EAPOL - -.if ${MK_OPENSSL} != "no" && !defined(RELEASE_CRUNCH) -CFLAGS+=-DEAP_TLS -DEAP_PEAP -DEAP_MSCHAPv2 -DEAP_LEAP -DEAP_PSK \ - -DEAP_TLV -DEAP_TLS_FUNCS -DEAP_TLS_OPENSSL -SRCS+= chap.c crypto_openssl.c \ +CFLAGS+=-DEAP_GTC \ + -DEAP_LEAP \ + -DEAP_MD5 \ + -DEAP_MSCHAPv2 \ + -DEAP_OTP \ + -DEAP_PEAP \ + -DEAP_PSK \ + -DEAP_TLS \ + -DEAP_TTLS \ + -DIEEE8021X_EAPOL +SRCS+= chap.c \ + eap.c \ + eap_common.c \ + eap_gtc.c \ eap_leap.c \ + eap_md5.c \ + eap_methods.c \ eap_mschapv2.c \ - eap_peap.c eap_peap_common.c \ - eap_psk.c eap_psk_common.c \ - eap_tls.c eap_tls_common.c \ - mschapv2.c ms_funcs.c tls_openssl.c - -CFLAGS+=-DEAP_TTLS -DEAP_MD5 -SRCS+= eap_ttls.c eap_md5.c - -.if !empty(CFLAGS:M*-DEAP_GTC) -SRCS+= eap_gtc.c -.endif - -.if !empty(CFLAGS:M*-DEAP_OTP) -SRCS+= eap_otp.c + eap_otp.c \ + eap_peap.c \ + eap_peap_common.c \ + eap_psk.c \ + eap_psk_common.c \ + eap_tls.c \ + eap_tls_common.c \ + eap_ttls.c \ + eapol_supp_sm.c \ + ms_funcs.c \ + mschapv2.c +TLS_FUNCS=y +NEED_AES_EAX=y +NEED_AES_ENCBLOCK=y +NEED_AES_OMAC1=y +NEED_SHA256=y .endif .if !empty(CFLAGS:M*-DEAP_AKA) -NEED_SIM_COMMON= true SRCS+= eap_aka.c +NEED_SIM_COMMON=y +NEED_AES_CBC=y .endif .if !empty(CFLAGS:M*-DEAP_SIM) -NEED_SIM_COMMON= true SRCS+= eap_sim.c +NEED_SIM_COMMON=y +NEED_AES_CBC=y .endif .if defined(NEED_SIM_COMMON) SRCS+= eap_sim_common.c +NEED_FIPS186_2_PRF=y +.endif # PC/SC interface for smartcards (USIM, GSM SIM) # GSM/UMTS authentication algorithm (for EAP-SIM/EAP-AKA) @@ -103,52 +135,24 @@ SRCS+= pcsc_funcs.c DPADD+=${LIBPTHREAD} LDADD+=-lpcsclite -lpthread .endif -.endif .if !empty(CFLAGS:M*-DEAP_GPSK) CFLAGS+=-DEAP_GPSK_SHA256 -SRCS+= eap_gpsk.c eap_gpsk_common.c -NEED_SHA256= true +SRCS+= eap_gpsk.c \ + eap_gpsk_common.c +NEED_AES_OMAC1=y .endif .if !empty(CFLAGS:M*-DEAP_PAX) -SRCS+= eap_pax.c eap_pax_common.c +SRCS+= eap_pax.c \ + eap_pax_common.c .endif .if !empty(CFLAGS:M*-DEAP_SAKE) -SRCS+= eap_sake.c eap_sake_common.c +SRCS+= eap_sake.c \ + eap_sake_common.c .endif -# NB: requires patch to openssl -#CFLAGS+= -DEAP_FAST -#SRCS+= eap_fast.c - -NEED_LIBSSL= true -.else -CFLAGS+= -DEAP_TLS_NONE -SRCS+= tls_none.c -.endif - -.endif - -# -# Configure crypto/cipher support. -# -# EAPOL support requires openssl in which case we use their -# cipher code. Otherwise we use our internal versions. -# -.if !defined(NEED_LIBSSL) -CFLAGS+= -DINTERNAL_AES -CFLAGS+= -DINTERNAL_SHA1 -CFLAGS+= -DINTERNAL_MD5 -.else -DPADD+= ${LIBSSL} ${LIBCRYPTO} -LDADD+= -lssl -lcrypto -.endif - -.if defined(NEED_SHA256) -CFLAGS+=-DINTERNAL_SHA256 -SRCS+= sha256.c -.endif +.include "${.CURDIR}/../Makefile.crypto" .include