From owner-p4-projects@FreeBSD.ORG Sun Jul 27 10:17:22 2008 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 2779B106567B; Sun, 27 Jul 2008 10:17:22 +0000 (UTC) Delivered-To: perforce@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DF1381065679 for ; Sun, 27 Jul 2008 10:17:21 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id CF4398FC21 for ; Sun, 27 Jul 2008 10:17:21 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.2/8.14.2) with ESMTP id m6RAHLBq076020 for ; Sun, 27 Jul 2008 10:17:21 GMT (envelope-from ed@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.2/8.14.1/Submit) id m6RAHLS2076018 for perforce@freebsd.org; Sun, 27 Jul 2008 10:17:21 GMT (envelope-from ed@FreeBSD.org) Date: Sun, 27 Jul 2008 10:17:21 GMT Message-Id: <200807271017.m6RAHLS2076018@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to ed@FreeBSD.org using -f From: Ed Schouten To: Perforce Change Reviews Cc: Subject: PERFORCE change 146031 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 27 Jul 2008 10:17:22 -0000 http://perforce.freebsd.org/chv.cgi?CH=146031 Change 146031 by ed@ed_dull on 2008/07/27 10:16:29 IFC. Affected files ... .. //depot/projects/mpsafetty/lib/libc/gen/arc4random.c#3 integrate .. //depot/projects/mpsafetty/lib/libutil/login.conf.5#2 integrate .. //depot/projects/mpsafetty/lib/libutil/login_cap.h#2 integrate .. //depot/projects/mpsafetty/lib/libutil/login_class.3#2 integrate .. //depot/projects/mpsafetty/lib/libutil/login_class.c#2 integrate .. //depot/projects/mpsafetty/sbin/mksnap_ffs/mksnap_ffs.8#2 integrate .. //depot/projects/mpsafetty/share/man/man4/wi.4#2 integrate .. //depot/projects/mpsafetty/sys/conf/files#5 integrate .. //depot/projects/mpsafetty/sys/contrib/ipfilter/netinet/ip_nat.c#3 integrate .. //depot/projects/mpsafetty/sys/dev/atkbdc/psm.c#2 integrate .. //depot/projects/mpsafetty/sys/dev/iicbus/ds1339.c#1 branch .. //depot/projects/mpsafetty/sys/dev/wi/if_wi.c#2 integrate .. //depot/projects/mpsafetty/sys/kern/uipc_usrreq.c#2 integrate .. //depot/projects/mpsafetty/sys/libkern/arc4random.c#3 integrate .. //depot/projects/mpsafetty/sys/net/bpf_buffer.c#2 integrate .. //depot/projects/mpsafetty/sys/net/route.c#2 integrate .. //depot/projects/mpsafetty/sys/net80211/ieee80211_hostap.c#2 integrate .. //depot/projects/mpsafetty/sys/netinet/raw_ip.c#3 integrate .. //depot/projects/mpsafetty/sys/netinet/udp_usrreq.c#7 integrate .. //depot/projects/mpsafetty/sys/netipsec/ipsec.c#3 integrate .. //depot/projects/mpsafetty/sys/netipx/ipx_input.c#3 integrate .. //depot/projects/mpsafetty/sys/netipx/ipx_usrreq.c#3 integrate .. //depot/projects/mpsafetty/usr.bin/tar/bsdtar.1#2 integrate .. //depot/projects/mpsafetty/usr.sbin/rtadvd/rtadvd.c#2 integrate .. //depot/projects/mpsafetty/usr.sbin/rtsold/rtsold.c#2 integrate Differences ... ==== //depot/projects/mpsafetty/lib/libc/gen/arc4random.c#3 (text+ko) ==== @@ -33,7 +33,7 @@ */ #include -__FBSDID("$FreeBSD: src/lib/libc/gen/arc4random.c,v 1.22 2008/07/22 17:10:18 ache Exp $"); +__FBSDID("$FreeBSD: src/lib/libc/gen/arc4random.c,v 1.23 2008/07/25 15:42:22 ache Exp $"); #include "namespace.h" #include @@ -54,8 +54,7 @@ static pthread_mutex_t arc4random_mtx = PTHREAD_MUTEX_INITIALIZER; -#define RANDOMDEV "/dev/random" -#define KEYSIZE 128 +#define RANDOMDEV "/dev/urandom" #define THREAD_LOCK() \ do { \ if (__isthreaded) \ @@ -107,40 +106,34 @@ static void arc4_stir(void) { - int done, fd, n; + int fd, n; struct { - struct timeval tv; - pid_t pid; - u_int8_t rnd[KEYSIZE]; - } rdat; + struct timeval tv; + pid_t pid; + u_int8_t rnd[128 - sizeof(struct timeval) - sizeof(pid_t)]; + } rdat; + gettimeofday(&rdat.tv, NULL); + rdat.pid = getpid(); fd = _open(RANDOMDEV, O_RDONLY, 0); - done = 0; if (fd >= 0) { - if (_read(fd, &rdat, KEYSIZE) == KEYSIZE) - done = 1; - (void)_close(fd); + (void) _read(fd, rdat.rnd, sizeof(rdat.rnd)); + _close(fd); } - if (!done) { - (void)gettimeofday(&rdat.tv, NULL); - rdat.pid = getpid(); - /* We'll just take whatever was on the stack too... */ - } + /* fd < 0? Ah, what the heck. We'll just take whatever was on the + * stack... */ - arc4_addrandom((u_char *)&rdat, KEYSIZE); + arc4_addrandom((void *) &rdat, sizeof(rdat)); /* * Throw away the first N bytes of output, as suggested in the * paper "Weaknesses in the Key Scheduling Algorithm of RC4" - * by Fluher, Mantin, and Shamir. N=768 is based on + * by Fluher, Mantin, and Shamir. N=1024 is based on * suggestions in the paper "(Not So) Random Shuffles of RC4" * by Ilya Mironov. */ - if (rs_initialized != 1) { - for (n = 0; n < 768; n++) - (void)arc4_getbyte(); - rs_initialized = 1; - } + for (n = 0; n < 1024; n++) + (void) arc4_getbyte(); arc4_count = 1600000; } @@ -177,7 +170,7 @@ { if (!rs_initialized) { arc4_init(); - rs_initialized = 2; + rs_initialized = 1; } } @@ -196,7 +189,6 @@ THREAD_LOCK(); arc4_check_init(); arc4_stir(); - rs_stired = 1; THREAD_UNLOCK(); } @@ -258,10 +250,6 @@ if (upper_bound < 2) return (0); - /* Detect simple power of two case */ - if ((upper_bound & -upper_bound) == upper_bound) - return (arc4random() % upper_bound); - #if (ULONG_MAX > 0xffffffffUL) min = 0x100000000UL % upper_bound; #else ==== //depot/projects/mpsafetty/lib/libutil/login.conf.5#2 (text+ko) ==== @@ -17,7 +17,7 @@ .\" 5. Modifications may be freely made to this file providing the above .\" conditions are met. .\" -.\" $FreeBSD: src/lib/libutil/login.conf.5,v 1.60 2006/10/10 08:15:08 ru Exp $ +.\" $FreeBSD: src/lib/libutil/login.conf.5,v 1.61 2008/07/25 19:58:14 brooks Exp $ .\" .Dd October 9, 2006 .Dt LOGIN.CONF 5 @@ -203,6 +203,15 @@ .It Sy "Name Type Notes Description .It "charset string Set $MM_CHARSET environment variable to the specified value. +.It "cpumask string List of cpus to bind the user to. +The syntax is the same as for the +.Fl l +argument of +.Xr cpuset 1 or the word +.Ql default . +If set to +.Ql default +no action is taken. .It "hushlogin bool false Same as having a ~/.hushlogin file. .It "ignorenologin bool false Login not prevented by nologin. .It "ftp-chroot bool false Limit FTP access with ==== //depot/projects/mpsafetty/lib/libutil/login_cap.h#2 (text+ko) ==== @@ -22,7 +22,7 @@ * Low-level routines relating to the user capabilities database * * Was login_cap.h,v 1.9 1997/05/07 20:00:01 eivind Exp - * $FreeBSD: src/lib/libutil/login_cap.h,v 1.9 2003/10/18 10:04:16 markm Exp $ + * $FreeBSD: src/lib/libutil/login_cap.h,v 1.10 2008/07/25 19:58:14 brooks Exp $ */ #ifndef _LOGIN_CAP_H_ @@ -48,7 +48,8 @@ #define LOGIN_SETUSER 0x0040 /* set user (via setuid) */ #define LOGIN_SETENV 0x0080 /* set user environment */ #define LOGIN_SETMAC 0x0100 /* set user default MAC label */ -#define LOGIN_SETALL 0x01ff /* set everything */ +#define LOGIN_SETCPUMASK 0x0200 /* set user cpumask */ +#define LOGIN_SETALL 0x03ff /* set everything */ #define BI_AUTH "authorize" /* accepted authentication */ #define BI_REJECT "reject" /* rejected authentication */ ==== //depot/projects/mpsafetty/lib/libutil/login_class.3#2 (text+ko) ==== @@ -17,7 +17,7 @@ .\" 5. Modifications may be freely made to this file providing the above .\" conditions are met. .\" -.\" $FreeBSD: src/lib/libutil/login_class.3,v 1.19 2006/06/17 07:25:58 maxim Exp $ +.\" $FreeBSD: src/lib/libutil/login_class.3,v 1.20 2008/07/25 19:58:14 brooks Exp $ .\" .Dd December 28, 1996 .Os @@ -155,6 +155,18 @@ Set the MAC label for the current process to the label specified in system login class database. .Pp +.It LOGIN_SETCPUMASK +Create a new +.Xr cpuset 2 +and set the cpu affinity to the specified mask. +The string may contain a comma separated list of numbers and/or number +ranges as handled by the +.Xr cpuset 1 +utility or the case-insensitive string +.Ql default . +If the string is +.Ql default +no action will be taken. .It LOGIN_SETALL Enables all of the above settings. .El @@ -186,6 +198,8 @@ .Xr syslog 3 , with LOG_ERR priority and directed to the currently active facility. .Sh SEE ALSO +.Xr cpuset 1 , +.Xr cpuset 2 , .Xr setgid 2 , .Xr setlogin 2 , .Xr setuid 2 , ==== //depot/projects/mpsafetty/lib/libutil/login_class.c#2 (text+ko) ==== @@ -23,12 +23,14 @@ */ #include -__FBSDID("$FreeBSD: src/lib/libutil/login_class.c,v 1.25 2007/05/01 18:50:33 yar Exp $"); +__FBSDID("$FreeBSD: src/lib/libutil/login_class.c,v 1.26 2008/07/25 19:58:14 brooks Exp $"); #include +#include #include #include #include +#include #include #include #include @@ -239,6 +241,108 @@ } +static int +list2cpuset(const char *list, cpuset_t *mask) +{ + enum { NONE, NUM, DASH } state; + int lastnum; + int curnum; + const char *l; + + state = NONE; + curnum = lastnum = 0; + for (l = list; *l != '\0';) { + if (isdigit(*l)) { + curnum = atoi(l); + if (curnum > CPU_SETSIZE) + errx(EXIT_FAILURE, + "Only %d cpus supported", CPU_SETSIZE); + while (isdigit(*l)) + l++; + switch (state) { + case NONE: + lastnum = curnum; + state = NUM; + break; + case DASH: + for (; lastnum <= curnum; lastnum++) + CPU_SET(lastnum, mask); + state = NONE; + break; + case NUM: + default: + return (0); + } + continue; + } + switch (*l) { + case ',': + switch (state) { + case NONE: + break; + case NUM: + CPU_SET(curnum, mask); + state = NONE; + break; + case DASH: + return (0); + break; + } + break; + case '-': + if (state != NUM) + return (0); + state = DASH; + break; + default: + return (0); + } + l++; + } + switch (state) { + case NONE: + break; + case NUM: + CPU_SET(curnum, mask); + break; + case DASH: + return (0); + } + return 1; +} + + +void +setclasscpumask(login_cap_t *lc) +{ + const char *maskstr; + cpuset_t maskset; + cpusetid_t setid; + + maskstr = login_getcapstr(lc, "cpumask", NULL, NULL); + CPU_ZERO(&maskset); + if (maskstr == NULL) + return; + if (strcasecmp("default", maskstr) == 0) + return; + if (!list2cpuset(maskstr, &maskset)) { + syslog(LOG_WARNING, + "list2cpuset(%s) invalid mask specification", maskstr); + return; + } + + if (cpuset(&setid) != 0) { + syslog(LOG_ERR, "cpuset(): %s", strerror(errno)); + return; + } + + if (cpuset_setaffinity(CPU_LEVEL_CPUSET, CPU_WHICH_PID, -1, + sizeof(maskset), &maskset) != 0) + syslog(LOG_ERR, "cpuset_setaffinity(%s): %s", maskstr, + strerror(errno)); +} + + /* * setclasscontext() * @@ -289,6 +393,9 @@ /* Set environment */ if (flags & LOGIN_SETENV) setclassenvironment(lc, pwd, 0); + /* Set cpu affinity */ + if (flags & LOGIN_SETCPUMASK) + setclasscpumask(lc); } return mymask; } ==== //depot/projects/mpsafetty/sbin/mksnap_ffs/mksnap_ffs.8#2 (text+ko) ==== @@ -32,7 +32,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $FreeBSD: src/sbin/mksnap_ffs/mksnap_ffs.8,v 1.3 2003/09/07 14:11:02 charnier Exp $ +.\" $FreeBSD: src/sbin/mksnap_ffs/mksnap_ffs.8,v 1.4 2008/07/26 13:18:33 kib Exp $ .\" .Dd January 19, 2003 .Dt MKSNAP_FFS 8 @@ -68,6 +68,9 @@ .Xr chmod 2 , .Xr chown 8 , .Xr mount 8 +.Sh CAVEATS +The disk full situation is not handled gracefully and may +lead to a system panic when no free blocks are found. .Sh HISTORY The .Nm ==== //depot/projects/mpsafetty/share/man/man4/wi.4#2 (text+ko) ==== @@ -28,7 +28,7 @@ .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF .\" THE POSSIBILITY OF SUCH DAMAGE. .\" -.\" $FreeBSD: src/share/man/man4/wi.4,v 1.75 2008/04/20 20:35:45 sam Exp $ +.\" $FreeBSD: src/share/man/man4/wi.4,v 1.76 2008/07/26 18:31:39 imp Exp $ .\" $OpenBSD: wi.4tbl,v 1.14 2002/04/29 19:53:50 jsyn Exp $ .\" .Dd April 13, 2008 @@ -347,6 +347,24 @@ .Pp Lucent cards prior to firmware version 6.0.6 do not implement IBSS mode and are not supported. +.Pp +Prior versions of +.Nm +supported Symbol firmware. +That support has been removed due to persistent problems with this +firmware as well as getting proper documentation on this firmware. +.Pp +Hermes 2 and Hermes 3 chips are not supported by this driver. +.Pp +Here's the above requirements in the form of a table +.Pp +.Bl -column -compact "Prims II/2.5" "xxxxxxxx" "xxxxxxxx" "xxxxxxxx" "xxxxxxxx" +.Em "Firmware Minimum WPA Host AP Adhoc/IBSS" +Prism II/2.5 0.8.0 1.7.0 1.3.4 1.3.1 +Prism 3 0.8.0 1.7.0 1.4.9 1.3.1 +Hermes 6.0.6 none none 6.0.6 +Symbol none none none none +.El .Sh BUGS Not all the new messages are documented here, and many of them are indications of transient errors that are not indications of serious ==== //depot/projects/mpsafetty/sys/conf/files#5 (text+ko) ==== @@ -1,4 +1,4 @@ -# $FreeBSD: src/sys/conf/files,v 1.1317 2008/07/25 14:31:00 ed Exp $ +# $FreeBSD: src/sys/conf/files,v 1.1318 2008/07/25 19:35:40 stas Exp $ # # The long compile-with and dependency lines are required because of # limitations in config: backslash-newline doesn't work in strings, and @@ -697,6 +697,7 @@ dev/igb/e1000_82575.c optional igb | em \ compile-with "${NORMAL_C} -I$S/dev/igb" dev/iicbus/ad7418.c optional ad7418 +dev/iicbus/ds1339.c optional ds1339 dev/iicbus/ds1672.c optional ds1672 dev/iicbus/icee.c optional icee dev/iicbus/if_ic.c optional ic ==== //depot/projects/mpsafetty/sys/contrib/ipfilter/netinet/ip_nat.c#3 (text+ko) ==== @@ -1,4 +1,4 @@ -/* $FreeBSD: src/sys/contrib/ipfilter/netinet/ip_nat.c,v 1.45 2008/07/24 12:35:05 darrenr Exp $ */ +/* $FreeBSD: src/sys/contrib/ipfilter/netinet/ip_nat.c,v 1.46 2008/07/26 19:46:00 darrenr Exp $ */ /* * Copyright (C) 1995-2003 by Darren Reed. @@ -117,7 +117,7 @@ #if !defined(lint) static const char sccsid[] = "@(#)ip_nat.c 1.11 6/5/96 (C) 1995 Darren Reed"; -static const char rcsid[] = "@(#)$FreeBSD: src/sys/contrib/ipfilter/netinet/ip_nat.c,v 1.45 2008/07/24 12:35:05 darrenr Exp $"; +static const char rcsid[] = "@(#)$FreeBSD: src/sys/contrib/ipfilter/netinet/ip_nat.c,v 1.46 2008/07/26 19:46:00 darrenr Exp $"; /* static const char rcsid[] = "@(#)$Id: ip_nat.c,v 2.195.2.102 2007/10/16 10:08:10 darrenr Exp $"; */ #endif @@ -2033,11 +2033,13 @@ * Standard port translation. Select next port. */ if (np->in_flags & IPN_SEQUENTIAL) { - port = htons(np->in_pnext); + port = np->in_pnext; } else { port = ipf_random() % (ntohs(np->in_pmax) - ntohs(np->in_pmin)); + port += ntohs(np->in_pmin); } + port = htons(port); np->in_pnext++; if (np->in_pnext > ntohs(np->in_pmax)) { ==== //depot/projects/mpsafetty/sys/dev/atkbdc/psm.c#2 (text+ko) ==== @@ -59,7 +59,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/dev/atkbdc/psm.c,v 1.97 2008/06/01 13:44:51 philip Exp $"); +__FBSDID("$FreeBSD: src/sys/dev/atkbdc/psm.c,v 1.98 2008/07/26 00:01:19 trhodes Exp $"); #include "opt_isa.h" #include "opt_psm.h" @@ -2112,26 +2112,34 @@ SYSCTL_NODE(_debug, OID_AUTO, psm, CTLFLAG_RD, 0, "ps/2 mouse"); SYSCTL_NODE(_hw, OID_AUTO, psm, CTLFLAG_RD, 0, "ps/2 mouse"); -SYSCTL_INT(_debug_psm, OID_AUTO, loglevel, CTLFLAG_RW, &verbose, 0, ""); +SYSCTL_INT(_debug_psm, OID_AUTO, loglevel, CTLFLAG_RW, &verbose, 0, + "Verbosity level"); static int psmhz = 20; -SYSCTL_INT(_debug_psm, OID_AUTO, hz, CTLFLAG_RW, &psmhz, 0, ""); +SYSCTL_INT(_debug_psm, OID_AUTO, hz, CTLFLAG_RW, &psmhz, 0, + "Frequency of the softcallout (in hz)"); static int psmerrsecs = 2; -SYSCTL_INT(_debug_psm, OID_AUTO, errsecs, CTLFLAG_RW, &psmerrsecs, 0, ""); +SYSCTL_INT(_debug_psm, OID_AUTO, errsecs, CTLFLAG_RW, &psmerrsecs, 0, + "Number of seconds during which packets will dropped after a sync error"); static int psmerrusecs = 0; -SYSCTL_INT(_debug_psm, OID_AUTO, errusecs, CTLFLAG_RW, &psmerrusecs, 0, ""); +SYSCTL_INT(_debug_psm, OID_AUTO, errusecs, CTLFLAG_RW, &psmerrusecs, 0, + "Microseconds to add to psmerrsecs"); static int psmsecs = 0; -SYSCTL_INT(_debug_psm, OID_AUTO, secs, CTLFLAG_RW, &psmsecs, 0, ""); +SYSCTL_INT(_debug_psm, OID_AUTO, secs, CTLFLAG_RW, &psmsecs, 0, + "Max number of seconds between soft interrupts"); static int psmusecs = 500000; -SYSCTL_INT(_debug_psm, OID_AUTO, usecs, CTLFLAG_RW, &psmusecs, 0, ""); +SYSCTL_INT(_debug_psm, OID_AUTO, usecs, CTLFLAG_RW, &psmusecs, 0, + "Microseconds to add to psmsecs"); static int pkterrthresh = 2; -SYSCTL_INT(_debug_psm, OID_AUTO, pkterrthresh, CTLFLAG_RW, &pkterrthresh, - 0, ""); +SYSCTL_INT(_debug_psm, OID_AUTO, pkterrthresh, CTLFLAG_RW, &pkterrthresh, 0, + "Number of error packets allowed before reinitializing the mouse"); static int tap_threshold = PSM_TAP_THRESHOLD; -SYSCTL_INT(_hw_psm, OID_AUTO, tap_threshold, CTLFLAG_RW, &tap_threshold, 0, ""); +SYSCTL_INT(_hw_psm, OID_AUTO, tap_threshold, CTLFLAG_RW, &tap_threshold, 0, + "Button tap threshold"); static int tap_timeout = PSM_TAP_TIMEOUT; -SYSCTL_INT(_hw_psm, OID_AUTO, tap_timeout, CTLFLAG_RW, &tap_timeout, 0, ""); +SYSCTL_INT(_hw_psm, OID_AUTO, tap_timeout, CTLFLAG_RW, &tap_timeout, 0, + "Tap timeout for touchpads"); static void psmintr(void *arg) ==== //depot/projects/mpsafetty/sys/dev/wi/if_wi.c#2 (text+ko) ==== @@ -60,7 +60,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/dev/wi/if_wi.c,v 1.218 2008/05/12 00:15:30 sam Exp $"); +__FBSDID("$FreeBSD: src/sys/dev/wi/if_wi.c,v 1.219 2008/07/26 17:04:30 imp Exp $"); #define WI_HERMES_STATS_WAR /* Work around stats counter bug. */ @@ -250,19 +250,6 @@ } ic = ifp->if_l2com; - /* - * NB: no locking is needed here; don't put it here - * unless you can prove it! - */ - error = bus_setup_intr(dev, sc->irq, INTR_TYPE_NET | INTR_MPSAFE, - NULL, wi_intr, sc, &sc->wi_intrhand); - - if (error) { - device_printf(dev, "bus_setup_intr() failed! (%d)\n", error); - wi_free(dev); - return error; - } - sc->sc_firmware_type = WI_NOTYPE; sc->wi_cmd_count = 500; /* Reset the NIC. */ @@ -473,6 +460,17 @@ if (bootverbose) ieee80211_announce(ic); + error = bus_setup_intr(dev, sc->irq, INTR_TYPE_NET | INTR_MPSAFE, + NULL, wi_intr, sc, &sc->wi_intrhand); + if (error) { + device_printf(dev, "bus_setup_intr() failed! (%d)\n", error); + bpfdetach(ifp); + ieee80211_ifdetach(ic); + if_free(sc->sc_ifp); + wi_free(dev); + return error; + } + return (0); } ==== //depot/projects/mpsafetty/sys/kern/uipc_usrreq.c#2 (text+ko) ==== @@ -56,7 +56,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/kern/uipc_usrreq.c,v 1.215 2008/07/03 23:26:10 emaste Exp $"); +__FBSDID("$FreeBSD: src/sys/kern/uipc_usrreq.c,v 1.216 2008/07/26 00:55:35 trhodes Exp $"); #include "opt_ddb.h" #include "opt_mac.h" @@ -139,14 +139,15 @@ SYSCTL_NODE(_net_local, SOCK_DGRAM, dgram, CTLFLAG_RW, 0, "SOCK_DGRAM"); SYSCTL_ULONG(_net_local_stream, OID_AUTO, sendspace, CTLFLAG_RW, - &unpst_sendspace, 0, ""); + &unpst_sendspace, 0, "Default stream send space."); SYSCTL_ULONG(_net_local_stream, OID_AUTO, recvspace, CTLFLAG_RW, - &unpst_recvspace, 0, ""); + &unpst_recvspace, 0, "Default stream receive space."); SYSCTL_ULONG(_net_local_dgram, OID_AUTO, maxdgram, CTLFLAG_RW, - &unpdg_sendspace, 0, ""); + &unpdg_sendspace, 0, "Default datagram send space."); SYSCTL_ULONG(_net_local_dgram, OID_AUTO, recvspace, CTLFLAG_RW, - &unpdg_recvspace, 0, ""); -SYSCTL_INT(_net_local, OID_AUTO, inflight, CTLFLAG_RD, &unp_rights, 0, ""); + &unpdg_recvspace, 0, "Default datagram receive space."); +SYSCTL_INT(_net_local, OID_AUTO, inflight, CTLFLAG_RD, &unp_rights, 0, + "File descriptors in flight."); /*- * Locking and synchronization: @@ -1969,10 +1970,12 @@ } static int unp_recycled; -SYSCTL_INT(_net_local, OID_AUTO, recycled, CTLFLAG_RD, &unp_recycled, 0, ""); +SYSCTL_INT(_net_local, OID_AUTO, recycled, CTLFLAG_RD, &unp_recycled, 0, + "Number of unreachable sockets claimed by the garbage collector."); static int unp_taskcount; -SYSCTL_INT(_net_local, OID_AUTO, taskcount, CTLFLAG_RD, &unp_taskcount, 0, ""); +SYSCTL_INT(_net_local, OID_AUTO, taskcount, CTLFLAG_RD, &unp_taskcount, 0, + "Number of times the garbage collector has run."); static void unp_gc(__unused void *arg, int pending) ==== //depot/projects/mpsafetty/sys/libkern/arc4random.c#3 (text+ko) ==== @@ -9,7 +9,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/libkern/arc4random.c,v 1.13 2008/07/22 16:16:51 ache Exp $"); +__FBSDID("$FreeBSD: src/sys/libkern/arc4random.c,v 1.15 2008/07/26 16:42:45 ache Exp $"); #include #include @@ -76,14 +76,12 @@ arc4_numruns = 0; /* - * Throw away the first N bytes of output, as suggested in the + * Throw away the first N words of output, as suggested in the * paper "Weaknesses in the Key Scheduling Algorithm of RC4" - * by Fluher, Mantin, and Shamir. N=768 is based on - * suggestions in the paper "(Not So) Random Shuffles of RC4" - * by Ilya Mironov. + * by Fluher, Mantin, and Shamir. (N = 256 in our case.) */ - for (n = 0; n < 768; n++) - (void)arc4_randbyte(); + for (n = 0; n < 256*4; n++) + arc4_randbyte(); mtx_unlock(&arc4_mtx); } ==== //depot/projects/mpsafetty/sys/net/bpf_buffer.c#2 (text+ko) ==== @@ -62,7 +62,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/net/bpf_buffer.c,v 1.2 2008/03/24 22:21:32 jkim Exp $"); +__FBSDID("$FreeBSD: src/sys/net/bpf_buffer.c,v 1.3 2008/07/25 23:58:09 trhodes Exp $"); #include "opt_bpf.h" @@ -89,10 +89,10 @@ static int bpf_bufsize = 4096; SYSCTL_INT(_net_bpf, OID_AUTO, bufsize, CTLFLAG_RW, - &bpf_bufsize, 0, ""); + &bpf_bufsize, 0, "Maximum capture buffer size in bytes"); static int bpf_maxbufsize = BPF_MAXBUFSIZE; SYSCTL_INT(_net_bpf, OID_AUTO, maxbufsize, CTLFLAG_RW, - &bpf_maxbufsize, 0, ""); + &bpf_maxbufsize, 0, "Default capture buffer in bytes"); void bpf_buffer_alloc(struct bpf_d *d) ==== //depot/projects/mpsafetty/sys/net/route.c#2 (text+ko) ==== @@ -27,7 +27,7 @@ * SUCH DAMAGE. * * @(#)route.c 8.3.1.1 (Berkeley) 2/23/95 - * $FreeBSD: src/sys/net/route.c,v 1.131 2008/05/10 04:32:58 julian Exp $ + * $FreeBSD: src/sys/net/route.c,v 1.132 2008/07/27 01:29:28 julian Exp $ */ /************************************************************************ * Note: In this file a 'fib' is a "forwarding information base" * @@ -84,9 +84,25 @@ u_int rt_numfibs = RT_NUMFIBS; SYSCTL_INT(_net, OID_AUTO, fibs, CTLFLAG_RD, &rt_numfibs, 0, ""); -/* Eventually this will be a tunable */ +/* + * Allow the boot code to allow LESS than RT_MAXFIBS to be used. + * We can't do more because storage is statically allocated for now. + * (for compatibility reasons.. this will change). + */ TUNABLE_INT("net.fibs", &rt_numfibs); +/* + * By default add routes to all fibs for new interfaces. + * Once this is set to 0 then only allocate routes on interface + * changes for the FIB of the caller when adding a new set of addresses + * to an interface. XXX this is a shotgun aproach to a problem that needs + * a more fine grained solution.. that will come. + */ +u_int rt_add_addr_allfibs = 1; +SYSCTL_INT(_net, OID_AUTO, add_addr_allfibs, CTLFLAG_RW, + &rt_add_addr_allfibs, 0, ""); +TUNABLE_INT("net.add_addr_allfibs", &rt_add_addr_allfibs); + static struct rtstat rtstat; /* by default only the first 'row' of tables will be accessed. */ @@ -1453,8 +1469,12 @@ if ( dst->sa_family != AF_INET) fibnum = 0; if (fibnum == -1) { - startfib = 0; - endfib = rt_numfibs - 1; + if (rt_add_addr_allfibs == 0 && cmd == (int)RTM_ADD) { + startfib = endfib = curthread->td_proc->p_fibnum; + } else { + startfib = 0; + endfib = rt_numfibs - 1; + } } else { KASSERT((fibnum < rt_numfibs), ("rtinit1: bad fibnum")); startfib = fibnum; ==== //depot/projects/mpsafetty/sys/net80211/ieee80211_hostap.c#2 (text+ko) ==== @@ -25,7 +25,7 @@ #include #ifdef __FreeBSD__ -__FBSDID("$FreeBSD: src/sys/net80211/ieee80211_hostap.c,v 1.1 2008/04/20 20:35:43 sam Exp $"); +__FBSDID("$FreeBSD: src/sys/net80211/ieee80211_hostap.c,v 1.2 2008/07/26 23:50:27 sam Exp $"); #endif /* @@ -2199,8 +2199,14 @@ "aid mismatch: sta aid 0x%x poll aid 0x%x", ni->ni_associd, aid); vap->iv_stats.is_ps_badaid++; - IEEE80211_SEND_MGMT(ni, IEEE80211_FC0_SUBTYPE_DEAUTH, - IEEE80211_REASON_NOT_ASSOCED); + /* + * NB: We used to deauth the station but it turns out + * the Blackberry Curve 8230 (and perhaps other devices) + * sometimes send the wrong AID when WME is negotiated. + * Being more lenient here seems ok as we already check + * the station is associated and we only return frames + * queued for the station (i.e. we don't use the AID). + */ return; } ==== //depot/projects/mpsafetty/sys/netinet/raw_ip.c#3 (text+ko) ==== @@ -31,7 +31,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/netinet/raw_ip.c,v 1.188 2008/07/18 10:47:07 rwatson Exp $"); +__FBSDID("$FreeBSD: src/sys/netinet/raw_ip.c,v 1.190 2008/07/26 21:12:00 mav Exp $"); #include "opt_inet6.h" #include "opt_ipsec.h" @@ -109,6 +109,41 @@ void (*ip_rsvp_force_done)(struct socket *); /* + * Hash functions + */ + +#define INP_PCBHASH_RAW_SIZE 256 +#define INP_PCBHASH_RAW(proto, laddr, faddr, mask) \ + (((proto) + (laddr) + (faddr)) % (mask) + 1) + +static void +rip_inshash(struct inpcb *inp) +{ + struct inpcbinfo *pcbinfo = inp->inp_pcbinfo; + struct inpcbhead *pcbhash; + int hash; + + INP_INFO_WLOCK_ASSERT(pcbinfo); + INP_WLOCK_ASSERT(inp); + + if (inp->inp_ip_p && inp->inp_laddr.s_addr && inp->inp_faddr.s_addr) { + hash = INP_PCBHASH_RAW(inp->inp_ip_p, inp->inp_laddr.s_addr, + inp->inp_faddr.s_addr, pcbinfo->ipi_hashmask); + } else { + hash = 0; + } + pcbhash = &pcbinfo->ipi_hashbase[hash]; + LIST_INSERT_HEAD(pcbhash, inp, inp_hash); +} + +static void +rip_delhash(struct inpcb *inp) +{ + INP_WLOCK_ASSERT(inp); + LIST_REMOVE(inp, inp_hash); +} + +/* * Raw interface to IP protocol. */ @@ -138,12 +173,8 @@ INP_INFO_LOCK_INIT(&ripcbinfo, "rip"); LIST_INIT(&ripcb); ripcbinfo.ipi_listhead = &ripcb; - /* - * XXX We don't use the hash list for raw IP, but it's easier to - * allocate a one entry hash list than it is to check all over the - * place for hashbase == NULL. - */ - ripcbinfo.ipi_hashbase = hashinit(1, M_PCB, &ripcbinfo.ipi_hashmask); + ripcbinfo.ipi_hashbase = hashinit(INP_PCBHASH_RAW_SIZE, M_PCB, + &ripcbinfo.ipi_hashmask); ripcbinfo.ipi_porthashbase = hashinit(1, M_PCB, &ripcbinfo.ipi_porthashmask); ripcbinfo.ipi_zone = uma_zcreate("ripcb", sizeof(struct inpcb), @@ -208,34 +239,65 @@ int proto = ip->ip_p; struct inpcb *inp, *last; struct sockaddr_in ripsrc; + int hash; bzero(&ripsrc, sizeof(ripsrc)); ripsrc.sin_len = sizeof(ripsrc); ripsrc.sin_family = AF_INET; ripsrc.sin_addr = ip->ip_src; last = NULL; + hash = INP_PCBHASH_RAW(proto, ip->ip_src.s_addr, + ip->ip_dst.s_addr, ripcbinfo.ipi_hashmask); INP_INFO_RLOCK(&ripcbinfo); - LIST_FOREACH(inp, &ripcb, inp_list) { + LIST_FOREACH(inp, &ripcbinfo.ipi_hashbase[hash], inp_hash) { + if (inp->inp_ip_p != proto) + continue; +#ifdef INET6 + if ((inp->inp_vflag & INP_IPV4) == 0) + continue; +#endif + if (inp->inp_laddr.s_addr != ip->ip_dst.s_addr) + continue; + if (inp->inp_faddr.s_addr != ip->ip_src.s_addr) + continue; INP_RLOCK(inp); - if (inp->inp_ip_p && inp->inp_ip_p != proto) { - docontinue: + if (jailed(inp->inp_socket->so_cred) && + (htonl(prison_getip(inp->inp_socket->so_cred)) != + ip->ip_dst.s_addr)) { INP_RUNLOCK(inp); continue; } + if (last) { + struct mbuf *n; + + n = m_copy(m, 0, (int)M_COPYALL); + if (n != NULL) + (void) rip_append(last, ip, n, &ripsrc); + /* XXX count dropped packet */ + INP_RUNLOCK(last); + } + last = inp; + } + LIST_FOREACH(inp, &ripcbinfo.ipi_hashbase[0], inp_hash) { + if (inp->inp_ip_p && inp->inp_ip_p != proto) + continue; #ifdef INET6 if ((inp->inp_vflag & INP_IPV4) == 0) - goto docontinue; + continue; #endif if (inp->inp_laddr.s_addr && inp->inp_laddr.s_addr != ip->ip_dst.s_addr) - goto docontinue; + continue; if (inp->inp_faddr.s_addr && inp->inp_faddr.s_addr != ip->ip_src.s_addr) - goto docontinue; - if (jailed(inp->inp_socket->so_cred)) - if (htonl(prison_getip(inp->inp_socket->so_cred)) != - ip->ip_dst.s_addr) - goto docontinue; + continue; + INP_RLOCK(inp); + if (jailed(inp->inp_socket->so_cred) && + (htonl(prison_getip(inp->inp_socket->so_cred)) != + ip->ip_dst.s_addr)) { + INP_RUNLOCK(inp); + continue; + } if (last) { struct mbuf *n; @@ -247,6 +309,7 @@ } last = inp; } + INP_INFO_RUNLOCK(&ripcbinfo); if (last != NULL) { if (rip_append(last, ip, m, &ripsrc) != 0) ipstat.ips_delivered--; @@ -256,7 +319,6 @@ ipstat.ips_noproto++; ipstat.ips_delivered--; } - INP_INFO_RUNLOCK(&ripcbinfo); } /* @@ -610,10 +672,11 @@ return (error); } inp = (struct inpcb *)so->so_pcb; - INP_INFO_WUNLOCK(&ripcbinfo); inp->inp_vflag |= INP_IPV4; inp->inp_ip_p = proto; inp->inp_ip_ttl = ip_defttl; + rip_inshash(inp); + INP_INFO_WUNLOCK(&ripcbinfo); INP_WUNLOCK(inp); return (0); } @@ -630,6 +693,7 @@ INP_INFO_WLOCK(&ripcbinfo); INP_WLOCK(inp); + rip_delhash(inp); if (so == ip_mrouter && ip_mrouter_done) ip_mrouter_done(); if (ip_rsvp_force_done) @@ -644,10 +708,11 @@ static void rip_dodisconnect(struct socket *so, struct inpcb *inp) { - INP_WLOCK_ASSERT(inp); + rip_delhash(inp); inp->inp_faddr.s_addr = INADDR_ANY; + rip_inshash(inp); SOCK_LOCK(so); so->so_state &= ~SS_ISCONNECTED; SOCK_UNLOCK(so); @@ -730,7 +795,9 @@ INP_INFO_WLOCK(&ripcbinfo); INP_WLOCK(inp); + rip_delhash(inp); inp->inp_laddr = addr->sin_addr; + rip_inshash(inp); INP_WUNLOCK(inp); INP_INFO_WUNLOCK(&ripcbinfo); return (0); @@ -754,7 +821,9 @@ INP_INFO_WLOCK(&ripcbinfo); INP_WLOCK(inp); + rip_delhash(inp); inp->inp_faddr = addr->sin_addr; + rip_inshash(inp); soisconnected(so); INP_WUNLOCK(inp); INP_INFO_WUNLOCK(&ripcbinfo); ==== //depot/projects/mpsafetty/sys/netinet/udp_usrreq.c#7 (text+ko) ==== @@ -32,7 +32,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/netinet/udp_usrreq.c,v 1.233 2008/07/20 15:29:58 trhodes Exp $"); +__FBSDID("$FreeBSD: src/sys/netinet/udp_usrreq.c,v 1.234 2008/07/26 23:07:34 mav Exp $"); #include "opt_ipfw.h" #include "opt_inet6.h" @@ -132,7 +132,7 @@ struct inpcbinfo udbinfo; >>> TRUNCATED FOR MAIL (1000 lines) <<<