CVS commit: src/sys/arch/sparc/sparc
Module Name:src Committed By: mrg Date: Wed Jan 17 07:38:20 UTC 2018 Modified Files: src/sys/arch/sparc/sparc: cpu.c cpuvar.h Log Message: fix previous: CPUFLG_SUN4CACHEBUG was renamed to CACHE_TRAPPAGEBUG and moved into the cacheinfo. don't revive the no longer used value, but fix the non-sun4m code to match cpu.c 1.251. To generate a diff of this commit: cvs rdiff -u -r1.251 -r1.252 src/sys/arch/sparc/sparc/cpu.c cvs rdiff -u -r1.96 -r1.97 src/sys/arch/sparc/sparc/cpuvar.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/sparc/sparc/cpu.c diff -u src/sys/arch/sparc/sparc/cpu.c:1.251 src/sys/arch/sparc/sparc/cpu.c:1.252 --- src/sys/arch/sparc/sparc/cpu.c:1.251 Tue Jan 16 08:23:17 2018 +++ src/sys/arch/sparc/sparc/cpu.c Wed Jan 17 07:38:20 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: cpu.c,v 1.251 2018/01/16 08:23:17 mrg Exp $ */ +/* $NetBSD: cpu.c,v 1.252 2018/01/17 07:38:20 mrg Exp $ */ /* * Copyright (c) 1996 @@ -52,7 +52,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.251 2018/01/16 08:23:17 mrg Exp $"); +__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.252 2018/01/17 07:38:20 mrg Exp $"); #include "opt_multiprocessor.h" #include "opt_lockdebug.h" @@ -1187,7 +1187,7 @@ getcacheinfo_sun4(struct cpu_info *sc, i ci->c_l2linesize = 4; ci->c_split = 0; ci->c_nlines = ci->c_totalsize >> ci->c_l2linesize; - sc->flags |= CPUFLG_SUN4CACHEBUG; + sc->cacheinfo.c_flags |= CACHE_TRAPPAGEBUG; break; case CPUTYP_4_400: ci->c_vactype = VAC_WRITEBACK; @@ -1321,7 +1321,7 @@ getcacheinfo_sun4c(struct cpu_info *sc, * mysterious buserr-type variable) */ if (prom_getpropint(node, "buserr-type", 0) == 1) - sc->flags |= CPUFLG_SUN4CACHEBUG; + sc->cacheinfo.c_flags |= CACHE_TRAPPAGEBUG; } #endif /* SUN4C */ Index: src/sys/arch/sparc/sparc/cpuvar.h diff -u src/sys/arch/sparc/sparc/cpuvar.h:1.96 src/sys/arch/sparc/sparc/cpuvar.h:1.97 --- src/sys/arch/sparc/sparc/cpuvar.h:1.96 Wed Jan 17 02:39:16 2018 +++ src/sys/arch/sparc/sparc/cpuvar.h Wed Jan 17 07:38:20 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: cpuvar.h,v 1.96 2018/01/17 02:39:16 christos Exp $ */ +/* $NetBSD: cpuvar.h,v 1.97 2018/01/17 07:38:20 mrg Exp $ */ /* * Copyright (c) 1996 The NetBSD Foundation, Inc. @@ -157,7 +157,6 @@ struct module_info { #define CPUFLG_HATCHED 0x1000 /* CPU is alive */ #define CPUFLG_PAUSED 0x2000 /* CPU is paused */ #define CPUFLG_GOTMSG 0x4000 /* CPU got an lev13 IPI */ -#define CPUFLG_SUN4CACHEBUG 0x8000 /* CPU has the sun4 cache bug */ /*
CVS commit: src/external/apache2/mDNSResponder/dist
Module Name:src Committed By: christos Date: Wed Jan 17 06:10:28 UTC 2018 Modified Files: src/external/apache2/mDNSResponder/dist/mDNSCore: mDNSEmbeddedAPI.h src/external/apache2/mDNSResponder/dist/mDNSPosix: mDNSPosix.c mDNSUNP.h src/external/apache2/mDNSResponder/dist/mDNSShared: dnssd_ipc.h Log Message: make lint compile again. To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 \ src/external/apache2/mDNSResponder/dist/mDNSCore/mDNSEmbeddedAPI.h cvs rdiff -u -r1.12 -r1.13 \ src/external/apache2/mDNSResponder/dist/mDNSPosix/mDNSPosix.c cvs rdiff -u -r1.1.1.3 -r1.2 \ src/external/apache2/mDNSResponder/dist/mDNSPosix/mDNSUNP.h cvs rdiff -u -r1.6 -r1.7 \ src/external/apache2/mDNSResponder/dist/mDNSShared/dnssd_ipc.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/external/apache2/mDNSResponder/dist/mDNSCore/mDNSEmbeddedAPI.h diff -u src/external/apache2/mDNSResponder/dist/mDNSCore/mDNSEmbeddedAPI.h:1.6 src/external/apache2/mDNSResponder/dist/mDNSCore/mDNSEmbeddedAPI.h:1.7 --- src/external/apache2/mDNSResponder/dist/mDNSCore/mDNSEmbeddedAPI.h:1.6 Sun Jan 14 15:04:55 2018 +++ src/external/apache2/mDNSResponder/dist/mDNSCore/mDNSEmbeddedAPI.h Wed Jan 17 01:10:27 2018 @@ -2602,7 +2602,7 @@ extern mDNSu8 NumUnreachableDNSServers; #if (defined(_MSC_VER)) #define mDNSinline static __inline -#elif ((__GNUC__ > 2) || ((__GNUC__ == 2) && (__GNUC_MINOR__ >= 9))) +#elif ((__GNUC__ > 2) || ((__GNUC__ == 2) && (__GNUC_MINOR__ >= 9))) || defined(__lint__) #define mDNSinline static inline #endif @@ -3562,6 +3562,7 @@ extern int MD5_Final(unsigned char *md, struct CompileTimeAssertionChecks_mDNS { +#ifndef __lint__ // Check that the compiler generated our on-the-wire packet format structure definitions // properly packed, without adding padding bytes to align fields on 32-bit or 64-bit boundaries. char assert0[(sizeof(rdataSRV) == 262 ) ? 1 : -1]; @@ -3613,6 +3614,7 @@ struct CompileTimeAssertionChecks_mDNS #if APPLE_OSX_mDNSResponder char sizecheck_ClientTunnel[(sizeof(ClientTunnel) <= 1256) ? 1 : -1]; #endif +#endif }; // Routine to initialize device-info TXT record contents Index: src/external/apache2/mDNSResponder/dist/mDNSPosix/mDNSPosix.c diff -u src/external/apache2/mDNSResponder/dist/mDNSPosix/mDNSPosix.c:1.12 src/external/apache2/mDNSResponder/dist/mDNSPosix/mDNSPosix.c:1.13 --- src/external/apache2/mDNSResponder/dist/mDNSPosix/mDNSPosix.c:1.12 Sun Jan 14 15:04:56 2018 +++ src/external/apache2/mDNSResponder/dist/mDNSPosix/mDNSPosix.c Wed Jan 17 01:10:27 2018 @@ -1455,7 +1455,7 @@ mDNSexport int mDNSPlatformMemCmp(const mDNSexport void mDNSPlatformQsort(void *base, int nel, int width, int (*compar)(const void *, const void *)) { -return (qsort(base, nel, width, compar)); +qsort(base, nel, width, compar); } // DNSSEC stub functions Index: src/external/apache2/mDNSResponder/dist/mDNSPosix/mDNSUNP.h diff -u src/external/apache2/mDNSResponder/dist/mDNSPosix/mDNSUNP.h:1.1.1.3 src/external/apache2/mDNSResponder/dist/mDNSPosix/mDNSUNP.h:1.2 --- src/external/apache2/mDNSResponder/dist/mDNSPosix/mDNSUNP.h:1.1.1.3 Sun Jan 14 13:43:02 2018 +++ src/external/apache2/mDNSResponder/dist/mDNSPosix/mDNSUNP.h Wed Jan 17 01:10:27 2018 @@ -101,7 +101,7 @@ struct ifi_info { extern struct ifi_info *get_ifi_info_linuxv6(int family, int doaliases); #endif -#if defined(AF_INET6) && HAVE_IPV6 +#if defined(AF_INET6) && HAVE_IPV6 && !defined(INET6_ADDRSTRLEN) #define INET6_ADDRSTRLEN 46 /*Maximum length of IPv6 address */ #endif Index: src/external/apache2/mDNSResponder/dist/mDNSShared/dnssd_ipc.h diff -u src/external/apache2/mDNSResponder/dist/mDNSShared/dnssd_ipc.h:1.6 src/external/apache2/mDNSResponder/dist/mDNSShared/dnssd_ipc.h:1.7 --- src/external/apache2/mDNSResponder/dist/mDNSShared/dnssd_ipc.h:1.6 Sun Jan 14 15:04:56 2018 +++ src/external/apache2/mDNSResponder/dist/mDNSShared/dnssd_ipc.h Wed Jan 17 01:10:28 2018 @@ -213,8 +213,10 @@ struct CompileTimeAssertionChecks_dnssd_ { // Check that the compiler generated our on-the-wire packet format structure definitions // properly packed, without adding padding bytes to align fields on 32-bit or 64-bit boundaries. +#ifndef __lint__ char assert0[(sizeof(client_context_t) == 8) ? 1 : -1]; char assert1[(sizeof(ipc_msg_hdr) == 28) ? 1 : -1]; +#endif }; #endif // DNSSD_IPC_H
CVS commit: src/share/man/man9
Module Name:src Committed By: pgoyette Date: Wed Jan 17 04:31:59 UTC 2018 Modified Files: src/share/man/man9: pfil.9 Log Message: Avoid applying .Dv to the left parenthesis, since it is not applied to the closing right parenthesis. To generate a diff of this commit: cvs rdiff -u -r1.36 -r1.37 src/share/man/man9/pfil.9 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/share/man/man9/pfil.9 diff -u src/share/man/man9/pfil.9:1.36 src/share/man/man9/pfil.9:1.37 --- src/share/man/man9/pfil.9:1.36 Wed Jan 17 02:45:38 2018 +++ src/share/man/man9/pfil.9 Wed Jan 17 04:31:59 2018 @@ -1,4 +1,4 @@ -.\" $NetBSD: pfil.9,v 1.36 2018/01/17 02:45:38 maya Exp $ +.\" $NetBSD: pfil.9,v 1.37 2018/01/17 04:31:59 pgoyette Exp $ .\" .\" Copyright (c) 1996 Matthew R. Green .\" All rights reserved. @@ -115,8 +115,8 @@ When a filter is invoked, the packet app That is, all protocol fields are in network byte order. The filter is called with its specified argument, the pointer to the pointer to the mbuf containing the packet, the pointer to the network -interface that the packet is traversing, and the direction -.Dv ( PFIL_IN +interface that the packet is traversing, and the direction (either +.Dv PFIL_IN or .Dv PFIL_OUT , see also below) that the packet is traveling. @@ -150,7 +150,8 @@ and .Fn pfil_remove_ihook functions, respectively. The event handler is called with its specified argument, the event id -.Dv ( PFIL_IFNET_ATTACH +(either +.Dv PFIL_IFNET_ATTACH or .Dv PFIL_IFNET_DETACH , see also below) or ioctl number, and the pointer
CVS commit: src/usr.sbin/ypserv/ypserv
Module Name:src Committed By: christos Date: Wed Jan 17 03:16:10 UTC 2018 Modified Files: src/usr.sbin/ypserv/ypserv: ypserv_proc.c Log Message: PR/47615: Dr. W. Stukenbrock: Always zero out the result structs in the svc procs to avoid returning stale request data to the client. XXX: pullup-6,7,8 To generate a diff of this commit: cvs rdiff -u -r1.17 -r1.18 src/usr.sbin/ypserv/ypserv/ypserv_proc.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/ypserv/ypserv/ypserv_proc.c diff -u src/usr.sbin/ypserv/ypserv/ypserv_proc.c:1.17 src/usr.sbin/ypserv/ypserv/ypserv_proc.c:1.18 --- src/usr.sbin/ypserv/ypserv/ypserv_proc.c:1.17 Fri Jul 17 11:58:01 2015 +++ src/usr.sbin/ypserv/ypserv/ypserv_proc.c Tue Jan 16 22:16:10 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: ypserv_proc.c,v 1.17 2015/07/17 15:58:01 christos Exp $ */ +/* $NetBSD: ypserv_proc.c,v 1.18 2018/01/17 03:16:10 christos Exp $ */ /* * Copyright (c) 1994 Mats O Jansson@@ -28,7 +28,7 @@ #include #ifndef lint -__RCSID("$NetBSD: ypserv_proc.c,v 1.17 2015/07/17 15:58:01 christos Exp $"); +__RCSID("$NetBSD: ypserv_proc.c,v 1.18 2018/01/17 03:16:10 christos Exp $"); #endif #include @@ -163,9 +163,10 @@ ypproc_match_2_svc(void *argp, struct sv "key %.*s", clientstr, TORF(secure), k->domain, k->map, k->keydat.dsize, k->keydat.dptr)); - if (secure && securecheck(caller)) + if (secure && securecheck(caller)) { + memset(, 0, sizeof(res)); res.status = YP_YPERR; - else + } else res = ypdb_get_record(k->domain, k->map, k->keydat, secure); return ((void *)); @@ -190,9 +191,10 @@ ypproc_first_2_svc(void *argp, struct sv "first_2: request from %.500s, secure %s, domain %s, map %s", clientstr, TORF(secure), k->domain, k->map)); - if (secure && securecheck(caller)) + if (secure && securecheck(caller)) { + memset(, 0, sizeof(res)); res.status = YP_YPERR; - else + } else res = ypdb_get_first(k->domain, k->map, FALSE); return ((void *)); @@ -218,9 +220,10 @@ ypproc_next_2_svc(void *argp, struct svc "key %.*s", clientstr, TORF(secure), k->domain, k->map, k->keydat.dsize, k->keydat.dptr)); - if (secure && securecheck(caller)) + if (secure && securecheck(caller)) { + memset(, 0, sizeof(res)); res.status = YP_YPERR; - else + } else res = ypdb_get_next(k->domain, k->map, k->keydat, FALSE); return ((void *)); @@ -326,6 +329,7 @@ ypproc_all_2_svc(void *argp, struct svc_ (void)memset(, 0, sizeof(res)); if (secure && securecheck(caller)) { + memset(, 0, sizeof(res)); res.ypresp_all_u.val.status = YP_YPERR; return (); } @@ -368,9 +372,10 @@ ypproc_master_2_svc(void *argp, struct s "master_2: request from %.500s, secure %s, domain %s, map %s", clientstr, TORF(secure), k->domain, k->map)); - if (secure && securecheck(caller)) + if (secure && securecheck(caller)) { + memset(, 0, sizeof(res)); res.status = YP_YPERR; - else + } else res = ypdb_get_master(k->domain, k->map); /* @@ -409,12 +414,15 @@ ypproc_order_2_svc(void *argp, struct sv "order_2: request from %.500s, secure %s, domain %s, map %s", clientstr, TORF(secure), k->domain, k->map)); - if (secure && securecheck(caller)) + if (secure && securecheck(caller)) { + memset(, 0, sizeof(res)); res.status = YP_YPERR; - else if (_yp_invalid_map(k->map)) + } else if (_yp_invalid_map(k->map)) { + memset(, 0, sizeof(res)); res.status = YP_NOMAP; - else + } else { res = ypdb_get_order(k->domain, k->map); + } return ((void *)); } @@ -446,7 +454,7 @@ ypproc_maplist_2_svc(void *argp, struct (void)snprintf(domain_path, sizeof(domain_path), "%s/%s", YP_DB_PATH, domain); - res.list = NULL; + memset(, 0, sizeof(res)); status = YP_TRUE; if ((stat(domain_path, ) != 0) || !S_ISDIR(finfo.st_mode)) {
CVS commit: src/games/wtf
Module Name:src Committed By: pgoyette Date: Wed Jan 17 03:03:59 UTC 2018 Modified Files: src/games/wtf: wtf Log Message: Don't skip the superfluous "is" argument if it's not superfluous! This allows us to use `wtf is` and get information for the acronym "is" and produces the same output as `wtf is is` withough requiring the extra typing by the user. To generate a diff of this commit: cvs rdiff -u -r1.21 -r1.22 src/games/wtf/wtf Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/games/wtf/wtf diff -u src/games/wtf/wtf:1.21 src/games/wtf/wtf:1.22 --- src/games/wtf/wtf:1.21 Tue Apr 21 23:56:30 2015 +++ src/games/wtf/wtf Wed Jan 17 03:03:59 2018 @@ -1,6 +1,6 @@ #!/bin/sh # -# $NetBSD: wtf,v 1.21 2015/04/21 23:56:30 christos Exp $ +# $NetBSD: wtf,v 1.22 2018/01/17 03:03:59 pgoyette Exp $ # # Public domain # @@ -30,7 +30,9 @@ done shift "$(expr "$OPTIND" - 1)" if [ "$1" = "is" ]; then - shift + if [ $# -gt 1 ] ; then + shift + fi fi if [ -z "$1" ]; then
CVS commit: src
Module Name:src Committed By: maya Date: Wed Jan 17 02:45:38 UTC 2018 Modified Files: src/distrib/sets/lists/comp: mi src/share/man/man9: Makefile pfil.9 Log Message: document pfil_{add,remove}_ihook, pfil_run_{addr,if}hooks from ryo shimizu in PR bin/51941 changes by myself: fix mdoc -Tlint, add missing set lists, adjust date to today, reword history addition. To generate a diff of this commit: cvs rdiff -u -r1.2169 -r1.2170 src/distrib/sets/lists/comp/mi cvs rdiff -u -r1.417 -r1.418 src/share/man/man9/Makefile cvs rdiff -u -r1.35 -r1.36 src/share/man/man9/pfil.9 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/distrib/sets/lists/comp/mi diff -u src/distrib/sets/lists/comp/mi:1.2169 src/distrib/sets/lists/comp/mi:1.2170 --- src/distrib/sets/lists/comp/mi:1.2169 Wed Jan 10 11:02:41 2018 +++ src/distrib/sets/lists/comp/mi Wed Jan 17 02:45:38 2018 @@ -1,4 +1,4 @@ -# $NetBSD: mi,v 1.2169 2018/01/10 11:02:41 knakahara Exp $ +# $NetBSD: mi,v 1.2170 2018/01/17 02:45:38 maya Exp $ # # Note: don't delete entries from here - mark them as "obsolete" instead. ./etc/mtree/set.compcomp-sys-root @@ -11011,13 +11011,17 @@ ./usr/share/man/cat9/percpu_putref.0 comp-sys-catman .cat ./usr/share/man/cat9/pfil.0 comp-sys-catman .cat ./usr/share/man/cat9/pfil_add_hook.0 comp-sys-catman .cat +./usr/share/man/cat9/pfil_add_ihook.0 comp-sys-catman .cat ./usr/share/man/cat9/pfil_get_head.0 comp-obsolete obsolete ./usr/share/man/cat9/pfil_head_get.0 comp-sys-catman .cat ./usr/share/man/cat9/pfil_head_register.0 comp-sys-catman .cat ./usr/share/man/cat9/pfil_head_unregister.0 comp-sys-catman .cat ./usr/share/man/cat9/pfil_hook_get.0 comp-sys-catman .cat ./usr/share/man/cat9/pfil_remove_hook.0 comp-sys-catman .cat +./usr/share/man/cat9/pfil_remove_ihook.0 comp-sys-catman .cat +./usr/share/man/cat9/pfil_run_addrhooks.0 comp-sys-catman .cat ./usr/share/man/cat9/pfil_run_hooks.0 comp-sys-catman .cat +./usr/share/man/cat9/pfil_run_ifhooks.0 comp-sys-catman .cat ./usr/share/man/cat9/pfind.0 comp-obsolete obsolete ./usr/share/man/cat9/pg_find.0 comp-obsolete obsolete ./usr/share/man/cat9/pgfind.0 comp-obsolete obsolete @@ -18477,12 +18481,16 @@ ./usr/share/man/html9/percpu_putref.html comp-sys-htmlman html ./usr/share/man/html9/pfil.html comp-sys-htmlman html ./usr/share/man/html9/pfil_add_hook.html comp-sys-htmlman html +./usr/share/man/html9/pfil_add_ihook.html comp-sys-htmlman html ./usr/share/man/html9/pfil_head_get.html comp-sys-htmlman html ./usr/share/man/html9/pfil_head_register.html comp-sys-htmlman html ./usr/share/man/html9/pfil_head_unregister.html comp-sys-htmlman html ./usr/share/man/html9/pfil_hook_get.html comp-sys-htmlman html ./usr/share/man/html9/pfil_remove_hook.html comp-sys-htmlman html +./usr/share/man/html9/pfil_remove_ihook.html comp-sys-htmlman html +./usr/share/man/html9/pfil_run_addrhooks.html comp-sys-htmlman html ./usr/share/man/html9/pfil_run_hooks.html comp-sys-htmlman html +./usr/share/man/html9/pfil_run_ifhooks.html comp-sys-htmlman html ./usr/share/man/html9/pfind.html comp-obsolete obsolete ./usr/share/man/html9/pg_find.html comp-obsolete obsolete ./usr/share/man/html9/pgfind.html comp-obsolete obsolete @@ -26103,13 +26111,17 @@ ./usr/share/man/man9/percpu_putref.9 comp-sys-man .man ./usr/share/man/man9/pfil.9 comp-sys-man .man ./usr/share/man/man9/pfil_add_hook.9 comp-sys-man .man +./usr/share/man/man9/pfil_add_ihook.9 comp-sys-man .man ./usr/share/man/man9/pfil_get_head.9 comp-obsolete obsolete ./usr/share/man/man9/pfil_head_get.9 comp-sys-man .man ./usr/share/man/man9/pfil_head_register.9 comp-sys-man .man ./usr/share/man/man9/pfil_head_unregister.9 comp-sys-man .man ./usr/share/man/man9/pfil_hook_get.9 comp-sys-man .man ./usr/share/man/man9/pfil_remove_hook.9 comp-sys-man .man +./usr/share/man/man9/pfil_remove_ihook.9 comp-sys-man .man +./usr/share/man/man9/pfil_run_addrhooks.9 comp-sys-man .man ./usr/share/man/man9/pfil_run_hooks.9 comp-sys-man .man +./usr/share/man/man9/pfil_run_ifhooks.9 comp-sys-man .man ./usr/share/man/man9/pfind.9 comp-obsolete obsolete ./usr/share/man/man9/pg_find.9 comp-obsolete obsolete ./usr/share/man/man9/pgfind.9 comp-obsolete obsolete Index: src/share/man/man9/Makefile diff -u src/share/man/man9/Makefile:1.417 src/share/man/man9/Makefile:1.418 --- src/share/man/man9/Makefile:1.417 Tue Nov 7 18:36:27 2017 +++ src/share/man/man9/Makefile Wed Jan 17 02:45:38 2018 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.417 2017/11/07 18:36:27 christos Exp $ +# $NetBSD: Makefile,v 1.418 2018/01/17 02:45:38 maya Exp $ # Makefile for section 9 (kernel function and variable) manual pages. @@ -663,10 +663,14 @@ MLINKS+=percpu.9 percpu_alloc.9 \ MLINKS+=pfil.9 pfil_hook_get.9 \ pfil.9 pfil_add_hook.9 \ pfil.9
CVS commit: src/sys/arch/sparc/sparc
Module Name:src Committed By: christos Date: Wed Jan 17 02:39:16 UTC 2018 Modified Files: src/sys/arch/sparc/sparc: cpuvar.h Log Message: fix compilation To generate a diff of this commit: cvs rdiff -u -r1.95 -r1.96 src/sys/arch/sparc/sparc/cpuvar.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/sparc/sparc/cpuvar.h diff -u src/sys/arch/sparc/sparc/cpuvar.h:1.95 src/sys/arch/sparc/sparc/cpuvar.h:1.96 --- src/sys/arch/sparc/sparc/cpuvar.h:1.95 Tue Jan 16 03:23:17 2018 +++ src/sys/arch/sparc/sparc/cpuvar.h Tue Jan 16 21:39:16 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: cpuvar.h,v 1.95 2018/01/16 08:23:17 mrg Exp $ */ +/* $NetBSD: cpuvar.h,v 1.96 2018/01/17 02:39:16 christos Exp $ */ /* * Copyright (c) 1996 The NetBSD Foundation, Inc. @@ -157,6 +157,7 @@ struct module_info { #define CPUFLG_HATCHED 0x1000 /* CPU is alive */ #define CPUFLG_PAUSED 0x2000 /* CPU is paused */ #define CPUFLG_GOTMSG 0x4000 /* CPU got an lev13 IPI */ +#define CPUFLG_SUN4CACHEBUG 0x8000 /* CPU has the sun4 cache bug */ /*
CVS commit: src/sys/arch/arm/arm
Module Name:src Committed By: christos Date: Wed Jan 17 02:37:33 UTC 2018 Modified Files: src/sys/arch/arm/arm: cpufunc_asm_xscale.S Log Message: rename DCACHE_SIZE to XSCALE_DCACHE_SIZE to avoid conflict with genassym field offset with the same name. To generate a diff of this commit: cvs rdiff -u -r1.23 -r1.24 src/sys/arch/arm/arm/cpufunc_asm_xscale.S Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/arm/arm/cpufunc_asm_xscale.S diff -u src/sys/arch/arm/arm/cpufunc_asm_xscale.S:1.23 src/sys/arch/arm/arm/cpufunc_asm_xscale.S:1.24 --- src/sys/arch/arm/arm/cpufunc_asm_xscale.S:1.23 Sat Mar 29 21:15:03 2014 +++ src/sys/arch/arm/arm/cpufunc_asm_xscale.S Tue Jan 16 21:37:32 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: cpufunc_asm_xscale.S,v 1.23 2014/03/30 01:15:03 matt Exp $ */ +/* $NetBSD: cpufunc_asm_xscale.S,v 1.24 2018/01/17 02:37:32 christos Exp $ */ /* * Copyright (c) 2001, 2002 Wasabi Systems, Inc. @@ -78,7 +78,7 @@ /* * Size of the XScale core D-cache. */ -#define DCACHE_SIZE 0x8000 +#define XSCALE_DCACHE_SIZE 0x8000 .Lblock_userspace_access: .word _C_LABEL(block_userspace_access) @@ -255,7 +255,7 @@ _C_LABEL(xscale_cache_clean_addr): .global _C_LABEL(xscale_cache_clean_size) _C_LABEL(xscale_cache_clean_size): - .word DCACHE_SIZE + .word XSCALE_DCACHE_SIZE .global _C_LABEL(xscale_minidata_clean_addr) _C_LABEL(xscale_minidata_clean_addr): @@ -311,7 +311,7 @@ _C_LABEL(xscale_minidata_clean_size): * alternate between them whenever this is done. No one knows \ * why the work-around works (mmm!).\ */\ - eor r0, r0, #(DCACHE_SIZE); \ + eor r0, r0, #(XSCALE_DCACHE_SIZE) ; \ str r0, [r2] ; \ add r0, r0, r1
CVS commit: src/sys/dev/pci
Module Name:src Committed By: knakahara Date: Wed Jan 17 02:16:07 UTC 2018 Modified Files: src/sys/dev/pci: if_wm.c Log Message: Fix duplicated "rxintr" evcnt counting. Pointed out by ozaki-r@n.o, thanks. To generate a diff of this commit: cvs rdiff -u -r1.555 -r1.556 src/sys/dev/pci/if_wm.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/pci/if_wm.c diff -u src/sys/dev/pci/if_wm.c:1.555 src/sys/dev/pci/if_wm.c:1.556 --- src/sys/dev/pci/if_wm.c:1.555 Tue Jan 16 07:23:13 2018 +++ src/sys/dev/pci/if_wm.c Wed Jan 17 02:16:07 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: if_wm.c,v 1.555 2018/01/16 07:23:13 knakahara Exp $ */ +/* $NetBSD: if_wm.c,v 1.556 2018/01/17 02:16:07 knakahara Exp $ */ /* * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc. @@ -83,7 +83,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.555 2018/01/16 07:23:13 knakahara Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.556 2018/01/17 02:16:07 knakahara Exp $"); #ifdef _KERNEL_OPT #include "opt_net_mpsafe.h" @@ -417,6 +417,7 @@ struct wm_rxqueue { uint32_t rxq_bytes; /* for AIM */ #ifdef WM_EVENT_COUNTERS WM_Q_EVCNT_DEFINE(rxq, rxintr); /* Rx interrupts */ + WM_Q_EVCNT_DEFINE(rxq, rxdefer); /* Rx deferred processing */ WM_Q_EVCNT_DEFINE(rxq, rxipsum); /* IP checksums checked in-bound */ WM_Q_EVCNT_DEFINE(rxq, rxtusum); /* TCP/UDP cksums checked in-bound */ @@ -6456,6 +6457,7 @@ wm_alloc_txrx_queues(struct wm_softc *sc xname = device_xname(sc->sc_dev); WM_Q_INTR_EVCNT_ATTACH(rxq, rxintr, rxq, i, xname); + WM_Q_INTR_EVCNT_ATTACH(rxq, rxdefer, rxq, i, xname); WM_Q_INTR_EVCNT_ATTACH(rxq, rxipsum, rxq, i, xname); WM_Q_INTR_EVCNT_ATTACH(rxq, rxtusum, rxq, i, xname); @@ -6506,6 +6508,7 @@ wm_free_txrx_queues(struct wm_softc *sc) #ifdef WM_EVENT_COUNTERS WM_Q_EVCNT_DETACH(rxq, rxintr, rxq, i); + WM_Q_EVCNT_DETACH(rxq, rxdefer, rxq, i); WM_Q_EVCNT_DETACH(rxq, rxipsum, rxq, i); WM_Q_EVCNT_DETACH(rxq, rxtusum, rxq, i); #endif /* WM_EVENT_COUNTERS */ @@ -9021,7 +9024,7 @@ wm_handle_queue(void *arg) mutex_exit(rxq->rxq_lock); return; } - WM_Q_EVCNT_INCR(rxq, rxintr); + WM_Q_EVCNT_INCR(rxq, rxdefer); wm_rxeof(rxq, limit); mutex_exit(rxq->rxq_lock);
CVS commit: othersrc/external/historical/eawk
Module Name:othersrc Committed By: agc Date: Wed Jan 17 01:38:37 UTC 2018 Modified Files: othersrc/external/historical/eawk/bin: expected othersrc/external/historical/eawk/dist: awkgram.y othersrc/external/historical/eawk/extend: Makefile othersrc/external/historical/eawk/extend/archive: archive.c othersrc/external/historical/eawk/extend/netpgpverify: netpgpverify.c othersrc/external/historical/eawk/lib: Makefile Log Message: Bring eawk up to date, it's had no real love since 2013. 1. Don't use bison, just use standard yacc to build 2. Use pure-parser directive, rather than %pure_parser 3. libarchive has changed its API since 2013 - adapt 4. netpgpverify has also changed its API since 2013 - adapt also 5. There is no sqlite3 sub-directory, so don't descend into it With thanks to yukonbob for the nudge. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 othersrc/external/historical/eawk/bin/expected cvs rdiff -u -r1.3 -r1.4 othersrc/external/historical/eawk/dist/awkgram.y cvs rdiff -u -r1.5 -r1.6 othersrc/external/historical/eawk/extend/Makefile cvs rdiff -u -r1.1 -r1.2 \ othersrc/external/historical/eawk/extend/archive/archive.c cvs rdiff -u -r1.1 -r1.2 \ othersrc/external/historical/eawk/extend/netpgpverify/netpgpverify.c cvs rdiff -u -r1.1 -r1.2 othersrc/external/historical/eawk/lib/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: othersrc/external/historical/eawk/bin/expected diff -u othersrc/external/historical/eawk/bin/expected:1.4 othersrc/external/historical/eawk/bin/expected:1.5 --- othersrc/external/historical/eawk/bin/expected:1.4 Thu Jun 6 01:45:56 2013 +++ othersrc/external/historical/eawk/bin/expected Wed Jan 17 01:38:36 2018 @@ -20,23 +20,14 @@ _mdnsd _tests _tcpdump _tss +_rtadvd +_unbound uucp nobody agc -prosody -quagga -cjparker -dirmngr dbus lp -avahi -polkit -haldaemon -pulse cyrus -distcc -varnish -stud 2. Testing FS, non-first field, print and next root:Charlie & toor:Bourne-again Superuser @@ -58,23 +49,14 @@ _mdnsd:& pseudo-user _tests:& pseudo-user _tcpdump:& pseudo-user _tss:& pseudo-user +_rtadvd:& pseudo-user +_unbound:& pseudo-user uucp:UNIX-to-UNIX Copy nobody:Unprivileged user agc: -prosody:Prosody daemon user -quagga:quagga user -cjparker: -dirmngr:dirmngr user dbus:System message bus lp:Common UNIX Printing System user -avahi:Avahi user -polkit:policykit polkit user -haldaemon:hal haldaemon user -pulse:pulseaudio pulse user cyrus:cyrus-sasl cyrus user -distcc:distcc user -varnish:Varnish daemon user -stud:stud daemon user 3. Testing BEGIN printing hello world 4. Testing bit arith @@ -114,7 +96,7 @@ ddaf35a193617abacc417349ae20413112e6fa4e 15. Testing stat mode 100644 16. Testing stat -mode 2123 +mode 1576 16. Testing time 17. Testing ctime wrong ctime! @@ -130,9 +112,9 @@ WARNS= 5 21. Testing getaddrinfo 17 21. Testing getaddrinfo address returned -1002005095143556 +10020050c7e9d9cd 22. Testing getaddrinfo address returned -1002005095143556 +10020050c7e9d9cd 23. Testing soundex abortion a163 BRXN acrimony a265 KRMNY @@ -199,550 +181,11 @@ output 27. Testing fnmatch Makefile 28. Testing http -http://www.w3.org/TR/html4/loose.dtd;> - - - - - - - - -http://www.NetBSD.org/changes/rss-netbsd.xml;> -The NetBSD Project - - - - - - - - - - - - - - - -Skip to main content. - - - - - The NetBSD Project - Of course it runs NetBSD - - - http://www.NetBSD.org/cgi-bin/redirect.cgi;> - - http://www.NetBSD.org/;>- WWW mirrors - - - - http://www.au.NetBSD.org/;>Australia - http://www2.be.NetBSD.org/;>Belgium (IPv4,IPv6) - http://www.fr.NetBSD.org/;>France (IPv4,IPv6) - http://netbsd.mcom.fr/;>France/2 - http://www.de.NetBSD.org/;>Germany (IPv4,IPv6) - http://netbsd.mirrors.treibsand.com/;>Germany/2 - http://www.it.NetBSD.org/;>Italy - http://www.jp.NetBSD.org/index.html;>Japan - http://www.za.NetBSD.org/;>South Africa - http://www.se.NetBSD.org/;>Sweden - http://www.uk.NetBSD.org/;>UK - http://netbsd.planetunix.net/;>USA (IPv4,IPv6) - - http://www.NetBSD.org/;>Master Site, USA (IPv4, IPv6) - http://www6.NetBSD.org/;>Master Site, USA (IPv6 only) - - - - - - - - - - - - Google custom search - http://www.google.com/jsapi" type="text/javascript"> - google.load('search', '1', {language : 'en'}); - google.setOnLoadCallback(function() { - var header_customSearchControl = new
CVS commit: src/lib/libc
Module Name:src Committed By: kamil Date: Wed Jan 17 01:24:30 UTC 2018 Modified Files: src/lib/libc/gen: closefrom.c exect.c src/lib/libc/include: namespace.h src/lib/libc/stdio: fopen.c freopen.c Log Message: Revert to commits as they broke few rump tests "Include namespace.h in a few of libc source files [...] This change finishes elimination of usage of the global name of the following symbols: - close -> _close - execve -> _execve - fcntl -> _fcntl - setcontext -> _setcontext - wait6 -> _wait6 - write -> _write - writev -> _writev" "Register more syscalls in namespace.h (of libc) Add weak symbols for: - fcntl - close - execve - setcontext - wait6 - write - writev" These changes broke: fs/nfs/t_rquotad:get_nfs_be_1_both fs/nfs/t_rquotad:get_nfs_be_1_group fs/nfs/t_rquotad:get_nfs_be_1_user fs/nfs/t_rquotad:get_nfs_le_1_both fs/nfs/t_rquotad:get_nfs_le_1_group fs/nfs/t_rquotad:get_nfs_le_1_user lib/librumphijack/t_config:fdoff lib/librumphijack/t_tcpip:http lib/librumphijack/t_tcpip:nfs lib/librumphijack/t_vfs:cpcopy lib/librumphijack/t_vfs:mv_x lib/librumphijack/t_vfs:paxcopy net/net/t_forwarding:ipforwarding_fastforward_v4 net/net/t_forwarding:ipforwarding_fastforward_v6 net/net/t_forwarding:ipforwarding_fragment_v4 net/net/t_forwarding:ipforwarding_misc net/net/t_mtudisc6:mtudisc6_basic This revert fixes the failures, except lib/librumphijack/t_vfs. The original changes were added in order to facilitate a usage of sanitizers against programs linked with NetBSD's libc. It is no longer needed, so abandon these changes. Sponsored by To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/lib/libc/gen/closefrom.c cvs rdiff -u -r1.2 -r1.3 src/lib/libc/gen/exect.c cvs rdiff -u -r1.195 -r1.196 src/lib/libc/include/namespace.h cvs rdiff -u -r1.18 -r1.19 src/lib/libc/stdio/fopen.c cvs rdiff -u -r1.21 -r1.22 src/lib/libc/stdio/freopen.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/libc/gen/closefrom.c diff -u src/lib/libc/gen/closefrom.c:1.3 src/lib/libc/gen/closefrom.c:1.4 --- src/lib/libc/gen/closefrom.c:1.3 Fri Jan 5 19:01:36 2018 +++ src/lib/libc/gen/closefrom.c Wed Jan 17 01:24:29 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: closefrom.c,v 1.3 2018/01/05 19:01:36 kamil Exp $ */ +/* $NetBSD: closefrom.c,v 1.4 2018/01/17 01:24:29 kamil Exp $ */ /* * Copyright (C) 2004 WIDE Project. @@ -31,10 +31,9 @@ #include #if defined(LIBC_SCCS) && !defined(lint) -__RCSID("$NetBSD: closefrom.c,v 1.3 2018/01/05 19:01:36 kamil Exp $"); +__RCSID("$NetBSD: closefrom.c,v 1.4 2018/01/17 01:24:29 kamil Exp $"); #endif /* LIBC_SCCS and not lint */ -#include "namespace.h" #include #include Index: src/lib/libc/gen/exect.c diff -u src/lib/libc/gen/exect.c:1.2 src/lib/libc/gen/exect.c:1.3 --- src/lib/libc/gen/exect.c:1.2 Fri Jan 5 19:01:36 2018 +++ src/lib/libc/gen/exect.c Wed Jan 17 01:24:29 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: exect.c,v 1.2 2018/01/05 19:01:36 kamil Exp $ */ +/* $NetBSD: exect.c,v 1.3 2018/01/17 01:24:29 kamil Exp $ */ /*- * Copyright (c) 2016 The NetBSD Foundation, Inc. @@ -28,10 +28,9 @@ #include #if !defined(lint) -__RCSID("$NetBSD: exect.c,v 1.2 2018/01/05 19:01:36 kamil Exp $"); +__RCSID("$NetBSD: exect.c,v 1.3 2018/01/17 01:24:29 kamil Exp $"); #endif -#include "namespace.h" #include __warn_references(exect, Index: src/lib/libc/include/namespace.h diff -u src/lib/libc/include/namespace.h:1.195 src/lib/libc/include/namespace.h:1.196 --- src/lib/libc/include/namespace.h:1.195 Sun Jan 7 21:19:35 2018 +++ src/lib/libc/include/namespace.h Wed Jan 17 01:24:29 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: namespace.h,v 1.195 2018/01/07 21:19:35 kamil Exp $ */ +/* $NetBSD: namespace.h,v 1.196 2018/01/17 01:24:29 kamil Exp $ */ /*- * Copyright (c) 1997-2004 The NetBSD Foundation, Inc. @@ -45,7 +45,6 @@ #define err _err #define errc _errc #define errx _errx -#define fcntl _fcntl #ifdef _REENTRANT #define fileno _fileno #endif /* _REENTRANT */ @@ -275,7 +274,6 @@ #define clock_gettime _clock_gettime #define clock_getres _clock_getres #define clock_settime _clock_settime -#define close _close #define closedir _closedir #define closelog _closelog #define closelog_r _closelog_r @@ -320,7 +318,6 @@ #define execlp _execlp #define execlpe _execlpe #define execv _execv -#define execve _execve #define execvp _execvp #define execvpe _execvpe #define explicit_memset _explicit_memset @@ -620,7 +617,6 @@ #define seekdir _seekdir #define select _select #define send _send -#define setcontext _setcontext #define setdomainname _setdomainname #define setenv _setenv #define setfsent _setfsent @@ -798,7 +794,6 @@ #define wait _wait #define
CVS commit: src/bin/ksh
Module Name:src Committed By: maya Date: Wed Jan 17 00:29:22 UTC 2018 Modified Files: src/bin/ksh: history.c Log Message: Use 0600 as the mode for histfile here too. pointed out by John D. Baker in PR bin/52480 To generate a diff of this commit: cvs rdiff -u -r1.17 -r1.18 src/bin/ksh/history.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/bin/ksh/history.c diff -u src/bin/ksh/history.c:1.17 src/bin/ksh/history.c:1.18 --- src/bin/ksh/history.c:1.17 Fri Jun 30 04:41:19 2017 +++ src/bin/ksh/history.c Wed Jan 17 00:29:22 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: history.c,v 1.17 2017/06/30 04:41:19 kamil Exp $ */ +/* $NetBSD: history.c,v 1.18 2018/01/17 00:29:22 maya Exp $ */ /* * command history @@ -19,7 +19,7 @@ #include #ifndef lint -__RCSID("$NetBSD: history.c,v 1.17 2017/06/30 04:41:19 kamil Exp $"); +__RCSID("$NetBSD: history.c,v 1.18 2018/01/17 00:29:22 maya Exp $"); #endif #include @@ -753,7 +753,7 @@ hist_finish() else hp = histlist; - if ((fd = open(hname, O_WRONLY | O_CREAT | O_TRUNC | O_EXLOCK, 0777)) != -1) { + if ((fd = open(hname, O_WRONLY | O_CREAT | O_TRUNC | O_EXLOCK, 0600)) != -1) { /* Remove anything written before we got the lock */ ftruncate(fd, 0); if ((fh = fdopen(fd, "w")) != NULL) {
CVS commit: src/tests/fs/tmpfs
Module Name:src Committed By: maya Date: Wed Jan 17 00:23:17 UTC 2018 Modified Files: src/tests/fs/tmpfs: t_sizes.sh t_statvfs.sh t_vnode_leak.sh Log Message: Use sysctl -n rather than parse the output. >From Ngie Cooper in PR bin/51870 To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/tests/fs/tmpfs/t_sizes.sh cvs rdiff -u -r1.4 -r1.5 src/tests/fs/tmpfs/t_statvfs.sh cvs rdiff -u -r1.6 -r1.7 src/tests/fs/tmpfs/t_vnode_leak.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/fs/tmpfs/t_sizes.sh diff -u src/tests/fs/tmpfs/t_sizes.sh:1.5 src/tests/fs/tmpfs/t_sizes.sh:1.6 --- src/tests/fs/tmpfs/t_sizes.sh:1.5 Sun Nov 7 17:51:18 2010 +++ src/tests/fs/tmpfs/t_sizes.sh Wed Jan 17 00:23:17 2018 @@ -1,4 +1,4 @@ -# $NetBSD: t_sizes.sh,v 1.5 2010/11/07 17:51:18 jmmv Exp $ +# $NetBSD: t_sizes.sh,v 1.6 2018/01/17 00:23:17 maya Exp $ # # Copyright (c) 2005, 2006, 2007, 2008 The NetBSD Foundation, Inc. # All rights reserved. @@ -54,7 +54,7 @@ big_head() { big_body() { test_mount -o -s10M - pagesize=$(sysctl hw.pagesize | cut -d ' ' -f 3) + pagesize=$(sysctl -n hw.pagesize) eval $($(atf_get_srcdir)/h_tools statvfs . | sed -e 's|^f_|cf_|') cf_bused=$((${cf_blocks} - ${cf_bfree})) Index: src/tests/fs/tmpfs/t_statvfs.sh diff -u src/tests/fs/tmpfs/t_statvfs.sh:1.4 src/tests/fs/tmpfs/t_statvfs.sh:1.5 --- src/tests/fs/tmpfs/t_statvfs.sh:1.4 Sun Nov 7 17:51:18 2010 +++ src/tests/fs/tmpfs/t_statvfs.sh Wed Jan 17 00:23:17 2018 @@ -1,4 +1,4 @@ -# $NetBSD: t_statvfs.sh,v 1.4 2010/11/07 17:51:18 jmmv Exp $ +# $NetBSD: t_statvfs.sh,v 1.5 2018/01/17 00:23:17 maya Exp $ # # Copyright (c) 2005, 2006, 2007 The NetBSD Foundation, Inc. # All rights reserved. @@ -38,7 +38,7 @@ values_head() { values_body() { test_mount -o -s10M - pagesize=$(sysctl hw.pagesize | cut -d ' ' -f 3) + pagesize=$(sysctl -n hw.pagesize) eval $($(atf_get_srcdir)/h_tools statvfs .) [ ${pagesize} -eq ${f_bsize} ] || \ atf_fail "Invalid bsize" Index: src/tests/fs/tmpfs/t_vnode_leak.sh diff -u src/tests/fs/tmpfs/t_vnode_leak.sh:1.6 src/tests/fs/tmpfs/t_vnode_leak.sh:1.7 --- src/tests/fs/tmpfs/t_vnode_leak.sh:1.6 Sun Nov 7 17:51:18 2010 +++ src/tests/fs/tmpfs/t_vnode_leak.sh Wed Jan 17 00:23:17 2018 @@ -1,4 +1,4 @@ -# $NetBSD: t_vnode_leak.sh,v 1.6 2010/11/07 17:51:18 jmmv Exp $ +# $NetBSD: t_vnode_leak.sh,v 1.7 2018/01/17 00:23:17 maya Exp $ # # Copyright (c) 2005, 2006, 2007, 2008 The NetBSD Foundation, Inc. # All rights reserved. @@ -36,7 +36,7 @@ main_head() { } main_body() { echo "Lowering kern.maxvnodes to 2000" - sysctl kern.maxvnodes | awk '{ print $3; }' >oldvnodes + sysctl -n kern.maxvnodes >oldvnodes atf_check -s eq:0 -o ignore -e empty sysctl -w kern.maxvnodes=2000 test_mount -o -s$(((4000 + 2) * 4096))
CVS commit: src/tests/fs/tmpfs
Module Name:src Committed By: maya Date: Wed Jan 17 00:22:29 UTC 2018 Modified Files: src/tests/fs/tmpfs: h_tools.c Log Message: - Add inttypes.h #include for PR* macros. - close fd when done to prevent leak. - use correct socket length when calling bind(2). >From Ngie Cooper in PR bin/51870 To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/tests/fs/tmpfs/h_tools.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/fs/tmpfs/h_tools.c diff -u src/tests/fs/tmpfs/h_tools.c:1.4 src/tests/fs/tmpfs/h_tools.c:1.5 --- src/tests/fs/tmpfs/h_tools.c:1.4 Sat Jun 11 18:03:17 2011 +++ src/tests/fs/tmpfs/h_tools.c Wed Jan 17 00:22:29 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: h_tools.c,v 1.4 2011/06/11 18:03:17 christos Exp $ */ +/* $NetBSD: h_tools.c,v 1.5 2018/01/17 00:22:29 maya Exp $ */ /* * Copyright (c) 2005, 2006 The NetBSD Foundation, Inc. @@ -45,6 +45,7 @@ #include #include #include +#include #include #include #include @@ -230,12 +231,13 @@ sockets_main(int argc, char **argv) return EXIT_FAILURE; } + memset(, 0, sizeof(addr)); (void)strlcpy(addr.sun_path, argv[1], sizeof(addr.sun_path)); addr.sun_family = PF_UNIX; - - error = bind(fd, (struct sockaddr *), sizeof(addr)); + error = bind(fd, (struct sockaddr *), SUN_LEN()); if (error == -1) { warn("connect"); + (void)close(fd); return EXIT_FAILURE; }
CVS commit: src/tests/lib/libc/gen
Module Name:src Committed By: maya Date: Wed Jan 17 00:16:43 UTC 2018 Modified Files: src/tests/lib/libc/gen: t_siginfo.c Log Message: Improve portability of headers and sort them. >From Ngie Cooper in PR bin/51833 To generate a diff of this commit: cvs rdiff -u -r1.31 -r1.32 src/tests/lib/libc/gen/t_siginfo.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/lib/libc/gen/t_siginfo.c diff -u src/tests/lib/libc/gen/t_siginfo.c:1.31 src/tests/lib/libc/gen/t_siginfo.c:1.32 --- src/tests/lib/libc/gen/t_siginfo.c:1.31 Sun Mar 5 16:07:38 2017 +++ src/tests/lib/libc/gen/t_siginfo.c Wed Jan 17 00:16:43 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: t_siginfo.c,v 1.31 2017/03/05 16:07:38 chs Exp $ */ +/* $NetBSD: t_siginfo.c,v 1.32 2018/01/17 00:16:43 maya Exp $ */ /*- * Copyright (c) 2010 The NetBSD Foundation, Inc. @@ -28,7 +28,6 @@ #include -#include #include #include #include @@ -36,13 +35,14 @@ #include #include +#include +#include +#include #include #include #include #include #include -#include -#include #include #ifdef __HAVE_FENV
CVS commit: src/sys/net80211
Module Name:src Committed By: maxv Date: Tue Jan 16 18:53:32 UTC 2018 Modified Files: src/sys/net80211: ieee80211_input.c ieee80211_node.c Log Message: Various fixes: style, remove tiring XXXs, and prevent integer overflow in ieee80211_setup_rates (normally it already can't happen, because I added a length check on xrates in ieee80211_recv_mgmt_beacon). To generate a diff of this commit: cvs rdiff -u -r1.107 -r1.108 src/sys/net80211/ieee80211_input.c cvs rdiff -u -r1.73 -r1.74 src/sys/net80211/ieee80211_node.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/net80211/ieee80211_input.c diff -u src/sys/net80211/ieee80211_input.c:1.107 src/sys/net80211/ieee80211_input.c:1.108 --- src/sys/net80211/ieee80211_input.c:1.107 Tue Jan 16 18:42:43 2018 +++ src/sys/net80211/ieee80211_input.c Tue Jan 16 18:53:32 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: ieee80211_input.c,v 1.107 2018/01/16 18:42:43 maxv Exp $ */ +/* $NetBSD: ieee80211_input.c,v 1.108 2018/01/16 18:53:32 maxv Exp $ */ /* * Copyright (c) 2001 Atsushi Onoe @@ -37,7 +37,7 @@ __FBSDID("$FreeBSD: src/sys/net80211/ieee80211_input.c,v 1.81 2005/08/10 16:22:29 sam Exp $"); #endif #ifdef __NetBSD__ -__KERNEL_RCSID(0, "$NetBSD: ieee80211_input.c,v 1.107 2018/01/16 18:42:43 maxv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ieee80211_input.c,v 1.108 2018/01/16 18:53:32 maxv Exp $"); #endif #ifdef _KERNEL_OPT @@ -1038,22 +1038,28 @@ ieee80211_decap(struct ieee80211com *ic, * Install received rate set information in the node's state block. */ int -ieee80211_setup_rates(struct ieee80211_node *ni, - const u_int8_t *rates, const u_int8_t *xrates, int flags) +ieee80211_setup_rates(struct ieee80211_node *ni, const u_int8_t *rates, +const u_int8_t *xrates, int flags) { struct ieee80211com *ic = ni->ni_ic; struct ieee80211_rateset *rs = >ni_rates; memset(rs, 0, sizeof(*rs)); + rs->rs_nrates = rates[1]; memcpy(rs->rs_rates, rates + 2, rs->rs_nrates); + if (xrates != NULL) { u_int8_t nxrates; + size_t totalrate; + /* * Tack on 11g extended supported rate element. */ nxrates = xrates[1]; - if (rs->rs_nrates + nxrates > IEEE80211_RATE_MAXSIZE) { + totalrate = (size_t)rs->rs_nrates + (size_t)nxrates; + + if (totalrate > IEEE80211_RATE_MAXSIZE) { IEEE80211_DEBUGVAR(char ebuf[3 * ETHER_ADDR_LEN]); nxrates = IEEE80211_RATE_MAXSIZE - rs->rs_nrates; IEEE80211_DPRINTF(ic, IEEE80211_MSG_XRATE, @@ -1063,9 +1069,11 @@ ieee80211_setup_rates(struct ieee80211_n nxrates, xrates[1]); ic->ic_stats.is_rx_rstoobig++; } + memcpy(rs->rs_rates + rs->rs_nrates, xrates+2, nxrates); rs->rs_nrates += nxrates; } + return ieee80211_fix_rate(ni, flags); } @@ -1869,11 +1877,14 @@ ieee80211_parse_wmeparams(struct ieee802 wh, "WME", "too short, len %u", len); return -1; } + qosinfo = frm[offsetof(struct ieee80211_wme_param, param_qosInfo)]; qosinfo &= WME_QOSINFO_COUNT; + /* XXX do proper check for wraparound */ if (qosinfo == wme->wme_wmeChanParams.cap_info) return 0; + frm += offsetof(struct ieee80211_wme_param, params_acParams); for (i = 0; i < WME_NUM_AC; i++) { struct wmeParams *wmep = @@ -1886,6 +1897,7 @@ ieee80211_parse_wmeparams(struct ieee802 wmep->wmep_txopLimit = LE_READ_2(frm+2); frm += 4; } + wme->wme_wmeChanParams.cap_info = qosinfo; return 1; #undef MS @@ -2191,7 +2203,7 @@ ieee80211_recv_mgmt_beacon(struct ieee80 * Count frame now that we know it's to be processed. */ if (subtype == IEEE80211_FC0_SUBTYPE_BEACON) { - ic->ic_stats.is_rx_beacon++; /* XXX remove */ + ic->ic_stats.is_rx_beacon++; IEEE80211_NODE_STAT(ni, rx_beacons); } else { IEEE80211_NODE_STAT(ni, rx_proberesp); @@ -2219,7 +2231,6 @@ ieee80211_recv_mgmt_beacon(struct ieee80 else ic->ic_flags &= ~IEEE80211_F_USEPROT; ni->ni_erp = scan.sp_erp; - /* XXX statistic */ } if ((ni->ni_capinfo ^ scan.sp_capinfo) & IEEE80211_CAPINFO_SHORT_SLOTTIME) { @@ -2237,7 +2248,6 @@ ieee80211_recv_mgmt_beacon(struct ieee80 ic->ic_curmode == IEEE80211_MODE_11A || (ni->ni_capinfo & IEEE80211_CAPINFO_SHORT_SLOTTIME)); ni->ni_capinfo = scan.sp_capinfo; - /* XXX statistic */ } if (scan.sp_wme != NULL && (ni->ni_flags & IEEE80211_NODE_QOS) && Index: src/sys/net80211/ieee80211_node.c diff -u src/sys/net80211/ieee80211_node.c:1.73 src/sys/net80211/ieee80211_node.c:1.74 --- src/sys/net80211/ieee80211_node.c:1.73 Tue Jan 16 18:42:43 2018 +++ src/sys/net80211/ieee80211_node.c Tue Jan 16 18:53:32 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: ieee80211_node.c,v 1.73 2018/01/16 18:42:43 maxv Exp $ */ +/* $NetBSD: ieee80211_node.c,v 1.74 2018/01/16 18:53:32 maxv Exp $ */ /*- * Copyright (c) 2001 Atsushi Onoe * Copyright (c) 2002-2005 Sam Leffler, Errno Consulting @@ -36,7 +36,7 @@ __FBSDID("$FreeBSD: src/sys/net80211/ieee80211_node.c,v 1.65 2005/08/13
CVS commit: src/sys
Module Name:src Committed By: maxv Date: Tue Jan 16 18:42:43 UTC 2018 Modified Files: src/sys/dev/ic: bwfm.c src/sys/net80211: ieee80211_input.c ieee80211_node.c ieee80211_node.h Log Message: Prepend 'sp_' to the name of the fields, so that they can easily be found via NXR or grep. To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/sys/dev/ic/bwfm.c cvs rdiff -u -r1.106 -r1.107 src/sys/net80211/ieee80211_input.c cvs rdiff -u -r1.72 -r1.73 src/sys/net80211/ieee80211_node.c cvs rdiff -u -r1.27 -r1.28 src/sys/net80211/ieee80211_node.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/ic/bwfm.c diff -u src/sys/dev/ic/bwfm.c:1.9 src/sys/dev/ic/bwfm.c:1.10 --- src/sys/dev/ic/bwfm.c:1.9 Tue Jan 16 14:23:15 2018 +++ src/sys/dev/ic/bwfm.c Tue Jan 16 18:42:43 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: bwfm.c,v 1.9 2018/01/16 14:23:15 maxv Exp $ */ +/* $NetBSD: bwfm.c,v 1.10 2018/01/16 18:42:43 maxv Exp $ */ /* $OpenBSD: bwfm.c,v 1.5 2017/10/16 22:27:16 patrick Exp $ */ /* * Copyright (c) 2010-2016 Broadcom Corporation @@ -1672,41 +1672,41 @@ bwfm_scan_node(struct bwfm_softc *sc, st /* Build scan result */ memset(, 0, sizeof(scan)); - scan.tstamp = (uint8_t *) - scan.bintval = le16toh(bss->beacon_period); - scan.capinfo = le16toh(bss->capability); - scan.bchan = ieee80211_chan2ieee(ic, ic->ic_curchan); - scan.chan= scan.bchan; - scan.rates = rates; - scan.ssid= ssid; + scan.sp_tstamp = (uint8_t *) + scan.sp_bintval = le16toh(bss->beacon_period); + scan.sp_capinfo = le16toh(bss->capability); + scan.sp_bchan = ieee80211_chan2ieee(ic, ic->ic_curchan); + scan.sp_chan= scan.sp_bchan; + scan.sp_rates = rates; + scan.sp_ssid= ssid; for (frm = sfrm; frm < efrm; frm += frm[1] + 2) { switch (frm[0]) { case IEEE80211_ELEMID_COUNTRY: - scan.country = frm; + scan.sp_country = frm; break; case IEEE80211_ELEMID_FHPARMS: if (ic->ic_phytype == IEEE80211_T_FH) { if (frm + 6 >= efrm) break; -scan.fhdwell = le16dec([2]); -scan.chan = IEEE80211_FH_CHAN(frm[4], frm[5]); -scan.fhindex = frm[6]; +scan.sp_fhdwell = le16dec([2]); +scan.sp_chan = IEEE80211_FH_CHAN(frm[4], frm[5]); +scan.sp_fhindex = frm[6]; } break; case IEEE80211_ELEMID_DSPARMS: if (ic->ic_phytype != IEEE80211_T_FH) { if (frm + 2 >= efrm) break; -scan.chan = frm[2]; +scan.sp_chan = frm[2]; } break; case IEEE80211_ELEMID_TIM: - scan.tim = frm; - scan.timoff = frm - sfrm; + scan.sp_tim = frm; + scan.sp_timoff = frm - sfrm; break; case IEEE80211_ELEMID_XRATES: - scan.xrates = frm; + scan.sp_xrates = frm; break; case IEEE80211_ELEMID_ERP: if (frm + 1 >= efrm) @@ -1715,10 +1715,10 @@ bwfm_scan_node(struct bwfm_softc *sc, st ic->ic_stats.is_rx_elem_toobig++; break; } - scan.erp = frm[2]; + scan.sp_erp = frm[2]; break; case IEEE80211_ELEMID_RSN: - scan.wpa = frm; + scan.sp_wpa = frm; break; case IEEE80211_ELEMID_VENDOR: if (frm + 1 >= efrm) @@ -1726,7 +1726,7 @@ bwfm_scan_node(struct bwfm_softc *sc, st if (frm + frm[1] + 2 >= efrm) break; if (bwfm_iswpaoui(frm)) -scan.wpa = frm; +scan.sp_wpa = frm; break; } if (frm + 1 >= efrm) Index: src/sys/net80211/ieee80211_input.c diff -u src/sys/net80211/ieee80211_input.c:1.106 src/sys/net80211/ieee80211_input.c:1.107 --- src/sys/net80211/ieee80211_input.c:1.106 Tue Jan 16 16:54:54 2018 +++ src/sys/net80211/ieee80211_input.c Tue Jan 16 18:42:43 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: ieee80211_input.c,v 1.106 2018/01/16 16:54:54 maxv Exp $ */ +/* $NetBSD: ieee80211_input.c,v 1.107 2018/01/16 18:42:43 maxv Exp $ */ /* * Copyright (c) 2001 Atsushi Onoe @@ -37,7 +37,7 @@ __FBSDID("$FreeBSD: src/sys/net80211/ieee80211_input.c,v 1.81 2005/08/10 16:22:29 sam Exp $"); #endif #ifdef __NetBSD__ -__KERNEL_RCSID(0, "$NetBSD: ieee80211_input.c,v 1.106 2018/01/16 16:54:54 maxv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ieee80211_input.c,v 1.107 2018/01/16 18:42:43 maxv Exp $"); #endif #ifdef _KERNEL_OPT @@ -1931,7 +1931,7 @@ ieee80211_update_adhoc_node(struct ieee8 ieee80211_init_neighbor(ic, ni, wh, scan, 0); } else { /* Record TSF for potential resync. */ - memcpy(ni->ni_tstamp.data, scan->tstamp, sizeof(ni->ni_tstamp)); + memcpy(ni->ni_tstamp.data, scan->sp_tstamp, sizeof(ni->ni_tstamp)); } ni->ni_rssi = rssi; @@ -2046,11 +2046,11 @@ ieee80211_recv_mgmt_beacon(struct ieee80 */ IEEE80211_VERIFY_LENGTH(efrm - frm, 12); memset(, 0, sizeof(scan)); - scan.tstamp = frm;frm += 8; - scan.bintval = le16toh(*(u_int16_t *)frm); frm += 2; - scan.capinfo = le16toh(*(u_int16_t *)frm); frm += 2; - scan.bchan = ieee80211_chan2ieee(ic, ic->ic_curchan); - scan.chan = scan.bchan; + scan.sp_tstamp = frm;frm += 8; + scan.sp_bintval = le16toh(*(u_int16_t *)frm);
CVS commit: src/sys/net80211
Module Name:src Committed By: maxv Date: Tue Jan 16 16:54:54 UTC 2018 Modified Files: src/sys/net80211: ieee80211_input.c Log Message: Add comments about the length checks, and check xrates. To generate a diff of this commit: cvs rdiff -u -r1.105 -r1.106 src/sys/net80211/ieee80211_input.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/net80211/ieee80211_input.c diff -u src/sys/net80211/ieee80211_input.c:1.105 src/sys/net80211/ieee80211_input.c:1.106 --- src/sys/net80211/ieee80211_input.c:1.105 Tue Jan 16 16:31:37 2018 +++ src/sys/net80211/ieee80211_input.c Tue Jan 16 16:54:54 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: ieee80211_input.c,v 1.105 2018/01/16 16:31:37 maxv Exp $ */ +/* $NetBSD: ieee80211_input.c,v 1.106 2018/01/16 16:54:54 maxv Exp $ */ /* * Copyright (c) 2001 Atsushi Onoe @@ -37,7 +37,7 @@ __FBSDID("$FreeBSD: src/sys/net80211/ieee80211_input.c,v 1.81 2005/08/10 16:22:29 sam Exp $"); #endif #ifdef __NetBSD__ -__KERNEL_RCSID(0, "$NetBSD: ieee80211_input.c,v 1.105 2018/01/16 16:31:37 maxv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ieee80211_input.c,v 1.106 2018/01/16 16:54:54 maxv Exp $"); #endif #ifdef _KERNEL_OPT @@ -2057,12 +2057,15 @@ ieee80211_recv_mgmt_beacon(struct ieee80 switch (*frm) { case IEEE80211_ELEMID_SSID: + /* no length check needed */ scan.ssid = frm; break; case IEEE80211_ELEMID_RATES: + /* no length check needed */ scan.rates = frm; break; case IEEE80211_ELEMID_COUNTRY: + /* XXX: we don't do anything with this? */ scan.country = frm; break; case IEEE80211_ELEMID_FHPARMS: @@ -2091,6 +2094,12 @@ ieee80211_recv_mgmt_beacon(struct ieee80 case IEEE80211_ELEMID_IBSSPARMS: break; case IEEE80211_ELEMID_XRATES: + if (frm[1] > IEEE80211_RATE_MAXSIZE) { +IEEE80211_DISCARD_IE(ic, IEEE80211_MSG_ELEMID, +wh, "XRATE", "bad len %u", frm[1]); +ic->ic_stats.is_rx_elem_toobig++; +break; + } scan.xrates = frm; break; case IEEE80211_ELEMID_ERP: @@ -2103,9 +2112,11 @@ ieee80211_recv_mgmt_beacon(struct ieee80 scan.erp = frm[2]; break; case IEEE80211_ELEMID_RSN: + /* no length check needed */ scan.wpa = frm; break; case IEEE80211_ELEMID_VENDOR: + /* no length check needed */ if (iswpaoui(frm)) scan.wpa = frm; else if (iswmeparam(frm) || iswmeinfo(frm))
CVS commit: src/sys/net80211
Module Name:src Committed By: maxv Date: Tue Jan 16 16:31:38 UTC 2018 Modified Files: src/sys/net80211: ieee80211_input.c Log Message: Gather related code. To generate a diff of this commit: cvs rdiff -u -r1.104 -r1.105 src/sys/net80211/ieee80211_input.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/net80211/ieee80211_input.c diff -u src/sys/net80211/ieee80211_input.c:1.104 src/sys/net80211/ieee80211_input.c:1.105 --- src/sys/net80211/ieee80211_input.c:1.104 Tue Jan 16 16:20:57 2018 +++ src/sys/net80211/ieee80211_input.c Tue Jan 16 16:31:37 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: ieee80211_input.c,v 1.104 2018/01/16 16:20:57 maxv Exp $ */ +/* $NetBSD: ieee80211_input.c,v 1.105 2018/01/16 16:31:37 maxv Exp $ */ /* * Copyright (c) 2001 Atsushi Onoe @@ -37,7 +37,7 @@ __FBSDID("$FreeBSD: src/sys/net80211/ieee80211_input.c,v 1.81 2005/08/10 16:22:29 sam Exp $"); #endif #ifdef __NetBSD__ -__KERNEL_RCSID(0, "$NetBSD: ieee80211_input.c,v 1.104 2018/01/16 16:20:57 maxv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ieee80211_input.c,v 1.105 2018/01/16 16:31:37 maxv Exp $"); #endif #ifdef _KERNEL_OPT @@ -1446,37 +1446,6 @@ bad: #endif /* !IEEE80211_NO_HOSTAP */ } -/* Verify the existence and length of __elem or get out. */ -#define IEEE80211_VERIFY_ELEMENT(__elem, __maxlen) do { \ - if ((__elem) == NULL) { \ - IEEE80211_DISCARD(ic, IEEE80211_MSG_ELEMID, \ - wh, ieee80211_mgt_subtype_name[subtype >> \ - IEEE80211_FC0_SUBTYPE_SHIFT], \ - "%s", "no " #__elem );\ - ic->ic_stats.is_rx_elem_missing++; \ - return; \ - }\ - if ((__elem)[1] > (__maxlen)) { \ - IEEE80211_DISCARD(ic, IEEE80211_MSG_ELEMID, \ - wh, ieee80211_mgt_subtype_name[subtype >> \ - IEEE80211_FC0_SUBTYPE_SHIFT], \ - "bad " #__elem " len %d", (__elem)[1]); \ - ic->ic_stats.is_rx_elem_toobig++; \ - return; \ - }\ -} while (0) - -#define IEEE80211_VERIFY_LENGTH(_len, _minlen) do { \ - if ((_len) < (_minlen)) { \ - IEEE80211_DISCARD(ic, IEEE80211_MSG_ELEMID, \ - wh, ieee80211_mgt_subtype_name[subtype >> \ - IEEE80211_FC0_SUBTYPE_SHIFT], \ - "%s", "ie too short");\ - ic->ic_stats.is_rx_elem_toosmall++; \ - return; \ - }\ -} while (0) - #ifdef IEEE80211_DEBUG static void ieee80211_ssid_mismatch(struct ieee80211com *ic, const char *tag, @@ -2003,6 +1972,36 @@ ieee80211_update_adhoc_node(struct ieee8 /* -- */ +#define IEEE80211_VERIFY_ELEMENT(__elem, __maxlen) do { \ + if ((__elem) == NULL) { \ + IEEE80211_DISCARD(ic, IEEE80211_MSG_ELEMID, \ + wh, ieee80211_mgt_subtype_name[subtype >> \ + IEEE80211_FC0_SUBTYPE_SHIFT], \ + "%s", "no " #__elem );\ + ic->ic_stats.is_rx_elem_missing++; \ + return; \ + }\ + if ((__elem)[1] > (__maxlen)) { \ + IEEE80211_DISCARD(ic, IEEE80211_MSG_ELEMID, \ + wh, ieee80211_mgt_subtype_name[subtype >> \ + IEEE80211_FC0_SUBTYPE_SHIFT], \ + "bad " #__elem " len %d", (__elem)[1]); \ + ic->ic_stats.is_rx_elem_toobig++; \ + return; \ + }\ +} while (0) + +#define IEEE80211_VERIFY_LENGTH(_len, _minlen) do { \ + if ((_len) < (_minlen)) { \ + IEEE80211_DISCARD(ic, IEEE80211_MSG_ELEMID, \ + wh, ieee80211_mgt_subtype_name[subtype >> \ + IEEE80211_FC0_SUBTYPE_SHIFT], \ + "%s", "ie too short");\ + ic->ic_stats.is_rx_elem_toosmall++; \ + return; \ + }\ +} while (0) + static void ieee80211_recv_mgmt_beacon(struct ieee80211com *ic, struct mbuf *m0, struct ieee80211_node *ni, int subtype, int rssi, u_int32_t rstamp) @@ -2948,6 +2947,10 @@ ieee80211_recv_mgmt_disassoc(struct ieee } } +#undef ISREASSOC +#undef IEEE80211_VERIFY_LENGTH +#undef IEEE80211_VERIFY_ELEMENT + /* -- */ void @@ -2998,10 +3001,6 @@ ieee80211_recv_mgmt(struct ieee80211com } } -#undef ISREASSOC -#undef IEEE80211_VERIFY_LENGTH -#undef IEEE80211_VERIFY_ELEMENT - #ifndef IEEE80211_NO_HOSTAP /* * Handle station power-save state change.
CVS commit: src/sys/arch/x86/x86
Module Name:src Committed By: kre Date: Tue Jan 16 16:24:23 UTC 2018 Modified Files: src/sys/arch/x86/x86: intr.c Log Message: Attempt to complete previous and allow XEN to compile (as well as link) To generate a diff of this commit: cvs rdiff -u -r1.120 -r1.121 src/sys/arch/x86/x86/intr.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/x86/x86/intr.c diff -u src/sys/arch/x86/x86/intr.c:1.120 src/sys/arch/x86/x86/intr.c:1.121 --- src/sys/arch/x86/x86/intr.c:1.120 Tue Jan 16 11:52:09 2018 +++ src/sys/arch/x86/x86/intr.c Tue Jan 16 16:24:23 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: intr.c,v 1.120 2018/01/16 11:52:09 roy Exp $ */ +/* $NetBSD: intr.c,v 1.121 2018/01/16 16:24:23 kre Exp $ */ /* * Copyright (c) 2007, 2008, 2009 The NetBSD Foundation, Inc. @@ -133,7 +133,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.120 2018/01/16 11:52:09 roy Exp $"); +__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.121 2018/01/16 16:24:23 kre Exp $"); #include "opt_intrdebug.h" #include "opt_multiprocessor.h" @@ -246,6 +246,9 @@ static const char *xen_intr_string(int, static inline bool redzone_const_or_false(bool); static inline int redzone_const_or_zero(int); +#else +#define redzone_const_or_false(x) (/*CONSTCOND*/0) +#define redzone_const_or_zero(x) (0) #endif static void intr_redistribute_xc_t(void *, void *);
CVS commit: src/sys/net80211
Module Name:src Committed By: maxv Date: Tue Jan 16 16:20:57 UTC 2018 Modified Files: src/sys/net80211: ieee80211_input.c Log Message: Style on the new functions. To generate a diff of this commit: cvs rdiff -u -r1.103 -r1.104 src/sys/net80211/ieee80211_input.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/net80211/ieee80211_input.c diff -u src/sys/net80211/ieee80211_input.c:1.103 src/sys/net80211/ieee80211_input.c:1.104 --- src/sys/net80211/ieee80211_input.c:1.103 Tue Jan 16 16:09:30 2018 +++ src/sys/net80211/ieee80211_input.c Tue Jan 16 16:20:57 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: ieee80211_input.c,v 1.103 2018/01/16 16:09:30 maxv Exp $ */ +/* $NetBSD: ieee80211_input.c,v 1.104 2018/01/16 16:20:57 maxv Exp $ */ /* * Copyright (c) 2001 Atsushi Onoe @@ -37,7 +37,7 @@ __FBSDID("$FreeBSD: src/sys/net80211/ieee80211_input.c,v 1.81 2005/08/10 16:22:29 sam Exp $"); #endif #ifdef __NetBSD__ -__KERNEL_RCSID(0, "$NetBSD: ieee80211_input.c,v 1.103 2018/01/16 16:09:30 maxv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ieee80211_input.c,v 1.104 2018/01/16 16:20:57 maxv Exp $"); #endif #ifdef _KERNEL_OPT @@ -2096,9 +2096,8 @@ ieee80211_recv_mgmt_beacon(struct ieee80 break; case IEEE80211_ELEMID_ERP: if (frm[1] != 1) { -IEEE80211_DISCARD_IE(ic, -IEEE80211_MSG_ELEMID, wh, "ERP", -"bad len %u", frm[1]); +IEEE80211_DISCARD_IE(ic, IEEE80211_MSG_ELEMID, +wh, "ERP", "bad len %u", frm[1]); ic->ic_stats.is_rx_elem_toobig++; break; } @@ -2116,8 +2115,7 @@ ieee80211_recv_mgmt_beacon(struct ieee80 break; default: IEEE80211_DISCARD_IE(ic, IEEE80211_MSG_ELEMID, - wh, "unhandled", - "id %u, len %u", *frm, frm[1]); + wh, "unhandled", "id %u, len %u", *frm, frm[1]); ic->ic_stats.is_rx_elem_unknown++; break; } @@ -2141,6 +2139,7 @@ ieee80211_recv_mgmt_beacon(struct ieee80 ic->ic_stats.is_rx_badchan++; return; } + if (scan.chan != scan.bchan && ic->ic_phytype != IEEE80211_T_FH) { /* @@ -2161,6 +2160,7 @@ ieee80211_recv_mgmt_beacon(struct ieee80 ic->ic_stats.is_rx_chanmismatch++; return; } + if (!(IEEE80211_BINTVAL_MIN <= scan.bintval && scan.bintval <= IEEE80211_BINTVAL_MAX)) { IEEE80211_DISCARD(ic, @@ -2176,27 +2176,28 @@ ieee80211_recv_mgmt_beacon(struct ieee80 ni = ieee80211_refine_node_for_beacon(ic, ni, >ic_channels[scan.chan], scan.ssid); } + /* * Count frame now that we know it's to be processed. */ if (subtype == IEEE80211_FC0_SUBTYPE_BEACON) { ic->ic_stats.is_rx_beacon++; /* XXX remove */ IEEE80211_NODE_STAT(ni, rx_beacons); - } else + } else { IEEE80211_NODE_STAT(ni, rx_proberesp); + } /* * When operating in station mode, check for state updates. * Be careful to ignore beacons received while doing a * background scan. We consider only 11g/WMM stuff right now. */ - if (ic->ic_opmode == IEEE80211_M_STA && - ni->ni_associd != 0 && + if (ic->ic_opmode == IEEE80211_M_STA && ni->ni_associd != 0 && ((ic->ic_flags & IEEE80211_F_SCAN) == 0 || IEEE80211_ADDR_EQ(wh->i_addr2, ni->ni_bssid))) { /* record tsf of last beacon */ - memcpy(ni->ni_tstamp.data, scan.tstamp, - sizeof(ni->ni_tstamp)); + memcpy(ni->ni_tstamp.data, scan.tstamp, sizeof(ni->ni_tstamp)); + if (ni->ni_erp != scan.erp) { IEEE80211_DPRINTF(ic, IEEE80211_MSG_ASSOC, "[%s] erp change: was 0x%x, now 0x%x\n", @@ -2210,6 +2211,7 @@ ieee80211_recv_mgmt_beacon(struct ieee80 ni->ni_erp = scan.erp; /* XXX statistic */ } + if ((ni->ni_capinfo ^ scan.capinfo) & IEEE80211_CAPINFO_SHORT_SLOTTIME) { IEEE80211_DPRINTF(ic, IEEE80211_MSG_ASSOC, "[%s] capabilities change: before 0x%x," @@ -,25 +2224,30 @@ ieee80211_recv_mgmt_beacon(struct ieee80 * change dynamically */ ieee80211_set_shortslottime(ic, -ic->ic_curmode == IEEE80211_MODE_11A || -(ni->ni_capinfo & IEEE80211_CAPINFO_SHORT_SLOTTIME)); + ic->ic_curmode == IEEE80211_MODE_11A || + (ni->ni_capinfo & IEEE80211_CAPINFO_SHORT_SLOTTIME)); ni->ni_capinfo = scan.capinfo; /* XXX statistic */ } - if (scan.wme != NULL && - (ni->ni_flags & IEEE80211_NODE_QOS) && - ieee80211_parse_wmeparams(ic, scan.wme, wh) > 0) + + if (scan.wme != NULL && (ni->ni_flags & IEEE80211_NODE_QOS) && + ieee80211_parse_wmeparams(ic, scan.wme, wh) > 0) { ieee80211_wme_updateparams(ic); + } + if (scan.tim != NULL) { struct ieee80211_tim_ie *ie = - (struct ieee80211_tim_ie *) scan.tim; + (struct ieee80211_tim_ie *)scan.tim; ni->ni_dtim_count = ie->tim_count; ni->ni_dtim_period = ie->tim_period; } - if (ic->ic_flags & IEEE80211_F_SCAN) - ieee80211_add_scan(ic, , wh, -subtype, rssi, rstamp); + + if (ic->ic_flags & IEEE80211_F_SCAN) { + ieee80211_add_scan(ic, , wh, subtype, rssi, +
CVS commit: src/sys/net80211
Module Name:src Committed By: maxv Date: Tue Jan 16 16:09:30 UTC 2018 Modified Files: src/sys/net80211: ieee80211_input.c Log Message: Introduce ieee80211_recv_mgmt_disassoc. To generate a diff of this commit: cvs rdiff -u -r1.102 -r1.103 src/sys/net80211/ieee80211_input.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/net80211/ieee80211_input.c diff -u src/sys/net80211/ieee80211_input.c:1.102 src/sys/net80211/ieee80211_input.c:1.103 --- src/sys/net80211/ieee80211_input.c:1.102 Tue Jan 16 16:04:16 2018 +++ src/sys/net80211/ieee80211_input.c Tue Jan 16 16:09:30 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: ieee80211_input.c,v 1.102 2018/01/16 16:04:16 maxv Exp $ */ +/* $NetBSD: ieee80211_input.c,v 1.103 2018/01/16 16:09:30 maxv Exp $ */ /* * Copyright (c) 2001 Atsushi Onoe @@ -37,7 +37,7 @@ __FBSDID("$FreeBSD: src/sys/net80211/ieee80211_input.c,v 1.81 2005/08/10 16:22:29 sam Exp $"); #endif #ifdef __NetBSD__ -__KERNEL_RCSID(0, "$NetBSD: ieee80211_input.c,v 1.102 2018/01/16 16:04:16 maxv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ieee80211_input.c,v 1.103 2018/01/16 16:09:30 maxv Exp $"); #endif #ifdef _KERNEL_OPT @@ -2855,10 +2855,8 @@ ieee80211_recv_mgmt_deauth(struct ieee80 } } -/* -- */ - -void -ieee80211_recv_mgmt(struct ieee80211com *ic, struct mbuf *m0, +static void +ieee80211_recv_mgmt_disassoc(struct ieee80211com *ic, struct mbuf *m0, struct ieee80211_node *ni, int subtype, int rssi, u_int32_t rstamp) { struct ieee80211_frame *wh; @@ -2869,6 +2867,59 @@ ieee80211_recv_mgmt(struct ieee80211com frm = (u_int8_t *)(wh + 1); efrm = mtod(m0, u_int8_t *) + m0->m_len; + u_int16_t reason; + + if (ic->ic_state != IEEE80211_S_RUN && + ic->ic_state != IEEE80211_S_ASSOC && + ic->ic_state != IEEE80211_S_AUTH) { + ic->ic_stats.is_rx_mgtdiscard++; + return; + } + /* + * disassoc frame format + * [2] reason + */ + IEEE80211_VERIFY_LENGTH(efrm - frm, 2); + reason = le16toh(*(u_int16_t *)frm); + __USE(reason); + ic->ic_stats.is_rx_disassoc++; + IEEE80211_NODE_STAT(ni, rx_disassoc); + + if (!IEEE80211_ADDR_EQ(wh->i_addr1, ic->ic_myaddr)) { + /* Not intended for this station. */ + ic->ic_stats.is_rx_mgtdiscard++; + return; + } + IEEE80211_DPRINTF(ic, IEEE80211_MSG_ASSOC, + "[%s] recv disassociate (reason %d)\n", + ether_snprintf(ebuf, sizeof(ebuf), ni->ni_macaddr), reason); + switch (ic->ic_opmode) { + case IEEE80211_M_STA: + ieee80211_new_state(ic, IEEE80211_S_ASSOC, + wh->i_fc[0] & IEEE80211_FC0_SUBTYPE_MASK); + break; + case IEEE80211_M_HOSTAP: +#ifndef IEEE80211_NO_HOSTAP + if (ni != ic->ic_bss) + ieee80211_node_leave(ic, ni); +#endif /* !IEEE80211_NO_HOSTAP */ + break; + default: + ic->ic_stats.is_rx_mgtdiscard++; + break; + } +} + +/* -- */ + +void +ieee80211_recv_mgmt(struct ieee80211com *ic, struct mbuf *m0, +struct ieee80211_node *ni, int subtype, int rssi, u_int32_t rstamp) +{ + struct ieee80211_frame *wh; + + wh = mtod(m0, struct ieee80211_frame *); + switch (subtype) { case IEEE80211_FC0_SUBTYPE_PROBE_RESP: case IEEE80211_FC0_SUBTYPE_BEACON: @@ -2897,58 +2948,19 @@ ieee80211_recv_mgmt(struct ieee80211com ieee80211_recv_mgmt_deauth(ic, m0, ni, subtype, rssi, rstamp); return; - case IEEE80211_FC0_SUBTYPE_DISASSOC: { - u_int16_t reason; + case IEEE80211_FC0_SUBTYPE_DISASSOC: + ieee80211_recv_mgmt_disassoc(ic, m0, ni, subtype, rssi, rstamp); + return; - if (ic->ic_state != IEEE80211_S_RUN && - ic->ic_state != IEEE80211_S_ASSOC && - ic->ic_state != IEEE80211_S_AUTH) { - ic->ic_stats.is_rx_mgtdiscard++; - return; - } - /* - * disassoc frame format - * [2] reason - */ - IEEE80211_VERIFY_LENGTH(efrm - frm, 2); - reason = le16toh(*(u_int16_t *)frm); - __USE(reason); - ic->ic_stats.is_rx_disassoc++; - IEEE80211_NODE_STAT(ni, rx_disassoc); - - if (!IEEE80211_ADDR_EQ(wh->i_addr1, ic->ic_myaddr)) { - /* Not intended for this station. */ - ic->ic_stats.is_rx_mgtdiscard++; - break; - } - IEEE80211_DPRINTF(ic, IEEE80211_MSG_ASSOC, - "[%s] recv disassociate (reason %d)\n", - ether_snprintf(ebuf, sizeof(ebuf), ni->ni_macaddr), reason); - switch (ic->ic_opmode) { - case IEEE80211_M_STA: - ieee80211_new_state(ic, IEEE80211_S_ASSOC, - wh->i_fc[0] & IEEE80211_FC0_SUBTYPE_MASK); - break; - case IEEE80211_M_HOSTAP: -#ifndef IEEE80211_NO_HOSTAP - if (ni != ic->ic_bss) -ieee80211_node_leave(ic, ni); -#endif /* !IEEE80211_NO_HOSTAP */ - break; - default: - ic->ic_stats.is_rx_mgtdiscard++; - break; - } - break; - } default: IEEE80211_DISCARD(ic, IEEE80211_MSG_ANY, wh, "mgt", "subtype 0x%x not handled", subtype); ic->ic_stats.is_rx_badsubtype++; break; } -#undef ISREASSOC } + +#undef ISREASSOC #undef
CVS commit: src/sys/net80211
Module Name:src Committed By: maxv Date: Tue Jan 16 16:04:17 UTC 2018 Modified Files: src/sys/net80211: ieee80211_input.c Log Message: Introduce ieee80211_recv_mgmt_deauth. To generate a diff of this commit: cvs rdiff -u -r1.101 -r1.102 src/sys/net80211/ieee80211_input.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/net80211/ieee80211_input.c diff -u src/sys/net80211/ieee80211_input.c:1.101 src/sys/net80211/ieee80211_input.c:1.102 --- src/sys/net80211/ieee80211_input.c:1.101 Tue Jan 16 16:00:17 2018 +++ src/sys/net80211/ieee80211_input.c Tue Jan 16 16:04:16 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: ieee80211_input.c,v 1.101 2018/01/16 16:00:17 maxv Exp $ */ +/* $NetBSD: ieee80211_input.c,v 1.102 2018/01/16 16:04:16 maxv Exp $ */ /* * Copyright (c) 2001 Atsushi Onoe @@ -37,7 +37,7 @@ __FBSDID("$FreeBSD: src/sys/net80211/ieee80211_input.c,v 1.81 2005/08/10 16:22:29 sam Exp $"); #endif #ifdef __NetBSD__ -__KERNEL_RCSID(0, "$NetBSD: ieee80211_input.c,v 1.101 2018/01/16 16:00:17 maxv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ieee80211_input.c,v 1.102 2018/01/16 16:04:16 maxv Exp $"); #endif #ifdef _KERNEL_OPT @@ -2802,6 +2802,59 @@ ieee80211_recv_mgmt_assoc_resp(struct ie ieee80211_new_state(ic, IEEE80211_S_RUN, subtype); } +static void +ieee80211_recv_mgmt_deauth(struct ieee80211com *ic, struct mbuf *m0, +struct ieee80211_node *ni, int subtype, int rssi, u_int32_t rstamp) +{ + struct ieee80211_frame *wh; + u_int8_t *frm, *efrm; + IEEE80211_DEBUGVAR(char ebuf[3 * ETHER_ADDR_LEN]); + + wh = mtod(m0, struct ieee80211_frame *); + frm = (u_int8_t *)(wh + 1); + efrm = mtod(m0, u_int8_t *) + m0->m_len; + + u_int16_t reason; + + if (ic->ic_state == IEEE80211_S_SCAN) { + ic->ic_stats.is_rx_mgtdiscard++; + return; + } + /* + * deauth frame format + * [2] reason + */ + IEEE80211_VERIFY_LENGTH(efrm - frm, 2); + reason = le16toh(*(u_int16_t *)frm); + __USE(reason); + ic->ic_stats.is_rx_deauth++; + IEEE80211_NODE_STAT(ni, rx_deauth); + + if (!IEEE80211_ADDR_EQ(wh->i_addr1, ic->ic_myaddr)) { + /* Not intended for this station. */ + ic->ic_stats.is_rx_mgtdiscard++; + return; + } + IEEE80211_DPRINTF(ic, IEEE80211_MSG_AUTH, + "[%s] recv deauthenticate (reason %d)\n", + ether_snprintf(ebuf, sizeof(ebuf), ni->ni_macaddr), reason); + switch (ic->ic_opmode) { + case IEEE80211_M_STA: + ieee80211_new_state(ic, IEEE80211_S_AUTH, + wh->i_fc[0] & IEEE80211_FC0_SUBTYPE_MASK); + break; + case IEEE80211_M_HOSTAP: +#ifndef IEEE80211_NO_HOSTAP + if (ni != ic->ic_bss) + ieee80211_node_leave(ic, ni); +#endif /* !IEEE80211_NO_HOSTAP */ + break; + default: + ic->ic_stats.is_rx_mgtdiscard++; + break; + } +} + /* -- */ void @@ -2840,48 +2893,9 @@ ieee80211_recv_mgmt(struct ieee80211com ieee80211_recv_mgmt_assoc_resp(ic, m0, ni, subtype, rssi, rstamp); return; - case IEEE80211_FC0_SUBTYPE_DEAUTH: { - u_int16_t reason; - - if (ic->ic_state == IEEE80211_S_SCAN) { - ic->ic_stats.is_rx_mgtdiscard++; - return; - } - /* - * deauth frame format - * [2] reason - */ - IEEE80211_VERIFY_LENGTH(efrm - frm, 2); - reason = le16toh(*(u_int16_t *)frm); - __USE(reason); - ic->ic_stats.is_rx_deauth++; - IEEE80211_NODE_STAT(ni, rx_deauth); - - if (!IEEE80211_ADDR_EQ(wh->i_addr1, ic->ic_myaddr)) { - /* Not intended for this station. */ - ic->ic_stats.is_rx_mgtdiscard++; - break; - } - IEEE80211_DPRINTF(ic, IEEE80211_MSG_AUTH, - "[%s] recv deauthenticate (reason %d)\n", - ether_snprintf(ebuf, sizeof(ebuf), ni->ni_macaddr), reason); - switch (ic->ic_opmode) { - case IEEE80211_M_STA: - ieee80211_new_state(ic, IEEE80211_S_AUTH, - wh->i_fc[0] & IEEE80211_FC0_SUBTYPE_MASK); - break; - case IEEE80211_M_HOSTAP: -#ifndef IEEE80211_NO_HOSTAP - if (ni != ic->ic_bss) -ieee80211_node_leave(ic, ni); -#endif /* !IEEE80211_NO_HOSTAP */ - break; - default: - ic->ic_stats.is_rx_mgtdiscard++; - break; - } - break; - } + case IEEE80211_FC0_SUBTYPE_DEAUTH: + ieee80211_recv_mgmt_deauth(ic, m0, ni, subtype, rssi, rstamp); + return; case IEEE80211_FC0_SUBTYPE_DISASSOC: { u_int16_t reason;
CVS commit: src/sys/net80211
Module Name:src Committed By: maxv Date: Tue Jan 16 16:00:17 UTC 2018 Modified Files: src/sys/net80211: ieee80211_input.c Log Message: Introduce ieee80211_recv_mgmt_assoc_resp. To generate a diff of this commit: cvs rdiff -u -r1.100 -r1.101 src/sys/net80211/ieee80211_input.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/net80211/ieee80211_input.c diff -u src/sys/net80211/ieee80211_input.c:1.100 src/sys/net80211/ieee80211_input.c:1.101 --- src/sys/net80211/ieee80211_input.c:1.100 Tue Jan 16 15:55:14 2018 +++ src/sys/net80211/ieee80211_input.c Tue Jan 16 16:00:17 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: ieee80211_input.c,v 1.100 2018/01/16 15:55:14 maxv Exp $ */ +/* $NetBSD: ieee80211_input.c,v 1.101 2018/01/16 16:00:17 maxv Exp $ */ /* * Copyright (c) 2001 Atsushi Onoe @@ -37,7 +37,7 @@ __FBSDID("$FreeBSD: src/sys/net80211/ieee80211_input.c,v 1.81 2005/08/10 16:22:29 sam Exp $"); #endif #ifdef __NetBSD__ -__KERNEL_RCSID(0, "$NetBSD: ieee80211_input.c,v 1.100 2018/01/16 15:55:14 maxv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ieee80211_input.c,v 1.101 2018/01/16 16:00:17 maxv Exp $"); #endif #ifdef _KERNEL_OPT @@ -2668,17 +2668,148 @@ ieee80211_recv_mgmt_assoc_req(struct iee ieee80211_node_join(ic, ni, resp); } +#define ISREASSOC(_st) ((_st) == IEEE80211_FC0_SUBTYPE_REASSOC_RESP) + +static void +ieee80211_recv_mgmt_assoc_resp(struct ieee80211com *ic, struct mbuf *m0, +struct ieee80211_node *ni, int subtype, int rssi, u_int32_t rstamp) +{ + struct ieee80211_frame *wh; + u_int8_t *frm, *efrm; + u_int8_t *rates, *xrates, *wpa, *wme; + u_int8_t rate; + IEEE80211_DEBUGVAR(char ebuf[3 * ETHER_ADDR_LEN]); + + wh = mtod(m0, struct ieee80211_frame *); + frm = (u_int8_t *)(wh + 1); + efrm = mtod(m0, u_int8_t *) + m0->m_len; + + u_int16_t capinfo, associd; + u_int16_t status; + + if (ic->ic_opmode != IEEE80211_M_STA || + ic->ic_state != IEEE80211_S_ASSOC) { + ic->ic_stats.is_rx_mgtdiscard++; + return; + } + + /* + * asresp frame format + * [2] capability information + * [2] status + * [2] association ID + * [tlv] supported rates + * [tlv] extended supported rates + * [tlv] WME + */ + IEEE80211_VERIFY_LENGTH(efrm - frm, 6); + ni = ic->ic_bss; + capinfo = le16toh(*(u_int16_t *)frm); + frm += 2; + status = le16toh(*(u_int16_t *)frm); + frm += 2; + if (status != 0) { + IEEE80211_DPRINTF(ic, IEEE80211_MSG_ASSOC, + "[%s] %sassoc failed (reason %d)\n", + ether_snprintf(ebuf, sizeof(ebuf), wh->i_addr2), + ISREASSOC(subtype) ? "re" : "", status); + if (ni != ic->ic_bss) /* XXX never true? */ + ni->ni_fails++; + ic->ic_stats.is_rx_auth_fail++; /* XXX */ + return; + } + associd = le16toh(*(u_int16_t *)frm); + frm += 2; + + rates = xrates = wpa = wme = NULL; + while (frm < efrm) { + switch (*frm) { + case IEEE80211_ELEMID_RATES: + rates = frm; + break; + case IEEE80211_ELEMID_XRATES: + xrates = frm; + break; + case IEEE80211_ELEMID_VENDOR: + if (iswmeoui(frm)) +wme = frm; + /* XXX Atheros OUI support */ + break; + } + frm += frm[1] + 2; + } + + IEEE80211_VERIFY_ELEMENT(rates, IEEE80211_RATE_MAXSIZE); + rate = ieee80211_setup_rates(ni, rates, xrates, + IEEE80211_R_DOSORT | IEEE80211_R_DOFRATE | + IEEE80211_R_DONEGO | IEEE80211_R_DODEL); + if (rate & IEEE80211_RATE_BASIC) { + IEEE80211_DPRINTF(ic, IEEE80211_MSG_ASSOC, + "[%s] %sassoc failed (rate set mismatch)\n", + ether_snprintf(ebuf, sizeof(ebuf), wh->i_addr2), + ISREASSOC(subtype) ? "re" : ""); + if (ni != ic->ic_bss) /* XXX never true? */ + ni->ni_fails++; + ic->ic_stats.is_rx_assoc_norate++; + ieee80211_new_state(ic, IEEE80211_S_SCAN, 0); + return; + } + + ni->ni_capinfo = capinfo; + ni->ni_associd = associd; + if (wme != NULL && + ieee80211_parse_wmeparams(ic, wme, wh) >= 0) { + ni->ni_flags |= IEEE80211_NODE_QOS; + ieee80211_wme_updateparams(ic); + } else + ni->ni_flags &= ~IEEE80211_NODE_QOS; + /* + * Configure state now that we are associated. + * + * XXX may need different/additional driver callbacks? + */ + if (ic->ic_curmode == IEEE80211_MODE_11A || + (ni->ni_capinfo & IEEE80211_CAPINFO_SHORT_PREAMBLE)) { + ic->ic_flags |= IEEE80211_F_SHPREAMBLE; + ic->ic_flags &= ~IEEE80211_F_USEBARKER; + } else { + ic->ic_flags &= ~IEEE80211_F_SHPREAMBLE; + ic->ic_flags |= IEEE80211_F_USEBARKER; + } + ieee80211_set_shortslottime(ic, + ic->ic_curmode == IEEE80211_MODE_11A || + (ni->ni_capinfo & IEEE80211_CAPINFO_SHORT_SLOTTIME)); + /* + * Honor ERP protection. + * + * NB: ni_erp should zero for non-11g operation. + * XXX check ic_curmode anyway? + */ + if (ic->ic_curmode == IEEE80211_MODE_11G && + (ni->ni_erp & IEEE80211_ERP_USE_PROTECTION)) + ic->ic_flags |= IEEE80211_F_USEPROT; + else + ic->ic_flags &= ~IEEE80211_F_USEPROT; + IEEE80211_DPRINTF(ic, IEEE80211_MSG_ASSOC, + "[%s] %sassoc success: %s preamble, %s slot time%s%s\n", +
CVS commit: src/sys/net80211
Module Name:src Committed By: maxv Date: Tue Jan 16 15:55:14 UTC 2018 Modified Files: src/sys/net80211: ieee80211_input.c Log Message: Introduce ieee80211_recv_mgmt_assoc_req. To generate a diff of this commit: cvs rdiff -u -r1.99 -r1.100 src/sys/net80211/ieee80211_input.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/net80211/ieee80211_input.c diff -u src/sys/net80211/ieee80211_input.c:1.99 src/sys/net80211/ieee80211_input.c:1.100 --- src/sys/net80211/ieee80211_input.c:1.99 Tue Jan 16 15:48:32 2018 +++ src/sys/net80211/ieee80211_input.c Tue Jan 16 15:55:14 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: ieee80211_input.c,v 1.99 2018/01/16 15:48:32 maxv Exp $ */ +/* $NetBSD: ieee80211_input.c,v 1.100 2018/01/16 15:55:14 maxv Exp $ */ /* * Copyright (c) 2001 Atsushi Onoe @@ -37,7 +37,7 @@ __FBSDID("$FreeBSD: src/sys/net80211/ieee80211_input.c,v 1.81 2005/08/10 16:22:29 sam Exp $"); #endif #ifdef __NetBSD__ -__KERNEL_RCSID(0, "$NetBSD: ieee80211_input.c,v 1.99 2018/01/16 15:48:32 maxv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ieee80211_input.c,v 1.100 2018/01/16 15:55:14 maxv Exp $"); #endif #ifdef _KERNEL_OPT @@ -2449,6 +2449,225 @@ ieee80211_recv_mgmt_auth(struct ieee8021 } } +static void +ieee80211_recv_mgmt_assoc_req(struct ieee80211com *ic, struct mbuf *m0, +struct ieee80211_node *ni, int subtype, int rssi, u_int32_t rstamp) +{ + struct ieee80211_frame *wh; + u_int8_t *frm, *efrm; + u_int8_t *ssid, *rates, *xrates, *wpa, *wme; + int reassoc, resp; + u_int8_t rate; + IEEE80211_DEBUGVAR(char ebuf[3 * ETHER_ADDR_LEN]); + + wh = mtod(m0, struct ieee80211_frame *); + frm = (u_int8_t *)(wh + 1); + efrm = mtod(m0, u_int8_t *) + m0->m_len; + + u_int16_t capinfo, lintval; + struct ieee80211_rsnparms rsn; + u_int8_t reason; + + if (ic->ic_opmode != IEEE80211_M_HOSTAP || + ic->ic_state != IEEE80211_S_RUN) { + ic->ic_stats.is_rx_mgtdiscard++; + return; + } + + if (subtype == IEEE80211_FC0_SUBTYPE_REASSOC_REQ) { + reassoc = 1; + resp = IEEE80211_FC0_SUBTYPE_REASSOC_RESP; + } else { + reassoc = 0; + resp = IEEE80211_FC0_SUBTYPE_ASSOC_RESP; + } + /* + * asreq frame format + * [2] capability information + * [2] listen interval + * [6*] current AP address (reassoc only) + * [tlv] ssid + * [tlv] supported rates + * [tlv] extended supported rates + * [tlv] WPA or RSN + */ + IEEE80211_VERIFY_LENGTH(efrm - frm, (reassoc ? 10 : 4)); + if (!IEEE80211_ADDR_EQ(wh->i_addr3, ic->ic_bss->ni_bssid)) { + IEEE80211_DISCARD(ic, IEEE80211_MSG_ANY, + wh, ieee80211_mgt_subtype_name[subtype >> + IEEE80211_FC0_SUBTYPE_SHIFT], + "%s", "wrong bssid"); + ic->ic_stats.is_rx_assoc_bss++; + return; + } + capinfo = le16toh(*(u_int16_t *)frm); frm += 2; + lintval = le16toh(*(u_int16_t *)frm); frm += 2; + if (reassoc) + frm += 6; /* ignore current AP info */ + ssid = rates = xrates = wpa = wme = NULL; + while (frm < efrm) { + switch (*frm) { + case IEEE80211_ELEMID_SSID: + ssid = frm; + break; + case IEEE80211_ELEMID_RATES: + rates = frm; + break; + case IEEE80211_ELEMID_XRATES: + xrates = frm; + break; + /* XXX verify only one of RSN and WPA ie's? */ + case IEEE80211_ELEMID_RSN: + wpa = frm; + break; + case IEEE80211_ELEMID_VENDOR: + if (iswpaoui(frm)) +wpa = frm; + else if (iswmeinfo(frm)) +wme = frm; + /* XXX Atheros OUI support */ + break; + } + frm += frm[1] + 2; + } + IEEE80211_VERIFY_ELEMENT(rates, IEEE80211_RATE_MAXSIZE); + IEEE80211_VERIFY_ELEMENT(ssid, IEEE80211_NWID_LEN); + IEEE80211_VERIFY_SSID(ic->ic_bss, ssid); + + if (ni == ic->ic_bss) { + IEEE80211_DPRINTF(ic, IEEE80211_MSG_ANY, + "[%s] deny %s request, sta not authenticated\n", + ether_snprintf(ebuf, sizeof(ebuf), wh->i_addr2), + reassoc ? "reassoc" : "assoc"); + ieee80211_send_error(ic, ni, wh->i_addr2, + IEEE80211_FC0_SUBTYPE_DEAUTH, + IEEE80211_REASON_ASSOC_NOT_AUTHED); + ic->ic_stats.is_rx_assoc_notauth++; + return; + } + /* assert right associstion security credentials */ + if (wpa == NULL && (ic->ic_flags & IEEE80211_F_WPA)) { + IEEE80211_DPRINTF(ic, + IEEE80211_MSG_ASSOC | IEEE80211_MSG_WPA, + "[%s] no WPA/RSN IE in association request\n", + ether_snprintf(ebuf, sizeof(ebuf), wh->i_addr2)); + IEEE80211_SEND_MGMT(ic, ni, + IEEE80211_FC0_SUBTYPE_DEAUTH, + IEEE80211_REASON_RSN_REQUIRED); + ieee80211_node_leave(ic, ni); + /* XXX distinguish WPA/RSN? */ + ic->ic_stats.is_rx_assoc_badwpaie++; + return; + } + if (wpa != NULL) { + /* + * Parse WPA information element. Note that + * we initialize the param block from the node + * state so that information in the IE overrides + * our defaults. The resulting parameters are + * installed below after the association is assured. + */ + rsn = ni->ni_rsn; + if (wpa[0] != IEEE80211_ELEMID_RSN) + reason = ieee80211_parse_wpa(ic, wpa, , wh); + else + reason =
CVS commit: src/sys/net80211
Module Name:src Committed By: maxv Date: Tue Jan 16 15:48:32 UTC 2018 Modified Files: src/sys/net80211: ieee80211_input.c Log Message: Introduce ieee80211_recv_mgmt_auth. To generate a diff of this commit: cvs rdiff -u -r1.98 -r1.99 src/sys/net80211/ieee80211_input.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/net80211/ieee80211_input.c diff -u src/sys/net80211/ieee80211_input.c:1.98 src/sys/net80211/ieee80211_input.c:1.99 --- src/sys/net80211/ieee80211_input.c:1.98 Tue Jan 16 15:42:52 2018 +++ src/sys/net80211/ieee80211_input.c Tue Jan 16 15:48:32 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: ieee80211_input.c,v 1.98 2018/01/16 15:42:52 maxv Exp $ */ +/* $NetBSD: ieee80211_input.c,v 1.99 2018/01/16 15:48:32 maxv Exp $ */ /* * Copyright (c) 2001 Atsushi Onoe @@ -37,7 +37,7 @@ __FBSDID("$FreeBSD: src/sys/net80211/ieee80211_input.c,v 1.81 2005/08/10 16:22:29 sam Exp $"); #endif #ifdef __NetBSD__ -__KERNEL_RCSID(0, "$NetBSD: ieee80211_input.c,v 1.98 2018/01/16 15:42:52 maxv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ieee80211_input.c,v 1.99 2018/01/16 15:48:32 maxv Exp $"); #endif #ifdef _KERNEL_OPT @@ -2371,6 +2371,84 @@ ieee80211_recv_mgmt_probe_req(struct iee } } +static void +ieee80211_recv_mgmt_auth(struct ieee80211com *ic, struct mbuf *m0, +struct ieee80211_node *ni, int subtype, int rssi, u_int32_t rstamp) +{ + struct ieee80211_frame *wh; + u_int8_t *frm, *efrm; + IEEE80211_DEBUGVAR(char ebuf[3 * ETHER_ADDR_LEN]); + + wh = mtod(m0, struct ieee80211_frame *); + frm = (u_int8_t *)(wh + 1); + efrm = mtod(m0, u_int8_t *) + m0->m_len; + + u_int16_t algo, seq, status; + /* + * auth frame format + * [2] algorithm + * [2] sequence + * [2] status + * [tlv*] challenge + */ + IEEE80211_VERIFY_LENGTH(efrm - frm, 6); + algo = le16toh(*(u_int16_t *)frm); + seq= le16toh(*(u_int16_t *)(frm + 2)); + status = le16toh(*(u_int16_t *)(frm + 4)); + IEEE80211_DPRINTF(ic, IEEE80211_MSG_AUTH, + "[%s] recv auth frame with algorithm %d seq %d\n", + ether_snprintf(ebuf, sizeof(ebuf), wh->i_addr2), algo, seq); + /* + * Consult the ACL policy module if setup. + */ + if (ic->ic_acl != NULL && + !ic->ic_acl->iac_check(ic, wh->i_addr2)) { + IEEE80211_DISCARD(ic, IEEE80211_MSG_ACL, + wh, "auth", "%s", "disallowed by ACL"); + ic->ic_stats.is_rx_acl++; + if (ic->ic_opmode == IEEE80211_M_HOSTAP) { + IEEE80211_SEND_MGMT(ic, ni, + IEEE80211_FC0_SUBTYPE_AUTH, + (seq+1) | (IEEE80211_STATUS_UNSPECIFIED<<16)); + } + return; + } + if (ic->ic_flags & IEEE80211_F_COUNTERM) { + IEEE80211_DISCARD(ic, + IEEE80211_MSG_AUTH | IEEE80211_MSG_CRYPTO, + wh, "auth", "%s", "TKIP countermeasures enabled"); + ic->ic_stats.is_rx_auth_countermeasures++; +#ifndef IEEE80211_NO_HOSTAP + if (ic->ic_opmode == IEEE80211_M_HOSTAP) { + IEEE80211_SEND_MGMT(ic, ni, +IEEE80211_FC0_SUBTYPE_AUTH, +IEEE80211_REASON_MIC_FAILURE); + } +#endif /* !IEEE80211_NO_HOSTAP */ + return; + } + if (algo == IEEE80211_AUTH_ALG_SHARED) + ieee80211_auth_shared(ic, wh, frm + 6, efrm, ni, rssi, + rstamp, seq, status); + else if (algo == IEEE80211_AUTH_ALG_OPEN) + ieee80211_auth_open(ic, wh, ni, rssi, rstamp, seq, + status); + else { + IEEE80211_DISCARD(ic, IEEE80211_MSG_ANY, + wh, "auth", "unsupported alg %d", algo); + ic->ic_stats.is_rx_auth_unsupported++; +#ifndef IEEE80211_NO_HOSTAP + if (ic->ic_opmode == IEEE80211_M_HOSTAP) { + /* XXX not right */ + IEEE80211_SEND_MGMT(ic, ni, +IEEE80211_FC0_SUBTYPE_AUTH, +(seq+1) | (IEEE80211_STATUS_ALG<<16)); + } +#endif /* !IEEE80211_NO_HOSTAP */ + return; + } +} + /* -- */ void @@ -2399,73 +2477,9 @@ ieee80211_recv_mgmt(struct ieee80211com ieee80211_recv_mgmt_probe_req(ic, m0, ni, subtype, rssi, rstamp); return; - case IEEE80211_FC0_SUBTYPE_AUTH: { - u_int16_t algo, seq, status; - /* - * auth frame format - * [2] algorithm - * [2] sequence - * [2] status - * [tlv*] challenge - */ - IEEE80211_VERIFY_LENGTH(efrm - frm, 6); - algo = le16toh(*(u_int16_t *)frm); - seq= le16toh(*(u_int16_t *)(frm + 2)); - status = le16toh(*(u_int16_t *)(frm + 4)); - IEEE80211_DPRINTF(ic, IEEE80211_MSG_AUTH, - "[%s] recv auth frame with algorithm %d seq %d\n", - ether_snprintf(ebuf, sizeof(ebuf), wh->i_addr2), algo, seq); - /* - * Consult the ACL policy module if setup. - */ - if (ic->ic_acl != NULL && - !ic->ic_acl->iac_check(ic, wh->i_addr2)) { - IEEE80211_DISCARD(ic, IEEE80211_MSG_ACL, - wh, "auth", "%s", "disallowed by ACL"); - ic->ic_stats.is_rx_acl++; - if (ic->ic_opmode == IEEE80211_M_HOSTAP) { -IEEE80211_SEND_MGMT(ic, ni, -IEEE80211_FC0_SUBTYPE_AUTH, -(seq+1) | (IEEE80211_STATUS_UNSPECIFIED<<16)); - } - return; - } - if (ic->ic_flags & IEEE80211_F_COUNTERM) { -
CVS commit: src/sys/net80211
Module Name:src Committed By: maxv Date: Tue Jan 16 15:42:52 UTC 2018 Modified Files: src/sys/net80211: ieee80211_input.c Log Message: Start splitting ieee80211_recv_mgmt. To generate a diff of this commit: cvs rdiff -u -r1.97 -r1.98 src/sys/net80211/ieee80211_input.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/net80211/ieee80211_input.c diff -u src/sys/net80211/ieee80211_input.c:1.97 src/sys/net80211/ieee80211_input.c:1.98 --- src/sys/net80211/ieee80211_input.c:1.97 Tue Jan 16 15:18:37 2018 +++ src/sys/net80211/ieee80211_input.c Tue Jan 16 15:42:52 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: ieee80211_input.c,v 1.97 2018/01/16 15:18:37 maxv Exp $ */ +/* $NetBSD: ieee80211_input.c,v 1.98 2018/01/16 15:42:52 maxv Exp $ */ /* * Copyright (c) 2001 Atsushi Onoe @@ -37,7 +37,7 @@ __FBSDID("$FreeBSD: src/sys/net80211/ieee80211_input.c,v 1.81 2005/08/10 16:22:29 sam Exp $"); #endif #ifdef __NetBSD__ -__KERNEL_RCSID(0, "$NetBSD: ieee80211_input.c,v 1.97 2018/01/16 15:18:37 maxv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ieee80211_input.c,v 1.98 2018/01/16 15:42:52 maxv Exp $"); #endif #ifdef _KERNEL_OPT @@ -2001,369 +2001,403 @@ ieee80211_update_adhoc_node(struct ieee8 } } -void -ieee80211_recv_mgmt(struct ieee80211com *ic, struct mbuf *m0, +/* -- */ + +static void +ieee80211_recv_mgmt_beacon(struct ieee80211com *ic, struct mbuf *m0, struct ieee80211_node *ni, int subtype, int rssi, u_int32_t rstamp) { -#define ISPROBE(_st) ((_st) == IEEE80211_FC0_SUBTYPE_PROBE_RESP) -#define ISREASSOC(_st) ((_st) == IEEE80211_FC0_SUBTYPE_REASSOC_RESP) struct ieee80211_frame *wh; u_int8_t *frm, *efrm; - u_int8_t *ssid, *rates, *xrates, *wpa, *wme; - int reassoc, resp, allocbs; - u_int8_t rate; IEEE80211_DEBUGVAR(char ebuf[3 * ETHER_ADDR_LEN]); + struct ieee80211_scanparams scan; wh = mtod(m0, struct ieee80211_frame *); frm = (u_int8_t *)(wh + 1); efrm = mtod(m0, u_int8_t *) + m0->m_len; - switch (subtype) { - case IEEE80211_FC0_SUBTYPE_PROBE_RESP: - case IEEE80211_FC0_SUBTYPE_BEACON: { - struct ieee80211_scanparams scan; - - /* - * We process beacon/probe response frames: - *o when scanning, or - *o station mode when associated (to collect state - * updates such as 802.11g slot time), or - *o adhoc mode (to discover neighbors) - * Frames otherwise received are discarded. - */ - if (!((ic->ic_flags & IEEE80211_F_SCAN) || - (ic->ic_opmode == IEEE80211_M_STA && ni->ni_associd) || - ic->ic_opmode == IEEE80211_M_IBSS)) { - ic->ic_stats.is_rx_mgtdiscard++; - return; - } - - /* - * beacon/probe response frame format - * [8] time stamp - * [2] beacon interval - * [2] capability information - * [tlv] ssid - * [tlv] supported rates - * [tlv] country information - * [tlv] parameter set (FH/DS) - * [tlv] erp information - * [tlv] extended supported rates - * [tlv] WME - * [tlv] WPA or RSN - */ - IEEE80211_VERIFY_LENGTH(efrm - frm, 12); - memset(, 0, sizeof(scan)); - scan.tstamp = frm;frm += 8; - scan.bintval = le16toh(*(u_int16_t *)frm); frm += 2; - scan.capinfo = le16toh(*(u_int16_t *)frm); frm += 2; - scan.bchan = ieee80211_chan2ieee(ic, ic->ic_curchan); - scan.chan = scan.bchan; - - while (frm + 1 < efrm) { - IEEE80211_VERIFY_LENGTH(efrm - frm, frm[1] + 2); + /* + * We process beacon/probe response frames: + *o when scanning, or + *o station mode when associated (to collect state + * updates such as 802.11g slot time), or + *o adhoc mode (to discover neighbors) + * Frames otherwise received are discarded. + */ + if (!((ic->ic_flags & IEEE80211_F_SCAN) || + (ic->ic_opmode == IEEE80211_M_STA && ni->ni_associd) || + ic->ic_opmode == IEEE80211_M_IBSS)) { + ic->ic_stats.is_rx_mgtdiscard++; + return; + } - switch (*frm) { - case IEEE80211_ELEMID_SSID: -scan.ssid = frm; -break; - case IEEE80211_ELEMID_RATES: -scan.rates = frm; -break; - case IEEE80211_ELEMID_COUNTRY: -scan.country = frm; -break; - case IEEE80211_ELEMID_FHPARMS: -IEEE80211_VERIFY_LENGTH(frm[1], 5); -if (ic->ic_phytype == IEEE80211_T_FH) { - scan.fhdwell = LE_READ_2([2]); - scan.chan = IEEE80211_FH_CHAN(frm[4], frm[5]); - scan.fhindex = frm[6]; -} -break; - case IEEE80211_ELEMID_DSPARMS: -/* - * XXX hack this since depending on phytype - * is problematic for multi-mode devices. - */ -IEEE80211_VERIFY_LENGTH(frm[1], 1); -if (ic->ic_phytype != IEEE80211_T_FH) - scan.chan = frm[2]; -break; - case IEEE80211_ELEMID_TIM: -/* XXX ATIM? */ -IEEE80211_VERIFY_LENGTH(frm[1], 5); -scan.tim = frm; -scan.timoff = frm - mtod(m0, u_int8_t *); -break; - case IEEE80211_ELEMID_IBSSPARMS: -break; - case
CVS commit: src/sys/net80211
Module Name:src Committed By: maxv Date: Tue Jan 16 15:18:37 UTC 2018 Modified Files: src/sys/net80211: ieee80211_input.c Log Message: More overflows... To generate a diff of this commit: cvs rdiff -u -r1.96 -r1.97 src/sys/net80211/ieee80211_input.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/net80211/ieee80211_input.c diff -u src/sys/net80211/ieee80211_input.c:1.96 src/sys/net80211/ieee80211_input.c:1.97 --- src/sys/net80211/ieee80211_input.c:1.96 Tue Jan 16 14:37:24 2018 +++ src/sys/net80211/ieee80211_input.c Tue Jan 16 15:18:37 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: ieee80211_input.c,v 1.96 2018/01/16 14:37:24 maxv Exp $ */ +/* $NetBSD: ieee80211_input.c,v 1.97 2018/01/16 15:18:37 maxv Exp $ */ /* * Copyright (c) 2001 Atsushi Onoe @@ -37,7 +37,7 @@ __FBSDID("$FreeBSD: src/sys/net80211/ieee80211_input.c,v 1.81 2005/08/10 16:22:29 sam Exp $"); #endif #ifdef __NetBSD__ -__KERNEL_RCSID(0, "$NetBSD: ieee80211_input.c,v 1.96 2018/01/16 14:37:24 maxv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ieee80211_input.c,v 1.97 2018/01/16 15:18:37 maxv Exp $"); #endif #ifdef _KERNEL_OPT @@ -2074,6 +2074,7 @@ ieee80211_recv_mgmt(struct ieee80211com scan.country = frm; break; case IEEE80211_ELEMID_FHPARMS: +IEEE80211_VERIFY_LENGTH(frm[1], 5); if (ic->ic_phytype == IEEE80211_T_FH) { scan.fhdwell = LE_READ_2([2]); scan.chan = IEEE80211_FH_CHAN(frm[4], frm[5]); @@ -2085,11 +2086,13 @@ ieee80211_recv_mgmt(struct ieee80211com * XXX hack this since depending on phytype * is problematic for multi-mode devices. */ +IEEE80211_VERIFY_LENGTH(frm[1], 1); if (ic->ic_phytype != IEEE80211_T_FH) scan.chan = frm[2]; break; case IEEE80211_ELEMID_TIM: /* XXX ATIM? */ +IEEE80211_VERIFY_LENGTH(frm[1], 5); scan.tim = frm; scan.timoff = frm - mtod(m0, u_int8_t *); break;
CVS commit: src/sys/net80211
Module Name:src Committed By: maxv Date: Tue Jan 16 14:37:24 UTC 2018 Modified Files: src/sys/net80211: ieee80211_input.c Log Message: Fix overflow. To generate a diff of this commit: cvs rdiff -u -r1.95 -r1.96 src/sys/net80211/ieee80211_input.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/net80211/ieee80211_input.c diff -u src/sys/net80211/ieee80211_input.c:1.95 src/sys/net80211/ieee80211_input.c:1.96 --- src/sys/net80211/ieee80211_input.c:1.95 Tue Jan 16 14:01:13 2018 +++ src/sys/net80211/ieee80211_input.c Tue Jan 16 14:37:24 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: ieee80211_input.c,v 1.95 2018/01/16 14:01:13 maxv Exp $ */ +/* $NetBSD: ieee80211_input.c,v 1.96 2018/01/16 14:37:24 maxv Exp $ */ /* * Copyright (c) 2001 Atsushi Onoe @@ -37,7 +37,7 @@ __FBSDID("$FreeBSD: src/sys/net80211/ieee80211_input.c,v 1.81 2005/08/10 16:22:29 sam Exp $"); #endif #ifdef __NetBSD__ -__KERNEL_RCSID(0, "$NetBSD: ieee80211_input.c,v 1.95 2018/01/16 14:01:13 maxv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ieee80211_input.c,v 1.96 2018/01/16 14:37:24 maxv Exp $"); #endif #ifdef _KERNEL_OPT @@ -2003,8 +2003,7 @@ ieee80211_update_adhoc_node(struct ieee8 void ieee80211_recv_mgmt(struct ieee80211com *ic, struct mbuf *m0, - struct ieee80211_node *ni, - int subtype, int rssi, u_int32_t rstamp) +struct ieee80211_node *ni, int subtype, int rssi, u_int32_t rstamp) { #define ISPROBE(_st) ((_st) == IEEE80211_FC0_SUBTYPE_PROBE_RESP) #define ISREASSOC(_st) ((_st) == IEEE80211_FC0_SUBTYPE_REASSOC_RESP) @@ -2016,8 +2015,9 @@ ieee80211_recv_mgmt(struct ieee80211com IEEE80211_DEBUGVAR(char ebuf[3 * ETHER_ADDR_LEN]); wh = mtod(m0, struct ieee80211_frame *); - frm = (u_int8_t *)[1]; + frm = (u_int8_t *)(wh + 1); efrm = mtod(m0, u_int8_t *) + m0->m_len; + switch (subtype) { case IEEE80211_FC0_SUBTYPE_PROBE_RESP: case IEEE80211_FC0_SUBTYPE_BEACON: { @@ -2037,6 +2037,7 @@ ieee80211_recv_mgmt(struct ieee80211com ic->ic_stats.is_rx_mgtdiscard++; return; } + /* * beacon/probe response frame format * [8] time stamp @@ -2059,7 +2060,9 @@ ieee80211_recv_mgmt(struct ieee80211com scan.bchan = ieee80211_chan2ieee(ic, ic->ic_curchan); scan.chan = scan.bchan; - while (frm < efrm) { + while (frm + 1 < efrm) { + IEEE80211_VERIFY_LENGTH(efrm - frm, frm[1] + 2); + switch (*frm) { case IEEE80211_ELEMID_SSID: scan.ssid = frm; @@ -2122,10 +2125,13 @@ ieee80211_recv_mgmt(struct ieee80211com ic->ic_stats.is_rx_elem_unknown++; break; } + frm += frm[1] + 2; } + IEEE80211_VERIFY_ELEMENT(scan.rates, IEEE80211_RATE_MAXSIZE); IEEE80211_VERIFY_ELEMENT(scan.ssid, IEEE80211_NWID_LEN); + if ( #if IEEE80211_CHAN_MAX < 255 scan.chan > IEEE80211_CHAN_MAX || @@ -2172,7 +2178,7 @@ ieee80211_recv_mgmt(struct ieee80211com if (ni != ic->ic_bss) { ni = ieee80211_refine_node_for_beacon(ic, ni, - >ic_channels[scan.chan], scan.ssid); + >ic_channels[scan.chan], scan.ssid); } /* * Count frame now that we know it's to be processed.
CVS commit: src/sys/dev/ic
Module Name:src Committed By: maxv Date: Tue Jan 16 14:23:15 UTC 2018 Modified Files: src/sys/dev/ic: bwfm.c Log Message: Mmh refix previous, we also need to make sure frm[1] is there. To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 src/sys/dev/ic/bwfm.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/ic/bwfm.c diff -u src/sys/dev/ic/bwfm.c:1.8 src/sys/dev/ic/bwfm.c:1.9 --- src/sys/dev/ic/bwfm.c:1.8 Tue Jan 16 13:48:21 2018 +++ src/sys/dev/ic/bwfm.c Tue Jan 16 14:23:15 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: bwfm.c,v 1.8 2018/01/16 13:48:21 maxv Exp $ */ +/* $NetBSD: bwfm.c,v 1.9 2018/01/16 14:23:15 maxv Exp $ */ /* $OpenBSD: bwfm.c,v 1.5 2017/10/16 22:27:16 patrick Exp $ */ /* * Copyright (c) 2010-2016 Broadcom Corporation @@ -1729,6 +1729,8 @@ bwfm_scan_node(struct bwfm_softc *sc, st scan.wpa = frm; break; } + if (frm + 1 >= efrm) + break; } if (ic->ic_flags & IEEE80211_F_SCAN)
CVS commit: [netbsd-8] src/sys/arch/arm/broadcom
Module Name:src Committed By: martin Date: Tue Jan 16 14:21:10 UTC 2018 Modified Files: src/sys/arch/arm/broadcom [netbsd-8]: bcm2835_space.c Log Message: Pull up the following revisions, requested by skrll in #408: sys/arch/arm/broadcom/bcm2835_space.c 1.12-1.13 Sync with armv7_generic_space.c - big endian support (probably not needed) - a4x subreagion/mmap support - fix some a4x stream methods - add UVM_KMF_COLORMATCH in bs_map when allocating KVA - support BUS_SPACE_MAP_PREFETCHABLE To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.10.10.1 src/sys/arch/arm/broadcom/bcm2835_space.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/arm/broadcom/bcm2835_space.c diff -u src/sys/arch/arm/broadcom/bcm2835_space.c:1.10 src/sys/arch/arm/broadcom/bcm2835_space.c:1.10.10.1 --- src/sys/arch/arm/broadcom/bcm2835_space.c:1.10 Tue Feb 2 13:55:50 2016 +++ src/sys/arch/arm/broadcom/bcm2835_space.c Tue Jan 16 14:21:10 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: bcm2835_space.c,v 1.10 2016/02/02 13:55:50 skrll Exp $ */ +/* $NetBSD: bcm2835_space.c,v 1.10.10.1 2018/01/16 14:21:10 martin Exp $ */ /*- * Copyright (c) 2012 The NetBSD Foundation, Inc. @@ -31,7 +31,7 @@ #include -__KERNEL_RCSID(0, "$NetBSD: bcm2835_space.c,v 1.10 2016/02/02 13:55:50 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: bcm2835_space.c,v 1.10.10.1 2018/01/16 14:21:10 martin Exp $"); #include #include @@ -51,6 +51,12 @@ bs_protos(generic_armv4); bs_protos(a4x); bs_protos(bs_notimpl); +#if __ARMEB__ +#define NSWAP(n) n ## _swap +#else +#define NSWAP(n) n +#endif + struct bus_space bcm2835_bs_tag = { /* cookie */ (void *) 0, @@ -75,38 +81,38 @@ struct bus_space bcm2835_bs_tag = { /* read (single) */ generic_bs_r_1, - generic_armv4_bs_r_2, - generic_bs_r_4, + NSWAP(generic_armv4_bs_r_2), + NSWAP(generic_bs_r_4), bs_notimpl_bs_r_8, /* read multiple */ generic_bs_rm_1, - generic_armv4_bs_rm_2, - generic_bs_rm_4, + NSWAP(generic_armv4_bs_rm_2), + NSWAP(generic_bs_rm_4), bs_notimpl_bs_rm_8, /* read region */ generic_bs_rr_1, - generic_armv4_bs_rr_2, - generic_bs_rr_4, + NSWAP(generic_armv4_bs_rr_2), + NSWAP(generic_bs_rr_4), bs_notimpl_bs_rr_8, /* write (single) */ generic_bs_w_1, - generic_armv4_bs_w_2, - generic_bs_w_4, + NSWAP(generic_armv4_bs_w_2), + NSWAP(generic_bs_w_4), bs_notimpl_bs_w_8, /* write multiple */ generic_bs_wm_1, - generic_armv4_bs_wm_2, - generic_bs_wm_4, + NSWAP(generic_armv4_bs_wm_2), + NSWAP(generic_bs_wm_4), bs_notimpl_bs_wm_8, /* write region */ generic_bs_wr_1, - generic_armv4_bs_wr_2, - generic_bs_wr_4, + NSWAP(generic_armv4_bs_wr_2), + NSWAP(generic_bs_wr_4), bs_notimpl_bs_wr_8, /* set multiple */ @@ -117,8 +123,8 @@ struct bus_space bcm2835_bs_tag = { /* set region */ generic_bs_sr_1, - generic_armv4_bs_sr_2, - bs_notimpl_bs_sr_4, + NSWAP(generic_armv4_bs_sr_2), + NSWAP(generic_bs_sr_4), bs_notimpl_bs_sr_8, /* copy */ @@ -130,38 +136,38 @@ struct bus_space bcm2835_bs_tag = { #ifdef __BUS_SPACE_HAS_STREAM_METHODS /* read (single) */ generic_bs_r_1, - generic_armv4_bs_r_2, - generic_bs_r_4, + NSWAP(generic_armv4_bs_r_2), + NSWAP(generic_bs_r_4), bs_notimpl_bs_r_8, /* read multiple */ generic_bs_rm_1, - generic_armv4_bs_rm_2, - generic_bs_rm_4, + NSWAP(generic_armv4_bs_rm_2), + NSWAP(generic_bs_rm_4), bs_notimpl_bs_rm_8, /* read region */ generic_bs_rr_1, - generic_armv4_bs_rr_2, - generic_bs_rr_4, + NSWAP(generic_armv4_bs_rr_2), + NSWAP(generic_bs_rr_4), bs_notimpl_bs_rr_8, /* write (single) */ generic_bs_w_1, - generic_armv4_bs_w_2, - generic_bs_w_4, + NSWAP(generic_armv4_bs_w_2), + NSWAP(generic_bs_w_4), bs_notimpl_bs_w_8, /* write multiple */ generic_bs_wm_1, - generic_armv4_bs_wm_2, - generic_bs_wm_4, + NSWAP(generic_armv4_bs_wm_2), + NSWAP(generic_bs_wm_4), bs_notimpl_bs_wm_8, /* write region */ generic_bs_wr_1, - generic_armv4_bs_wr_2, - generic_bs_wr_4, + NSWAP(generic_armv4_bs_wr_2), + NSWAP(generic_bs_wr_4), bs_notimpl_bs_wr_8, #endif }; @@ -173,7 +179,7 @@ struct bus_space bcm2835_a4x_bs_tag = { /* mapping/unmapping */ bcm2835_bs_map, bcm2835_bs_unmap, - bcm2835_bs_subregion, + bcm2835_a4x_bs_subregion, /* allocation/deallocation */ bcm2835_bs_alloc, /* not implemented */ @@ -183,21 +189,21 @@ struct bus_space bcm2835_a4x_bs_tag = { bcm2835_bs_vaddr, /* mmap */ - bs_notimpl_bs_mmap, + bcm2835_a4x_bs_mmap, /* barrier */ bcm2835_bs_barrier, /* read (single) */ a4x_bs_r_1, - a4x_bs_r_2, - a4x_bs_r_4, + NSWAP(a4x_bs_r_2), + NSWAP(a4x_bs_r_4), bs_notimpl_bs_r_8, /* read multiple */ a4x_bs_rm_1, - a4x_bs_rm_2, - a4x_bs_rm_4, + NSWAP(a4x_bs_rm_2), + NSWAP(a4x_bs_rm_4), bs_notimpl_bs_rm_8, /* read region */ @@ -208,15 +214,16 @@ struct bus_space bcm2835_a4x_bs_tag = { /* write (single) */ a4x_bs_w_1,
CVS commit: [netbsd-8] src/lib/libc/gen
Module Name:src Committed By: martin Date: Tue Jan 16 14:15:50 UTC 2018 Modified Files: src/lib/libc/gen [netbsd-8]: vis.c Log Message: Pull up the following, requested by maya in #411: lib/libc/gen/vis.c 1.74 Use 16x instead of 4x the amount of space since each wint_t can result in 4 bytes of 4 characters ("\ooo") each. To generate a diff of this commit: cvs rdiff -u -r1.73 -r1.73.4.1 src/lib/libc/gen/vis.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/libc/gen/vis.c diff -u src/lib/libc/gen/vis.c:1.73 src/lib/libc/gen/vis.c:1.73.4.1 --- src/lib/libc/gen/vis.c:1.73 Sun Apr 23 01:58:48 2017 +++ src/lib/libc/gen/vis.c Tue Jan 16 14:15:50 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: vis.c,v 1.73 2017/04/23 01:58:48 christos Exp $ */ +/* $NetBSD: vis.c,v 1.73.4.1 2018/01/16 14:15:50 martin Exp $ */ /*- * Copyright (c) 1989, 1993 @@ -57,7 +57,7 @@ #include #if defined(LIBC_SCCS) && !defined(lint) -__RCSID("$NetBSD: vis.c,v 1.73 2017/04/23 01:58:48 christos Exp $"); +__RCSID("$NetBSD: vis.c,v 1.73.4.1 2018/01/16 14:15:50 martin Exp $"); #endif /* LIBC_SCCS and not lint */ #ifdef __FBSDID __FBSDID("$FreeBSD$"); @@ -432,10 +432,10 @@ istrsenvisx(char **mbdstp, size_t *dlen, mdst = NULL; if ((psrc = calloc(mbslength + 1, sizeof(*psrc))) == NULL) return -1; - if ((pdst = calloc((4 * mbslength) + 1, sizeof(*pdst))) == NULL) + if ((pdst = calloc((16 * mbslength) + 1, sizeof(*pdst))) == NULL) goto out; if (*mbdstp == NULL) { - if ((mdst = calloc((4 * mbslength) + 1, sizeof(*mdst))) == NULL) + if ((mdst = calloc((16 * mbslength) + 1, sizeof(*mdst))) == NULL) goto out; *mbdstp = mdst; } @@ -468,12 +468,13 @@ istrsenvisx(char **mbdstp, size_t *dlen, clen = 1; cerr = 1; } - if (clen == 0) + if (clen == 0) { /* * NUL in input gives 0 return value. process * as single NUL byte and keep going. */ clen = 1; + } /* Advance buffer character pointer. */ src++; /* Advance input pointer by number of bytes read. */
CVS commit: [netbsd-8] src/doc
Module Name:src Committed By: martin Date: Tue Jan 16 14:08:56 UTC 2018 Modified Files: src/doc [netbsd-8]: CHANGES-8.0 Log Message: Tickets #474, #497, #498, #500, #501 To generate a diff of this commit: cvs rdiff -u -r1.1.2.104 -r1.1.2.105 src/doc/CHANGES-8.0 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/doc/CHANGES-8.0 diff -u src/doc/CHANGES-8.0:1.1.2.104 src/doc/CHANGES-8.0:1.1.2.105 --- src/doc/CHANGES-8.0:1.1.2.104 Mon Jan 15 00:21:49 2018 +++ src/doc/CHANGES-8.0 Tue Jan 16 14:08:56 2018 @@ -1,4 +1,4 @@ -# $NetBSD: CHANGES-8.0,v 1.1.2.104 2018/01/15 00:21:49 snj Exp $ +# $NetBSD: CHANGES-8.0,v 1.1.2.105 2018/01/16 14:08:56 martin Exp $ A complete list of changes from the initial NetBSD 8.0 branch on 2017-06-04 until the 8.0 release: @@ -9102,3 +9102,49 @@ sys/dev/audiovar.h1.59 via patch, 1. example: sysctl -w hw.hdafg0.usemixer=0 [nat, ticket #489] +lib/libc/locale/wcstod.c 1.16 +lib/libc/locale/wcstof.c 1.5 +lib/libc/locale/wcstold.c 1.5 + + Add missing weak aliases for wcsto{f,d,ld}_l + [kamil, ticket #474] + +distrib/sets/lists/debug/mi 1.225 +distrib/sets/lists/tests/mi 1.763 +share/man/man9/workqueue.9 1.12 +sys/kern/subr_workqueue.c 1.34 +sys/net/if_bridge.c1.147 +sys/net/if_spppsubr.c1.178 +sys/sys/workqueue.h1.10 +tests/rump/kernspace/Makefile 1.6 +tests/rump/kernspace/kernspace.h 1.5-1.6 +tests/rump/kernspace/workqueue.c 1.1-1.6 +tests/rump/rumpkern/Makefile 1.16 +tests/rump/rumpkern/t_workqueue.c 1.1-1.2 + + Add simple test for workqueue(9) + Tweak use of cv_timedwait + Fix a race condition on taking the mutex + Add workqueue_wait that waits for a specific work to finish + Ensure the timer isn't running by using workqueue_wait + [ozaki-r, ticket #497] + +sys/kern/uipc_domain.c1.101 +sys/rump/librump/rumpnet/rump_net.c 1.21 +sys/sys/domain.h1.34 + + Don't start callouts for domains before attaching domains + on rump kernels. + [ozaki-r, ticket #498] + +usr.sbin/bta2dpd/bta2dpd/bta2dpd.c 1.5 + + Set size of mtusize before calling getsockopt to obtain mtu size. + [nat, ticket #500] + + +sys/kern/kern_event.c1.103 + + Set EV_ONESHOT to prevent rescheduling + [christos, ticket #501] +
CVS commit: src/sys/net80211
Module Name:src Committed By: maxv Date: Tue Jan 16 14:01:13 UTC 2018 Modified Files: src/sys/net80211: ieee80211_input.c Log Message: Fix memory leak. If m1 == m, m = NULL, so it's safe to just call m_freem. To generate a diff of this commit: cvs rdiff -u -r1.94 -r1.95 src/sys/net80211/ieee80211_input.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/net80211/ieee80211_input.c diff -u src/sys/net80211/ieee80211_input.c:1.94 src/sys/net80211/ieee80211_input.c:1.95 --- src/sys/net80211/ieee80211_input.c:1.94 Tue Jan 16 09:42:11 2018 +++ src/sys/net80211/ieee80211_input.c Tue Jan 16 14:01:13 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: ieee80211_input.c,v 1.94 2018/01/16 09:42:11 maxv Exp $ */ +/* $NetBSD: ieee80211_input.c,v 1.95 2018/01/16 14:01:13 maxv Exp $ */ /* * Copyright (c) 2001 Atsushi Onoe @@ -37,7 +37,7 @@ __FBSDID("$FreeBSD: src/sys/net80211/ieee80211_input.c,v 1.81 2005/08/10 16:22:29 sam Exp $"); #endif #ifdef __NetBSD__ -__KERNEL_RCSID(0, "$NetBSD: ieee80211_input.c,v 1.94 2018/01/16 09:42:11 maxv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ieee80211_input.c,v 1.95 2018/01/16 14:01:13 maxv Exp $"); #endif #ifdef _KERNEL_OPT @@ -891,6 +891,7 @@ ieee80211_deliver_data(struct ieee80211c ieee80211_free_node(sta); } } + if (m1 != NULL) { int len; #ifdef ALTQ @@ -902,13 +903,14 @@ ieee80211_deliver_data(struct ieee80211c IFQ_ENQUEUE(>if_snd, m1, error); if (error) { ifp->if_oerrors++; +m_freem(m); m = NULL; } ifp->if_obytes += len; } } - if (m != NULL) { + if (m != NULL) { if (ni->ni_vlan != 0) vlan_set_tag(m, ni->ni_vlan); @@ -919,6 +921,7 @@ ieee80211_deliver_data(struct ieee80211c KASSERT(ifp->if_percpuq); if_percpuq_enqueue(ifp->if_percpuq, m); } + return; }
CVS commit: src/sys/dev/ic
Module Name:src Committed By: maxv Date: Tue Jan 16 13:48:21 UTC 2018 Modified Files: src/sys/dev/ic: bwfm.c Log Message: Fix overflow, noted by Maya. To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/sys/dev/ic/bwfm.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/ic/bwfm.c diff -u src/sys/dev/ic/bwfm.c:1.7 src/sys/dev/ic/bwfm.c:1.8 --- src/sys/dev/ic/bwfm.c:1.7 Mon Dec 18 13:56:14 2017 +++ src/sys/dev/ic/bwfm.c Tue Jan 16 13:48:21 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: bwfm.c,v 1.7 2017/12/18 13:56:14 jmcneill Exp $ */ +/* $NetBSD: bwfm.c,v 1.8 2018/01/16 13:48:21 maxv Exp $ */ /* $OpenBSD: bwfm.c,v 1.5 2017/10/16 22:27:16 patrick Exp $ */ /* * Copyright (c) 2010-2016 Broadcom Corporation @@ -1687,14 +1687,19 @@ bwfm_scan_node(struct bwfm_softc *sc, st break; case IEEE80211_ELEMID_FHPARMS: if (ic->ic_phytype == IEEE80211_T_FH) { +if (frm + 6 >= efrm) + break; scan.fhdwell = le16dec([2]); scan.chan = IEEE80211_FH_CHAN(frm[4], frm[5]); scan.fhindex = frm[6]; } break; case IEEE80211_ELEMID_DSPARMS: - if (ic->ic_phytype != IEEE80211_T_FH) + if (ic->ic_phytype != IEEE80211_T_FH) { +if (frm + 2 >= efrm) + break; scan.chan = frm[2]; + } break; case IEEE80211_ELEMID_TIM: scan.tim = frm; @@ -1704,6 +1709,8 @@ bwfm_scan_node(struct bwfm_softc *sc, st scan.xrates = frm; break; case IEEE80211_ELEMID_ERP: + if (frm + 1 >= efrm) +break; if (frm[1] != 1) { ic->ic_stats.is_rx_elem_toobig++; break; @@ -1714,6 +1721,10 @@ bwfm_scan_node(struct bwfm_softc *sc, st scan.wpa = frm; break; case IEEE80211_ELEMID_VENDOR: + if (frm + 1 >= efrm) +break; + if (frm + frm[1] + 2 >= efrm) +break; if (bwfm_iswpaoui(frm)) scan.wpa = frm; break;
CVS commit: [netbsd-8] src/sys/kern
Module Name:src Committed By: martin Date: Tue Jan 16 13:26:12 UTC 2018 Modified Files: src/sys/kern [netbsd-8]: kern_event.c Log Message: Pull up following revision(s) (requested by christos in ticket #501): sys/kern/kern_event.c: revision 1.103 Set EV_ONESHOT to prevent rescheduling XXX: pullup-8 To generate a diff of this commit: cvs rdiff -u -r1.91.2.1 -r1.91.2.2 src/sys/kern/kern_event.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/kern/kern_event.c diff -u src/sys/kern/kern_event.c:1.91.2.1 src/sys/kern/kern_event.c:1.91.2.2 --- src/sys/kern/kern_event.c:1.91.2.1 Wed Jul 5 20:04:40 2017 +++ src/sys/kern/kern_event.c Tue Jan 16 13:26:12 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: kern_event.c,v 1.91.2.1 2017/07/05 20:04:40 snj Exp $ */ +/* $NetBSD: kern_event.c,v 1.91.2.2 2018/01/16 13:26:12 martin Exp $ */ /*- * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc. @@ -58,7 +58,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: kern_event.c,v 1.91.2.1 2017/07/05 20:04:40 snj Exp $"); +__KERNEL_RCSID(0, "$NetBSD: kern_event.c,v 1.91.2.2 2018/01/16 13:26:12 martin Exp $"); #include #include @@ -662,6 +662,12 @@ static void filt_timerdetach(struct knote *kn) { callout_t *calloutp; + struct kqueue *kq = kn->kn_kq; + + mutex_spin_enter(>kq_lock); + /* prevent rescheduling when we expire */ + kn->kn_flags |= EV_ONESHOT; + mutex_spin_exit(>kq_lock); calloutp = (callout_t *)kn->kn_hook; callout_halt(calloutp, NULL);
CVS commit: [netbsd-8] src/usr.sbin/bta2dpd/bta2dpd
Module Name:src Committed By: martin Date: Tue Jan 16 13:09:59 UTC 2018 Modified Files: src/usr.sbin/bta2dpd/bta2dpd [netbsd-8]: bta2dpd.c Log Message: Pull up following revision(s) (requested by nat in ticket #500): usr.sbin/bta2dpd/bta2dpd/bta2dpd.c: revision 1.5 Set size of mtusize before calling getsockopt to obtain mtu size. To generate a diff of this commit: cvs rdiff -u -r1.3.2.1 -r1.3.2.2 src/usr.sbin/bta2dpd/bta2dpd/bta2dpd.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/bta2dpd/bta2dpd/bta2dpd.c diff -u src/usr.sbin/bta2dpd/bta2dpd/bta2dpd.c:1.3.2.1 src/usr.sbin/bta2dpd/bta2dpd/bta2dpd.c:1.3.2.2 --- src/usr.sbin/bta2dpd/bta2dpd/bta2dpd.c:1.3.2.1 Thu Aug 31 11:21:43 2017 +++ src/usr.sbin/bta2dpd/bta2dpd/bta2dpd.c Tue Jan 16 13:09:59 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: bta2dpd.c,v 1.3.2.1 2017/08/31 11:21:43 martin Exp $ */ +/* $NetBSD: bta2dpd.c,v 1.3.2.2 2018/01/16 13:09:59 martin Exp $ */ /*- * Copyright (c) 2015 - 2016 Nathanial Sloss@@ -784,13 +784,12 @@ opened_connection: state = 7; } + mtusize = sizeof(uint16_t); getsockopt(sc, BTPROTO_L2CAP, SO_L2CAP_OMTU, , ); if (userset_mtu != 0 && userset_mtu > 100 && userset_mtu < mtu) mtu = userset_mtu; else if (userset_mtu == 0 && mtu >= 500) mtu /= 2; - - mtusize = sizeof(uint16_t); } static void
CVS commit: [netbsd-8] src/sys
Module Name:src Committed By: martin Date: Tue Jan 16 13:04:34 UTC 2018 Modified Files: src/sys/kern [netbsd-8]: uipc_domain.c src/sys/rump/librump/rumpnet [netbsd-8]: rump_net.c src/sys/sys [netbsd-8]: domain.h Log Message: Pull up following revision(s) (requested by ozaki-r in ticket #498): sys/kern/uipc_domain.c: revision 1.101 sys/sys/domain.h: revision 1.34 sys/rump/librump/rumpnet/rump_net.c: revision 1.21 Don't start callouts for domains before attaching domains on rump kernels On rump kernels, the callouts for domains, pffasttimo and pfslowtimo, started before domains were attached. Normally the callouts were dispatched after domain attaches (initializations) finished, however, under load the callouts could be executed prior to the attaches, resulting in that the callouts accessed unallocated or uninitialized resources. To generate a diff of this commit: cvs rdiff -u -r1.96.10.1 -r1.96.10.2 src/sys/kern/uipc_domain.c cvs rdiff -u -r1.20 -r1.20.6.1 src/sys/rump/librump/rumpnet/rump_net.c cvs rdiff -u -r1.32.10.1 -r1.32.10.2 src/sys/sys/domain.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/kern/uipc_domain.c diff -u src/sys/kern/uipc_domain.c:1.96.10.1 src/sys/kern/uipc_domain.c:1.96.10.2 --- src/sys/kern/uipc_domain.c:1.96.10.1 Tue Jul 25 01:55:21 2017 +++ src/sys/kern/uipc_domain.c Tue Jan 16 13:04:33 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: uipc_domain.c,v 1.96.10.1 2017/07/25 01:55:21 snj Exp $ */ +/* $NetBSD: uipc_domain.c,v 1.96.10.2 2018/01/16 13:04:33 martin Exp $ */ /* * Copyright (c) 1982, 1986, 1993 @@ -32,7 +32,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: uipc_domain.c,v 1.96.10.1 2017/07/25 01:55:21 snj Exp $"); +__KERNEL_RCSID(0, "$NetBSD: uipc_domain.c,v 1.96.10.2 2018/01/16 13:04:33 martin Exp $"); #include #include @@ -84,6 +84,17 @@ static void sysctl_net_setup(void); static struct domain domain_dummy; __link_set_add_rodata(domains,domain_dummy); +static void +domain_init_timers(void) +{ + + callout_init(_ch, CALLOUT_MPSAFE); + callout_init(_ch, CALLOUT_MPSAFE); + + callout_reset(_ch, 1, pffasttimo, NULL); + callout_reset(_ch, 1, pfslowtimo, NULL); +} + void domaininit(bool attach) { @@ -108,13 +119,20 @@ domaininit(bool attach) } if (rt_domain) domain_attach(rt_domain); + + domain_init_timers(); } +} - callout_init(_ch, CALLOUT_MPSAFE); - callout_init(_ch, CALLOUT_MPSAFE); +/* + * Must be called only if domaininit has been called with false and + * after all domains have been attached. + */ +void +domaininit_post(void) +{ - callout_reset(_ch, 1, pffasttimo, NULL); - callout_reset(_ch, 1, pfslowtimo, NULL); + domain_init_timers(); } void Index: src/sys/rump/librump/rumpnet/rump_net.c diff -u src/sys/rump/librump/rumpnet/rump_net.c:1.20 src/sys/rump/librump/rumpnet/rump_net.c:1.20.6.1 --- src/sys/rump/librump/rumpnet/rump_net.c:1.20 Tue Jan 17 02:03:09 2017 +++ src/sys/rump/librump/rumpnet/rump_net.c Tue Jan 16 13:04:34 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: rump_net.c,v 1.20 2017/01/17 02:03:09 christos Exp $ */ +/* $NetBSD: rump_net.c,v 1.20.6.1 2018/01/16 13:04:34 martin Exp $ */ /* * Copyright (c) 2008 Antti Kantee. All Rights Reserved. @@ -26,7 +26,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: rump_net.c,v 1.20 2017/01/17 02:03:09 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rump_net.c,v 1.20.6.1 2018/01/16 13:04:34 martin Exp $"); #include @@ -56,4 +56,6 @@ RUMP_COMPONENT(RUMP__FACTION_NET) rump_component_init(RUMP_COMPONENT_NET_ROUTE); rump_component_init(RUMP_COMPONENT_NET_IF); rump_component_init(RUMP_COMPONENT_NET_IFCFG); + + domaininit_post(); } Index: src/sys/sys/domain.h diff -u src/sys/sys/domain.h:1.32.10.1 src/sys/sys/domain.h:1.32.10.2 --- src/sys/sys/domain.h:1.32.10.1 Tue Oct 24 08:55:56 2017 +++ src/sys/sys/domain.h Tue Jan 16 13:04:34 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: domain.h,v 1.32.10.1 2017/10/24 08:55:56 snj Exp $ */ +/* $NetBSD: domain.h,v 1.32.10.2 2018/01/16 13:04:34 martin Exp $ */ /* * Copyright (c) 1982, 1986, 1993 @@ -103,6 +103,7 @@ STAILQ_HEAD(domainhead,domain); extern struct domainhead domains; void domain_attach(struct domain *); void domaininit(bool); +void domaininit_post(void); #endif #endif /* !_SYS_DOMAIN_H_ */
CVS commit: [netbsd-8] src
Module Name:src Committed By: martin Date: Tue Jan 16 13:01:11 UTC 2018 Modified Files: src/distrib/sets/lists/debug [netbsd-8]: mi src/distrib/sets/lists/tests [netbsd-8]: mi src/share/man/man9 [netbsd-8]: workqueue.9 src/sys/kern [netbsd-8]: subr_workqueue.c src/sys/net [netbsd-8]: if_bridge.c if_spppsubr.c src/sys/sys [netbsd-8]: workqueue.h src/tests/rump/kernspace [netbsd-8]: Makefile kernspace.h src/tests/rump/rumpkern [netbsd-8]: Makefile Added Files: src/tests/rump/kernspace [netbsd-8]: workqueue.c src/tests/rump/rumpkern [netbsd-8]: t_workqueue.c Log Message: Pull up following revision(s) (requested by ozaki-r in ticket #497): tests/rump/rumpkern/Makefile: revision 1.16 tests/rump/kernspace/Makefile: revision 1.6 tests/rump/kernspace/workqueue.c: revision 1.1 tests/rump/kernspace/workqueue.c: revision 1.2 tests/rump/kernspace/workqueue.c: revision 1.3 tests/rump/kernspace/workqueue.c: revision 1.4 tests/rump/kernspace/workqueue.c: revision 1.5 tests/rump/kernspace/workqueue.c: revision 1.6 tests/rump/rumpkern/t_workqueue.c: revision 1.1 sys/sys/workqueue.h: revision 1.10 tests/rump/rumpkern/t_workqueue.c: revision 1.2 tests/rump/kernspace/kernspace.h: revision 1.5 tests/rump/kernspace/kernspace.h: revision 1.6 sys/net/if_bridge.c: revision 1.147 distrib/sets/lists/debug/mi: revision 1.225 sys/kern/subr_workqueue.c: revision 1.34 share/man/man9/workqueue.9: revision 1.12 sys/net/if_spppsubr.c: revision 1.178 distrib/sets/lists/tests/mi: revision 1.763 Add simple test for workqueue(9) Add declaration. build fix sorry, I forgot to commit this file. Tweak use of cv_timedwait - Handle its return value - Specify more appropriate time-out periods (2 ticks is too short) Fix a race condition on taking the mutex The workqueue worker can take the mutex before the tester tries to take it after calling workqueue_enqueue. If it happens, the worker calls cv_broadcast before the tester calls cv_timedwait and the tester will wait until the cv timed out Take the mutex before calling workqueue_enqueue so that the tester surely calls cv_timedwait before the worker calls cv_broadcast. The fix stabilizes the test, t_workqueue/workqueue1. Add workqueue_wait that waits for a specific work to finish The caller must ensure that no new work is enqueued before calling workqueue_wait. Note that Note that if the workqueue is WQ_PERCPU, the caller can enqueue a new work to another queue other than the waiting queue. Discussed on tech-kern@ Ensure the timer isn't running by using workqueue_wait Functionalize some routines to add new tests easily (NFC) Add a test case for workqueue_wait Fix build To generate a diff of this commit: cvs rdiff -u -r1.216.2.7 -r1.216.2.8 src/distrib/sets/lists/debug/mi cvs rdiff -u -r1.752.2.7 -r1.752.2.8 src/distrib/sets/lists/tests/mi cvs rdiff -u -r1.11 -r1.11.8.1 src/share/man/man9/workqueue.9 cvs rdiff -u -r1.33 -r1.33.30.1 src/sys/kern/subr_workqueue.c cvs rdiff -u -r1.134.6.5 -r1.134.6.6 src/sys/net/if_bridge.c cvs rdiff -u -r1.169.6.3 -r1.169.6.4 src/sys/net/if_spppsubr.c cvs rdiff -u -r1.9 -r1.9.100.1 src/sys/sys/workqueue.h cvs rdiff -u -r1.5 -r1.5.38.1 src/tests/rump/kernspace/Makefile cvs rdiff -u -r1.4 -r1.4.38.1 src/tests/rump/kernspace/kernspace.h cvs rdiff -u -r0 -r1.6.2.2 src/tests/rump/kernspace/workqueue.c cvs rdiff -u -r1.15 -r1.15.16.1 src/tests/rump/rumpkern/Makefile cvs rdiff -u -r0 -r1.2.2.2 src/tests/rump/rumpkern/t_workqueue.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/distrib/sets/lists/debug/mi diff -u src/distrib/sets/lists/debug/mi:1.216.2.7 src/distrib/sets/lists/debug/mi:1.216.2.8 --- src/distrib/sets/lists/debug/mi:1.216.2.7 Fri Dec 22 06:05:35 2017 +++ src/distrib/sets/lists/debug/mi Tue Jan 16 13:01:10 2018 @@ -1,4 +1,4 @@ -# $NetBSD: mi,v 1.216.2.7 2017/12/22 06:05:35 snj Exp $ +# $NetBSD: mi,v 1.216.2.8 2018/01/16 13:01:10 martin Exp $ ./etc/mtree/set.debug comp-sys-root ./usr/lib comp-sys-usr compatdir ./usr/lib/i18n/libBIG5_g.a comp-c-debuglib debuglib,compatfile @@ -2305,6 +2305,7 @@ ./usr/libdata/debug/usr/tests/rump/rumpkern/t_signals.debug tests-syscall-debug debug,atf,rump ./usr/libdata/debug/usr/tests/rump/rumpkern/t_threads.debug tests-syscall-debug debug,atf,rump ./usr/libdata/debug/usr/tests/rump/rumpkern/t_tsleep.debug tests-syscall-debug debug,atf,rump +./usr/libdata/debug/usr/tests/rump/rumpkern/t_workqueue.debug tests-syscall-debug debug,atf,rump ./usr/libdata/debug/usr/tests/rump/rumpkern/t_vm.debug tests-syscall-debug debug,atf,rump ./usr/libdata/debug/usr/tests/rump/rumpvfs/t_basic.debug tests-syscall-debug debug,atf,rump
CVS commit: [netbsd-8] src/lib/libc/locale
Module Name:src Committed By: martin Date: Tue Jan 16 12:03:44 UTC 2018 Modified Files: src/lib/libc/locale [netbsd-8]: wcstod.c wcstof.c wcstold.c Log Message: Pull up following revision(s) (requested by kamil in ticket #474): lib/libc/locale/wcstod.c: revision 1.16 lib/libc/locale/wcstold.c: revision 1.5 lib/libc/locale/wcstof.c: revision 1.5 PR/52801: Kamil Rytarowski: Add missing weak aliases for wcsto{f,d,ld}_l XXX: pullup-8 To generate a diff of this commit: cvs rdiff -u -r1.15 -r1.15.20.1 src/lib/libc/locale/wcstod.c cvs rdiff -u -r1.4 -r1.4.20.1 src/lib/libc/locale/wcstof.c \ src/lib/libc/locale/wcstold.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/libc/locale/wcstod.c diff -u src/lib/libc/locale/wcstod.c:1.15 src/lib/libc/locale/wcstod.c:1.15.20.1 --- src/lib/libc/locale/wcstod.c:1.15 Thu Apr 18 22:23:17 2013 +++ src/lib/libc/locale/wcstod.c Tue Jan 16 12:03:44 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: wcstod.c,v 1.15 2013/04/18 22:23:17 joerg Exp $ */ +/* $NetBSD: wcstod.c,v 1.15.20.1 2018/01/16 12:03:44 martin Exp $ */ /*- * Copyright (c)2006 Citrus Project, @@ -28,7 +28,7 @@ #include #if defined(LIBC_SCCS) && !defined(lint) -__RCSID("$NetBSD: wcstod.c,v 1.15 2013/04/18 22:23:17 joerg Exp $"); +__RCSID("$NetBSD: wcstod.c,v 1.15.20.1 2018/01/16 12:03:44 martin Exp $"); #endif /* LIBC_SCCS and not lint */ #include "namespace.h" @@ -42,6 +42,7 @@ __RCSID("$NetBSD: wcstod.c,v 1.15 2013/0 #include __weak_alias(wcstod,_wcstod) +__weak_alias(wcstod_l,_wcstod_l) #define _FUNCNAME wcstod #define _RETURN_TYPE double Index: src/lib/libc/locale/wcstof.c diff -u src/lib/libc/locale/wcstof.c:1.4 src/lib/libc/locale/wcstof.c:1.4.20.1 --- src/lib/libc/locale/wcstof.c:1.4 Thu Apr 18 22:23:18 2013 +++ src/lib/libc/locale/wcstof.c Tue Jan 16 12:03:44 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: wcstof.c,v 1.4 2013/04/18 22:23:18 joerg Exp $ */ +/* $NetBSD: wcstof.c,v 1.4.20.1 2018/01/16 12:03:44 martin Exp $ */ /*- * Copyright (c)2006 Citrus Project, @@ -28,7 +28,7 @@ #include #if defined(LIBC_SCCS) && !defined(lint) -__RCSID("$NetBSD: wcstof.c,v 1.4 2013/04/18 22:23:18 joerg Exp $"); +__RCSID("$NetBSD: wcstof.c,v 1.4.20.1 2018/01/16 12:03:44 martin Exp $"); #endif /* LIBC_SCCS and not lint */ #include "namespace.h" @@ -42,6 +42,7 @@ __RCSID("$NetBSD: wcstof.c,v 1.4 2013/04 #include __weak_alias(wcstof,_wcstof) +__weak_alias(wcstof_l,_wcstof_l) #define _FUNCNAME wcstof #define _RETURN_TYPE float Index: src/lib/libc/locale/wcstold.c diff -u src/lib/libc/locale/wcstold.c:1.4 src/lib/libc/locale/wcstold.c:1.4.20.1 --- src/lib/libc/locale/wcstold.c:1.4 Thu Apr 18 22:23:18 2013 +++ src/lib/libc/locale/wcstold.c Tue Jan 16 12:03:44 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: wcstold.c,v 1.4 2013/04/18 22:23:18 joerg Exp $ */ +/* $NetBSD: wcstold.c,v 1.4.20.1 2018/01/16 12:03:44 martin Exp $ */ /*- * Copyright (c)2006 Citrus Project, @@ -28,7 +28,7 @@ #include #if defined(LIBC_SCCS) && !defined(lint) -__RCSID("$NetBSD: wcstold.c,v 1.4 2013/04/18 22:23:18 joerg Exp $"); +__RCSID("$NetBSD: wcstold.c,v 1.4.20.1 2018/01/16 12:03:44 martin Exp $"); #endif /* LIBC_SCCS and not lint */ #include "namespace.h" @@ -42,6 +42,7 @@ __RCSID("$NetBSD: wcstold.c,v 1.4 2013/0 #include __weak_alias(wcstold,_wcstold) +__weak_alias(wcstold_l,_wcstold_l) #define _FUNCNAME wcstold #define _RETURN_TYPE long double
CVS commit: src/sys/arch/x86/x86
Module Name:src Committed By: roy Date: Tue Jan 16 11:52:10 UTC 2018 Modified Files: src/sys/arch/x86/x86: intr.c Log Message: Fix XEN builds To generate a diff of this commit: cvs rdiff -u -r1.119 -r1.120 src/sys/arch/x86/x86/intr.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/x86/x86/intr.c diff -u src/sys/arch/x86/x86/intr.c:1.119 src/sys/arch/x86/x86/intr.c:1.120 --- src/sys/arch/x86/x86/intr.c:1.119 Sat Jan 13 20:36:06 2018 +++ src/sys/arch/x86/x86/intr.c Tue Jan 16 11:52:09 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: intr.c,v 1.119 2018/01/13 20:36:06 bouyer Exp $ */ +/* $NetBSD: intr.c,v 1.120 2018/01/16 11:52:09 roy Exp $ */ /* * Copyright (c) 2007, 2008, 2009 The NetBSD Foundation, Inc. @@ -133,7 +133,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.119 2018/01/13 20:36:06 bouyer Exp $"); +__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.120 2018/01/16 11:52:09 roy Exp $"); #include "opt_intrdebug.h" #include "opt_multiprocessor.h" @@ -243,10 +243,10 @@ static const char *legacy_intr_string(in #if defined(XEN) /* XXX: nuke conditional after integration */ static const char *xen_intr_string(int, char *, size_t, struct pic *); #endif /* XXX: XEN */ -#endif static inline bool redzone_const_or_false(bool); static inline int redzone_const_or_zero(int); +#endif static void intr_redistribute_xc_t(void *, void *); static void intr_redistribute_xc_s1(void *, void *); @@ -1428,6 +1428,7 @@ struct intrhand fake_preempt_intrhand; static const char *x86_ipi_names[X86_NIPI] = X86_IPI_NAMES; #endif +#if !defined(XEN) static inline bool redzone_const_or_false(bool x) { @@ -1443,6 +1444,7 @@ redzone_const_or_zero(int x) { return redzone_const_or_false(true) ? x : 0; } +#endif /* * Initialize all handlers that aren't dynamically allocated, and exist
CVS commit: src/distrib/common
Module Name:src Committed By: maya Date: Tue Jan 16 09:59:37 UTC 2018 Modified Files: src/distrib/common: Makefile.mdset Log Message: Make MDSET_NOGZIP behave as documented also if MDSET_SUFFIX is set MDSET_NOGZIP is documented as intended to apply for all kernels, even if MDSET_NOGZIP.filename is not set. >From Harold Gutch in PR toolchain/52836 To generate a diff of this commit: cvs rdiff -u -r1.41 -r1.42 src/distrib/common/Makefile.mdset Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/distrib/common/Makefile.mdset diff -u src/distrib/common/Makefile.mdset:1.41 src/distrib/common/Makefile.mdset:1.42 --- src/distrib/common/Makefile.mdset:1.41 Tue Sep 20 20:55:54 2016 +++ src/distrib/common/Makefile.mdset Tue Jan 16 09:59:37 2018 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile.mdset,v 1.41 2016/09/20 20:55:54 christos Exp $ +# $NetBSD: Makefile.mdset,v 1.42 2018/01/16 09:59:37 maya Exp $ # # Makefile snippet to ${TOOL_MDSETIMAGE} file system images into kernels # @@ -102,7 +102,7 @@ ${_KERNEL.${_K}.${_F}}.${_S}: ${_KERNEL. false .endif -.if defined(MDSET_NOGZIP.${_FILENAME}) && defined(MDSET_NOGZIP) +.if defined(MDSET_NOGZIP.${_FILENAME}) || defined(MDSET_NOGZIP) KERNELS+= ${_KERNEL.${_K}.${_F}}.${_S} .else # { KERNELS+= ${_KERNEL.${_K}.${_F}}.${_S}.gz
CVS commit: src/sys/net80211
Module Name:src Committed By: maxv Date: Tue Jan 16 09:42:11 UTC 2018 Modified Files: src/sys/net80211: ieee80211_input.c Log Message: Style, remove pointless XXXs, and add a comment about LLC. To generate a diff of this commit: cvs rdiff -u -r1.93 -r1.94 src/sys/net80211/ieee80211_input.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/net80211/ieee80211_input.c diff -u src/sys/net80211/ieee80211_input.c:1.93 src/sys/net80211/ieee80211_input.c:1.94 --- src/sys/net80211/ieee80211_input.c:1.93 Tue Jan 16 08:39:29 2018 +++ src/sys/net80211/ieee80211_input.c Tue Jan 16 09:42:11 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: ieee80211_input.c,v 1.93 2018/01/16 08:39:29 maxv Exp $ */ +/* $NetBSD: ieee80211_input.c,v 1.94 2018/01/16 09:42:11 maxv Exp $ */ /* * Copyright (c) 2001 Atsushi Onoe @@ -37,7 +37,7 @@ __FBSDID("$FreeBSD: src/sys/net80211/ieee80211_input.c,v 1.81 2005/08/10 16:22:29 sam Exp $"); #endif #ifdef __NetBSD__ -__KERNEL_RCSID(0, "$NetBSD: ieee80211_input.c,v 1.93 2018/01/16 08:39:29 maxv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ieee80211_input.c,v 1.94 2018/01/16 09:42:11 maxv Exp $"); #endif #ifdef _KERNEL_OPT @@ -177,7 +177,7 @@ ieee80211_input_data(struct ieee80211com ni->ni_macaddr, NULL, "data too short: expecting %u", hdrspace); ic->ic_stats.is_rx_tooshort++; - goto out; /* XXX */ + goto out; } wh = mtod(m, struct ieee80211_frame *); @@ -300,10 +300,9 @@ ieee80211_input_data(struct ieee80211com goto out; } } - wh = NULL; /* no longer valid, catch any uses */ /* - * Next strip any MSDU crypto bits. + * Next, strip any MSDU crypto bits. */ if (key != NULL && !ieee80211_crypto_demic(ic, key, m, 0)) { IEEE80211_DISCARD_MAC(ic, IEEE80211_MSG_INPUT, @@ -763,7 +762,7 @@ ieee80211_defrag(struct ieee80211com *ic struct ieee80211_frame *lwh; u_int16_t rxseq; u_int8_t fragno; - u_int8_t more_frag = wh->i_fc[1] & IEEE80211_FC1_MORE_FRAG; + const u_int8_t more_frag = wh->i_fc[1] & IEEE80211_FC1_MORE_FRAG; struct mbuf *mfrag; IASSERT(!IEEE80211_IS_MULTICAST(wh->i_addr1), ("multicast fragm?")); @@ -818,27 +817,33 @@ ieee80211_defrag(struct ieee80211com *ic } } - if (mfrag == NULL) { + if (mfrag == NULL) { if (fragno != 0) { /* !first fragment, discard */ IEEE80211_NODE_STAT(ni, rx_defrag); m_freem(m); return NULL; } mfrag = m; - } else {/* concatenate */ - m_adj(m, hdrspace); /* strip header */ + } else { + /* Strip header and concatenate */ + m_adj(m, hdrspace); m_cat(mfrag, m); + /* NB: m_cat doesn't update the packet header */ mfrag->m_pkthdr.len += m->m_pkthdr.len; + /* track last seqnum and fragno */ lwh = mtod(mfrag, struct ieee80211_frame *); - *(u_int16_t *) lwh->i_seq = *(u_int16_t *) wh->i_seq; + *(u_int16_t *)lwh->i_seq = *(u_int16_t *)wh->i_seq; } - if (more_frag) { /* more to come, save */ + + if (more_frag) { + /* more to come, save */ ni->ni_rxfragstamp = ticks; ni->ni_rxfrag[0] = mfrag; mfrag = NULL; } + return mfrag; } @@ -920,26 +925,33 @@ ieee80211_deliver_data(struct ieee80211c static struct mbuf * ieee80211_decap(struct ieee80211com *ic, struct mbuf *m, int hdrlen) { - struct ieee80211_qosframe_addr4 wh; /* Max size address frames */ + struct ieee80211_qosframe_addr4 wh; /* Max size address frames */ struct ether_header *eh; struct llc *llc; if (m->m_len < hdrlen + sizeof(*llc) && (m = m_pullup(m, hdrlen + sizeof(*llc))) == NULL) { - /* XXX stat, msg */ return NULL; } + memcpy(, mtod(m, void *), hdrlen); + llc = (struct llc *)(mtod(m, char *) + hdrlen); - if (llc->llc_dsap == LLC_SNAP_LSAP && llc->llc_ssap == LLC_SNAP_LSAP && - llc->llc_control == LLC_UI && llc->llc_snap.org_code[0] == 0 && - llc->llc_snap.org_code[1] == 0 && llc->llc_snap.org_code[2] == 0) { + if (llc->llc_dsap == LLC_SNAP_LSAP && + llc->llc_ssap == LLC_SNAP_LSAP && + llc->llc_control == LLC_UI && + llc->llc_snap.org_code[0] == 0 && + llc->llc_snap.org_code[1] == 0 && + llc->llc_snap.org_code[2] == 0) { m_adj(m, hdrlen + sizeof(struct llc) - sizeof(*eh)); llc = NULL; } else { + /* Keep the LLC after the Ethernet header. */ m_adj(m, hdrlen - sizeof(*eh)); } + eh = mtod(m, struct ether_header *); + switch (wh.i_fc[1] & IEEE80211_FC1_DIR_MASK) { case IEEE80211_FC1_DIR_NODS: IEEE80211_ADDR_COPY(eh->ether_dhost, wh.i_addr1); @@ -958,6 +970,7 @@ ieee80211_decap(struct ieee80211com *ic, IEEE80211_ADDR_COPY(eh->ether_shost, wh.i_addr4); break; } + #ifdef ALIGNED_POINTER if (!ALIGNED_POINTER(mtod(m, char *) + sizeof(*eh), u_int32_t)) { struct mbuf *n, *n0, **np; @@ -1009,10 +1022,12 @@ ieee80211_decap(struct ieee80211com *ic, m = n0; } #endif /* ALIGNED_POINTER */ + if (llc != NULL) { eh = mtod(m, struct ether_header *); eh->ether_type = htons(m->m_pkthdr.len -
CVS commit: src/sys/net80211
Module Name:src Committed By: maxv Date: Tue Jan 16 09:04:30 UTC 2018 Modified Files: src/sys/net80211: ieee80211_crypto.c Log Message: Update the mbuf pointer when m_pullup succeeds, I forgot this in my last revision (I only fixed the UAF in one branch). Meanwhile, style. To generate a diff of this commit: cvs rdiff -u -r1.18 -r1.19 src/sys/net80211/ieee80211_crypto.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/net80211/ieee80211_crypto.c diff -u src/sys/net80211/ieee80211_crypto.c:1.18 src/sys/net80211/ieee80211_crypto.c:1.19 --- src/sys/net80211/ieee80211_crypto.c:1.18 Sun Dec 10 08:56:23 2017 +++ src/sys/net80211/ieee80211_crypto.c Tue Jan 16 09:04:30 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: ieee80211_crypto.c,v 1.18 2017/12/10 08:56:23 maxv Exp $ */ +/* $NetBSD: ieee80211_crypto.c,v 1.19 2018/01/16 09:04:30 maxv Exp $ */ /*- * Copyright (c) 2001 Atsushi Onoe * Copyright (c) 2002-2005 Sam Leffler, Errno Consulting @@ -36,7 +36,7 @@ __FBSDID("$FreeBSD: src/sys/net80211/ieee80211_crypto.c,v 1.12 2005/08/08 18:46:35 sam Exp $"); #endif #ifdef __NetBSD__ -__KERNEL_RCSID(0, "$NetBSD: ieee80211_crypto.c,v 1.18 2017/12/10 08:56:23 maxv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ieee80211_crypto.c,v 1.19 2018/01/16 09:04:30 maxv Exp $"); #endif #ifdef _KERNEL_OPT @@ -559,6 +559,11 @@ ieee80211_crypto_encap(struct ieee80211c return (cip->ic_encap(k, m, keyid<<6) ? k : NULL); } +#define IEEE80211_WEP_HDRLEN (IEEE80211_WEP_IVLEN + IEEE80211_WEP_KIDLEN) +#define IEEE80211_WEP_MINLEN \ + (sizeof(struct ieee80211_frame) + \ + IEEE80211_WEP_HDRLEN + IEEE80211_WEP_CRCLEN) + /* * Validate and strip privacy headers (and trailer) for a * received frame that has the WEP/Privacy bit set. @@ -567,13 +572,9 @@ struct ieee80211_key * ieee80211_crypto_decap(struct ieee80211com *ic, struct ieee80211_node *ni, struct mbuf **mp, int hdrlen) { -#define IEEE80211_WEP_HDRLEN (IEEE80211_WEP_IVLEN + IEEE80211_WEP_KIDLEN) -#define IEEE80211_WEP_MINLEN \ - (sizeof(struct ieee80211_frame) + \ - IEEE80211_WEP_HDRLEN + IEEE80211_WEP_CRCLEN) + const struct ieee80211_cipher *cip; struct ieee80211_key *k; struct ieee80211_frame *wh; - const struct ieee80211_cipher *cip; struct mbuf *m = *mp; u_int8_t keyid; @@ -582,7 +583,7 @@ ieee80211_crypto_decap(struct ieee80211c IEEE80211_DPRINTF(ic, IEEE80211_MSG_ANY, "%s: WEP data frame too short, len %u\n", __func__, m->m_pkthdr.len); - ic->ic_stats.is_rx_tooshort++; /* XXX need unique stat? */ + ic->ic_stats.is_rx_tooshort++; return NULL; } @@ -595,18 +596,22 @@ ieee80211_crypto_decap(struct ieee80211c wh = mtod(m, struct ieee80211_frame *); m_copydata(m, hdrlen + IEEE80211_WEP_IVLEN, sizeof(keyid), ); if (IEEE80211_IS_MULTICAST(wh->i_addr1) || - ni->ni_ucastkey.wk_cipher == _cipher_none) + ni->ni_ucastkey.wk_cipher == _cipher_none) { k = >ic_nw_keys[keyid >> 6]; - else + } else { k = >ni_ucastkey; + } /* * Insure crypto header is contiguous for all decap work. */ cip = k->wk_cipher; - if (m->m_len < hdrlen + cip->ic_header && - (m = m_pullup(m, hdrlen + cip->ic_header)) == NULL) { - *mp = NULL; + if (m->m_len < hdrlen + cip->ic_header) { + m = m_pullup(m, hdrlen + cip->ic_header); + *mp = m; + } + + if (m == NULL) { IEEE80211_DPRINTF(ic, IEEE80211_MSG_CRYPTO, "[%s] unable to pullup %s header\n", ether_sprintf(wh->i_addr2), cip->ic_name); @@ -615,6 +620,4 @@ ieee80211_crypto_decap(struct ieee80211c } return (cip->ic_decap(k, m, hdrlen) ? k : NULL); -#undef IEEE80211_WEP_MINLEN -#undef IEEE80211_WEP_HDRLEN }
CVS commit: src/tools/make
Module Name:src Committed By: uwe Date: Tue Jan 16 08:53:51 UTC 2018 Modified Files: src/tools/make: buildmake.sh.in Log Message: Do not use HOST_CFLAGS and others. build.sh calls configure with CFLAGS set to HOST_CFLAGS, etc - so HOST_* environment variables are already taken into account if set. OTOH, if configure were to add anything to CFLAGS etc, the old code would happily ignore those changes, picking up original environment variables instead. To generate a diff of this commit: cvs rdiff -u -r1.11 -r1.12 src/tools/make/buildmake.sh.in Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tools/make/buildmake.sh.in diff -u src/tools/make/buildmake.sh.in:1.11 src/tools/make/buildmake.sh.in:1.12 --- src/tools/make/buildmake.sh.in:1.11 Mon Jan 15 20:14:49 2018 +++ src/tools/make/buildmake.sh.in Tue Jan 16 08:53:51 2018 @@ -1,25 +1,28 @@ #! /bin/sh -# $NetBSD: buildmake.sh.in,v 1.11 2018/01/15 20:14:49 uwe Exp $ +# $NetBSD: buildmake.sh.in,v 1.12 2018/01/16 08:53:51 uwe Exp $ # # buildmake.sh.in - Autoconf-processed shell script for building make(1). # : ${NETBSDSRCDIR:=@srcdir@/../..} +MKSRCDIR=${NETBSDSRCDIR}/usr.bin/make + +_CC="@CC@" + +_CFLAGS="@CPPFLAGS@" +_CFLAGS="${_CFLAGS} -D_PATH_DEFSYSPATH=\"${NETBSDSRCDIR}/share/mk\"" +_CFLAGS="${_CFLAGS} @DEFS@" +_CFLAGS="${_CFLAGS} @CFLAGS@" -: ${HOST_CC="@CC@"} -: ${HOST_CFLAGS="@CPPFLAGS@ @CFLAGS@"} -: ${HOST_LDFLAGS="@LDFLAGS@ @LIBS@"} +_LDFLAGS="@LDFLAGS@ @LIBS@" docmd () { echo "$1" $1 || exit 1 } -MKSRCDIR=${NETBSDSRCDIR}/usr.bin/make -HOST_CFLAGS="${HOST_CFLAGS} -D_PATH_DEFSYSPATH=\"${NETBSDSRCDIR}/share/mk\"" - for f in $MKSRCDIR/*.c $MKSRCDIR/lst.lib/*.c; do - docmd "${HOST_CC} ${HOST_CFLAGS} @DEFS@ -c $f" + docmd "${_CC} ${_CFLAGS} -c $f" done -docmd "${HOST_CC} -o ${_TOOL_PREFIX:-nb}make *.o ${HOST_LDFLAGS}" +docmd "${_CC} -o ${_TOOL_PREFIX:-nb}make *.o ${_LDFLAGS}"
CVS commit: src/sys/net80211
Module Name:src Committed By: maxv Date: Tue Jan 16 08:39:29 UTC 2018 Modified Files: src/sys/net80211: ieee80211_input.c Log Message: Split ieee80211_input into three sub-functions, that parse received packets depending on their type: DATA -> ieee80211_input_data MANAGEMENT -> ieee80211_input_management CONTROL-> ieee80211_input_control No real functional change, but makes the code much clearer. To generate a diff of this commit: cvs rdiff -u -r1.92 -r1.93 src/sys/net80211/ieee80211_input.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/net80211/ieee80211_input.c diff -u src/sys/net80211/ieee80211_input.c:1.92 src/sys/net80211/ieee80211_input.c:1.93 --- src/sys/net80211/ieee80211_input.c:1.92 Tue Jan 16 07:53:02 2018 +++ src/sys/net80211/ieee80211_input.c Tue Jan 16 08:39:29 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: ieee80211_input.c,v 1.92 2018/01/16 07:53:02 maxv Exp $ */ +/* $NetBSD: ieee80211_input.c,v 1.93 2018/01/16 08:39:29 maxv Exp $ */ /* * Copyright (c) 2001 Atsushi Onoe @@ -37,7 +37,7 @@ __FBSDID("$FreeBSD: src/sys/net80211/ieee80211_input.c,v 1.81 2005/08/10 16:22:29 sam Exp $"); #endif #ifdef __NetBSD__ -__KERNEL_RCSID(0, "$NetBSD: ieee80211_input.c,v 1.92 2018/01/16 07:53:02 maxv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ieee80211_input.c,v 1.93 2018/01/16 08:39:29 maxv Exp $"); #endif #ifdef _KERNEL_OPT @@ -148,6 +148,359 @@ static void ieee80211_update_adhoc_node( struct ieee80211_node *, struct ieee80211_frame *, struct ieee80211_scanparams *, int, u_int32_t); +/* -- */ + +/* + * Input code for a DATA frame. + */ +static int +ieee80211_input_data(struct ieee80211com *ic, struct mbuf **mp, +struct ieee80211_node *ni) +{ + struct ifnet *ifp = ic->ic_ifp; + struct ieee80211_key *key; + struct ieee80211_frame *wh; + u_int8_t dir, subtype; + struct ether_header *eh; + struct mbuf *m = *mp; + int hdrspace; + + wh = mtod(m, struct ieee80211_frame *); + dir = wh->i_fc[1] & IEEE80211_FC1_DIR_MASK; + subtype = wh->i_fc[0] & IEEE80211_FC0_SUBTYPE_MASK; + + hdrspace = ieee80211_hdrspace(ic, wh); + + if (m->m_len < hdrspace && + (m = m_pullup(m, hdrspace)) == NULL) { + IEEE80211_DISCARD_MAC(ic, IEEE80211_MSG_ANY, + ni->ni_macaddr, NULL, + "data too short: expecting %u", hdrspace); + ic->ic_stats.is_rx_tooshort++; + goto out; /* XXX */ + } + wh = mtod(m, struct ieee80211_frame *); + + switch (ic->ic_opmode) { + case IEEE80211_M_STA: + if (dir != IEEE80211_FC1_DIR_FROMDS) { + IEEE80211_DISCARD(ic, IEEE80211_MSG_INPUT, + wh, "data", "%s", "unknown dir 0x%x", dir); + ic->ic_stats.is_rx_wrongdir++; + goto out; + } + if ((ifp->if_flags & IFF_SIMPLEX) && + IEEE80211_IS_MULTICAST(wh->i_addr1) && + IEEE80211_ADDR_EQ(wh->i_addr3, ic->ic_myaddr)) { + /* + * In IEEE802.11 network, multicast packet + * sent from me is broadcast from AP. + * It should be silently discarded for + * SIMPLEX interface. + */ + IEEE80211_DISCARD(ic, IEEE80211_MSG_INPUT, + wh, NULL, "%s", "multicast echo"); + ic->ic_stats.is_rx_mcastecho++; + goto out; + } + break; + + case IEEE80211_M_IBSS: + case IEEE80211_M_AHDEMO: + if (dir != IEEE80211_FC1_DIR_NODS) { + IEEE80211_DISCARD(ic, IEEE80211_MSG_INPUT, + wh, "data", "%s", "unknown dir 0x%x", dir); + ic->ic_stats.is_rx_wrongdir++; + goto out; + } + /* XXX no power-save support */ + break; + + case IEEE80211_M_HOSTAP: +#ifndef IEEE80211_NO_HOSTAP + if (dir != IEEE80211_FC1_DIR_TODS) { + IEEE80211_DISCARD(ic, IEEE80211_MSG_INPUT, + wh, "data", "%s", "unknown dir 0x%x", dir); + ic->ic_stats.is_rx_wrongdir++; + goto out; + } + /* check if source STA is associated */ + if (ni == ic->ic_bss) { + IEEE80211_DISCARD(ic, IEEE80211_MSG_INPUT, + wh, "data", "%s", "unknown src"); + ieee80211_send_error(ic, ni, wh->i_addr2, + IEEE80211_FC0_SUBTYPE_DEAUTH, + IEEE80211_REASON_NOT_AUTHED); + ic->ic_stats.is_rx_notassoc++; + goto err; + } + if (ni->ni_associd == 0) { + IEEE80211_DISCARD(ic, IEEE80211_MSG_INPUT, + wh, "data", "%s", "unassoc src"); + IEEE80211_SEND_MGMT(ic, ni, + IEEE80211_FC0_SUBTYPE_DISASSOC, + IEEE80211_REASON_NOT_ASSOCED); + ic->ic_stats.is_rx_notassoc++; + goto err; + } + + /* + * Check for power save state change. + */ + if (((wh->i_fc[1] & IEEE80211_FC1_PWR_MGT) ^ + (ni->ni_flags & IEEE80211_NODE_PWR_MGT))) + ieee80211_node_pwrsave(ni, +wh->i_fc[1] & IEEE80211_FC1_PWR_MGT); +#endif /* !IEEE80211_NO_HOSTAP */ + break; + + default: + /* XXX here to keep compiler happy */ + goto out; + } + + /* + * Handle privacy requirements. Note that we + * must not be preempted from here until after + * we (potentially) call ieee80211_crypto_demic; + * otherwise we may
CVS commit: src/doc
Module Name:src Committed By: mrg Date: Tue Jan 16 08:37:43 UTC 2018 Modified Files: src/doc: CHANGES Log Message: note sparc* cpuctl identify support. To generate a diff of this commit: cvs rdiff -u -r1.2346 -r1.2347 src/doc/CHANGES Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/doc/CHANGES diff -u src/doc/CHANGES:1.2346 src/doc/CHANGES:1.2347 --- src/doc/CHANGES:1.2346 Mon Jan 15 19:01:55 2018 +++ src/doc/CHANGES Tue Jan 16 08:37:43 2018 @@ -1,4 +1,4 @@ -# LIST OF CHANGES FROM LAST RELEASE: <$Revision: 1.2346 $> +# LIST OF CHANGES FROM LAST RELEASE: <$Revision: 1.2347 $> # # # [Note: This file does not mention every change made to the NetBSD source tree. @@ -99,3 +99,5 @@ Changes from NetBSD 8.0 to NetBSD 9.0: dhcpcd(8): Import dhcpcd-7.0.0 [roy 20180101] mdnsd(8), dns-sd(1), libdns_sd: import mDNSResponder 878.1 [christos 20180114] + cpuctl(8): Add cpuctl identify support for sparc and sparc64. + [mrg 20180116]
CVS commit: src
Module Name:src Committed By: mrg Date: Tue Jan 16 08:23:18 UTC 2018 Modified Files: src/sys/arch/sparc/include: cpu.h src/sys/arch/sparc/sparc: cache.c cache.h cpu.c cpuvar.h pmap.c src/sys/arch/sparc64/include: cpu.h src/sys/arch/sparc64/sparc64: cpu.c src/usr.sbin/cpuctl: cpuctl.c cpuctl.h src/usr.sbin/cpuctl/arch: arm.c i386.c noarch.c Added Files: src/sys/arch/sparc/sparc: cache_print.h src/usr.sbin/cpuctl/arch: sparc.c sparc64.c Log Message: implement cpuctl identify for sparc and sparc64. sparc: - move enum vactype and struct cacheinfo into cpu.h - move the cache flags from cpuinfo.flags into CACHEINFO.c_flags (this allows the new cache_printf_backend() to see them.) remove unused CPUFLG_CACHEIOMMUTABLES and CPUFLG_CACHEDVMA. - align xmpsg to 64 bytes - move cache_print() into cache_print.h so it can be shared with cpuctl. it only depends upon a working printf(). - if found, store the CPU node's "name" into cpu_longname. this changes the default output to show the local CPU not the generic CPU family. eg: cpu0 at mainbus0: mid 8: Ross,RT625 @ 90 MHz, on-chip FPU vs the generic "RT620/625" previously shown. - for each CPU export these things: - name - fpuname - mid - cloc - freq - psr impl and version - mmu impl, version, and number of contexts - cacheinfo structure (which changed for the first time ever with this commit.) sparc64: - add a minimal "cacheinfo" structure to export the i/d/e-cache size and linesize. - store %ver, cpu node "name" and cacheinfo in cpu_info. - set cpu_info ver, name and cacheinfo in cpu_attach(), and export them via sysctl, as well as CPU ID and clock freq cpuctl: - add identifycpu_bind() that returns false on !x86 as their identify routines do not need to run on a particular CPU to obtain its information, and use it to avoid trying to set affinity when not needed. - add sparc and sparc64 cpu identify support using the newly exported values. To generate a diff of this commit: cvs rdiff -u -r1.99 -r1.100 src/sys/arch/sparc/include/cpu.h cvs rdiff -u -r1.99 -r1.100 src/sys/arch/sparc/sparc/cache.c cvs rdiff -u -r1.35 -r1.36 src/sys/arch/sparc/sparc/cache.h cvs rdiff -u -r0 -r1.1 src/sys/arch/sparc/sparc/cache_print.h cvs rdiff -u -r1.250 -r1.251 src/sys/arch/sparc/sparc/cpu.c cvs rdiff -u -r1.94 -r1.95 src/sys/arch/sparc/sparc/cpuvar.h cvs rdiff -u -r1.361 -r1.362 src/sys/arch/sparc/sparc/pmap.c cvs rdiff -u -r1.123 -r1.124 src/sys/arch/sparc64/include/cpu.h cvs rdiff -u -r1.132 -r1.133 src/sys/arch/sparc64/sparc64/cpu.c cvs rdiff -u -r1.28 -r1.29 src/usr.sbin/cpuctl/cpuctl.c cvs rdiff -u -r1.5 -r1.6 src/usr.sbin/cpuctl/cpuctl.h cvs rdiff -u -r1.1 -r1.2 src/usr.sbin/cpuctl/arch/arm.c cvs rdiff -u -r1.79 -r1.80 src/usr.sbin/cpuctl/arch/i386.c cvs rdiff -u -r1.5 -r1.6 src/usr.sbin/cpuctl/arch/noarch.c cvs rdiff -u -r0 -r1.1 src/usr.sbin/cpuctl/arch/sparc.c \ src/usr.sbin/cpuctl/arch/sparc64.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/sparc/include/cpu.h diff -u src/sys/arch/sparc/include/cpu.h:1.99 src/sys/arch/sparc/include/cpu.h:1.100 --- src/sys/arch/sparc/include/cpu.h:1.99 Sat Dec 2 00:48:04 2017 +++ src/sys/arch/sparc/include/cpu.h Tue Jan 16 08:23:17 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: cpu.h,v 1.99 2017/12/02 00:48:04 macallan Exp $ */ +/* $NetBSD: cpu.h,v 1.100 2018/01/16 08:23:17 mrg Exp $ */ /* * Copyright (c) 1992, 1993 @@ -56,6 +56,67 @@ * Exported definitions unique to SPARC cpu support. */ +/* + * Sun-4 and Sun-4c virtual address cache. + * + * Sun-4 virtual caches come in two flavors, write-through (Sun-4c) + * and write-back (Sun-4). The write-back caches are much faster + * but require a bit more care. + * + * This is exported via sysctl so be careful changing it. + */ +enum vactype { VAC_UNKNOWN, VAC_NONE, VAC_WRITETHROUGH, VAC_WRITEBACK }; + +/* + * Cache control information. + * + * This is exported via sysctl so be careful changing it. + */ + +struct cacheinfo { + int c_totalsize; /* total size, in bytes */ + /* if split, MAX(icache,dcache) */ + int c_enabled; /* true => cache is enabled */ + int c_hwflush; /* true => have hardware flush */ + int c_linesize; /* line size, in bytes */ + /* if split, MIN(icache,dcache) */ + int c_l2linesize; /* log2(linesize) */ + int c_nlines; /* precomputed # of lines to flush */ + int c_physical; /* true => cache has physical + address tags */ + int c_associativity; /* # of "buckets" in cache line */ + int c_split; /* true => cache is split */ + + int ic_totalsize; /* instruction cache */ + int ic_enabled; + int ic_linesize; + int ic_l2linesize; + int ic_nlines; + int ic_associativity; + + int dc_totalsize; /* data cache */ + int dc_enabled; + int dc_linesize; + int dc_l2linesize; + int dc_nlines; + int dc_associativity; + +
CVS commit: src/sys/kern
Module Name:src Committed By: ozaki-r Date: Tue Jan 16 08:15:29 UTC 2018 Modified Files: src/sys/kern: kern_timeout.c Log Message: Sanity-check if interlock is held when it's passed To generate a diff of this commit: cvs rdiff -u -r1.53 -r1.54 src/sys/kern/kern_timeout.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/kern/kern_timeout.c diff -u src/sys/kern/kern_timeout.c:1.53 src/sys/kern/kern_timeout.c:1.54 --- src/sys/kern/kern_timeout.c:1.53 Tue Jan 9 01:44:50 2018 +++ src/sys/kern/kern_timeout.c Tue Jan 16 08:15:29 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: kern_timeout.c,v 1.53 2018/01/09 01:44:50 christos Exp $ */ +/* $NetBSD: kern_timeout.c,v 1.54 2018/01/16 08:15:29 ozaki-r Exp $ */ /*- * Copyright (c) 2003, 2006, 2007, 2008, 2009 The NetBSD Foundation, Inc. @@ -59,7 +59,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: kern_timeout.c,v 1.53 2018/01/09 01:44:50 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: kern_timeout.c,v 1.54 2018/01/16 08:15:29 ozaki-r Exp $"); /* * Timeouts are kept in a hierarchical timing wheel. The c_time is the @@ -473,6 +473,7 @@ callout_halt(callout_t *cs, void *interl KASSERT(c->c_magic == CALLOUT_MAGIC); KASSERT(!cpu_intr_p()); + KASSERT(interlock == NULL || mutex_owned(interlock)); lock = callout_lock(c); relock = NULL;
CVS commit: src/sys
Module Name:src Committed By: ozaki-r Date: Tue Jan 16 08:13:47 UTC 2018 Modified Files: src/sys/netinet: if_arp.c src/sys/netinet6: nd6_nbr.c Log Message: Make DAD destructions (MP-)safe with callout_stop arp_dad_stoptimer and nd6_dad_stoptimer can be called with or without softnet_lock held and unfortunately we have no easy way to statically know which. So it is hard to use callout_halt there. To address the situation, we use callout_stop to make the code safe. The new approach copes with the issue by delegating the destruction of a callout to callout itself, which allows us to not wait the callout to finish. This can be done thanks to that DAD objects are separated from other data such as ifa. The approach is suggested by riastradh@ Proposed on tech-kern@ and tech-net@ To generate a diff of this commit: cvs rdiff -u -r1.255 -r1.256 src/sys/netinet/if_arp.c cvs rdiff -u -r1.143 -r1.144 src/sys/netinet6/nd6_nbr.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/netinet/if_arp.c diff -u src/sys/netinet/if_arp.c:1.255 src/sys/netinet/if_arp.c:1.256 --- src/sys/netinet/if_arp.c:1.255 Fri Nov 17 07:37:12 2017 +++ src/sys/netinet/if_arp.c Tue Jan 16 08:13:47 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: if_arp.c,v 1.255 2017/11/17 07:37:12 ozaki-r Exp $ */ +/* $NetBSD: if_arp.c,v 1.256 2018/01/16 08:13:47 ozaki-r Exp $ */ /*- * Copyright (c) 1998, 2000, 2008 The NetBSD Foundation, Inc. @@ -68,7 +68,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_arp.c,v 1.255 2017/11/17 07:37:12 ozaki-r Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_arp.c,v 1.256 2018/01/16 08:13:47 ozaki-r Exp $"); #ifdef _KERNEL_OPT #include "opt_ddb.h" @@ -173,7 +173,8 @@ static void revarprequest(struct ifnet * static void arp_drainstub(void); -static void arp_dad_timer(struct ifaddr *); +struct dadq; +static void arp_dad_timer(struct dadq *); static void arp_dad_start(struct ifaddr *); static void arp_dad_stop(struct ifaddr *); static void arp_dad_duplicated(struct ifaddr *, const char *); @@ -1534,18 +1535,18 @@ arp_dad_starttimer(struct dadq *dp, int { callout_reset(>dad_timer_ch, ticks, - (void (*)(void *))arp_dad_timer, (void *)dp->dad_ifa); + (void (*)(void *))arp_dad_timer, dp); } static void -arp_dad_stoptimer(struct dadq *dp) +arp_dad_destroytimer(struct dadq *dp) { -#ifdef NET_MPSAFE - callout_halt(>dad_timer_ch, NULL); -#else - callout_halt(>dad_timer_ch, softnet_lock); -#endif + TAILQ_REMOVE(, dp, dad_list); + /* Request the timer to destroy dp. */ + dp->dad_ifa = NULL; + callout_reset(>dad_timer_ch, 0, + (void (*)(void *))arp_dad_timer, dp); } static void @@ -1665,36 +1666,39 @@ arp_dad_stop(struct ifaddr *ifa) } /* Prevent the timer from running anymore. */ - TAILQ_REMOVE(, dp, dad_list); - mutex_exit(_dad_lock); + arp_dad_destroytimer(dp); - arp_dad_stoptimer(dp); + mutex_exit(_dad_lock); - kmem_intr_free(dp, sizeof(*dp)); ifafree(ifa); } static void -arp_dad_timer(struct ifaddr *ifa) +arp_dad_timer(struct dadq *dp) { - struct in_ifaddr *ia = (struct in_ifaddr *)ifa; - struct dadq *dp; + struct ifaddr *ifa; + struct in_ifaddr *ia; char ipbuf[INET_ADDRSTRLEN]; bool need_free = false; SOFTNET_KERNEL_LOCK_UNLESS_NET_MPSAFE(); mutex_enter(_dad_lock); - /* Sanity check */ - if (ia == NULL) { - log(LOG_ERR, "%s: called with null parameter\n", __func__); - goto done; - } - dp = arp_dad_find(ifa); - if (dp == NULL) { - /* DAD seems to be stopping, so do nothing. */ + ifa = dp->dad_ifa; + if (ifa == NULL) { + /* ifa is being deleted. DAD should be freed too. */ + if (callout_pending(>dad_timer_ch)) { + /* + * The callout is scheduled again, so we cannot destroy + * dp in this run. + */ + goto done; + } + need_free = true; goto done; } + + ia = (struct in_ifaddr *)ifa; if (ia->ia4_flags & IN_IFF_DUPLICATED) { log(LOG_ERR, "%s: called with duplicate address %s(%s)\n", __func__, IN_PRINT(ipbuf, >ia_addr.sin_addr), @@ -1769,8 +1773,10 @@ done: mutex_exit(_dad_lock); if (need_free) { + callout_destroy(>dad_timer_ch); kmem_intr_free(dp, sizeof(*dp)); - ifafree(ifa); + if (ifa != NULL) + ifafree(ifa); } SOFTNET_KERNEL_UNLOCK_UNLESS_NET_MPSAFE(); Index: src/sys/netinet6/nd6_nbr.c diff -u src/sys/netinet6/nd6_nbr.c:1.143 src/sys/netinet6/nd6_nbr.c:1.144 --- src/sys/netinet6/nd6_nbr.c:1.143 Tue Jan 16 07:56:55 2018 +++ src/sys/netinet6/nd6_nbr.c Tue Jan 16 08:13:47 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: nd6_nbr.c,v 1.143 2018/01/16 07:56:55 ozaki-r Exp $ */ +/* $NetBSD: nd6_nbr.c,v 1.144 2018/01/16 08:13:47 ozaki-r Exp $ */ /* $KAME: nd6_nbr.c,v 1.61 2001/02/10 16:06:14 jinmei Exp $ */ /* @@ -31,7 +31,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: nd6_nbr.c,v 1.143 2018/01/16 07:56:55 ozaki-r Exp $"); +__KERNEL_RCSID(0, "$NetBSD: nd6_nbr.c,v 1.144 2018/01/16 08:13:47 ozaki-r Exp $");