Merge ^/head r311546 through r311683.
This commit is contained in:
commit
69415bc524
@ -606,7 +606,7 @@ XCFLAGS+= ${BFLAGS}
|
||||
.endif
|
||||
|
||||
.if ${MK_LIB32} != "no" && (${TARGET_ARCH} == "amd64" || \
|
||||
${TARGET_ARCH} == "powerpc64")
|
||||
${TARGET_ARCH} == "powerpc64") || ${TARGET_ARCH:Mmips64*} != ""
|
||||
LIBCOMPAT= 32
|
||||
.include "Makefile.libcompat"
|
||||
.elif ${MK_LIBSOFT} != "no" && ${TARGET_ARCH} == "armv6"
|
||||
|
@ -4,8 +4,7 @@
|
||||
__<${_this:T}>__:
|
||||
|
||||
# Makefile for the compatibility libraries.
|
||||
# - 32-bit compat libraries on PowerPC and AMD64.
|
||||
# could also be for mips, but that doesn't work today.
|
||||
# - 32-bit compat libraries on MIPS, PowerPC, and AMD64.
|
||||
|
||||
# -------------------------------------------------------------------
|
||||
# 32 bit world
|
||||
@ -15,6 +14,7 @@ LIB32CPUFLAGS= -march=i686 -mmmx -msse -msse2
|
||||
.else
|
||||
LIB32CPUFLAGS= -march=${TARGET_CPUTYPE}
|
||||
.endif
|
||||
LIB32CPUFLAGS+= -m32
|
||||
LIB32WMAKEENV= MACHINE=i386 MACHINE_ARCH=i386 \
|
||||
MACHINE_CPU="i686 mmx sse sse2"
|
||||
LIB32WMAKEFLAGS= \
|
||||
@ -28,14 +28,30 @@ LIB32CPUFLAGS= -mcpu=powerpc
|
||||
.else
|
||||
LIB32CPUFLAGS= -mcpu=${TARGET_CPUTYPE}
|
||||
.endif
|
||||
LIB32CPUFLAGS+= -m32
|
||||
LIB32WMAKEENV= MACHINE=powerpc MACHINE_ARCH=powerpc
|
||||
LIB32WMAKEFLAGS= \
|
||||
LD="${XLD} -m elf32ppc_fbsd" \
|
||||
OBJCOPY="${XOBJCOPY}"
|
||||
|
||||
.elif ${TARGET_ARCH:Mmips64*} != ""
|
||||
.if empty(TARGET_CPUTYPE)
|
||||
LIB32CPUFLAGS= -march=mips3
|
||||
.else
|
||||
LIB32CPUFLAGS= -march=${TARGET_CPUTYPE}
|
||||
.endif
|
||||
LIB32CPUFLAGS+= -mabi=32
|
||||
LIB32WMAKEENV= MACHINE=mips MACHINE_ARCH=mips
|
||||
.if ${TARGET_ARCH:Mmips64el*} != ""
|
||||
LIB32WMAKEFLAGS= LD="${XLD} -m elf32ltsmip_fbsd"
|
||||
.else
|
||||
LIB32WMAKEFLAGS= LD="${XLD} -m elf32btsmip_fbsd"
|
||||
.endif
|
||||
LIB32WMAKEFLAGS+= OBJCOPY="${XOBJCOPY}"
|
||||
.endif
|
||||
|
||||
|
||||
LIB32CFLAGS= -m32 -DCOMPAT_32BIT
|
||||
LIB32CFLAGS= -DCOMPAT_32BIT
|
||||
LIB32DTRACE= ${DTRACE} -32
|
||||
LIB32WMAKEFLAGS+= -DCOMPAT_32BIT
|
||||
|
||||
|
@ -32,7 +32,7 @@
|
||||
.\" @(#)chmod.1 8.4 (Berkeley) 3/31/94
|
||||
.\" $FreeBSD$
|
||||
.\"
|
||||
.Dd April 20, 2015
|
||||
.Dd January 7, 2017
|
||||
.Dt CHMOD 1
|
||||
.Os
|
||||
.Sh NAME
|
||||
@ -106,6 +106,16 @@ option is specified.
|
||||
In addition, these options override each other and the
|
||||
command's actions are determined by the last one specified.
|
||||
.Pp
|
||||
If
|
||||
.Nm
|
||||
receives a
|
||||
.Dv SIGINFO
|
||||
signal (see the
|
||||
.Cm status
|
||||
argument for
|
||||
.Xr stty 1 ) ,
|
||||
then the current filename as well as the old and new modes are displayed.
|
||||
.Pp
|
||||
Only the owner of a file or the super-user is permitted to change
|
||||
the mode of a file.
|
||||
.Sh EXIT STATUS
|
||||
|
@ -49,14 +49,24 @@ __FBSDID("$FreeBSD$");
|
||||
#include <fcntl.h>
|
||||
#include <fts.h>
|
||||
#include <limits.h>
|
||||
#include <signal.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
static volatile sig_atomic_t siginfo;
|
||||
|
||||
static void usage(void);
|
||||
static int may_have_nfs4acl(const FTSENT *ent, int hflag);
|
||||
|
||||
static void
|
||||
siginfo_handler(int sig __unused)
|
||||
{
|
||||
|
||||
siginfo = 1;
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
@ -125,6 +135,8 @@ done: argv += optind;
|
||||
if (argc < 2)
|
||||
usage();
|
||||
|
||||
(void)signal(SIGINFO, siginfo_handler);
|
||||
|
||||
if (Rflag) {
|
||||
if (hflag)
|
||||
errx(1, "the -R and -h options may not be "
|
||||
@ -192,10 +204,10 @@ done: argv += optind;
|
||||
&& !fflag) {
|
||||
warn("%s", p->fts_path);
|
||||
rval = 1;
|
||||
} else if (vflag) {
|
||||
} else if (vflag || siginfo) {
|
||||
(void)printf("%s", p->fts_path);
|
||||
|
||||
if (vflag > 1) {
|
||||
if (vflag > 1 || siginfo) {
|
||||
char m1[12], m2[12];
|
||||
|
||||
strmode(p->fts_statp->st_mode, m1);
|
||||
@ -207,6 +219,7 @@ done: argv += optind;
|
||||
newmode, m2);
|
||||
}
|
||||
(void)printf("\n");
|
||||
siginfo = 0;
|
||||
}
|
||||
}
|
||||
if (errno)
|
||||
|
@ -527,3 +527,5 @@ DEFINE_LIBUNWIND_PRIVATE_FUNCTION(_ZN9libunwind15Registers_riscv6jumptoEv)
|
||||
ret // jump to ra
|
||||
|
||||
#endif
|
||||
|
||||
.section .note.GNU-stack,"",@progbits
|
||||
|
@ -469,3 +469,5 @@ DEFINE_LIBUNWIND_FUNCTION(unw_getcontext)
|
||||
/* RISCVTODO */
|
||||
|
||||
#endif
|
||||
|
||||
.section .note.GNU-stack,"",@progbits
|
||||
|
@ -170,7 +170,7 @@ atmif_check_carrier(struct atmif_priv *aif)
|
||||
aif->pub.carrier = ATMIF_CARRIER_UNKNOWN;
|
||||
return;
|
||||
}
|
||||
if (!ifmr.ifm_status & IFM_AVALID) {
|
||||
if (!(ifmr.ifm_status & IFM_AVALID)) {
|
||||
aif->pub.carrier = ATMIF_CARRIER_UNKNOWN;
|
||||
return;
|
||||
}
|
||||
|
@ -12,6 +12,11 @@
|
||||
#define TCPD_SOCKADDR struct sockaddr_in
|
||||
#endif
|
||||
|
||||
#ifndef _STDFILE_DECLARED
|
||||
#define _STDFILE_DECLARED
|
||||
typedef struct __sFILE FILE;
|
||||
#endif
|
||||
|
||||
/* Structure to describe one communications endpoint. */
|
||||
|
||||
#define STRING_LENGTH 128 /* hosts, users, processes */
|
||||
|
@ -253,7 +253,7 @@ tcp_print(netdissect_options *ndo,
|
||||
if (ip6) {
|
||||
register struct tcp_seq_hash6 *th;
|
||||
struct tcp_seq_hash6 *tcp_seq_hash;
|
||||
const struct in6_addr *src, *dst;
|
||||
const void *src, *dst;
|
||||
struct tha6 tha;
|
||||
|
||||
tcp_seq_hash = tcp_seq_hash6;
|
||||
@ -309,7 +309,7 @@ tcp_print(netdissect_options *ndo,
|
||||
#endif /*INET6*/
|
||||
register struct tcp_seq_hash *th;
|
||||
struct tcp_seq_hash *tcp_seq_hash;
|
||||
const struct in_addr *src, *dst;
|
||||
const void *src, *dst;
|
||||
struct tha tha;
|
||||
|
||||
tcp_seq_hash = tcp_seq_hash4;
|
||||
|
@ -1408,7 +1408,7 @@
|
||||
/* #undef LASTLOG_WRITE_PUTUTXLINE */
|
||||
|
||||
/* Define if you want TCP Wrappers support */
|
||||
#define LIBWRAP 1
|
||||
/* #undef LIBWRAP */
|
||||
|
||||
/* Define to whatever link() returns for "not supported" if it doesn't return
|
||||
EOPNOTSUPP. */
|
||||
|
@ -122,6 +122,14 @@ snmpEnableAuthenTraps = 2
|
||||
# order to use the enclosed variables, e.g. `usmUserStatus.$(engine).$(user1)`
|
||||
# can only be used if %usm is uncommented.
|
||||
#
|
||||
# Modules are loaded in the order listed, so they must be before any
|
||||
# dependent modules, e.g. "mibII" vs "bridge".
|
||||
#
|
||||
|
||||
#
|
||||
# MIB-2 module
|
||||
#
|
||||
begemotSnmpdModulePath."mibII" = "/usr/lib/snmp_mibII.so"
|
||||
|
||||
#
|
||||
# Bridge module
|
||||
@ -140,11 +148,6 @@ snmpEnableAuthenTraps = 2
|
||||
#
|
||||
#begemotSnmpdModulePath."lm75" = "/usr/lib/snmp_lm75.so"
|
||||
|
||||
#
|
||||
# MIB-2 module
|
||||
#
|
||||
begemotSnmpdModulePath."mibII" = "/usr/lib/snmp_mibII.so"
|
||||
|
||||
#
|
||||
# Netgraph module
|
||||
#
|
||||
|
@ -133,7 +133,8 @@ LIBADD+= compiler_rt
|
||||
.if ${TARGET_CPUARCH} == mips
|
||||
LIB2FUNCS_EXTRA = floatunsidf.c floatunsisf.c
|
||||
# ABIs other than o32 need this
|
||||
.if ${TARGET_ARCH:Mmips64*} != "" || ${TARGET_ARCH:Mmipsn32*} != ""
|
||||
.if (${TARGET_ARCH:Mmips64*} != "" || ${TARGET_ARCH:Mmipsn32*} != "") && \
|
||||
!defined(COMPAT_32BIT)
|
||||
LIB2FUNCS_EXTRA+= floatdidf.c fixunsdfsi.c
|
||||
LIB2FUNCS_EXTRA+= floatdisf.c floatundidf.c
|
||||
LIB2FUNCS_EXTRA+= fixsfdi.c floatundisf.c
|
||||
|
@ -8,6 +8,7 @@ _EMULATION_ENDIAN=b
|
||||
|
||||
.if ${TARGET_ARCH:Mmips64*} != ""
|
||||
NATIVE_EMULATION=elf64${_EMULATION_ENDIAN}tsmip_fbsd
|
||||
LIBSEARCHPATH.elf32${_EMULATION_ENDIAN}tsmip_fbsd=\"=/usr/lib32\"
|
||||
.elif ${TARGET_ARCH:Mmipsn32*} != ""
|
||||
NATIVE_EMULATION=elf32${_EMULATION_ENDIAN}tsmipn32_fbsd
|
||||
.else
|
||||
|
@ -123,6 +123,10 @@ start_element(void *data, const char *name, const char **attr)
|
||||
mt->curband = &mt->rd->bands_11ng;
|
||||
else if (iseq(mode, "11na"))
|
||||
mt->curband = &mt->rd->bands_11na;
|
||||
else if (iseq(mode, "11ac"))
|
||||
mt->curband = &mt->rd->bands_11ac;
|
||||
else if (iseq(mode, "11acg"))
|
||||
mt->curband = &mt->rd->bands_11acg;
|
||||
else
|
||||
warnx("unknown mode \"%s\" at line %ld",
|
||||
__DECONST(char *, mode),
|
||||
@ -184,6 +188,14 @@ decode_flag(struct mystate *mt, const char *p, int len)
|
||||
FLAG(IEEE80211_CHAN_G),
|
||||
FLAG(IEEE80211_CHAN_HT20),
|
||||
FLAG(IEEE80211_CHAN_HT40),
|
||||
FLAG(IEEE80211_CHAN_VHT20),
|
||||
FLAG(IEEE80211_CHAN_VHT40),
|
||||
FLAG(IEEE80211_CHAN_VHT80),
|
||||
/*
|
||||
* XXX VHT80_80? This likely should be done by
|
||||
* 80MHz chan logic in net80211 / ifconfig.
|
||||
*/
|
||||
FLAG(IEEE80211_CHAN_VHT160),
|
||||
FLAG(IEEE80211_CHAN_ST),
|
||||
FLAG(IEEE80211_CHAN_TURBO),
|
||||
FLAG(IEEE80211_CHAN_PASSIVE),
|
||||
@ -515,6 +527,24 @@ lib80211_regdomain_readconfig(struct regdata *rdp, const void *p, size_t len)
|
||||
}
|
||||
nb->band = id;
|
||||
}
|
||||
LIST_FOREACH(nb, &dp->bands_11ac, next) {
|
||||
id = findid(rdp, nb->band, FREQBAND);
|
||||
if (id == NULL) {
|
||||
warnx("undefined 11ac band \"%s\"",
|
||||
__DECONST(char *, nb->band));
|
||||
errors++;
|
||||
}
|
||||
nb->band = id;
|
||||
}
|
||||
LIST_FOREACH(nb, &dp->bands_11acg, next) {
|
||||
id = findid(rdp, nb->band, FREQBAND);
|
||||
if (id == NULL) {
|
||||
warnx("undefined 11acg band \"%s\"",
|
||||
__DECONST(char *, nb->band));
|
||||
errors++;
|
||||
}
|
||||
nb->band = id;
|
||||
}
|
||||
}
|
||||
LIST_FOREACH(cp, &rdp->countries, next) {
|
||||
id = cp->rd;
|
||||
@ -562,6 +592,8 @@ lib80211_regdomain_cleanup(struct regdata *rdp)
|
||||
cleanup_bands(&dp->bands_11a);
|
||||
cleanup_bands(&dp->bands_11ng);
|
||||
cleanup_bands(&dp->bands_11na);
|
||||
cleanup_bands(&dp->bands_11ac);
|
||||
cleanup_bands(&dp->bands_11acg);
|
||||
if (dp->name != NULL)
|
||||
free(__DECONST(char *, dp->name));
|
||||
}
|
||||
|
@ -75,6 +75,8 @@ struct regdomain {
|
||||
netband_head bands_11a; /* 11a operation */
|
||||
netband_head bands_11ng;/* 11ng operation */
|
||||
netband_head bands_11na;/* 11na operation */
|
||||
netband_head bands_11ac;/* 11ac 5GHz operation */
|
||||
netband_head bands_11acg;/* 11ac 2GHz operation */
|
||||
|
||||
LIST_ENTRY(regdomain) next;
|
||||
};
|
||||
|
@ -272,6 +272,8 @@ void _malloc_thread_cleanup(void);
|
||||
* thread is exiting, so its thread-local dtors should be called.
|
||||
*/
|
||||
void __cxa_thread_call_dtors(void);
|
||||
int __cxa_thread_atexit_hidden(void (*dtor_func)(void *), void *obj,
|
||||
void *dso_symbol) __hidden;
|
||||
|
||||
/*
|
||||
* These functions are used by the threading libraries in order to protect
|
||||
|
@ -5,7 +5,9 @@
|
||||
.PATH: ${LIBC_SRCTOP}/${LIBC_ARCH}/stdlib ${LIBC_SRCTOP}/stdlib
|
||||
|
||||
MISRCS+=C99_Exit.c a64l.c abort.c abs.c atexit.c atof.c atoi.c atol.c atoll.c \
|
||||
bsearch.c cxa_thread_atexit.c div.c exit.c getenv.c getopt.c getopt_long.c \
|
||||
bsearch.c \
|
||||
cxa_thread_atexit.c cxa_thread_atexit_impl.c \
|
||||
div.c exit.c getenv.c getopt.c getopt_long.c \
|
||||
getsubopt.c hcreate.c hcreate_r.c hdestroy_r.c heapsort.c heapsort_b.c \
|
||||
hsearch_r.c imaxabs.c imaxdiv.c \
|
||||
insque.c l64a.c labs.c ldiv.c llabs.c lldiv.c lsearch.c \
|
||||
|
@ -118,6 +118,7 @@ FBSD_1.4 {
|
||||
|
||||
FBSD_1.5 {
|
||||
__cxa_thread_atexit;
|
||||
__cxa_thread_atexit_impl;
|
||||
};
|
||||
|
||||
FBSDprivate_1.0 {
|
||||
|
@ -1,7 +1,10 @@
|
||||
/*-
|
||||
* Copyright (c) 2016 Mahdi Mokhtari <mokhi64@gmail.com>
|
||||
* Copyright (c) 2017 The FreeBSD Foundation
|
||||
* All rights reserved.
|
||||
*
|
||||
* Portions of this software were developed by Konstantin Belousov
|
||||
* under sponsorship from the FreeBSD Foundation.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
@ -27,114 +30,11 @@
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#include <sys/queue.h>
|
||||
#include "namespace.h"
|
||||
#include <errno.h>
|
||||
#include <link.h>
|
||||
#include <pthread.h>
|
||||
#include <stddef.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include "un-namespace.h"
|
||||
#include "libc_private.h"
|
||||
|
||||
/*
|
||||
* C++11 introduces the thread_local scope (like __thread with some
|
||||
* additions). As a key-feature it should support non-trivial
|
||||
* destructors, registered with __cxa_thread_atexit() to be executed
|
||||
* at the thread termination.
|
||||
*
|
||||
* The implemention keeps a _Thread_local list of destructors per each
|
||||
* thread, and calls __cxa_thread_call_dtors() on each thread's exit
|
||||
* to do cleanup. For a thread calling exit(3), in particular, for
|
||||
* the initial thread returning from main(), we call
|
||||
* __cxa_thread_call_dtors() inside exit().
|
||||
*
|
||||
* It could be possible that a dynamically loaded library, use
|
||||
* thread_local variable but is dlclose()'d before thread exit. The
|
||||
* destructor of this variable will then try to access the address,
|
||||
* for calling it but it's unloaded, so it'll crash. We're using
|
||||
* __elf_phdr_match_addr() to detect and prevent such cases and so
|
||||
* prevent the crash.
|
||||
*/
|
||||
|
||||
#define CXA_DTORS_ITERATIONS 4
|
||||
|
||||
struct cxa_thread_dtor {
|
||||
void *obj;
|
||||
void (*func)(void *);
|
||||
void *dso;
|
||||
LIST_ENTRY(cxa_thread_dtor) entry;
|
||||
};
|
||||
static _Thread_local LIST_HEAD(dtor_list, cxa_thread_dtor) dtors =
|
||||
LIST_HEAD_INITIALIZER(dtors);
|
||||
|
||||
int
|
||||
__cxa_thread_atexit(void (*dtor_func)(void *), void *obj, void *dso_symbol)
|
||||
{
|
||||
struct cxa_thread_dtor *new_dtor;
|
||||
|
||||
new_dtor = malloc(sizeof(*new_dtor));
|
||||
if (new_dtor == NULL) {
|
||||
errno = ENOMEM; /* forcibly override malloc(3) error */
|
||||
return (-1);
|
||||
}
|
||||
|
||||
new_dtor->obj = obj;
|
||||
new_dtor->func = dtor_func;
|
||||
new_dtor->dso = dso_symbol;
|
||||
LIST_INSERT_HEAD(&dtors, new_dtor, entry);
|
||||
return (0);
|
||||
}
|
||||
|
||||
static void
|
||||
walk_cb_call(struct cxa_thread_dtor *dtor)
|
||||
{
|
||||
struct dl_phdr_info phdr_info;
|
||||
|
||||
if (_rtld_addr_phdr(dtor->dso, &phdr_info) &&
|
||||
__elf_phdr_match_addr(&phdr_info, dtor->func))
|
||||
dtor->func(dtor->obj);
|
||||
else
|
||||
fprintf(stderr, "__cxa_thread_call_dtors: dtr %p from "
|
||||
"unloaded dso, skipping\n", (void *)(dtor->func));
|
||||
}
|
||||
|
||||
static void
|
||||
walk_cb_nocall(struct cxa_thread_dtor *dtor __unused)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
cxa_thread_walk(void (*cb)(struct cxa_thread_dtor *))
|
||||
{
|
||||
struct cxa_thread_dtor *dtor, *tdtor;
|
||||
|
||||
LIST_FOREACH_SAFE(dtor, &dtors, entry, tdtor) {
|
||||
LIST_REMOVE(dtor, entry);
|
||||
cb(dtor);
|
||||
free(dtor);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* This is the callback function we use to call destructors, once for
|
||||
* each thread. It is called in exit(3) in libc/stdlib/exit.c and
|
||||
* before exit_thread() in libthr/thread/thr_exit.c.
|
||||
*/
|
||||
void
|
||||
__cxa_thread_call_dtors(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < CXA_DTORS_ITERATIONS && !LIST_EMPTY(&dtors); i++)
|
||||
cxa_thread_walk(walk_cb_call);
|
||||
|
||||
if (!LIST_EMPTY(&dtors)) {
|
||||
fprintf(stderr, "Thread %p is exiting with more "
|
||||
"thread-specific dtors created after %d iterations "
|
||||
"of destructor calls\n",
|
||||
_pthread_self(), i);
|
||||
cxa_thread_walk(walk_cb_nocall);
|
||||
}
|
||||
return (__cxa_thread_atexit_hidden(dtor_func, obj, dso_symbol));
|
||||
}
|
||||
|
153
lib/libc/stdlib/cxa_thread_atexit_impl.c
Normal file
153
lib/libc/stdlib/cxa_thread_atexit_impl.c
Normal file
@ -0,0 +1,153 @@
|
||||
/*-
|
||||
* Copyright (c) 2016 Mahdi Mokhtari <mokhi64@gmail.com>
|
||||
* Copyright (c) 2016, 2017 The FreeBSD Foundation
|
||||
* All rights reserved.
|
||||
*
|
||||
* Portions of this software were developed by Konstantin Belousov
|
||||
* under sponsorship from the FreeBSD Foundation.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#include <sys/queue.h>
|
||||
#include "namespace.h"
|
||||
#include <errno.h>
|
||||
#include <link.h>
|
||||
#include <pthread.h>
|
||||
#include <stddef.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include "un-namespace.h"
|
||||
#include "libc_private.h"
|
||||
|
||||
/*
|
||||
* C++11 introduces the thread_local scope (like __thread with some
|
||||
* additions). As a key-feature it should support non-trivial
|
||||
* destructors, registered with __cxa_thread_atexit() to be executed
|
||||
* at the thread termination.
|
||||
*
|
||||
* The implemention keeps a _Thread_local list of destructors per each
|
||||
* thread, and calls __cxa_thread_call_dtors() on each thread's exit
|
||||
* to do cleanup. For a thread calling exit(3), in particular, for
|
||||
* the initial thread returning from main(), we call
|
||||
* __cxa_thread_call_dtors() inside exit().
|
||||
*
|
||||
* It could be possible that a dynamically loaded library, use
|
||||
* thread_local variable but is dlclose()'d before thread exit. The
|
||||
* destructor of this variable will then try to access the address,
|
||||
* for calling it but it's unloaded, so it'll crash. We're using
|
||||
* __elf_phdr_match_addr() to detect and prevent such cases and so
|
||||
* prevent the crash.
|
||||
*/
|
||||
|
||||
#define CXA_DTORS_ITERATIONS 4
|
||||
|
||||
struct cxa_thread_dtor {
|
||||
void *obj;
|
||||
void (*func)(void *);
|
||||
void *dso;
|
||||
LIST_ENTRY(cxa_thread_dtor) entry;
|
||||
};
|
||||
static _Thread_local LIST_HEAD(dtor_list, cxa_thread_dtor) dtors =
|
||||
LIST_HEAD_INITIALIZER(dtors);
|
||||
|
||||
int
|
||||
__cxa_thread_atexit_impl(void (*dtor_func)(void *), void *obj,
|
||||
void *dso_symbol)
|
||||
{
|
||||
|
||||
return (__cxa_thread_atexit_hidden(dtor_func, obj, dso_symbol));
|
||||
}
|
||||
|
||||
int
|
||||
__cxa_thread_atexit_hidden(void (*dtor_func)(void *), void *obj,
|
||||
void *dso_symbol)
|
||||
{
|
||||
struct cxa_thread_dtor *new_dtor;
|
||||
|
||||
new_dtor = malloc(sizeof(*new_dtor));
|
||||
if (new_dtor == NULL) {
|
||||
errno = ENOMEM; /* forcibly override malloc(3) error */
|
||||
return (-1);
|
||||
}
|
||||
|
||||
new_dtor->obj = obj;
|
||||
new_dtor->func = dtor_func;
|
||||
new_dtor->dso = dso_symbol;
|
||||
LIST_INSERT_HEAD(&dtors, new_dtor, entry);
|
||||
return (0);
|
||||
}
|
||||
|
||||
static void
|
||||
walk_cb_call(struct cxa_thread_dtor *dtor)
|
||||
{
|
||||
struct dl_phdr_info phdr_info;
|
||||
|
||||
if (_rtld_addr_phdr(dtor->dso, &phdr_info) &&
|
||||
__elf_phdr_match_addr(&phdr_info, dtor->func))
|
||||
dtor->func(dtor->obj);
|
||||
else
|
||||
fprintf(stderr, "__cxa_thread_call_dtors: dtr %p from "
|
||||
"unloaded dso, skipping\n", (void *)(dtor->func));
|
||||
}
|
||||
|
||||
static void
|
||||
walk_cb_nocall(struct cxa_thread_dtor *dtor __unused)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
cxa_thread_walk(void (*cb)(struct cxa_thread_dtor *))
|
||||
{
|
||||
struct cxa_thread_dtor *dtor, *tdtor;
|
||||
|
||||
LIST_FOREACH_SAFE(dtor, &dtors, entry, tdtor) {
|
||||
LIST_REMOVE(dtor, entry);
|
||||
cb(dtor);
|
||||
free(dtor);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* This is the callback function we use to call destructors, once for
|
||||
* each thread. It is called in exit(3) in libc/stdlib/exit.c and
|
||||
* before exit_thread() in libthr/thread/thr_exit.c.
|
||||
*/
|
||||
void
|
||||
__cxa_thread_call_dtors(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < CXA_DTORS_ITERATIONS && !LIST_EMPTY(&dtors); i++)
|
||||
cxa_thread_walk(walk_cb_call);
|
||||
|
||||
if (!LIST_EMPTY(&dtors)) {
|
||||
fprintf(stderr, "Thread %p is exiting with more "
|
||||
"thread-specific dtors created after %d iterations "
|
||||
"of destructor calls\n",
|
||||
_pthread_self(), i);
|
||||
cxa_thread_walk(walk_cb_nocall);
|
||||
}
|
||||
}
|
@ -100,10 +100,11 @@ __FBSDID("$FreeBSD$");
|
||||
*/
|
||||
|
||||
static int
|
||||
do_buff_decode(u_int8_t *databuf, size_t len,
|
||||
do_buff_decode(u_int8_t *buff, size_t len,
|
||||
void (*arg_put)(void *, int , void *, int, char *),
|
||||
void *puthook, const char *fmt, va_list *ap)
|
||||
{
|
||||
int ind = 0;
|
||||
int assigned = 0;
|
||||
int width;
|
||||
int suppress;
|
||||
@ -112,21 +113,17 @@ do_buff_decode(u_int8_t *databuf, size_t len,
|
||||
static u_char mask[] = {0, 0x01, 0x03, 0x07, 0x0f,
|
||||
0x1f, 0x3f, 0x7f, 0xff};
|
||||
int value;
|
||||
u_char *base = databuf;
|
||||
char *intendp;
|
||||
char letter;
|
||||
char field_name[80];
|
||||
|
||||
# define ARG_PUT(ARG) \
|
||||
do \
|
||||
{ \
|
||||
if (!suppress) \
|
||||
{ \
|
||||
#define ARG_PUT(ARG) \
|
||||
do { \
|
||||
if (!suppress) { \
|
||||
if (arg_put) \
|
||||
(*arg_put)(puthook, (letter == 't' ? \
|
||||
'b' : letter), \
|
||||
(void *)((long)(ARG)), width, \
|
||||
field_name); \
|
||||
(*arg_put)(puthook, (letter == 't' ? 'b' : \
|
||||
letter), (void *)((long)(ARG)), width, \
|
||||
field_name); \
|
||||
else \
|
||||
*(va_arg(*ap, int *)) = (ARG); \
|
||||
assigned++; \
|
||||
@ -187,7 +184,11 @@ do_buff_decode(u_int8_t *databuf, size_t len,
|
||||
done = 1;
|
||||
else {
|
||||
if (shift <= 0) {
|
||||
bits = *databuf++;
|
||||
if (ind >= len) {
|
||||
done = 1;
|
||||
break;
|
||||
}
|
||||
bits = buff[ind++];
|
||||
shift = 8;
|
||||
}
|
||||
value = (bits >> (shift - width)) &
|
||||
@ -209,29 +210,31 @@ do_buff_decode(u_int8_t *databuf, size_t len,
|
||||
fmt++;
|
||||
width = strtol(fmt, &intendp, 10);
|
||||
fmt = intendp;
|
||||
if (ind + width > len) {
|
||||
done = 1;
|
||||
break;
|
||||
}
|
||||
switch(width) {
|
||||
case 1:
|
||||
ARG_PUT(*databuf);
|
||||
databuf++;
|
||||
ARG_PUT(buff[ind]);
|
||||
ind++;
|
||||
break;
|
||||
|
||||
case 2:
|
||||
ARG_PUT((*databuf) << 8 | *(databuf + 1));
|
||||
databuf += 2;
|
||||
ARG_PUT(buff[ind] << 8 | buff[ind + 1]);
|
||||
ind += 2;
|
||||
break;
|
||||
|
||||
case 3:
|
||||
ARG_PUT((*databuf) << 16 |
|
||||
(*(databuf + 1)) << 8 | *(databuf + 2));
|
||||
databuf += 3;
|
||||
ARG_PUT(buff[ind] << 16 |
|
||||
buff[ind + 1] << 8 | buff[ind + 2]);
|
||||
ind += 3;
|
||||
break;
|
||||
|
||||
case 4:
|
||||
ARG_PUT((*databuf) << 24 |
|
||||
(*(databuf + 1)) << 16 |
|
||||
(*(databuf + 2)) << 8 |
|
||||
*(databuf + 3));
|
||||
databuf += 4;
|
||||
ARG_PUT(buff[ind] << 24 | buff[ind + 1] << 16 |
|
||||
buff[ind + 2] << 8 | buff[ind + 3]);
|
||||
ind += 4;
|
||||
break;
|
||||
|
||||
default:
|
||||
@ -242,32 +245,35 @@ do_buff_decode(u_int8_t *databuf, size_t len,
|
||||
break;
|
||||
|
||||
case 'c': /* Characters (i.e., not swapped) */
|
||||
case 'z': /* Characters with zeroed trailing
|
||||
spaces */
|
||||
case 'z': /* Characters with zeroed trailing spaces */
|
||||
shift = 0;
|
||||
fmt++;
|
||||
width = strtol(fmt, &intendp, 10);
|
||||
fmt = intendp;
|
||||
if (ind + width > len) {
|
||||
done = 1;
|
||||
break;
|
||||
}
|
||||
if (!suppress) {
|
||||
if (arg_put)
|
||||
(*arg_put)(puthook,
|
||||
(letter == 't' ? 'b' : letter),
|
||||
databuf, width, field_name);
|
||||
(letter == 't' ? 'b' : letter),
|
||||
&buff[ind], width, field_name);
|
||||
else {
|
||||
char *dest;
|
||||
dest = va_arg(*ap, char *);
|
||||
bcopy(databuf, dest, width);
|
||||
bcopy(&buff[ind], dest, width);
|
||||
if (letter == 'z') {
|
||||
char *p;
|
||||
for (p = dest + width - 1;
|
||||
(p >= (char *)dest)
|
||||
&& (*p == ' '); p--)
|
||||
p >= dest && *p == ' ';
|
||||
p--)
|
||||
*p = 0;
|
||||
}
|
||||
}
|
||||
assigned++;
|
||||
}
|
||||
databuf += width;
|
||||
ind += width;
|
||||
field_name[0] = 0;
|
||||
suppress = 0;
|
||||
break;
|
||||
@ -295,9 +301,9 @@ do_buff_decode(u_int8_t *databuf, size_t len,
|
||||
}
|
||||
|
||||
if (plus)
|
||||
databuf += width; /* Relative seek */
|
||||
ind += width; /* Relative seek */
|
||||
else
|
||||
databuf = base + width; /* Absolute seek */
|
||||
ind = width; /* Absolute seek */
|
||||
|
||||
break;
|
||||
|
||||
|
@ -53,10 +53,10 @@ __FBSDID("$FreeBSD$");
|
||||
|
||||
#include <err.h>
|
||||
|
||||
#include <isofs/cd9660/cd9660_node.h>
|
||||
#define _KERNEL
|
||||
#include <isofs/cd9660/iso.h>
|
||||
#undef _KERNEL
|
||||
#include <isofs/cd9660/cd9660_node.h>
|
||||
|
||||
#include <kvm.h>
|
||||
#include <stdio.h>
|
||||
|
@ -62,8 +62,6 @@ __FBSDID("$FreeBSD$");
|
||||
|
||||
struct in_addr servip;
|
||||
|
||||
static n_long nmask, smask;
|
||||
|
||||
static time_t bot;
|
||||
|
||||
static char vm_rfc1048[4] = VM_RFC1048;
|
||||
@ -223,30 +221,19 @@ bootp(sock, flag)
|
||||
bcopy(rbuf.rbootp.bp_file, bootfile, sizeof(bootfile));
|
||||
bootfile[sizeof(bootfile) - 1] = '\0';
|
||||
|
||||
if (IN_CLASSA(ntohl(myip.s_addr)))
|
||||
nmask = htonl(IN_CLASSA_NET);
|
||||
else if (IN_CLASSB(ntohl(myip.s_addr)))
|
||||
nmask = htonl(IN_CLASSB_NET);
|
||||
else
|
||||
nmask = htonl(IN_CLASSC_NET);
|
||||
#ifdef BOOTP_DEBUG
|
||||
if (debug)
|
||||
printf("'native netmask' is %s\n", intoa(nmask));
|
||||
#endif
|
||||
|
||||
/* Check subnet mask against net mask; toss if bogus */
|
||||
if ((nmask & smask) != nmask) {
|
||||
if (!netmask) {
|
||||
if (IN_CLASSA(ntohl(myip.s_addr)))
|
||||
netmask = htonl(IN_CLASSA_NET);
|
||||
else if (IN_CLASSB(ntohl(myip.s_addr)))
|
||||
netmask = htonl(IN_CLASSB_NET);
|
||||
else
|
||||
netmask = htonl(IN_CLASSC_NET);
|
||||
#ifdef BOOTP_DEBUG
|
||||
if (debug)
|
||||
printf("subnet mask (%s) bad\n", intoa(smask));
|
||||
printf("'native netmask' is %s\n", intoa(netmask));
|
||||
#endif
|
||||
smask = 0;
|
||||
}
|
||||
|
||||
/* Get subnet (or natural net) mask */
|
||||
netmask = nmask;
|
||||
if (smask)
|
||||
netmask = smask;
|
||||
#ifdef BOOTP_DEBUG
|
||||
if (debug)
|
||||
printf("mask: %s\n", intoa(netmask));
|
||||
@ -385,7 +372,7 @@ vend_rfc1048(cp, len)
|
||||
break;
|
||||
|
||||
if (tag == TAG_SUBNET_MASK) {
|
||||
bcopy(cp, &smask, sizeof(smask));
|
||||
bcopy(cp, &netmask, sizeof(netmask));
|
||||
}
|
||||
if (tag == TAG_GATEWAY) {
|
||||
bcopy(cp, &gateip.s_addr, sizeof(gateip.s_addr));
|
||||
@ -445,7 +432,7 @@ vend_cmu(cp)
|
||||
vp = (struct cmu_vend *)cp;
|
||||
|
||||
if (vp->v_smask.s_addr != 0) {
|
||||
smask = vp->v_smask.s_addr;
|
||||
netmask = vp->v_smask.s_addr;
|
||||
}
|
||||
if (vp->v_dgate.s_addr != 0) {
|
||||
gateip = vp->v_dgate;
|
||||
|
@ -142,7 +142,7 @@ gen_table "seekwhence" "SEEK_[A-Z]+[[:space:]]+[0-9]+" "sys/
|
||||
gen_table "fcntlcmd" "F_[A-Z0-9_]+[[:space:]]+[0-9]+[[:space:]]+" "sys/fcntl.h" "F_CANCEL|F_..LCK"
|
||||
gen_table "mmapflags" "MAP_[A-Z_]+[[:space:]]+0x[0-9A-Fa-f]+" "sys/mman.h"
|
||||
gen_table "rtpriofuncs" "RTP_[A-Z]+[[:space:]]+[0-9]+" "sys/rtprio.h"
|
||||
gen_table "msgflags" "MSG_[A-Z]+[[:space:]]+0x[0-9]+" "sys/socket.h" "MSG_SOCALLBCK"
|
||||
gen_table "msgflags" "MSG_[A-Z]+[[:space:]]+0x[0-9]+" "sys/socket.h" "MSG_SOCALLBCK|MSG_MORETOCOME"
|
||||
gen_table "sigcode" "SI_[A-Z]+[[:space:]]+0(x[0-9abcdef]+)?" "sys/signal.h"
|
||||
gen_table "umtxcvwaitflags" "CVWAIT_[A-Z_]+[[:space:]]+0x[0-9]+" "sys/umtx.h"
|
||||
gen_table "umtxrwlockflags" "URWLOCK_PREFER_READER[[:space:]]+0x[0-9]+" "sys/umtx.h"
|
||||
|
@ -27,7 +27,7 @@
|
||||
.\"
|
||||
.\" $FreeBSD$
|
||||
.\"
|
||||
.Dd November 30, 2016
|
||||
.Dd January 6, 2017
|
||||
.Dt CAMCONTROL 8
|
||||
.Os
|
||||
.Sh NAME
|
||||
@ -121,7 +121,7 @@
|
||||
.Ic modepage
|
||||
.Op device id
|
||||
.Op generic args
|
||||
.Aq Fl m Ar page | Fl l
|
||||
.Aq Fl m Ar page[,subpage] | Fl l
|
||||
.Op Fl P Ar pgctl
|
||||
.Op Fl b | Fl e
|
||||
.Op Fl d
|
||||
@ -702,9 +702,10 @@ The editor will be invoked if
|
||||
detects that standard input is terminal.
|
||||
.It Fl l
|
||||
Lists all available mode pages.
|
||||
.It Fl m Ar mode_page
|
||||
This specifies the number of the mode page the user would like to view
|
||||
and/or edit.
|
||||
If specified more then once, also lists subpages.
|
||||
.It Fl m Ar page[,subpage]
|
||||
This specifies the number of the mode page and optionally subpage the user
|
||||
would like to view and/or edit.
|
||||
This argument is mandatory unless
|
||||
.Fl l
|
||||
is specified.
|
||||
|
@ -125,12 +125,9 @@ typedef enum {
|
||||
CAM_ARG_GET_STDINQ = 0x00002000,
|
||||
CAM_ARG_GET_XFERRATE = 0x00004000,
|
||||
CAM_ARG_INQ_MASK = 0x00007000,
|
||||
CAM_ARG_MODE_EDIT = 0x00008000,
|
||||
CAM_ARG_PAGE_CNTL = 0x00010000,
|
||||
CAM_ARG_TIMEOUT = 0x00020000,
|
||||
CAM_ARG_CMD_IN = 0x00040000,
|
||||
CAM_ARG_CMD_OUT = 0x00080000,
|
||||
CAM_ARG_DBD = 0x00100000,
|
||||
CAM_ARG_ERR_RECOVER = 0x00200000,
|
||||
CAM_ARG_RETRIES = 0x00400000,
|
||||
CAM_ARG_START_UNIT = 0x00800000,
|
||||
@ -3987,8 +3984,8 @@ reassignblocks(struct cam_device *device, u_int32_t *blocks, int num_blocks)
|
||||
|
||||
#ifndef MINIMALISTIC
|
||||
void
|
||||
mode_sense(struct cam_device *device, int mode_page, int page_control,
|
||||
int dbd, int retry_count, int timeout, u_int8_t *data, int datalen)
|
||||
mode_sense(struct cam_device *device, int dbd, int pc, int page, int subpage,
|
||||
int retry_count, int timeout, u_int8_t *data, int datalen)
|
||||
{
|
||||
union ccb *ccb;
|
||||
int retval;
|
||||
@ -4000,15 +3997,17 @@ mode_sense(struct cam_device *device, int mode_page, int page_control,
|
||||
|
||||
CCB_CLEAR_ALL_EXCEPT_HDR(&ccb->csio);
|
||||
|
||||
scsi_mode_sense(&ccb->csio,
|
||||
scsi_mode_sense_subpage(&ccb->csio,
|
||||
/* retries */ retry_count,
|
||||
/* cbfcnp */ NULL,
|
||||
/* tag_action */ MSG_SIMPLE_Q_TAG,
|
||||
/* dbd */ dbd,
|
||||
/* page_code */ page_control << 6,
|
||||
/* page */ mode_page,
|
||||
/* pc */ pc << 6,
|
||||
/* page */ page,
|
||||
/* subpage */ subpage,
|
||||
/* param_buf */ data,
|
||||
/* param_len */ datalen,
|
||||
/* minimum_cmd_size */ 0,
|
||||
/* sense_len */ SSD_FULL_SIZE,
|
||||
/* timeout */ timeout ? timeout : 5000);
|
||||
|
||||
@ -4089,8 +4088,9 @@ void
|
||||
modepage(struct cam_device *device, int argc, char **argv, char *combinedopt,
|
||||
int retry_count, int timeout)
|
||||
{
|
||||
int c, mode_page = -1, page_control = 0;
|
||||
int binary = 0, list = 0;
|
||||
char *str_subpage;
|
||||
int c, page = -1, subpage = -1, pc = 0;
|
||||
int binary = 0, dbd = 0, edit = 0, list = 0;
|
||||
|
||||
while ((c = getopt(argc, argv, combinedopt)) != -1) {
|
||||
switch(c) {
|
||||
@ -4098,40 +4098,44 @@ modepage(struct cam_device *device, int argc, char **argv, char *combinedopt,
|
||||
binary = 1;
|
||||
break;
|
||||
case 'd':
|
||||
arglist |= CAM_ARG_DBD;
|
||||
dbd = 1;
|
||||
break;
|
||||
case 'e':
|
||||
arglist |= CAM_ARG_MODE_EDIT;
|
||||
edit = 1;
|
||||
break;
|
||||
case 'l':
|
||||
list = 1;
|
||||
list++;
|
||||
break;
|
||||
case 'm':
|
||||
mode_page = strtol(optarg, NULL, 0);
|
||||
if (mode_page < 0)
|
||||
errx(1, "invalid mode page %d", mode_page);
|
||||
str_subpage = optarg;
|
||||
strsep(&str_subpage, ",");
|
||||
page = strtol(optarg, NULL, 0);
|
||||
if (str_subpage)
|
||||
subpage = strtol(str_subpage, NULL, 0);
|
||||
else
|
||||
subpage = 0;
|
||||
if (page < 0)
|
||||
errx(1, "invalid mode page %d", page);
|
||||
if (subpage < 0)
|
||||
errx(1, "invalid mode subpage %d", subpage);
|
||||
break;
|
||||
case 'P':
|
||||
page_control = strtol(optarg, NULL, 0);
|
||||
if ((page_control < 0) || (page_control > 3))
|
||||
errx(1, "invalid page control field %d",
|
||||
page_control);
|
||||
arglist |= CAM_ARG_PAGE_CNTL;
|
||||
pc = strtol(optarg, NULL, 0);
|
||||
if ((pc < 0) || (pc > 3))
|
||||
errx(1, "invalid page control field %d", pc);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (mode_page == -1 && list == 0)
|
||||
if (page == -1 && list == 0)
|
||||
errx(1, "you must specify a mode page!");
|
||||
|
||||
if (list) {
|
||||
mode_list(device, page_control, arglist & CAM_ARG_DBD,
|
||||
retry_count, timeout);
|
||||
if (list != 0) {
|
||||
mode_list(device, dbd, pc, list > 1, retry_count, timeout);
|
||||
} else {
|
||||
mode_edit(device, mode_page, page_control,
|
||||
arglist & CAM_ARG_DBD, arglist & CAM_ARG_MODE_EDIT, binary,
|
||||
mode_edit(device, dbd, pc, page, subpage, edit, binary,
|
||||
retry_count, timeout);
|
||||
}
|
||||
}
|
||||
|
@ -84,14 +84,14 @@ int epc(struct cam_device *device, int argc, char **argv, char *combinedopt,
|
||||
int timestamp(struct cam_device *device, int argc, char **argv,
|
||||
char *combinedopt, int retry_count, int timeout,
|
||||
int verbosemode);
|
||||
void mode_sense(struct cam_device *device, int mode_page, int page_control,
|
||||
int dbd, int retry_count, int timeout, u_int8_t *data,
|
||||
void mode_sense(struct cam_device *device, int dbd, int pc, int page,
|
||||
int subpage, int retry_count, int timeout, uint8_t *data,
|
||||
int datalen);
|
||||
void mode_select(struct cam_device *device, int save_pages, int retry_count,
|
||||
int timeout, u_int8_t *data, int datalen);
|
||||
void mode_edit(struct cam_device *device, int page, int page_control, int dbd,
|
||||
void mode_edit(struct cam_device *device, int dbd, int pc, int page, int subpage,
|
||||
int edit, int binary, int retry_count, int timeout);
|
||||
void mode_list(struct cam_device *device, int page_control, int dbd,
|
||||
void mode_list(struct cam_device *device, int dbd, int pc, int subpages,
|
||||
int retry_count, int timeout);
|
||||
int scsidoinquiry(struct cam_device *device, int argc, char **argv,
|
||||
char *combinedopt, int retry_count, int timeout);
|
||||
|
@ -66,9 +66,6 @@ __FBSDID("$FreeBSD$");
|
||||
#define MODE_PAGE_HEADER(mh) \
|
||||
(struct scsi_mode_page_header *)find_mode_page_6(mh)
|
||||
|
||||
#define MODE_PAGE_DATA(mph) \
|
||||
(u_int8_t *)(mph) + sizeof(struct scsi_mode_page_header)
|
||||
|
||||
|
||||
struct editentry {
|
||||
STAILQ_ENTRY(editentry) link;
|
||||
@ -86,7 +83,8 @@ static int editlist_changed = 0; /* Whether any entries were changed. */
|
||||
|
||||
struct pagename {
|
||||
SLIST_ENTRY(pagename) link;
|
||||
int pagenum;
|
||||
int page;
|
||||
int subpage;
|
||||
char *name;
|
||||
};
|
||||
static SLIST_HEAD(, pagename) namelist; /* Page number to name mappings. */
|
||||
@ -106,21 +104,22 @@ static int editentry_save(void *hook, char *name);
|
||||
static struct editentry *editentry_lookup(char *name);
|
||||
static int editentry_set(char *name, char *newvalue,
|
||||
int editonly);
|
||||
static void editlist_populate(struct cam_device *device,
|
||||
int modepage, int page_control,
|
||||
int dbd, int retries, int timeout);
|
||||
static void editlist_save(struct cam_device *device, int modepage,
|
||||
int page_control, int dbd, int retries,
|
||||
int timeout);
|
||||
static void nameentry_create(int pagenum, char *name);
|
||||
static struct pagename *nameentry_lookup(int pagenum);
|
||||
static int load_format(const char *pagedb_path, int page);
|
||||
static void editlist_populate(struct cam_device *device, int dbd,
|
||||
int pc, int page, int subpage,
|
||||
int retries, int timeout);
|
||||
static void editlist_save(struct cam_device *device, int dbd,
|
||||
int pc, int page, int subpage,
|
||||
int retries, int timeout);
|
||||
static void nameentry_create(int page, int subpage, char *name);
|
||||
static struct pagename *nameentry_lookup(int page, int subpage);
|
||||
static int load_format(const char *pagedb_path, int lpage,
|
||||
int lsubpage);
|
||||
static int modepage_write(FILE *file, int editonly);
|
||||
static int modepage_read(FILE *file);
|
||||
static void modepage_edit(void);
|
||||
static void modepage_dump(struct cam_device *device, int page,
|
||||
int page_control, int dbd, int retries,
|
||||
int timeout);
|
||||
static void modepage_dump(struct cam_device *device, int dbd,
|
||||
int pc, int page, int subpage, int retries,
|
||||
int timeout);
|
||||
static void cleanup_editfile(void);
|
||||
|
||||
|
||||
@ -193,7 +192,14 @@ editentry_save(void *hook __unused, char *name)
|
||||
struct editentry *src; /* Entry value to save. */
|
||||
|
||||
src = editentry_lookup(name);
|
||||
assert(src != NULL);
|
||||
if (src == 0) {
|
||||
/*
|
||||
* This happens if field does not fit into read page size.
|
||||
* It also means that this field won't be written, so the
|
||||
* returned value does not really matter.
|
||||
*/
|
||||
return (0);
|
||||
}
|
||||
|
||||
switch (src->type) {
|
||||
case 'i': /* Byte-sized integral type. */
|
||||
@ -318,10 +324,10 @@ editentry_set(char *name, char *newvalue, int editonly)
|
||||
}
|
||||
|
||||
static void
|
||||
nameentry_create(int pagenum, char *name) {
|
||||
nameentry_create(int page, int subpage, char *name) {
|
||||
struct pagename *newentry;
|
||||
|
||||
if (pagenum < 0 || name == NULL || name[0] == '\0')
|
||||
if (page < 0 || subpage < 0 || name == NULL || name[0] == '\0')
|
||||
return;
|
||||
|
||||
/* Allocate memory for the new entry and a copy of the entry name. */
|
||||
@ -332,16 +338,17 @@ nameentry_create(int pagenum, char *name) {
|
||||
/* Trim any trailing whitespace for the page name. */
|
||||
RTRIM(newentry->name);
|
||||
|
||||
newentry->pagenum = pagenum;
|
||||
newentry->page = page;
|
||||
newentry->subpage = subpage;
|
||||
SLIST_INSERT_HEAD(&namelist, newentry, link);
|
||||
}
|
||||
|
||||
static struct pagename *
|
||||
nameentry_lookup(int pagenum) {
|
||||
nameentry_lookup(int page, int subpage) {
|
||||
struct pagename *scan;
|
||||
|
||||
SLIST_FOREACH(scan, &namelist, link) {
|
||||
if (pagenum == scan->pagenum)
|
||||
if (page == scan->page && subpage == scan->subpage)
|
||||
return (scan);
|
||||
}
|
||||
|
||||
@ -350,12 +357,14 @@ nameentry_lookup(int pagenum) {
|
||||
}
|
||||
|
||||
static int
|
||||
load_format(const char *pagedb_path, int page)
|
||||
load_format(const char *pagedb_path, int lpage, int lsubpage)
|
||||
{
|
||||
FILE *pagedb;
|
||||
char str_pagenum[MAX_PAGENUM_LEN];
|
||||
char str_page[MAX_PAGENUM_LEN];
|
||||
char *str_subpage;
|
||||
char str_pagename[MAX_PAGENAME_LEN];
|
||||
int pagenum;
|
||||
int page;
|
||||
int subpage;
|
||||
int depth; /* Quoting depth. */
|
||||
int found;
|
||||
int lineno;
|
||||
@ -364,9 +373,10 @@ load_format(const char *pagedb_path, int page)
|
||||
char c;
|
||||
|
||||
#define SETSTATE_LOCATE do { \
|
||||
str_pagenum[0] = '\0'; \
|
||||
str_page[0] = '\0'; \
|
||||
str_pagename[0] = '\0'; \
|
||||
pagenum = -1; \
|
||||
page = -1; \
|
||||
subpage = -1; \
|
||||
state = LOCATE; \
|
||||
} while (0)
|
||||
|
||||
@ -443,32 +453,46 @@ load_format(const char *pagedb_path, int page)
|
||||
* modes without providing a mode definition).
|
||||
*/
|
||||
/* Record the name of this page. */
|
||||
pagenum = strtol(str_pagenum, NULL, 0);
|
||||
nameentry_create(pagenum, str_pagename);
|
||||
str_subpage = str_page;
|
||||
strsep(&str_subpage, ",");
|
||||
page = strtol(str_page, NULL, 0);
|
||||
if (str_subpage)
|
||||
subpage = strtol(str_subpage, NULL, 0);
|
||||
else
|
||||
subpage = 0;
|
||||
nameentry_create(page, subpage, str_pagename);
|
||||
SETSTATE_LOCATE;
|
||||
} else if (depth == 0 && c == PAGENAME_START) {
|
||||
SETSTATE_PAGENAME;
|
||||
} else if (c == PAGEDEF_START) {
|
||||
pagenum = strtol(str_pagenum, NULL, 0);
|
||||
str_subpage = str_page;
|
||||
strsep(&str_subpage, ",");
|
||||
page = strtol(str_page, NULL, 0);
|
||||
if (str_subpage)
|
||||
subpage = strtol(str_subpage, NULL, 0);
|
||||
else
|
||||
subpage = 0;
|
||||
if (depth == 1) {
|
||||
/* Record the name of this page. */
|
||||
nameentry_create(pagenum, str_pagename);
|
||||
nameentry_create(page, subpage,
|
||||
str_pagename);
|
||||
/*
|
||||
* Only record the format if this is
|
||||
* the page we are interested in.
|
||||
*/
|
||||
if (page == pagenum && !found)
|
||||
if (lpage == page &&
|
||||
lsubpage == subpage && !found)
|
||||
SETSTATE_PAGEDEF;
|
||||
}
|
||||
} else if (c == PAGEDEF_END) {
|
||||
/* Reset the processor state. */
|
||||
SETSTATE_LOCATE;
|
||||
} else if (depth == 0 && ! BUFFERFULL(str_pagenum)) {
|
||||
strncat(str_pagenum, &c, 1);
|
||||
} else if (depth == 0 && ! BUFFERFULL(str_page)) {
|
||||
strncat(str_page, &c, 1);
|
||||
} else if (depth == 0) {
|
||||
errx(EX_OSFILE, "%s:%d: %s %zd %s", pagedb_path,
|
||||
lineno, "page identifier exceeds",
|
||||
sizeof(str_pagenum) - 1, "characters");
|
||||
sizeof(str_page) - 1, "characters");
|
||||
}
|
||||
break;
|
||||
|
||||
@ -484,7 +508,7 @@ load_format(const char *pagedb_path, int page)
|
||||
} else {
|
||||
errx(EX_OSFILE, "%s:%d: %s %zd %s", pagedb_path,
|
||||
lineno, "page name exceeds",
|
||||
sizeof(str_pagenum) - 1, "characters");
|
||||
sizeof(str_page) - 1, "characters");
|
||||
}
|
||||
break;
|
||||
|
||||
@ -525,88 +549,95 @@ load_format(const char *pagedb_path, int page)
|
||||
}
|
||||
|
||||
static void
|
||||
editlist_populate(struct cam_device *device, int modepage, int page_control,
|
||||
int dbd, int retries, int timeout)
|
||||
editlist_populate(struct cam_device *device, int dbd, int pc, int page,
|
||||
int subpage, int retries, int timeout)
|
||||
{
|
||||
u_int8_t data[MAX_COMMAND_SIZE];/* Buffer to hold sense data. */
|
||||
u_int8_t *mode_pars; /* Pointer to modepage params. */
|
||||
struct scsi_mode_header_6 *mh; /* Location of mode header. */
|
||||
struct scsi_mode_page_header *mph;
|
||||
struct scsi_mode_page_header_sp *mphsp;
|
||||
int len;
|
||||
|
||||
STAILQ_INIT(&editlist);
|
||||
|
||||
/* Fetch changeable values; use to build initial editlist. */
|
||||
mode_sense(device, modepage, 1, dbd, retries, timeout, data,
|
||||
mode_sense(device, dbd, 1, page, subpage, retries, timeout, data,
|
||||
sizeof(data));
|
||||
|
||||
mh = (struct scsi_mode_header_6 *)data;
|
||||
mph = MODE_PAGE_HEADER(mh);
|
||||
mode_pars = MODE_PAGE_DATA(mph);
|
||||
if ((mph->page_code & SMPH_SPF) == 0) {
|
||||
mode_pars = (uint8_t *)(mph + 1);
|
||||
len = mph->page_length;
|
||||
} else {
|
||||
mphsp = (struct scsi_mode_page_header_sp *)mph;
|
||||
mode_pars = (uint8_t *)(mphsp + 1);
|
||||
len = scsi_2btoul(mphsp->page_length);
|
||||
}
|
||||
|
||||
/* Decode the value data, creating edit_entries for each value. */
|
||||
buff_decode_visit(mode_pars, mh->data_length, format,
|
||||
editentry_create, 0);
|
||||
buff_decode_visit(mode_pars, len, format, editentry_create, 0);
|
||||
|
||||
/* Fetch the current/saved values; use to set editentry values. */
|
||||
mode_sense(device, modepage, page_control, dbd, retries, timeout, data,
|
||||
sizeof(data));
|
||||
buff_decode_visit(mode_pars, mh->data_length, format,
|
||||
editentry_update, 0);
|
||||
mode_sense(device, dbd, pc, page, subpage, retries, timeout,
|
||||
data, sizeof(data));
|
||||
buff_decode_visit(mode_pars, len, format, editentry_update, 0);
|
||||
}
|
||||
|
||||
static void
|
||||
editlist_save(struct cam_device *device, int modepage, int page_control,
|
||||
int dbd, int retries, int timeout)
|
||||
editlist_save(struct cam_device *device, int dbd, int pc, int page,
|
||||
int subpage, int retries, int timeout)
|
||||
{
|
||||
u_int8_t data[MAX_COMMAND_SIZE];/* Buffer to hold sense data. */
|
||||
u_int8_t *mode_pars; /* Pointer to modepage params. */
|
||||
struct scsi_mode_header_6 *mh; /* Location of mode header. */
|
||||
struct scsi_mode_page_header *mph;
|
||||
struct scsi_mode_page_header_sp *mphsp;
|
||||
int len, hlen;
|
||||
|
||||
/* Make sure that something changed before continuing. */
|
||||
if (! editlist_changed)
|
||||
return;
|
||||
|
||||
/*
|
||||
* Preload the CDB buffer with the current mode page data.
|
||||
* XXX If buff_encode_visit would return the number of bytes encoded
|
||||
* we *should* use that to build a header from scratch. As it is
|
||||
* now, we need mode_sense to find out the page length.
|
||||
*/
|
||||
mode_sense(device, modepage, page_control, dbd, retries, timeout, data,
|
||||
sizeof(data));
|
||||
/* Preload the CDB buffer with the current mode page data. */
|
||||
mode_sense(device, dbd, pc, page, subpage, retries, timeout,
|
||||
data, sizeof(data));
|
||||
|
||||
/* Initial headers & offsets. */
|
||||
mh = (struct scsi_mode_header_6 *)data;
|
||||
mph = MODE_PAGE_HEADER(mh);
|
||||
mode_pars = MODE_PAGE_DATA(mph);
|
||||
if ((mph->page_code & SMPH_SPF) == 0) {
|
||||
hlen = sizeof(*mph);
|
||||
mode_pars = (uint8_t *)(mph + 1);
|
||||
len = mph->page_length;
|
||||
} else {
|
||||
mphsp = (struct scsi_mode_page_header_sp *)mph;
|
||||
hlen = sizeof(*mphsp);
|
||||
mode_pars = (uint8_t *)(mphsp + 1);
|
||||
len = scsi_2btoul(mphsp->page_length);
|
||||
}
|
||||
|
||||
/* Encode the value data to be passed back to the device. */
|
||||
buff_encode_visit(mode_pars, mh->data_length, format,
|
||||
editentry_save, 0);
|
||||
buff_encode_visit(mode_pars, len, format, editentry_save, 0);
|
||||
|
||||
/* Eliminate block descriptors. */
|
||||
bcopy(mph, ((u_int8_t *)mh) + sizeof(*mh),
|
||||
sizeof(*mph) + mph->page_length);
|
||||
bcopy(mph, mh + 1, hlen + len);
|
||||
|
||||
/* Recalculate headers & offsets. */
|
||||
mh->blk_desc_len = 0; /* No block descriptors. */
|
||||
mh->dev_spec = 0; /* Clear device-specific parameters. */
|
||||
mph = MODE_PAGE_HEADER(mh);
|
||||
mode_pars = MODE_PAGE_DATA(mph);
|
||||
|
||||
mph->page_code &= SMS_PAGE_CODE;/* Isolate just the page code. */
|
||||
mh->data_length = 0; /* Reserved for MODE SELECT command. */
|
||||
mh->dev_spec = 0; /* Clear device-specific parameters. */
|
||||
mh->blk_desc_len = 0; /* No block descriptors. */
|
||||
mph = MODE_PAGE_HEADER(mh);
|
||||
mph->page_code &= ~SMPH_PS; /* Reserved for MODE SELECT command. */
|
||||
|
||||
/*
|
||||
* Write the changes back to the device. If the user editted control
|
||||
* page 3 (saved values) then request the changes be permanently
|
||||
* recorded.
|
||||
*/
|
||||
mode_select(device,
|
||||
(page_control << PAGE_CTRL_SHIFT == SMS_PAGE_CTRL_SAVED),
|
||||
retries, timeout, (u_int8_t *)mh,
|
||||
sizeof(*mh) + mh->blk_desc_len + sizeof(*mph) + mph->page_length);
|
||||
mode_select(device, (pc << PAGE_CTRL_SHIFT == SMS_PAGE_CTRL_SAVED),
|
||||
retries, timeout, (u_int8_t *)mh, sizeof(*mh) + hlen + len);
|
||||
}
|
||||
|
||||
static int
|
||||
@ -775,24 +806,32 @@ modepage_edit(void)
|
||||
}
|
||||
|
||||
static void
|
||||
modepage_dump(struct cam_device *device, int page, int page_control, int dbd,
|
||||
modepage_dump(struct cam_device *device, int dbd, int pc, int page, int subpage,
|
||||
int retries, int timeout)
|
||||
{
|
||||
u_int8_t data[MAX_COMMAND_SIZE];/* Buffer to hold sense data. */
|
||||
u_int8_t *mode_pars; /* Pointer to modepage params. */
|
||||
struct scsi_mode_header_6 *mh; /* Location of mode header. */
|
||||
struct scsi_mode_page_header *mph;
|
||||
int indx; /* Index for scanning mode params. */
|
||||
struct scsi_mode_page_header_sp *mphsp;
|
||||
int indx, len;
|
||||
|
||||
mode_sense(device, page, page_control, dbd, retries, timeout, data,
|
||||
sizeof(data));
|
||||
mode_sense(device, dbd, pc, page, subpage, retries, timeout,
|
||||
data, sizeof(data));
|
||||
|
||||
mh = (struct scsi_mode_header_6 *)data;
|
||||
mph = MODE_PAGE_HEADER(mh);
|
||||
mode_pars = MODE_PAGE_DATA(mph);
|
||||
if ((mph->page_code & SMPH_SPF) == 0) {
|
||||
mode_pars = (uint8_t *)(mph + 1);
|
||||
len = mph->page_length;
|
||||
} else {
|
||||
mphsp = (struct scsi_mode_page_header_sp *)mph;
|
||||
mode_pars = (uint8_t *)(mphsp + 1);
|
||||
len = scsi_2btoul(mphsp->page_length);
|
||||
}
|
||||
|
||||
/* Print the raw mode page data with newlines each 8 bytes. */
|
||||
for (indx = 0; indx < mph->page_length; indx++) {
|
||||
for (indx = 0; indx < len; indx++) {
|
||||
printf("%02x%c",mode_pars[indx],
|
||||
(((indx + 1) % 8) == 0) ? '\n' : ' ');
|
||||
}
|
||||
@ -810,7 +849,7 @@ cleanup_editfile(void)
|
||||
}
|
||||
|
||||
void
|
||||
mode_edit(struct cam_device *device, int page, int page_control, int dbd,
|
||||
mode_edit(struct cam_device *device, int dbd, int pc, int page, int subpage,
|
||||
int edit, int binary, int retry_count, int timeout)
|
||||
{
|
||||
const char *pagedb_path; /* Path to modepage database. */
|
||||
@ -822,15 +861,17 @@ mode_edit(struct cam_device *device, int page, int page_control, int dbd,
|
||||
if ((pagedb_path = getenv("SCSI_MODES")) == NULL)
|
||||
pagedb_path = DEFAULT_SCSI_MODE_DB;
|
||||
|
||||
if (load_format(pagedb_path, page) != 0 && (edit || verbose)) {
|
||||
if (load_format(pagedb_path, page, subpage) != 0 &&
|
||||
(edit || verbose)) {
|
||||
if (errno == ENOENT) {
|
||||
/* Modepage database file not found. */
|
||||
warn("cannot open modepage database \"%s\"",
|
||||
pagedb_path);
|
||||
} else if (errno == ESRCH) {
|
||||
/* Modepage entry not found in database. */
|
||||
warnx("modepage %d not found in database"
|
||||
"\"%s\"", page, pagedb_path);
|
||||
warnx("modepage 0x%02x,0x%02x not found in "
|
||||
"database \"%s\"", page, subpage,
|
||||
pagedb_path);
|
||||
}
|
||||
/* We can recover in display mode, otherwise we exit. */
|
||||
if (!edit) {
|
||||
@ -840,22 +881,20 @@ mode_edit(struct cam_device *device, int page, int page_control, int dbd,
|
||||
exit(EX_OSFILE);
|
||||
}
|
||||
|
||||
editlist_populate(device, page, page_control, dbd, retry_count,
|
||||
editlist_populate(device, dbd, pc, page, subpage, retry_count,
|
||||
timeout);
|
||||
}
|
||||
|
||||
if (edit) {
|
||||
if (page_control << PAGE_CTRL_SHIFT != SMS_PAGE_CTRL_CURRENT &&
|
||||
page_control << PAGE_CTRL_SHIFT != SMS_PAGE_CTRL_SAVED)
|
||||
if (pc << PAGE_CTRL_SHIFT != SMS_PAGE_CTRL_CURRENT &&
|
||||
pc << PAGE_CTRL_SHIFT != SMS_PAGE_CTRL_SAVED)
|
||||
errx(EX_USAGE, "it only makes sense to edit page 0 "
|
||||
"(current) or page 3 (saved values)");
|
||||
modepage_edit();
|
||||
editlist_save(device, page, page_control, dbd, retry_count,
|
||||
timeout);
|
||||
editlist_save(device, dbd, pc, page, subpage, retry_count, timeout);
|
||||
} else if (binary || STAILQ_EMPTY(&editlist)) {
|
||||
/* Display without formatting information. */
|
||||
modepage_dump(device, page, page_control, dbd, retry_count,
|
||||
timeout);
|
||||
modepage_dump(device, dbd, pc, page, subpage, retry_count, timeout);
|
||||
} else {
|
||||
/* Display with format. */
|
||||
modepage_write(stdout, 0);
|
||||
@ -863,44 +902,55 @@ mode_edit(struct cam_device *device, int page, int page_control, int dbd,
|
||||
}
|
||||
|
||||
void
|
||||
mode_list(struct cam_device *device, int page_control, int dbd,
|
||||
mode_list(struct cam_device *device, int dbd, int pc, int subpages,
|
||||
int retry_count, int timeout)
|
||||
{
|
||||
u_int8_t data[MAX_COMMAND_SIZE];/* Buffer to hold sense data. */
|
||||
struct scsi_mode_header_6 *mh; /* Location of mode header. */
|
||||
struct scsi_mode_page_header *mph;
|
||||
struct scsi_mode_page_header_sp *mphsp;
|
||||
struct pagename *nameentry;
|
||||
const char *pagedb_path;
|
||||
int len;
|
||||
int len, page, subpage;
|
||||
|
||||
if ((pagedb_path = getenv("SCSI_MODES")) == NULL)
|
||||
pagedb_path = DEFAULT_SCSI_MODE_DB;
|
||||
|
||||
if (load_format(pagedb_path, 0) != 0 && verbose && errno == ENOENT) {
|
||||
if (load_format(pagedb_path, 0, 0) != 0 && verbose && errno == ENOENT) {
|
||||
/* Modepage database file not found. */
|
||||
warn("cannot open modepage database \"%s\"", pagedb_path);
|
||||
}
|
||||
|
||||
/* Build the list of all mode pages by querying the "all pages" page. */
|
||||
mode_sense(device, SMS_ALL_PAGES_PAGE, page_control, dbd, retry_count,
|
||||
timeout, data, sizeof(data));
|
||||
mode_sense(device, dbd, pc, SMS_ALL_PAGES_PAGE,
|
||||
subpages ? SMS_SUBPAGE_ALL : 0,
|
||||
retry_count, timeout, data, sizeof(data));
|
||||
|
||||
mh = (struct scsi_mode_header_6 *)data;
|
||||
len = sizeof(*mh) + mh->blk_desc_len; /* Skip block descriptors. */
|
||||
/* Iterate through the pages in the reply. */
|
||||
while (len < mh->data_length) {
|
||||
/* Locate the next mode page header. */
|
||||
mph = (struct scsi_mode_page_header *)
|
||||
((intptr_t)mh + len);
|
||||
mph = (struct scsi_mode_page_header *)((intptr_t)mh + len);
|
||||
|
||||
mph->page_code &= SMS_PAGE_CODE;
|
||||
nameentry = nameentry_lookup(mph->page_code);
|
||||
if ((mph->page_code & SMPH_SPF) == 0) {
|
||||
page = mph->page_code & SMS_PAGE_CODE;
|
||||
subpage = 0;
|
||||
len += sizeof(*mph) + mph->page_length;
|
||||
} else {
|
||||
mphsp = (struct scsi_mode_page_header_sp *)mph;
|
||||
page = mphsp->page_code & SMS_PAGE_CODE;
|
||||
subpage = mphsp->subpage;
|
||||
len += sizeof(*mphsp) + scsi_2btoul(mphsp->page_length);
|
||||
}
|
||||
|
||||
if (nameentry == NULL || nameentry->name == NULL)
|
||||
printf("0x%02x\n", mph->page_code);
|
||||
else
|
||||
printf("0x%02x\t%s\n", mph->page_code,
|
||||
nameentry->name);
|
||||
len += mph->page_length + sizeof(*mph);
|
||||
nameentry = nameentry_lookup(page, subpage);
|
||||
if (subpage == 0) {
|
||||
printf("0x%02x\t%s\n", page,
|
||||
nameentry ? nameentry->name : "");
|
||||
} else {
|
||||
printf("0x%02x,0x%02x\t%s\n", page, subpage,
|
||||
nameentry ? nameentry->name : "");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -119,6 +119,7 @@
|
||||
#define IEEE80211_NODE_ASSOCID 0x020000 /* xmit requires associd */
|
||||
#define IEEE80211_NODE_AMSDU_RX 0x040000 /* AMSDU rx enabled */
|
||||
#define IEEE80211_NODE_AMSDU_TX 0x080000 /* AMSDU tx enabled */
|
||||
#define IEEE80211_NODE_VHT 0x100000 /* VHT enabled */
|
||||
#endif
|
||||
|
||||
#define MAXCHAN 1536 /* max 1.5K channels */
|
||||
@ -143,7 +144,9 @@ static const char *modename[IEEE80211_MODE_MAX] = {
|
||||
[IEEE80211_MODE_11NA] = "11na",
|
||||
[IEEE80211_MODE_11NG] = "11ng",
|
||||
[IEEE80211_MODE_HALF] = "half",
|
||||
[IEEE80211_MODE_QUARTER] = "quarter"
|
||||
[IEEE80211_MODE_QUARTER] = "quarter",
|
||||
[IEEE80211_MODE_VHT_2GHZ] = "11acg",
|
||||
[IEEE80211_MODE_VHT_5GHZ] = "11ac",
|
||||
};
|
||||
|
||||
static void set80211(int s, int type, int val, int len, void *data);
|
||||
@ -183,6 +186,20 @@ gethtconf(int s)
|
||||
gothtconf = 1;
|
||||
}
|
||||
|
||||
/* VHT */
|
||||
static int vhtconf = 0;
|
||||
static int gotvhtconf = 0;
|
||||
|
||||
static void
|
||||
getvhtconf(int s)
|
||||
{
|
||||
if (gotvhtconf)
|
||||
return;
|
||||
if (get80211val(s, IEEE80211_IOC_VHTCONF, &vhtconf) < 0)
|
||||
warn("unable to get VHT configuration information");
|
||||
gotvhtconf = 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* Collect channel info from the kernel. We use this (mostly)
|
||||
* to handle mapping between frequency and IEEE channel number.
|
||||
@ -200,6 +217,7 @@ getchaninfo(int s)
|
||||
err(1, "unable to get channel information");
|
||||
ifmr = ifmedia_getstate(s);
|
||||
gethtconf(s);
|
||||
getvhtconf(s);
|
||||
}
|
||||
|
||||
static struct regdata *
|
||||
@ -255,6 +273,9 @@ canpromote(int i, int from, int to)
|
||||
* channe list (e.g. mode 11a); we want to honor that to avoid
|
||||
* confusing behaviour.
|
||||
*/
|
||||
/*
|
||||
* XXX VHT
|
||||
*/
|
||||
static int
|
||||
promote(int i)
|
||||
{
|
||||
@ -361,6 +382,10 @@ getcurchan(int s)
|
||||
static enum ieee80211_phymode
|
||||
chan2mode(const struct ieee80211_channel *c)
|
||||
{
|
||||
if (IEEE80211_IS_CHAN_VHTA(c))
|
||||
return IEEE80211_MODE_VHT_5GHZ;
|
||||
if (IEEE80211_IS_CHAN_VHTG(c))
|
||||
return IEEE80211_MODE_VHT_2GHZ;
|
||||
if (IEEE80211_IS_CHAN_HTA(c))
|
||||
return IEEE80211_MODE_11NA;
|
||||
if (IEEE80211_IS_CHAN_HTG(c))
|
||||
@ -502,9 +527,12 @@ setregdomain_cb(int s, void *arg)
|
||||
printf("drivercaps: 0x%x\n", dc->dc_drivercaps);
|
||||
printf("cryptocaps: 0x%x\n", dc->dc_cryptocaps);
|
||||
printf("htcaps : 0x%x\n", dc->dc_htcaps);
|
||||
printf("vhtcaps : 0x%x\n", dc->dc_vhtcaps);
|
||||
#if 0
|
||||
memcpy(chaninfo, &dc->dc_chaninfo,
|
||||
IEEE80211_CHANINFO_SPACE(&dc->dc_chaninfo));
|
||||
print_channels(s, &dc->dc_chaninfo, 1/*allchans*/, 1/*verbose*/);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
req = malloc(IEEE80211_REGDOMAIN_SIZE(dc->dc_chaninfo.ic_nchans));
|
||||
@ -616,6 +644,7 @@ getchannelflags(const char *val, int freq)
|
||||
#define _CHAN_HT 0x80000000
|
||||
const char *cp;
|
||||
int flags;
|
||||
int is_vht = 0;
|
||||
|
||||
flags = 0;
|
||||
|
||||
@ -636,6 +665,9 @@ getchannelflags(const char *val, int freq)
|
||||
case 'g': /* 802.11g */
|
||||
flags |= IEEE80211_CHAN_G;
|
||||
break;
|
||||
case 'v': /* vht: 802.11ac */
|
||||
is_vht = 1;
|
||||
/* Fallthrough */
|
||||
case 'h': /* ht = 802.11n */
|
||||
case 'n': /* 802.11n */
|
||||
flags |= _CHAN_HT; /* NB: private */
|
||||
@ -674,6 +706,15 @@ getchannelflags(const char *val, int freq)
|
||||
flags |= IEEE80211_CHAN_HT20;
|
||||
break;
|
||||
case 40:
|
||||
case 80:
|
||||
case 160:
|
||||
/* Handle the 80/160 VHT flag */
|
||||
if (cw == 80)
|
||||
flags |= IEEE80211_CHAN_VHT80;
|
||||
else if (cw == 160)
|
||||
flags |= IEEE80211_CHAN_VHT160;
|
||||
|
||||
/* Fallthrough */
|
||||
if (ep != NULL && *ep == '+')
|
||||
flags |= IEEE80211_CHAN_HT40U;
|
||||
else if (ep != NULL && *ep == '-')
|
||||
@ -683,6 +724,7 @@ getchannelflags(const char *val, int freq)
|
||||
errx(-1, "%s: Invalid channel width\n", val);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Cleanup specifications.
|
||||
*/
|
||||
@ -695,6 +737,7 @@ getchannelflags(const char *val, int freq)
|
||||
* are also usable for legacy operation; e.g. freq:n/40.
|
||||
*/
|
||||
flags &= ~IEEE80211_CHAN_HT;
|
||||
flags &= ~IEEE80211_CHAN_VHT;
|
||||
} else {
|
||||
/*
|
||||
* Remove private indicator that this is an HT channel
|
||||
@ -714,6 +757,25 @@ getchannelflags(const char *val, int freq)
|
||||
mapchan(&chan, freq, 0);
|
||||
flags |= (chan.ic_flags & IEEE80211_CHAN_HT);
|
||||
}
|
||||
|
||||
/*
|
||||
* If VHT is enabled, then also set the VHT flag and the
|
||||
* relevant channel up/down.
|
||||
*/
|
||||
if (is_vht && (flags & IEEE80211_CHAN_HT)) {
|
||||
/*
|
||||
* XXX yes, maybe we should just have VHT, and reuse
|
||||
* HT20/HT40U/HT40D
|
||||
*/
|
||||
if (flags & IEEE80211_CHAN_VHT80)
|
||||
;
|
||||
else if (flags & IEEE80211_CHAN_HT20)
|
||||
flags |= IEEE80211_CHAN_VHT20;
|
||||
else if (flags & IEEE80211_CHAN_HT40U)
|
||||
flags |= IEEE80211_CHAN_VHT40U;
|
||||
else if (flags & IEEE80211_CHAN_HT40D)
|
||||
flags |= IEEE80211_CHAN_VHT40D;
|
||||
}
|
||||
}
|
||||
return flags;
|
||||
#undef _CHAN_HT
|
||||
@ -1447,6 +1509,10 @@ getmodeflags(const char *val)
|
||||
case 'q': /* 1/4-width channels */
|
||||
flags |= IEEE80211_CHAN_QUARTER;
|
||||
break;
|
||||
case 'v':
|
||||
/* XXX set HT too? */
|
||||
flags |= IEEE80211_CHAN_VHT;
|
||||
break;
|
||||
default:
|
||||
errx(-1, "%s: Invalid mode attribute %c\n",
|
||||
val, *cp);
|
||||
@ -1863,6 +1929,21 @@ set80211rifs(const char *val, int d, int s, const struct afswtch *rafp)
|
||||
set80211(s, IEEE80211_IOC_RIFS, d, 0, NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
set80211vhtconf(const char *val, int d, int s, const struct afswtch *rafp)
|
||||
{
|
||||
if (get80211val(s, IEEE80211_IOC_VHTCONF, &vhtconf) < 0)
|
||||
errx(-1, "cannot set VHT setting");
|
||||
printf("%s: vhtconf=0x%08x, d=%d\n", __func__, vhtconf, d);
|
||||
if (d < 0) {
|
||||
d = -d;
|
||||
vhtconf &= ~d;
|
||||
} else
|
||||
vhtconf |= d;
|
||||
printf("%s: vhtconf is now 0x%08x\n", __func__, vhtconf);
|
||||
set80211(s, IEEE80211_IOC_VHTCONF, vhtconf, 0, NULL);
|
||||
}
|
||||
|
||||
static
|
||||
DECL_CMD_FUNC(set80211tdmaslot, val, d)
|
||||
{
|
||||
@ -2035,6 +2116,7 @@ regdomain_addchans(struct ieee80211req_chaninfo *ci,
|
||||
hi_adj = (chanFlags & IEEE80211_CHAN_HT40U) ? -20 : 0;
|
||||
lo_adj = (chanFlags & IEEE80211_CHAN_HT40D) ? 20 : 0;
|
||||
channelSep = (chanFlags & IEEE80211_CHAN_2GHZ) ? 0 : 40;
|
||||
|
||||
LIST_FOREACH(nb, bands, next) {
|
||||
b = nb->band;
|
||||
if (verbose) {
|
||||
@ -2045,6 +2127,7 @@ regdomain_addchans(struct ieee80211req_chaninfo *ci,
|
||||
putchar('\n');
|
||||
}
|
||||
prev = NULL;
|
||||
|
||||
for (freq = b->freqStart + lo_adj;
|
||||
freq <= b->freqEnd + hi_adj; freq += b->chanSep) {
|
||||
/*
|
||||
@ -2055,6 +2138,40 @@ regdomain_addchans(struct ieee80211req_chaninfo *ci,
|
||||
* then constrained according by channel separation.
|
||||
*/
|
||||
flags = nb->flags | b->flags;
|
||||
|
||||
/*
|
||||
* VHT first - HT is a subset.
|
||||
*
|
||||
* XXX TODO: VHT80p80, VHT160 is not yet done.
|
||||
*/
|
||||
if (flags & IEEE80211_CHAN_VHT) {
|
||||
if ((chanFlags & IEEE80211_CHAN_VHT20) &&
|
||||
(flags & IEEE80211_CHAN_VHT20) == 0) {
|
||||
if (verbose)
|
||||
printf("%u: skip, not a "
|
||||
"VHT20 channel\n", freq);
|
||||
continue;
|
||||
}
|
||||
if ((chanFlags & IEEE80211_CHAN_VHT40) &&
|
||||
(flags & IEEE80211_CHAN_VHT40) == 0) {
|
||||
if (verbose)
|
||||
printf("%u: skip, not a "
|
||||
"VHT40 channel\n", freq);
|
||||
continue;
|
||||
}
|
||||
if ((chanFlags & IEEE80211_CHAN_VHT80) &&
|
||||
(flags & IEEE80211_CHAN_VHT80) == 0) {
|
||||
if (verbose)
|
||||
printf("%u: skip, not a "
|
||||
"VHT80 channel\n", freq);
|
||||
continue;
|
||||
}
|
||||
|
||||
flags &= ~IEEE80211_CHAN_VHT;
|
||||
flags |= chanFlags & IEEE80211_CHAN_VHT;
|
||||
}
|
||||
|
||||
/* Now, constrain HT */
|
||||
if (flags & IEEE80211_CHAN_HT) {
|
||||
/*
|
||||
* HT channels are generated specially; we're
|
||||
@ -2127,7 +2244,7 @@ regdomain_addchans(struct ieee80211req_chaninfo *ci,
|
||||
memset(c, 0, sizeof(*c));
|
||||
c->ic_freq = freq;
|
||||
c->ic_flags = flags;
|
||||
if (c->ic_flags & IEEE80211_CHAN_DFS)
|
||||
if (c->ic_flags & IEEE80211_CHAN_DFS)
|
||||
c->ic_maxregpower = nb->maxPowerDFS;
|
||||
else
|
||||
c->ic_maxregpower = nb->maxPower;
|
||||
@ -2204,6 +2321,40 @@ regdomain_makechannels(
|
||||
&dc->dc_chaninfo);
|
||||
}
|
||||
}
|
||||
if (!LIST_EMPTY(&rd->bands_11ac) && dc->dc_vhtcaps != 0) {
|
||||
regdomain_addchans(ci, &rd->bands_11ac, reg,
|
||||
IEEE80211_CHAN_A | IEEE80211_CHAN_HT20 |
|
||||
IEEE80211_CHAN_VHT20,
|
||||
&dc->dc_chaninfo);
|
||||
|
||||
/* VHT40 is a function of HT40.. */
|
||||
if (dc->dc_htcaps & IEEE80211_HTCAP_CHWIDTH40) {
|
||||
regdomain_addchans(ci, &rd->bands_11ac, reg,
|
||||
IEEE80211_CHAN_A | IEEE80211_CHAN_HT40U |
|
||||
IEEE80211_CHAN_VHT40U,
|
||||
&dc->dc_chaninfo);
|
||||
regdomain_addchans(ci, &rd->bands_11ac, reg,
|
||||
IEEE80211_CHAN_A | IEEE80211_CHAN_HT40D |
|
||||
IEEE80211_CHAN_VHT40D,
|
||||
&dc->dc_chaninfo);
|
||||
}
|
||||
|
||||
/* VHT80 */
|
||||
/* XXX dc_vhtcap? */
|
||||
if (1) {
|
||||
regdomain_addchans(ci, &rd->bands_11ac, reg,
|
||||
IEEE80211_CHAN_A | IEEE80211_CHAN_HT40U |
|
||||
IEEE80211_CHAN_VHT80,
|
||||
&dc->dc_chaninfo);
|
||||
regdomain_addchans(ci, &rd->bands_11ac, reg,
|
||||
IEEE80211_CHAN_A | IEEE80211_CHAN_HT40D |
|
||||
IEEE80211_CHAN_VHT80,
|
||||
&dc->dc_chaninfo);
|
||||
}
|
||||
|
||||
/* XXX TODO: VHT80_80, VHT160 */
|
||||
}
|
||||
|
||||
if (!LIST_EMPTY(&rd->bands_11ng) && dc->dc_htcaps != 0) {
|
||||
regdomain_addchans(ci, &rd->bands_11ng, reg,
|
||||
IEEE80211_CHAN_G | IEEE80211_CHAN_HT20,
|
||||
@ -2435,6 +2586,8 @@ getflags(int flags)
|
||||
if (flags & IEEE80211_NODE_HTCOMPAT)
|
||||
*cp++ = '+';
|
||||
}
|
||||
if (flags & IEEE80211_NODE_VHT)
|
||||
*cp++ = 'V';
|
||||
if (flags & IEEE80211_NODE_WPS)
|
||||
*cp++ = 'W';
|
||||
if (flags & IEEE80211_NODE_TSN)
|
||||
@ -3574,14 +3727,31 @@ get_chaninfo(const struct ieee80211_channel *c, int precise,
|
||||
if (IEEE80211_IS_CHAN_TURBO(c))
|
||||
strlcat(buf, " Turbo", bsize);
|
||||
if (precise) {
|
||||
if (IEEE80211_IS_CHAN_HT20(c))
|
||||
/* XXX should make VHT80U, VHT80D */
|
||||
if (IEEE80211_IS_CHAN_VHT80(c) &&
|
||||
IEEE80211_IS_CHAN_HT40D(c))
|
||||
strlcat(buf, " vht/80-", bsize);
|
||||
else if (IEEE80211_IS_CHAN_VHT80(c) &&
|
||||
IEEE80211_IS_CHAN_HT40U(c))
|
||||
strlcat(buf, " vht/80+", bsize);
|
||||
else if (IEEE80211_IS_CHAN_VHT80(c))
|
||||
strlcat(buf, " vht/80", bsize);
|
||||
else if (IEEE80211_IS_CHAN_VHT40D(c))
|
||||
strlcat(buf, " vht/40-", bsize);
|
||||
else if (IEEE80211_IS_CHAN_VHT40U(c))
|
||||
strlcat(buf, " vht/40+", bsize);
|
||||
else if (IEEE80211_IS_CHAN_VHT20(c))
|
||||
strlcat(buf, " vht/20", bsize);
|
||||
else if (IEEE80211_IS_CHAN_HT20(c))
|
||||
strlcat(buf, " ht/20", bsize);
|
||||
else if (IEEE80211_IS_CHAN_HT40D(c))
|
||||
strlcat(buf, " ht/40-", bsize);
|
||||
else if (IEEE80211_IS_CHAN_HT40U(c))
|
||||
strlcat(buf, " ht/40+", bsize);
|
||||
} else {
|
||||
if (IEEE80211_IS_CHAN_HT(c))
|
||||
if (IEEE80211_IS_CHAN_VHT(c))
|
||||
strlcat(buf, " vht", bsize);
|
||||
else if (IEEE80211_IS_CHAN_HT(c))
|
||||
strlcat(buf, " ht", bsize);
|
||||
}
|
||||
return buf;
|
||||
@ -3612,6 +3782,16 @@ print_chaninfo(const struct ieee80211_channel *c, int verb)
|
||||
static int
|
||||
chanpref(const struct ieee80211_channel *c)
|
||||
{
|
||||
if (IEEE80211_IS_CHAN_VHT160(c))
|
||||
return 80;
|
||||
if (IEEE80211_IS_CHAN_VHT80_80(c))
|
||||
return 75;
|
||||
if (IEEE80211_IS_CHAN_VHT80(c))
|
||||
return 70;
|
||||
if (IEEE80211_IS_CHAN_VHT40(c))
|
||||
return 60;
|
||||
if (IEEE80211_IS_CHAN_VHT20(c))
|
||||
return 50;
|
||||
if (IEEE80211_IS_CHAN_HT40(c))
|
||||
return 40;
|
||||
if (IEEE80211_IS_CHAN_HT20(c))
|
||||
@ -3807,6 +3987,11 @@ list_capabilities(int s)
|
||||
putchar('\n');
|
||||
printb("htcaps", dc->dc_htcaps, IEEE80211_HTCAP_BITS);
|
||||
}
|
||||
if (dc->dc_vhtcaps != 0 || verbose) {
|
||||
putchar('\n');
|
||||
printb("vhtcaps", dc->dc_vhtcaps, IEEE80211_VHTCAP_BITS);
|
||||
}
|
||||
|
||||
putchar('\n');
|
||||
if (verbose) {
|
||||
chaninfo = &dc->dc_chaninfo; /* XXX */
|
||||
@ -4847,6 +5032,30 @@ end:
|
||||
}
|
||||
}
|
||||
|
||||
if (IEEE80211_IS_CHAN_VHT(c) || verbose) {
|
||||
getvhtconf(s);
|
||||
if (vhtconf & 0x1)
|
||||
LINE_CHECK("vht");
|
||||
else
|
||||
LINE_CHECK("-vht");
|
||||
if (vhtconf & 0x2)
|
||||
LINE_CHECK("vht40");
|
||||
else
|
||||
LINE_CHECK("-vht40");
|
||||
if (vhtconf & 0x4)
|
||||
LINE_CHECK("vht80");
|
||||
else
|
||||
LINE_CHECK("-vht80");
|
||||
if (vhtconf & 0x8)
|
||||
LINE_CHECK("vht80p80");
|
||||
else
|
||||
LINE_CHECK("-vht80p80");
|
||||
if (vhtconf & 0x10)
|
||||
LINE_CHECK("vht160");
|
||||
else
|
||||
LINE_CHECK("-vht160");
|
||||
}
|
||||
|
||||
if (get80211val(s, IEEE80211_IOC_WME, &wme) != -1) {
|
||||
if (wme)
|
||||
LINE_CHECK("wme");
|
||||
@ -5426,6 +5635,16 @@ static struct cmd ieee80211_cmds[] = {
|
||||
DEF_CMD("-ht40", 0, set80211htconf),
|
||||
DEF_CMD("ht", 3, set80211htconf), /* NB: 20+40 */
|
||||
DEF_CMD("-ht", 0, set80211htconf),
|
||||
DEF_CMD("vht", 1, set80211vhtconf),
|
||||
DEF_CMD("-vht", 0, set80211vhtconf),
|
||||
DEF_CMD("vht40", 2, set80211vhtconf),
|
||||
DEF_CMD("-vht40", -2, set80211vhtconf),
|
||||
DEF_CMD("vht80", 4, set80211vhtconf),
|
||||
DEF_CMD("-vht80", -4, set80211vhtconf),
|
||||
DEF_CMD("vht80p80", 8, set80211vhtconf),
|
||||
DEF_CMD("-vht80p80", -8, set80211vhtconf),
|
||||
DEF_CMD("vht160", 16, set80211vhtconf),
|
||||
DEF_CMD("-vht160", -16, set80211vhtconf),
|
||||
DEF_CMD("rifs", 1, set80211rifs),
|
||||
DEF_CMD("-rifs", 0, set80211rifs),
|
||||
DEF_CMD("smps", IEEE80211_HTCAP_SMPS_ENA, set80211smps),
|
||||
|
@ -1,9 +1,10 @@
|
||||
.\" $FreeBSD$
|
||||
.Dd April 22, 2016
|
||||
.Dd January 7, 2017
|
||||
.Dt MD5 1
|
||||
.Os
|
||||
.Sh NAME
|
||||
.Nm md5 , sha1 , sha256 , sha384 , sha512, sha512t256, rmd160
|
||||
.Nm md5 , sha1 , sha256 , sha384 , sha512 , sha512t256 , rmd160 ,
|
||||
.Nm skein256 , skein512 , skein1024
|
||||
.Nd calculate a message-digest fingerprint (checksum) for a file
|
||||
.Sh SYNOPSIS
|
||||
.Nm md5
|
||||
@ -41,11 +42,27 @@
|
||||
.Op Fl c Ar string
|
||||
.Op Fl s Ar string
|
||||
.Op Ar
|
||||
.Nm skein256
|
||||
.Op Fl pqrtx
|
||||
.Op Fl c Ar string
|
||||
.Op Fl s Ar string
|
||||
.Op Ar
|
||||
.Nm skein512
|
||||
.Op Fl pqrtx
|
||||
.Op Fl c Ar string
|
||||
.Op Fl s Ar string
|
||||
.Op Ar
|
||||
.Nm skein1024
|
||||
.Op Fl pqrtx
|
||||
.Op Fl c Ar string
|
||||
.Op Fl s Ar string
|
||||
.Op Ar
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Nm md5 , sha1 , sha256 , sha384 , sha512, sha512t256
|
||||
.Nm md5 , sha1 , sha256 , sha384 , sha512, sha512t256, rmd160,
|
||||
.Nm skein256, skein512,
|
||||
and
|
||||
.Nm rmd160
|
||||
.Nm skein1024
|
||||
utilities take as input a message of arbitrary length and produce as
|
||||
output a
|
||||
.Dq fingerprint
|
||||
@ -56,9 +73,9 @@ It is conjectured that it is computationally infeasible to
|
||||
produce two messages having the same message digest, or to produce any
|
||||
message having a given prespecified target message digest.
|
||||
The
|
||||
.Tn MD5 , SHA-1 , SHA-256 , SHA-384 , SHA-512
|
||||
.Tn MD5 , SHA-1 , SHA-256 , SHA-384 , SHA-512, RIPEMD-160,
|
||||
and
|
||||
.Tn RIPEMD-160
|
||||
.Tn SKEIN
|
||||
algorithms are intended for digital signature applications, where a
|
||||
large file must be
|
||||
.Dq compressed
|
||||
@ -128,9 +145,10 @@ Run a built-in test script.
|
||||
.El
|
||||
.Sh EXIT STATUS
|
||||
The
|
||||
.Nm md5 , sha1 , sha256 , sha512, sha512t256
|
||||
.Nm md5 , sha1 , sha256 , sha512, sha512t256, rmd160,
|
||||
.Nm skein256, skein512,
|
||||
and
|
||||
.Nm rmd160
|
||||
.Nm skein1024
|
||||
utilities exit 0 on success,
|
||||
1 if at least one of the input files could not be read,
|
||||
and 2 if at least one file does not have the same hash as the
|
||||
@ -143,7 +161,8 @@ option.
|
||||
.Xr sha 3 ,
|
||||
.Xr sha256 3 ,
|
||||
.Xr sha384 3 ,
|
||||
.Xr sha512 3
|
||||
.Xr sha512 3 ,
|
||||
.Xr skein 3
|
||||
.Rs
|
||||
.%A R. Rivest
|
||||
.%T The MD5 Message-Digest Algorithm
|
||||
|
@ -27,7 +27,7 @@ CFLAGS+=-I${SSHDIR} -include ssh_namespace.h
|
||||
SRCS+= ssh_namespace.h
|
||||
|
||||
# pam should always happen before ssh here for static linking
|
||||
LIBADD= pam ssh util wrap
|
||||
LIBADD= pam ssh util
|
||||
|
||||
.if ${MK_LDNS} != "no"
|
||||
CFLAGS+= -DHAVE_LDNS=1
|
||||
@ -53,6 +53,11 @@ SRCS+= krb5_config.h
|
||||
LIBADD+= gssapi_krb5 gssapi krb5
|
||||
.endif
|
||||
|
||||
.if ${MK_TCP_WRAPPERS} != "no"
|
||||
CFLAGS+= -DLIBWRAP
|
||||
LIBADD+= wrap
|
||||
.endif
|
||||
|
||||
LIBADD+= crypto
|
||||
|
||||
.if defined(LOCALBASE)
|
||||
|
@ -1,7 +1,7 @@
|
||||
.\" DO NOT EDIT-- this file is automatically generated.
|
||||
.\" from FreeBSD: head/tools/build/options/makeman 306729 2016-10-05 20:12:00Z emaste
|
||||
.\" $FreeBSD$
|
||||
.Dd January 2, 2017
|
||||
.Dd January 6, 2017
|
||||
.Dt SRC.CONF 5
|
||||
.Os
|
||||
.Sh NAME
|
||||
@ -1628,7 +1628,7 @@ and related programs.
|
||||
.\" from FreeBSD: head/tools/build/options/WITHOUT_USB 156932 2006-03-21 07:50:50Z ru
|
||||
Set to not build USB-related programs and libraries.
|
||||
.It Va WITHOUT_USB_GADGET_EXAMPLES
|
||||
.\" from FreeBSD: head/tools/build/options/WITHOUT_USB_GADGET_EXAMPLES 274665 2014-11-18 17:06:50Z imp
|
||||
.\" from FreeBSD: head/tools/build/options/WITHOUT_USB_GADGET_EXAMPLES 311548 2017-01-06 21:08:19Z ngie
|
||||
Set to not build USB gadget kernel modules.
|
||||
.It Va WITHOUT_UTMPX
|
||||
.\" from FreeBSD: head/tools/build/options/WITHOUT_UTMPX 231530 2012-02-11 20:28:42Z ed
|
||||
|
@ -49,7 +49,11 @@
|
||||
|
||||
# ALL DEVICE TYPES
|
||||
|
||||
0x0a "Control Mode Page" {
|
||||
0x0a,0x03 "Command Duration Limit A";
|
||||
|
||||
0x0a,0x04 "Command Duration Limit B";
|
||||
|
||||
0x0a "Control" {
|
||||
{TST} t3
|
||||
{TMF_ONLY} t1
|
||||
{DPICZ} t1
|
||||
@ -78,7 +82,18 @@
|
||||
{Extended Self-Test Completion Time} i2
|
||||
}
|
||||
|
||||
0x02 "Disconnect-Reconnect Page" {
|
||||
0x0a,0x01 "Control Extension" {
|
||||
{Reserved} *t4
|
||||
{DLC} t1
|
||||
{TCMOS} t1
|
||||
{SCSIP} t1
|
||||
{IALUAE} t1
|
||||
{Reserved} *t4
|
||||
{Initial Command Priority} t4
|
||||
{Maximum Sense Data Length} i1
|
||||
}
|
||||
|
||||
0x02 "Disconnect-Reconnect" {
|
||||
{Buffer Full Ratio} i1
|
||||
{Buffer Empty Ratio} i1
|
||||
{Bus Inactivity Limit} i2
|
||||
@ -92,26 +107,11 @@
|
||||
{Reserved} *i1
|
||||
}
|
||||
|
||||
0x15 "Extended Page";
|
||||
0x15 "Extended";
|
||||
|
||||
0x16 "Extended Device-Type Specific Page";
|
||||
0x16 "Extended Device-Type Specific";
|
||||
|
||||
0x1c "Informational Exceptions Control Page" {
|
||||
{PERF} t1
|
||||
{Reserved} *t1
|
||||
{EBF} t1
|
||||
{EWasc} t1
|
||||
{DExcpt} t1
|
||||
{TEST} t1
|
||||
{EBACKERR} t1
|
||||
{LogErr} t1
|
||||
{Reserved} *t4
|
||||
{MRIE} t4
|
||||
{Interval Timer} i4
|
||||
{Report Count} i4
|
||||
}
|
||||
|
||||
0x09 "Peripheral Device Page" {
|
||||
0x09 "Peripheral Device" {
|
||||
{Interface Identifier} i2
|
||||
{Reserved} *i1
|
||||
{Reserved} *i1
|
||||
@ -119,21 +119,69 @@
|
||||
{Reserved} *i1
|
||||
}
|
||||
|
||||
0x1a "Power Condition Page" {
|
||||
{Reserved} *i1
|
||||
0x1a "Power Condition" {
|
||||
{PM_BG_PRECEDENCE} t1
|
||||
{Reserved} *t6
|
||||
{Idle} t1
|
||||
{Standby} t1
|
||||
{Idle Condition Timer} i4
|
||||
{Standby Condition Timer} i4
|
||||
{STANDBY_Y} t1
|
||||
{Reserved} *t4
|
||||
{IDLE_C} t1
|
||||
{IDLE_B} t1
|
||||
{IDLE_A} t1
|
||||
{STANDBY_Z} t1
|
||||
{IDLE_A Condition Timer} i4
|
||||
{STANDBY_Z Condition Timer} i4
|
||||
{IDLE_B Condition Timer} i4
|
||||
{IDLE_C Condition Timer} i4
|
||||
{STANDBY_Y Condition Timer} i4
|
||||
{Reserved} *i4
|
||||
{Reserved} *i4
|
||||
{Reserved} *i4
|
||||
{Reserved} *i3
|
||||
{CCF Idle} t2
|
||||
{CCF Standby} t2
|
||||
{CCF Stopped} t2
|
||||
{Reserved} *t2
|
||||
}
|
||||
|
||||
0x18 "Protocol-Specific LUN Page";
|
||||
0x1a,0x01 "Power Consumption" {
|
||||
{Reserved} *i2
|
||||
{Reserved} *t6
|
||||
{Active Level} t2
|
||||
{Power Consumption Identifier} i1
|
||||
{Reserved} *i4
|
||||
{Reserved} *i4
|
||||
}
|
||||
|
||||
0x19 "Protocol-Specific Port Page";
|
||||
0x18 "Protocol-Specific Logical Unit";
|
||||
|
||||
0x19 "Protocol-Specific Port";
|
||||
|
||||
# DIRECT ACCESS DEVICES
|
||||
0x08 "Caching Page" {
|
||||
|
||||
0x0a,0x02 "Application Tag";
|
||||
|
||||
0x1a,0xf1 "ATA Power Condition";
|
||||
|
||||
0x1c,0x01 "Background Control" {
|
||||
{Reserved} *t5
|
||||
{S_L_FULL} *t1
|
||||
{LOWIR} *t1
|
||||
{EN_BMS} *t1
|
||||
{Reserved} *t7
|
||||
{EN_PS} *t1
|
||||
{Background Medium Scan Interval Time} i2
|
||||
{Background Pre-Scan Time Limit} i2
|
||||
{Minimum Idle Time Before Background Scan} i2
|
||||
{Maximum Time To Suspend Background Scan} i2
|
||||
{Reserved} *i2
|
||||
}
|
||||
|
||||
0x0a,0x06 "Background Operation Control" {
|
||||
{BO_MODE} t2
|
||||
{Reserved} *t6
|
||||
}
|
||||
|
||||
0x08 "Caching" {
|
||||
{IC} t1
|
||||
{ABPF} t1
|
||||
{CAP} t1
|
||||
@ -159,7 +207,7 @@
|
||||
{Reserved} *t4
|
||||
}
|
||||
|
||||
0x05 "Flexible Disk Page" {
|
||||
0x05 "Flexible Disk" {
|
||||
{Transfer rate} i2
|
||||
{Number of heads} i1
|
||||
{Sectors per track} i1
|
||||
@ -190,7 +238,7 @@
|
||||
{Reserved} *i1
|
||||
}
|
||||
|
||||
0x03 "Format Device Page" {
|
||||
0x03 "Format Device" {
|
||||
{Tracks per Zone} i2
|
||||
{Alternate Sectors per Zone} i2
|
||||
{Alternate Tracks per Zone} i2
|
||||
@ -207,7 +255,34 @@
|
||||
{Reserved} *t4
|
||||
}
|
||||
|
||||
0x0b "Medium Types Supported Page" {
|
||||
0x0a,0x05 "I/O Advice Hints Grouping";
|
||||
|
||||
0x1c "Informational Exceptions Control" {
|
||||
{PERF} t1
|
||||
{Reserved} *t1
|
||||
{EBF} t1
|
||||
{EWasc} t1
|
||||
{DExcpt} t1
|
||||
{TEST} t1
|
||||
{EBACKERR} t1
|
||||
{LogErr} t1
|
||||
{Reserved} *t4
|
||||
{MRIE} t4
|
||||
{Interval Timer} i4
|
||||
{Report Count} i4
|
||||
}
|
||||
|
||||
0x1c,0x02 "Logical Block Provisioning" {
|
||||
{Reserved} *t7
|
||||
{SITUA} t1
|
||||
{Reserved} *i1
|
||||
{Reserved} *i1
|
||||
{Reserved} *i1
|
||||
{Reserved} *i4
|
||||
{Reserved} *i4
|
||||
}
|
||||
|
||||
0x0b "Medium Types Supported" {
|
||||
{Reserved} *i1
|
||||
{Reserved} *i1
|
||||
{Medium type one supported} i1
|
||||
@ -216,10 +291,11 @@
|
||||
{Medium type four supported} i1
|
||||
}
|
||||
|
||||
# Notch page (0x0c)
|
||||
0x0c "Notch and Partition Page";
|
||||
0x0c "Notch and Partition";
|
||||
|
||||
0x01 "Read-Write Error Recovery Page" {
|
||||
0x0a,0xf1 "PATA Control";
|
||||
|
||||
0x01 "Read-Write Error Recovery" {
|
||||
{AWRE (Auto Write Reallocation Enbld)} t1
|
||||
{ARRE (Auto Read Reallocation Enbld)} t1
|
||||
{TB (Transfer Block)} t1
|
||||
@ -240,7 +316,7 @@
|
||||
{Recovery Time Limit} i2
|
||||
}
|
||||
|
||||
0x04 "Rigid Disk Drive Geometry Page" {
|
||||
0x04 "Rigid Disk Drive Geometry" {
|
||||
{Number of Cylinders} i3
|
||||
{Number of Heads} i1
|
||||
{Starting Cylinder-Write Precompensation} i3
|
||||
@ -256,7 +332,7 @@
|
||||
{Reserved} *i1
|
||||
}
|
||||
|
||||
0x07 "Verify Error Recovery Page" {
|
||||
0x07 "Verify Error Recovery" {
|
||||
{Reserved} *t4
|
||||
{EER} t1
|
||||
{PER} t1
|
||||
@ -272,7 +348,7 @@
|
||||
{Verify Recovery Time Limit} i2
|
||||
}
|
||||
|
||||
0x0E "CD-ROM Audio Control Parameters Page" {
|
||||
0x0E "CD-ROM Audio Control Parameters" {
|
||||
{Reserved} *t5
|
||||
{Immed} t1
|
||||
{SOTC} t1
|
||||
@ -297,7 +373,7 @@
|
||||
}
|
||||
|
||||
# SEQUENTIAL ACCESS DEVICES
|
||||
0x10 "Device Configuration Page" {
|
||||
0x10 "Device Configuration" {
|
||||
{Reserved} *t1
|
||||
{Change Active Partition} t1
|
||||
{Change Active Format} t1
|
||||
@ -326,7 +402,7 @@
|
||||
{SCSI-3 Permanent Write Protect} t1
|
||||
}
|
||||
|
||||
0x0f "Data Compression Page" {
|
||||
0x0f "Data Compression" {
|
||||
{Data Compression Enabled} t1
|
||||
{Date Compression Capable} t1
|
||||
{Reserved} *t6
|
||||
@ -339,7 +415,7 @@
|
||||
}
|
||||
|
||||
# Removable devices
|
||||
0x1b "Removable Block Access Capacities Page" {
|
||||
0x1b "Removable Block Access Capacities" {
|
||||
{System Floppy Type Device} t1
|
||||
{Supports Reporting Format Progress} t1
|
||||
{Reserved} *t6
|
||||
@ -351,7 +427,7 @@
|
||||
}
|
||||
|
||||
# CD-ROM (and CD-R[W]) devices
|
||||
0x2a "CD capabilities and mechanical status page" {
|
||||
0x2a "CD capabilities and mechanical status" {
|
||||
{Reserved} *t4
|
||||
{Method 2} t1
|
||||
{CD-RW Read} t1
|
||||
|
@ -2779,32 +2779,29 @@ ctl_ioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flag,
|
||||
break;
|
||||
}
|
||||
case CTL_GETSTATS: {
|
||||
struct ctl_stats *stats;
|
||||
struct ctl_stats *stats = (struct ctl_stats *)addr;
|
||||
int i;
|
||||
|
||||
stats = (struct ctl_stats *)addr;
|
||||
|
||||
if ((sizeof(struct ctl_lun_io_stats) * softc->num_luns) >
|
||||
stats->alloc_len) {
|
||||
stats->status = CTL_SS_NEED_MORE_SPACE;
|
||||
stats->num_luns = softc->num_luns;
|
||||
break;
|
||||
}
|
||||
/*
|
||||
* XXX KDM no locking here. If the LUN list changes,
|
||||
* things can blow up.
|
||||
*/
|
||||
i = 0;
|
||||
stats->status = CTL_SS_OK;
|
||||
stats->fill_len = 0;
|
||||
STAILQ_FOREACH(lun, &softc->lun_list, links) {
|
||||
if (stats->fill_len + sizeof(lun->stats) >
|
||||
stats->alloc_len) {
|
||||
stats->status = CTL_SS_NEED_MORE_SPACE;
|
||||
break;
|
||||
}
|
||||
retval = copyout(&lun->stats, &stats->lun_stats[i++],
|
||||
sizeof(lun->stats));
|
||||
if (retval != 0)
|
||||
break;
|
||||
stats->fill_len += sizeof(lun->stats);
|
||||
}
|
||||
stats->num_luns = softc->num_luns;
|
||||
stats->fill_len = sizeof(struct ctl_lun_io_stats) *
|
||||
softc->num_luns;
|
||||
stats->status = CTL_SS_OK;
|
||||
#ifdef CTL_TIME_IO
|
||||
stats->flags = CTL_STATS_FLAG_TIME_VALID;
|
||||
#else
|
||||
|
@ -7622,24 +7622,34 @@ scsi_inquiry(struct ccb_scsiio *csio, u_int32_t retries,
|
||||
}
|
||||
|
||||
void
|
||||
scsi_mode_sense(struct ccb_scsiio *csio, u_int32_t retries,
|
||||
void (*cbfcnp)(struct cam_periph *, union ccb *),
|
||||
u_int8_t tag_action, int dbd, u_int8_t page_code,
|
||||
u_int8_t page, u_int8_t *param_buf, u_int32_t param_len,
|
||||
u_int8_t sense_len, u_int32_t timeout)
|
||||
scsi_mode_sense(struct ccb_scsiio *csio, uint32_t retries,
|
||||
void (*cbfcnp)(struct cam_periph *, union ccb *), uint8_t tag_action,
|
||||
int dbd, uint8_t pc, uint8_t page, uint8_t *param_buf, uint32_t param_len,
|
||||
uint8_t sense_len, uint32_t timeout)
|
||||
{
|
||||
|
||||
scsi_mode_sense_len(csio, retries, cbfcnp, tag_action, dbd,
|
||||
page_code, page, param_buf, param_len, 0,
|
||||
sense_len, timeout);
|
||||
scsi_mode_sense_subpage(csio, retries, cbfcnp, tag_action, dbd,
|
||||
pc, page, 0, param_buf, param_len, 0, sense_len, timeout);
|
||||
}
|
||||
|
||||
void
|
||||
scsi_mode_sense_len(struct ccb_scsiio *csio, u_int32_t retries,
|
||||
void (*cbfcnp)(struct cam_periph *, union ccb *),
|
||||
u_int8_t tag_action, int dbd, u_int8_t page_code,
|
||||
u_int8_t page, u_int8_t *param_buf, u_int32_t param_len,
|
||||
int minimum_cmd_size, u_int8_t sense_len, u_int32_t timeout)
|
||||
scsi_mode_sense_len(struct ccb_scsiio *csio, uint32_t retries,
|
||||
void (*cbfcnp)(struct cam_periph *, union ccb *), uint8_t tag_action,
|
||||
int dbd, uint8_t pc, uint8_t page, uint8_t *param_buf, uint32_t param_len,
|
||||
int minimum_cmd_size, uint8_t sense_len, uint32_t timeout)
|
||||
{
|
||||
|
||||
scsi_mode_sense_subpage(csio, retries, cbfcnp, tag_action, dbd,
|
||||
pc, page, 0, param_buf, param_len, minimum_cmd_size,
|
||||
sense_len, timeout);
|
||||
}
|
||||
|
||||
void
|
||||
scsi_mode_sense_subpage(struct ccb_scsiio *csio, uint32_t retries,
|
||||
void (*cbfcnp)(struct cam_periph *, union ccb *), uint8_t tag_action,
|
||||
int dbd, uint8_t pc, uint8_t page, uint8_t subpage, uint8_t *param_buf,
|
||||
uint32_t param_len, int minimum_cmd_size, uint8_t sense_len,
|
||||
uint32_t timeout)
|
||||
{
|
||||
u_int8_t cdb_len;
|
||||
|
||||
@ -7658,7 +7668,8 @@ scsi_mode_sense_len(struct ccb_scsiio *csio, u_int32_t retries,
|
||||
scsi_cmd->opcode = MODE_SENSE_6;
|
||||
if (dbd != 0)
|
||||
scsi_cmd->byte2 |= SMS_DBD;
|
||||
scsi_cmd->page = page_code | page;
|
||||
scsi_cmd->page = pc | page;
|
||||
scsi_cmd->subpage = subpage;
|
||||
scsi_cmd->length = param_len;
|
||||
cdb_len = sizeof(*scsi_cmd);
|
||||
} else {
|
||||
@ -7672,7 +7683,8 @@ scsi_mode_sense_len(struct ccb_scsiio *csio, u_int32_t retries,
|
||||
scsi_cmd->opcode = MODE_SENSE_10;
|
||||
if (dbd != 0)
|
||||
scsi_cmd->byte2 |= SMS_DBD;
|
||||
scsi_cmd->page = page_code | page;
|
||||
scsi_cmd->page = pc | page;
|
||||
scsi_cmd->subpage = subpage;
|
||||
scsi_ulto2b(param_len, scsi_cmd->length);
|
||||
cdb_len = sizeof(*scsi_cmd);
|
||||
}
|
||||
|
@ -3977,21 +3977,24 @@ void scsi_inquiry(struct ccb_scsiio *csio, u_int32_t retries,
|
||||
u_int8_t sense_len, u_int32_t timeout);
|
||||
|
||||
void scsi_mode_sense(struct ccb_scsiio *csio, u_int32_t retries,
|
||||
void (*cbfcnp)(struct cam_periph *,
|
||||
union ccb *),
|
||||
u_int8_t tag_action, int dbd,
|
||||
u_int8_t page_code, u_int8_t page,
|
||||
u_int8_t *param_buf, u_int32_t param_len,
|
||||
u_int8_t sense_len, u_int32_t timeout);
|
||||
void (*cbfcnp)(struct cam_periph *, union ccb *),
|
||||
uint8_t tag_action, int dbd, uint8_t pc, uint8_t page,
|
||||
uint8_t *param_buf, uint32_t param_len,
|
||||
uint8_t sense_len, uint32_t timeout);
|
||||
|
||||
void scsi_mode_sense_len(struct ccb_scsiio *csio, u_int32_t retries,
|
||||
void (*cbfcnp)(struct cam_periph *,
|
||||
union ccb *),
|
||||
u_int8_t tag_action, int dbd,
|
||||
u_int8_t page_code, u_int8_t page,
|
||||
u_int8_t *param_buf, u_int32_t param_len,
|
||||
int minimum_cmd_size, u_int8_t sense_len,
|
||||
u_int32_t timeout);
|
||||
void (*cbfcnp)(struct cam_periph *, union ccb *),
|
||||
uint8_t tag_action, int dbd, uint8_t pc, uint8_t page,
|
||||
uint8_t *param_buf, uint32_t param_len,
|
||||
int minimum_cmd_size, uint8_t sense_len, uint32_t timeout);
|
||||
|
||||
void scsi_mode_sense_subpage(struct ccb_scsiio *csio,
|
||||
uint32_t retries,
|
||||
void (*cbfcnp)(struct cam_periph *, union ccb *),
|
||||
uint8_t tag_action, int dbd, uint8_t pc,
|
||||
uint8_t page, uint8_t subpage,
|
||||
uint8_t *param_buf, uint32_t param_len,
|
||||
int minimum_cmd_size, uint8_t sense_len, uint32_t timeout);
|
||||
|
||||
void scsi_mode_select(struct ccb_scsiio *csio, u_int32_t retries,
|
||||
void (*cbfcnp)(struct cam_periph *,
|
||||
|
@ -586,7 +586,7 @@ chstart(struct cam_periph *periph, union ccb *start_ccb)
|
||||
/* tag_action */ MSG_SIMPLE_Q_TAG,
|
||||
/* dbd */ (softc->quirks & CH_Q_NO_DBD) ?
|
||||
FALSE : TRUE,
|
||||
/* page_code */ SMS_PAGE_CTRL_CURRENT,
|
||||
/* pc */ SMS_PAGE_CTRL_CURRENT,
|
||||
/* page */ CH_ELEMENT_ADDR_ASSIGN_PAGE,
|
||||
/* param_buf */ (u_int8_t *)mode_buffer,
|
||||
/* param_len */ mode_buffer_len,
|
||||
@ -1587,7 +1587,7 @@ chgetparams(struct cam_periph *periph)
|
||||
/* cbfcnp */ chdone,
|
||||
/* tag_action */ MSG_SIMPLE_Q_TAG,
|
||||
/* dbd */ dbd,
|
||||
/* page_code */ SMS_PAGE_CTRL_CURRENT,
|
||||
/* pc */ SMS_PAGE_CTRL_CURRENT,
|
||||
/* page */ CH_ELEMENT_ADDR_ASSIGN_PAGE,
|
||||
/* param_buf */ (u_int8_t *)mode_buffer,
|
||||
/* param_len */ mode_buffer_len,
|
||||
@ -1650,7 +1650,7 @@ chgetparams(struct cam_periph *periph)
|
||||
/* cbfcnp */ chdone,
|
||||
/* tag_action */ MSG_SIMPLE_Q_TAG,
|
||||
/* dbd */ dbd,
|
||||
/* page_code */ SMS_PAGE_CTRL_CURRENT,
|
||||
/* pc */ SMS_PAGE_CTRL_CURRENT,
|
||||
/* page */ CH_DEVICE_CAP_PAGE,
|
||||
/* param_buf */ (u_int8_t *)mode_buffer,
|
||||
/* param_len */ mode_buffer_len,
|
||||
|
@ -3965,6 +3965,7 @@ net80211/ieee80211_sta.c optional wlan \
|
||||
net80211/ieee80211_superg.c optional wlan ieee80211_support_superg
|
||||
net80211/ieee80211_scan_sw.c optional wlan
|
||||
net80211/ieee80211_tdma.c optional wlan ieee80211_support_tdma
|
||||
net80211/ieee80211_vht.c optional wlan
|
||||
net80211/ieee80211_wds.c optional wlan
|
||||
net80211/ieee80211_xauth.c optional wlan wlan_xauth
|
||||
net80211/ieee80211_alq.c optional wlan ieee80211_alq
|
||||
|
@ -1022,23 +1022,25 @@ ACPI_EXPORT_SYMBOL (AcpiDetachData)
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiGetData
|
||||
* FUNCTION: AcpiGetDataFull
|
||||
*
|
||||
* PARAMETERS: ObjHandle - Namespace node
|
||||
* Handler - Handler used in call to AttachData
|
||||
* Handle - Handler used in call to attach_data
|
||||
* Data - Where the data is returned
|
||||
* Callback - function to execute before returning
|
||||
*
|
||||
* RETURN: Status
|
||||
*
|
||||
* DESCRIPTION: Retrieve data that was previously attached to a namespace node.
|
||||
* DESCRIPTION: Retrieve data that was previously attached to a namespace node
|
||||
* and execute a callback before returning.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
ACPI_STATUS
|
||||
AcpiGetData (
|
||||
AcpiGetDataFull (
|
||||
ACPI_HANDLE ObjHandle,
|
||||
ACPI_OBJECT_HANDLER Handler,
|
||||
void **Data)
|
||||
void **Data,
|
||||
void (*Callback)(void *))
|
||||
{
|
||||
ACPI_NAMESPACE_NODE *Node;
|
||||
ACPI_STATUS Status;
|
||||
@ -1069,10 +1071,34 @@ AcpiGetData (
|
||||
}
|
||||
|
||||
Status = AcpiNsGetAttachedData (Node, Handler, Data);
|
||||
|
||||
if (ACPI_SUCCESS(Status) && Callback) {
|
||||
Callback(*Data);
|
||||
}
|
||||
UnlockAndExit:
|
||||
(void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
|
||||
return (Status);
|
||||
}
|
||||
ACPI_EXPORT_SYMBOL (AcpiGetDataFull)
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiGetData
|
||||
*
|
||||
* PARAMETERS: ObjHandle - Namespace node
|
||||
* Handler - Handler used in call to AttachData
|
||||
* Data - Where the data is returned
|
||||
*
|
||||
* RETURN: Status
|
||||
*
|
||||
* DESCRIPTION: Retrieve data that was previously attached to a namespace node.
|
||||
*
|
||||
******************************************************************************/
|
||||
ACPI_STATUS
|
||||
AcpiGetData (
|
||||
ACPI_HANDLE ObjHandle,
|
||||
ACPI_OBJECT_HANDLER Handler,
|
||||
void **Data)
|
||||
{
|
||||
return (AcpiGetDataFull(ObjHandle, Handler, Data, NULL));
|
||||
}
|
||||
ACPI_EXPORT_SYMBOL (AcpiGetData)
|
||||
|
@ -314,11 +314,12 @@ ACPI_EXPORT_SYMBOL (AcpiGetTableHeader)
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiGetTable
|
||||
* FUNCTION: AcpiGetTableWithSize
|
||||
*
|
||||
* PARAMETERS: Signature - ACPI signature of needed table
|
||||
* Instance - Which instance (for SSDTs)
|
||||
* OutTable - Where the pointer to the table is returned
|
||||
* TblSize - Size of the table
|
||||
*
|
||||
* RETURN: Status and pointer to the requested table
|
||||
*
|
||||
@ -333,10 +334,11 @@ ACPI_EXPORT_SYMBOL (AcpiGetTableHeader)
|
||||
******************************************************************************/
|
||||
|
||||
ACPI_STATUS
|
||||
AcpiGetTable (
|
||||
AcpiGetTableWithSize (
|
||||
char *Signature,
|
||||
UINT32 Instance,
|
||||
ACPI_TABLE_HEADER **OutTable)
|
||||
ACPI_TABLE_HEADER **OutTable,
|
||||
ACPI_SIZE *TblSize)
|
||||
{
|
||||
UINT32 i;
|
||||
UINT32 j;
|
||||
@ -434,10 +436,38 @@ AcpiPutTable (
|
||||
(void) AcpiUtReleaseMutex (ACPI_MTX_TABLES);
|
||||
return_VOID;
|
||||
}
|
||||
|
||||
ACPI_EXPORT_SYMBOL (AcpiPutTable)
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiGetTable
|
||||
*
|
||||
* PARAMETERS: Signature - ACPI signature of needed table
|
||||
* Instance - Which instance (for SSDTs)
|
||||
* OutTable - Where the pointer to the table is returned
|
||||
*
|
||||
* RETURN: Status and pointer to the requested table
|
||||
*
|
||||
* DESCRIPTION: Finds and verifies an ACPI table. Table must be in the
|
||||
* RSDT/XSDT.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
ACPI_STATUS
|
||||
AcpiGetTable (
|
||||
char *Signature,
|
||||
UINT32 Instance,
|
||||
ACPI_TABLE_HEADER **OutTable)
|
||||
{
|
||||
ACPI_SIZE Size;
|
||||
|
||||
return (AcpiGetTableWithSize(Signature, Instance, OutTable, &Size));
|
||||
}
|
||||
|
||||
ACPI_EXPORT_SYMBOL (AcpiGetTable)
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiGetTableByIndex
|
||||
|
@ -584,6 +584,14 @@ AcpiGetTableHeader (
|
||||
UINT32 Instance,
|
||||
ACPI_TABLE_HEADER *OutTableHeader))
|
||||
|
||||
ACPI_EXTERNAL_RETURN_STATUS (
|
||||
ACPI_STATUS
|
||||
AcpiGetTableWithSize (
|
||||
ACPI_STRING Signature,
|
||||
UINT32 Instance,
|
||||
ACPI_TABLE_HEADER **OutTable,
|
||||
ACPI_SIZE *TblSize))
|
||||
|
||||
ACPI_EXTERNAL_RETURN_STATUS (
|
||||
ACPI_STATUS
|
||||
AcpiGetTable (
|
||||
@ -670,6 +678,14 @@ AcpiGetData (
|
||||
ACPI_OBJECT_HANDLER Handler,
|
||||
void **Data))
|
||||
|
||||
ACPI_EXTERNAL_RETURN_STATUS (
|
||||
ACPI_STATUS
|
||||
AcpiGetDataFull (
|
||||
ACPI_HANDLE Object,
|
||||
ACPI_OBJECT_HANDLER Handler,
|
||||
void **Data,
|
||||
void (*Callback)(void *)))
|
||||
|
||||
ACPI_EXTERNAL_RETURN_STATUS (
|
||||
ACPI_STATUS
|
||||
AcpiDebugTrace (
|
||||
|
@ -1326,4 +1326,6 @@ _SP_OFFS_ = _SP_OFFS_-8
|
||||
ret
|
||||
.endif
|
||||
#----------------------------------------------------------------
|
||||
.section .note.GNU-stack,"",@progbits
|
||||
|
||||
.end
|
||||
|
@ -107,7 +107,7 @@ free_atid(struct adapter *sc, int atid)
|
||||
}
|
||||
|
||||
/*
|
||||
* Active open failed.
|
||||
* Active open succeeded.
|
||||
*/
|
||||
static int
|
||||
do_act_establish(struct sge_iq *iq, const struct rss_header *rss,
|
||||
@ -128,7 +128,7 @@ do_act_establish(struct sge_iq *iq, const struct rss_header *rss,
|
||||
|
||||
INP_WLOCK(inp);
|
||||
toep->tid = tid;
|
||||
insert_tid(sc, tid, toep);
|
||||
insert_tid(sc, tid, toep, inp->inp_vflag & INP_IPV6 ? 2 : 1);
|
||||
if (inp->inp_flags & INP_DROPPED) {
|
||||
|
||||
/* socket closed by the kernel before hw told us it connected */
|
||||
@ -187,6 +187,9 @@ act_open_failure_cleanup(struct adapter *sc, u_int atid, u_int status)
|
||||
INP_INFO_RUNLOCK(&V_tcbinfo);
|
||||
}
|
||||
|
||||
/*
|
||||
* Active open failed.
|
||||
*/
|
||||
static int
|
||||
do_act_open_rpl(struct sge_iq *iq, const struct rss_header *rss,
|
||||
struct mbuf *m)
|
||||
|
@ -824,14 +824,16 @@ done_with_synqe(struct adapter *sc, struct synq_entry *synqe)
|
||||
struct inpcb *inp = lctx->inp;
|
||||
struct vi_info *vi = synqe->syn->m_pkthdr.rcvif->if_softc;
|
||||
struct l2t_entry *e = &sc->l2t->l2tab[synqe->l2e_idx];
|
||||
int ntids;
|
||||
|
||||
INP_WLOCK_ASSERT(inp);
|
||||
ntids = inp->inp_vflag & INP_IPV6 ? 2 : 1;
|
||||
|
||||
TAILQ_REMOVE(&lctx->synq, synqe, link);
|
||||
inp = release_lctx(sc, lctx);
|
||||
if (inp)
|
||||
INP_WUNLOCK(inp);
|
||||
remove_tid(sc, synqe->tid);
|
||||
remove_tid(sc, synqe->tid, ntids);
|
||||
release_tid(sc, synqe->tid, &sc->sge.ctrlq[vi->pi->port_id]);
|
||||
t4_l2t_release(e);
|
||||
release_synqe(synqe); /* removed from synq list */
|
||||
@ -1180,7 +1182,7 @@ do_pass_accept_req(struct sge_iq *iq, const struct rss_header *rss,
|
||||
struct l2t_entry *e = NULL;
|
||||
int rscale, mtu_idx, rx_credits, rxqid, ulp_mode;
|
||||
struct synq_entry *synqe = NULL;
|
||||
int reject_reason, v;
|
||||
int reject_reason, v, ntids;
|
||||
uint16_t vid;
|
||||
#ifdef INVARIANTS
|
||||
unsigned int opcode = G_CPL_OPCODE(be32toh(OPCODE_TID(cpl)));
|
||||
@ -1254,6 +1256,8 @@ found:
|
||||
*/
|
||||
if (!in6_ifhasaddr(ifp, &inc.inc6_laddr))
|
||||
REJECT_PASS_ACCEPT();
|
||||
|
||||
ntids = 2;
|
||||
} else {
|
||||
|
||||
/* Don't offload if the ifcap isn't enabled */
|
||||
@ -1266,6 +1270,8 @@ found:
|
||||
*/
|
||||
if (!in_ifhasaddr(ifp, inc.inc_laddr))
|
||||
REJECT_PASS_ACCEPT();
|
||||
|
||||
ntids = 1;
|
||||
}
|
||||
|
||||
e = get_l2te_for_nexthop(pi, ifp, &inc);
|
||||
@ -1343,7 +1349,7 @@ found:
|
||||
synqe->rcv_bufsize = rx_credits;
|
||||
atomic_store_rel_ptr(&synqe->wr, (uintptr_t)wr);
|
||||
|
||||
insert_tid(sc, tid, synqe);
|
||||
insert_tid(sc, tid, synqe, ntids);
|
||||
TAILQ_INSERT_TAIL(&lctx->synq, synqe, link);
|
||||
hold_synqe(synqe); /* hold for the duration it's in the synq */
|
||||
hold_lctx(lctx); /* A synqe on the list has a ref on its lctx */
|
||||
@ -1372,7 +1378,7 @@ found:
|
||||
if (m)
|
||||
m->m_pkthdr.rcvif = hw_ifp;
|
||||
|
||||
remove_tid(sc, synqe->tid);
|
||||
remove_tid(sc, synqe->tid, ntids);
|
||||
free(wr, M_CXGBE);
|
||||
|
||||
/* Yank the synqe out of the lctx synq. */
|
||||
|
@ -307,7 +307,7 @@ release_offload_resources(struct toepcb *toep)
|
||||
t4_l2t_release(toep->l2te);
|
||||
|
||||
if (tid >= 0) {
|
||||
remove_tid(sc, tid);
|
||||
remove_tid(sc, tid, toep->ce ? 2 : 1);
|
||||
release_tid(sc, tid, toep->ctrlq);
|
||||
}
|
||||
|
||||
@ -420,12 +420,12 @@ final_cpl_received(struct toepcb *toep)
|
||||
}
|
||||
|
||||
void
|
||||
insert_tid(struct adapter *sc, int tid, void *ctx)
|
||||
insert_tid(struct adapter *sc, int tid, void *ctx, int ntids)
|
||||
{
|
||||
struct tid_info *t = &sc->tids;
|
||||
|
||||
t->tid_tab[tid] = ctx;
|
||||
atomic_add_int(&t->tids_in_use, 1);
|
||||
atomic_add_int(&t->tids_in_use, ntids);
|
||||
}
|
||||
|
||||
void *
|
||||
@ -445,12 +445,12 @@ update_tid(struct adapter *sc, int tid, void *ctx)
|
||||
}
|
||||
|
||||
void
|
||||
remove_tid(struct adapter *sc, int tid)
|
||||
remove_tid(struct adapter *sc, int tid, int ntids)
|
||||
{
|
||||
struct tid_info *t = &sc->tids;
|
||||
|
||||
t->tid_tab[tid] = NULL;
|
||||
atomic_subtract_int(&t->tids_in_use, 1);
|
||||
atomic_subtract_int(&t->tids_in_use, ntids);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -306,10 +306,10 @@ void free_toepcb(struct toepcb *);
|
||||
void offload_socket(struct socket *, struct toepcb *);
|
||||
void undo_offload_socket(struct socket *);
|
||||
void final_cpl_received(struct toepcb *);
|
||||
void insert_tid(struct adapter *, int, void *);
|
||||
void insert_tid(struct adapter *, int, void *, int);
|
||||
void *lookup_tid(struct adapter *, int);
|
||||
void update_tid(struct adapter *, int, void *);
|
||||
void remove_tid(struct adapter *, int);
|
||||
void remove_tid(struct adapter *, int, int);
|
||||
void release_tid(struct adapter *, int, struct sge_wrq *);
|
||||
int find_best_mtu_idx(struct adapter *, struct in_conninfo *, int);
|
||||
u_long select_rcv_wnd(struct socket *);
|
||||
|
@ -178,9 +178,10 @@ gpio_pin_is_active(gpio_pin_t pin, bool *active)
|
||||
return (rv);
|
||||
}
|
||||
|
||||
*active = tmp != 0;
|
||||
if (pin->flags & GPIO_ACTIVE_LOW)
|
||||
*active = !(*active);
|
||||
*active = tmp == 0;
|
||||
else
|
||||
*active = tmp != 0;
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
@ -884,7 +884,7 @@ genkbd_commonioctl(keyboard_t *kbd, u_long cmd, caddr_t arg)
|
||||
omapp->key[i].spcl = mapp->key[i].spcl;
|
||||
omapp->key[i].flgs = mapp->key[i].flgs;
|
||||
}
|
||||
return (0);
|
||||
break;
|
||||
case PIO_KEYMAP: /* set keyboard translation table */
|
||||
case OPIO_KEYMAP: /* set keyboard translation table (compat) */
|
||||
#ifndef KBD_DISABLE_KEYMAP_LOAD
|
||||
|
@ -355,8 +355,8 @@ struct mmc_request {
|
||||
*/
|
||||
#define MMC_OCR_VOLTAGE 0x3fffffffU /* Vdd Voltage mask */
|
||||
#define MMC_OCR_LOW_VOLTAGE (1u << 7) /* Low Voltage Range -- tbd */
|
||||
#define MMC_OCR_MIN_VOLTAGE_SHIFT 7
|
||||
#define MMC_OCR_200_210 (1U << 8) /* Vdd voltage 2.00 ~ 2.10 */
|
||||
#define MMC_OCR_MIN_VOLTAGE_SHIFT 8
|
||||
#define MMC_OCR_210_220 (1U << 9) /* Vdd voltage 2.10 ~ 2.20 */
|
||||
#define MMC_OCR_220_230 (1U << 10) /* Vdd voltage 2.20 ~ 2.30 */
|
||||
#define MMC_OCR_230_240 (1U << 11) /* Vdd voltage 2.30 ~ 2.40 */
|
||||
|
@ -164,8 +164,7 @@ sdhci_reset(struct sdhci_slot *slot, uint8_t mask)
|
||||
int timeout;
|
||||
|
||||
if (slot->quirks & SDHCI_QUIRK_NO_CARD_NO_RESET) {
|
||||
if (!(RD4(slot, SDHCI_PRESENT_STATE) &
|
||||
SDHCI_CARD_PRESENT))
|
||||
if (!SDHCI_GET_CARD_PRESENT(slot->bus, slot))
|
||||
return;
|
||||
}
|
||||
|
||||
@ -489,7 +488,7 @@ sdhci_card_task(void *arg, int pending)
|
||||
struct sdhci_slot *slot = arg;
|
||||
|
||||
SDHCI_LOCK(slot);
|
||||
if (RD4(slot, SDHCI_PRESENT_STATE) & SDHCI_CARD_PRESENT) {
|
||||
if (SDHCI_GET_CARD_PRESENT(slot->bus, slot)) {
|
||||
if (slot->dev == NULL) {
|
||||
/* If card is present - attach mmc bus. */
|
||||
slot->dev = device_add_child(slot->bus, "mmc", -1);
|
||||
@ -718,6 +717,13 @@ sdhci_generic_min_freq(device_t brdev, struct sdhci_slot *slot)
|
||||
return (slot->max_clk / SDHCI_200_MAX_DIVIDER);
|
||||
}
|
||||
|
||||
bool
|
||||
sdhci_generic_get_card_present(device_t brdev, struct sdhci_slot *slot)
|
||||
{
|
||||
|
||||
return (RD4(slot, SDHCI_PRESENT_STATE) & SDHCI_CARD_PRESENT);
|
||||
}
|
||||
|
||||
int
|
||||
sdhci_generic_update_ios(device_t brdev, device_t reqdev)
|
||||
{
|
||||
@ -834,7 +840,7 @@ sdhci_start_command(struct sdhci_slot *slot, struct mmc_command *cmd)
|
||||
state = RD4(slot, SDHCI_PRESENT_STATE);
|
||||
/* Do not issue command if there is no card, clock or power.
|
||||
* Controller will not detect timeout without clock active. */
|
||||
if ((state & SDHCI_CARD_PRESENT) == 0 ||
|
||||
if (!SDHCI_GET_CARD_PRESENT(slot->bus, slot) ||
|
||||
slot->power == 0 ||
|
||||
slot->clock == 0) {
|
||||
cmd->error = MMC_ERR_FAILED;
|
||||
@ -1323,7 +1329,7 @@ sdhci_generic_intr(struct sdhci_slot *slot)
|
||||
|
||||
/* Handle card presence interrupts. */
|
||||
if (intmask & (SDHCI_INT_CARD_INSERT | SDHCI_INT_CARD_REMOVE)) {
|
||||
present = RD4(slot, SDHCI_PRESENT_STATE) & SDHCI_CARD_PRESENT;
|
||||
present = SDHCI_GET_CARD_PRESENT(slot->bus, slot);
|
||||
slot->intmask &=
|
||||
~(SDHCI_INT_CARD_INSERT | SDHCI_INT_CARD_REMOVE);
|
||||
slot->intmask |= present ? SDHCI_INT_CARD_REMOVE :
|
||||
|
@ -322,5 +322,6 @@ int sdhci_generic_acquire_host(device_t brdev, device_t reqdev);
|
||||
int sdhci_generic_release_host(device_t brdev, device_t reqdev);
|
||||
void sdhci_generic_intr(struct sdhci_slot *slot);
|
||||
uint32_t sdhci_generic_min_freq(device_t brdev, struct sdhci_slot *slot);
|
||||
bool sdhci_generic_get_card_present(device_t brdev, struct sdhci_slot *slot);
|
||||
|
||||
#endif /* __SDHCI_H__ */
|
||||
|
@ -152,3 +152,9 @@ METHOD uint32_t min_freq {
|
||||
device_t brdev;
|
||||
struct sdhci_slot *slot;
|
||||
} DEFAULT sdhci_generic_min_freq;
|
||||
|
||||
METHOD bool get_card_present {
|
||||
device_t brdev;
|
||||
struct sdhci_slot *slot;
|
||||
} DEFAULT sdhci_generic_get_card_present;
|
||||
|
||||
|
@ -438,8 +438,9 @@ ef10_tx_qpost(
|
||||
size_t offset;
|
||||
efx_qword_t qword;
|
||||
|
||||
/* Fragments must not span 4k boundaries. */
|
||||
EFSYS_ASSERT(P2ROUNDUP(addr + 1, 4096) >= (addr + size));
|
||||
/* No limitations on boundary crossing */
|
||||
EFSYS_ASSERT(size <=
|
||||
etp->et_enp->en_nic_cfg.enc_tx_dma_desc_size_max);
|
||||
|
||||
id = added++ & etp->et_mask;
|
||||
offset = id * sizeof (efx_qword_t);
|
||||
@ -584,8 +585,8 @@ ef10_tx_qdesc_dma_create(
|
||||
__in boolean_t eop,
|
||||
__out efx_desc_t *edp)
|
||||
{
|
||||
/* Fragments must not span 4k boundaries. */
|
||||
EFSYS_ASSERT(P2ROUNDUP(addr + 1, 4096) >= addr + size);
|
||||
/* No limitations on boundary crossing */
|
||||
EFSYS_ASSERT(size <= etp->et_enp->en_nic_cfg.enc_tx_dma_desc_size_max);
|
||||
|
||||
EFSYS_PROBE4(tx_desc_dma_create, unsigned int, etp->et_index,
|
||||
efsys_dma_addr_t, addr,
|
||||
|
@ -1154,6 +1154,13 @@ typedef struct efx_nic_cfg_s {
|
||||
uint32_t enc_rx_batch_max;
|
||||
/* Number of rx descriptors the hardware requires for a push. */
|
||||
uint32_t enc_rx_push_align;
|
||||
/* Maximum amount of data in DMA descriptor */
|
||||
uint32_t enc_tx_dma_desc_size_max;
|
||||
/*
|
||||
* Boundary which DMA descriptor data must not cross or 0 if no
|
||||
* limitation.
|
||||
*/
|
||||
uint32_t enc_tx_dma_desc_boundary;
|
||||
/*
|
||||
* Maximum number of bytes into the packet the TCP header can start for
|
||||
* the hardware to apply TSO packet edits.
|
||||
|
@ -748,8 +748,12 @@ siena_tx_qpost(
|
||||
size_t size = ebp->eb_size;
|
||||
efsys_dma_addr_t end = start + size;
|
||||
|
||||
/* Fragments must not span 4k boundaries. */
|
||||
EFSYS_ASSERT(P2ROUNDUP(start + 1, 4096) >= end);
|
||||
/*
|
||||
* Fragments must not span 4k boundaries.
|
||||
* Here it is a stricter requirement than the maximum length.
|
||||
*/
|
||||
EFSYS_ASSERT(P2ROUNDUP(start + 1,
|
||||
etp->et_enp->en_nic_cfg.enc_tx_dma_desc_boundary) >= end);
|
||||
|
||||
EFX_TX_DESC(etp, start, size, ebp->eb_eop, added);
|
||||
}
|
||||
@ -1009,8 +1013,12 @@ siena_tx_qdesc_dma_create(
|
||||
__in boolean_t eop,
|
||||
__out efx_desc_t *edp)
|
||||
{
|
||||
/* Fragments must not span 4k boundaries. */
|
||||
EFSYS_ASSERT(P2ROUNDUP(addr + 1, 4096) >= addr + size);
|
||||
/*
|
||||
* Fragments must not span 4k boundaries.
|
||||
* Here it is a stricter requirement than the maximum length.
|
||||
*/
|
||||
EFSYS_ASSERT(P2ROUNDUP(addr + 1,
|
||||
etp->et_enp->en_nic_cfg.enc_tx_dma_desc_boundary) >= addr + size);
|
||||
|
||||
EFSYS_PROBE4(tx_desc_dma_create, unsigned int, etp->et_index,
|
||||
efsys_dma_addr_t, addr,
|
||||
|
@ -304,6 +304,10 @@ hunt_board_cfg(
|
||||
/* Alignment for WPTR updates */
|
||||
encp->enc_rx_push_align = EF10_RX_WPTR_ALIGN;
|
||||
|
||||
encp->enc_tx_dma_desc_size_max = EFX_MASK32(ESF_DZ_RX_KER_BYTE_CNT);
|
||||
/* No boundary crossing limits */
|
||||
encp->enc_tx_dma_desc_boundary = 0;
|
||||
|
||||
/*
|
||||
* Set resource limits for MC_CMD_ALLOC_VIS. Note that we cannot use
|
||||
* MC_CMD_GET_RESOURCE_LIMITS here as that reports the available
|
||||
|
@ -301,6 +301,10 @@ medford_board_cfg(
|
||||
/* Alignment for WPTR updates */
|
||||
encp->enc_rx_push_align = EF10_RX_WPTR_ALIGN;
|
||||
|
||||
encp->enc_tx_dma_desc_size_max = EFX_MASK32(ESF_DZ_RX_KER_BYTE_CNT);
|
||||
/* No boundary crossing limits */
|
||||
encp->enc_tx_dma_desc_boundary = 0;
|
||||
|
||||
/*
|
||||
* Set resource limits for MC_CMD_ALLOC_VIS. Note that we cannot use
|
||||
* MC_CMD_GET_RESOURCE_LIMITS here as that reports the available
|
||||
|
@ -138,6 +138,10 @@ siena_board_cfg(
|
||||
/* Alignment for WPTR updates */
|
||||
encp->enc_rx_push_align = 1;
|
||||
|
||||
encp->enc_tx_dma_desc_size_max = EFX_MASK32(FSF_AZ_TX_KER_BYTE_COUNT);
|
||||
/* Fragments must not span 4k boundaries. */
|
||||
encp->enc_tx_dma_desc_boundary = 4096;
|
||||
|
||||
/* Resource limits */
|
||||
rc = efx_mcdi_get_resource_limits(enp, &nevq, &nrxq, &ntxq);
|
||||
if (rc != 0) {
|
||||
|
@ -326,7 +326,9 @@ struct sfxge_softc {
|
||||
#endif
|
||||
};
|
||||
|
||||
#define SFXGE_LINK_UP(sc) ((sc)->port.link_mode != EFX_LINK_DOWN)
|
||||
#define SFXGE_LINK_UP(sc) \
|
||||
((sc)->port.link_mode != EFX_LINK_DOWN && \
|
||||
(sc)->port.link_mode != EFX_LINK_UNKNOWN)
|
||||
#define SFXGE_RUNNING(sc) ((sc)->ifnet->if_drv_flags & IFF_DRV_RUNNING)
|
||||
|
||||
#define SFXGE_PARAM(_name) "hw.sfxge." #_name
|
||||
|
@ -311,8 +311,7 @@ sfxge_mac_link_update(struct sfxge_softc *sc, efx_link_mode_t mode)
|
||||
port->link_mode = mode;
|
||||
|
||||
/* Push link state update to the OS */
|
||||
link_state = (port->link_mode != EFX_LINK_DOWN ?
|
||||
LINK_STATE_UP : LINK_STATE_DOWN);
|
||||
link_state = (SFXGE_LINK_UP(sc) ? LINK_STATE_UP : LINK_STATE_DOWN);
|
||||
sc->ifnet->if_baudrate = sfxge_link_baudrate[port->link_mode];
|
||||
if_link_state_change(sc->ifnet, link_state);
|
||||
}
|
||||
|
@ -1720,6 +1720,7 @@ static int
|
||||
sfxge_tx_qinit(struct sfxge_softc *sc, unsigned int txq_index,
|
||||
enum sfxge_txq_type type, unsigned int evq_index)
|
||||
{
|
||||
const efx_nic_cfg_t *encp = efx_nic_cfg_get(sc->enp);
|
||||
char name[16];
|
||||
struct sysctl_ctx_list *ctx = device_get_sysctl_ctx(sc->dev);
|
||||
struct sysctl_oid *txq_node;
|
||||
@ -1750,9 +1751,11 @@ sfxge_tx_qinit(struct sfxge_softc *sc, unsigned int txq_index,
|
||||
&txq->buf_base_id);
|
||||
|
||||
/* Create a DMA tag for packet mappings. */
|
||||
if (bus_dma_tag_create(sc->parent_dma_tag, 1, 0x1000,
|
||||
if (bus_dma_tag_create(sc->parent_dma_tag, 1,
|
||||
encp->enc_tx_dma_desc_boundary,
|
||||
MIN(0x3FFFFFFFFFFFUL, BUS_SPACE_MAXADDR), BUS_SPACE_MAXADDR, NULL,
|
||||
NULL, 0x11000, SFXGE_TX_MAPPING_MAX_SEG, 0x1000, 0, NULL, NULL,
|
||||
NULL, 0x11000, SFXGE_TX_MAPPING_MAX_SEG,
|
||||
encp->enc_tx_dma_desc_size_max, 0, NULL, NULL,
|
||||
&txq->packet_dma_tag) != 0) {
|
||||
device_printf(sc->dev, "Couldn't allocate txq DMA tag\n");
|
||||
rc = ENOMEM;
|
||||
|
@ -51,8 +51,8 @@ __FBSDID("$FreeBSD$");
|
||||
#include <fs/cd9660/iso_rrip.h>
|
||||
|
||||
struct cd9660_ino_alloc_arg {
|
||||
ino_t ino;
|
||||
ino_t i_ino;
|
||||
cd_ino_t ino;
|
||||
cd_ino_t i_ino;
|
||||
struct iso_directory_record *ep;
|
||||
};
|
||||
|
||||
@ -124,7 +124,7 @@ cd9660_lookup(ap)
|
||||
struct cd9660_ino_alloc_arg dd_arg;
|
||||
u_long bmask; /* block offset mask */
|
||||
int error;
|
||||
ino_t ino, i_ino;
|
||||
cd_ino_t ino, i_ino;
|
||||
int ltype, reclen;
|
||||
u_short namelen;
|
||||
int isoflags;
|
||||
|
@ -309,14 +309,21 @@ cd9660_tstamp_conv17(pi,pu)
|
||||
return cd9660_tstamp_conv7(buf, pu, ISO_FTYPE_DEFAULT);
|
||||
}
|
||||
|
||||
ino_t
|
||||
cd_ino_t
|
||||
isodirino(isodir, imp)
|
||||
struct iso_directory_record *isodir;
|
||||
struct iso_mnt *imp;
|
||||
{
|
||||
ino_t ino;
|
||||
cd_ino_t ino;
|
||||
|
||||
ino = (isonum_733(isodir->extent) + isonum_711(isodir->ext_attr_length))
|
||||
<< imp->im_bshift;
|
||||
return (ino);
|
||||
/*
|
||||
* Note there is an inverse calculation in
|
||||
* cd9660_vfsops.c:cd9660_vget_internal():
|
||||
* ip->iso_start = ino >> imp->im_bshift;
|
||||
* and also a calculation of the isodir pointer
|
||||
* from an inode in cd9660_vnops.c:cd9660_readlink()
|
||||
*/
|
||||
ino = ((cd_ino_t)isonum_733(isodir->extent) +
|
||||
isonum_711(isodir->ext_attr_length)) << imp->im_bshift;
|
||||
return ino;
|
||||
}
|
||||
|
@ -58,7 +58,7 @@ typedef struct {
|
||||
|
||||
struct iso_node {
|
||||
struct vnode *i_vnode; /* vnode associated with this inode */
|
||||
ino_t i_number; /* the identity of the inode */
|
||||
cd_ino_t i_number; /* the identity of the inode */
|
||||
/* we use the actual starting block of the file */
|
||||
struct iso_mnt *i_mnt; /* filesystem associated with this inode */
|
||||
struct lockf *i_lockf; /* head of byte-level lock list */
|
||||
|
@ -628,7 +628,7 @@ cd9660_rrip_getname(isodir,outbuf,outlen,inump,imp)
|
||||
struct iso_directory_record *isodir;
|
||||
char *outbuf;
|
||||
u_short *outlen;
|
||||
ino_t *inump;
|
||||
cd_ino_t *inump;
|
||||
struct iso_mnt *imp;
|
||||
{
|
||||
ISO_RRIP_ANALYZE analyze;
|
||||
|
@ -540,7 +540,7 @@ cd9660_root(mp, flags, vpp)
|
||||
struct iso_mnt *imp = VFSTOISOFS(mp);
|
||||
struct iso_directory_record *dp =
|
||||
(struct iso_directory_record *)imp->root;
|
||||
ino_t ino = isodirino(dp, imp);
|
||||
cd_ino_t ino = isodirino(dp, imp);
|
||||
|
||||
/*
|
||||
* With RRIP we must use the `.' entry of the root directory.
|
||||
@ -617,6 +617,11 @@ cd9660_fhtovp(mp, fhp, flags, vpp)
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*
|
||||
* Conform to standard VFS interface; can't vget arbitrary inodes beyond 4GB
|
||||
* into media with current inode scheme and 32-bit ino_t. This shouldn't be
|
||||
* needed for anything other than nfsd, and who exports a mounted DVD over NFS?
|
||||
*/
|
||||
static int
|
||||
cd9660_vget(mp, ino, flags, vpp)
|
||||
struct mount *mp;
|
||||
@ -640,10 +645,22 @@ cd9660_vget(mp, ino, flags, vpp)
|
||||
(struct iso_directory_record *)0));
|
||||
}
|
||||
|
||||
/* Use special comparator for full 64-bit ino comparison. */
|
||||
static int
|
||||
cd9660_vfs_hash_cmp(vp, pino)
|
||||
struct vnode *vp;
|
||||
cd_ino_t *pino;
|
||||
{
|
||||
struct iso_node *ip;
|
||||
|
||||
ip = VTOI(vp);
|
||||
return (ip->i_number != *pino);
|
||||
}
|
||||
|
||||
int
|
||||
cd9660_vget_internal(mp, ino, flags, vpp, relocated, isodir)
|
||||
struct mount *mp;
|
||||
ino_t ino;
|
||||
cd_ino_t ino;
|
||||
int flags;
|
||||
struct vnode **vpp;
|
||||
int relocated;
|
||||
@ -658,7 +675,8 @@ cd9660_vget_internal(mp, ino, flags, vpp, relocated, isodir)
|
||||
struct thread *td;
|
||||
|
||||
td = curthread;
|
||||
error = vfs_hash_get(mp, ino, flags, td, vpp, NULL, NULL);
|
||||
error = vfs_hash_get(mp, ino, flags, td, vpp, cd9660_vfs_hash_cmp,
|
||||
&ino);
|
||||
if (error || *vpp != NULL)
|
||||
return (error);
|
||||
|
||||
@ -699,7 +717,8 @@ cd9660_vget_internal(mp, ino, flags, vpp, relocated, isodir)
|
||||
*vpp = NULLVP;
|
||||
return (error);
|
||||
}
|
||||
error = vfs_hash_insert(vp, ino, flags, td, vpp, NULL, NULL);
|
||||
error = vfs_hash_insert(vp, ino, flags, td, vpp, cd9660_vfs_hash_cmp,
|
||||
&ino);
|
||||
if (error || *vpp != NULL)
|
||||
return (error);
|
||||
|
||||
|
@ -481,6 +481,7 @@ cd9660_readdir(ap)
|
||||
u_short namelen;
|
||||
int ncookies = 0;
|
||||
u_long *cookies = NULL;
|
||||
cd_ino_t ino;
|
||||
|
||||
dp = VTOI(vdp);
|
||||
imp = dp->i_mnt;
|
||||
@ -576,8 +577,10 @@ cd9660_readdir(ap)
|
||||
|
||||
switch (imp->iso_ftype) {
|
||||
case ISO_FTYPE_RRIP:
|
||||
cd9660_rrip_getname(ep,idp->current.d_name, &namelen,
|
||||
&idp->current.d_fileno,imp);
|
||||
ino = idp->current.d_fileno;
|
||||
cd9660_rrip_getname(ep, idp->current.d_name, &namelen,
|
||||
&ino, imp);
|
||||
idp->current.d_fileno = ino;
|
||||
idp->current.d_namlen = (u_char)namelen;
|
||||
if (idp->current.d_namlen)
|
||||
error = iso_uiodir(idp,&idp->current,idp->curroff);
|
||||
@ -831,8 +834,8 @@ cd9660_vptofh(ap)
|
||||
memcpy(ap->a_fhp, &ifh, sizeof(ifh));
|
||||
|
||||
#ifdef ISOFS_DBG
|
||||
printf("vptofh: ino %d, start %ld\n",
|
||||
ifh.ifid_ino, ifh.ifid_start);
|
||||
printf("vptofh: ino %jd, start %ld\n",
|
||||
(uintmax_t)ifh.ifid_ino, ifh.ifid_start);
|
||||
#endif
|
||||
|
||||
return (0);
|
||||
|
@ -219,6 +219,11 @@ enum ISO_FTYPE { ISO_FTYPE_DEFAULT, ISO_FTYPE_9660, ISO_FTYPE_RRIP,
|
||||
#define ISOFSMNT_ROOT 0
|
||||
#endif
|
||||
|
||||
/*
|
||||
* When ino_t becomes 64-bit, we can remove this definition in favor of ino_t.
|
||||
*/
|
||||
#define cd_ino_t uint64_t
|
||||
|
||||
struct iso_mnt {
|
||||
uint64_t im_flags;
|
||||
|
||||
@ -250,10 +255,10 @@ struct iso_mnt {
|
||||
};
|
||||
|
||||
struct ifid {
|
||||
u_short ifid_len;
|
||||
u_short ifid_pad;
|
||||
int ifid_ino;
|
||||
long ifid_start;
|
||||
u_short ifid_len;
|
||||
u_short ifid_pad;
|
||||
cd_ino_t ifid_ino;
|
||||
long ifid_start;
|
||||
};
|
||||
|
||||
#define VFSTOISOFS(mp) ((struct iso_mnt *)((mp)->mnt_data))
|
||||
@ -263,7 +268,7 @@ struct ifid {
|
||||
#define lblkno(imp, loc) ((loc) >> (imp)->im_bshift)
|
||||
#define blksize(imp, ip, lbn) ((imp)->logical_block_size)
|
||||
|
||||
int cd9660_vget_internal(struct mount *, ino_t, int, struct vnode **, int,
|
||||
int cd9660_vget_internal(struct mount *, cd_ino_t, int, struct vnode **, int,
|
||||
struct iso_directory_record *);
|
||||
#define cd9660_sysctl ((int (*)(int *, u_int, void *, size_t *, void *, \
|
||||
size_t, struct proc *))eopnotsupp)
|
||||
@ -274,7 +279,7 @@ extern struct vop_vector cd9660_fifoops;
|
||||
int isochar(u_char *, u_char *, int, u_short *, int *, int, void *);
|
||||
int isofncmp(u_char *, int, u_char *, int, int, int, void *, void *);
|
||||
void isofntrans(u_char *, int, u_char *, u_short *, int, int, int, int, void *);
|
||||
ino_t isodirino(struct iso_directory_record *, struct iso_mnt *);
|
||||
cd_ino_t isodirino(struct iso_directory_record *, struct iso_mnt *);
|
||||
u_short sgetrune(const char *, size_t, char const **, int, void *);
|
||||
|
||||
#endif /* _KERNEL */
|
||||
|
@ -54,6 +54,7 @@
|
||||
#define ISO_SUSP_STOP 0x1000
|
||||
#define ISO_SUSP_UNKNOWN 0x8000
|
||||
|
||||
#ifdef _KERNEL
|
||||
typedef struct {
|
||||
struct iso_node *inop;
|
||||
int fields; /* interesting fields in this analysis */
|
||||
@ -61,7 +62,7 @@ typedef struct {
|
||||
off_t iso_ce_off; /* offset of continuation area */
|
||||
int iso_ce_len; /* length of continuation area */
|
||||
struct iso_mnt *imp; /* mount structure */
|
||||
ino_t *inump; /* inode number pointer */
|
||||
cd_ino_t *inump; /* inode number pointer */
|
||||
char *outbuf; /* name/symbolic link output area */
|
||||
u_short *outlen; /* length of above */
|
||||
u_short maxlen; /* maximum length of above */
|
||||
@ -74,9 +75,10 @@ int cd9660_rrip_analyze(struct iso_directory_record *isodir,
|
||||
struct iso_node *inop, struct iso_mnt *imp);
|
||||
int cd9660_rrip_getname(struct iso_directory_record *isodir,
|
||||
char *outbuf, u_short *outlen,
|
||||
ino_t *inump, struct iso_mnt *imp);
|
||||
cd_ino_t *inump, struct iso_mnt *imp);
|
||||
int cd9660_rrip_getsymname(struct iso_directory_record *isodir,
|
||||
char *outbuf, u_short *outlen,
|
||||
struct iso_mnt *imp);
|
||||
int cd9660_rrip_offset(struct iso_directory_record *isodir,
|
||||
struct iso_mnt *imp);
|
||||
#endif /* _KERNEL */
|
||||
|
@ -604,6 +604,8 @@ retry:
|
||||
if (td->td_ru.ru_msgrcv != ru_before)
|
||||
job->msgrcv = 1;
|
||||
} else {
|
||||
if (!TAILQ_EMPTY(&sb->sb_aiojobq))
|
||||
flags |= MSG_MORETOCOME;
|
||||
uio.uio_rw = UIO_WRITE;
|
||||
ru_before = td->td_ru.ru_msgsnd;
|
||||
#ifdef MAC
|
||||
|
@ -1182,6 +1182,7 @@ sosend_dgram(struct socket *so, struct sockaddr *addr, struct uio *uio,
|
||||
(resid <= 0)) ?
|
||||
PRUS_EOF :
|
||||
/* If there is more to send set PRUS_MORETOCOME */
|
||||
(flags & MSG_MORETOCOME) ||
|
||||
(resid > 0 && space > 0) ? PRUS_MORETOCOME : 0,
|
||||
top, addr, control, td);
|
||||
if (dontroute) {
|
||||
@ -1368,6 +1369,7 @@ restart:
|
||||
(resid <= 0)) ?
|
||||
PRUS_EOF :
|
||||
/* If there is more to send set PRUS_MORETOCOME. */
|
||||
(flags & MSG_MORETOCOME) ||
|
||||
(resid > 0 && space > 0) ? PRUS_MORETOCOME : 0,
|
||||
top, addr, control, td);
|
||||
if (dontroute) {
|
||||
|
@ -11,3 +11,5 @@ machine mips mips64
|
||||
makeoptions ARCH_FLAGS="-march=mips64 -mabi=64"
|
||||
|
||||
makeoptions KERNLOADADDR=0xffffffff80100000
|
||||
|
||||
options COMPAT_FREEBSD32 # Compatible with o32 binaries
|
||||
|
@ -12,7 +12,7 @@ SRCS= ieee80211.c ieee80211_action.c ieee80211_ageq.c \
|
||||
ieee80211_ratectl_none.c ieee80211_regdomain.c \
|
||||
ieee80211_ht.c ieee80211_hwmp.c ieee80211_adhoc.c ieee80211_hostap.c \
|
||||
ieee80211_monitor.c ieee80211_sta.c ieee80211_wds.c ieee80211_ddb.c \
|
||||
ieee80211_tdma.c ieee80211_superg.c
|
||||
ieee80211_tdma.c ieee80211_superg.c ieee80211_vht.c
|
||||
SRCS+= bus_if.h device_if.h opt_ddb.h opt_inet.h opt_inet6.h \
|
||||
opt_tdma.h opt_wlan.h
|
||||
|
||||
|
@ -90,6 +90,7 @@ const uint8_t ieee80211broadcastaddr[IEEE80211_ADDR_LEN] =
|
||||
static void ieee80211_syncflag_locked(struct ieee80211com *ic, int flag);
|
||||
static void ieee80211_syncflag_ht_locked(struct ieee80211com *ic, int flag);
|
||||
static void ieee80211_syncflag_ext_locked(struct ieee80211com *ic, int flag);
|
||||
static void ieee80211_syncflag_vht_locked(struct ieee80211com *ic, int flag);
|
||||
static int ieee80211_media_setup(struct ieee80211com *ic,
|
||||
struct ifmedia *media, int caps, int addsta,
|
||||
ifm_change_cb_t media_change, ifm_stat_cb_t media_stat);
|
||||
@ -652,6 +653,12 @@ ieee80211_vap_attach(struct ieee80211vap *vap, ifm_change_cb_t media_change,
|
||||
ieee80211_syncflag_locked(ic, IEEE80211_F_BURST);
|
||||
ieee80211_syncflag_ht_locked(ic, IEEE80211_FHT_HT);
|
||||
ieee80211_syncflag_ht_locked(ic, IEEE80211_FHT_USEHT40);
|
||||
|
||||
ieee80211_syncflag_vht_locked(ic, IEEE80211_FVHT_VHT);
|
||||
ieee80211_syncflag_vht_locked(ic, IEEE80211_FVHT_USEVHT40);
|
||||
ieee80211_syncflag_vht_locked(ic, IEEE80211_FVHT_USEVHT80);
|
||||
ieee80211_syncflag_vht_locked(ic, IEEE80211_FVHT_USEVHT80P80);
|
||||
ieee80211_syncflag_vht_locked(ic, IEEE80211_FVHT_USEVHT160);
|
||||
IEEE80211_UNLOCK(ic);
|
||||
|
||||
return 1;
|
||||
@ -699,6 +706,13 @@ ieee80211_vap_detach(struct ieee80211vap *vap)
|
||||
ieee80211_syncflag_locked(ic, IEEE80211_F_BURST);
|
||||
ieee80211_syncflag_ht_locked(ic, IEEE80211_FHT_HT);
|
||||
ieee80211_syncflag_ht_locked(ic, IEEE80211_FHT_USEHT40);
|
||||
|
||||
ieee80211_syncflag_vht_locked(ic, IEEE80211_FVHT_VHT);
|
||||
ieee80211_syncflag_vht_locked(ic, IEEE80211_FVHT_USEVHT40);
|
||||
ieee80211_syncflag_vht_locked(ic, IEEE80211_FVHT_USEVHT80);
|
||||
ieee80211_syncflag_vht_locked(ic, IEEE80211_FVHT_USEVHT80P80);
|
||||
ieee80211_syncflag_vht_locked(ic, IEEE80211_FVHT_USEVHT160);
|
||||
|
||||
/* NB: this handles the bpfdetach done below */
|
||||
ieee80211_syncflag_ext_locked(ic, IEEE80211_FEXT_BPF);
|
||||
if (vap->iv_ifflags & IFF_PROMISC)
|
||||
@ -852,6 +866,46 @@ ieee80211_syncflag_ht(struct ieee80211vap *vap, int flag)
|
||||
IEEE80211_UNLOCK(ic);
|
||||
}
|
||||
|
||||
/*
|
||||
* Synchronize flags_vht bit state in the com structure
|
||||
* according to the state of all vap's. This is used,
|
||||
* for example, to handle state changes via ioctls.
|
||||
*/
|
||||
static void
|
||||
ieee80211_syncflag_vht_locked(struct ieee80211com *ic, int flag)
|
||||
{
|
||||
struct ieee80211vap *vap;
|
||||
int bit;
|
||||
|
||||
IEEE80211_LOCK_ASSERT(ic);
|
||||
|
||||
bit = 0;
|
||||
TAILQ_FOREACH(vap, &ic->ic_vaps, iv_next)
|
||||
if (vap->iv_flags_vht & flag) {
|
||||
bit = 1;
|
||||
break;
|
||||
}
|
||||
if (bit)
|
||||
ic->ic_flags_vht |= flag;
|
||||
else
|
||||
ic->ic_flags_vht &= ~flag;
|
||||
}
|
||||
|
||||
void
|
||||
ieee80211_syncflag_vht(struct ieee80211vap *vap, int flag)
|
||||
{
|
||||
struct ieee80211com *ic = vap->iv_ic;
|
||||
|
||||
IEEE80211_LOCK(ic);
|
||||
if (flag < 0) {
|
||||
flag = -flag;
|
||||
vap->iv_flags_vht &= ~flag;
|
||||
} else
|
||||
vap->iv_flags_vht |= flag;
|
||||
ieee80211_syncflag_vht_locked(ic, flag);
|
||||
IEEE80211_UNLOCK(ic);
|
||||
}
|
||||
|
||||
/*
|
||||
* Synchronize flags_ext bit state in the com structure
|
||||
* according to the state of all vap's. This is used,
|
||||
|
@ -737,16 +737,6 @@ struct ieee80211_ie_htinfo {
|
||||
* 802.11ac definitions - 802.11ac-2013 .
|
||||
*/
|
||||
|
||||
/* VHT opmode bits */
|
||||
#define IEEE80211_VHT_OPMODE_CHANWIDTH_MASK 3
|
||||
#define IEEE80211_VHT_OPMODE_CHANWIDTH_20MHZ 0
|
||||
#define IEEE80211_VHT_OPMODE_CHANWIDTH_40MHZ 1
|
||||
#define IEEE80211_VHT_OPMODE_CHANWIDTH_80MHZ 2
|
||||
#define IEEE80211_VHT_OPMODE_CHANWIDTH_160MHZ 3
|
||||
#define IEEE80211_VHT_OPMODE_RX_NSS_MASK 0x70
|
||||
#define IEEE80211_VHT_OPMODE_RX_NSS_SHIFT 4
|
||||
#define IEEE80211_VHT_OPMODE_RX_NSS_TYPE_BF 0x80
|
||||
|
||||
/*
|
||||
* Maximum length of A-MPDU that the STA can RX in VHT.
|
||||
* Length = 2 ^ (13 + max_ampdu_length_exp) - 1 (octets)
|
||||
@ -787,6 +777,7 @@ struct ieee80211_ie_vhtcap {
|
||||
struct ieee80211_vht_mcs_info supp_mcs;
|
||||
} __packed;
|
||||
|
||||
/* VHT operation mode subfields - 802.11ac-2013 Table 8.183x */
|
||||
#define IEEE80211_VHT_CHANWIDTH_USE_HT 0 /* Use HT IE for chw */
|
||||
#define IEEE80211_VHT_CHANWIDTH_80MHZ 1 /* 80MHz */
|
||||
#define IEEE80211_VHT_CHANWIDTH_160MHZ 2 /* 160MHz */
|
||||
@ -839,6 +830,14 @@ struct ieee80211_ie_vht_operation {
|
||||
#define IEEE80211_VHTCAP_RX_ANTENNA_PATTERN 0x10000000
|
||||
#define IEEE80211_VHTCAP_TX_ANTENNA_PATTERN 0x20000000
|
||||
|
||||
/*
|
||||
* XXX TODO: add the rest of the bits
|
||||
*/
|
||||
#define IEEE80211_VHTCAP_BITS \
|
||||
"\20\1MPDU7991\2MPDU11454\3CHAN160\4CHAN8080\5RXLDPC\6SHORTGI80" \
|
||||
"\7SHORTGI160\10RXSTBC1\11RXSTBC2\12RXSTBC3\13RXSTBC4\14BFERCAP" \
|
||||
"\15BFEECAP\27VHT\37RXANTPTN\40TXANTPTN"
|
||||
|
||||
/*
|
||||
* VHT Transmit Power Envelope element - 802.11ac-2013 8.4.2.164
|
||||
*
|
||||
|
@ -710,6 +710,7 @@ ieee80211_ioctl_getdevcaps(struct ieee80211com *ic,
|
||||
dc->dc_drivercaps = ic->ic_caps;
|
||||
dc->dc_cryptocaps = ic->ic_cryptocaps;
|
||||
dc->dc_htcaps = ic->ic_htcaps;
|
||||
dc->dc_vhtcaps = ic->ic_vhtcaps;
|
||||
ci = &dc->dc_chaninfo;
|
||||
ic->ic_getradiocaps(ic, maxchans, &ci->ic_nchans, ci->ic_chans);
|
||||
KASSERT(ci->ic_nchans <= maxchans,
|
||||
@ -1135,6 +1136,22 @@ ieee80211_ioctl_get80211(struct ieee80211vap *vap, u_long cmd,
|
||||
if (vap->iv_flags_ht & IEEE80211_FHT_STBC_RX)
|
||||
ireq->i_val |= 2;
|
||||
break;
|
||||
|
||||
/* VHT */
|
||||
case IEEE80211_IOC_VHTCONF:
|
||||
ireq->i_val = 0;
|
||||
if (vap->iv_flags_vht & IEEE80211_FVHT_VHT)
|
||||
ireq->i_val |= 1;
|
||||
if (vap->iv_flags_vht & IEEE80211_FVHT_USEVHT40)
|
||||
ireq->i_val |= 2;
|
||||
if (vap->iv_flags_vht & IEEE80211_FVHT_USEVHT80)
|
||||
ireq->i_val |= 4;
|
||||
if (vap->iv_flags_vht & IEEE80211_FVHT_USEVHT80P80)
|
||||
ireq->i_val |= 8;
|
||||
if (vap->iv_flags_vht & IEEE80211_FVHT_USEVHT160)
|
||||
ireq->i_val |= 16;
|
||||
break;
|
||||
|
||||
default:
|
||||
error = ieee80211_ioctl_getdefault(vap, ireq);
|
||||
break;
|
||||
@ -1869,6 +1886,8 @@ findchannel(struct ieee80211com *ic, int ieee, int mode)
|
||||
/* NB: handled specially below */
|
||||
[IEEE80211_MODE_11NA] = IEEE80211_CHAN_A,
|
||||
[IEEE80211_MODE_11NG] = IEEE80211_CHAN_G,
|
||||
[IEEE80211_MODE_VHT_5GHZ] = IEEE80211_CHAN_A,
|
||||
[IEEE80211_MODE_VHT_2GHZ] = IEEE80211_CHAN_G,
|
||||
};
|
||||
u_int modeflags;
|
||||
int i;
|
||||
@ -1893,11 +1912,27 @@ findchannel(struct ieee80211com *ic, int ieee, int mode)
|
||||
!find11gchannel(ic, i, c->ic_freq))
|
||||
return c;
|
||||
} else {
|
||||
/* must check HT specially */
|
||||
/* must check VHT specifically */
|
||||
if ((mode == IEEE80211_MODE_VHT_5GHZ ||
|
||||
mode == IEEE80211_MODE_VHT_2GHZ) &&
|
||||
!IEEE80211_IS_CHAN_VHT(c))
|
||||
continue;
|
||||
|
||||
/*
|
||||
* Must check HT specially - only match on HT,
|
||||
* not HT+VHT channels
|
||||
*/
|
||||
if ((mode == IEEE80211_MODE_11NA ||
|
||||
mode == IEEE80211_MODE_11NG) &&
|
||||
!IEEE80211_IS_CHAN_HT(c))
|
||||
continue;
|
||||
|
||||
if ((mode == IEEE80211_MODE_11NA ||
|
||||
mode == IEEE80211_MODE_11NG) &&
|
||||
IEEE80211_IS_CHAN_VHT(c))
|
||||
continue;
|
||||
|
||||
/* Check that the modeflags above match */
|
||||
if ((c->ic_flags & modeflags) == modeflags)
|
||||
return c;
|
||||
}
|
||||
@ -2021,6 +2056,7 @@ ieee80211_ioctl_setchannel(struct ieee80211vap *vap,
|
||||
if (c == NULL)
|
||||
return EINVAL;
|
||||
}
|
||||
|
||||
/*
|
||||
* Fine tune channel selection based on desired mode:
|
||||
* if 11b is requested, find the 11b version of any
|
||||
@ -2031,6 +2067,9 @@ ieee80211_ioctl_setchannel(struct ieee80211vap *vap,
|
||||
* 11a channel returned,
|
||||
* if 11ng is requested, find the ht version of any
|
||||
* 11g channel returned,
|
||||
* if 11ac is requested, find the 11ac version
|
||||
* of any 11a/11na channel returned,
|
||||
* (TBD) 11acg (2GHz VHT)
|
||||
* otherwise we should be ok with what we've got.
|
||||
*/
|
||||
switch (vap->iv_des_mode) {
|
||||
@ -2067,6 +2106,17 @@ ieee80211_ioctl_setchannel(struct ieee80211vap *vap,
|
||||
c = c2;
|
||||
}
|
||||
break;
|
||||
case IEEE80211_MODE_VHT_2GHZ:
|
||||
printf("%s: TBD\n", __func__);
|
||||
break;
|
||||
case IEEE80211_MODE_VHT_5GHZ:
|
||||
if (IEEE80211_IS_CHAN_A(c)) {
|
||||
c2 = findchannel(ic, ireq->i_val,
|
||||
IEEE80211_MODE_VHT_5GHZ);
|
||||
if (c2 != NULL)
|
||||
c = c2;
|
||||
}
|
||||
break;
|
||||
default: /* NB: no static turboG */
|
||||
break;
|
||||
}
|
||||
@ -2092,6 +2142,7 @@ ieee80211_ioctl_setcurchan(struct ieee80211vap *vap,
|
||||
error = copyin(ireq->i_data, &chan, sizeof(chan));
|
||||
if (error != 0)
|
||||
return error;
|
||||
|
||||
/* XXX 0xffff overflows 16-bit signed */
|
||||
if (chan.ic_freq == 0 || chan.ic_freq == IEEE80211_CHAN_ANY) {
|
||||
c = IEEE80211_CHAN_ANYC;
|
||||
@ -3321,6 +3372,37 @@ ieee80211_ioctl_set80211(struct ieee80211vap *vap, u_long cmd, struct ieee80211r
|
||||
if (isvapht(vap))
|
||||
error = ERESTART;
|
||||
break;
|
||||
|
||||
/* VHT */
|
||||
case IEEE80211_IOC_VHTCONF:
|
||||
if (ireq->i_val & 1)
|
||||
ieee80211_syncflag_vht(vap, IEEE80211_FVHT_VHT);
|
||||
else
|
||||
ieee80211_syncflag_vht(vap, -IEEE80211_FVHT_VHT);
|
||||
|
||||
if (ireq->i_val & 2)
|
||||
ieee80211_syncflag_vht(vap, IEEE80211_FVHT_USEVHT40);
|
||||
else
|
||||
ieee80211_syncflag_vht(vap, -IEEE80211_FVHT_USEVHT40);
|
||||
|
||||
if (ireq->i_val & 4)
|
||||
ieee80211_syncflag_vht(vap, IEEE80211_FVHT_USEVHT80);
|
||||
else
|
||||
ieee80211_syncflag_vht(vap, -IEEE80211_FVHT_USEVHT80);
|
||||
|
||||
if (ireq->i_val & 8)
|
||||
ieee80211_syncflag_vht(vap, IEEE80211_FVHT_USEVHT80P80);
|
||||
else
|
||||
ieee80211_syncflag_vht(vap, -IEEE80211_FVHT_USEVHT80P80);
|
||||
|
||||
if (ireq->i_val & 16)
|
||||
ieee80211_syncflag_vht(vap, IEEE80211_FVHT_USEVHT160);
|
||||
else
|
||||
ieee80211_syncflag_vht(vap, -IEEE80211_FVHT_USEVHT160);
|
||||
|
||||
error = ENETRESET;
|
||||
break;
|
||||
|
||||
default:
|
||||
error = ieee80211_ioctl_setdefault(vap, ireq);
|
||||
break;
|
||||
|
@ -556,6 +556,7 @@ struct ieee80211_devcaps_req {
|
||||
uint32_t dc_drivercaps; /* general driver caps */
|
||||
uint32_t dc_cryptocaps; /* hardware crypto support */
|
||||
uint32_t dc_htcaps; /* HT/802.11n support */
|
||||
uint32_t dc_vhtcaps; /* VHT/802.11ac capabilities */
|
||||
struct ieee80211req_chaninfo dc_chaninfo;
|
||||
};
|
||||
#define IEEE80211_DEVCAPS_SIZE(_nchan) \
|
||||
@ -704,6 +705,9 @@ struct ieee80211req {
|
||||
#define IEEE80211_IOC_STBC 113 /* STBC Tx/RX (on, off) */
|
||||
#define IEEE80211_IOC_LDPC 114 /* LDPC Tx/RX (on, off) */
|
||||
|
||||
/* VHT */
|
||||
#define IEEE80211_IOC_VHTCONF 130 /* VHT config (off, on; widths) */
|
||||
|
||||
#define IEEE80211_IOC_MESH_ID 170 /* mesh identifier */
|
||||
#define IEEE80211_IOC_MESH_AP 171 /* accepting peerings */
|
||||
#define IEEE80211_IOC_MESH_FWRD 172 /* forward frames */
|
||||
|
@ -142,6 +142,7 @@ struct ieee80211_node {
|
||||
#define IEEE80211_NODE_ASSOCID 0x020000 /* xmit requires associd */
|
||||
#define IEEE80211_NODE_AMSDU_RX 0x040000 /* AMSDU rx enabled */
|
||||
#define IEEE80211_NODE_AMSDU_TX 0x080000 /* AMSDU tx enabled */
|
||||
#define IEEE80211_NODE_VHT 0x100000 /* VHT enabled */
|
||||
uint16_t ni_associd; /* association ID */
|
||||
uint16_t ni_vlan; /* vlan tag */
|
||||
uint16_t ni_txpower; /* current transmit power */
|
||||
@ -226,11 +227,13 @@ struct ieee80211_node {
|
||||
|
||||
/* VHT state */
|
||||
uint32_t ni_vhtcap;
|
||||
uint32_t ni_vhtinfo;
|
||||
uint16_t ni_vht_basicmcs;
|
||||
uint16_t ni_vht_pad2;
|
||||
struct ieee80211_vht_mcs_info ni_vht_mcsinfo;
|
||||
uint8_t ni_vht_chan1; /* 20/40/80/160 - VHT chan1 */
|
||||
uint8_t ni_vht_chan2; /* 80+80 - VHT chan2 */
|
||||
uint16_t ni_vht_pad1;
|
||||
uint8_t ni_vht_chanwidth; /* IEEE80211_VHT_CHANWIDTH_ */
|
||||
uint8_t ni_vht_pad1;
|
||||
uint32_t ni_vht_spare[8];
|
||||
|
||||
/* fast-frames state */
|
||||
|
@ -77,6 +77,7 @@ void ieee80211_promisc(struct ieee80211vap *, bool);
|
||||
void ieee80211_allmulti(struct ieee80211vap *, bool);
|
||||
void ieee80211_syncflag(struct ieee80211vap *, int flag);
|
||||
void ieee80211_syncflag_ht(struct ieee80211vap *, int flag);
|
||||
void ieee80211_syncflag_vht(struct ieee80211vap *, int flag);
|
||||
void ieee80211_syncflag_ext(struct ieee80211vap *, int flag);
|
||||
|
||||
#define ieee80211_input(ni, m, rssi, nf) \
|
||||
@ -361,7 +362,8 @@ struct ieee80211_beacon_offsets {
|
||||
uint8_t *bo_csa; /* start of CSA element */
|
||||
uint8_t *bo_quiet; /* start of Quiet element */
|
||||
uint8_t *bo_meshconf; /* start of MESHCONF element */
|
||||
uint8_t *bo_spare[3];
|
||||
uint8_t *bo_vhtinfo; /* start of VHT info element (XXX VHTCAP?) */
|
||||
uint8_t *bo_spare[2];
|
||||
};
|
||||
struct mbuf *ieee80211_beacon_alloc(struct ieee80211_node *);
|
||||
|
||||
|
@ -68,6 +68,7 @@ __FBSDID("$FreeBSD$");
|
||||
#define ROAM_RATE_HALF_DEFAULT 2*6 /* half-width 11a/g bss */
|
||||
#define ROAM_RATE_QUARTER_DEFAULT 2*3 /* quarter-width 11a/g bss */
|
||||
#define ROAM_MCS_11N_DEFAULT (1 | IEEE80211_RATE_MCS) /* 11n bss */
|
||||
#define ROAM_MCS_11AC_DEFAULT (1 | IEEE80211_RATE_MCS) /* 11ac bss; XXX not used yet */
|
||||
|
||||
void
|
||||
ieee80211_scan_attach(struct ieee80211com *ic)
|
||||
@ -116,6 +117,11 @@ static const struct ieee80211_roamparam defroam[IEEE80211_MODE_MAX] = {
|
||||
.rate = ROAM_MCS_11N_DEFAULT },
|
||||
[IEEE80211_MODE_11NG] = { .rssi = ROAM_RSSI_11B_DEFAULT,
|
||||
.rate = ROAM_MCS_11N_DEFAULT },
|
||||
[IEEE80211_MODE_VHT_2GHZ] = { .rssi = ROAM_RSSI_11B_DEFAULT,
|
||||
.rate = ROAM_MCS_11AC_DEFAULT },
|
||||
[IEEE80211_MODE_VHT_5GHZ] = { .rssi = ROAM_RSSI_11A_DEFAULT,
|
||||
.rate = ROAM_MCS_11AC_DEFAULT },
|
||||
|
||||
};
|
||||
|
||||
void
|
||||
|
@ -250,7 +250,9 @@ struct ieee80211_scanparams {
|
||||
uint8_t *quiet;
|
||||
uint8_t *meshid;
|
||||
uint8_t *meshconf;
|
||||
uint8_t *spare[3];
|
||||
uint8_t *vhtcap;
|
||||
uint8_t *vhtopmode;
|
||||
uint8_t *spare[1];
|
||||
};
|
||||
|
||||
/*
|
||||
|
@ -87,6 +87,14 @@
|
||||
/* XXX TODO: cap this at 1, in case hz is not 1000 */
|
||||
#define IEEE80211_TU_TO_TICKS(x)(((uint64_t)(x) * 1024 * hz) / (1000 * 1000))
|
||||
|
||||
/*
|
||||
* Technically, vhtflags may be 0 /and/ 11ac is enabled.
|
||||
* At some point ic should just grow a flag somewhere that
|
||||
* says that VHT is supported - and then this macro can be
|
||||
* changed.
|
||||
*/
|
||||
#define IEEE80211_CONF_VHT(ic) ((ic)->ic_vhtcaps != 0)
|
||||
|
||||
/*
|
||||
* 802.11 control state is split into a common portion that maps
|
||||
* 1-1 to a physical device and one or more "Virtual AP's" (VAP)
|
||||
@ -653,8 +661,12 @@ MALLOC_DECLARE(M_80211_VAP);
|
||||
#define IEEE80211_FVEN_BITS "\20"
|
||||
|
||||
#define IEEE80211_FVHT_VHT 0x000000001 /* CONF: VHT supported */
|
||||
#define IEEE80211_FVHT_USEVHT40 0x000000002 /* CONF: Use VHT40 */
|
||||
#define IEEE80211_FVHT_USEVHT80 0x000000004 /* CONF: Use VHT80 */
|
||||
#define IEEE80211_FVHT_USEVHT80P80 0x000000008 /* CONF: Use VHT 80+80 */
|
||||
#define IEEE80211_FVHT_USEVHT160 0x000000010 /* CONF: Use VHT160 */
|
||||
#define IEEE80211_VFHT_BITS \
|
||||
"\20\1VHT"
|
||||
"\20\1VHT\2VHT40\3VHT80\4VHT80P80\5VHT160"
|
||||
|
||||
int ic_printf(struct ieee80211com *, const char *, ...) __printflike(2, 3);
|
||||
void ieee80211_ifattach(struct ieee80211com *);
|
||||
@ -829,6 +841,27 @@ ieee80211_htchanflags(const struct ieee80211_channel *c)
|
||||
IEEE80211_IS_CHAN_HT(c) ? IEEE80211_FHT_HT : 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Calculate VHT channel promotion flags for a channel.
|
||||
* XXX belongs in ieee80211_vht.h but needs IEEE80211_FVHT_*
|
||||
*/
|
||||
static __inline int
|
||||
ieee80211_vhtchanflags(const struct ieee80211_channel *c)
|
||||
{
|
||||
|
||||
if (IEEE80211_IS_CHAN_VHT160(c))
|
||||
return IEEE80211_FVHT_USEVHT160;
|
||||
if (IEEE80211_IS_CHAN_VHT80_80(c))
|
||||
return IEEE80211_FVHT_USEVHT80P80;
|
||||
if (IEEE80211_IS_CHAN_VHT80(c))
|
||||
return IEEE80211_FVHT_USEVHT80;
|
||||
if (IEEE80211_IS_CHAN_VHT40(c))
|
||||
return IEEE80211_FVHT_USEVHT40;
|
||||
if (IEEE80211_IS_CHAN_VHT(c))
|
||||
return IEEE80211_FVHT_VHT;
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*
|
||||
* Fetch the current TX power (cap) for the given node.
|
||||
*
|
||||
|
477
sys/net80211/ieee80211_vht.c
Normal file
477
sys/net80211/ieee80211_vht.c
Normal file
@ -0,0 +1,477 @@
|
||||
/*-
|
||||
* Copyright (c) 2017 Adrian Chadd <adrian@FreeBSD.org>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#ifdef __FreeBSD__
|
||||
__FBSDID("$FreeBSD$");
|
||||
#endif
|
||||
|
||||
/*
|
||||
* IEEE 802.11ac-2013 protocol support.
|
||||
*/
|
||||
|
||||
#include "opt_inet.h"
|
||||
#include "opt_wlan.h"
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/malloc.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/endian.h>
|
||||
|
||||
#include <sys/socket.h>
|
||||
|
||||
#include <net/if.h>
|
||||
#include <net/if_var.h>
|
||||
#include <net/if_media.h>
|
||||
#include <net/ethernet.h>
|
||||
|
||||
#include <net80211/ieee80211_var.h>
|
||||
#include <net80211/ieee80211_action.h>
|
||||
#include <net80211/ieee80211_input.h>
|
||||
#include <net80211/ieee80211_vht.h>
|
||||
|
||||
/* define here, used throughout file */
|
||||
#define MS(_v, _f) (((_v) & _f) >> _f##_S)
|
||||
#define SM(_v, _f) (((_v) << _f##_S) & _f)
|
||||
|
||||
#define ADDSHORT(frm, v) do { \
|
||||
frm[0] = (v) & 0xff; \
|
||||
frm[1] = (v) >> 8; \
|
||||
frm += 2; \
|
||||
} while (0)
|
||||
#define ADDWORD(frm, v) do { \
|
||||
frm[0] = (v) & 0xff; \
|
||||
frm[1] = ((v) >> 8) & 0xff; \
|
||||
frm[2] = ((v) >> 16) & 0xff; \
|
||||
frm[3] = ((v) >> 24) & 0xff; \
|
||||
frm += 4; \
|
||||
} while (0)
|
||||
|
||||
/*
|
||||
* XXX TODO: handle WLAN_ACTION_VHT_OPMODE_NOTIF
|
||||
*
|
||||
* Look at mac80211/vht.c:ieee80211_vht_handle_opmode() for further details.
|
||||
*/
|
||||
|
||||
static void
|
||||
ieee80211_vht_init(void)
|
||||
{
|
||||
}
|
||||
|
||||
SYSINIT(wlan_vht, SI_SUB_DRIVERS, SI_ORDER_FIRST, ieee80211_vht_init, NULL);
|
||||
|
||||
void
|
||||
ieee80211_vht_attach(struct ieee80211com *ic)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
ieee80211_vht_detach(struct ieee80211com *ic)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
ieee80211_vht_vattach(struct ieee80211vap *vap)
|
||||
{
|
||||
struct ieee80211com *ic = vap->iv_ic;
|
||||
|
||||
if (! IEEE80211_CONF_VHT(ic))
|
||||
return;
|
||||
|
||||
vap->iv_vhtcaps = ic->ic_vhtcaps;
|
||||
vap->iv_vhtextcaps = ic->ic_vhtextcaps;
|
||||
|
||||
/* XXX assume VHT80 support; should really check vhtcaps */
|
||||
vap->iv_flags_vht =
|
||||
IEEE80211_FVHT_VHT
|
||||
| IEEE80211_FVHT_USEVHT40
|
||||
| IEEE80211_FVHT_USEVHT80;
|
||||
/* XXX TODO: enable VHT80+80, VHT160 capabilities */
|
||||
|
||||
memcpy(&vap->iv_vht_mcsinfo, &ic->ic_vht_mcsinfo,
|
||||
sizeof(struct ieee80211_vht_mcs_info));
|
||||
}
|
||||
|
||||
void
|
||||
ieee80211_vht_vdetach(struct ieee80211vap *vap)
|
||||
{
|
||||
}
|
||||
|
||||
#if 0
|
||||
static void
|
||||
vht_announce(struct ieee80211com *ic, enum ieee80211_phymode mode)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
static int
|
||||
vht_mcs_to_num(int m)
|
||||
{
|
||||
|
||||
switch (m) {
|
||||
case IEEE80211_VHT_MCS_SUPPORT_0_7:
|
||||
return (7);
|
||||
case IEEE80211_VHT_MCS_SUPPORT_0_8:
|
||||
return (8);
|
||||
case IEEE80211_VHT_MCS_SUPPORT_0_9:
|
||||
return (9);
|
||||
default:
|
||||
return (0);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
ieee80211_vht_announce(struct ieee80211com *ic)
|
||||
{
|
||||
int i, tx, rx;
|
||||
|
||||
if (! IEEE80211_CONF_VHT(ic))
|
||||
return;
|
||||
|
||||
/* Channel width */
|
||||
ic_printf(ic, "[VHT] Channel Widths: 20MHz, 40MHz, 80MHz");
|
||||
if (ic->ic_vhtcaps & IEEE80211_VHTCAP_SUPP_CHAN_WIDTH_160_80PLUS80MHZ)
|
||||
printf(" 80+80MHz");
|
||||
if (ic->ic_vhtcaps & IEEE80211_VHTCAP_SUPP_CHAN_WIDTH_160MHZ)
|
||||
printf(" 160MHz");
|
||||
printf("\n");
|
||||
|
||||
/* Features */
|
||||
ic_printf(ic, "[VHT] Features: %b\n", ic->ic_vhtcaps,
|
||||
IEEE80211_VHTCAP_BITS);
|
||||
|
||||
/* For now, just 5GHz VHT. Worry about 2GHz VHT later */
|
||||
for (i = 0; i < 7; i++) {
|
||||
/* Each stream is 2 bits */
|
||||
tx = (ic->ic_vht_mcsinfo.tx_mcs_map >> (2*i)) & 0x3;
|
||||
rx = (ic->ic_vht_mcsinfo.rx_mcs_map >> (2*i)) & 0x3;
|
||||
if (tx == 3 && rx == 3)
|
||||
continue;
|
||||
ic_printf(ic, "[VHT] NSS %d: TX MCS 0..%d, RX MCS 0..%d\n",
|
||||
i + 1,
|
||||
vht_mcs_to_num(tx),
|
||||
vht_mcs_to_num(rx));
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
ieee80211_vht_node_init(struct ieee80211_node *ni)
|
||||
{
|
||||
|
||||
IEEE80211_NOTE(ni->ni_vap, IEEE80211_MSG_11N, ni,
|
||||
"%s: called", __func__);
|
||||
ni->ni_flags |= IEEE80211_NODE_VHT;
|
||||
}
|
||||
|
||||
void
|
||||
ieee80211_vht_node_cleanup(struct ieee80211_node *ni)
|
||||
{
|
||||
|
||||
IEEE80211_NOTE(ni->ni_vap, IEEE80211_MSG_11N, ni,
|
||||
"%s: called", __func__);
|
||||
ni->ni_flags &= ~IEEE80211_NODE_VHT;
|
||||
ni->ni_vhtcap = 0;
|
||||
bzero(&ni->ni_vht_mcsinfo, sizeof(struct ieee80211_vht_mcs_info));
|
||||
}
|
||||
|
||||
/*
|
||||
* Parse an 802.11ac VHT operation IE.
|
||||
*/
|
||||
void
|
||||
ieee80211_parse_vhtopmode(struct ieee80211_node *ni, const uint8_t *ie)
|
||||
{
|
||||
/* vht operation */
|
||||
ni->ni_vht_chanwidth = ie[2];
|
||||
ni->ni_vht_chan1 = ie[3];
|
||||
ni->ni_vht_chan2 = ie[4];
|
||||
ni->ni_vht_basicmcs = le16dec(ie + 5);
|
||||
|
||||
#if 0
|
||||
printf("%s: chan1=%d, chan2=%d, chanwidth=%d, basicmcs=0x%04x\n",
|
||||
__func__,
|
||||
ni->ni_vht_chan1,
|
||||
ni->ni_vht_chan2,
|
||||
ni->ni_vht_chanwidth,
|
||||
ni->ni_vht_basicmcs);
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
* Parse an 802.11ac VHT capability IE.
|
||||
*/
|
||||
void
|
||||
ieee80211_parse_vhtcap(struct ieee80211_node *ni, const uint8_t *ie)
|
||||
{
|
||||
|
||||
/* vht capability */
|
||||
ni->ni_vhtcap = le32dec(ie + 2);
|
||||
|
||||
/* suppmcs */
|
||||
ni->ni_vht_mcsinfo.rx_mcs_map = le16dec(ie + 6);
|
||||
ni->ni_vht_mcsinfo.rx_highest = le16dec(ie + 8);
|
||||
ni->ni_vht_mcsinfo.tx_mcs_map = le16dec(ie + 10);
|
||||
ni->ni_vht_mcsinfo.tx_highest = le16dec(ie + 12);
|
||||
}
|
||||
|
||||
int
|
||||
ieee80211_vht_updateparams(struct ieee80211_node *ni,
|
||||
const uint8_t *vhtcap_ie,
|
||||
const uint8_t *vhtop_ie)
|
||||
{
|
||||
|
||||
//printf("%s: called\n", __func__);
|
||||
|
||||
ieee80211_parse_vhtcap(ni, vhtcap_ie);
|
||||
ieee80211_parse_vhtopmode(ni, vhtop_ie);
|
||||
return (0);
|
||||
}
|
||||
|
||||
void
|
||||
ieee80211_setup_vht_rates(struct ieee80211_node *ni,
|
||||
const uint8_t *vhtcap_ie,
|
||||
const uint8_t *vhtop_ie)
|
||||
{
|
||||
|
||||
//printf("%s: called\n", __func__);
|
||||
/* XXX TODO */
|
||||
}
|
||||
|
||||
void
|
||||
ieee80211_vht_timeout(struct ieee80211com *ic)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
ieee80211_vht_node_join(struct ieee80211_node *ni)
|
||||
{
|
||||
|
||||
IEEE80211_NOTE(ni->ni_vap, IEEE80211_MSG_11N, ni,
|
||||
"%s: called", __func__);
|
||||
}
|
||||
|
||||
void
|
||||
ieee80211_vht_node_leave(struct ieee80211_node *ni)
|
||||
{
|
||||
|
||||
IEEE80211_NOTE(ni->ni_vap, IEEE80211_MSG_11N, ni,
|
||||
"%s: called", __func__);
|
||||
}
|
||||
|
||||
uint8_t *
|
||||
ieee80211_add_vhtcap(uint8_t *frm, struct ieee80211_node *ni)
|
||||
{
|
||||
uint32_t cap;
|
||||
|
||||
memset(frm, '\0', sizeof(struct ieee80211_ie_vhtcap));
|
||||
|
||||
frm[0] = IEEE80211_ELEMID_VHT_CAP;
|
||||
frm[1] = sizeof(struct ieee80211_ie_vhtcap) - 2;
|
||||
frm += 2;
|
||||
|
||||
/*
|
||||
* For now, don't do any configuration.
|
||||
* Just populate the node configuration.
|
||||
* We can worry about making it configurable later.
|
||||
*/
|
||||
|
||||
cap = ni->ni_vhtcap;
|
||||
|
||||
/*
|
||||
* XXX TODO: any capability changes required by
|
||||
* configuration.
|
||||
*/
|
||||
|
||||
/* 32-bit VHT capability */
|
||||
ADDWORD(frm, cap);
|
||||
|
||||
/* suppmcs */
|
||||
ADDSHORT(frm, ni->ni_vht_mcsinfo.rx_mcs_map);
|
||||
ADDSHORT(frm, ni->ni_vht_mcsinfo.rx_highest);
|
||||
ADDSHORT(frm, ni->ni_vht_mcsinfo.tx_mcs_map);
|
||||
ADDSHORT(frm, ni->ni_vht_mcsinfo.tx_highest);
|
||||
|
||||
return (frm);
|
||||
}
|
||||
|
||||
static uint8_t
|
||||
ieee80211_vht_get_chwidth_ie(struct ieee80211_channel *c)
|
||||
{
|
||||
|
||||
/*
|
||||
* XXX TODO: look at the node configuration as
|
||||
* well?
|
||||
*/
|
||||
|
||||
if (IEEE80211_IS_CHAN_VHT160(c)) {
|
||||
return IEEE80211_VHT_CHANWIDTH_160MHZ;
|
||||
}
|
||||
if (IEEE80211_IS_CHAN_VHT80_80(c)) {
|
||||
return IEEE80211_VHT_CHANWIDTH_80P80MHZ;
|
||||
}
|
||||
if (IEEE80211_IS_CHAN_VHT80(c)) {
|
||||
return IEEE80211_VHT_CHANWIDTH_80MHZ;
|
||||
}
|
||||
if (IEEE80211_IS_CHAN_VHT40(c)) {
|
||||
return IEEE80211_VHT_CHANWIDTH_USE_HT;
|
||||
}
|
||||
if (IEEE80211_IS_CHAN_VHT20(c)) {
|
||||
return IEEE80211_VHT_CHANWIDTH_USE_HT;
|
||||
}
|
||||
|
||||
/* We shouldn't get here */
|
||||
printf("%s: called on a non-VHT channel (freq=%d, flags=0x%08x\n",
|
||||
__func__,
|
||||
(int) c->ic_freq,
|
||||
c->ic_flags);
|
||||
return IEEE80211_VHT_CHANWIDTH_USE_HT;
|
||||
}
|
||||
|
||||
/*
|
||||
* Note: this just uses the current channel information;
|
||||
* it doesn't use the node info after parsing.
|
||||
*
|
||||
* XXX TODO: need to make the basic MCS set configurable.
|
||||
* XXX TODO: read 802.11-2013 to determine what to set
|
||||
* chwidth to when scanning. I have a feeling
|
||||
* it isn't involved in scanning and we shouldn't
|
||||
* be sending it; and I don't yet know what to set
|
||||
* it to for IBSS or hostap where the peer may be
|
||||
* a completely different channel width to us.
|
||||
*/
|
||||
uint8_t *
|
||||
ieee80211_add_vhtinfo(uint8_t *frm, struct ieee80211_node *ni)
|
||||
{
|
||||
memset(frm, '\0', sizeof(struct ieee80211_ie_vht_operation));
|
||||
|
||||
frm[0] = IEEE80211_ELEMID_VHT_OPMODE;
|
||||
frm[1] = sizeof(struct ieee80211_ie_vht_operation) - 2;
|
||||
frm += 2;
|
||||
|
||||
/*
|
||||
* XXX if it's a station, then see if we have a node
|
||||
* channel or ANYC. If it's ANYC then assume we're
|
||||
* scanning, and announce our capabilities.
|
||||
*
|
||||
* This should set the "20/40/80/160MHz wide config";
|
||||
* the 80/80 or 160MHz wide config is done in VHTCAP.
|
||||
*
|
||||
* Other modes - just limit it to the channel.
|
||||
*/
|
||||
|
||||
/* 8-bit chanwidth */
|
||||
*frm++ = ieee80211_vht_get_chwidth_ie(ni->ni_chan);
|
||||
|
||||
/* 8-bit freq1 */
|
||||
*frm++ = ni->ni_chan->ic_vht_ch_freq1;
|
||||
|
||||
/* 8-bit freq2 */
|
||||
*frm++ = ni->ni_chan->ic_vht_ch_freq2;
|
||||
|
||||
/* 16-bit basic MCS set - just MCS0..7 for NSS=1 for now */
|
||||
ADDSHORT(frm, 0xfffc);
|
||||
|
||||
return (frm);
|
||||
}
|
||||
|
||||
void
|
||||
ieee80211_vht_update_cap(struct ieee80211_node *ni, const uint8_t *vhtcap_ie,
|
||||
const uint8_t *vhtop_ie)
|
||||
{
|
||||
|
||||
ieee80211_parse_vhtcap(ni, vhtcap_ie);
|
||||
ieee80211_parse_vhtopmode(ni, vhtop_ie);
|
||||
}
|
||||
|
||||
static struct ieee80211_channel *
|
||||
findvhtchan(struct ieee80211com *ic, struct ieee80211_channel *c, int vhtflags)
|
||||
{
|
||||
|
||||
return (ieee80211_find_channel(ic, c->ic_freq,
|
||||
(c->ic_flags & ~IEEE80211_CHAN_VHT) | vhtflags));
|
||||
}
|
||||
|
||||
/*
|
||||
* Handle channel promotion to VHT, similar to ieee80211_ht_adjust_channel().
|
||||
*/
|
||||
struct ieee80211_channel *
|
||||
ieee80211_vht_adjust_channel(struct ieee80211com *ic,
|
||||
struct ieee80211_channel *chan, int flags)
|
||||
{
|
||||
struct ieee80211_channel *c;
|
||||
|
||||
/* First case - handle channel demotion - if VHT isn't set */
|
||||
if ((flags & IEEE80211_FVHT_VHT) == 0) {
|
||||
#if 0
|
||||
printf("%s: demoting channel %d/0x%08x\n", __func__,
|
||||
chan->ic_ieee, chan->ic_flags);
|
||||
#endif
|
||||
c = ieee80211_find_channel(ic, chan->ic_freq,
|
||||
chan->ic_flags & ~IEEE80211_CHAN_VHT);
|
||||
if (c == NULL)
|
||||
c = chan;
|
||||
#if 0
|
||||
printf("%s: .. to %d/0x%08x\n", __func__,
|
||||
c->ic_ieee, c->ic_flags);
|
||||
#endif
|
||||
return (c);
|
||||
}
|
||||
|
||||
/*
|
||||
* We can upgrade to VHT - attempt to do so
|
||||
*
|
||||
* Note: we don't clear the HT flags, these are the hints
|
||||
* for HT40U/HT40D when selecting VHT40 or larger channels.
|
||||
*/
|
||||
/* Start with VHT80 */
|
||||
c = NULL;
|
||||
if ((c == NULL) && (flags & IEEE80211_FVHT_USEVHT160))
|
||||
c = findvhtchan(ic, chan, IEEE80211_CHAN_VHT80);
|
||||
|
||||
if ((c == NULL) && (flags & IEEE80211_FVHT_USEVHT80P80))
|
||||
c = findvhtchan(ic, chan, IEEE80211_CHAN_VHT80_80);
|
||||
|
||||
if ((c == NULL) && (flags & IEEE80211_FVHT_USEVHT80))
|
||||
c = findvhtchan(ic, chan, IEEE80211_CHAN_VHT80);
|
||||
|
||||
if ((c == NULL) && (flags & IEEE80211_FVHT_USEVHT40))
|
||||
c = findvhtchan(ic, chan, IEEE80211_CHAN_VHT40U);
|
||||
if ((c == NULL) && (flags & IEEE80211_FVHT_USEVHT40))
|
||||
c = findvhtchan(ic, chan, IEEE80211_CHAN_VHT40D);
|
||||
/*
|
||||
* If we get here, VHT20 is always possible because we checked
|
||||
* for IEEE80211_FVHT_VHT above.
|
||||
*/
|
||||
if (c == NULL)
|
||||
c = findvhtchan(ic, chan, IEEE80211_CHAN_VHT20);
|
||||
|
||||
if (c != NULL)
|
||||
chan = c;
|
||||
|
||||
#if 0
|
||||
printf("%s: selected %d/0x%08x\n", __func__, c->ic_ieee, c->ic_flags);
|
||||
#endif
|
||||
return (chan);
|
||||
}
|
63
sys/net80211/ieee80211_vht.h
Normal file
63
sys/net80211/ieee80211_vht.h
Normal file
@ -0,0 +1,63 @@
|
||||
/*-
|
||||
* Copyright (c) 2016 Adrian Chadd <adrian@FreeBSD.org>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
#ifndef _NET80211_IEEE80211_VHT_H_
|
||||
#define _NET80211_IEEE80211_VHT_H_
|
||||
|
||||
void ieee80211_vht_attach(struct ieee80211com *);
|
||||
void ieee80211_vht_detach(struct ieee80211com *);
|
||||
void ieee80211_vht_vattach(struct ieee80211vap *);
|
||||
void ieee80211_vht_vdetach(struct ieee80211vap *);
|
||||
|
||||
void ieee80211_vht_announce(struct ieee80211com *);
|
||||
|
||||
void ieee80211_vht_node_init(struct ieee80211_node *);
|
||||
void ieee80211_vht_node_cleanup(struct ieee80211_node *);
|
||||
|
||||
void ieee80211_parse_vhtopmode(struct ieee80211_node *, const uint8_t *);
|
||||
void ieee80211_parse_vhtcap(struct ieee80211_node *, const uint8_t *);
|
||||
|
||||
int ieee80211_vht_updateparams(struct ieee80211_node *,
|
||||
const uint8_t *, const uint8_t *);
|
||||
void ieee80211_setup_vht_rates(struct ieee80211_node *,
|
||||
const uint8_t *, const uint8_t *);
|
||||
|
||||
void ieee80211_vht_timeout(struct ieee80211com *ic);
|
||||
|
||||
void ieee80211_vht_node_join(struct ieee80211_node *ni);
|
||||
void ieee80211_vht_node_leave(struct ieee80211_node *ni);
|
||||
|
||||
uint8_t * ieee80211_add_vhtcap(uint8_t *frm, struct ieee80211_node *);
|
||||
uint8_t * ieee80211_add_vhtinfo(uint8_t *frm, struct ieee80211_node *);
|
||||
|
||||
void ieee80211_vht_update_cap(struct ieee80211_node *,
|
||||
const uint8_t *, const uint8_t *);
|
||||
|
||||
struct ieee80211_channel *
|
||||
ieee80211_vht_adjust_channel(struct ieee80211com *,
|
||||
struct ieee80211_channel *, int);
|
||||
|
||||
#endif /* _NET80211_IEEE80211_VHT_H_ */
|
@ -241,7 +241,7 @@ SYSCTL_VNET_PCPUSTAT(_net_inet6_ipsec6, IPSECCTL_STATS, ipsecstats,
|
||||
#endif /* INET6 */
|
||||
|
||||
static int ipsec_in_reject(struct secpolicy *, const struct mbuf *);
|
||||
static int ipsec_setspidx_inpcb(const struct mbuf *, struct inpcb *);
|
||||
static int ipsec_setspidx_inpcb(const struct mbuf *, struct inpcb *, u_int);
|
||||
static int ipsec_setspidx(const struct mbuf *, struct secpolicyindex *, int);
|
||||
static void ipsec4_get_ulp(const struct mbuf *m, struct secpolicyindex *, int);
|
||||
static int ipsec4_setspidx_ipaddr(const struct mbuf *, struct secpolicyindex *);
|
||||
@ -343,7 +343,7 @@ ipsec_getpolicybysock(const struct mbuf *m, u_int dir, struct inpcb *inp,
|
||||
}
|
||||
|
||||
/* Set spidx in pcb. */
|
||||
*error = ipsec_setspidx_inpcb(m, inp);
|
||||
*error = ipsec_setspidx_inpcb(m, inp, dir);
|
||||
if (*error)
|
||||
return (NULL);
|
||||
|
||||
@ -500,8 +500,9 @@ ipsec4_checkpolicy(const struct mbuf *m, u_int dir, int *error,
|
||||
}
|
||||
|
||||
static int
|
||||
ipsec_setspidx_inpcb(const struct mbuf *m, struct inpcb *inp)
|
||||
ipsec_setspidx_inpcb(const struct mbuf *m, struct inpcb *inp, u_int dir)
|
||||
{
|
||||
struct secpolicyindex *spidx;
|
||||
int error;
|
||||
|
||||
IPSEC_ASSERT(inp != NULL, ("null inp"));
|
||||
@ -509,11 +510,13 @@ ipsec_setspidx_inpcb(const struct mbuf *m, struct inpcb *inp)
|
||||
IPSEC_ASSERT(inp->inp_sp->sp_out != NULL && inp->inp_sp->sp_in != NULL,
|
||||
("null sp_in || sp_out"));
|
||||
|
||||
error = ipsec_setspidx(m, &inp->inp_sp->sp_in->spidx, 1);
|
||||
if (dir == IPSEC_DIR_INBOUND)
|
||||
spidx = &inp->inp_sp->sp_in->spidx;
|
||||
else
|
||||
spidx = &inp->inp_sp->sp_out->spidx;
|
||||
error = ipsec_setspidx(m, spidx, 1);
|
||||
if (error == 0) {
|
||||
inp->inp_sp->sp_in->spidx.dir = IPSEC_DIR_INBOUND;
|
||||
inp->inp_sp->sp_out->spidx = inp->inp_sp->sp_in->spidx;
|
||||
inp->inp_sp->sp_out->spidx.dir = IPSEC_DIR_OUTBOUND;
|
||||
spidx->dir = dir;
|
||||
} else {
|
||||
bzero(&inp->inp_sp->sp_in->spidx,
|
||||
sizeof (inp->inp_sp->sp_in->spidx));
|
||||
|
@ -435,6 +435,7 @@ struct msghdr {
|
||||
#endif
|
||||
#ifdef _KERNEL
|
||||
#define MSG_SOCALLBCK 0x10000 /* for use by socket callbacks - soreceive (TCP) */
|
||||
#define MSG_MORETOCOME 0x20000 /* additional data pending */
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
@ -65,7 +65,7 @@
|
||||
#define _POSIX_MONOTONIC_CLOCK 200112L
|
||||
#define _POSIX_NO_TRUNC 1
|
||||
#define _POSIX_PRIORITIZED_IO (-1)
|
||||
#define _POSIX_PRIORITY_SCHEDULING 200112L
|
||||
#define _POSIX_PRIORITY_SCHEDULING 0
|
||||
#define _POSIX_RAW_SOCKETS 200112L
|
||||
#define _POSIX_REALTIME_SIGNALS 200112L
|
||||
#define _POSIX_SEMAPHORES 200112L
|
||||
|
@ -1494,6 +1494,7 @@ OLD_FILES+=usr/bin/llvm-mc
|
||||
OLD_FILES+=usr/bin/llvm-modextract
|
||||
OLD_FILES+=usr/bin/llvm-nm
|
||||
OLD_FILES+=usr/bin/llvm-pdbdump
|
||||
OLD_FILES+=usr/bin/llvm-ranlib
|
||||
OLD_FILES+=usr/bin/llvm-rtdyld
|
||||
OLD_FILES+=usr/bin/llvm-symbolizer
|
||||
OLD_FILES+=usr/bin/llvm-xray
|
||||
|
@ -1,2 +1,2 @@
|
||||
.\" $FreeBSD$
|
||||
Set to build USB gadget kernel modules.
|
||||
Set to not build USB gadget kernel modules.
|
||||
|
@ -7,4 +7,6 @@ SRCS+= llvm-ar.cpp
|
||||
|
||||
LIBADD+= z
|
||||
|
||||
LINKS+= ${BINDIR}/llvm-ar ${BINDIR}/llvm-ranlib
|
||||
|
||||
.include "../llvm.prog.mk"
|
||||
|
@ -99,6 +99,8 @@ eof: if (ferror(fp1))
|
||||
} else
|
||||
if (feof(fp2))
|
||||
eofmsg(file2);
|
||||
fclose(fp2);
|
||||
fclose(fp1);
|
||||
if (dfound)
|
||||
exit(DIFF_EXIT);
|
||||
}
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
.include <bsd.own.mk>
|
||||
|
||||
ATF_TESTS_SH+= cmp_test2
|
||||
NETBSD_ATF_TESTS_SH= cmp_test
|
||||
|
||||
.include <netbsd-tests.test.mk>
|
||||
|
67
usr.bin/cmp/tests/cmp_test2.sh
Executable file
67
usr.bin/cmp/tests/cmp_test2.sh
Executable file
@ -0,0 +1,67 @@
|
||||
# Copyright (c) 2017 Alan Somers
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
||||
# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
|
||||
# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
# $FreeBSD$
|
||||
|
||||
atf_test_case special
|
||||
special_head() {
|
||||
atf_set "descr" "Test cmp(1)'s handling of non-regular files"
|
||||
}
|
||||
special_body() {
|
||||
echo 0123456789abcdef > a
|
||||
echo 0123456789abcdeg > b
|
||||
cat a | atf_check -s exit:0 cmp a -
|
||||
cat a | atf_check -s exit:0 cmp - a
|
||||
cat b | atf_check -s not-exit:0 cmp a -
|
||||
cat b | atf_check -s not-exit:0 cmp - a
|
||||
true
|
||||
}
|
||||
|
||||
atf_test_case symlink
|
||||
symlink_head() {
|
||||
atf_set "descr" "Test cmp(1)'s handling of symlinks"
|
||||
}
|
||||
symlink_body() {
|
||||
echo 0123456789abcdef > a
|
||||
echo 0123456789abcdeg > b
|
||||
ln -s a a.lnk
|
||||
ln -s b b.lnk
|
||||
ln -s a a2.lnk
|
||||
cp a adup
|
||||
ln -s adup adup.lnk
|
||||
atf_check -s exit:0 cmp a a.lnk
|
||||
atf_check -s exit:0 cmp a.lnk a
|
||||
atf_check -s not-exit:0 -o ignore cmp a b.lnk
|
||||
atf_check -s not-exit:0 -o ignore cmp b.lnk a
|
||||
atf_check -s not-exit:0 -o ignore -e ignore cmp -h a a.lnk
|
||||
atf_check -s not-exit:0 -o ignore -e ignore cmp -h a.lnk a
|
||||
atf_check -s exit:0 cmp -h a.lnk a2.lnk
|
||||
atf_check -s not-exit:0 -o ignore -e ignore cmp -h a.lnk adup.lnk
|
||||
}
|
||||
|
||||
atf_init_test_cases()
|
||||
{
|
||||
atf_add_test_case special
|
||||
atf_add_test_case symlink
|
||||
}
|
@ -30,6 +30,10 @@
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#include <sys/capsicum.h>
|
||||
|
||||
#include <err.h>
|
||||
#include <errno.h>
|
||||
#include <utmpx.h>
|
||||
|
||||
#include <algorithm>
|
||||
@ -51,6 +55,10 @@ main(int argc, char **)
|
||||
}
|
||||
|
||||
setutxent();
|
||||
|
||||
if (cap_enter() < 0 && errno != ENOSYS)
|
||||
err(1, "Failed to enter capability mode.");
|
||||
|
||||
while ((ut = getutxent()) != NULL)
|
||||
if (ut->ut_type == USER_PROCESS)
|
||||
names.insert(ut->ut_user);
|
||||
|
@ -31,7 +31,7 @@
|
||||
.\" @(#)chgrp.1 8.3 (Berkeley) 3/31/94
|
||||
.\" $FreeBSD$
|
||||
.\"
|
||||
.Dd April 20, 2015
|
||||
.Dd January 7, 2017
|
||||
.Dt CHGRP 1
|
||||
.Os
|
||||
.Sh NAME
|
||||
@ -120,6 +120,17 @@ The user invoking
|
||||
.Nm
|
||||
must belong to the specified group and be the owner of the file,
|
||||
or be the super-user.
|
||||
.Pp
|
||||
If
|
||||
.Nm
|
||||
receives a
|
||||
.Dv SIGINFO
|
||||
signal (see the
|
||||
.Cm status
|
||||
argument for
|
||||
.Xr stty 1 ) ,
|
||||
then the current filename as well as the old and new group names are
|
||||
displayed.
|
||||
.Sh FILES
|
||||
.Bl -tag -width /etc/group -compact
|
||||
.It Pa /etc/group
|
||||
|
@ -28,7 +28,7 @@
|
||||
.\" @(#)chown.8 8.3 (Berkeley) 3/31/94
|
||||
.\" $FreeBSD$
|
||||
.\"
|
||||
.Dd April 20, 2015
|
||||
.Dd January 7, 2017
|
||||
.Dt CHOWN 8
|
||||
.Os
|
||||
.Sh NAME
|
||||
@ -135,6 +135,17 @@ group name.
|
||||
.Pp
|
||||
The ownership of a file may only be altered by a super-user for
|
||||
obvious security reasons.
|
||||
.Pp
|
||||
If
|
||||
.Nm
|
||||
receives a
|
||||
.Dv SIGINFO
|
||||
signal (see the
|
||||
.Cm status
|
||||
argument for
|
||||
.Xr stty 1 ) ,
|
||||
then the current filename as well as the old and new file owner and group
|
||||
are displayed.
|
||||
.Sh EXIT STATUS
|
||||
.Ex -std
|
||||
.Sh COMPATIBILITY
|
||||
|
@ -52,6 +52,7 @@ __FBSDID("$FreeBSD$");
|
||||
#include <grp.h>
|
||||
#include <libgen.h>
|
||||
#include <pwd.h>
|
||||
#include <signal.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
@ -63,11 +64,20 @@ static void a_uid(const char *);
|
||||
static void chownerr(const char *);
|
||||
static uid_t id(const char *, const char *);
|
||||
static void usage(void);
|
||||
static void print_info(const FTSENT *, int);
|
||||
|
||||
static uid_t uid;
|
||||
static gid_t gid;
|
||||
static int ischown;
|
||||
static const char *gname;
|
||||
static volatile sig_atomic_t siginfo;
|
||||
|
||||
static void
|
||||
siginfo_handler(int sig __unused)
|
||||
{
|
||||
|
||||
siginfo = 1;
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
@ -119,6 +129,8 @@ main(int argc, char **argv)
|
||||
if (argc < 2)
|
||||
usage();
|
||||
|
||||
(void)signal(SIGINFO, siginfo_handler);
|
||||
|
||||
if (Rflag) {
|
||||
if (hflag && (Hflag || Lflag))
|
||||
errx(1, "the -R%c and -h options may not be "
|
||||
@ -189,6 +201,10 @@ main(int argc, char **argv)
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if (siginfo) {
|
||||
print_info(p, 2);
|
||||
siginfo = 0;
|
||||
}
|
||||
if ((uid == (uid_t)-1 || uid == p->fts_statp->st_uid) &&
|
||||
(gid == (gid_t)-1 || gid == p->fts_statp->st_gid))
|
||||
continue;
|
||||
@ -196,35 +212,8 @@ main(int argc, char **argv)
|
||||
== -1 && !fflag) {
|
||||
chownerr(p->fts_path);
|
||||
rval = 1;
|
||||
} else if (vflag) {
|
||||
printf("%s", p->fts_path);
|
||||
if (vflag > 1) {
|
||||
if (ischown) {
|
||||
printf(": %ju:%ju -> %ju:%ju",
|
||||
(uintmax_t)
|
||||
p->fts_statp->st_uid,
|
||||
(uintmax_t)
|
||||
p->fts_statp->st_gid,
|
||||
(uid == (uid_t)-1) ?
|
||||
(uintmax_t)
|
||||
p->fts_statp->st_uid :
|
||||
(uintmax_t)uid,
|
||||
(gid == (gid_t)-1) ?
|
||||
(uintmax_t)
|
||||
p->fts_statp->st_gid :
|
||||
(uintmax_t)gid);
|
||||
} else {
|
||||
printf(": %ju -> %ju",
|
||||
(uintmax_t)
|
||||
p->fts_statp->st_gid,
|
||||
(gid == (gid_t)-1) ?
|
||||
(uintmax_t)
|
||||
p->fts_statp->st_gid :
|
||||
(uintmax_t)gid);
|
||||
}
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
} else if (vflag)
|
||||
print_info(p, vflag);
|
||||
}
|
||||
if (errno)
|
||||
err(1, "fts_read");
|
||||
@ -315,3 +304,26 @@ usage(void)
|
||||
"usage: chgrp [-fhvx] [-R [-H | -L | -P]] group file ...");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
static void
|
||||
print_info(const FTSENT *p, int vflag)
|
||||
{
|
||||
|
||||
printf("%s", p->fts_path);
|
||||
if (vflag > 1) {
|
||||
if (ischown) {
|
||||
printf(": %ju:%ju -> %ju:%ju",
|
||||
(uintmax_t)p->fts_statp->st_uid,
|
||||
(uintmax_t)p->fts_statp->st_gid,
|
||||
(uid == (uid_t)-1) ?
|
||||
(uintmax_t)p->fts_statp->st_uid : (uintmax_t)uid,
|
||||
(gid == (gid_t)-1) ?
|
||||
(uintmax_t)p->fts_statp->st_gid : (uintmax_t)gid);
|
||||
} else {
|
||||
printf(": %ju -> %ju", (uintmax_t)p->fts_statp->st_gid,
|
||||
(gid == (gid_t)-1) ?
|
||||
(uintmax_t)p->fts_statp->st_gid : (uintmax_t)gid);
|
||||
}
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user