diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2018-08-09 14:02:09 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2018-09-21 10:29:38 +0200 |
commit | bb80d9df8bac71eedee1a6787ca63aef972a7e48 (patch) | |
tree | 1b5cb9443c5ead5706c35afb618abbbd1592315e | |
parent | Update to FreeBSD head 2017-10-01 (diff) | |
download | rtems-libbsd-bb80d9df8bac71eedee1a6787ca63aef972a7e48.tar.bz2 |
Update to FreeBSD head 2017-12-01
Git mirror commit e724f51f811a4b2bd29447f8b85ab5c2f9b88266.
Update #3472.
1197 files changed, 6529 insertions, 2521 deletions
diff --git a/freebsd-org b/freebsd-org -Subproject b2f0376b45428f13151d229c5ae9d4d8f74acbd +Subproject e724f51f811a4b2bd29447f8b85ab5c2f9b8826 diff --git a/freebsd/bin/hostname/hostname.c b/freebsd/bin/hostname/hostname.c index 964eb52b..1838fbcb 100644 --- a/freebsd/bin/hostname/hostname.c +++ b/freebsd/bin/hostname/hostname.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-user-space.h> /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1988, 1993 * The Regents of the University of California. All rights reserved. * diff --git a/freebsd/contrib/tcpdump/addrtoname.c b/freebsd/contrib/tcpdump/addrtoname.c index 35ae7186..fb4550cc 100644 --- a/freebsd/contrib/tcpdump/addrtoname.c +++ b/freebsd/contrib/tcpdump/addrtoname.c @@ -32,10 +32,10 @@ #include "config.h" #endif -#ifdef WITH_CASPER +#ifdef HAVE_CASPER #include <libcasper.h> #include <casper/cap_dns.h> -#endif /* WITH_CASPER */ +#endif /* HAVE_CASPER */ #include <netdissect-stdinc.h> @@ -208,7 +208,7 @@ intoa(uint32_t addr) static uint32_t f_netmask; static uint32_t f_localnet; -#ifdef WITH_CASPER +#ifdef HAVE_CASPER extern cap_channel_t *capdns; #endif @@ -256,7 +256,7 @@ getname(netdissect_options *ndo, const u_char *ap) */ if (!ndo->ndo_nflag && (addr & f_netmask) == f_localnet) { -#ifdef WITH_CASPER +#ifdef HAVE_CASPER if (capdns != NULL) { hp = cap_gethostbyaddr(capdns, (char *)&addr, 4, AF_INET); @@ -317,7 +317,7 @@ getname6(netdissect_options *ndo, const u_char *ap) * Do not print names if -n was given. */ if (!ndo->ndo_nflag) { -#ifdef WITH_CASPER +#ifdef HAVE_CASPER if (capdns != NULL) { hp = cap_gethostbyaddr(capdns, (char *)&addr, sizeof(addr), AF_INET6); diff --git a/freebsd/contrib/tcpdump/tcpdump.c b/freebsd/contrib/tcpdump/tcpdump.c index 6e0fcd1c..52fd2260 100644 --- a/freebsd/contrib/tcpdump/tcpdump.c +++ b/freebsd/contrib/tcpdump/tcpdump.c @@ -94,10 +94,10 @@ The Regents of the University of California. All rights reserved.\n"; #include <sys/ioccom.h> #include <net/bpf.h> #include <libgen.h> -#ifdef WITH_CASPER +#ifdef HAVE_CASPER #include <libcasper.h> #include <casper/cap_dns.h> -#endif /* WITH_CASPER */ +#endif /* HAVE_CASPER */ #endif /* HAVE_CAPSICUM */ #include <pcap.h> #include <signal.h> @@ -199,7 +199,7 @@ static int infoprint; char *program_name; -#ifdef WITH_CASPER +#ifdef HAVE_CASPER cap_channel_t *capdns; #endif @@ -764,7 +764,7 @@ get_next_file(FILE *VFile, char *ptr) return ret; } -#ifdef WITH_CASPER +#ifdef HAVE_CASPER static cap_channel_t * capdns_setup(void) { @@ -791,7 +791,7 @@ capdns_setup(void) return (capdnsloc); } -#endif /* WITH_CASPER */ +#endif /* HAVE_CASPER */ #ifdef HAVE_PCAP_SET_TSTAMP_PRECISION static int @@ -1980,10 +1980,10 @@ main(int argc, char **argv) exit_tcpdump(0); } -#ifdef WITH_CASPER +#ifdef HAVE_CASPER if (!ndo->ndo_nflag) capdns = capdns_setup(); -#endif /* WITH_CASPER */ +#endif /* HAVE_CASPER */ init_print(ndo, localnet, netmask, timezone_offset); @@ -2207,11 +2207,11 @@ main(int argc, char **argv) #ifdef HAVE_CAPSICUM cansandbox = (VFileName == NULL && zflag == NULL); -#ifdef WITH_CASPER +#ifdef HAVE_CASPER cansandbox = (cansandbox && (ndo->ndo_nflag || capdns != NULL)); #else cansandbox = (cansandbox && ndo->ndo_nflag); -#endif /* WITH_CASPER */ +#endif /* HAVE_CASPER */ if (cansandbox && cap_enter() < 0 && errno != ENOSYS) error("unable to enter the capability mode"); #endif /* HAVE_CAPSICUM */ diff --git a/freebsd/crypto/openssl/crypto/asn1/a_bitstr.c b/freebsd/crypto/openssl/crypto/asn1/a_bitstr.c index a98bb9b9..deb4cb53 100644 --- a/freebsd/crypto/openssl/crypto/asn1/a_bitstr.c +++ b/freebsd/crypto/openssl/crypto/asn1/a_bitstr.c @@ -58,6 +58,7 @@ * [including the GNU Public Licence.] */ +#include <limits.h> #include <stdio.h> #include "cryptlib.h" #include <openssl/asn1.h> @@ -138,6 +139,11 @@ ASN1_BIT_STRING *c2i_ASN1_BIT_STRING(ASN1_BIT_STRING **a, goto err; } + if (len > INT_MAX) { + i = ASN1_R_STRING_TOO_LONG; + goto err; + } + if ((a == NULL) || ((*a) == NULL)) { if ((ret = M_ASN1_BIT_STRING_new()) == NULL) return (NULL); diff --git a/freebsd/crypto/openssl/crypto/asn1/asn1_int.h b/freebsd/crypto/openssl/crypto/asn1/asn1_int.h new file mode 100644 index 00000000..c9fd8b12 --- /dev/null +++ b/freebsd/crypto/openssl/crypto/asn1/asn1_int.h @@ -0,0 +1,63 @@ +/* asn1t.h */ +/* + * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL project + * 2006. + */ +/* ==================================================================== + * Copyright (c) 2006 The OpenSSL Project. 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. + * + * 3. All advertising materials mentioning features or use of this + * software must display the following acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" + * + * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to + * endorse or promote products derived from this software without + * prior written permission. For written permission, please contact + * licensing@OpenSSL.org. + * + * 5. Products derived from this software may not be called "OpenSSL" + * nor may "OpenSSL" appear in their names without prior written + * permission of the OpenSSL Project. + * + * 6. Redistributions of any form whatsoever must retain the following + * acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" + * + * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY + * EXPRESSED 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 OpenSSL PROJECT OR + * ITS 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. + * ==================================================================== + * + * This product includes cryptographic software written by Eric Young + * (eay@cryptsoft.com). This product includes software written by Tim + * Hudson (tjh@cryptsoft.com). + * + */ + +/* Internal ASN1 template structures and functions: not for application use */ + +void asn1_item_combine_free(ASN1_VALUE **pval, const ASN1_ITEM *it, + int combine); diff --git a/freebsd/crypto/openssl/crypto/asn1/tasn_fre.c b/freebsd/crypto/openssl/crypto/asn1/tasn_fre.c index b298dceb..e734f2d5 100644 --- a/freebsd/crypto/openssl/crypto/asn1/tasn_fre.c +++ b/freebsd/crypto/openssl/crypto/asn1/tasn_fre.c @@ -63,9 +63,7 @@ #include <openssl/asn1.h> #include <openssl/asn1t.h> #include <openssl/objects.h> - -static void asn1_item_combine_free(ASN1_VALUE **pval, const ASN1_ITEM *it, - int combine); +#include "asn1_int.h" /* Free up an ASN1 structure */ @@ -79,8 +77,7 @@ void ASN1_item_ex_free(ASN1_VALUE **pval, const ASN1_ITEM *it) asn1_item_combine_free(pval, it, 0); } -static void asn1_item_combine_free(ASN1_VALUE **pval, const ASN1_ITEM *it, - int combine) +void asn1_item_combine_free(ASN1_VALUE **pval, const ASN1_ITEM *it, int combine) { const ASN1_TEMPLATE *tt = NULL, *seqtt; const ASN1_EXTERN_FUNCS *ef; diff --git a/freebsd/crypto/openssl/crypto/asn1/tasn_new.c b/freebsd/crypto/openssl/crypto/asn1/tasn_new.c index 96f8cc87..3e0f792c 100644 --- a/freebsd/crypto/openssl/crypto/asn1/tasn_new.c +++ b/freebsd/crypto/openssl/crypto/asn1/tasn_new.c @@ -65,6 +65,7 @@ #include <openssl/err.h> #include <openssl/asn1t.h> #include <string.h> +#include "asn1_int.h" static int asn1_item_ex_combine_new(ASN1_VALUE **pval, const ASN1_ITEM *it, int combine); @@ -201,7 +202,7 @@ static int asn1_item_ex_combine_new(ASN1_VALUE **pval, const ASN1_ITEM *it, return 1; memerr2: - ASN1_item_ex_free(pval, it); + asn1_item_combine_free(pval, it, combine); memerr: ASN1err(ASN1_F_ASN1_ITEM_EX_COMBINE_NEW, ERR_R_MALLOC_FAILURE); #ifdef CRYPTO_MDEBUG @@ -211,7 +212,7 @@ static int asn1_item_ex_combine_new(ASN1_VALUE **pval, const ASN1_ITEM *it, return 0; auxerr2: - ASN1_item_ex_free(pval, it); + asn1_item_combine_free(pval, it, combine); auxerr: ASN1err(ASN1_F_ASN1_ITEM_EX_COMBINE_NEW, ASN1_R_AUX_ERROR); #ifdef CRYPTO_MDEBUG diff --git a/freebsd/crypto/openssl/crypto/asn1/x_name.c b/freebsd/crypto/openssl/crypto/asn1/x_name.c index d0460b34..258a05ad 100644 --- a/freebsd/crypto/openssl/crypto/asn1/x_name.c +++ b/freebsd/crypto/openssl/crypto/asn1/x_name.c @@ -525,19 +525,11 @@ static int i2d_name_canon(STACK_OF(STACK_OF_X509_NAME_ENTRY) * _intname, int X509_NAME_set(X509_NAME **xn, X509_NAME *name) { - X509_NAME *in; - - if (!xn || !name) - return (0); - - if (*xn != name) { - in = X509_NAME_dup(name); - if (in != NULL) { - X509_NAME_free(*xn); - *xn = in; - } - } - return (*xn != NULL); + if ((name = X509_NAME_dup(name)) == NULL) + return 0; + X509_NAME_free(*xn); + *xn = name; + return 1; } IMPLEMENT_STACK_OF(X509_NAME_ENTRY) diff --git a/freebsd/crypto/openssl/crypto/asn1/x_pkey.c b/freebsd/crypto/openssl/crypto/asn1/x_pkey.c index 75ebc078..a3765035 100644 --- a/freebsd/crypto/openssl/crypto/asn1/x_pkey.c +++ b/freebsd/crypto/openssl/crypto/asn1/x_pkey.c @@ -108,10 +108,14 @@ X509_PKEY *X509_PKEY_new(void) X509_PKEY *ret = NULL; ASN1_CTX c; - M_ASN1_New_Malloc(ret, X509_PKEY); + ret = OPENSSL_malloc(sizeof(X509_PKEY)); + if (ret == NULL) { + c.line = __LINE__; + goto err; + } ret->version = 0; - M_ASN1_New(ret->enc_algor, X509_ALGOR_new); - M_ASN1_New(ret->enc_pkey, M_ASN1_OCTET_STRING_new); + ret->enc_algor = X509_ALGOR_new(); + ret->enc_pkey = M_ASN1_OCTET_STRING_new(); ret->dec_pkey = NULL; ret->key_length = 0; ret->key_data = NULL; @@ -119,8 +123,15 @@ X509_PKEY *X509_PKEY_new(void) ret->cipher.cipher = NULL; memset(ret->cipher.iv, 0, EVP_MAX_IV_LENGTH); ret->references = 1; - return (ret); - M_ASN1_New_Error(ASN1_F_X509_PKEY_NEW); + if (ret->enc_algor == NULL || ret->enc_pkey == NULL) { + c.line = __LINE__; + goto err; + } + return ret; +err: + X509_PKEY_free(ret); + ASN1_MAC_H_err(ASN1_F_X509_PKEY_NEW, ERR_R_MALLOC_FAILURE, c.line); + return NULL; } void X509_PKEY_free(X509_PKEY *x) diff --git a/freebsd/crypto/openssl/crypto/bn/bn_exp.c b/freebsd/crypto/openssl/crypto/bn/bn_exp.c index ff7592cb..7c1ea0a4 100644 --- a/freebsd/crypto/openssl/crypto/bn/bn_exp.c +++ b/freebsd/crypto/openssl/crypto/bn/bn_exp.c @@ -147,7 +147,8 @@ int BN_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx) int i, bits, ret = 0; BIGNUM *v, *rr; - if (BN_get_flags(p, BN_FLG_CONSTTIME) != 0) { + if (BN_get_flags(p, BN_FLG_CONSTTIME) != 0 + || BN_get_flags(a, BN_FLG_CONSTTIME) != 0) { /* BN_FLG_CONSTTIME only supported by BN_mod_exp_mont() */ BNerr(BN_F_BN_EXP, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED); return -1; @@ -247,7 +248,9 @@ int BN_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, const BIGNUM *m, if (BN_is_odd(m)) { # ifdef MONT_EXP_WORD if (a->top == 1 && !a->neg - && (BN_get_flags(p, BN_FLG_CONSTTIME) == 0)) { + && (BN_get_flags(p, BN_FLG_CONSTTIME) == 0) + && (BN_get_flags(a, BN_FLG_CONSTTIME) == 0) + && (BN_get_flags(m, BN_FLG_CONSTTIME) == 0)) { BN_ULONG A = a->d[0]; ret = BN_mod_exp_mont_word(r, A, p, m, ctx, NULL); } else @@ -279,7 +282,9 @@ int BN_mod_exp_recp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BIGNUM *val[TABLE_SIZE]; BN_RECP_CTX recp; - if (BN_get_flags(p, BN_FLG_CONSTTIME) != 0) { + if (BN_get_flags(p, BN_FLG_CONSTTIME) != 0 + || BN_get_flags(a, BN_FLG_CONSTTIME) != 0 + || BN_get_flags(m, BN_FLG_CONSTTIME) != 0) { /* BN_FLG_CONSTTIME only supported by BN_mod_exp_mont() */ BNerr(BN_F_BN_MOD_EXP_RECP, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED); return -1; @@ -413,7 +418,9 @@ int BN_mod_exp_mont(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p, BIGNUM *val[TABLE_SIZE]; BN_MONT_CTX *mont = NULL; - if (BN_get_flags(p, BN_FLG_CONSTTIME) != 0) { + if (BN_get_flags(p, BN_FLG_CONSTTIME) != 0 + || BN_get_flags(a, BN_FLG_CONSTTIME) != 0 + || BN_get_flags(m, BN_FLG_CONSTTIME) != 0) { return BN_mod_exp_mont_consttime(rr, a, p, m, ctx, in_mont); } @@ -1219,7 +1226,8 @@ int BN_mod_exp_mont_word(BIGNUM *rr, BN_ULONG a, const BIGNUM *p, #define BN_TO_MONTGOMERY_WORD(r, w, mont) \ (BN_set_word(r, (w)) && BN_to_montgomery(r, r, (mont), ctx)) - if (BN_get_flags(p, BN_FLG_CONSTTIME) != 0) { + if (BN_get_flags(p, BN_FLG_CONSTTIME) != 0 + || BN_get_flags(m, BN_FLG_CONSTTIME) != 0) { /* BN_FLG_CONSTTIME only supported by BN_mod_exp_mont() */ BNerr(BN_F_BN_MOD_EXP_MONT_WORD, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED); return -1; @@ -1350,7 +1358,9 @@ int BN_mod_exp_simple(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, /* Table of variables obtained from 'ctx' */ BIGNUM *val[TABLE_SIZE]; - if (BN_get_flags(p, BN_FLG_CONSTTIME) != 0) { + if (BN_get_flags(p, BN_FLG_CONSTTIME) != 0 + || BN_get_flags(a, BN_FLG_CONSTTIME) != 0 + || BN_get_flags(m, BN_FLG_CONSTTIME) != 0) { /* BN_FLG_CONSTTIME only supported by BN_mod_exp_mont() */ BNerr(BN_F_BN_MOD_EXP_SIMPLE, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED); return -1; diff --git a/freebsd/crypto/openssl/crypto/bn/bn_lib.c b/freebsd/crypto/openssl/crypto/bn/bn_lib.c index 10679fbd..da58a91a 100644 --- a/freebsd/crypto/openssl/crypto/bn/bn_lib.c +++ b/freebsd/crypto/openssl/crypto/bn/bn_lib.c @@ -526,6 +526,9 @@ BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b) memcpy(a->d, b->d, sizeof(b->d[0]) * b->top); #endif + if (BN_get_flags(b, BN_FLG_CONSTTIME) != 0) + BN_set_flags(a, BN_FLG_CONSTTIME); + a->top = b->top; a->neg = b->neg; bn_check_top(a); diff --git a/freebsd/crypto/openssl/crypto/bn/bn_mont.c b/freebsd/crypto/openssl/crypto/bn/bn_mont.c index a9c001f7..ddf25f5c 100644 --- a/freebsd/crypto/openssl/crypto/bn/bn_mont.c +++ b/freebsd/crypto/openssl/crypto/bn/bn_mont.c @@ -396,6 +396,9 @@ int BN_MONT_CTX_set(BN_MONT_CTX *mont, const BIGNUM *mod, BN_CTX *ctx) tmod.dmax = 2; tmod.neg = 0; + if (BN_get_flags(mod, BN_FLG_CONSTTIME) != 0) + BN_set_flags(&tmod, BN_FLG_CONSTTIME); + mont->ri = (BN_num_bits(mod) + (BN_BITS2 - 1)) / BN_BITS2 * BN_BITS2; # if defined(OPENSSL_BN_ASM_MONT) && (BN_BITS2<=32) diff --git a/freebsd/crypto/openssl/crypto/bn/bn_mul.c b/freebsd/crypto/openssl/crypto/bn/bn_mul.c index ac45a788..2cd04c19 100644 --- a/freebsd/crypto/openssl/crypto/bn/bn_mul.c +++ b/freebsd/crypto/openssl/crypto/bn/bn_mul.c @@ -1034,46 +1034,6 @@ int BN_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx) rr->top = top; goto end; } -# if 0 - if (i == 1 && !BN_get_flags(b, BN_FLG_STATIC_DATA)) { - BIGNUM *tmp_bn = (BIGNUM *)b; - if (bn_wexpand(tmp_bn, al) == NULL) - goto err; - tmp_bn->d[bl] = 0; - bl++; - i--; - } else if (i == -1 && !BN_get_flags(a, BN_FLG_STATIC_DATA)) { - BIGNUM *tmp_bn = (BIGNUM *)a; - if (bn_wexpand(tmp_bn, bl) == NULL) - goto err; - tmp_bn->d[al] = 0; - al++; - i++; - } - if (i == 0) { - /* symmetric and > 4 */ - /* 16 or larger */ - j = BN_num_bits_word((BN_ULONG)al); - j = 1 << (j - 1); - k = j + j; - t = BN_CTX_get(ctx); - if (al == j) { /* exact multiple */ - if (bn_wexpand(t, k * 2) == NULL) - goto err; - if (bn_wexpand(rr, k * 2) == NULL) - goto err; - bn_mul_recursive(rr->d, a->d, b->d, al, t->d); - } else { - if (bn_wexpand(t, k * 4) == NULL) - goto err; - if (bn_wexpand(rr, k * 4) == NULL) - goto err; - bn_mul_part_recursive(rr->d, a->d, b->d, al - j, j, t->d); - } - rr->top = top; - goto end; - } -# endif } #endif /* BN_RECURSION */ if (bn_wexpand(rr, top) == NULL) diff --git a/freebsd/crypto/openssl/crypto/bn/bn_x931p.c b/freebsd/crypto/openssl/crypto/bn/bn_x931p.c index b8971d20..4e081b2f 100644 --- a/freebsd/crypto/openssl/crypto/bn/bn_x931p.c +++ b/freebsd/crypto/openssl/crypto/bn/bn_x931p.c @@ -219,6 +219,8 @@ int BN_X931_generate_Xpq(BIGNUM *Xp, BIGNUM *Xq, int nbits, BN_CTX *ctx) BN_CTX_start(ctx); t = BN_CTX_get(ctx); + if (t == NULL) + goto err; for (i = 0; i < 1000; i++) { if (!BN_rand(Xq, nbits, 1, 0)) @@ -257,10 +259,12 @@ int BN_X931_generate_prime_ex(BIGNUM *p, BIGNUM *p1, BIGNUM *p2, int ret = 0; BN_CTX_start(ctx); - if (!Xp1) + if (Xp1 == NULL) Xp1 = BN_CTX_get(ctx); - if (!Xp2) + if (Xp2 == NULL) Xp2 = BN_CTX_get(ctx); + if (Xp1 == NULL || Xp2 == NULL) + goto error; if (!BN_rand(Xp1, 101, 0, 0)) goto error; diff --git a/freebsd/crypto/openssl/crypto/cryptlib.c b/freebsd/crypto/openssl/crypto/cryptlib.c index a204ad4b..8445beb9 100644 --- a/freebsd/crypto/openssl/crypto/cryptlib.c +++ b/freebsd/crypto/openssl/crypto/cryptlib.c @@ -471,11 +471,18 @@ void CRYPTO_THREADID_set_pointer(CRYPTO_THREADID *id, void *ptr) } } +#ifdef OPENSSL_FIPS +extern int FIPS_crypto_threadid_set_callback(void (*func) (CRYPTO_THREADID *)); +#endif + int CRYPTO_THREADID_set_callback(void (*func) (CRYPTO_THREADID *)) { if (threadid_callback) return 0; threadid_callback = func; +#ifdef OPENSSL_FIPS + FIPS_crypto_threadid_set_callback(func); +#endif return 1; } diff --git a/freebsd/crypto/openssl/crypto/dh/dh.h b/freebsd/crypto/openssl/crypto/dh/dh.h index a228c7a7..80b28fb3 100644 --- a/freebsd/crypto/openssl/crypto/dh/dh.h +++ b/freebsd/crypto/openssl/crypto/dh/dh.h @@ -257,11 +257,13 @@ DH *DH_get_1024_160(void); DH *DH_get_2048_224(void); DH *DH_get_2048_256(void); +# ifndef OPENSSL_NO_CMS /* RFC2631 KDF */ int DH_KDF_X9_42(unsigned char *out, size_t outlen, const unsigned char *Z, size_t Zlen, ASN1_OBJECT *key_oid, const unsigned char *ukm, size_t ukmlen, const EVP_MD *md); +# endif # define EVP_PKEY_CTX_set_dh_paramgen_prime_len(ctx, len) \ EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DH, EVP_PKEY_OP_PARAMGEN, \ diff --git a/freebsd/crypto/openssl/crypto/dh/dh_kdf.c b/freebsd/crypto/openssl/crypto/dh/dh_kdf.c index b44aaeba..10a7b61d 100644 --- a/freebsd/crypto/openssl/crypto/dh/dh_kdf.c +++ b/freebsd/crypto/openssl/crypto/dh/dh_kdf.c @@ -53,6 +53,9 @@ * ==================================================================== */ +#include <e_os.h> + +#ifndef OPENSSL_NO_CMS #include <string.h> #include <openssl/dh.h> #include <openssl/evp.h> @@ -187,3 +190,4 @@ int DH_KDF_X9_42(unsigned char *out, size_t outlen, EVP_MD_CTX_cleanup(&mctx); return rv; } +#endif diff --git a/freebsd/crypto/openssl/crypto/dh/dh_pmeth.c b/freebsd/crypto/openssl/crypto/dh/dh_pmeth.c index 34d7dc88..fe5684ce 100644 --- a/freebsd/crypto/openssl/crypto/dh/dh_pmeth.c +++ b/freebsd/crypto/openssl/crypto/dh/dh_pmeth.c @@ -209,7 +209,11 @@ static int pkey_dh_ctrl(EVP_PKEY_CTX *ctx, int type, int p1, void *p2) case EVP_PKEY_CTRL_DH_KDF_TYPE: if (p1 == -2) return dctx->kdf_type; +#ifdef OPENSSL_NO_CMS + if (p1 != EVP_PKEY_DH_KDF_NONE) +#else if (p1 != EVP_PKEY_DH_KDF_NONE && p1 != EVP_PKEY_DH_KDF_X9_42) +#endif return -2; dctx->kdf_type = p1; return 1; @@ -450,7 +454,9 @@ static int pkey_dh_derive(EVP_PKEY_CTX *ctx, unsigned char *key, return ret; *keylen = ret; return 1; - } else if (dctx->kdf_type == EVP_PKEY_DH_KDF_X9_42) { + } +#ifndef OPENSSL_NO_CMS + else if (dctx->kdf_type == EVP_PKEY_DH_KDF_X9_42) { unsigned char *Z = NULL; size_t Zlen = 0; if (!dctx->kdf_outlen || !dctx->kdf_oid) @@ -481,6 +487,7 @@ static int pkey_dh_derive(EVP_PKEY_CTX *ctx, unsigned char *key, } return ret; } +#endif return 1; } diff --git a/freebsd/crypto/openssl/crypto/dsa/dsa_ameth.c b/freebsd/crypto/openssl/crypto/dsa/dsa_ameth.c index c5f642f3..3da90130 100644 --- a/freebsd/crypto/openssl/crypto/dsa/dsa_ameth.c +++ b/freebsd/crypto/openssl/crypto/dsa/dsa_ameth.c @@ -260,6 +260,7 @@ static int dsa_priv_decode(EVP_PKEY *pkey, PKCS8_PRIV_KEY_INFO *p8) goto dsaerr; } + BN_set_flags(dsa->priv_key, BN_FLG_CONSTTIME); if (!BN_mod_exp(dsa->pub_key, dsa->g, dsa->priv_key, dsa->p, ctx)) { DSAerr(DSA_F_DSA_PRIV_DECODE, DSA_R_BN_ERROR); goto dsaerr; diff --git a/freebsd/crypto/openssl/crypto/dsa/dsa_gen.c b/freebsd/crypto/openssl/crypto/dsa/dsa_gen.c index a130c7be..cdca6fcc 100644 --- a/freebsd/crypto/openssl/crypto/dsa/dsa_gen.c +++ b/freebsd/crypto/openssl/crypto/dsa/dsa_gen.c @@ -484,6 +484,8 @@ int dsa_builtin_paramgen2(DSA *ret, size_t L, size_t N, } else { p = BN_CTX_get(ctx); q = BN_CTX_get(ctx); + if (q == NULL) + goto err; } if (!BN_lshift(test, BN_value_one(), L - 1)) diff --git a/freebsd/crypto/openssl/crypto/dsa/dsa_ossl.c b/freebsd/crypto/openssl/crypto/dsa/dsa_ossl.c index 5207d8f2..715511c2 100644 --- a/freebsd/crypto/openssl/crypto/dsa/dsa_ossl.c +++ b/freebsd/crypto/openssl/crypto/dsa/dsa_ossl.c @@ -226,7 +226,9 @@ static int dsa_sign_setup(DSA *dsa, BN_CTX *ctx_in, BIGNUM **kinvp, { BN_CTX *ctx; BIGNUM k, kq, *K, *kinv = NULL, *r = NULL; + BIGNUM l, m; int ret = 0; + int q_bits; if (!dsa->p || !dsa->q || !dsa->g) { DSAerr(DSA_F_DSA_SIGN_SETUP, DSA_R_MISSING_PARAMETERS); @@ -235,6 +237,8 @@ static int dsa_sign_setup(DSA *dsa, BN_CTX *ctx_in, BIGNUM **kinvp, BN_init(&k); BN_init(&kq); + BN_init(&l); + BN_init(&m); if (ctx_in == NULL) { if ((ctx = BN_CTX_new()) == NULL) @@ -245,6 +249,13 @@ static int dsa_sign_setup(DSA *dsa, BN_CTX *ctx_in, BIGNUM **kinvp, if ((r = BN_new()) == NULL) goto err; + /* Preallocate space */ + q_bits = BN_num_bits(dsa->q); + if (!BN_set_bit(&k, q_bits) + || !BN_set_bit(&l, q_bits) + || !BN_set_bit(&m, q_bits)) + goto err; + /* Get random k */ do if (!BN_rand_range(&k, dsa->q)) @@ -265,24 +276,23 @@ static int dsa_sign_setup(DSA *dsa, BN_CTX *ctx_in, BIGNUM **kinvp, /* Compute r = (g^k mod p) mod q */ if ((dsa->flags & DSA_FLAG_NO_EXP_CONSTTIME) == 0) { - if (!BN_copy(&kq, &k)) - goto err; - - BN_set_flags(&kq, BN_FLG_CONSTTIME); - /* * We do not want timing information to leak the length of k, so we - * compute g^k using an equivalent exponent of fixed length. (This - * is a kludge that we need because the BN_mod_exp_mont() does not - * let us specify the desired timing behaviour.) + * compute G^k using an equivalent scalar of fixed bit-length. + * + * We unconditionally perform both of these additions to prevent a + * small timing information leakage. We then choose the sum that is + * one bit longer than the modulus. + * + * TODO: revisit the BN_copy aiming for a memory access agnostic + * conditional copy. */ - - if (!BN_add(&kq, &kq, dsa->q)) + if (!BN_add(&l, &k, dsa->q) + || !BN_add(&m, &l, dsa->q) + || !BN_copy(&kq, BN_num_bits(&l) > q_bits ? &l : &m)) goto err; - if (BN_num_bits(&kq) <= BN_num_bits(dsa->q)) { - if (!BN_add(&kq, &kq, dsa->q)) - goto err; - } + + BN_set_flags(&kq, BN_FLG_CONSTTIME); K = &kq; } else { @@ -316,7 +326,9 @@ static int dsa_sign_setup(DSA *dsa, BN_CTX *ctx_in, BIGNUM **kinvp, BN_CTX_free(ctx); BN_clear_free(&k); BN_clear_free(&kq); - return (ret); + BN_clear_free(&l); + BN_clear_free(&m); + return ret; } static int dsa_do_verify(const unsigned char *dgst, int dgst_len, diff --git a/freebsd/crypto/openssl/crypto/ec/ecp_mont.c b/freebsd/crypto/openssl/crypto/ec/ecp_mont.c index 22acc3d1..f3524e2c 100644 --- a/freebsd/crypto/openssl/crypto/ec/ecp_mont.c +++ b/freebsd/crypto/openssl/crypto/ec/ecp_mont.c @@ -249,6 +249,8 @@ int ec_GFp_mont_group_set_curve(EC_GROUP *group, const BIGNUM *p, BN_CTX_free(new_ctx); if (mont != NULL) BN_MONT_CTX_free(mont); + if (one != NULL) + BN_free(one); return ret; } diff --git a/freebsd/crypto/openssl/crypto/ec/ecp_nistp224.c b/freebsd/crypto/openssl/crypto/ec/ecp_nistp224.c index d40f611b..aba7ff6d 100644 --- a/freebsd/crypto/openssl/crypto/ec/ecp_nistp224.c +++ b/freebsd/crypto/openssl/crypto/ec/ecp_nistp224.c @@ -718,7 +718,7 @@ static limb felem_is_zero(const felem in) return (zero | two224m96p1 | two225m97p2); } -static limb felem_is_zero_int(const felem in) +static int felem_is_zero_int(const void *in) { return (int)(felem_is_zero(in) & ((limb) 1)); } @@ -1393,7 +1393,6 @@ static void make_points_affine(size_t num, felem points[ /* num */ ][3], sizeof(felem), tmp_felems, (void (*)(void *))felem_one, - (int (*)(const void *)) felem_is_zero_int, (void (*)(void *, const void *)) felem_assign, diff --git a/freebsd/crypto/openssl/crypto/ec/ecp_nistp256.c b/freebsd/crypto/openssl/crypto/ec/ecp_nistp256.c index adf1a459..c34288fc 100644 --- a/freebsd/crypto/openssl/crypto/ec/ecp_nistp256.c +++ b/freebsd/crypto/openssl/crypto/ec/ecp_nistp256.c @@ -979,7 +979,7 @@ static limb smallfelem_is_zero(const smallfelem small) return result; } -static int smallfelem_is_zero_int(const smallfelem small) +static int smallfelem_is_zero_int(const void *small) { return (int)(smallfelem_is_zero(small) & ((limb) 1)); } @@ -1981,7 +1981,6 @@ static void make_points_affine(size_t num, smallfelem points[][3], sizeof(smallfelem), tmp_smallfelems, (void (*)(void *))smallfelem_one, - (int (*)(const void *)) smallfelem_is_zero_int, (void (*)(void *, const void *)) smallfelem_assign, diff --git a/freebsd/crypto/openssl/crypto/ec/ecp_nistp521.c b/freebsd/crypto/openssl/crypto/ec/ecp_nistp521.c index 8e28ecd7..3d83b2d7 100644 --- a/freebsd/crypto/openssl/crypto/ec/ecp_nistp521.c +++ b/freebsd/crypto/openssl/crypto/ec/ecp_nistp521.c @@ -873,7 +873,7 @@ static limb felem_is_zero(const felem in) return is_zero; } -static int felem_is_zero_int(const felem in) +static int felem_is_zero_int(const void *in) { return (int)(felem_is_zero(in) & ((limb) 1)); } @@ -1789,7 +1789,6 @@ static void make_points_affine(size_t num, felem points[][3], sizeof(felem), tmp_felems, (void (*)(void *))felem_one, - (int (*)(const void *)) felem_is_zero_int, (void (*)(void *, const void *)) felem_assign, diff --git a/freebsd/crypto/openssl/crypto/ecdh/ech_lib.c b/freebsd/crypto/openssl/crypto/ecdh/ech_lib.c index 3bf95415..4bf047a6 100644 --- a/freebsd/crypto/openssl/crypto/ecdh/ech_lib.c +++ b/freebsd/crypto/openssl/crypto/ecdh/ech_lib.c @@ -227,9 +227,16 @@ ECDH_DATA *ecdh_check(EC_KEY *key) */ ecdh_data_free(ecdh_data); ecdh_data = (ECDH_DATA *)data; + } else if (EC_KEY_get_key_method_data(key, ecdh_data_dup, + ecdh_data_free, + ecdh_data_free) != ecdh_data) { + /* Or an out of memory error in EC_KEY_insert_key_method_data. */ + ecdh_data_free(ecdh_data); + return NULL; } - } else + } else { ecdh_data = (ECDH_DATA *)data; + } #ifdef OPENSSL_FIPS if (FIPS_mode() && !(ecdh_data->flags & ECDH_FLAG_FIPS_METHOD) && !(EC_KEY_get_flags(key) & EC_FLAG_NON_FIPS_ALLOW)) { diff --git a/freebsd/crypto/openssl/crypto/ecdsa/ecs_lib.c b/freebsd/crypto/openssl/crypto/ecdsa/ecs_lib.c index b97747d9..d6ae2c01 100644 --- a/freebsd/crypto/openssl/crypto/ecdsa/ecs_lib.c +++ b/freebsd/crypto/openssl/crypto/ecdsa/ecs_lib.c @@ -205,9 +205,16 @@ ECDSA_DATA *ecdsa_check(EC_KEY *key) */ ecdsa_data_free(ecdsa_data); ecdsa_data = (ECDSA_DATA *)data; + } else if (EC_KEY_get_key_method_data(key, ecdsa_data_dup, + ecdsa_data_free, + ecdsa_data_free) != ecdsa_data) { + /* Or an out of memory error in EC_KEY_insert_key_method_data. */ + ecdsa_data_free(ecdsa_data); + return NULL; } - } else + } else { ecdsa_data = (ECDSA_DATA *)data; + } #ifdef OPENSSL_FIPS if (FIPS_mode() && !(ecdsa_data->flags & ECDSA_FLAG_FIPS_METHOD) && !(EC_KEY_get_flags(key) & EC_FLAG_NON_FIPS_ALLOW)) { diff --git a/freebsd/crypto/openssl/crypto/ecdsa/ecs_ossl.c b/freebsd/crypto/openssl/crypto/ecdsa/ecs_ossl.c index 786ff794..ccc1d30a 100644 --- a/freebsd/crypto/openssl/crypto/ecdsa/ecs_ossl.c +++ b/freebsd/crypto/openssl/crypto/ecdsa/ecs_ossl.c @@ -97,6 +97,7 @@ static int ecdsa_sign_setup(EC_KEY *eckey, BN_CTX *ctx_in, BIGNUM **kinvp, EC_POINT *tmp_point = NULL; const EC_GROUP *group; int ret = 0; + int order_bits; if (eckey == NULL || (group = EC_KEY_get0_group(eckey)) == NULL) { ECDSAerr(ECDSA_F_ECDSA_SIGN_SETUP, ERR_R_PASSED_NULL_PARAMETER); @@ -128,6 +129,13 @@ static int ecdsa_sign_setup(EC_KEY *eckey, BN_CTX *ctx_in, BIGNUM **kinvp, goto err; } + /* Preallocate space */ + order_bits = BN_num_bits(order); + if (!BN_set_bit(k, order_bits) + || !BN_set_bit(r, order_bits) + || !BN_set_bit(X, order_bits)) + goto err; + do { /* get random k */ do @@ -141,13 +149,19 @@ static int ecdsa_sign_setup(EC_KEY *eckey, BN_CTX *ctx_in, BIGNUM **kinvp, /* * We do not want timing information to leak the length of k, so we * compute G*k using an equivalent scalar of fixed bit-length. + * + * We unconditionally perform both of these additions to prevent a + * small timing information leakage. We then choose the sum that is + * one bit longer than the order. This guarantees the code + * path used in the constant time implementations elsewhere. + * + * TODO: revisit the BN_copy aiming for a memory access agnostic + * conditional copy. */ - - if (!BN_add(k, k, order)) + if (!BN_add(r, k, order) + || !BN_add(X, r, order) + || !BN_copy(k, BN_num_bits(r) > order_bits ? r : X)) goto err; - if (BN_num_bits(k) <= BN_num_bits(order)) - if (!BN_add(k, k, order)) - goto err; /* compute r the x-coordinate of generator * k */ if (!EC_POINT_mul(group, tmp_point, k, NULL, NULL, ctx)) { diff --git a/freebsd/crypto/openssl/crypto/err/err.c b/freebsd/crypto/openssl/crypto/err/err.c index d4be17cd..326a1670 100644 --- a/freebsd/crypto/openssl/crypto/err/err.c +++ b/freebsd/crypto/openssl/crypto/err/err.c @@ -727,6 +727,8 @@ void ERR_put_error(int lib, int func, int reason, const char *file, int line) } #endif es = ERR_get_state(); + if (es == NULL) + return; es->top = (es->top + 1) % ERR_NUM_ERRORS; if (es->top == es->bottom) @@ -744,6 +746,8 @@ void ERR_clear_error(void) ERR_STATE *es; es = ERR_get_state(); + if (es == NULL) + return; for (i = 0; i < ERR_NUM_ERRORS; i++) { err_clear(es, i); @@ -808,6 +812,8 @@ static unsigned long get_error_values(int inc, int top, const char **file, unsigned long ret; es = ERR_get_state(); + if (es == NULL) + return 0; if (inc && top) { if (file) @@ -1018,7 +1024,6 @@ void ERR_remove_state(unsigned long pid) ERR_STATE *ERR_get_state(void) { - static ERR_STATE fallback; ERR_STATE *ret, tmp, *tmpp = NULL; int i; CRYPTO_THREADID tid; @@ -1032,7 +1037,7 @@ ERR_STATE *ERR_get_state(void) if (ret == NULL) { ret = (ERR_STATE *)OPENSSL_malloc(sizeof(ERR_STATE)); if (ret == NULL) - return (&fallback); + return NULL; CRYPTO_THREADID_cpy(&ret->tid, &tid); ret->top = 0; ret->bottom = 0; @@ -1044,7 +1049,7 @@ ERR_STATE *ERR_get_state(void) /* To check if insertion failed, do a get. */ if (ERRFN(thread_get_item) (ret) != ret) { ERR_STATE_free(ret); /* could not insert it */ - return (&fallback); + return NULL; } /* * If a race occured in this function and we came second, tmpp is the @@ -1068,10 +1073,10 @@ void ERR_set_error_data(char *data, int flags) int i; es = ERR_get_state(); + if (es == NULL) + return; i = es->top; - if (i == 0) - i = ERR_NUM_ERRORS - 1; err_clear_data(es, i); es->err_data[i] = data; @@ -1123,6 +1128,8 @@ int ERR_set_mark(void) ERR_STATE *es; es = ERR_get_state(); + if (es == NULL) + return 0; if (es->bottom == es->top) return 0; @@ -1135,6 +1142,8 @@ int ERR_pop_to_mark(void) ERR_STATE *es; es = ERR_get_state(); + if (es == NULL) + return 0; while (es->bottom != es->top && (es->err_flags[es->top] & ERR_FLAG_MARK) == 0) { diff --git a/freebsd/crypto/openssl/crypto/evp/e_aes_cbc_hmac_sha1.c b/freebsd/crypto/openssl/crypto/evp/e_aes_cbc_hmac_sha1.c index 2aaf8a62..90be1fb0 100644 --- a/freebsd/crypto/openssl/crypto/evp/e_aes_cbc_hmac_sha1.c +++ b/freebsd/crypto/openssl/crypto/evp/e_aes_cbc_hmac_sha1.c @@ -581,12 +581,17 @@ static int aesni_cbc_hmac_sha1_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, maxpad |= (255 - maxpad) >> (sizeof(maxpad) * 8 - 8); maxpad &= 255; - ret &= constant_time_ge(maxpad, pad); + mask = constant_time_ge(maxpad, pad); + ret &= mask; + /* + * If pad is invalid then we will fail the above test but we must + * continue anyway because we are in constant time code. However, + * we'll use the maxpad value instead of the supplied pad to make + * sure we perform well defined pointer arithmetic. + */ + pad = constant_time_select(mask, pad, maxpad); inp_len = len - (SHA_DIGEST_LENGTH + pad + 1); - mask = (0 - ((inp_len - len) >> (sizeof(inp_len) * 8 - 1))); - inp_len &= mask; - ret &= (int)mask; key->aux.tls_aad[plen - 2] = inp_len >> 8; key->aux.tls_aad[plen - 1] = inp_len; diff --git a/freebsd/crypto/openssl/crypto/evp/e_aes_cbc_hmac_sha256.c b/freebsd/crypto/openssl/crypto/evp/e_aes_cbc_hmac_sha256.c index 1a683da2..49e41a4c 100644 --- a/freebsd/crypto/openssl/crypto/evp/e_aes_cbc_hmac_sha256.c +++ b/freebsd/crypto/openssl/crypto/evp/e_aes_cbc_hmac_sha256.c @@ -509,10 +509,12 @@ static int aesni_cbc_hmac_sha256_cipher(EVP_CIPHER_CTX *ctx, * to identify it and avoid stitch invocation. So that after we * establish that current CPU supports AVX, we even see if it's * either even XOP-capable Bulldozer-based or GenuineIntel one. + * But SHAEXT-capable go ahead... */ - if (OPENSSL_ia32cap_P[1] & (1 << (60 - 32)) && /* AVX? */ - ((OPENSSL_ia32cap_P[1] & (1 << (43 - 32))) /* XOP? */ - | (OPENSSL_ia32cap_P[0] & (1<<30))) && /* "Intel CPU"? */ + if (((OPENSSL_ia32cap_P[2] & (1 << 29)) || /* SHAEXT? */ + ((OPENSSL_ia32cap_P[1] & (1 << (60 - 32))) && /* AVX? */ + ((OPENSSL_ia32cap_P[1] & (1 << (43 - 32))) /* XOP? */ + | (OPENSSL_ia32cap_P[0] & (1 << 30))))) && /* "Intel CPU"? */ plen > (sha_off + iv) && (blocks = (plen - (sha_off + iv)) / SHA256_CBLOCK)) { SHA256_Update(&key->md, in + iv, sha_off); @@ -592,12 +594,17 @@ static int aesni_cbc_hmac_sha256_cipher(EVP_CIPHER_CTX *ctx, maxpad |= (255 - maxpad) >> (sizeof(maxpad) * 8 - 8); maxpad &= 255; - ret &= constant_time_ge(maxpad, pad); + mask = constant_time_ge(maxpad, pad); + ret &= mask; + /* + * If pad is invalid then we will fail the above test but we must + * continue anyway because we are in constant time code. However, + * we'll use the maxpad value instead of the supplied pad to make + * sure we perform well defined pointer arithmetic. + */ + pad = constant_time_select(mask, pad, maxpad); inp_len = len - (SHA256_DIGEST_LENGTH + pad + 1); - mask = (0 - ((inp_len - len) >> (sizeof(inp_len) * 8 - 1))); - inp_len &= mask; - ret &= (int)mask; key->aux.tls_aad[plen - 2] = inp_len >> 8; key->aux.tls_aad[plen - 1] = inp_len; diff --git a/freebsd/crypto/openssl/crypto/evp/evp.h b/freebsd/crypto/openssl/crypto/evp/evp.h index d258ef87..cf1de15e 100644 --- a/freebsd/crypto/openssl/crypto/evp/evp.h +++ b/freebsd/crypto/openssl/crypto/evp/evp.h @@ -1363,6 +1363,98 @@ void EVP_PKEY_meth_set_ctrl(EVP_PKEY_METHOD *pmeth, const char *type, const char *value)); +void EVP_PKEY_meth_get_init(EVP_PKEY_METHOD *pmeth, + int (**pinit) (EVP_PKEY_CTX *ctx)); + +void EVP_PKEY_meth_get_copy(EVP_PKEY_METHOD *pmeth, + int (**pcopy) (EVP_PKEY_CTX *dst, + EVP_PKEY_CTX *src)); + +void EVP_PKEY_meth_get_cleanup(EVP_PKEY_METHOD *pmeth, + void (**pcleanup) (EVP_PKEY_CTX *ctx)); + +void EVP_PKEY_meth_get_paramgen(EVP_PKEY_METHOD *pmeth, + int (**pparamgen_init) (EVP_PKEY_CTX *ctx), + int (**pparamgen) (EVP_PKEY_CTX *ctx, + EVP_PKEY *pkey)); + +void EVP_PKEY_meth_get_keygen(EVP_PKEY_METHOD *pmeth, + int (**pkeygen_init) (EVP_PKEY_CTX *ctx), + int (**pkeygen) (EVP_PKEY_CTX *ctx, + EVP_PKEY *pkey)); + +void EVP_PKEY_meth_get_sign(EVP_PKEY_METHOD *pmeth, + int (**psign_init) (EVP_PKEY_CTX *ctx), + int (**psign) (EVP_PKEY_CTX *ctx, + unsigned char *sig, size_t *siglen, + const unsigned char *tbs, + size_t tbslen)); + +void EVP_PKEY_meth_get_verify(EVP_PKEY_METHOD *pmeth, + int (**pverify_init) (EVP_PKEY_CTX *ctx), + int (**pverify) (EVP_PKEY_CTX *ctx, + const unsigned char *sig, + size_t siglen, + const unsigned char *tbs, + size_t tbslen)); + +void EVP_PKEY_meth_get_verify_recover(EVP_PKEY_METHOD *pmeth, + int (**pverify_recover_init) (EVP_PKEY_CTX + *ctx), + int (**pverify_recover) (EVP_PKEY_CTX + *ctx, + unsigned char + *sig, + size_t *siglen, + const unsigned + char *tbs, + size_t tbslen)); + +void EVP_PKEY_meth_get_signctx(EVP_PKEY_METHOD *pmeth, + int (**psignctx_init) (EVP_PKEY_CTX *ctx, + EVP_MD_CTX *mctx), + int (**psignctx) (EVP_PKEY_CTX *ctx, + unsigned char *sig, + size_t *siglen, + EVP_MD_CTX *mctx)); + +void EVP_PKEY_meth_get_verifyctx(EVP_PKEY_METHOD *pmeth, + int (**pverifyctx_init) (EVP_PKEY_CTX *ctx, + EVP_MD_CTX *mctx), + int (**pverifyctx) (EVP_PKEY_CTX *ctx, + const unsigned char *sig, + int siglen, + EVP_MD_CTX *mctx)); + +void EVP_PKEY_meth_get_encrypt(EVP_PKEY_METHOD *pmeth, + int (**pencrypt_init) (EVP_PKEY_CTX *ctx), + int (**pencryptfn) (EVP_PKEY_CTX *ctx, + unsigned char *out, + size_t *outlen, + const unsigned char *in, + size_t inlen)); + +void EVP_PKEY_meth_get_decrypt(EVP_PKEY_METHOD *pmeth, + int (**pdecrypt_init) (EVP_PKEY_CTX *ctx), + int (**pdecrypt) (EVP_PKEY_CTX *ctx, + unsigned char *out, + size_t *outlen, + const unsigned char *in, + size_t inlen)); + +void EVP_PKEY_meth_get_derive(EVP_PKEY_METHOD *pmeth, + int (**pderive_init) (EVP_PKEY_CTX *ctx), + int (**pderive) (EVP_PKEY_CTX *ctx, + unsigned char *key, + size_t *keylen)); + +void EVP_PKEY_meth_get_ctrl(EVP_PKEY_METHOD *pmeth, + int (**pctrl) (EVP_PKEY_CTX *ctx, int type, int p1, + void *p2), + int (**pctrl_str) (EVP_PKEY_CTX *ctx, + const char *type, + const char *value)); + void EVP_add_alg_module(void); /* BEGIN ERROR CODES */ diff --git a/freebsd/crypto/openssl/crypto/evp/evp_key.c b/freebsd/crypto/openssl/crypto/evp/evp_key.c index 083f4638..9544f496 100644 --- a/freebsd/crypto/openssl/crypto/evp/evp_key.c +++ b/freebsd/crypto/openssl/crypto/evp/evp_key.c @@ -99,7 +99,7 @@ int EVP_read_pw_string(char *buf, int len, const char *prompt, int verify) int EVP_read_pw_string_min(char *buf, int min, int len, const char *prompt, int verify) { - int ret; + int ret = -1; char buff[BUFSIZ]; UI *ui; @@ -107,16 +107,18 @@ int EVP_read_pw_string_min(char *buf, int min, int len, const char *prompt, prompt = prompt_string; ui = UI_new(); if (ui == NULL) - return -1; - UI_add_input_string(ui, prompt, 0, buf, min, - (len >= BUFSIZ) ? BUFSIZ - 1 : len); - if (verify) - UI_add_verify_string(ui, prompt, 0, - buff, min, (len >= BUFSIZ) ? BUFSIZ - 1 : len, - buf); + return ret; + if (UI_add_input_string(ui, prompt, 0, buf, min, + (len >= BUFSIZ) ? BUFSIZ - 1 : len) < 0 + || (verify + && UI_add_verify_string(ui, prompt, 0, buff, min, + (len >= BUFSIZ) ? BUFSIZ - 1 : len, + buf) < 0)) + goto end; ret = UI_process(ui); - UI_free(ui); OPENSSL_cleanse(buff, BUFSIZ); + end: + UI_free(ui); return ret; } diff --git a/freebsd/crypto/openssl/crypto/evp/pmeth_lib.c b/freebsd/crypto/openssl/crypto/evp/pmeth_lib.c index 5b170cf2..78cbc4d3 100644 --- a/freebsd/crypto/openssl/crypto/evp/pmeth_lib.c +++ b/freebsd/crypto/openssl/crypto/evp/pmeth_lib.c @@ -591,3 +591,170 @@ void EVP_PKEY_meth_set_ctrl(EVP_PKEY_METHOD *pmeth, pmeth->ctrl = ctrl; pmeth->ctrl_str = ctrl_str; } + +void EVP_PKEY_meth_get_init(EVP_PKEY_METHOD *pmeth, + int (**pinit) (EVP_PKEY_CTX *ctx)) +{ + *pinit = pmeth->init; +} + +void EVP_PKEY_meth_get_copy(EVP_PKEY_METHOD *pmeth, + int (**pcopy) (EVP_PKEY_CTX *dst, + EVP_PKEY_CTX *src)) +{ + *pcopy = pmeth->copy; +} + +void EVP_PKEY_meth_get_cleanup(EVP_PKEY_METHOD *pmeth, + void (**pcleanup) (EVP_PKEY_CTX *ctx)) +{ + *pcleanup = pmeth->cleanup; +} + +void EVP_PKEY_meth_get_paramgen(EVP_PKEY_METHOD *pmeth, + int (**pparamgen_init) (EVP_PKEY_CTX *ctx), + int (**pparamgen) (EVP_PKEY_CTX *ctx, + EVP_PKEY *pkey)) +{ + if (pparamgen_init) + *pparamgen_init = pmeth->paramgen_init; + if (pparamgen) + *pparamgen = pmeth->paramgen; +} + +void EVP_PKEY_meth_get_keygen(EVP_PKEY_METHOD *pmeth, + int (**pkeygen_init) (EVP_PKEY_CTX *ctx), + int (**pkeygen) (EVP_PKEY_CTX *ctx, + EVP_PKEY *pkey)) +{ + if (pkeygen_init) + *pkeygen_init = pmeth->keygen_init; + if (pkeygen) + *pkeygen = pmeth->keygen; +} + +void EVP_PKEY_meth_get_sign(EVP_PKEY_METHOD *pmeth, + int (**psign_init) (EVP_PKEY_CTX *ctx), + int (**psign) (EVP_PKEY_CTX *ctx, + unsigned char *sig, size_t *siglen, + const unsigned char *tbs, + size_t tbslen)) +{ + if (psign_init) + *psign_init = pmeth->sign_init; + if (psign) + *psign = pmeth->sign; +} + +void EVP_PKEY_meth_get_verify(EVP_PKEY_METHOD *pmeth, + int (**pverify_init) (EVP_PKEY_CTX *ctx), + int (**pverify) (EVP_PKEY_CTX *ctx, + const unsigned char *sig, + size_t siglen, + const unsigned char *tbs, + size_t tbslen)) +{ + if (pverify_init) + *pverify_init = pmeth->verify_init; + if (pverify) + *pverify = pmeth->verify; +} + +void EVP_PKEY_meth_get_verify_recover(EVP_PKEY_METHOD *pmeth, + int (**pverify_recover_init) (EVP_PKEY_CTX + *ctx), + int (**pverify_recover) (EVP_PKEY_CTX + *ctx, + unsigned char + *sig, + size_t *siglen, + const unsigned + char *tbs, + size_t tbslen)) +{ + if (pverify_recover_init) + *pverify_recover_init = pmeth->verify_recover_init; + if (pverify_recover) + *pverify_recover = pmeth->verify_recover; +} + +void EVP_PKEY_meth_get_signctx(EVP_PKEY_METHOD *pmeth, + int (**psignctx_init) (EVP_PKEY_CTX *ctx, + EVP_MD_CTX *mctx), + int (**psignctx) (EVP_PKEY_CTX *ctx, + unsigned char *sig, + size_t *siglen, + EVP_MD_CTX *mctx)) +{ + if (psignctx_init) + *psignctx_init = pmeth->signctx_init; + if (psignctx) + *psignctx = pmeth->signctx; +} + +void EVP_PKEY_meth_get_verifyctx(EVP_PKEY_METHOD *pmeth, + int (**pverifyctx_init) (EVP_PKEY_CTX *ctx, + EVP_MD_CTX *mctx), + int (**pverifyctx) (EVP_PKEY_CTX *ctx, + const unsigned char *sig, + int siglen, + EVP_MD_CTX *mctx)) +{ + if (pverifyctx_init) + *pverifyctx_init = pmeth->verifyctx_init; + if (pverifyctx) + *pverifyctx = pmeth->verifyctx; +} + +void EVP_PKEY_meth_get_encrypt(EVP_PKEY_METHOD *pmeth, + int (**pencrypt_init) (EVP_PKEY_CTX *ctx), + int (**pencryptfn) (EVP_PKEY_CTX *ctx, + unsigned char *out, + size_t *outlen, + const unsigned char *in, + size_t inlen)) +{ + if (pencrypt_init) + *pencrypt_init = pmeth->encrypt_init; + if (pencryptfn) + *pencryptfn = pmeth->encrypt; +} + +void EVP_PKEY_meth_get_decrypt(EVP_PKEY_METHOD *pmeth, + int (**pdecrypt_init) (EVP_PKEY_CTX *ctx), + int (**pdecrypt) (EVP_PKEY_CTX *ctx, + unsigned char *out, + size_t *outlen, + const unsigned char *in, + size_t inlen)) +{ + if (pdecrypt_init) + *pdecrypt_init = pmeth->decrypt_init; + if (pdecrypt) + *pdecrypt = pmeth->decrypt; +} + +void EVP_PKEY_meth_get_derive(EVP_PKEY_METHOD *pmeth, + int (**pderive_init) (EVP_PKEY_CTX *ctx), + int (**pderive) (EVP_PKEY_CTX *ctx, + unsigned char *key, + size_t *keylen)) +{ + if (pderive_init) + *pderive_init = pmeth->derive_init; + if (pderive) + *pderive = pmeth->derive; +} + +void EVP_PKEY_meth_get_ctrl(EVP_PKEY_METHOD *pmeth, + int (**pctrl) (EVP_PKEY_CTX *ctx, int type, int p1, + void *p2), + int (**pctrl_str) (EVP_PKEY_CTX *ctx, + const char *type, + const char *value)) +{ + if (pctrl) + *pctrl = pmeth->ctrl; + if (pctrl_str) + *pctrl_str = pmeth->ctrl_str; +} diff --git a/freebsd/crypto/openssl/crypto/ex_data.c b/freebsd/crypto/openssl/crypto/ex_data.c index f0e2fd50..631a48b9 100644 --- a/freebsd/crypto/openssl/crypto/ex_data.c +++ b/freebsd/crypto/openssl/crypto/ex_data.c @@ -475,7 +475,14 @@ static int int_dup_ex_data(int class_index, CRYPTO_EX_DATA *to, if (j < mx) mx = j; if (mx > 0) { - if (!CRYPTO_set_ex_data(to, mx - 1, NULL)) + /* + * Make sure the ex_data stack is at least |mx| elements long to avoid + * issues in the for loop that follows; so go get the |mx|'th element + * (if it does not exist CRYPTO_get_ex_data() returns NULL), and assign + * to itself. This is normally a no-op; but ensures the stack is the + * proper size + */ + if (!CRYPTO_set_ex_data(to, mx - 1, CRYPTO_get_ex_data(to, mx - 1))) goto skip; storage = OPENSSL_malloc(mx * sizeof(CRYPTO_EX_DATA_FUNCS *)); if (!storage) diff --git a/freebsd/crypto/openssl/crypto/lhash/lhash.c b/freebsd/crypto/openssl/crypto/lhash/lhash.c index 5bd72269..1e7194e3 100644 --- a/freebsd/crypto/openssl/crypto/lhash/lhash.c +++ b/freebsd/crypto/openssl/crypto/lhash/lhash.c @@ -103,6 +103,24 @@ #include <openssl/crypto.h> #include <openssl/lhash.h> +/* + * A hashing implementation that appears to be based on the linear hashing + * alogrithm: + * https://en.wikipedia.org/wiki/Linear_hashing + * + * Litwin, Witold (1980), "Linear hashing: A new tool for file and table + * addressing", Proc. 6th Conference on Very Large Databases: 212–223 + * http://hackthology.com/pdfs/Litwin-1980-Linear_Hashing.pdf + * + * From the wikipedia article "Linear hashing is used in the BDB Berkeley + * database system, which in turn is used by many software systems such as + * OpenLDAP, using a C implementation derived from the CACM article and first + * published on the Usenet in 1988 by Esmond Pitt." + * + * The CACM paper is available here: + * https://pdfs.semanticscholar.org/ff4d/1c5deca6269cc316bfd952172284dbf610ee.pdf + */ + const char lh_version[] = "lhash" OPENSSL_VERSION_PTEXT; #undef MIN_NODES @@ -110,7 +128,7 @@ const char lh_version[] = "lhash" OPENSSL_VERSION_PTEXT; #define UP_LOAD (2*LH_LOAD_MULT) /* load times 256 (default 2) */ #define DOWN_LOAD (LH_LOAD_MULT) /* load times 256 (default 1) */ -static void expand(_LHASH *lh); +static int expand(_LHASH *lh); static void contract(_LHASH *lh); static LHASH_NODE **getrn(_LHASH *lh, const void *data, unsigned long *rhash); @@ -184,8 +202,9 @@ void *lh_insert(_LHASH *lh, void *data) void *ret; lh->error = 0; - if (lh->up_load <= (lh->num_items * LH_LOAD_MULT / lh->num_nodes)) - expand(lh); + if (lh->up_load <= (lh->num_items * LH_LOAD_MULT / lh->num_nodes) + && !expand(lh)) + return NULL; rn = getrn(lh, data, &hash); @@ -302,19 +321,37 @@ void lh_doall_arg(_LHASH *lh, LHASH_DOALL_ARG_FN_TYPE func, void *arg) doall_util_fn(lh, 1, (LHASH_DOALL_FN_TYPE)0, func, arg); } -static void expand(_LHASH *lh) +static int expand(_LHASH *lh) { LHASH_NODE **n, **n1, **n2, *np; - unsigned int p, i, j; - unsigned long hash, nni; + unsigned int p, pmax, nni, j; + unsigned long hash; + + nni = lh->num_alloc_nodes; + p = lh->p; + pmax = lh->pmax; + if (p + 1 >= pmax) { + j = nni * 2; + n = OPENSSL_realloc(lh->b, (int)(sizeof(LHASH_NODE *) * j)); + if (n == NULL) { + lh->error++; + return 0; + } + lh->b = n; + memset(n + nni, 0, sizeof(*n) * (j - nni)); + lh->pmax = nni; + lh->num_alloc_nodes = j; + lh->num_expand_reallocs++; + lh->p = 0; + } else { + lh->p++; + } lh->num_nodes++; lh->num_expands++; - p = (int)lh->p++; n1 = &(lh->b[p]); - n2 = &(lh->b[p + (int)lh->pmax]); - *n2 = NULL; /* 27/07/92 - eay - undefined pointer bug */ - nni = lh->num_alloc_nodes; + n2 = &(lh->b[p + pmax]); + *n2 = NULL; for (np = *n1; np != NULL;) { #ifndef OPENSSL_NO_HASH_COMP @@ -332,25 +369,7 @@ static void expand(_LHASH *lh) np = *n1; } - if ((lh->p) >= lh->pmax) { - j = (int)lh->num_alloc_nodes * 2; - n = (LHASH_NODE **)OPENSSL_realloc(lh->b, - (int)(sizeof(LHASH_NODE *) * j)); - if (n == NULL) { - lh->error++; - lh->num_nodes--; - lh->p = 0; - return; - } - /* else */ - for (i = (int)lh->num_alloc_nodes; i < j; i++) /* 26/02/92 eay */ - n[i] = NULL; /* 02/03/92 eay */ - lh->pmax = lh->num_alloc_nodes; - lh->num_alloc_nodes = j; - lh->num_expand_reallocs++; - lh->p = 0; - lh->b = n; - } + return 1; } static void contract(_LHASH *lh) diff --git a/freebsd/crypto/openssl/crypto/ocsp/ocsp_vfy.c b/freebsd/crypto/openssl/crypto/ocsp/ocsp_vfy.c index 1105f574..23ffe63c 100644 --- a/freebsd/crypto/openssl/crypto/ocsp/ocsp_vfy.c +++ b/freebsd/crypto/openssl/crypto/ocsp/ocsp_vfy.c @@ -120,6 +120,8 @@ int OCSP_basic_verify(OCSP_BASICRESP *bs, STACK_OF(X509) *certs, goto end; } } + } else if (certs != NULL) { + untrusted = certs; } else { untrusted = bs->certs; } diff --git a/freebsd/crypto/openssl/crypto/opensslv.h b/freebsd/crypto/openssl/crypto/opensslv.h index 9eae57ca..83867763 100644 --- a/freebsd/crypto/openssl/crypto/opensslv.h +++ b/freebsd/crypto/openssl/crypto/opensslv.h @@ -30,11 +30,11 @@ extern "C" { * (Prior to 0.9.5a beta1, a different scheme was used: MMNNFFRBB for * major minor fix final patch/beta) */ -# define OPENSSL_VERSION_NUMBER 0x100020cfL +# define OPENSSL_VERSION_NUMBER 0x100020dfL # ifdef OPENSSL_FIPS -# define OPENSSL_VERSION_TEXT "OpenSSL 1.0.2l-fips 25 May 2017" +# define OPENSSL_VERSION_TEXT "OpenSSL 1.0.2m-fips 2 Nov 2017" # else -# define OPENSSL_VERSION_TEXT "OpenSSL 1.0.2l-freebsd 25 May 2017" +# define OPENSSL_VERSION_TEXT "OpenSSL 1.0.2m-freebsd 2 Nov 2017" # endif # define OPENSSL_VERSION_PTEXT " part of " OPENSSL_VERSION_TEXT diff --git a/freebsd/crypto/openssl/crypto/pem/pem_lib.c b/freebsd/crypto/openssl/crypto/pem/pem_lib.c index 36f4d7eb..877f6424 100644 --- a/freebsd/crypto/openssl/crypto/pem/pem_lib.c +++ b/freebsd/crypto/openssl/crypto/pem/pem_lib.c @@ -538,7 +538,8 @@ int PEM_get_EVP_CIPHER_INFO(char *header, EVP_CIPHER_INFO *cipher) ((c >= '0') && (c <= '9')))) break; #else - if (!(isupper(c) || (c == '-') || isdigit(c))) + if (!(isupper((unsigned char)c) || (c == '-') + || isdigit((unsigned char)c))) break; #endif header++; diff --git a/freebsd/crypto/openssl/crypto/pem/pem_pk8.c b/freebsd/crypto/openssl/crypto/pem/pem_pk8.c index c7cd0997..f0e375c8 100644 --- a/freebsd/crypto/openssl/crypto/pem/pem_pk8.c +++ b/freebsd/crypto/openssl/crypto/pem/pem_pk8.c @@ -180,6 +180,7 @@ EVP_PKEY *d2i_PKCS8PrivateKey_bio(BIO *bp, EVP_PKEY **x, pem_password_cb *cb, } p8inf = PKCS8_decrypt(p8, psbuf, klen); X509_SIG_free(p8); + OPENSSL_cleanse(psbuf, klen); if (!p8inf) return NULL; ret = EVP_PKCS82PKEY(p8inf); diff --git a/freebsd/crypto/openssl/crypto/pem/pem_pkey.c b/freebsd/crypto/openssl/crypto/pem/pem_pkey.c index 7384b8e2..839e7bf6 100644 --- a/freebsd/crypto/openssl/crypto/pem/pem_pkey.c +++ b/freebsd/crypto/openssl/crypto/pem/pem_pkey.c @@ -122,6 +122,7 @@ EVP_PKEY *PEM_read_bio_PrivateKey(BIO *bp, EVP_PKEY **x, pem_password_cb *cb, } p8inf = PKCS8_decrypt(p8, psbuf, klen); X509_SIG_free(p8); + OPENSSL_cleanse(psbuf, klen); if (!p8inf) goto p8err; ret = EVP_PKCS82PKEY(p8inf); diff --git a/freebsd/crypto/openssl/crypto/pkcs12/p12_kiss.c b/freebsd/crypto/openssl/crypto/pkcs12/p12_kiss.c index 7245322d..27cd87e1 100644 --- a/freebsd/crypto/openssl/crypto/pkcs12/p12_kiss.c +++ b/freebsd/crypto/openssl/crypto/pkcs12/p12_kiss.c @@ -86,6 +86,12 @@ int PKCS12_parse(PKCS12 *p12, const char *pass, EVP_PKEY **pkey, X509 **cert, { STACK_OF(X509) *ocerts = NULL; X509 *x = NULL; + + if (pkey) + *pkey = NULL; + if (cert) + *cert = NULL; + /* Check for NULL PKCS12 structure */ if (!p12) { @@ -94,11 +100,6 @@ int PKCS12_parse(PKCS12 *p12, const char *pass, EVP_PKEY **pkey, X509 **cert, return 0; } - if (pkey) - *pkey = NULL; - if (cert) - *cert = NULL; - /* Check the mac */ /* @@ -127,7 +128,7 @@ int PKCS12_parse(PKCS12 *p12, const char *pass, EVP_PKEY **pkey, X509 **cert, if (!ocerts) { PKCS12err(PKCS12_F_PKCS12_PARSE, ERR_R_MALLOC_FAILURE); - return 0; + goto err; } if (!parse_pk12(p12, pass, -1, pkey, ocerts)) { @@ -165,10 +166,14 @@ int PKCS12_parse(PKCS12 *p12, const char *pass, EVP_PKEY **pkey, X509 **cert, err: - if (pkey && *pkey) + if (pkey) { EVP_PKEY_free(*pkey); - if (cert && *cert) + *pkey = NULL; + } + if (cert) { X509_free(*cert); + *cert = NULL; + } if (x) X509_free(x); if (ocerts) diff --git a/freebsd/crypto/openssl/crypto/rsa/rsa_ameth.c b/freebsd/crypto/openssl/crypto/rsa/rsa_ameth.c index 59335b6f..bf4713bf 100644 --- a/freebsd/crypto/openssl/crypto/rsa/rsa_ameth.c +++ b/freebsd/crypto/openssl/crypto/rsa/rsa_ameth.c @@ -770,6 +770,7 @@ static int rsa_item_sign(EVP_MD_CTX *ctx, const ASN1_ITEM *it, void *asn, return 2; } +#ifndef OPENSSL_NO_CMS static RSA_OAEP_PARAMS *rsa_oaep_decode(const X509_ALGOR *alg, X509_ALGOR **pmaskHash) { @@ -793,7 +794,6 @@ static RSA_OAEP_PARAMS *rsa_oaep_decode(const X509_ALGOR *alg, return pss; } -#ifndef OPENSSL_NO_CMS static int rsa_cms_decrypt(CMS_RecipientInfo *ri) { EVP_PKEY_CTX *pkctx; diff --git a/freebsd/crypto/openssl/crypto/rsa/rsa_oaep.c b/freebsd/crypto/openssl/crypto/rsa/rsa_oaep.c index a50e0f39..b4f1aa59 100644 --- a/freebsd/crypto/openssl/crypto/rsa/rsa_oaep.c +++ b/freebsd/crypto/openssl/crypto/rsa/rsa_oaep.c @@ -239,10 +239,14 @@ int RSA_padding_check_PKCS1_OAEP_mgf1(unsigned char *to, int tlen, RSAerr(RSA_F_RSA_PADDING_CHECK_PKCS1_OAEP_MGF1, RSA_R_OAEP_DECODING_ERROR); cleanup: - if (db != NULL) + if (db != NULL) { + OPENSSL_cleanse(db, dblen); OPENSSL_free(db); - if (em != NULL) + } + if (em != NULL) { + OPENSSL_cleanse(em, num); OPENSSL_free(em); + } return mlen; } diff --git a/freebsd/crypto/openssl/crypto/rsa/rsa_pk1.c b/freebsd/crypto/openssl/crypto/rsa/rsa_pk1.c index f4b568a6..0dd288b1 100644 --- a/freebsd/crypto/openssl/crypto/rsa/rsa_pk1.c +++ b/freebsd/crypto/openssl/crypto/rsa/rsa_pk1.c @@ -257,8 +257,6 @@ int RSA_padding_check_PKCS1_type_2(unsigned char *to, int tlen, * We can't continue in constant-time because we need to copy the result * and we cannot fake its length. This unavoidably leaks timing * information at the API boundary. - * TODO(emilia): this could be addressed at the call site, - * see BoringSSL commit 0aa0767340baf925bda4804882aab0cb974b2d26. */ if (!good) { mlen = -1; @@ -268,8 +266,10 @@ int RSA_padding_check_PKCS1_type_2(unsigned char *to, int tlen, memcpy(to, em + msg_index, mlen); err: - if (em != NULL) + if (em != NULL) { + OPENSSL_cleanse(em, num); OPENSSL_free(em); + } if (mlen == -1) RSAerr(RSA_F_RSA_PADDING_CHECK_PKCS1_TYPE_2, RSA_R_PKCS_DECODING_ERROR); diff --git a/freebsd/crypto/openssl/crypto/rsa/rsa_pmeth.c b/freebsd/crypto/openssl/crypto/rsa/rsa_pmeth.c index 1d50e6c9..902b7008 100644 --- a/freebsd/crypto/openssl/crypto/rsa/rsa_pmeth.c +++ b/freebsd/crypto/openssl/crypto/rsa/rsa_pmeth.c @@ -182,27 +182,25 @@ static void pkey_rsa_cleanup(EVP_PKEY_CTX *ctx) * FIPS mode. */ -static int pkey_fips_check_ctx(EVP_PKEY_CTX *ctx) +static int pkey_fips_check_rsa(const RSA *rsa, const EVP_MD **pmd, + const EVP_MD **pmgf1md) { - RSA_PKEY_CTX *rctx = ctx->data; - RSA *rsa = ctx->pkey->pkey.rsa; int rv = -1; + if (!FIPS_mode()) return 0; if (rsa->flags & RSA_FLAG_NON_FIPS_ALLOW) rv = 0; if (!(rsa->meth->flags & RSA_FLAG_FIPS_METHOD) && rv) return -1; - if (rctx->md) { - const EVP_MD *fmd; - fmd = FIPS_get_digestbynid(EVP_MD_type(rctx->md)); - if (!fmd || !(fmd->flags & EVP_MD_FLAG_FIPS)) + if (*pmd != NULL) { + *pmd = FIPS_get_digestbynid(EVP_MD_type(*pmd)); + if (*pmd == NULL || !((*pmd)->flags & EVP_MD_FLAG_FIPS)) return rv; } - if (rctx->mgf1md && !(rctx->mgf1md->flags & EVP_MD_FLAG_FIPS)) { - const EVP_MD *fmd; - fmd = FIPS_get_digestbynid(EVP_MD_type(rctx->mgf1md)); - if (!fmd || !(fmd->flags & EVP_MD_FLAG_FIPS)) + if (*pmgf1md != NULL) { + *pmgf1md = FIPS_get_digestbynid(EVP_MD_type(*pmgf1md)); + if (*pmgf1md == NULL || !((*pmgf1md)->flags & EVP_MD_FLAG_FIPS)) return rv; } return 1; @@ -216,27 +214,27 @@ static int pkey_rsa_sign(EVP_PKEY_CTX *ctx, unsigned char *sig, int ret; RSA_PKEY_CTX *rctx = ctx->data; RSA *rsa = ctx->pkey->pkey.rsa; + const EVP_MD *md = rctx->md; + const EVP_MD *mgf1md = rctx->mgf1md; #ifdef OPENSSL_FIPS - ret = pkey_fips_check_ctx(ctx); + ret = pkey_fips_check_rsa(rsa, &md, &mgf1md); if (ret < 0) { RSAerr(RSA_F_PKEY_RSA_SIGN, RSA_R_OPERATION_NOT_ALLOWED_IN_FIPS_MODE); return -1; } #endif - if (rctx->md) { - if (tbslen != (size_t)EVP_MD_size(rctx->md)) { + if (md != NULL) { + if (tbslen != (size_t)EVP_MD_size(md)) { RSAerr(RSA_F_PKEY_RSA_SIGN, RSA_R_INVALID_DIGEST_LENGTH); return -1; } #ifdef OPENSSL_FIPS if (ret > 0) { unsigned int slen; - ret = FIPS_rsa_sign_digest(rsa, tbs, tbslen, rctx->md, - rctx->pad_mode, - rctx->saltlen, - rctx->mgf1md, sig, &slen); + ret = FIPS_rsa_sign_digest(rsa, tbs, tbslen, md, rctx->pad_mode, + rctx->saltlen, mgf1md, sig, &slen); if (ret > 0) *siglen = slen; else @@ -245,12 +243,12 @@ static int pkey_rsa_sign(EVP_PKEY_CTX *ctx, unsigned char *sig, } #endif - if (EVP_MD_type(rctx->md) == NID_mdc2) { + if (EVP_MD_type(md) == NID_mdc2) { unsigned int sltmp; if (rctx->pad_mode != RSA_PKCS1_PADDING) return -1; - ret = RSA_sign_ASN1_OCTET_STRING(NID_mdc2, - tbs, tbslen, sig, &sltmp, rsa); + ret = RSA_sign_ASN1_OCTET_STRING(NID_mdc2, tbs, tbslen, sig, &sltmp, + rsa); if (ret <= 0) return ret; @@ -265,23 +263,20 @@ static int pkey_rsa_sign(EVP_PKEY_CTX *ctx, unsigned char *sig, return -1; } memcpy(rctx->tbuf, tbs, tbslen); - rctx->tbuf[tbslen] = RSA_X931_hash_id(EVP_MD_type(rctx->md)); + rctx->tbuf[tbslen] = RSA_X931_hash_id(EVP_MD_type(md)); ret = RSA_private_encrypt(tbslen + 1, rctx->tbuf, sig, rsa, RSA_X931_PADDING); } else if (rctx->pad_mode == RSA_PKCS1_PADDING) { unsigned int sltmp; - ret = RSA_sign(EVP_MD_type(rctx->md), - tbs, tbslen, sig, &sltmp, rsa); + ret = RSA_sign(EVP_MD_type(md), tbs, tbslen, sig, &sltmp, rsa); if (ret <= 0) return ret; ret = sltmp; } else if (rctx->pad_mode == RSA_PKCS1_PSS_PADDING) { if (!setup_tbuf(rctx, ctx)) return -1; - if (!RSA_padding_add_PKCS1_PSS_mgf1(rsa, - rctx->tbuf, tbs, - rctx->md, rctx->mgf1md, - rctx->saltlen)) + if (!RSA_padding_add_PKCS1_PSS_mgf1(rsa, rctx->tbuf, tbs, + md, mgf1md, rctx->saltlen)) return -1; ret = RSA_private_encrypt(RSA_size(rsa), rctx->tbuf, sig, rsa, RSA_NO_PADDING); @@ -350,32 +345,31 @@ static int pkey_rsa_verify(EVP_PKEY_CTX *ctx, { RSA_PKEY_CTX *rctx = ctx->data; RSA *rsa = ctx->pkey->pkey.rsa; + const EVP_MD *md = rctx->md; + const EVP_MD *mgf1md = rctx->mgf1md; size_t rslen; + #ifdef OPENSSL_FIPS - int rv; - rv = pkey_fips_check_ctx(ctx); + int rv = pkey_fips_check_rsa(rsa, &md, &mgf1md); + if (rv < 0) { RSAerr(RSA_F_PKEY_RSA_VERIFY, RSA_R_OPERATION_NOT_ALLOWED_IN_FIPS_MODE); return -1; } #endif - if (rctx->md) { + if (md != NULL) { #ifdef OPENSSL_FIPS if (rv > 0) { - return FIPS_rsa_verify_digest(rsa, - tbs, tbslen, - rctx->md, - rctx->pad_mode, - rctx->saltlen, - rctx->mgf1md, sig, siglen); + return FIPS_rsa_verify_digest(rsa, tbs, tbslen, md, rctx->pad_mode, + rctx->saltlen, mgf1md, sig, siglen); } #endif if (rctx->pad_mode == RSA_PKCS1_PADDING) - return RSA_verify(EVP_MD_type(rctx->md), tbs, tbslen, + return RSA_verify(EVP_MD_type(md), tbs, tbslen, sig, siglen, rsa); - if (tbslen != (size_t)EVP_MD_size(rctx->md)) { + if (tbslen != (size_t)EVP_MD_size(md)) { RSAerr(RSA_F_PKEY_RSA_VERIFY, RSA_R_INVALID_DIGEST_LENGTH); return -1; } @@ -390,8 +384,7 @@ static int pkey_rsa_verify(EVP_PKEY_CTX *ctx, rsa, RSA_NO_PADDING); if (ret <= 0) return 0; - ret = RSA_verify_PKCS1_PSS_mgf1(rsa, tbs, - rctx->md, rctx->mgf1md, + ret = RSA_verify_PKCS1_PSS_mgf1(rsa, tbs, md, mgf1md, rctx->tbuf, rctx->saltlen); if (ret <= 0) return 0; diff --git a/freebsd/crypto/openssl/crypto/ui/ui_lib.c b/freebsd/crypto/openssl/crypto/ui/ui_lib.c index 6b5ee5dd..a967246c 100644 --- a/freebsd/crypto/openssl/crypto/ui/ui_lib.c +++ b/freebsd/crypto/openssl/crypto/ui/ui_lib.c @@ -522,6 +522,7 @@ int UI_process(UI *ui) } } } + err: if (ui->meth->ui_close_session != NULL && ui->meth->ui_close_session(ui) <= 0) diff --git a/freebsd/crypto/openssl/crypto/whrlpool/wp_dgst.c b/freebsd/crypto/openssl/crypto/whrlpool/wp_dgst.c index a9b33867..0da00640 100644 --- a/freebsd/crypto/openssl/crypto/whrlpool/wp_dgst.c +++ b/freebsd/crypto/openssl/crypto/whrlpool/wp_dgst.c @@ -168,7 +168,7 @@ void WHIRLPOOL_BitUpdate(WHIRLPOOL_CTX *c, const void *_inp, size_t bits) goto reconsider; } else #endif - if (bits >= 8) { + if (bits > 8) { b = ((inp[0] << inpgap) | (inp[1] >> (8 - inpgap))); b &= 0xff; if (bitrem) @@ -185,7 +185,7 @@ void WHIRLPOOL_BitUpdate(WHIRLPOOL_CTX *c, const void *_inp, size_t bits) } if (bitrem) c->data[byteoff] = b << (8 - bitrem); - } else { /* remaining less than 8 bits */ + } else { /* remaining less than or equal to 8 bits */ b = (inp[0] << inpgap) & 0xff; if (bitrem) diff --git a/freebsd/crypto/openssl/crypto/x509/by_dir.c b/freebsd/crypto/openssl/crypto/x509/by_dir.c index a93bbc99..d6fb51e0 100644 --- a/freebsd/crypto/openssl/crypto/x509/by_dir.c +++ b/freebsd/crypto/openssl/crypto/x509/by_dir.c @@ -404,6 +404,7 @@ static int get_cert_by_subject(X509_LOOKUP *xl, int type, X509_NAME *name, if (!hent) { hent = OPENSSL_malloc(sizeof(BY_DIR_HASH)); if (hent == NULL) { + CRYPTO_w_unlock(CRYPTO_LOCK_X509_STORE); X509err(X509_F_GET_CERT_BY_SUBJECT, ERR_R_MALLOC_FAILURE); goto finish; } diff --git a/freebsd/crypto/openssl/crypto/x509/by_file.c b/freebsd/crypto/openssl/crypto/x509/by_file.c index f6b4b96b..f795f1cb 100644 --- a/freebsd/crypto/openssl/crypto/x509/by_file.c +++ b/freebsd/crypto/openssl/crypto/x509/by_file.c @@ -94,12 +94,12 @@ static int by_file_ctrl(X509_LOOKUP *ctx, int cmd, const char *argp, long argl, char **ret) { int ok = 0; - char *file; + const char *file; switch (cmd) { case X509_L_FILE_LOAD: if (argl == X509_FILETYPE_DEFAULT) { - file = (char *)getenv(X509_get_default_cert_file_env()); + file = getenv(X509_get_default_cert_file_env()); if (file) ok = (X509_load_cert_crl_file(ctx, file, X509_FILETYPE_PEM) != 0); @@ -142,7 +142,7 @@ int X509_load_cert_file(X509_LOOKUP *ctx, const char *file, int type) if (type == X509_FILETYPE_PEM) { for (;;) { - x = PEM_read_bio_X509_AUX(in, NULL, NULL, NULL); + x = PEM_read_bio_X509_AUX(in, NULL, NULL, ""); if (x == NULL) { if ((ERR_GET_REASON(ERR_peek_last_error()) == PEM_R_NO_START_LINE) && (count > 0)) { @@ -201,7 +201,7 @@ int X509_load_crl_file(X509_LOOKUP *ctx, const char *file, int type) if (type == X509_FILETYPE_PEM) { for (;;) { - x = PEM_read_bio_X509_CRL(in, NULL, NULL, NULL); + x = PEM_read_bio_X509_CRL(in, NULL, NULL, ""); if (x == NULL) { if ((ERR_GET_REASON(ERR_peek_last_error()) == PEM_R_NO_START_LINE) && (count > 0)) { @@ -255,7 +255,7 @@ int X509_load_cert_crl_file(X509_LOOKUP *ctx, const char *file, int type) X509err(X509_F_X509_LOAD_CERT_CRL_FILE, ERR_R_SYS_LIB); return 0; } - inf = PEM_X509_INFO_read_bio(in, NULL, NULL, NULL); + inf = PEM_X509_INFO_read_bio(in, NULL, NULL, ""); BIO_free(in); if (!inf) { X509err(X509_F_X509_LOAD_CERT_CRL_FILE, ERR_R_PEM_LIB); diff --git a/freebsd/crypto/openssl/crypto/x509v3/pcy_tree.c b/freebsd/crypto/openssl/crypto/x509v3/pcy_tree.c index 2efe5621..31661ed4 100644 --- a/freebsd/crypto/openssl/crypto/x509v3/pcy_tree.c +++ b/freebsd/crypto/openssl/crypto/x509v3/pcy_tree.c @@ -734,6 +734,7 @@ int X509_policy_check(X509_POLICY_TREE **ptree, int *pexplicit_policy, STACK_OF(ASN1_OBJECT) *policy_oids, unsigned int flags) { int ret; + int calc_ret; X509_POLICY_TREE *tree = NULL; STACK_OF(X509_POLICY_NODE) *nodes, *auth_nodes = NULL; *ptree = NULL; @@ -802,17 +803,20 @@ int X509_policy_check(X509_POLICY_TREE **ptree, int *pexplicit_policy, /* Tree is not empty: continue */ - ret = tree_calculate_authority_set(tree, &auth_nodes); + calc_ret = tree_calculate_authority_set(tree, &auth_nodes); - if (!ret) + if (!calc_ret) goto error; - if (!tree_calculate_user_set(tree, policy_oids, auth_nodes)) - goto error; + ret = tree_calculate_user_set(tree, policy_oids, auth_nodes); - if (ret == 2) + if (calc_ret == 2) sk_X509_POLICY_NODE_free(auth_nodes); + if (!ret) + goto error; + + if (tree) *ptree = tree; diff --git a/freebsd/crypto/openssl/crypto/x509v3/v3_addr.c b/freebsd/crypto/openssl/crypto/x509v3/v3_addr.c index f40b7ceb..cbf6ef30 100644 --- a/freebsd/crypto/openssl/crypto/x509v3/v3_addr.c +++ b/freebsd/crypto/openssl/crypto/x509v3/v3_addr.c @@ -132,10 +132,12 @@ static int length_from_afi(const unsigned afi) */ unsigned int v3_addr_get_afi(const IPAddressFamily *f) { - return ((f != NULL && - f->addressFamily != NULL && f->addressFamily->data != NULL) - ? ((f->addressFamily->data[0] << 8) | (f->addressFamily->data[1])) - : 0); + if (f == NULL + || f->addressFamily == NULL + || f->addressFamily->data == NULL + || f->addressFamily->length < 2) + return 0; + return (f->addressFamily->data[0] << 8) | f->addressFamily->data[1]; } /* diff --git a/freebsd/crypto/openssl/crypto/x509v3/v3_genn.c b/freebsd/crypto/openssl/crypto/x509v3/v3_genn.c index 5d0a23a4..b6e2f409 100644 --- a/freebsd/crypto/openssl/crypto/x509v3/v3_genn.c +++ b/freebsd/crypto/openssl/crypto/x509v3/v3_genn.c @@ -233,6 +233,7 @@ int GENERAL_NAME_set0_othername(GENERAL_NAME *gen, oth = OTHERNAME_new(); if (!oth) return 0; + ASN1_TYPE_free(oth->value); oth->type_id = oid; oth->value = value; GENERAL_NAME_set0_value(gen, GEN_OTHERNAME, oth); diff --git a/freebsd/crypto/openssl/crypto/x509v3/v3_ncons.c b/freebsd/crypto/openssl/crypto/x509v3/v3_ncons.c index 41a77067..006c2009 100644 --- a/freebsd/crypto/openssl/crypto/x509v3/v3_ncons.c +++ b/freebsd/crypto/openssl/crypto/x509v3/v3_ncons.c @@ -109,6 +109,47 @@ ASN1_SEQUENCE(NAME_CONSTRAINTS) = { IMPLEMENT_ASN1_ALLOC_FUNCTIONS(GENERAL_SUBTREE) IMPLEMENT_ASN1_ALLOC_FUNCTIONS(NAME_CONSTRAINTS) +/* + * We cannot use strncasecmp here because that applies locale specific rules. + * For example in Turkish 'I' is not the uppercase character for 'i'. We need to + * do a simple ASCII case comparison ignoring the locale (that is why we use + * numeric constants below). + */ +static int ia5ncasecmp(const char *s1, const char *s2, size_t n) +{ + for (; n > 0; n--, s1++, s2++) { + if (*s1 != *s2) { + unsigned char c1 = (unsigned char)*s1, c2 = (unsigned char)*s2; + + /* Convert to lower case */ + if (c1 >= 0x41 /* A */ && c1 <= 0x5A /* Z */) + c1 += 0x20; + if (c2 >= 0x41 /* A */ && c2 <= 0x5A /* Z */) + c2 += 0x20; + + if (c1 == c2) + continue; + + if (c1 < c2) + return -1; + + /* c1 > c2 */ + return 1; + } else if (*s1 == 0) { + /* If we get here we know that *s2 == 0 too */ + return 0; + } + } + + return 0; +} + +static int ia5casecmp(const char *s1, const char *s2) +{ + /* No portable definition of SIZE_MAX, so we use (size_t)(-1) instead */ + return ia5ncasecmp(s1, s2, (size_t)(-1)); +} + static void *v2i_NAME_CONSTRAINTS(const X509V3_EXT_METHOD *method, X509V3_CTX *ctx, STACK_OF(CONF_VALUE) *nval) { @@ -386,7 +427,7 @@ static int nc_dns(ASN1_IA5STRING *dns, ASN1_IA5STRING *base) return X509_V_ERR_PERMITTED_VIOLATION; } - if (strcasecmp(baseptr, dnsptr)) + if (ia5casecmp(baseptr, dnsptr)) return X509_V_ERR_PERMITTED_VIOLATION; return X509_V_OK; @@ -406,7 +447,7 @@ static int nc_email(ASN1_IA5STRING *eml, ASN1_IA5STRING *base) if (!baseat && (*baseptr == '.')) { if (eml->length > base->length) { emlptr += eml->length - base->length; - if (!strcasecmp(baseptr, emlptr)) + if (ia5casecmp(baseptr, emlptr) == 0) return X509_V_OK; } return X509_V_ERR_PERMITTED_VIOLATION; @@ -427,7 +468,7 @@ static int nc_email(ASN1_IA5STRING *eml, ASN1_IA5STRING *base) } emlptr = emlat + 1; /* Just have hostname left to match: case insensitive */ - if (strcasecmp(baseptr, emlptr)) + if (ia5casecmp(baseptr, emlptr)) return X509_V_ERR_PERMITTED_VIOLATION; return X509_V_OK; @@ -466,14 +507,14 @@ static int nc_uri(ASN1_IA5STRING *uri, ASN1_IA5STRING *base) if (*baseptr == '.') { if (hostlen > base->length) { p = hostptr + hostlen - base->length; - if (!strncasecmp(p, baseptr, base->length)) + if (ia5ncasecmp(p, baseptr, base->length) == 0) return X509_V_OK; } return X509_V_ERR_PERMITTED_VIOLATION; } if ((base->length != (int)hostlen) - || strncasecmp(hostptr, baseptr, hostlen)) + || ia5ncasecmp(hostptr, baseptr, hostlen)) return X509_V_ERR_PERMITTED_VIOLATION; return X509_V_OK; diff --git a/freebsd/crypto/openssl/ssl/s23_clnt.c b/freebsd/crypto/openssl/ssl/s23_clnt.c index 4a7d7a39..197ae215 100644 --- a/freebsd/crypto/openssl/ssl/s23_clnt.c +++ b/freebsd/crypto/openssl/ssl/s23_clnt.c @@ -737,7 +737,35 @@ static int ssl23_get_server_hello(SSL *s) s->version = TLS1_2_VERSION; s->method = TLSv1_2_client_method(); } else { + /* + * Unrecognised version, we'll send a protocol version alert using + * our preferred version. + */ + switch(s->client_version) { + default: + /* + * Shouldn't happen + * Fall through + */ + case TLS1_2_VERSION: + s->version = TLS1_2_VERSION; + s->method = TLSv1_2_client_method(); + break; + case TLS1_1_VERSION: + s->version = TLS1_1_VERSION; + s->method = TLSv1_1_client_method(); + break; + case TLS1_VERSION: + s->version = TLS1_VERSION; + s->method = TLSv1_client_method(); + break; + case SSL3_VERSION: + s->version = SSL3_VERSION; + s->method = SSLv3_client_method(); + break; + } SSLerr(SSL_F_SSL23_GET_SERVER_HELLO, SSL_R_UNSUPPORTED_PROTOCOL); + ssl3_send_alert(s, SSL3_AL_FATAL, SSL_AD_PROTOCOL_VERSION); goto err; } diff --git a/freebsd/crypto/openssl/ssl/s3_pkt.c b/freebsd/crypto/openssl/ssl/s3_pkt.c index 77225b8b..679517f2 100644 --- a/freebsd/crypto/openssl/ssl/s3_pkt.c +++ b/freebsd/crypto/openssl/ssl/s3_pkt.c @@ -1429,7 +1429,7 @@ int ssl3_read_bytes(SSL *s, int type, unsigned char *buf, int len, int peek) (s->s3->handshake_fragment_len >= 4) && (s->s3->handshake_fragment[0] == SSL3_MT_CLIENT_HELLO) && (s->session != NULL) && (s->session->cipher != NULL) && - !(s->ctx->options & SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION)) { + !(s->options & SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION)) { /* * s->s3->handshake_fragment_len = 0; */ diff --git a/freebsd/crypto/openssl/ssl/s3_srvr.c b/freebsd/crypto/openssl/ssl/s3_srvr.c index 6bba7dfc..6162941b 100644 --- a/freebsd/crypto/openssl/ssl/s3_srvr.c +++ b/freebsd/crypto/openssl/ssl/s3_srvr.c @@ -2204,7 +2204,7 @@ int ssl3_get_client_key_exchange(SSL *s) unsigned char rand_premaster_secret[SSL_MAX_MASTER_KEY_LENGTH]; int decrypt_len; unsigned char decrypt_good, version_good; - size_t j; + size_t j, padding_len; /* FIX THIS UP EAY EAY EAY EAY */ if (s->s3->tmp.use_rsa_tmp) { @@ -2272,16 +2272,38 @@ int ssl3_get_client_key_exchange(SSL *s) if (RAND_bytes(rand_premaster_secret, sizeof(rand_premaster_secret)) <= 0) goto err; + + /* + * Decrypt with no padding. PKCS#1 padding will be removed as part of + * the timing-sensitive code below. + */ decrypt_len = - RSA_private_decrypt((int)n, p, p, rsa, RSA_PKCS1_PADDING); - ERR_clear_error(); + RSA_private_decrypt((int)n, p, p, rsa, RSA_NO_PADDING); + if (decrypt_len < 0) + goto err; + + /* Check the padding. See RFC 3447, section 7.2.2. */ /* - * decrypt_len should be SSL_MAX_MASTER_KEY_LENGTH. decrypt_good will - * be 0xff if so and zero otherwise. + * The smallest padded premaster is 11 bytes of overhead. Small keys + * are publicly invalid, so this may return immediately. This ensures + * PS is at least 8 bytes. */ - decrypt_good = - constant_time_eq_int_8(decrypt_len, SSL_MAX_MASTER_KEY_LENGTH); + if (decrypt_len < 11 + SSL_MAX_MASTER_KEY_LENGTH) { + al = SSL_AD_DECRYPT_ERROR; + SSLerr(SSL_F_SSL3_GET_CLIENT_KEY_EXCHANGE, + SSL_R_DECRYPTION_FAILED); + goto f_err; + } + + padding_len = decrypt_len - SSL_MAX_MASTER_KEY_LENGTH; + decrypt_good = constant_time_eq_int_8(p[0], 0) & + constant_time_eq_int_8(p[1], 2); + for (j = 2; j < padding_len - 1; j++) { + decrypt_good &= ~constant_time_is_zero_8(p[j]); + } + decrypt_good &= constant_time_is_zero_8(p[padding_len - 1]); + p += padding_len; /* * If the version in the decrypted pre-master secret is correct then diff --git a/freebsd/crypto/openssl/ssl/ssl_ciph.c b/freebsd/crypto/openssl/ssl/ssl_ciph.c index 3649ed69..2591b69b 100644 --- a/freebsd/crypto/openssl/ssl/ssl_ciph.c +++ b/freebsd/crypto/openssl/ssl/ssl_ciph.c @@ -1207,7 +1207,7 @@ static int ssl_cipher_process_rulestr(const char *rule_str, ((ch >= '0') && (ch <= '9')) || ((ch >= 'a') && (ch <= 'z')) || (ch == '-') || (ch == '.')) #else - while (isalnum(ch) || (ch == '-') || (ch == '.')) + while (isalnum((unsigned char)ch) || (ch == '-') || (ch == '.')) #endif { ch = *(++l); diff --git a/freebsd/crypto/openssl/ssl/ssl_lib.c b/freebsd/crypto/openssl/ssl/ssl_lib.c index 54b831ea..43e3f76b 100644 --- a/freebsd/crypto/openssl/ssl/ssl_lib.c +++ b/freebsd/crypto/openssl/ssl/ssl_lib.c @@ -1827,15 +1827,15 @@ void SSL_get0_alpn_selected(const SSL *ssl, const unsigned char **data, int SSL_export_keying_material(SSL *s, unsigned char *out, size_t olen, const char *label, size_t llen, - const unsigned char *p, size_t plen, + const unsigned char *context, size_t contextlen, int use_context) { if (s->version < TLS1_VERSION && s->version != DTLS1_BAD_VER) return -1; return s->method->ssl3_enc->export_keying_material(s, out, olen, label, - llen, p, plen, - use_context); + llen, context, + contextlen, use_context); } static unsigned long ssl_session_hash(const SSL_SESSION *a) @@ -3182,6 +3182,7 @@ SSL_CTX *SSL_set_SSL_CTX(SSL *ssl, SSL_CTX *ctx) #endif ssl->cert = ssl_cert_dup(ctx->cert); if (ocert) { + int i; /* Preserve any already negotiated parameters */ if (ssl->server) { ssl->cert->peer_sigalgs = ocert->peer_sigalgs; @@ -3191,6 +3192,9 @@ SSL_CTX *SSL_set_SSL_CTX(SSL *ssl, SSL_CTX *ctx) ssl->cert->ciphers_rawlen = ocert->ciphers_rawlen; ocert->ciphers_raw = NULL; } + for (i = 0; i < SSL_PKEY_NUM; i++) { + ssl->cert->pkeys[i].digest = ocert->pkeys[i].digest; + } #ifndef OPENSSL_NO_TLSEXT ssl->cert->alpn_proposed = ocert->alpn_proposed; ssl->cert->alpn_proposed_len = ocert->alpn_proposed_len; diff --git a/freebsd/crypto/openssl/ssl/ssl_sess.c b/freebsd/crypto/openssl/ssl/ssl_sess.c index 8fd8c79c..fbded359 100644 --- a/freebsd/crypto/openssl/ssl/ssl_sess.c +++ b/freebsd/crypto/openssl/ssl/ssl_sess.c @@ -263,7 +263,6 @@ SSL_SESSION *ssl_session_dup(SSL_SESSION *src, int ticket) #ifndef OPENSSL_NO_SRP dest->srp_username = NULL; #endif - memset(&dest->ex_data, 0, sizeof(dest->ex_data)); /* We deliberately don't copy the prev and next pointers */ dest->prev = NULL; @@ -277,6 +276,9 @@ SSL_SESSION *ssl_session_dup(SSL_SESSION *src, int ticket) if (src->peer != NULL) CRYPTO_add(&src->peer->references, 1, CRYPTO_LOCK_X509); + if (!CRYPTO_new_ex_data(CRYPTO_EX_INDEX_SSL_SESSION, dest, &dest->ex_data)) + goto err; + #ifndef OPENSSL_NO_PSK if (src->psk_identity_hint) { dest->psk_identity_hint = BUF_strdup(src->psk_identity_hint); @@ -327,7 +329,7 @@ SSL_SESSION *ssl_session_dup(SSL_SESSION *src, int ticket) } # endif - if (ticket != 0) { + if (ticket != 0 && src->tlsext_tick != NULL) { dest->tlsext_tick = BUF_memdup(src->tlsext_tick, src->tlsext_ticklen); if(dest->tlsext_tick == NULL) goto err; diff --git a/freebsd/crypto/openssl/ssl/ssltest.c b/freebsd/crypto/openssl/ssl/ssltest.c index c05929c0..5eafe9e3 100644 --- a/freebsd/crypto/openssl/ssl/ssltest.c +++ b/freebsd/crypto/openssl/ssl/ssltest.c @@ -317,6 +317,9 @@ static int s_ticket1 = 0; static int s_ticket2 = 0; static int c_ticket = 0; static int ticket_expect = -1; +static int sni_in_cert_cb = 0; +static const char *client_sigalgs = NULL; +static const char *server_digest_expect = NULL; static int servername_cb(SSL *s, int *ad, void *arg) { @@ -357,6 +360,11 @@ static int verify_servername(SSL *client, SSL *server) BIO_printf(bio_stdout, "Servername: context is unknown\n"); return -1; } +static int cert_cb(SSL *ssl, void *arg) +{ + int unused; + return servername_cb(ssl, &unused, NULL) != SSL_TLSEXT_ERR_ALERT_FATAL; +} static int verify_ticket(SSL* ssl) { @@ -373,6 +381,20 @@ static int verify_ticket(SSL* ssl) return -1; } +static int verify_server_digest(SSL* ssl) +{ + int nid = NID_undef; + + if (server_digest_expect == NULL) + return 0; + SSL_get_peer_signature_nid(ssl, &nid); + if (strcmp(server_digest_expect, OBJ_nid2sn(nid)) == 0) + return 1; + BIO_printf(bio_stdout, "Expected server digest %s, got %s.\n", + server_digest_expect, OBJ_nid2sn(nid)); + return -1; +} + /*- * next_protos_parse parses a comma separated list of strings into a string * in a format suitable for passing to SSL_CTX_set_next_protos_advertised. @@ -833,6 +855,7 @@ static void sv_usage(void) #endif #ifndef OPENSSL_NO_TLS1 fprintf(stderr, " -tls1 - use TLSv1\n"); + fprintf(stderr, " -tls12 - use TLSv1.2\n"); #endif #ifndef OPENSSL_NO_DTLS fprintf(stderr, " -dtls1 - use DTLSv1\n"); @@ -886,6 +909,9 @@ static void sv_usage(void) fprintf(stderr, " -c_ticket <yes|no> - enable/disable session tickets on the client\n"); fprintf(stderr, " -ticket_expect <yes|no> - indicate that the client should (or should not) have a ticket\n"); #endif + fprintf(stderr, " -sni_in_cert_cb - have the server handle SNI in the certificate callback\n"); + fprintf(stderr, " -client_sigalgs arg - the signature algorithms to configure on the client\n"); + fprintf(stderr, " -server_digest_expect arg - the expected server signing digest\n"); } static void print_details(SSL *c_ssl, const char *prefix) @@ -1012,7 +1038,7 @@ int main(int argc, char *argv[]) int badop = 0; int bio_pair = 0; int force = 0; - int dtls1 = 0, dtls12 = 0, tls1 = 0, ssl2 = 0, ssl3 = 0, ret = 1; + int dtls1 = 0, dtls12 = 0, tls1 = 0, tls12 = 0, ssl2 = 0, ssl3 = 0, ret = 1; int client_auth = 0; int server_auth = 0, i; struct app_verify_arg app_verify_arg = @@ -1166,6 +1192,11 @@ int main(int argc, char *argv[]) no_protocol = 1; #endif tls1 = 1; + } else if (strcmp(*argv, "-tls12") == 0) { +#ifdef OPENSSL_NO_TLS1 + no_protocol = 1; +#endif + tls12 = 1; } else if (strcmp(*argv, "-ssl3") == 0) { #ifdef OPENSSL_NO_SSL3_METHOD no_protocol = 1; @@ -1345,6 +1376,16 @@ int main(int argc, char *argv[]) else if (strcmp(*argv, "no") == 0) ticket_expect = 0; #endif + } else if (strcmp(*argv, "-sni_in_cert_cb") == 0) { + sni_in_cert_cb = 1; + } else if (strcmp(*argv, "-client_sigalgs") == 0) { + if (--argc < 1) + goto bad; + client_sigalgs = *(++argv); + } else if (strcmp(*argv, "-server_digest_expect") == 0) { + if (--argc < 1) + goto bad; + server_digest_expect = *(++argv); } else { fprintf(stderr, "unknown option %s\n", *argv); badop = 1; @@ -1375,9 +1416,9 @@ int main(int argc, char *argv[]) goto end; } - if (ssl2 + ssl3 + tls1 + dtls1 + dtls12 > 1) { - fprintf(stderr, "At most one of -ssl2, -ssl3, -tls1, -dtls1 or -dtls12 should " - "be requested.\n"); + if (ssl2 + ssl3 + tls1 + tls12 + dtls1 + dtls12 > 1) { + fprintf(stderr, "At most one of -ssl2, -ssl3, -tls1, -tls12, -dtls1 or " + "-dtls12 should be requested.\n"); EXIT(1); } @@ -1393,10 +1434,11 @@ int main(int argc, char *argv[]) goto end; } - if (!ssl2 && !ssl3 && !tls1 && !dtls1 && !dtls12 && number > 1 && !reuse && !force) { + if (!ssl2 && !ssl3 && !tls1 && !tls12 && !dtls1 && !dtls12 && number > 1 + && !reuse && !force) { fprintf(stderr, "This case cannot work. Use -f to perform " "the test anyway (and\n-d to see what happens), " - "or add one of ssl2, -ssl3, -tls1, -dtls1, -dtls12, -reuse\n" + "or add one of ssl2, -ssl3, -tls1, -tls12, -dtls1, -dtls12, -reuse\n" "to avoid protocol mismatch.\n"); EXIT(1); } @@ -1460,7 +1502,7 @@ int main(int argc, char *argv[]) #endif /* - * At this point, ssl2/ssl3/tls1 is only set if the protocol is + * At this point, ssl2/ssl3/tls1/tls12 is only set if the protocol is * available. (Otherwise we exit early.) However the compiler doesn't * know this, so we ifdef. */ @@ -1484,6 +1526,8 @@ int main(int argc, char *argv[]) #ifndef OPENSSL_NO_TLS1 if (tls1) meth = TLSv1_method(); + else if (tls12) + meth = TLSv1_2_method(); else #endif meth = SSLv23_method(); @@ -1780,8 +1824,12 @@ int main(int argc, char *argv[]) OPENSSL_free(alpn); } - if (sn_server1 || sn_server2) - SSL_CTX_set_tlsext_servername_callback(s_ctx, servername_cb); + if (sn_server1 || sn_server2) { + if (sni_in_cert_cb) + SSL_CTX_set_cert_cb(s_ctx, cert_cb, NULL); + else + SSL_CTX_set_tlsext_servername_callback(s_ctx, servername_cb); + } #ifndef OPENSSL_NO_TLSEXT if (s_ticket1 == 0) @@ -1801,6 +1849,9 @@ int main(int argc, char *argv[]) SSL_CTX_set_options(c_ctx, SSL_OP_NO_TICKET); #endif + if (client_sigalgs != NULL) + SSL_CTX_set1_sigalgs_list(c_ctx, client_sigalgs); + c_ssl = SSL_new(c_ctx); s_ssl = SSL_new(s_ctx); @@ -1866,6 +1917,8 @@ int main(int argc, char *argv[]) ret = 1; if (verify_ticket(c_ssl) < 0) ret = 1; + if (verify_server_digest(c_ssl) < 0) + ret = 1; SSL_free(s_ssl); SSL_free(c_ssl); diff --git a/freebsd/crypto/openssl/ssl/tls1.h b/freebsd/crypto/openssl/ssl/tls1.h index 7e237d06..dd1d8c10 100644 --- a/freebsd/crypto/openssl/ssl/tls1.h +++ b/freebsd/crypto/openssl/ssl/tls1.h @@ -317,7 +317,7 @@ int SSL_get_servername_type(const SSL *s); */ int SSL_export_keying_material(SSL *s, unsigned char *out, size_t olen, const char *label, size_t llen, - const unsigned char *p, size_t plen, + const unsigned char *context, size_t contextlen, int use_context); int SSL_get_sigalgs(SSL *s, int idx, diff --git a/freebsd/include/arpa/nameser.h b/freebsd/include/arpa/nameser.h index ef47b204..f0e3482a 100644 --- a/freebsd/include/arpa/nameser.h +++ b/freebsd/include/arpa/nameser.h @@ -15,7 +15,9 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* +/*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1983, 1989, 1993 * The Regents of the University of California. All rights reserved. * diff --git a/freebsd/include/arpa/nameser_compat.h b/freebsd/include/arpa/nameser_compat.h index e7b58056..1035c3fc 100644 --- a/freebsd/include/arpa/nameser_compat.h +++ b/freebsd/include/arpa/nameser_compat.h @@ -1,4 +1,7 @@ -/* Copyright (c) 1983, 1989 +/*- + * SPDX-License-Identifier: BSD-3-Clause + * + * Copyright (c) 1983, 1989 * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/freebsd/include/db.h b/freebsd/include/db.h index 4d04db41..13fa91d6 100644 --- a/freebsd/include/db.h +++ b/freebsd/include/db.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1990, 1993, 1994 * The Regents of the University of California. All rights reserved. * diff --git a/freebsd/include/err.h b/freebsd/include/err.h index f81742ff..636185e2 100644 --- a/freebsd/include/err.h +++ b/freebsd/include/err.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1993 * The Regents of the University of California. All rights reserved. * diff --git a/freebsd/include/mpool.h b/freebsd/include/mpool.h index 3f22ab78..2c686602 100644 --- a/freebsd/include/mpool.h +++ b/freebsd/include/mpool.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1991, 1993, 1994 * The Regents of the University of California. All rights reserved. * diff --git a/freebsd/include/netconfig.h b/freebsd/include/netconfig.h index 80dc0da2..b459e2ee 100644 --- a/freebsd/include/netconfig.h +++ b/freebsd/include/netconfig.h @@ -1,6 +1,36 @@ -/* $NetBSD: netconfig.h,v 1.1 2000/06/02 22:57:54 fvdl Exp $ */ +/* $NetBSD: netconfig.h,v 1.6 2008/04/28 20:22:54 martin Exp $ */ /* $FreeBSD$ */ +/*- + * SPDX-License-Identifier: BSD-2-Clause-NetBSD + * + * Copyright (c) 2004 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Frank van der Linden. + * + * 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. + */ #ifndef _NETCONFIG_H_ #define _NETCONFIG_H_ @@ -30,10 +60,10 @@ typedef struct { /* * nc_semantics values */ -#define NC_TPI_CLTS 1 -#define NC_TPI_COTS 2 -#define NC_TPI_COTS_ORD 3 -#define NC_TPI_RAW 4 +#define NC_TPI_CLTS 1 /* Connectionless transport */ +#define NC_TPI_COTS 2 /* Connection oriented transport */ +#define NC_TPI_COTS_ORD 3 /* Connection oriented, ordered transport */ +#define NC_TPI_RAW 4 /* Raw connection */ /* * nc_flag values diff --git a/freebsd/include/netdb.h b/freebsd/include/netdb.h index 2da7755d..f46f5a3c 100644 --- a/freebsd/include/netdb.h +++ b/freebsd/include/netdb.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1980, 1983, 1988, 1993 * The Regents of the University of California. All rights reserved. * diff --git a/freebsd/include/nlist.h b/freebsd/include/nlist.h index a4965fd9..5ea6f5ea 100644 --- a/freebsd/include/nlist.h +++ b/freebsd/include/nlist.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1991, 1993 * The Regents of the University of California. All rights reserved. * (c) UNIX System Laboratories, Inc. diff --git a/freebsd/include/nsswitch.h b/freebsd/include/nsswitch.h index d1839002..ed4f3ccd 100644 --- a/freebsd/include/nsswitch.h +++ b/freebsd/include/nsswitch.h @@ -2,6 +2,8 @@ /* $FreeBSD$ */ /*- + * SPDX-License-Identifier: BSD-2-Clause-NetBSD + * * Copyright (c) 1997, 1998, 1999 The NetBSD Foundation, Inc. * All rights reserved. * diff --git a/freebsd/include/resolv.h b/freebsd/include/resolv.h index e3d4fd12..1f4a9bc8 100644 --- a/freebsd/include/resolv.h +++ b/freebsd/include/resolv.h @@ -1,4 +1,6 @@ -/* +/*- + * SPDX-License-Identifier: BSD-3-Clause + * * Portions Copyright (C) 2004, 2005, 2008, 2009 Internet Systems Consortium, Inc. ("ISC") * Portions Copyright (C) 1995-2003 Internet Software Consortium. * diff --git a/freebsd/include/rpc/auth.h b/freebsd/include/rpc/auth.h index 5503762b..bf0d76c0 100644 --- a/freebsd/include/rpc/auth.h +++ b/freebsd/include/rpc/auth.h @@ -1,6 +1,8 @@ /* $NetBSD: auth.h,v 1.15 2000/06/02 22:57:55 fvdl Exp $ */ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 2009, Sun Microsystems, Inc. * All rights reserved. * diff --git a/freebsd/include/rpc/auth_des.h b/freebsd/include/rpc/auth_des.h index 58b34d77..3b860d8c 100644 --- a/freebsd/include/rpc/auth_des.h +++ b/freebsd/include/rpc/auth_des.h @@ -1,6 +1,8 @@ /* @(#)auth_des.h 2.2 88/07/29 4.0 RPCSRC; from 1.3 88/02/08 SMI */ /* $FreeBSD$ */ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 2009, Sun Microsystems, Inc. * All rights reserved. * diff --git a/freebsd/include/rpc/auth_kerb.h b/freebsd/include/rpc/auth_kerb.h index b6c5ae10..29b09d50 100644 --- a/freebsd/include/rpc/auth_kerb.h +++ b/freebsd/include/rpc/auth_kerb.h @@ -1,5 +1,7 @@ /* $FreeBSD$ */ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 2009, Sun Microsystems, Inc. * All rights reserved. * diff --git a/freebsd/include/rpc/auth_unix.h b/freebsd/include/rpc/auth_unix.h index fa47e8ba..6d1fc315 100644 --- a/freebsd/include/rpc/auth_unix.h +++ b/freebsd/include/rpc/auth_unix.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 2009, Sun Microsystems, Inc. * All rights reserved. * diff --git a/freebsd/include/rpc/clnt.h b/freebsd/include/rpc/clnt.h index 66533e24..8d9ce1ec 100644 --- a/freebsd/include/rpc/clnt.h +++ b/freebsd/include/rpc/clnt.h @@ -1,6 +1,8 @@ /* $NetBSD: clnt.h,v 1.14 2000/06/02 22:57:55 fvdl Exp $ */ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 2010, Oracle America, Inc. * All rights reserved. * diff --git a/freebsd/include/rpc/clnt_soc.h b/freebsd/include/rpc/clnt_soc.h index 6536a4bb..c16609bb 100644 --- a/freebsd/include/rpc/clnt_soc.h +++ b/freebsd/include/rpc/clnt_soc.h @@ -2,6 +2,8 @@ /* $FreeBSD$ */ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 2009, Sun Microsystems, Inc. * All rights reserved. * diff --git a/freebsd/include/rpc/des.h b/freebsd/include/rpc/des.h index 9400ccdf..93698cce 100644 --- a/freebsd/include/rpc/des.h +++ b/freebsd/include/rpc/des.h @@ -1,6 +1,8 @@ /* @(#)des.h 2.2 88/08/10 4.0 RPCSRC; from 2.7 88/02/08 SMI */ /* $FreeBSD$ */ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 2009, Sun Microsystems, Inc. * All rights reserved. * diff --git a/freebsd/include/rpc/des_crypt.h b/freebsd/include/rpc/des_crypt.h index af33e9d6..ef938c5c 100644 --- a/freebsd/include/rpc/des_crypt.h +++ b/freebsd/include/rpc/des_crypt.h @@ -6,6 +6,8 @@ * Copyright (C) 1986, Sun Microsystems, Inc. */ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 2009, Sun Microsystems, Inc. * All rights reserved. * diff --git a/freebsd/include/rpc/nettype.h b/freebsd/include/rpc/nettype.h index 3ded8928..39c1f769 100644 --- a/freebsd/include/rpc/nettype.h +++ b/freebsd/include/rpc/nettype.h @@ -2,6 +2,8 @@ /* $FreeBSD$ */ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 2009, Sun Microsystems, Inc. * All rights reserved. * diff --git a/freebsd/include/rpc/pmap_clnt.h b/freebsd/include/rpc/pmap_clnt.h index e8314f60..465cb0c0 100644 --- a/freebsd/include/rpc/pmap_clnt.h +++ b/freebsd/include/rpc/pmap_clnt.h @@ -1,6 +1,8 @@ /* $NetBSD: pmap_clnt.h,v 1.9 2000/06/02 22:57:55 fvdl Exp $ */ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 2009, Sun Microsystems, Inc. * All rights reserved. * diff --git a/freebsd/include/rpc/pmap_prot.h b/freebsd/include/rpc/pmap_prot.h index d880c40d..f69bad9c 100644 --- a/freebsd/include/rpc/pmap_prot.h +++ b/freebsd/include/rpc/pmap_prot.h @@ -1,6 +1,8 @@ /* $NetBSD: pmap_prot.h,v 1.8 2000/06/02 22:57:55 fvdl Exp $ */ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 2009, Sun Microsystems, Inc. * All rights reserved. * diff --git a/freebsd/include/rpc/pmap_rmt.h b/freebsd/include/rpc/pmap_rmt.h index 21eb5d1b..791b3f48 100644 --- a/freebsd/include/rpc/pmap_rmt.h +++ b/freebsd/include/rpc/pmap_rmt.h @@ -1,6 +1,8 @@ /* $NetBSD: pmap_rmt.h,v 1.7 1998/02/11 23:01:23 lukem Exp $ */ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 2009, Sun Microsystems, Inc. * All rights reserved. * diff --git a/freebsd/include/rpc/raw.h b/freebsd/include/rpc/raw.h index a5c7d935..b56b9026 100644 --- a/freebsd/include/rpc/raw.h +++ b/freebsd/include/rpc/raw.h @@ -2,6 +2,8 @@ /* $FreeBSD$ */ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 2009, Sun Microsystems, Inc. * All rights reserved. * diff --git a/freebsd/include/rpc/rpc.h b/freebsd/include/rpc/rpc.h index e7a3dc8d..561437c3 100644 --- a/freebsd/include/rpc/rpc.h +++ b/freebsd/include/rpc/rpc.h @@ -1,6 +1,8 @@ /* $NetBSD: rpc.h,v 1.13 2000/06/02 22:57:56 fvdl Exp $ */ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 2009, Sun Microsystems, Inc. * All rights reserved. * diff --git a/freebsd/include/rpc/rpc_com.h b/freebsd/include/rpc/rpc_com.h index 0996efc0..dd331e26 100644 --- a/freebsd/include/rpc/rpc_com.h +++ b/freebsd/include/rpc/rpc_com.h @@ -2,6 +2,8 @@ /* $FreeBSD$ */ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 2009, Sun Microsystems, Inc. * All rights reserved. * diff --git a/freebsd/include/rpc/rpc_msg.h b/freebsd/include/rpc/rpc_msg.h index fdde3875..35b816fd 100644 --- a/freebsd/include/rpc/rpc_msg.h +++ b/freebsd/include/rpc/rpc_msg.h @@ -1,6 +1,8 @@ /* $NetBSD: rpc_msg.h,v 1.11 2000/06/02 22:57:56 fvdl Exp $ */ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 2009, Sun Microsystems, Inc. * All rights reserved. * diff --git a/freebsd/include/rpc/rpcb_clnt.h b/freebsd/include/rpc/rpcb_clnt.h index 45527872..b642aacd 100644 --- a/freebsd/include/rpc/rpcb_clnt.h +++ b/freebsd/include/rpc/rpcb_clnt.h @@ -2,6 +2,8 @@ /* $FreeBSD$ */ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 2009, Sun Microsystems, Inc. * All rights reserved. * diff --git a/freebsd/include/rpc/rpcent.h b/freebsd/include/rpc/rpcent.h index c1650fa4..15c4ae4d 100644 --- a/freebsd/include/rpc/rpcent.h +++ b/freebsd/include/rpc/rpcent.h @@ -2,6 +2,8 @@ /* $FreeBSD$ */ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 2009, Sun Microsystems, Inc. * All rights reserved. * diff --git a/freebsd/include/rpc/rpcsec_gss.h b/freebsd/include/rpc/rpcsec_gss.h index ccd346fd..2878ae04 100644 --- a/freebsd/include/rpc/rpcsec_gss.h +++ b/freebsd/include/rpc/rpcsec_gss.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2008 Doug Rabson * All rights reserved. * diff --git a/freebsd/include/rpc/svc.h b/freebsd/include/rpc/svc.h index c7989b03..83bbfb27 100644 --- a/freebsd/include/rpc/svc.h +++ b/freebsd/include/rpc/svc.h @@ -1,6 +1,8 @@ /* $NetBSD: svc.h,v 1.17 2000/06/02 22:57:56 fvdl Exp $ */ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 2009, Sun Microsystems, Inc. * All rights reserved. * diff --git a/freebsd/include/rpc/svc_auth.h b/freebsd/include/rpc/svc_auth.h index 87b8efe7..e9b6cd4b 100644 --- a/freebsd/include/rpc/svc_auth.h +++ b/freebsd/include/rpc/svc_auth.h @@ -1,6 +1,8 @@ /* $NetBSD: svc_auth.h,v 1.8 2000/06/02 22:57:57 fvdl Exp $ */ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 2009, Sun Microsystems, Inc. * All rights reserved. * diff --git a/freebsd/include/rpc/svc_dg.h b/freebsd/include/rpc/svc_dg.h index 313176ea..d9f3012c 100644 --- a/freebsd/include/rpc/svc_dg.h +++ b/freebsd/include/rpc/svc_dg.h @@ -2,6 +2,8 @@ /* $FreeBSD$ */ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 2009, Sun Microsystems, Inc. * All rights reserved. * diff --git a/freebsd/include/rpc/svc_soc.h b/freebsd/include/rpc/svc_soc.h index 311c8322..912e2ec2 100644 --- a/freebsd/include/rpc/svc_soc.h +++ b/freebsd/include/rpc/svc_soc.h @@ -2,6 +2,8 @@ /* $FreeBSD$ */ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 2009, Sun Microsystems, Inc. * All rights reserved. * diff --git a/freebsd/include/rpc/xdr.h b/freebsd/include/rpc/xdr.h index daee333f..9e239337 100644 --- a/freebsd/include/rpc/xdr.h +++ b/freebsd/include/rpc/xdr.h @@ -1,6 +1,8 @@ /* $NetBSD: xdr.h,v 1.19 2000/07/17 05:00:45 matt Exp $ */ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 2009, Sun Microsystems, Inc. * All rights reserved. * diff --git a/freebsd/include/rpcsvc/nis_tags.h b/freebsd/include/rpcsvc/nis_tags.h index 7ee630e6..55920a02 100644 --- a/freebsd/include/rpcsvc/nis_tags.h +++ b/freebsd/include/rpcsvc/nis_tags.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 2010, Oracle America, Inc. * * Redistribution and use in source and binary forms, with or without diff --git a/freebsd/include/rpcsvc/yp_prot.h b/freebsd/include/rpcsvc/yp_prot.h index 6b2e28af..a0090ac6 100644 --- a/freebsd/include/rpcsvc/yp_prot.h +++ b/freebsd/include/rpcsvc/yp_prot.h @@ -1,4 +1,6 @@ -/* +/*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1992/3 Theo de Raadt <deraadt@fsa.ca> * All rights reserved. * diff --git a/freebsd/include/rpcsvc/ypclnt.h b/freebsd/include/rpcsvc/ypclnt.h index abde97c3..c0a0a46e 100644 --- a/freebsd/include/rpcsvc/ypclnt.h +++ b/freebsd/include/rpcsvc/ypclnt.h @@ -1,4 +1,6 @@ -/* +/*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1992/3 Theo de Raadt <deraadt@fsa.ca> * All rights reserved. * diff --git a/freebsd/include/sysexits.h b/freebsd/include/sysexits.h index e52bb5be..5e414f24 100644 --- a/freebsd/include/sysexits.h +++ b/freebsd/include/sysexits.h @@ -1,4 +1,6 @@ -/* +/*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1987, 1993 * The Regents of the University of California. All rights reserved. * diff --git a/freebsd/lib/libbsdstat/bsdstat.c b/freebsd/lib/libbsdstat/bsdstat.c index 3bf727f9..ee710452 100644 --- a/freebsd/lib/libbsdstat/bsdstat.c +++ b/freebsd/lib/libbsdstat/bsdstat.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-user-space.h> /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2002-2007 Sam Leffler, Errno Consulting * All rights reserved. * diff --git a/freebsd/lib/libbsdstat/bsdstat.h b/freebsd/lib/libbsdstat/bsdstat.h index ef972108..89e231a8 100644 --- a/freebsd/lib/libbsdstat/bsdstat.h +++ b/freebsd/lib/libbsdstat/bsdstat.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2002-2007 Sam Leffler, Errno Consulting * All rights reserved. * diff --git a/freebsd/lib/libc/db/btree/bt_close.c b/freebsd/lib/libc/db/btree/bt_close.c index a56a8595..f4a1c5e7 100644 --- a/freebsd/lib/libc/db/btree/bt_close.c +++ b/freebsd/lib/libc/db/btree/bt_close.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-user-space.h> /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1990, 1993, 1994 * The Regents of the University of California. All rights reserved. * diff --git a/freebsd/lib/libc/db/btree/bt_conv.c b/freebsd/lib/libc/db/btree/bt_conv.c index 4acb9d47..87aefc6e 100644 --- a/freebsd/lib/libc/db/btree/bt_conv.c +++ b/freebsd/lib/libc/db/btree/bt_conv.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-user-space.h> /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1990, 1993, 1994 * The Regents of the University of California. All rights reserved. * diff --git a/freebsd/lib/libc/db/btree/bt_debug.c b/freebsd/lib/libc/db/btree/bt_debug.c index 992ed358..f543b9b4 100644 --- a/freebsd/lib/libc/db/btree/bt_debug.c +++ b/freebsd/lib/libc/db/btree/bt_debug.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-user-space.h> /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1990, 1993, 1994 * The Regents of the University of California. All rights reserved. * diff --git a/freebsd/lib/libc/db/btree/bt_delete.c b/freebsd/lib/libc/db/btree/bt_delete.c index 5ee6848e..d514d91d 100644 --- a/freebsd/lib/libc/db/btree/bt_delete.c +++ b/freebsd/lib/libc/db/btree/bt_delete.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-user-space.h> /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1990, 1993, 1994 * The Regents of the University of California. All rights reserved. * diff --git a/freebsd/lib/libc/db/btree/bt_get.c b/freebsd/lib/libc/db/btree/bt_get.c index bd4446ba..1b7b07ed 100644 --- a/freebsd/lib/libc/db/btree/bt_get.c +++ b/freebsd/lib/libc/db/btree/bt_get.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-user-space.h> /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1990, 1993, 1994 * The Regents of the University of California. All rights reserved. * diff --git a/freebsd/lib/libc/db/btree/bt_open.c b/freebsd/lib/libc/db/btree/bt_open.c index 02da0f77..81ce9eb4 100644 --- a/freebsd/lib/libc/db/btree/bt_open.c +++ b/freebsd/lib/libc/db/btree/bt_open.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-user-space.h> /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1990, 1993, 1994 * The Regents of the University of California. All rights reserved. * diff --git a/freebsd/lib/libc/db/btree/bt_overflow.c b/freebsd/lib/libc/db/btree/bt_overflow.c index 109db15e..bb3160b5 100644 --- a/freebsd/lib/libc/db/btree/bt_overflow.c +++ b/freebsd/lib/libc/db/btree/bt_overflow.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-user-space.h> /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1990, 1993, 1994 * The Regents of the University of California. All rights reserved. * diff --git a/freebsd/lib/libc/db/btree/bt_page.c b/freebsd/lib/libc/db/btree/bt_page.c index 35890ccc..8651d47f 100644 --- a/freebsd/lib/libc/db/btree/bt_page.c +++ b/freebsd/lib/libc/db/btree/bt_page.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-user-space.h> /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1990, 1993, 1994 * The Regents of the University of California. All rights reserved. * diff --git a/freebsd/lib/libc/db/btree/bt_put.c b/freebsd/lib/libc/db/btree/bt_put.c index aa6046c5..9bb5ac3f 100644 --- a/freebsd/lib/libc/db/btree/bt_put.c +++ b/freebsd/lib/libc/db/btree/bt_put.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-user-space.h> /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1990, 1993, 1994 * The Regents of the University of California. All rights reserved. * diff --git a/freebsd/lib/libc/db/btree/bt_search.c b/freebsd/lib/libc/db/btree/bt_search.c index f18b1f3f..212ceca4 100644 --- a/freebsd/lib/libc/db/btree/bt_search.c +++ b/freebsd/lib/libc/db/btree/bt_search.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-user-space.h> /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1990, 1993, 1994 * The Regents of the University of California. All rights reserved. * diff --git a/freebsd/lib/libc/db/btree/bt_seq.c b/freebsd/lib/libc/db/btree/bt_seq.c index d879e9e7..54020fc7 100644 --- a/freebsd/lib/libc/db/btree/bt_seq.c +++ b/freebsd/lib/libc/db/btree/bt_seq.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-user-space.h> /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1990, 1993, 1994 * The Regents of the University of California. All rights reserved. * diff --git a/freebsd/lib/libc/db/btree/bt_split.c b/freebsd/lib/libc/db/btree/bt_split.c index ce47a6e3..e03596db 100644 --- a/freebsd/lib/libc/db/btree/bt_split.c +++ b/freebsd/lib/libc/db/btree/bt_split.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-user-space.h> /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1990, 1993, 1994 * The Regents of the University of California. All rights reserved. * diff --git a/freebsd/lib/libc/db/btree/bt_utils.c b/freebsd/lib/libc/db/btree/bt_utils.c index 9aee0051..ff098427 100644 --- a/freebsd/lib/libc/db/btree/bt_utils.c +++ b/freebsd/lib/libc/db/btree/bt_utils.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-user-space.h> /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1990, 1993, 1994 * The Regents of the University of California. All rights reserved. * diff --git a/freebsd/lib/libc/db/btree/btree.h b/freebsd/lib/libc/db/btree/btree.h index fe313a07..1db1e348 100644 --- a/freebsd/lib/libc/db/btree/btree.h +++ b/freebsd/lib/libc/db/btree/btree.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1991, 1993, 1994 * The Regents of the University of California. All rights reserved. * diff --git a/freebsd/lib/libc/db/btree/extern.h b/freebsd/lib/libc/db/btree/extern.h index 388f2716..581504cc 100644 --- a/freebsd/lib/libc/db/btree/extern.h +++ b/freebsd/lib/libc/db/btree/extern.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1991, 1993, 1994 * The Regents of the University of California. All rights reserved. * diff --git a/freebsd/lib/libc/db/db/db.c b/freebsd/lib/libc/db/db/db.c index 774ebad1..12afbfb5 100644 --- a/freebsd/lib/libc/db/db/db.c +++ b/freebsd/lib/libc/db/db/db.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-user-space.h> /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1991, 1993 * The Regents of the University of California. All rights reserved. * diff --git a/freebsd/lib/libc/db/mpool/mpool-compat.c b/freebsd/lib/libc/db/mpool/mpool-compat.c index d4e96640..37bbdd79 100644 --- a/freebsd/lib/libc/db/mpool/mpool-compat.c +++ b/freebsd/lib/libc/db/mpool/mpool-compat.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-user-space.h> /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2009 Xin LI <delphij@FreeBSD.org> * All rights reserved. * diff --git a/freebsd/lib/libc/db/mpool/mpool.c b/freebsd/lib/libc/db/mpool/mpool.c index bcb00dad..302c968d 100644 --- a/freebsd/lib/libc/db/mpool/mpool.c +++ b/freebsd/lib/libc/db/mpool/mpool.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-user-space.h> /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1990, 1993, 1994 * The Regents of the University of California. All rights reserved. * diff --git a/freebsd/lib/libc/db/recno/extern.h b/freebsd/lib/libc/db/recno/extern.h index 9bec8029..11e3ca22 100644 --- a/freebsd/lib/libc/db/recno/extern.h +++ b/freebsd/lib/libc/db/recno/extern.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1991, 1993 * The Regents of the University of California. All rights reserved. * diff --git a/freebsd/lib/libc/db/recno/rec_close.c b/freebsd/lib/libc/db/recno/rec_close.c index 8bc20ca6..6b8b9dde 100644 --- a/freebsd/lib/libc/db/recno/rec_close.c +++ b/freebsd/lib/libc/db/recno/rec_close.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-user-space.h> /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1990, 1993, 1994 * The Regents of the University of California. All rights reserved. * diff --git a/freebsd/lib/libc/db/recno/rec_delete.c b/freebsd/lib/libc/db/recno/rec_delete.c index 688df9d9..2ccae8a7 100644 --- a/freebsd/lib/libc/db/recno/rec_delete.c +++ b/freebsd/lib/libc/db/recno/rec_delete.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-user-space.h> /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1990, 1993, 1994 * The Regents of the University of California. All rights reserved. * diff --git a/freebsd/lib/libc/db/recno/rec_get.c b/freebsd/lib/libc/db/recno/rec_get.c index 45bfece6..fa6c91ea 100644 --- a/freebsd/lib/libc/db/recno/rec_get.c +++ b/freebsd/lib/libc/db/recno/rec_get.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-user-space.h> /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1990, 1993, 1994 * The Regents of the University of California. All rights reserved. * diff --git a/freebsd/lib/libc/db/recno/rec_open.c b/freebsd/lib/libc/db/recno/rec_open.c index e104c531..f7033875 100644 --- a/freebsd/lib/libc/db/recno/rec_open.c +++ b/freebsd/lib/libc/db/recno/rec_open.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-user-space.h> /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1990, 1993, 1994 * The Regents of the University of California. All rights reserved. * diff --git a/freebsd/lib/libc/db/recno/rec_put.c b/freebsd/lib/libc/db/recno/rec_put.c index f4ea926e..4efeec92 100644 --- a/freebsd/lib/libc/db/recno/rec_put.c +++ b/freebsd/lib/libc/db/recno/rec_put.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-user-space.h> /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1990, 1993, 1994 * The Regents of the University of California. All rights reserved. * diff --git a/freebsd/lib/libc/db/recno/rec_search.c b/freebsd/lib/libc/db/recno/rec_search.c index 9b5db59e..d61c1f3a 100644 --- a/freebsd/lib/libc/db/recno/rec_search.c +++ b/freebsd/lib/libc/db/recno/rec_search.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-user-space.h> /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1990, 1993 * The Regents of the University of California. All rights reserved. * diff --git a/freebsd/lib/libc/db/recno/rec_seq.c b/freebsd/lib/libc/db/recno/rec_seq.c index 1c862037..f36cfb88 100644 --- a/freebsd/lib/libc/db/recno/rec_seq.c +++ b/freebsd/lib/libc/db/recno/rec_seq.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-user-space.h> /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1991, 1993, 1994 * The Regents of the University of California. All rights reserved. * diff --git a/freebsd/lib/libc/db/recno/rec_utils.c b/freebsd/lib/libc/db/recno/rec_utils.c index 2af19d0c..d2fc5d35 100644 --- a/freebsd/lib/libc/db/recno/rec_utils.c +++ b/freebsd/lib/libc/db/recno/rec_utils.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-user-space.h> /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1990, 1993, 1994 * The Regents of the University of California. All rights reserved. * diff --git a/freebsd/lib/libc/db/recno/recno.h b/freebsd/lib/libc/db/recno/recno.h index 87986114..ae0eb85c 100644 --- a/freebsd/lib/libc/db/recno/recno.h +++ b/freebsd/lib/libc/db/recno/recno.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1991, 1993 * The Regents of the University of California. All rights reserved. * diff --git a/freebsd/lib/libc/gen/err.c b/freebsd/lib/libc/gen/err.c index 1d026dbf..9ad0da79 100644 --- a/freebsd/lib/libc/gen/err.c +++ b/freebsd/lib/libc/gen/err.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-user-space.h> /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1993 * The Regents of the University of California. All rights reserved. * diff --git a/freebsd/lib/libc/gen/feature_present.c b/freebsd/lib/libc/gen/feature_present.c index 6eb44887..1a1d9a85 100644 --- a/freebsd/lib/libc/gen/feature_present.c +++ b/freebsd/lib/libc/gen/feature_present.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-user-space.h> /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 2008 Yahoo!, Inc. * All rights reserved. * Written by: John Baldwin <jhb@FreeBSD.org> diff --git a/freebsd/lib/libc/gen/getdomainname.c b/freebsd/lib/libc/gen/getdomainname.c index 142e79c6..32dfdf01 100644 --- a/freebsd/lib/libc/gen/getdomainname.c +++ b/freebsd/lib/libc/gen/getdomainname.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-user-space.h> -/* +/*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1989, 1993 * The Regents of the University of California. All rights reserved. * diff --git a/freebsd/lib/libc/gen/gethostname.c b/freebsd/lib/libc/gen/gethostname.c index 26c97ec1..0c832be1 100644 --- a/freebsd/lib/libc/gen/gethostname.c +++ b/freebsd/lib/libc/gen/gethostname.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-user-space.h> -/* +/*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1989, 1993 * The Regents of the University of California. All rights reserved. * diff --git a/freebsd/lib/libc/gen/sethostname.c b/freebsd/lib/libc/gen/sethostname.c index 9e81311d..c7185019 100644 --- a/freebsd/lib/libc/gen/sethostname.c +++ b/freebsd/lib/libc/gen/sethostname.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-user-space.h> -/* +/*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1989, 1993 * The Regents of the University of California. All rights reserved. * diff --git a/freebsd/lib/libc/include/libc_private.h b/freebsd/lib/libc/include/libc_private.h index 91f832a0..8e78f556 100644 --- a/freebsd/lib/libc/include/libc_private.h +++ b/freebsd/lib/libc/include/libc_private.h @@ -1,4 +1,6 @@ -/* +/*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1998 John Birrell <jb@cimlogic.com.au>. * All rights reserved. * diff --git a/freebsd/lib/libc/include/namespace.h b/freebsd/lib/libc/include/namespace.h index a4678037..252265c8 100644 --- a/freebsd/lib/libc/include/namespace.h +++ b/freebsd/lib/libc/include/namespace.h @@ -1,5 +1,7 @@ -/* - * Copyright (c) XXX +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2001 Daniel Eischen <deischen@FreeBSD.org>. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/freebsd/lib/libc/include/nss_tls.h b/freebsd/lib/libc/include/nss_tls.h index 03cf9923..0bf088ee 100644 --- a/freebsd/lib/libc/include/nss_tls.h +++ b/freebsd/lib/libc/include/nss_tls.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2003 Networks Associates Technology, Inc. * All rights reserved. * diff --git a/freebsd/lib/libc/include/reentrant.h b/freebsd/lib/libc/include/reentrant.h index 8e0b90f5..dd197ada 100644 --- a/freebsd/lib/libc/include/reentrant.h +++ b/freebsd/lib/libc/include/reentrant.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 1997,98 The NetBSD Foundation, Inc. * All rights reserved. * diff --git a/freebsd/lib/libc/include/spinlock.h b/freebsd/lib/libc/include/spinlock.h index c29f3f5e..c81ef76d 100644 --- a/freebsd/lib/libc/include/spinlock.h +++ b/freebsd/lib/libc/include/spinlock.h @@ -1,4 +1,6 @@ -/* +/*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1998 John Birrell <jb@cimlogic.com.au>. * All rights reserved. * diff --git a/freebsd/lib/libc/include/un-namespace.h b/freebsd/lib/libc/include/un-namespace.h index 85cfe0e5..5089a707 100644 --- a/freebsd/lib/libc/include/un-namespace.h +++ b/freebsd/lib/libc/include/un-namespace.h @@ -1,5 +1,7 @@ -/* - * Copyright (c) XXX +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2001 Daniel Eischen <deischen@FreeBSD.org>. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/freebsd/lib/libc/inet/inet_addr.c b/freebsd/lib/libc/inet/inet_addr.c index 0be7c726..3dedd7fa 100644 --- a/freebsd/lib/libc/inet/inet_addr.c +++ b/freebsd/lib/libc/inet/inet_addr.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-user-space.h> -/* +/*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1983, 1990, 1993 * The Regents of the University of California. All rights reserved. * diff --git a/freebsd/lib/libc/inet/inet_lnaof.c b/freebsd/lib/libc/inet/inet_lnaof.c index 8a071dfc..f764b354 100644 --- a/freebsd/lib/libc/inet/inet_lnaof.c +++ b/freebsd/lib/libc/inet/inet_lnaof.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-user-space.h> -/* +/*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1983, 1993 * The Regents of the University of California. All rights reserved. * diff --git a/freebsd/lib/libc/inet/inet_makeaddr.c b/freebsd/lib/libc/inet/inet_makeaddr.c index 024c8e27..75b011ab 100644 --- a/freebsd/lib/libc/inet/inet_makeaddr.c +++ b/freebsd/lib/libc/inet/inet_makeaddr.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-user-space.h> -/* +/*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1983, 1993 * The Regents of the University of California. All rights reserved. * diff --git a/freebsd/lib/libc/inet/inet_netof.c b/freebsd/lib/libc/inet/inet_netof.c index 24d9c91d..5cd96736 100644 --- a/freebsd/lib/libc/inet/inet_netof.c +++ b/freebsd/lib/libc/inet/inet_netof.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-user-space.h> -/* +/*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1983, 1993 * The Regents of the University of California. All rights reserved. * diff --git a/freebsd/lib/libc/inet/inet_network.c b/freebsd/lib/libc/inet/inet_network.c index d42c1160..244754cc 100644 --- a/freebsd/lib/libc/inet/inet_network.c +++ b/freebsd/lib/libc/inet/inet_network.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-user-space.h> -/* +/*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1983, 1993 * The Regents of the University of California. All rights reserved. * diff --git a/freebsd/lib/libc/inet/inet_ntoa.c b/freebsd/lib/libc/inet/inet_ntoa.c index 3a009569..4a9acca1 100644 --- a/freebsd/lib/libc/inet/inet_ntoa.c +++ b/freebsd/lib/libc/inet/inet_ntoa.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-user-space.h> /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1983, 1993 * The Regents of the University of California. All rights reserved. * diff --git a/freebsd/lib/libc/net/ether_addr.c b/freebsd/lib/libc/net/ether_addr.c index bceefaec..55b823bf 100644 --- a/freebsd/lib/libc/net/ether_addr.c +++ b/freebsd/lib/libc/net/ether_addr.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-user-space.h> -/* +/*- + * SPDX-License-Identifier: BSD-4-Clause + * * Copyright (c) 1995 Bill Paul <wpaul@ctr.columbia.edu>. * Copyright (c) 2007 Robert N. M. Watson * All rights reserved. diff --git a/freebsd/lib/libc/net/gai_strerror.c b/freebsd/lib/libc/net/gai_strerror.c index 0a0a64ac..b2b35d69 100644 --- a/freebsd/lib/libc/net/gai_strerror.c +++ b/freebsd/lib/libc/net/gai_strerror.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-user-space.h> -/* +/*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. * All rights reserved. * diff --git a/freebsd/lib/libc/net/getaddrinfo.c b/freebsd/lib/libc/net/getaddrinfo.c index 2f97a244..c9dab725 100644 --- a/freebsd/lib/libc/net/getaddrinfo.c +++ b/freebsd/lib/libc/net/getaddrinfo.c @@ -2,7 +2,9 @@ /* $KAME: getaddrinfo.c,v 1.15 2000/07/09 04:37:24 itojun Exp $ */ -/* +/*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. * All rights reserved. * diff --git a/freebsd/lib/libc/net/gethostbydns.c b/freebsd/lib/libc/net/gethostbydns.c index bb63e8bd..07e69ac7 100644 --- a/freebsd/lib/libc/net/gethostbydns.c +++ b/freebsd/lib/libc/net/gethostbydns.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-user-space.h> -/* +/*- + * SPDX-License-Identifier: BSD-3-Clause + * * ++Copyright++ 1985, 1988, 1993 * - * Copyright (c) 1985, 1988, 1993 diff --git a/freebsd/lib/libc/net/gethostbyht.c b/freebsd/lib/libc/net/gethostbyht.c index 648a3e71..0e4042e9 100644 --- a/freebsd/lib/libc/net/gethostbyht.c +++ b/freebsd/lib/libc/net/gethostbyht.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-user-space.h> /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1985, 1988, 1993 * The Regents of the University of California. All rights reserved. * diff --git a/freebsd/lib/libc/net/gethostbynis.c b/freebsd/lib/libc/net/gethostbynis.c index 833017ab..5cf4b2e0 100644 --- a/freebsd/lib/libc/net/gethostbynis.c +++ b/freebsd/lib/libc/net/gethostbynis.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-user-space.h> /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 1994, Garrett Wollman * * Redistribution and use in source and binary forms, with or without diff --git a/freebsd/lib/libc/net/gethostnamadr.c b/freebsd/lib/libc/net/gethostnamadr.c index 837b5ec2..b9103282 100644 --- a/freebsd/lib/libc/net/gethostnamadr.c +++ b/freebsd/lib/libc/net/gethostnamadr.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-user-space.h> /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 1994, Garrett Wollman * * Redistribution and use in source and binary forms, with or without diff --git a/freebsd/lib/libc/net/getifmaddrs.c b/freebsd/lib/libc/net/getifmaddrs.c index 41d61091..d555b4a0 100644 --- a/freebsd/lib/libc/net/getifmaddrs.c +++ b/freebsd/lib/libc/net/getifmaddrs.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-user-space.h> -/* +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2003 Bruce M. Simpson. * All rights reserved * diff --git a/freebsd/lib/libc/net/getnameinfo.c b/freebsd/lib/libc/net/getnameinfo.c index a3c850ba..741972de 100644 --- a/freebsd/lib/libc/net/getnameinfo.c +++ b/freebsd/lib/libc/net/getnameinfo.c @@ -2,7 +2,9 @@ /* $KAME: getnameinfo.c,v 1.61 2002/06/27 09:25:47 itojun Exp $ */ -/* +/*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. * Copyright (c) 2000 Ben Harris. * All rights reserved. diff --git a/freebsd/lib/libc/net/getnetbydns.c b/freebsd/lib/libc/net/getnetbydns.c index 6338d36e..d9bd1c10 100644 --- a/freebsd/lib/libc/net/getnetbydns.c +++ b/freebsd/lib/libc/net/getnetbydns.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-user-space.h> /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1985, 1988, 1993 * The Regents of the University of California. All rights reserved. * diff --git a/freebsd/lib/libc/net/getnetbyht.c b/freebsd/lib/libc/net/getnetbyht.c index 71a2d1d6..ce7cbe01 100644 --- a/freebsd/lib/libc/net/getnetbyht.c +++ b/freebsd/lib/libc/net/getnetbyht.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-user-space.h> -/* +/*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1983, 1993 * The Regents of the University of California. All rights reserved. * diff --git a/freebsd/lib/libc/net/getnetbynis.c b/freebsd/lib/libc/net/getnetbynis.c index b47d3808..cb7f1a6e 100644 --- a/freebsd/lib/libc/net/getnetbynis.c +++ b/freebsd/lib/libc/net/getnetbynis.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-user-space.h> /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 1994, Garrett Wollman * * Redistribution and use in source and binary forms, with or without diff --git a/freebsd/lib/libc/net/getnetnamadr.c b/freebsd/lib/libc/net/getnetnamadr.c index ca08a191..147fa350 100644 --- a/freebsd/lib/libc/net/getnetnamadr.c +++ b/freebsd/lib/libc/net/getnetnamadr.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-user-space.h> /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 1994, Garrett Wollman * * Redistribution and use in source and binary forms, with or without diff --git a/freebsd/lib/libc/net/getproto.c b/freebsd/lib/libc/net/getproto.c index 2817fb8f..3850aca8 100644 --- a/freebsd/lib/libc/net/getproto.c +++ b/freebsd/lib/libc/net/getproto.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-user-space.h> -/* +/*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1983, 1993 * The Regents of the University of California. All rights reserved. * diff --git a/freebsd/lib/libc/net/getprotoent.c b/freebsd/lib/libc/net/getprotoent.c index f81746f2..0558bc1f 100644 --- a/freebsd/lib/libc/net/getprotoent.c +++ b/freebsd/lib/libc/net/getprotoent.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-user-space.h> -/* +/*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1983, 1993 * The Regents of the University of California. All rights reserved. * diff --git a/freebsd/lib/libc/net/getprotoname.c b/freebsd/lib/libc/net/getprotoname.c index e798e991..ed48dcbd 100644 --- a/freebsd/lib/libc/net/getprotoname.c +++ b/freebsd/lib/libc/net/getprotoname.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-user-space.h> -/* +/*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1983, 1993 * The Regents of the University of California. All rights reserved. * diff --git a/freebsd/lib/libc/net/getservent.c b/freebsd/lib/libc/net/getservent.c index 424adb2e..5358093d 100644 --- a/freebsd/lib/libc/net/getservent.c +++ b/freebsd/lib/libc/net/getservent.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-user-space.h> -/* +/*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1983, 1993 * The Regents of the University of California. All rights reserved. * diff --git a/freebsd/lib/libc/net/ip6opt.c b/freebsd/lib/libc/net/ip6opt.c index 920c203a..eeef03a6 100644 --- a/freebsd/lib/libc/net/ip6opt.c +++ b/freebsd/lib/libc/net/ip6opt.c @@ -2,7 +2,9 @@ /* $KAME: ip6opt.c,v 1.13 2003/06/06 10:08:20 suz Exp $ */ -/* +/*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. * All rights reserved. * diff --git a/freebsd/lib/libc/net/linkaddr.c b/freebsd/lib/libc/net/linkaddr.c index 97870019..70743c02 100644 --- a/freebsd/lib/libc/net/linkaddr.c +++ b/freebsd/lib/libc/net/linkaddr.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-user-space.h> /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1990, 1993 * The Regents of the University of California. All rights reserved. * diff --git a/freebsd/lib/libc/net/map_v4v6.c b/freebsd/lib/libc/net/map_v4v6.c index 60334b05..5ccbf3fb 100644 --- a/freebsd/lib/libc/net/map_v4v6.c +++ b/freebsd/lib/libc/net/map_v4v6.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-user-space.h> -/* +/*- + * SPDX-License-Identifier: BSD-3-Clause + * * ++Copyright++ 1985, 1988, 1993 * - * Copyright (c) 1985, 1988, 1993 diff --git a/freebsd/lib/libc/net/name6.c b/freebsd/lib/libc/net/name6.c index da65015b..1be61773 100644 --- a/freebsd/lib/libc/net/name6.c +++ b/freebsd/lib/libc/net/name6.c @@ -2,7 +2,9 @@ /* $KAME: name6.c,v 1.25 2000/06/26 16:44:40 itojun Exp $ */ -/* +/*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (C) 1995, 1996, 1997, 1998, and 1999 WIDE Project. * All rights reserved. * diff --git a/freebsd/lib/libc/net/netdb_private.h b/freebsd/lib/libc/net/netdb_private.h index 51f28f07..0cd832b6 100644 --- a/freebsd/lib/libc/net/netdb_private.h +++ b/freebsd/lib/libc/net/netdb_private.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (C) 2005 The FreeBSD Project. All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/freebsd/lib/libc/net/nsdispatch.c b/freebsd/lib/libc/net/nsdispatch.c index c739bf6a..4b74407c 100644 --- a/freebsd/lib/libc/net/nsdispatch.c +++ b/freebsd/lib/libc/net/nsdispatch.c @@ -3,6 +3,8 @@ /* $NetBSD: nsdispatch.c,v 1.9 1999/01/25 00:16:17 lukem Exp $ */ /*- + * SPDX-License-Identifier: BSD-2-Clause-NetBSD + * * Copyright (c) 1997, 1998, 1999 The NetBSD Foundation, Inc. * All rights reserved. * diff --git a/freebsd/lib/libc/net/nslexer.c b/freebsd/lib/libc/net/nslexer.c index 2a86898a..d3cc82ce 100644 --- a/freebsd/lib/libc/net/nslexer.c +++ b/freebsd/lib/libc/net/nslexer.c @@ -538,6 +538,8 @@ char *_nsyytext; /* $NetBSD: nslexer.l,v 1.3 1999/01/25 00:16:17 lukem Exp $ */ /*- + * SPDX-License-Identifier: BSD-2-Clause-NetBSD + * * Copyright (c) 1997, 1998, 1999 The NetBSD Foundation, Inc. * All rights reserved. * @@ -583,7 +585,7 @@ static char *rcsid = #include "nsparser.h" #define YY_NO_INPUT 1 -#line 587 "nslexer.c" +#line 589 "nslexer.c" #define INITIAL 0 @@ -763,10 +765,10 @@ YY_DECL char *yy_cp, *yy_bp; int yy_act; -#line 59 "nslexer.l" +#line 61 "nslexer.l" -#line 770 "nslexer.c" +#line 772 "nslexer.c" if ( !(yy_init) ) { @@ -861,59 +863,59 @@ do_action: /* This label is used only to access EOF actions. */ case 1: YY_RULE_SETUP -#line 61 "nslexer.l" +#line 63 "nslexer.l" ; /* skip whitespace */ YY_BREAK case 2: YY_RULE_SETUP -#line 63 "nslexer.l" +#line 65 "nslexer.l" ; /* skip comments */ YY_BREAK case 3: /* rule 3 can match eol */ YY_RULE_SETUP -#line 65 "nslexer.l" +#line 67 "nslexer.l" ; /* allow continuation */ YY_BREAK case 4: /* rule 4 can match eol */ YY_RULE_SETUP -#line 67 "nslexer.l" +#line 69 "nslexer.l" return NL; YY_BREAK case 5: YY_RULE_SETUP -#line 69 "nslexer.l" +#line 71 "nslexer.l" return SUCCESS; YY_BREAK case 6: YY_RULE_SETUP -#line 70 "nslexer.l" +#line 72 "nslexer.l" return UNAVAIL; YY_BREAK case 7: YY_RULE_SETUP -#line 71 "nslexer.l" +#line 73 "nslexer.l" return NOTFOUND; YY_BREAK case 8: YY_RULE_SETUP -#line 72 "nslexer.l" +#line 74 "nslexer.l" return TRYAGAIN; YY_BREAK case 9: YY_RULE_SETUP -#line 74 "nslexer.l" +#line 76 "nslexer.l" return RETURN; YY_BREAK case 10: YY_RULE_SETUP -#line 75 "nslexer.l" +#line 77 "nslexer.l" return CONTINUE; YY_BREAK case 11: YY_RULE_SETUP -#line 77 "nslexer.l" +#line 79 "nslexer.l" { char *p; int i; @@ -933,15 +935,15 @@ YY_RULE_SETUP YY_BREAK case 12: YY_RULE_SETUP -#line 94 "nslexer.l" +#line 96 "nslexer.l" return _nsyytext[0]; YY_BREAK case 13: YY_RULE_SETUP -#line 96 "nslexer.l" +#line 98 "nslexer.l" ECHO; YY_BREAK -#line 945 "nslexer.c" +#line 947 "nslexer.c" case YY_STATE_EOF(INITIAL): yyterminate(); @@ -1906,7 +1908,7 @@ void _nsyyfree (void * ptr ) #define YYTABLES_NAME "yytables" -#line 96 "nslexer.l" +#line 98 "nslexer.l" diff --git a/freebsd/lib/libc/net/nslexer.l b/freebsd/lib/libc/net/nslexer.l index c7a95f61..17cfef8a 100644 --- a/freebsd/lib/libc/net/nslexer.l +++ b/freebsd/lib/libc/net/nslexer.l @@ -2,6 +2,8 @@ /* $NetBSD: nslexer.l,v 1.3 1999/01/25 00:16:17 lukem Exp $ */ /*- + * SPDX-License-Identifier: BSD-2-Clause-NetBSD + * * Copyright (c) 1997, 1998, 1999 The NetBSD Foundation, Inc. * All rights reserved. * diff --git a/freebsd/lib/libc/net/nsparser.c b/freebsd/lib/libc/net/nsparser.c index aefcde20..d574ad2a 100644 --- a/freebsd/lib/libc/net/nsparser.c +++ b/freebsd/lib/libc/net/nsparser.c @@ -101,6 +101,8 @@ /* $NetBSD: nsparser.y,v 1.3 1999/01/25 00:16:18 lukem Exp $ */ /*- + * SPDX-License-Identifier: BSD-2-Clause-NetBSD + * * Copyright (c) 1997, 1998, 1999 The NetBSD Foundation, Inc. * All rights reserved. * @@ -151,13 +153,13 @@ static ns_src cursrc; #endif #ifndef YYSTYPE_IS_DECLARED #define YYSTYPE_IS_DECLARED 1 -#line 51 "nsparser.y" +#line 53 "nsparser.y" typedef union { char *str; int mapval; } YYSTYPE; #endif /* !YYSTYPE_IS_DECLARED */ -#line 161 "nsparser.c" +#line 163 "nsparser.c" /* compatibility with bison */ #ifdef YYPARSE_PARAM @@ -356,7 +358,7 @@ typedef struct { } YYSTACKDATA; /* variables for the parser stack */ static YYSTACKDATA yystack; -#line 146 "nsparser.y" +#line 148 "nsparser.y" static void _nsaddsrctomap(const char *elem) @@ -389,7 +391,7 @@ _nsaddsrctomap(const char *elem) cursrc.name = elem; _nsdbtaddsrc(&curdbt, &cursrc); } -#line 393 "nsparser.c" +#line 395 "nsparser.c" #if YYDEBUG #include <stdio.h> /* needed for printf */ @@ -589,25 +591,25 @@ yyreduce: switch (yyn) { case 6: -#line 79 "nsparser.y" +#line 81 "nsparser.y" { free((char*)curdbt.name); } break; case 7: -#line 83 "nsparser.y" +#line 85 "nsparser.y" { _nsdbtput(&curdbt); } break; case 8: -#line 87 "nsparser.y" +#line 89 "nsparser.y" { yyerrok; } break; case 9: -#line 94 "nsparser.y" +#line 96 "nsparser.y" { curdbt.name = yylval.str; curdbt.srclist = NULL; @@ -615,24 +617,24 @@ case 9: } break; case 12: -#line 108 "nsparser.y" +#line 110 "nsparser.y" { cursrc.flags = NS_TERMINATE; _nsaddsrctomap(yystack.l_mark[0].str); } break; case 13: -#line 112 "nsparser.y" +#line 114 "nsparser.y" { cursrc.flags = NS_SUCCESS; } break; case 14: -#line 113 "nsparser.y" +#line 115 "nsparser.y" { _nsaddsrctomap(yystack.l_mark[-4].str); } break; case 17: -#line 125 "nsparser.y" +#line 127 "nsparser.y" { if (yystack.l_mark[0].mapval) /* if action == RETURN set RETURN bit */ cursrc.flags |= yystack.l_mark[-2].mapval; @@ -641,30 +643,30 @@ case 17: } break; case 18: -#line 134 "nsparser.y" +#line 136 "nsparser.y" { yyval.mapval = NS_SUCCESS; } break; case 19: -#line 135 "nsparser.y" +#line 137 "nsparser.y" { yyval.mapval = NS_UNAVAIL; } break; case 20: -#line 136 "nsparser.y" +#line 138 "nsparser.y" { yyval.mapval = NS_NOTFOUND; } break; case 21: -#line 137 "nsparser.y" +#line 139 "nsparser.y" { yyval.mapval = NS_TRYAGAIN; } break; case 22: -#line 141 "nsparser.y" +#line 143 "nsparser.y" { yyval.mapval = NS_ACTION_RETURN; } break; case 23: -#line 142 "nsparser.y" +#line 144 "nsparser.y" { yyval.mapval = NS_ACTION_CONTINUE; } break; -#line 668 "nsparser.c" +#line 670 "nsparser.c" } yystack.s_mark -= yym; yystate = *yystack.s_mark; diff --git a/freebsd/lib/libc/net/nsparser.y b/freebsd/lib/libc/net/nsparser.y index 773e23fc..a67b0803 100644 --- a/freebsd/lib/libc/net/nsparser.y +++ b/freebsd/lib/libc/net/nsparser.y @@ -2,6 +2,8 @@ /* $NetBSD: nsparser.y,v 1.3 1999/01/25 00:16:18 lukem Exp $ */ /*- + * SPDX-License-Identifier: BSD-2-Clause-NetBSD + * * Copyright (c) 1997, 1998, 1999 The NetBSD Foundation, Inc. * All rights reserved. * diff --git a/freebsd/lib/libc/net/nss_backends.h b/freebsd/lib/libc/net/nss_backends.h index 9bea37b1..0ec80322 100644 --- a/freebsd/lib/libc/net/nss_backends.h +++ b/freebsd/lib/libc/net/nss_backends.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2003 Networks Associates Technology, Inc. * All rights reserved. * diff --git a/freebsd/lib/libc/net/rcmd.c b/freebsd/lib/libc/net/rcmd.c index aff5584c..24bd7a0c 100644 --- a/freebsd/lib/libc/net/rcmd.c +++ b/freebsd/lib/libc/net/rcmd.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-user-space.h> -/* +/*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1983, 1993, 1994 * The Regents of the University of California. All rights reserved. * diff --git a/freebsd/lib/libc/net/recv.c b/freebsd/lib/libc/net/recv.c index 4d3fc004..f424dd5c 100644 --- a/freebsd/lib/libc/net/recv.c +++ b/freebsd/lib/libc/net/recv.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-user-space.h> -/* +/*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1988, 1993 * The Regents of the University of California. All rights reserved. * diff --git a/freebsd/lib/libc/net/rthdr.c b/freebsd/lib/libc/net/rthdr.c index 89d1c2eb..841ccd50 100644 --- a/freebsd/lib/libc/net/rthdr.c +++ b/freebsd/lib/libc/net/rthdr.c @@ -2,7 +2,9 @@ /* $KAME: rthdr.c,v 1.19 2003/06/06 10:48:51 itojun Exp $ */ -/* +/*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. * All rights reserved. * diff --git a/freebsd/lib/libc/net/send.c b/freebsd/lib/libc/net/send.c index 6b71fa95..b8bca568 100644 --- a/freebsd/lib/libc/net/send.c +++ b/freebsd/lib/libc/net/send.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-user-space.h> -/* +/*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1988, 1993 * The Regents of the University of California. All rights reserved. * diff --git a/freebsd/lib/libc/net/vars.c b/freebsd/lib/libc/net/vars.c index b3355ff0..0d4a33d6 100644 --- a/freebsd/lib/libc/net/vars.c +++ b/freebsd/lib/libc/net/vars.c @@ -2,7 +2,9 @@ /* $KAME: vars.c,v 1.2 2001/08/20 02:32:41 itojun Exp $ */ -/* +/*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. * All rights reserved. * diff --git a/freebsd/lib/libc/posix1e/mac.c b/freebsd/lib/libc/posix1e/mac.c index 16e45199..23ff49df 100644 --- a/freebsd/lib/libc/posix1e/mac.c +++ b/freebsd/lib/libc/posix1e/mac.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-user-space.h> -/* +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 1999, 2000, 2001, 2002 Robert N. M. Watson * Copyright (c) 2002, 2003 Networks Associates Technology, Inc. * All rights reserved. diff --git a/freebsd/lib/libc/resolv/h_errno.c b/freebsd/lib/libc/resolv/h_errno.c index aed29e84..49f17f08 100644 --- a/freebsd/lib/libc/resolv/h_errno.c +++ b/freebsd/lib/libc/resolv/h_errno.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-user-space.h> /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2006 The FreeBSD Project. All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/freebsd/lib/libc/resolv/herror.c b/freebsd/lib/libc/resolv/herror.c index b7abf3bc..29da9ca3 100644 --- a/freebsd/lib/libc/resolv/herror.c +++ b/freebsd/lib/libc/resolv/herror.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-user-space.h> -/* +/*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1987, 1993 * The Regents of the University of California. All rights reserved. * diff --git a/freebsd/lib/libc/resolv/res_comp.c b/freebsd/lib/libc/resolv/res_comp.c index a62551ca..4999327b 100644 --- a/freebsd/lib/libc/resolv/res_comp.c +++ b/freebsd/lib/libc/resolv/res_comp.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-user-space.h> -/* +/*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1985, 1993 * The Regents of the University of California. All rights reserved. * diff --git a/freebsd/lib/libc/resolv/res_debug.c b/freebsd/lib/libc/resolv/res_debug.c index ff6e61f4..004a7db0 100644 --- a/freebsd/lib/libc/resolv/res_debug.c +++ b/freebsd/lib/libc/resolv/res_debug.c @@ -17,7 +17,9 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* +/*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1985 * The Regents of the University of California. All rights reserved. * diff --git a/freebsd/lib/libc/resolv/res_init.c b/freebsd/lib/libc/resolv/res_init.c index 521839f8..ce4b4267 100644 --- a/freebsd/lib/libc/resolv/res_init.c +++ b/freebsd/lib/libc/resolv/res_init.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-user-space.h> -/* +/*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1985, 1989, 1993 * The Regents of the University of California. All rights reserved. * diff --git a/freebsd/lib/libc/resolv/res_mkquery.c b/freebsd/lib/libc/resolv/res_mkquery.c index 9e6c4d7a..564eb5a2 100644 --- a/freebsd/lib/libc/resolv/res_mkquery.c +++ b/freebsd/lib/libc/resolv/res_mkquery.c @@ -17,7 +17,9 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* +/*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1985, 1993 * The Regents of the University of California. All rights reserved. * diff --git a/freebsd/lib/libc/resolv/res_query.c b/freebsd/lib/libc/resolv/res_query.c index 9c351050..2010d647 100644 --- a/freebsd/lib/libc/resolv/res_query.c +++ b/freebsd/lib/libc/resolv/res_query.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-user-space.h> -/* +/*- + * SPDX-License-Identifier: BSD-3-Clause + * * Portions Copyright (C) 2004, 2005, 2008 Internet Systems Consortium, Inc. ("ISC") * Portions Copyright (C) 1996-2001, 2003 Internet Software Consortium. * diff --git a/freebsd/lib/libc/resolv/res_send.c b/freebsd/lib/libc/resolv/res_send.c index 064c8c48..06d11327 100644 --- a/freebsd/lib/libc/resolv/res_send.c +++ b/freebsd/lib/libc/resolv/res_send.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-user-space.h> -/* +/*- + * SPDX-License-Identifier: BSD-3-Clause + * * Portions Copyright (C) 2004-2009 Internet Systems Consortium, Inc. ("ISC") * Portions Copyright (C) 1996-2003 Internet Software Consortium. * diff --git a/freebsd/lib/libc/resolv/res_state.c b/freebsd/lib/libc/resolv/res_state.c index 1cfe1700..f450e2ab 100644 --- a/freebsd/lib/libc/resolv/res_state.c +++ b/freebsd/lib/libc/resolv/res_state.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-user-space.h> /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2006 The FreeBSD Project. All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/freebsd/lib/libc/rpc/auth_des.c b/freebsd/lib/libc/rpc/auth_des.c index 02943484..89491421 100644 --- a/freebsd/lib/libc/rpc/auth_des.c +++ b/freebsd/lib/libc/rpc/auth_des.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-user-space.h> /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 2009, Sun Microsystems, Inc. * All rights reserved. * diff --git a/freebsd/lib/libc/rpc/auth_none.c b/freebsd/lib/libc/rpc/auth_none.c index 9f91292a..d66b36f7 100644 --- a/freebsd/lib/libc/rpc/auth_none.c +++ b/freebsd/lib/libc/rpc/auth_none.c @@ -3,6 +3,8 @@ /* $NetBSD: auth_none.c,v 1.13 2000/01/22 22:19:17 mycroft Exp $ */ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 2009, Sun Microsystems, Inc. * All rights reserved. * diff --git a/freebsd/lib/libc/rpc/auth_unix.c b/freebsd/lib/libc/rpc/auth_unix.c index 6936327a..ea8f44c9 100644 --- a/freebsd/lib/libc/rpc/auth_unix.c +++ b/freebsd/lib/libc/rpc/auth_unix.c @@ -3,6 +3,8 @@ /* $NetBSD: auth_unix.c,v 1.18 2000/07/06 03:03:30 christos Exp $ */ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 2009, Sun Microsystems, Inc. * All rights reserved. * diff --git a/freebsd/lib/libc/rpc/authdes_prot.c b/freebsd/lib/libc/rpc/authdes_prot.c index dd28c049..dc63fa38 100644 --- a/freebsd/lib/libc/rpc/authdes_prot.c +++ b/freebsd/lib/libc/rpc/authdes_prot.c @@ -7,6 +7,8 @@ static char sccsid[] = "@(#)authdes_prot.c 2.1 88/07/29 4.0 RPCSRC; from 1.6 88 __FBSDID("$FreeBSD$"); /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 2009, Sun Microsystems, Inc. * All rights reserved. * diff --git a/freebsd/lib/libc/rpc/authunix_prot.c b/freebsd/lib/libc/rpc/authunix_prot.c index 9eb5e8d3..32cef5fb 100644 --- a/freebsd/lib/libc/rpc/authunix_prot.c +++ b/freebsd/lib/libc/rpc/authunix_prot.c @@ -3,6 +3,8 @@ /* $NetBSD: authunix_prot.c,v 1.12 2000/01/22 22:19:17 mycroft Exp $ */ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 2009, Sun Microsystems, Inc. * All rights reserved. * diff --git a/freebsd/lib/libc/rpc/bindresvport.c b/freebsd/lib/libc/rpc/bindresvport.c index 77e03568..87bb83ca 100644 --- a/freebsd/lib/libc/rpc/bindresvport.c +++ b/freebsd/lib/libc/rpc/bindresvport.c @@ -3,6 +3,8 @@ /* $NetBSD: bindresvport.c,v 1.19 2000/07/06 03:03:59 christos Exp $ */ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 2009, Sun Microsystems, Inc. * All rights reserved. * diff --git a/freebsd/lib/libc/rpc/clnt_bcast.c b/freebsd/lib/libc/rpc/clnt_bcast.c index d17e9166..4f22d06b 100644 --- a/freebsd/lib/libc/rpc/clnt_bcast.c +++ b/freebsd/lib/libc/rpc/clnt_bcast.c @@ -3,6 +3,8 @@ /* $NetBSD: clnt_bcast.c,v 1.3 2000/07/06 03:05:20 christos Exp $ */ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 2009, Sun Microsystems, Inc. * All rights reserved. * diff --git a/freebsd/lib/libc/rpc/clnt_dg.c b/freebsd/lib/libc/rpc/clnt_dg.c index 0c6db42d..4ec2e8b0 100644 --- a/freebsd/lib/libc/rpc/clnt_dg.c +++ b/freebsd/lib/libc/rpc/clnt_dg.c @@ -3,6 +3,8 @@ /* $NetBSD: clnt_dg.c,v 1.4 2000/07/14 08:40:41 fvdl Exp $ */ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 2009, Sun Microsystems, Inc. * All rights reserved. * diff --git a/freebsd/lib/libc/rpc/clnt_generic.c b/freebsd/lib/libc/rpc/clnt_generic.c index 1f9960d2..5d1f7480 100644 --- a/freebsd/lib/libc/rpc/clnt_generic.c +++ b/freebsd/lib/libc/rpc/clnt_generic.c @@ -3,6 +3,8 @@ /* $NetBSD: clnt_generic.c,v 1.18 2000/07/06 03:10:34 christos Exp $ */ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 2010, Oracle America, Inc. * All rights reserved. * diff --git a/freebsd/lib/libc/rpc/clnt_perror.c b/freebsd/lib/libc/rpc/clnt_perror.c index 1dda69bc..59f43572 100644 --- a/freebsd/lib/libc/rpc/clnt_perror.c +++ b/freebsd/lib/libc/rpc/clnt_perror.c @@ -4,6 +4,8 @@ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 2009, Sun Microsystems, Inc. * All rights reserved. * diff --git a/freebsd/lib/libc/rpc/clnt_raw.c b/freebsd/lib/libc/rpc/clnt_raw.c index f2f18b33..45c87a10 100644 --- a/freebsd/lib/libc/rpc/clnt_raw.c +++ b/freebsd/lib/libc/rpc/clnt_raw.c @@ -3,6 +3,8 @@ /* $NetBSD: clnt_raw.c,v 1.20 2000/12/10 04:12:03 christos Exp $ */ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 2009, Sun Microsystems, Inc. * All rights reserved. * diff --git a/freebsd/lib/libc/rpc/clnt_simple.c b/freebsd/lib/libc/rpc/clnt_simple.c index 8ae6e266..bf3c4fbc 100644 --- a/freebsd/lib/libc/rpc/clnt_simple.c +++ b/freebsd/lib/libc/rpc/clnt_simple.c @@ -3,6 +3,8 @@ /* $NetBSD: clnt_simple.c,v 1.21 2000/07/06 03:10:34 christos Exp $ */ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 2009, Sun Microsystems, Inc. * All rights reserved. * diff --git a/freebsd/lib/libc/rpc/clnt_vc.c b/freebsd/lib/libc/rpc/clnt_vc.c index 8dc3de48..76ed41ff 100644 --- a/freebsd/lib/libc/rpc/clnt_vc.c +++ b/freebsd/lib/libc/rpc/clnt_vc.c @@ -3,6 +3,8 @@ /* $NetBSD: clnt_vc.c,v 1.4 2000/07/14 08:40:42 fvdl Exp $ */ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 2009, Sun Microsystems, Inc. * All rights reserved. * diff --git a/freebsd/lib/libc/rpc/crypt_client.c b/freebsd/lib/libc/rpc/crypt_client.c index 15e915ad..b842836f 100644 --- a/freebsd/lib/libc/rpc/crypt_client.c +++ b/freebsd/lib/libc/rpc/crypt_client.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-user-space.h> -/* +/*- + * SPDX-License-Identifier: BSD-4-Clause + * * Copyright (c) 1996 * Bill Paul <wpaul@ctr.columbia.edu>. All rights reserved. * diff --git a/freebsd/lib/libc/rpc/des_crypt.c b/freebsd/lib/libc/rpc/des_crypt.c index 31763422..877a24d6 100644 --- a/freebsd/lib/libc/rpc/des_crypt.c +++ b/freebsd/lib/libc/rpc/des_crypt.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-user-space.h> /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 2009, Sun Microsystems, Inc. * All rights reserved. * diff --git a/freebsd/lib/libc/rpc/des_soft.c b/freebsd/lib/libc/rpc/des_soft.c index 2b6b8606..e1125cf6 100644 --- a/freebsd/lib/libc/rpc/des_soft.c +++ b/freebsd/lib/libc/rpc/des_soft.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-user-space.h> /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 2009, Sun Microsystems, Inc. * All rights reserved. * diff --git a/freebsd/lib/libc/rpc/getnetconfig.c b/freebsd/lib/libc/rpc/getnetconfig.c index dd3fa87e..63e80e26 100644 --- a/freebsd/lib/libc/rpc/getnetconfig.c +++ b/freebsd/lib/libc/rpc/getnetconfig.c @@ -3,6 +3,8 @@ /* $NetBSD: getnetconfig.c,v 1.3 2000/07/06 03:10:34 christos Exp $ */ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 2009, Sun Microsystems, Inc. * All rights reserved. * diff --git a/freebsd/lib/libc/rpc/getnetpath.c b/freebsd/lib/libc/rpc/getnetpath.c index 12def71b..fc411e69 100644 --- a/freebsd/lib/libc/rpc/getnetpath.c +++ b/freebsd/lib/libc/rpc/getnetpath.c @@ -3,6 +3,8 @@ /* $NetBSD: getnetpath.c,v 1.3 2000/07/06 03:10:34 christos Exp $ */ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 2009, Sun Microsystems, Inc. * All rights reserved. * diff --git a/freebsd/lib/libc/rpc/getpublickey.c b/freebsd/lib/libc/rpc/getpublickey.c index 0fef3d38..614c3859 100644 --- a/freebsd/lib/libc/rpc/getpublickey.c +++ b/freebsd/lib/libc/rpc/getpublickey.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-user-space.h> /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 2009, Sun Microsystems, Inc. * All rights reserved. * diff --git a/freebsd/lib/libc/rpc/getrpcent.c b/freebsd/lib/libc/rpc/getrpcent.c index 97cccf8d..d287d0be 100644 --- a/freebsd/lib/libc/rpc/getrpcent.c +++ b/freebsd/lib/libc/rpc/getrpcent.c @@ -3,6 +3,8 @@ /* $NetBSD: getrpcent.c,v 1.17 2000/01/22 22:19:17 mycroft Exp $ */ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 2009, Sun Microsystems, Inc. * All rights reserved. * diff --git a/freebsd/lib/libc/rpc/getrpcport.c b/freebsd/lib/libc/rpc/getrpcport.c index 26e08b93..84fc4e81 100644 --- a/freebsd/lib/libc/rpc/getrpcport.c +++ b/freebsd/lib/libc/rpc/getrpcport.c @@ -3,6 +3,8 @@ /* $NetBSD: getrpcport.c,v 1.16 2000/01/22 22:19:18 mycroft Exp $ */ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 2009, Sun Microsystems, Inc. * All rights reserved. * diff --git a/freebsd/lib/libc/rpc/key_call.c b/freebsd/lib/libc/rpc/key_call.c index c28aa507..ba3b884d 100644 --- a/freebsd/lib/libc/rpc/key_call.c +++ b/freebsd/lib/libc/rpc/key_call.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-user-space.h> /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 2009, Sun Microsystems, Inc. * All rights reserved. * diff --git a/freebsd/lib/libc/rpc/key_prot_xdr.c b/freebsd/lib/libc/rpc/key_prot_xdr.c index ee045587..00009867 100644 --- a/freebsd/lib/libc/rpc/key_prot_xdr.c +++ b/freebsd/lib/libc/rpc/key_prot_xdr.c @@ -9,6 +9,8 @@ #include <rpc/key_prot.h> #include "un-namespace.h" /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 2009, Sun Microsystems, Inc. * All rights reserved. * diff --git a/freebsd/lib/libc/rpc/mt_misc.h b/freebsd/lib/libc/rpc/mt_misc.h index 9cc2349c..7f3ced02 100644 --- a/freebsd/lib/libc/rpc/mt_misc.h +++ b/freebsd/lib/libc/rpc/mt_misc.h @@ -1,4 +1,6 @@ -/* +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (C) 2006 The FreeBSD Project. All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/freebsd/lib/libc/rpc/netname.c b/freebsd/lib/libc/rpc/netname.c index 2590325a..3e0687e8 100644 --- a/freebsd/lib/libc/rpc/netname.c +++ b/freebsd/lib/libc/rpc/netname.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-user-space.h> /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 2009, Sun Microsystems, Inc. * All rights reserved. * diff --git a/freebsd/lib/libc/rpc/netnamer.c b/freebsd/lib/libc/rpc/netnamer.c index 910323ed..e4e472a5 100644 --- a/freebsd/lib/libc/rpc/netnamer.c +++ b/freebsd/lib/libc/rpc/netnamer.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-user-space.h> /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 2009, Sun Microsystems, Inc. * All rights reserved. * diff --git a/freebsd/lib/libc/rpc/pmap_clnt.c b/freebsd/lib/libc/rpc/pmap_clnt.c index c3eadbc2..203eabbd 100644 --- a/freebsd/lib/libc/rpc/pmap_clnt.c +++ b/freebsd/lib/libc/rpc/pmap_clnt.c @@ -3,6 +3,8 @@ /* $NetBSD: pmap_clnt.c,v 1.16 2000/07/06 03:10:34 christos Exp $ */ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 2009, Sun Microsystems, Inc. * All rights reserved. * diff --git a/freebsd/lib/libc/rpc/pmap_getmaps.c b/freebsd/lib/libc/rpc/pmap_getmaps.c index fd6c4a85..1c93a9db 100644 --- a/freebsd/lib/libc/rpc/pmap_getmaps.c +++ b/freebsd/lib/libc/rpc/pmap_getmaps.c @@ -3,6 +3,8 @@ /* $NetBSD: pmap_getmaps.c,v 1.16 2000/07/06 03:10:34 christos Exp $ */ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 2009, Sun Microsystems, Inc. * All rights reserved. * diff --git a/freebsd/lib/libc/rpc/pmap_getport.c b/freebsd/lib/libc/rpc/pmap_getport.c index 0ddfb68c..c81cea20 100644 --- a/freebsd/lib/libc/rpc/pmap_getport.c +++ b/freebsd/lib/libc/rpc/pmap_getport.c @@ -3,6 +3,8 @@ /* $NetBSD: pmap_getport.c,v 1.16 2000/07/06 03:10:34 christos Exp $ */ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 2009, Sun Microsystems, Inc. * All rights reserved. * diff --git a/freebsd/lib/libc/rpc/pmap_prot.c b/freebsd/lib/libc/rpc/pmap_prot.c index 03c303eb..c55e86a6 100644 --- a/freebsd/lib/libc/rpc/pmap_prot.c +++ b/freebsd/lib/libc/rpc/pmap_prot.c @@ -3,6 +3,8 @@ /* $NetBSD: pmap_prot.c,v 1.10 2000/01/22 22:19:18 mycroft Exp $ */ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 2009, Sun Microsystems, Inc. * All rights reserved. * diff --git a/freebsd/lib/libc/rpc/pmap_prot2.c b/freebsd/lib/libc/rpc/pmap_prot2.c index 0b5134a3..64b53b4e 100644 --- a/freebsd/lib/libc/rpc/pmap_prot2.c +++ b/freebsd/lib/libc/rpc/pmap_prot2.c @@ -3,6 +3,8 @@ /* $NetBSD: pmap_prot2.c,v 1.14 2000/07/06 03:10:34 christos Exp $ */ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 2009, Sun Microsystems, Inc. * All rights reserved. * diff --git a/freebsd/lib/libc/rpc/pmap_rmt.c b/freebsd/lib/libc/rpc/pmap_rmt.c index 17f9d5b4..f4d37673 100644 --- a/freebsd/lib/libc/rpc/pmap_rmt.c +++ b/freebsd/lib/libc/rpc/pmap_rmt.c @@ -3,6 +3,8 @@ /* $NetBSD: pmap_rmt.c,v 1.29 2000/07/06 03:10:34 christos Exp $ */ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 2009, Sun Microsystems, Inc. * All rights reserved. * diff --git a/freebsd/lib/libc/rpc/rpc_callmsg.c b/freebsd/lib/libc/rpc/rpc_callmsg.c index f635205c..6034382f 100644 --- a/freebsd/lib/libc/rpc/rpc_callmsg.c +++ b/freebsd/lib/libc/rpc/rpc_callmsg.c @@ -3,6 +3,8 @@ /* $NetBSD: rpc_callmsg.c,v 1.16 2000/07/14 08:40:42 fvdl Exp $ */ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 2009, Sun Microsystems, Inc. * All rights reserved. * diff --git a/freebsd/lib/libc/rpc/rpc_com.h b/freebsd/lib/libc/rpc/rpc_com.h index bfa6a0bc..c0c144fc 100644 --- a/freebsd/lib/libc/rpc/rpc_com.h +++ b/freebsd/lib/libc/rpc/rpc_com.h @@ -1,6 +1,8 @@ /* $NetBSD: rpc_com.h,v 1.3 2000/12/10 04:10:08 christos Exp $ */ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 2009, Sun Microsystems, Inc. * All rights reserved. * diff --git a/freebsd/lib/libc/rpc/rpc_commondata.c b/freebsd/lib/libc/rpc/rpc_commondata.c index 1afaee29..989cb709 100644 --- a/freebsd/lib/libc/rpc/rpc_commondata.c +++ b/freebsd/lib/libc/rpc/rpc_commondata.c @@ -3,6 +3,8 @@ /* $NetBSD: rpc_commondata.c,v 1.7 2000/06/02 23:11:13 fvdl Exp $ */ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 2009, Sun Microsystems, Inc. * All rights reserved. * diff --git a/freebsd/lib/libc/rpc/rpc_dtablesize.c b/freebsd/lib/libc/rpc/rpc_dtablesize.c index 69bea25e..c63c632c 100644 --- a/freebsd/lib/libc/rpc/rpc_dtablesize.c +++ b/freebsd/lib/libc/rpc/rpc_dtablesize.c @@ -3,6 +3,8 @@ /* $NetBSD: rpc_dtablesize.c,v 1.14 1998/11/15 17:32:43 christos Exp $ */ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 2009, Sun Microsystems, Inc. * All rights reserved. * diff --git a/freebsd/lib/libc/rpc/rpc_generic.c b/freebsd/lib/libc/rpc/rpc_generic.c index 5bd983c4..9a72dacc 100644 --- a/freebsd/lib/libc/rpc/rpc_generic.c +++ b/freebsd/lib/libc/rpc/rpc_generic.c @@ -3,6 +3,8 @@ /* $NetBSD: rpc_generic.c,v 1.4 2000/09/28 09:07:04 kleink Exp $ */ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 2009, Sun Microsystems, Inc. * All rights reserved. * diff --git a/freebsd/lib/libc/rpc/rpc_prot.c b/freebsd/lib/libc/rpc/rpc_prot.c index e182c7e9..cad6ed60 100644 --- a/freebsd/lib/libc/rpc/rpc_prot.c +++ b/freebsd/lib/libc/rpc/rpc_prot.c @@ -3,6 +3,8 @@ /* $NetBSD: rpc_prot.c,v 1.16 2000/06/02 23:11:13 fvdl Exp $ */ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 2009, Sun Microsystems, Inc. * All rights reserved. * diff --git a/freebsd/lib/libc/rpc/rpc_soc.c b/freebsd/lib/libc/rpc/rpc_soc.c index d5b5be3a..0fb2f933 100644 --- a/freebsd/lib/libc/rpc/rpc_soc.c +++ b/freebsd/lib/libc/rpc/rpc_soc.c @@ -3,6 +3,8 @@ /* $NetBSD: rpc_soc.c,v 1.6 2000/07/06 03:10:35 christos Exp $ */ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 2009, Sun Microsystems, Inc. * All rights reserved. * diff --git a/freebsd/lib/libc/rpc/rpcb_clnt.c b/freebsd/lib/libc/rpc/rpcb_clnt.c index 16cdf20d..88717a36 100644 --- a/freebsd/lib/libc/rpc/rpcb_clnt.c +++ b/freebsd/lib/libc/rpc/rpcb_clnt.c @@ -3,6 +3,8 @@ /* $NetBSD: rpcb_clnt.c,v 1.6 2000/07/16 06:41:43 itojun Exp $ */ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 2010, Oracle America, Inc. * All rights reserved. * diff --git a/freebsd/lib/libc/rpc/rpcb_prot.c b/freebsd/lib/libc/rpc/rpcb_prot.c index ede13565..5e9d078a 100644 --- a/freebsd/lib/libc/rpc/rpcb_prot.c +++ b/freebsd/lib/libc/rpc/rpcb_prot.c @@ -3,6 +3,8 @@ /* $NetBSD: rpcb_prot.c,v 1.3 2000/07/14 08:40:42 fvdl Exp $ */ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 2009, Sun Microsystems, Inc. * All rights reserved. * diff --git a/freebsd/lib/libc/rpc/rpcb_st_xdr.c b/freebsd/lib/libc/rpc/rpcb_st_xdr.c index dc5be588..a9d26e4f 100644 --- a/freebsd/lib/libc/rpc/rpcb_st_xdr.c +++ b/freebsd/lib/libc/rpc/rpcb_st_xdr.c @@ -3,6 +3,8 @@ /* $NetBSD: rpcb_st_xdr.c,v 1.3 2000/07/14 08:40:42 fvdl Exp $ */ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 2009, Sun Microsystems, Inc. * All rights reserved. * diff --git a/freebsd/lib/libc/rpc/rpcdname.c b/freebsd/lib/libc/rpc/rpcdname.c index 63ea11e1..59df3d49 100644 --- a/freebsd/lib/libc/rpc/rpcdname.c +++ b/freebsd/lib/libc/rpc/rpcdname.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-user-space.h> /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 2009, Sun Microsystems, Inc. * All rights reserved. * diff --git a/freebsd/lib/libc/rpc/rpcsec_gss_stub.c b/freebsd/lib/libc/rpc/rpcsec_gss_stub.c index 2c82dba7..61ac0d0b 100644 --- a/freebsd/lib/libc/rpc/rpcsec_gss_stub.c +++ b/freebsd/lib/libc/rpc/rpcsec_gss_stub.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-user-space.h> /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2006 Doug Rabson * All rights reserved. * diff --git a/freebsd/lib/libc/rpc/rtime.c b/freebsd/lib/libc/rpc/rtime.c index a6223863..2369dd25 100644 --- a/freebsd/lib/libc/rpc/rtime.c +++ b/freebsd/lib/libc/rpc/rtime.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-user-space.h> /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 2009, Sun Microsystems, Inc. * All rights reserved. * diff --git a/freebsd/lib/libc/rpc/svc.c b/freebsd/lib/libc/rpc/svc.c index c9205f8c..0c63fb26 100644 --- a/freebsd/lib/libc/rpc/svc.c +++ b/freebsd/lib/libc/rpc/svc.c @@ -3,6 +3,8 @@ /* $NetBSD: svc.c,v 1.21 2000/07/06 03:10:35 christos Exp $ */ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 2009, Sun Microsystems, Inc. * All rights reserved. * diff --git a/freebsd/lib/libc/rpc/svc_auth.c b/freebsd/lib/libc/rpc/svc_auth.c index ea56b340..b4bf8128 100644 --- a/freebsd/lib/libc/rpc/svc_auth.c +++ b/freebsd/lib/libc/rpc/svc_auth.c @@ -3,6 +3,8 @@ /* $NetBSD: svc_auth.c,v 1.12 2000/07/06 03:10:35 christos Exp $ */ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 2009, Sun Microsystems, Inc. * All rights reserved. * diff --git a/freebsd/lib/libc/rpc/svc_auth_des.c b/freebsd/lib/libc/rpc/svc_auth_des.c index c1665ba6..192b55ae 100644 --- a/freebsd/lib/libc/rpc/svc_auth_des.c +++ b/freebsd/lib/libc/rpc/svc_auth_des.c @@ -6,6 +6,8 @@ */ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 2009, Sun Microsystems, Inc. * All rights reserved. * diff --git a/freebsd/lib/libc/rpc/svc_auth_unix.c b/freebsd/lib/libc/rpc/svc_auth_unix.c index 53459786..69364523 100644 --- a/freebsd/lib/libc/rpc/svc_auth_unix.c +++ b/freebsd/lib/libc/rpc/svc_auth_unix.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-user-space.h> /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 2009, Sun Microsystems, Inc. * All rights reserved. * diff --git a/freebsd/lib/libc/rpc/svc_dg.c b/freebsd/lib/libc/rpc/svc_dg.c index 377ce5f2..f2a42346 100644 --- a/freebsd/lib/libc/rpc/svc_dg.c +++ b/freebsd/lib/libc/rpc/svc_dg.c @@ -3,6 +3,8 @@ /* $NetBSD: svc_dg.c,v 1.4 2000/07/06 03:10:35 christos Exp $ */ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 2009, Sun Microsystems, Inc. * All rights reserved. * diff --git a/freebsd/lib/libc/rpc/svc_generic.c b/freebsd/lib/libc/rpc/svc_generic.c index 0643ae22..9f1b3955 100644 --- a/freebsd/lib/libc/rpc/svc_generic.c +++ b/freebsd/lib/libc/rpc/svc_generic.c @@ -3,6 +3,8 @@ /* $NetBSD: svc_generic.c,v 1.3 2000/07/06 03:10:35 christos Exp $ */ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 2009, Sun Microsystems, Inc. * All rights reserved. * diff --git a/freebsd/lib/libc/rpc/svc_raw.c b/freebsd/lib/libc/rpc/svc_raw.c index 772e523f..5a4425ee 100644 --- a/freebsd/lib/libc/rpc/svc_raw.c +++ b/freebsd/lib/libc/rpc/svc_raw.c @@ -3,6 +3,8 @@ /* $NetBSD: svc_raw.c,v 1.14 2000/07/06 03:10:35 christos Exp $ */ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 2009, Sun Microsystems, Inc. * All rights reserved. * diff --git a/freebsd/lib/libc/rpc/svc_run.c b/freebsd/lib/libc/rpc/svc_run.c index 4e6ed628..1040fd4b 100644 --- a/freebsd/lib/libc/rpc/svc_run.c +++ b/freebsd/lib/libc/rpc/svc_run.c @@ -3,6 +3,8 @@ /* $NetBSD: svc_run.c,v 1.17 2000/07/06 03:10:35 christos Exp $ */ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 2009, Sun Microsystems, Inc. * All rights reserved. * diff --git a/freebsd/lib/libc/rpc/svc_simple.c b/freebsd/lib/libc/rpc/svc_simple.c index 28da2898..7061dad5 100644 --- a/freebsd/lib/libc/rpc/svc_simple.c +++ b/freebsd/lib/libc/rpc/svc_simple.c @@ -3,6 +3,8 @@ /* $NetBSD: svc_simple.c,v 1.20 2000/07/06 03:10:35 christos Exp $ */ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 2009, Sun Microsystems, Inc. * All rights reserved. * diff --git a/freebsd/lib/libc/rpc/svc_vc.c b/freebsd/lib/libc/rpc/svc_vc.c index d00a1fbf..56b805ae 100644 --- a/freebsd/lib/libc/rpc/svc_vc.c +++ b/freebsd/lib/libc/rpc/svc_vc.c @@ -3,6 +3,8 @@ /* $NetBSD: svc_vc.c,v 1.7 2000/08/03 00:01:53 fvdl Exp $ */ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 2009, Sun Microsystems, Inc. * All rights reserved. * diff --git a/freebsd/lib/libc/stdio/fgetln.c b/freebsd/lib/libc/stdio/fgetln.c index 7f5e18b3..d3bd40c8 100644 --- a/freebsd/lib/libc/stdio/fgetln.c +++ b/freebsd/lib/libc/stdio/fgetln.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-user-space.h> /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1990, 1993 * The Regents of the University of California. All rights reserved. * diff --git a/freebsd/lib/libc/stdio/local.h b/freebsd/lib/libc/stdio/local.h index 26a4afe9..bed0b232 100644 --- a/freebsd/lib/libc/stdio/local.h +++ b/freebsd/lib/libc/stdio/local.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1990, 1993 * The Regents of the University of California. All rights reserved. * diff --git a/freebsd/lib/libc/string/strsep.c b/freebsd/lib/libc/string/strsep.c index 221eda29..0045e3da 100644 --- a/freebsd/lib/libc/string/strsep.c +++ b/freebsd/lib/libc/string/strsep.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-user-space.h> /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1990, 1993 * The Regents of the University of California. All rights reserved. * diff --git a/freebsd/lib/libc/xdr/xdr.c b/freebsd/lib/libc/xdr/xdr.c index 877f2efa..1d5c2925 100644 --- a/freebsd/lib/libc/xdr/xdr.c +++ b/freebsd/lib/libc/xdr/xdr.c @@ -3,6 +3,8 @@ /* $NetBSD: xdr.c,v 1.22 2000/07/06 03:10:35 christos Exp $ */ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 2010, Oracle America, Inc. * * Redistribution and use in source and binary forms, with or without diff --git a/freebsd/lib/libc/xdr/xdr_array.c b/freebsd/lib/libc/xdr/xdr_array.c index 2b9fa580..a833e1f3 100644 --- a/freebsd/lib/libc/xdr/xdr_array.c +++ b/freebsd/lib/libc/xdr/xdr_array.c @@ -3,6 +3,8 @@ /* $NetBSD: xdr_array.c,v 1.12 2000/01/22 22:19:18 mycroft Exp $ */ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 2010, Oracle America, Inc. * * Redistribution and use in source and binary forms, with or without diff --git a/freebsd/lib/libc/xdr/xdr_float.c b/freebsd/lib/libc/xdr/xdr_float.c index 29cfcac0..cb957c2e 100644 --- a/freebsd/lib/libc/xdr/xdr_float.c +++ b/freebsd/lib/libc/xdr/xdr_float.c @@ -3,6 +3,8 @@ /* $NetBSD: xdr_float.c,v 1.23 2000/07/17 04:59:51 matt Exp $ */ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 2010, Oracle America, Inc. * * Redistribution and use in source and binary forms, with or without diff --git a/freebsd/lib/libc/xdr/xdr_mem.c b/freebsd/lib/libc/xdr/xdr_mem.c index c7dafbae..01365afe 100644 --- a/freebsd/lib/libc/xdr/xdr_mem.c +++ b/freebsd/lib/libc/xdr/xdr_mem.c @@ -3,6 +3,8 @@ /* $NetBSD: xdr_mem.c,v 1.15 2000/01/22 22:19:18 mycroft Exp $ */ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 2010, Oracle America, Inc. * * Redistribution and use in source and binary forms, with or without diff --git a/freebsd/lib/libc/xdr/xdr_rec.c b/freebsd/lib/libc/xdr/xdr_rec.c index a7eb890e..f9b03028 100644 --- a/freebsd/lib/libc/xdr/xdr_rec.c +++ b/freebsd/lib/libc/xdr/xdr_rec.c @@ -3,6 +3,8 @@ /* $NetBSD: xdr_rec.c,v 1.18 2000/07/06 03:10:35 christos Exp $ */ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 2010, Oracle America, Inc. * * Redistribution and use in source and binary forms, with or without diff --git a/freebsd/lib/libc/xdr/xdr_reference.c b/freebsd/lib/libc/xdr/xdr_reference.c index 1c9dc5e5..d13ab062 100644 --- a/freebsd/lib/libc/xdr/xdr_reference.c +++ b/freebsd/lib/libc/xdr/xdr_reference.c @@ -3,6 +3,8 @@ /* $NetBSD: xdr_reference.c,v 1.13 2000/01/22 22:19:18 mycroft Exp $ */ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 2010, Oracle America, Inc. * * Redistribution and use in source and binary forms, with or without diff --git a/freebsd/lib/libc/xdr/xdr_sizeof.c b/freebsd/lib/libc/xdr/xdr_sizeof.c index 4e669cbe..667272ca 100644 --- a/freebsd/lib/libc/xdr/xdr_sizeof.c +++ b/freebsd/lib/libc/xdr/xdr_sizeof.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-user-space.h> /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 2010, Oracle America, Inc. * * Redistribution and use in source and binary forms, with or without diff --git a/freebsd/lib/libc/xdr/xdr_stdio.c b/freebsd/lib/libc/xdr/xdr_stdio.c index 3bbdb464..e73463c3 100644 --- a/freebsd/lib/libc/xdr/xdr_stdio.c +++ b/freebsd/lib/libc/xdr/xdr_stdio.c @@ -3,6 +3,8 @@ /* $NetBSD: xdr_stdio.c,v 1.14 2000/01/22 22:19:19 mycroft Exp $ */ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 2010, Oracle America, Inc. * * Redistribution and use in source and binary forms, with or without diff --git a/freebsd/lib/libcasper/libcasper/libcasper.h b/freebsd/lib/libcasper/libcasper/libcasper.h new file mode 100644 index 00000000..8ad15bc6 --- /dev/null +++ b/freebsd/lib/libcasper/libcasper/libcasper.h @@ -0,0 +1,244 @@ +/*- + * Copyright (c) 2012-2013 The FreeBSD Foundation + * Copyright (c) 2015-2017 Mariusz Zaborski <oshogbo@FreeBSD.org> + * All rights reserved. + * + * This software was developed by Pawel Jakub Dawidek 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 AUTHORS 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 AUTHORS 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$ + */ + +#ifndef _LIBCASPER_H_ +#define _LIBCASPER_H_ + +#ifdef HAVE_CASPER +#define WITH_CASPER +#endif + +#include <sys/types.h> +#include <sys/nv.h> + +#include <stdlib.h> +#include <unistd.h> + +#ifndef _NVLIST_T_DECLARED +#define _NVLIST_T_DECLARED +struct nvlist; + +typedef struct nvlist nvlist_t; +#endif + +#ifndef _CAP_CHANNEL_T_DECLARED +#define _CAP_CHANNEL_T_DECLARED +#ifdef WITH_CASPER +struct cap_channel; + +typedef struct cap_channel cap_channel_t; +#define CASPER_SUPPORT (1) +#else +struct cap_channel { + int cch_fd; +}; +typedef struct cap_channel cap_channel_t; +#define CASPER_SUPPORT (0) +#endif /* ! WITH_CASPER */ +#endif /* ! _CAP_CHANNEL_T_DECLARED */ + +/* + * The functions opens unrestricted communication channel to Casper. + */ +#ifdef WITH_CASPER +cap_channel_t *cap_init(void); +#else +static inline cap_channel_t * +cap_init(void) +{ + cap_channel_t *chan; + + chan = malloc(sizeof(*chan)); + if (chan != NULL) { + chan->cch_fd = -1; + } + return (chan); +} +#endif + +/* + * The functions to communicate with service. + */ +#ifdef WITH_CASPER +cap_channel_t *cap_service_open(const cap_channel_t *chan, const char *name); +int cap_service_limit(const cap_channel_t *chan, + const char * const *names, size_t nnames); +#else +#define cap_service_open(chan, name) (cap_init()) +#define cap_service_limit(chan, names, nnames) (0) +#endif + +/* + * The function creates cap_channel_t based on the given socket. + */ +#ifdef WITH_CASPER +cap_channel_t *cap_wrap(int sock); +#else +static inline cap_channel_t * +cap_wrap(int sock) +{ + cap_channel_t *chan; + + chan = cap_init(); + if (chan != NULL) { + chan->cch_fd = sock; + } + return (chan); +} +#endif + +/* + * The function returns communication socket and frees cap_channel_t. + */ +#ifdef WITH_CASPER +int cap_unwrap(cap_channel_t *chan); +#else +#define cap_unwrap(chan) (chan->cch_fd) +#endif + +/* + * The function clones the given capability. + */ +#ifdef WITH_CASPER +cap_channel_t *cap_clone(const cap_channel_t *chan); +#else +static inline cap_channel_t * +cap_clone(const cap_channel_t *chan) +{ + cap_channel_t *newchan; + + newchan = cap_init(); + if (newchan == NULL) { + return (NULL); + } + + if (chan->cch_fd == -1) { + newchan->cch_fd = -1; + } else { + newchan->cch_fd = dup(chan->cch_fd); + if (newchan->cch_fd < 0) { + free(newchan); + newchan = NULL; + } + } + + return (newchan); +} +#endif + +/* + * The function closes the given capability. + */ +#ifdef WITH_CASPER +void cap_close(cap_channel_t *chan); +#else +static inline void +cap_close(cap_channel_t *chan) +{ + + if (chan->cch_fd >= 0) { + close(chan->cch_fd); + } + free(chan); +} +#endif + +/* + * The function returns socket descriptor associated with the given + * cap_channel_t for use with select(2)/kqueue(2)/etc. + */ +#ifdef WITH_CASPER +int cap_sock(const cap_channel_t *chan); +#else +#define cap_sock(chan) (chan->cch_fd) +#endif + +/* + * The function limits the given capability. + * It always destroys 'limits' on return. + */ +#ifdef WITH_CASPER +int cap_limit_set(const cap_channel_t *chan, nvlist_t *limits); +#else +#define cap_limit_set(chan, limits) (0) +#endif + +/* + * The function returns current limits of the given capability. + */ +#ifdef WITH_CASPER +int cap_limit_get(const cap_channel_t *chan, nvlist_t **limitsp); +#else +static inline int +cap_limit_get(const cap_channel_t *chan __unused, nvlist_t **limitsp) +{ + + *limitsp = nvlist_create(0); + return (0); +} +#endif + +/* + * Function sends nvlist over the given capability. + */ +#ifdef WITH_CASPER +int cap_send_nvlist(const cap_channel_t *chan, const nvlist_t *nvl); +#else +#define cap_send_nvlist(chan, nvl) (0) +#endif + +/* + * Function receives nvlist over the given capability. + */ +#ifdef WITH_CASPER +nvlist_t *cap_recv_nvlist(const cap_channel_t *chan, int flags); +#else +#define cap_recv_nvlist(chan, flags) (0) +#endif + +/* + * Function sends the given nvlist, destroys it and receives new nvlist in + * response over the given capability. + */ +#ifdef WITH_CASPER +nvlist_t *cap_xfer_nvlist(const cap_channel_t *chan, nvlist_t *nvl, int flags); +#else +static inline nvlist_t * +cap_xfer_nvlist(const cap_channel_t *chan __unused, nvlist_t *nvl, int flags) +{ + + nvlist_destroy(nvl); + return (nvlist_create(flags)); +} +#endif + +#endif /* !_LIBCASPER_H_ */ diff --git a/freebsd/lib/libcasper/services/cap_dns/cap_dns.h b/freebsd/lib/libcasper/services/cap_dns/cap_dns.h new file mode 100644 index 00000000..d9d12bfd --- /dev/null +++ b/freebsd/lib/libcasper/services/cap_dns/cap_dns.h @@ -0,0 +1,75 @@ +/*- + * Copyright (c) 2012 The FreeBSD Foundation + * All rights reserved. + * + * This software was developed by Pawel Jakub Dawidek 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 AUTHORS 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 AUTHORS 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$ + */ + +#ifndef _CAP_DNS_H_ +#define _CAP_DNS_H_ + +#ifdef HAVE_CASPER +#define WITH_CASPER +#endif + +#include <sys/socket.h> /* socklen_t */ + +struct addrinfo; +struct hostent; + +#ifdef WITH_CASPER +struct hostent *cap_gethostbyname(cap_channel_t *chan, const char *name); +struct hostent *cap_gethostbyname2(cap_channel_t *chan, const char *name, + int type); +struct hostent *cap_gethostbyaddr(cap_channel_t *chan, const void *addr, + socklen_t len, int type); + +int cap_getaddrinfo(cap_channel_t *chan, const char *hostname, + const char *servname, const struct addrinfo *hints, struct addrinfo **res); +int cap_getnameinfo(cap_channel_t *chan, const struct sockaddr *sa, + socklen_t salen, char *host, size_t hostlen, char *serv, size_t servlen, + int flags); + +int cap_dns_type_limit(cap_channel_t *chan, const char * const *types, + size_t ntypes); +int cap_dns_family_limit(cap_channel_t *chan, const int *families, + size_t nfamilies); +#else +#define cap_gethostbyname(chan, name) gethostbyname(name) +#define cap_gethostbyname2(chan, name, type) gethostbyname2(name, type) +#define cap_gethostbyaddr(chan, addr, len, type) gethostbyaddr(addr, len, type) + +#define cap_getaddrinfo(chan, hostname, servname, hints, res) \ + getaddrinfo(hostname, servname, hints, res) +#define cap_getnameinfo(chan, sa, salen, host, hostlen, serv, servlen, flags) \ + getnameinfo(sa, salen, host, hostlen, serv, servlen, flags) + +#define cap_dns_type_limit(chan, types, ntypes) (0) +#define cap_dns_family_limit(chan, families, nfamilies) (0) +#endif + +#endif /* !_CAP_DNS_H_ */ diff --git a/freebsd/lib/libcasper/services/cap_syslog/cap_syslog.h b/freebsd/lib/libcasper/services/cap_syslog/cap_syslog.h new file mode 100644 index 00000000..55ca4b35 --- /dev/null +++ b/freebsd/lib/libcasper/services/cap_syslog/cap_syslog.h @@ -0,0 +1,54 @@ +/*- + * Copyright (c) 2017 Mariusz Zaborski <oshogbo@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 AUTHORS 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 AUTHORS 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$ + */ + +#ifndef _CAP_SYSLOG_H_ +#define _CAP_SYSLOG_H_ + +#ifdef WITH_CASPER +void cap_syslog(cap_channel_t *chan, int pri, + const char *fmt, ...) __printflike(3, 4); +void cap_vsyslog(cap_channel_t *chan, int priority, const char *fmt, + va_list ap) __printflike(3, 0); + +void cap_openlog(cap_channel_t *chan, const char *ident, int logopt, + int facility); +void cap_closelog(cap_channel_t *chan); + +int cap_setlogmask(cap_channel_t *chan, int maskpri); +#else +#define cap_syslog(chan, pri, ...) syslog(pri, __VA_ARGS__) +#define cap_vsyslog(chan, pri, fmt, ap) vsyslog(pri, fmt, ap) + +#define cap_openlog(chan, ident, logopt, facility) \ + openlog(ident, logopt, facility) +#define cap_closelog(chan) closelog() + +#define cap_setlogmask(chan, maskpri) setlogmask(maskpri) +#endif /* !WITH_CASPER */ + +#endif /* !_CAP_SYSLOG_H_ */ diff --git a/freebsd/lib/libkvm/kvm.h b/freebsd/lib/libkvm/kvm.h index 5b4f6e11..c5d46f9f 100644 --- a/freebsd/lib/libkvm/kvm.h +++ b/freebsd/lib/libkvm/kvm.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1989, 1993 * The Regents of the University of California. All rights reserved. * @@ -37,6 +39,14 @@ #include <sys/types.h> #include <nlist.h> +/* + * Including vm/vm.h causes namespace pollution issues. For the + * most part, only things using kvm_walk_pages() need to #include it. + */ +#ifndef VM_H +typedef u_char vm_prot_t; +#endif + /* Default version symbol. */ #define VRS_SYM "_version" #define VRS_KEY "VERSION" @@ -75,7 +85,19 @@ struct kvm_swap { u_int ksw_reserved2; }; +struct kvm_page { + unsigned int version; + u_long paddr; + u_long kmap_vaddr; + u_long dmap_vaddr; + vm_prot_t prot; + u_long offset; + size_t len; + /* end of version 1 */ +}; + #define SWIF_DEV_PREFIX 0x0002 +#define LIBKVM_WALK_PAGES_VERSION 1 __BEGIN_DECLS int kvm_close(kvm_t *); @@ -106,6 +128,9 @@ ssize_t kvm_read(kvm_t *, unsigned long, void *, size_t); ssize_t kvm_read_zpcpu(kvm_t *, unsigned long, void *, size_t, int); ssize_t kvm_read2(kvm_t *, kvaddr_t, void *, size_t); ssize_t kvm_write(kvm_t *, unsigned long, const void *, size_t); + +typedef int kvm_walk_pages_cb_t(struct kvm_page *, void *); +int kvm_walk_pages(kvm_t *, kvm_walk_pages_cb_t *, void *); __END_DECLS #endif /* !_KVM_H_ */ diff --git a/freebsd/lib/libmemstat/memstat.c b/freebsd/lib/libmemstat/memstat.c index 995984e5..60da9b00 100644 --- a/freebsd/lib/libmemstat/memstat.c +++ b/freebsd/lib/libmemstat/memstat.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-user-space.h> /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2005 Robert N. M. Watson * All rights reserved. * diff --git a/freebsd/lib/libmemstat/memstat.h b/freebsd/lib/libmemstat/memstat.h index 8394dc1c..98fc99f0 100644 --- a/freebsd/lib/libmemstat/memstat.h +++ b/freebsd/lib/libmemstat/memstat.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2005 Robert N. M. Watson * All rights reserved. * diff --git a/freebsd/lib/libmemstat/memstat_all.c b/freebsd/lib/libmemstat/memstat_all.c index 2e37b4e9..51cda024 100644 --- a/freebsd/lib/libmemstat/memstat_all.c +++ b/freebsd/lib/libmemstat/memstat_all.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-user-space.h> /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2005 Robert N. M. Watson * All rights reserved. * diff --git a/freebsd/lib/libmemstat/memstat_internal.h b/freebsd/lib/libmemstat/memstat_internal.h index 9fdc2281..12345d9f 100644 --- a/freebsd/lib/libmemstat/memstat_internal.h +++ b/freebsd/lib/libmemstat/memstat_internal.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2005 Robert N. M. Watson * All rights reserved. * diff --git a/freebsd/lib/libmemstat/memstat_malloc.c b/freebsd/lib/libmemstat/memstat_malloc.c index 6dc274e0..b252a2d4 100644 --- a/freebsd/lib/libmemstat/memstat_malloc.c +++ b/freebsd/lib/libmemstat/memstat_malloc.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-user-space.h> /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2005 Robert N. M. Watson * All rights reserved. * diff --git a/freebsd/lib/libmemstat/memstat_uma.c b/freebsd/lib/libmemstat/memstat_uma.c index 431aa046..533a5af7 100644 --- a/freebsd/lib/libmemstat/memstat_uma.c +++ b/freebsd/lib/libmemstat/memstat_uma.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-user-space.h> /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2005-2006 Robert N. M. Watson * All rights reserved. * diff --git a/freebsd/lib/libutil/expand_number.c b/freebsd/lib/libutil/expand_number.c index b004f5fc..86eef1b9 100644 --- a/freebsd/lib/libutil/expand_number.c +++ b/freebsd/lib/libutil/expand_number.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-user-space.h> /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2007 Eric Anderson <anderson@FreeBSD.org> * Copyright (c) 2007 Pawel Jakub Dawidek <pjd@FreeBSD.org> * All rights reserved. diff --git a/freebsd/lib/libutil/humanize_number.c b/freebsd/lib/libutil/humanize_number.c index 9464b052..40668aa9 100644 --- a/freebsd/lib/libutil/humanize_number.c +++ b/freebsd/lib/libutil/humanize_number.c @@ -2,7 +2,9 @@ /* $NetBSD: humanize_number.c,v 1.14 2008/04/28 20:22:59 martin Exp $ */ -/* +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 1997, 1998, 1999, 2002 The NetBSD Foundation, Inc. * Copyright 2013 John-Mark Gurney <jmg@FreeBSD.org> * All rights reserved. diff --git a/freebsd/lib/libutil/libutil.h b/freebsd/lib/libutil/libutil.h index fa924dbd..c79eaac5 100644 --- a/freebsd/lib/libutil/libutil.h +++ b/freebsd/lib/libutil/libutil.h @@ -1,4 +1,6 @@ -/* +/*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1996 Peter Wemm <peter@FreeBSD.org>. * All rights reserved. * Copyright (c) 2002 Networks Associates Technology, Inc. diff --git a/freebsd/lib/libutil/trimdomain.c b/freebsd/lib/libutil/trimdomain.c index 848dd760..8daeb1f2 100644 --- a/freebsd/lib/libutil/trimdomain.c +++ b/freebsd/lib/libutil/trimdomain.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-user-space.h> /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2001 Brian Somers <brian@Awfulhak.org> * Based on original work by Atsushi Murai <amurai@FreeBSD.org> * All rights reserved. diff --git a/freebsd/sbin/dhclient/alloc.c b/freebsd/sbin/dhclient/alloc.c index 977deff1..03caf934 100644 --- a/freebsd/sbin/dhclient/alloc.c +++ b/freebsd/sbin/dhclient/alloc.c @@ -4,7 +4,9 @@ /* Memory allocation... */ -/* +/*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1995, 1996, 1998 The Internet Software Consortium. * All rights reserved. * diff --git a/freebsd/sbin/dhclient/bpf.c b/freebsd/sbin/dhclient/bpf.c index 4d3d2276..978faa58 100644 --- a/freebsd/sbin/dhclient/bpf.c +++ b/freebsd/sbin/dhclient/bpf.c @@ -4,7 +4,9 @@ /* BPF socket interface code, originally contributed by Archie Cobbs. */ -/* +/*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1995, 1996, 1998, 1999 * The Internet Software Consortium. All rights reserved. * diff --git a/freebsd/sbin/dhclient/clparse.c b/freebsd/sbin/dhclient/clparse.c index 1bb0f957..f35c9402 100644 --- a/freebsd/sbin/dhclient/clparse.c +++ b/freebsd/sbin/dhclient/clparse.c @@ -4,7 +4,9 @@ /* Parser for dhclient config and lease files... */ -/* +/*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1997 The Internet Software Consortium. * All rights reserved. * diff --git a/freebsd/sbin/dhclient/conflex.c b/freebsd/sbin/dhclient/conflex.c index c4fd442c..fce0458c 100644 --- a/freebsd/sbin/dhclient/conflex.c +++ b/freebsd/sbin/dhclient/conflex.c @@ -4,7 +4,9 @@ /* Lexical scanner for dhcpd config file... */ -/* +/*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1995, 1996, 1997 The Internet Software Consortium. * All rights reserved. * diff --git a/freebsd/sbin/dhclient/convert.c b/freebsd/sbin/dhclient/convert.c index 27b24d3e..35058764 100644 --- a/freebsd/sbin/dhclient/convert.c +++ b/freebsd/sbin/dhclient/convert.c @@ -7,7 +7,9 @@ * which can't be assumed to be aligned. */ -/* +/*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1995, 1996 The Internet Software Consortium. * All rights reserved. * diff --git a/freebsd/sbin/dhclient/dhclient.c b/freebsd/sbin/dhclient/dhclient.c index b36fce4d..b0dabdb8 100644 --- a/freebsd/sbin/dhclient/dhclient.c +++ b/freebsd/sbin/dhclient/dhclient.c @@ -2,7 +2,9 @@ /* $OpenBSD: dhclient.c,v 1.63 2005/02/06 17:10:13 krw Exp $ */ -/* +/*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright 2004 Henning Brauer <henning@openbsd.org> * Copyright (c) 1995, 1996, 1997, 1998, 1999 * The Internet Software Consortium. All rights reserved. @@ -86,6 +88,8 @@ __FBSDID("$FreeBSD$"); #define CLIENT_PATH "PATH=/usr/bin:/usr/sbin:/bin:/sbin" +cap_channel_t *capsyslog; + time_t cur_time; time_t default_lease_time = 43200; /* 12 hours... */ @@ -347,6 +351,21 @@ die: exit(1); } +static void +init_casper(void) +{ + cap_channel_t *casper; + + casper = cap_init(); + if (casper == NULL) + error("unable to start casper"); + + capsyslog = cap_service_open(casper, "system.syslog"); + cap_close(casper); + if (capsyslog == NULL) + error("unable to open system.syslog service"); +} + int main(int argc, char *argv[]) { @@ -358,9 +377,11 @@ main(int argc, char *argv[]) pid_t otherpid; cap_rights_t rights; + init_casper(); + /* Initially, log errors to stderr as well as to syslogd. */ - openlog(__progname, LOG_PID | LOG_NDELAY, DHCPD_LOG_FACILITY); - setlogmask(LOG_UPTO(LOG_DEBUG)); + cap_openlog(capsyslog, __progname, LOG_PID | LOG_NDELAY, DHCPD_LOG_FACILITY); + cap_setlogmask(capsyslog, LOG_UPTO(LOG_DEBUG)); while ((ch = getopt(argc, argv, "bc:dl:p:qu")) != -1) switch (ch) { @@ -520,7 +541,7 @@ main(int argc, char *argv[]) setproctitle("%s", ifi->name); - if (cap_enter() < 0 && errno != ENOSYS) + if (CASPER_SUPPORT && cap_enter() < 0 && errno != ENOSYS) error("can't enter capability mode: %m"); if (immediate_daemon) @@ -2406,7 +2427,7 @@ go_daemon(void) /* Stop logging to stderr... */ log_perror = 0; - if (daemon(1, 0) == -1) + if (daemon(1, 1) == -1) error("daemon"); cap_rights_init(&rights); diff --git a/freebsd/sbin/dhclient/dhcp.h b/freebsd/sbin/dhclient/dhcp.h index 6e7d1a74..e4dcfb93 100644 --- a/freebsd/sbin/dhclient/dhcp.h +++ b/freebsd/sbin/dhclient/dhcp.h @@ -3,7 +3,9 @@ /* Protocol structures... */ -/* +/*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1995, 1996 The Internet Software Consortium. * All rights reserved. * diff --git a/freebsd/sbin/dhclient/dhcpd.h b/freebsd/sbin/dhclient/dhcpd.h index 9210cd42..3fd51ee3 100644 --- a/freebsd/sbin/dhclient/dhcpd.h +++ b/freebsd/sbin/dhclient/dhcpd.h @@ -1,6 +1,8 @@ /* $OpenBSD: dhcpd.h,v 1.33 2004/05/06 22:29:15 deraadt Exp $ */ -/* +/*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 2004 Henning Brauer <henning@openbsd.org> * Copyright (c) 1995, 1996, 1997, 1998, 1999 * The Internet Software Consortium. All rights reserved. @@ -73,6 +75,9 @@ #include <time.h> #include <unistd.h> +#include <libcasper.h> +#include <casper/cap_syslog.h> + #include "dhcp.h" #include "tree.h" @@ -352,6 +357,7 @@ int addr_eq(struct iaddr, struct iaddr); char *piaddr(struct iaddr); /* dhclient.c */ +extern cap_channel_t *capsyslog; extern char *path_dhclient_conf; extern char *path_dhclient_db; extern time_t cur_time; diff --git a/freebsd/sbin/dhclient/dhctoken.h b/freebsd/sbin/dhclient/dhctoken.h index 7b23242f..26c81aa7 100644 --- a/freebsd/sbin/dhclient/dhctoken.h +++ b/freebsd/sbin/dhclient/dhctoken.h @@ -2,7 +2,9 @@ /* Tokens for config file lexer and parser. */ -/* +/*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1995, 1996, 1997, 1998, 1999 * The Internet Software Consortium. All rights reserved. * @@ -38,6 +40,8 @@ * Enterprises. To learn more about the Internet Software Consortium, * see ``http://www.vix.com/isc''. To learn more about Vixie * Enterprises, see ``http://www.vix.com''. + * + * $FreeBSD$ */ #define SEMI ';' diff --git a/freebsd/sbin/dhclient/dispatch.c b/freebsd/sbin/dhclient/dispatch.c index c0eee929..958e38c7 100644 --- a/freebsd/sbin/dhclient/dispatch.c +++ b/freebsd/sbin/dhclient/dispatch.c @@ -2,7 +2,9 @@ /* $OpenBSD: dispatch.c,v 1.31 2004/09/21 04:07:03 david Exp $ */ -/* +/*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright 2004 Henning Brauer <henning@openbsd.org> * Copyright (c) 1995, 1996, 1997, 1998, 1999 * The Internet Software Consortium. All rights reserved. @@ -300,7 +302,8 @@ interface_status(struct interface_info *ifinfo) memset(&ifr, 0, sizeof(ifr)); strlcpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name)); if (ioctl(ifsock, SIOCGIFFLAGS, &ifr) < 0) { - syslog(LOG_ERR, "ioctl(SIOCGIFFLAGS) on %s: %m", ifname); + cap_syslog(capsyslog, LOG_ERR, "ioctl(SIOCGIFFLAGS) on %s: %m", + ifname); goto inactive; } @@ -318,9 +321,8 @@ interface_status(struct interface_info *ifinfo) strlcpy(ifmr.ifm_name, ifname, sizeof(ifmr.ifm_name)); if (ioctl(ifsock, SIOCGIFMEDIA, (caddr_t)&ifmr) < 0) { if (errno != EINVAL) { - syslog(LOG_DEBUG, "ioctl(SIOCGIFMEDIA) on %s: %m", - ifname); - + cap_syslog(capsyslog, LOG_DEBUG, + "ioctl(SIOCGIFMEDIA) on %s: %m", ifname); ifinfo->noifmedia = 1; goto active; } @@ -481,8 +483,8 @@ interface_link_status(char *ifname) if (ioctl(sock, SIOCGIFMEDIA, (caddr_t)&ifmr) == -1) { /* EINVAL -> link state unknown. treat as active */ if (errno != EINVAL) - syslog(LOG_DEBUG, "ioctl(SIOCGIFMEDIA) on %s: %m", - ifname); + cap_syslog(capsyslog, LOG_DEBUG, + "ioctl(SIOCGIFMEDIA) on %s: %m", ifname); close(sock); return (1); } diff --git a/freebsd/sbin/dhclient/errwarn.c b/freebsd/sbin/dhclient/errwarn.c index fe184997..e99f5f50 100644 --- a/freebsd/sbin/dhclient/errwarn.c +++ b/freebsd/sbin/dhclient/errwarn.c @@ -4,7 +4,9 @@ /* Errors and warnings... */ -/* +/*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1996 The Internet Software Consortium. * All Rights Reserved. * Copyright (c) 1995 RadioMail Corporation. All rights reserved. @@ -71,7 +73,7 @@ error(char *fmt, ...) va_end(list); #ifndef DEBUG - syslog(log_priority | LOG_ERR, "%s", mbuf); + cap_syslog(capsyslog, log_priority | LOG_ERR, "%s", mbuf); #endif /* Also log it to stderr? */ @@ -80,7 +82,7 @@ error(char *fmt, ...) write(2, "\n", 1); } - syslog(LOG_CRIT, "exiting."); + cap_syslog(capsyslog, LOG_CRIT, "exiting."); if (log_perror) { fprintf(stderr, "exiting.\n"); fflush(stderr); @@ -105,7 +107,7 @@ warning(char *fmt, ...) va_end(list); #ifndef DEBUG - syslog(log_priority | LOG_ERR, "%s", mbuf); + cap_syslog(capsyslog, log_priority | LOG_ERR, "%s", mbuf); #endif if (log_perror) { @@ -131,7 +133,7 @@ note(char *fmt, ...) va_end(list); #ifndef DEBUG - syslog(log_priority | LOG_INFO, "%s", mbuf); + cap_syslog(capsyslog, log_priority | LOG_INFO, "%s", mbuf); #endif if (log_perror) { @@ -157,7 +159,7 @@ debug(char *fmt, ...) va_end(list); #ifndef DEBUG - syslog(log_priority | LOG_DEBUG, "%s", mbuf); + cap_syslog(capsyslog, log_priority | LOG_DEBUG, "%s", mbuf); #endif if (log_perror) { @@ -219,10 +221,10 @@ parse_warn(char *fmt, ...) va_end(list); #ifndef DEBUG - syslog(log_priority | LOG_ERR, "%s", mbuf); - syslog(log_priority | LOG_ERR, "%s", token_line); + cap_syslog(capsyslog, log_priority | LOG_ERR, "%s", mbuf); + cap_syslog(capsyslog, log_priority | LOG_ERR, "%s", token_line); if (lexline < 81) - syslog(log_priority | LOG_ERR, + cap_syslog(capsyslog, log_priority | LOG_ERR, "%s^", &spaces[sizeof(spaces) - lexchar]); #endif diff --git a/freebsd/sbin/dhclient/hash.c b/freebsd/sbin/dhclient/hash.c index 9bac94cf..879edbfc 100644 --- a/freebsd/sbin/dhclient/hash.c +++ b/freebsd/sbin/dhclient/hash.c @@ -4,7 +4,9 @@ /* Routines for manipulating hash tables... */ -/* +/*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1995, 1996, 1997, 1998 The Internet Software Consortium. * All rights reserved. * diff --git a/freebsd/sbin/dhclient/inet.c b/freebsd/sbin/dhclient/inet.c index 1a5c0360..8ed88886 100644 --- a/freebsd/sbin/dhclient/inet.c +++ b/freebsd/sbin/dhclient/inet.c @@ -7,7 +7,9 @@ * way... */ -/* +/*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1996 The Internet Software Consortium. All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/freebsd/sbin/dhclient/options.c b/freebsd/sbin/dhclient/options.c index 8dac0039..c08c5c53 100644 --- a/freebsd/sbin/dhclient/options.c +++ b/freebsd/sbin/dhclient/options.c @@ -4,7 +4,9 @@ /* DHCP options parsing and reassembly. */ -/* +/*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1995, 1996, 1997, 1998 The Internet Software Consortium. * All rights reserved. * diff --git a/freebsd/sbin/dhclient/packet.c b/freebsd/sbin/dhclient/packet.c index 28a9ccec..40e969ae 100644 --- a/freebsd/sbin/dhclient/packet.c +++ b/freebsd/sbin/dhclient/packet.c @@ -4,7 +4,9 @@ /* Packet assembly code, originally contributed by Archie Cobbs. */ -/* +/*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1995, 1996, 1999 The Internet Software Consortium. * All rights reserved. * diff --git a/freebsd/sbin/dhclient/parse.c b/freebsd/sbin/dhclient/parse.c index 88853312..45234e58 100644 --- a/freebsd/sbin/dhclient/parse.c +++ b/freebsd/sbin/dhclient/parse.c @@ -4,7 +4,9 @@ /* Common parser code for dhcpd and dhclient. */ -/* +/*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1995, 1996, 1997, 1998 The Internet Software Consortium. * All rights reserved. * diff --git a/freebsd/sbin/dhclient/tables.c b/freebsd/sbin/dhclient/tables.c index 6339898c..d33ab6fa 100644 --- a/freebsd/sbin/dhclient/tables.c +++ b/freebsd/sbin/dhclient/tables.c @@ -4,7 +4,9 @@ /* Tables of information... */ -/* +/*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1995, 1996 The Internet Software Consortium. * All rights reserved. * diff --git a/freebsd/sbin/dhclient/tree.c b/freebsd/sbin/dhclient/tree.c index f540e717..bc94e2aa 100644 --- a/freebsd/sbin/dhclient/tree.c +++ b/freebsd/sbin/dhclient/tree.c @@ -4,7 +4,9 @@ /* Routines for manipulating parse trees... */ -/* +/*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1995, 1996, 1997 The Internet Software Consortium. * All rights reserved. * diff --git a/freebsd/sbin/dhclient/tree.h b/freebsd/sbin/dhclient/tree.h index 04e08e7c..9fdcc0d3 100644 --- a/freebsd/sbin/dhclient/tree.h +++ b/freebsd/sbin/dhclient/tree.h @@ -2,7 +2,9 @@ /* Definitions for address trees... */ -/* +/*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1995 The Internet Software Consortium. All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -37,6 +39,8 @@ * Enterprises. To learn more about the Internet Software Consortium, * see ``http://www.vix.com/isc''. To learn more about Vixie * Enterprises, see ``http://www.vix.com''. + * + * $FreeBSD$ */ /* A pair of pointers, suitable for making a linked list. */ diff --git a/freebsd/sbin/ifconfig/af_inet.c b/freebsd/sbin/ifconfig/af_inet.c index ad825c9d..960b800f 100644 --- a/freebsd/sbin/ifconfig/af_inet.c +++ b/freebsd/sbin/ifconfig/af_inet.c @@ -4,7 +4,9 @@ #include "rtems-bsd-ifconfig-namespace.h" #endif /* __rtems__ */ -/* +/*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1983, 1993 * The Regents of the University of California. All rights reserved. * diff --git a/freebsd/sbin/ifconfig/af_inet6.c b/freebsd/sbin/ifconfig/af_inet6.c index 173d804d..cae6c326 100644 --- a/freebsd/sbin/ifconfig/af_inet6.c +++ b/freebsd/sbin/ifconfig/af_inet6.c @@ -4,7 +4,9 @@ #include "rtems-bsd-ifconfig-namespace.h" #endif /* __rtems__ */ -/* +/*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1983, 1993 * The Regents of the University of California. All rights reserved. * diff --git a/freebsd/sbin/ifconfig/af_link.c b/freebsd/sbin/ifconfig/af_link.c index b9ff0a82..c08a19fc 100644 --- a/freebsd/sbin/ifconfig/af_link.c +++ b/freebsd/sbin/ifconfig/af_link.c @@ -4,7 +4,9 @@ #include "rtems-bsd-ifconfig-namespace.h" #endif /* __rtems__ */ -/* +/*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1983, 1993 * The Regents of the University of California. All rights reserved. * diff --git a/freebsd/sbin/ifconfig/af_nd6.c b/freebsd/sbin/ifconfig/af_nd6.c index a29457ae..1d9bdd73 100644 --- a/freebsd/sbin/ifconfig/af_nd6.c +++ b/freebsd/sbin/ifconfig/af_nd6.c @@ -4,7 +4,9 @@ #include "rtems-bsd-ifconfig-namespace.h" #endif /* __rtems__ */ -/* +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2009 Hiroki Sato. All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/freebsd/sbin/ifconfig/ifbridge.c b/freebsd/sbin/ifconfig/ifbridge.c index 7eeeb853..b24e9426 100644 --- a/freebsd/sbin/ifconfig/ifbridge.c +++ b/freebsd/sbin/ifconfig/ifbridge.c @@ -5,6 +5,8 @@ #endif /* __rtems__ */ /*- + * SPDX-License-Identifier: BSD-4-Clause + * * Copyright 2001 Wasabi Systems, Inc. * All rights reserved. * diff --git a/freebsd/sbin/ifconfig/ifclone.c b/freebsd/sbin/ifconfig/ifclone.c index 195d5899..749e12c0 100644 --- a/freebsd/sbin/ifconfig/ifclone.c +++ b/freebsd/sbin/ifconfig/ifclone.c @@ -4,7 +4,9 @@ #include "rtems-bsd-ifconfig-namespace.h" #endif /* __rtems__ */ -/* +/*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1983, 1993 * The Regents of the University of California. All rights reserved. * diff --git a/freebsd/sbin/ifconfig/ifconfig.c b/freebsd/sbin/ifconfig/ifconfig.c index 28da2bef..410c4849 100644 --- a/freebsd/sbin/ifconfig/ifconfig.c +++ b/freebsd/sbin/ifconfig/ifconfig.c @@ -4,7 +4,9 @@ #include "rtems-bsd-ifconfig-namespace.h" #endif /* __rtems__ */ -/* +/*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1983, 1993 * The Regents of the University of California. All rights reserved. * @@ -1224,7 +1226,7 @@ unsetifdescr(const char *val, int value, int s, const struct afswtch *afp) "\020\1RXCSUM\2TXCSUM\3NETCONS\4VLAN_MTU\5VLAN_HWTAGGING\6JUMBO_MTU\7POLLING" \ "\10VLAN_HWCSUM\11TSO4\12TSO6\13LRO\14WOL_UCAST\15WOL_MCAST\16WOL_MAGIC" \ "\17TOE4\20TOE6\21VLAN_HWFILTER\23VLAN_HWTSO\24LINKSTATE\25NETMAP" \ -"\26RXCSUM_IPV6\27TXCSUM_IPV6\31TXRTLMT" +"\26RXCSUM_IPV6\27TXCSUM_IPV6\31TXRTLMT\32HWRXTSTMP" /* * Print the status of the interface. If an address family was @@ -1543,6 +1545,8 @@ static struct cmd basic_cmds[] = { DEF_CMD("-wol_magic", -IFCAP_WOL_MAGIC, setifcap), DEF_CMD("txrtlmt", IFCAP_TXRTLMT, setifcap), DEF_CMD("-txrtlmt", -IFCAP_TXRTLMT, setifcap), + DEF_CMD("hwrxtsmp", IFCAP_HWRXTSTMP, setifcap), + DEF_CMD("-hwrxtsmp", -IFCAP_HWRXTSTMP, setifcap), DEF_CMD("normal", -IFF_LINK0, setifflags), DEF_CMD("compress", IFF_LINK0, setifflags), DEF_CMD("noicmp", IFF_LINK1, setifflags), diff --git a/freebsd/sbin/ifconfig/ifconfig.h b/freebsd/sbin/ifconfig/ifconfig.h index d9be9c7b..97fe20e1 100644 --- a/freebsd/sbin/ifconfig/ifconfig.h +++ b/freebsd/sbin/ifconfig/ifconfig.h @@ -1,4 +1,6 @@ -/* +/*- + * SPDX-License-Identifier: BSD-4-Clause + * * Copyright (c) 1997 Peter Wemm. * All rights reserved. * diff --git a/freebsd/sbin/ifconfig/ifgif.c b/freebsd/sbin/ifconfig/ifgif.c index 2d29a8f0..9afd641d 100644 --- a/freebsd/sbin/ifconfig/ifgif.c +++ b/freebsd/sbin/ifconfig/ifgif.c @@ -5,6 +5,8 @@ #endif /* __rtems__ */ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2009 Hiroki Sato. All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/freebsd/sbin/ifconfig/ifgre.c b/freebsd/sbin/ifconfig/ifgre.c index 1f954101..2adc6d76 100644 --- a/freebsd/sbin/ifconfig/ifgre.c +++ b/freebsd/sbin/ifconfig/ifgre.c @@ -5,6 +5,8 @@ #endif /* __rtems__ */ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2008 Andrew Thompson. All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/freebsd/sbin/ifconfig/ifgroup.c b/freebsd/sbin/ifconfig/ifgroup.c index d02903d2..ae8e2b8d 100644 --- a/freebsd/sbin/ifconfig/ifgroup.c +++ b/freebsd/sbin/ifconfig/ifgroup.c @@ -5,6 +5,8 @@ #endif /* __rtems__ */ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2006 Max Laier. All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/freebsd/sbin/ifconfig/ifieee80211.c b/freebsd/sbin/ifconfig/ifieee80211.c index 18484368..c3139e2c 100644 --- a/freebsd/sbin/ifconfig/ifieee80211.c +++ b/freebsd/sbin/ifconfig/ifieee80211.c @@ -4,7 +4,9 @@ #include "rtems-bsd-ifconfig-namespace.h" #endif /* __rtems__ */ -/* +/*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright 2001 The Aerospace Corporation. All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/freebsd/sbin/ifconfig/ifmac.c b/freebsd/sbin/ifconfig/ifmac.c index 65493600..8a2fe6d0 100644 --- a/freebsd/sbin/ifconfig/ifmac.c +++ b/freebsd/sbin/ifconfig/ifmac.c @@ -5,6 +5,8 @@ #endif /* __rtems__ */ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 2001 Networks Associates Technology, Inc. * All rights reserved. * diff --git a/freebsd/sbin/ifconfig/ifmedia.c b/freebsd/sbin/ifconfig/ifmedia.c index 1b7eef46..b986d548 100644 --- a/freebsd/sbin/ifconfig/ifmedia.c +++ b/freebsd/sbin/ifconfig/ifmedia.c @@ -7,7 +7,9 @@ /* $NetBSD: ifconfig.c,v 1.34 1997/04/21 01:17:58 lukem Exp $ */ /* $FreeBSD$ */ -/* +/*- + * SPDX-License-Identifier: BSD-4-Clause + * * Copyright (c) 1997 Jason R. Thorpe. * All rights reserved. * diff --git a/freebsd/sbin/ifconfig/ifpfsync.c b/freebsd/sbin/ifconfig/ifpfsync.c index e2332fbb..c2c91687 100644 --- a/freebsd/sbin/ifconfig/ifpfsync.c +++ b/freebsd/sbin/ifconfig/ifpfsync.c @@ -4,7 +4,9 @@ #include "rtems-bsd-ifconfig-namespace.h" #endif /* __rtems__ */ -/* +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2003 Ryan McBride. All rights reserved. * Copyright (c) 2004 Max Laier. All rights reserved. * diff --git a/freebsd/sbin/ifconfig/ifvlan.c b/freebsd/sbin/ifconfig/ifvlan.c index dd1d15fe..160fc717 100644 --- a/freebsd/sbin/ifconfig/ifvlan.c +++ b/freebsd/sbin/ifconfig/ifvlan.c @@ -4,7 +4,9 @@ #include "rtems-bsd-ifconfig-namespace.h" #endif /* __rtems__ */ -/* +/*- + * SPDX-License-Identifier: BSD-4-Clause + * * Copyright (c) 1999 Bill Paul <wpaul@ctr.columbia.edu> * Copyright (c) 2012 ADARA Networks, Inc. * All rights reserved. diff --git a/freebsd/sbin/pfctl/parse.c b/freebsd/sbin/pfctl/parse.c index 529d3746..76ca5c7e 100644 --- a/freebsd/sbin/pfctl/parse.c +++ b/freebsd/sbin/pfctl/parse.c @@ -97,7 +97,7 @@ #define YYPURE 0 -#line 30 "parse.y" +#line 32 "parse.y" #ifdef __rtems__ #include <machine/rtems-bsd-user-space.h> #undef INET6 @@ -2569,7 +2569,7 @@ typedef struct { } YYSTACKDATA; /* variables for the parser stack */ static YYSTACKDATA yystack; -#line 4551 "parse.y" +#line 4556 "parse.y" #ifdef __rtems__ RTEMS_LINKER_RWSET_CONTENT(bsd_prog_pfctl, static YYSTACKDATA yystack); #endif /* __rtems__ */ @@ -4565,11 +4565,11 @@ yyreduce: switch (yyn) { case 17: -#line 556 "parse.y" +#line 558 "parse.y" { file->errors++; } break; case 18: -#line 559 "parse.y" +#line 561 "parse.y" { struct file *nfile; @@ -4585,7 +4585,7 @@ case 18: } break; case 25: -#line 586 "parse.y" +#line 588 "parse.y" { if (!strcmp(yystack.l_mark[0].v.string, "none")) yyval.v.i = 0; @@ -4600,7 +4600,7 @@ case 25: } break; case 26: -#line 600 "parse.y" +#line 602 "parse.y" { if (check_rulestate(PFCTL_STATE_OPTION)) { free(yystack.l_mark[0].v.string); @@ -4615,7 +4615,7 @@ case 26: } break; case 27: -#line 612 "parse.y" +#line 614 "parse.y" { if (!(pf->opts & PF_OPT_OPTIMIZE)) { pf->opts |= PF_OPT_OPTIMIZE; @@ -4624,7 +4624,7 @@ case 27: } break; case 32: -#line 622 "parse.y" +#line 624 "parse.y" { if (check_rulestate(PFCTL_STATE_OPTION)) { free(yystack.l_mark[0].v.string); @@ -4639,7 +4639,7 @@ case 32: } break; case 33: -#line 634 "parse.y" +#line 636 "parse.y" { if (yystack.l_mark[0].v.number == 0 || yystack.l_mark[0].v.number > UINT_MAX) { yyerror("hostid must be non-zero"); @@ -4652,7 +4652,7 @@ case 33: } break; case 34: -#line 644 "parse.y" +#line 646 "parse.y" { if (pf->opts & PF_OPT_VERBOSE) printf("set block-policy drop\n"); @@ -4662,7 +4662,7 @@ case 34: } break; case 35: -#line 651 "parse.y" +#line 653 "parse.y" { if (pf->opts & PF_OPT_VERBOSE) printf("set block-policy return\n"); @@ -4672,7 +4672,7 @@ case 35: } break; case 36: -#line 658 "parse.y" +#line 660 "parse.y" { if (pf->opts & PF_OPT_VERBOSE) printf("set require-order %s\n", @@ -4681,7 +4681,7 @@ case 36: } break; case 37: -#line 664 "parse.y" +#line 666 "parse.y" { if (pf->opts & PF_OPT_VERBOSE) printf("set fingerprints \"%s\"\n", yystack.l_mark[0].v.string); @@ -4702,7 +4702,7 @@ case 37: } break; case 38: -#line 682 "parse.y" +#line 684 "parse.y" { if (pf->opts & PF_OPT_VERBOSE) switch (yystack.l_mark[0].v.i) { @@ -4717,7 +4717,7 @@ case 38: } break; case 39: -#line 694 "parse.y" +#line 696 "parse.y" { if (check_rulestate(PFCTL_STATE_OPTION)) { free(yystack.l_mark[0].v.string); @@ -4732,7 +4732,7 @@ case 39: } break; case 40: -#line 706 "parse.y" +#line 708 "parse.y" { if (expand_skip_interface(yystack.l_mark[0].v.interface) != 0) { yyerror("error setting skip interface(s)"); @@ -4741,7 +4741,7 @@ case 40: } break; case 41: -#line 712 "parse.y" +#line 714 "parse.y" { if (keep_state_defaults != NULL) { yyerror("cannot redefine state-defaults"); @@ -4751,11 +4751,11 @@ case 41: } break; case 42: -#line 721 "parse.y" +#line 723 "parse.y" { yyval.v.string = yystack.l_mark[0].v.string; } break; case 43: -#line 722 "parse.y" +#line 724 "parse.y" { if ((yyval.v.string = strdup("all")) == NULL) { err(1, "stringall: strdup"); @@ -4763,7 +4763,7 @@ case 43: } break; case 44: -#line 729 "parse.y" +#line 731 "parse.y" { if (asprintf(&yyval.v.string, "%s %s", yystack.l_mark[-1].v.string, yystack.l_mark[0].v.string) == -1) err(1, "string: asprintf"); @@ -4772,7 +4772,7 @@ case 44: } break; case 46: -#line 738 "parse.y" +#line 740 "parse.y" { if (asprintf(&yyval.v.string, "%s %s", yystack.l_mark[-1].v.string, yystack.l_mark[0].v.string) == -1) err(1, "string: asprintf"); @@ -4781,7 +4781,7 @@ case 46: } break; case 48: -#line 747 "parse.y" +#line 749 "parse.y" { char *s; if (asprintf(&s, "%lld", (long long)yystack.l_mark[0].v.number) == -1) { @@ -4792,7 +4792,7 @@ case 48: } break; case 50: -#line 758 "parse.y" +#line 760 "parse.y" { if (pf->opts & PF_OPT_VERBOSE) printf("%s = \"%s\"\n", yystack.l_mark[-2].v.string, yystack.l_mark[0].v.string); @@ -4803,15 +4803,15 @@ case 50: } break; case 51: -#line 768 "parse.y" +#line 770 "parse.y" { yyval.v.string = yystack.l_mark[0].v.string; } break; case 52: -#line 769 "parse.y" +#line 771 "parse.y" { yyval.v.string = NULL; } break; case 57: -#line 779 "parse.y" +#line 781 "parse.y" { char ta[PF_ANCHOR_NAME_SIZE]; struct pf_ruleset *rs; @@ -4831,7 +4831,7 @@ case 57: } break; case 58: -#line 796 "parse.y" +#line 798 "parse.y" { pf->alast = pf->anchor; pf->asd--; @@ -4839,7 +4839,7 @@ case 58: } break; case 60: -#line 806 "parse.y" +#line 808 "parse.y" { struct pf_rule r; struct node_proto *proto; @@ -4974,7 +4974,7 @@ case 60: } break; case 61: -#line 938 "parse.y" +#line 940 "parse.y" { struct pf_rule r; @@ -4998,7 +4998,7 @@ case 61: } break; case 62: -#line 959 "parse.y" +#line 961 "parse.y" { struct pf_rule r; @@ -5043,7 +5043,7 @@ case 62: } break; case 63: -#line 1001 "parse.y" +#line 1003 "parse.y" { struct pf_rule r; @@ -5081,7 +5081,7 @@ case 63: } break; case 64: -#line 1038 "parse.y" +#line 1040 "parse.y" { struct loadanchors *loadanchor; @@ -5114,7 +5114,7 @@ case 64: } break; case 65: -#line 1069 "parse.y" +#line 1071 "parse.y" { yyval.v.b.b2 = yyval.v.b.w = 0; if (yystack.l_mark[-1].v.i) @@ -5124,7 +5124,7 @@ case 65: } break; case 66: -#line 1079 "parse.y" +#line 1081 "parse.y" { struct pf_rule r; @@ -5182,18 +5182,18 @@ case 66: } break; case 67: -#line 1136 "parse.y" +#line 1138 "parse.y" { bzero(&scrub_opts, sizeof scrub_opts); scrub_opts.rtableid = -1; } break; case 68: -#line 1141 "parse.y" +#line 1143 "parse.y" { yyval.v.scrub_opts = scrub_opts; } break; case 69: -#line 1142 "parse.y" +#line 1144 "parse.y" { bzero(&scrub_opts, sizeof scrub_opts); scrub_opts.rtableid = -1; @@ -5201,7 +5201,7 @@ case 69: } break; case 72: -#line 1153 "parse.y" +#line 1155 "parse.y" { if (scrub_opts.nodf) { yyerror("no-df cannot be respecified"); @@ -5211,7 +5211,7 @@ case 72: } break; case 73: -#line 1160 "parse.y" +#line 1162 "parse.y" { if (scrub_opts.marker & SOM_MINTTL) { yyerror("min-ttl cannot be respecified"); @@ -5226,7 +5226,7 @@ case 73: } break; case 74: -#line 1172 "parse.y" +#line 1174 "parse.y" { if (scrub_opts.marker & SOM_MAXMSS) { yyerror("max-mss cannot be respecified"); @@ -5241,7 +5241,7 @@ case 74: } break; case 75: -#line 1184 "parse.y" +#line 1186 "parse.y" { if (scrub_opts.marker & SOM_SETTOS) { yyerror("set-tos cannot be respecified"); @@ -5252,7 +5252,7 @@ case 75: } break; case 76: -#line 1192 "parse.y" +#line 1194 "parse.y" { if (scrub_opts.marker & SOM_FRAGCACHE) { yyerror("fragcache cannot be respecified"); @@ -5263,7 +5263,7 @@ case 76: } break; case 77: -#line 1200 "parse.y" +#line 1202 "parse.y" { if (strcasecmp(yystack.l_mark[0].v.string, "tcp") != 0) { yyerror("scrub reassemble supports only tcp, " @@ -5280,7 +5280,7 @@ case 77: } break; case 78: -#line 1214 "parse.y" +#line 1216 "parse.y" { if (scrub_opts.randomid) { yyerror("random-id cannot be respecified"); @@ -5290,7 +5290,7 @@ case 78: } break; case 79: -#line 1221 "parse.y" +#line 1223 "parse.y" { if (yystack.l_mark[0].v.number < 0 || yystack.l_mark[0].v.number > rt_tableid_max()) { yyerror("invalid rtable id"); @@ -5300,26 +5300,26 @@ case 79: } break; case 80: -#line 1228 "parse.y" +#line 1230 "parse.y" { scrub_opts.match_tag = yystack.l_mark[0].v.string; scrub_opts.match_tag_not = yystack.l_mark[-2].v.number; } break; case 81: -#line 1234 "parse.y" +#line 1236 "parse.y" { yyval.v.i = 0; /* default */ } break; case 82: -#line 1235 "parse.y" +#line 1237 "parse.y" { yyval.v.i = 0; } break; case 83: -#line 1236 "parse.y" +#line 1238 "parse.y" { yyval.v.i = 0; } break; case 84: -#line 1239 "parse.y" +#line 1241 "parse.y" { struct pf_rule r; struct node_host *h = NULL, *hh; @@ -5407,19 +5407,19 @@ case 84: } break; case 85: -#line 1326 "parse.y" +#line 1328 "parse.y" { yyval.v.interface = yystack.l_mark[0].v.interface; } break; case 86: -#line 1327 "parse.y" +#line 1329 "parse.y" { yyval.v.interface = yystack.l_mark[-1].v.interface; } break; case 87: -#line 1330 "parse.y" +#line 1332 "parse.y" { yyval.v.interface = yystack.l_mark[-1].v.interface; } break; case 88: -#line 1331 "parse.y" +#line 1333 "parse.y" { yystack.l_mark[-3].v.interface->tail->next = yystack.l_mark[-1].v.interface; yystack.l_mark[-3].v.interface->tail = yystack.l_mark[-1].v.interface; @@ -5427,29 +5427,29 @@ case 88: } break; case 89: -#line 1338 "parse.y" +#line 1340 "parse.y" { yyval.v.interface = yystack.l_mark[0].v.interface; } break; case 90: -#line 1339 "parse.y" +#line 1341 "parse.y" { yystack.l_mark[-1].v.interface->dynamic = 1; yyval.v.interface = yystack.l_mark[-1].v.interface; } break; case 91: -#line 1345 "parse.y" +#line 1347 "parse.y" { bzero(&antispoof_opts, sizeof antispoof_opts); antispoof_opts.rtableid = -1; } break; case 92: -#line 1350 "parse.y" +#line 1352 "parse.y" { yyval.v.antispoof_opts = antispoof_opts; } break; case 93: -#line 1351 "parse.y" +#line 1353 "parse.y" { bzero(&antispoof_opts, sizeof antispoof_opts); antispoof_opts.rtableid = -1; @@ -5457,7 +5457,7 @@ case 93: } break; case 96: -#line 1362 "parse.y" +#line 1364 "parse.y" { if (antispoof_opts.label) { yyerror("label cannot be redefined"); @@ -5467,7 +5467,7 @@ case 96: } break; case 97: -#line 1369 "parse.y" +#line 1371 "parse.y" { if (yystack.l_mark[0].v.number < 0 || yystack.l_mark[0].v.number > rt_tableid_max()) { yyerror("invalid rtable id"); @@ -5477,15 +5477,15 @@ case 97: } break; case 98: -#line 1378 "parse.y" +#line 1380 "parse.y" { yyval.v.number = 1; } break; case 99: -#line 1379 "parse.y" +#line 1381 "parse.y" { yyval.v.number = 0; } break; case 100: -#line 1382 "parse.y" +#line 1384 "parse.y" { struct node_host *h, *nh; struct node_tinit *ti, *nti; @@ -5516,18 +5516,18 @@ case 100: } break; case 101: -#line 1412 "parse.y" +#line 1414 "parse.y" { bzero(&table_opts, sizeof table_opts); SIMPLEQ_INIT(&table_opts.init_nodes); } break; case 102: -#line 1417 "parse.y" +#line 1419 "parse.y" { yyval.v.table_opts = table_opts; } break; case 103: -#line 1419 "parse.y" +#line 1421 "parse.y" { bzero(&table_opts, sizeof table_opts); SIMPLEQ_INIT(&table_opts.init_nodes); @@ -5535,7 +5535,7 @@ case 103: } break; case 106: -#line 1430 "parse.y" +#line 1432 "parse.y" { if (!strcmp(yystack.l_mark[0].v.string, "const")) table_opts.flags |= PFR_TFLAG_CONST; @@ -5552,11 +5552,11 @@ case 106: } break; case 107: -#line 1444 "parse.y" +#line 1446 "parse.y" { table_opts.init_addr = 1; } break; case 108: -#line 1445 "parse.y" +#line 1447 "parse.y" { struct node_host *n; struct node_tinit *ti; @@ -5599,7 +5599,7 @@ case 108: } break; case 109: -#line 1485 "parse.y" +#line 1487 "parse.y" { struct node_tinit *ti; @@ -5612,7 +5612,7 @@ case 109: } break; case 110: -#line 1497 "parse.y" +#line 1499 "parse.y" { struct pf_altq a; @@ -5637,7 +5637,7 @@ case 110: } break; case 111: -#line 1521 "parse.y" +#line 1523 "parse.y" { struct pf_altq a; @@ -5675,7 +5675,7 @@ case 111: } break; case 112: -#line 1558 "parse.y" +#line 1560 "parse.y" { bzero(&queue_opts, sizeof queue_opts); queue_opts.priority = DEFAULT_PRIORITY; @@ -5685,11 +5685,11 @@ case 112: } break; case 113: -#line 1566 "parse.y" +#line 1568 "parse.y" { yyval.v.queue_opts = queue_opts; } break; case 114: -#line 1567 "parse.y" +#line 1569 "parse.y" { bzero(&queue_opts, sizeof queue_opts); queue_opts.priority = DEFAULT_PRIORITY; @@ -5700,7 +5700,7 @@ case 114: } break; case 117: -#line 1581 "parse.y" +#line 1583 "parse.y" { if (queue_opts.marker & QOM_BWSPEC) { yyerror("bandwidth cannot be respecified"); @@ -5711,7 +5711,7 @@ case 117: } break; case 118: -#line 1589 "parse.y" +#line 1591 "parse.y" { if (queue_opts.marker & QOM_PRIORITY) { yyerror("priority cannot be respecified"); @@ -5726,7 +5726,7 @@ case 118: } break; case 119: -#line 1601 "parse.y" +#line 1603 "parse.y" { if (queue_opts.marker & QOM_QLIMIT) { yyerror("qlimit cannot be respecified"); @@ -5741,7 +5741,7 @@ case 119: } break; case 120: -#line 1613 "parse.y" +#line 1615 "parse.y" { if (queue_opts.marker & QOM_SCHEDULER) { yyerror("scheduler cannot be respecified"); @@ -5752,7 +5752,7 @@ case 120: } break; case 121: -#line 1621 "parse.y" +#line 1623 "parse.y" { if (queue_opts.marker & QOM_TBRSIZE) { yyerror("tbrsize cannot be respecified"); @@ -5767,7 +5767,7 @@ case 121: } break; case 122: -#line 1635 "parse.y" +#line 1637 "parse.y" { double bps; char *cp; @@ -5813,7 +5813,7 @@ case 122: } break; case 123: -#line 1678 "parse.y" +#line 1680 "parse.y" { if (yystack.l_mark[0].v.number < 0 || yystack.l_mark[0].v.number > UINT_MAX) { yyerror("bandwidth number too big"); @@ -5824,35 +5824,35 @@ case 123: } break; case 124: -#line 1688 "parse.y" +#line 1690 "parse.y" { yyval.v.queue_options.qtype = ALTQT_CBQ; yyval.v.queue_options.data.cbq_opts.flags = 0; } break; case 125: -#line 1692 "parse.y" +#line 1694 "parse.y" { yyval.v.queue_options.qtype = ALTQT_CBQ; yyval.v.queue_options.data.cbq_opts.flags = yystack.l_mark[-1].v.number; } break; case 126: -#line 1696 "parse.y" +#line 1698 "parse.y" { yyval.v.queue_options.qtype = ALTQT_PRIQ; yyval.v.queue_options.data.priq_opts.flags = 0; } break; case 127: -#line 1700 "parse.y" +#line 1702 "parse.y" { yyval.v.queue_options.qtype = ALTQT_PRIQ; yyval.v.queue_options.data.priq_opts.flags = yystack.l_mark[-1].v.number; } break; case 128: -#line 1704 "parse.y" +#line 1706 "parse.y" { yyval.v.queue_options.qtype = ALTQT_HFSC; bzero(&yyval.v.queue_options.data.hfsc_opts, @@ -5860,14 +5860,14 @@ case 128: } break; case 129: -#line 1709 "parse.y" +#line 1711 "parse.y" { yyval.v.queue_options.qtype = ALTQT_HFSC; yyval.v.queue_options.data.hfsc_opts = yystack.l_mark[-1].v.hfsc_opts; } break; case 130: -#line 1713 "parse.y" +#line 1715 "parse.y" { yyval.v.queue_options.qtype = ALTQT_FAIRQ; bzero(&yyval.v.queue_options.data.fairq_opts, @@ -5875,14 +5875,14 @@ case 130: } break; case 131: -#line 1718 "parse.y" +#line 1720 "parse.y" { yyval.v.queue_options.qtype = ALTQT_FAIRQ; yyval.v.queue_options.data.fairq_opts = yystack.l_mark[-1].v.fairq_opts; } break; case 132: -#line 1722 "parse.y" +#line 1724 "parse.y" { yyval.v.queue_options.qtype = ALTQT_CODEL; bzero(&yyval.v.queue_options.data.codel_opts, @@ -5890,22 +5890,22 @@ case 132: } break; case 133: -#line 1727 "parse.y" +#line 1729 "parse.y" { yyval.v.queue_options.qtype = ALTQT_CODEL; yyval.v.queue_options.data.codel_opts = yystack.l_mark[-1].v.codel_opts; } break; case 134: -#line 1733 "parse.y" +#line 1735 "parse.y" { yyval.v.number |= yystack.l_mark[0].v.number; } break; case 135: -#line 1734 "parse.y" +#line 1736 "parse.y" { yyval.v.number |= yystack.l_mark[0].v.number; } break; case 136: -#line 1737 "parse.y" +#line 1739 "parse.y" { if (!strcmp(yystack.l_mark[0].v.string, "default")) yyval.v.number = CBQCLF_DEFCLASS; @@ -5928,15 +5928,15 @@ case 136: } break; case 137: -#line 1759 "parse.y" +#line 1761 "parse.y" { yyval.v.number |= yystack.l_mark[0].v.number; } break; case 138: -#line 1760 "parse.y" +#line 1762 "parse.y" { yyval.v.number |= yystack.l_mark[0].v.number; } break; case 139: -#line 1763 "parse.y" +#line 1765 "parse.y" { if (!strcmp(yystack.l_mark[0].v.string, "default")) yyval.v.number = PRCF_DEFAULTCLASS; @@ -5957,20 +5957,20 @@ case 139: } break; case 140: -#line 1783 "parse.y" +#line 1785 "parse.y" { bzero(&hfsc_opts, sizeof(struct node_hfsc_opts)); } break; case 141: -#line 1787 "parse.y" +#line 1789 "parse.y" { yyval.v.hfsc_opts = hfsc_opts; } break; case 144: -#line 1796 "parse.y" +#line 1798 "parse.y" { if (hfsc_opts.linkshare.used) { yyerror("linkshare already specified"); @@ -5981,7 +5981,7 @@ case 144: } break; case 145: -#line 1805 "parse.y" +#line 1807 "parse.y" { if (yystack.l_mark[-3].v.number < 0 || yystack.l_mark[-3].v.number > INT_MAX) { yyerror("timing in curve out of range"); @@ -5998,7 +5998,7 @@ case 145: } break; case 146: -#line 1819 "parse.y" +#line 1821 "parse.y" { if (hfsc_opts.realtime.used) { yyerror("realtime already specified"); @@ -6009,7 +6009,7 @@ case 146: } break; case 147: -#line 1828 "parse.y" +#line 1830 "parse.y" { if (yystack.l_mark[-3].v.number < 0 || yystack.l_mark[-3].v.number > INT_MAX) { yyerror("timing in curve out of range"); @@ -6026,7 +6026,7 @@ case 147: } break; case 148: -#line 1842 "parse.y" +#line 1844 "parse.y" { if (hfsc_opts.upperlimit.used) { yyerror("upperlimit already specified"); @@ -6037,7 +6037,7 @@ case 148: } break; case 149: -#line 1851 "parse.y" +#line 1853 "parse.y" { if (yystack.l_mark[-3].v.number < 0 || yystack.l_mark[-3].v.number > INT_MAX) { yyerror("timing in curve out of range"); @@ -6054,7 +6054,7 @@ case 149: } break; case 150: -#line 1865 "parse.y" +#line 1867 "parse.y" { if (!strcmp(yystack.l_mark[0].v.string, "default")) hfsc_opts.flags |= HFCF_DEFAULTCLASS; @@ -6075,20 +6075,20 @@ case 150: } break; case 151: -#line 1885 "parse.y" +#line 1887 "parse.y" { bzero(&fairq_opts, sizeof(struct node_fairq_opts)); } break; case 152: -#line 1889 "parse.y" +#line 1891 "parse.y" { yyval.v.fairq_opts = fairq_opts; } break; case 155: -#line 1898 "parse.y" +#line 1900 "parse.y" { if (fairq_opts.linkshare.used) { yyerror("linkshare already specified"); @@ -6099,7 +6099,7 @@ case 155: } break; case 156: -#line 1906 "parse.y" +#line 1908 "parse.y" { if (fairq_opts.linkshare.used) { yyerror("linkshare already specified"); @@ -6112,19 +6112,19 @@ case 156: } break; case 157: -#line 1916 "parse.y" +#line 1918 "parse.y" { fairq_opts.hogs_bw = yystack.l_mark[0].v.queue_bwspec; } break; case 158: -#line 1919 "parse.y" +#line 1921 "parse.y" { fairq_opts.nbuckets = yystack.l_mark[0].v.number; } break; case 159: -#line 1922 "parse.y" +#line 1924 "parse.y" { if (!strcmp(yystack.l_mark[0].v.string, "default")) fairq_opts.flags |= FARF_DEFAULTCLASS; @@ -6145,20 +6145,20 @@ case 159: } break; case 160: -#line 1942 "parse.y" +#line 1944 "parse.y" { bzero(&codel_opts, sizeof(struct codel_opts)); } break; case 161: -#line 1946 "parse.y" +#line 1948 "parse.y" { yyval.v.codel_opts = codel_opts; } break; case 164: -#line 1955 "parse.y" +#line 1957 "parse.y" { if (codel_opts.interval) { yyerror("interval already specified"); @@ -6168,7 +6168,7 @@ case 164: } break; case 165: -#line 1962 "parse.y" +#line 1964 "parse.y" { if (codel_opts.target) { yyerror("target already specified"); @@ -6178,7 +6178,7 @@ case 165: } break; case 166: -#line 1969 "parse.y" +#line 1971 "parse.y" { if (!strcmp(yystack.l_mark[0].v.string, "ecn")) codel_opts.ecn = 1; @@ -6191,23 +6191,23 @@ case 166: } break; case 167: -#line 1981 "parse.y" +#line 1983 "parse.y" { yyval.v.queue = NULL; } break; case 168: -#line 1982 "parse.y" +#line 1984 "parse.y" { yyval.v.queue = yystack.l_mark[0].v.queue; } break; case 169: -#line 1983 "parse.y" +#line 1985 "parse.y" { yyval.v.queue = yystack.l_mark[-1].v.queue; } break; case 170: -#line 1986 "parse.y" +#line 1988 "parse.y" { yyval.v.queue = yystack.l_mark[-1].v.queue; } break; case 171: -#line 1987 "parse.y" +#line 1989 "parse.y" { yystack.l_mark[-3].v.queue->tail->next = yystack.l_mark[-1].v.queue; yystack.l_mark[-3].v.queue->tail = yystack.l_mark[-1].v.queue; @@ -6215,7 +6215,7 @@ case 171: } break; case 172: -#line 1994 "parse.y" +#line 1996 "parse.y" { yyval.v.queue = calloc(1, sizeof(struct node_queue)); if (yyval.v.queue == NULL) @@ -6234,7 +6234,7 @@ case 172: } break; case 173: -#line 2014 "parse.y" +#line 2016 "parse.y" { struct pf_rule r; struct node_state_opt *o; @@ -6659,18 +6659,18 @@ case 173: } break; case 174: -#line 2438 "parse.y" +#line 2440 "parse.y" { bzero(&filter_opts, sizeof filter_opts); filter_opts.rtableid = -1; } break; case 175: -#line 2443 "parse.y" +#line 2445 "parse.y" { yyval.v.filter_opts = filter_opts; } break; case 176: -#line 2444 "parse.y" +#line 2446 "parse.y" { bzero(&filter_opts, sizeof filter_opts); filter_opts.rtableid = -1; @@ -6678,7 +6678,7 @@ case 176: } break; case 179: -#line 2455 "parse.y" +#line 2457 "parse.y" { if (filter_opts.uid) yystack.l_mark[0].v.uid->tail->next = filter_opts.uid; @@ -6686,7 +6686,7 @@ case 179: } break; case 180: -#line 2460 "parse.y" +#line 2462 "parse.y" { if (filter_opts.gid) yystack.l_mark[0].v.gid->tail->next = filter_opts.gid; @@ -6694,7 +6694,7 @@ case 180: } break; case 181: -#line 2465 "parse.y" +#line 2467 "parse.y" { if (filter_opts.marker & FOM_FLAGS) { yyerror("flags cannot be redefined"); @@ -6708,7 +6708,7 @@ case 181: } break; case 182: -#line 2476 "parse.y" +#line 2478 "parse.y" { if (filter_opts.marker & FOM_ICMP) { yyerror("icmp-type cannot be redefined"); @@ -6719,7 +6719,7 @@ case 182: } break; case 183: -#line 2484 "parse.y" +#line 2486 "parse.y" { if (filter_opts.marker & FOM_PRIO) { yyerror("prio cannot be redefined"); @@ -6734,7 +6734,7 @@ case 183: } break; case 184: -#line 2496 "parse.y" +#line 2498 "parse.y" { if (filter_opts.marker & FOM_TOS) { yyerror("tos cannot be redefined"); @@ -6745,7 +6745,7 @@ case 184: } break; case 185: -#line 2504 "parse.y" +#line 2506 "parse.y" { if (filter_opts.marker & FOM_KEEP) { yyerror("modulate or keep cannot be redefined"); @@ -6757,19 +6757,19 @@ case 185: } break; case 186: -#line 2513 "parse.y" +#line 2515 "parse.y" { filter_opts.fragment = 1; } break; case 187: -#line 2516 "parse.y" +#line 2518 "parse.y" { filter_opts.allowopts = 1; } break; case 188: -#line 2519 "parse.y" +#line 2521 "parse.y" { if (filter_opts.label) { yyerror("label cannot be redefined"); @@ -6779,7 +6779,7 @@ case 188: } break; case 189: -#line 2526 "parse.y" +#line 2528 "parse.y" { if (filter_opts.queues.qname) { yyerror("queue cannot be redefined"); @@ -6789,20 +6789,20 @@ case 189: } break; case 190: -#line 2533 "parse.y" +#line 2535 "parse.y" { filter_opts.tag = yystack.l_mark[0].v.string; } break; case 191: -#line 2536 "parse.y" +#line 2538 "parse.y" { filter_opts.match_tag = yystack.l_mark[0].v.string; filter_opts.match_tag_not = yystack.l_mark[-2].v.number; } break; case 192: -#line 2540 "parse.y" +#line 2542 "parse.y" { double p; @@ -6817,7 +6817,7 @@ case 192: } break; case 193: -#line 2552 "parse.y" +#line 2554 "parse.y" { if (yystack.l_mark[0].v.number < 0 || yystack.l_mark[0].v.number > rt_tableid_max()) { yyerror("invalid rtable id"); @@ -6827,7 +6827,7 @@ case 193: } break; case 194: -#line 2559 "parse.y" +#line 2561 "parse.y" { #ifdef __FreeBSD__ filter_opts.divert.port = yystack.l_mark[0].v.range.a; @@ -6839,7 +6839,7 @@ case 194: } break; case 195: -#line 2568 "parse.y" +#line 2570 "parse.y" { #ifndef __FreeBSD__ if ((filter_opts.divert.addr = host(yystack.l_mark[-2].v.string)) == NULL) { @@ -6860,7 +6860,7 @@ case 195: } break; case 196: -#line 2586 "parse.y" +#line 2588 "parse.y" { #ifdef __FreeBSD__ yyerror("divert-reply has no meaning in FreeBSD pf(4)"); @@ -6871,15 +6871,15 @@ case 196: } break; case 198: -#line 2597 "parse.y" +#line 2599 "parse.y" { yyval.v.filter_opts = filter_opts; } break; case 199: -#line 2598 "parse.y" +#line 2600 "parse.y" { yyval.v.filter_opts = filter_opts; } break; case 202: -#line 2605 "parse.y" +#line 2607 "parse.y" { if (filter_opts.marker & FOM_SETPRIO) { yyerror("prio cannot be redefined"); @@ -6891,7 +6891,7 @@ case 202: } break; case 203: -#line 2614 "parse.y" +#line 2616 "parse.y" { if (yystack.l_mark[0].v.number < 0 || yystack.l_mark[0].v.number > PF_PRIO_MAX) { yyerror("prio must be 0 - %u", PF_PRIO_MAX); @@ -6901,7 +6901,7 @@ case 203: } break; case 204: -#line 2621 "parse.y" +#line 2623 "parse.y" { if (yystack.l_mark[-3].v.number < 0 || yystack.l_mark[-3].v.number > PF_PRIO_MAX || yystack.l_mark[-1].v.number < 0 || yystack.l_mark[-1].v.number > PF_PRIO_MAX) { @@ -6913,7 +6913,7 @@ case 204: } break; case 205: -#line 2632 "parse.y" +#line 2634 "parse.y" { char *e; double p = strtod(yystack.l_mark[0].v.string, &e); @@ -6932,21 +6932,21 @@ case 205: } break; case 206: -#line 2648 "parse.y" +#line 2650 "parse.y" { yyval.v.probability = (double)yystack.l_mark[0].v.number; } break; case 207: -#line 2654 "parse.y" +#line 2656 "parse.y" { yyval.v.b.b1 = PF_PASS; yyval.v.b.b2 = yyval.v.b.w = 0; } break; case 208: -#line 2655 "parse.y" +#line 2657 "parse.y" { yyval.v.b = yystack.l_mark[0].v.b; yyval.v.b.b1 = PF_DROP; } break; case 209: -#line 2658 "parse.y" +#line 2660 "parse.y" { yyval.v.b.b2 = blockpolicy; yyval.v.b.w = returnicmpdefault; @@ -6954,7 +6954,7 @@ case 209: } break; case 210: -#line 2663 "parse.y" +#line 2665 "parse.y" { yyval.v.b.b2 = PFRULE_DROP; yyval.v.b.w = 0; @@ -6962,7 +6962,7 @@ case 210: } break; case 211: -#line 2668 "parse.y" +#line 2670 "parse.y" { yyval.v.b.b2 = PFRULE_RETURNRST; yyval.v.b.w = 0; @@ -6970,7 +6970,7 @@ case 211: } break; case 212: -#line 2673 "parse.y" +#line 2675 "parse.y" { if (yystack.l_mark[-1].v.number < 0 || yystack.l_mark[-1].v.number > 255) { yyerror("illegal ttl value %d", yystack.l_mark[-1].v.number); @@ -6982,7 +6982,7 @@ case 212: } break; case 213: -#line 2682 "parse.y" +#line 2684 "parse.y" { yyval.v.b.b2 = PFRULE_RETURNICMP; yyval.v.b.w = returnicmpdefault; @@ -6990,7 +6990,7 @@ case 213: } break; case 214: -#line 2687 "parse.y" +#line 2689 "parse.y" { yyval.v.b.b2 = PFRULE_RETURNICMP; yyval.v.b.w = returnicmpdefault; @@ -6998,7 +6998,7 @@ case 214: } break; case 215: -#line 2692 "parse.y" +#line 2694 "parse.y" { yyval.v.b.b2 = PFRULE_RETURNICMP; yyval.v.b.w = yystack.l_mark[-1].v.number; @@ -7006,7 +7006,7 @@ case 215: } break; case 216: -#line 2697 "parse.y" +#line 2699 "parse.y" { yyval.v.b.b2 = PFRULE_RETURNICMP; yyval.v.b.w = returnicmpdefault; @@ -7014,7 +7014,7 @@ case 216: } break; case 217: -#line 2702 "parse.y" +#line 2704 "parse.y" { yyval.v.b.b2 = PFRULE_RETURNICMP; yyval.v.b.w = yystack.l_mark[-3].v.number; @@ -7022,7 +7022,7 @@ case 217: } break; case 218: -#line 2707 "parse.y" +#line 2709 "parse.y" { yyval.v.b.b2 = PFRULE_RETURN; yyval.v.b.w = returnicmpdefault; @@ -7030,7 +7030,7 @@ case 218: } break; case 219: -#line 2714 "parse.y" +#line 2716 "parse.y" { if (!(yyval.v.number = parseicmpspec(yystack.l_mark[0].v.string, AF_INET))) { free(yystack.l_mark[0].v.string); @@ -7040,7 +7040,7 @@ case 219: } break; case 220: -#line 2721 "parse.y" +#line 2723 "parse.y" { u_int8_t icmptype; @@ -7053,7 +7053,7 @@ case 220: } break; case 221: -#line 2733 "parse.y" +#line 2735 "parse.y" { if (!(yyval.v.number = parseicmpspec(yystack.l_mark[0].v.string, AF_INET6))) { free(yystack.l_mark[0].v.string); @@ -7063,7 +7063,7 @@ case 221: } break; case 222: -#line 2740 "parse.y" +#line 2742 "parse.y" { u_int8_t icmptype; @@ -7076,62 +7076,62 @@ case 222: } break; case 223: -#line 2752 "parse.y" +#line 2754 "parse.y" { yyval.v.i = PF_INOUT; } break; case 224: -#line 2753 "parse.y" +#line 2755 "parse.y" { yyval.v.i = PF_IN; } break; case 225: -#line 2754 "parse.y" +#line 2756 "parse.y" { yyval.v.i = PF_OUT; } break; case 226: -#line 2757 "parse.y" +#line 2759 "parse.y" { yyval.v.logquick.quick = 0; } break; case 227: -#line 2758 "parse.y" +#line 2760 "parse.y" { yyval.v.logquick.quick = 1; } break; case 228: -#line 2761 "parse.y" +#line 2763 "parse.y" { yyval.v.logquick.log = 0; yyval.v.logquick.quick = 0; yyval.v.logquick.logif = 0; } break; case 229: -#line 2762 "parse.y" +#line 2764 "parse.y" { yyval.v.logquick = yystack.l_mark[0].v.logquick; yyval.v.logquick.quick = 0; } break; case 230: -#line 2763 "parse.y" +#line 2765 "parse.y" { yyval.v.logquick.quick = 1; yyval.v.logquick.log = 0; yyval.v.logquick.logif = 0; } break; case 231: -#line 2764 "parse.y" +#line 2766 "parse.y" { yyval.v.logquick = yystack.l_mark[-1].v.logquick; yyval.v.logquick.quick = 1; } break; case 232: -#line 2765 "parse.y" +#line 2767 "parse.y" { yyval.v.logquick = yystack.l_mark[0].v.logquick; yyval.v.logquick.quick = 1; } break; case 233: -#line 2768 "parse.y" +#line 2770 "parse.y" { yyval.v.logquick.log = PF_LOG; yyval.v.logquick.logif = 0; } break; case 234: -#line 2769 "parse.y" +#line 2771 "parse.y" { yyval.v.logquick.log = PF_LOG | yystack.l_mark[-1].v.logquick.log; yyval.v.logquick.logif = yystack.l_mark[-1].v.logquick.logif; } break; case 235: -#line 2775 "parse.y" +#line 2777 "parse.y" { yyval.v.logquick = yystack.l_mark[0].v.logquick; } break; case 236: -#line 2776 "parse.y" +#line 2778 "parse.y" { yyval.v.logquick.log = yystack.l_mark[-2].v.logquick.log | yystack.l_mark[0].v.logquick.log; yyval.v.logquick.logif = yystack.l_mark[0].v.logquick.logif; @@ -7140,19 +7140,19 @@ case 236: } break; case 237: -#line 2784 "parse.y" +#line 2786 "parse.y" { yyval.v.logquick.log = PF_LOG_ALL; yyval.v.logquick.logif = 0; } break; case 238: -#line 2785 "parse.y" +#line 2787 "parse.y" { yyval.v.logquick.log = PF_LOG_SOCKET_LOOKUP; yyval.v.logquick.logif = 0; } break; case 239: -#line 2786 "parse.y" +#line 2788 "parse.y" { yyval.v.logquick.log = PF_LOG_SOCKET_LOOKUP; yyval.v.logquick.logif = 0; } break; case 240: -#line 2787 "parse.y" +#line 2789 "parse.y" { const char *errstr; u_int i; @@ -7174,23 +7174,23 @@ case 240: } break; case 241: -#line 2808 "parse.y" +#line 2810 "parse.y" { yyval.v.interface = NULL; } break; case 242: -#line 2809 "parse.y" +#line 2811 "parse.y" { yyval.v.interface = yystack.l_mark[0].v.interface; } break; case 243: -#line 2810 "parse.y" +#line 2812 "parse.y" { yyval.v.interface = yystack.l_mark[-1].v.interface; } break; case 244: -#line 2813 "parse.y" +#line 2815 "parse.y" { yyval.v.interface = yystack.l_mark[-1].v.interface; } break; case 245: -#line 2814 "parse.y" +#line 2816 "parse.y" { yystack.l_mark[-3].v.interface->tail->next = yystack.l_mark[-1].v.interface; yystack.l_mark[-3].v.interface->tail = yystack.l_mark[-1].v.interface; @@ -7198,11 +7198,11 @@ case 245: } break; case 246: -#line 2821 "parse.y" +#line 2823 "parse.y" { yyval.v.interface = yystack.l_mark[0].v.interface; yyval.v.interface->not = yystack.l_mark[-1].v.number; } break; case 247: -#line 2824 "parse.y" +#line 2826 "parse.y" { struct node_host *n; @@ -7227,35 +7227,35 @@ case 247: } break; case 248: -#line 2848 "parse.y" +#line 2850 "parse.y" { yyval.v.i = 0; } break; case 249: -#line 2849 "parse.y" +#line 2851 "parse.y" { yyval.v.i = AF_INET; } break; case 250: -#line 2850 "parse.y" +#line 2852 "parse.y" { yyval.v.i = AF_INET6; } break; case 251: -#line 2853 "parse.y" +#line 2855 "parse.y" { yyval.v.proto = NULL; } break; case 252: -#line 2854 "parse.y" +#line 2856 "parse.y" { yyval.v.proto = yystack.l_mark[0].v.proto; } break; case 253: -#line 2855 "parse.y" +#line 2857 "parse.y" { yyval.v.proto = yystack.l_mark[-1].v.proto; } break; case 254: -#line 2858 "parse.y" +#line 2860 "parse.y" { yyval.v.proto = yystack.l_mark[-1].v.proto; } break; case 255: -#line 2859 "parse.y" +#line 2861 "parse.y" { yystack.l_mark[-3].v.proto->tail->next = yystack.l_mark[-1].v.proto; yystack.l_mark[-3].v.proto->tail = yystack.l_mark[-1].v.proto; @@ -7263,7 +7263,7 @@ case 255: } break; case 256: -#line 2866 "parse.y" +#line 2868 "parse.y" { u_int8_t pr; @@ -7281,7 +7281,7 @@ case 256: } break; case 257: -#line 2883 "parse.y" +#line 2885 "parse.y" { struct protoent *p; @@ -7296,7 +7296,7 @@ case 257: } break; case 258: -#line 2895 "parse.y" +#line 2897 "parse.y" { if (yystack.l_mark[0].v.number < 0 || yystack.l_mark[0].v.number > 255) { yyerror("protocol outside range"); @@ -7305,7 +7305,7 @@ case 258: } break; case 259: -#line 2903 "parse.y" +#line 2905 "parse.y" { yyval.v.fromto.src.host = NULL; yyval.v.fromto.src.port = NULL; @@ -7315,7 +7315,7 @@ case 259: } break; case 260: -#line 2910 "parse.y" +#line 2912 "parse.y" { yyval.v.fromto.src = yystack.l_mark[-2].v.peer; yyval.v.fromto.src_os = yystack.l_mark[-1].v.os; @@ -7323,19 +7323,19 @@ case 260: } break; case 261: -#line 2917 "parse.y" +#line 2919 "parse.y" { yyval.v.os = NULL; } break; case 262: -#line 2918 "parse.y" +#line 2920 "parse.y" { yyval.v.os = yystack.l_mark[0].v.os; } break; case 263: -#line 2919 "parse.y" +#line 2921 "parse.y" { yyval.v.os = yystack.l_mark[-1].v.os; } break; case 264: -#line 2922 "parse.y" +#line 2924 "parse.y" { yyval.v.os = calloc(1, sizeof(struct node_os)); if (yyval.v.os == NULL) @@ -7345,11 +7345,11 @@ case 264: } break; case 265: -#line 2931 "parse.y" +#line 2933 "parse.y" { yyval.v.os = yystack.l_mark[-1].v.os; } break; case 266: -#line 2932 "parse.y" +#line 2934 "parse.y" { yystack.l_mark[-3].v.os->tail->next = yystack.l_mark[-1].v.os; yystack.l_mark[-3].v.os->tail = yystack.l_mark[-1].v.os; @@ -7357,27 +7357,27 @@ case 266: } break; case 267: -#line 2939 "parse.y" +#line 2941 "parse.y" { yyval.v.peer.host = NULL; yyval.v.peer.port = NULL; } break; case 268: -#line 2943 "parse.y" +#line 2945 "parse.y" { yyval.v.peer = yystack.l_mark[0].v.peer; } break; case 269: -#line 2948 "parse.y" +#line 2950 "parse.y" { yyval.v.peer.host = NULL; yyval.v.peer.port = NULL; } break; case 270: -#line 2952 "parse.y" +#line 2954 "parse.y" { if (disallow_urpf_failed(yystack.l_mark[0].v.peer.host, "\"urpf-failed\" is " "not permitted in a destination address")) @@ -7386,52 +7386,52 @@ case 270: } break; case 271: -#line 2960 "parse.y" +#line 2962 "parse.y" { yyval.v.peer.host = yystack.l_mark[0].v.host; yyval.v.peer.port = NULL; } break; case 272: -#line 2964 "parse.y" +#line 2966 "parse.y" { yyval.v.peer.host = yystack.l_mark[-2].v.host; yyval.v.peer.port = yystack.l_mark[0].v.port; } break; case 273: -#line 2968 "parse.y" +#line 2970 "parse.y" { yyval.v.peer.host = NULL; yyval.v.peer.port = yystack.l_mark[0].v.port; } break; case 276: -#line 2978 "parse.y" +#line 2980 "parse.y" { yyval.v.host = NULL; } break; case 277: -#line 2979 "parse.y" +#line 2981 "parse.y" { yyval.v.host = yystack.l_mark[0].v.host; } break; case 278: -#line 2980 "parse.y" +#line 2982 "parse.y" { yyval.v.host = yystack.l_mark[-1].v.host; } break; case 279: -#line 2983 "parse.y" +#line 2985 "parse.y" { yyval.v.host = yystack.l_mark[0].v.host; } break; case 280: -#line 2984 "parse.y" +#line 2986 "parse.y" { yyval.v.host = NULL; } break; case 281: -#line 2987 "parse.y" +#line 2989 "parse.y" { yyval.v.host = yystack.l_mark[-1].v.host; } break; case 282: -#line 2988 "parse.y" +#line 2990 "parse.y" { if (yystack.l_mark[-1].v.host == NULL) yyval.v.host = yystack.l_mark[-3].v.host; @@ -7445,7 +7445,7 @@ case 282: } break; case 283: -#line 3001 "parse.y" +#line 3003 "parse.y" { struct node_host *n; @@ -7455,7 +7455,7 @@ case 283: } break; case 284: -#line 3008 "parse.y" +#line 3010 "parse.y" { yyval.v.host = calloc(1, sizeof(struct node_host)); if (yyval.v.host == NULL) @@ -7467,7 +7467,7 @@ case 284: } break; case 285: -#line 3017 "parse.y" +#line 3019 "parse.y" { yyval.v.host = calloc(1, sizeof(struct node_host)); if (yyval.v.host == NULL) @@ -7479,7 +7479,7 @@ case 285: } break; case 286: -#line 3028 "parse.y" +#line 3030 "parse.y" { if ((yyval.v.host = host(yystack.l_mark[0].v.string)) == NULL) { /* error. "any" is handled elsewhere */ @@ -7492,7 +7492,7 @@ case 286: } break; case 287: -#line 3038 "parse.y" +#line 3040 "parse.y" { struct node_host *b, *e; @@ -7528,7 +7528,7 @@ case 287: } break; case 288: -#line 3071 "parse.y" +#line 3073 "parse.y" { char *buf; @@ -7545,7 +7545,7 @@ case 288: } break; case 289: -#line 3085 "parse.y" +#line 3087 "parse.y" { char *buf; @@ -7566,7 +7566,7 @@ case 289: } break; case 291: -#line 3104 "parse.y" +#line 3106 "parse.y" { struct node_host *n; @@ -7580,7 +7580,7 @@ case 291: } break; case 292: -#line 3115 "parse.y" +#line 3117 "parse.y" { if (strlen(yystack.l_mark[-1].v.string) >= PF_TABLE_NAME_SIZE) { yyerror("table name '%s' too long", yystack.l_mark[-1].v.string); @@ -7601,7 +7601,7 @@ case 292: } break; case 294: -#line 3136 "parse.y" +#line 3138 "parse.y" { u_long ulval; @@ -7615,7 +7615,7 @@ case 294: } break; case 295: -#line 3149 "parse.y" +#line 3151 "parse.y" { int flags = 0; char *p, *op; @@ -7670,19 +7670,19 @@ case 295: } break; case 296: -#line 3203 "parse.y" +#line 3205 "parse.y" { yyval.v.port = yystack.l_mark[0].v.port; } break; case 297: -#line 3204 "parse.y" +#line 3206 "parse.y" { yyval.v.port = yystack.l_mark[-1].v.port; } break; case 298: -#line 3207 "parse.y" +#line 3209 "parse.y" { yyval.v.port = yystack.l_mark[-1].v.port; } break; case 299: -#line 3208 "parse.y" +#line 3210 "parse.y" { yystack.l_mark[-3].v.port->tail->next = yystack.l_mark[-1].v.port; yystack.l_mark[-3].v.port->tail = yystack.l_mark[-1].v.port; @@ -7690,7 +7690,7 @@ case 299: } break; case 300: -#line 3215 "parse.y" +#line 3217 "parse.y" { yyval.v.port = calloc(1, sizeof(struct node_port)); if (yyval.v.port == NULL) @@ -7706,7 +7706,7 @@ case 300: } break; case 301: -#line 3228 "parse.y" +#line 3230 "parse.y" { if (yystack.l_mark[0].v.range.t) { yyerror("':' cannot be used with an other " @@ -7724,7 +7724,7 @@ case 301: } break; case 302: -#line 3243 "parse.y" +#line 3245 "parse.y" { if (yystack.l_mark[-2].v.range.t || yystack.l_mark[0].v.range.t) { yyerror("':' cannot be used with an other " @@ -7742,7 +7742,7 @@ case 302: } break; case 303: -#line 3260 "parse.y" +#line 3262 "parse.y" { if (parseport(yystack.l_mark[0].v.string, &yyval.v.range, 0) == -1) { free(yystack.l_mark[0].v.string); @@ -7752,7 +7752,7 @@ case 303: } break; case 304: -#line 3269 "parse.y" +#line 3271 "parse.y" { if (parseport(yystack.l_mark[0].v.string, &yyval.v.range, PPORT_RANGE) == -1) { free(yystack.l_mark[0].v.string); @@ -7762,19 +7762,19 @@ case 304: } break; case 305: -#line 3278 "parse.y" +#line 3280 "parse.y" { yyval.v.uid = yystack.l_mark[0].v.uid; } break; case 306: -#line 3279 "parse.y" +#line 3281 "parse.y" { yyval.v.uid = yystack.l_mark[-1].v.uid; } break; case 307: -#line 3282 "parse.y" +#line 3284 "parse.y" { yyval.v.uid = yystack.l_mark[-1].v.uid; } break; case 308: -#line 3283 "parse.y" +#line 3285 "parse.y" { yystack.l_mark[-3].v.uid->tail->next = yystack.l_mark[-1].v.uid; yystack.l_mark[-3].v.uid->tail = yystack.l_mark[-1].v.uid; @@ -7782,7 +7782,7 @@ case 308: } break; case 309: -#line 3290 "parse.y" +#line 3292 "parse.y" { yyval.v.uid = calloc(1, sizeof(struct node_uid)); if (yyval.v.uid == NULL) @@ -7795,7 +7795,7 @@ case 309: } break; case 310: -#line 3300 "parse.y" +#line 3302 "parse.y" { if (yystack.l_mark[0].v.number == UID_MAX && yystack.l_mark[-1].v.i != PF_OP_EQ && yystack.l_mark[-1].v.i != PF_OP_NE) { yyerror("user unknown requires operator = or " @@ -7813,7 +7813,7 @@ case 310: } break; case 311: -#line 3315 "parse.y" +#line 3317 "parse.y" { if (yystack.l_mark[-2].v.number == UID_MAX || yystack.l_mark[0].v.number == UID_MAX) { yyerror("user unknown requires operator = or " @@ -7831,7 +7831,7 @@ case 311: } break; case 312: -#line 3332 "parse.y" +#line 3334 "parse.y" { if (!strcmp(yystack.l_mark[0].v.string, "unknown")) yyval.v.number = UID_MAX; @@ -7849,7 +7849,7 @@ case 312: } break; case 313: -#line 3347 "parse.y" +#line 3349 "parse.y" { if (yystack.l_mark[0].v.number < 0 || yystack.l_mark[0].v.number >= UID_MAX) { yyerror("illegal uid value %lu", yystack.l_mark[0].v.number); @@ -7859,19 +7859,19 @@ case 313: } break; case 314: -#line 3356 "parse.y" +#line 3358 "parse.y" { yyval.v.gid = yystack.l_mark[0].v.gid; } break; case 315: -#line 3357 "parse.y" +#line 3359 "parse.y" { yyval.v.gid = yystack.l_mark[-1].v.gid; } break; case 316: -#line 3360 "parse.y" +#line 3362 "parse.y" { yyval.v.gid = yystack.l_mark[-1].v.gid; } break; case 317: -#line 3361 "parse.y" +#line 3363 "parse.y" { yystack.l_mark[-3].v.gid->tail->next = yystack.l_mark[-1].v.gid; yystack.l_mark[-3].v.gid->tail = yystack.l_mark[-1].v.gid; @@ -7879,7 +7879,7 @@ case 317: } break; case 318: -#line 3368 "parse.y" +#line 3370 "parse.y" { yyval.v.gid = calloc(1, sizeof(struct node_gid)); if (yyval.v.gid == NULL) @@ -7892,7 +7892,7 @@ case 318: } break; case 319: -#line 3378 "parse.y" +#line 3380 "parse.y" { if (yystack.l_mark[0].v.number == GID_MAX && yystack.l_mark[-1].v.i != PF_OP_EQ && yystack.l_mark[-1].v.i != PF_OP_NE) { yyerror("group unknown requires operator = or " @@ -7910,7 +7910,7 @@ case 319: } break; case 320: -#line 3393 "parse.y" +#line 3395 "parse.y" { if (yystack.l_mark[-2].v.number == GID_MAX || yystack.l_mark[0].v.number == GID_MAX) { yyerror("group unknown requires operator = or " @@ -7928,7 +7928,7 @@ case 320: } break; case 321: -#line 3410 "parse.y" +#line 3412 "parse.y" { if (!strcmp(yystack.l_mark[0].v.string, "unknown")) yyval.v.number = GID_MAX; @@ -7946,7 +7946,7 @@ case 321: } break; case 322: -#line 3425 "parse.y" +#line 3427 "parse.y" { if (yystack.l_mark[0].v.number < 0 || yystack.l_mark[0].v.number >= GID_MAX) { yyerror("illegal gid value %lu", yystack.l_mark[0].v.number); @@ -7956,7 +7956,7 @@ case 322: } break; case 323: -#line 3434 "parse.y" +#line 3436 "parse.y" { int f; @@ -7970,39 +7970,39 @@ case 323: } break; case 324: -#line 3447 "parse.y" +#line 3449 "parse.y" { yyval.v.b.b1 = yystack.l_mark[-2].v.b.b1; yyval.v.b.b2 = yystack.l_mark[0].v.b.b1; } break; case 325: -#line 3448 "parse.y" +#line 3450 "parse.y" { yyval.v.b.b1 = 0; yyval.v.b.b2 = yystack.l_mark[0].v.b.b1; } break; case 326: -#line 3449 "parse.y" +#line 3451 "parse.y" { yyval.v.b.b1 = 0; yyval.v.b.b2 = 0; } break; case 327: -#line 3452 "parse.y" +#line 3454 "parse.y" { yyval.v.icmp = yystack.l_mark[0].v.icmp; } break; case 328: -#line 3453 "parse.y" +#line 3455 "parse.y" { yyval.v.icmp = yystack.l_mark[-1].v.icmp; } break; case 329: -#line 3454 "parse.y" +#line 3456 "parse.y" { yyval.v.icmp = yystack.l_mark[0].v.icmp; } break; case 330: -#line 3455 "parse.y" +#line 3457 "parse.y" { yyval.v.icmp = yystack.l_mark[-1].v.icmp; } break; case 331: -#line 3458 "parse.y" +#line 3460 "parse.y" { yyval.v.icmp = yystack.l_mark[-1].v.icmp; } break; case 332: -#line 3459 "parse.y" +#line 3461 "parse.y" { yystack.l_mark[-3].v.icmp->tail->next = yystack.l_mark[-1].v.icmp; yystack.l_mark[-3].v.icmp->tail = yystack.l_mark[-1].v.icmp; @@ -8010,11 +8010,11 @@ case 332: } break; case 333: -#line 3466 "parse.y" +#line 3468 "parse.y" { yyval.v.icmp = yystack.l_mark[-1].v.icmp; } break; case 334: -#line 3467 "parse.y" +#line 3469 "parse.y" { yystack.l_mark[-3].v.icmp->tail->next = yystack.l_mark[-1].v.icmp; yystack.l_mark[-3].v.icmp->tail = yystack.l_mark[-1].v.icmp; @@ -8022,7 +8022,7 @@ case 334: } break; case 335: -#line 3474 "parse.y" +#line 3476 "parse.y" { yyval.v.icmp = calloc(1, sizeof(struct node_icmp)); if (yyval.v.icmp == NULL) @@ -8035,7 +8035,7 @@ case 335: } break; case 336: -#line 3484 "parse.y" +#line 3486 "parse.y" { const struct icmpcodeent *p; @@ -8057,7 +8057,7 @@ case 336: } break; case 337: -#line 3503 "parse.y" +#line 3505 "parse.y" { if (yystack.l_mark[0].v.number < 0 || yystack.l_mark[0].v.number > 255) { yyerror("illegal icmp-code %lu", yystack.l_mark[0].v.number); @@ -8074,7 +8074,7 @@ case 337: } break; case 338: -#line 3519 "parse.y" +#line 3521 "parse.y" { yyval.v.icmp = calloc(1, sizeof(struct node_icmp)); if (yyval.v.icmp == NULL) @@ -8087,7 +8087,7 @@ case 338: } break; case 339: -#line 3529 "parse.y" +#line 3531 "parse.y" { const struct icmpcodeent *p; @@ -8109,7 +8109,7 @@ case 339: } break; case 340: -#line 3548 "parse.y" +#line 3550 "parse.y" { if (yystack.l_mark[0].v.number < 0 || yystack.l_mark[0].v.number > 255) { yyerror("illegal icmp-code %lu", yystack.l_mark[0].v.number); @@ -8126,7 +8126,7 @@ case 340: } break; case 341: -#line 3564 "parse.y" +#line 3566 "parse.y" { const struct icmptypeent *p; @@ -8140,7 +8140,7 @@ case 341: } break; case 342: -#line 3575 "parse.y" +#line 3577 "parse.y" { if (yystack.l_mark[0].v.number < 0 || yystack.l_mark[0].v.number > 255) { yyerror("illegal icmp-type %lu", yystack.l_mark[0].v.number); @@ -8150,7 +8150,7 @@ case 342: } break; case 343: -#line 3584 "parse.y" +#line 3586 "parse.y" { const struct icmptypeent *p; @@ -8165,7 +8165,7 @@ case 343: } break; case 344: -#line 3596 "parse.y" +#line 3598 "parse.y" { if (yystack.l_mark[0].v.number < 0 || yystack.l_mark[0].v.number > 255) { yyerror("illegal icmp6-type %lu", yystack.l_mark[0].v.number); @@ -8175,7 +8175,7 @@ case 344: } break; case 345: -#line 3605 "parse.y" +#line 3607 "parse.y" { int val; char *end; @@ -8198,7 +8198,7 @@ case 345: } break; case 346: -#line 3625 "parse.y" +#line 3627 "parse.y" { yyval.v.number = yystack.l_mark[0].v.number; if (yyval.v.number < 0 || yyval.v.number > 255) { @@ -8208,85 +8208,85 @@ case 346: } break; case 347: -#line 3634 "parse.y" +#line 3636 "parse.y" { yyval.v.i = PF_SRCTRACK; } break; case 348: -#line 3635 "parse.y" +#line 3637 "parse.y" { yyval.v.i = PF_SRCTRACK_GLOBAL; } break; case 349: -#line 3636 "parse.y" +#line 3638 "parse.y" { yyval.v.i = PF_SRCTRACK_RULE; } break; case 350: -#line 3639 "parse.y" +#line 3641 "parse.y" { yyval.v.i = PFRULE_IFBOUND; } break; case 351: -#line 3642 "parse.y" +#line 3644 "parse.y" { yyval.v.i = 0; } break; case 352: -#line 3647 "parse.y" +#line 3649 "parse.y" { yyval.v.keep_state.action = 0; yyval.v.keep_state.options = NULL; } break; case 353: -#line 3651 "parse.y" +#line 3653 "parse.y" { yyval.v.keep_state.action = PF_STATE_NORMAL; yyval.v.keep_state.options = yystack.l_mark[0].v.state_opt; } break; case 354: -#line 3655 "parse.y" +#line 3657 "parse.y" { yyval.v.keep_state.action = PF_STATE_MODULATE; yyval.v.keep_state.options = yystack.l_mark[0].v.state_opt; } break; case 355: -#line 3659 "parse.y" +#line 3661 "parse.y" { yyval.v.keep_state.action = PF_STATE_SYNPROXY; yyval.v.keep_state.options = yystack.l_mark[0].v.state_opt; } break; case 356: -#line 3665 "parse.y" +#line 3667 "parse.y" { yyval.v.i = 0; } break; case 357: -#line 3666 "parse.y" +#line 3668 "parse.y" { yyval.v.i = PF_FLUSH; } break; case 358: -#line 3667 "parse.y" +#line 3669 "parse.y" { yyval.v.i = PF_FLUSH | PF_FLUSH_GLOBAL; } break; case 359: -#line 3672 "parse.y" +#line 3674 "parse.y" { yyval.v.state_opt = yystack.l_mark[-1].v.state_opt; } break; case 360: -#line 3673 "parse.y" +#line 3675 "parse.y" { yyval.v.state_opt = NULL; } break; case 361: -#line 3676 "parse.y" +#line 3678 "parse.y" { yyval.v.state_opt = yystack.l_mark[0].v.state_opt; } break; case 362: -#line 3677 "parse.y" +#line 3679 "parse.y" { yystack.l_mark[-2].v.state_opt->tail->next = yystack.l_mark[0].v.state_opt; yystack.l_mark[-2].v.state_opt->tail = yystack.l_mark[0].v.state_opt; @@ -8294,7 +8294,7 @@ case 362: } break; case 363: -#line 3684 "parse.y" +#line 3686 "parse.y" { if (yystack.l_mark[0].v.number < 0 || yystack.l_mark[0].v.number > UINT_MAX) { yyerror("only positive values permitted"); @@ -8310,7 +8310,7 @@ case 363: } break; case 364: -#line 3697 "parse.y" +#line 3699 "parse.y" { yyval.v.state_opt = calloc(1, sizeof(struct node_state_opt)); if (yyval.v.state_opt == NULL) @@ -8321,7 +8321,7 @@ case 364: } break; case 365: -#line 3705 "parse.y" +#line 3707 "parse.y" { if (yystack.l_mark[0].v.number < 0 || yystack.l_mark[0].v.number > UINT_MAX) { yyerror("only positive values permitted"); @@ -8337,7 +8337,7 @@ case 365: } break; case 366: -#line 3718 "parse.y" +#line 3720 "parse.y" { if (yystack.l_mark[0].v.number < 0 || yystack.l_mark[0].v.number > UINT_MAX) { yyerror("only positive values permitted"); @@ -8353,7 +8353,7 @@ case 366: } break; case 367: -#line 3731 "parse.y" +#line 3733 "parse.y" { if (yystack.l_mark[-2].v.number < 0 || yystack.l_mark[-2].v.number > UINT_MAX || yystack.l_mark[0].v.number < 0 || yystack.l_mark[0].v.number > UINT_MAX) { @@ -8371,7 +8371,7 @@ case 367: } break; case 368: -#line 3746 "parse.y" +#line 3748 "parse.y" { if (strlen(yystack.l_mark[-2].v.string) >= PF_TABLE_NAME_SIZE) { yyerror("table name '%s' too long", yystack.l_mark[-2].v.string); @@ -8392,7 +8392,7 @@ case 368: } break; case 369: -#line 3764 "parse.y" +#line 3766 "parse.y" { if (yystack.l_mark[0].v.number < 0 || yystack.l_mark[0].v.number > UINT_MAX) { yyerror("only positive values permitted"); @@ -8408,7 +8408,7 @@ case 369: } break; case 370: -#line 3777 "parse.y" +#line 3779 "parse.y" { yyval.v.state_opt = calloc(1, sizeof(struct node_state_opt)); if (yyval.v.state_opt == NULL) @@ -8420,7 +8420,7 @@ case 370: } break; case 371: -#line 3786 "parse.y" +#line 3788 "parse.y" { yyval.v.state_opt = calloc(1, sizeof(struct node_state_opt)); if (yyval.v.state_opt == NULL) @@ -8432,7 +8432,7 @@ case 371: } break; case 372: -#line 3795 "parse.y" +#line 3797 "parse.y" { yyval.v.state_opt = calloc(1, sizeof(struct node_state_opt)); if (yyval.v.state_opt == NULL) @@ -8443,7 +8443,7 @@ case 372: } break; case 373: -#line 3803 "parse.y" +#line 3805 "parse.y" { int i; @@ -8476,42 +8476,42 @@ case 373: } break; case 374: -#line 3835 "parse.y" +#line 3837 "parse.y" { yyval.v.string = yystack.l_mark[0].v.string; } break; case 375: -#line 3840 "parse.y" +#line 3842 "parse.y" { yyval.v.qassign.qname = yystack.l_mark[0].v.string; yyval.v.qassign.pqname = NULL; } break; case 376: -#line 3844 "parse.y" +#line 3846 "parse.y" { yyval.v.qassign.qname = yystack.l_mark[-1].v.string; yyval.v.qassign.pqname = NULL; } break; case 377: -#line 3848 "parse.y" +#line 3850 "parse.y" { yyval.v.qassign.qname = yystack.l_mark[-3].v.string; yyval.v.qassign.pqname = yystack.l_mark[-1].v.string; } break; case 378: -#line 3854 "parse.y" +#line 3856 "parse.y" { yyval.v.i = 0; } break; case 379: -#line 3855 "parse.y" +#line 3857 "parse.y" { yyval.v.i = 1; } break; case 380: -#line 3858 "parse.y" +#line 3860 "parse.y" { if (parseport(yystack.l_mark[0].v.string, &yyval.v.range, PPORT_RANGE|PPORT_STAR) == -1) { free(yystack.l_mark[0].v.string); @@ -8521,19 +8521,19 @@ case 380: } break; case 381: -#line 3867 "parse.y" +#line 3869 "parse.y" { yyval.v.host = yystack.l_mark[0].v.host; } break; case 382: -#line 3868 "parse.y" +#line 3870 "parse.y" { yyval.v.host = yystack.l_mark[-1].v.host; } break; case 383: -#line 3871 "parse.y" +#line 3873 "parse.y" { yyval.v.host = yystack.l_mark[-1].v.host; } break; case 384: -#line 3872 "parse.y" +#line 3874 "parse.y" { yystack.l_mark[-3].v.host->tail->next = yystack.l_mark[-1].v.host; yystack.l_mark[-3].v.host->tail = yystack.l_mark[-1].v.host->tail; @@ -8541,11 +8541,11 @@ case 384: } break; case 385: -#line 3879 "parse.y" +#line 3881 "parse.y" { yyval.v.redirection = NULL; } break; case 386: -#line 3880 "parse.y" +#line 3882 "parse.y" { yyval.v.redirection = calloc(1, sizeof(struct redirection)); if (yyval.v.redirection == NULL) @@ -8555,7 +8555,7 @@ case 386: } break; case 387: -#line 3887 "parse.y" +#line 3889 "parse.y" { yyval.v.redirection = calloc(1, sizeof(struct redirection)); if (yyval.v.redirection == NULL) @@ -8565,7 +8565,7 @@ case 387: } break; case 388: -#line 3897 "parse.y" +#line 3899 "parse.y" { yyval.v.hashkey = calloc(1, sizeof(struct pf_poolhashkey)); if (yyval.v.hashkey == NULL) @@ -8577,7 +8577,7 @@ case 388: } break; case 389: -#line 3907 "parse.y" +#line 3909 "parse.y" { if (!strncmp(yystack.l_mark[0].v.string, "0x", 2)) { if (strlen(yystack.l_mark[0].v.string) != 34) { @@ -8617,22 +8617,22 @@ case 389: } break; case 390: -#line 3946 "parse.y" +#line 3948 "parse.y" { bzero(&pool_opts, sizeof pool_opts); } break; case 391: -#line 3948 "parse.y" +#line 3950 "parse.y" { yyval.v.pool_opts = pool_opts; } break; case 392: -#line 3949 "parse.y" +#line 3951 "parse.y" { bzero(&pool_opts, sizeof pool_opts); yyval.v.pool_opts = pool_opts; } break; case 395: -#line 3959 "parse.y" +#line 3961 "parse.y" { if (pool_opts.type) { yyerror("pool type cannot be redefined"); @@ -8642,7 +8642,7 @@ case 395: } break; case 396: -#line 3966 "parse.y" +#line 3968 "parse.y" { if (pool_opts.type) { yyerror("pool type cannot be redefined"); @@ -8652,7 +8652,7 @@ case 396: } break; case 397: -#line 3973 "parse.y" +#line 3975 "parse.y" { if (pool_opts.type) { yyerror("pool type cannot be redefined"); @@ -8663,7 +8663,7 @@ case 397: } break; case 398: -#line 3981 "parse.y" +#line 3983 "parse.y" { if (pool_opts.type) { yyerror("pool type cannot be redefined"); @@ -8673,7 +8673,7 @@ case 398: } break; case 399: -#line 3988 "parse.y" +#line 3990 "parse.y" { if (pool_opts.staticport) { yyerror("static-port cannot be redefined"); @@ -8683,7 +8683,7 @@ case 399: } break; case 400: -#line 3995 "parse.y" +#line 3997 "parse.y" { if (filter_opts.marker & POM_STICKYADDRESS) { yyerror("sticky-address cannot be redefined"); @@ -8694,11 +8694,11 @@ case 400: } break; case 401: -#line 4005 "parse.y" +#line 4007 "parse.y" { yyval.v.redirection = NULL; } break; case 402: -#line 4006 "parse.y" +#line 4008 "parse.y" { yyval.v.redirection = calloc(1, sizeof(struct redirection)); if (yyval.v.redirection == NULL) @@ -8708,7 +8708,7 @@ case 402: } break; case 403: -#line 4013 "parse.y" +#line 4015 "parse.y" { yyval.v.redirection = calloc(1, sizeof(struct redirection)); if (yyval.v.redirection == NULL) @@ -8718,23 +8718,23 @@ case 403: } break; case 404: -#line 4022 "parse.y" +#line 4024 "parse.y" { yyval.v.b.b1 = yyval.v.b.b2 = 0; yyval.v.b.w2 = 0; } break; case 405: -#line 4023 "parse.y" +#line 4025 "parse.y" { yyval.v.b.b1 = 1; yyval.v.b.b2 = 0; yyval.v.b.w2 = 0; } break; case 406: -#line 4024 "parse.y" +#line 4026 "parse.y" { yyval.v.b.b1 = 1; yyval.v.b.b2 = yystack.l_mark[0].v.logquick.log; yyval.v.b.w2 = yystack.l_mark[0].v.logquick.logif; } break; case 407: -#line 4025 "parse.y" +#line 4027 "parse.y" { yyval.v.b.b1 = 0; yyval.v.b.b2 = yystack.l_mark[0].v.logquick.log; yyval.v.b.w2 = yystack.l_mark[0].v.logquick.logif; } break; case 408: -#line 4028 "parse.y" +#line 4030 "parse.y" { if (yystack.l_mark[-2].v.i && yystack.l_mark[0].v.b.b1) { yyerror("\"pass\" not valid with \"no\""); @@ -8750,7 +8750,7 @@ case 408: } break; case 409: -#line 4041 "parse.y" +#line 4043 "parse.y" { if (yystack.l_mark[-2].v.i && yystack.l_mark[0].v.b.b1) { yyerror("\"pass\" not valid with \"no\""); @@ -8766,7 +8766,7 @@ case 409: } break; case 410: -#line 4058 "parse.y" +#line 4060 "parse.y" { struct pf_rule r; @@ -8924,7 +8924,7 @@ case 410: } break; case 411: -#line 4217 "parse.y" +#line 4219 "parse.y" { struct pf_rule binat; struct pf_pooladdr *pa; @@ -9090,27 +9090,27 @@ case 411: } break; case 412: -#line 4382 "parse.y" +#line 4384 "parse.y" { yyval.v.string = NULL; } break; case 413: -#line 4383 "parse.y" +#line 4385 "parse.y" { yyval.v.string = yystack.l_mark[0].v.string; } break; case 414: -#line 4386 "parse.y" +#line 4388 "parse.y" { yyval.v.tagged.neg = 0; yyval.v.tagged.name = NULL; } break; case 415: -#line 4387 "parse.y" +#line 4389 "parse.y" { yyval.v.tagged.neg = yystack.l_mark[-2].v.number; yyval.v.tagged.name = yystack.l_mark[0].v.string; } break; case 416: -#line 4390 "parse.y" +#line 4392 "parse.y" { yyval.v.rtableid = -1; } break; case 417: -#line 4391 "parse.y" +#line 4393 "parse.y" { if (yystack.l_mark[0].v.number < 0 || yystack.l_mark[0].v.number > rt_tableid_max()) { yyerror("invalid rtable id"); @@ -9120,7 +9120,7 @@ case 417: } break; case 418: -#line 4400 "parse.y" +#line 4402 "parse.y" { yyval.v.host = calloc(1, sizeof(struct node_host)); if (yyval.v.host == NULL) @@ -9132,18 +9132,21 @@ case 418: } break; case 419: -#line 4409 "parse.y" +#line 4411 "parse.y" { + struct node_host *n; + yyval.v.host = yystack.l_mark[-1].v.host; - yyval.v.host->ifname = yystack.l_mark[-2].v.string; + for (n = yystack.l_mark[-1].v.host; n != NULL; n = n->next) + n->ifname = yystack.l_mark[-2].v.string; } break; case 420: -#line 4415 "parse.y" +#line 4420 "parse.y" { yyval.v.host = yystack.l_mark[-1].v.host; } break; case 421: -#line 4416 "parse.y" +#line 4421 "parse.y" { if (yystack.l_mark[-3].v.host->af == 0) yystack.l_mark[-3].v.host->af = yystack.l_mark[-1].v.host->af; @@ -9158,15 +9161,15 @@ case 421: } break; case 422: -#line 4430 "parse.y" +#line 4435 "parse.y" { yyval.v.host = yystack.l_mark[0].v.host; } break; case 423: -#line 4431 "parse.y" +#line 4436 "parse.y" { yyval.v.host = yystack.l_mark[-1].v.host; } break; case 424: -#line 4434 "parse.y" +#line 4439 "parse.y" { yyval.v.route.host = NULL; yyval.v.route.rt = 0; @@ -9174,7 +9177,7 @@ case 424: } break; case 425: -#line 4439 "parse.y" +#line 4444 "parse.y" { /* backwards-compat */ yyval.v.route.host = NULL; @@ -9183,7 +9186,7 @@ case 425: } break; case 426: -#line 4445 "parse.y" +#line 4450 "parse.y" { yyval.v.route.host = yystack.l_mark[-1].v.host; yyval.v.route.rt = PF_ROUTETO; @@ -9193,7 +9196,7 @@ case 426: } break; case 427: -#line 4452 "parse.y" +#line 4457 "parse.y" { yyval.v.route.host = yystack.l_mark[-1].v.host; yyval.v.route.rt = PF_REPLYTO; @@ -9203,7 +9206,7 @@ case 427: } break; case 428: -#line 4459 "parse.y" +#line 4464 "parse.y" { yyval.v.route.host = yystack.l_mark[-1].v.host; yyval.v.route.rt = PF_DUPTO; @@ -9213,7 +9216,7 @@ case 428: } break; case 429: -#line 4469 "parse.y" +#line 4474 "parse.y" { if (check_rulestate(PFCTL_STATE_OPTION)) { free(yystack.l_mark[-1].v.string); @@ -9232,7 +9235,7 @@ case 429: } break; case 430: -#line 4485 "parse.y" +#line 4490 "parse.y" { if (check_rulestate(PFCTL_STATE_OPTION)) YYERROR; @@ -9245,7 +9248,7 @@ case 430: } break; case 433: -#line 4502 "parse.y" +#line 4507 "parse.y" { if (check_rulestate(PFCTL_STATE_OPTION)) { free(yystack.l_mark[-1].v.string); @@ -9264,11 +9267,11 @@ case 433: } break; case 438: -#line 4528 "parse.y" +#line 4533 "parse.y" { yyval.v.number = 0; } break; case 439: -#line 4529 "parse.y" +#line 4534 "parse.y" { if (!strcmp(yystack.l_mark[0].v.string, "yes")) yyval.v.number = 1; @@ -9282,30 +9285,30 @@ case 439: } break; case 440: -#line 4542 "parse.y" +#line 4547 "parse.y" { yyval.v.i = PF_OP_EQ; } break; case 441: -#line 4543 "parse.y" +#line 4548 "parse.y" { yyval.v.i = PF_OP_NE; } break; case 442: -#line 4544 "parse.y" +#line 4549 "parse.y" { yyval.v.i = PF_OP_LE; } break; case 443: -#line 4545 "parse.y" +#line 4550 "parse.y" { yyval.v.i = PF_OP_LT; } break; case 444: -#line 4546 "parse.y" +#line 4551 "parse.y" { yyval.v.i = PF_OP_GE; } break; case 445: -#line 4547 "parse.y" +#line 4552 "parse.y" { yyval.v.i = PF_OP_GT; } break; -#line 9311 "parse.c" +#line 9314 "parse.c" } yystack.s_mark -= yym; yystate = *yystack.s_mark; diff --git a/freebsd/sbin/pfctl/parse.y b/freebsd/sbin/pfctl/parse.y index 8116ba14..11fe33b9 100644 --- a/freebsd/sbin/pfctl/parse.y +++ b/freebsd/sbin/pfctl/parse.y @@ -1,6 +1,8 @@ /* $OpenBSD: parse.y,v 1.554 2008/10/17 12:59:53 henning Exp $ */ -/* +/*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2001 Markus Friedl. All rights reserved. * Copyright (c) 2001 Daniel Hartmeier. All rights reserved. * Copyright (c) 2001 Theo de Raadt. All rights reserved. @@ -4407,8 +4409,11 @@ route_host : STRING { $$->tail = $$; } | '(' STRING host ')' { + struct node_host *n; + $$ = $3; - $$->ifname = $2; + for (n = $3; n != NULL; n = n->next) + n->ifname = $2; } ; diff --git a/freebsd/sbin/pfctl/pf_print_state.c b/freebsd/sbin/pfctl/pf_print_state.c index 1e09a01f..723b358b 100644 --- a/freebsd/sbin/pfctl/pf_print_state.c +++ b/freebsd/sbin/pfctl/pf_print_state.c @@ -6,7 +6,9 @@ /* $OpenBSD: pf_print_state.c,v 1.52 2008/08/12 16:40:18 david Exp $ */ -/* +/*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2001 Daniel Hartmeier * All rights reserved. * diff --git a/freebsd/sbin/pfctl/pfctl.c b/freebsd/sbin/pfctl/pfctl.c index fb22a5d4..f0b963df 100644 --- a/freebsd/sbin/pfctl/pfctl.c +++ b/freebsd/sbin/pfctl/pfctl.c @@ -7,7 +7,9 @@ /* $OpenBSD: pfctl.c,v 1.278 2008/08/31 20:18:17 jmc Exp $ */ -/* +/*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2001 Daniel Hartmeier * Copyright (c) 2002,2003 Henning Brauer * All rights reserved. diff --git a/freebsd/sbin/pfctl/pfctl.h b/freebsd/sbin/pfctl/pfctl.h index 2c69bc20..a432f109 100644 --- a/freebsd/sbin/pfctl/pfctl.h +++ b/freebsd/sbin/pfctl/pfctl.h @@ -1,6 +1,8 @@ /* $OpenBSD: pfctl.h,v 1.42 2007/12/05 12:01:47 chl Exp $ */ -/* +/*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2001 Daniel Hartmeier * All rights reserved. * diff --git a/freebsd/sbin/pfctl/pfctl_parser.c b/freebsd/sbin/pfctl/pfctl_parser.c index 5206c769..88646e79 100644 --- a/freebsd/sbin/pfctl/pfctl_parser.c +++ b/freebsd/sbin/pfctl/pfctl_parser.c @@ -8,7 +8,9 @@ /* $OpenBSD: pfctl_parser.c,v 1.240 2008/06/10 20:55:02 mcbride Exp $ */ -/* +/*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2001 Daniel Hartmeier * Copyright (c) 2002,2003 Henning Brauer * All rights reserved. diff --git a/freebsd/sbin/pfctl/pfctl_parser.h b/freebsd/sbin/pfctl/pfctl_parser.h index 2b7fea7b..e652c97c 100644 --- a/freebsd/sbin/pfctl/pfctl_parser.h +++ b/freebsd/sbin/pfctl/pfctl_parser.h @@ -1,6 +1,8 @@ /* $OpenBSD: pfctl_parser.h,v 1.86 2006/10/31 23:46:25 mcbride Exp $ */ -/* +/*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2001 Daniel Hartmeier * All rights reserved. * diff --git a/freebsd/sbin/pfctl/pfctl_radix.c b/freebsd/sbin/pfctl/pfctl_radix.c index c151f878..65ae3e54 100644 --- a/freebsd/sbin/pfctl/pfctl_radix.c +++ b/freebsd/sbin/pfctl/pfctl_radix.c @@ -6,7 +6,9 @@ /* $OpenBSD: pfctl_radix.c,v 1.27 2005/05/21 21:03:58 henning Exp $ */ -/* +/*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2002 Cedric Berger * All rights reserved. * diff --git a/freebsd/sbin/pfctl/pfctl_table.c b/freebsd/sbin/pfctl/pfctl_table.c index 4dfb0689..1cc6019b 100644 --- a/freebsd/sbin/pfctl/pfctl_table.c +++ b/freebsd/sbin/pfctl/pfctl_table.c @@ -6,7 +6,9 @@ /* $OpenBSD: pfctl_table.c,v 1.67 2008/06/10 20:55:02 mcbride Exp $ */ -/* +/*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2002 Cedric Berger * All rights reserved. * diff --git a/freebsd/sbin/ping/ping.c b/freebsd/sbin/ping/ping.c index e0897962..4c8f7cc8 100644 --- a/freebsd/sbin/ping/ping.c +++ b/freebsd/sbin/ping/ping.c @@ -4,7 +4,9 @@ #include "rtems-bsd-ping-namespace.h" #endif /* __rtems__ */ -/* +/*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1989, 1993 * The Regents of the University of California. All rights reserved. * @@ -88,10 +90,8 @@ __FBSDID("$FreeBSD$"); #include <netinet/ip_var.h> #include <arpa/inet.h> -#ifdef WITH_CASPER #include <libcasper.h> #include <casper/cap_dns.h> -#endif #ifdef IPSEC #include <netipsec/ipsec.h> @@ -224,19 +224,19 @@ static volatile sig_atomic_t finish_up; static volatile sig_atomic_t siginfo_p; #endif /* __rtems__ */ -#ifdef WITH_CASPER +#ifndef __rtems__ static cap_channel_t *capdns; -#endif -#ifdef __rtems__ +#else /* __rtems__ */ +#define capdns NULL static u_char packet[IP_MAXPACKET] __aligned(4); static char hnamebuf[MAXHOSTNAMELEN], snamebuf[MAXHOSTNAMELEN]; #endif /* __rtems__ */ static void fill(char *, char *); static u_short in_cksum(u_short *, int); -#ifdef WITH_CASPER +#ifndef __rtems__ static cap_channel_t *capdns_setup(void); -#endif +#endif /* __rtems__ */ static void check_status(void); static void finish(void) __dead2; static void pinger(void); @@ -632,21 +632,19 @@ main(int argc, char *const *argv) if (options & F_PINGFILLED) { fill((char *)datap, payload); } -#ifdef WITH_CASPER +#ifndef __rtems__ capdns = capdns_setup(); -#endif +#endif /* __rtems__ */ if (source) { bzero((char *)&sock_in, sizeof(sock_in)); sock_in.sin_family = AF_INET; if (inet_aton(source, &sock_in.sin_addr) != 0) { shostname = source; } else { -#ifdef WITH_CASPER if (capdns != NULL) hp = cap_gethostbyname2(capdns, source, AF_INET); else -#endif hp = gethostbyname2(source, AF_INET); if (!hp) errx(EX_NOHOST, "cannot resolve %s: %s", @@ -675,11 +673,9 @@ main(int argc, char *const *argv) if (inet_aton(target, &to->sin_addr) != 0) { hostname = target; } else { -#ifdef WITH_CASPER if (capdns != NULL) hp = cap_gethostbyname2(capdns, target, AF_INET); else -#endif hp = gethostbyname2(target, AF_INET); if (!hp) errx(EX_NOHOST, "cannot resolve %s: %s", @@ -693,7 +689,7 @@ main(int argc, char *const *argv) hostname = hnamebuf; } -#ifdef WITH_CASPER +#ifndef __rtems__ /* From now on we will use only reverse DNS lookups. */ if (capdns != NULL) { const char *types[1]; @@ -702,7 +698,7 @@ main(int argc, char *const *argv) if (cap_dns_type_limit(capdns, types, 1) < 0) err(1, "unable to limit access to system.dns service"); } -#endif +#endif /* __rtems__ */ if (connect(ssend, (struct sockaddr *)&whereto, sizeof(whereto)) != 0) err(1, "connect"); @@ -791,10 +787,8 @@ main(int argc, char *const *argv) if (options & F_NUMERIC) cansandbox = true; -#ifdef WITH_CASPER else if (capdns != NULL) - cansandbox = true; -#endif + cansandbox = CASPER_SUPPORT; else cansandbox = false; @@ -1784,11 +1778,9 @@ pr_addr(struct in_addr ina) if (options & F_NUMERIC) return inet_ntoa(ina); -#ifdef WITH_CASPER if (capdns != NULL) hp = cap_gethostbyaddr(capdns, (char *)&ina, 4, AF_INET); else -#endif hp = gethostbyaddr((char *)&ina, 4, AF_INET); if (hp == NULL) @@ -1868,7 +1860,7 @@ fill(char *bp, char *patp) } } -#ifdef WITH_CASPER +#ifndef __rtems__ static cap_channel_t * capdns_setup(void) { @@ -1894,7 +1886,7 @@ capdns_setup(void) return (capdnsloc); } -#endif /* WITH_CASPER */ +#endif /* __rtems__ */ #if defined(IPSEC) && defined(IPSEC_POLICY_IPSEC) #define SECOPT " [-P policy]" diff --git a/freebsd/sbin/ping6/ping6.c b/freebsd/sbin/ping6/ping6.c index 972ef38e..c95572b0 100644 --- a/freebsd/sbin/ping6/ping6.c +++ b/freebsd/sbin/ping6/ping6.c @@ -6,7 +6,9 @@ /* $KAME: ping6.c,v 1.169 2003/07/25 06:01:47 itojun Exp $ */ -/* +/*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. * All rights reserved. * diff --git a/freebsd/sbin/route/route.c b/freebsd/sbin/route/route.c index 45063cca..e994dfcc 100644 --- a/freebsd/sbin/route/route.c +++ b/freebsd/sbin/route/route.c @@ -4,7 +4,9 @@ #include "rtems-bsd-route-namespace.h" #endif /* __rtems__ */ -/* +/*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1983, 1989, 1991, 1993 * The Regents of the University of California. All rights reserved. * diff --git a/freebsd/sbin/sysctl/sysctl.c b/freebsd/sbin/sysctl/sysctl.c index c6907afe..d69d1ac5 100644 --- a/freebsd/sbin/sysctl/sysctl.c +++ b/freebsd/sbin/sysctl/sysctl.c @@ -4,7 +4,9 @@ #include "rtems-bsd-sysctl-namespace.h" #endif /* __rtems__ */ -/* +/*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1993 * The Regents of the University of California. All rights reserved. * @@ -655,33 +657,33 @@ S_timeval(size_t l2, void *p) static int S_vmtotal(size_t l2, void *p) { - struct vmtotal *v = (struct vmtotal *)p; - int pageKilo = getpagesize() / 1024; + struct vmtotal *v; + int pageKilo; if (l2 != sizeof(*v)) { warnx("S_vmtotal %zu != %zu", l2, sizeof(*v)); return (1); } - printf( - "\nSystem wide totals computed every five seconds:" + v = p; + pageKilo = getpagesize() / 1024; + +#define pg2k(a) ((uintmax_t)(a) * pageKilo) + printf("\nSystem wide totals computed every five seconds:" " (values in kilobytes)\n"); printf("===============================================\n"); - printf( - "Processes:\t\t(RUNQ: %hd Disk Wait: %hd Page Wait: " - "%hd Sleep: %hd)\n", + printf("Processes:\t\t(RUNQ: %d Disk Wait: %d Page Wait: " + "%d Sleep: %d)\n", v->t_rq, v->t_dw, v->t_pw, v->t_sl); - printf( - "Virtual Memory:\t\t(Total: %jdK Active: %jdK)\n", - (intmax_t)v->t_vm * pageKilo, (intmax_t)v->t_avm * pageKilo); - printf("Real Memory:\t\t(Total: %jdK Active: %jdK)\n", - (intmax_t)v->t_rm * pageKilo, (intmax_t)v->t_arm * pageKilo); - printf("Shared Virtual Memory:\t(Total: %jdK Active: %jdK)\n", - (intmax_t)v->t_vmshr * pageKilo, (intmax_t)v->t_avmshr * pageKilo); - printf("Shared Real Memory:\t(Total: %jdK Active: %jdK)\n", - (intmax_t)v->t_rmshr * pageKilo, (intmax_t)v->t_armshr * pageKilo); - printf("Free Memory:\t%jdK", (intmax_t)v->t_free * pageKilo); - + printf("Virtual Memory:\t\t(Total: %juK Active: %juK)\n", + pg2k(v->t_vm), pg2k(v->t_avm)); + printf("Real Memory:\t\t(Total: %juK Active: %juK)\n", + pg2k(v->t_rm), pg2k(v->t_arm)); + printf("Shared Virtual Memory:\t(Total: %juK Active: %juK)\n", + pg2k(v->t_vmshr), pg2k(v->t_avmshr)); + printf("Shared Real Memory:\t(Total: %juK Active: %juK)\n", + pg2k(v->t_rmshr), pg2k(v->t_armshr)); + printf("Free Memory:\t%juK", pg2k(v->t_free)); return (0); } @@ -742,8 +744,9 @@ S_efi_map(size_t l2, void *p) type = types[map->md_type]; else type = "<INVALID>"; - printf("\n%23s %012lx %12p %08lx ", type, map->md_phys, - map->md_virt, map->md_pages); + printf("\n%23s %012jx %12p %08jx ", type, + (uintmax_t)map->md_phys, map->md_virt, + (uintmax_t)map->md_pages); if (map->md_attr & EFI_MD_ATTR_UC) printf("UC "); if (map->md_attr & EFI_MD_ATTR_WC) diff --git a/freebsd/sys/arm/at91/at91_mci.c b/freebsd/sys/arm/at91/at91_mci.c index 206f782d..6f5ace83 100644 --- a/freebsd/sys/arm/at91/at91_mci.c +++ b/freebsd/sys/arm/at91/at91_mci.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2006 Bernd Walter. All rights reserved. * Copyright (c) 2006 M. Warner Losh. All rights reserved. * Copyright (c) 2010 Greg Ansley. All rights reserved. diff --git a/freebsd/sys/arm/at91/at91_mcireg.h b/freebsd/sys/arm/at91/at91_mcireg.h index b79582bd..eec67857 100644 --- a/freebsd/sys/arm/at91/at91_mcireg.h +++ b/freebsd/sys/arm/at91/at91_mcireg.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2006 Berndt Walter. All rights reserved. * Copyright (c) 2006 M. Warner Losh. All rights reserved. * diff --git a/freebsd/sys/arm/at91/at91_pdcreg.h b/freebsd/sys/arm/at91/at91_pdcreg.h index d15c22a7..88389e00 100644 --- a/freebsd/sys/arm/at91/at91_pdcreg.h +++ b/freebsd/sys/arm/at91/at91_pdcreg.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2006 M. Warner Losh. All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/freebsd/sys/arm/at91/at91reg.h b/freebsd/sys/arm/at91/at91reg.h index 8dbf4d0b..f5791bd7 100644 --- a/freebsd/sys/arm/at91/at91reg.h +++ b/freebsd/sys/arm/at91/at91reg.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2009 Greg Ansley All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/freebsd/sys/arm/at91/at91var.h b/freebsd/sys/arm/at91/at91var.h index 46227a0d..84c898fb 100644 --- a/freebsd/sys/arm/at91/at91var.h +++ b/freebsd/sys/arm/at91/at91var.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2005 Olivier Houchard. All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/freebsd/sys/arm/include/machine/cpufunc.h b/freebsd/sys/arm/include/machine/cpufunc.h index 18c57f7f..e3ada92b 100644 --- a/freebsd/sys/arm/include/machine/cpufunc.h +++ b/freebsd/sys/arm/include/machine/cpufunc.h @@ -1,6 +1,8 @@ /* $NetBSD: cpufunc.h,v 1.29 2003/09/06 09:08:35 rearnsha Exp $ */ /*- + * SPDX-License-Identifier: BSD-4-Clause + * * Copyright (c) 1997 Mark Brinicombe. * Copyright (c) 1997 Causality Limited * All rights reserved. diff --git a/freebsd/sys/arm/include/machine/in_cksum.h b/freebsd/sys/arm/include/machine/in_cksum.h index 72edfba9..d55b838b 100644 --- a/freebsd/sys/arm/include/machine/in_cksum.h +++ b/freebsd/sys/arm/include/machine/in_cksum.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1990 The Regents of the University of California. * All rights reserved. * diff --git a/freebsd/sys/arm/lpc/if_lpe.c b/freebsd/sys/arm/lpc/if_lpe.c index d9c1e381..99016be3 100755 --- a/freebsd/sys/arm/lpc/if_lpe.c +++ b/freebsd/sys/arm/lpc/if_lpe.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2011 Jakub Wojciech Klama <jceel@FreeBSD.org> * All rights reserved. * diff --git a/freebsd/sys/arm/lpc/if_lpereg.h b/freebsd/sys/arm/lpc/if_lpereg.h index 8e1512be..a40bf8b5 100644 --- a/freebsd/sys/arm/lpc/if_lpereg.h +++ b/freebsd/sys/arm/lpc/if_lpereg.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2011 Jakub Wojciech Klama <jceel@FreeBSD.org> * All rights reserved. * diff --git a/freebsd/sys/arm/lpc/lpc_pwr.c b/freebsd/sys/arm/lpc/lpc_pwr.c index 70ffe902..dd1064c8 100755 --- a/freebsd/sys/arm/lpc/lpc_pwr.c +++ b/freebsd/sys/arm/lpc/lpc_pwr.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2011 Jakub Wojciech Klama <jceel@FreeBSD.org> * All rights reserved. * diff --git a/freebsd/sys/arm/lpc/lpcreg.h b/freebsd/sys/arm/lpc/lpcreg.h index b63dfbc5..d094e8f9 100644 --- a/freebsd/sys/arm/lpc/lpcreg.h +++ b/freebsd/sys/arm/lpc/lpcreg.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2011 Jakub Wojciech Klama <jceel@FreeBSD.org> * All rights reserved. * diff --git a/freebsd/sys/arm/lpc/lpcvar.h b/freebsd/sys/arm/lpc/lpcvar.h index ed05320c..dafbef08 100644 --- a/freebsd/sys/arm/lpc/lpcvar.h +++ b/freebsd/sys/arm/lpc/lpcvar.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2011 Jakub Wojciech Klama <jceel@FreeBSD.org> * All rights reserved. * diff --git a/freebsd/sys/arm/ti/am335x/am335x_prcm.c b/freebsd/sys/arm/ti/am335x/am335x_prcm.c index bc61c9f8..83faafbd 100644 --- a/freebsd/sys/arm/ti/am335x/am335x_prcm.c +++ b/freebsd/sys/arm/ti/am335x/am335x_prcm.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2012 Damjan Marion <dmarion@Freebsd.org> * All rights reserved. * diff --git a/freebsd/sys/arm/ti/am335x/am335x_scm.h b/freebsd/sys/arm/ti/am335x/am335x_scm.h index 6116be06..ff7af52f 100644 --- a/freebsd/sys/arm/ti/am335x/am335x_scm.h +++ b/freebsd/sys/arm/ti/am335x/am335x_scm.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2012 Oleksandr Tymoshenko <gonzo@freebsd.org> * All rights reserved. * diff --git a/freebsd/sys/arm/ti/am335x/am335x_usbss.c b/freebsd/sys/arm/ti/am335x/am335x_usbss.c index 8369171d..322bb43a 100644 --- a/freebsd/sys/arm/ti/am335x/am335x_usbss.c +++ b/freebsd/sys/arm/ti/am335x/am335x_usbss.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2013 Oleksandr Tymoshenko <gonzo@freebsd.org> * * Redistribution and use in source and binary forms, with or without diff --git a/freebsd/sys/arm/ti/ti_cpuid.h b/freebsd/sys/arm/ti/ti_cpuid.h index 7a3fcd5e..b76e65e8 100644 --- a/freebsd/sys/arm/ti/ti_cpuid.h +++ b/freebsd/sys/arm/ti/ti_cpuid.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2011 * Ben Gray <ben.r.gray@gmail.com>. * All rights reserved. diff --git a/freebsd/sys/arm/ti/ti_prcm.c b/freebsd/sys/arm/ti/ti_prcm.c index b4dd03fb..0eac4dfd 100644 --- a/freebsd/sys/arm/ti/ti_prcm.c +++ b/freebsd/sys/arm/ti/ti_prcm.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> -/* +/*- + * SPDX-License-Identifier: BSD-4-Clause + * * Copyright (c) 2010 * Ben Gray <ben.r.gray@gmail.com>. * All rights reserved. diff --git a/freebsd/sys/arm/ti/ti_prcm.h b/freebsd/sys/arm/ti/ti_prcm.h index 61b69607..6df39436 100644 --- a/freebsd/sys/arm/ti/ti_prcm.h +++ b/freebsd/sys/arm/ti/ti_prcm.h @@ -1,4 +1,6 @@ -/* +/*- + * SPDX-License-Identifier: BSD-4-Clause + * * Copyright (c) 2010 * Ben Gray <ben.r.gray@gmail.com>. * All rights reserved. diff --git a/freebsd/sys/arm/ti/ti_scm.c b/freebsd/sys/arm/ti/ti_scm.c index 96b284c9..28eaf42a 100644 --- a/freebsd/sys/arm/ti/ti_scm.c +++ b/freebsd/sys/arm/ti/ti_scm.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> -/* +/*- + * SPDX-License-Identifier: BSD-4-Clause + * * Copyright (c) 2010 * Ben Gray <ben.r.gray@gmail.com>. * All rights reserved. diff --git a/freebsd/sys/arm/ti/ti_scm.h b/freebsd/sys/arm/ti/ti_scm.h index 1342ddc6..f1df004e 100644 --- a/freebsd/sys/arm/ti/ti_scm.h +++ b/freebsd/sys/arm/ti/ti_scm.h @@ -1,4 +1,6 @@ -/* +/*- + * SPDX-License-Identifier: BSD-4-Clause + * * Copyright (c) 2010 * Ben Gray <ben.r.gray@gmail.com>. * All rights reserved. diff --git a/freebsd/sys/arm/ti/ti_sdhci.c b/freebsd/sys/arm/ti/ti_sdhci.c index 58d178a0..c5d29cb6 100644 --- a/freebsd/sys/arm/ti/ti_sdhci.c +++ b/freebsd/sys/arm/ti/ti_sdhci.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2013 Ian Lepore <ian@freebsd.org> * Copyright (c) 2011 Ben Gray <ben.r.gray@gmail.com>. * All rights reserved. diff --git a/freebsd/sys/arm/ti/tivar.h b/freebsd/sys/arm/ti/tivar.h index 248ad901..ecc0a448 100644 --- a/freebsd/sys/arm/ti/tivar.h +++ b/freebsd/sys/arm/ti/tivar.h @@ -1,4 +1,6 @@ -/* +/*- + * SPDX-License-Identifier: BSD-4-Clause + * * Copyright (c) 2010 * Ben Gray <ben.r.gray@gmail.com>. * All rights reserved. diff --git a/freebsd/sys/arm/xilinx/zy7_slcr.c b/freebsd/sys/arm/xilinx/zy7_slcr.c index 57b9ff72..79fccee5 100644 --- a/freebsd/sys/arm/xilinx/zy7_slcr.c +++ b/freebsd/sys/arm/xilinx/zy7_slcr.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2013 Thomas Skibo * All rights reserved. * diff --git a/freebsd/sys/arm/xilinx/zy7_slcr.h b/freebsd/sys/arm/xilinx/zy7_slcr.h index 3afec02a..d1e1641f 100644 --- a/freebsd/sys/arm/xilinx/zy7_slcr.h +++ b/freebsd/sys/arm/xilinx/zy7_slcr.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2013 Thomas Skibo * All rights reserved. * diff --git a/freebsd/sys/avr/include/machine/in_cksum.h b/freebsd/sys/avr/include/machine/in_cksum.h index 72edfba9..d55b838b 100644 --- a/freebsd/sys/avr/include/machine/in_cksum.h +++ b/freebsd/sys/avr/include/machine/in_cksum.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1990 The Regents of the University of California. * All rights reserved. * diff --git a/freebsd/sys/bfin/include/machine/in_cksum.h b/freebsd/sys/bfin/include/machine/in_cksum.h index 72edfba9..d55b838b 100644 --- a/freebsd/sys/bfin/include/machine/in_cksum.h +++ b/freebsd/sys/bfin/include/machine/in_cksum.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1990 The Regents of the University of California. * All rights reserved. * diff --git a/freebsd/sys/bsm/audit.h b/freebsd/sys/bsm/audit.h index 57edb5e4..adbaa46a 100644 --- a/freebsd/sys/bsm/audit.h +++ b/freebsd/sys/bsm/audit.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 2005-2009 Apple Inc. * Copyright (c) 2016 Robert N. M. Watson * All rights reserved. diff --git a/freebsd/sys/bsm/audit_kevents.h b/freebsd/sys/bsm/audit_kevents.h index fb80c124..277e721d 100644 --- a/freebsd/sys/bsm/audit_kevents.h +++ b/freebsd/sys/bsm/audit_kevents.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 2005-2009 Apple Inc. * All rights reserved. * diff --git a/freebsd/sys/cam/ata/ata_all.h b/freebsd/sys/cam/ata/ata_all.h index a279aa91..087d6820 100644 --- a/freebsd/sys/cam/ata/ata_all.h +++ b/freebsd/sys/cam/ata/ata_all.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2009 Alexander Motin <mav@FreeBSD.org> * All rights reserved. * diff --git a/freebsd/sys/cam/cam.c b/freebsd/sys/cam/cam.c index b6bc10d3..5d07bebf 100644 --- a/freebsd/sys/cam/cam.c +++ b/freebsd/sys/cam/cam.c @@ -3,6 +3,8 @@ /*- * Generic utility routines for the Common Access Method layer. * + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 1997 Justin T. Gibbs. * All rights reserved. * @@ -237,29 +239,35 @@ cam_strmatch(const u_int8_t *str, const u_int8_t *pattern, int str_len) return (1); } else if (*pattern == '[') { int negate_range, ok; - uint8_t pc, sc; + uint8_t pc = UCHAR_MAX; + uint8_t sc; ok = 0; sc = *str++; str_len--; + pattern++; if ((negate_range = (*pattern == '^')) != 0) pattern++; - while (((pc = *pattern) != ']') && *pattern != '\0') { - pattern++; + while ((*pattern != ']') && *pattern != '\0') { if (*pattern == '-') { if (pattern[1] == '\0') /* Bad pattern */ return (1); if (sc >= pc && sc <= pattern[1]) ok = 1; - pattern += 2; - } else if (pc == sc) + pattern++; + } else if (*pattern == sc) ok = 1; + pc = *pattern; + pattern++; } if (ok == negate_range) return (1); + pattern++; } else if (*pattern == '?') { - /* NB: || *str == ' ' of the old code is a bug and was removed */ - /* if you add it back, keep this the last if before the naked else */ + /* + * NB: || *str == ' ' of the old code is a bug and was + * removed. If you add it back, keep this the last if + * before the naked else */ pattern++; str++; str_len--; @@ -271,6 +279,17 @@ cam_strmatch(const u_int8_t *str, const u_int8_t *pattern, int str_len) str_len--; } } + + /* '*' is allowed to match nothing, so gobble it */ + while (*pattern == '*') + pattern++; + + if ( *pattern != '\0') { + /* Pattern not fully consumed. Not a match */ + return (1); + } + + /* Eat trailing spaces, which get added by SAT */ while (str_len > 0 && *str == ' ') { str++; str_len--; diff --git a/freebsd/sys/cam/cam.h b/freebsd/sys/cam/cam.h index 4bd569be..4f9cddf3 100644 --- a/freebsd/sys/cam/cam.h +++ b/freebsd/sys/cam/cam.h @@ -1,6 +1,8 @@ /*- * Data structures and definitions for the CAM system. * + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 1997 Justin T. Gibbs. * All rights reserved. * diff --git a/freebsd/sys/cam/cam_ccb.h b/freebsd/sys/cam/cam_ccb.h index 97560848..8e88b4a3 100644 --- a/freebsd/sys/cam/cam_ccb.h +++ b/freebsd/sys/cam/cam_ccb.h @@ -1,6 +1,8 @@ /*- * Data structures and definitions for CAM Control Blocks (CCBs). * + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 1997, 1998 Justin T. Gibbs. * All rights reserved. * @@ -1039,11 +1041,14 @@ struct ccb_trans_settings_nvme u_int valid; /* Which fields to honor */ #define CTS_NVME_VALID_SPEC 0x01 #define CTS_NVME_VALID_CAPS 0x02 - u_int spec_major; /* Major version of spec supported */ - u_int spec_minor; /* Minor verison of spec supported */ - u_int spec_tiny; /* Tiny version of spec supported */ - u_int max_xfer; /* Max transfer size (0 -> unlimited */ - u_int caps; +#define CTS_NVME_VALID_LINK 0x04 + uint32_t spec; /* NVMe spec implemented -- same as vs register */ + uint32_t max_xfer; /* Max transfer size (0 -> unlimited */ + uint32_t caps; + uint8_t lanes; /* Number of PCIe lanes */ + uint8_t speed; /* PCIe generation for each lane */ + uint8_t max_lanes; /* Number of PCIe lanes */ + uint8_t max_speed; /* PCIe generation for each lane */ }; #include <cam/mmc/mmc_bus.h> diff --git a/freebsd/sys/cam/cam_debug.h b/freebsd/sys/cam/cam_debug.h index 7b619a29..b88c6b20 100644 --- a/freebsd/sys/cam/cam_debug.h +++ b/freebsd/sys/cam/cam_debug.h @@ -1,6 +1,8 @@ /*- * Macros for tracing/loging information in the CAM layer * + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 1997 Justin T. Gibbs. * All rights reserved. * diff --git a/freebsd/sys/cam/cam_periph.h b/freebsd/sys/cam/cam_periph.h index 87f153c3..b7f0618e 100644 --- a/freebsd/sys/cam/cam_periph.h +++ b/freebsd/sys/cam/cam_periph.h @@ -1,6 +1,8 @@ /*- * Data structures and definitions for CAM peripheral ("type") drivers. * + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 1997, 1998 Justin T. Gibbs. * All rights reserved. * diff --git a/freebsd/sys/cam/cam_sim.h b/freebsd/sys/cam/cam_sim.h index 4c4c8c58..95dedb08 100644 --- a/freebsd/sys/cam/cam_sim.h +++ b/freebsd/sys/cam/cam_sim.h @@ -1,6 +1,8 @@ /*- * Data structures and definitions for SCSI Interface Modules (SIMs). * + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 1997 Justin T. Gibbs. * All rights reserved. * diff --git a/freebsd/sys/cam/cam_xpt.h b/freebsd/sys/cam/cam_xpt.h index 47fdbd74..8baec294 100644 --- a/freebsd/sys/cam/cam_xpt.h +++ b/freebsd/sys/cam/cam_xpt.h @@ -2,6 +2,8 @@ * Data structures and definitions for dealing with the * Common Access Method Transport (xpt) layer. * + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 1997 Justin T. Gibbs. * All rights reserved. * diff --git a/freebsd/sys/cam/cam_xpt_sim.h b/freebsd/sys/cam/cam_xpt_sim.h index c3575deb..87b57217 100644 --- a/freebsd/sys/cam/cam_xpt_sim.h +++ b/freebsd/sys/cam/cam_xpt_sim.h @@ -2,6 +2,8 @@ * Data structures and definitions for dealing with the * Common Access Method Transport (xpt) layer. * + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 1997 Justin T. Gibbs. * All rights reserved. * diff --git a/freebsd/sys/cam/nvme/nvme_all.h b/freebsd/sys/cam/nvme/nvme_all.h index b52b7a78..b2db4833 100644 --- a/freebsd/sys/cam/nvme/nvme_all.h +++ b/freebsd/sys/cam/nvme/nvme_all.h @@ -33,15 +33,14 @@ struct ccb_nvmeio; -#define NVME_REV_1 1 /* Supports NVMe 1.2 or earlier */ - void nvme_ns_cmd(struct ccb_nvmeio *nvmeio, uint8_t cmd, uint32_t nsid, uint32_t cdw10, uint32_t cdw11, uint32_t cdw12, uint32_t cdw13, uint32_t cdw14, uint32_t cdw15); int nvme_identify_match(caddr_t identbuffer, caddr_t table_entry); -void nvme_print_ident(const struct nvme_controller_data *, const struct nvme_namespace_data *); +struct sbuf; +void nvme_print_ident(const struct nvme_controller_data *, const struct nvme_namespace_data *, struct sbuf *); const char *nvme_op_string(const struct nvme_command *); const char *nvme_cmd_string(const struct nvme_command *, char *, size_t); const void *nvme_get_identify_cntrl(struct cam_periph *); diff --git a/freebsd/sys/cam/scsi/scsi_all.c b/freebsd/sys/cam/scsi/scsi_all.c index c13f5516..d344cc14 100644 --- a/freebsd/sys/cam/scsi/scsi_all.c +++ b/freebsd/sys/cam/scsi/scsi_all.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Implementation of Utility functions for all SCSI device types. * * Copyright (c) 1997, 1998, 1999 Justin T. Gibbs. diff --git a/freebsd/sys/crypto/sha1.c b/freebsd/sys/crypto/sha1.c index c21677ec..51eb8016 100644 --- a/freebsd/sys/crypto/sha1.c +++ b/freebsd/sys/crypto/sha1.c @@ -1,7 +1,9 @@ #include <machine/rtems-bsd-kernel-space.h> /* $KAME: sha1.c,v 1.5 2000/11/08 06:13:08 itojun Exp $ */ -/* +/*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. * All rights reserved. * diff --git a/freebsd/sys/crypto/sha1.h b/freebsd/sys/crypto/sha1.h index c1bc1a3a..95c07682 100644 --- a/freebsd/sys/crypto/sha1.h +++ b/freebsd/sys/crypto/sha1.h @@ -1,7 +1,9 @@ /* $FreeBSD$ */ /* $KAME: sha1.h,v 1.5 2000/03/27 04:36:23 sumikawa Exp $ */ -/* +/*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. * All rights reserved. * diff --git a/freebsd/sys/dev/bce/if_bce.c b/freebsd/sys/dev/bce/if_bce.c index 5901c472..a2e4c804 100644 --- a/freebsd/sys/dev/bce/if_bce.c +++ b/freebsd/sys/dev/bce/if_bce.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2006-2014 QLogic Corporation * * Redistribution and use in source and binary forms, with or without diff --git a/freebsd/sys/dev/bce/if_bcefw.h b/freebsd/sys/dev/bce/if_bcefw.h index cae01fea..4ba86701 100644 --- a/freebsd/sys/dev/bce/if_bcefw.h +++ b/freebsd/sys/dev/bce/if_bcefw.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2006-2014 QLogic Corporation * * Redistribution and use in source and binary forms, with or without diff --git a/freebsd/sys/dev/bce/if_bcereg.h b/freebsd/sys/dev/bce/if_bcereg.h index 2f166ead..d9bd23cc 100644 --- a/freebsd/sys/dev/bce/if_bcereg.h +++ b/freebsd/sys/dev/bce/if_bcereg.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 2006-2014 QLogic Corporation * * Redistribution and use in source and binary forms, with or without diff --git a/freebsd/sys/dev/bfe/if_bfe.c b/freebsd/sys/dev/bfe/if_bfe.c index c0bd4b26..63825a99 100644 --- a/freebsd/sys/dev/bfe/if_bfe.c +++ b/freebsd/sys/dev/bfe/if_bfe.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2003 Stuart Walsh<stu@ipng.org.uk> * and Duncan Barclay<dmlb@dmlb.org> * diff --git a/freebsd/sys/dev/bfe/if_bfereg.h b/freebsd/sys/dev/bfe/if_bfereg.h index b50627ed..668d2604 100644 --- a/freebsd/sys/dev/bfe/if_bfereg.h +++ b/freebsd/sys/dev/bfe/if_bfereg.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2003 Stuart Walsh * * Redistribution and use in source and binary forms, with or without diff --git a/freebsd/sys/dev/bge/if_bge.c b/freebsd/sys/dev/bge/if_bge.c index fad66e1e..956ee52f 100644 --- a/freebsd/sys/dev/bge/if_bge.c +++ b/freebsd/sys/dev/bge/if_bge.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-4-Clause + * * Copyright (c) 2001 Wind River Systems * Copyright (c) 1997, 1998, 1999, 2001 * Bill Paul <wpaul@windriver.com>. All rights reserved. diff --git a/freebsd/sys/dev/bge/if_bgereg.h b/freebsd/sys/dev/bge/if_bgereg.h index 0cf9ca18..eb7686e7 100644 --- a/freebsd/sys/dev/bge/if_bgereg.h +++ b/freebsd/sys/dev/bge/if_bgereg.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-4-Clause + * * Copyright (c) 2001 Wind River Systems * Copyright (c) 1997, 1998, 1999, 2001 * Bill Paul <wpaul@windriver.com>. All rights reserved. diff --git a/freebsd/sys/dev/cadence/if_cgem.c b/freebsd/sys/dev/cadence/if_cgem.c index 4f4114cf..42fd4213 100644 --- a/freebsd/sys/dev/cadence/if_cgem.c +++ b/freebsd/sys/dev/cadence/if_cgem.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2012-2014 Thomas Skibo <thomasskibo@yahoo.com> * All rights reserved. * diff --git a/freebsd/sys/dev/cadence/if_cgem_hw.h b/freebsd/sys/dev/cadence/if_cgem_hw.h index 30fb6dd3..1569857d 100644 --- a/freebsd/sys/dev/cadence/if_cgem_hw.h +++ b/freebsd/sys/dev/cadence/if_cgem_hw.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2012-2013 Thomas Skibo * All rights reserved. * diff --git a/freebsd/sys/dev/dc/dcphy.c b/freebsd/sys/dev/dc/dcphy.c index 35ab0353..de8fec09 100644 --- a/freebsd/sys/dev/dc/dcphy.c +++ b/freebsd/sys/dev/dc/dcphy.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-4-Clause + * * Copyright (c) 1997, 1998, 1999 * Bill Paul <wpaul@ee.columbia.edu>. All rights reserved. * diff --git a/freebsd/sys/dev/dc/if_dc.c b/freebsd/sys/dev/dc/if_dc.c index a0efd5ba..3339b83d 100644 --- a/freebsd/sys/dev/dc/if_dc.c +++ b/freebsd/sys/dev/dc/if_dc.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-4-Clause + * * Copyright (c) 1997, 1998, 1999 * Bill Paul <wpaul@ee.columbia.edu>. All rights reserved. * diff --git a/freebsd/sys/dev/dc/if_dcreg.h b/freebsd/sys/dev/dc/if_dcreg.h index e290881f..9ae26cc6 100644 --- a/freebsd/sys/dev/dc/if_dcreg.h +++ b/freebsd/sys/dev/dc/if_dcreg.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-4-Clause + * * Copyright (c) 1997, 1998, 1999 * Bill Paul <wpaul@ee.columbia.edu>. All rights reserved. * diff --git a/freebsd/sys/dev/dc/pnphy.c b/freebsd/sys/dev/dc/pnphy.c index 9848b461..c6f191fa 100644 --- a/freebsd/sys/dev/dc/pnphy.c +++ b/freebsd/sys/dev/dc/pnphy.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /* + * SPDX-License-Identifier: BSD-4-Clause + * * Copyright (c) 1997, 1998, 1999 * Bill Paul <wpaul@ee.columbia.edu>. All rights reserved. * diff --git a/freebsd/sys/dev/e1000/e1000_80003es2lan.c b/freebsd/sys/dev/e1000/e1000_80003es2lan.c index bd666441..50175d2a 100644 --- a/freebsd/sys/dev/e1000/e1000_80003es2lan.c +++ b/freebsd/sys/dev/e1000/e1000_80003es2lan.c @@ -1,6 +1,7 @@ #include <machine/rtems-bsd-kernel-space.h> /****************************************************************************** + SPDX-License-Identifier: BSD-3-Clause Copyright (c) 2001-2015, Intel Corporation All rights reserved. diff --git a/freebsd/sys/dev/e1000/e1000_80003es2lan.h b/freebsd/sys/dev/e1000/e1000_80003es2lan.h index 89b15512..cbf0eafa 100644 --- a/freebsd/sys/dev/e1000/e1000_80003es2lan.h +++ b/freebsd/sys/dev/e1000/e1000_80003es2lan.h @@ -1,4 +1,5 @@ /****************************************************************************** + SPDX-License-Identifier: BSD-3-Clause Copyright (c) 2001-2015, Intel Corporation All rights reserved. diff --git a/freebsd/sys/dev/e1000/e1000_82540.c b/freebsd/sys/dev/e1000/e1000_82540.c index e6311762..1243bdab 100644 --- a/freebsd/sys/dev/e1000/e1000_82540.c +++ b/freebsd/sys/dev/e1000/e1000_82540.c @@ -1,6 +1,7 @@ #include <machine/rtems-bsd-kernel-space.h> /****************************************************************************** + SPDX-License-Identifier: BSD-3-Clause Copyright (c) 2001-2015, Intel Corporation All rights reserved. diff --git a/freebsd/sys/dev/e1000/e1000_82541.c b/freebsd/sys/dev/e1000/e1000_82541.c index 770b3b7b..b6830b98 100644 --- a/freebsd/sys/dev/e1000/e1000_82541.c +++ b/freebsd/sys/dev/e1000/e1000_82541.c @@ -1,6 +1,7 @@ #include <machine/rtems-bsd-kernel-space.h> /****************************************************************************** + SPDX-License-Identifier: BSD-3-Clause Copyright (c) 2001-2015, Intel Corporation All rights reserved. diff --git a/freebsd/sys/dev/e1000/e1000_82541.h b/freebsd/sys/dev/e1000/e1000_82541.h index 7a01fd43..ce29548a 100644 --- a/freebsd/sys/dev/e1000/e1000_82541.h +++ b/freebsd/sys/dev/e1000/e1000_82541.h @@ -1,4 +1,5 @@ /****************************************************************************** + SPDX-License-Identifier: BSD-3-Clause Copyright (c) 2001-2015, Intel Corporation All rights reserved. diff --git a/freebsd/sys/dev/e1000/e1000_82542.c b/freebsd/sys/dev/e1000/e1000_82542.c index a21fec73..7bbcaead 100644 --- a/freebsd/sys/dev/e1000/e1000_82542.c +++ b/freebsd/sys/dev/e1000/e1000_82542.c @@ -1,6 +1,7 @@ #include <machine/rtems-bsd-kernel-space.h> /****************************************************************************** + SPDX-License-Identifier: BSD-3-Clause Copyright (c) 2001-2015, Intel Corporation All rights reserved. diff --git a/freebsd/sys/dev/e1000/e1000_82543.c b/freebsd/sys/dev/e1000/e1000_82543.c index 4930fc95..dbaa4a6e 100644 --- a/freebsd/sys/dev/e1000/e1000_82543.c +++ b/freebsd/sys/dev/e1000/e1000_82543.c @@ -1,6 +1,7 @@ #include <machine/rtems-bsd-kernel-space.h> /****************************************************************************** + SPDX-License-Identifier: BSD-3-Clause Copyright (c) 2001-2015, Intel Corporation All rights reserved. diff --git a/freebsd/sys/dev/e1000/e1000_82543.h b/freebsd/sys/dev/e1000/e1000_82543.h index e8edda5d..98289524 100644 --- a/freebsd/sys/dev/e1000/e1000_82543.h +++ b/freebsd/sys/dev/e1000/e1000_82543.h @@ -1,4 +1,5 @@ /****************************************************************************** + SPDX-License-Identifier: BSD-3-Clause Copyright (c) 2001-2015, Intel Corporation All rights reserved. diff --git a/freebsd/sys/dev/e1000/e1000_82571.c b/freebsd/sys/dev/e1000/e1000_82571.c index 2b72489a..fdef7284 100644 --- a/freebsd/sys/dev/e1000/e1000_82571.c +++ b/freebsd/sys/dev/e1000/e1000_82571.c @@ -1,6 +1,7 @@ #include <machine/rtems-bsd-kernel-space.h> /****************************************************************************** + SPDX-License-Identifier: BSD-3-Clause Copyright (c) 2001-2015, Intel Corporation All rights reserved. diff --git a/freebsd/sys/dev/e1000/e1000_82571.h b/freebsd/sys/dev/e1000/e1000_82571.h index 8e5ca56a..a39f63c5 100644 --- a/freebsd/sys/dev/e1000/e1000_82571.h +++ b/freebsd/sys/dev/e1000/e1000_82571.h @@ -1,4 +1,5 @@ /****************************************************************************** + SPDX-License-Identifier: BSD-3-Clause Copyright (c) 2001-2015, Intel Corporation All rights reserved. diff --git a/freebsd/sys/dev/e1000/e1000_82575.c b/freebsd/sys/dev/e1000/e1000_82575.c index ebf8371c..9958d98c 100644 --- a/freebsd/sys/dev/e1000/e1000_82575.c +++ b/freebsd/sys/dev/e1000/e1000_82575.c @@ -1,6 +1,7 @@ #include <machine/rtems-bsd-kernel-space.h> /****************************************************************************** + SPDX-License-Identifier: BSD-3-Clause Copyright (c) 2001-2015, Intel Corporation All rights reserved. diff --git a/freebsd/sys/dev/e1000/e1000_82575.h b/freebsd/sys/dev/e1000/e1000_82575.h index f8179560..7e127ed7 100644 --- a/freebsd/sys/dev/e1000/e1000_82575.h +++ b/freebsd/sys/dev/e1000/e1000_82575.h @@ -1,4 +1,5 @@ /****************************************************************************** + SPDX-License-Identifier: BSD-3-Clause Copyright (c) 2001-2015, Intel Corporation All rights reserved. diff --git a/freebsd/sys/dev/e1000/e1000_api.c b/freebsd/sys/dev/e1000/e1000_api.c index 829e7be0..393a22e2 100644 --- a/freebsd/sys/dev/e1000/e1000_api.c +++ b/freebsd/sys/dev/e1000/e1000_api.c @@ -1,6 +1,7 @@ #include <machine/rtems-bsd-kernel-space.h> /****************************************************************************** + SPDX-License-Identifier: BSD-3-Clause Copyright (c) 2001-2015, Intel Corporation All rights reserved. diff --git a/freebsd/sys/dev/e1000/e1000_api.h b/freebsd/sys/dev/e1000/e1000_api.h index 074197bf..bf5f637c 100644 --- a/freebsd/sys/dev/e1000/e1000_api.h +++ b/freebsd/sys/dev/e1000/e1000_api.h @@ -1,4 +1,5 @@ /****************************************************************************** + SPDX-License-Identifier: BSD-3-Clause Copyright (c) 2001-2015, Intel Corporation All rights reserved. diff --git a/freebsd/sys/dev/e1000/e1000_defines.h b/freebsd/sys/dev/e1000/e1000_defines.h index 4c2b0903..db7659e8 100644 --- a/freebsd/sys/dev/e1000/e1000_defines.h +++ b/freebsd/sys/dev/e1000/e1000_defines.h @@ -1,4 +1,5 @@ /****************************************************************************** + SPDX-License-Identifier: BSD-3-Clause Copyright (c) 2001-2015, Intel Corporation All rights reserved. diff --git a/freebsd/sys/dev/e1000/e1000_hw.h b/freebsd/sys/dev/e1000/e1000_hw.h index e1464a7b..82e783fe 100644 --- a/freebsd/sys/dev/e1000/e1000_hw.h +++ b/freebsd/sys/dev/e1000/e1000_hw.h @@ -1,4 +1,5 @@ /****************************************************************************** + SPDX-License-Identifier: BSD-3-Clause Copyright (c) 2001-2015, Intel Corporation All rights reserved. diff --git a/freebsd/sys/dev/e1000/e1000_i210.c b/freebsd/sys/dev/e1000/e1000_i210.c index 8f427b9a..5f09e4d2 100644 --- a/freebsd/sys/dev/e1000/e1000_i210.c +++ b/freebsd/sys/dev/e1000/e1000_i210.c @@ -1,6 +1,7 @@ #include <machine/rtems-bsd-kernel-space.h> /****************************************************************************** + SPDX-License-Identifier: BSD-3-Clause Copyright (c) 2001-2015, Intel Corporation All rights reserved. diff --git a/freebsd/sys/dev/e1000/e1000_i210.h b/freebsd/sys/dev/e1000/e1000_i210.h index f940915b..c08a0dd7 100644 --- a/freebsd/sys/dev/e1000/e1000_i210.h +++ b/freebsd/sys/dev/e1000/e1000_i210.h @@ -1,4 +1,5 @@ /****************************************************************************** + SPDX-License-Identifier: BSD-3-Clause Copyright (c) 2001-2015, Intel Corporation All rights reserved. diff --git a/freebsd/sys/dev/e1000/e1000_ich8lan.c b/freebsd/sys/dev/e1000/e1000_ich8lan.c index a620d126..b78b7283 100644 --- a/freebsd/sys/dev/e1000/e1000_ich8lan.c +++ b/freebsd/sys/dev/e1000/e1000_ich8lan.c @@ -1,6 +1,7 @@ #include <machine/rtems-bsd-kernel-space.h> /****************************************************************************** + SPDX-License-Identifier: BSD-3-Clause Copyright (c) 2001-2015, Intel Corporation All rights reserved. diff --git a/freebsd/sys/dev/e1000/e1000_ich8lan.h b/freebsd/sys/dev/e1000/e1000_ich8lan.h index 6d812911..d61f4df8 100644 --- a/freebsd/sys/dev/e1000/e1000_ich8lan.h +++ b/freebsd/sys/dev/e1000/e1000_ich8lan.h @@ -1,4 +1,5 @@ /****************************************************************************** + SPDX-License-Identifier: BSD-3-Clause Copyright (c) 2001-2015, Intel Corporation All rights reserved. diff --git a/freebsd/sys/dev/e1000/e1000_mac.c b/freebsd/sys/dev/e1000/e1000_mac.c index 2af37399..581659be 100644 --- a/freebsd/sys/dev/e1000/e1000_mac.c +++ b/freebsd/sys/dev/e1000/e1000_mac.c @@ -1,6 +1,7 @@ #include <machine/rtems-bsd-kernel-space.h> /****************************************************************************** + SPDX-License-Identifier: BSD-3-Clause Copyright (c) 2001-2015, Intel Corporation All rights reserved. diff --git a/freebsd/sys/dev/e1000/e1000_mac.h b/freebsd/sys/dev/e1000/e1000_mac.h index ef9789bb..cb8da246 100644 --- a/freebsd/sys/dev/e1000/e1000_mac.h +++ b/freebsd/sys/dev/e1000/e1000_mac.h @@ -1,4 +1,5 @@ /****************************************************************************** + SPDX-License-Identifier: BSD-3-Clause Copyright (c) 2001-2015, Intel Corporation All rights reserved. diff --git a/freebsd/sys/dev/e1000/e1000_manage.c b/freebsd/sys/dev/e1000/e1000_manage.c index 82456912..9f9ab336 100644 --- a/freebsd/sys/dev/e1000/e1000_manage.c +++ b/freebsd/sys/dev/e1000/e1000_manage.c @@ -1,6 +1,7 @@ #include <machine/rtems-bsd-kernel-space.h> /****************************************************************************** + SPDX-License-Identifier: BSD-3-Clause Copyright (c) 2001-2015, Intel Corporation All rights reserved. diff --git a/freebsd/sys/dev/e1000/e1000_manage.h b/freebsd/sys/dev/e1000/e1000_manage.h index 303e99e3..2ef2e3a4 100644 --- a/freebsd/sys/dev/e1000/e1000_manage.h +++ b/freebsd/sys/dev/e1000/e1000_manage.h @@ -1,4 +1,5 @@ /****************************************************************************** + SPDX-License-Identifier: BSD-3-Clause Copyright (c) 2001-2015, Intel Corporation All rights reserved. diff --git a/freebsd/sys/dev/e1000/e1000_mbx.c b/freebsd/sys/dev/e1000/e1000_mbx.c index 0c6bb2c2..dc1482da 100644 --- a/freebsd/sys/dev/e1000/e1000_mbx.c +++ b/freebsd/sys/dev/e1000/e1000_mbx.c @@ -1,6 +1,7 @@ #include <machine/rtems-bsd-kernel-space.h> /****************************************************************************** + SPDX-License-Identifier: BSD-3-Clause Copyright (c) 2001-2015, Intel Corporation All rights reserved. diff --git a/freebsd/sys/dev/e1000/e1000_mbx.h b/freebsd/sys/dev/e1000/e1000_mbx.h index fadd8494..f0b21992 100644 --- a/freebsd/sys/dev/e1000/e1000_mbx.h +++ b/freebsd/sys/dev/e1000/e1000_mbx.h @@ -1,4 +1,5 @@ /****************************************************************************** + SPDX-License-Identifier: BSD-3-Clause Copyright (c) 2001-2015, Intel Corporation All rights reserved. diff --git a/freebsd/sys/dev/e1000/e1000_nvm.c b/freebsd/sys/dev/e1000/e1000_nvm.c index a1e881ad..98cc0c98 100644 --- a/freebsd/sys/dev/e1000/e1000_nvm.c +++ b/freebsd/sys/dev/e1000/e1000_nvm.c @@ -1,6 +1,7 @@ #include <machine/rtems-bsd-kernel-space.h> /****************************************************************************** + SPDX-License-Identifier: BSD-3-Clause Copyright (c) 2001-2015, Intel Corporation All rights reserved. diff --git a/freebsd/sys/dev/e1000/e1000_nvm.h b/freebsd/sys/dev/e1000/e1000_nvm.h index 64a4083e..4f40f9ae 100644 --- a/freebsd/sys/dev/e1000/e1000_nvm.h +++ b/freebsd/sys/dev/e1000/e1000_nvm.h @@ -1,4 +1,5 @@ /****************************************************************************** + SPDX-License-Identifier: BSD-3-Clause Copyright (c) 2001-2015, Intel Corporation All rights reserved. diff --git a/freebsd/sys/dev/e1000/e1000_osdep.c b/freebsd/sys/dev/e1000/e1000_osdep.c index 45aae330..2e8dca62 100644 --- a/freebsd/sys/dev/e1000/e1000_osdep.c +++ b/freebsd/sys/dev/e1000/e1000_osdep.c @@ -1,6 +1,7 @@ #include <machine/rtems-bsd-kernel-space.h> /****************************************************************************** + SPDX-License-Identifier: BSD-3-Clause Copyright (c) 2001-2015, Intel Corporation All rights reserved. diff --git a/freebsd/sys/dev/e1000/e1000_osdep.h b/freebsd/sys/dev/e1000/e1000_osdep.h index c7c23e58..d9f956f3 100644 --- a/freebsd/sys/dev/e1000/e1000_osdep.h +++ b/freebsd/sys/dev/e1000/e1000_osdep.h @@ -1,4 +1,5 @@ /****************************************************************************** + SPDX-License-Identifier: BSD-3-Clause Copyright (c) 2001-2015, Intel Corporation All rights reserved. diff --git a/freebsd/sys/dev/e1000/e1000_phy.c b/freebsd/sys/dev/e1000/e1000_phy.c index 87753e19..c656a6f1 100644 --- a/freebsd/sys/dev/e1000/e1000_phy.c +++ b/freebsd/sys/dev/e1000/e1000_phy.c @@ -1,6 +1,7 @@ #include <machine/rtems-bsd-kernel-space.h> /****************************************************************************** + SPDX-License-Identifier: BSD-3-Clause Copyright (c) 2001-2015, Intel Corporation All rights reserved. diff --git a/freebsd/sys/dev/e1000/e1000_phy.h b/freebsd/sys/dev/e1000/e1000_phy.h index d3d563f7..6d0687fc 100644 --- a/freebsd/sys/dev/e1000/e1000_phy.h +++ b/freebsd/sys/dev/e1000/e1000_phy.h @@ -1,4 +1,5 @@ /****************************************************************************** + SPDX-License-Identifier: BSD-3-Clause Copyright (c) 2001-2015, Intel Corporation All rights reserved. diff --git a/freebsd/sys/dev/e1000/e1000_regs.h b/freebsd/sys/dev/e1000/e1000_regs.h index 37d70172..d9949817 100644 --- a/freebsd/sys/dev/e1000/e1000_regs.h +++ b/freebsd/sys/dev/e1000/e1000_regs.h @@ -1,4 +1,5 @@ /****************************************************************************** + SPDX-License-Identifier: BSD-3-Clause Copyright (c) 2001-2015, Intel Corporation All rights reserved. diff --git a/freebsd/sys/dev/e1000/e1000_vf.c b/freebsd/sys/dev/e1000/e1000_vf.c index 0e46641e..26f266e6 100644 --- a/freebsd/sys/dev/e1000/e1000_vf.c +++ b/freebsd/sys/dev/e1000/e1000_vf.c @@ -1,6 +1,7 @@ #include <machine/rtems-bsd-kernel-space.h> /****************************************************************************** + SPDX-License-Identifier: BSD-3-Clause Copyright (c) 2001-2015, Intel Corporation All rights reserved. diff --git a/freebsd/sys/dev/e1000/e1000_vf.h b/freebsd/sys/dev/e1000/e1000_vf.h index e6f834e7..9c76b632 100644 --- a/freebsd/sys/dev/e1000/e1000_vf.h +++ b/freebsd/sys/dev/e1000/e1000_vf.h @@ -1,4 +1,5 @@ /****************************************************************************** + SPDX-License-Identifier: BSD-3-Clause Copyright (c) 2001-2015, Intel Corporation All rights reserved. diff --git a/freebsd/sys/dev/e1000/if_em.c b/freebsd/sys/dev/e1000/if_em.c index dba6ef0a..07acaad9 100644 --- a/freebsd/sys/dev/e1000/if_em.c +++ b/freebsd/sys/dev/e1000/if_em.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2016 Matt Macy <mmacy@nextbsd.org> * All rights reserved. * @@ -1956,7 +1958,9 @@ em_if_msix_intr_assign(if_ctx_t ctx, int msix) rid = vector + 1; snprintf(buf, sizeof(buf), "txq%d", i); tx_que = &adapter->tx_queues[i]; - iflib_softirq_alloc_generic(ctx, rid, IFLIB_INTR_TX, tx_que, tx_que->me, buf); + iflib_softirq_alloc_generic(ctx, + &adapter->rx_queues[i % adapter->rx_num_queues].que_irq, + IFLIB_INTR_TX, tx_que, tx_que->me, buf); tx_que->msix = (vector % adapter->tx_num_queues); diff --git a/freebsd/sys/dev/e1000/if_em.h b/freebsd/sys/dev/e1000/if_em.h index b7599291..4f9d34b8 100644 --- a/freebsd/sys/dev/e1000/if_em.h +++ b/freebsd/sys/dev/e1000/if_em.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2016 Matt Macy <mmacy@nextbsd.org> * All rights reserved. * diff --git a/freebsd/sys/dev/evdev/evdev.c b/freebsd/sys/dev/evdev/evdev.c index b3c786a5..6c2976d7 100644 --- a/freebsd/sys/dev/evdev/evdev.c +++ b/freebsd/sys/dev/evdev/evdev.c @@ -52,6 +52,9 @@ #ifdef FEATURE FEATURE(evdev, "Input event devices support"); +#ifdef EVDEV_SUPPORT +FEATURE(evdev_support, "Evdev support in hybrid drivers"); +#endif #endif enum evdev_sparse_result @@ -70,12 +73,14 @@ int evdev_rcpt_mask = EVDEV_RCPT_HW_MOUSE | EVDEV_RCPT_HW_KBD; #endif /* __rtems__ */ int evdev_sysmouse_t_axis = 0; +#ifdef EVDEV_SUPPORT SYSCTL_NODE(_kern, OID_AUTO, evdev, CTLFLAG_RW, 0, "Evdev args"); SYSCTL_INT(_kern_evdev, OID_AUTO, rcpt_mask, CTLFLAG_RW, &evdev_rcpt_mask, 0, "Who is receiving events: bit0 - sysmouse, bit1 - kbdmux, " "bit2 - mouse hardware, bit3 - keyboard hardware"); SYSCTL_INT(_kern_evdev, OID_AUTO, sysmouse_t_axis, CTLFLAG_RW, &evdev_sysmouse_t_axis, 0, "Extract T-axis from 0-none, 1-ums, 2-psm"); +#endif static void evdev_start_repeat(struct evdev_dev *, uint16_t); static void evdev_stop_repeat(struct evdev_dev *); @@ -583,7 +588,8 @@ evdev_modify_event(struct evdev_dev *evdev, uint16_t type, uint16_t code, *value = KEY_EVENT_REPEAT; } else { /* Start/stop callout for evdev repeats */ - if (bit_test(evdev->ev_key_states, code) == !*value) { + if (bit_test(evdev->ev_key_states, code) == !*value && + !LIST_EMPTY(&evdev->ev_clients)) { if (*value == KEY_EVENT_DOWN) evdev_start_repeat(evdev, code); else @@ -638,8 +644,6 @@ evdev_sparse_event(struct evdev_dev *evdev, uint16_t type, uint16_t code, break; case EV_SND: - if (bit_test(evdev->ev_snd_states, code) == value) - return (EV_SKIP_EVENT); bit_change(evdev->ev_snd_states, code, value); break; @@ -817,7 +821,11 @@ evdev_inject_event(struct evdev_dev *evdev, uint16_t type, uint16_t code, case EV_ABS: case EV_SW: push: + if (evdev->ev_lock_type != EV_LOCK_INTERNAL) + EVDEV_LOCK(evdev); ret = evdev_push_event(evdev, type, code, value); + if (evdev->ev_lock_type != EV_LOCK_INTERNAL) + EVDEV_UNLOCK(evdev); break; default: diff --git a/freebsd/sys/dev/evdev/evdev.h b/freebsd/sys/dev/evdev/evdev.h index 946913c4..31f0c2c3 100644 --- a/freebsd/sys/dev/evdev/evdev.h +++ b/freebsd/sys/dev/evdev/evdev.h @@ -197,7 +197,7 @@ static __inline int evdev_push_snd(struct evdev_dev *evdev, uint16_t code, int32_t value) { - return (evdev_push_event(evdev, EV_SND, code, value != 0)); + return (evdev_push_event(evdev, EV_SND, code, value)); } static __inline int diff --git a/freebsd/sys/dev/evdev/evdev_utils.c b/freebsd/sys/dev/evdev/evdev_utils.c index caf81a46..9814ffeb 100644 --- a/freebsd/sys/dev/evdev/evdev_utils.c +++ b/freebsd/sys/dev/evdev/evdev_utils.c @@ -34,7 +34,9 @@ #include <sys/conf.h> #include <sys/kbio.h> #include <sys/kernel.h> +#include <sys/lock.h> #include <sys/malloc.h> +#include <sys/mutex.h> #include <sys/systm.h> #include <dev/evdev/evdev.h> @@ -64,7 +66,7 @@ static uint16_t evdev_usb_scancodes[256] = { KEY_PAUSE, KEY_INSERT, KEY_HOME, KEY_PAGEUP, KEY_DELETE, KEY_END, KEY_PAGEDOWN, KEY_RIGHT, KEY_LEFT, KEY_DOWN, KEY_UP, KEY_NUMLOCK, - KEY_SLASH, KEY_KPASTERISK, KEY_KPMINUS, KEY_KPPLUS, + KEY_KPSLASH, KEY_KPASTERISK, KEY_KPMINUS, KEY_KPPLUS, KEY_KPENTER, KEY_KP1, KEY_KP2, KEY_KP3, KEY_KP4, KEY_KP5, KEY_KP6, KEY_KP7, /* 0x60 - 0x7f */ @@ -131,7 +133,7 @@ static uint16_t evdev_at_set1_scancodes[] = { KEY_APOSTROPHE, KEY_GRAVE, KEY_LEFTSHIFT, KEY_BACKSLASH, KEY_Z, KEY_X, KEY_C, KEY_V, KEY_B, KEY_N, KEY_M, KEY_COMMA, - KEY_DOT, KEY_SLASH, KEY_RIGHTSHIFT, NONE, + KEY_DOT, KEY_SLASH, KEY_RIGHTSHIFT, KEY_KPASTERISK, KEY_LEFTALT, KEY_SPACE, KEY_CAPSLOCK, KEY_F1, KEY_F2, KEY_F3, KEY_F4, KEY_F5, /* 0x40 - 0x5f */ @@ -140,7 +142,7 @@ static uint16_t evdev_at_set1_scancodes[] = { KEY_KP8, KEY_KP9, KEY_KPMINUS, KEY_KP4, KEY_KP5, KEY_KP6, KEY_KPPLUS, KEY_KP1, KEY_KP2, KEY_KP3, KEY_KP0, KEY_KPDOT, - NONE, NONE, NONE, KEY_F11, + NONE, NONE, KEY_102ND, KEY_F11, KEY_F12, NONE, NONE, NONE, NONE, NONE, NONE, NONE, /* 0x60 - 0x7f */ @@ -167,7 +169,7 @@ static uint16_t evdev_at_set1_scancodes[] = { NONE, NONE, NONE, NONE, NONE, NONE, KEY_VOLUMEDOWN, NONE, KEY_VOLUMEUP, NONE, KEY_HOMEPAGE, NONE, - NONE, KEY_KPASTERISK, NONE, KEY_SYSRQ, + NONE, KEY_KPSLASH, NONE, KEY_SYSRQ, KEY_RIGHTALT, NONE, NONE, NONE, NONE, NONE, NONE, NONE, /* 0x40 - 0x5f. 0xE0 prefixed */ @@ -316,19 +318,26 @@ evdev_ev_kbd_event(struct evdev_dev *evdev, void *softc, uint16_t type, leds |= 1 << i; else leds &= ~(1 << i); - if (leds != oleds) + if (leds != oleds) { + mtx_lock(&Giant); kbdd_ioctl(kbd, KDSETLED, (caddr_t)&leds); + mtx_unlock(&Giant); + } break; } } } else if (type == EV_REP && code == REP_DELAY) { delay[0] = value; delay[1] = kbd->kb_delay2; + mtx_lock(&Giant); kbdd_ioctl(kbd, KDSETREPEAT, (caddr_t)delay); + mtx_unlock(&Giant); } else if (type == EV_REP && code == REP_PERIOD) { delay[0] = kbd->kb_delay1; delay[1] = value; + mtx_lock(&Giant); kbdd_ioctl(kbd, KDSETREPEAT, (caddr_t)delay); + mtx_unlock(&Giant); } } diff --git a/freebsd/sys/dev/fdt/fdt_common.c b/freebsd/sys/dev/fdt/fdt_common.c index c8c777f1..26f73bc3 100644 --- a/freebsd/sys/dev/fdt/fdt_common.c +++ b/freebsd/sys/dev/fdt/fdt_common.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2009-2014 The FreeBSD Foundation * All rights reserved. * diff --git a/freebsd/sys/dev/fdt/fdt_common.h b/freebsd/sys/dev/fdt/fdt_common.h index 904d3e18..91522df5 100644 --- a/freebsd/sys/dev/fdt/fdt_common.h +++ b/freebsd/sys/dev/fdt/fdt_common.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2009-2010 The FreeBSD Foundation * All rights reserved. * diff --git a/freebsd/sys/dev/fdt/simplebus.c b/freebsd/sys/dev/fdt/simplebus.c index 9c85f751..54b17074 100644 --- a/freebsd/sys/dev/fdt/simplebus.c +++ b/freebsd/sys/dev/fdt/simplebus.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2013 Nathan Whitehorn * All rights reserved. * diff --git a/freebsd/sys/dev/ffec/if_ffec.c b/freebsd/sys/dev/ffec/if_ffec.c index 22b2cdfc..1d842286 100644 --- a/freebsd/sys/dev/ffec/if_ffec.c +++ b/freebsd/sys/dev/ffec/if_ffec.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2013 Ian Lepore <ian@freebsd.org> * Copyright (C) 2007-2008 Semihalf, Rafal Jaworowski * Copyright (C) 2006-2007 Semihalf, Piotr Kruszynski @@ -103,18 +105,21 @@ enum { FECTYPE_NONE, FECTYPE_GENERIC, FECTYPE_IMX53, - FECTYPE_IMX6, + FECTYPE_IMX6, /* imx6 and imx7 */ FECTYPE_MVF, }; /* * Flags that describe general differences between the FEC hardware in various - * SoCs. These are ORed into the FECTYPE enum values. + * SoCs. These are ORed into the FECTYPE enum values in the ofw_compat_data, so + * the low 8 bits are reserved for the type enum. In the softc, the type and + * flags are put into separate members, so that you don't need to mask the flags + * out of the type to compare it. */ -#define FECTYPE_MASK 0x0000ffff -#define FECFLAG_GBE (1 << 16) -#define FECFLAG_AVB (1 << 17) -#define FECFLAG_RACC (1 << 18) +#define FECTYPE_MASK 0x000000ff +#define FECFLAG_GBE (1 << 8) +#define FECFLAG_AVB (1 << 9) +#define FECFLAG_RACC (1 << 10) /* * Table of supported FDT compat strings and their associated FECTYPE values. @@ -122,12 +127,12 @@ enum { static struct ofw_compat_data compat_data[] = { {"fsl,imx51-fec", FECTYPE_GENERIC}, {"fsl,imx53-fec", FECTYPE_IMX53}, - {"fsl,imx6q-fec", FECTYPE_IMX6 | FECFLAG_GBE | FECFLAG_RACC}, - {"fsl,imx6ul-fec", FECTYPE_IMX6}, - {"fsl,mvf600-fec", FECTYPE_MVF | FECFLAG_RACC}, + {"fsl,imx6q-fec", FECTYPE_IMX6 | FECFLAG_RACC | FECFLAG_GBE }, + {"fsl,imx6ul-fec", FECTYPE_IMX6 | FECFLAG_RACC }, + {"fsl,imx7d-fec", FECTYPE_IMX6 | FECFLAG_RACC | FECFLAG_GBE | + FECFLAG_AVB }, + {"fsl,mvf600-fec", FECTYPE_MVF | FECFLAG_RACC }, {"fsl,mvf-fec", FECTYPE_MVF}, - {"fsl,imx7d-fec", FECTYPE_IMX6 | FECFLAG_GBE | FECFLAG_AVB | - FECFLAG_RACC}, {NULL, FECTYPE_NONE}, }; @@ -161,12 +166,12 @@ struct ffec_softc { int if_flags; struct mtx mtx; struct resource *irq_res[MAX_IRQ_COUNT]; - int irq_count; struct resource *mem_res; void * intr_cookie[MAX_IRQ_COUNT]; struct callout ffec_callout; mii_contype_t phy_conn_type; - uintptr_t fectype; + uint32_t fecflags; + uint8_t fectype; boolean_t link_is_up; boolean_t is_attached; boolean_t is_detaching; @@ -198,6 +203,13 @@ struct ffec_softc { int tx_ic_count; }; +static struct resource_spec irq_res_spec[MAX_IRQ_COUNT + 1] = { + { SYS_RES_IRQ, 0, RF_ACTIVE }, + { SYS_RES_IRQ, 1, RF_ACTIVE | RF_OPTIONAL }, + { SYS_RES_IRQ, 2, RF_ACTIVE | RF_OPTIONAL }, + RESOURCE_SPEC_END +}; + #define FFEC_LOCK(sc) mtx_lock(&(sc)->mtx) #define FFEC_UNLOCK(sc) mtx_unlock(&(sc)->mtx) #define FFEC_LOCK_INIT(sc) mtx_init(&(sc)->mtx, \ @@ -302,7 +314,7 @@ ffec_miigasket_setup(struct ffec_softc *sc) * We only need the gasket for MII and RMII connections on certain SoCs. */ - switch (sc->fectype & FECTYPE_MASK) + switch (sc->fectype) { case FECTYPE_IMX53: break; @@ -842,10 +854,10 @@ ffec_setup_rxbuf(struct ffec_softc *sc, int idx, struct mbuf * m) int error, nsegs; struct bus_dma_segment seg; - if ((sc->fectype & FECFLAG_RACC) == 0) { + if (!(sc->fecflags & FECFLAG_RACC)) { /* - * The RACC[SHIFT16] feature is not used. So, we need to leave - * at least ETHER_ALIGN bytes free at the beginning of the + * The RACC[SHIFT16] feature is not available. So, we need to + * leave at least ETHER_ALIGN bytes free at the beginning of the * buffer to allow the data to be re-aligned after receiving it * (by copying it backwards ETHER_ALIGN bytes in the same * buffer). We also have to ensure that the beginning of the @@ -905,23 +917,6 @@ ffec_rxfinish_onebuf(struct ffec_softc *sc, int len, uint32_t flags2) return; } - /* - * Unfortunately, the protocol headers need to be aligned on a 32-bit - * boundary for the upper layers. The hardware requires receive - * buffers to be 16-byte aligned. The ethernet header is 14 bytes, - * leaving the protocol header unaligned. We used m_adj() after - * allocating the buffer to leave empty space at the start of the - * buffer, now we'll use the alignment agnostic bcopy() routine to - * shuffle all the data backwards 2 bytes and adjust m_data. - * - * XXX imx6 hardware is able to do this 2-byte alignment by setting the - * SHIFT16 bit in the RACC register. Older hardware doesn't have that - * feature, but for them could we speed this up by copying just the - * protocol headers into their own small mbuf then chaining the cluster - * to it? That way we'd only need to copy like 64 bytes or whatever - * the biggest header is, instead of the whole 1530ish-byte frame. - */ - FFEC_UNLOCK(sc); bmap = &sc->rxbuf_map[sc->rx_idx]; @@ -940,8 +935,17 @@ ffec_rxfinish_onebuf(struct ffec_softc *sc, int len, uint32_t flags2) m->m_pkthdr.csum_data = 0xffff; } - if (sc->fectype & FECFLAG_RACC) { - /* We use the RACC[SHIFT16] feature */ + /* + * Align the protocol headers in the receive buffer on a 32-bit + * boundary. Newer hardware does the alignment for us. On hardware + * that doesn't support this feature, we have to copy-align the data. + * + * XXX for older hardware, could we speed this up by copying just the + * protocol headers into their own small mbuf then chaining the cluster + * to it? That way we'd only need to copy like 64 bytes or whatever the + * biggest header is, instead of the whole 1530ish-byte frame. + */ + if (sc->fecflags & FECFLAG_RACC) { m->m_data = mtod(m, uint8_t *) + 2; } else { uint8_t *dst, *src; @@ -1325,7 +1329,7 @@ ffec_init_locked(struct ffec_softc *sc) ffec_clear_stats(sc); WR4(sc, FEC_MIBC_REG, regval & ~FEC_MIBC_DIS); - if (sc->fectype & FECFLAG_RACC) { + if (sc->fecflags & FECFLAG_RACC) { /* * RACC - Receive Accelerator Function Configuration. */ @@ -1540,18 +1544,16 @@ ffec_detach(device_t dev) bus_dmamap_destroy(sc->txdesc_tag, sc->txdesc_map); } if (sc->txdesc_tag != NULL) - bus_dma_tag_destroy(sc->txdesc_tag); + bus_dma_tag_destroy(sc->txdesc_tag); /* Release bus resources. */ - for (irq = 0; irq < sc->irq_count; ++irq) { - if (sc->intr_cookie[irq]) + for (irq = 0; irq < MAX_IRQ_COUNT; ++irq) { + if (sc->intr_cookie[irq] != NULL) { bus_teardown_intr(dev, sc->irq_res[irq], sc->intr_cookie[irq]); - - if (sc->irq_res[irq] != NULL) - bus_release_resource(dev, SYS_RES_IRQ, 0, - sc->irq_res[irq]); + } } + bus_release_resources(dev, irq_res_spec, sc->irq_res); if (sc->mem_res != NULL) bus_release_resource(dev, SYS_RES_MEMORY, 0, sc->mem_res); @@ -1712,10 +1714,11 @@ ffec_attach(device_t dev) struct ifnet *ifp = NULL; struct mbuf *m; void *dummy; + uintptr_t typeflags; phandle_t ofw_node; + uint32_t idx, mscr; int error, phynum, rid, irq; uint8_t eaddr[ETHER_ADDR_LEN]; - uint32_t idx, mscr; sc = device_get_softc(dev); sc->dev = dev; @@ -1726,7 +1729,17 @@ ffec_attach(device_t dev) * There are differences in the implementation and features of the FEC * hardware on different SoCs, so figure out what type we are. */ - sc->fectype = ofw_bus_search_compatible(dev, compat_data)->ocd_data; + typeflags = ofw_bus_search_compatible(dev, compat_data)->ocd_data; + sc->fectype = (uint8_t)(typeflags & FECTYPE_MASK); + sc->fecflags = (uint32_t)(typeflags & ~FECTYPE_MASK); + + if (sc->fecflags & FECFLAG_AVB) { + sc->rxbuf_align = 64; + sc->txbuf_align = 1; + } else { + sc->rxbuf_align = 16; + sc->txbuf_align = 16; + } if (sc->fectype & FECFLAG_AVB) { sc->rxbuf_align = 64; @@ -1768,17 +1781,10 @@ ffec_attach(device_t dev) error = ENOMEM; goto out; } - for (irq = 0; irq < MAX_IRQ_COUNT; ++irq) { - rid = irq; - sc->irq_res[irq] = bus_alloc_resource_any(dev, SYS_RES_IRQ, - &rid, RF_ACTIVE); - if (sc->irq_res[irq] == NULL) - break; - } - sc->irq_count = irq; - if (irq == 0) { - device_printf(dev, "could not allocate interrupt resources.\n"); - error = ENOMEM; + + error = bus_alloc_resources(dev, irq_res_spec, sc->irq_res); + if (error != 0) { + device_printf(dev, "could not allocate interrupt resources\n"); goto out; } @@ -1924,25 +1930,33 @@ ffec_attach(device_t dev) /* Try to get the MAC address from the hardware before resetting it. */ ffec_get_hwaddr(sc, eaddr); - /* Reset the hardware. Disables all interrupts. */ - if (sc->fectype & FECFLAG_AVB) - /* - * Avoid AXI bus issues due to a MAC reset, see Linux for more - * details. - */ + /* + * Reset the hardware. Disables all interrupts. + * + * When the FEC is connected to the AXI bus (indicated by AVB flag), a + * MAC reset while a bus transaction is pending can hang the bus. + * Instead of resetting, turn off the ENABLE bit, which allows the + * hardware to complete any in-progress transfers (appending a bad CRC + * to any partial packet) and release the AXI bus. This could probably + * be done unconditionally for all hardware variants, but that hasn't + * been tested. + */ + if (sc->fecflags & FECFLAG_AVB) WR4(sc, FEC_ECR_REG, 0); else WR4(sc, FEC_ECR_REG, FEC_ECR_RESET); /* Setup interrupt handler. */ - for (irq = 0; irq < sc->irq_count; ++irq) { - error = bus_setup_intr(dev, sc->irq_res[irq], - INTR_TYPE_NET | INTR_MPSAFE, NULL, ffec_intr, sc, - &sc->intr_cookie[irq]); - if (error != 0) { - device_printf(dev, - "could not setup interrupt handler.\n"); - goto out; + for (irq = 0; irq < MAX_IRQ_COUNT; ++irq) { + if (sc->irq_res[irq] != NULL) { + error = bus_setup_intr(dev, sc->irq_res[irq], + INTR_TYPE_NET | INTR_MPSAFE, NULL, ffec_intr, sc, + &sc->intr_cookie[irq]); + if (error != 0) { + device_printf(dev, + "could not setup interrupt handler.\n"); + goto out; + } } } @@ -2019,7 +2033,7 @@ ffec_attach(device_t dev) } error = mii_attach(dev, &sc->miibus, ifp, ffec_media_change, ffec_media_status, BMSR_DEFCAPMASK, phynum, MII_OFFSET_ANY, - (sc->fectype & FECTYPE_MVF) ? MIIF_FORCEANEG : 0); + (sc->fecflags & FECTYPE_MVF) ? MIIF_FORCEANEG : 0); if (error != 0) { device_printf(dev, "PHY attach failed\n"); goto out; diff --git a/freebsd/sys/dev/ffec/if_ffecreg.h b/freebsd/sys/dev/ffec/if_ffecreg.h index 9ec5b375..e2e7e816 100644 --- a/freebsd/sys/dev/ffec/if_ffecreg.h +++ b/freebsd/sys/dev/ffec/if_ffecreg.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2013 Ian Lepore <ian@freebsd.org> * All rights reserved. * diff --git a/freebsd/sys/dev/fxp/if_fxp.c b/freebsd/sys/dev/fxp/if_fxp.c index 20bdc988..ca933aa8 100644 --- a/freebsd/sys/dev/fxp/if_fxp.c +++ b/freebsd/sys/dev/fxp/if_fxp.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-2-Clause-NetBSD + * * Copyright (c) 1995, David Greenman * Copyright (c) 2001 Jonathan Lemon <jlemon@freebsd.org> * All rights reserved. diff --git a/freebsd/sys/dev/fxp/if_fxpreg.h b/freebsd/sys/dev/fxp/if_fxpreg.h index 7ee85884..d1e6a45a 100644 --- a/freebsd/sys/dev/fxp/if_fxpreg.h +++ b/freebsd/sys/dev/fxp/if_fxpreg.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-NetBSD + * * Copyright (c) 1995, David Greenman * Copyright (c) 2001 Jonathan Lemon <jlemon@freebsd.org> * All rights reserved. diff --git a/freebsd/sys/dev/fxp/if_fxpvar.h b/freebsd/sys/dev/fxp/if_fxpvar.h index 78200ce3..476a1a2c 100644 --- a/freebsd/sys/dev/fxp/if_fxpvar.h +++ b/freebsd/sys/dev/fxp/if_fxpvar.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 1995, David Greenman * All rights reserved. * diff --git a/freebsd/sys/dev/fxp/rcvbundl.h b/freebsd/sys/dev/fxp/rcvbundl.h index dac793df..e49889f0 100644 --- a/freebsd/sys/dev/fxp/rcvbundl.h +++ b/freebsd/sys/dev/fxp/rcvbundl.h @@ -1,4 +1,6 @@ /*- +SPDX-License-Identifier: BSD-3-Clause + Copyright (c) 1999-2001, Intel Corporation All rights reserved. diff --git a/freebsd/sys/dev/gpio/gpiobus.c b/freebsd/sys/dev/gpio/gpiobus.c index bbe8fc6c..2b1899e6 100644 --- a/freebsd/sys/dev/gpio/gpiobus.c +++ b/freebsd/sys/dev/gpio/gpiobus.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2009 Oleksandr Tymoshenko <gonzo@freebsd.org> * All rights reserved. * diff --git a/freebsd/sys/dev/gpio/gpiobusvar.h b/freebsd/sys/dev/gpio/gpiobusvar.h index 9eee5a03..fbcfbb4e 100644 --- a/freebsd/sys/dev/gpio/gpiobusvar.h +++ b/freebsd/sys/dev/gpio/gpiobusvar.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2009 Oleksandr Tymoshenko <gonzo@freebsd.org> * All rights reserved. * diff --git a/freebsd/sys/dev/gpio/ofw_gpiobus.c b/freebsd/sys/dev/gpio/ofw_gpiobus.c index e76059f9..70495a2a 100644 --- a/freebsd/sys/dev/gpio/ofw_gpiobus.c +++ b/freebsd/sys/dev/gpio/ofw_gpiobus.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2009, Nathan Whitehorn <nwhitehorn@FreeBSD.org> * Copyright (c) 2013, Luiz Otavio O Souza <loos@FreeBSD.org> * Copyright (c) 2013 The FreeBSD Foundation diff --git a/freebsd/sys/dev/kbd/kbd.c b/freebsd/sys/dev/kbd/kbd.c index 3187e8bf..c7512e89 100644 --- a/freebsd/sys/dev/kbd/kbd.c +++ b/freebsd/sys/dev/kbd/kbd.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 1999 Kazutaka YOKOTA <yokota@zodiac.mech.utsunomiya-u.ac.jp> * All rights reserved. * diff --git a/freebsd/sys/dev/kbd/kbdreg.h b/freebsd/sys/dev/kbd/kbdreg.h index ff4a694b..5caafdda 100644 --- a/freebsd/sys/dev/kbd/kbdreg.h +++ b/freebsd/sys/dev/kbd/kbdreg.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 1999 Kazutaka YOKOTA <yokota@zodiac.mech.utsunomiya-u.ac.jp> * All rights reserved. * diff --git a/freebsd/sys/dev/kbd/kbdtables.h b/freebsd/sys/dev/kbd/kbdtables.h index 5ff744c0..c1c6defc 100644 --- a/freebsd/sys/dev/kbd/kbdtables.h +++ b/freebsd/sys/dev/kbd/kbdtables.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 1992-1998 Sen Schmidt * All rights reserved. * diff --git a/freebsd/sys/dev/led/led.c b/freebsd/sys/dev/led/led.c index cb811ce9..70de95bb 100644 --- a/freebsd/sys/dev/led/led.c +++ b/freebsd/sys/dev/led/led.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: Beerware + * * ---------------------------------------------------------------------------- * "THE BEER-WARE LICENSE" (Revision 42): * <phk@FreeBSD.org> wrote this file. As long as you retain this notice you diff --git a/freebsd/sys/dev/mii/brgphy.c b/freebsd/sys/dev/mii/brgphy.c index d476960f..0566f616 100644 --- a/freebsd/sys/dev/mii/brgphy.c +++ b/freebsd/sys/dev/mii/brgphy.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-4-Clause + * * Copyright (c) 2000 * Bill Paul <wpaul@ee.columbia.edu>. All rights reserved. * diff --git a/freebsd/sys/dev/mii/brgphyreg.h b/freebsd/sys/dev/mii/brgphyreg.h index b3535d59..5cceb392 100644 --- a/freebsd/sys/dev/mii/brgphyreg.h +++ b/freebsd/sys/dev/mii/brgphyreg.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-4-Clause + * * Copyright (c) 2000 * Bill Paul <wpaul@ee.columbia.edu>. All rights reserved. * diff --git a/freebsd/sys/dev/mii/e1000phy.c b/freebsd/sys/dev/mii/e1000phy.c index ee62b6c6..ae5a3922 100644 --- a/freebsd/sys/dev/mii/e1000phy.c +++ b/freebsd/sys/dev/mii/e1000phy.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-2-Clause-NetBSD + * * Principal Author: Parag Patel * Copyright (c) 2001 * All rights reserved. diff --git a/freebsd/sys/dev/mii/e1000phyreg.h b/freebsd/sys/dev/mii/e1000phyreg.h index e5d5cf96..04c396e5 100644 --- a/freebsd/sys/dev/mii/e1000phyreg.h +++ b/freebsd/sys/dev/mii/e1000phyreg.h @@ -31,6 +31,8 @@ */ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Derived by information released by Intel under the following license: * * Copyright (c) 1999 - 2001, Intel Corporation diff --git a/freebsd/sys/dev/mii/icsphy.c b/freebsd/sys/dev/mii/icsphy.c index e313afe1..bde90714 100755 --- a/freebsd/sys/dev/mii/icsphy.c +++ b/freebsd/sys/dev/mii/icsphy.c @@ -3,6 +3,8 @@ /* $NetBSD: icsphy.c,v 1.41 2006/11/16 21:24:07 christos Exp $ */ /*- + * SPDX-License-Identifier: BSD-2-Clause-NetBSD + * * Copyright (c) 1998, 1999, 2000 The NetBSD Foundation, Inc. * All rights reserved. * diff --git a/freebsd/sys/dev/mii/icsphyreg.h b/freebsd/sys/dev/mii/icsphyreg.h index d92d0b51..80ebbded 100644 --- a/freebsd/sys/dev/mii/icsphyreg.h +++ b/freebsd/sys/dev/mii/icsphyreg.h @@ -1,6 +1,8 @@ /* $NetBSD: icsphyreg.h,v 1.2 2003/07/01 22:46:08 msaitoh Exp $ */ /*- + * SPDX-License-Identifier: BSD-2-Clause-NetBSD + * * Copyright (c) 1998 The NetBSD Foundation, Inc. * All rights reserved. * diff --git a/freebsd/sys/dev/mii/mii.c b/freebsd/sys/dev/mii/mii.c index b7464bb6..2ed40543 100644 --- a/freebsd/sys/dev/mii/mii.c +++ b/freebsd/sys/dev/mii/mii.c @@ -3,6 +3,8 @@ /* $NetBSD: mii.c,v 1.12 1999/08/03 19:41:49 drochner Exp $ */ /*- + * SPDX-License-Identifier: BSD-2-Clause-NetBSD + * * Copyright (c) 1998 The NetBSD Foundation, Inc. * All rights reserved. * diff --git a/freebsd/sys/dev/mii/mii.h b/freebsd/sys/dev/mii/mii.h index fa1ec84e..11b2d117 100644 --- a/freebsd/sys/dev/mii/mii.h +++ b/freebsd/sys/dev/mii/mii.h @@ -1,6 +1,8 @@ /* $NetBSD: mii.h,v 1.18 2014/06/16 14:43:22 msaitoh Exp $ */ /*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 1997 Manuel Bouyer. All rights reserved. * * Modification to match BSD/OS 3.0 MII interface by Jason R. Thorpe, diff --git a/freebsd/sys/dev/mii/mii_bitbang.c b/freebsd/sys/dev/mii/mii_bitbang.c index 784aa4d8..0fd3bb47 100644 --- a/freebsd/sys/dev/mii/mii_bitbang.c +++ b/freebsd/sys/dev/mii/mii_bitbang.c @@ -3,6 +3,8 @@ /* $NetBSD: mii_bitbang.c,v 1.12 2008/05/04 17:06:09 xtraeme Exp $ */ /*- + * SPDX-License-Identifier: BSD-2-Clause-NetBSD + * * Copyright (c) 1999 The NetBSD Foundation, Inc. * All rights reserved. * diff --git a/freebsd/sys/dev/mii/mii_bitbang.h b/freebsd/sys/dev/mii/mii_bitbang.h index 2bc74276..14e2c90f 100644 --- a/freebsd/sys/dev/mii/mii_bitbang.h +++ b/freebsd/sys/dev/mii/mii_bitbang.h @@ -1,6 +1,8 @@ /* $NetBSD: mii_bitbang.h,v 1.6 2009/05/12 14:31:27 cegger Exp $ */ /*- + * SPDX-License-Identifier: BSD-2-Clause-NetBSD + * * Copyright (c) 1999 The NetBSD Foundation, Inc. * All rights reserved. * diff --git a/freebsd/sys/dev/mii/mii_physubr.c b/freebsd/sys/dev/mii/mii_physubr.c index 864f9968..9ba68190 100644 --- a/freebsd/sys/dev/mii/mii_physubr.c +++ b/freebsd/sys/dev/mii/mii_physubr.c @@ -3,6 +3,8 @@ /* $NetBSD: mii_physubr.c,v 1.5 1999/08/03 19:41:49 drochner Exp $ */ /*- + * SPDX-License-Identifier: BSD-2-Clause-NetBSD + * * Copyright (c) 1998, 1999, 2000, 2001 The NetBSD Foundation, Inc. * All rights reserved. * diff --git a/freebsd/sys/dev/mii/miivar.h b/freebsd/sys/dev/mii/miivar.h index ef81bdb2..9def25c4 100644 --- a/freebsd/sys/dev/mii/miivar.h +++ b/freebsd/sys/dev/mii/miivar.h @@ -1,6 +1,8 @@ /* $NetBSD: miivar.h,v 1.8 1999/04/23 04:24:32 thorpej Exp $ */ /*- + * SPDX-License-Identifier: BSD-2-Clause-NetBSD + * * Copyright (c) 1998, 1999 The NetBSD Foundation, Inc. * All rights reserved. * diff --git a/freebsd/sys/dev/mii/rgephy.c b/freebsd/sys/dev/mii/rgephy.c index de8a2975..8a045a7d 100644 --- a/freebsd/sys/dev/mii/rgephy.c +++ b/freebsd/sys/dev/mii/rgephy.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-4-Clause + * * Copyright (c) 2003 * Bill Paul <wpaul@windriver.com>. All rights reserved. * diff --git a/freebsd/sys/dev/mii/rgephyreg.h b/freebsd/sys/dev/mii/rgephyreg.h index 35917daa..39efaee4 100644 --- a/freebsd/sys/dev/mii/rgephyreg.h +++ b/freebsd/sys/dev/mii/rgephyreg.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-4-Clause + * * Copyright (c) 2003 * Bill Paul <wpaul@windriver.com>. All rights reserved. * diff --git a/freebsd/sys/dev/mii/ukphy.c b/freebsd/sys/dev/mii/ukphy.c index c9c59b06..14e42fc9 100644 --- a/freebsd/sys/dev/mii/ukphy.c +++ b/freebsd/sys/dev/mii/ukphy.c @@ -3,6 +3,8 @@ /* $NetBSD: ukphy.c,v 1.2 1999/04/23 04:24:32 thorpej Exp $ */ /*- + * SPDX-License-Identifier: BSD-2-Clause-NetBSD + * * Copyright (c) 1998, 1999 The NetBSD Foundation, Inc. * All rights reserved. * diff --git a/freebsd/sys/dev/mii/ukphy_subr.c b/freebsd/sys/dev/mii/ukphy_subr.c index 06e1cc5f..b87717fb 100644 --- a/freebsd/sys/dev/mii/ukphy_subr.c +++ b/freebsd/sys/dev/mii/ukphy_subr.c @@ -3,6 +3,8 @@ /* $NetBSD: ukphy_subr.c,v 1.2 1998/11/05 04:08:02 thorpej Exp $ */ /*- + * SPDX-License-Identifier: BSD-2-Clause-NetBSD + * * Copyright (c) 1998 The NetBSD Foundation, Inc. * All rights reserved. * diff --git a/freebsd/sys/dev/mmc/bridge.h b/freebsd/sys/dev/mmc/bridge.h index b7d95ffc..7af811f1 100644 --- a/freebsd/sys/dev/mmc/bridge.h +++ b/freebsd/sys/dev/mmc/bridge.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2006 M. Warner Losh. All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/freebsd/sys/dev/mmc/mmc.c b/freebsd/sys/dev/mmc/mmc.c index 77934e86..32599383 100644 --- a/freebsd/sys/dev/mmc/mmc.c +++ b/freebsd/sys/dev/mmc/mmc.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2006 Bernd Walter. All rights reserved. * Copyright (c) 2006 M. Warner Losh. All rights reserved. * Copyright (c) 2017 Marius Strobl <marius@FreeBSD.org> diff --git a/freebsd/sys/dev/mmc/mmcbrvar.h b/freebsd/sys/dev/mmc/mmcbrvar.h index c70af92a..6e4bec70 100644 --- a/freebsd/sys/dev/mmc/mmcbrvar.h +++ b/freebsd/sys/dev/mmc/mmcbrvar.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2006 Bernd Walter. All rights reserved. * Copyright (c) 2006 M. Warner Losh. All rights reserved. * diff --git a/freebsd/sys/dev/mmc/mmcreg.h b/freebsd/sys/dev/mmc/mmcreg.h index 8120b69f..5f58ce3f 100644 --- a/freebsd/sys/dev/mmc/mmcreg.h +++ b/freebsd/sys/dev/mmc/mmcreg.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2006 M. Warner Losh. All rights reserved. * Copyright (c) 2017 Marius Strobl <marius@FreeBSD.org> * Copyright (c) 2015-2016 Ilya Bakulin <kibab@FreeBSD.org> diff --git a/freebsd/sys/dev/mmc/mmcsd.c b/freebsd/sys/dev/mmc/mmcsd.c index 45bd9c50..df29b544 100644 --- a/freebsd/sys/dev/mmc/mmcsd.c +++ b/freebsd/sys/dev/mmc/mmcsd.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2006 Bernd Walter. All rights reserved. * Copyright (c) 2006 M. Warner Losh. All rights reserved. * Copyright (c) 2017 Marius Strobl <marius@FreeBSD.org> @@ -554,7 +556,7 @@ mmcsd_attach(device_t dev) (ext_csd[EXT_CSD_ENH_START_ADDR + 1] << 8) + (ext_csd[EXT_CSD_ENH_START_ADDR + 2] << 16) + (ext_csd[EXT_CSD_ENH_START_ADDR + 3] << 24)) * - (sc->high_cap != 0 ? MMC_SECTOR_SIZE : 1); + (sc->high_cap == 0 ? MMC_SECTOR_SIZE : 1); } else if (bootverbose) device_printf(dev, "enhanced user data area spans entire device\n"); diff --git a/freebsd/sys/dev/mmc/mmcvar.h b/freebsd/sys/dev/mmc/mmcvar.h index d0f4e330..1604c306 100644 --- a/freebsd/sys/dev/mmc/mmcvar.h +++ b/freebsd/sys/dev/mmc/mmcvar.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2006 Bernd Walter. All rights reserved. * Copyright (c) 2006 M. Warner Losh. All rights reserved. * diff --git a/freebsd/sys/dev/nvme/nvme.h b/freebsd/sys/dev/nvme/nvme.h index d4fc131e..5d11f793 100644 --- a/freebsd/sys/dev/nvme/nvme.h +++ b/freebsd/sys/dev/nvme/nvme.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (C) 2012-2013 Intel Corporation * All rights reserved. * @@ -42,6 +44,13 @@ #define NVME_BIO_TEST _IOWR('n', 101, struct nvme_io_test) /* + * Macros to deal with NVME revisions, as defined VS register + */ +#define NVME_REV(x, y) (((x) << 16) | ((y) << 8)) +#define NVME_MAJOR(r) (((r) >> 16) & 0xffff) +#define NVME_MINOR(r) (((r) >> 8) & 0xff) + +/* * Use to mark a command to apply to all namespaces, or to retrieve global * log pages. */ @@ -1068,7 +1077,12 @@ uint32_t nvme_ns_get_stripesize(struct nvme_namespace *ns); int nvme_ns_bio_process(struct nvme_namespace *ns, struct bio *bp, nvme_cb_fn_t cb_fn); -/* Command building helper functions -- shared with CAM */ +/* + * Command building helper functions -- shared with CAM + * These functions assume allocator zeros out cmd structure + * CAM's xpt_get_ccb and the request allocator for nvme both + * do zero'd allocations. + */ static inline void nvme_ns_flush_cmd(struct nvme_command *cmd, uint32_t nsid) { @@ -1086,9 +1100,6 @@ void nvme_ns_rw_cmd(struct nvme_command *cmd, uint32_t rwcmd, uint32_t nsid, cmd->cdw10 = lba & 0xffffffffu; cmd->cdw11 = lba >> 32; cmd->cdw12 = count-1; - cmd->cdw13 = 0; - cmd->cdw14 = 0; - cmd->cdw15 = 0; } static inline diff --git a/freebsd/sys/dev/ofw/ofw_bus.h b/freebsd/sys/dev/ofw/ofw_bus.h index dff9a2b8..bfffcefa 100644 --- a/freebsd/sys/dev/ofw/ofw_bus.h +++ b/freebsd/sys/dev/ofw/ofw_bus.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2001, 2003 by Thomas Moestl <tmm@FreeBSD.org> * Copyright (c) 2004 by Marius Strobl <marius@FreeBSD.org> * All rights reserved. diff --git a/freebsd/sys/dev/ofw/ofw_bus_subr.c b/freebsd/sys/dev/ofw/ofw_bus_subr.c index 418304a0..c655e668 100644 --- a/freebsd/sys/dev/ofw/ofw_bus_subr.c +++ b/freebsd/sys/dev/ofw/ofw_bus_subr.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2001 - 2003 by Thomas Moestl <tmm@FreeBSD.org>. * Copyright (c) 2005 Marius Strobl <marius@FreeBSD.org> * All rights reserved. diff --git a/freebsd/sys/dev/ofw/ofw_bus_subr.h b/freebsd/sys/dev/ofw/ofw_bus_subr.h index 4afd84e3..04f5a75b 100644 --- a/freebsd/sys/dev/ofw/ofw_bus_subr.h +++ b/freebsd/sys/dev/ofw/ofw_bus_subr.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2005 Marius Strobl <marius@FreeBSD.org> * All rights reserved. * @@ -63,7 +65,7 @@ struct intr_map_data_fdt { }; #endif -#define SIMPLEBUS_PNP_DESCR "Z:compat;P:private;" +#define SIMPLEBUS_PNP_DESCR "Z:compat;P:#;" #define SIMPLEBUS_PNP_INFO(t) \ MODULE_PNP_INFO(SIMPLEBUS_PNP_DESCR, simplebus, t, t, sizeof(t[0]), sizeof(t) / sizeof(t[0])); diff --git a/freebsd/sys/dev/ofw/ofw_fdt.c b/freebsd/sys/dev/ofw/ofw_fdt.c index 282c3667..7bdf447b 100644 --- a/freebsd/sys/dev/ofw/ofw_fdt.c +++ b/freebsd/sys/dev/ofw/ofw_fdt.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2009-2010 The FreeBSD Foundation * All rights reserved. * diff --git a/freebsd/sys/dev/ofw/ofw_pci.h b/freebsd/sys/dev/ofw/ofw_pci.h index eb60c5ba..fe4e8b1a 100644 --- a/freebsd/sys/dev/ofw/ofw_pci.h +++ b/freebsd/sys/dev/ofw/ofw_pci.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-NetBSD + * * Copyright (c) 1999 The NetBSD Foundation, Inc. * All rights reserved. * diff --git a/freebsd/sys/dev/ofw/ofwvar.h b/freebsd/sys/dev/ofw/ofwvar.h index 38bf472b..559da72b 100644 --- a/freebsd/sys/dev/ofw/ofwvar.h +++ b/freebsd/sys/dev/ofw/ofwvar.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2005 Peter Grehan * Copyright (c) 2008 Nathan Whitehorn * All rights reserved. diff --git a/freebsd/sys/dev/ofw/openfirm.c b/freebsd/sys/dev/ofw/openfirm.c index 7132c419..406e8dd6 100644 --- a/freebsd/sys/dev/ofw/openfirm.c +++ b/freebsd/sys/dev/ofw/openfirm.c @@ -3,6 +3,8 @@ /* $NetBSD: Locore.c,v 1.7 2000/08/20 07:04:59 tsubai Exp $ */ /*- + * SPDX-License-Identifier: BSD-4-Clause + * * Copyright (C) 1995, 1996 Wolfgang Solfrank. * Copyright (C) 1995, 1996 TooLs GmbH. * All rights reserved. @@ -210,6 +212,12 @@ OF_install(char *name, int prio) ofw_def_t *ofwp, **ofwpp; static int curr_prio = 0; + /* Allow OF layer to be uninstalled */ + if (name == NULL) { + ofw_def_impl = NULL; + return (FALSE); + } + /* * Try and locate the OFW kobj corresponding to the name. */ diff --git a/freebsd/sys/dev/ofw/openfirm.h b/freebsd/sys/dev/ofw/openfirm.h index 4e9fb29c..e1701164 100644 --- a/freebsd/sys/dev/ofw/openfirm.h +++ b/freebsd/sys/dev/ofw/openfirm.h @@ -1,6 +1,8 @@ /* $NetBSD: openfirm.h,v 1.1 1998/05/15 10:16:00 tsubai Exp $ */ /*- + * SPDX-License-Identifier: BSD-4-Clause + * * Copyright (C) 1995, 1996 Wolfgang Solfrank. * Copyright (C) 1995, 1996 TooLs GmbH. * All rights reserved. diff --git a/freebsd/sys/dev/pci/pci.c b/freebsd/sys/dev/pci/pci.c index 69497d2c..e492846d 100644 --- a/freebsd/sys/dev/pci/pci.c +++ b/freebsd/sys/dev/pci/pci.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 1997, Stefan Esser <se@freebsd.org> * Copyright (c) 2000, Michael Smith <msmith@freebsd.org> * Copyright (c) 2000, BSDi @@ -323,9 +325,9 @@ SYSCTL_NODE(_hw, OID_AUTO, pci, CTLFLAG_RD, 0, "PCI bus tuning parameters"); static int pci_enable_io_modes = 1; SYSCTL_INT(_hw_pci, OID_AUTO, enable_io_modes, CTLFLAG_RWTUN, &pci_enable_io_modes, 1, - "Enable I/O and memory bits in the config register. Some BIOSes do not\n\ -enable these bits correctly. We'd like to do this all the time, but there\n\ -are some peripherals that this causes problems with."); + "Enable I/O and memory bits in the config register. Some BIOSes do not" + " enable these bits correctly. We'd like to do this all the time, but" + " there are some peripherals that this causes problems with."); static int pci_do_realloc_bars = 0; SYSCTL_INT(_hw_pci, OID_AUTO, realloc_bars, CTLFLAG_RWTUN, @@ -336,10 +338,10 @@ SYSCTL_INT(_hw_pci, OID_AUTO, realloc_bars, CTLFLAG_RWTUN, static int pci_do_power_nodriver = 0; SYSCTL_INT(_hw_pci, OID_AUTO, do_power_nodriver, CTLFLAG_RWTUN, &pci_do_power_nodriver, 0, - "Place a function into D3 state when no driver attaches to it. 0 means\n\ -disable. 1 means conservatively place devices into D3 state. 2 means\n\ -aggressively place devices into D3 state. 3 means put absolutely everything\n\ -in D3 state."); + "Place a function into D3 state when no driver attaches to it. 0 means" + " disable. 1 means conservatively place devices into D3 state. 2 means" + " aggressively place devices into D3 state. 3 means put absolutely" + " everything in D3 state."); int pci_do_power_resume = 1; SYSCTL_INT(_hw_pci, OID_AUTO, do_power_resume, CTLFLAG_RWTUN, @@ -374,9 +376,10 @@ static int pci_usb_takeover = 1; static int pci_usb_takeover = 0; #endif SYSCTL_INT(_hw_pci, OID_AUTO, usb_early_takeover, CTLFLAG_RDTUN, - &pci_usb_takeover, 1, "Enable early takeover of USB controllers.\n\ -Disable this if you depend on BIOS emulation of USB devices, that is\n\ -you use USB devices (like keyboard or mouse) but do not load USB drivers"); + &pci_usb_takeover, 1, + "Enable early takeover of USB controllers. Disable this if you depend on" + " BIOS emulation of USB devices, that is you use USB devices (like" + " keyboard or mouse) but do not load USB drivers"); static int pci_clear_bars; SYSCTL_INT(_hw_pci, OID_AUTO, clear_bars, CTLFLAG_RDTUN, &pci_clear_bars, 0, diff --git a/freebsd/sys/dev/pci/pci_pci.c b/freebsd/sys/dev/pci/pci_pci.c index ed4c1b50..5585bd32 100644 --- a/freebsd/sys/dev/pci/pci_pci.c +++ b/freebsd/sys/dev/pci/pci_pci.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1994,1995 Stefan Esser, Wolfgang StanglMeier * Copyright (c) 2000 Michael Smith <msmith@freebsd.org> * Copyright (c) 2000 BSDi diff --git a/freebsd/sys/dev/pci/pci_private.h b/freebsd/sys/dev/pci/pci_private.h index 6c5a1677..dd254e66 100644 --- a/freebsd/sys/dev/pci/pci_private.h +++ b/freebsd/sys/dev/pci/pci_private.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 1997, Stefan Esser <se@freebsd.org> * Copyright (c) 2000, Michael Smith <msmith@freebsd.org> * Copyright (c) 2000, BSDi diff --git a/freebsd/sys/dev/pci/pci_user.c b/freebsd/sys/dev/pci/pci_user.c index edad1847..6e1cc3ef 100644 --- a/freebsd/sys/dev/pci/pci_user.c +++ b/freebsd/sys/dev/pci/pci_user.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 1997, Stefan Esser <se@freebsd.org> * All rights reserved. * diff --git a/freebsd/sys/dev/pci/pcib_private.h b/freebsd/sys/dev/pci/pcib_private.h index 5482e12d..5cda3a38 100644 --- a/freebsd/sys/dev/pci/pcib_private.h +++ b/freebsd/sys/dev/pci/pcib_private.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1994,1995 Stefan Esser, Wolfgang StanglMeier * Copyright (c) 2000 Michael Smith <msmith@freebsd.org> * Copyright (c) 2000 BSDi diff --git a/freebsd/sys/dev/pci/pcireg.h b/freebsd/sys/dev/pci/pcireg.h index b434b2e6..00589c4b 100644 --- a/freebsd/sys/dev/pci/pcireg.h +++ b/freebsd/sys/dev/pci/pcireg.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 1997, Stefan Esser <se@freebsd.org> * All rights reserved. * diff --git a/freebsd/sys/dev/pci/pcivar.h b/freebsd/sys/dev/pci/pcivar.h index 4652715a..430e29db 100644 --- a/freebsd/sys/dev/pci/pcivar.h +++ b/freebsd/sys/dev/pci/pcivar.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 1997, Stefan Esser <se@freebsd.org> * All rights reserved. * diff --git a/freebsd/sys/dev/re/if_re.c b/freebsd/sys/dev/re/if_re.c index 0a2cb648..c8bb6db7 100644 --- a/freebsd/sys/dev/re/if_re.c +++ b/freebsd/sys/dev/re/if_re.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-4-Clause + * * Copyright (c) 1997, 1998-2003 * Bill Paul <wpaul@windriver.com>. All rights reserved. * diff --git a/freebsd/sys/dev/rtwn/usb/rtwn_usb_attach.h b/freebsd/sys/dev/rtwn/usb/rtwn_usb_attach.h index ee6d9137..6bbdf5bc 100644 --- a/freebsd/sys/dev/rtwn/usb/rtwn_usb_attach.h +++ b/freebsd/sys/dev/rtwn/usb/rtwn_usb_attach.h @@ -137,6 +137,8 @@ static const STRUCT_USB_HOST_ID rtwn_devs[] = { RTWN_RTL8812AU_DEV(SENAO, EUB1200AC), RTWN_RTL8812AU_DEV(SITECOMEU, WLA7100), RTWN_RTL8812AU_DEV(TPLINK, T4U), + RTWN_RTL8812AU_DEV(TPLINK, T4UV2), + RTWN_RTL8812AU_DEV(TPLINK, T4UHV2), RTWN_RTL8812AU_DEV(TRENDNET, TEW805UB), RTWN_RTL8812AU_DEV(ZYXEL, NWD6605), #undef RTWN_RTL8812AU_DEV diff --git a/freebsd/sys/dev/sdhci/sdhci.c b/freebsd/sys/dev/sdhci/sdhci.c index 8d1fed8f..496e8fac 100644 --- a/freebsd/sys/dev/sdhci/sdhci.c +++ b/freebsd/sys/dev/sdhci/sdhci.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2008 Alexander Motin <mav@FreeBSD.org> * Copyright (c) 2017 Marius Strobl <marius@FreeBSD.org> * All rights reserved. diff --git a/freebsd/sys/dev/sdhci/sdhci.h b/freebsd/sys/dev/sdhci/sdhci.h index ba66415f..f2a7a9b1 100644 --- a/freebsd/sys/dev/sdhci/sdhci.h +++ b/freebsd/sys/dev/sdhci/sdhci.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2008 Alexander Motin <mav@FreeBSD.org> * All rights reserved. * diff --git a/freebsd/sys/dev/smc/if_smc.c b/freebsd/sys/dev/smc/if_smc.c index fd1a0960..6b087a85 100644 --- a/freebsd/sys/dev/smc/if_smc.c +++ b/freebsd/sys/dev/smc/if_smc.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2008 Benno Rice. All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/freebsd/sys/dev/smc/if_smcreg.h b/freebsd/sys/dev/smc/if_smcreg.h index 4b939076..4642966f 100644 --- a/freebsd/sys/dev/smc/if_smcreg.h +++ b/freebsd/sys/dev/smc/if_smcreg.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2006 Benno Rice. All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/freebsd/sys/dev/smc/if_smcvar.h b/freebsd/sys/dev/smc/if_smcvar.h index fd42edbb..a58eb0df 100644 --- a/freebsd/sys/dev/smc/if_smcvar.h +++ b/freebsd/sys/dev/smc/if_smcvar.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2008 Benno Rice. All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/freebsd/sys/dev/tsec/if_tsec.c b/freebsd/sys/dev/tsec/if_tsec.c index b7edc948..e07c21ce 100644 --- a/freebsd/sys/dev/tsec/if_tsec.c +++ b/freebsd/sys/dev/tsec/if_tsec.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (C) 2007-2008 Semihalf, Rafal Jaworowski * Copyright (C) 2006-2007 Semihalf, Piotr Kruszynski * All rights reserved. diff --git a/freebsd/sys/dev/tsec/if_tsec.h b/freebsd/sys/dev/tsec/if_tsec.h index c8dca3bf..2caa2619 100644 --- a/freebsd/sys/dev/tsec/if_tsec.h +++ b/freebsd/sys/dev/tsec/if_tsec.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (C) 2006-2007 Semihalf, Piotr Kruszynski * All rights reserved. * diff --git a/freebsd/sys/dev/tsec/if_tsec_fdt.c b/freebsd/sys/dev/tsec/if_tsec_fdt.c index 476a5bf9..01718194 100644 --- a/freebsd/sys/dev/tsec/if_tsec_fdt.c +++ b/freebsd/sys/dev/tsec/if_tsec_fdt.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (C) 2007-2008 Semihalf, Rafal Jaworowski * Copyright (C) 2006-2007 Semihalf, Piotr Kruszynski * All rights reserved. diff --git a/freebsd/sys/dev/tsec/if_tsecreg.h b/freebsd/sys/dev/tsec/if_tsecreg.h index 1994298c..18a81df7 100644 --- a/freebsd/sys/dev/tsec/if_tsecreg.h +++ b/freebsd/sys/dev/tsec/if_tsecreg.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (C) 2008-2009 Semihalf, Piotr Ziecik * Copyright (C) 2006-2007 Semihalf, Piotr Kruszynski * All rights reserved. diff --git a/freebsd/sys/dev/usb/controller/dwc_otg.c b/freebsd/sys/dev/usb/controller/dwc_otg.c index 421eb77f..abc23ac6 100644 --- a/freebsd/sys/dev/usb/controller/dwc_otg.c +++ b/freebsd/sys/dev/usb/controller/dwc_otg.c @@ -2,6 +2,8 @@ /* $FreeBSD$ */ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2015 Daisuke Aoyama. All rights reserved. * Copyright (c) 2012-2015 Hans Petter Selasky. All rights reserved. * Copyright (c) 2010-2011 Aleksandr Rybalko. All rights reserved. diff --git a/freebsd/sys/dev/usb/controller/dwc_otg.h b/freebsd/sys/dev/usb/controller/dwc_otg.h index 7f5ede48..2de0214f 100644 --- a/freebsd/sys/dev/usb/controller/dwc_otg.h +++ b/freebsd/sys/dev/usb/controller/dwc_otg.h @@ -1,5 +1,7 @@ /* $FreeBSD$ */ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2012 Hans Petter Selasky. All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/freebsd/sys/dev/usb/controller/dwc_otg_fdt.c b/freebsd/sys/dev/usb/controller/dwc_otg_fdt.c index 791d9890..1cf96f4c 100644 --- a/freebsd/sys/dev/usb/controller/dwc_otg_fdt.c +++ b/freebsd/sys/dev/usb/controller/dwc_otg_fdt.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2012 Hans Petter Selasky. All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/freebsd/sys/dev/usb/controller/dwc_otgreg.h b/freebsd/sys/dev/usb/controller/dwc_otgreg.h index 8b9538ae..3c50ca58 100644 --- a/freebsd/sys/dev/usb/controller/dwc_otgreg.h +++ b/freebsd/sys/dev/usb/controller/dwc_otgreg.h @@ -1,6 +1,8 @@ /* $FreeBSD$ */ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2010,2011 Aleksandr Rybalko. All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/freebsd/sys/dev/usb/controller/ehci.c b/freebsd/sys/dev/usb/controller/ehci.c index 9de1491e..557698f6 100644 --- a/freebsd/sys/dev/usb/controller/ehci.c +++ b/freebsd/sys/dev/usb/controller/ehci.c @@ -2,6 +2,8 @@ /* $FreeBSD$ */ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2008 Hans Petter Selasky. All rights reserved. * Copyright (c) 2004 The NetBSD Foundation, Inc. All rights reserved. * Copyright (c) 2004 Lennart Augustsson. All rights reserved. diff --git a/freebsd/sys/dev/usb/controller/ehci.h b/freebsd/sys/dev/usb/controller/ehci.h index dd20c0a5..3a5f6781 100644 --- a/freebsd/sys/dev/usb/controller/ehci.h +++ b/freebsd/sys/dev/usb/controller/ehci.h @@ -1,5 +1,7 @@ /* $FreeBSD$ */ /*- + * SPDX-License-Identifier: BSD-2-Clause-NetBSD + * * Copyright (c) 2001 The NetBSD Foundation, Inc. * All rights reserved. * diff --git a/freebsd/sys/dev/usb/controller/ehcireg.h b/freebsd/sys/dev/usb/controller/ehcireg.h index 2394b2c1..81939e20 100644 --- a/freebsd/sys/dev/usb/controller/ehcireg.h +++ b/freebsd/sys/dev/usb/controller/ehcireg.h @@ -1,5 +1,7 @@ /* $FreeBSD$ */ /*- + * SPDX-License-Identifier: BSD-2-Clause-NetBSD + * * Copyright (c) 2001 The NetBSD Foundation, Inc. * All rights reserved. * diff --git a/freebsd/sys/dev/usb/controller/musb_otg.c b/freebsd/sys/dev/usb/controller/musb_otg.c index 0f1953b6..16a3adef 100644 --- a/freebsd/sys/dev/usb/controller/musb_otg.c +++ b/freebsd/sys/dev/usb/controller/musb_otg.c @@ -2,6 +2,8 @@ /* $FreeBSD$ */ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2008 Hans Petter Selasky. All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/freebsd/sys/dev/usb/controller/musb_otg.h b/freebsd/sys/dev/usb/controller/musb_otg.h index 7fe19a7c..55ab7aa6 100644 --- a/freebsd/sys/dev/usb/controller/musb_otg.h +++ b/freebsd/sys/dev/usb/controller/musb_otg.h @@ -1,5 +1,7 @@ /* $FreeBSD$ */ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2008 Hans Petter Selasky. All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/freebsd/sys/dev/usb/controller/ohci.c b/freebsd/sys/dev/usb/controller/ohci.c index 9f0654e3..df1981cc 100644 --- a/freebsd/sys/dev/usb/controller/ohci.c +++ b/freebsd/sys/dev/usb/controller/ohci.c @@ -2,6 +2,8 @@ /* $FreeBSD$ */ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2008 Hans Petter Selasky. All rights reserved. * Copyright (c) 1998 The NetBSD Foundation, Inc. All rights reserved. * Copyright (c) 1998 Lennart Augustsson. All rights reserved. diff --git a/freebsd/sys/dev/usb/controller/ohci.h b/freebsd/sys/dev/usb/controller/ohci.h index 69fc9a62..72e825ec 100755 --- a/freebsd/sys/dev/usb/controller/ohci.h +++ b/freebsd/sys/dev/usb/controller/ohci.h @@ -1,5 +1,7 @@ /* $FreeBSD$ */ /*- + * SPDX-License-Identifier: BSD-2-Clause-NetBSD + * * Copyright (c) 1998 The NetBSD Foundation, Inc. * All rights reserved. * diff --git a/freebsd/sys/dev/usb/controller/ohcireg.h b/freebsd/sys/dev/usb/controller/ohcireg.h index 7f14875c..c6ea4113 100644 --- a/freebsd/sys/dev/usb/controller/ohcireg.h +++ b/freebsd/sys/dev/usb/controller/ohcireg.h @@ -1,5 +1,7 @@ /* $FreeBSD$ */ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 1998 The NetBSD Foundation, Inc. * All rights reserved. * diff --git a/freebsd/sys/dev/usb/controller/uhcireg.h b/freebsd/sys/dev/usb/controller/uhcireg.h index 95eae494..fa0e4eb9 100644 --- a/freebsd/sys/dev/usb/controller/uhcireg.h +++ b/freebsd/sys/dev/usb/controller/uhcireg.h @@ -1,5 +1,7 @@ /* $FreeBSD$ */ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 1998 The NetBSD Foundation, Inc. * All rights reserved. * diff --git a/freebsd/sys/dev/usb/controller/usb_controller.c b/freebsd/sys/dev/usb/controller/usb_controller.c index 5f198aed..a2633d0d 100644 --- a/freebsd/sys/dev/usb/controller/usb_controller.c +++ b/freebsd/sys/dev/usb/controller/usb_controller.c @@ -2,6 +2,8 @@ /* $FreeBSD$ */ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2008 Hans Petter Selasky. All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/freebsd/sys/dev/usb/controller/xhcireg.h b/freebsd/sys/dev/usb/controller/xhcireg.h index 0e588ecb..b49bc09a 100644 --- a/freebsd/sys/dev/usb/controller/xhcireg.h +++ b/freebsd/sys/dev/usb/controller/xhcireg.h @@ -1,6 +1,8 @@ /* $FreeBSD$ */ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2010 Hans Petter Selasky. All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/freebsd/sys/dev/usb/input/atp.c b/freebsd/sys/dev/usb/input/atp.c index 17162411..d0fabe0d 100644 --- a/freebsd/sys/dev/usb/input/atp.c +++ b/freebsd/sys/dev/usb/input/atp.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2014 Rohit Grover * All rights reserved. * diff --git a/freebsd/sys/dev/usb/input/uep.c b/freebsd/sys/dev/usb/input/uep.c index d7af405f..701c8550 100644 --- a/freebsd/sys/dev/usb/input/uep.c +++ b/freebsd/sys/dev/usb/input/uep.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright 2010, Gleb Smirnoff <glebius@FreeBSD.org> * All rights reserved. * diff --git a/freebsd/sys/dev/usb/input/uhid.c b/freebsd/sys/dev/usb/input/uhid.c index 6de5944d..90761ab7 100644 --- a/freebsd/sys/dev/usb/input/uhid.c +++ b/freebsd/sys/dev/usb/input/uhid.c @@ -10,6 +10,8 @@ __FBSDID("$FreeBSD$"); /*- + * SPDX-License-Identifier: BSD-2-Clause-NetBSD + * * Copyright (c) 1998 The NetBSD Foundation, Inc. * All rights reserved. * diff --git a/freebsd/sys/dev/usb/input/ukbd.c b/freebsd/sys/dev/usb/input/ukbd.c index d473d1ea..9b1d28fc 100644 --- a/freebsd/sys/dev/usb/input/ukbd.c +++ b/freebsd/sys/dev/usb/input/ukbd.c @@ -5,6 +5,8 @@ __FBSDID("$FreeBSD$"); /*- + * SPDX-License-Identifier: BSD-2-Clause-NetBSD + * * Copyright (c) 1998 The NetBSD Foundation, Inc. * All rights reserved. * diff --git a/freebsd/sys/dev/usb/input/ums.c b/freebsd/sys/dev/usb/input/ums.c index 36c1d1b4..79bc2291 100644 --- a/freebsd/sys/dev/usb/input/ums.c +++ b/freebsd/sys/dev/usb/input/ums.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 1998 The NetBSD Foundation, Inc. * All rights reserved. * @@ -298,7 +300,7 @@ ums_intr_callback(struct usb_xfer *xfer, usb_error_t error) if ((info->sc_flags & UMS_FLAG_T_AXIS) && (id == info->sc_iid_t)) { - dt -= hid_get_data(buf, len, &info->sc_loc_t); + dt += hid_get_data(buf, len, &info->sc_loc_t); /* T-axis is translated into button presses */ buttons_found |= (1UL << 5) | (1UL << 6); } @@ -334,10 +336,10 @@ ums_intr_callback(struct usb_xfer *xfer, usb_error_t error) /* translate T-axis into button presses until further */ if (dt > 0) { ums_put_queue(sc, 0, 0, 0, 0, buttons); - buttons |= 1UL << 5; + buttons |= 1UL << 6; } else if (dt < 0) { ums_put_queue(sc, 0, 0, 0, 0, buttons); - buttons |= 1UL << 6; + buttons |= 1UL << 5; } sc->sc_status.button = buttons; diff --git a/freebsd/sys/dev/usb/input/usb_rdesc.h b/freebsd/sys/dev/usb/input/usb_rdesc.h index 23ea620b..00eea122 100644 --- a/freebsd/sys/dev/usb/input/usb_rdesc.h +++ b/freebsd/sys/dev/usb/input/usb_rdesc.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2000 Nick Hibma <n_hibma@FreeBSD.org> * All rights reserved. * diff --git a/freebsd/sys/dev/usb/input/wsp.c b/freebsd/sys/dev/usb/input/wsp.c index d3eae491..0eb2c024 100644 --- a/freebsd/sys/dev/usb/input/wsp.c +++ b/freebsd/sys/dev/usb/input/wsp.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2012 Huang Wen Hui * All rights reserved. * diff --git a/freebsd/sys/dev/usb/net/if_aue.c b/freebsd/sys/dev/usb/net/if_aue.c index 06ccd8ce..69951b70 100644 --- a/freebsd/sys/dev/usb/net/if_aue.c +++ b/freebsd/sys/dev/usb/net/if_aue.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-4-Clause + * * Copyright (c) 1997, 1998, 1999, 2000 * Bill Paul <wpaul@ee.columbia.edu>. All rights reserved. * diff --git a/freebsd/sys/dev/usb/net/if_auereg.h b/freebsd/sys/dev/usb/net/if_auereg.h index 4d0843eb..dfbaac42 100644 --- a/freebsd/sys/dev/usb/net/if_auereg.h +++ b/freebsd/sys/dev/usb/net/if_auereg.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-4-Clause + * * Copyright (c) 1997, 1998, 1999 * Bill Paul <wpaul@ee.columbia.edu>. All rights reserved. * diff --git a/freebsd/sys/dev/usb/net/if_axe.c b/freebsd/sys/dev/usb/net/if_axe.c index 728f8e3d..b77292ba 100644 --- a/freebsd/sys/dev/usb/net/if_axe.c +++ b/freebsd/sys/dev/usb/net/if_axe.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-4-Clause + * * Copyright (c) 1997, 1998, 1999, 2000-2003 * Bill Paul <wpaul@windriver.com>. All rights reserved. * diff --git a/freebsd/sys/dev/usb/net/if_axereg.h b/freebsd/sys/dev/usb/net/if_axereg.h index 64cb2352..2654bbba 100644 --- a/freebsd/sys/dev/usb/net/if_axereg.h +++ b/freebsd/sys/dev/usb/net/if_axereg.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-4-Clause + * * Copyright (c) 1997, 1998, 1999, 2000-2003 * Bill Paul <wpaul@windriver.com>. All rights reserved. * diff --git a/freebsd/sys/dev/usb/net/if_axge.c b/freebsd/sys/dev/usb/net/if_axge.c index 4e6f05b5..fc602b88 100644 --- a/freebsd/sys/dev/usb/net/if_axge.c +++ b/freebsd/sys/dev/usb/net/if_axge.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2013-2014 Kevin Lo * All rights reserved. * diff --git a/freebsd/sys/dev/usb/net/if_axgereg.h b/freebsd/sys/dev/usb/net/if_axgereg.h index c073610f..542ea6d1 100644 --- a/freebsd/sys/dev/usb/net/if_axgereg.h +++ b/freebsd/sys/dev/usb/net/if_axgereg.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2013-2014 Kevin Lo * All rights reserved. * diff --git a/freebsd/sys/dev/usb/net/if_cdce.c b/freebsd/sys/dev/usb/net/if_cdce.c index 777113da..ececc5b3 100644 --- a/freebsd/sys/dev/usb/net/if_cdce.c +++ b/freebsd/sys/dev/usb/net/if_cdce.c @@ -3,6 +3,8 @@ /* $NetBSD: if_cdce.c,v 1.4 2004/10/24 12:50:54 augustss Exp $ */ /*- + * SPDX-License-Identifier: BSD-4-Clause + * * Copyright (c) 1997, 1998, 1999, 2000-2003 Bill Paul <wpaul@windriver.com> * Copyright (c) 2003-2005 Craig Boston * Copyright (c) 2004 Daniel Hartmeier diff --git a/freebsd/sys/dev/usb/net/if_cdcereg.h b/freebsd/sys/dev/usb/net/if_cdcereg.h index 1bc2d603..26d037c5 100644 --- a/freebsd/sys/dev/usb/net/if_cdcereg.h +++ b/freebsd/sys/dev/usb/net/if_cdcereg.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-4-Clause + * * Copyright (c) 2003-2005 Craig Boston * All rights reserved. * diff --git a/freebsd/sys/dev/usb/net/if_cue.c b/freebsd/sys/dev/usb/net/if_cue.c index d5152dd4..63846a01 100644 --- a/freebsd/sys/dev/usb/net/if_cue.c +++ b/freebsd/sys/dev/usb/net/if_cue.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-4-Clause + * * Copyright (c) 1997, 1998, 1999, 2000 * Bill Paul <wpaul@ee.columbia.edu>. All rights reserved. * diff --git a/freebsd/sys/dev/usb/net/if_cuereg.h b/freebsd/sys/dev/usb/net/if_cuereg.h index ff245c05..b5cccee4 100644 --- a/freebsd/sys/dev/usb/net/if_cuereg.h +++ b/freebsd/sys/dev/usb/net/if_cuereg.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-4-Clause + * * Copyright (c) 1997, 1998, 1999, 2000 * Bill Paul <wpaul@ee.columbia.edu>. All rights reserved. * diff --git a/freebsd/sys/dev/usb/net/if_ipheth.c b/freebsd/sys/dev/usb/net/if_ipheth.c index 2eaf88b8..bb56c294 100644 --- a/freebsd/sys/dev/usb/net/if_ipheth.c +++ b/freebsd/sys/dev/usb/net/if_ipheth.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2010 Hans Petter Selasky. All rights reserved. * Copyright (c) 2009 Diego Giagio. All rights reserved. * diff --git a/freebsd/sys/dev/usb/net/if_iphethvar.h b/freebsd/sys/dev/usb/net/if_iphethvar.h index 65b0c940..4f990189 100644 --- a/freebsd/sys/dev/usb/net/if_iphethvar.h +++ b/freebsd/sys/dev/usb/net/if_iphethvar.h @@ -1,5 +1,7 @@ /* $FreeBSD$ */ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2010 Hans Petter Selasky. All rights reserved. * Copyright (c) 2009 Diego Giagio. All rights reserved. * diff --git a/freebsd/sys/dev/usb/net/if_kue.c b/freebsd/sys/dev/usb/net/if_kue.c index 26e09459..255a83bb 100644 --- a/freebsd/sys/dev/usb/net/if_kue.c +++ b/freebsd/sys/dev/usb/net/if_kue.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-4-Clause + * * Copyright (c) 1997, 1998, 1999, 2000 * Bill Paul <wpaul@ee.columbia.edu>. All rights reserved. * diff --git a/freebsd/sys/dev/usb/net/if_kuefw.h b/freebsd/sys/dev/usb/net/if_kuefw.h index 2b055a92..8b799f01 100644 --- a/freebsd/sys/dev/usb/net/if_kuefw.h +++ b/freebsd/sys/dev/usb/net/if_kuefw.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-4-Clause + * * Copyright (c) 1997, 1998, 1999, 2000 * Bill Paul <wpaul@ee.columbia.edu>. All rights reserved. * diff --git a/freebsd/sys/dev/usb/net/if_kuereg.h b/freebsd/sys/dev/usb/net/if_kuereg.h index 16ad044d..2f5d7ccb 100644 --- a/freebsd/sys/dev/usb/net/if_kuereg.h +++ b/freebsd/sys/dev/usb/net/if_kuereg.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-4-Clause + * * Copyright (c) 1997, 1998, 1999, 2000 * Bill Paul <wpaul@ee.columbia.edu>. All rights reserved. * diff --git a/freebsd/sys/dev/usb/net/if_mos.c b/freebsd/sys/dev/usb/net/if_mos.c index 8cac9033..a25e9df6 100644 --- a/freebsd/sys/dev/usb/net/if_mos.c +++ b/freebsd/sys/dev/usb/net/if_mos.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: 0BSD AND BSD-4-Clause + * * Copyright (c) 2011 Rick van der Zwet <info@rickvanderzwet.nl> * * Permission to use, copy, modify, and distribute this software for any diff --git a/freebsd/sys/dev/usb/net/if_mosreg.h b/freebsd/sys/dev/usb/net/if_mosreg.h index c811d552..b8034feb 100644 --- a/freebsd/sys/dev/usb/net/if_mosreg.h +++ b/freebsd/sys/dev/usb/net/if_mosreg.h @@ -32,6 +32,8 @@ */ /*- + * SPDX-License-Identifier: BSD-4-Clause + * * Copyright (c) 1997, 1998, 1999, 2000-2003 * Bill Paul <wpaul@windriver.com>. All rights reserved. * diff --git a/freebsd/sys/dev/usb/net/if_rue.c b/freebsd/sys/dev/usb/net/if_rue.c index e816a190..7b062755 100644 --- a/freebsd/sys/dev/usb/net/if_rue.c +++ b/freebsd/sys/dev/usb/net/if_rue.c @@ -27,6 +27,8 @@ * SUCH DAMAGE. */ /*- + * SPDX-License-Identifier: BSD-4-Clause AND BSD-2-Clause-FreeBSD + * * Copyright (c) 1997, 1998, 1999, 2000 * Bill Paul <wpaul@ee.columbia.edu>. All rights reserved. * diff --git a/freebsd/sys/dev/usb/net/if_ruereg.h b/freebsd/sys/dev/usb/net/if_ruereg.h index c90a9692..688ee24e 100644 --- a/freebsd/sys/dev/usb/net/if_ruereg.h +++ b/freebsd/sys/dev/usb/net/if_ruereg.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2001-2003, Shunsuke Akiyama <akiyama@FreeBSD.org>. * All rights reserved. * diff --git a/freebsd/sys/dev/usb/net/if_smsc.c b/freebsd/sys/dev/usb/net/if_smsc.c index 9c028b4e..88ecb618 100644 --- a/freebsd/sys/dev/usb/net/if_smsc.c +++ b/freebsd/sys/dev/usb/net/if_smsc.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2012 * Ben Gray <bgray@freebsd.org>. * All rights reserved. @@ -1570,8 +1572,9 @@ smsc_fdt_find_eth_node(phandle_t start) /* Traverse through entire tree to find usb ethernet nodes. */ for (node = OF_child(start); node != 0; node = OF_peer(node)) { - if (ofw_bus_node_is_compatible(node, "net,ethernet") && - ofw_bus_node_is_compatible(node, "usb,device")) + if ((ofw_bus_node_is_compatible(node, "net,ethernet") && + ofw_bus_node_is_compatible(node, "usb,device")) || + ofw_bus_node_is_compatible(node, "usb424,ec00")) return (node); child = smsc_fdt_find_eth_node(node); if (child != -1) @@ -1638,6 +1641,37 @@ smsc_fdt_find_eth_node_by_path(phandle_t start) return (-1); } +/* + * Look through known names that can contain mac address + * return 0 if valid MAC address has been found + */ +static int +smsc_fdt_read_mac_property(phandle_t node, unsigned char *mac) +{ + int len; + + /* Check if there is property */ + if ((len = OF_getproplen(node, "local-mac-address")) > 0) { + if (len != ETHER_ADDR_LEN) + return (EINVAL); + + OF_getprop(node, "local-mac-address", mac, + ETHER_ADDR_LEN); + return (0); + } + + if ((len = OF_getproplen(node, "mac-address")) > 0) { + if (len != ETHER_ADDR_LEN) + return (EINVAL); + + OF_getprop(node, "mac-address", mac, + ETHER_ADDR_LEN); + return (0); + } + + return (ENXIO); +} + /** * Get MAC address from FDT blob. Firmware or loader should fill * mac-address or local-mac-address property. Returns 0 if MAC address @@ -1647,37 +1681,22 @@ static int smsc_fdt_find_mac(unsigned char *mac) { phandle_t node, root; - int len; root = OF_finddevice("/"); node = smsc_fdt_find_eth_node(root); + if (node != -1) { + if (smsc_fdt_read_mac_property(node, mac) == 0) + return (0); + } + /* * If it's not FreeBSD FDT blob for RPi, try more * generic .../usb/hub/ethernet */ - if (node == -1) - node = smsc_fdt_find_eth_node_by_path(root); - - if (node != -1) { - /* Check if there is property */ - if ((len = OF_getproplen(node, "local-mac-address")) > 0) { - if (len != ETHER_ADDR_LEN) - return (EINVAL); - - OF_getprop(node, "local-mac-address", mac, - ETHER_ADDR_LEN); - return (0); - } + node = smsc_fdt_find_eth_node_by_path(root); - if ((len = OF_getproplen(node, "mac-address")) > 0) { - if (len != ETHER_ADDR_LEN) - return (EINVAL); - - OF_getprop(node, "mac-address", mac, - ETHER_ADDR_LEN); - return (0); - } - } + if (node != -1) + return smsc_fdt_read_mac_property(node, mac); return (ENXIO); } diff --git a/freebsd/sys/dev/usb/net/if_smscreg.h b/freebsd/sys/dev/usb/net/if_smscreg.h index 31a63828..5ad79b9e 100644 --- a/freebsd/sys/dev/usb/net/if_smscreg.h +++ b/freebsd/sys/dev/usb/net/if_smscreg.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2012 * Ben Gray <bgray@freebsd.org>. * All rights reserved. diff --git a/freebsd/sys/dev/usb/net/if_udav.c b/freebsd/sys/dev/usb/net/if_udav.c index b8393abc..21019265 100644 --- a/freebsd/sys/dev/usb/net/if_udav.c +++ b/freebsd/sys/dev/usb/net/if_udav.c @@ -4,6 +4,8 @@ /* $nabe: if_udav.c,v 1.3 2003/08/21 16:57:19 nabe Exp $ */ /* $FreeBSD$ */ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 2003 * Shingo WATANABE <nabe@nabechan.org>. All rights reserved. * diff --git a/freebsd/sys/dev/usb/net/if_udavreg.h b/freebsd/sys/dev/usb/net/if_udavreg.h index 7c35829b..d8927006 100644 --- a/freebsd/sys/dev/usb/net/if_udavreg.h +++ b/freebsd/sys/dev/usb/net/if_udavreg.h @@ -2,6 +2,8 @@ /* $nabe: if_udavreg.h,v 1.2 2003/08/21 16:26:40 nabe Exp $ */ /* $FreeBSD$ */ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 2003 * Shingo WATANABE <nabe@nabechan.org>. All rights reserved. * diff --git a/freebsd/sys/dev/usb/net/if_ure.c b/freebsd/sys/dev/usb/net/if_ure.c index 89ce723b..0e45a6c9 100644 --- a/freebsd/sys/dev/usb/net/if_ure.c +++ b/freebsd/sys/dev/usb/net/if_ure.c @@ -72,6 +72,7 @@ static const STRUCT_USB_HOST_ID ure_devs[] = { URE_DEV(LENOVO, RTL8153, 0), URE_DEV(REALTEK, RTL8152, URE_FLAG_8152), URE_DEV(REALTEK, RTL8153, 0), + URE_DEV(TPLINK, RTL8153, 0), #undef URE_DEV }; diff --git a/freebsd/sys/dev/usb/net/ruephy.c b/freebsd/sys/dev/usb/net/ruephy.c index af01d23b..d16bc8ae 100644 --- a/freebsd/sys/dev/usb/net/ruephy.c +++ b/freebsd/sys/dev/usb/net/ruephy.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2001-2003, Shunsuke Akiyama <akiyama@FreeBSD.org>. * All rights reserved. * diff --git a/freebsd/sys/dev/usb/net/ruephyreg.h b/freebsd/sys/dev/usb/net/ruephyreg.h index 01d3cc17..38c508d5 100644 --- a/freebsd/sys/dev/usb/net/ruephyreg.h +++ b/freebsd/sys/dev/usb/net/ruephyreg.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2001-2003, Shunsuke Akiyama <akiyama@FreeBSD.org>. * All rights reserved. * diff --git a/freebsd/sys/dev/usb/net/usb_ethernet.c b/freebsd/sys/dev/usb/net/usb_ethernet.c index 32c0fa22..842e7987 100644 --- a/freebsd/sys/dev/usb/net/usb_ethernet.c +++ b/freebsd/sys/dev/usb/net/usb_ethernet.c @@ -2,6 +2,8 @@ /* $FreeBSD$ */ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2009 Andrew Thompson (thompsa@FreeBSD.org) * * Redistribution and use in source and binary forms, with or without diff --git a/freebsd/sys/dev/usb/net/usb_ethernet.h b/freebsd/sys/dev/usb/net/usb_ethernet.h index d22e5d9b..c7afc650 100644 --- a/freebsd/sys/dev/usb/net/usb_ethernet.h +++ b/freebsd/sys/dev/usb/net/usb_ethernet.h @@ -1,5 +1,7 @@ /* $FreeBSD$ */ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2008 Hans Petter Selasky. All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/freebsd/sys/dev/usb/quirk/usb_quirk.c b/freebsd/sys/dev/usb/quirk/usb_quirk.c index 3ea3f3c6..8c9e91cb 100644 --- a/freebsd/sys/dev/usb/quirk/usb_quirk.c +++ b/freebsd/sys/dev/usb/quirk/usb_quirk.c @@ -2,6 +2,8 @@ /* $FreeBSD$ */ /*- + * SPDX-License-Identifier: BSD-2-Clause-NetBSD + * * Copyright (c) 1998 The NetBSD Foundation, Inc. All rights reserved. * Copyright (c) 1998 Lennart Augustsson. All rights reserved. * Copyright (c) 2008 Hans Petter Selasky. All rights reserved. diff --git a/freebsd/sys/dev/usb/quirk/usb_quirk.h b/freebsd/sys/dev/usb/quirk/usb_quirk.h index bb9fe190..e7f2e02f 100644 --- a/freebsd/sys/dev/usb/quirk/usb_quirk.h +++ b/freebsd/sys/dev/usb/quirk/usb_quirk.h @@ -1,5 +1,7 @@ /* $FreeBSD$ */ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2008 Hans Petter Selasky. All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/freebsd/sys/dev/usb/serial/u3g.c b/freebsd/sys/dev/usb/serial/u3g.c index 3582b6d8..0f3933e6 100644 --- a/freebsd/sys/dev/usb/serial/u3g.c +++ b/freebsd/sys/dev/usb/serial/u3g.c @@ -238,6 +238,8 @@ static const STRUCT_USB_HOST_ID u3g_devs[] = { U3G_DEV(DLINK, DWR510, 0), U3G_DEV(DLINK, DWM157_CD, U3GINIT_SCSIEJECT), U3G_DEV(DLINK, DWM157, 0), + U3G_DEV(DLINK, DWM222_CD, U3GINIT_SCSIEJECT), + U3G_DEV(DLINK, DWM222, 0), U3G_DEV(DLINK3, DWM652, 0), U3G_DEV(HP, EV2200, 0), U3G_DEV(HP, HS2300, 0), diff --git a/freebsd/sys/dev/usb/serial/ubsa.c b/freebsd/sys/dev/usb/serial/ubsa.c index 61005fa0..8b6284f0 100644 --- a/freebsd/sys/dev/usb/serial/ubsa.c +++ b/freebsd/sys/dev/usb/serial/ubsa.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD AND BSD-2-Clause-NetBSD + * * Copyright (c) 2002, Alexander Kabaev <kan.FreeBSD.org>. * All rights reserved. * diff --git a/freebsd/sys/dev/usb/serial/ubser.c b/freebsd/sys/dev/usb/serial/ubser.c index 534c5e75..9fdb1d3a 100644 --- a/freebsd/sys/dev/usb/serial/ubser.c +++ b/freebsd/sys/dev/usb/serial/ubser.c @@ -10,6 +10,8 @@ */ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD AND BSD-2-Clause-NetBSD + * * Copyright (c) 2001-2002, Shunsuke Akiyama <akiyama@jp.FreeBSD.org>. * All rights reserved. * diff --git a/freebsd/sys/dev/usb/serial/uchcom.c b/freebsd/sys/dev/usb/serial/uchcom.c index 3bee03d9..1e741ccd 100644 --- a/freebsd/sys/dev/usb/serial/uchcom.c +++ b/freebsd/sys/dev/usb/serial/uchcom.c @@ -3,6 +3,8 @@ /* $NetBSD: uchcom.c,v 1.1 2007/09/03 17:57:37 tshiozak Exp $ */ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD AND BSD-2-Clause-NetBSD + * * Copyright (c) 2007, Takanori Watanabe * All rights reserved. * diff --git a/freebsd/sys/dev/usb/serial/ucycom.c b/freebsd/sys/dev/usb/serial/ucycom.c index 6f83d450..1166d36d 100644 --- a/freebsd/sys/dev/usb/serial/ucycom.c +++ b/freebsd/sys/dev/usb/serial/ucycom.c @@ -4,6 +4,8 @@ __FBSDID("$FreeBSD$"); /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2004 Dag-Erling Coïdan Smørgrav * All rights reserved. * diff --git a/freebsd/sys/dev/usb/serial/ufoma.c b/freebsd/sys/dev/usb/serial/ufoma.c index bcd70308..97ffea63 100644 --- a/freebsd/sys/dev/usb/serial/ufoma.c +++ b/freebsd/sys/dev/usb/serial/ufoma.c @@ -6,6 +6,8 @@ __FBSDID("$FreeBSD$"); #define UFOMA_HANDSFREE /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD AND BSD-2-Clause-NetBSD + * * Copyright (c) 2005, Takanori Watanabe * Copyright (c) 2003, M. Warner Losh <imp@FreeBSD.org>. * All rights reserved. diff --git a/freebsd/sys/dev/usb/serial/uftdi.c b/freebsd/sys/dev/usb/serial/uftdi.c index a40ee4f7..d07c055d 100644 --- a/freebsd/sys/dev/usb/serial/uftdi.c +++ b/freebsd/sys/dev/usb/serial/uftdi.c @@ -3,6 +3,8 @@ /* $NetBSD: uftdi.c,v 1.13 2002/09/23 05:51:23 simonb Exp $ */ /*- + * SPDX-License-Identifier: BSD-2-Clause-NetBSD + * * Copyright (c) 2000 The NetBSD Foundation, Inc. * All rights reserved. * diff --git a/freebsd/sys/dev/usb/serial/ugensa.c b/freebsd/sys/dev/usb/serial/ugensa.c index 15f6c9e3..2737227c 100644 --- a/freebsd/sys/dev/usb/serial/ugensa.c +++ b/freebsd/sys/dev/usb/serial/ugensa.c @@ -3,7 +3,9 @@ /* $FreeBSD$ */ /* $NetBSD: ugensa.c,v 1.9.2.1 2007/03/24 14:55:50 yamt Exp $ */ -/* +/*- + * SPDX-License-Identifier: BSD-2-Clause-NetBSD + * * Copyright (c) 2004, 2005 The NetBSD Foundation, Inc. * All rights reserved. * diff --git a/freebsd/sys/dev/usb/serial/uipaq.c b/freebsd/sys/dev/usb/serial/uipaq.c index b512b0e5..bf746295 100644 --- a/freebsd/sys/dev/usb/serial/uipaq.c +++ b/freebsd/sys/dev/usb/serial/uipaq.c @@ -3,7 +3,9 @@ /* $NetBSD: uipaq.c,v 1.4 2006/11/16 01:33:27 christos Exp $ */ /* $OpenBSD: uipaq.c,v 1.1 2005/06/17 23:50:33 deraadt Exp $ */ -/* +/*- + * SPDX-License-Identifier: BSD-2-Clause-NetBSD + * * Copyright (c) 2000-2005 The NetBSD Foundation, Inc. * All rights reserved. * diff --git a/freebsd/sys/dev/usb/serial/ulpt.c b/freebsd/sys/dev/usb/serial/ulpt.c index bd2d966a..c966e602 100644 --- a/freebsd/sys/dev/usb/serial/ulpt.c +++ b/freebsd/sys/dev/usb/serial/ulpt.c @@ -6,6 +6,8 @@ __FBSDID("$FreeBSD$"); /* $NetBSD: ulpt.c,v 1.60 2003/10/04 21:19:50 augustss Exp $ */ /*- + * SPDX-License-Identifier: BSD-2-Clause-NetBSD + * * Copyright (c) 1998, 2003 The NetBSD Foundation, Inc. * All rights reserved. * diff --git a/freebsd/sys/dev/usb/serial/umcs.c b/freebsd/sys/dev/usb/serial/umcs.c index 5d803e44..8f083ce3 100644 --- a/freebsd/sys/dev/usb/serial/umcs.c +++ b/freebsd/sys/dev/usb/serial/umcs.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2010 Lev Serebryakov <lev@FreeBSD.org>. * All rights reserved. * diff --git a/freebsd/sys/dev/usb/serial/umcs.h b/freebsd/sys/dev/usb/serial/umcs.h index 8ba57c13..288988c2 100644 --- a/freebsd/sys/dev/usb/serial/umcs.h +++ b/freebsd/sys/dev/usb/serial/umcs.h @@ -1,5 +1,7 @@ /* $FreeBSD$ */ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2010 Lev Serebryakov <lev@FreeBSD.org>. * All rights reserved. * diff --git a/freebsd/sys/dev/usb/serial/umct.c b/freebsd/sys/dev/usb/serial/umct.c index 5c00985d..e6877a36 100644 --- a/freebsd/sys/dev/usb/serial/umct.c +++ b/freebsd/sys/dev/usb/serial/umct.c @@ -4,6 +4,8 @@ __FBSDID("$FreeBSD$"); /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2003 Scott Long * All rights reserved. * diff --git a/freebsd/sys/dev/usb/serial/umodem.c b/freebsd/sys/dev/usb/serial/umodem.c index 2d36f125..c64600c8 100644 --- a/freebsd/sys/dev/usb/serial/umodem.c +++ b/freebsd/sys/dev/usb/serial/umodem.c @@ -6,6 +6,8 @@ __FBSDID("$FreeBSD$"); /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD AND BSD-2-Clause-NetBSD + * * Copyright (c) 2003, M. Warner Losh <imp@FreeBSD.org>. * All rights reserved. * diff --git a/freebsd/sys/dev/usb/serial/uplcom.c b/freebsd/sys/dev/usb/serial/uplcom.c index 7ec41e97..2b90e4d6 100644 --- a/freebsd/sys/dev/usb/serial/uplcom.c +++ b/freebsd/sys/dev/usb/serial/uplcom.c @@ -6,6 +6,8 @@ __FBSDID("$FreeBSD$"); /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD AND BSD-2-Clause-NetBSD + * * Copyright (c) 2001-2003, 2005 Shunsuke Akiyama <akiyama@jp.FreeBSD.org>. * All rights reserved. * diff --git a/freebsd/sys/dev/usb/serial/usb_serial.c b/freebsd/sys/dev/usb/serial/usb_serial.c index eb3adabd..46a18d63 100644 --- a/freebsd/sys/dev/usb/serial/usb_serial.c +++ b/freebsd/sys/dev/usb/serial/usb_serial.c @@ -3,6 +3,8 @@ /* $NetBSD: ucom.c,v 1.40 2001/11/13 06:24:54 lukem Exp $ */ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD AND BSD-2-Clause-NetBSD + * * Copyright (c) 2001-2003, 2005, 2008 * Shunsuke Akiyama <akiyama@jp.FreeBSD.org>. * All rights reserved. diff --git a/freebsd/sys/dev/usb/serial/usb_serial.h b/freebsd/sys/dev/usb/serial/usb_serial.h index 2c53f445..9a5e043e 100644 --- a/freebsd/sys/dev/usb/serial/usb_serial.h +++ b/freebsd/sys/dev/usb/serial/usb_serial.h @@ -2,6 +2,8 @@ /* $FreeBSD$ */ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD AND BSD-2-Clause-NetBSD + * * Copyright (c) 2001-2002, Shunsuke Akiyama <akiyama@jp.FreeBSD.org>. * All rights reserved. * diff --git a/freebsd/sys/dev/usb/serial/uvisor.c b/freebsd/sys/dev/usb/serial/uvisor.c index c749b415..18db98c7 100644 --- a/freebsd/sys/dev/usb/serial/uvisor.c +++ b/freebsd/sys/dev/usb/serial/uvisor.c @@ -16,6 +16,8 @@ */ /*- + * SPDX-License-Identifier: BSD-2-Clause-NetBSD + * * Copyright (c) 2000 The NetBSD Foundation, Inc. * All rights reserved. * diff --git a/freebsd/sys/dev/usb/serial/uvscom.c b/freebsd/sys/dev/usb/serial/uvscom.c index 04d92a41..f4cc6ee6 100644 --- a/freebsd/sys/dev/usb/serial/uvscom.c +++ b/freebsd/sys/dev/usb/serial/uvscom.c @@ -6,6 +6,8 @@ __FBSDID("$FreeBSD$"); /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2001-2003, 2005 Shunsuke Akiyama <akiyama@jp.FreeBSD.org>. * All rights reserved. * diff --git a/freebsd/sys/dev/usb/storage/umass.c b/freebsd/sys/dev/usb/storage/umass.c index c99874e2..6b488cf7 100644 --- a/freebsd/sys/dev/usb/storage/umass.c +++ b/freebsd/sys/dev/usb/storage/umass.c @@ -4,6 +4,8 @@ __FBSDID("$FreeBSD$"); /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 1999 MAEKAWA Masahide <bishop@rr.iij4u.or.jp>, * Nick Hibma <n_hibma@FreeBSD.org> * All rights reserved. diff --git a/freebsd/sys/dev/usb/ufm_ioctl.h b/freebsd/sys/dev/usb/ufm_ioctl.h index 5a233883..599d36d4 100644 --- a/freebsd/sys/dev/usb/ufm_ioctl.h +++ b/freebsd/sys/dev/usb/ufm_ioctl.h @@ -1,5 +1,7 @@ /* $FreeBSD$ */ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2001 M. Warner Losh * All rights reserved. * diff --git a/freebsd/sys/dev/usb/usb.h b/freebsd/sys/dev/usb/usb.h index 95b4f4ac..ff33cf00 100644 --- a/freebsd/sys/dev/usb/usb.h +++ b/freebsd/sys/dev/usb/usb.h @@ -1,5 +1,7 @@ /* $FreeBSD$ */ /*- + * SPDX-License-Identifier: BSD-2-Clause-NetBSD + * * Copyright (c) 2008 Hans Petter Selasky. All rights reserved. * Copyright (c) 1998 The NetBSD Foundation, Inc. All rights reserved. * Copyright (c) 1998 Lennart Augustsson. All rights reserved. diff --git a/freebsd/sys/dev/usb/usb_bus.h b/freebsd/sys/dev/usb/usb_bus.h index 3ceeb1ef..710436c1 100644 --- a/freebsd/sys/dev/usb/usb_bus.h +++ b/freebsd/sys/dev/usb/usb_bus.h @@ -1,5 +1,7 @@ /* $FreeBSD$ */ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2008 Hans Petter Selasky. All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/freebsd/sys/dev/usb/usb_busdma.c b/freebsd/sys/dev/usb/usb_busdma.c index 446e36e6..9a70c687 100644 --- a/freebsd/sys/dev/usb/usb_busdma.c +++ b/freebsd/sys/dev/usb/usb_busdma.c @@ -2,6 +2,8 @@ /* $FreeBSD$ */ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2008 Hans Petter Selasky. All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/freebsd/sys/dev/usb/usb_busdma.h b/freebsd/sys/dev/usb/usb_busdma.h index 077bf8b8..d75e67ee 100644 --- a/freebsd/sys/dev/usb/usb_busdma.h +++ b/freebsd/sys/dev/usb/usb_busdma.h @@ -1,5 +1,7 @@ /* $FreeBSD$ */ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2008 Hans Petter Selasky. All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/freebsd/sys/dev/usb/usb_cdc.h b/freebsd/sys/dev/usb/usb_cdc.h index 86f35170..d77c24bb 100644 --- a/freebsd/sys/dev/usb/usb_cdc.h +++ b/freebsd/sys/dev/usb/usb_cdc.h @@ -2,6 +2,8 @@ /* $FreeBSD$ */ /*- + * SPDX-License-Identifier: BSD-2-Clause-NetBSD + * * Copyright (c) 1998 The NetBSD Foundation, Inc. * All rights reserved. * diff --git a/freebsd/sys/dev/usb/usb_controller.h b/freebsd/sys/dev/usb/usb_controller.h index 6a2f6b03..59139e64 100644 --- a/freebsd/sys/dev/usb/usb_controller.h +++ b/freebsd/sys/dev/usb/usb_controller.h @@ -1,5 +1,7 @@ /* $FreeBSD$ */ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2008 Hans Petter Selasky. All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/freebsd/sys/dev/usb/usb_core.c b/freebsd/sys/dev/usb/usb_core.c index 3d9daa26..09bfdb2b 100644 --- a/freebsd/sys/dev/usb/usb_core.c +++ b/freebsd/sys/dev/usb/usb_core.c @@ -2,6 +2,8 @@ /* $FreeBSD$ */ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2008 Hans Petter Selasky. All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/freebsd/sys/dev/usb/usb_core.h b/freebsd/sys/dev/usb/usb_core.h index 9f52e65a..01018ca9 100644 --- a/freebsd/sys/dev/usb/usb_core.h +++ b/freebsd/sys/dev/usb/usb_core.h @@ -1,5 +1,7 @@ /* $FreeBSD$ */ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2008 Hans Petter Selasky. All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/freebsd/sys/dev/usb/usb_debug.c b/freebsd/sys/dev/usb/usb_debug.c index 000319b1..e3a1474e 100644 --- a/freebsd/sys/dev/usb/usb_debug.c +++ b/freebsd/sys/dev/usb/usb_debug.c @@ -2,6 +2,8 @@ /* $FreeBSD$ */ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2008 Hans Petter Selasky. All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/freebsd/sys/dev/usb/usb_debug.h b/freebsd/sys/dev/usb/usb_debug.h index e30f2c2c..87c0dcfe 100644 --- a/freebsd/sys/dev/usb/usb_debug.h +++ b/freebsd/sys/dev/usb/usb_debug.h @@ -1,5 +1,7 @@ /* $FreeBSD$ */ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2008 Hans Petter Selasky. All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/freebsd/sys/dev/usb/usb_dev.c b/freebsd/sys/dev/usb/usb_dev.c index b0ad9aaf..2b244d80 100644 --- a/freebsd/sys/dev/usb/usb_dev.c +++ b/freebsd/sys/dev/usb/usb_dev.c @@ -2,6 +2,8 @@ /* $FreeBSD$ */ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2006-2008 Hans Petter Selasky. All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/freebsd/sys/dev/usb/usb_dev.h b/freebsd/sys/dev/usb/usb_dev.h index f87ba53b..ae851153 100644 --- a/freebsd/sys/dev/usb/usb_dev.h +++ b/freebsd/sys/dev/usb/usb_dev.h @@ -1,5 +1,7 @@ /* $FreeBSD$ */ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2008 Hans Petter Selasky. All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/freebsd/sys/dev/usb/usb_device.c b/freebsd/sys/dev/usb/usb_device.c index 6a193a75..861f6029 100644 --- a/freebsd/sys/dev/usb/usb_device.c +++ b/freebsd/sys/dev/usb/usb_device.c @@ -2,6 +2,8 @@ /* $FreeBSD$ */ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2008 Hans Petter Selasky. All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/freebsd/sys/dev/usb/usb_device.h b/freebsd/sys/dev/usb/usb_device.h index 22e15606..1cf48ea1 100644 --- a/freebsd/sys/dev/usb/usb_device.h +++ b/freebsd/sys/dev/usb/usb_device.h @@ -1,5 +1,7 @@ /* $FreeBSD$ */ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2008 Hans Petter Selasky. All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/freebsd/sys/dev/usb/usb_dynamic.c b/freebsd/sys/dev/usb/usb_dynamic.c index c2ca9af6..9eb835ad 100644 --- a/freebsd/sys/dev/usb/usb_dynamic.c +++ b/freebsd/sys/dev/usb/usb_dynamic.c @@ -2,6 +2,8 @@ /* $FreeBSD$ */ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2008 Hans Petter Selasky. All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/freebsd/sys/dev/usb/usb_dynamic.h b/freebsd/sys/dev/usb/usb_dynamic.h index e52c46fb..2d46afc8 100644 --- a/freebsd/sys/dev/usb/usb_dynamic.h +++ b/freebsd/sys/dev/usb/usb_dynamic.h @@ -1,5 +1,7 @@ /* $FreeBSD$ */ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2008 Hans Petter Selasky. All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/freebsd/sys/dev/usb/usb_endian.h b/freebsd/sys/dev/usb/usb_endian.h index 0bbcb9bf..59761767 100644 --- a/freebsd/sys/dev/usb/usb_endian.h +++ b/freebsd/sys/dev/usb/usb_endian.h @@ -1,5 +1,7 @@ /* $FreeBSD$ */ /* + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2008 Hans Petter Selasky. All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/freebsd/sys/dev/usb/usb_error.c b/freebsd/sys/dev/usb/usb_error.c index 2cc49964..2c58c508 100644 --- a/freebsd/sys/dev/usb/usb_error.c +++ b/freebsd/sys/dev/usb/usb_error.c @@ -2,6 +2,8 @@ /* $FreeBSD$ */ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2008 Hans Petter Selasky. All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/freebsd/sys/dev/usb/usb_freebsd.h b/freebsd/sys/dev/usb/usb_freebsd.h index bc5d2422..1eff3e14 100644 --- a/freebsd/sys/dev/usb/usb_freebsd.h +++ b/freebsd/sys/dev/usb/usb_freebsd.h @@ -1,5 +1,7 @@ /* $FreeBSD$ */ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2008 Hans Petter Selasky. All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/freebsd/sys/dev/usb/usb_generic.c b/freebsd/sys/dev/usb/usb_generic.c index ae14bae3..29a27d53 100644 --- a/freebsd/sys/dev/usb/usb_generic.c +++ b/freebsd/sys/dev/usb/usb_generic.c @@ -2,6 +2,8 @@ /* $FreeBSD$ */ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2008 Hans Petter Selasky. All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/freebsd/sys/dev/usb/usb_generic.h b/freebsd/sys/dev/usb/usb_generic.h index 835ec72a..d03f25cd 100644 --- a/freebsd/sys/dev/usb/usb_generic.h +++ b/freebsd/sys/dev/usb/usb_generic.h @@ -1,5 +1,7 @@ /* $FreeBSD$ */ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2008 Hans Petter Selasky. All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/freebsd/sys/dev/usb/usb_handle_request.c b/freebsd/sys/dev/usb/usb_handle_request.c index c6b4db32..458d1fc1 100644 --- a/freebsd/sys/dev/usb/usb_handle_request.c +++ b/freebsd/sys/dev/usb/usb_handle_request.c @@ -2,6 +2,8 @@ /* $FreeBSD$ */ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2008 Hans Petter Selasky. All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/freebsd/sys/dev/usb/usb_hid.c b/freebsd/sys/dev/usb/usb_hid.c index 5019aa1a..c2d93f3a 100644 --- a/freebsd/sys/dev/usb/usb_hid.c +++ b/freebsd/sys/dev/usb/usb_hid.c @@ -3,6 +3,8 @@ /* $FreeBSD$ */ /* $NetBSD: hid.c,v 1.17 2001/11/13 06:24:53 lukem Exp $ */ /*- + * SPDX-License-Identifier: BSD-2-Clause-NetBSD + * * Copyright (c) 1998 The NetBSD Foundation, Inc. * All rights reserved. * diff --git a/freebsd/sys/dev/usb/usb_hub.c b/freebsd/sys/dev/usb/usb_hub.c index 0eaeeb60..a0ad462f 100644 --- a/freebsd/sys/dev/usb/usb_hub.c +++ b/freebsd/sys/dev/usb/usb_hub.c @@ -2,6 +2,8 @@ /* $FreeBSD$ */ /*- + * SPDX-License-Identifier: BSD-2-Clause-NetBSD + * * Copyright (c) 1998 The NetBSD Foundation, Inc. All rights reserved. * Copyright (c) 1998 Lennart Augustsson. All rights reserved. * Copyright (c) 2008-2010 Hans Petter Selasky. All rights reserved. diff --git a/freebsd/sys/dev/usb/usb_hub.h b/freebsd/sys/dev/usb/usb_hub.h index 16430d9b..3d4e0837 100644 --- a/freebsd/sys/dev/usb/usb_hub.h +++ b/freebsd/sys/dev/usb/usb_hub.h @@ -1,5 +1,7 @@ /* $FreeBSD$ */ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2008 Hans Petter Selasky. All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/freebsd/sys/dev/usb/usb_ioctl.h b/freebsd/sys/dev/usb/usb_ioctl.h index 683f3e61..7cf90649 100644 --- a/freebsd/sys/dev/usb/usb_ioctl.h +++ b/freebsd/sys/dev/usb/usb_ioctl.h @@ -1,5 +1,7 @@ /* $FreeBSD$ */ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2008 Hans Petter Selasky. All rights reserved. * Copyright (c) 1998 The NetBSD Foundation, Inc. All rights reserved. * Copyright (c) 1998 Lennart Augustsson. All rights reserved. diff --git a/freebsd/sys/dev/usb/usb_lookup.c b/freebsd/sys/dev/usb/usb_lookup.c index 533080ef..6f6a763f 100644 --- a/freebsd/sys/dev/usb/usb_lookup.c +++ b/freebsd/sys/dev/usb/usb_lookup.c @@ -2,6 +2,8 @@ /* $FreeBSD$ */ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2008 Hans Petter Selasky. All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/freebsd/sys/dev/usb/usb_mbuf.c b/freebsd/sys/dev/usb/usb_mbuf.c index b1cc3276..62c14264 100644 --- a/freebsd/sys/dev/usb/usb_mbuf.c +++ b/freebsd/sys/dev/usb/usb_mbuf.c @@ -2,6 +2,8 @@ /* $FreeBSD$ */ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2008 Hans Petter Selasky. All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/freebsd/sys/dev/usb/usb_mbuf.h b/freebsd/sys/dev/usb/usb_mbuf.h index 3b331ffc..2466e2e4 100644 --- a/freebsd/sys/dev/usb/usb_mbuf.h +++ b/freebsd/sys/dev/usb/usb_mbuf.h @@ -1,5 +1,7 @@ /* $FreeBSD$ */ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2008 Hans Petter Selasky. All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/freebsd/sys/dev/usb/usb_msctest.c b/freebsd/sys/dev/usb/usb_msctest.c index f0eede28..d8d11eca 100644 --- a/freebsd/sys/dev/usb/usb_msctest.c +++ b/freebsd/sys/dev/usb/usb_msctest.c @@ -2,6 +2,8 @@ /* $FreeBSD$ */ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2008,2011 Hans Petter Selasky. All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/freebsd/sys/dev/usb/usb_msctest.h b/freebsd/sys/dev/usb/usb_msctest.h index d3f26c2b..6b5d3283 100644 --- a/freebsd/sys/dev/usb/usb_msctest.h +++ b/freebsd/sys/dev/usb/usb_msctest.h @@ -1,5 +1,7 @@ /* $FreeBSD$ */ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2008 Hans Petter Selasky. All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/freebsd/sys/dev/usb/usb_parse.c b/freebsd/sys/dev/usb/usb_parse.c index 776e1f05..638aaf77 100644 --- a/freebsd/sys/dev/usb/usb_parse.c +++ b/freebsd/sys/dev/usb/usb_parse.c @@ -2,6 +2,8 @@ /* $FreeBSD$ */ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2008 Hans Petter Selasky. All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/freebsd/sys/dev/usb/usb_pf.h b/freebsd/sys/dev/usb/usb_pf.h index 29fe6ebd..03f7ba98 100644 --- a/freebsd/sys/dev/usb/usb_pf.h +++ b/freebsd/sys/dev/usb/usb_pf.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1990, 1991, 1993 * The Regents of the University of California. All rights reserved. * diff --git a/freebsd/sys/dev/usb/usb_process.c b/freebsd/sys/dev/usb/usb_process.c index 88f09804..6c4cc7ad 100644 --- a/freebsd/sys/dev/usb/usb_process.c +++ b/freebsd/sys/dev/usb/usb_process.c @@ -2,6 +2,8 @@ /* $FreeBSD$ */ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2008 Hans Petter Selasky. All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/freebsd/sys/dev/usb/usb_process.h b/freebsd/sys/dev/usb/usb_process.h index dd20afd4..7be78917 100644 --- a/freebsd/sys/dev/usb/usb_process.h +++ b/freebsd/sys/dev/usb/usb_process.h @@ -1,5 +1,7 @@ /* $FreeBSD$ */ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2008 Hans Petter Selasky. All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/freebsd/sys/dev/usb/usb_request.c b/freebsd/sys/dev/usb/usb_request.c index ef8ed3e6..6be241c2 100644 --- a/freebsd/sys/dev/usb/usb_request.c +++ b/freebsd/sys/dev/usb/usb_request.c @@ -2,6 +2,8 @@ /* $FreeBSD$ */ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 1998 The NetBSD Foundation, Inc. All rights reserved. * Copyright (c) 1998 Lennart Augustsson. All rights reserved. * Copyright (c) 2008 Hans Petter Selasky. All rights reserved. diff --git a/freebsd/sys/dev/usb/usb_request.h b/freebsd/sys/dev/usb/usb_request.h index 9f0a4e64..7c653132 100644 --- a/freebsd/sys/dev/usb/usb_request.h +++ b/freebsd/sys/dev/usb/usb_request.h @@ -1,5 +1,7 @@ /* $FreeBSD$ */ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2008 Hans Petter Selasky. All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/freebsd/sys/dev/usb/usb_transfer.c b/freebsd/sys/dev/usb/usb_transfer.c index ee80d9bb..7ea25337 100644 --- a/freebsd/sys/dev/usb/usb_transfer.c +++ b/freebsd/sys/dev/usb/usb_transfer.c @@ -2,6 +2,8 @@ /* $FreeBSD$ */ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2008 Hans Petter Selasky. All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/freebsd/sys/dev/usb/usb_transfer.h b/freebsd/sys/dev/usb/usb_transfer.h index f035240b..da632a73 100644 --- a/freebsd/sys/dev/usb/usb_transfer.h +++ b/freebsd/sys/dev/usb/usb_transfer.h @@ -1,5 +1,7 @@ /* $FreeBSD$ */ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2008 Hans Petter Selasky. All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/freebsd/sys/dev/usb/usb_util.c b/freebsd/sys/dev/usb/usb_util.c index 4d8c9c56..aa705751 100644 --- a/freebsd/sys/dev/usb/usb_util.c +++ b/freebsd/sys/dev/usb/usb_util.c @@ -2,6 +2,8 @@ /* $FreeBSD$ */ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2008 Hans Petter Selasky. All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/freebsd/sys/dev/usb/usb_util.h b/freebsd/sys/dev/usb/usb_util.h index 7e52404f..87e54d35 100644 --- a/freebsd/sys/dev/usb/usb_util.h +++ b/freebsd/sys/dev/usb/usb_util.h @@ -1,5 +1,7 @@ /* $FreeBSD$ */ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2008 Hans Petter Selasky. All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/freebsd/sys/dev/usb/usbdi.h b/freebsd/sys/dev/usb/usbdi.h index 6ad3e43e..2be8eef1 100644 --- a/freebsd/sys/dev/usb/usbdi.h +++ b/freebsd/sys/dev/usb/usbdi.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2009 Andrew Thompson * * Redistribution and use in source and binary forms, with or without diff --git a/freebsd/sys/dev/usb/usbdi_util.h b/freebsd/sys/dev/usb/usbdi_util.h index 1e450f8f..d0ee6f9d 100644 --- a/freebsd/sys/dev/usb/usbdi_util.h +++ b/freebsd/sys/dev/usb/usbdi_util.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2009 Andrew Thompson * * Redistribution and use in source and binary forms, with or without diff --git a/freebsd/sys/dev/usb/usbhid.h b/freebsd/sys/dev/usb/usbhid.h index 31aa7ea4..8870e291 100644 --- a/freebsd/sys/dev/usb/usbhid.h +++ b/freebsd/sys/dev/usb/usbhid.h @@ -1,5 +1,7 @@ /* $FreeBSD$ */ /*- + * SPDX-License-Identifier: BSD-2-Clause-NetBSD + * * Copyright (c) 2008 Hans Petter Selasky. All rights reserved. * Copyright (c) 1998 The NetBSD Foundation, Inc. All rights reserved. * Copyright (c) 1998 Lennart Augustsson. All rights reserved. diff --git a/freebsd/sys/dev/usb/wlan/if_rsu.c b/freebsd/sys/dev/usb/wlan/if_rsu.c index 2415d2f2..179de4e5 100644 --- a/freebsd/sys/dev/usb/wlan/if_rsu.c +++ b/freebsd/sys/dev/usb/wlan/if_rsu.c @@ -73,8 +73,11 @@ __FBSDID("$FreeBSD$"); #include <dev/usb/usbdi.h> #include <rtems/bsd/local/usbdevs.h> +#include <dev/rtwn/if_rtwn_ridx.h> /* XXX */ #include <dev/usb/wlan/if_rsureg.h> +#define RSU_RATE_IS_CCK RTWN_RATE_IS_CCK + #ifdef USB_DEBUG static int rsu_debug = 0; SYSCTL_NODE(_hw_usb, OID_AUTO, rsu, CTLFLAG_RW, 0, "USB rsu"); @@ -2387,44 +2390,6 @@ rsu_rx_frame(struct rsu_softc *sc, struct mbuf *m) rssi = rsu_hwrssi_to_rssi(sc, sc->sc_currssi); } - if (ieee80211_radiotap_active(ic)) { - struct rsu_rx_radiotap_header *tap = &sc->sc_rxtap; - - /* Map HW rate index to 802.11 rate. */ - tap->wr_flags = 0; /* TODO */ - tap->wr_tsft = rsu_get_tsf_high(sc); - if (le32toh(stat->tsf_low) > rsu_get_tsf_low(sc)) - tap->wr_tsft--; - tap->wr_tsft = (uint64_t)htole32(tap->wr_tsft) << 32; - tap->wr_tsft += stat->tsf_low; - - if (rate < 12) { - switch (rate) { - /* CCK. */ - case 0: tap->wr_rate = 2; break; - case 1: tap->wr_rate = 4; break; - case 2: tap->wr_rate = 11; break; - case 3: tap->wr_rate = 22; break; - /* OFDM. */ - case 4: tap->wr_rate = 12; break; - case 5: tap->wr_rate = 18; break; - case 6: tap->wr_rate = 24; break; - case 7: tap->wr_rate = 36; break; - case 8: tap->wr_rate = 48; break; - case 9: tap->wr_rate = 72; break; - case 10: tap->wr_rate = 96; break; - case 11: tap->wr_rate = 108; break; - } - } else { /* MCS0~15. */ - /* Bit 7 set means HT MCS instead of rate. */ - tap->wr_rate = 0x80 | (rate - 12); - } - - tap->wr_dbm_antsignal = rssi; - tap->wr_chan_freq = htole16(ic->ic_curchan->ic_freq); - tap->wr_chan_flags = htole16(ic->ic_curchan->ic_flags); - }; - /* Hardware does Rx TCP checksum offload. */ /* * This flag can be set for some other @@ -2470,65 +2435,34 @@ rsu_rx_frame(struct rsu_softc *sc, struct mbuf *m) rxs.c_nf = -96; /* Rate */ - if (!(rxdw3 & R92S_RXDW3_HTC)) { - switch (rate) { - /* CCK. */ - case 0: - rxs.c_rate = 2; - rxs.c_pktflags |= IEEE80211_RX_F_CCK; - break; - case 1: - rxs.c_rate = 4; - rxs.c_pktflags |= IEEE80211_RX_F_CCK; - break; - case 2: - rxs.c_rate = 11; + if (rate < 12) { + rxs.c_rate = ridx2rate[rate]; + if (RSU_RATE_IS_CCK(rate)) rxs.c_pktflags |= IEEE80211_RX_F_CCK; - break; - case 3: - rxs.c_rate = 22; - rxs.c_pktflags |= IEEE80211_RX_F_CCK; - break; - /* OFDM. */ - case 4: - rxs.c_rate = 12; - rxs.c_pktflags |= IEEE80211_RX_F_OFDM; - break; - case 5: - rxs.c_rate = 18; - rxs.c_pktflags |= IEEE80211_RX_F_OFDM; - break; - case 6: - rxs.c_rate = 24; - rxs.c_pktflags |= IEEE80211_RX_F_OFDM; - break; - case 7: - rxs.c_rate = 36; - rxs.c_pktflags |= IEEE80211_RX_F_OFDM; - break; - case 8: - rxs.c_rate = 48; - rxs.c_pktflags |= IEEE80211_RX_F_OFDM; - break; - case 9: - rxs.c_rate = 72; - rxs.c_pktflags |= IEEE80211_RX_F_OFDM; - break; - case 10: - rxs.c_rate = 96; - rxs.c_pktflags |= IEEE80211_RX_F_OFDM; - break; - case 11: - rxs.c_rate = 108; + else rxs.c_pktflags |= IEEE80211_RX_F_OFDM; - break; - } - } else if (rate >= 12) { /* MCS0~15. */ - /* Bit 7 set means HT MCS instead of rate. */ - rxs.c_rate = (rate - 12); + } else { + rxs.c_rate = IEEE80211_RATE_MCS | (rate - 12); rxs.c_pktflags |= IEEE80211_RX_F_HT; } + if (ieee80211_radiotap_active(ic)) { + struct rsu_rx_radiotap_header *tap = &sc->sc_rxtap; + + /* Map HW rate index to 802.11 rate. */ + tap->wr_flags = 0; /* TODO */ + tap->wr_tsft = rsu_get_tsf_high(sc); + if (le32toh(stat->tsf_low) > rsu_get_tsf_low(sc)) + tap->wr_tsft--; + tap->wr_tsft = (uint64_t)htole32(tap->wr_tsft) << 32; + tap->wr_tsft += stat->tsf_low; + + tap->wr_rate = rxs.c_rate; + tap->wr_dbm_antsignal = rssi; + tap->wr_chan_freq = htole16(ic->ic_curchan->ic_freq); + tap->wr_chan_flags = htole16(ic->ic_curchan->ic_flags); + }; + (void) ieee80211_add_rx_params(m, &rxs); /* Drop descriptor. */ diff --git a/freebsd/sys/dev/usb/wlan/if_uath.c b/freebsd/sys/dev/usb/wlan/if_uath.c index c4ebe5ed..e1aa5ec0 100644 --- a/freebsd/sys/dev/usb/wlan/if_uath.c +++ b/freebsd/sys/dev/usb/wlan/if_uath.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD AND 0BSD + * * Copyright (c) 2006 Sam Leffler, Errno Consulting * Copyright (c) 2008-2009 Weongyo Jeong <weongyo@freebsd.org> * All rights reserved. diff --git a/freebsd/sys/dev/usb/wlan/if_zydfw.h b/freebsd/sys/dev/usb/wlan/if_zydfw.h index 46f5c2ab..f18442e9 100644 --- a/freebsd/sys/dev/usb/wlan/if_zydfw.h +++ b/freebsd/sys/dev/usb/wlan/if_zydfw.h @@ -1,4 +1,6 @@ /* + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (C) 2001, 2002, 2003,2004 ZyDAS Technology Corporation. * All rights reserved. * diff --git a/freebsd/sys/fs/devfs/devfs_int.h b/freebsd/sys/fs/devfs/devfs_int.h index 3a55a52e..e3991cbd 100644 --- a/freebsd/sys/fs/devfs/devfs_int.h +++ b/freebsd/sys/fs/devfs/devfs_int.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2005 Poul-Henning Kamp. All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/freebsd/sys/fs/devfs/devfs_vnops.c b/freebsd/sys/fs/devfs/devfs_vnops.c index fcf69a1a..4a1c0675 100644 --- a/freebsd/sys/fs/devfs/devfs_vnops.c +++ b/freebsd/sys/fs/devfs/devfs_vnops.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2000-2004 * Poul-Henning Kamp. All rights reserved. * Copyright (c) 1989, 1992-1993, 1995 diff --git a/freebsd/sys/h8300/include/machine/in_cksum.h b/freebsd/sys/h8300/include/machine/in_cksum.h index 72edfba9..d55b838b 100644 --- a/freebsd/sys/h8300/include/machine/in_cksum.h +++ b/freebsd/sys/h8300/include/machine/in_cksum.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1990 The Regents of the University of California. * All rights reserved. * diff --git a/freebsd/sys/i386/i386/in_cksum.c b/freebsd/sys/i386/i386/in_cksum.c index 6c8811be..601e82fe 100644 --- a/freebsd/sys/i386/i386/in_cksum.c +++ b/freebsd/sys/i386/i386/in_cksum.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1990 The Regents of the University of California. * All rights reserved. * diff --git a/freebsd/sys/i386/include/machine/_bus.h b/freebsd/sys/i386/include/machine/_bus.h index 49bdd5a3..2f0b8422 100644 --- a/freebsd/sys/i386/include/machine/_bus.h +++ b/freebsd/sys/i386/include/machine/_bus.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2005 M. Warner Losh. * All rights reserved. * diff --git a/freebsd/sys/i386/include/machine/cpufunc.h b/freebsd/sys/i386/include/machine/cpufunc.h index a311cd1d..0147abe9 100644 --- a/freebsd/sys/i386/include/machine/cpufunc.h +++ b/freebsd/sys/i386/include/machine/cpufunc.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1993 The Regents of the University of California. * All rights reserved. * diff --git a/freebsd/sys/i386/include/machine/in_cksum.h b/freebsd/sys/i386/include/machine/in_cksum.h index 8816f3c8..360b324a 100644 --- a/freebsd/sys/i386/include/machine/in_cksum.h +++ b/freebsd/sys/i386/include/machine/in_cksum.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1990 The Regents of the University of California. * All rights reserved. * diff --git a/freebsd/sys/i386/include/machine/intr_machdep.h b/freebsd/sys/i386/include/machine/intr_machdep.h index 5892d07c..06272209 100644 --- a/freebsd/sys/i386/include/machine/intr_machdep.h +++ b/freebsd/sys/i386/include/machine/intr_machdep.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2003 John Baldwin <jhb@FreeBSD.org> * All rights reserved. * diff --git a/freebsd/sys/i386/include/machine/md_var.h b/freebsd/sys/i386/include/machine/md_var.h index 2ca8c856..38d2a828 100644 --- a/freebsd/sys/i386/include/machine/md_var.h +++ b/freebsd/sys/i386/include/machine/md_var.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1995 Bruce D. Evans. * All rights reserved. * @@ -66,6 +68,8 @@ void init_AMD_Elan_sc520(void); vm_paddr_t kvtop(void *addr); void panicifcpuunsupported(void); void ppro_reenable_apic(void); +void set_fsbase(struct thread *td, uint32_t base); +void set_gsbase(struct thread *td, uint32_t base); void setidt(int idx, alias_for_inthand_t *func, int typ, int dpl, int selec); union savefpu *get_pcb_user_save_td(struct thread *td); union savefpu *get_pcb_user_save_pcb(struct pcb *pcb); diff --git a/freebsd/sys/isa/isavar.h b/freebsd/sys/isa/isavar.h index 740a114c..28d13505 100644 --- a/freebsd/sys/isa/isavar.h +++ b/freebsd/sys/isa/isavar.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 1998 Doug Rabson * All rights reserved. * diff --git a/freebsd/sys/isa/pnpvar.h b/freebsd/sys/isa/pnpvar.h index 291c8130..1f77b1b2 100644 --- a/freebsd/sys/isa/pnpvar.h +++ b/freebsd/sys/isa/pnpvar.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 1999 Doug Rabson * All rights reserved. * diff --git a/freebsd/sys/kern/init_main.c b/freebsd/sys/kern/init_main.c index f211b363..b8961ab6 100644 --- a/freebsd/sys/kern/init_main.c +++ b/freebsd/sys/kern/init_main.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-4-Clause + * * Copyright (c) 1995 Terrence R. Lambert * All rights reserved. * @@ -139,6 +141,11 @@ SET_DECLARE(sysinit_set, struct sysinit); struct sysinit **sysinit, **sysinit_end; struct sysinit **newsysinit, **newsysinit_end; +EVENTHANDLER_LIST_DECLARE(process_init); +EVENTHANDLER_LIST_DECLARE(thread_init); +EVENTHANDLER_LIST_DECLARE(process_ctor); +EVENTHANDLER_LIST_DECLARE(thread_ctor); + /* * Merge a new sysinit set into the current set, reallocating it if * necessary. This can only be called after malloc is running. @@ -444,6 +451,10 @@ proc0_init(void *dummy __unused) struct proc *p; struct thread *td; struct ucred *newcred; + struct uidinfo tmpuinfo; + struct loginclass tmplc = { + .lc_name = "", + }; vm_paddr_t pageablemem; int i; @@ -526,10 +537,17 @@ proc0_init(void *dummy __unused) /* Create credentials. */ newcred = crget(); newcred->cr_ngroups = 1; /* group 0 */ + /* A hack to prevent uifind from tripping over NULL pointers. */ + curthread->td_ucred = newcred; + tmpuinfo.ui_uid = 1; + newcred->cr_uidinfo = newcred->cr_ruidinfo = &tmpuinfo; newcred->cr_uidinfo = uifind(0); newcred->cr_ruidinfo = uifind(0); - newcred->cr_prison = &prison0; + newcred->cr_loginclass = &tmplc; newcred->cr_loginclass = loginclass_find("default"); + /* End hack. creds get properly set later with thread_cow_get_proc */ + curthread->td_ucred = NULL; + newcred->cr_prison = &prison0; proc_set_cred_init(p, newcred); #ifdef AUDIT audit_cred_kproc0(newcred); @@ -593,10 +611,10 @@ proc0_init(void *dummy __unused) * Call the init and ctor for the new thread and proc. We wait * to do this until all other structures are fairly sane. */ - EVENTHANDLER_INVOKE(process_init, p); - EVENTHANDLER_INVOKE(thread_init, td); - EVENTHANDLER_INVOKE(process_ctor, p); - EVENTHANDLER_INVOKE(thread_ctor, td); + EVENTHANDLER_DIRECT_INVOKE(process_init, p); + EVENTHANDLER_DIRECT_INVOKE(thread_init, td); + EVENTHANDLER_DIRECT_INVOKE(process_ctor, p); + EVENTHANDLER_DIRECT_INVOKE(thread_ctor, td); /* * Charge root for one process. @@ -803,7 +821,7 @@ start_init(void *dummy) * Otherwise, return via fork_trampoline() all the way * to user mode as init! */ - if ((error = sys_execve(td, &args)) == 0) { + if ((error = sys_execve(td, &args)) == EJUSTRETURN) { mtx_unlock(&Giant); return; } diff --git a/freebsd/sys/kern/kern_condvar.c b/freebsd/sys/kern/kern_condvar.c index 927a722c..399a699e 100644 --- a/freebsd/sys/kern/kern_condvar.c +++ b/freebsd/sys/kern/kern_condvar.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2000 Jake Burkholder <jake@freebsd.org>. * All rights reserved. * diff --git a/freebsd/sys/kern/kern_conf.c b/freebsd/sys/kern/kern_conf.c index 8ad8c7c5..f62e8e4d 100644 --- a/freebsd/sys/kern/kern_conf.c +++ b/freebsd/sys/kern/kern_conf.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 1999-2002 Poul-Henning Kamp * All rights reserved. * diff --git a/freebsd/sys/kern/kern_event.c b/freebsd/sys/kern/kern_event.c index 2428182c..905ef23c 100644 --- a/freebsd/sys/kern/kern_event.c +++ b/freebsd/sys/kern/kern_event.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 1999,2000,2001 Jonathan Lemon <jlemon@FreeBSD.org> * Copyright 2004 John-Mark Gurney <jmg@FreeBSD.org> * Copyright (c) 2009 Apple, Inc. @@ -35,6 +37,10 @@ __FBSDID("$FreeBSD$"); #include <rtems/bsd/local/opt_ktrace.h> #include <rtems/bsd/local/opt_kqueue.h> +#ifdef COMPAT_FREEBSD11 +#define _WANT_FREEBSD11_KEVENT +#endif + #include <sys/param.h> #include <sys/systm.h> #include <sys/capsicum.h> @@ -123,7 +129,7 @@ static void kqueue_fo_release(int filt); struct g_kevent_args; static int kern_kevent_generic(struct thread *td, struct g_kevent_args *uap, - struct kevent_copyops *k_ops); + struct kevent_copyops *k_ops, const char *struct_name); #ifndef __rtems__ static fo_rdwr_t kqueue_read; @@ -444,16 +450,15 @@ filt_procattach(struct knote *kn) bool exiting, immediate; exiting = immediate = false; - p = pfind(kn->kn_id); - if (p == NULL && (kn->kn_sfflags & NOTE_EXIT)) { - p = zpfind(kn->kn_id); - exiting = true; - } else if (p != NULL && (p->p_flag & P_WEXIT)) { - exiting = true; - } - + if (kn->kn_sfflags & NOTE_EXIT) + p = pfind_any(kn->kn_id); + else + p = pfind(kn->kn_id); if (p == NULL) return (ESRCH); + if (p->p_flag & P_WEXIT) + exiting = true; + if ((error = p_cansee(curthread, p))) { PROC_UNLOCK(p); return (error); @@ -987,17 +992,6 @@ kqueue(void) } #endif /* __rtems__ */ -#ifdef KTRACE -static size_t -kev_iovlen(int n, u_int kgio, size_t kevent_size) -{ - - if (n < 0 || n >= kgio / kevent_size) - return (kgio); - return (n * kevent_size); -} -#endif - struct g_kevent_args { int fd; void *changelist; @@ -1034,22 +1028,18 @@ sys_kevent(struct thread *td, struct kevent_args *uap) .timeout = uap->timeout, }; - return (kern_kevent_generic(td, &gk_args, &k_ops)); + return (kern_kevent_generic(td, &gk_args, &k_ops, "kevent")); } static int kern_kevent_generic(struct thread *td, struct g_kevent_args *uap, - struct kevent_copyops *k_ops) + struct kevent_copyops *k_ops, const char *struct_name) { struct timespec ts, *tsp; - int error; #ifdef KTRACE - struct uio ktruio; - struct iovec ktriov; - struct uio *ktruioin = NULL; - struct uio *ktruioout = NULL; - u_int kgio; + struct kevent *eventlist = uap->eventlist; #endif + int error; if (uap->timeout != NULL) { error = copyin(uap->timeout, &ts, sizeof(ts)); @@ -1060,35 +1050,18 @@ kern_kevent_generic(struct thread *td, struct g_kevent_args *uap, tsp = NULL; #ifdef KTRACE - if (KTRPOINT(td, KTR_GENIO)) { - kgio = ktr_geniosize; - ktriov.iov_base = uap->changelist; - ktriov.iov_len = kev_iovlen(uap->nchanges, kgio, - k_ops->kevent_size); - ktruio = (struct uio){ .uio_iov = &ktriov, .uio_iovcnt = 1, - .uio_segflg = UIO_USERSPACE, .uio_rw = UIO_READ, - .uio_td = td }; - ktruioin = cloneuio(&ktruio); - ktriov.iov_base = uap->eventlist; - ktriov.iov_len = kev_iovlen(uap->nevents, kgio, - k_ops->kevent_size); - ktriov.iov_len = uap->nevents * k_ops->kevent_size; - ktruioout = cloneuio(&ktruio); - } + if (KTRPOINT(td, KTR_STRUCT_ARRAY)) + ktrstructarray(struct_name, UIO_USERSPACE, uap->changelist, + uap->nchanges, k_ops->kevent_size); #endif error = kern_kevent(td, uap->fd, uap->nchanges, uap->nevents, k_ops, tsp); #ifdef KTRACE - if (ktruioin != NULL) { - ktruioin->uio_resid = kev_iovlen(uap->nchanges, kgio, - k_ops->kevent_size); - ktrgenio(uap->fd, UIO_WRITE, ktruioin, 0); - ktruioout->uio_resid = kev_iovlen(td->td_retval[0], kgio, - k_ops->kevent_size); - ktrgenio(uap->fd, UIO_READ, ktruioout, error); - } + if (error == 0 && KTRPOINT(td, KTR_STRUCT_ARRAY)) + ktrstructarray(struct_name, UIO_USERSPACE, eventlist, + td->td_retval[0], k_ops->kevent_size); #endif return (error); @@ -1163,15 +1136,6 @@ kevent_copyin(void *arg, struct kevent *kevp, int count) } #ifdef COMPAT_FREEBSD11 -struct kevent_freebsd11 { - __uintptr_t ident; /* identifier for this event */ - short filter; /* filter for event */ - unsigned short flags; - unsigned int fflags; - __intptr_t data; - void *udata; /* opaque user data identifier */ -}; - static int kevent11_copyout(void *arg, struct kevent *kevp, int count) { @@ -1246,7 +1210,7 @@ freebsd11_kevent(struct thread *td, struct freebsd11_kevent_args *uap) .timeout = uap->timeout, }; - return (kern_kevent_generic(td, &gk_args, &k_ops)); + return (kern_kevent_generic(td, &gk_args, &k_ops, "kevent_freebsd11")); } #endif diff --git a/freebsd/sys/kern/kern_hhook.c b/freebsd/sys/kern/kern_hhook.c index af2dcf61..081f97e5 100644 --- a/freebsd/sys/kern/kern_hhook.c +++ b/freebsd/sys/kern/kern_hhook.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2010,2013 Lawrence Stewart <lstewart@freebsd.org> * Copyright (c) 2010 The FreeBSD Foundation * All rights reserved. diff --git a/freebsd/sys/kern/kern_intr.c b/freebsd/sys/kern/kern_intr.c index fbb5a1e9..aa896467 100644 --- a/freebsd/sys/kern/kern_intr.c +++ b/freebsd/sys/kern/kern_intr.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 1997, Stefan Esser <se@freebsd.org> * All rights reserved. * diff --git a/freebsd/sys/kern/kern_khelp.c b/freebsd/sys/kern/kern_khelp.c index 7ff76467..6e4673ee 100644 --- a/freebsd/sys/kern/kern_khelp.c +++ b/freebsd/sys/kern/kern_khelp.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2010,2013 Lawrence Stewart <lstewart@freebsd.org> * Copyright (c) 2010 The FreeBSD Foundation * All rights reserved. diff --git a/freebsd/sys/kern/kern_linker.c b/freebsd/sys/kern/kern_linker.c index 1c81a61c..c19071a6 100644 --- a/freebsd/sys/kern/kern_linker.c +++ b/freebsd/sys/kern/kern_linker.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 1997-2000 Doug Rabson * All rights reserved. * @@ -293,7 +295,7 @@ linker_file_sysuninit(linker_file_t lf) } static void -linker_file_register_sysctls(linker_file_t lf) +linker_file_register_sysctls(linker_file_t lf, bool enable) { struct sysctl_oid **start, **stop, **oidp; @@ -308,8 +310,34 @@ linker_file_register_sysctls(linker_file_t lf) sx_xunlock(&kld_sx); sysctl_wlock(); + for (oidp = start; oidp < stop; oidp++) { + if (enable) + sysctl_register_oid(*oidp); + else + sysctl_register_disabled_oid(*oidp); + } + sysctl_wunlock(); + sx_xlock(&kld_sx); +} + +static void +linker_file_enable_sysctls(linker_file_t lf) +{ + struct sysctl_oid **start, **stop, **oidp; + + KLD_DPF(FILE, + ("linker_file_enable_sysctls: enable SYSCTLs for %s\n", + lf->filename)); + + sx_assert(&kld_sx, SA_XLOCKED); + + if (linker_file_lookup_set(lf, "sysctl_set", &start, &stop, NULL) != 0) + return; + + sx_xunlock(&kld_sx); + sysctl_wlock(); for (oidp = start; oidp < stop; oidp++) - sysctl_register_oid(*oidp); + sysctl_enable_oid(*oidp); sysctl_wunlock(); sx_xlock(&kld_sx); } @@ -446,7 +474,7 @@ linker_load_file(const char *filename, linker_file_t *result) return (error); } modules = !TAILQ_EMPTY(&lf->modules); - linker_file_register_sysctls(lf); + linker_file_register_sysctls(lf, false); linker_file_sysinit(lf); lf->flags |= LINKER_FILE_LINKED; @@ -459,6 +487,7 @@ linker_load_file(const char *filename, linker_file_t *result) linker_file_unload(lf, LINKER_UNLOAD_FORCE); return (ENOEXEC); } + linker_file_enable_sysctls(lf); EVENTHANDLER_INVOKE(kld_load, lf); *result = lf; return (0); @@ -708,8 +737,8 @@ linker_file_unload(linker_file_t file, int flags) */ if (file->flags & LINKER_FILE_LINKED) { file->flags &= ~LINKER_FILE_LINKED; - linker_file_sysuninit(file); linker_file_unregister_sysctls(file); + linker_file_sysuninit(file); } TAILQ_REMOVE(&linker_files, file, link); @@ -1218,7 +1247,7 @@ out: int sys_kldstat(struct thread *td, struct kldstat_args *uap) { - struct kld_file_stat stat; + struct kld_file_stat *stat; int error, version; /* @@ -1231,10 +1260,12 @@ sys_kldstat(struct thread *td, struct kldstat_args *uap) version != sizeof(struct kld_file_stat)) return (EINVAL); - error = kern_kldstat(td, uap->fileid, &stat); - if (error != 0) - return (error); - return (copyout(&stat, uap->stat, version)); + stat = malloc(sizeof(*stat), M_TEMP, M_WAITOK | M_ZERO); + error = kern_kldstat(td, uap->fileid, stat); + if (error == 0) + error = copyout(stat, uap->stat, version); + free(stat, M_TEMP); + return (error); } int @@ -1658,7 +1689,7 @@ restart: if (linker_file_lookup_set(lf, "sysinit_set", &si_start, &si_stop, NULL) == 0) sysinit_add(si_start, si_stop); - linker_file_register_sysctls(lf); + linker_file_register_sysctls(lf, true); lf->flags |= LINKER_FILE_LINKED; continue; fail: diff --git a/freebsd/sys/kern/kern_mbuf.c b/freebsd/sys/kern/kern_mbuf.c index 472e0894..0f46259a 100644 --- a/freebsd/sys/kern/kern_mbuf.c +++ b/freebsd/sys/kern/kern_mbuf.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2004, 2005, * Bosko Milekic <bmilekic@FreeBSD.org>. All rights reserved. * @@ -522,7 +524,7 @@ mb_ctor_clust(void *mem, int size, void *arg, int how) #endif m = (struct mbuf *)arg; if (m != NULL) { - m->m_ext.ext_buf = (caddr_t)mem; + m->m_ext.ext_buf = (char *)mem; m->m_data = m->m_ext.ext_buf; m->m_flags |= M_EXT; m->m_ext.ext_free = NULL; @@ -694,29 +696,19 @@ mb_free_ext(struct mbuf *m) break; #ifndef __rtems__ case EXT_SFBUF: - sf_ext_free(m->m_ext.ext_arg1, m->m_ext.ext_arg2); - uma_zfree(zone_mbuf, mref); - break; - case EXT_SFBUF_NOCACHE: - sf_ext_free_nocache(m->m_ext.ext_arg1, - m->m_ext.ext_arg2); - uma_zfree(zone_mbuf, mref); - break; #endif /* __rtems__ */ case EXT_NET_DRV: case EXT_MOD_TYPE: case EXT_DISPOSABLE: - KASSERT(m->m_ext.ext_free != NULL, + KASSERT(mref->m_ext.ext_free != NULL, ("%s: ext_free not set", __func__)); - (*(m->m_ext.ext_free))(m, m->m_ext.ext_arg1, - m->m_ext.ext_arg2); + mref->m_ext.ext_free(mref); uma_zfree(zone_mbuf, mref); break; case EXT_EXTREF: KASSERT(m->m_ext.ext_free != NULL, ("%s: ext_free not set", __func__)); - (*(m->m_ext.ext_free))(m, m->m_ext.ext_arg1, - m->m_ext.ext_arg2); + m->m_ext.ext_free(m); break; default: KASSERT(m->m_ext.ext_type == 0, @@ -938,9 +930,8 @@ m_getm2(struct mbuf *m, int len, int how, short type, int flags) * Nothing. */ void -m_extadd(struct mbuf *mb, caddr_t buf, u_int size, - void (*freef)(struct mbuf *, void *, void *), void *arg1, void *arg2, - int flags, int type) +m_extadd(struct mbuf *mb, char *buf, u_int size, m_ext_free_t freef, + void *arg1, void *arg2, int flags, int type) { KASSERT(type != EXT_CLUSTER, ("%s: EXT_CLUSTER not allowed", __func__)); diff --git a/freebsd/sys/kern/kern_mib.c b/freebsd/sys/kern/kern_mib.c index 1f867dd4..4f520ef3 100644 --- a/freebsd/sys/kern/kern_mib.c +++ b/freebsd/sys/kern/kern_mib.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1982, 1986, 1989, 1993 * The Regents of the University of California. All rights reserved. * diff --git a/freebsd/sys/kern/kern_module.c b/freebsd/sys/kern/kern_module.c index 28aa8b20..58a2f83a 100644 --- a/freebsd/sys/kern/kern_module.c +++ b/freebsd/sys/kern/kern_module.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 1997 Doug Rabson * All rights reserved. * diff --git a/freebsd/sys/kern/kern_mtxpool.c b/freebsd/sys/kern/kern_mtxpool.c index 4b0329b0..7f6c4dce 100644 --- a/freebsd/sys/kern/kern_mtxpool.c +++ b/freebsd/sys/kern/kern_mtxpool.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2001 Matthew Dillon. All Rights Reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/freebsd/sys/kern/kern_osd.c b/freebsd/sys/kern/kern_osd.c index 96e7e5fd..b7fc945a 100644 --- a/freebsd/sys/kern/kern_osd.c +++ b/freebsd/sys/kern/kern_osd.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2007 Pawel Jakub Dawidek <pjd@FreeBSD.org> * All rights reserved. * diff --git a/freebsd/sys/kern/kern_synch.c b/freebsd/sys/kern/kern_synch.c index 3dfa4164..d96954c7 100644 --- a/freebsd/sys/kern/kern_synch.c +++ b/freebsd/sys/kern/kern_synch.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1982, 1986, 1990, 1991, 1993 * The Regents of the University of California. All rights reserved. * (c) UNIX System Laboratories, Inc. diff --git a/freebsd/sys/kern/kern_sysctl.c b/freebsd/sys/kern/kern_sysctl.c index e99a8bd6..02078a32 100644 --- a/freebsd/sys/kern/kern_sysctl.c +++ b/freebsd/sys/kern/kern_sysctl.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1982, 1986, 1989, 1993 * The Regents of the University of California. All rights reserved. * @@ -516,6 +518,37 @@ retry: } void +sysctl_register_disabled_oid(struct sysctl_oid *oidp) +{ + + /* + * Mark the leaf as dormant if it's not to be immediately enabled. + * We do not disable nodes as they can be shared between modules + * and it is always safe to access a node. + */ + KASSERT((oidp->oid_kind & CTLFLAG_DORMANT) == 0, + ("internal flag is set in oid_kind")); + if ((oidp->oid_kind & CTLTYPE) != CTLTYPE_NODE) + oidp->oid_kind |= CTLFLAG_DORMANT; + sysctl_register_oid(oidp); +} + +void +sysctl_enable_oid(struct sysctl_oid *oidp) +{ + + SYSCTL_ASSERT_WLOCKED(); + if ((oidp->oid_kind & CTLTYPE) == CTLTYPE_NODE) { + KASSERT((oidp->oid_kind & CTLFLAG_DORMANT) == 0, + ("sysctl node is marked as dormant")); + return; + } + KASSERT((oidp->oid_kind & CTLFLAG_DORMANT) != 0, + ("enabling already enabled sysctl oid")); + oidp->oid_kind &= ~CTLFLAG_DORMANT; +} + +void sysctl_unregister_oid(struct sysctl_oid *oidp) { struct sysctl_oid *p; @@ -1063,7 +1096,7 @@ sysctl_sysctl_next_ls(struct sysctl_oid_list *lsp, int *name, u_int namelen, *next = oidp->oid_number; *oidpp = oidp; - if (oidp->oid_kind & CTLFLAG_SKIP) + if ((oidp->oid_kind & (CTLFLAG_SKIP | CTLFLAG_DORMANT)) != 0) continue; if (!namelen) { @@ -1184,17 +1217,21 @@ sysctl_sysctl_name2oid(SYSCTL_HANDLER_ARGS) int error, oid[CTL_MAXNAME], len = 0; struct sysctl_oid *op = NULL; struct rm_priotracker tracker; + char buf[32]; if (!req->newlen) return (ENOENT); if (req->newlen >= MAXPATHLEN) /* XXX arbitrary, undocumented */ return (ENAMETOOLONG); - p = malloc(req->newlen+1, M_SYSCTL, M_WAITOK); + p = buf; + if (req->newlen >= sizeof(buf)) + p = malloc(req->newlen+1, M_SYSCTL, M_WAITOK); error = SYSCTL_IN(req, p, req->newlen); if (error) { - free(p, M_SYSCTL); + if (p != buf) + free(p, M_SYSCTL); return (error); } @@ -1204,7 +1241,8 @@ sysctl_sysctl_name2oid(SYSCTL_HANDLER_ARGS) error = name2oid(p, oid, &len, &op); SYSCTL_RUNLOCK(&tracker); - free(p, M_SYSCTL); + if (p != buf) + free(p, M_SYSCTL); if (error) return (error); @@ -1902,6 +1940,8 @@ sysctl_find_oid(int *name, u_int namelen, struct sysctl_oid **noid, } lsp = SYSCTL_CHILDREN(oid); } else if (indx == namelen) { + if ((oid->oid_kind & CTLFLAG_DORMANT) != 0) + return (ENOENT); *noid = oid; if (nindx != NULL) *nindx = indx; @@ -2105,12 +2145,11 @@ userland_sysctl(struct thread *td, int *name, u_int namelen, void *old, if (KTRPOINT(curthread, KTR_SYSCTL)) ktrsysctl(name, namelen); #endif - - if (req.oldptr && req.oldlen > PAGE_SIZE) { + memlocked = 0; + if (req.oldptr && req.oldlen > 4 * PAGE_SIZE) { memlocked = 1; sx_xlock(&sysctlmemlock); - } else - memlocked = 0; + } CURVNET_SET(TD_TO_VNET(td)); for (;;) { diff --git a/freebsd/sys/kern/kern_time.c b/freebsd/sys/kern/kern_time.c index 6e394310..61dc7c73 100644 --- a/freebsd/sys/kern/kern_time.c +++ b/freebsd/sys/kern/kern_time.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1982, 1986, 1989, 1993 * The Regents of the University of California. All rights reserved. * @@ -418,7 +420,7 @@ kern_clock_settime(struct thread *td, clockid_t clock_id, struct timespec *ats) if (ats->tv_nsec < 0 || ats->tv_nsec >= 1000000000 || ats->tv_sec < 0) return (EINVAL); - if (!allow_insane_settime && ats->tv_sec > 9999ULL * 366 * 24 * 60 * 60) + if (!allow_insane_settime && ats->tv_sec > 8000ULL * 365 * 24 * 60 * 60) return (EINVAL); /* XXX Don't convert nsec->usec and back */ TIMESPEC_TO_TIMEVAL(&atv, ats); diff --git a/freebsd/sys/kern/kern_timeout.c b/freebsd/sys/kern/kern_timeout.c index e1f6209d..d33c158a 100644 --- a/freebsd/sys/kern/kern_timeout.c +++ b/freebsd/sys/kern/kern_timeout.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1982, 1986, 1991, 1993 * The Regents of the University of California. All rights reserved. * (c) UNIX System Laboratories, Inc. @@ -300,7 +302,7 @@ cc_cce_migrating(struct callout_cpu *cc, int direct) /* * Kernel low level callwheel initialization - * called on cpu0 during kernel startup. + * called on the BSP during kernel startup. */ #ifdef __rtems__ static void rtems_bsd_timeout_init_early(void *); @@ -357,7 +359,7 @@ callout_callwheel_init(void *dummy) * XXX: Clip callout to result of previous function of maxusers * maximum 384. This is still huge, but acceptable. */ - memset(CC_CPU(0), 0, sizeof(cc_cpu)); + memset(CC_CPU(curcpu), 0, sizeof(cc_cpu)); #ifndef __rtems__ ncallout = imin(16 + maxproc + maxfiles, 18508); TUNABLE_INT_FETCH("kern.ncallout", &ncallout); @@ -381,7 +383,7 @@ callout_callwheel_init(void *dummy) #endif /* __rtems__ */ /* - * Only cpu0 handles timeout(9) and receives a preallocation. + * Only BSP handles timeout(9) and receives a preallocation. * * XXX: Once all timeout(9) consumers are converted this can * be removed. @@ -427,7 +429,7 @@ callout_cpu_init(struct callout_cpu *cc, int cpu) snprintf(cc->cc_ktr_event_name, sizeof(cc->cc_ktr_event_name), "callwheel cpu %d", cpu); #ifndef __rtems__ - if (cc->cc_callout == NULL) /* Only cpu0 handles timeout(9) */ + if (cc->cc_callout == NULL) /* Only BSP handles timeout(9) */ return; #endif /* __rtems__ */ for (i = 0; i < ncallout; i++) { @@ -499,7 +501,7 @@ start_softclock(void *dummy) if (cpu == timeout_cpu) continue; cc = CC_CPU(cpu); - cc->cc_callout = NULL; /* Only cpu0 handles timeout(9). */ + cc->cc_callout = NULL; /* Only BSP handles timeout(9). */ callout_cpu_init(cc, cpu); snprintf(name, sizeof(name), "clock (%d)", cpu); ie = NULL; diff --git a/freebsd/sys/kern/kern_uuid.c b/freebsd/sys/kern/kern_uuid.c index 1ac19685..80290ccc 100644 --- a/freebsd/sys/kern/kern_uuid.c +++ b/freebsd/sys/kern/kern_uuid.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2002 Marcel Moolenaar * All rights reserved. * diff --git a/freebsd/sys/kern/subr_blist.c b/freebsd/sys/kern/subr_blist.c index 7f232e93..a7d78d86 100644 --- a/freebsd/sys/kern/subr_blist.c +++ b/freebsd/sys/kern/subr_blist.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1998 Matthew Dillon. All Rights Reserved. * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -110,6 +112,7 @@ __FBSDID("$FreeBSD$"); #include <sys/sbuf.h> #include <stdio.h> #include <string.h> +#include <stddef.h> #include <stdlib.h> #include <stdarg.h> #include <stdbool.h> @@ -139,7 +142,6 @@ static void blst_copy(blmeta_t *scan, daddr_t blk, daddr_t radix, static daddr_t blst_leaf_fill(blmeta_t *scan, daddr_t blk, int count); static daddr_t blst_meta_fill(blmeta_t *scan, daddr_t allocBlk, daddr_t count, u_daddr_t radix); -static daddr_t blst_radix_init(blmeta_t *scan, daddr_t radix, daddr_t count); #ifndef _KERNEL static void blst_radix_print(blmeta_t *scan, daddr_t blk, daddr_t radix, int tab); @@ -220,30 +222,70 @@ blist_t blist_create(daddr_t blocks, int flags) { blist_t bl; - daddr_t nodes, radix; + daddr_t i, last_block; + u_daddr_t nodes, radix, skip; + int digit; /* - * Calculate the radix field used for scanning. + * Calculate the radix and node count used for scanning. Find the last + * block that is followed by a terminator. */ + last_block = blocks - 1; radix = BLIST_BMAP_RADIX; while (radix < blocks) { + if (((last_block / radix + 1) & BLIST_META_MASK) != 0) + /* + * A terminator will be added. Update last_block to the + * position just before that terminator. + */ + last_block |= radix - 1; radix *= BLIST_META_RADIX; } - nodes = 1 + blst_radix_init(NULL, radix, blocks); - bl = malloc(sizeof(struct blist), M_SWAP, flags); + /* + * Count the meta-nodes in the expanded tree, including the final + * terminator, from the bottom level up to the root. + */ + nodes = (last_block >= blocks) ? 2 : 1; + last_block /= BLIST_BMAP_RADIX; + while (last_block > 0) { + nodes += last_block + 1; + last_block /= BLIST_META_RADIX; + } + bl = malloc(offsetof(struct blist, bl_root[nodes]), M_SWAP, flags | + M_ZERO); if (bl == NULL) return (NULL); bl->bl_blocks = blocks; bl->bl_radix = radix; bl->bl_cursor = 0; - bl->bl_root = malloc(nodes * sizeof(blmeta_t), M_SWAP, flags); - if (bl->bl_root == NULL) { - free(bl, M_SWAP); - return (NULL); + + /* + * Initialize the empty tree by filling in root values, then initialize + * just the terminators in the rest of the tree. + */ + bl->bl_root[0].bm_bighint = 0; + if (radix == BLIST_BMAP_RADIX) + bl->bl_root[0].u.bmu_bitmap = 0; + else + bl->bl_root[0].u.bmu_avail = 0; + last_block = blocks - 1; + i = 0; + while (radix > BLIST_BMAP_RADIX) { + radix /= BLIST_META_RADIX; + skip = radix_to_skip(radix); + digit = last_block / radix; + i += 1 + digit * skip; + if (digit != BLIST_META_MASK) { + /* + * Add a terminator. + */ + bl->bl_root[i + skip].bm_bighint = (daddr_t)-1; + bl->bl_root[i + skip].u.bmu_bitmap = 0; + } + last_block %= radix; } - blst_radix_init(bl->bl_root, radix, blocks); #if defined(BLIST_DEBUG) printf( @@ -263,7 +305,7 @@ blist_create(daddr_t blocks, int flags) void blist_destroy(blist_t bl) { - free(bl->bl_root, M_SWAP); + free(bl, M_SWAP); } @@ -1074,83 +1116,6 @@ blst_meta_fill(blmeta_t *scan, daddr_t allocBlk, daddr_t count, u_daddr_t radix) return (nblks); } -/* - * BLST_RADIX_INIT() - initialize radix tree - * - * Initialize our meta structures and bitmaps and calculate the exact - * amount of space required to manage 'count' blocks - this space may - * be considerably less than the calculated radix due to the large - * RADIX values we use. - */ -static daddr_t -blst_radix_init(blmeta_t *scan, daddr_t radix, daddr_t count) -{ - daddr_t i, memindex, next_skip, skip; - - memindex = 0; - - /* - * Leaf node - */ - - if (radix == BLIST_BMAP_RADIX) { - if (scan) { - scan->bm_bighint = 0; - scan->u.bmu_bitmap = 0; - } - return (memindex); - } - - /* - * Meta node. If allocating the entire object we can special - * case it. However, we need to figure out how much memory - * is required to manage 'count' blocks, so we continue on anyway. - */ - - if (scan) { - scan->bm_bighint = 0; - scan->u.bmu_avail = 0; - } - - skip = radix_to_skip(radix); - next_skip = skip / BLIST_META_RADIX; - radix /= BLIST_META_RADIX; - - for (i = 1; i < skip; i += next_skip) { - if (count >= radix) { - /* - * Allocate the entire object - */ - memindex = i + - blst_radix_init(((scan) ? &scan[i] : NULL), radix, - radix); - count -= radix; - } else if (count > 0) { - /* - * Allocate a partial object - */ - memindex = i + - blst_radix_init(((scan) ? &scan[i] : NULL), radix, - count); - count = 0; - } else { - /* - * Add terminator and break out. Make terminator bitmap - * zero to avoid a spanning leaf allocation that - * includes the terminator. - */ - if (scan) { - scan[i].bm_bighint = (daddr_t)-1; - scan[i].u.bmu_bitmap = 0; - } - break; - } - } - if (memindex < i) - memindex = i; - return (memindex); -} - #ifdef BLIST_DEBUG static void diff --git a/freebsd/sys/kern/subr_bufring.c b/freebsd/sys/kern/subr_bufring.c index 00b3a10a..30294de2 100644 --- a/freebsd/sys/kern/subr_bufring.c +++ b/freebsd/sys/kern/subr_bufring.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2007, 2008 Kip Macy <kmacy@freebsd.org> * All rights reserved. * diff --git a/freebsd/sys/kern/subr_bus.c b/freebsd/sys/kern/subr_bus.c index fdc47ab5..09a459aa 100644 --- a/freebsd/sys/kern/subr_bus.c +++ b/freebsd/sys/kern/subr_bus.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 1997,1998,2003 Doug Rabson * All rights reserved. * @@ -2977,6 +2979,9 @@ device_attach(device_t dev) else dev->state = DS_ATTACHED; dev->flags &= ~DF_DONENOMATCH; +#ifndef __rtems__ + EVENTHANDLER_INVOKE(device_attach, dev); +#endif /* __rtems__ */ devadded(dev); return (0); } @@ -3010,8 +3015,19 @@ device_detach(device_t dev) if (dev->state != DS_ATTACHED) return (0); - if ((error = DEVICE_DETACH(dev)) != 0) +#ifndef __rtems__ + EVENTHANDLER_INVOKE(device_detach, dev, EVHDEV_DETACH_BEGIN); +#endif /* __rtems__ */ + if ((error = DEVICE_DETACH(dev)) != 0) { +#ifndef __rtems__ + EVENTHANDLER_INVOKE(device_detach, dev, EVHDEV_DETACH_FAILED); +#endif /* __rtems__ */ return (error); + } else { +#ifndef __rtems__ + EVENTHANDLER_INVOKE(device_detach, dev, EVHDEV_DETACH_COMPLETE); +#endif /* __rtems__ */ + } devremoved(dev); if (!device_is_quiet(dev)) device_printf(dev, "detached\n"); diff --git a/freebsd/sys/kern/subr_counter.c b/freebsd/sys/kern/subr_counter.c index 685f5332..e4c98fae 100644 --- a/freebsd/sys/kern/subr_counter.c +++ b/freebsd/sys/kern/subr_counter.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2012 Gleb Smirnoff <glebius@FreeBSD.org> * All rights reserved. * diff --git a/freebsd/sys/kern/subr_eventhandler.c b/freebsd/sys/kern/subr_eventhandler.c index c373a7f2..92cd9726 100644 --- a/freebsd/sys/kern/subr_eventhandler.c +++ b/freebsd/sys/kern/subr_eventhandler.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 1999 Michael Smith <msmith@freebsd.org> * All rights reserved. * @@ -40,7 +42,7 @@ __FBSDID("$FreeBSD$"); static MALLOC_DEFINE(M_EVENTHANDLER, "eventhandler", "Event handler records"); -/* List of 'slow' lists */ +/* List of all eventhandler lists */ static TAILQ_HEAD(, eventhandler_list) eventhandler_lists; static int eventhandler_lists_initted = 0; static struct mtx eventhandler_mutex; @@ -66,25 +68,11 @@ eventhandler_init(void *dummy __unused) SYSINIT(eventhandlers, SI_SUB_EVENTHANDLER, SI_ORDER_FIRST, eventhandler_init, NULL); -/* - * Insertion is O(n) due to the priority scan, but optimises to O(1) - * if all priorities are identical. - */ -static eventhandler_tag -eventhandler_register_internal(struct eventhandler_list *list, - const char *name, eventhandler_tag epn) +static struct eventhandler_list * +eventhandler_find_or_create_list(const char *name) { - struct eventhandler_list *new_list; - struct eventhandler_entry *ep; - - KASSERT(eventhandler_lists_initted, ("eventhandler registered too early")); - KASSERT(epn != NULL, ("%s: cannot register NULL event", __func__)); - - /* lock the eventhandler lists */ - mtx_lock(&eventhandler_mutex); + struct eventhandler_list *list, *new_list; - /* Do we need to find/create the (slow) list? */ - if (list == NULL) { /* look for a matching, existing list */ list = _eventhandler_find_list(name); @@ -92,8 +80,8 @@ eventhandler_register_internal(struct eventhandler_list *list, if (list == NULL) { mtx_unlock(&eventhandler_mutex); - new_list = malloc(sizeof(struct eventhandler_list) + - strlen(name) + 1, M_EVENTHANDLER, M_WAITOK); + new_list = malloc(sizeof(*new_list) + strlen(name) + 1, + M_EVENTHANDLER, M_WAITOK | M_ZERO); /* If someone else created it already, then use that one. */ mtx_lock(&eventhandler_mutex); @@ -103,21 +91,35 @@ eventhandler_register_internal(struct eventhandler_list *list, } else { CTR2(KTR_EVH, "%s: creating list \"%s\"", __func__, name); list = new_list; - list->el_flags = 0; - list->el_runcount = 0; - bzero(&list->el_lock, sizeof(list->el_lock)); - list->el_name = (char *)list + sizeof(struct eventhandler_list); + TAILQ_INIT(&list->el_entries); + mtx_init(&list->el_lock, name, "eventhandler list", MTX_DEF); + list->el_name = (char *)(list + 1); strcpy(list->el_name, name); TAILQ_INSERT_HEAD(&eventhandler_lists, list, el_link); } } + return (list); +} + +/* + * Insertion is O(n) due to the priority scan, but optimises to O(1) + * if all priorities are identical. + */ +static eventhandler_tag +eventhandler_register_internal(struct eventhandler_list *list, + const char *name, eventhandler_tag epn) +{ + struct eventhandler_entry *ep; + + KASSERT(eventhandler_lists_initted, ("eventhandler registered too early")); + KASSERT(epn != NULL, ("%s: cannot register NULL event", __func__)); + + /* Do we need to find/create the list? */ + if (list == NULL) { + mtx_lock(&eventhandler_mutex); + list = eventhandler_find_or_create_list(name); + mtx_unlock(&eventhandler_mutex); } - if (!(list->el_flags & EHL_INITTED)) { - TAILQ_INIT(&list->el_entries); - mtx_init(&list->el_lock, name, "eventhandler list", MTX_DEF); - atomic_store_rel_int(&list->el_flags, EHL_INITTED); - } - mtx_unlock(&eventhandler_mutex); KASSERT(epn->ee_priority != EHE_DEAD_PRIORITY, ("%s: handler for %s registered with dead priority", __func__, name)); @@ -182,8 +184,9 @@ vimage_eventhandler_register(struct eventhandler_list *list, const char *name, } #endif -void -eventhandler_deregister(struct eventhandler_list *list, eventhandler_tag tag) +static void +_eventhandler_deregister(struct eventhandler_list *list, eventhandler_tag tag, + bool wait) { struct eventhandler_entry *ep = tag; @@ -217,11 +220,26 @@ eventhandler_deregister(struct eventhandler_list *list, eventhandler_tag tag) ep->ee_priority = EHE_DEAD_PRIORITY; } } - while (list->el_runcount > 0) + while (wait && list->el_runcount > 0) mtx_sleep(list, &list->el_lock, 0, "evhrm", 0); EHL_UNLOCK(list); } +void +eventhandler_deregister(struct eventhandler_list *list, eventhandler_tag tag) +{ + + _eventhandler_deregister(list, tag, true); +} + +void +eventhandler_deregister_nowait(struct eventhandler_list *list, + eventhandler_tag tag) +{ + + _eventhandler_deregister(list, tag, false); +} + /* * Internal version for use when eventhandler list is already locked. */ @@ -280,3 +298,22 @@ eventhandler_prune_list(struct eventhandler_list *list) if (pruned > 0) wakeup(list); } + +/* + * Create (or get the existing) list so the pointer can be stored by + * EVENTHANDLER_LIST_DEFINE. + */ +struct eventhandler_list * +eventhandler_create_list(const char *name) +{ + struct eventhandler_list *list; + + KASSERT(eventhandler_lists_initted, + ("eventhandler list created too early")); + + mtx_lock(&eventhandler_mutex); + list = eventhandler_find_or_create_list(name); + mtx_unlock(&eventhandler_mutex); + + return (list); +} diff --git a/freebsd/sys/kern/subr_firmware.c b/freebsd/sys/kern/subr_firmware.c index f08a8692..cc8bb691 100644 --- a/freebsd/sys/kern/subr_firmware.c +++ b/freebsd/sys/kern/subr_firmware.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2005-2008, Sam Leffler <sam@errno.com> * All rights reserved. * diff --git a/freebsd/sys/kern/subr_hash.c b/freebsd/sys/kern/subr_hash.c index 193ad1be..488d8bcd 100644 --- a/freebsd/sys/kern/subr_hash.c +++ b/freebsd/sys/kern/subr_hash.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1982, 1986, 1991, 1993 * The Regents of the University of California. All rights reserved. * (c) UNIX System Laboratories, Inc. diff --git a/freebsd/sys/kern/subr_hints.c b/freebsd/sys/kern/subr_hints.c index b19379c4..982059c3 100644 --- a/freebsd/sys/kern/subr_hints.c +++ b/freebsd/sys/kern/subr_hints.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2000,2001 Peter Wemm <peter@FreeBSD.org> * All rights reserved. * diff --git a/freebsd/sys/kern/subr_kobj.c b/freebsd/sys/kern/subr_kobj.c index 7436535e..a6a888d5 100644 --- a/freebsd/sys/kern/subr_kobj.c +++ b/freebsd/sys/kern/subr_kobj.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2000,2003 Doug Rabson * All rights reserved. * diff --git a/freebsd/sys/kern/subr_lock.c b/freebsd/sys/kern/subr_lock.c index 28991a9f..4f577b65 100644 --- a/freebsd/sys/kern/subr_lock.c +++ b/freebsd/sys/kern/subr_lock.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2006 John Baldwin <jhb@FreeBSD.org> * All rights reserved. * diff --git a/freebsd/sys/kern/subr_module.c b/freebsd/sys/kern/subr_module.c index 09cc3560..d8d42653 100644 --- a/freebsd/sys/kern/subr_module.c +++ b/freebsd/sys/kern/subr_module.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 1998 Michael Smith * All rights reserved. * diff --git a/freebsd/sys/kern/subr_pcpu.c b/freebsd/sys/kern/subr_pcpu.c index 076c302c..1d230b68 100644 --- a/freebsd/sys/kern/subr_pcpu.c +++ b/freebsd/sys/kern/subr_pcpu.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 2001 Wind River Systems, Inc. * All rights reserved. * Written by: John Baldwin <jhb@FreeBSD.org> @@ -412,7 +414,7 @@ DB_SHOW_ALL_COMMAND(pcpu, db_show_cpu_all) int id; db_printf("Current CPU: %d\n\n", PCPU_GET(cpuid)); - for (id = 0; id <= mp_maxid; id++) { + CPU_FOREACH(id) { pc = pcpu_find(id); if (pc != NULL) { show_pcpu(pc); diff --git a/freebsd/sys/kern/subr_prf.c b/freebsd/sys/kern/subr_prf.c index 0380cfec..0405b369 100644 --- a/freebsd/sys/kern/subr_prf.c +++ b/freebsd/sys/kern/subr_prf.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1986, 1988, 1991, 1993 * The Regents of the University of California. All rights reserved. * (c) UNIX System Laboratories, Inc. diff --git a/freebsd/sys/kern/subr_sbuf.c b/freebsd/sys/kern/subr_sbuf.c index 951cb50c..b51ed52c 100644 --- a/freebsd/sys/kern/subr_sbuf.c +++ b/freebsd/sys/kern/subr_sbuf.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2000-2008 Poul-Henning Kamp * Copyright (c) 2000-2008 Dag-Erling Coïdan Smørgrav * All rights reserved. diff --git a/freebsd/sys/kern/subr_sleepqueue.c b/freebsd/sys/kern/subr_sleepqueue.c index a8ffa7e8..fa33af86 100644 --- a/freebsd/sys/kern/subr_sleepqueue.c +++ b/freebsd/sys/kern/subr_sleepqueue.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2004 John Baldwin <jhb@FreeBSD.org> * Copyright (c) 2015 embedded brains GmbH <rtems@embedded-brains.de> * All rights reserved. @@ -102,7 +104,10 @@ __FBSDID("$FreeBSD$"); * Constants for the hash table of sleep queue chains. * SC_TABLESIZE must be a power of two for SC_MASK to work properly. */ -#define SC_TABLESIZE 256 /* Must be power of 2. */ +#ifndef SC_TABLESIZE +#define SC_TABLESIZE 256 +#endif +CTASSERT(powerof2(SC_TABLESIZE)); #define SC_MASK (SC_TABLESIZE - 1) #define SC_SHIFT 8 #define SC_HASH(wc) ((((uintptr_t)(wc) >> SC_SHIFT) ^ (uintptr_t)(wc)) & \ @@ -146,7 +151,7 @@ struct sleepqueue_chain { u_int sc_depth; /* Length of sc_queues. */ u_int sc_max_depth; /* Max length of sc_queues. */ #endif -}; +} __aligned(CACHE_LINE_SIZE); #ifdef SLEEPQUEUE_PROFILING u_int sleepq_max_depth; @@ -1463,7 +1468,7 @@ sleepq_sbuf_print_stacks(struct sbuf *sb, void *wchan, int queue, M_TEMP, M_WAITOK); for (stack_idx = 0; stack_idx < stacks_to_allocate; stack_idx++) - st[stack_idx] = stack_create(); + st[stack_idx] = stack_create(M_WAITOK); /* Where we will store the td name, tid, etc. */ td_infos = malloc(sizeof(struct sbuf *) * stacks_to_allocate, @@ -1735,7 +1740,7 @@ found: if (TAILQ_EMPTY(&sq->sq_blocked[i])) db_printf("\tempty\n"); else - TAILQ_FOREACH(td, &sq->sq_blocked[0], + TAILQ_FOREACH(td, &sq->sq_blocked[i], td_slpq) { db_printf("\t%p (tid %d, pid %d, \"%s\")\n", td, td->td_tid, td->td_proc->p_pid, diff --git a/freebsd/sys/kern/subr_taskqueue.c b/freebsd/sys/kern/subr_taskqueue.c index 74b9cf59..60057f78 100644 --- a/freebsd/sys/kern/subr_taskqueue.c +++ b/freebsd/sys/kern/subr_taskqueue.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2000 Doug Rabson * All rights reserved. * diff --git a/freebsd/sys/kern/subr_uio.c b/freebsd/sys/kern/subr_uio.c index 904ef1f4..4979bcf1 100644 --- a/freebsd/sys/kern/subr_uio.c +++ b/freebsd/sys/kern/subr_uio.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1982, 1986, 1991, 1993 * The Regents of the University of California. All rights reserved. * (c) UNIX System Laboratories, Inc. diff --git a/freebsd/sys/kern/subr_unit.c b/freebsd/sys/kern/subr_unit.c index 1deeeb8b..426253dc 100644 --- a/freebsd/sys/kern/subr_unit.c +++ b/freebsd/sys/kern/subr_unit.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2004 Poul-Henning Kamp * All rights reserved. * @@ -368,6 +370,26 @@ delete_unrhdr(struct unrhdr *uh) Free(uh); } +void +clear_unrhdr(struct unrhdr *uh) +{ + struct unr *up, *uq; + + KASSERT(TAILQ_EMPTY(&uh->ppfree), + ("unrhdr has postponed item for free")); + TAILQ_FOREACH_SAFE(up, &uh->head, list, uq) { + if (up->ptr != uh) { + Free(up->ptr); + } + Free(up); + } + uh->busy = 0; + uh->alloc = 0; + init_unrhdr(uh, uh->low, uh->high, uh->mtx); + + check_unrhdr(uh, __LINE__); +} + static __inline int is_bitmap(struct unrhdr *uh, struct unr *up) { diff --git a/freebsd/sys/kern/sys_generic.c b/freebsd/sys/kern/sys_generic.c index 6b26dbeb..118b4c77 100644 --- a/freebsd/sys/kern/sys_generic.c +++ b/freebsd/sys/kern/sys_generic.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1982, 1986, 1989, 1993 * The Regents of the University of California. All rights reserved. * (c) UNIX System Laboratories, Inc. diff --git a/freebsd/sys/kern/sys_pipe.c b/freebsd/sys/kern/sys_pipe.c index 08dd619a..cc5b123c 100755 --- a/freebsd/sys/kern/sys_pipe.c +++ b/freebsd/sys/kern/sys_pipe.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-4-Clause + * * Copyright (c) 1996 John S. Dyson * Copyright (c) 2012 Giovanni Trematerra * All rights reserved. diff --git a/freebsd/sys/kern/sys_socket.c b/freebsd/sys/kern/sys_socket.c index b3c9c56d..974f7eec 100644 --- a/freebsd/sys/kern/sys_socket.c +++ b/freebsd/sys/kern/sys_socket.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1982, 1986, 1990, 1993 * The Regents of the University of California. All rights reserved. * diff --git a/freebsd/sys/kern/tty.c b/freebsd/sys/kern/tty.c index 7d8400c7..1350c1d9 100644 --- a/freebsd/sys/kern/tty.c +++ b/freebsd/sys/kern/tty.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2008 Ed Schouten <ed@FreeBSD.org> * All rights reserved. * diff --git a/freebsd/sys/kern/tty_inq.c b/freebsd/sys/kern/tty_inq.c index 84980393..b470cb5a 100644 --- a/freebsd/sys/kern/tty_inq.c +++ b/freebsd/sys/kern/tty_inq.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2008 Ed Schouten <ed@FreeBSD.org> * All rights reserved. * diff --git a/freebsd/sys/kern/tty_outq.c b/freebsd/sys/kern/tty_outq.c index f083641b..121e9975 100644 --- a/freebsd/sys/kern/tty_outq.c +++ b/freebsd/sys/kern/tty_outq.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2008 Ed Schouten <ed@FreeBSD.org> * All rights reserved. * diff --git a/freebsd/sys/kern/tty_ttydisc.c b/freebsd/sys/kern/tty_ttydisc.c index 5ecb15ea..b94080fb 100644 --- a/freebsd/sys/kern/tty_ttydisc.c +++ b/freebsd/sys/kern/tty_ttydisc.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2008 Ed Schouten <ed@FreeBSD.org> * All rights reserved. * diff --git a/freebsd/sys/kern/uipc_accf.c b/freebsd/sys/kern/uipc_accf.c index 8a0e14e3..64f59202 100644 --- a/freebsd/sys/kern/uipc_accf.c +++ b/freebsd/sys/kern/uipc_accf.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2000 Paycounter, Inc. * Copyright (c) 2005 Robert N. M. Watson * Author: Alfred Perlstein <alfred@paycounter.com>, <alfred@FreeBSD.org> diff --git a/freebsd/sys/kern/uipc_domain.c b/freebsd/sys/kern/uipc_domain.c index 93cc3d9a..90b6e971 100644 --- a/freebsd/sys/kern/uipc_domain.c +++ b/freebsd/sys/kern/uipc_domain.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1982, 1986, 1993 * The Regents of the University of California. All rights reserved. * diff --git a/freebsd/sys/kern/uipc_mbuf.c b/freebsd/sys/kern/uipc_mbuf.c index abc30dd3..7bf531e0 100644 --- a/freebsd/sys/kern/uipc_mbuf.c +++ b/freebsd/sys/kern/uipc_mbuf.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1982, 1986, 1988, 1991, 1993 * The Regents of the University of California. All rights reserved. * @@ -190,7 +192,17 @@ mb_dupcl(struct mbuf *n, struct mbuf *m) KASSERT(m->m_flags & M_EXT, ("%s: M_EXT not set on %p", __func__, m)); KASSERT(!(n->m_flags & M_EXT), ("%s: M_EXT set on %p", __func__, n)); - n->m_ext = m->m_ext; + /* + * Cache access optimization. For most kinds of external + * storage we don't need full copy of m_ext, since the + * holder of the 'ext_count' is responsible to carry the + * free routine and its arguments. Exclusion is EXT_EXTREF, + * where 'ext_cnt' doesn't point into mbuf at all. + */ + if (m->m_ext.ext_type == EXT_EXTREF) + bcopy(&m->m_ext, &n->m_ext, sizeof(struct m_ext)); + else + bcopy(&m->m_ext, &n->m_ext, m_ext_copylen); n->m_flags |= M_EXT; n->m_flags |= m->m_flags & M_RDONLY; @@ -1441,62 +1453,59 @@ bad: struct mbuf * m_fragment(struct mbuf *m0, int how, int length) { - struct mbuf *m_new = NULL, *m_final = NULL; - int progress = 0; + struct mbuf *m_first, *m_last; + int divisor = 255, progress = 0, fraglen; if (!(m0->m_flags & M_PKTHDR)) return (m0); - if ((length == 0) || (length < -2)) + if (length == 0 || length < -2) return (m0); + if (length > MCLBYTES) + length = MCLBYTES; + if (length < 0 && divisor > MCLBYTES) + divisor = MCLBYTES; + if (length == -1) + length = 1 + (arc4random() % divisor); + if (length > 0) + fraglen = length; m_fixhdr(m0); /* Needed sanity check */ - m_final = m_getcl(how, MT_DATA, M_PKTHDR); - - if (m_final == NULL) + m_first = m_getcl(how, MT_DATA, M_PKTHDR); + if (m_first == NULL) goto nospace; - if (m_dup_pkthdr(m_final, m0, how) == 0) + if (m_dup_pkthdr(m_first, m0, how) == 0) goto nospace; - m_new = m_final; - - if (length == -1) - length = 1 + (arc4random() & 255); + m_last = m_first; while (progress < m0->m_pkthdr.len) { - int fraglen; - - if (length > 0) - fraglen = length; - else - fraglen = 1 + (arc4random() & 255); + if (length == -2) + fraglen = 1 + (arc4random() % divisor); if (fraglen > m0->m_pkthdr.len - progress) fraglen = m0->m_pkthdr.len - progress; - if (fraglen > MCLBYTES) - fraglen = MCLBYTES; - - if (m_new == NULL) { - m_new = m_getcl(how, MT_DATA, 0); + if (progress != 0) { + struct mbuf *m_new = m_getcl(how, MT_DATA, 0); if (m_new == NULL) goto nospace; + + m_last->m_next = m_new; + m_last = m_new; } - m_copydata(m0, progress, fraglen, mtod(m_new, caddr_t)); + m_copydata(m0, progress, fraglen, mtod(m_last, caddr_t)); progress += fraglen; - m_new->m_len = fraglen; - if (m_new != m_final) - m_cat(m_final, m_new); - m_new = NULL; + m_last->m_len = fraglen; } m_freem(m0); - m0 = m_final; + m0 = m_first; return (m0); nospace: - if (m_final) - m_freem(m_final); + if (m_first) + m_freem(m_first); /* Return the original chain on failure */ return (m0); } diff --git a/freebsd/sys/kern/uipc_mbuf2.c b/freebsd/sys/kern/uipc_mbuf2.c index bb2b27b0..7dd2840c 100644 --- a/freebsd/sys/kern/uipc_mbuf2.c +++ b/freebsd/sys/kern/uipc_mbuf2.c @@ -4,6 +4,8 @@ /* $NetBSD: uipc_mbuf.c,v 1.40 1999/04/01 00:23:25 thorpej Exp $ */ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (C) 1999 WIDE Project. * All rights reserved. * diff --git a/freebsd/sys/kern/uipc_sockbuf.c b/freebsd/sys/kern/uipc_sockbuf.c index 4ec7187c..0c4ace6b 100644 --- a/freebsd/sys/kern/uipc_sockbuf.c +++ b/freebsd/sys/kern/uipc_sockbuf.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1982, 1986, 1988, 1990, 1993 * The Regents of the University of California. All rights reserved. * diff --git a/freebsd/sys/kern/uipc_socket.c b/freebsd/sys/kern/uipc_socket.c index 5e4fda56..43763026 100644 --- a/freebsd/sys/kern/uipc_socket.c +++ b/freebsd/sys/kern/uipc_socket.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1982, 1986, 1988, 1990, 1993 * The Regents of the University of California. * Copyright (c) 2004 The FreeBSD Foundation diff --git a/freebsd/sys/kern/uipc_syscalls.c b/freebsd/sys/kern/uipc_syscalls.c index 5a9a381f..f2aba363 100644 --- a/freebsd/sys/kern/uipc_syscalls.c +++ b/freebsd/sys/kern/uipc_syscalls.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1982, 1986, 1989, 1990, 1993 * The Regents of the University of California. All rights reserved. * diff --git a/freebsd/sys/kern/uipc_usrreq.c b/freebsd/sys/kern/uipc_usrreq.c index 702ba1e4..9f7e545f 100644 --- a/freebsd/sys/kern/uipc_usrreq.c +++ b/freebsd/sys/kern/uipc_usrreq.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1982, 1986, 1989, 1991, 1993 * The Regents of the University of California. * Copyright (c) 2004-2009 Robert N. M. Watson @@ -1816,12 +1818,20 @@ unp_pcblist(SYSCTL_HANDLER_ARGS) if (unp->unp_addr != NULL) bcopy(unp->unp_addr, &xu->xu_addr, unp->unp_addr->sun_len); + else + bzero(&xu->xu_addr, sizeof(xu->xu_addr)); if (unp->unp_conn != NULL && unp->unp_conn->unp_addr != NULL) bcopy(unp->unp_conn->unp_addr, &xu->xu_caddr, unp->unp_conn->unp_addr->sun_len); - bcopy(unp, &xu->xu_unp, sizeof *unp); + else + bzero(&xu->xu_caddr, sizeof(xu->xu_caddr)); + xu->unp_vnode = unp->unp_vnode; + xu->unp_conn = unp->unp_conn; + xu->xu_firstref = LIST_FIRST(&unp->unp_refs); + xu->xu_nextref = LIST_NEXT(unp, unp_reflink); + xu->unp_gencnt = unp->unp_gencnt; sotoxsocket(unp->unp_socket, &xu->xu_socket); UNP_PCB_UNLOCK(unp); error = SYSCTL_OUT(req, xu, sizeof *xu); diff --git a/freebsd/sys/libkern/random.c b/freebsd/sys/libkern/random.c index efa9a70a..b8cb653a 100644 --- a/freebsd/sys/libkern/random.c +++ b/freebsd/sys/libkern/random.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1992, 1993 * The Regents of the University of California. All rights reserved. * @@ -41,8 +43,7 @@ __FBSDID("$FreeBSD$"); static u_long randseed = 937186357; /* after srandom(1), NSHUFF counted */ void -srandom(seed) - u_long seed; +srandom(u_long seed) { int i; diff --git a/freebsd/sys/lm32/include/machine/in_cksum.h b/freebsd/sys/lm32/include/machine/in_cksum.h index 72edfba9..d55b838b 100644 --- a/freebsd/sys/lm32/include/machine/in_cksum.h +++ b/freebsd/sys/lm32/include/machine/in_cksum.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1990 The Regents of the University of California. * All rights reserved. * diff --git a/freebsd/sys/m32c/include/machine/in_cksum.h b/freebsd/sys/m32c/include/machine/in_cksum.h index 72edfba9..d55b838b 100644 --- a/freebsd/sys/m32c/include/machine/in_cksum.h +++ b/freebsd/sys/m32c/include/machine/in_cksum.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1990 The Regents of the University of California. * All rights reserved. * diff --git a/freebsd/sys/m32r/include/machine/in_cksum.h b/freebsd/sys/m32r/include/machine/in_cksum.h index 72edfba9..d55b838b 100644 --- a/freebsd/sys/m32r/include/machine/in_cksum.h +++ b/freebsd/sys/m32r/include/machine/in_cksum.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1990 The Regents of the University of California. * All rights reserved. * diff --git a/freebsd/sys/m68k/include/machine/in_cksum.h b/freebsd/sys/m68k/include/machine/in_cksum.h index 72edfba9..d55b838b 100644 --- a/freebsd/sys/m68k/include/machine/in_cksum.h +++ b/freebsd/sys/m68k/include/machine/in_cksum.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1990 The Regents of the University of California. * All rights reserved. * diff --git a/freebsd/sys/mips/include/machine/cpufunc.h b/freebsd/sys/mips/include/machine/cpufunc.h index d4150edd..a83d22bf 100644 --- a/freebsd/sys/mips/include/machine/cpufunc.h +++ b/freebsd/sys/mips/include/machine/cpufunc.h @@ -1,6 +1,8 @@ /* $OpenBSD: pio.h,v 1.2 1998/09/15 10:50:12 pefo Exp $ */ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD AND BSD-4-Clause + * * Copyright (c) 2002-2004 Juli Mallett. All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/freebsd/sys/mips/include/machine/cpuregs.h b/freebsd/sys/mips/include/machine/cpuregs.h index ca86a1c5..b9978bd0 100644 --- a/freebsd/sys/mips/include/machine/cpuregs.h +++ b/freebsd/sys/mips/include/machine/cpuregs.h @@ -1,6 +1,8 @@ /* $NetBSD: cpuregs.h,v 1.70 2006/05/15 02:26:54 simonb Exp $ */ /* + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1992, 1993 * The Regents of the University of California. All rights reserved. * diff --git a/freebsd/sys/mips/include/machine/in_cksum.h b/freebsd/sys/mips/include/machine/in_cksum.h index 72edfba9..d55b838b 100644 --- a/freebsd/sys/mips/include/machine/in_cksum.h +++ b/freebsd/sys/mips/include/machine/in_cksum.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1990 The Regents of the University of California. * All rights reserved. * diff --git a/freebsd/sys/mips/mips/in_cksum.c b/freebsd/sys/mips/mips/in_cksum.c index 22e19d83..79aa23f9 100644 --- a/freebsd/sys/mips/mips/in_cksum.c +++ b/freebsd/sys/mips/mips/in_cksum.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-4-Clause + * * Copyright (c) 1988, 1992, 1993 * The Regents of the University of California. All rights reserved. * Copyright (c) 1996 diff --git a/freebsd/sys/net/bpf.c b/freebsd/sys/net/bpf.c index cd8d34d7..6fc6b435 100644 --- a/freebsd/sys/net/bpf.c +++ b/freebsd/sys/net/bpf.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1990, 1991, 1993 * The Regents of the University of California. All rights reserved. * diff --git a/freebsd/sys/net/bpf.h b/freebsd/sys/net/bpf.h index e82ce184..d8eb7ff4 100644 --- a/freebsd/sys/net/bpf.h +++ b/freebsd/sys/net/bpf.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1990, 1991, 1993 * The Regents of the University of California. All rights reserved. * diff --git a/freebsd/sys/net/bpf_buffer.c b/freebsd/sys/net/bpf_buffer.c index 88af8425..7a182a61 100644 --- a/freebsd/sys/net/bpf_buffer.c +++ b/freebsd/sys/net/bpf_buffer.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 2007 Seccuris Inc. * All rights reserved. * diff --git a/freebsd/sys/net/bpf_buffer.h b/freebsd/sys/net/bpf_buffer.h index c1dc1f3a..b49eed96 100644 --- a/freebsd/sys/net/bpf_buffer.h +++ b/freebsd/sys/net/bpf_buffer.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2007 Seccuris Inc. * All rights reserved. * diff --git a/freebsd/sys/net/bpf_filter.c b/freebsd/sys/net/bpf_filter.c index 8ca92300..4cd1f962 100644 --- a/freebsd/sys/net/bpf_filter.c +++ b/freebsd/sys/net/bpf_filter.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1990, 1991, 1993 * The Regents of the University of California. All rights reserved. * diff --git a/freebsd/sys/net/bpf_jitter.c b/freebsd/sys/net/bpf_jitter.c index 0369cb72..ac3a6ddd 100644 --- a/freebsd/sys/net/bpf_jitter.c +++ b/freebsd/sys/net/bpf_jitter.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (C) 2002-2003 NetGroup, Politecnico di Torino (Italy) * Copyright (C) 2005-2017 Jung-uk Kim <jkim@FreeBSD.org> * All rights reserved. diff --git a/freebsd/sys/net/bpf_jitter.h b/freebsd/sys/net/bpf_jitter.h index 479205ea..a7c7cd9f 100644 --- a/freebsd/sys/net/bpf_jitter.h +++ b/freebsd/sys/net/bpf_jitter.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (C) 2002-2003 NetGroup, Politecnico di Torino (Italy) * Copyright (C) 2005-2009 Jung-uk Kim <jkim@FreeBSD.org> * All rights reserved. diff --git a/freebsd/sys/net/bpf_zerocopy.h b/freebsd/sys/net/bpf_zerocopy.h index a5709b86..c3598747 100644 --- a/freebsd/sys/net/bpf_zerocopy.h +++ b/freebsd/sys/net/bpf_zerocopy.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2007 Seccuris Inc. * All rights reserved. * diff --git a/freebsd/sys/net/bpfdesc.h b/freebsd/sys/net/bpfdesc.h index 7c13f375..3d8e69ce 100644 --- a/freebsd/sys/net/bpfdesc.h +++ b/freebsd/sys/net/bpfdesc.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1990, 1991, 1993 * The Regents of the University of California. All rights reserved. * diff --git a/freebsd/sys/net/bridgestp.c b/freebsd/sys/net/bridgestp.c index dfa2a9bf..472b9634 100644 --- a/freebsd/sys/net/bridgestp.c +++ b/freebsd/sys/net/bridgestp.c @@ -2,7 +2,9 @@ /* $NetBSD: bridgestp.c,v 1.5 2003/11/28 08:56:48 keihan Exp $ */ -/* +/*- + * SPDX-License-Identifier: BSD-2-Clause-NetBSD + * * Copyright (c) 2000 Jason L. Wright (jason@thought.net) * Copyright (c) 2006 Andrew Thompson (thompsa@FreeBSD.org) * All rights reserved. diff --git a/freebsd/sys/net/bridgestp.h b/freebsd/sys/net/bridgestp.h index cbb8d53c..48f6c9eb 100644 --- a/freebsd/sys/net/bridgestp.h +++ b/freebsd/sys/net/bridgestp.h @@ -1,6 +1,8 @@ /* $NetBSD: if_bridgevar.h,v 1.4 2003/07/08 07:13:50 itojun Exp $ */ -/* +/*- + * SPDX-License-Identifier: BSD-4-Clause + * * Copyright 2001 Wasabi Systems, Inc. * All rights reserved. * @@ -35,7 +37,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ -/* +/*- * Copyright (c) 1999, 2000 Jason L. Wright (jason@thought.net) * All rights reserved. * diff --git a/freebsd/sys/net/fddi.h b/freebsd/sys/net/fddi.h index 71e3b6fb..0badcc3c 100644 --- a/freebsd/sys/net/fddi.h +++ b/freebsd/sys/net/fddi.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-4-Clause + * * Copyright (c) 1982, 1986, 1993 * The Regents of the University of California. All rights reserved. * Copyright (c) 1995 Matt Thomas (thomas@lkg.dec.com) diff --git a/freebsd/sys/net/firewire.h b/freebsd/sys/net/firewire.h index bab71a58..dd7d23e4 100644 --- a/freebsd/sys/net/firewire.h +++ b/freebsd/sys/net/firewire.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2004 Doug Rabson * All rights reserved. * diff --git a/freebsd/sys/net/ieee8023ad_lacp.c b/freebsd/sys/net/ieee8023ad_lacp.c index d3fb457e..1778193d 100644 --- a/freebsd/sys/net/ieee8023ad_lacp.c +++ b/freebsd/sys/net/ieee8023ad_lacp.c @@ -3,6 +3,8 @@ /* $NetBSD: ieee8023ad_lacp.c,v 1.3 2005/12/11 12:24:54 christos Exp $ */ /*- + * SPDX-License-Identifier: BSD-2-Clause-NetBSD + * * Copyright (c)2005 YAMAMOTO Takashi, * Copyright (c)2008 Andrew Thompson <thompsa@FreeBSD.org> * All rights reserved. diff --git a/freebsd/sys/net/ieee8023ad_lacp.h b/freebsd/sys/net/ieee8023ad_lacp.h index b26e2c92..5ae48ceb 100644 --- a/freebsd/sys/net/ieee8023ad_lacp.h +++ b/freebsd/sys/net/ieee8023ad_lacp.h @@ -1,6 +1,8 @@ /* $NetBSD: ieee8023ad_impl.h,v 1.2 2005/12/10 23:21:39 elad Exp $ */ /*- + * SPDX-License-Identifier: BSD-2-Clause-NetBSD + * * Copyright (c)2005 YAMAMOTO Takashi, * All rights reserved. * diff --git a/freebsd/sys/net/if.c b/freebsd/sys/net/if.c index 00505706..67252bd4 100644 --- a/freebsd/sys/net/if.c +++ b/freebsd/sys/net/if.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1980, 1986, 1993 * The Regents of the University of California. All rights reserved. * @@ -1710,7 +1712,7 @@ ifa_maintain_loopback_route(int cmd, const char *otype, struct ifaddr *ifa, bzero(&info, sizeof(info)); if (cmd != RTM_DELETE) info.rti_ifp = V_loif; - info.rti_flags = ifa->ifa_flags | RTF_HOST | RTF_STATIC; + info.rti_flags = ifa->ifa_flags | RTF_HOST | RTF_STATIC | RTF_PINNED; info.rti_info[RTAX_DST] = ia; info.rti_info[RTAX_GATEWAY] = (struct sockaddr *)&null_sdl; link_init_sdl(ifp, (struct sockaddr *)&null_sdl, ifp->if_type); diff --git a/freebsd/sys/net/if_arc.h b/freebsd/sys/net/if_arc.h index b2444e72..8bed38b8 100644 --- a/freebsd/sys/net/if_arc.h +++ b/freebsd/sys/net/if_arc.h @@ -2,6 +2,8 @@ /* $FreeBSD$ */ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1982, 1986, 1993 * The Regents of the University of California. All rights reserved. * diff --git a/freebsd/sys/net/if_arcsubr.c b/freebsd/sys/net/if_arcsubr.c index c71dcb8e..171085ec 100644 --- a/freebsd/sys/net/if_arcsubr.c +++ b/freebsd/sys/net/if_arcsubr.c @@ -4,6 +4,8 @@ /* $FreeBSD$ */ /*- + * SPDX-License-Identifier: BSD-4-Clause + * * Copyright (c) 1994, 1995 Ignatios Souvatzis * Copyright (c) 1982, 1989, 1993 * The Regents of the University of California. All rights reserved. diff --git a/freebsd/sys/net/if_arp.h b/freebsd/sys/net/if_arp.h index 82448026..1a66c89c 100644 --- a/freebsd/sys/net/if_arp.h +++ b/freebsd/sys/net/if_arp.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1986, 1993 * The Regents of the University of California. All rights reserved. * diff --git a/freebsd/sys/net/if_bridge.c b/freebsd/sys/net/if_bridge.c index 3499f3db..d345c0f1 100644 --- a/freebsd/sys/net/if_bridge.c +++ b/freebsd/sys/net/if_bridge.c @@ -2,7 +2,9 @@ /* $NetBSD: if_bridge.c,v 1.31 2005/06/01 19:45:34 jdc Exp $ */ -/* +/*- + * SPDX-License-Identifier: BSD-4-Clause + * * Copyright 2001 Wasabi Systems, Inc. * All rights reserved. * diff --git a/freebsd/sys/net/if_bridgevar.h b/freebsd/sys/net/if_bridgevar.h index 480c90af..84ff8d21 100644 --- a/freebsd/sys/net/if_bridgevar.h +++ b/freebsd/sys/net/if_bridgevar.h @@ -1,6 +1,8 @@ /* $NetBSD: if_bridgevar.h,v 1.4 2003/07/08 07:13:50 itojun Exp $ */ /* + * SPDX-License-Identifier: BSD-4-Clause + * * Copyright 2001 Wasabi Systems, Inc. * All rights reserved. * diff --git a/freebsd/sys/net/if_clone.c b/freebsd/sys/net/if_clone.c index e7339423..99faa05f 100644 --- a/freebsd/sys/net/if_clone.c +++ b/freebsd/sys/net/if_clone.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 2012 Gleb Smirnoff <glebius@FreeBSD.org> * Copyright (c) 1980, 1986, 1993 * The Regents of the University of California. All rights reserved. @@ -597,39 +599,21 @@ ifc_name2unit(const char *name, int *unit) return (0); } -int -ifc_alloc_unit(struct if_clone *ifc, int *unit) +static int +ifc_alloc_unit_specific(struct if_clone *ifc, int *unit) { char name[IFNAMSIZ]; - int wildcard; - wildcard = (*unit < 0); -retry: if (*unit > ifc->ifc_maxunit) return (ENOSPC); - if (*unit < 0) { - *unit = alloc_unr(ifc->ifc_unrhdr); - if (*unit == -1) - return (ENOSPC); - } else { - *unit = alloc_unr_specific(ifc->ifc_unrhdr, *unit); - if (*unit == -1) { - if (wildcard) { - (*unit)++; - goto retry; - } else - return (EEXIST); - } - } + + if (alloc_unr_specific(ifc->ifc_unrhdr, *unit) == -1) + return (EEXIST); snprintf(name, IFNAMSIZ, "%s%d", ifc->ifc_name, *unit); if (ifunit(name) != NULL) { free_unr(ifc->ifc_unrhdr, *unit); - if (wildcard) { - (*unit)++; - goto retry; - } else - return (EEXIST); + return (EEXIST); } IF_CLONE_ADDREF(ifc); @@ -637,6 +621,36 @@ retry: return (0); } +static int +ifc_alloc_unit_next(struct if_clone *ifc, int *unit) +{ + int error; + + *unit = alloc_unr(ifc->ifc_unrhdr); + if (*unit == -1) + return (ENOSPC); + + free_unr(ifc->ifc_unrhdr, *unit); + for (;;) { + error = ifc_alloc_unit_specific(ifc, unit); + if (error != EEXIST) + break; + + (*unit)++; + } + + return (error); +} + +int +ifc_alloc_unit(struct if_clone *ifc, int *unit) +{ + if (*unit < 0) + return (ifc_alloc_unit_next(ifc, unit)); + else + return (ifc_alloc_unit_specific(ifc, unit)); +} + void ifc_free_unit(struct if_clone *ifc, int unit) { diff --git a/freebsd/sys/net/if_clone.h b/freebsd/sys/net/if_clone.h index d55aba20..f26ab63b 100644 --- a/freebsd/sys/net/if_clone.h +++ b/freebsd/sys/net/if_clone.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1982, 1986, 1989, 1993 * The Regents of the University of California. All rights reserved. * diff --git a/freebsd/sys/net/if_dead.c b/freebsd/sys/net/if_dead.c index 7626c604..552be13f 100644 --- a/freebsd/sys/net/if_dead.c +++ b/freebsd/sys/net/if_dead.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2009 Robert N. M. Watson * All rights reserved. * diff --git a/freebsd/sys/net/if_disc.c b/freebsd/sys/net/if_disc.c index 8daeee82..b3ff7ff8 100644 --- a/freebsd/sys/net/if_disc.c +++ b/freebsd/sys/net/if_disc.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1982, 1986, 1993 * The Regents of the University of California. All rights reserved. * diff --git a/freebsd/sys/net/if_dl.h b/freebsd/sys/net/if_dl.h index 5c4f273f..50767325 100644 --- a/freebsd/sys/net/if_dl.h +++ b/freebsd/sys/net/if_dl.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1990, 1993 * The Regents of the University of California. All rights reserved. * diff --git a/freebsd/sys/net/if_edsc.c b/freebsd/sys/net/if_edsc.c index 9a1398b2..6b5671c1 100644 --- a/freebsd/sys/net/if_edsc.c +++ b/freebsd/sys/net/if_edsc.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1982, 1986, 1993 * The Regents of the University of California. All rights reserved. * diff --git a/freebsd/sys/net/if_enc.c b/freebsd/sys/net/if_enc.c index 5fc53b5e..34022795 100644 --- a/freebsd/sys/net/if_enc.c +++ b/freebsd/sys/net/if_enc.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2006 The FreeBSD Project. * Copyright (c) 2015 Andrey V. Elsukov <ae@FreeBSD.org> * All rights reserved. diff --git a/freebsd/sys/net/if_enc.h b/freebsd/sys/net/if_enc.h index 616c621f..758fff0a 100644 --- a/freebsd/sys/net/if_enc.h +++ b/freebsd/sys/net/if_enc.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2008 The FreeBSD Project. * All rights reserved. * diff --git a/freebsd/sys/net/if_epair.c b/freebsd/sys/net/if_epair.c index 2e1911d7..106c0a43 100644 --- a/freebsd/sys/net/if_epair.c +++ b/freebsd/sys/net/if_epair.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2008 The FreeBSD Foundation * Copyright (c) 2009-2010 Bjoern A. Zeeb <bz@FreeBSD.org> * All rights reserved. @@ -982,6 +984,17 @@ vnet_epair_uninit(const void *unused __unused) VNET_SYSUNINIT(vnet_epair_uninit, SI_SUB_INIT_IF, SI_ORDER_ANY, vnet_epair_uninit, NULL); +static void +epair_uninit(const void *unused __unused) +{ + netisr_unregister(&epair_nh); + epair_dpcpu_detach(); + if (bootverbose) + printf("%s unloaded.\n", epairname); +} +SYSUNINIT(epair_uninit, SI_SUB_INIT_IF, SI_ORDER_MIDDLE, + epair_uninit, NULL); + static int epair_modevent(module_t mod, int type, void *data) { @@ -1001,10 +1014,7 @@ epair_modevent(module_t mod, int type, void *data) printf("%s initialized.\n", epairname); break; case MOD_UNLOAD: - netisr_unregister(&epair_nh); - epair_dpcpu_detach(); - if (bootverbose) - printf("%s unloaded.\n", epairname); + /* Handled in epair_uninit() */ break; default: return (EOPNOTSUPP); diff --git a/freebsd/sys/net/if_ethersubr.c b/freebsd/sys/net/if_ethersubr.c index c0064fc6..9b927511 100644 --- a/freebsd/sys/net/if_ethersubr.c +++ b/freebsd/sys/net/if_ethersubr.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1982, 1989, 1993 * The Regents of the University of California. All rights reserved. * diff --git a/freebsd/sys/net/if_fddisubr.c b/freebsd/sys/net/if_fddisubr.c index 5243f6cd..3c159a22 100644 --- a/freebsd/sys/net/if_fddisubr.c +++ b/freebsd/sys/net/if_fddisubr.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-4-Clause + * * Copyright (c) 1995, 1996 * Matt Thomas <matt@3am-software.com>. All rights reserved. * Copyright (c) 1982, 1989, 1993 diff --git a/freebsd/sys/net/if_fwsubr.c b/freebsd/sys/net/if_fwsubr.c index a31be7e1..f9552838 100644 --- a/freebsd/sys/net/if_fwsubr.c +++ b/freebsd/sys/net/if_fwsubr.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 2004 Doug Rabson * Copyright (c) 1982, 1989, 1993 * The Regents of the University of California. All rights reserved. diff --git a/freebsd/sys/net/if_gif.c b/freebsd/sys/net/if_gif.c index e5e6cb5e..fdbccbb6 100644 --- a/freebsd/sys/net/if_gif.c +++ b/freebsd/sys/net/if_gif.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. * All rights reserved. * diff --git a/freebsd/sys/net/if_gif.h b/freebsd/sys/net/if_gif.h index 28da85bd..556c2acc 100644 --- a/freebsd/sys/net/if_gif.h +++ b/freebsd/sys/net/if_gif.h @@ -2,6 +2,8 @@ /* $KAME: if_gif.h,v 1.17 2000/09/11 11:36:41 sumikawa Exp $ */ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. * All rights reserved. * diff --git a/freebsd/sys/net/if_gre.c b/freebsd/sys/net/if_gre.c index a2129eaa..dd9ba8f3 100644 --- a/freebsd/sys/net/if_gre.c +++ b/freebsd/sys/net/if_gre.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 1998 The NetBSD Foundation, Inc. * Copyright (c) 2014 Andrey V. Elsukov <ae@FreeBSD.org> * All rights reserved. diff --git a/freebsd/sys/net/if_gre.h b/freebsd/sys/net/if_gre.h index 8fb811cb..0eac9e9f 100644 --- a/freebsd/sys/net/if_gre.h +++ b/freebsd/sys/net/if_gre.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 1998 The NetBSD Foundation, Inc. * Copyright (c) 2014 Andrey V. Elsukov <ae@FreeBSD.org> * All rights reserved diff --git a/freebsd/sys/net/if_iso88025subr.c b/freebsd/sys/net/if_iso88025subr.c index 7dbce8d3..cba09bf5 100644 --- a/freebsd/sys/net/if_iso88025subr.c +++ b/freebsd/sys/net/if_iso88025subr.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 1998, Larry Lile * All rights reserved. * diff --git a/freebsd/sys/net/if_llatbl.c b/freebsd/sys/net/if_llatbl.c index c08218c6..d98153b9 100644 --- a/freebsd/sys/net/if_llatbl.c +++ b/freebsd/sys/net/if_llatbl.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> -/* +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2004 Luigi Rizzo, Alessandro Cerri. All rights reserved. * Copyright (c) 2004-2008 Qing Li. All rights reserved. * Copyright (c) 2008 Kip Macy. All rights reserved. diff --git a/freebsd/sys/net/if_llatbl.h b/freebsd/sys/net/if_llatbl.h index 5e89fea0..fcf93883 100644 --- a/freebsd/sys/net/if_llatbl.h +++ b/freebsd/sys/net/if_llatbl.h @@ -1,4 +1,6 @@ -/* +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2004 Luigi Rizzo, Alessandro Cerri. All rights reserved. * Copyright (c) 2004-2008 Qing Li. All rights reserved. * Copyright (c) 2008 Kip Macy. All rights reserved. diff --git a/freebsd/sys/net/if_llc.h b/freebsd/sys/net/if_llc.h index 7a959b9c..b1bd7686 100644 --- a/freebsd/sys/net/if_llc.h +++ b/freebsd/sys/net/if_llc.h @@ -1,6 +1,8 @@ /* $NetBSD: if_llc.h,v 1.12 1999/11/19 20:41:19 thorpej Exp $ */ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1988, 1993 * The Regents of the University of California. All rights reserved. * diff --git a/freebsd/sys/net/if_loop.c b/freebsd/sys/net/if_loop.c index fd290b2d..bae46891 100644 --- a/freebsd/sys/net/if_loop.c +++ b/freebsd/sys/net/if_loop.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1982, 1986, 1993 * The Regents of the University of California. All rights reserved. * diff --git a/freebsd/sys/net/if_media.c b/freebsd/sys/net/if_media.c index 4e39f656..cceb0079 100644 --- a/freebsd/sys/net/if_media.c +++ b/freebsd/sys/net/if_media.c @@ -4,6 +4,8 @@ /* $FreeBSD$ */ /*- + * SPDX-License-Identifier: BSD-4-Clause + * * Copyright (c) 1997 * Jonathan Stone and Jason R. Thorpe. All rights reserved. * diff --git a/freebsd/sys/net/if_media.h b/freebsd/sys/net/if_media.h index d1080dd6..13621a10 100644 --- a/freebsd/sys/net/if_media.h +++ b/freebsd/sys/net/if_media.h @@ -2,6 +2,8 @@ /* $FreeBSD$ */ /*- + * SPDX-License-Identifier: BSD-4-Clause + * * Copyright (c) 1997 * Jonathan Stone and Jason R. Thorpe. All rights reserved. * diff --git a/freebsd/sys/net/if_pflog.h b/freebsd/sys/net/if_pflog.h index 0faeb7d4..5ed341a8 100644 --- a/freebsd/sys/net/if_pflog.h +++ b/freebsd/sys/net/if_pflog.h @@ -1,5 +1,7 @@ /* $OpenBSD: if_pflog.h,v 1.13 2006/10/23 12:46:09 henning Exp $ */ -/* +/*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright 2001 Niels Provos <provos@citi.umich.edu> * All rights reserved. * @@ -22,6 +24,8 @@ * 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 _NET_IF_PFLOG_H_ diff --git a/freebsd/sys/net/if_pfsync.h b/freebsd/sys/net/if_pfsync.h index 5c4ba631..3715fdb5 100644 --- a/freebsd/sys/net/if_pfsync.h +++ b/freebsd/sys/net/if_pfsync.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2001 Michael Shalayeff * All rights reserved. * diff --git a/freebsd/sys/net/if_stf.c b/freebsd/sys/net/if_stf.c index b29c5f93..2aab358c 100644 --- a/freebsd/sys/net/if_stf.c +++ b/freebsd/sys/net/if_stf.c @@ -4,6 +4,8 @@ /* $KAME: if_stf.c,v 1.73 2001/12/03 11:08:30 keiichi Exp $ */ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (C) 2000 WIDE Project. * All rights reserved. * diff --git a/freebsd/sys/net/if_tap.c b/freebsd/sys/net/if_tap.c index ca499606..ce143f9f 100644 --- a/freebsd/sys/net/if_tap.c +++ b/freebsd/sys/net/if_tap.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (C) 1999-2000 by Maksim Yevmenkin <m_evmenkin@yahoo.com> * All rights reserved. * @@ -741,9 +743,10 @@ tapioctl(struct cdev *dev, u_long cmd, caddr_t data, int flag, struct thread *td switch (cmd) { case TAPSIFINFO: tapp = (struct tapinfo *)data; + if (ifp->if_type != tapp->type) + return (EPROTOTYPE); mtx_lock(&tp->tap_mtx); ifp->if_mtu = tapp->mtu; - ifp->if_type = tapp->type; ifp->if_baudrate = tapp->baudrate; mtx_unlock(&tp->tap_mtx); break; diff --git a/freebsd/sys/net/if_tap.h b/freebsd/sys/net/if_tap.h index 91feb2fe..34f44b38 100644 --- a/freebsd/sys/net/if_tap.h +++ b/freebsd/sys/net/if_tap.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (C) 1999-2000 by Maksim Yevmenkin <m_evmenkin@yahoo.com> * All rights reserved. * diff --git a/freebsd/sys/net/if_tapvar.h b/freebsd/sys/net/if_tapvar.h index 21bac505..f5cf9f3e 100644 --- a/freebsd/sys/net/if_tapvar.h +++ b/freebsd/sys/net/if_tapvar.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (C) 1999-2000 by Maksim Yevmenkin <m_evmenkin@yahoo.com> * All rights reserved. * diff --git a/freebsd/sys/net/if_tun.c b/freebsd/sys/net/if_tun.c index dc742b8f..598a5c14 100644 --- a/freebsd/sys/net/if_tun.c +++ b/freebsd/sys/net/if_tun.c @@ -686,9 +686,10 @@ tunioctl(struct cdev *dev, u_long cmd, caddr_t data, int flag, if (error) return (error); } + if (TUN2IFP(tp)->if_type != tunp->type) + return (EPROTOTYPE); mtx_lock(&tp->tun_mtx); TUN2IFP(tp)->if_mtu = tunp->mtu; - TUN2IFP(tp)->if_type = tunp->type; TUN2IFP(tp)->if_baudrate = tunp->baudrate; mtx_unlock(&tp->tun_mtx); break; diff --git a/freebsd/sys/net/if_types.h b/freebsd/sys/net/if_types.h index b9a752df..61c432ba 100644 --- a/freebsd/sys/net/if_types.h +++ b/freebsd/sys/net/if_types.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1989, 1993, 1994 * The Regents of the University of California. All rights reserved. * diff --git a/freebsd/sys/net/if_var.h b/freebsd/sys/net/if_var.h index c2de24a7..e22beea7 100644 --- a/freebsd/sys/net/if_var.h +++ b/freebsd/sys/net/if_var.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1982, 1986, 1989, 1993 * The Regents of the University of California. All rights reserved. * diff --git a/freebsd/sys/net/if_vlan_var.h b/freebsd/sys/net/if_vlan_var.h index 6b20d142..d27e5104 100644 --- a/freebsd/sys/net/if_vlan_var.h +++ b/freebsd/sys/net/if_vlan_var.h @@ -143,16 +143,16 @@ struct vlanreq { } while (0) #define VLAN_TRUNKDEV(_ifp) \ - (_ifp)->if_type == IFT_L2VLAN ? (*vlan_trunkdev_p)((_ifp)) : NULL + ((_ifp)->if_type == IFT_L2VLAN ? (*vlan_trunkdev_p)((_ifp)) : NULL) #define VLAN_TAG(_ifp, _vid) \ - (_ifp)->if_type == IFT_L2VLAN ? (*vlan_tag_p)((_ifp), (_vid)) : EINVAL + ((_ifp)->if_type == IFT_L2VLAN ? (*vlan_tag_p)((_ifp), (_vid)) : EINVAL) #define VLAN_COOKIE(_ifp) \ - (_ifp)->if_type == IFT_L2VLAN ? (*vlan_cookie_p)((_ifp)) : NULL + ((_ifp)->if_type == IFT_L2VLAN ? (*vlan_cookie_p)((_ifp)) : NULL) #define VLAN_SETCOOKIE(_ifp, _cookie) \ - (_ifp)->if_type == IFT_L2VLAN ? \ - (*vlan_setcookie_p)((_ifp), (_cookie)) : EINVAL + ((_ifp)->if_type == IFT_L2VLAN ? \ + (*vlan_setcookie_p)((_ifp), (_cookie)) : EINVAL) #define VLAN_DEVAT(_ifp, _vid) \ - (_ifp)->if_vlantrunk != NULL ? (*vlan_devat_p)((_ifp), (_vid)) : NULL + ((_ifp)->if_vlantrunk != NULL ? (*vlan_devat_p)((_ifp), (_vid)) : NULL) extern void (*vlan_trunk_cap_p)(struct ifnet *); extern struct ifnet *(*vlan_trunkdev_p)(struct ifnet *); diff --git a/freebsd/sys/net/iflib.h b/freebsd/sys/net/iflib.h index 7249686b..70992fdd 100644 --- a/freebsd/sys/net/iflib.h +++ b/freebsd/sys/net/iflib.h @@ -361,7 +361,7 @@ int iflib_irq_alloc(if_ctx_t, if_irq_t, int, driver_filter_t, void *filter_arg, int iflib_irq_alloc_generic(if_ctx_t ctx, if_irq_t irq, int rid, iflib_intr_type_t type, driver_filter_t *filter, void *filter_arg, int qid, char *name); -void iflib_softirq_alloc_generic(if_ctx_t ctx, int rid, iflib_intr_type_t type, void *arg, int qid, char *name); +void iflib_softirq_alloc_generic(if_ctx_t ctx, if_irq_t irq, iflib_intr_type_t type, void *arg, int qid, char *name); void iflib_irq_free(if_ctx_t ctx, if_irq_t irq); diff --git a/freebsd/sys/net/ifq.h b/freebsd/sys/net/ifq.h index 3969c6a0..bffb80c3 100644 --- a/freebsd/sys/net/ifq.h +++ b/freebsd/sys/net/ifq.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1982, 1986, 1989, 1993 * The Regents of the University of California. All rights reserved. * diff --git a/freebsd/sys/net/iso88025.h b/freebsd/sys/net/iso88025.h index 11bd6ec4..78b2737f 100644 --- a/freebsd/sys/net/iso88025.h +++ b/freebsd/sys/net/iso88025.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 1998, Larry Lile * All rights reserved. * diff --git a/freebsd/sys/net/netisr.c b/freebsd/sys/net/netisr.c index 5dffbfdc..8f2430eb 100644 --- a/freebsd/sys/net/netisr.c +++ b/freebsd/sys/net/netisr.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2007-2009 Robert N. M. Watson * Copyright (c) 2010-2011 Juniper Networks, Inc. * All rights reserved. diff --git a/freebsd/sys/net/netisr.h b/freebsd/sys/net/netisr.h index b0e8e5ab..32d2aa83 100644 --- a/freebsd/sys/net/netisr.h +++ b/freebsd/sys/net/netisr.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2007-2009 Robert N. M. Watson * Copyright (c) 2010-2011 Juniper Networks, Inc. * All rights reserved. diff --git a/freebsd/sys/net/netisr_internal.h b/freebsd/sys/net/netisr_internal.h index ac3ed0f2..af486075 100644 --- a/freebsd/sys/net/netisr_internal.h +++ b/freebsd/sys/net/netisr_internal.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2007-2009 Robert N. M. Watson * Copyright (c) 2010-2011 Juniper Networks, Inc. * All rights reserved. diff --git a/freebsd/sys/net/pfil.c b/freebsd/sys/net/pfil.c index 3c7984c7..e29cd5e7 100644 --- a/freebsd/sys/net/pfil.c +++ b/freebsd/sys/net/pfil.c @@ -4,6 +4,8 @@ /* $NetBSD: pfil.c,v 1.20 2001/11/12 23:49:46 lukem Exp $ */ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1996 Matthew R. Green * All rights reserved. * diff --git a/freebsd/sys/net/pfil.h b/freebsd/sys/net/pfil.h index 64d7cf62..2243ad83 100644 --- a/freebsd/sys/net/pfil.h +++ b/freebsd/sys/net/pfil.h @@ -2,6 +2,8 @@ /* $NetBSD: pfil.h,v 1.22 2003/06/23 12:57:08 martin Exp $ */ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1996 Matthew R. Green * All rights reserved. * diff --git a/freebsd/sys/net/pfkeyv2.h b/freebsd/sys/net/pfkeyv2.h index c2cf568f..7bbdd577 100644 --- a/freebsd/sys/net/pfkeyv2.h +++ b/freebsd/sys/net/pfkeyv2.h @@ -2,6 +2,8 @@ /* $KAME: pfkeyv2.h,v 1.37 2003/09/06 05:15:43 itojun Exp $ */ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. * All rights reserved. * diff --git a/freebsd/sys/net/pfvar.h b/freebsd/sys/net/pfvar.h index c5e8567f..4bc84d94 100644 --- a/freebsd/sys/net/pfvar.h +++ b/freebsd/sys/net/pfvar.h @@ -1,4 +1,6 @@ -/* +/*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2001 Daniel Hartmeier * All rights reserved. * diff --git a/freebsd/sys/net/radix.c b/freebsd/sys/net/radix.c index 6bca1a1f..bbfd5f65 100644 --- a/freebsd/sys/net/radix.c +++ b/freebsd/sys/net/radix.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1988, 1989, 1993 * The Regents of the University of California. All rights reserved. * diff --git a/freebsd/sys/net/radix.h b/freebsd/sys/net/radix.h index f9c55164..05f0f490 100644 --- a/freebsd/sys/net/radix.h +++ b/freebsd/sys/net/radix.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1988, 1989, 1993 * The Regents of the University of California. All rights reserved. * diff --git a/freebsd/sys/net/radix_mpath.c b/freebsd/sys/net/radix_mpath.c index cb61fa56..7eccd8f1 100644 --- a/freebsd/sys/net/radix_mpath.c +++ b/freebsd/sys/net/radix_mpath.c @@ -3,6 +3,8 @@ /* $KAME: radix_mpath.c,v 1.17 2004/11/08 10:29:39 itojun Exp $ */ /* + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (C) 2001 WIDE Project. * All rights reserved. * diff --git a/freebsd/sys/net/radix_mpath.h b/freebsd/sys/net/radix_mpath.h index 2b0d442e..bb6a9087 100644 --- a/freebsd/sys/net/radix_mpath.h +++ b/freebsd/sys/net/radix_mpath.h @@ -1,6 +1,8 @@ /* $KAME: radix_mpath.h,v 1.10 2004/11/06 15:44:28 itojun Exp $ */ /* + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (C) 2001 WIDE Project. * All rights reserved. * diff --git a/freebsd/sys/net/raw_cb.c b/freebsd/sys/net/raw_cb.c index dd893440..0c441e8c 100644 --- a/freebsd/sys/net/raw_cb.c +++ b/freebsd/sys/net/raw_cb.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1980, 1986, 1993 * The Regents of the University of California. * All rights reserved. diff --git a/freebsd/sys/net/raw_cb.h b/freebsd/sys/net/raw_cb.h index c2d002e6..bd5e08fc 100644 --- a/freebsd/sys/net/raw_cb.h +++ b/freebsd/sys/net/raw_cb.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1980, 1986, 1993 * The Regents of the University of California. * All rights reserved. diff --git a/freebsd/sys/net/raw_usrreq.c b/freebsd/sys/net/raw_usrreq.c index ff89cf5f..e8ad50cb 100644 --- a/freebsd/sys/net/raw_usrreq.c +++ b/freebsd/sys/net/raw_usrreq.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1980, 1986, 1993 * The Regents of the University of California. * All rights reserved. @@ -227,9 +229,10 @@ raw_usend(struct socket *so, int flags, struct mbuf *m, struct sockaddr *nam, KASSERT(sotorawcb(so) != NULL, ("raw_usend: rp == NULL")); if ((flags & PRUS_OOB) || (control && control->m_len)) { - /* XXXRW: Should control also be freed here? */ if (m != NULL) m_freem(m); + if (control != NULL) + m_freem(control); return (EOPNOTSUPP); } diff --git a/freebsd/sys/net/route.c b/freebsd/sys/net/route.c index a6a19cb0..1be39753 100644 --- a/freebsd/sys/net/route.c +++ b/freebsd/sys/net/route.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1980, 1986, 1991, 1993 * The Regents of the University of California. All rights reserved. * diff --git a/freebsd/sys/net/route.h b/freebsd/sys/net/route.h index ae052f19..8835433e 100644 --- a/freebsd/sys/net/route.h +++ b/freebsd/sys/net/route.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1980, 1986, 1993 * The Regents of the University of California. All rights reserved. * diff --git a/freebsd/sys/net/rss_config.h b/freebsd/sys/net/rss_config.h index 2ab32a43..202dbef5 100644 --- a/freebsd/sys/net/rss_config.h +++ b/freebsd/sys/net/rss_config.h @@ -66,7 +66,6 @@ #define RSS_HASHTYPE_RSS_IPV6_EX (1 << 5) /* IPv6 2-tuple + ext hdrs */ #define RSS_HASHTYPE_RSS_TCP_IPV6_EX (1 << 6) /* TCPv6 4-tiple + ext hdrs */ #define RSS_HASHTYPE_RSS_UDP_IPV4 (1 << 7) /* IPv4 UDP 4-tuple */ -#define RSS_HASHTYPE_RSS_UDP_IPV4_EX (1 << 8) /* IPv4 UDP 4-tuple + ext hdrs */ #define RSS_HASHTYPE_RSS_UDP_IPV6 (1 << 9) /* IPv6 UDP 4-tuple */ #define RSS_HASHTYPE_RSS_UDP_IPV6_EX (1 << 10) /* IPv6 UDP 4-tuple + ext hdrs */ diff --git a/freebsd/sys/net/rtsock.c b/freebsd/sys/net/rtsock.c index 1f527cd3..fe608d70 100644 --- a/freebsd/sys/net/rtsock.c +++ b/freebsd/sys/net/rtsock.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1988, 1991, 1993 * The Regents of the University of California. All rights reserved. * diff --git a/freebsd/sys/net/sff8472.h b/freebsd/sys/net/sff8472.h index 5c50ea46..e67aa7f6 100644 --- a/freebsd/sys/net/sff8472.h +++ b/freebsd/sys/net/sff8472.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2013 George V. Neville-Neil * All rights reserved. * diff --git a/freebsd/sys/net/slcompress.c b/freebsd/sys/net/slcompress.c index 7ad705fe..7d03497e 100644 --- a/freebsd/sys/net/slcompress.c +++ b/freebsd/sys/net/slcompress.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1989, 1993, 1994 * The Regents of the University of California. All rights reserved. * diff --git a/freebsd/sys/net/slcompress.h b/freebsd/sys/net/slcompress.h index bd53c081..47526931 100644 --- a/freebsd/sys/net/slcompress.h +++ b/freebsd/sys/net/slcompress.h @@ -2,6 +2,8 @@ * Definitions for tcp compression routines. */ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1989, 1993 * The Regents of the University of California. All rights reserved. * diff --git a/freebsd/sys/net/vnet.h b/freebsd/sys/net/vnet.h index 4985d4bd..0ec00aad 100644 --- a/freebsd/sys/net/vnet.h +++ b/freebsd/sys/net/vnet.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2006-2009 University of Zagreb * Copyright (c) 2006-2009 FreeBSD Foundation * All rights reserved. diff --git a/freebsd/sys/net80211/_ieee80211.h b/freebsd/sys/net80211/_ieee80211.h index 9434f3a6..354362fc 100644 --- a/freebsd/sys/net80211/_ieee80211.h +++ b/freebsd/sys/net80211/_ieee80211.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2001 Atsushi Onoe * Copyright (c) 2002-2008 Sam Leffler, Errno Consulting * All rights reserved. diff --git a/freebsd/sys/net80211/ieee80211.c b/freebsd/sys/net80211/ieee80211.c index bf6aa8dc..d914c2e4 100644 --- a/freebsd/sys/net80211/ieee80211.c +++ b/freebsd/sys/net80211/ieee80211.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2001 Atsushi Onoe * Copyright (c) 2002-2009 Sam Leffler, Errno Consulting * All rights reserved. diff --git a/freebsd/sys/net80211/ieee80211.h b/freebsd/sys/net80211/ieee80211.h index 9fef8c44..db46b8f1 100644 --- a/freebsd/sys/net80211/ieee80211.h +++ b/freebsd/sys/net80211/ieee80211.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2001 Atsushi Onoe * Copyright (c) 2002-2009 Sam Leffler, Errno Consulting * All rights reserved. diff --git a/freebsd/sys/net80211/ieee80211_acl.c b/freebsd/sys/net80211/ieee80211_acl.c index 703769b7..d1844b46 100644 --- a/freebsd/sys/net80211/ieee80211_acl.c +++ b/freebsd/sys/net80211/ieee80211_acl.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2004-2008 Sam Leffler, Errno Consulting * All rights reserved. * diff --git a/freebsd/sys/net80211/ieee80211_action.c b/freebsd/sys/net80211/ieee80211_action.c index 7fb26dff..8c5b8e41 100644 --- a/freebsd/sys/net80211/ieee80211_action.c +++ b/freebsd/sys/net80211/ieee80211_action.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2009 Sam Leffler, Errno Consulting * All rights reserved. * diff --git a/freebsd/sys/net80211/ieee80211_action.h b/freebsd/sys/net80211/ieee80211_action.h index 4ee2aff4..71d2e778 100644 --- a/freebsd/sys/net80211/ieee80211_action.h +++ b/freebsd/sys/net80211/ieee80211_action.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2009 Sam Leffler, Errno Consulting * All rights reserved. * diff --git a/freebsd/sys/net80211/ieee80211_adhoc.c b/freebsd/sys/net80211/ieee80211_adhoc.c index 9372226e..fdd02e46 100644 --- a/freebsd/sys/net80211/ieee80211_adhoc.c +++ b/freebsd/sys/net80211/ieee80211_adhoc.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2007-2009 Sam Leffler, Errno Consulting * All rights reserved. * diff --git a/freebsd/sys/net80211/ieee80211_adhoc.h b/freebsd/sys/net80211/ieee80211_adhoc.h index d8e19e5e..fa5d168d 100644 --- a/freebsd/sys/net80211/ieee80211_adhoc.h +++ b/freebsd/sys/net80211/ieee80211_adhoc.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2007-2008 Sam Leffler, Errno Consulting * All rights reserved. * diff --git a/freebsd/sys/net80211/ieee80211_ageq.c b/freebsd/sys/net80211/ieee80211_ageq.c index e161208c..c87ae2da 100644 --- a/freebsd/sys/net80211/ieee80211_ageq.c +++ b/freebsd/sys/net80211/ieee80211_ageq.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2009 Sam Leffler, Errno Consulting * All rights reserved. * diff --git a/freebsd/sys/net80211/ieee80211_ageq.h b/freebsd/sys/net80211/ieee80211_ageq.h index fdcf071a..81bd17b6 100644 --- a/freebsd/sys/net80211/ieee80211_ageq.h +++ b/freebsd/sys/net80211/ieee80211_ageq.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2009 Sam Leffler, Errno Consulting * All rights reserved. * diff --git a/freebsd/sys/net80211/ieee80211_alq.h b/freebsd/sys/net80211/ieee80211_alq.h index 7537e933..d57e6e9b 100644 --- a/freebsd/sys/net80211/ieee80211_alq.h +++ b/freebsd/sys/net80211/ieee80211_alq.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2011 Adrian Chadd, Xenion Lty Ltd * All rights reserved. * diff --git a/freebsd/sys/net80211/ieee80211_crypto.c b/freebsd/sys/net80211/ieee80211_crypto.c index 077e44f7..2e28538c 100644 --- a/freebsd/sys/net80211/ieee80211_crypto.c +++ b/freebsd/sys/net80211/ieee80211_crypto.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2001 Atsushi Onoe * Copyright (c) 2002-2008 Sam Leffler, Errno Consulting * All rights reserved. diff --git a/freebsd/sys/net80211/ieee80211_crypto.h b/freebsd/sys/net80211/ieee80211_crypto.h index 3cbceec3..b732fe80 100644 --- a/freebsd/sys/net80211/ieee80211_crypto.h +++ b/freebsd/sys/net80211/ieee80211_crypto.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2001 Atsushi Onoe * Copyright (c) 2002-2008 Sam Leffler, Errno Consulting * All rights reserved. diff --git a/freebsd/sys/net80211/ieee80211_crypto_ccmp.c b/freebsd/sys/net80211/ieee80211_crypto_ccmp.c index 017b5381..87836b22 100644 --- a/freebsd/sys/net80211/ieee80211_crypto_ccmp.c +++ b/freebsd/sys/net80211/ieee80211_crypto_ccmp.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2002-2008 Sam Leffler, Errno Consulting * All rights reserved. * diff --git a/freebsd/sys/net80211/ieee80211_crypto_none.c b/freebsd/sys/net80211/ieee80211_crypto_none.c index 67815393..6f4d9b82 100644 --- a/freebsd/sys/net80211/ieee80211_crypto_none.c +++ b/freebsd/sys/net80211/ieee80211_crypto_none.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2002-2008 Sam Leffler, Errno Consulting * All rights reserved. * diff --git a/freebsd/sys/net80211/ieee80211_crypto_tkip.c b/freebsd/sys/net80211/ieee80211_crypto_tkip.c index bf21056b..37cc0fe6 100644 --- a/freebsd/sys/net80211/ieee80211_crypto_tkip.c +++ b/freebsd/sys/net80211/ieee80211_crypto_tkip.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2002-2008 Sam Leffler, Errno Consulting * All rights reserved. * diff --git a/freebsd/sys/net80211/ieee80211_crypto_wep.c b/freebsd/sys/net80211/ieee80211_crypto_wep.c index 8931436f..a091356a 100644 --- a/freebsd/sys/net80211/ieee80211_crypto_wep.c +++ b/freebsd/sys/net80211/ieee80211_crypto_wep.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2002-2008 Sam Leffler, Errno Consulting * All rights reserved. * diff --git a/freebsd/sys/net80211/ieee80211_ddb.c b/freebsd/sys/net80211/ieee80211_ddb.c index c942c06d..5f676bb9 100644 --- a/freebsd/sys/net80211/ieee80211_ddb.c +++ b/freebsd/sys/net80211/ieee80211_ddb.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2007-2009 Sam Leffler, Errno Consulting * All rights reserved. * diff --git a/freebsd/sys/net80211/ieee80211_dfs.c b/freebsd/sys/net80211/ieee80211_dfs.c index bb1efcb4..2c454516 100644 --- a/freebsd/sys/net80211/ieee80211_dfs.c +++ b/freebsd/sys/net80211/ieee80211_dfs.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2007-2008 Sam Leffler, Errno Consulting * All rights reserved. * diff --git a/freebsd/sys/net80211/ieee80211_dfs.h b/freebsd/sys/net80211/ieee80211_dfs.h index a5688e3b..4bf580d7 100644 --- a/freebsd/sys/net80211/ieee80211_dfs.h +++ b/freebsd/sys/net80211/ieee80211_dfs.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2007-2008 Sam Leffler, Errno Consulting * All rights reserved. * diff --git a/freebsd/sys/net80211/ieee80211_freebsd.c b/freebsd/sys/net80211/ieee80211_freebsd.c index e811955e..00430f77 100644 --- a/freebsd/sys/net80211/ieee80211_freebsd.c +++ b/freebsd/sys/net80211/ieee80211_freebsd.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2003-2009 Sam Leffler, Errno Consulting * All rights reserved. * diff --git a/freebsd/sys/net80211/ieee80211_freebsd.h b/freebsd/sys/net80211/ieee80211_freebsd.h index 2a0b7396..8395eb00 100644 --- a/freebsd/sys/net80211/ieee80211_freebsd.h +++ b/freebsd/sys/net80211/ieee80211_freebsd.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2003-2008 Sam Leffler, Errno Consulting * All rights reserved. * diff --git a/freebsd/sys/net80211/ieee80211_hostap.c b/freebsd/sys/net80211/ieee80211_hostap.c index 8fd4270a..0cc43748 100644 --- a/freebsd/sys/net80211/ieee80211_hostap.c +++ b/freebsd/sys/net80211/ieee80211_hostap.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2007-2008 Sam Leffler, Errno Consulting * All rights reserved. * diff --git a/freebsd/sys/net80211/ieee80211_hostap.h b/freebsd/sys/net80211/ieee80211_hostap.h index e08c4a04..d3342eee 100644 --- a/freebsd/sys/net80211/ieee80211_hostap.h +++ b/freebsd/sys/net80211/ieee80211_hostap.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2007-2008 Sam Leffler, Errno Consulting * All rights reserved. * diff --git a/freebsd/sys/net80211/ieee80211_ht.c b/freebsd/sys/net80211/ieee80211_ht.c index 77e254e6..21d85fb3 100644 --- a/freebsd/sys/net80211/ieee80211_ht.c +++ b/freebsd/sys/net80211/ieee80211_ht.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2007-2008 Sam Leffler, Errno Consulting * All rights reserved. * diff --git a/freebsd/sys/net80211/ieee80211_ht.h b/freebsd/sys/net80211/ieee80211_ht.h index b85e1c9a..4e02cd32 100644 --- a/freebsd/sys/net80211/ieee80211_ht.h +++ b/freebsd/sys/net80211/ieee80211_ht.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2007-2008 Sam Leffler, Errno Consulting * All rights reserved. * diff --git a/freebsd/sys/net80211/ieee80211_hwmp.c b/freebsd/sys/net80211/ieee80211_hwmp.c index 62c27e29..37beae83 100644 --- a/freebsd/sys/net80211/ieee80211_hwmp.c +++ b/freebsd/sys/net80211/ieee80211_hwmp.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2009 The FreeBSD Foundation * All rights reserved. * diff --git a/freebsd/sys/net80211/ieee80211_input.c b/freebsd/sys/net80211/ieee80211_input.c index 27f979e8..0afad260 100644 --- a/freebsd/sys/net80211/ieee80211_input.c +++ b/freebsd/sys/net80211/ieee80211_input.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2001 Atsushi Onoe * Copyright (c) 2002-2009 Sam Leffler, Errno Consulting * All rights reserved. diff --git a/freebsd/sys/net80211/ieee80211_input.h b/freebsd/sys/net80211/ieee80211_input.h index cff07c68..2f3afc3b 100644 --- a/freebsd/sys/net80211/ieee80211_input.h +++ b/freebsd/sys/net80211/ieee80211_input.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2007-2009 Sam Leffler, Errno Consulting * All rights reserved. * @@ -131,6 +133,38 @@ ishtinfooui(const uint8_t *frm) return frm[1] > 3 && le32dec(frm+2) == ((BCM_OUI_HTINFO<<24)|BCM_OUI); } +static __inline int +ieee80211_check_rxseq_amsdu(const struct ieee80211_rx_stats *rxs) +{ + + return (!! (rxs->c_pktflags & IEEE80211_RX_F_AMSDU)); +} + +/* + * Return 1 if the rxseq check should increment the sequence + * number. Return 0 if it's part of an AMSDU batch and it isn't + * the final frame in the decap'ed burst. + */ +static __inline int +ieee80211_check_rxseq_amsdu_more(const struct ieee80211_rx_stats *rxs) +{ + /* No state? ok */ + if (rxs == NULL) + return (1); + + /* State but no AMSDU set? ok */ + if ((rxs->c_pktflags & IEEE80211_RX_F_AMSDU) == 0) + return (1); + + /* State, AMSDU set, then _MORE means "don't inc yet" */ + if (rxs->c_pktflags & IEEE80211_RX_F_AMSDU_MORE) { + return (0); + } + + /* Both are set, so return ok */ + return (1); +} + /* * Check the current frame sequence number against the current TID * state and return whether it's in sequence or should be dropped. @@ -238,7 +272,20 @@ ieee80211_check_rxseq(struct ieee80211_node *ni, struct ieee80211_frame *wh, goto fail; ok: - ni->ni_rxseqs[tid] = rxseq; + /* + * Only bump the sequence number if it's the last frame + * in a batch. That way frames in the rest of the batch + * get included, and the last frame in the batch kicks + * it next. + */ + if (ieee80211_check_rxseq_amsdu_more(rxs)) { + ni->ni_rxseqs[tid] = rxseq; + if ((rxs != NULL) && ieee80211_check_rxseq_amsdu(rxs)) + IEEE80211_NODE_STAT(ni, rx_amsdu_more_end); + } else { + /* .. still waiting */ + IEEE80211_NODE_STAT(ni, rx_amsdu_more); + } return 1; diff --git a/freebsd/sys/net80211/ieee80211_ioctl.c b/freebsd/sys/net80211/ieee80211_ioctl.c index 68a0f9ae..c5f6721d 100644 --- a/freebsd/sys/net80211/ieee80211_ioctl.c +++ b/freebsd/sys/net80211/ieee80211_ioctl.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2001 Atsushi Onoe * Copyright (c) 2002-2009 Sam Leffler, Errno Consulting * All rights reserved. diff --git a/freebsd/sys/net80211/ieee80211_ioctl.h b/freebsd/sys/net80211/ieee80211_ioctl.h index 7d472bc6..5021285b 100644 --- a/freebsd/sys/net80211/ieee80211_ioctl.h +++ b/freebsd/sys/net80211/ieee80211_ioctl.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2001 Atsushi Onoe * Copyright (c) 2002-2009 Sam Leffler, Errno Consulting * All rights reserved. @@ -84,7 +86,11 @@ struct ieee80211_nodestats { uint32_t ns_tx_deauth_code; /* last deauth reason */ uint32_t ns_tx_disassoc; /* disassociations */ uint32_t ns_tx_disassoc_code; /* last disassociation reason */ - uint32_t ns_spare[8]; + + /* Hardware A-MSDU decode */ + uint32_t ns_rx_amsdu_more; /* RX decap A-MSDU, more coming from A-MSDU */ + uint32_t ns_rx_amsdu_more_end; /* RX decap A-MSDU (or any other frame), no more coming */ + uint32_t ns_spare[6]; }; /* diff --git a/freebsd/sys/net80211/ieee80211_mesh.c b/freebsd/sys/net80211/ieee80211_mesh.c index df2865f4..f747c214 100644 --- a/freebsd/sys/net80211/ieee80211_mesh.c +++ b/freebsd/sys/net80211/ieee80211_mesh.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2009 The FreeBSD Foundation * All rights reserved. * diff --git a/freebsd/sys/net80211/ieee80211_mesh.h b/freebsd/sys/net80211/ieee80211_mesh.h index 2253af00..89423bd8 100644 --- a/freebsd/sys/net80211/ieee80211_mesh.h +++ b/freebsd/sys/net80211/ieee80211_mesh.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2009 The FreeBSD Foundation * All rights reserved. * diff --git a/freebsd/sys/net80211/ieee80211_monitor.c b/freebsd/sys/net80211/ieee80211_monitor.c index 11559985..0c07ed7c 100644 --- a/freebsd/sys/net80211/ieee80211_monitor.c +++ b/freebsd/sys/net80211/ieee80211_monitor.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2007-2008 Sam Leffler, Errno Consulting * All rights reserved. * diff --git a/freebsd/sys/net80211/ieee80211_monitor.h b/freebsd/sys/net80211/ieee80211_monitor.h index d7dd8e98..0a64d0be 100644 --- a/freebsd/sys/net80211/ieee80211_monitor.h +++ b/freebsd/sys/net80211/ieee80211_monitor.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2007-2008 Sam Leffler, Errno Consulting * All rights reserved. * diff --git a/freebsd/sys/net80211/ieee80211_node.c b/freebsd/sys/net80211/ieee80211_node.c index d5eec26a..023fb128 100644 --- a/freebsd/sys/net80211/ieee80211_node.c +++ b/freebsd/sys/net80211/ieee80211_node.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2001 Atsushi Onoe * Copyright (c) 2002-2009 Sam Leffler, Errno Consulting * All rights reserved. diff --git a/freebsd/sys/net80211/ieee80211_node.h b/freebsd/sys/net80211/ieee80211_node.h index 26c05567..3e21cdda 100644 --- a/freebsd/sys/net80211/ieee80211_node.h +++ b/freebsd/sys/net80211/ieee80211_node.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2001 Atsushi Onoe * Copyright (c) 2002-2009 Sam Leffler, Errno Consulting * All rights reserved. diff --git a/freebsd/sys/net80211/ieee80211_output.c b/freebsd/sys/net80211/ieee80211_output.c index 93b4dc46..51a75af2 100644 --- a/freebsd/sys/net80211/ieee80211_output.c +++ b/freebsd/sys/net80211/ieee80211_output.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2001 Atsushi Onoe * Copyright (c) 2002-2009 Sam Leffler, Errno Consulting * All rights reserved. diff --git a/freebsd/sys/net80211/ieee80211_phy.c b/freebsd/sys/net80211/ieee80211_phy.c index 1558257e..8088ec4c 100644 --- a/freebsd/sys/net80211/ieee80211_phy.c +++ b/freebsd/sys/net80211/ieee80211_phy.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2007-2008 Sam Leffler, Errno Consulting * All rights reserved. * diff --git a/freebsd/sys/net80211/ieee80211_phy.h b/freebsd/sys/net80211/ieee80211_phy.h index 7970388b..1539e879 100644 --- a/freebsd/sys/net80211/ieee80211_phy.h +++ b/freebsd/sys/net80211/ieee80211_phy.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2007-2008 Sam Leffler, Errno Consulting * All rights reserved. * diff --git a/freebsd/sys/net80211/ieee80211_power.c b/freebsd/sys/net80211/ieee80211_power.c index cd526855..68fede6c 100644 --- a/freebsd/sys/net80211/ieee80211_power.c +++ b/freebsd/sys/net80211/ieee80211_power.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2002-2008 Sam Leffler, Errno Consulting * All rights reserved. * diff --git a/freebsd/sys/net80211/ieee80211_power.h b/freebsd/sys/net80211/ieee80211_power.h index d9bbaa58..f2c0050f 100644 --- a/freebsd/sys/net80211/ieee80211_power.h +++ b/freebsd/sys/net80211/ieee80211_power.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2002-2008 Sam Leffler, Errno Consulting * All rights reserved. * diff --git a/freebsd/sys/net80211/ieee80211_proto.c b/freebsd/sys/net80211/ieee80211_proto.c index d9cbc3b5..73410d70 100644 --- a/freebsd/sys/net80211/ieee80211_proto.c +++ b/freebsd/sys/net80211/ieee80211_proto.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2001 Atsushi Onoe * Copyright (c) 2002-2008 Sam Leffler, Errno Consulting * Copyright (c) 2012 IEEE diff --git a/freebsd/sys/net80211/ieee80211_proto.h b/freebsd/sys/net80211/ieee80211_proto.h index b9aef7cb..187f7018 100644 --- a/freebsd/sys/net80211/ieee80211_proto.h +++ b/freebsd/sys/net80211/ieee80211_proto.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2001 Atsushi Onoe * Copyright (c) 2002-2009 Sam Leffler, Errno Consulting * All rights reserved. diff --git a/freebsd/sys/net80211/ieee80211_radiotap.c b/freebsd/sys/net80211/ieee80211_radiotap.c index e62be743..81746e4e 100644 --- a/freebsd/sys/net80211/ieee80211_radiotap.c +++ b/freebsd/sys/net80211/ieee80211_radiotap.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2009 Sam Leffler, Errno Consulting * All rights reserved. * diff --git a/freebsd/sys/net80211/ieee80211_radiotap.h b/freebsd/sys/net80211/ieee80211_radiotap.h index e42c6664..d4369e8e 100644 --- a/freebsd/sys/net80211/ieee80211_radiotap.h +++ b/freebsd/sys/net80211/ieee80211_radiotap.h @@ -2,6 +2,8 @@ /* $NetBSD: ieee80211_radiotap.h,v 1.16 2007/01/06 05:51:15 dyoung Exp $ */ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 2003, 2004 David Young. All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/freebsd/sys/net80211/ieee80211_ratectl.c b/freebsd/sys/net80211/ieee80211_ratectl.c index d12032df..25a2f208 100644 --- a/freebsd/sys/net80211/ieee80211_ratectl.c +++ b/freebsd/sys/net80211/ieee80211_ratectl.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2010 Rui Paulo <rpaulo@FreeBSD.org> * All rights reserved. * diff --git a/freebsd/sys/net80211/ieee80211_ratectl.h b/freebsd/sys/net80211/ieee80211_ratectl.h index ccb17ef6..d147421a 100644 --- a/freebsd/sys/net80211/ieee80211_ratectl.h +++ b/freebsd/sys/net80211/ieee80211_ratectl.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2010 Rui Paulo <rpaulo@FreeBSD.org> * All rights reserved. * diff --git a/freebsd/sys/net80211/ieee80211_ratectl_none.c b/freebsd/sys/net80211/ieee80211_ratectl_none.c index 2b4a9916..a758e9ee 100644 --- a/freebsd/sys/net80211/ieee80211_ratectl_none.c +++ b/freebsd/sys/net80211/ieee80211_ratectl_none.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2010 Bernhard Schmidt <bschmidt@FreeBSD.org> * All rights reserved. * diff --git a/freebsd/sys/net80211/ieee80211_regdomain.c b/freebsd/sys/net80211/ieee80211_regdomain.c index beda077c..f4a81de4 100644 --- a/freebsd/sys/net80211/ieee80211_regdomain.c +++ b/freebsd/sys/net80211/ieee80211_regdomain.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2005-2008 Sam Leffler, Errno Consulting * All rights reserved. * diff --git a/freebsd/sys/net80211/ieee80211_regdomain.h b/freebsd/sys/net80211/ieee80211_regdomain.h index cfb31463..e46ffa80 100644 --- a/freebsd/sys/net80211/ieee80211_regdomain.h +++ b/freebsd/sys/net80211/ieee80211_regdomain.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2005-2008 Sam Leffler, Errno Consulting * All rights reserved. * diff --git a/freebsd/sys/net80211/ieee80211_rssadapt.c b/freebsd/sys/net80211/ieee80211_rssadapt.c index 5d404fa1..f05af298 100644 --- a/freebsd/sys/net80211/ieee80211_rssadapt.c +++ b/freebsd/sys/net80211/ieee80211_rssadapt.c @@ -3,6 +3,8 @@ /* $FreeBSD$ */ /* $NetBSD: ieee80211_rssadapt.c,v 1.9 2005/02/26 22:45:09 perry Exp $ */ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 2010 Rui Paulo <rpaulo@FreeBSD.org> * Copyright (c) 2003, 2004 David Young. All rights reserved. * diff --git a/freebsd/sys/net80211/ieee80211_rssadapt.h b/freebsd/sys/net80211/ieee80211_rssadapt.h index ee1d2d90..74b64bea 100644 --- a/freebsd/sys/net80211/ieee80211_rssadapt.h +++ b/freebsd/sys/net80211/ieee80211_rssadapt.h @@ -1,6 +1,8 @@ /* $FreeBSD$ */ /* $NetBSD: ieee80211_rssadapt.h,v 1.4 2005/02/26 22:45:09 perry Exp $ */ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 2003, 2004 David Young. All rights reserved. * * Redistribution and use in source and binary forms, with or diff --git a/freebsd/sys/net80211/ieee80211_scan.c b/freebsd/sys/net80211/ieee80211_scan.c index 1f3f95a5..9b58ff98 100644 --- a/freebsd/sys/net80211/ieee80211_scan.c +++ b/freebsd/sys/net80211/ieee80211_scan.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2002-2008 Sam Leffler, Errno Consulting * All rights reserved. * diff --git a/freebsd/sys/net80211/ieee80211_scan.h b/freebsd/sys/net80211/ieee80211_scan.h index a3c873df..07d927cf 100644 --- a/freebsd/sys/net80211/ieee80211_scan.h +++ b/freebsd/sys/net80211/ieee80211_scan.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2005-2009 Sam Leffler, Errno Consulting * All rights reserved. * diff --git a/freebsd/sys/net80211/ieee80211_scan_sta.c b/freebsd/sys/net80211/ieee80211_scan_sta.c index 1a930bc3..ed069ed8 100644 --- a/freebsd/sys/net80211/ieee80211_scan_sta.c +++ b/freebsd/sys/net80211/ieee80211_scan_sta.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2002-2009 Sam Leffler, Errno Consulting * All rights reserved. * diff --git a/freebsd/sys/net80211/ieee80211_sta.c b/freebsd/sys/net80211/ieee80211_sta.c index 8e0da623..1993f566 100644 --- a/freebsd/sys/net80211/ieee80211_sta.c +++ b/freebsd/sys/net80211/ieee80211_sta.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2007-2008 Sam Leffler, Errno Consulting * All rights reserved. * diff --git a/freebsd/sys/net80211/ieee80211_sta.h b/freebsd/sys/net80211/ieee80211_sta.h index e97e181e..79c576d1 100644 --- a/freebsd/sys/net80211/ieee80211_sta.h +++ b/freebsd/sys/net80211/ieee80211_sta.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2007-2008 Sam Leffler, Errno Consulting * All rights reserved. * diff --git a/freebsd/sys/net80211/ieee80211_superg.c b/freebsd/sys/net80211/ieee80211_superg.c index a9968b49..8c3cc719 100644 --- a/freebsd/sys/net80211/ieee80211_superg.c +++ b/freebsd/sys/net80211/ieee80211_superg.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2002-2009 Sam Leffler, Errno Consulting * All rights reserved. * diff --git a/freebsd/sys/net80211/ieee80211_superg.h b/freebsd/sys/net80211/ieee80211_superg.h index 2c8a6a0b..4f77829f 100644 --- a/freebsd/sys/net80211/ieee80211_superg.h +++ b/freebsd/sys/net80211/ieee80211_superg.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2009 Sam Leffler, Errno Consulting * All rights reserved. * diff --git a/freebsd/sys/net80211/ieee80211_tdma.c b/freebsd/sys/net80211/ieee80211_tdma.c index d7c1269c..b18803fc 100644 --- a/freebsd/sys/net80211/ieee80211_tdma.c +++ b/freebsd/sys/net80211/ieee80211_tdma.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2007-2009 Sam Leffler, Errno Consulting * Copyright (c) 2007-2009 Intel Corporation * All rights reserved. diff --git a/freebsd/sys/net80211/ieee80211_tdma.h b/freebsd/sys/net80211/ieee80211_tdma.h index 76b9ed1c..9b108e4b 100644 --- a/freebsd/sys/net80211/ieee80211_tdma.h +++ b/freebsd/sys/net80211/ieee80211_tdma.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2007-2009 Sam Leffler, Errno Consulting * Copyright (c) 2007-2009 Intel Corporation * All rights reserved. diff --git a/freebsd/sys/net80211/ieee80211_var.h b/freebsd/sys/net80211/ieee80211_var.h index 1d806a92..ee17c806 100644 --- a/freebsd/sys/net80211/ieee80211_var.h +++ b/freebsd/sys/net80211/ieee80211_var.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2001 Atsushi Onoe * Copyright (c) 2002-2009 Sam Leffler, Errno Consulting * All rights reserved. diff --git a/freebsd/sys/net80211/ieee80211_wds.c b/freebsd/sys/net80211/ieee80211_wds.c index 66ee0322..1bceacef 100644 --- a/freebsd/sys/net80211/ieee80211_wds.c +++ b/freebsd/sys/net80211/ieee80211_wds.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2007-2008 Sam Leffler, Errno Consulting * All rights reserved. * diff --git a/freebsd/sys/net80211/ieee80211_wds.h b/freebsd/sys/net80211/ieee80211_wds.h index c34fb6ee..23f1a571 100644 --- a/freebsd/sys/net80211/ieee80211_wds.h +++ b/freebsd/sys/net80211/ieee80211_wds.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2007-2008 Sam Leffler, Errno Consulting * All rights reserved. * diff --git a/freebsd/sys/net80211/ieee80211_xauth.c b/freebsd/sys/net80211/ieee80211_xauth.c index 5efce39a..742ed5bf 100644 --- a/freebsd/sys/net80211/ieee80211_xauth.c +++ b/freebsd/sys/net80211/ieee80211_xauth.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2004 Video54 Technologies, Inc. * Copyright (c) 2004-2008 Sam Leffler, Errno Consulting * All rights reserved. diff --git a/freebsd/sys/netinet/accf_data.c b/freebsd/sys/netinet/accf_data.c index ae91bfa6..a98ded36 100644 --- a/freebsd/sys/netinet/accf_data.c +++ b/freebsd/sys/netinet/accf_data.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2000 Alfred Perlstein <alfred@FreeBSD.org> * All rights reserved. * diff --git a/freebsd/sys/netinet/accf_dns.c b/freebsd/sys/netinet/accf_dns.c index 5d11a024..f0f5d1f8 100644 --- a/freebsd/sys/netinet/accf_dns.c +++ b/freebsd/sys/netinet/accf_dns.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> -/* +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (C) 2007 David Malone <dwmalone@FreeBSD.org> * All rights reserved. * diff --git a/freebsd/sys/netinet/accf_http.c b/freebsd/sys/netinet/accf_http.c index 65dc2621..f1c9c5b3 100644 --- a/freebsd/sys/netinet/accf_http.c +++ b/freebsd/sys/netinet/accf_http.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2000 Paycounter, Inc. * Author: Alfred Perlstein <alfred@paycounter.com>, <alfred@FreeBSD.org> * All rights reserved. diff --git a/freebsd/sys/netinet/cc/cc.c b/freebsd/sys/netinet/cc/cc.c index 26d6f329..dc919172 100644 --- a/freebsd/sys/netinet/cc/cc.c +++ b/freebsd/sys/netinet/cc/cc.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2007-2008 * Swinburne University of Technology, Melbourne, Australia. * Copyright (c) 2009-2010 Lawrence Stewart <lstewart@freebsd.org> diff --git a/freebsd/sys/netinet/cc/cc_module.h b/freebsd/sys/netinet/cc/cc_module.h index 6da10df1..1daf915c 100644 --- a/freebsd/sys/netinet/cc/cc_module.h +++ b/freebsd/sys/netinet/cc/cc_module.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2009-2010 Lawrence Stewart <lstewart@freebsd.org> * All rights reserved. * diff --git a/freebsd/sys/netinet/cc/cc_newreno.c b/freebsd/sys/netinet/cc/cc_newreno.c index 474afcc9..58a6504a 100644 --- a/freebsd/sys/netinet/cc/cc_newreno.c +++ b/freebsd/sys/netinet/cc/cc_newreno.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 1982, 1986, 1988, 1990, 1993, 1994, 1995 * The Regents of the University of California. * Copyright (c) 2007-2008,2010 diff --git a/freebsd/sys/netinet/icmp6.h b/freebsd/sys/netinet/icmp6.h index d2e35e42..b0ae67fe 100644 --- a/freebsd/sys/netinet/icmp6.h +++ b/freebsd/sys/netinet/icmp6.h @@ -2,6 +2,8 @@ /* $KAME: icmp6.h,v 1.46 2001/04/27 15:09:48 itojun Exp $ */ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. * All rights reserved. * diff --git a/freebsd/sys/netinet/icmp_var.h b/freebsd/sys/netinet/icmp_var.h index 565c7d48..6b421f2d 100644 --- a/freebsd/sys/netinet/icmp_var.h +++ b/freebsd/sys/netinet/icmp_var.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1982, 1986, 1993 * The Regents of the University of California. All rights reserved. * diff --git a/freebsd/sys/netinet/if_ether.c b/freebsd/sys/netinet/if_ether.c index bdb3b054..fbf6238f 100644 --- a/freebsd/sys/netinet/if_ether.c +++ b/freebsd/sys/netinet/if_ether.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1982, 1986, 1988, 1993 * The Regents of the University of California. All rights reserved. * diff --git a/freebsd/sys/netinet/if_ether.h b/freebsd/sys/netinet/if_ether.h index b0bc30cf..028e45a7 100644 --- a/freebsd/sys/netinet/if_ether.h +++ b/freebsd/sys/netinet/if_ether.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1982, 1986, 1993 * The Regents of the University of California. All rights reserved. * diff --git a/freebsd/sys/netinet/igmp.c b/freebsd/sys/netinet/igmp.c index 5575a803..cf319470 100644 --- a/freebsd/sys/netinet/igmp.c +++ b/freebsd/sys/netinet/igmp.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 2007-2009 Bruce Simpson. * Copyright (c) 1988 Stephen Deering. * Copyright (c) 1992, 1993 diff --git a/freebsd/sys/netinet/igmp.h b/freebsd/sys/netinet/igmp.h index 9d19726a..873d6419 100644 --- a/freebsd/sys/netinet/igmp.h +++ b/freebsd/sys/netinet/igmp.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1988 Stephen Deering. * Copyright (c) 1992, 1993 * The Regents of the University of California. All rights reserved. diff --git a/freebsd/sys/netinet/igmp_var.h b/freebsd/sys/netinet/igmp_var.h index c2401506..4f9db06c 100644 --- a/freebsd/sys/netinet/igmp_var.h +++ b/freebsd/sys/netinet/igmp_var.h @@ -1,4 +1,6 @@ -/*-a +/*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1988 Stephen Deering. * Copyright (c) 1992, 1993 * The Regents of the University of California. All rights reserved. diff --git a/freebsd/sys/netinet/in.c b/freebsd/sys/netinet/in.c index 0b31ff7e..77ada362 100644 --- a/freebsd/sys/netinet/in.c +++ b/freebsd/sys/netinet/in.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1982, 1986, 1991, 1993 * The Regents of the University of California. All rights reserved. * Copyright (C) 2001 WIDE Project. All rights reserved. diff --git a/freebsd/sys/netinet/in_gif.c b/freebsd/sys/netinet/in_gif.c index e7439acf..d072161f 100644 --- a/freebsd/sys/netinet/in_gif.c +++ b/freebsd/sys/netinet/in_gif.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. * All rights reserved. * diff --git a/freebsd/sys/netinet/in_kdtrace.h b/freebsd/sys/netinet/in_kdtrace.h index 0825c7df..ba63a9a9 100644 --- a/freebsd/sys/netinet/in_kdtrace.h +++ b/freebsd/sys/netinet/in_kdtrace.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2013 Mark Johnston <markj@FreeBSD.org> * * Redistribution and use in source and binary forms, with or without diff --git a/freebsd/sys/netinet/in_mcast.c b/freebsd/sys/netinet/in_mcast.c index 2ba4d9e8..41beed9b 100644 --- a/freebsd/sys/netinet/in_mcast.c +++ b/freebsd/sys/netinet/in_mcast.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 2007-2009 Bruce Simpson. * Copyright (c) 2005 Robert N. M. Watson. * All rights reserved. diff --git a/freebsd/sys/netinet/in_pcb.c b/freebsd/sys/netinet/in_pcb.c index 44890e3f..2783a276 100644 --- a/freebsd/sys/netinet/in_pcb.c +++ b/freebsd/sys/netinet/in_pcb.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1982, 1986, 1991, 1993, 1995 * The Regents of the University of California. * Copyright (c) 2007-2009 Robert N. M. Watson diff --git a/freebsd/sys/netinet/in_pcb.h b/freebsd/sys/netinet/in_pcb.h index 059ea90c..574ab407 100644 --- a/freebsd/sys/netinet/in_pcb.h +++ b/freebsd/sys/netinet/in_pcb.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1982, 1986, 1990, 1993 * The Regents of the University of California. * Copyright (c) 2010-2011 Juniper Networks, Inc. diff --git a/freebsd/sys/netinet/in_proto.c b/freebsd/sys/netinet/in_proto.c index de2f2057..f1dec6c5 100644 --- a/freebsd/sys/netinet/in_proto.c +++ b/freebsd/sys/netinet/in_proto.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1982, 1986, 1993 * The Regents of the University of California. All rights reserved. * diff --git a/freebsd/sys/netinet/in_systm.h b/freebsd/sys/netinet/in_systm.h index 573ee40d..44f4d4d5 100644 --- a/freebsd/sys/netinet/in_systm.h +++ b/freebsd/sys/netinet/in_systm.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1982, 1986, 1993 * The Regents of the University of California. All rights reserved. * diff --git a/freebsd/sys/netinet/in_var.h b/freebsd/sys/netinet/in_var.h index b2a7d460..ff722fc9 100644 --- a/freebsd/sys/netinet/in_var.h +++ b/freebsd/sys/netinet/in_var.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1985, 1986, 1993 * The Regents of the University of California. All rights reserved. * diff --git a/freebsd/sys/netinet/ip.h b/freebsd/sys/netinet/ip.h index 4d9d4888..6d902fe4 100644 --- a/freebsd/sys/netinet/ip.h +++ b/freebsd/sys/netinet/ip.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1982, 1986, 1993 * The Regents of the University of California. * All rights reserved. diff --git a/freebsd/sys/netinet/ip6.h b/freebsd/sys/netinet/ip6.h index 40c4973c..a0dfcb0f 100644 --- a/freebsd/sys/netinet/ip6.h +++ b/freebsd/sys/netinet/ip6.h @@ -2,6 +2,8 @@ /* $KAME: ip6.h,v 1.18 2001/03/29 05:34:30 itojun Exp $ */ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. * All rights reserved. * diff --git a/freebsd/sys/netinet/ip_carp.c b/freebsd/sys/netinet/ip_carp.c index 8b09a8c3..70537cfb 100644 --- a/freebsd/sys/netinet/ip_carp.c +++ b/freebsd/sys/netinet/ip_carp.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2002 Michael Shalayeff. * Copyright (c) 2003 Ryan McBride. * Copyright (c) 2011 Gleb Smirnoff <glebius@FreeBSD.org> @@ -177,8 +179,8 @@ static int proto_reg[] = {-1, -1}; * Each softc has a lock sc_mtx. It is used to synchronise carp_input_c(), * callout-driven events and ioctl()s. * - * To traverse the list of softcs on an ifnet we use CIF_LOCK(), to - * traverse the global list we use the mutex carp_mtx. + * To traverse the list of softcs on an ifnet we use CIF_LOCK() or carp_sx. + * To traverse the global list we use the mutex carp_mtx. * * Known issues with locking: * @@ -288,7 +290,8 @@ SYSCTL_VNET_PCPUSTAT(_net_inet_carp, OID_AUTO, stats, struct carpstats, ++_i) #define IFNET_FOREACH_CARP(ifp, sc) \ - CIF_LOCK_ASSERT(ifp->if_carp); \ + KASSERT(mtx_owned(&ifp->if_carp->cif_mtx) || \ + sx_xlocked(&carp_sx), ("cif_vrs not locked")); \ TAILQ_FOREACH((sc), &(ifp)->if_carp->cif_vrs, sc_list) #define DEMOTE_ADVSKEW(sc) \ @@ -1564,6 +1567,8 @@ carp_alloc(struct ifnet *ifp) struct carp_softc *sc; struct carp_if *cif; + sx_assert(&carp_sx, SA_XLOCKED); + if ((cif = ifp->if_carp) == NULL) cif = carp_alloc_if(ifp); @@ -1753,11 +1758,9 @@ carp_ioctl(struct ifreq *ifr, u_long cmd, struct thread *td) } if (ifp->if_carp) { - CIF_LOCK(ifp->if_carp); IFNET_FOREACH_CARP(ifp, sc) if (sc->sc_vhid == carpr.carpr_vhid) break; - CIF_UNLOCK(ifp->if_carp); } if (sc == NULL) { sc = carp_alloc(ifp); @@ -1828,11 +1831,9 @@ carp_ioctl(struct ifreq *ifr, u_long cmd, struct thread *td) priveleged = (priv_check(td, PRIV_NETINET_CARP) == 0); if (carpr.carpr_vhid != 0) { - CIF_LOCK(ifp->if_carp); IFNET_FOREACH_CARP(ifp, sc) if (sc->sc_vhid == carpr.carpr_vhid) break; - CIF_UNLOCK(ifp->if_carp); if (sc == NULL) { error = ENOENT; break; @@ -1843,7 +1844,6 @@ carp_ioctl(struct ifreq *ifr, u_long cmd, struct thread *td) int i, count; count = 0; - CIF_LOCK(ifp->if_carp); IFNET_FOREACH_CARP(ifp, sc) count++; @@ -1865,7 +1865,6 @@ carp_ioctl(struct ifreq *ifr, u_long cmd, struct thread *td) } i++; } - CIF_UNLOCK(ifp->if_carp); } break; } @@ -1920,11 +1919,9 @@ carp_attach(struct ifaddr *ifa, int vhid) return (ENOPROTOOPT); } - CIF_LOCK(cif); IFNET_FOREACH_CARP(ifp, sc) if (sc->sc_vhid == vhid) break; - CIF_UNLOCK(cif); if (sc == NULL) { sx_xunlock(&carp_sx); return (ENOENT); diff --git a/freebsd/sys/netinet/ip_carp.h b/freebsd/sys/netinet/ip_carp.h index 9c6edf6d..fc591ac3 100644 --- a/freebsd/sys/netinet/ip_carp.h +++ b/freebsd/sys/netinet/ip_carp.h @@ -1,7 +1,9 @@ /* $FreeBSD$ */ /* $OpenBSD: ip_carp.h,v 1.8 2004/07/29 22:12:15 mcbride Exp $ */ -/* +/*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2002 Michael Shalayeff. All rights reserved. * Copyright (c) 2003 Ryan McBride. All rights reserved. * diff --git a/freebsd/sys/netinet/ip_divert.c b/freebsd/sys/netinet/ip_divert.c index 5d7b1635..53a0445e 100644 --- a/freebsd/sys/netinet/ip_divert.c +++ b/freebsd/sys/netinet/ip_divert.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1982, 1986, 1988, 1993 * The Regents of the University of California. All rights reserved. * diff --git a/freebsd/sys/netinet/ip_divert.h b/freebsd/sys/netinet/ip_divert.h index b8bcf4fb..a426afec 100644 --- a/freebsd/sys/netinet/ip_divert.h +++ b/freebsd/sys/netinet/ip_divert.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 2003 Sam Leffler, Errno Consulting * All rights reserved. * diff --git a/freebsd/sys/netinet/ip_dummynet.h b/freebsd/sys/netinet/ip_dummynet.h index 377b5b09..9d64b3e9 100644 --- a/freebsd/sys/netinet/ip_dummynet.h +++ b/freebsd/sys/netinet/ip_dummynet.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 1998-2010 Luigi Rizzo, Universita` di Pisa * Portions Copyright (c) 2000 Akamba Corp. * All rights reserved diff --git a/freebsd/sys/netinet/ip_ecn.c b/freebsd/sys/netinet/ip_ecn.c index cc5fd9dd..921f1c16 100644 --- a/freebsd/sys/netinet/ip_ecn.c +++ b/freebsd/sys/netinet/ip_ecn.c @@ -3,6 +3,8 @@ /* $KAME: ip_ecn.c,v 1.12 2002/01/07 11:34:47 kjc Exp $ */ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (C) 1999 WIDE Project. * All rights reserved. * diff --git a/freebsd/sys/netinet/ip_ecn.h b/freebsd/sys/netinet/ip_ecn.h index c5c1c4eb..eb49b5f1 100644 --- a/freebsd/sys/netinet/ip_ecn.h +++ b/freebsd/sys/netinet/ip_ecn.h @@ -2,6 +2,8 @@ /* $KAME: ip_ecn.h,v 1.8 2002/01/07 11:34:47 kjc Exp $ */ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (C) 1999 WIDE Project. * All rights reserved. * diff --git a/freebsd/sys/netinet/ip_encap.c b/freebsd/sys/netinet/ip_encap.c index 0f6fa850..d0866b00 100644 --- a/freebsd/sys/netinet/ip_encap.c +++ b/freebsd/sys/netinet/ip_encap.c @@ -3,6 +3,8 @@ /* $KAME: ip_encap.c,v 1.41 2001/03/15 08:35:08 itojun Exp $ */ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. * All rights reserved. * diff --git a/freebsd/sys/netinet/ip_encap.h b/freebsd/sys/netinet/ip_encap.h index 0b8dbd6f..bbbee390 100644 --- a/freebsd/sys/netinet/ip_encap.h +++ b/freebsd/sys/netinet/ip_encap.h @@ -2,6 +2,8 @@ /* $KAME: ip_encap.h,v 1.7 2000/03/25 07:23:37 sumikawa Exp $ */ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. * All rights reserved. * diff --git a/freebsd/sys/netinet/ip_fastfwd.c b/freebsd/sys/netinet/ip_fastfwd.c index 823dee35..b8a56c31 100644 --- a/freebsd/sys/netinet/ip_fastfwd.c +++ b/freebsd/sys/netinet/ip_fastfwd.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 2003 Andre Oppermann, Internet Business Solutions AG * All rights reserved. * diff --git a/freebsd/sys/netinet/ip_fw.h b/freebsd/sys/netinet/ip_fw.h index ddee5bf1..de938c75 100644 --- a/freebsd/sys/netinet/ip_fw.h +++ b/freebsd/sys/netinet/ip_fw.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2002-2009 Luigi Rizzo, Universita` di Pisa * * Redistribution and use in source and binary forms, with or without @@ -728,6 +730,8 @@ struct _ipfw_dyn_rule { #define ICMP_REJECT_RST 0x100 /* fake ICMP code (send a TCP RST) */ #define ICMP6_UNREACH_RST 0x100 /* fake ICMPv6 code (send a TCP RST) */ +#define ICMP_REJECT_ABORT 0x101 /* fake ICMP code (send an SCTP ABORT) */ +#define ICMP6_UNREACH_ABORT 0x101 /* fake ICMPv6 code (send an SCTP ABORT) */ /* * These are used for lookup tables. diff --git a/freebsd/sys/netinet/ip_gre.c b/freebsd/sys/netinet/ip_gre.c index 90c22032..673e23d5 100644 --- a/freebsd/sys/netinet/ip_gre.c +++ b/freebsd/sys/netinet/ip_gre.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-2-Clause-NetBSD + * * Copyright (c) 1998 The NetBSD Foundation, Inc. * Copyright (c) 2014 Andrey V. Elsukov <ae@FreeBSD.org> * All rights reserved. diff --git a/freebsd/sys/netinet/ip_icmp.c b/freebsd/sys/netinet/ip_icmp.c index 4843efcd..b03fea56 100644 --- a/freebsd/sys/netinet/ip_icmp.c +++ b/freebsd/sys/netinet/ip_icmp.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1982, 1986, 1988, 1993 * The Regents of the University of California. All rights reserved. * diff --git a/freebsd/sys/netinet/ip_icmp.h b/freebsd/sys/netinet/ip_icmp.h index 9ffec3b0..0303a095 100644 --- a/freebsd/sys/netinet/ip_icmp.h +++ b/freebsd/sys/netinet/ip_icmp.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1982, 1986, 1993 * The Regents of the University of California. All rights reserved. * diff --git a/freebsd/sys/netinet/ip_id.c b/freebsd/sys/netinet/ip_id.c index fb7d7835..02bf2c5b 100644 --- a/freebsd/sys/netinet/ip_id.c +++ b/freebsd/sys/netinet/ip_id.c @@ -1,7 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> - /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2008 Michael J. Silbersack. * All rights reserved. * diff --git a/freebsd/sys/netinet/ip_input.c b/freebsd/sys/netinet/ip_input.c index 437c281a..c1baebbb 100644 --- a/freebsd/sys/netinet/ip_input.c +++ b/freebsd/sys/netinet/ip_input.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1982, 1986, 1988, 1993 * The Regents of the University of California. All rights reserved. * @@ -1145,40 +1147,96 @@ void ip_savecontrol(struct inpcb *inp, struct mbuf **mp, struct ip *ip, struct mbuf *m) { + bool stamped; + stamped = false; if ((inp->inp_socket->so_options & SO_BINTIME) || CHECK_SO_CT(inp->inp_socket, SO_TS_BINTIME)) { - struct bintime bt; - - bintime(&bt); + struct bintime boottimebin, bt; + struct timespec ts1; + + if ((m->m_flags & (M_PKTHDR | M_TSTMP)) == (M_PKTHDR | + M_TSTMP)) { + mbuf_tstmp2timespec(m, &ts1); + timespec2bintime(&ts1, &bt); + getboottimebin(&boottimebin); + bintime_add(&bt, &boottimebin); + } else { + bintime(&bt); + } *mp = sbcreatecontrol((caddr_t)&bt, sizeof(bt), SCM_BINTIME, SOL_SOCKET); - if (*mp) + if (*mp != NULL) { mp = &(*mp)->m_next; + stamped = true; + } } if (CHECK_SO_CT(inp->inp_socket, SO_TS_REALTIME_MICRO)) { + struct bintime boottimebin, bt1; + struct timespec ts1;; struct timeval tv; - microtime(&tv); + if ((m->m_flags & (M_PKTHDR | M_TSTMP)) == (M_PKTHDR | + M_TSTMP)) { + mbuf_tstmp2timespec(m, &ts1); + timespec2bintime(&ts1, &bt1); + getboottimebin(&boottimebin); + bintime_add(&bt1, &boottimebin); + bintime2timeval(&bt1, &tv); + } else { + microtime(&tv); + } *mp = sbcreatecontrol((caddr_t)&tv, sizeof(tv), SCM_TIMESTAMP, SOL_SOCKET); - if (*mp) + if (*mp != NULL) { mp = &(*mp)->m_next; + stamped = true; + } } else if (CHECK_SO_CT(inp->inp_socket, SO_TS_REALTIME)) { - struct timespec ts; - - nanotime(&ts); + struct bintime boottimebin; + struct timespec ts, ts1; + + if ((m->m_flags & (M_PKTHDR | M_TSTMP)) == (M_PKTHDR | + M_TSTMP)) { + mbuf_tstmp2timespec(m, &ts); + getboottimebin(&boottimebin); + bintime2timespec(&boottimebin, &ts1); + timespecadd(&ts, &ts1, &ts); + } else { + nanotime(&ts); + } *mp = sbcreatecontrol((caddr_t)&ts, sizeof(ts), SCM_REALTIME, SOL_SOCKET); - if (*mp) + if (*mp != NULL) { mp = &(*mp)->m_next; + stamped = true; + } } else if (CHECK_SO_CT(inp->inp_socket, SO_TS_MONOTONIC)) { struct timespec ts; - nanouptime(&ts); + if ((m->m_flags & (M_PKTHDR | M_TSTMP)) == (M_PKTHDR | + M_TSTMP)) + mbuf_tstmp2timespec(m, &ts); + else + nanouptime(&ts); *mp = sbcreatecontrol((caddr_t)&ts, sizeof(ts), SCM_MONOTONIC, SOL_SOCKET); - if (*mp) + if (*mp != NULL) { + mp = &(*mp)->m_next; + stamped = true; + } + } + if (stamped && (m->m_flags & (M_PKTHDR | M_TSTMP)) == (M_PKTHDR | + M_TSTMP)) { + struct sock_timestamp_info sti; + + bzero(&sti, sizeof(sti)); + sti.st_info_flags = ST_INFO_HW; + if ((m->m_flags & M_TSTMP_HPREC) != 0) + sti.st_info_flags |= ST_INFO_HW_HPREC; + *mp = sbcreatecontrol((caddr_t)&sti, sizeof(sti), SCM_TIME_INFO, + SOL_SOCKET); + if (*mp != NULL) mp = &(*mp)->m_next; } if (inp->inp_flags & INP_RECVDSTADDR) { diff --git a/freebsd/sys/netinet/ip_mroute.c b/freebsd/sys/netinet/ip_mroute.c index d0d323e9..eba4af63 100644 --- a/freebsd/sys/netinet/ip_mroute.c +++ b/freebsd/sys/netinet/ip_mroute.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1989 Stephen Deering * Copyright (c) 1992, 1993 * The Regents of the University of California. All rights reserved. diff --git a/freebsd/sys/netinet/ip_mroute.h b/freebsd/sys/netinet/ip_mroute.h index 66bb65c3..11329fd1 100644 --- a/freebsd/sys/netinet/ip_mroute.h +++ b/freebsd/sys/netinet/ip_mroute.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1989 Stephen Deering. * Copyright (c) 1992, 1993 * The Regents of the University of California. All rights reserved. diff --git a/freebsd/sys/netinet/ip_options.c b/freebsd/sys/netinet/ip_options.c index 9d5310f1..d85aecf3 100644 --- a/freebsd/sys/netinet/ip_options.c +++ b/freebsd/sys/netinet/ip_options.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /* + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1982, 1986, 1988, 1993 * The Regents of the University of California. * Copyright (c) 2005 Andre Oppermann, Internet Business Solutions AG. diff --git a/freebsd/sys/netinet/ip_options.h b/freebsd/sys/netinet/ip_options.h index b7d2fb0a..3213d5f7 100644 --- a/freebsd/sys/netinet/ip_options.h +++ b/freebsd/sys/netinet/ip_options.h @@ -1,4 +1,6 @@ /* + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1982, 1986, 1993 * The Regents of the University of California. * Copyright (c) 2005 Andre Oppermann, Internet Business Solutions AG. diff --git a/freebsd/sys/netinet/ip_output.c b/freebsd/sys/netinet/ip_output.c index d9a5c511..62110ed1 100644 --- a/freebsd/sys/netinet/ip_output.c +++ b/freebsd/sys/netinet/ip_output.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1982, 1986, 1988, 1990, 1993 * The Regents of the University of California. All rights reserved. * diff --git a/freebsd/sys/netinet/ip_var.h b/freebsd/sys/netinet/ip_var.h index f7e58d18..9e7ee591 100644 --- a/freebsd/sys/netinet/ip_var.h +++ b/freebsd/sys/netinet/ip_var.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1982, 1986, 1993 * The Regents of the University of California. All rights reserved. * diff --git a/freebsd/sys/netinet/libalias/alias.c b/freebsd/sys/netinet/libalias/alias.c index 35343c5f..2dd5b999 100644 --- a/freebsd/sys/netinet/libalias/alias.c +++ b/freebsd/sys/netinet/libalias/alias.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2001 Charles Mott <cm@linktel.net> * All rights reserved. * diff --git a/freebsd/sys/netinet/libalias/alias.h b/freebsd/sys/netinet/libalias/alias.h index b12b353a..0b8875ec 100644 --- a/freebsd/sys/netinet/libalias/alias.h +++ b/freebsd/sys/netinet/libalias/alias.h @@ -1,6 +1,8 @@ /* lint -save -library Flexelint comment for external headers */ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2001 Charles Mott <cm@linktel.net> * All rights reserved. * diff --git a/freebsd/sys/netinet/libalias/alias_cuseeme.c b/freebsd/sys/netinet/libalias/alias_cuseeme.c index 1d3cfa54..1d62a696 100644 --- a/freebsd/sys/netinet/libalias/alias_cuseeme.c +++ b/freebsd/sys/netinet/libalias/alias_cuseeme.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 1998 Brian Somers <brian@Awfulhak.org> * with the aid of code written by * Junichi SATOH <junichi@astec.co.jp> 1996, 1997. diff --git a/freebsd/sys/netinet/libalias/alias_db.c b/freebsd/sys/netinet/libalias/alias_db.c index 212b891d..38fcd597 100644 --- a/freebsd/sys/netinet/libalias/alias_db.c +++ b/freebsd/sys/netinet/libalias/alias_db.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2001 Charles Mott <cm@linktel.net> * All rights reserved. * diff --git a/freebsd/sys/netinet/libalias/alias_dummy.c b/freebsd/sys/netinet/libalias/alias_dummy.c index 8b5ba1eb..19f8430d 100644 --- a/freebsd/sys/netinet/libalias/alias_dummy.c +++ b/freebsd/sys/netinet/libalias/alias_dummy.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2005 Paolo Pisati <piso@FreeBSD.org> * All rights reserved. * diff --git a/freebsd/sys/netinet/libalias/alias_ftp.c b/freebsd/sys/netinet/libalias/alias_ftp.c index 2e1f4d3a..4a86139e 100644 --- a/freebsd/sys/netinet/libalias/alias_ftp.c +++ b/freebsd/sys/netinet/libalias/alias_ftp.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2001 Charles Mott <cm@linktel.net> * All rights reserved. * diff --git a/freebsd/sys/netinet/libalias/alias_irc.c b/freebsd/sys/netinet/libalias/alias_irc.c index 19bf0db1..1dbb9ddf 100644 --- a/freebsd/sys/netinet/libalias/alias_irc.c +++ b/freebsd/sys/netinet/libalias/alias_irc.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2001 Charles Mott <cm@linktel.net> * All rights reserved. * diff --git a/freebsd/sys/netinet/libalias/alias_local.h b/freebsd/sys/netinet/libalias/alias_local.h index e9e843c6..c2929425 100644 --- a/freebsd/sys/netinet/libalias/alias_local.h +++ b/freebsd/sys/netinet/libalias/alias_local.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2001 Charles Mott <cm@linktel.net> * All rights reserved. * diff --git a/freebsd/sys/netinet/libalias/alias_mod.c b/freebsd/sys/netinet/libalias/alias_mod.c index d57d9ca0..c9dbfc59 100644 --- a/freebsd/sys/netinet/libalias/alias_mod.c +++ b/freebsd/sys/netinet/libalias/alias_mod.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2005 Paolo Pisati <piso@FreeBSD.org> * All rights reserved. * diff --git a/freebsd/sys/netinet/libalias/alias_mod.h b/freebsd/sys/netinet/libalias/alias_mod.h index fd020c46..d57798f7 100644 --- a/freebsd/sys/netinet/libalias/alias_mod.h +++ b/freebsd/sys/netinet/libalias/alias_mod.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2005 Paolo Pisati <piso@FreeBSD.org> * All rights reserved. * diff --git a/freebsd/sys/netinet/libalias/alias_nbt.c b/freebsd/sys/netinet/libalias/alias_nbt.c index 9e3b8b00..3d200cd4 100644 --- a/freebsd/sys/netinet/libalias/alias_nbt.c +++ b/freebsd/sys/netinet/libalias/alias_nbt.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Written by Atsushi Murai <amurai@spec.co.jp> * Copyright (c) 1998, System Planning and Engineering Co. * All rights reserved. diff --git a/freebsd/sys/netinet/libalias/alias_proxy.c b/freebsd/sys/netinet/libalias/alias_proxy.c index 233d5154..b5af9153 100644 --- a/freebsd/sys/netinet/libalias/alias_proxy.c +++ b/freebsd/sys/netinet/libalias/alias_proxy.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2001 Charles Mott <cm@linktel.net> * All rights reserved. * diff --git a/freebsd/sys/netinet/libalias/alias_sctp.c b/freebsd/sys/netinet/libalias/alias_sctp.c index c3d76c3b..f7fda7bf 100644 --- a/freebsd/sys/netinet/libalias/alias_sctp.c +++ b/freebsd/sys/netinet/libalias/alias_sctp.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2008 * Swinburne University of Technology, Melbourne, Australia. * diff --git a/freebsd/sys/netinet/libalias/alias_sctp.h b/freebsd/sys/netinet/libalias/alias_sctp.h index 7bef6f8f..dc401ce9 100644 --- a/freebsd/sys/netinet/libalias/alias_sctp.h +++ b/freebsd/sys/netinet/libalias/alias_sctp.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2008 * Swinburne University of Technology, Melbourne, Australia. * diff --git a/freebsd/sys/netinet/libalias/alias_skinny.c b/freebsd/sys/netinet/libalias/alias_skinny.c index 49e80eeb..2cf235f2 100644 --- a/freebsd/sys/netinet/libalias/alias_skinny.c +++ b/freebsd/sys/netinet/libalias/alias_skinny.c @@ -3,6 +3,8 @@ /*- * alias_skinny.c * + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2002, 2003 MarcusCom, Inc. * All rights reserved. * diff --git a/freebsd/sys/netinet/libalias/alias_smedia.c b/freebsd/sys/netinet/libalias/alias_smedia.c index 93f93296..e2798845 100644 --- a/freebsd/sys/netinet/libalias/alias_smedia.c +++ b/freebsd/sys/netinet/libalias/alias_smedia.c @@ -1,8 +1,10 @@ #include <machine/rtems-bsd-kernel-space.h> -/* +/*- * alias_smedia.c * + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD AND BSD-2-Clause + * * Copyright (c) 2000 Whistle Communications, Inc. * All rights reserved. * diff --git a/freebsd/sys/netinet/libalias/alias_util.c b/freebsd/sys/netinet/libalias/alias_util.c index 622121ee..ea3b0f8f 100644 --- a/freebsd/sys/netinet/libalias/alias_util.c +++ b/freebsd/sys/netinet/libalias/alias_util.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2001 Charles Mott <cm@linktel.net> * All rights reserved. * diff --git a/freebsd/sys/netinet/pim.h b/freebsd/sys/netinet/pim.h index 7878f797..ec140cb3 100644 --- a/freebsd/sys/netinet/pim.h +++ b/freebsd/sys/netinet/pim.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1996-2000 * University of Southern California/Information Sciences Institute. * All rights reserved. diff --git a/freebsd/sys/netinet/pim_var.h b/freebsd/sys/netinet/pim_var.h index ae876c94..e6398a4d 100644 --- a/freebsd/sys/netinet/pim_var.h +++ b/freebsd/sys/netinet/pim_var.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1998-2000 * University of Southern California/Information Sciences Institute. * All rights reserved. diff --git a/freebsd/sys/netinet/raw_ip.c b/freebsd/sys/netinet/raw_ip.c index 689a2bc4..0ed185ae 100644 --- a/freebsd/sys/netinet/raw_ip.c +++ b/freebsd/sys/netinet/raw_ip.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1982, 1986, 1988, 1993 * The Regents of the University of California. * All rights reserved. diff --git a/freebsd/sys/netinet/sctp.h b/freebsd/sys/netinet/sctp.h index 578be4f6..5a86f108 100644 --- a/freebsd/sys/netinet/sctp.h +++ b/freebsd/sys/netinet/sctp.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 2001-2008, by Cisco Systems, Inc. All rights reserved. * Copyright (c) 2008-2012, by Randall Stewart. All rights reserved. * Copyright (c) 2008-2012, by Michael Tuexen. All rights reserved. diff --git a/freebsd/sys/netinet/sctp_asconf.c b/freebsd/sys/netinet/sctp_asconf.c index 5f1c4e8f..d2d990e1 100644 --- a/freebsd/sys/netinet/sctp_asconf.c +++ b/freebsd/sys/netinet/sctp_asconf.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 2001-2007, by Cisco Systems, Inc. All rights reserved. * Copyright (c) 2008-2012, by Randall Stewart. All rights reserved. * Copyright (c) 2008-2012, by Michael Tuexen. All rights reserved. diff --git a/freebsd/sys/netinet/sctp_asconf.h b/freebsd/sys/netinet/sctp_asconf.h index ed9160e1..2a372205 100644 --- a/freebsd/sys/netinet/sctp_asconf.h +++ b/freebsd/sys/netinet/sctp_asconf.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 2001-2007, by Cisco Systems, Inc. All rights reserved. * Copyright (c) 2008-2012, by Randall Stewart. All rights reserved. * Copyright (c) 2008-2012, by Michael Tuexen. All rights reserved. diff --git a/freebsd/sys/netinet/sctp_auth.c b/freebsd/sys/netinet/sctp_auth.c index b6dfdaf8..d8fbcf6e 100644 --- a/freebsd/sys/netinet/sctp_auth.c +++ b/freebsd/sys/netinet/sctp_auth.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 2001-2008, by Cisco Systems, Inc. All rights reserved. * Copyright (c) 2008-2012, by Randall Stewart. All rights reserved. * Copyright (c) 2008-2012, by Michael Tuexen. All rights reserved. @@ -1608,9 +1610,9 @@ sctp_zero_m(struct mbuf *m, uint32_t m_offset, uint32_t size) /* now use the rest of the mbuf chain */ while ((m_tmp != NULL) && (size > 0)) { data = mtod(m_tmp, uint8_t *)+m_offset; - if (size > (uint32_t)SCTP_BUF_LEN(m_tmp)) { - memset(data, 0, SCTP_BUF_LEN(m_tmp)); - size -= SCTP_BUF_LEN(m_tmp); + if (size > (uint32_t)(SCTP_BUF_LEN(m_tmp) - m_offset)) { + memset(data, 0, SCTP_BUF_LEN(m_tmp) - m_offset); + size -= SCTP_BUF_LEN(m_tmp) - m_offset; } else { memset(data, 0, size); size = 0; diff --git a/freebsd/sys/netinet/sctp_auth.h b/freebsd/sys/netinet/sctp_auth.h index 04fd6464..66990c30 100644 --- a/freebsd/sys/netinet/sctp_auth.h +++ b/freebsd/sys/netinet/sctp_auth.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 2001-2008, by Cisco Systems, Inc. All rights reserved. * Copyright (c) 2008-2012, by Randall Stewart. All rights reserved. * Copyright (c) 2008-2012, by Michael Tuexen. All rights reserved. diff --git a/freebsd/sys/netinet/sctp_bsd_addr.c b/freebsd/sys/netinet/sctp_bsd_addr.c index b3cb2ce3..7e2ef189 100644 --- a/freebsd/sys/netinet/sctp_bsd_addr.c +++ b/freebsd/sys/netinet/sctp_bsd_addr.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 2001-2007, by Cisco Systems, Inc. All rights reserved. * Copyright (c) 2008-2012, by Randall Stewart. All rights reserved. * Copyright (c) 2008-2012, by Michael Tuexen. All rights reserved. diff --git a/freebsd/sys/netinet/sctp_bsd_addr.h b/freebsd/sys/netinet/sctp_bsd_addr.h index 8c0383a5..f2191a9b 100644 --- a/freebsd/sys/netinet/sctp_bsd_addr.h +++ b/freebsd/sys/netinet/sctp_bsd_addr.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 2001-2007, by Cisco Systems, Inc. All rights reserved. * Copyright (c) 2008-2012, by Randall Stewart. All rights reserved. * Copyright (c) 2008-2012, by Michael Tuexen. All rights reserved. diff --git a/freebsd/sys/netinet/sctp_cc_functions.c b/freebsd/sys/netinet/sctp_cc_functions.c index b153d325..e8d6a354 100644 --- a/freebsd/sys/netinet/sctp_cc_functions.c +++ b/freebsd/sys/netinet/sctp_cc_functions.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 2001-2007, by Cisco Systems, Inc. All rights reserved. * Copyright (c) 2008-2012, by Randall Stewart. All rights reserved. * Copyright (c) 2008-2012, by Michael Tuexen. All rights reserved. diff --git a/freebsd/sys/netinet/sctp_constants.h b/freebsd/sys/netinet/sctp_constants.h index 56772b34..94378799 100644 --- a/freebsd/sys/netinet/sctp_constants.h +++ b/freebsd/sys/netinet/sctp_constants.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 2001-2008, by Cisco Systems, Inc. All rights reserved. * Copyright (c) 2008-2012, by Randall Stewart. All rights reserved. * Copyright (c) 2008-2012, by Michael Tuexen. All rights reserved. @@ -97,10 +99,6 @@ __FBSDID("$FreeBSD$"); */ #define SCTP_DEFAULT_VRF_SIZE 4 -/* constants for rto calc */ -#define sctp_align_safe_nocopy 0 -#define sctp_align_unsafe_makecopy 1 - /* JRS - Values defined for the HTCP algorithm */ #define ALPHA_BASE (1<<7) /* 1.0 with shift << 7 */ #define BETA_MIN (1<<6) /* 0.5 with shift << 7 */ diff --git a/freebsd/sys/netinet/sctp_crc32.c b/freebsd/sys/netinet/sctp_crc32.c index 99aebe48..82e361e1 100644 --- a/freebsd/sys/netinet/sctp_crc32.c +++ b/freebsd/sys/netinet/sctp_crc32.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 2001-2007, by Cisco Systems, Inc. All rights reserved. * Copyright (c) 2008-2012, by Randall Stewart. All rights reserved. * Copyright (c) 2008-2012, by Michael Tuexen. All rights reserved. diff --git a/freebsd/sys/netinet/sctp_crc32.h b/freebsd/sys/netinet/sctp_crc32.h index 7fe02f5c..adc38afc 100644 --- a/freebsd/sys/netinet/sctp_crc32.h +++ b/freebsd/sys/netinet/sctp_crc32.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 2001-2007, by Cisco Systems, Inc. All rights reserved. * Copyright (c) 2008-2012, by Randall Stewart. All rights reserved. * Copyright (c) 2008-2012, by Michael Tuexen. All rights reserved. diff --git a/freebsd/sys/netinet/sctp_dtrace_declare.h b/freebsd/sys/netinet/sctp_dtrace_declare.h index c5c8f9ce..e4dc97fc 100644 --- a/freebsd/sys/netinet/sctp_dtrace_declare.h +++ b/freebsd/sys/netinet/sctp_dtrace_declare.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 2008-2012, by Randall Stewart. All rights reserved. * Copyright (c) 2008-2012, by Michael Tuexen. All rights reserved. * diff --git a/freebsd/sys/netinet/sctp_dtrace_define.h b/freebsd/sys/netinet/sctp_dtrace_define.h index 19f44da4..53451d20 100644 --- a/freebsd/sys/netinet/sctp_dtrace_define.h +++ b/freebsd/sys/netinet/sctp_dtrace_define.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 2008-2012, by Randall Stewart. All rights reserved. * Copyright (c) 2008-2012, by Michael Tuexen. All rights reserved. * diff --git a/freebsd/sys/netinet/sctp_header.h b/freebsd/sys/netinet/sctp_header.h index b650d930..685ed78a 100644 --- a/freebsd/sys/netinet/sctp_header.h +++ b/freebsd/sys/netinet/sctp_header.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 2001-2007, by Cisco Systems, Inc. All rights reserved. * Copyright (c) 2008-2012, by Randall Stewart. All rights reserved. * Copyright (c) 2008-2012, by Michael Tuexen. All rights reserved. diff --git a/freebsd/sys/netinet/sctp_indata.c b/freebsd/sys/netinet/sctp_indata.c index c27dd485..c4522a39 100644 --- a/freebsd/sys/netinet/sctp_indata.c +++ b/freebsd/sys/netinet/sctp_indata.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 2001-2007, by Cisco Systems, Inc. All rights reserved. * Copyright (c) 2008-2012, by Randall Stewart. All rights reserved. * Copyright (c) 2008-2012, by Michael Tuexen. All rights reserved. @@ -90,12 +92,14 @@ sctp_calc_rwnd(struct sctp_tcb *stcb, struct sctp_association *asoc) if (stcb->sctp_socket == NULL) { return (calc); } + KASSERT(asoc->cnt_on_reasm_queue > 0 || asoc->size_on_reasm_queue == 0, + ("size_on_reasm_queue is %u", asoc->size_on_reasm_queue)); + KASSERT(asoc->cnt_on_all_streams > 0 || asoc->size_on_all_streams == 0, + ("size_on_all_streams is %u", asoc->size_on_all_streams)); if (stcb->asoc.sb_cc == 0 && - asoc->size_on_reasm_queue == 0 && - asoc->size_on_all_streams == 0) { + asoc->cnt_on_reasm_queue == 0 && + asoc->cnt_on_all_streams == 0) { /* Full rwnd granted */ - KASSERT(asoc->cnt_on_reasm_queue == 0, ("cnt_on_reasm_queue is %u", asoc->cnt_on_reasm_queue)); - KASSERT(asoc->cnt_on_all_streams == 0, ("cnt_on_all_streams is %u", asoc->cnt_on_all_streams)); calc = max(SCTP_SB_LIMIT_RCV(stcb->sctp_socket), SCTP_MINIMAL_RWND); return (calc); } @@ -1247,6 +1251,19 @@ deliver_more: } done = (control->end_added) && (control->last_frag_seen); if (control->on_read_q == 0) { + if (!done) { + if (asoc->size_on_all_streams >= control->length) { + asoc->size_on_all_streams -= control->length; + } else { +#ifdef INVARIANTS + panic("size_on_all_streams = %u smaller than control length %u", asoc->size_on_all_streams, control->length); +#else + asoc->size_on_all_streams = 0; +#endif + } + strm->pd_api_started = 1; + control->pdapi_started = 1; + } sctp_add_to_readq(stcb->sctp_ep, stcb, control, &stcb->sctp_socket->so_rcv, control->end_added, @@ -1256,10 +1273,6 @@ deliver_more: if (done) { control = nctl; goto deliver_more; - } else { - /* We are now doing PD API */ - strm->pd_api_started = 1; - control->pdapi_started = 1; } } } @@ -1318,15 +1331,11 @@ sctp_add_chk_to_control(struct sctp_queued_to_read *control, } else if (control->on_strm_q == SCTP_ON_ORDERED) { /* Ordered */ TAILQ_REMOVE(&strm->inqueue, control, next_instrm); - if (asoc->size_on_all_streams >= control->length) { - asoc->size_on_all_streams -= control->length; - } else { -#ifdef INVARIANTS - panic("size_on_all_streams = %u smaller than control length %u", asoc->size_on_all_streams, control->length); -#else - asoc->size_on_all_streams = 0; -#endif - } + /* + * Don't need to decrement + * size_on_all_streams, since control is on + * the read queue. + */ sctp_ucount_decr(asoc->cnt_on_all_streams); control->on_strm_q = 0; #ifdef INVARIANTS @@ -2643,10 +2652,11 @@ sctp_process_data(struct mbuf **mm, int iphlen, int *offset, int length, struct sctp_association *asoc; int num_chunks = 0; /* number of control chunks processed */ int stop_proc = 0; - int chk_length, break_flag, last_chunk; + int break_flag, last_chunk; int abort_flag = 0, was_a_gap; struct mbuf *m; uint32_t highest_tsn; + uint16_t chk_length; /* set the rwnd */ sctp_set_rwnd(stcb, &stcb->asoc); @@ -2698,7 +2708,8 @@ sctp_process_data(struct mbuf **mm, int iphlen, int *offset, int length, } /* get pointer to the first chunk header */ ch = (struct sctp_chunkhdr *)sctp_m_getptr(m, *offset, - sizeof(struct sctp_chunkhdr), (uint8_t *)&chunk_buf); + sizeof(struct sctp_chunkhdr), + (uint8_t *)&chunk_buf); if (ch == NULL) { return (1); } @@ -2740,7 +2751,7 @@ sctp_process_data(struct mbuf **mm, int iphlen, int *offset, int length, } if ((ch->chunk_type == SCTP_DATA) || (ch->chunk_type == SCTP_IDATA)) { - int clen; + uint16_t clen; if (ch->chunk_type == SCTP_DATA) { clen = sizeof(struct sctp_data_chunk); @@ -2755,7 +2766,8 @@ sctp_process_data(struct mbuf **mm, int iphlen, int *offset, int length, struct mbuf *op_err; char msg[SCTP_DIAG_INFO_LEN]; - snprintf(msg, sizeof(msg), "DATA chunk of length %d", + snprintf(msg, sizeof(msg), "%s chunk of length %u", + ch->chunk_type == SCTP_DATA ? "DATA" : "I-DATA", chk_length); op_err = sctp_generate_cause(SCTP_CAUSE_PROTOCOL_VIOLATION, msg); stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_20; @@ -2832,7 +2844,25 @@ sctp_process_data(struct mbuf **mm, int iphlen, int *offset, int length, return (2); } default: - /* unknown chunk type, use bit rules */ + /* + * Unknown chunk type: use bit rules after + * checking length + */ + if (chk_length < sizeof(struct sctp_chunkhdr)) { + /* + * Need to send an abort since we + * had a invalid chunk. + */ + struct mbuf *op_err; + char msg[SCTP_DIAG_INFO_LEN]; + + snprintf(msg, sizeof(msg), "Chunk of length %u", + chk_length); + op_err = sctp_generate_cause(SCTP_CAUSE_PROTOCOL_VIOLATION, msg); + stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_20; + sctp_abort_an_association(inp, stcb, op_err, SCTP_SO_NOT_LOCKED); + return (2); + } if (ch->chunk_type & 0x40) { /* Add a error report to the queue */ struct mbuf *op_err; @@ -2868,7 +2898,8 @@ sctp_process_data(struct mbuf **mm, int iphlen, int *offset, int length, continue; } ch = (struct sctp_chunkhdr *)sctp_m_getptr(m, *offset, - sizeof(struct sctp_chunkhdr), (uint8_t *)&chunk_buf); + sizeof(struct sctp_chunkhdr), + (uint8_t *)&chunk_buf); if (ch == NULL) { *offset = length; stop_proc = 1; @@ -3060,7 +3091,6 @@ sctp_process_segment_range(struct sctp_tcb *stcb, struct sctp_tmit_chunk **p_tp1 &stcb->asoc, tp1->whoTo, &tp1->sent_rcv_time, - sctp_align_safe_nocopy, SCTP_RTT_FROM_DATA); *rto_ok = 0; } @@ -4032,7 +4062,6 @@ sctp_express_handle_sack(struct sctp_tcb *stcb, uint32_t cumack, sctp_calculate_rto(stcb, asoc, tp1->whoTo, &tp1->sent_rcv_time, - sctp_align_safe_nocopy, SCTP_RTT_FROM_DATA); rto_ok = 0; } @@ -4638,7 +4667,6 @@ hopeless_peer: sctp_calculate_rto(stcb, asoc, tp1->whoTo, &tp1->sent_rcv_time, - sctp_align_safe_nocopy, SCTP_RTT_FROM_DATA); rto_ok = 0; } diff --git a/freebsd/sys/netinet/sctp_indata.h b/freebsd/sys/netinet/sctp_indata.h index badd269d..10b18d0b 100644 --- a/freebsd/sys/netinet/sctp_indata.h +++ b/freebsd/sys/netinet/sctp_indata.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 2001-2007, by Cisco Systems, Inc. All rights reserved. * Copyright (c) 2008-2012, by Randall Stewart. All rights reserved. * Copyright (c) 2008-2012, by Michael Tuexen. All rights reserved. diff --git a/freebsd/sys/netinet/sctp_input.c b/freebsd/sys/netinet/sctp_input.c index 0871bdb8..9c552ff5 100644 --- a/freebsd/sys/netinet/sctp_input.c +++ b/freebsd/sys/netinet/sctp_input.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 2001-2008, by Cisco Systems, Inc. All rights reserved. * Copyright (c) 2008-2012, by Randall Stewart. All rights reserved. * Copyright (c) 2008-2012, by Michael Tuexen. All rights reserved. @@ -519,7 +521,7 @@ sctp_process_init_ack(struct mbuf *m, int iphlen, int offset, asoc->primary_destination, SCTP_FROM_SCTP_INPUT + SCTP_LOC_3); /* calculate the RTO */ - net->RTO = sctp_calculate_rto(stcb, asoc, net, &asoc->time_entered, sctp_align_safe_nocopy, + net->RTO = sctp_calculate_rto(stcb, asoc, net, &asoc->time_entered, SCTP_RTT_FROM_NON_DATA); retval = sctp_send_cookie_echo(m, offset, stcb, net); if (retval < 0) { @@ -635,13 +637,21 @@ sctp_handle_heartbeat_ack(struct sctp_heartbeat_chunk *cp, r_net, SCTP_FROM_SCTP_INPUT + SCTP_LOC_4); sctp_timer_start(SCTP_TIMER_TYPE_HEARTBEAT, stcb->sctp_ep, stcb, r_net); } + if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_THRESHOLD_LOGGING) { + sctp_misc_ints(SCTP_THRESHOLD_CLEAR, + stcb->asoc.overall_error_count, + 0, + SCTP_FROM_SCTP_INPUT, + __LINE__); + } + stcb->asoc.overall_error_count = 0; old_error_counter = r_net->error_count; r_net->error_count = 0; r_net->hb_responded = 1; tv.tv_sec = cp->heartbeat.hb_info.time_value_1; tv.tv_usec = cp->heartbeat.hb_info.time_value_2; /* Now lets do a RTO with this */ - r_net->RTO = sctp_calculate_rto(stcb, &stcb->asoc, r_net, &tv, sctp_align_safe_nocopy, + r_net->RTO = sctp_calculate_rto(stcb, &stcb->asoc, r_net, &tv, SCTP_RTT_FROM_NON_DATA); if (!(r_net->dest_state & SCTP_ADDR_REACHABLE)) { r_net->dest_state |= SCTP_ADDR_REACHABLE; @@ -765,7 +775,8 @@ sctp_handle_nat_missing_state(struct sctp_tcb *stcb, } -static void +/* Returns 1 if the stcb was aborted, 0 otherwise */ +static int sctp_handle_abort(struct sctp_abort_chunk *abort, struct sctp_tcb *stcb, struct sctp_nets *net) { @@ -777,29 +788,29 @@ sctp_handle_abort(struct sctp_abort_chunk *abort, SCTPDBG(SCTP_DEBUG_INPUT2, "sctp_handle_abort: handling ABORT\n"); if (stcb == NULL) - return; + return (0); len = ntohs(abort->ch.chunk_length); - if (len > sizeof(struct sctp_chunkhdr)) { + if (len >= sizeof(struct sctp_chunkhdr) + sizeof(struct sctp_error_cause)) { /* * Need to check the cause codes for our two magic nat * aborts which don't kill the assoc necessarily. */ - struct sctp_gen_error_cause *cause; + struct sctp_error_cause *cause; - cause = (struct sctp_gen_error_cause *)(abort + 1); + cause = (struct sctp_error_cause *)(abort + 1); error = ntohs(cause->code); if (error == SCTP_CAUSE_NAT_COLLIDING_STATE) { SCTPDBG(SCTP_DEBUG_INPUT2, "Received Colliding state abort flags:%x\n", abort->ch.chunk_flags); if (sctp_handle_nat_colliding_state(stcb)) { - return; + return (0); } } else if (error == SCTP_CAUSE_NAT_MISSING_STATE) { SCTPDBG(SCTP_DEBUG_INPUT2, "Received missing state abort flags:%x\n", abort->ch.chunk_flags); if (sctp_handle_nat_missing_state(stcb, net)) { - return; + return (0); } } } else { @@ -834,6 +845,7 @@ sctp_handle_abort(struct sctp_abort_chunk *abort, SCTP_SOCKET_UNLOCK(so, 1); #endif SCTPDBG(SCTP_DEBUG_INPUT2, "sctp_handle_abort: finished\n"); + return (1); } static void @@ -1090,19 +1102,11 @@ sctp_handle_shutdown_ack(struct sctp_shutdown_ack_chunk *cp SCTP_UNUSED, #endif } -/* - * Skip past the param header and then we will find the chunk that caused the - * problem. There are two possibilities ASCONF or FWD-TSN other than that and - * our peer must be broken. - */ static void -sctp_process_unrecog_chunk(struct sctp_tcb *stcb, struct sctp_paramhdr *phdr, +sctp_process_unrecog_chunk(struct sctp_tcb *stcb, uint8_t chunk_type, struct sctp_nets *net) { - struct sctp_chunkhdr *chk; - - chk = (struct sctp_chunkhdr *)((caddr_t)phdr + sizeof(*phdr)); - switch (chk->chunk_type) { + switch (chunk_type) { case SCTP_ASCONF_ACK: case SCTP_ASCONF: sctp_asconf_cleanup(stcb, net); @@ -1113,8 +1117,8 @@ sctp_process_unrecog_chunk(struct sctp_tcb *stcb, struct sctp_paramhdr *phdr, break; default: SCTPDBG(SCTP_DEBUG_INPUT2, - "Peer does not support chunk type %d(%x)??\n", - chk->chunk_type, (uint32_t)chk->chunk_type); + "Peer does not support chunk type %d (0x%x).\n", + chunk_type, chunk_type); break; } } @@ -1126,12 +1130,9 @@ sctp_process_unrecog_chunk(struct sctp_tcb *stcb, struct sctp_paramhdr *phdr, * XXX: Is this the right thing to do? */ static void -sctp_process_unrecog_param(struct sctp_tcb *stcb, struct sctp_paramhdr *phdr) +sctp_process_unrecog_param(struct sctp_tcb *stcb, uint16_t parameter_type) { - struct sctp_paramhdr *pbad; - - pbad = phdr + 1; - switch (ntohs(pbad->param_type)) { + switch (parameter_type) { /* pr-sctp draft */ case SCTP_PRSCTP_SUPPORTED: stcb->asoc.prsctp_supported = 0; @@ -1156,63 +1157,69 @@ sctp_process_unrecog_param(struct sctp_tcb *stcb, struct sctp_paramhdr *phdr) break; default: SCTPDBG(SCTP_DEBUG_INPUT2, - "Peer does not support param type %d(%x)??\n", - pbad->param_type, (uint32_t)pbad->param_type); + "Peer does not support param type %d (0x%x)??\n", + parameter_type, parameter_type); break; } } static int sctp_handle_error(struct sctp_chunkhdr *ch, - struct sctp_tcb *stcb, struct sctp_nets *net) + struct sctp_tcb *stcb, struct sctp_nets *net, uint32_t limit) { - int chklen; - struct sctp_paramhdr *phdr; - uint16_t error, error_type; - uint16_t error_len; + struct sctp_error_cause *cause; struct sctp_association *asoc; - int adjust; + uint32_t remaining_length, adjust; + uint16_t code, cause_code, cause_length; #if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) struct socket *so; #endif /* parse through all of the errors and process */ asoc = &stcb->asoc; - phdr = (struct sctp_paramhdr *)((caddr_t)ch + + cause = (struct sctp_error_cause *)((caddr_t)ch + sizeof(struct sctp_chunkhdr)); - chklen = ntohs(ch->chunk_length) - sizeof(struct sctp_chunkhdr); - error = 0; - while ((size_t)chklen >= sizeof(struct sctp_paramhdr)) { + remaining_length = ntohs(ch->chunk_length); + if (remaining_length > limit) { + remaining_length = limit; + } + if (remaining_length >= sizeof(struct sctp_chunkhdr)) { + remaining_length -= sizeof(struct sctp_chunkhdr); + } else { + remaining_length = 0; + } + code = 0; + while (remaining_length >= sizeof(struct sctp_error_cause)) { /* Process an Error Cause */ - error_type = ntohs(phdr->param_type); - error_len = ntohs(phdr->param_length); - if ((error_len > chklen) || (error_len == 0)) { - /* invalid param length for this param */ - SCTPDBG(SCTP_DEBUG_INPUT1, "Bogus length in error param- chunk left:%d errorlen:%d\n", - chklen, error_len); + cause_code = ntohs(cause->code); + cause_length = ntohs(cause->length); + if ((cause_length > remaining_length) || (cause_length == 0)) { + /* Invalid cause length, possibly due to truncation. */ + SCTPDBG(SCTP_DEBUG_INPUT1, "Bogus length in cause - bytes left: %u cause length: %u\n", + remaining_length, cause_length); return (0); } - if (error == 0) { + if (code == 0) { /* report the first error cause */ - error = error_type; + code = cause_code; } - switch (error_type) { + switch (cause_code) { case SCTP_CAUSE_INVALID_STREAM: case SCTP_CAUSE_MISSING_PARAM: case SCTP_CAUSE_INVALID_PARAM: case SCTP_CAUSE_NO_USER_DATA: - SCTPDBG(SCTP_DEBUG_INPUT1, "Software error we got a %d back? We have a bug :/ (or do they?)\n", - error_type); + SCTPDBG(SCTP_DEBUG_INPUT1, "Software error we got a %u back? We have a bug :/ (or do they?)\n", + cause_code); break; case SCTP_CAUSE_NAT_COLLIDING_STATE: - SCTPDBG(SCTP_DEBUG_INPUT2, "Received Colliding state abort flags:%x\n", + SCTPDBG(SCTP_DEBUG_INPUT2, "Received Colliding state abort flags: %x\n", ch->chunk_flags); if (sctp_handle_nat_colliding_state(stcb)) { return (0); } break; case SCTP_CAUSE_NAT_MISSING_STATE: - SCTPDBG(SCTP_DEBUG_INPUT2, "Received missing state abort flags:%x\n", + SCTPDBG(SCTP_DEBUG_INPUT2, "Received missing state abort flags: %x\n", ch->chunk_flags); if (sctp_handle_nat_missing_state(stcb, net)) { return (0); @@ -1223,12 +1230,18 @@ sctp_handle_error(struct sctp_chunkhdr *ch, * We only act if we have echoed a cookie and are * waiting. */ - if (SCTP_GET_STATE(asoc) == SCTP_STATE_COOKIE_ECHOED) { - int *p; - - p = (int *)((caddr_t)phdr + sizeof(*phdr)); - /* Save the time doubled */ - asoc->cookie_preserve_req = ntohl(*p) << 1; + if ((cause_length >= sizeof(struct sctp_error_stale_cookie)) && + (SCTP_GET_STATE(asoc) == SCTP_STATE_COOKIE_ECHOED)) { + struct sctp_error_stale_cookie *stale_cookie; + + stale_cookie = (struct sctp_error_stale_cookie *)cause; + asoc->cookie_preserve_req = ntohl(stale_cookie->stale_time); + /* Double it to be more robust on RTX */ + if (asoc->cookie_preserve_req <= UINT32_MAX / 2) { + asoc->cookie_preserve_req *= 2; + } else { + asoc->cookie_preserve_req = UINT32_MAX; + } asoc->stale_cookie_count++; if (asoc->stale_cookie_count > asoc->max_init_times) { @@ -1271,10 +1284,21 @@ sctp_handle_error(struct sctp_chunkhdr *ch, */ break; case SCTP_CAUSE_UNRECOG_CHUNK: - sctp_process_unrecog_chunk(stcb, phdr, net); + if (cause_length >= sizeof(struct sctp_error_unrecognized_chunk)) { + struct sctp_error_unrecognized_chunk *unrec_chunk; + + unrec_chunk = (struct sctp_error_unrecognized_chunk *)cause; + sctp_process_unrecog_chunk(stcb, unrec_chunk->ch.chunk_type, net); + } break; case SCTP_CAUSE_UNRECOG_PARAM: - sctp_process_unrecog_param(stcb, phdr); + /* XXX: We only consider the first parameter */ + if (cause_length >= sizeof(struct sctp_error_cause) + sizeof(struct sctp_paramhdr)) { + struct sctp_paramhdr *unrec_parameter; + + unrec_parameter = (struct sctp_paramhdr *)(cause + 1); + sctp_process_unrecog_param(stcb, ntohs(unrec_parameter->param_type)); + } break; case SCTP_CAUSE_COOKIE_IN_SHUTDOWN: /* @@ -1291,8 +1315,8 @@ sctp_handle_error(struct sctp_chunkhdr *ch, * We should NOT get these here, but in a * ASCONF-ACK. */ - SCTPDBG(SCTP_DEBUG_INPUT2, "Peer sends ASCONF errors in a Operational Error?<%d>?\n", - error_type); + SCTPDBG(SCTP_DEBUG_INPUT2, "Peer sends ASCONF errors in a error cause with code %u.\n", + cause_code); break; case SCTP_CAUSE_OUT_OF_RESC: /* @@ -1304,15 +1328,19 @@ sctp_handle_error(struct sctp_chunkhdr *ch, */ break; default: - SCTPDBG(SCTP_DEBUG_INPUT1, "sctp_handle_error: unknown error type = 0x%xh\n", - error_type); + SCTPDBG(SCTP_DEBUG_INPUT1, "sctp_handle_error: unknown code 0x%x\n", + cause_code); break; } - adjust = SCTP_SIZE32(error_len); - chklen -= adjust; - phdr = (struct sctp_paramhdr *)((caddr_t)phdr + adjust); + adjust = SCTP_SIZE32(cause_length); + if (remaining_length >= adjust) { + remaining_length -= adjust; + } else { + remaining_length = 0; + } + cause = (struct sctp_error_cause *)((caddr_t)cause + adjust); } - sctp_ulp_notify(SCTP_NOTIFY_REMOTE_ERROR, stcb, error, ch, SCTP_SO_NOT_LOCKED); + sctp_ulp_notify(SCTP_NOTIFY_REMOTE_ERROR, stcb, code, ch, SCTP_SO_NOT_LOCKED); return (0); } @@ -1489,6 +1517,7 @@ sctp_process_cookie_existing(struct mbuf *m, int iphlen, int offset, struct sctp_init_ack_chunk *initack_cp, initack_buf; struct sctp_nets *net; struct mbuf *op_err; + struct timeval old; int init_offset, initack_offset, i; int retval; int spec_flag = 0; @@ -1649,10 +1678,11 @@ sctp_process_cookie_existing(struct mbuf *m, int iphlen, int offset, * since we did not send a HB make sure we don't * double things */ + old.tv_sec = cookie->time_entered.tv_sec; + old.tv_usec = cookie->time_entered.tv_usec; net->hb_responded = 1; net->RTO = sctp_calculate_rto(stcb, asoc, net, - &cookie->time_entered, - sctp_align_unsafe_makecopy, + &old, SCTP_RTT_FROM_NON_DATA); if (stcb->asoc.sctp_autoclose_ticks && @@ -2369,10 +2399,13 @@ sctp_process_cookie_new(struct mbuf *m, int iphlen, int offset, } (void)SCTP_GETTIME_TIMEVAL(&stcb->asoc.time_entered); if ((netp != NULL) && (*netp != NULL)) { + struct timeval old; + /* calculate the RTT and set the encaps port */ + old.tv_sec = cookie->time_entered.tv_sec; + old.tv_usec = cookie->time_entered.tv_usec; (*netp)->RTO = sctp_calculate_rto(stcb, asoc, *netp, - &cookie->time_entered, sctp_align_unsafe_makecopy, - SCTP_RTT_FROM_NON_DATA); + &old, SCTP_RTT_FROM_NON_DATA); } /* respond with a COOKIE-ACK */ sctp_send_cookie_ack(stcb); @@ -2920,7 +2953,14 @@ sctp_handle_cookie_ack(struct sctp_cookie_ack_chunk *cp SCTP_UNUSED, return; } asoc = &stcb->asoc; - + if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_THRESHOLD_LOGGING) { + sctp_misc_ints(SCTP_THRESHOLD_CLEAR, + asoc->overall_error_count, + 0, + SCTP_FROM_SCTP_INPUT, + __LINE__); + } + asoc->overall_error_count = 0; sctp_stop_all_cookie_timers(stcb); /* process according to association state */ if (SCTP_GET_STATE(asoc) == SCTP_STATE_COOKIE_ECHOED) { @@ -2938,7 +2978,7 @@ sctp_handle_cookie_ack(struct sctp_cookie_ack_chunk *cp SCTP_UNUSED, SCTP_STAT_INCR_GAUGE32(sctps_currestab); if (asoc->overall_error_count == 0) { net->RTO = sctp_calculate_rto(stcb, asoc, net, - &asoc->time_entered, sctp_align_safe_nocopy, + &asoc->time_entered, SCTP_RTT_FROM_NON_DATA); } (void)SCTP_GETTIME_TIMEVAL(&asoc->time_entered); @@ -4504,7 +4544,7 @@ sctp_process_control(struct mbuf *m, int iphlen, int *offset, int length, char msg[SCTP_DIAG_INFO_LEN]; uint32_t vtag_in; int num_chunks = 0; /* number of control chunks processed */ - uint32_t chk_length; + uint32_t chk_length, contiguous; int ret; int abort_no_unlock = 0; int ecne_seen = 0; @@ -4515,7 +4555,6 @@ sctp_process_control(struct mbuf *m, int iphlen, int *offset, int length, * until we get into jumbo grams and such.. */ uint8_t chunk_buf[SCTP_CHUNK_BUFFER_SIZE]; - struct sctp_tcb *locked_tcb = stcb; int got_auth = 0; uint32_t auth_offset = 0, auth_len = 0; int auth_skipped = 0; @@ -4527,31 +4566,29 @@ sctp_process_control(struct mbuf *m, int iphlen, int *offset, int length, SCTPDBG(SCTP_DEBUG_INPUT1, "sctp_process_control: iphlen=%u, offset=%u, length=%u stcb:%p\n", iphlen, *offset, length, (void *)stcb); + if (stcb) { + SCTP_TCB_LOCK_ASSERT(stcb); + } /* validate chunk header length... */ if (ntohs(ch->chunk_length) < sizeof(*ch)) { SCTPDBG(SCTP_DEBUG_INPUT1, "Invalid header length %d\n", ntohs(ch->chunk_length)); - if (locked_tcb) { - SCTP_TCB_UNLOCK(locked_tcb); - } - return (NULL); + *offset = length; + return (stcb); } /* * validate the verification tag */ vtag_in = ntohl(sh->v_tag); - if (locked_tcb) { - SCTP_TCB_LOCK_ASSERT(locked_tcb); - } if (ch->chunk_type == SCTP_INITIATION) { SCTPDBG(SCTP_DEBUG_INPUT1, "Its an INIT of len:%d vtag:%x\n", ntohs(ch->chunk_length), vtag_in); if (vtag_in != 0) { /* protocol error- silently discard... */ SCTP_STAT_INCR(sctps_badvtag); - if (locked_tcb) { - SCTP_TCB_UNLOCK(locked_tcb); + if (stcb != NULL) { + SCTP_TCB_UNLOCK(stcb); } return (NULL); } @@ -4574,9 +4611,6 @@ sctp_process_control(struct mbuf *m, int iphlen, int *offset, int length, if (*offset >= length) { /* no more data left in the mbuf chain */ *offset = length; - if (locked_tcb) { - SCTP_TCB_UNLOCK(locked_tcb); - } return (NULL); } ch = (struct sctp_chunkhdr *)sctp_m_getptr(m, *offset, @@ -4585,10 +4619,7 @@ sctp_process_control(struct mbuf *m, int iphlen, int *offset, int length, if (ch == NULL) { /* Help */ *offset = length; - if (locked_tcb) { - SCTP_TCB_UNLOCK(locked_tcb); - } - return (NULL); + return (stcb); } if (ch->chunk_type == SCTP_COOKIE_ECHO) { goto process_control_chunks; @@ -4625,10 +4656,7 @@ sctp_process_control(struct mbuf *m, int iphlen, int *offset, int length, * sctp_findassociation_ep_asconf(). */ SCTP_INP_DECR_REF(inp); - } else { - locked_tcb = stcb; } - /* now go back and verify any auth chunk to be sure */ if (auth_skipped && (stcb != NULL)) { struct sctp_auth_chunk *auth; @@ -4642,10 +4670,7 @@ sctp_process_control(struct mbuf *m, int iphlen, int *offset, int length, auth_offset)) { /* auth HMAC failed so dump it */ *offset = length; - if (locked_tcb) { - SCTP_TCB_UNLOCK(locked_tcb); - } - return (NULL); + return (stcb); } else { /* remaining chunks are HMAC checked */ stcb->asoc.authenticated = 1; @@ -4661,9 +4686,6 @@ sctp_process_control(struct mbuf *m, int iphlen, int *offset, int length, mflowtype, mflowid, inp->fibnum, vrf_id, port); *offset = length; - if (locked_tcb) { - SCTP_TCB_UNLOCK(locked_tcb); - } return (NULL); } asoc = &stcb->asoc; @@ -4675,13 +4697,14 @@ sctp_process_control(struct mbuf *m, int iphlen, int *offset, int length, if ((((ch->chunk_flags & SCTP_HAD_NO_TCB) == 0) && (vtag_in == asoc->my_vtag)) || (((ch->chunk_flags & SCTP_HAD_NO_TCB) == SCTP_HAD_NO_TCB) && + (asoc->peer_vtag != htonl(0)) && (vtag_in == asoc->peer_vtag))) { /* this is valid */ } else { /* drop this packet... */ SCTP_STAT_INCR(sctps_badvtag); - if (locked_tcb) { - SCTP_TCB_UNLOCK(locked_tcb); + if (stcb != NULL) { + SCTP_TCB_UNLOCK(stcb); } return (NULL); } @@ -4694,8 +4717,8 @@ sctp_process_control(struct mbuf *m, int iphlen, int *offset, int length, * but it won't complete until the shutdown * is completed */ - if (locked_tcb) { - SCTP_TCB_UNLOCK(locked_tcb); + if (stcb != NULL) { + SCTP_TCB_UNLOCK(stcb); } snprintf(msg, sizeof(msg), "OOTB, %s:%d at %s", __FILE__, __LINE__, __func__); op_err = sctp_generate_cause(SCTP_BASE_SYSCTL(sctp_diag_info_code), @@ -4714,8 +4737,8 @@ sctp_process_control(struct mbuf *m, int iphlen, int *offset, int length, "invalid vtag: %xh, expect %xh\n", vtag_in, asoc->my_vtag); SCTP_STAT_INCR(sctps_badvtag); - if (locked_tcb) { - SCTP_TCB_UNLOCK(locked_tcb); + if (stcb != NULL) { + SCTP_TCB_UNLOCK(stcb); } *offset = length; return (NULL); @@ -4730,14 +4753,6 @@ sctp_process_control(struct mbuf *m, int iphlen, int *offset, int length, (ch->chunk_type == SCTP_HEARTBEAT_REQUEST)) && (SCTP_GET_STATE(&stcb->asoc) == SCTP_STATE_COOKIE_ECHOED)) { /* implied cookie-ack.. we must have lost the ack */ - if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_THRESHOLD_LOGGING) { - sctp_misc_ints(SCTP_THRESHOLD_CLEAR, - stcb->asoc.overall_error_count, - 0, - SCTP_FROM_SCTP_INPUT, - __LINE__); - } - stcb->asoc.overall_error_count = 0; sctp_handle_cookie_ack((struct sctp_cookie_ack_chunk *)ch, stcb, *netp); } @@ -4751,65 +4766,34 @@ process_control_chunks: if (chk_length < sizeof(*ch) || (*offset + (int)chk_length) > length) { *offset = length; - if (locked_tcb) { - SCTP_TCB_UNLOCK(locked_tcb); - } - return (NULL); + return (stcb); } SCTP_STAT_INCR_COUNTER64(sctps_incontrolchunks); /* - * INIT-ACK only gets the init ack "header" portion only - * because we don't have to process the peer's COOKIE. All - * others get a complete chunk. + * INIT and INIT-ACK only gets the init ack "header" portion + * only because we don't have to process the peer's COOKIE. + * All others get a complete chunk. */ - if ((ch->chunk_type == SCTP_INITIATION_ACK) || - (ch->chunk_type == SCTP_INITIATION)) { - /* get an init-ack chunk */ - ch = (struct sctp_chunkhdr *)sctp_m_getptr(m, *offset, - sizeof(struct sctp_init_ack_chunk), chunk_buf); - if (ch == NULL) { - *offset = length; - if (locked_tcb) { - SCTP_TCB_UNLOCK(locked_tcb); - } - return (NULL); - } - } else { - /* For cookies and all other chunks. */ - if (chk_length > sizeof(chunk_buf)) { - /* - * use just the size of the chunk buffer so - * the front part of our chunks fit in - * contiguous space up to the chunk buffer - * size (508 bytes). For chunks that need to - * get more than that they must use the - * sctp_m_getptr() function or other means - * (e.g. know how to parse mbuf chains). - * Cookies do this already. - */ - ch = (struct sctp_chunkhdr *)sctp_m_getptr(m, *offset, - (sizeof(chunk_buf) - 4), - chunk_buf); - if (ch == NULL) { - *offset = length; - if (locked_tcb) { - SCTP_TCB_UNLOCK(locked_tcb); - } - return (NULL); - } - } else { - /* We can fit it all */ - ch = (struct sctp_chunkhdr *)sctp_m_getptr(m, *offset, - chk_length, chunk_buf); - if (ch == NULL) { - SCTP_PRINTF("sctp_process_control: Can't get the all data....\n"); - *offset = length; - if (locked_tcb) { - SCTP_TCB_UNLOCK(locked_tcb); - } - return (NULL); - } + switch (ch->chunk_type) { + case SCTP_INITIATION: + contiguous = sizeof(struct sctp_init_chunk); + break; + case SCTP_INITIATION_ACK: + contiguous = sizeof(struct sctp_init_ack_chunk); + break; + default: + contiguous = min(chk_length, sizeof(chunk_buf)); + break; + } + ch = (struct sctp_chunkhdr *)sctp_m_getptr(m, *offset, + contiguous, + chunk_buf); + if (ch == NULL) { + *offset = length; + if (stcb != NULL) { + SCTP_TCB_UNLOCK(stcb); } + return (NULL); } num_chunks++; /* Save off the last place we got a control from */ @@ -4845,8 +4829,8 @@ process_control_chunks: (length - *offset > (int)SCTP_SIZE32(chk_length))) { /* RFC 4960 requires that no ABORT is sent */ *offset = length; - if (locked_tcb) { - SCTP_TCB_UNLOCK(locked_tcb); + if (stcb != NULL) { + SCTP_TCB_UNLOCK(stcb); } return (NULL); } @@ -4866,26 +4850,22 @@ process_control_chunks: mflowtype, mflowid, vrf_id, port); *offset = length; - if ((!abort_no_unlock) && (locked_tcb)) { - SCTP_TCB_UNLOCK(locked_tcb); + if ((!abort_no_unlock) && (stcb != NULL)) { + SCTP_TCB_UNLOCK(stcb); } return (NULL); break; case SCTP_PAD_CHUNK: break; case SCTP_INITIATION_ACK: - SCTPDBG(SCTP_DEBUG_INPUT3, "SCTP_INIT-ACK\n"); + SCTPDBG(SCTP_DEBUG_INPUT3, "SCTP_INIT_ACK\n"); if (inp->sctp_flags & SCTP_PCB_FLAGS_SOCKET_GONE) { /* We are not interested anymore */ - if ((stcb) && (stcb->asoc.total_output_queue_size)) { + if ((stcb != NULL) && (stcb->asoc.total_output_queue_size)) { ; } else { - if ((locked_tcb != NULL) && (locked_tcb != stcb)) { - /* Very unlikely */ - SCTP_TCB_UNLOCK(locked_tcb); - } *offset = length; - if (stcb) { + if (stcb != NULL) { #if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) so = SCTP_INP_SO(inp); atomic_add_int(&stcb->asoc.refcnt, 1); @@ -4907,12 +4887,9 @@ process_control_chunks: if ((num_chunks > 1) || (length - *offset > (int)SCTP_SIZE32(chk_length))) { *offset = length; - if (locked_tcb) { - SCTP_TCB_UNLOCK(locked_tcb); - } - return (NULL); + return (stcb); } - if ((netp) && (*netp)) { + if ((netp != NULL) && (*netp != NULL)) { ret = sctp_handle_init_ack(m, iphlen, *offset, src, dst, sh, (struct sctp_init_ack_chunk *)ch, @@ -4934,115 +4911,38 @@ process_control_chunks: if ((stcb != NULL) && (ret == 0)) { sctp_chunk_output(stcb->sctp_ep, stcb, SCTP_OUTPUT_FROM_CONTROL_PROC, SCTP_SO_NOT_LOCKED); } - if (locked_tcb) { - SCTP_TCB_UNLOCK(locked_tcb); - } - return (NULL); + return (stcb); break; case SCTP_SELECTIVE_ACK: - { - struct sctp_sack_chunk *sack; - int abort_now = 0; - uint32_t a_rwnd, cum_ack; - uint16_t num_seg, num_dup; - uint8_t flags; - int offset_seg, offset_dup; - - SCTPDBG(SCTP_DEBUG_INPUT3, "SCTP_SACK\n"); - SCTP_STAT_INCR(sctps_recvsacks); - if (stcb == NULL) { - SCTPDBG(SCTP_DEBUG_INDATA1, "No stcb when processing SACK chunk\n"); - break; - } - if (chk_length < sizeof(struct sctp_sack_chunk)) { - SCTPDBG(SCTP_DEBUG_INDATA1, "Bad size on SACK chunk, too small\n"); - break; - } - if (SCTP_GET_STATE(&stcb->asoc) == SCTP_STATE_SHUTDOWN_ACK_SENT) { - /*- - * If we have sent a shutdown-ack, we will pay no - * attention to a sack sent in to us since - * we don't care anymore. - */ - break; - } - sack = (struct sctp_sack_chunk *)ch; - flags = ch->chunk_flags; - cum_ack = ntohl(sack->sack.cum_tsn_ack); - num_seg = ntohs(sack->sack.num_gap_ack_blks); - num_dup = ntohs(sack->sack.num_dup_tsns); - a_rwnd = (uint32_t)ntohl(sack->sack.a_rwnd); - if (sizeof(struct sctp_sack_chunk) + - num_seg * sizeof(struct sctp_gap_ack_block) + - num_dup * sizeof(uint32_t) != chk_length) { - SCTPDBG(SCTP_DEBUG_INDATA1, "Bad size of SACK chunk\n"); - break; - } - offset_seg = *offset + sizeof(struct sctp_sack_chunk); - offset_dup = offset_seg + num_seg * sizeof(struct sctp_gap_ack_block); - SCTPDBG(SCTP_DEBUG_INPUT3, "SCTP_SACK process cum_ack:%x num_seg:%d a_rwnd:%d\n", - cum_ack, num_seg, a_rwnd); - stcb->asoc.seen_a_sack_this_pkt = 1; - if ((stcb->asoc.pr_sctp_cnt == 0) && - (num_seg == 0) && - SCTP_TSN_GE(cum_ack, stcb->asoc.last_acked_seq) && - (stcb->asoc.saw_sack_with_frags == 0) && - (stcb->asoc.saw_sack_with_nr_frags == 0) && - (!TAILQ_EMPTY(&stcb->asoc.sent_queue)) - ) { - /* - * We have a SIMPLE sack having no - * prior segments and data on sent - * queue to be acked.. Use the - * faster path sack processing. We - * also allow window update sacks - * with no missing segments to go - * this way too. - */ - sctp_express_handle_sack(stcb, cum_ack, a_rwnd, &abort_now, ecne_seen); - } else { - if (netp && *netp) - sctp_handle_sack(m, offset_seg, offset_dup, stcb, - num_seg, 0, num_dup, &abort_now, flags, - cum_ack, a_rwnd, ecne_seen); - } - if (abort_now) { - /* ABORT signal from sack processing */ - *offset = length; - return (NULL); - } - if (TAILQ_EMPTY(&stcb->asoc.send_queue) && - TAILQ_EMPTY(&stcb->asoc.sent_queue) && - (stcb->asoc.stream_queue_cnt == 0)) { - sctp_ulp_notify(SCTP_NOTIFY_SENDER_DRY, stcb, 0, NULL, SCTP_SO_NOT_LOCKED); - } - } - break; - /* - * EY - nr_sack: If the received chunk is an - * nr_sack chunk - */ case SCTP_NR_SELECTIVE_ACK: { - struct sctp_nr_sack_chunk *nr_sack; int abort_now = 0; uint32_t a_rwnd, cum_ack; uint16_t num_seg, num_nr_seg, num_dup; uint8_t flags; int offset_seg, offset_dup; - SCTPDBG(SCTP_DEBUG_INPUT3, "SCTP_NR_SACK\n"); + SCTPDBG(SCTP_DEBUG_INPUT3, "%s\n", + ch->chunk_type == SCTP_SELECTIVE_ACK ? "SCTP_SACK" : "SCTP_NR_SACK"); SCTP_STAT_INCR(sctps_recvsacks); if (stcb == NULL) { - SCTPDBG(SCTP_DEBUG_INDATA1, "No stcb when processing NR-SACK chunk\n"); + SCTPDBG(SCTP_DEBUG_INDATA1, "No stcb when processing %s chunk\n", + (ch->chunk_type == SCTP_SELECTIVE_ACK) ? "SCTP_SACK" : "SCTP_NR_SACK"); break; } - if (stcb->asoc.nrsack_supported == 0) { - goto unknown_chunk; - } - if (chk_length < sizeof(struct sctp_nr_sack_chunk)) { - SCTPDBG(SCTP_DEBUG_INDATA1, "Bad size on NR-SACK chunk, too small\n"); - break; + if (ch->chunk_type == SCTP_SELECTIVE_ACK) { + if (chk_length < sizeof(struct sctp_sack_chunk)) { + SCTPDBG(SCTP_DEBUG_INDATA1, "Bad size on SACK chunk, too small\n"); + break; + } + } else { + if (stcb->asoc.nrsack_supported == 0) { + goto unknown_chunk; + } + if (chk_length < sizeof(struct sctp_nr_sack_chunk)) { + SCTPDBG(SCTP_DEBUG_INDATA1, "Bad size on NR_SACK chunk, too small\n"); + break; + } } if (SCTP_GET_STATE(&stcb->asoc) == SCTP_STATE_SHUTDOWN_ACK_SENT) { /*- @@ -5052,22 +4952,44 @@ process_control_chunks: */ break; } - nr_sack = (struct sctp_nr_sack_chunk *)ch; flags = ch->chunk_flags; - cum_ack = ntohl(nr_sack->nr_sack.cum_tsn_ack); - num_seg = ntohs(nr_sack->nr_sack.num_gap_ack_blks); - num_nr_seg = ntohs(nr_sack->nr_sack.num_nr_gap_ack_blks); - num_dup = ntohs(nr_sack->nr_sack.num_dup_tsns); - a_rwnd = (uint32_t)ntohl(nr_sack->nr_sack.a_rwnd); - if (sizeof(struct sctp_nr_sack_chunk) + - (num_seg + num_nr_seg) * sizeof(struct sctp_gap_ack_block) + - num_dup * sizeof(uint32_t) != chk_length) { - SCTPDBG(SCTP_DEBUG_INDATA1, "Bad size of NR_SACK chunk\n"); - break; + if (ch->chunk_type == SCTP_SELECTIVE_ACK) { + struct sctp_sack_chunk *sack; + + sack = (struct sctp_sack_chunk *)ch; + cum_ack = ntohl(sack->sack.cum_tsn_ack); + num_seg = ntohs(sack->sack.num_gap_ack_blks); + num_nr_seg = 0; + num_dup = ntohs(sack->sack.num_dup_tsns); + a_rwnd = ntohl(sack->sack.a_rwnd); + if (sizeof(struct sctp_sack_chunk) + + num_seg * sizeof(struct sctp_gap_ack_block) + + num_dup * sizeof(uint32_t) != chk_length) { + SCTPDBG(SCTP_DEBUG_INDATA1, "Bad size of SACK chunk\n"); + break; + } + offset_seg = *offset + sizeof(struct sctp_sack_chunk); + offset_dup = offset_seg + num_seg * sizeof(struct sctp_gap_ack_block); + } else { + struct sctp_nr_sack_chunk *nr_sack; + + nr_sack = (struct sctp_nr_sack_chunk *)ch; + cum_ack = ntohl(nr_sack->nr_sack.cum_tsn_ack); + num_seg = ntohs(nr_sack->nr_sack.num_gap_ack_blks); + num_nr_seg = ntohs(nr_sack->nr_sack.num_nr_gap_ack_blks); + num_dup = ntohs(nr_sack->nr_sack.num_dup_tsns); + a_rwnd = ntohl(nr_sack->nr_sack.a_rwnd); + if (sizeof(struct sctp_nr_sack_chunk) + + (num_seg + num_nr_seg) * sizeof(struct sctp_gap_ack_block) + + num_dup * sizeof(uint32_t) != chk_length) { + SCTPDBG(SCTP_DEBUG_INDATA1, "Bad size of NR_SACK chunk\n"); + break; + } + offset_seg = *offset + sizeof(struct sctp_nr_sack_chunk); + offset_dup = offset_seg + (num_seg + num_nr_seg) * sizeof(struct sctp_gap_ack_block); } - offset_seg = *offset + sizeof(struct sctp_nr_sack_chunk); - offset_dup = offset_seg + num_seg * sizeof(struct sctp_gap_ack_block); - SCTPDBG(SCTP_DEBUG_INPUT3, "SCTP_NR_SACK process cum_ack:%x num_seg:%d a_rwnd:%d\n", + SCTPDBG(SCTP_DEBUG_INPUT3, "%s process cum_ack:%x num_seg:%d a_rwnd:%d\n", + (ch->chunk_type == SCTP_SELECTIVE_ACK) ? "SCTP_SACK" : "SCTP_NR_SACK", cum_ack, num_seg, a_rwnd); stcb->asoc.seen_a_sack_this_pkt = 1; if ((stcb->asoc.pr_sctp_cnt == 0) && @@ -5088,10 +5010,11 @@ process_control_chunks: sctp_express_handle_sack(stcb, cum_ack, a_rwnd, &abort_now, ecne_seen); } else { - if (netp && *netp) + if ((netp != NULL) && (*netp != NULL)) { sctp_handle_sack(m, offset_seg, offset_dup, stcb, num_seg, num_nr_seg, num_dup, &abort_now, flags, cum_ack, a_rwnd, ecne_seen); + } } if (abort_now) { /* ABORT signal from sack processing */ @@ -5103,71 +5026,51 @@ process_control_chunks: (stcb->asoc.stream_queue_cnt == 0)) { sctp_ulp_notify(SCTP_NOTIFY_SENDER_DRY, stcb, 0, NULL, SCTP_SO_NOT_LOCKED); } + break; } - break; - case SCTP_HEARTBEAT_REQUEST: SCTPDBG(SCTP_DEBUG_INPUT3, "SCTP_HEARTBEAT\n"); - if ((stcb) && netp && *netp) { + if ((stcb != NULL) && (netp != NULL) && (*netp != NULL)) { SCTP_STAT_INCR(sctps_recvheartbeat); sctp_send_heartbeat_ack(stcb, m, *offset, chk_length, *netp); - - /* He's alive so give him credit */ - if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_THRESHOLD_LOGGING) { - sctp_misc_ints(SCTP_THRESHOLD_CLEAR, - stcb->asoc.overall_error_count, - 0, - SCTP_FROM_SCTP_INPUT, - __LINE__); - } - stcb->asoc.overall_error_count = 0; } break; case SCTP_HEARTBEAT_ACK: - SCTPDBG(SCTP_DEBUG_INPUT3, "SCTP_HEARTBEAT-ACK\n"); + SCTPDBG(SCTP_DEBUG_INPUT3, "SCTP_HEARTBEAT_ACK\n"); if ((stcb == NULL) || (chk_length != sizeof(struct sctp_heartbeat_chunk))) { /* Its not ours */ *offset = length; - if (locked_tcb) { - SCTP_TCB_UNLOCK(locked_tcb); - } - return (NULL); - } - /* He's alive so give him credit */ - if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_THRESHOLD_LOGGING) { - sctp_misc_ints(SCTP_THRESHOLD_CLEAR, - stcb->asoc.overall_error_count, - 0, - SCTP_FROM_SCTP_INPUT, - __LINE__); + return (stcb); } - stcb->asoc.overall_error_count = 0; SCTP_STAT_INCR(sctps_recvheartbeatack); - if (netp && *netp) + if ((netp != NULL) && (*netp != NULL)) { sctp_handle_heartbeat_ack((struct sctp_heartbeat_chunk *)ch, stcb, *netp); + } break; case SCTP_ABORT_ASSOCIATION: SCTPDBG(SCTP_DEBUG_INPUT3, "SCTP_ABORT, stcb %p\n", (void *)stcb); - if ((stcb) && netp && *netp) - sctp_handle_abort((struct sctp_abort_chunk *)ch, - stcb, *netp); *offset = length; - return (NULL); + if ((stcb != NULL) && (netp != NULL) && (*netp != NULL)) { + if (sctp_handle_abort((struct sctp_abort_chunk *)ch, stcb, *netp)) { + return (NULL); + } else { + return (stcb); + } + } else { + return (NULL); + } break; case SCTP_SHUTDOWN: SCTPDBG(SCTP_DEBUG_INPUT3, "SCTP_SHUTDOWN, stcb %p\n", (void *)stcb); if ((stcb == NULL) || (chk_length != sizeof(struct sctp_shutdown_chunk))) { *offset = length; - if (locked_tcb) { - SCTP_TCB_UNLOCK(locked_tcb); - } - return (NULL); + return (stcb); } - if (netp && *netp) { + if ((netp != NULL) && (*netp != NULL)) { int abort_flag = 0; sctp_handle_shutdown((struct sctp_shutdown_chunk *)ch, @@ -5179,30 +5082,31 @@ process_control_chunks: } break; case SCTP_SHUTDOWN_ACK: - SCTPDBG(SCTP_DEBUG_INPUT3, "SCTP_SHUTDOWN-ACK, stcb %p\n", (void *)stcb); - if ((stcb) && (netp) && (*netp)) + SCTPDBG(SCTP_DEBUG_INPUT3, "SCTP_SHUTDOWN_ACK, stcb %p\n", (void *)stcb); + if ((stcb != NULL) && (netp != NULL) && (*netp != NULL)) { sctp_handle_shutdown_ack((struct sctp_shutdown_ack_chunk *)ch, stcb, *netp); + } *offset = length; return (NULL); break; - case SCTP_OPERATION_ERROR: - SCTPDBG(SCTP_DEBUG_INPUT3, "SCTP_OP-ERR\n"); - if ((stcb) && netp && *netp && sctp_handle_error(ch, stcb, *netp) < 0) { + SCTPDBG(SCTP_DEBUG_INPUT3, "SCTP_OP_ERR\n"); + if ((stcb != NULL) && (netp != NULL) && (*netp != NULL) && + sctp_handle_error(ch, stcb, *netp, contiguous) < 0) { *offset = length; return (NULL); } break; case SCTP_COOKIE_ECHO: SCTPDBG(SCTP_DEBUG_INPUT3, - "SCTP_COOKIE-ECHO, stcb %p\n", (void *)stcb); - if ((stcb) && (stcb->asoc.total_output_queue_size)) { + "SCTP_COOKIE_ECHO, stcb %p\n", (void *)stcb); + if ((stcb != NULL) && (stcb->asoc.total_output_queue_size > 0)) { ; } else { if (inp->sctp_flags & SCTP_PCB_FLAGS_SOCKET_GONE) { /* We are not interested anymore */ abend: - if (stcb) { + if (stcb != NULL) { SCTP_TCB_UNLOCK(stcb); } *offset = length; @@ -5250,7 +5154,7 @@ process_control_chunks: linp = inp; } - if (linp) { + if (linp != NULL) { SCTP_ASOC_CREATE_LOCK(linp); if ((inp->sctp_flags & SCTP_PCB_FLAGS_SOCKET_GONE) || (inp->sctp_flags & SCTP_PCB_FLAGS_SOCKET_ALLGONE)) { @@ -5258,7 +5162,10 @@ process_control_chunks: goto abend; } } - if (netp) { + if (netp != NULL) { + struct sctp_tcb *locked_stcb; + + locked_stcb = stcb; ret_buf = sctp_handle_cookie_echo(m, iphlen, *offset, @@ -5269,20 +5176,26 @@ process_control_chunks: auth_skipped, auth_offset, auth_len, - &locked_tcb, + &locked_stcb, mflowtype, mflowid, vrf_id, port); + if ((locked_stcb != NULL) && (locked_stcb != stcb)) { + SCTP_TCB_UNLOCK(locked_stcb); + } + if (stcb != NULL) { + SCTP_TCB_LOCK_ASSERT(stcb); + } } else { ret_buf = NULL; } - if (linp) { + if (linp != NULL) { SCTP_ASOC_CREATE_UNLOCK(linp); } if (ret_buf == NULL) { - if (locked_tcb) { - SCTP_TCB_UNLOCK(locked_tcb); + if (stcb != NULL) { + SCTP_TCB_UNLOCK(stcb); } SCTPDBG(SCTP_DEBUG_INPUT3, "GAK, null buffer\n"); @@ -5307,12 +5220,9 @@ process_control_chunks: } break; case SCTP_COOKIE_ACK: - SCTPDBG(SCTP_DEBUG_INPUT3, "SCTP_COOKIE-ACK, stcb %p\n", (void *)stcb); + SCTPDBG(SCTP_DEBUG_INPUT3, "SCTP_COOKIE_ACK, stcb %p\n", (void *)stcb); if ((stcb == NULL) || chk_length != sizeof(struct sctp_cookie_ack_chunk)) { - if (locked_tcb) { - SCTP_TCB_UNLOCK(locked_tcb); - } - return (NULL); + return (stcb); } if (inp->sctp_flags & SCTP_PCB_FLAGS_SOCKET_GONE) { /* We are not interested anymore */ @@ -5336,85 +5246,43 @@ process_control_chunks: return (NULL); } } - /* He's alive so give him credit */ - if ((stcb) && netp && *netp) { - if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_THRESHOLD_LOGGING) { - sctp_misc_ints(SCTP_THRESHOLD_CLEAR, - stcb->asoc.overall_error_count, - 0, - SCTP_FROM_SCTP_INPUT, - __LINE__); - } - stcb->asoc.overall_error_count = 0; + if ((netp != NULL) && (*netp != NULL)) { sctp_handle_cookie_ack((struct sctp_cookie_ack_chunk *)ch, stcb, *netp); } break; case SCTP_ECN_ECHO: - SCTPDBG(SCTP_DEBUG_INPUT3, "SCTP_ECN-ECHO\n"); - /* He's alive so give him credit */ + SCTPDBG(SCTP_DEBUG_INPUT3, "SCTP_ECN_ECHO\n"); if ((stcb == NULL) || (chk_length != sizeof(struct sctp_ecne_chunk))) { /* Its not ours */ - if (locked_tcb) { - SCTP_TCB_UNLOCK(locked_tcb); - } *offset = length; - return (NULL); + return (stcb); } - if (stcb) { - if (stcb->asoc.ecn_supported == 0) { - goto unknown_chunk; - } - if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_THRESHOLD_LOGGING) { - sctp_misc_ints(SCTP_THRESHOLD_CLEAR, - stcb->asoc.overall_error_count, - 0, - SCTP_FROM_SCTP_INPUT, - __LINE__); - } - stcb->asoc.overall_error_count = 0; - sctp_handle_ecn_echo((struct sctp_ecne_chunk *)ch, - stcb); - ecne_seen = 1; + if (stcb->asoc.ecn_supported == 0) { + goto unknown_chunk; } + sctp_handle_ecn_echo((struct sctp_ecne_chunk *)ch, stcb); + ecne_seen = 1; break; case SCTP_ECN_CWR: - SCTPDBG(SCTP_DEBUG_INPUT3, "SCTP_ECN-CWR\n"); - /* He's alive so give him credit */ + SCTPDBG(SCTP_DEBUG_INPUT3, "SCTP_ECN_CWR\n"); if ((stcb == NULL) || (chk_length != sizeof(struct sctp_cwr_chunk))) { - /* Its not ours */ - if (locked_tcb) { - SCTP_TCB_UNLOCK(locked_tcb); - } *offset = length; - return (NULL); + return (stcb); } - if (stcb) { - if (stcb->asoc.ecn_supported == 0) { - goto unknown_chunk; - } - if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_THRESHOLD_LOGGING) { - sctp_misc_ints(SCTP_THRESHOLD_CLEAR, - stcb->asoc.overall_error_count, - 0, - SCTP_FROM_SCTP_INPUT, - __LINE__); - } - stcb->asoc.overall_error_count = 0; - sctp_handle_ecn_cwr((struct sctp_cwr_chunk *)ch, stcb, *netp); + if (stcb->asoc.ecn_supported == 0) { + goto unknown_chunk; } + sctp_handle_ecn_cwr((struct sctp_cwr_chunk *)ch, stcb, *netp); break; case SCTP_SHUTDOWN_COMPLETE: - SCTPDBG(SCTP_DEBUG_INPUT3, "SCTP_SHUTDOWN-COMPLETE, stcb %p\n", (void *)stcb); + SCTPDBG(SCTP_DEBUG_INPUT3, "SCTP_SHUTDOWN_COMPLETE, stcb %p\n", (void *)stcb); /* must be first and only chunk */ if ((num_chunks > 1) || (length - *offset > (int)SCTP_SIZE32(chk_length))) { *offset = length; - if (locked_tcb) { - SCTP_TCB_UNLOCK(locked_tcb); - } - return (NULL); + return (stcb); } - if ((stcb) && netp && *netp) { + if ((stcb != NULL) && (netp != NULL) && (*netp != NULL)) { sctp_handle_shutdown_complete((struct sctp_shutdown_complete_chunk *)ch, stcb, *netp); } @@ -5423,35 +5291,23 @@ process_control_chunks: break; case SCTP_ASCONF: SCTPDBG(SCTP_DEBUG_INPUT3, "SCTP_ASCONF\n"); - /* He's alive so give him credit */ - if (stcb) { + if (stcb != NULL) { if (stcb->asoc.asconf_supported == 0) { goto unknown_chunk; } - if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_THRESHOLD_LOGGING) { - sctp_misc_ints(SCTP_THRESHOLD_CLEAR, - stcb->asoc.overall_error_count, - 0, - SCTP_FROM_SCTP_INPUT, - __LINE__); - } - stcb->asoc.overall_error_count = 0; sctp_handle_asconf(m, *offset, src, (struct sctp_asconf_chunk *)ch, stcb, asconf_cnt == 0); asconf_cnt++; } break; case SCTP_ASCONF_ACK: - SCTPDBG(SCTP_DEBUG_INPUT3, "SCTP_ASCONF-ACK\n"); + SCTPDBG(SCTP_DEBUG_INPUT3, "SCTP_ASCONF_ACK\n"); if (chk_length < sizeof(struct sctp_asconf_ack_chunk)) { /* Its not ours */ - if (locked_tcb) { - SCTP_TCB_UNLOCK(locked_tcb); - } *offset = length; - return (NULL); + return (stcb); } - if ((stcb) && netp && *netp) { + if ((stcb != NULL) && (netp != NULL) && (*netp != NULL)) { if (stcb->asoc.asconf_supported == 0) { goto unknown_chunk; } @@ -5472,30 +5328,18 @@ process_control_chunks: break; case SCTP_FORWARD_CUM_TSN: case SCTP_IFORWARD_CUM_TSN: - SCTPDBG(SCTP_DEBUG_INPUT3, "SCTP_FWD-TSN\n"); + SCTPDBG(SCTP_DEBUG_INPUT3, "SCTP_FWD_TSN\n"); if (chk_length < sizeof(struct sctp_forward_tsn_chunk)) { /* Its not ours */ - if (locked_tcb) { - SCTP_TCB_UNLOCK(locked_tcb); - } *offset = length; - return (NULL); + return (stcb); } - /* He's alive so give him credit */ - if (stcb) { + if (stcb != NULL) { int abort_flag = 0; if (stcb->asoc.prsctp_supported == 0) { goto unknown_chunk; } - stcb->asoc.overall_error_count = 0; - if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_THRESHOLD_LOGGING) { - sctp_misc_ints(SCTP_THRESHOLD_CLEAR, - stcb->asoc.overall_error_count, - 0, - SCTP_FROM_SCTP_INPUT, - __LINE__); - } *fwd_tsn_seen = 1; if (inp->sctp_flags & SCTP_PCB_FLAGS_SOCKET_GONE) { /* We are not interested anymore */ @@ -5525,28 +5369,15 @@ process_control_chunks: if (abort_flag) { *offset = length; return (NULL); - } else { - if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_THRESHOLD_LOGGING) { - sctp_misc_ints(SCTP_THRESHOLD_CLEAR, - stcb->asoc.overall_error_count, - 0, - SCTP_FROM_SCTP_INPUT, - __LINE__); - } - stcb->asoc.overall_error_count = 0; } - } break; case SCTP_STREAM_RESET: SCTPDBG(SCTP_DEBUG_INPUT3, "SCTP_STREAM_RESET\n"); if (((stcb == NULL) || (ch == NULL) || (chk_length < sizeof(struct sctp_stream_reset_tsn_req)))) { /* Its not ours */ - if (locked_tcb) { - SCTP_TCB_UNLOCK(locked_tcb); - } *offset = length; - return (NULL); + return (stcb); } if (stcb->asoc.reconfig_supported == 0) { goto unknown_chunk; @@ -5562,20 +5393,16 @@ process_control_chunks: /* re-get it all please */ if (chk_length < sizeof(struct sctp_pktdrop_chunk)) { /* Its not ours */ - if (locked_tcb) { - SCTP_TCB_UNLOCK(locked_tcb); - } *offset = length; - return (NULL); + return (stcb); } - if (ch && (stcb) && netp && (*netp)) { + if ((ch != NULL) && (stcb != NULL) && (netp != NULL) && (*netp != NULL)) { if (stcb->asoc.pktdrop_supported == 0) { goto unknown_chunk; } sctp_handle_packet_dropped((struct sctp_pktdrop_chunk *)ch, stcb, *netp, - min(chk_length, (sizeof(chunk_buf) - 4))); - + min(chk_length, contiguous)); } break; case SCTP_AUTHENTICATION: @@ -5597,11 +5424,8 @@ process_control_chunks: (chk_length > (sizeof(struct sctp_auth_chunk) + SCTP_AUTH_DIGEST_LEN_MAX))) { /* Its not ours */ - if (locked_tcb) { - SCTP_TCB_UNLOCK(locked_tcb); - } *offset = length; - return (NULL); + return (stcb); } if (got_auth == 1) { /* skip this chunk... it's already auth'd */ @@ -5666,15 +5490,12 @@ next_chunk: ch = (struct sctp_chunkhdr *)sctp_m_getptr(m, *offset, sizeof(struct sctp_chunkhdr), chunk_buf); if (ch == NULL) { - if (locked_tcb) { - SCTP_TCB_UNLOCK(locked_tcb); - } *offset = length; - return (NULL); + return (stcb); } } /* while */ - if (asconf_cnt > 0 && stcb != NULL) { + if ((asconf_cnt > 0) && (stcb != NULL)) { sctp_send_asconf_ack(stcb); } return (stcb); @@ -5952,14 +5773,6 @@ sctp_common_input_processing(struct mbuf **mm, int iphlen, int offset, int lengt * shows us the cookie-ack was lost. Imply it was * there. */ - if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_THRESHOLD_LOGGING) { - sctp_misc_ints(SCTP_THRESHOLD_CLEAR, - stcb->asoc.overall_error_count, - 0, - SCTP_FROM_SCTP_INPUT, - __LINE__); - } - stcb->asoc.overall_error_count = 0; sctp_handle_cookie_ack((struct sctp_cookie_ack_chunk *)ch, stcb, net); break; case SCTP_STATE_COOKIE_WAIT: diff --git a/freebsd/sys/netinet/sctp_input.h b/freebsd/sys/netinet/sctp_input.h index 25df0f3b..ff0916e7 100644 --- a/freebsd/sys/netinet/sctp_input.h +++ b/freebsd/sys/netinet/sctp_input.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 2001-2007, by Cisco Systems, Inc. All rights reserved. * Copyright (c) 2008-2012, by Randall Stewart. All rights reserved. * Copyright (c) 2008-2012, by Michael Tuexen. All rights reserved. diff --git a/freebsd/sys/netinet/sctp_lock_bsd.h b/freebsd/sys/netinet/sctp_lock_bsd.h index 96e35214..a92d5f2b 100644 --- a/freebsd/sys/netinet/sctp_lock_bsd.h +++ b/freebsd/sys/netinet/sctp_lock_bsd.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 2001-2007, by Cisco Systems, Inc. All rights reserved. * Copyright (c) 2008-2012, by Randall Stewart. All rights reserved. * Copyright (c) 2008-2012, by Michael Tuexen. All rights reserved. diff --git a/freebsd/sys/netinet/sctp_os.h b/freebsd/sys/netinet/sctp_os.h index dc6049b6..57ab6d79 100644 --- a/freebsd/sys/netinet/sctp_os.h +++ b/freebsd/sys/netinet/sctp_os.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 2006-2007, by Cisco Systems, Inc. All rights reserved. * Copyright (c) 2008-2012, by Randall Stewart. All rights reserved. * Copyright (c) 2008-2012, by Michael Tuexen. All rights reserved. diff --git a/freebsd/sys/netinet/sctp_os_bsd.h b/freebsd/sys/netinet/sctp_os_bsd.h index 045ccc38..c9eaa069 100644 --- a/freebsd/sys/netinet/sctp_os_bsd.h +++ b/freebsd/sys/netinet/sctp_os_bsd.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 2006-2007, by Cisco Systems, Inc. All rights reserved. * Copyright (c) 2008-2012, by Randall Stewart. All rights reserved. * Copyright (c) 2008-2012, by Michael Tuexen. All rights reserved. diff --git a/freebsd/sys/netinet/sctp_output.c b/freebsd/sys/netinet/sctp_output.c index 2540b5b9..bc54ee96 100644 --- a/freebsd/sys/netinet/sctp_output.c +++ b/freebsd/sys/netinet/sctp_output.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 2001-2008, by Cisco Systems, Inc. All rights reserved. * Copyright (c) 2008-2012, by Randall Stewart. All rights reserved. * Copyright (c) 2008-2012, by Michael Tuexen. All rights reserved. @@ -3467,32 +3469,35 @@ static int sctp_find_cmsg(int c_type, void *data, struct mbuf *control, size_t cpsize) { struct cmsghdr cmh; - int tlen, at, found; struct sctp_sndinfo sndinfo; struct sctp_prinfo prinfo; struct sctp_authinfo authinfo; + int tot_len, rem_len, cmsg_data_len, cmsg_data_off, off; + int found; - tlen = SCTP_BUF_LEN(control); - at = 0; - found = 0; /* * Independent of how many mbufs, find the c_type inside the control * structure and copy out the data. */ - while (at < tlen) { - if ((tlen - at) < (int)CMSG_ALIGN(sizeof(cmh))) { + found = 0; + tot_len = SCTP_BUF_LEN(control); + for (off = 0; off < tot_len; off += CMSG_ALIGN(cmh.cmsg_len)) { + rem_len = tot_len - off; + if (rem_len < (int)CMSG_ALIGN(sizeof(cmh))) { /* There is not enough room for one more. */ return (found); } - m_copydata(control, at, sizeof(cmh), (caddr_t)&cmh); + m_copydata(control, off, sizeof(cmh), (caddr_t)&cmh); if (cmh.cmsg_len < CMSG_ALIGN(sizeof(cmh))) { /* We dont't have a complete CMSG header. */ return (found); } - if (((int)cmh.cmsg_len + at) > tlen) { + if ((cmh.cmsg_len > INT_MAX) || ((int)cmh.cmsg_len > rem_len)) { /* We don't have the complete CMSG. */ return (found); } + cmsg_data_len = (int)cmh.cmsg_len - CMSG_ALIGN(sizeof(cmh)); + cmsg_data_off = off + CMSG_ALIGN(sizeof(cmh)); if ((cmh.cmsg_level == IPPROTO_SCTP) && ((c_type == cmh.cmsg_type) || ((c_type == SCTP_SNDRCV) && @@ -3500,11 +3505,14 @@ sctp_find_cmsg(int c_type, void *data, struct mbuf *control, size_t cpsize) (cmh.cmsg_type == SCTP_PRINFO) || (cmh.cmsg_type == SCTP_AUTHINFO))))) { if (c_type == cmh.cmsg_type) { - if ((size_t)(cmh.cmsg_len - CMSG_ALIGN(sizeof(cmh))) < cpsize) { + if (cpsize > INT_MAX) { + return (found); + } + if (cmsg_data_len < (int)cpsize) { return (found); } /* It is exactly what we want. Copy it out. */ - m_copydata(control, at + CMSG_ALIGN(sizeof(cmh)), (int)cpsize, (caddr_t)data); + m_copydata(control, cmsg_data_off, (int)cpsize, (caddr_t)data); return (1); } else { struct sctp_sndrcvinfo *sndrcvinfo; @@ -3518,10 +3526,10 @@ sctp_find_cmsg(int c_type, void *data, struct mbuf *control, size_t cpsize) } switch (cmh.cmsg_type) { case SCTP_SNDINFO: - if ((size_t)(cmh.cmsg_len - CMSG_ALIGN(sizeof(cmh))) < sizeof(struct sctp_sndinfo)) { + if (cmsg_data_len < (int)sizeof(struct sctp_sndinfo)) { return (found); } - m_copydata(control, at + CMSG_ALIGN(sizeof(cmh)), sizeof(struct sctp_sndinfo), (caddr_t)&sndinfo); + m_copydata(control, cmsg_data_off, sizeof(struct sctp_sndinfo), (caddr_t)&sndinfo); sndrcvinfo->sinfo_stream = sndinfo.snd_sid; sndrcvinfo->sinfo_flags = sndinfo.snd_flags; sndrcvinfo->sinfo_ppid = sndinfo.snd_ppid; @@ -3529,10 +3537,10 @@ sctp_find_cmsg(int c_type, void *data, struct mbuf *control, size_t cpsize) sndrcvinfo->sinfo_assoc_id = sndinfo.snd_assoc_id; break; case SCTP_PRINFO: - if ((size_t)(cmh.cmsg_len - CMSG_ALIGN(sizeof(cmh))) < sizeof(struct sctp_prinfo)) { + if (cmsg_data_len < (int)sizeof(struct sctp_prinfo)) { return (found); } - m_copydata(control, at + CMSG_ALIGN(sizeof(cmh)), sizeof(struct sctp_prinfo), (caddr_t)&prinfo); + m_copydata(control, cmsg_data_off, sizeof(struct sctp_prinfo), (caddr_t)&prinfo); if (prinfo.pr_policy != SCTP_PR_SCTP_NONE) { sndrcvinfo->sinfo_timetolive = prinfo.pr_value; } else { @@ -3541,10 +3549,10 @@ sctp_find_cmsg(int c_type, void *data, struct mbuf *control, size_t cpsize) sndrcvinfo->sinfo_flags |= prinfo.pr_policy; break; case SCTP_AUTHINFO: - if ((size_t)(cmh.cmsg_len - CMSG_ALIGN(sizeof(cmh))) < sizeof(struct sctp_authinfo)) { + if (cmsg_data_len < (int)sizeof(struct sctp_authinfo)) { return (found); } - m_copydata(control, at + CMSG_ALIGN(sizeof(cmh)), sizeof(struct sctp_authinfo), (caddr_t)&authinfo); + m_copydata(control, cmsg_data_off, sizeof(struct sctp_authinfo), (caddr_t)&authinfo); sndrcvinfo->sinfo_keynumber_valid = 1; sndrcvinfo->sinfo_keynumber = authinfo.auth_keynumber; break; @@ -3554,7 +3562,6 @@ sctp_find_cmsg(int c_type, void *data, struct mbuf *control, size_t cpsize) found = 1; } } - at += CMSG_ALIGN(cmh.cmsg_len); } return (found); } @@ -4270,12 +4277,8 @@ sctp_lowlevel_chunk_output(struct sctp_inpcb *inp, /* free tempy routes */ RO_RTFREE(ro); } else { - /* - * PMTU check versus smallest asoc MTU goes - * here - */ - if ((ro->ro_rt != NULL) && - (net->ro._s_addr)) { + if ((ro->ro_rt != NULL) && (net->ro._s_addr) && + ((net->dest_state & SCTP_ADDR_NO_PMTUD) == 0)) { uint32_t mtu; mtu = SCTP_GATHER_MTU_FROM_ROUTE(net->ro._s_addr, &net->ro._l_addr.sa, ro->ro_rt); @@ -4632,8 +4635,8 @@ sctp_lowlevel_chunk_output(struct sctp_inpcb *inp, } net->src_addr_selected = 0; } - if ((ro->ro_rt != NULL) && - (net->ro._s_addr)) { + if ((ro->ro_rt != NULL) && (net->ro._s_addr) && + ((net->dest_state & SCTP_ADDR_NO_PMTUD) == 0)) { uint32_t mtu; mtu = SCTP_GATHER_MTU_FROM_ROUTE(net->ro._s_addr, &net->ro._l_addr.sa, ro->ro_rt); @@ -5503,6 +5506,7 @@ sctp_send_initiate_ack(struct sctp_inpcb *inp, struct sctp_tcb *stcb, struct sctp_paramhdr *ph; union sctp_sockstore *over_addr; struct sctp_scoping scp; + struct timeval now; #ifdef INET struct sockaddr_in *dst4 = (struct sockaddr_in *)dst; struct sockaddr_in *src4 = (struct sockaddr_in *)src; @@ -5603,7 +5607,9 @@ do_a_abort: memset(&stc, 0, sizeof(struct sctp_state_cookie)); /* the time I built cookie */ - (void)SCTP_GETTIME_TIMEVAL(&stc.time_entered); + (void)SCTP_GETTIME_TIMEVAL(&now); + stc.time_entered.tv_sec = now.tv_sec; + stc.time_entered.tv_usec = now.tv_usec; /* populate any tie tags */ if (asoc != NULL) { diff --git a/freebsd/sys/netinet/sctp_output.h b/freebsd/sys/netinet/sctp_output.h index 0a5cf10b..e6222e3f 100644 --- a/freebsd/sys/netinet/sctp_output.h +++ b/freebsd/sys/netinet/sctp_output.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 2001-2007, by Cisco Systems, Inc. All rights reserved. * Copyright (c) 2008-2012, by Randall Stewart. All rights reserved. * Copyright (c) 2008-2012, by Michael Tuexen. All rights reserved. diff --git a/freebsd/sys/netinet/sctp_pcb.c b/freebsd/sys/netinet/sctp_pcb.c index 46a91110..cf993d64 100644 --- a/freebsd/sys/netinet/sctp_pcb.c +++ b/freebsd/sys/netinet/sctp_pcb.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 2001-2008, by Cisco Systems, Inc. All rights reserved. * Copyright (c) 2008-2012, by Randall Stewart. All rights reserved. * Copyright (c) 2008-2012, by Michael Tuexen. All rights reserved. @@ -2579,6 +2581,7 @@ sctp_inpcb_alloc(struct socket *so, uint32_t vrf_id) /* number of streams to pre-open on a association */ m->pre_open_stream_count = SCTP_BASE_SYSCTL(sctp_nr_outgoing_streams_default); + m->default_mtu = 0; /* Add adaptation cookie */ m->adaptation_layer_indicator = 0; m->adaptation_layer_indicator_provided = 0; @@ -3946,7 +3949,28 @@ sctp_add_remote_addr(struct sctp_tcb *stcb, struct sockaddr *newaddr, net, 0, stcb->asoc.vrf_id); - if (net->ro._s_addr != NULL) { + if (stcb->asoc.default_mtu > 0) { + net->mtu = stcb->asoc.default_mtu; + switch (net->ro._l_addr.sa.sa_family) { +#ifdef INET + case AF_INET: + net->mtu += SCTP_MIN_V4_OVERHEAD; + break; +#endif +#ifdef INET6 + case AF_INET6: + net->mtu += SCTP_MIN_OVERHEAD; + break; +#endif + default: + break; + } +#if defined(INET) || defined(INET6) + if (net->port) { + net->mtu += (uint32_t)sizeof(struct udphdr); + } +#endif + } else if (net->ro._s_addr != NULL) { uint32_t imtu, rmtu, hcmtu; net->src_addr_selected = 1; @@ -3970,19 +3994,42 @@ sctp_add_remote_addr(struct sctp_tcb *stcb, struct sockaddr *newaddr, } } if (net->mtu == 0) { - switch (newaddr->sa_family) { + if (stcb->asoc.default_mtu > 0) { + net->mtu = stcb->asoc.default_mtu; + switch (net->ro._l_addr.sa.sa_family) { #ifdef INET - case AF_INET: - net->mtu = SCTP_DEFAULT_MTU; - break; + case AF_INET: + net->mtu += SCTP_MIN_V4_OVERHEAD; + break; #endif #ifdef INET6 - case AF_INET6: - net->mtu = 1280; - break; + case AF_INET6: + net->mtu += SCTP_MIN_OVERHEAD; + break; #endif - default: - break; + default: + break; + } +#if defined(INET) || defined(INET6) + if (net->port) { + net->mtu += (uint32_t)sizeof(struct udphdr); + } +#endif + } else { + switch (newaddr->sa_family) { +#ifdef INET + case AF_INET: + net->mtu = SCTP_DEFAULT_MTU; + break; +#endif +#ifdef INET6 + case AF_INET6: + net->mtu = 1280; + break; +#endif + default: + break; + } } } #if defined(INET) || defined(INET6) diff --git a/freebsd/sys/netinet/sctp_pcb.h b/freebsd/sys/netinet/sctp_pcb.h index acc68311..3fc03399 100644 --- a/freebsd/sys/netinet/sctp_pcb.h +++ b/freebsd/sys/netinet/sctp_pcb.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 2001-2007, by Cisco Systems, Inc. All rights reserved. * Copyright (c) 2008-2012, by Randall Stewart. All rights reserved. * Copyright (c) 2008-2012, by Michael Tuexen. All rights reserved. @@ -287,6 +289,7 @@ struct sctp_pcb { sctp_auth_chklist_t *local_auth_chunks; sctp_hmaclist_t *local_hmacs; uint16_t default_keyid; + uint32_t default_mtu; /* various thresholds */ /* Max times I will init at a guy */ diff --git a/freebsd/sys/netinet/sctp_peeloff.c b/freebsd/sys/netinet/sctp_peeloff.c index 3603e41a..ad96b88c 100644 --- a/freebsd/sys/netinet/sctp_peeloff.c +++ b/freebsd/sys/netinet/sctp_peeloff.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 2001-2007, by Cisco Systems, Inc. All rights reserved. * Copyright (c) 2008-2012, by Randall Stewart. All rights reserved. * Copyright (c) 2008-2012, by Michael Tuexen. All rights reserved. diff --git a/freebsd/sys/netinet/sctp_peeloff.h b/freebsd/sys/netinet/sctp_peeloff.h index 00b87031..478b1995 100644 --- a/freebsd/sys/netinet/sctp_peeloff.h +++ b/freebsd/sys/netinet/sctp_peeloff.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 2001-2007, by Cisco Systems, Inc. All rights reserved. * Copyright (c) 2008-2012, by Randall Stewart. All rights reserved. * Copyright (c) 2008-2012, by Michael Tuexen. All rights reserved. diff --git a/freebsd/sys/netinet/sctp_structs.h b/freebsd/sys/netinet/sctp_structs.h index f7371748..d60705b4 100644 --- a/freebsd/sys/netinet/sctp_structs.h +++ b/freebsd/sys/netinet/sctp_structs.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 2001-2008, by Cisco Systems, Inc. All rights reserved. * Copyright (c) 2008-2012, by Randall Stewart. All rights reserved. * Copyright (c) 2008-2012, by Michael Tuexen. All rights reserved. @@ -1098,6 +1100,7 @@ struct sctp_association { uint32_t chunks_on_out_queue; /* total chunks floating around, * locked by send socket buffer */ uint32_t peers_adaptation; + uint32_t default_mtu; uint16_t peer_hmac_id; /* peer HMAC id to send */ /* diff --git a/freebsd/sys/netinet/sctp_sysctl.c b/freebsd/sys/netinet/sctp_sysctl.c index 52361602..8259140f 100644 --- a/freebsd/sys/netinet/sctp_sysctl.c +++ b/freebsd/sys/netinet/sctp_sysctl.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 2007, by Cisco Systems, Inc. All rights reserved. * Copyright (c) 2008-2012, by Randall Stewart. All rights reserved. * Copyright (c) 2008-2012, by Michael Tuexen. All rights reserved. diff --git a/freebsd/sys/netinet/sctp_sysctl.h b/freebsd/sys/netinet/sctp_sysctl.h index 959bd1e4..8187ae9e 100644 --- a/freebsd/sys/netinet/sctp_sysctl.h +++ b/freebsd/sys/netinet/sctp_sysctl.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 2007, by Cisco Systems, Inc. All rights reserved. * Copyright (c) 2008-2012, by Randall Stewart. All rights reserved. * Copyright (c) 2008-2012, by Michael Tuexen. All rights reserved. diff --git a/freebsd/sys/netinet/sctp_timer.c b/freebsd/sys/netinet/sctp_timer.c index ecadca5b..c0253840 100644 --- a/freebsd/sys/netinet/sctp_timer.c +++ b/freebsd/sys/netinet/sctp_timer.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 2001-2007, by Cisco Systems, Inc. All rights reserved. * Copyright (c) 2008-2012, by Randall Stewart. All rights reserved. * Copyright (c) 2008-2012, by Michael Tuexen. All rights reserved. diff --git a/freebsd/sys/netinet/sctp_timer.h b/freebsd/sys/netinet/sctp_timer.h index 6d409cdc..d58fbaa9 100644 --- a/freebsd/sys/netinet/sctp_timer.h +++ b/freebsd/sys/netinet/sctp_timer.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 2001-2007, by Cisco Systems, Inc. All rights reserved. * Copyright (c) 2008-2012, by Randall Stewart. All rights reserved. * Copyright (c) 2008-2012, by Michael Tuexen. All rights reserved. diff --git a/freebsd/sys/netinet/sctp_uio.h b/freebsd/sys/netinet/sctp_uio.h index daa6847d..93274a70 100644 --- a/freebsd/sys/netinet/sctp_uio.h +++ b/freebsd/sys/netinet/sctp_uio.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 2001-2007, by Cisco Systems, Inc. All rights reserved. * Copyright (c) 2008-2012, by Randall Stewart. All rights reserved. * Copyright (c) 2008-2012, by Michael Tuexen. All rights reserved. diff --git a/freebsd/sys/netinet/sctp_usrreq.c b/freebsd/sys/netinet/sctp_usrreq.c index 6ab04456..05ddee01 100644 --- a/freebsd/sys/netinet/sctp_usrreq.c +++ b/freebsd/sys/netinet/sctp_usrreq.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 2001-2008, by Cisco Systems, Inc. All rights reserved. * Copyright (c) 2008-2012, by Randall Stewart. All rights reserved. * Copyright (c) 2008-2012, by Michael Tuexen. All rights reserved. @@ -204,6 +206,10 @@ sctp_notify(struct sctp_inpcb *inp, #endif /* no need to unlock here, since the TCB is gone */ } else if (icmp_code == ICMP_UNREACH_NEEDFRAG) { + if ((net->dest_state & SCTP_ADDR_NO_PMTUD) == 0) { + SCTP_TCB_UNLOCK(stcb); + return; + } /* Find the next (smaller) MTU */ if (next_mtu == 0) { /* @@ -2414,7 +2420,7 @@ flags_out: #endif #ifdef INET6 case AF_INET6: - paddrp->spp_pathmtu -= SCTP_MIN_V4_OVERHEAD; + paddrp->spp_pathmtu -= SCTP_MIN_OVERHEAD; break; #endif default: @@ -2449,7 +2455,7 @@ flags_out: * value */ paddrp->spp_pathmaxrxt = stcb->asoc.def_net_failure; - paddrp->spp_pathmtu = 0; + paddrp->spp_pathmtu = stcb->asoc.default_mtu; if (stcb->asoc.default_dscp & 0x01) { paddrp->spp_dscp = stcb->asoc.default_dscp & 0xfc; paddrp->spp_flags |= SPP_DSCP; @@ -2496,8 +2502,7 @@ flags_out: paddrp->spp_flags |= SPP_IPV6_FLOWLABEL; } #endif - /* can't return this */ - paddrp->spp_pathmtu = 0; + paddrp->spp_pathmtu = inp->sctp_ep.default_mtu; if (sctp_is_feature_off(inp, SCTP_PCB_FLAGS_DONOT_HEARTBEAT)) { paddrp->spp_flags |= SPP_HB_ENABLE; @@ -5481,6 +5486,7 @@ sctp_setopt(struct socket *so, int optname, void *optval, size_t optsize, sctp_pathmtu_adjustment(stcb, net->mtu); } } + stcb->asoc.default_mtu = paddrp->spp_pathmtu; sctp_stcb_feature_on(inp, stcb, SCTP_PCB_FLAGS_DO_NOT_PMTUD); } if (paddrp->spp_flags & SPP_PMTUD_ENABLE) { @@ -5490,6 +5496,7 @@ sctp_setopt(struct socket *so, int optname, void *optval, size_t optsize, } net->dest_state &= ~SCTP_ADDR_NO_PMTUD; } + stcb->asoc.default_mtu = 0; sctp_stcb_feature_off(inp, stcb, SCTP_PCB_FLAGS_DO_NOT_PMTUD); } if (paddrp->spp_flags & SPP_DSCP) { @@ -5546,8 +5553,12 @@ sctp_setopt(struct socket *so, int optname, void *optval, size_t optsize, sctp_feature_on(inp, SCTP_PCB_FLAGS_DONOT_HEARTBEAT); } if (paddrp->spp_flags & SPP_PMTUD_ENABLE) { + inp->sctp_ep.default_mtu = 0; sctp_feature_off(inp, SCTP_PCB_FLAGS_DO_NOT_PMTUD); } else if (paddrp->spp_flags & SPP_PMTUD_DISABLE) { + if (paddrp->spp_pathmtu >= SCTP_SMALLEST_PMTU) { + inp->sctp_ep.default_mtu = paddrp->spp_pathmtu; + } sctp_feature_on(inp, SCTP_PCB_FLAGS_DO_NOT_PMTUD); } if (paddrp->spp_flags & SPP_DSCP) { diff --git a/freebsd/sys/netinet/sctp_var.h b/freebsd/sys/netinet/sctp_var.h index 9e149e68..84cbfc88 100644 --- a/freebsd/sys/netinet/sctp_var.h +++ b/freebsd/sys/netinet/sctp_var.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 2001-2008, by Cisco Systems, Inc. All rights reserved. * Copyright (c) 2008-2012, by Randall Stewart. All rights reserved. * Copyright (c) 2008-2012, by Michael Tuexen. All rights reserved. diff --git a/freebsd/sys/netinet/sctputil.c b/freebsd/sys/netinet/sctputil.c index f8fd23f1..98c2a708 100644 --- a/freebsd/sys/netinet/sctputil.c +++ b/freebsd/sys/netinet/sctputil.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 2001-2008, by Cisco Systems, Inc. All rights reserved. * Copyright (c) 2008-2012, by Randall Stewart. All rights reserved. * Copyright (c) 2008-2012, by Michael Tuexen. All rights reserved. @@ -1044,6 +1046,7 @@ sctp_init_asoc(struct sctp_inpcb *inp, struct sctp_tcb *stcb, asoc->initial_init_rto_max = inp->sctp_ep.initial_init_rto_max; asoc->initial_rto = inp->sctp_ep.initial_rto; + asoc->default_mtu = inp->sctp_ep.default_mtu; asoc->max_init_times = inp->sctp_ep.max_init_times; asoc->max_send_times = inp->sctp_ep.max_send_times; asoc->def_net_failure = inp->sctp_ep.def_net_failure; @@ -2424,8 +2427,8 @@ uint32_t sctp_calculate_rto(struct sctp_tcb *stcb, struct sctp_association *asoc, struct sctp_nets *net, - struct timeval *told, - int safe, int rtt_from_sack) + struct timeval *old, + int rtt_from_sack) { /*- * given an association and the starting time of the current RTT @@ -2434,19 +2437,8 @@ sctp_calculate_rto(struct sctp_tcb *stcb, int32_t rtt; /* RTT in ms */ uint32_t new_rto; int first_measure = 0; - struct timeval now, then, *old; - - /* Copy it out for sparc64 */ - if (safe == sctp_align_unsafe_makecopy) { - old = &then; - memcpy(&then, told, sizeof(struct timeval)); - } else if (safe == sctp_align_safe_nocopy) { - old = told; - } else { - /* error */ - SCTP_PRINTF("Huh, bad rto calc call\n"); - return (0); - } + struct timeval now; + /************************/ /* 1. calculate new RTT */ /************************/ @@ -4687,14 +4679,14 @@ sctp_release_pr_sctp_chunk(struct sctp_tcb *stcb, struct sctp_tmit_chunk *tp1, stcb->asoc.abandoned_sent[PR_SCTP_POLICY(tp1->flags)]++; stcb->asoc.strmout[sid].abandoned_sent[0]++; #if defined(SCTP_DETAILED_STR_STATS) - stcb->asoc.strmout[stream].abandoned_sent[PR_SCTP_POLICY(tp1->flags)]++; + stcb->asoc.strmout[sid].abandoned_sent[PR_SCTP_POLICY(tp1->flags)]++; #endif } else { stcb->asoc.abandoned_unsent[0]++; stcb->asoc.abandoned_unsent[PR_SCTP_POLICY(tp1->flags)]++; stcb->asoc.strmout[sid].abandoned_unsent[0]++; #if defined(SCTP_DETAILED_STR_STATS) - stcb->asoc.strmout[stream].abandoned_unsent[PR_SCTP_POLICY(tp1->flags)]++; + stcb->asoc.strmout[sid].abandoned_unsent[PR_SCTP_POLICY(tp1->flags)]++; #endif } do { diff --git a/freebsd/sys/netinet/sctputil.h b/freebsd/sys/netinet/sctputil.h index 97b33654..61d34591 100644 --- a/freebsd/sys/netinet/sctputil.h +++ b/freebsd/sys/netinet/sctputil.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 2001-2007, by Cisco Systems, Inc. All rights reserved. * Copyright (c) 2008-2012, by Randall Stewart. All rights reserved. * Copyright (c) 2008-2012, by Michael Tuexen. All rights reserved. @@ -135,7 +137,7 @@ void uint32_t sctp_calculate_rto(struct sctp_tcb *, struct sctp_association *, - struct sctp_nets *, struct timeval *, int, int); + struct sctp_nets *, struct timeval *, int); uint32_t sctp_calculate_len(struct mbuf *); diff --git a/freebsd/sys/netinet/tcp_debug.c b/freebsd/sys/netinet/tcp_debug.c index 8835370b..0036b422 100644 --- a/freebsd/sys/netinet/tcp_debug.c +++ b/freebsd/sys/netinet/tcp_debug.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1982, 1986, 1993 * The Regents of the University of California. * All rights reserved. diff --git a/freebsd/sys/netinet/tcp_debug.h b/freebsd/sys/netinet/tcp_debug.h index aa26c292..a51c15a4 100644 --- a/freebsd/sys/netinet/tcp_debug.h +++ b/freebsd/sys/netinet/tcp_debug.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1982, 1986, 1993 * The Regents of the University of California. All rights reserved. * diff --git a/freebsd/sys/netinet/tcp_fsm.h b/freebsd/sys/netinet/tcp_fsm.h index ddb52084..dcc4a4e8 100644 --- a/freebsd/sys/netinet/tcp_fsm.h +++ b/freebsd/sys/netinet/tcp_fsm.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1982, 1986, 1993 * The Regents of the University of California. * All rights reserved. diff --git a/freebsd/sys/netinet/tcp_hostcache.c b/freebsd/sys/netinet/tcp_hostcache.c index 0452f5db..d1de3f33 100644 --- a/freebsd/sys/netinet/tcp_hostcache.c +++ b/freebsd/sys/netinet/tcp_hostcache.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 2002 Andre Oppermann, Internet Business Solutions AG * All rights reserved. * diff --git a/freebsd/sys/netinet/tcp_hostcache.h b/freebsd/sys/netinet/tcp_hostcache.h index 23a0c673..f4e1013a 100644 --- a/freebsd/sys/netinet/tcp_hostcache.h +++ b/freebsd/sys/netinet/tcp_hostcache.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 2002 Andre Oppermann, Internet Business Solutions AG * All rights reserved. * diff --git a/freebsd/sys/netinet/tcp_input.c b/freebsd/sys/netinet/tcp_input.c index 663b8bc2..b172205d 100644 --- a/freebsd/sys/netinet/tcp_input.c +++ b/freebsd/sys/netinet/tcp_input.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1982, 1986, 1988, 1990, 1993, 1994, 1995 * The Regents of the University of California. All rights reserved. * Copyright (c) 2007-2008,2010 @@ -147,7 +149,6 @@ SYSCTL_INT(_net_inet_tcp, OID_AUTO, delayed_ack, CTLFLAG_VNET | CTLFLAG_RW, "Delay ACK to try and piggyback it onto a data packet"); VNET_DEFINE(int, drop_synfin) = 0; -#define V_drop_synfin VNET(drop_synfin) SYSCTL_INT(_net_inet_tcp, OID_AUTO, drop_synfin, CTLFLAG_VNET | CTLFLAG_RW, &VNET_NAME(drop_synfin), 0, "Drop TCP packets with SYN+FIN set"); @@ -158,7 +159,6 @@ SYSCTL_INT(_net_inet_tcp, OID_AUTO, rfc6675_pipe, CTLFLAG_VNET | CTLFLAG_RW, "Use calculated pipe/in-flight bytes per RFC 6675"); VNET_DEFINE(int, tcp_do_rfc3042) = 1; -#define V_tcp_do_rfc3042 VNET(tcp_do_rfc3042) SYSCTL_INT(_net_inet_tcp, OID_AUTO, rfc3042, CTLFLAG_VNET | CTLFLAG_RW, &VNET_NAME(tcp_do_rfc3042), 0, "Enable RFC 3042 (Limited Transmit)"); @@ -196,13 +196,11 @@ SYSCTL_INT(_net_inet_tcp_ecn, OID_AUTO, maxretries, CTLFLAG_VNET | CTLFLAG_RW, "Max retries before giving up on ECN"); VNET_DEFINE(int, tcp_insecure_syn) = 0; -#define V_tcp_insecure_syn VNET(tcp_insecure_syn) SYSCTL_INT(_net_inet_tcp, OID_AUTO, insecure_syn, CTLFLAG_VNET | CTLFLAG_RW, &VNET_NAME(tcp_insecure_syn), 0, "Follow RFC793 instead of RFC5961 criteria for accepting SYN packets"); VNET_DEFINE(int, tcp_insecure_rst) = 0; -#define V_tcp_insecure_rst VNET(tcp_insecure_rst) SYSCTL_INT(_net_inet_tcp, OID_AUTO, insecure_rst, CTLFLAG_VNET | CTLFLAG_RW, &VNET_NAME(tcp_insecure_rst), 0, "Follow RFC793 instead of RFC5961 criteria for accepting RST packets"); @@ -213,19 +211,16 @@ SYSCTL_INT(_net_inet_tcp, TCPCTL_RECVSPACE, recvspace, CTLFLAG_VNET | CTLFLAG_RW &VNET_NAME(tcp_recvspace), 0, "Initial receive socket buffer size"); VNET_DEFINE(int, tcp_do_autorcvbuf) = 1; -#define V_tcp_do_autorcvbuf VNET(tcp_do_autorcvbuf) SYSCTL_INT(_net_inet_tcp, OID_AUTO, recvbuf_auto, CTLFLAG_VNET | CTLFLAG_RW, &VNET_NAME(tcp_do_autorcvbuf), 0, "Enable automatic receive buffer sizing"); VNET_DEFINE(int, tcp_autorcvbuf_inc) = 16*1024; -#define V_tcp_autorcvbuf_inc VNET(tcp_autorcvbuf_inc) SYSCTL_INT(_net_inet_tcp, OID_AUTO, recvbuf_inc, CTLFLAG_VNET | CTLFLAG_RW, &VNET_NAME(tcp_autorcvbuf_inc), 0, "Incrementor step size of automatic receive buffer"); VNET_DEFINE(int, tcp_autorcvbuf_max) = 2*1024*1024; -#define V_tcp_autorcvbuf_max VNET(tcp_autorcvbuf_max) SYSCTL_INT(_net_inet_tcp, OID_AUTO, recvbuf_max, CTLFLAG_VNET | CTLFLAG_RW, &VNET_NAME(tcp_autorcvbuf_max), 0, "Max size of automatic receive buffer"); diff --git a/freebsd/sys/netinet/tcp_lro.c b/freebsd/sys/netinet/tcp_lro.c index 91d534f1..50481b50 100644 --- a/freebsd/sys/netinet/tcp_lro.c +++ b/freebsd/sys/netinet/tcp_lro.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2007, Myricom Inc. * Copyright (c) 2008, Intel Corporation. * Copyright (c) 2012 The FreeBSD Foundation diff --git a/freebsd/sys/netinet/tcp_lro.h b/freebsd/sys/netinet/tcp_lro.h index e019cd1e..855f4ee4 100644 --- a/freebsd/sys/netinet/tcp_lro.h +++ b/freebsd/sys/netinet/tcp_lro.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2006, Myricom Inc. * Copyright (c) 2008, Intel Corporation. * Copyright (c) 2016 Mellanox Technologies. diff --git a/freebsd/sys/netinet/tcp_offload.c b/freebsd/sys/netinet/tcp_offload.c index 12882225..41302db1 100644 --- a/freebsd/sys/netinet/tcp_offload.c +++ b/freebsd/sys/netinet/tcp_offload.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2012 Chelsio Communications, Inc. * All rights reserved. * diff --git a/freebsd/sys/netinet/tcp_offload.h b/freebsd/sys/netinet/tcp_offload.h index a0523665..8485fa29 100644 --- a/freebsd/sys/netinet/tcp_offload.h +++ b/freebsd/sys/netinet/tcp_offload.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2012 Chelsio Communications, Inc. * All rights reserved. * diff --git a/freebsd/sys/netinet/tcp_output.c b/freebsd/sys/netinet/tcp_output.c index 30ec34de..1cb622ac 100644 --- a/freebsd/sys/netinet/tcp_output.c +++ b/freebsd/sys/netinet/tcp_output.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1982, 1986, 1988, 1990, 1993, 1995 * The Regents of the University of California. All rights reserved. * @@ -104,7 +106,6 @@ SYSCTL_INT(_net_inet_tcp, OID_AUTO, path_mtu_discovery, CTLFLAG_VNET | CTLFLAG_R "Enable Path MTU Discovery"); VNET_DEFINE(int, tcp_do_tso) = 1; -#define V_tcp_do_tso VNET(tcp_do_tso) SYSCTL_INT(_net_inet_tcp, OID_AUTO, tso, CTLFLAG_VNET | CTLFLAG_RW, &VNET_NAME(tcp_do_tso), 0, "Enable TCP Segmentation Offload"); @@ -115,19 +116,16 @@ SYSCTL_INT(_net_inet_tcp, TCPCTL_SENDSPACE, sendspace, CTLFLAG_VNET | CTLFLAG_RW &VNET_NAME(tcp_sendspace), 0, "Initial send socket buffer size"); VNET_DEFINE(int, tcp_do_autosndbuf) = 1; -#define V_tcp_do_autosndbuf VNET(tcp_do_autosndbuf) SYSCTL_INT(_net_inet_tcp, OID_AUTO, sendbuf_auto, CTLFLAG_VNET | CTLFLAG_RW, &VNET_NAME(tcp_do_autosndbuf), 0, "Enable automatic send buffer sizing"); VNET_DEFINE(int, tcp_autosndbuf_inc) = 8*1024; -#define V_tcp_autosndbuf_inc VNET(tcp_autosndbuf_inc) SYSCTL_INT(_net_inet_tcp, OID_AUTO, sendbuf_inc, CTLFLAG_VNET | CTLFLAG_RW, &VNET_NAME(tcp_autosndbuf_inc), 0, "Incrementor step size of automatic send buffer"); VNET_DEFINE(int, tcp_autosndbuf_max) = 2*1024*1024; -#define V_tcp_autosndbuf_max VNET(tcp_autosndbuf_max) SYSCTL_INT(_net_inet_tcp, OID_AUTO, sendbuf_max, CTLFLAG_VNET | CTLFLAG_RW, &VNET_NAME(tcp_autosndbuf_max), 0, "Max size of automatic send buffer"); @@ -529,12 +527,12 @@ after_sack_rexmit: * XXXGL: should there be used sbused() or sbavail()? */ if (V_tcp_do_autosndbuf && so->so_snd.sb_flags & SB_AUTOSIZE) { - int autosndbuf_mod = 0; - if (V_tcp_sendbuf_auto_lowat) - autosndbuf_mod = so->so_snd.sb_lowat; + int lowat; - if ((tp->snd_wnd / 4 * 5) >= so->so_snd.sb_hiwat - autosndbuf_mod && - sbused(&so->so_snd) >= (so->so_snd.sb_hiwat / 8 * 7) - autosndbuf_mod && + lowat = V_tcp_sendbuf_auto_lowat ? so->so_snd.sb_lowat : 0; + if ((tp->snd_wnd / 4 * 5) >= so->so_snd.sb_hiwat - lowat && + sbused(&so->so_snd) >= + (so->so_snd.sb_hiwat / 8 * 7) - lowat && sbused(&so->so_snd) < V_tcp_autosndbuf_max && sendwin >= (sbused(&so->so_snd) - (tp->snd_nxt - tp->snd_una))) { diff --git a/freebsd/sys/netinet/tcp_reass.c b/freebsd/sys/netinet/tcp_reass.c index 4f944cab..dbb61299 100644 --- a/freebsd/sys/netinet/tcp_reass.c +++ b/freebsd/sys/netinet/tcp_reass.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1982, 1986, 1988, 1990, 1993, 1994, 1995 * The Regents of the University of California. All rights reserved. * diff --git a/freebsd/sys/netinet/tcp_sack.c b/freebsd/sys/netinet/tcp_sack.c index 00876890..91c032c8 100644 --- a/freebsd/sys/netinet/tcp_sack.c +++ b/freebsd/sys/netinet/tcp_sack.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1982, 1986, 1988, 1990, 1993, 1994, 1995 * The Regents of the University of California. * All rights reserved. @@ -13,7 +15,7 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 4. Neither the name of the University nor the names of its contributors + * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * @@ -135,19 +137,16 @@ SYSCTL_INT(_net_inet_tcp_sack, OID_AUTO, enable, CTLFLAG_VNET | CTLFLAG_RW, &VNET_NAME(tcp_do_sack), 0, "Enable/Disable TCP SACK support"); VNET_DEFINE(int, tcp_sack_maxholes) = 128; -#define V_tcp_sack_maxholes VNET(tcp_sack_maxholes) SYSCTL_INT(_net_inet_tcp_sack, OID_AUTO, maxholes, CTLFLAG_VNET | CTLFLAG_RW, &VNET_NAME(tcp_sack_maxholes), 0, "Maximum number of TCP SACK holes allowed per connection"); VNET_DEFINE(int, tcp_sack_globalmaxholes) = 65536; -#define V_tcp_sack_globalmaxholes VNET(tcp_sack_globalmaxholes) SYSCTL_INT(_net_inet_tcp_sack, OID_AUTO, globalmaxholes, CTLFLAG_VNET | CTLFLAG_RW, &VNET_NAME(tcp_sack_globalmaxholes), 0, "Global maximum number of TCP SACK holes"); VNET_DEFINE(int, tcp_sack_globalholes) = 0; -#define V_tcp_sack_globalholes VNET(tcp_sack_globalholes) SYSCTL_INT(_net_inet_tcp_sack, OID_AUTO, globalholes, CTLFLAG_VNET | CTLFLAG_RD, &VNET_NAME(tcp_sack_globalholes), 0, "Global number of TCP SACK holes currently allocated"); diff --git a/freebsd/sys/netinet/tcp_seq.h b/freebsd/sys/netinet/tcp_seq.h index cfc1ccf7..ee1e1bfd 100644 --- a/freebsd/sys/netinet/tcp_seq.h +++ b/freebsd/sys/netinet/tcp_seq.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1982, 1986, 1993, 1995 * The Regents of the University of California. All rights reserved. * diff --git a/freebsd/sys/netinet/tcp_subr.c b/freebsd/sys/netinet/tcp_subr.c index dff41275..d9c0b57e 100644 --- a/freebsd/sys/netinet/tcp_subr.c +++ b/freebsd/sys/netinet/tcp_subr.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1982, 1986, 1988, 1990, 1993, 1995 * The Regents of the University of California. All rights reserved. * @@ -1242,16 +1244,20 @@ tcp_respond(struct tcpcb *tp, void *ipgen, struct tcphdr *th, struct mbuf *m, if (flags & TH_RST) TCP_PROBE5(accept__refused, NULL, NULL, m, tp, nth); - TCP_PROBE5(send, NULL, tp, m, tp, nth); #ifdef INET6 - if (isipv6) - (void) ip6_output(m, NULL, NULL, 0, NULL, NULL, inp); + if (isipv6) { + TCP_PROBE5(send, NULL, tp, ip6, tp, nth); + (void)ip6_output(m, NULL, NULL, 0, NULL, NULL, inp); + } #endif /* INET6 */ #if defined(INET) && defined(INET6) else #endif #ifdef INET - (void) ip_output(m, NULL, NULL, 0, NULL, inp); + { + TCP_PROBE5(send, NULL, tp, ip, tp, nth); + (void)ip_output(m, NULL, NULL, 0, NULL, inp); + } #endif } diff --git a/freebsd/sys/netinet/tcp_syncache.c b/freebsd/sys/netinet/tcp_syncache.c index a30def41..0dc4a0a5 100644 --- a/freebsd/sys/netinet/tcp_syncache.c +++ b/freebsd/sys/netinet/tcp_syncache.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2001 McAfee, Inc. * Copyright (c) 2006,2013 Andre Oppermann, Internet Business Solutions AG * All rights reserved. @@ -1205,6 +1207,7 @@ syncache_tfo_expand(struct syncache *sc, struct socket **lsop, struct mbuf *m, TCPSTAT_INC(tcps_sc_aborted); atomic_subtract_int(pending_counter, 1); } else { + soisconnected(*lsop); inp = sotoinpcb(*lsop); tp = intotcpcb(inp); tp->t_flags |= TF_FASTOPEN; diff --git a/freebsd/sys/netinet/tcp_syncache.h b/freebsd/sys/netinet/tcp_syncache.h index 3932cab7..d9ebb65c 100644 --- a/freebsd/sys/netinet/tcp_syncache.h +++ b/freebsd/sys/netinet/tcp_syncache.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1982, 1986, 1993, 1994, 1995 * The Regents of the University of California. All rights reserved. * diff --git a/freebsd/sys/netinet/tcp_timer.c b/freebsd/sys/netinet/tcp_timer.c index b4528801..a2f854d7 100644 --- a/freebsd/sys/netinet/tcp_timer.c +++ b/freebsd/sys/netinet/tcp_timer.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1982, 1986, 1988, 1990, 1993, 1995 * The Regents of the University of California. All rights reserved. * @@ -143,16 +145,14 @@ SYSCTL_INT(_net_inet_tcp, OID_AUTO, rexmit_drop_options, CTLFLAG_RW, &tcp_rexmit_drop_options, 0, "Drop TCP options from 3rd and later retransmitted SYN"); -static VNET_DEFINE(int, tcp_pmtud_blackhole_detect); -#define V_tcp_pmtud_blackhole_detect VNET(tcp_pmtud_blackhole_detect) +VNET_DEFINE(int, tcp_pmtud_blackhole_detect); SYSCTL_INT(_net_inet_tcp, OID_AUTO, pmtud_blackhole_detection, CTLFLAG_RW|CTLFLAG_VNET, &VNET_NAME(tcp_pmtud_blackhole_detect), 0, "Path MTU Discovery Black Hole Detection Enabled"); #ifdef INET -static VNET_DEFINE(int, tcp_pmtud_blackhole_mss) = 1200; -#define V_tcp_pmtud_blackhole_mss VNET(tcp_pmtud_blackhole_mss) +VNET_DEFINE(int, tcp_pmtud_blackhole_mss) = 1200; SYSCTL_INT(_net_inet_tcp, OID_AUTO, pmtud_blackhole_mss, CTLFLAG_RW|CTLFLAG_VNET, &VNET_NAME(tcp_pmtud_blackhole_mss), 0, @@ -160,8 +160,7 @@ SYSCTL_INT(_net_inet_tcp, OID_AUTO, pmtud_blackhole_mss, #endif #ifdef INET6 -static VNET_DEFINE(int, tcp_v6pmtud_blackhole_mss) = 1220; -#define V_tcp_v6pmtud_blackhole_mss VNET(tcp_v6pmtud_blackhole_mss) +VNET_DEFINE(int, tcp_v6pmtud_blackhole_mss) = 1220; SYSCTL_INT(_net_inet_tcp, OID_AUTO, v6pmtud_blackhole_mss, CTLFLAG_RW|CTLFLAG_VNET, &VNET_NAME(tcp_v6pmtud_blackhole_mss), 0, diff --git a/freebsd/sys/netinet/tcp_timer.h b/freebsd/sys/netinet/tcp_timer.h index f14f929a..9a26c95d 100644 --- a/freebsd/sys/netinet/tcp_timer.h +++ b/freebsd/sys/netinet/tcp_timer.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1982, 1986, 1993 * The Regents of the University of California. All rights reserved. * @@ -198,6 +200,13 @@ extern int tcp_syn_backoff[]; extern int tcp_finwait2_timeout; extern int tcp_fast_finwait2_recycle; +VNET_DECLARE(int, tcp_pmtud_blackhole_detect); +#define V_tcp_pmtud_blackhole_detect VNET(tcp_pmtud_blackhole_detect) +VNET_DECLARE(int, tcp_pmtud_blackhole_mss); +#define V_tcp_pmtud_blackhole_mss VNET(tcp_pmtud_blackhole_mss) +VNET_DECLARE(int, tcp_v6pmtud_blackhole_mss); +#define V_tcp_v6pmtud_blackhole_mss VNET(tcp_v6pmtud_blackhole_mss) + int tcp_inpinfo_lock_add(struct inpcb *inp); void tcp_inpinfo_lock_del(struct inpcb *inp, struct tcpcb *tp); diff --git a/freebsd/sys/netinet/tcp_timewait.c b/freebsd/sys/netinet/tcp_timewait.c index 13105339..61263dfe 100644 --- a/freebsd/sys/netinet/tcp_timewait.c +++ b/freebsd/sys/netinet/tcp_timewait.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1982, 1986, 1988, 1990, 1993, 1995 * The Regents of the University of California. All rights reserved. * @@ -49,6 +51,9 @@ __FBSDID("$FreeBSD$"); #include <sys/proc.h> #include <sys/socket.h> #include <sys/socketvar.h> +#ifndef INVARIANTS +#include <sys/syslog.h> +#endif #include <sys/protosw.h> #include <sys/random.h> @@ -711,10 +716,29 @@ tcp_tw_2msl_scan(int reuse) INP_WLOCK(inp); tw = intotw(inp); if (in_pcbrele_wlocked(inp)) { - KASSERT(tw == NULL, ("%s: held last inp " - "reference but tw not NULL", __func__)); - INP_INFO_RUNLOCK(&V_tcbinfo); - continue; + if (__predict_true(tw == NULL)) { + INP_INFO_RUNLOCK(&V_tcbinfo); + continue; + } else { + /* This should not happen as in TIMEWAIT + * state the inp should not be destroyed + * before its tcptw. If INVARIANTS is + * defined panic. + */ +#ifdef INVARIANTS + panic("%s: Panic before an infinite " + "loop: INP_TIMEWAIT && (INP_FREED " + "|| inp last reference) && tw != " + "NULL", __func__); +#else + log(LOG_ERR, "%s: Avoid an infinite " + "loop: INP_TIMEWAIT && (INP_FREED " + "|| inp last reference) && tw != " + "NULL", __func__); +#endif + INP_INFO_RUNLOCK(&V_tcbinfo); + break; + } } if (tw == NULL) { diff --git a/freebsd/sys/netinet/tcp_usrreq.c b/freebsd/sys/netinet/tcp_usrreq.c index 88cc3501..76c6d952 100644 --- a/freebsd/sys/netinet/tcp_usrreq.c +++ b/freebsd/sys/netinet/tcp_usrreq.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1982, 1986, 1988, 1993 * The Regents of the University of California. * Copyright (c) 2006-2007 Robert N. M. Watson diff --git a/freebsd/sys/netinet/tcp_var.h b/freebsd/sys/netinet/tcp_var.h index 967a5139..0bcb3dc6 100644 --- a/freebsd/sys/netinet/tcp_var.h +++ b/freebsd/sys/netinet/tcp_var.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1982, 1986, 1993, 1994, 1995 * The Regents of the University of California. All rights reserved. * @@ -201,12 +203,6 @@ struct tcpcb { #endif /* _KERNEL || _WANT_TCPCB */ #ifdef _KERNEL -/* - * Kernel variables for tcp. - */ -VNET_DECLARE(int, tcp_do_rfc1323); -#define V_tcp_do_rfc1323 VNET(tcp_do_rfc1323) - struct tcptemp { u_char tt_ipgen[40]; /* the size must be of max ip header, now IPv6 */ struct tcphdr tt_t; @@ -701,50 +697,83 @@ SYSCTL_DECL(_net_inet_tcp_sack); MALLOC_DECLARE(M_TCPLOG); #endif -VNET_DECLARE(struct inpcbhead, tcb); /* queue of active tcpcb's */ -VNET_DECLARE(struct inpcbinfo, tcbinfo); extern int tcp_log_in_vain; -VNET_DECLARE(int, tcp_mssdflt); /* XXX */ -VNET_DECLARE(int, tcp_minmss); + +/* + * Global TCP tunables shared between different stacks. + * Please keep the list sorted. + */ +VNET_DECLARE(int, drop_synfin); +VNET_DECLARE(int, path_mtu_discovery); +VNET_DECLARE(int, tcp_abc_l_var); +VNET_DECLARE(int, tcp_autorcvbuf_inc); +VNET_DECLARE(int, tcp_autorcvbuf_max); +VNET_DECLARE(int, tcp_autosndbuf_inc); +VNET_DECLARE(int, tcp_autosndbuf_max); VNET_DECLARE(int, tcp_delack_enabled); +VNET_DECLARE(int, tcp_do_autorcvbuf); +VNET_DECLARE(int, tcp_do_autosndbuf); +VNET_DECLARE(int, tcp_do_ecn); +VNET_DECLARE(int, tcp_do_rfc1323); +VNET_DECLARE(int, tcp_do_rfc3042); VNET_DECLARE(int, tcp_do_rfc3390); -VNET_DECLARE(int, tcp_initcwnd_segments); -VNET_DECLARE(int, tcp_sendspace); -VNET_DECLARE(int, tcp_recvspace); -VNET_DECLARE(int, path_mtu_discovery); VNET_DECLARE(int, tcp_do_rfc3465); -VNET_DECLARE(int, tcp_abc_l_var); -#define V_tcb VNET(tcb) -#define V_tcbinfo VNET(tcbinfo) -#define V_tcp_mssdflt VNET(tcp_mssdflt) -#define V_tcp_minmss VNET(tcp_minmss) -#define V_tcp_delack_enabled VNET(tcp_delack_enabled) -#define V_tcp_do_rfc3390 VNET(tcp_do_rfc3390) -#define V_tcp_initcwnd_segments VNET(tcp_initcwnd_segments) -#define V_tcp_sendspace VNET(tcp_sendspace) -#define V_tcp_recvspace VNET(tcp_recvspace) -#define V_path_mtu_discovery VNET(path_mtu_discovery) -#define V_tcp_do_rfc3465 VNET(tcp_do_rfc3465) -#define V_tcp_abc_l_var VNET(tcp_abc_l_var) - -VNET_DECLARE(int, tcp_do_sack); /* SACK enabled/disabled */ -VNET_DECLARE(int, tcp_sc_rst_sock_fail); /* RST on sock alloc failure */ -#define V_tcp_do_sack VNET(tcp_do_sack) -#define V_tcp_sc_rst_sock_fail VNET(tcp_sc_rst_sock_fail) - -VNET_DECLARE(int, tcp_do_ecn); /* TCP ECN enabled/disabled */ +VNET_DECLARE(int, tcp_do_rfc6675_pipe); +VNET_DECLARE(int, tcp_do_sack); +VNET_DECLARE(int, tcp_do_tso); VNET_DECLARE(int, tcp_ecn_maxretries); -#define V_tcp_do_ecn VNET(tcp_do_ecn) -#define V_tcp_ecn_maxretries VNET(tcp_ecn_maxretries) +VNET_DECLARE(int, tcp_initcwnd_segments); +VNET_DECLARE(int, tcp_insecure_rst); +VNET_DECLARE(int, tcp_insecure_syn); +VNET_DECLARE(int, tcp_minmss); +VNET_DECLARE(int, tcp_mssdflt); +VNET_DECLARE(int, tcp_recvspace); +VNET_DECLARE(int, tcp_sack_globalholes); +VNET_DECLARE(int, tcp_sack_globalmaxholes); +VNET_DECLARE(int, tcp_sack_maxholes); +VNET_DECLARE(int, tcp_sc_rst_sock_fail); +VNET_DECLARE(int, tcp_sendspace); +VNET_DECLARE(struct inpcbhead, tcb); +VNET_DECLARE(struct inpcbinfo, tcbinfo); + +#define V_drop_synfin VNET(drop_synfin) +#define V_path_mtu_discovery VNET(path_mtu_discovery) +#define V_tcb VNET(tcb) +#define V_tcbinfo VNET(tcbinfo) +#define V_tcp_abc_l_var VNET(tcp_abc_l_var) +#define V_tcp_autorcvbuf_inc VNET(tcp_autorcvbuf_inc) +#define V_tcp_autorcvbuf_max VNET(tcp_autorcvbuf_max) +#define V_tcp_autosndbuf_inc VNET(tcp_autosndbuf_inc) +#define V_tcp_autosndbuf_max VNET(tcp_autosndbuf_max) +#define V_tcp_delack_enabled VNET(tcp_delack_enabled) +#define V_tcp_do_autorcvbuf VNET(tcp_do_autorcvbuf) +#define V_tcp_do_autosndbuf VNET(tcp_do_autosndbuf) +#define V_tcp_do_ecn VNET(tcp_do_ecn) +#define V_tcp_do_rfc1323 VNET(tcp_do_rfc1323) +#define V_tcp_do_rfc3042 VNET(tcp_do_rfc3042) +#define V_tcp_do_rfc3390 VNET(tcp_do_rfc3390) +#define V_tcp_do_rfc3465 VNET(tcp_do_rfc3465) +#define V_tcp_do_rfc6675_pipe VNET(tcp_do_rfc6675_pipe) +#define V_tcp_do_sack VNET(tcp_do_sack) +#define V_tcp_do_tso VNET(tcp_do_tso) +#define V_tcp_ecn_maxretries VNET(tcp_ecn_maxretries) +#define V_tcp_initcwnd_segments VNET(tcp_initcwnd_segments) +#define V_tcp_insecure_rst VNET(tcp_insecure_rst) +#define V_tcp_insecure_syn VNET(tcp_insecure_syn) +#define V_tcp_minmss VNET(tcp_minmss) +#define V_tcp_mssdflt VNET(tcp_mssdflt) +#define V_tcp_recvspace VNET(tcp_recvspace) +#define V_tcp_sack_globalholes VNET(tcp_sack_globalholes) +#define V_tcp_sack_globalmaxholes VNET(tcp_sack_globalmaxholes) +#define V_tcp_sack_maxholes VNET(tcp_sack_maxholes) +#define V_tcp_sc_rst_sock_fail VNET(tcp_sc_rst_sock_fail) +#define V_tcp_sendspace VNET(tcp_sendspace) #ifdef TCP_HHOOK VNET_DECLARE(struct hhook_head *, tcp_hhh[HHOOK_TCP_LAST + 1]); #define V_tcp_hhh VNET(tcp_hhh) #endif -VNET_DECLARE(int, tcp_do_rfc6675_pipe); -#define V_tcp_do_rfc6675_pipe VNET(tcp_do_rfc6675_pipe) - int tcp_addoptions(struct tcpopt *, u_char *); int tcp_ccalgounload(struct cc_algo *unload_algo); struct tcpcb * diff --git a/freebsd/sys/netinet/tcpip.h b/freebsd/sys/netinet/tcpip.h index 45c1095a..f3ed5be9 100644 --- a/freebsd/sys/netinet/tcpip.h +++ b/freebsd/sys/netinet/tcpip.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1982, 1986, 1993 * The Regents of the University of California. All rights reserved. * diff --git a/freebsd/sys/netinet/toecore.h b/freebsd/sys/netinet/toecore.h index 6ea98518..633984a6 100644 --- a/freebsd/sys/netinet/toecore.h +++ b/freebsd/sys/netinet/toecore.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2012 Chelsio Communications, Inc. * All rights reserved. * diff --git a/freebsd/sys/netinet/udp.h b/freebsd/sys/netinet/udp.h index 7b18df42..7c08135d 100644 --- a/freebsd/sys/netinet/udp.h +++ b/freebsd/sys/netinet/udp.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1982, 1986, 1993 * The Regents of the University of California. * All rights reserved. diff --git a/freebsd/sys/netinet/udp_usrreq.c b/freebsd/sys/netinet/udp_usrreq.c index af6b564f..da2dbe98 100644 --- a/freebsd/sys/netinet/udp_usrreq.c +++ b/freebsd/sys/netinet/udp_usrreq.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1982, 1986, 1988, 1990, 1993, 1995 * The Regents of the University of California. * Copyright (c) 2008 Robert N. M. Watson diff --git a/freebsd/sys/netinet/udp_var.h b/freebsd/sys/netinet/udp_var.h index e92ac961..01545582 100644 --- a/freebsd/sys/netinet/udp_var.h +++ b/freebsd/sys/netinet/udp_var.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1982, 1986, 1989, 1993 * The Regents of the University of California. * All rights reserved. diff --git a/freebsd/sys/netinet6/dest6.c b/freebsd/sys/netinet6/dest6.c index 8d2f79e4..1c9efc25 100644 --- a/freebsd/sys/netinet6/dest6.c +++ b/freebsd/sys/netinet6/dest6.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. * All rights reserved. * diff --git a/freebsd/sys/netinet6/frag6.c b/freebsd/sys/netinet6/frag6.c index ae209b60..1224aeaa 100644 --- a/freebsd/sys/netinet6/frag6.c +++ b/freebsd/sys/netinet6/frag6.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. * All rights reserved. * diff --git a/freebsd/sys/netinet6/icmp6.c b/freebsd/sys/netinet6/icmp6.c index 16b48490..fb537170 100644 --- a/freebsd/sys/netinet6/icmp6.c +++ b/freebsd/sys/netinet6/icmp6.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. * All rights reserved. * diff --git a/freebsd/sys/netinet6/in6.c b/freebsd/sys/netinet6/in6.c index d5c21396..2046043d 100644 --- a/freebsd/sys/netinet6/in6.c +++ b/freebsd/sys/netinet6/in6.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. * All rights reserved. * diff --git a/freebsd/sys/netinet6/in6_cksum.c b/freebsd/sys/netinet6/in6_cksum.c index be9e191e..b33d202c 100644 --- a/freebsd/sys/netinet6/in6_cksum.c +++ b/freebsd/sys/netinet6/in6_cksum.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. * All rights reserved. * diff --git a/freebsd/sys/netinet6/in6_gif.c b/freebsd/sys/netinet6/in6_gif.c index 70de4d0c..160a0929 100644 --- a/freebsd/sys/netinet6/in6_gif.c +++ b/freebsd/sys/netinet6/in6_gif.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. * All rights reserved. * diff --git a/freebsd/sys/netinet6/in6_ifattach.c b/freebsd/sys/netinet6/in6_ifattach.c index e572fad7..d89581e4 100644 --- a/freebsd/sys/netinet6/in6_ifattach.c +++ b/freebsd/sys/netinet6/in6_ifattach.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. * All rights reserved. * diff --git a/freebsd/sys/netinet6/in6_ifattach.h b/freebsd/sys/netinet6/in6_ifattach.h index a34530db..1e038fa8 100644 --- a/freebsd/sys/netinet6/in6_ifattach.h +++ b/freebsd/sys/netinet6/in6_ifattach.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. * All rights reserved. * diff --git a/freebsd/sys/netinet6/in6_mcast.c b/freebsd/sys/netinet6/in6_mcast.c index 5977a6fe..4119d1d9 100644 --- a/freebsd/sys/netinet6/in6_mcast.c +++ b/freebsd/sys/netinet6/in6_mcast.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> -/* +/*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 2009 Bruce Simpson. * All rights reserved. * diff --git a/freebsd/sys/netinet6/in6_pcb.c b/freebsd/sys/netinet6/in6_pcb.c index 56142a1b..c9107260 100644 --- a/freebsd/sys/netinet6/in6_pcb.c +++ b/freebsd/sys/netinet6/in6_pcb.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. * Copyright (c) 2010-2011 Juniper Networks, Inc. * All rights reserved. diff --git a/freebsd/sys/netinet6/in6_pcb.h b/freebsd/sys/netinet6/in6_pcb.h index f21230bc..2c6bcdc6 100644 --- a/freebsd/sys/netinet6/in6_pcb.h +++ b/freebsd/sys/netinet6/in6_pcb.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. * All rights reserved. * diff --git a/freebsd/sys/netinet6/in6_proto.c b/freebsd/sys/netinet6/in6_proto.c index f52a683e..55fbbe80 100644 --- a/freebsd/sys/netinet6/in6_proto.c +++ b/freebsd/sys/netinet6/in6_proto.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. * All rights reserved. * diff --git a/freebsd/sys/netinet6/in6_rmx.c b/freebsd/sys/netinet6/in6_rmx.c index d6d9efea..402d9e87 100644 --- a/freebsd/sys/netinet6/in6_rmx.c +++ b/freebsd/sys/netinet6/in6_rmx.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. * All rights reserved. * diff --git a/freebsd/sys/netinet6/in6_src.c b/freebsd/sys/netinet6/in6_src.c index bc6890dc..a13c1a06 100644 --- a/freebsd/sys/netinet6/in6_src.c +++ b/freebsd/sys/netinet6/in6_src.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. * All rights reserved. * diff --git a/freebsd/sys/netinet6/in6_var.h b/freebsd/sys/netinet6/in6_var.h index a3dac7f4..2e22d962 100644 --- a/freebsd/sys/netinet6/in6_var.h +++ b/freebsd/sys/netinet6/in6_var.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. * All rights reserved. * diff --git a/freebsd/sys/netinet6/ip6_ecn.h b/freebsd/sys/netinet6/ip6_ecn.h index 27d3f34d..dade6573 100644 --- a/freebsd/sys/netinet6/ip6_ecn.h +++ b/freebsd/sys/netinet6/ip6_ecn.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (C) 1999 WIDE Project. * All rights reserved. * diff --git a/freebsd/sys/netinet6/ip6_fastfwd.c b/freebsd/sys/netinet6/ip6_fastfwd.c index 2f00c554..e11f612b 100644 --- a/freebsd/sys/netinet6/ip6_fastfwd.c +++ b/freebsd/sys/netinet6/ip6_fastfwd.c @@ -196,6 +196,16 @@ passin: in6_ifstat_inc(rcvif, ifs6_in_noroute); goto dropin; } + + /* + * Outgoing packet firewall processing. + */ + if (!PFIL_HOOKED(&V_inet6_pfil_hook)) + goto passout; + if (pfil_run_hooks(&V_inet6_pfil_hook, &m, nh.nh_ifp, PFIL_OUT, + NULL) != 0 || m == NULL) + goto dropout; + /* * We used slow path processing for packets with scoped addresses. * So, scope checks aren't needed here. @@ -208,14 +218,6 @@ passin: } /* - * Outgoing packet firewall processing. - */ - if (!PFIL_HOOKED(&V_inet6_pfil_hook)) - goto passout; - if (pfil_run_hooks(&V_inet6_pfil_hook, &m, nh.nh_ifp, PFIL_OUT, - NULL) != 0 || m == NULL) - goto dropout; - /* * If packet filter sets the M_FASTFWD_OURS flag, this means * that new destination or next hop is our local address. * So, we can just go back to ip6_input. diff --git a/freebsd/sys/netinet6/ip6_forward.c b/freebsd/sys/netinet6/ip6_forward.c index 542de6de..3364dd05 100644 --- a/freebsd/sys/netinet6/ip6_forward.c +++ b/freebsd/sys/netinet6/ip6_forward.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. * All rights reserved. * diff --git a/freebsd/sys/netinet6/ip6_id.c b/freebsd/sys/netinet6/ip6_id.c index 21a0bb51..cf0f3a4c 100644 --- a/freebsd/sys/netinet6/ip6_id.c +++ b/freebsd/sys/netinet6/ip6_id.c @@ -32,6 +32,8 @@ */ /*- + * SPDX-License-Identifier: BSD-4-Clause AND BSD-3-Clause + * * Copyright 1998 Niels Provos <provos@citi.umich.edu> * All rights reserved. * diff --git a/freebsd/sys/netinet6/ip6_input.c b/freebsd/sys/netinet6/ip6_input.c index 3d502674..c22f2015 100644 --- a/freebsd/sys/netinet6/ip6_input.c +++ b/freebsd/sys/netinet6/ip6_input.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. * All rights reserved. * @@ -1223,43 +1225,97 @@ ip6_savecontrol_v4(struct inpcb *inp, struct mbuf *m, struct mbuf **mp, struct bintime bt; struct timespec ts; } t; + struct bintime boottimebin, bt1; + struct timespec ts1; + bool stamped; + stamped = false; switch (inp->inp_socket->so_ts_clock) { case SO_TS_REALTIME_MICRO: - microtime(&t.tv); + if ((m->m_flags & (M_PKTHDR | M_TSTMP)) == (M_PKTHDR | + M_TSTMP)) { + mbuf_tstmp2timespec(m, &ts1); + timespec2bintime(&ts1, &bt1); + getboottimebin(&boottimebin); + bintime_add(&bt1, &boottimebin); + bintime2timeval(&bt1, &t.tv); + } else { + microtime(&t.tv); + } *mp = sbcreatecontrol((caddr_t) &t.tv, sizeof(t.tv), SCM_TIMESTAMP, SOL_SOCKET); - if (*mp) + if (*mp != NULL) { mp = &(*mp)->m_next; + stamped = true; + } break; case SO_TS_BINTIME: - bintime(&t.bt); + if ((m->m_flags & (M_PKTHDR | M_TSTMP)) == (M_PKTHDR | + M_TSTMP)) { + mbuf_tstmp2timespec(m, &ts1); + timespec2bintime(&ts1, &t.bt); + getboottimebin(&boottimebin); + bintime_add(&t.bt, &boottimebin); + } else { + bintime(&t.bt); + } *mp = sbcreatecontrol((caddr_t)&t.bt, sizeof(t.bt), SCM_BINTIME, SOL_SOCKET); - if (*mp) + if (*mp != NULL) { mp = &(*mp)->m_next; + stamped = true; + } break; case SO_TS_REALTIME: - nanotime(&t.ts); + if ((m->m_flags & (M_PKTHDR | M_TSTMP)) == (M_PKTHDR | + M_TSTMP)) { + mbuf_tstmp2timespec(m, &t.ts); + getboottimebin(&boottimebin); + bintime2timespec(&boottimebin, &ts1); + timespecadd(&t.ts, &ts1, &t.ts); + } else { + nanotime(&t.ts); + } *mp = sbcreatecontrol((caddr_t)&t.ts, sizeof(t.ts), SCM_REALTIME, SOL_SOCKET); - if (*mp) + if (*mp != NULL) { mp = &(*mp)->m_next; + stamped = true; + } break; case SO_TS_MONOTONIC: - nanouptime(&t.ts); + if ((m->m_flags & (M_PKTHDR | M_TSTMP)) == (M_PKTHDR | + M_TSTMP)) + mbuf_tstmp2timespec(m, &t.ts); + else + nanouptime(&t.ts); *mp = sbcreatecontrol((caddr_t)&t.ts, sizeof(t.ts), SCM_MONOTONIC, SOL_SOCKET); - if (*mp) + if (*mp != NULL) { mp = &(*mp)->m_next; + stamped = true; + } break; default: panic("unknown (corrupted) so_ts_clock"); } + if (stamped && (m->m_flags & (M_PKTHDR | M_TSTMP)) == + (M_PKTHDR | M_TSTMP)) { + struct sock_timestamp_info sti; + + bzero(&sti, sizeof(sti)); + sti.st_info_flags = ST_INFO_HW; + if ((m->m_flags & M_TSTMP_HPREC) != 0) + sti.st_info_flags |= ST_INFO_HW_HPREC; + *mp = sbcreatecontrol((caddr_t)&sti, sizeof(sti), + SCM_TIME_INFO, SOL_SOCKET); + if (*mp != NULL) + mp = &(*mp)->m_next; + } } #endif diff --git a/freebsd/sys/netinet6/ip6_mroute.c b/freebsd/sys/netinet6/ip6_mroute.c index a1d71361..4959145d 100644 --- a/freebsd/sys/netinet6/ip6_mroute.c +++ b/freebsd/sys/netinet6/ip6_mroute.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (C) 1998 WIDE Project. * All rights reserved. * diff --git a/freebsd/sys/netinet6/ip6_mroute.h b/freebsd/sys/netinet6/ip6_mroute.h index 51e1d496..40a85770 100644 --- a/freebsd/sys/netinet6/ip6_mroute.h +++ b/freebsd/sys/netinet6/ip6_mroute.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (C) 1998 WIDE Project. * All rights reserved. * diff --git a/freebsd/sys/netinet6/ip6_output.c b/freebsd/sys/netinet6/ip6_output.c index d8ed24a9..8dd71077 100644 --- a/freebsd/sys/netinet6/ip6_output.c +++ b/freebsd/sys/netinet6/ip6_output.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. * All rights reserved. * diff --git a/freebsd/sys/netinet6/ip6_var.h b/freebsd/sys/netinet6/ip6_var.h index 65bf1e69..5c8997ca 100644 --- a/freebsd/sys/netinet6/ip6_var.h +++ b/freebsd/sys/netinet6/ip6_var.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. * All rights reserved. * diff --git a/freebsd/sys/netinet6/ip6protosw.h b/freebsd/sys/netinet6/ip6protosw.h index edfbd0ab..d978e330 100644 --- a/freebsd/sys/netinet6/ip6protosw.h +++ b/freebsd/sys/netinet6/ip6protosw.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. * All rights reserved. * diff --git a/freebsd/sys/netinet6/mld6.c b/freebsd/sys/netinet6/mld6.c index 37625990..26fb21f7 100644 --- a/freebsd/sys/netinet6/mld6.c +++ b/freebsd/sys/netinet6/mld6.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 2009 Bruce Simpson. * * Redistribution and use in source and binary forms, with or without diff --git a/freebsd/sys/netinet6/mld6.h b/freebsd/sys/netinet6/mld6.h index 64d6b8d7..b426a2e2 100644 --- a/freebsd/sys/netinet6/mld6.h +++ b/freebsd/sys/netinet6/mld6.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 2009 Bruce Simpson. * * Redistribution and use in source and binary forms, with or without diff --git a/freebsd/sys/netinet6/mld6_var.h b/freebsd/sys/netinet6/mld6_var.h index be7e9035..0aeac367 100644 --- a/freebsd/sys/netinet6/mld6_var.h +++ b/freebsd/sys/netinet6/mld6_var.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 2009 Bruce Simpson. * * Redistribution and use in source and binary forms, with or without diff --git a/freebsd/sys/netinet6/nd6.c b/freebsd/sys/netinet6/nd6.c index b6368965..30672e23 100644 --- a/freebsd/sys/netinet6/nd6.c +++ b/freebsd/sys/netinet6/nd6.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. * All rights reserved. * diff --git a/freebsd/sys/netinet6/nd6.h b/freebsd/sys/netinet6/nd6.h index 243e9548..30990637 100644 --- a/freebsd/sys/netinet6/nd6.h +++ b/freebsd/sys/netinet6/nd6.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. * All rights reserved. * diff --git a/freebsd/sys/netinet6/nd6_nbr.c b/freebsd/sys/netinet6/nd6_nbr.c index f22d0ce7..5e55fc2b 100644 --- a/freebsd/sys/netinet6/nd6_nbr.c +++ b/freebsd/sys/netinet6/nd6_nbr.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. * All rights reserved. * diff --git a/freebsd/sys/netinet6/nd6_rtr.c b/freebsd/sys/netinet6/nd6_rtr.c index 7edd0925..47fc497e 100644 --- a/freebsd/sys/netinet6/nd6_rtr.c +++ b/freebsd/sys/netinet6/nd6_rtr.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. * All rights reserved. * diff --git a/freebsd/sys/netinet6/pim6.h b/freebsd/sys/netinet6/pim6.h index dec84cf2..45346e89 100644 --- a/freebsd/sys/netinet6/pim6.h +++ b/freebsd/sys/netinet6/pim6.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (C) 1998 WIDE Project. * All rights reserved. * diff --git a/freebsd/sys/netinet6/pim6_var.h b/freebsd/sys/netinet6/pim6_var.h index 7f9262bb..7afe89b9 100644 --- a/freebsd/sys/netinet6/pim6_var.h +++ b/freebsd/sys/netinet6/pim6_var.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (C) 1998 WIDE Project. * All rights reserved. * diff --git a/freebsd/sys/netinet6/raw_ip6.c b/freebsd/sys/netinet6/raw_ip6.c index 2bbd9864..743fe787 100644 --- a/freebsd/sys/netinet6/raw_ip6.c +++ b/freebsd/sys/netinet6/raw_ip6.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. * All rights reserved. * diff --git a/freebsd/sys/netinet6/raw_ip6.h b/freebsd/sys/netinet6/raw_ip6.h index 5eec5fff..e2dcac36 100644 --- a/freebsd/sys/netinet6/raw_ip6.h +++ b/freebsd/sys/netinet6/raw_ip6.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (C) 2001 WIDE Project. * All rights reserved. * diff --git a/freebsd/sys/netinet6/route6.c b/freebsd/sys/netinet6/route6.c index 061d0a67..7014daa6 100644 --- a/freebsd/sys/netinet6/route6.c +++ b/freebsd/sys/netinet6/route6.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. * All rights reserved. * diff --git a/freebsd/sys/netinet6/scope6.c b/freebsd/sys/netinet6/scope6.c index 3e8e7cef..a4c56769 100644 --- a/freebsd/sys/netinet6/scope6.c +++ b/freebsd/sys/netinet6/scope6.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (C) 2000 WIDE Project. * All rights reserved. * diff --git a/freebsd/sys/netinet6/scope6_var.h b/freebsd/sys/netinet6/scope6_var.h index e38d77a9..a2a9137d 100644 --- a/freebsd/sys/netinet6/scope6_var.h +++ b/freebsd/sys/netinet6/scope6_var.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (C) 2000 WIDE Project. * All rights reserved. * diff --git a/freebsd/sys/netinet6/sctp6_usrreq.c b/freebsd/sys/netinet6/sctp6_usrreq.c index 27fcaa99..619a30dc 100644 --- a/freebsd/sys/netinet6/sctp6_usrreq.c +++ b/freebsd/sys/netinet6/sctp6_usrreq.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 2001-2007, by Cisco Systems, Inc. All rights reserved. * Copyright (c) 2008-2012, by Randall Stewart. All rights reserved. * Copyright (c) 2008-2012, by Michael Tuexen. All rights reserved. @@ -231,6 +233,10 @@ sctp6_notify(struct sctp_inpcb *inp, } break; case ICMP6_PACKET_TOO_BIG: + if ((net->dest_state & SCTP_ADDR_NO_PMTUD) == 0) { + SCTP_TCB_UNLOCK(stcb); + break; + } if (SCTP_OS_TIMER_PENDING(&net->pmtu_timer.timer)) { timer_stopped = 1; sctp_timer_stop(SCTP_TIMER_TYPE_PATHMTURAISE, inp, stcb, net, diff --git a/freebsd/sys/netinet6/sctp6_var.h b/freebsd/sys/netinet6/sctp6_var.h index a24ceba7..e3c4359a 100644 --- a/freebsd/sys/netinet6/sctp6_var.h +++ b/freebsd/sys/netinet6/sctp6_var.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 2001-2007, by Cisco Systems, Inc. All rights reserved. * Copyright (c) 2008-2012, by Randall Stewart. All rights reserved. * Copyright (c) 2008-2012, by Michael Tuexen. All rights reserved. diff --git a/freebsd/sys/netinet6/send.h b/freebsd/sys/netinet6/send.h index 9795d142..6194f80e 100644 --- a/freebsd/sys/netinet6/send.h +++ b/freebsd/sys/netinet6/send.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2009-2010 Ana Kukec <anchie@FreeBSD.org> * All rights reserved. * diff --git a/freebsd/sys/netinet6/tcp6_var.h b/freebsd/sys/netinet6/tcp6_var.h index 1ef1eb95..00697695 100644 --- a/freebsd/sys/netinet6/tcp6_var.h +++ b/freebsd/sys/netinet6/tcp6_var.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. * All rights reserved. * diff --git a/freebsd/sys/netinet6/udp6_usrreq.c b/freebsd/sys/netinet6/udp6_usrreq.c index d00584ed..ae57ac79 100644 --- a/freebsd/sys/netinet6/udp6_usrreq.c +++ b/freebsd/sys/netinet6/udp6_usrreq.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. * Copyright (c) 2010-2011 Juniper Networks, Inc. * Copyright (c) 2014 Kevin Lo diff --git a/freebsd/sys/netinet6/udp6_var.h b/freebsd/sys/netinet6/udp6_var.h index 8a2afa38..93e226d6 100644 --- a/freebsd/sys/netinet6/udp6_var.h +++ b/freebsd/sys/netinet6/udp6_var.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. * All rights reserved. * diff --git a/freebsd/sys/netipsec/ah.h b/freebsd/sys/netipsec/ah.h index 1ffeacdc..8c76dbc4 100644 --- a/freebsd/sys/netipsec/ah.h +++ b/freebsd/sys/netipsec/ah.h @@ -2,6 +2,8 @@ /* $KAME: ah.h,v 1.13 2000/10/18 21:28:00 itojun Exp $ */ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. * All rights reserved. * diff --git a/freebsd/sys/netipsec/esp.h b/freebsd/sys/netipsec/esp.h index 8eb09630..94612b87 100644 --- a/freebsd/sys/netipsec/esp.h +++ b/freebsd/sys/netipsec/esp.h @@ -2,6 +2,8 @@ /* $KAME: esp.h,v 1.16 2000/10/18 21:28:00 itojun Exp $ */ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. * All rights reserved. * diff --git a/freebsd/sys/netipsec/ipcomp.h b/freebsd/sys/netipsec/ipcomp.h index 47e9305e..f1ffdc9b 100644 --- a/freebsd/sys/netipsec/ipcomp.h +++ b/freebsd/sys/netipsec/ipcomp.h @@ -2,6 +2,8 @@ /* $KAME: ipcomp.h,v 1.8 2000/09/26 07:55:14 itojun Exp $ */ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (C) 1999 WIDE Project. * All rights reserved. * diff --git a/freebsd/sys/netipsec/ipcomp_var.h b/freebsd/sys/netipsec/ipcomp_var.h index 5062c9dd..34bfb767 100644 --- a/freebsd/sys/netipsec/ipcomp_var.h +++ b/freebsd/sys/netipsec/ipcomp_var.h @@ -2,6 +2,8 @@ /* $KAME: ipcomp.h,v 1.8 2000/09/26 07:55:14 itojun Exp $ */ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (C) 1999 WIDE Project. * All rights reserved. * diff --git a/freebsd/sys/netipsec/ipsec.c b/freebsd/sys/netipsec/ipsec.c index 79c9519c..4d75b51b 100644 --- a/freebsd/sys/netipsec/ipsec.c +++ b/freebsd/sys/netipsec/ipsec.c @@ -4,6 +4,8 @@ /* $KAME: ipsec.c,v 1.103 2001/05/24 07:14:18 sakane Exp $ */ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. * All rights reserved. * @@ -151,6 +153,15 @@ sysctl_def_policy(SYSCTL_HANDLER_ARGS) * 0 take anything */ VNET_DEFINE(int, crypto_support) = CRYPTOCAP_F_HARDWARE | CRYPTOCAP_F_SOFTWARE; + +/* + * Use asynchronous mode to parallelize crypto jobs: + * + * 0 - disabled + * 1 - enabled + */ +VNET_DEFINE(int, async_crypto) = 0; + /* * TCP/UDP checksum handling policy for transport mode NAT-T (RFC3948) * @@ -197,6 +208,9 @@ SYSCTL_INT(_net_inet_ipsec, IPSECCTL_ECN, ecn, SYSCTL_INT(_net_inet_ipsec, OID_AUTO, crypto_support, CTLFLAG_VNET | CTLFLAG_RW, &VNET_NAME(crypto_support), 0, "Crypto driver selection."); +SYSCTL_INT(_net_inet_ipsec, OID_AUTO, async_crypto, + CTLFLAG_VNET | CTLFLAG_RW, &VNET_NAME(async_crypto), 0, + "Use asynchronous mode to parallelize crypto jobs."); SYSCTL_INT(_net_inet_ipsec, OID_AUTO, check_policy_history, CTLFLAG_VNET | CTLFLAG_RW, &VNET_NAME(check_policy_history), 0, "Use strict check of inbound packets to security policy compliance."); diff --git a/freebsd/sys/netipsec/ipsec.h b/freebsd/sys/netipsec/ipsec.h index a61730ef..a1e27bbf 100644 --- a/freebsd/sys/netipsec/ipsec.h +++ b/freebsd/sys/netipsec/ipsec.h @@ -2,6 +2,8 @@ /* $KAME: ipsec.h,v 1.53 2001/11/20 08:32:38 itojun Exp $ */ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. * All rights reserved. * @@ -283,6 +285,7 @@ VNET_DECLARE(int, ip4_ipsec_dfbit); VNET_DECLARE(int, ip4_ipsec_ecn); VNET_DECLARE(int, ip4_esp_randpad); VNET_DECLARE(int, crypto_support); +VNET_DECLARE(int, async_crypto); VNET_DECLARE(int, natt_cksum_policy); #define IPSECSTAT_INC(name) \ @@ -296,6 +299,7 @@ VNET_DECLARE(int, natt_cksum_policy); #define V_ip4_ipsec_ecn VNET(ip4_ipsec_ecn) #define V_ip4_esp_randpad VNET(ip4_esp_randpad) #define V_crypto_support VNET(crypto_support) +#define V_async_crypto VNET(async_crypto) #define V_natt_cksum_policy VNET(natt_cksum_policy) #define ipseclog(x) do { if (V_ipsec_debug) log x; } while (0) diff --git a/freebsd/sys/netipsec/ipsec6.h b/freebsd/sys/netipsec/ipsec6.h index 33aa30f3..6d44f989 100644 --- a/freebsd/sys/netipsec/ipsec6.h +++ b/freebsd/sys/netipsec/ipsec6.h @@ -2,6 +2,8 @@ /* $KAME: ipsec.h,v 1.44 2001/03/23 08:08:47 itojun Exp $ */ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. * All rights reserved. * diff --git a/freebsd/sys/netipsec/ipsec_mbuf.c b/freebsd/sys/netipsec/ipsec_mbuf.c index 80cb8fbc..66d53514 100644 --- a/freebsd/sys/netipsec/ipsec_mbuf.c +++ b/freebsd/sys/netipsec/ipsec_mbuf.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2002, 2003 Sam Leffler, Errno Consulting * All rights reserved. * diff --git a/freebsd/sys/netipsec/ipsec_output.c b/freebsd/sys/netipsec/ipsec_output.c index ac9529d5..f5ee076c 100644 --- a/freebsd/sys/netipsec/ipsec_output.c +++ b/freebsd/sys/netipsec/ipsec_output.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2002, 2003 Sam Leffler, Errno Consulting * Copyright (c) 2016 Andrey V. Elsukov <ae@FreeBSD.org> * All rights reserved. diff --git a/freebsd/sys/netipsec/key.c b/freebsd/sys/netipsec/key.c index ef5d8419..3652524c 100644 --- a/freebsd/sys/netipsec/key.c +++ b/freebsd/sys/netipsec/key.c @@ -4,6 +4,8 @@ /* $KAME: key.c,v 1.191 2001/06/27 10:46:49 sakane Exp $ */ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. * All rights reserved. * @@ -5102,7 +5104,7 @@ key_updateaddresses(struct socket *so, struct mbuf *m, newsav->natt = NULL; newsav->sah = sah; newsav->state = SADB_SASTATE_MATURE; - error = key_setnatt(sav, mhp); + error = key_setnatt(newsav, mhp); if (error != 0) goto fail; @@ -6265,7 +6267,7 @@ key_getsizes_ah(const struct auth_hash *ah, int alg, u_int16_t* min, u_int16_t* max) { - *min = *max = ah->keysize; + *min = *max = ah->hashsize; if (ah->keysize == 0) { /* * Transform takes arbitrary key size but algorithm diff --git a/freebsd/sys/netipsec/key.h b/freebsd/sys/netipsec/key.h index a646832e..6c3e05c0 100644 --- a/freebsd/sys/netipsec/key.h +++ b/freebsd/sys/netipsec/key.h @@ -2,6 +2,8 @@ /* $KAME: key.h,v 1.21 2001/07/27 03:51:30 itojun Exp $ */ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. * All rights reserved. * diff --git a/freebsd/sys/netipsec/key_debug.c b/freebsd/sys/netipsec/key_debug.c index f71212b7..12cfe34e 100644 --- a/freebsd/sys/netipsec/key_debug.c +++ b/freebsd/sys/netipsec/key_debug.c @@ -4,6 +4,8 @@ /* $KAME: key_debug.c,v 1.26 2001/06/27 10:46:50 sakane Exp $ */ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. * All rights reserved. * diff --git a/freebsd/sys/netipsec/key_debug.h b/freebsd/sys/netipsec/key_debug.h index afb11cb1..a2dd57ed 100644 --- a/freebsd/sys/netipsec/key_debug.h +++ b/freebsd/sys/netipsec/key_debug.h @@ -2,6 +2,8 @@ /* $KAME: key_debug.h,v 1.10 2001/08/05 08:37:52 itojun Exp $ */ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. * All rights reserved. * diff --git a/freebsd/sys/netipsec/key_var.h b/freebsd/sys/netipsec/key_var.h index ecef2360..bd68645e 100644 --- a/freebsd/sys/netipsec/key_var.h +++ b/freebsd/sys/netipsec/key_var.h @@ -2,6 +2,8 @@ /* $KAME: key_var.h,v 1.11 2001/09/12 23:05:07 sakane Exp $ */ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. * All rights reserved. * diff --git a/freebsd/sys/netipsec/keydb.h b/freebsd/sys/netipsec/keydb.h index ab03abb1..19eae767 100644 --- a/freebsd/sys/netipsec/keydb.h +++ b/freebsd/sys/netipsec/keydb.h @@ -2,6 +2,8 @@ /* $KAME: keydb.h,v 1.14 2000/08/02 17:58:26 sakane Exp $ */ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. * All rights reserved. * diff --git a/freebsd/sys/netipsec/keysock.c b/freebsd/sys/netipsec/keysock.c index a7421af6..7ecd50b8 100644 --- a/freebsd/sys/netipsec/keysock.c +++ b/freebsd/sys/netipsec/keysock.c @@ -4,6 +4,8 @@ /* $KAME: keysock.c,v 1.25 2001/08/13 20:07:41 itojun Exp $ */ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. * All rights reserved. * diff --git a/freebsd/sys/netipsec/keysock.h b/freebsd/sys/netipsec/keysock.h index 8fbf4a02..30b68da6 100644 --- a/freebsd/sys/netipsec/keysock.h +++ b/freebsd/sys/netipsec/keysock.h @@ -2,6 +2,8 @@ /* $KAME: keysock.h,v 1.8 2000/03/27 05:11:06 sumikawa Exp $ */ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. * All rights reserved. * diff --git a/freebsd/sys/netipsec/xform_ah.c b/freebsd/sys/netipsec/xform_ah.c index 6e9baa1f..5667f78f 100644 --- a/freebsd/sys/netipsec/xform_ah.c +++ b/freebsd/sys/netipsec/xform_ah.c @@ -659,6 +659,8 @@ ah_input(struct mbuf *m, struct secasvar *sav, int skip, int protoff) /* Crypto operation descriptor. */ crp->crp_ilen = m->m_pkthdr.len; /* Total input length. */ crp->crp_flags = CRYPTO_F_IMBUF | CRYPTO_F_CBIFSYNC; + if (V_async_crypto) + crp->crp_flags |= CRYPTO_F_ASYNC | CRYPTO_F_ASYNC_KEEPORDER; crp->crp_buf = (caddr_t) m; crp->crp_callback = ah_input_cb; crp->crp_sid = cryptoid; @@ -1035,6 +1037,8 @@ ah_output(struct mbuf *m, struct secpolicy *sp, struct secasvar *sav, /* Crypto operation descriptor. */ crp->crp_ilen = m->m_pkthdr.len; /* Total input length. */ crp->crp_flags = CRYPTO_F_IMBUF | CRYPTO_F_CBIFSYNC; + if (V_async_crypto) + crp->crp_flags |= CRYPTO_F_ASYNC | CRYPTO_F_ASYNC_KEEPORDER; crp->crp_buf = (caddr_t) m; crp->crp_callback = ah_output_cb; crp->crp_sid = cryptoid; diff --git a/freebsd/sys/netipsec/xform_esp.c b/freebsd/sys/netipsec/xform_esp.c index 8310b799..8af95f7d 100644 --- a/freebsd/sys/netipsec/xform_esp.c +++ b/freebsd/sys/netipsec/xform_esp.c @@ -387,6 +387,8 @@ esp_input(struct mbuf *m, struct secasvar *sav, int skip, int protoff) /* Crypto operation descriptor */ crp->crp_ilen = m->m_pkthdr.len; /* Total input length */ crp->crp_flags = CRYPTO_F_IMBUF | CRYPTO_F_CBIFSYNC; + if (V_async_crypto) + crp->crp_flags |= CRYPTO_F_ASYNC | CRYPTO_F_ASYNC_KEEPORDER; crp->crp_buf = (caddr_t) m; crp->crp_callback = esp_input_cb; crp->crp_sid = cryptoid; @@ -843,6 +845,8 @@ esp_output(struct mbuf *m, struct secpolicy *sp, struct secasvar *sav, /* Crypto operation descriptor. */ crp->crp_ilen = m->m_pkthdr.len; /* Total input length. */ crp->crp_flags = CRYPTO_F_IMBUF | CRYPTO_F_CBIFSYNC; + if (V_async_crypto) + crp->crp_flags |= CRYPTO_F_ASYNC | CRYPTO_F_ASYNC_KEEPORDER; crp->crp_buf = (caddr_t) m; crp->crp_callback = esp_output_cb; crp->crp_opaque = (caddr_t) xd; diff --git a/freebsd/sys/netipsec/xform_ipcomp.c b/freebsd/sys/netipsec/xform_ipcomp.c index e79301b1..4764e609 100644 --- a/freebsd/sys/netipsec/xform_ipcomp.c +++ b/freebsd/sys/netipsec/xform_ipcomp.c @@ -4,6 +4,8 @@ /* $OpenBSD: ip_ipcomp.c,v 1.1 2001/07/05 12:08:52 jjbg Exp $ */ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 2001 Jean-Jacques Bernard-Gundol (jj@wabbitt.org) * * Redistribution and use in source and binary forms, with or without diff --git a/freebsd/sys/netipsec/xform_tcp.c b/freebsd/sys/netipsec/xform_tcp.c index 3df5db3a..9310cf2c 100644 --- a/freebsd/sys/netipsec/xform_tcp.c +++ b/freebsd/sys/netipsec/xform_tcp.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 2003 Bruce M. Simpson <bms@spc.org> * Copyright (c) 2016 Andrey V. Elsukov <ae@FreeBSD.org> * diff --git a/freebsd/sys/netpfil/pf/if_pfsync.c b/freebsd/sys/netpfil/pf/if_pfsync.c index 491ff3a7..2343adc2 100644 --- a/freebsd/sys/netpfil/pf/if_pfsync.c +++ b/freebsd/sys/netpfil/pf/if_pfsync.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: (BSD-2-Clause-FreeBSD AND ISC) + * * Copyright (c) 2002 Michael Shalayeff * Copyright (c) 2012 Gleb Smirnoff <glebius@FreeBSD.org> * All rights reserved. diff --git a/freebsd/sys/netpfil/pf/in4_cksum.c b/freebsd/sys/netpfil/pf/in4_cksum.c index 87993ac6..509c33cd 100644 --- a/freebsd/sys/netpfil/pf/in4_cksum.c +++ b/freebsd/sys/netpfil/pf/in4_cksum.c @@ -6,6 +6,8 @@ /* $NetBSD: in_cksum.c,v 1.13 1996/10/13 02:03:03 christos Exp $ */ /* + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (C) 1999 WIDE Project. * All rights reserved. * diff --git a/freebsd/sys/netpfil/pf/pf.c b/freebsd/sys/netpfil/pf/pf.c index ca46d16e..d94966b9 100644 --- a/freebsd/sys/netpfil/pf/pf.c +++ b/freebsd/sys/netpfil/pf/pf.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2001 Daniel Hartmeier * Copyright (c) 2002 - 2008 Henning Brauer * Copyright (c) 2012 Gleb Smirnoff <glebius@FreeBSD.org> diff --git a/freebsd/sys/netpfil/pf/pf.h b/freebsd/sys/netpfil/pf/pf.h index ac0e0fb9..333faea3 100644 --- a/freebsd/sys/netpfil/pf/pf.h +++ b/freebsd/sys/netpfil/pf/pf.h @@ -1,4 +1,6 @@ /* + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2001 Daniel Hartmeier * All rights reserved. * diff --git a/freebsd/sys/netpfil/pf/pf_altq.h b/freebsd/sys/netpfil/pf/pf_altq.h index 3efd4ff7..f6d578d3 100644 --- a/freebsd/sys/netpfil/pf/pf_altq.h +++ b/freebsd/sys/netpfil/pf/pf_altq.h @@ -1,4 +1,6 @@ -/* +/*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2001 Daniel Hartmeier * All rights reserved. * diff --git a/freebsd/sys/netpfil/pf/pf_if.c b/freebsd/sys/netpfil/pf/pf_if.c index 0ca6a019..e224e6a7 100644 --- a/freebsd/sys/netpfil/pf/pf_if.c +++ b/freebsd/sys/netpfil/pf/pf_if.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2001 Daniel Hartmeier * Copyright (c) 2003 Cedric Berger * Copyright (c) 2005 Henning Brauer <henning@openbsd.org> diff --git a/freebsd/sys/netpfil/pf/pf_ioctl.c b/freebsd/sys/netpfil/pf/pf_ioctl.c index e9ca8d95..98f190e7 100644 --- a/freebsd/sys/netpfil/pf/pf_ioctl.c +++ b/freebsd/sys/netpfil/pf/pf_ioctl.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2001 Daniel Hartmeier * Copyright (c) 2002,2003 Henning Brauer * Copyright (c) 2012 Gleb Smirnoff <glebius@FreeBSD.org> diff --git a/freebsd/sys/netpfil/pf/pf_lb.c b/freebsd/sys/netpfil/pf/pf_lb.c index abbf1c1e..7ce27a07 100644 --- a/freebsd/sys/netpfil/pf/pf_lb.c +++ b/freebsd/sys/netpfil/pf/pf_lb.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2001 Daniel Hartmeier * Copyright (c) 2002 - 2008 Henning Brauer * All rights reserved. diff --git a/freebsd/sys/netpfil/pf/pf_mtag.h b/freebsd/sys/netpfil/pf/pf_mtag.h index fd8554ae..67c79350 100644 --- a/freebsd/sys/netpfil/pf/pf_mtag.h +++ b/freebsd/sys/netpfil/pf/pf_mtag.h @@ -1,5 +1,7 @@ /* $FreeBSD$ */ -/* +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2001 Daniel Hartmeier * All rights reserved. * diff --git a/freebsd/sys/netpfil/pf/pf_norm.c b/freebsd/sys/netpfil/pf/pf_norm.c index 60733ae8..e3a00971 100644 --- a/freebsd/sys/netpfil/pf/pf_norm.c +++ b/freebsd/sys/netpfil/pf/pf_norm.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright 2001 Niels Provos <provos@citi.umich.edu> * Copyright 2011 Alexander Bluhm <bluhm@openbsd.org> * All rights reserved. diff --git a/freebsd/sys/netpfil/pf/pf_ruleset.c b/freebsd/sys/netpfil/pf/pf_ruleset.c index b8428f7f..3cd74e1d 100644 --- a/freebsd/sys/netpfil/pf/pf_ruleset.c +++ b/freebsd/sys/netpfil/pf/pf_ruleset.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2001 Daniel Hartmeier * Copyright (c) 2002,2003 Henning Brauer * All rights reserved. diff --git a/freebsd/sys/netpfil/pf/pf_table.c b/freebsd/sys/netpfil/pf/pf_table.c index c655effa..68e24d22 100644 --- a/freebsd/sys/netpfil/pf/pf_table.c +++ b/freebsd/sys/netpfil/pf/pf_table.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2002 Cedric Berger * All rights reserved. * diff --git a/freebsd/sys/nios2/include/machine/in_cksum.h b/freebsd/sys/nios2/include/machine/in_cksum.h index 72edfba9..d55b838b 100644 --- a/freebsd/sys/nios2/include/machine/in_cksum.h +++ b/freebsd/sys/nios2/include/machine/in_cksum.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1990 The Regents of the University of California. * All rights reserved. * diff --git a/freebsd/sys/opencrypto/crypto.c b/freebsd/sys/opencrypto/crypto.c index 57378e2f..2631ca5b 100644 --- a/freebsd/sys/opencrypto/crypto.c +++ b/freebsd/sys/opencrypto/crypto.c @@ -72,7 +72,9 @@ __FBSDID("$FreeBSD$"); #include <sys/malloc.h> #include <sys/proc.h> #include <sys/sdt.h> +#include <sys/smp.h> #include <sys/sysctl.h> +#include <sys/taskqueue.h> #include <ddb/ddb.h> @@ -137,26 +139,51 @@ static int crypto_drivers_num = 0; * operations. */ static int crp_sleep = 0; -static TAILQ_HEAD(,cryptop) crp_q; /* request queues */ +static TAILQ_HEAD(cryptop_q ,cryptop) crp_q; /* request queues */ static TAILQ_HEAD(,cryptkop) crp_kq; static struct mtx crypto_q_mtx; #define CRYPTO_Q_LOCK() mtx_lock(&crypto_q_mtx) #define CRYPTO_Q_UNLOCK() mtx_unlock(&crypto_q_mtx) /* - * There are two queues for processing completed crypto requests; one - * for the symmetric and one for the asymmetric ops. We only need one - * but have two to avoid type futzing (cryptop vs. cryptkop). A single - * mutex is used to lock access to both queues. Note that this lock - * must be separate from the lock on request queues to insure driver - * callbacks don't generate lock order reversals. + * Taskqueue used to dispatch the crypto requests + * that have the CRYPTO_F_ASYNC flag */ -static TAILQ_HEAD(,cryptop) crp_ret_q; /* callback queues */ -static TAILQ_HEAD(,cryptkop) crp_ret_kq; -static struct mtx crypto_ret_q_mtx; -#define CRYPTO_RETQ_LOCK() mtx_lock(&crypto_ret_q_mtx) -#define CRYPTO_RETQ_UNLOCK() mtx_unlock(&crypto_ret_q_mtx) -#define CRYPTO_RETQ_EMPTY() (TAILQ_EMPTY(&crp_ret_q) && TAILQ_EMPTY(&crp_ret_kq)) +static struct taskqueue *crypto_tq; + +/* + * Crypto seq numbers are operated on with modular arithmetic + */ +#define CRYPTO_SEQ_GT(a,b) ((int)((a)-(b)) > 0) + +struct crypto_ret_worker { + struct mtx crypto_ret_mtx; + + TAILQ_HEAD(,cryptop) crp_ordered_ret_q; /* ordered callback queue for symetric jobs */ + TAILQ_HEAD(,cryptop) crp_ret_q; /* callback queue for symetric jobs */ + TAILQ_HEAD(,cryptkop) crp_ret_kq; /* callback queue for asym jobs */ + + u_int32_t reorder_ops; /* total ordered sym jobs received */ + u_int32_t reorder_cur_seq; /* current sym job dispatched */ + + struct proc *cryptoretproc; +}; +static struct crypto_ret_worker *crypto_ret_workers = NULL; + +#define CRYPTO_RETW(i) (&crypto_ret_workers[i]) +#define CRYPTO_RETW_ID(w) ((w) - crypto_ret_workers) +#define FOREACH_CRYPTO_RETW(w) \ + for (w = crypto_ret_workers; w < crypto_ret_workers + crypto_workers_num; ++w) + +#define CRYPTO_RETW_LOCK(w) mtx_lock(&w->crypto_ret_mtx) +#define CRYPTO_RETW_UNLOCK(w) mtx_unlock(&w->crypto_ret_mtx) +#define CRYPTO_RETW_EMPTY(w) \ + (TAILQ_EMPTY(&w->crp_ret_q) && TAILQ_EMPTY(&w->crp_ret_kq) && TAILQ_EMPTY(&w->crp_ordered_ret_q)) + +static int crypto_workers_num = 0; +SYSCTL_INT(_kern, OID_AUTO, crypto_workers_num, CTLFLAG_RDTUN, + &crypto_workers_num, 0, + "Number of crypto workers used to dispatch crypto jobs"); static uma_zone_t cryptop_zone; static uma_zone_t cryptodesc_zone; @@ -174,11 +201,12 @@ MALLOC_DEFINE(M_CRYPTO_DATA, "crypto", "crypto session records"); static void crypto_proc(void); static struct proc *cryptoproc; -static void crypto_ret_proc(void); -static struct proc *cryptoretproc; +static void crypto_ret_proc(struct crypto_ret_worker *ret_worker); static void crypto_destroy(void); static int crypto_invoke(struct cryptocap *cap, struct cryptop *crp, int hint); static int crypto_kinvoke(struct cryptkop *krp, int flags); +static void crypto_task_invoke(void *ctx, int pending); +static void crypto_batch_enqueue(struct cryptop *crp); static struct cryptostats cryptostats; SYSCTL_STRUCT(_kern, OID_AUTO, crypto_stats, CTLFLAG_RW, &cryptostats, @@ -224,6 +252,7 @@ struct keybuf * get_keybuf(void) { static int crypto_init(void) { + struct crypto_ret_worker *ret_worker; int error; mtx_init(&crypto_drivers_mtx, "crypto", "crypto driver table", @@ -233,10 +262,6 @@ crypto_init(void) TAILQ_INIT(&crp_kq); mtx_init(&crypto_q_mtx, "crypto", "crypto op queues", MTX_DEF); - TAILQ_INIT(&crp_ret_q); - TAILQ_INIT(&crp_ret_kq); - mtx_init(&crypto_ret_q_mtx, "crypto", "crypto return queues", MTX_DEF); - cryptop_zone = uma_zcreate("cryptop", sizeof (struct cryptop), 0, 0, 0, 0, UMA_ALIGN_PTR, UMA_ZONE_ZINIT); @@ -258,6 +283,20 @@ crypto_init(void) goto bad; } + if (crypto_workers_num < 1 || crypto_workers_num > mp_ncpus) + crypto_workers_num = mp_ncpus; + + crypto_tq = taskqueue_create("crypto", M_WAITOK|M_ZERO, + taskqueue_thread_enqueue, &crypto_tq); + if (crypto_tq == NULL) { + printf("crypto init: cannot setup crypto taskqueue\n"); + error = ENOMEM; + goto bad; + } + + taskqueue_start_threads(&crypto_tq, crypto_workers_num, PRI_MIN_KERN, + "crypto"); + error = kproc_create((void (*)(void *)) crypto_proc, NULL, &cryptoproc, 0, 0, "crypto"); if (error) { @@ -266,15 +305,35 @@ crypto_init(void) goto bad; } - error = kproc_create((void (*)(void *)) crypto_ret_proc, NULL, - &cryptoretproc, 0, 0, "crypto returns"); - if (error) { - printf("crypto_init: cannot start cryptoret thread; error %d", - error); + crypto_ret_workers = malloc(crypto_workers_num * sizeof(struct crypto_ret_worker), + M_CRYPTO_DATA, M_NOWAIT|M_ZERO); + if (crypto_ret_workers == NULL) { + error = ENOMEM; + printf("crypto_init: cannot allocate ret workers\n"); goto bad; } - keybuf_init(); + + FOREACH_CRYPTO_RETW(ret_worker) { + TAILQ_INIT(&ret_worker->crp_ordered_ret_q); + TAILQ_INIT(&ret_worker->crp_ret_q); + TAILQ_INIT(&ret_worker->crp_ret_kq); + + ret_worker->reorder_ops = 0; + ret_worker->reorder_cur_seq = 0; + + mtx_init(&ret_worker->crypto_ret_mtx, "crypto", "crypto return queues", MTX_DEF); + + error = kproc_create((void (*)(void *)) crypto_ret_proc, ret_worker, + &ret_worker->cryptoretproc, 0, 0, "crypto returns %td", CRYPTO_RETW_ID(ret_worker)); + if (error) { + printf("crypto_init: cannot start cryptoret thread; error %d", + error); + goto bad; + } + } + + keybuf_init(); return 0; bad: @@ -315,12 +374,17 @@ crypto_terminate(struct proc **pp, void *q) static void crypto_destroy(void) { + struct crypto_ret_worker *ret_worker; + /* * Terminate any crypto threads. */ + if (crypto_tq != NULL) + taskqueue_drain_all(crypto_tq); CRYPTO_DRIVER_LOCK(); crypto_terminate(&cryptoproc, &crp_q); - crypto_terminate(&cryptoretproc, &crp_ret_q); + FOREACH_CRYPTO_RETW(ret_worker) + crypto_terminate(&ret_worker->cryptoretproc, &ret_worker->crp_ret_q); CRYPTO_DRIVER_UNLOCK(); /* XXX flush queues??? */ @@ -336,7 +400,11 @@ crypto_destroy(void) if (cryptop_zone != NULL) uma_zdestroy(cryptop_zone); mtx_destroy(&crypto_q_mtx); - mtx_destroy(&crypto_ret_q_mtx); + FOREACH_CRYPTO_RETW(ret_worker) + mtx_destroy(&ret_worker->crypto_ret_mtx); + free(crypto_ret_workers, M_CRYPTO_DATA); + if (crypto_tq != NULL) + taskqueue_free(crypto_tq); mtx_destroy(&crypto_drivers_mtx); } @@ -579,7 +647,7 @@ crypto_get_driverid(device_t dev, int flags) crypto_drivers[i].cc_dev = dev; crypto_drivers[i].cc_flags = flags; if (bootverbose) - printf("crypto: assign %s driver id %u, flags %u\n", + printf("crypto: assign %s driver id %u, flags 0x%x\n", device_get_nameunit(dev), i, flags); CRYPTO_DRIVER_UNLOCK(); @@ -835,9 +903,26 @@ crypto_dispatch(struct cryptop *crp) binuptime(&crp->crp_tstamp); #endif - hid = CRYPTO_SESID2HID(crp->crp_sid); + if (CRYPTOP_ASYNC(crp)) { + if (crp->crp_flags & CRYPTO_F_ASYNC_KEEPORDER) { + struct crypto_ret_worker *ret_worker; + + crp->crp_retw_id = crp->crp_sid % crypto_workers_num; + ret_worker = CRYPTO_RETW(crp->crp_retw_id); + + CRYPTO_RETW_LOCK(ret_worker); + crp->crp_seq = ret_worker->reorder_ops++; + CRYPTO_RETW_UNLOCK(ret_worker); + } + + TASK_INIT(&crp->crp_task, 0, crypto_task_invoke, crp); + taskqueue_enqueue(crypto_tq, &crp->crp_task); + return (0); + } if ((crp->crp_flags & CRYPTO_F_BATCH) == 0) { + hid = CRYPTO_SESID2HID(crp->crp_sid); + /* * Caller marked the request to be processed * immediately; dispatch it directly to the @@ -856,12 +941,19 @@ crypto_dispatch(struct cryptop *crp) */ } } + crypto_batch_enqueue(crp); + return 0; +} + +void +crypto_batch_enqueue(struct cryptop *crp) +{ + CRYPTO_Q_LOCK(); TAILQ_INSERT_TAIL(&crp_q, crp, crp_next); if (crp_sleep) wakeup_one(&crp_q); CRYPTO_Q_UNLOCK(); - return 0; } /* @@ -1042,6 +1134,23 @@ crypto_tstat(struct cryptotstat *ts, struct bintime *bt) } #endif +static void +crypto_task_invoke(void *ctx, int pending) +{ + struct cryptocap *cap; + struct cryptop *crp; + int hid, result; + + crp = (struct cryptop *)ctx; + + hid = CRYPTO_SESID2HID(crp->crp_sid); + cap = crypto_checkdriver(hid); + + result = crypto_invoke(cap, crp, 0); + if (result == ERESTART) + crypto_batch_enqueue(crp); +} + /* * Dispatch a crypto request to the appropriate crypto devices. */ @@ -1104,6 +1213,7 @@ crypto_freereq(struct cryptop *crp) #ifdef DIAGNOSTIC { struct cryptop *crp2; + struct crypto_ret_worker *ret_worker; CRYPTO_Q_LOCK(); TAILQ_FOREACH(crp2, &crp_q, crp_next) { @@ -1112,13 +1222,16 @@ crypto_freereq(struct cryptop *crp) crp)); } CRYPTO_Q_UNLOCK(); - CRYPTO_RETQ_LOCK(); - TAILQ_FOREACH(crp2, &crp_ret_q, crp_next) { - KASSERT(crp2 != crp, - ("Freeing cryptop from the return queue (%p).", - crp)); + + FOREACH_CRYPTO_RETW(ret_worker) { + CRYPTO_RETW_LOCK(ret_worker); + TAILQ_FOREACH(crp2, &ret_worker->crp_ret_q, crp_next) { + KASSERT(crp2 != crp, + ("Freeing cryptop from the return queue (%p).", + crp)); + } + CRYPTO_RETW_UNLOCK(ret_worker); } - CRYPTO_RETQ_UNLOCK(); } #endif @@ -1176,9 +1289,10 @@ crypto_done(struct cryptop *crp) * doing extraneous context switches; the latter is mostly * used with the software crypto driver. */ - if ((crp->crp_flags & CRYPTO_F_CBIMM) || + if (!CRYPTOP_ASYNC_KEEPORDER(crp) && + ((crp->crp_flags & CRYPTO_F_CBIMM) || ((crp->crp_flags & CRYPTO_F_CBIFSYNC) && - (CRYPTO_SESID2CAPS(crp->crp_sid) & CRYPTOCAP_F_SYNC))) { + (CRYPTO_SESID2CAPS(crp->crp_sid) & CRYPTOCAP_F_SYNC)))) { /* * Do the callback directly. This is ok when the * callback routine does very little (e.g. the @@ -1199,14 +1313,45 @@ crypto_done(struct cryptop *crp) #endif crp->crp_callback(crp); } else { + struct crypto_ret_worker *ret_worker; + bool wake; + + ret_worker = CRYPTO_RETW(crp->crp_retw_id); + wake = false; + /* * Normal case; queue the callback for the thread. */ - CRYPTO_RETQ_LOCK(); - if (CRYPTO_RETQ_EMPTY()) - wakeup_one(&crp_ret_q); /* shared wait channel */ - TAILQ_INSERT_TAIL(&crp_ret_q, crp, crp_next); - CRYPTO_RETQ_UNLOCK(); + CRYPTO_RETW_LOCK(ret_worker); + if (CRYPTOP_ASYNC_KEEPORDER(crp)) { + struct cryptop *tmp; + + TAILQ_FOREACH_REVERSE(tmp, &ret_worker->crp_ordered_ret_q, + cryptop_q, crp_next) { + if (CRYPTO_SEQ_GT(crp->crp_seq, tmp->crp_seq)) { + TAILQ_INSERT_AFTER(&ret_worker->crp_ordered_ret_q, + tmp, crp, crp_next); + break; + } + } + if (tmp == NULL) { + TAILQ_INSERT_HEAD(&ret_worker->crp_ordered_ret_q, + crp, crp_next); + } + + if (crp->crp_seq == ret_worker->reorder_cur_seq) + wake = true; + } + else { + if (CRYPTO_RETW_EMPTY(ret_worker)) + wake = true; + + TAILQ_INSERT_TAIL(&ret_worker->crp_ret_q, crp, crp_next); + } + + if (wake) + wakeup_one(&ret_worker->crp_ret_q); /* shared wait channel */ + CRYPTO_RETW_UNLOCK(ret_worker); } } @@ -1216,6 +1361,7 @@ crypto_done(struct cryptop *crp) void crypto_kdone(struct cryptkop *krp) { + struct crypto_ret_worker *ret_worker; struct cryptocap *cap; if (krp->krp_status != 0) @@ -1230,11 +1376,14 @@ crypto_kdone(struct cryptkop *krp) crypto_remove(cap); } CRYPTO_DRIVER_UNLOCK(); - CRYPTO_RETQ_LOCK(); - if (CRYPTO_RETQ_EMPTY()) - wakeup_one(&crp_ret_q); /* shared wait channel */ - TAILQ_INSERT_TAIL(&crp_ret_kq, krp, krp_next); - CRYPTO_RETQ_UNLOCK(); + + ret_worker = CRYPTO_RETW(0); + + CRYPTO_RETW_LOCK(ret_worker); + if (CRYPTO_RETW_EMPTY(ret_worker)) + wakeup_one(&ret_worker->crp_ret_q); /* shared wait channel */ + TAILQ_INSERT_TAIL(&ret_worker->crp_ret_kq, krp, krp_next); + CRYPTO_RETW_UNLOCK(ret_worker); } int @@ -1436,24 +1585,36 @@ crypto_proc(void) * callbacks typically are expensive and would slow interrupt handling. */ static void -crypto_ret_proc(void) +crypto_ret_proc(struct crypto_ret_worker *ret_worker) { struct cryptop *crpt; struct cryptkop *krpt; - CRYPTO_RETQ_LOCK(); + CRYPTO_RETW_LOCK(ret_worker); for (;;) { /* Harvest return q's for completed ops */ - crpt = TAILQ_FIRST(&crp_ret_q); - if (crpt != NULL) - TAILQ_REMOVE(&crp_ret_q, crpt, crp_next); + crpt = TAILQ_FIRST(&ret_worker->crp_ordered_ret_q); + if (crpt != NULL) { + if (crpt->crp_seq == ret_worker->reorder_cur_seq) { + TAILQ_REMOVE(&ret_worker->crp_ordered_ret_q, crpt, crp_next); + ret_worker->reorder_cur_seq++; + } else { + crpt = NULL; + } + } - krpt = TAILQ_FIRST(&crp_ret_kq); + if (crpt == NULL) { + crpt = TAILQ_FIRST(&ret_worker->crp_ret_q); + if (crpt != NULL) + TAILQ_REMOVE(&ret_worker->crp_ret_q, crpt, crp_next); + } + + krpt = TAILQ_FIRST(&ret_worker->crp_ret_kq); if (krpt != NULL) - TAILQ_REMOVE(&crp_ret_kq, krpt, krp_next); + TAILQ_REMOVE(&ret_worker->crp_ret_kq, krpt, krp_next); if (crpt != NULL || krpt != NULL) { - CRYPTO_RETQ_UNLOCK(); + CRYPTO_RETW_UNLOCK(ret_worker); /* * Run callbacks unlocked. */ @@ -1475,22 +1636,22 @@ crypto_ret_proc(void) } if (krpt != NULL) krpt->krp_callback(krpt); - CRYPTO_RETQ_LOCK(); + CRYPTO_RETW_LOCK(ret_worker); } else { /* * Nothing more to be processed. Sleep until we're * woken because there are more returns to process. */ - msleep(&crp_ret_q, &crypto_ret_q_mtx, PWAIT, + msleep(&ret_worker->crp_ret_q, &ret_worker->crypto_ret_mtx, PWAIT, "crypto_ret_wait", 0); - if (cryptoretproc == NULL) + if (ret_worker->cryptoretproc == NULL) break; cryptostats.cs_rets++; } } - CRYPTO_RETQ_UNLOCK(); + CRYPTO_RETW_UNLOCK(ret_worker); - crypto_finis(&crp_ret_q); + crypto_finis(&ret_worker->crp_ret_q); } #ifdef DDB @@ -1525,6 +1686,7 @@ db_show_drivers(void) DB_SHOW_COMMAND(crypto, db_show_crypto) { struct cryptop *crp; + struct crypto_ret_worker *ret_worker; db_show_drivers(); db_printf("\n"); @@ -1543,16 +1705,19 @@ DB_SHOW_COMMAND(crypto, db_show_crypto) , crp->crp_callback ); } - if (!TAILQ_EMPTY(&crp_ret_q)) { - db_printf("\n%4s %4s %4s %8s\n", - "HID", "Etype", "Flags", "Callback"); - TAILQ_FOREACH(crp, &crp_ret_q, crp_next) { - db_printf("%4u %4u %04x %8p\n" - , (int) CRYPTO_SESID2HID(crp->crp_sid) - , crp->crp_etype - , crp->crp_flags - , crp->crp_callback - ); + FOREACH_CRYPTO_RETW(ret_worker) { + db_printf("\n%8s %4s %4s %4s %8s\n", + "ret_worker", "HID", "Etype", "Flags", "Callback"); + if (!TAILQ_EMPTY(&ret_worker->crp_ret_q)) { + TAILQ_FOREACH(crp, &ret_worker->crp_ret_q, crp_next) { + db_printf("%8td %4u %4u %04x %8p\n" + , CRYPTO_RETW_ID(ret_worker) + , (int) CRYPTO_SESID2HID(crp->crp_sid) + , crp->crp_etype + , crp->crp_flags + , crp->crp_callback + ); + } } } } @@ -1560,6 +1725,7 @@ DB_SHOW_COMMAND(crypto, db_show_crypto) DB_SHOW_COMMAND(kcrypto, db_show_kcrypto) { struct cryptkop *krp; + struct crypto_ret_worker *ret_worker; db_show_drivers(); db_printf("\n"); @@ -1575,10 +1741,12 @@ DB_SHOW_COMMAND(kcrypto, db_show_kcrypto) , krp->krp_callback ); } - if (!TAILQ_EMPTY(&crp_ret_q)) { + + ret_worker = CRYPTO_RETW(0); + if (!TAILQ_EMPTY(&ret_worker->crp_ret_q)) { db_printf("%4s %5s %8s %4s %8s\n", "Op", "Status", "CRID", "HID", "Callback"); - TAILQ_FOREACH(krp, &crp_ret_kq, krp_next) { + TAILQ_FOREACH(krp, &ret_worker->crp_ret_kq, krp_next) { db_printf("%4u %5u %08x %4u %8p\n" , krp->krp_op , krp->krp_status diff --git a/freebsd/sys/opencrypto/cryptodev.h b/freebsd/sys/opencrypto/cryptodev.h index c42515a6..cfbda068 100644 --- a/freebsd/sys/opencrypto/cryptodev.h +++ b/freebsd/sys/opencrypto/cryptodev.h @@ -63,6 +63,7 @@ #define _CRYPTO_CRYPTO_H_ #include <sys/ioccom.h> +#include <sys/_task.h> /* Some initial values */ #define CRYPTO_DRIVERS_INITIAL 4 @@ -391,6 +392,8 @@ struct cryptodesc { struct cryptop { TAILQ_ENTRY(cryptop) crp_next; + struct task crp_task; + u_int64_t crp_sid; /* Session ID */ int crp_ilen; /* Input data total length */ int crp_olen; /* Result total length */ @@ -413,6 +416,14 @@ struct cryptop { #define CRYPTO_F_CBIMM 0x0010 /* Do callback immediately */ #define CRYPTO_F_DONE 0x0020 /* Operation completed */ #define CRYPTO_F_CBIFSYNC 0x0040 /* Do CBIMM if op is synchronous */ +#define CRYPTO_F_ASYNC 0x0080 /* Dispatch crypto jobs on several threads + * if op is synchronous + */ +#define CRYPTO_F_ASYNC_KEEPORDER 0x0100 /* + * Dispatch the crypto jobs in the same + * order there are submitted. Applied only + * if CRYPTO_F_ASYNC flags is set + */ caddr_t crp_buf; /* Data to be processed */ caddr_t crp_opaque; /* Opaque pointer, passed along */ @@ -421,8 +432,20 @@ struct cryptop { int (*crp_callback)(struct cryptop *); /* Callback function */ struct bintime crp_tstamp; /* performance time stamp */ + uint32_t crp_seq; /* used for ordered dispatch */ + uint32_t crp_retw_id; /* + * the return worker to be used, + * used for ordered dispatch + */ }; +#define CRYPTOP_ASYNC(crp) \ + (((crp)->crp_flags & CRYPTO_F_ASYNC) && \ + CRYPTO_SESID2CAPS((crp)->crp_sid) & CRYPTOCAP_F_SYNC) +#define CRYPTOP_ASYNC_KEEPORDER(crp) \ + (CRYPTOP_ASYNC(crp) && \ + (crp)->crp_flags & CRYPTO_F_ASYNC_KEEPORDER) + #define CRYPTO_BUF_CONTIG 0x0 #define CRYPTO_BUF_IOV 0x1 #define CRYPTO_BUF_MBUF 0x2 diff --git a/freebsd/sys/powerpc/include/machine/cpufunc.h b/freebsd/sys/powerpc/include/machine/cpufunc.h index c70a94d3..204c4801 100644 --- a/freebsd/sys/powerpc/include/machine/cpufunc.h +++ b/freebsd/sys/powerpc/include/machine/cpufunc.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 1998 Doug Rabson * All rights reserved. * diff --git a/freebsd/sys/powerpc/include/machine/in_cksum.h b/freebsd/sys/powerpc/include/machine/in_cksum.h index 37bfb200..fd34e13d 100644 --- a/freebsd/sys/powerpc/include/machine/in_cksum.h +++ b/freebsd/sys/powerpc/include/machine/in_cksum.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1990 The Regents of the University of California. * All rights reserved. * diff --git a/freebsd/sys/powerpc/include/machine/intr_machdep.h b/freebsd/sys/powerpc/include/machine/intr_machdep.h index 5fbf9ee0..6ece0fa8 100644 --- a/freebsd/sys/powerpc/include/machine/intr_machdep.h +++ b/freebsd/sys/powerpc/include/machine/intr_machdep.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (C) 2002 Benno Rice. * All rights reserved. * @@ -30,7 +32,7 @@ #define INTR_VECTORS 256 -#define MAX_PICS 16 +#define MAX_PICS 32 #define MAP_IRQ(node, pin) powerpc_get_irq(node, pin) /* @@ -46,7 +48,7 @@ driver_filter_t powerpc_ipi_handler; void intrcnt_add(const char *name, u_long **countp); -void powerpc_register_pic(device_t, uint32_t, u_int, u_int, u_int); +u_int powerpc_register_pic(device_t, uint32_t, u_int, u_int, u_int); u_int powerpc_get_irq(uint32_t, u_int); void powerpc_dispatch_intr(u_int, struct trapframe *); diff --git a/freebsd/sys/powerpc/include/machine/psl.h b/freebsd/sys/powerpc/include/machine/psl.h index bb4756f0..329120f4 100644 --- a/freebsd/sys/powerpc/include/machine/psl.h +++ b/freebsd/sys/powerpc/include/machine/psl.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-4-Clause + * * Copyright (C) 1995, 1996 Wolfgang Solfrank. * Copyright (C) 1995, 1996 TooLs GmbH. * All rights reserved. @@ -45,15 +47,16 @@ #define PSL_FP 0x00002000UL /* floating point enable */ #define PSL_ME 0x00001000UL /* machine check enable */ #define PSL_FE0 0x00000800UL /* floating point interrupt mode 0 */ -#define PSL_BE 0x00000200UL /* branch trace enable */ #define PSL_FE1 0x00000100UL /* floating point interrupt mode 1 */ #define PSL_PMM 0x00000004UL /* performance monitor mark */ +#define PSL_RI 0x00000002UL /* recoverable interrupt */ /* Machine State Register - Book-E cores */ #ifdef __powerpc64__ #define PSL_CM 0x80000000UL /* Computation Mode (64-bit) */ #endif +#define PSL_GS 0x10000000UL /* Guest state */ #define PSL_UCLE 0x04000000UL /* User mode cache lock enable */ #define PSL_WE 0x00040000UL /* Wait state enable */ #define PSL_CE 0x00020000UL /* Critical interrupt enable */ @@ -72,10 +75,10 @@ #define PSL_POW 0x00040000UL /* power management */ #define PSL_ILE 0x00010000UL /* interrupt endian mode (1 == le) */ #define PSL_SE 0x00000400UL /* single-step trace enable */ +#define PSL_BE 0x00000200UL /* branch trace enable */ #define PSL_IP 0x00000040UL /* interrupt prefix - 601 only */ #define PSL_IR 0x00000020UL /* instruction address relocation */ #define PSL_DR 0x00000010UL /* data address relocation */ -#define PSL_RI 0x00000002UL /* recoverable interrupt */ #define PSL_LE 0x00000001UL /* endian mode (1 == le) */ /* diff --git a/freebsd/sys/powerpc/include/machine/spr.h b/freebsd/sys/powerpc/include/machine/spr.h index 5efdf961..3e479415 100644 --- a/freebsd/sys/powerpc/include/machine/spr.h +++ b/freebsd/sys/powerpc/include/machine/spr.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2001 The NetBSD Foundation, Inc. * All rights reserved. * @@ -210,6 +212,11 @@ #define EPCR_DMIUH 0x00400000 #define EPCR_PMGS 0x00200000 #define SPR_SPEFSCR 0x200 /* ..8 Signal Processing Engine FSCR. */ + +#define SPR_LPCR 0x13e /* Logical Partitioning Control */ +#define LPCR_LPES 0x008 /* Bit 60 */ +#define SPR_LPID 0x13f /* Logical Partitioning Control */ + #define SPR_IBAT0U 0x210 /* .68 Instruction BAT Reg 0 Upper */ #define SPR_IBAT0U 0x210 /* .6. Instruction BAT Reg 0 Upper */ #define SPR_IBAT0L 0x211 /* .6. Instruction BAT Reg 0 Lower */ @@ -745,6 +752,8 @@ #define SVR_P4040E 0x8208 #define SVR_P4080 0x8201 #define SVR_P4080E 0x8209 +#define SVR_P5010 0x8221 +#define SVR_P5010E 0x8229 #define SVR_P5020 0x8220 #define SVR_P5020E 0x8228 #define SVR_P5021 0x8205 diff --git a/freebsd/sys/powerpc/powerpc/in_cksum.c b/freebsd/sys/powerpc/powerpc/in_cksum.c index d73fed4e..ab25a651 100644 --- a/freebsd/sys/powerpc/powerpc/in_cksum.c +++ b/freebsd/sys/powerpc/powerpc/in_cksum.c @@ -4,6 +4,8 @@ /* $NetBSD: in_cksum.c,v 1.7 1997/09/02 13:18:15 thorpej Exp $ */ /*- + * SPDX-License-Identifier: BSD-4-Clause + * * Copyright (c) 1988, 1992, 1993 * The Regents of the University of California. All rights reserved. * Copyright (c) 1996 diff --git a/freebsd/sys/rpc/types.h b/freebsd/sys/rpc/types.h index 62b5aca1..e5d728d6 100644 --- a/freebsd/sys/rpc/types.h +++ b/freebsd/sys/rpc/types.h @@ -1,6 +1,8 @@ /* $NetBSD: types.h,v 1.13 2000/06/13 01:02:44 thorpej Exp $ */ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 2009, Sun Microsystems, Inc. * All rights reserved. * diff --git a/freebsd/sys/security/audit/audit.h b/freebsd/sys/security/audit/audit.h index 12cda7b5..055194d3 100644 --- a/freebsd/sys/security/audit/audit.h +++ b/freebsd/sys/security/audit/audit.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1999-2005 Apple Inc. * Copyright (c) 2016-2017 Robert N. M. Watson * All rights reserved. diff --git a/freebsd/sys/sh/include/machine/in_cksum.h b/freebsd/sys/sh/include/machine/in_cksum.h index 72edfba9..d55b838b 100644 --- a/freebsd/sys/sh/include/machine/in_cksum.h +++ b/freebsd/sys/sh/include/machine/in_cksum.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1990 The Regents of the University of California. * All rights reserved. * diff --git a/freebsd/sys/sparc/include/machine/in_cksum.h b/freebsd/sys/sparc/include/machine/in_cksum.h index 72edfba9..d55b838b 100644 --- a/freebsd/sys/sparc/include/machine/in_cksum.h +++ b/freebsd/sys/sparc/include/machine/in_cksum.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1990 The Regents of the University of California. * All rights reserved. * diff --git a/freebsd/sys/sparc64/include/machine/asi.h b/freebsd/sys/sparc64/include/machine/asi.h index e5769c12..2a40eb89 100644 --- a/freebsd/sys/sparc64/include/machine/asi.h +++ b/freebsd/sys/sparc64/include/machine/asi.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1997 Berkeley Software Design, Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/freebsd/sys/sparc64/include/machine/cpufunc.h b/freebsd/sys/sparc64/include/machine/cpufunc.h index abfbd1fd..934e6717 100644 --- a/freebsd/sys/sparc64/include/machine/cpufunc.h +++ b/freebsd/sys/sparc64/include/machine/cpufunc.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2001 Jake Burkholder. * All rights reserved. * diff --git a/freebsd/sys/sparc64/include/machine/in_cksum.h b/freebsd/sys/sparc64/include/machine/in_cksum.h index b13882e0..6f80d699 100644 --- a/freebsd/sys/sparc64/include/machine/in_cksum.h +++ b/freebsd/sys/sparc64/include/machine/in_cksum.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1990 The Regents of the University of California. * All rights reserved. * diff --git a/freebsd/sys/sparc64/include/machine/pstate.h b/freebsd/sys/sparc64/include/machine/pstate.h index 4f536303..df3a25bd 100644 --- a/freebsd/sys/sparc64/include/machine/pstate.h +++ b/freebsd/sys/sparc64/include/machine/pstate.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2001 Jake Burkholder. * All rights reserved. * diff --git a/freebsd/sys/sparc64/sparc64/in_cksum.c b/freebsd/sys/sparc64/sparc64/in_cksum.c index bc8e5f62..58a19845 100644 --- a/freebsd/sys/sparc64/sparc64/in_cksum.c +++ b/freebsd/sys/sparc64/sparc64/in_cksum.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1990 The Regents of the University of California. * All rights reserved. * diff --git a/freebsd/sys/sys/_bus_dma.h b/freebsd/sys/sys/_bus_dma.h index 91318d01..c2a17301 100644 --- a/freebsd/sys/sys/_bus_dma.h +++ b/freebsd/sys/sys/_bus_dma.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright 2006 John-Mark Gurney. * All rights reserved. * diff --git a/freebsd/sys/sys/_callout.h b/freebsd/sys/sys/_callout.h index 53df18e9..60b02f56 100644 --- a/freebsd/sys/sys/_callout.h +++ b/freebsd/sys/sys/_callout.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1990, 1993 * The Regents of the University of California. All rights reserved. * (c) UNIX System Laboratories, Inc. diff --git a/freebsd/sys/sys/_lock.h b/freebsd/sys/sys/_lock.h index e92430c4..ae10254c 100644 --- a/freebsd/sys/sys/_lock.h +++ b/freebsd/sys/sys/_lock.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1997 Berkeley Software Design, Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/freebsd/sys/sys/_lockmgr.h b/freebsd/sys/sys/_lockmgr.h index 0367ff1e..62e50df1 100644 --- a/freebsd/sys/sys/_lockmgr.h +++ b/freebsd/sys/sys/_lockmgr.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2008 Attilio Rao <attilio@FreeBSD.org> * All rights reserved. * diff --git a/freebsd/sys/sys/_mutex.h b/freebsd/sys/sys/_mutex.h index 96f53238..5252aee1 100644 --- a/freebsd/sys/sys/_mutex.h +++ b/freebsd/sys/sys/_mutex.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1997 Berkeley Software Design, Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/freebsd/sys/sys/_null.h b/freebsd/sys/sys/_null.h index 92706c6a..8fa5e424 100644 --- a/freebsd/sys/sys/_null.h +++ b/freebsd/sys/sys/_null.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2003 Marcel Moolenaar * All rights reserved. * diff --git a/freebsd/sys/sys/_pctrie.h b/freebsd/sys/sys/_pctrie.h index c6d13baa..d9a98a78 100644 --- a/freebsd/sys/sys/_pctrie.h +++ b/freebsd/sys/sys/_pctrie.h @@ -1,4 +1,6 @@ -/* +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2013 EMC Corp. * Copyright (c) 2011 Jeffrey Roberson <jeff@freebsd.org> * Copyright (c) 2008 Mayur Shardul <mayur.shardul@gmail.com> diff --git a/freebsd/sys/sys/_rmlock.h b/freebsd/sys/sys/_rmlock.h index adc2bc56..28e3cb34 100644 --- a/freebsd/sys/sys/_rmlock.h +++ b/freebsd/sys/sys/_rmlock.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 2007 Stephan Uphoff <ups@FreeBSD.org> * All rights reserved. * diff --git a/freebsd/sys/sys/_rwlock.h b/freebsd/sys/sys/_rwlock.h index 029fb98b..318592d5 100644 --- a/freebsd/sys/sys/_rwlock.h +++ b/freebsd/sys/sys/_rwlock.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2006 John Baldwin <jhb@FreeBSD.org> * All rights reserved. * diff --git a/freebsd/sys/sys/_semaphore.h b/freebsd/sys/sys/_semaphore.h index 560076c8..b5c48251 100644 --- a/freebsd/sys/sys/_semaphore.h +++ b/freebsd/sys/sys/_semaphore.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2002 Alfred Perlstein <alfred@FreeBSD.org> * All rights reserved. * diff --git a/freebsd/sys/sys/_sx.h b/freebsd/sys/sys/_sx.h index b07ac47a..328a43a4 100644 --- a/freebsd/sys/sys/_sx.h +++ b/freebsd/sys/sys/_sx.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2007 Attilio Rao <attilio@freebsd.org> * All rights reserved. * diff --git a/freebsd/sys/sys/_task.h b/freebsd/sys/sys/_task.h index d46659f4..392dc874 100644 --- a/freebsd/sys/sys/_task.h +++ b/freebsd/sys/sys/_task.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2000 Doug Rabson * All rights reserved. * diff --git a/freebsd/sys/sys/_unrhdr.h b/freebsd/sys/sys/_unrhdr.h index f3c25d16..65abe578 100644 --- a/freebsd/sys/sys/_unrhdr.h +++ b/freebsd/sys/sys/_unrhdr.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2004 Poul-Henning Kamp * All rights reserved. * diff --git a/freebsd/sys/sys/acl.h b/freebsd/sys/sys/acl.h index 9806a54a..196447a6 100644 --- a/freebsd/sys/sys/acl.h +++ b/freebsd/sys/sys/acl.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 1999-2001 Robert N. M. Watson * Copyright (c) 2008 Edward Tomasz Napierała <trasz@FreeBSD.org> * All rights reserved. diff --git a/freebsd/sys/sys/aio.h b/freebsd/sys/sys/aio.h index ab6f766f..2843042b 100644 --- a/freebsd/sys/sys/aio.h +++ b/freebsd/sys/sys/aio.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 1997 John S. Dyson. All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -256,7 +258,7 @@ int aio_suspend(const struct aiocb * const[], int, const struct timespec *); */ int aio_mlock(struct aiocb *); -#ifdef __BSD_VISIBLE +#if __BSD_VISIBLE ssize_t aio_waitcomplete(struct aiocb **, struct timespec *); #endif diff --git a/freebsd/sys/sys/ata.h b/freebsd/sys/sys/ata.h index 4d3b3e7f..f8a332c3 100644 --- a/freebsd/sys/sys/ata.h +++ b/freebsd/sys/sys/ata.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2000 - 2008 Søren Schmidt <sos@FreeBSD.org> * All rights reserved. * diff --git a/freebsd/sys/sys/blist.h b/freebsd/sys/sys/blist.h index 486e04eb..22d834f7 100644 --- a/freebsd/sys/sys/blist.h +++ b/freebsd/sys/sys/blist.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1998 Matthew Dillon. All Rights Reserved. * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -82,7 +84,7 @@ typedef struct blist { daddr_t bl_blocks; /* area of coverage */ u_daddr_t bl_radix; /* coverage radix */ daddr_t bl_cursor; /* next-fit search starts at */ - blmeta_t *bl_root; /* root of radix tree */ + blmeta_t bl_root[1]; /* root of radix tree */ } *blist_t; #define BLIST_META_RADIX 16 diff --git a/freebsd/sys/sys/buf.h b/freebsd/sys/sys/buf.h index 5d4f0dc6..77acac5b 100644 --- a/freebsd/sys/sys/buf.h +++ b/freebsd/sys/sys/buf.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1982, 1986, 1989, 1993 * The Regents of the University of California. All rights reserved. * (c) UNIX System Laboratories, Inc. diff --git a/freebsd/sys/sys/buf_ring.h b/freebsd/sys/sys/buf_ring.h index 3655775e..0b633238 100644 --- a/freebsd/sys/sys/buf_ring.h +++ b/freebsd/sys/sys/buf_ring.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2007-2009 Kip Macy <kmacy@freebsd.org> * All rights reserved. * diff --git a/freebsd/sys/sys/bufobj.h b/freebsd/sys/sys/bufobj.h index 2dc440a6..fb3f0873 100644 --- a/freebsd/sys/sys/bufobj.h +++ b/freebsd/sys/sys/bufobj.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2004 Poul-Henning Kamp * All rights reserved. * diff --git a/freebsd/sys/sys/bus.h b/freebsd/sys/sys/bus.h index 626026dc..7a3f6b1a 100644 --- a/freebsd/sys/sys/bus.h +++ b/freebsd/sys/sys/bus.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 1997,1998,2003 Doug Rabson * All rights reserved. * @@ -491,6 +493,7 @@ struct resource_spec { int rid; int flags; }; +#define RESOURCE_SPEC_END {-1, 0, 0} int bus_alloc_resources(device_t dev, struct resource_spec *rs, struct resource **res); @@ -632,7 +635,6 @@ struct sysctl_oid *devclass_get_sysctl_tree(devclass_t dc); /* * Access functions for device resources. */ - int resource_int_value(const char *name, int unit, const char *resname, int *result); int resource_long_value(const char *name, int unit, const char *resname, @@ -644,12 +646,6 @@ int resource_find_match(int *anchor, const char **name, int *unit, const char *resname, const char *value); int resource_find_dev(int *anchor, const char *name, int *unit, const char *resname, const char *value); -int resource_set_int(const char *name, int unit, const char *resname, - int value); -int resource_set_long(const char *name, int unit, const char *resname, - long value); -int resource_set_string(const char *name, int unit, const char *resname, - const char *value); int resource_unset_value(const char *name, int unit, const char *resname); /* diff --git a/freebsd/sys/sys/bus_dma.h b/freebsd/sys/sys/bus_dma.h index 04dbe0cb..c5799661 100644 --- a/freebsd/sys/sys/bus_dma.h +++ b/freebsd/sys/sys/bus_dma.h @@ -1,6 +1,8 @@ /* $NetBSD: bus.h,v 1.12 1997/10/01 08:25:15 fvdl Exp $ */ /*- + * SPDX-License-Identifier: BSD-2-Clause-NetBSD + * * Copyright (c) 1996, 1997 The NetBSD Foundation, Inc. * All rights reserved. * diff --git a/freebsd/sys/sys/callout.h b/freebsd/sys/sys/callout.h index 68861957..a0b45d98 100644 --- a/freebsd/sys/sys/callout.h +++ b/freebsd/sys/sys/callout.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1990, 1993 * The Regents of the University of California. All rights reserved. * (c) UNIX System Laboratories, Inc. diff --git a/freebsd/sys/sys/capability.h b/freebsd/sys/sys/capability.h index 3bdaf203..4b07c090 100644 --- a/freebsd/sys/sys/capability.h +++ b/freebsd/sys/sys/capability.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2014 Robert N. M. Watson * All rights reserved. * diff --git a/freebsd/sys/sys/caprights.h b/freebsd/sys/sys/caprights.h index eb8e454f..8698483c 100644 --- a/freebsd/sys/sys/caprights.h +++ b/freebsd/sys/sys/caprights.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2013 FreeBSD Foundation * All rights reserved. * diff --git a/freebsd/sys/sys/condvar.h b/freebsd/sys/sys/condvar.h index c4666694..cf3cc6ba 100644 --- a/freebsd/sys/sys/condvar.h +++ b/freebsd/sys/sys/condvar.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2000 Jake Burkholder <jake@freebsd.org>. * All rights reserved. * diff --git a/freebsd/sys/sys/conf.h b/freebsd/sys/sys/conf.h index 8bf6a3ed..7f240f68 100644 --- a/freebsd/sys/sys/conf.h +++ b/freebsd/sys/sys/conf.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1990, 1993 * The Regents of the University of California. All rights reserved. * Copyright (c) 2000 @@ -364,26 +366,29 @@ struct dumperinfo { off_t mediaoffset; /* Initial offset in bytes. */ off_t mediasize; /* Space available in bytes. */ void *blockbuf; /* Buffer for padding shorter dump blocks */ + off_t dumpoff; /* Offset of ongoing kernel dump. */ struct kerneldumpcrypto *kdc; /* Kernel dump crypto. */ + struct kerneldumpgz *kdgz; /* Kernel dump compression. */ }; -int set_dumper(struct dumperinfo *di, const char *devname, struct thread *td, - uint8_t encrypt, const uint8_t *key, uint32_t encryptedkeysize, - const uint8_t *encryptedkey); -void dump_init_header(const struct dumperinfo *di, struct kerneldumpheader *kdh, - char *magic, uint32_t archver, uint64_t dumplen); -int dump_start(struct dumperinfo *di, struct kerneldumpheader *kdh, - off_t *dumplop); -int dump_finish(struct dumperinfo *di, struct kerneldumpheader *kdh, - off_t dumplo); -int dump_write(struct dumperinfo *, void *, vm_offset_t, off_t, size_t); -int doadump(boolean_t); #ifndef __rtems__ extern int dumping; /* system is dumping */ #else /* __rtems__ */ -#define dumping 0 +#define dumping 0 #endif /* __rtems__ */ +int doadump(boolean_t); +int set_dumper(struct dumperinfo *di, const char *devname, struct thread *td, + uint8_t compression, uint8_t encryption, const uint8_t *key, + uint32_t encryptedkeysize, const uint8_t *encryptedkey); + +int dump_start(struct dumperinfo *di, struct kerneldumpheader *kdh); +int dump_append(struct dumperinfo *, void *, vm_offset_t, size_t); +int dump_write(struct dumperinfo *, void *, vm_offset_t, off_t, size_t); +int dump_finish(struct dumperinfo *di, struct kerneldumpheader *kdh); +void dump_init_header(const struct dumperinfo *di, struct kerneldumpheader *kdh, + char *magic, uint32_t archver, uint64_t dumplen); + #endif /* _KERNEL */ #endif /* !_SYS_CONF_H_ */ diff --git a/freebsd/sys/sys/cons.h b/freebsd/sys/sys/cons.h index 78cba61e..aded0459 100644 --- a/freebsd/sys/sys/cons.h +++ b/freebsd/sys/sys/cons.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1988 University of Utah. * Copyright (c) 1991 The Regents of the University of California. * All rights reserved. diff --git a/freebsd/sys/sys/counter.h b/freebsd/sys/sys/counter.h index 5046d41d..418141a5 100644 --- a/freebsd/sys/sys/counter.h +++ b/freebsd/sys/sys/counter.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2012 Gleb Smirnoff <glebius@FreeBSD.org> * All rights reserved. * diff --git a/freebsd/sys/sys/cpu.h b/freebsd/sys/sys/cpu.h index f159e376..b3b745ab 100644 --- a/freebsd/sys/sys/cpu.h +++ b/freebsd/sys/sys/cpu.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2005-2007 Nate Lawson (SDG) * All rights reserved. * diff --git a/freebsd/sys/sys/ctype.h b/freebsd/sys/sys/ctype.h index 57b848b5..b2a1fa93 100644 --- a/freebsd/sys/sys/ctype.h +++ b/freebsd/sys/sys/ctype.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1982, 1988, 1991, 1993 * The Regents of the University of California. All rights reserved. * (c) UNIX System Laboratories, Inc. diff --git a/freebsd/sys/sys/domain.h b/freebsd/sys/sys/domain.h index 64da7ed7..513d624b 100644 --- a/freebsd/sys/sys/domain.h +++ b/freebsd/sys/sys/domain.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1982, 1986, 1993 * The Regents of the University of California. All rights reserved. * diff --git a/freebsd/sys/sys/eventhandler.h b/freebsd/sys/sys/eventhandler.h index b071c639..cc423752 100644 --- a/freebsd/sys/sys/eventhandler.h +++ b/freebsd/sys/sys/eventhandler.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 1999 Michael Smith <msmith@freebsd.org> * All rights reserved. * @@ -51,8 +53,7 @@ struct eventhandler_entry_vimage { struct eventhandler_list { char *el_name; - int el_flags; -#define EHL_INITTED (1<<0) + int el_flags; /* Unused. */ u_int el_runcount; struct mtx el_lock; TAILQ_ENTRY(eventhandler_list) el_link; @@ -72,8 +73,6 @@ typedef struct eventhandler_entry *eventhandler_tag; struct eventhandler_entry *_ep; \ struct eventhandler_entry_ ## name *_t; \ \ - KASSERT((list)->el_flags & EHL_INITTED, \ - ("eventhandler_invoke: running non-inited list")); \ EHL_LOCK_ASSERT((list), MA_OWNED); \ (list)->el_runcount++; \ KASSERT((list)->el_runcount > 0, \ @@ -98,10 +97,41 @@ typedef struct eventhandler_entry *eventhandler_tag; } while (0) /* - * Slow handlers are entirely dynamic; lists are created - * when entries are added to them, and thus have no concept of "owner", - * - * Slow handlers need to be declared, but do not need to be defined. The + * You can optionally use the EVENTHANDLER_LIST and EVENTHANDLER_DIRECT macros + * to pre-define a symbol for the eventhandler list. This symbol can be used by + * EVENTHANDLER_DIRECT_INVOKE, which has the advantage of not needing to do a + * locked search of the global list of eventhandler lists. At least + * EVENTHANDLER_LIST_DEFINE must be be used for EVENTHANDLER_DIRECT_INVOKE to + * work. EVENTHANDLER_LIST_DECLARE is only needed if the call to + * EVENTHANDLER_DIRECT_INVOKE is in a different compilation unit from + * EVENTHANDLER_LIST_DEFINE. If the events are even relatively high frequency + * it is suggested that you directly define a list for them. + */ +#define EVENTHANDLER_LIST_DECLARE(name) \ +extern struct eventhandler_list *_eventhandler_list_ ## name \ + +#define EVENTHANDLER_LIST_DEFINE(name) \ +struct eventhandler_list *_eventhandler_list_ ## name ; \ +static void _ehl_init_ ## name (void * ctx __unused) \ +{ \ + _eventhandler_list_ ## name = eventhandler_create_list(#name); \ +} \ +SYSINIT(name ## _ehl_init, SI_SUB_EVENTHANDLER, SI_ORDER_ANY, \ + _ehl_init_ ## name, NULL); \ + struct __hack + +#define EVENTHANDLER_DIRECT_INVOKE(name, ...) do { \ + struct eventhandler_list *_el; \ + \ + _el = _eventhandler_list_ ## name ; \ + if (!TAILQ_EMPTY(&_el->el_entries)) { \ + EHL_LOCK(_el); \ + _EVENTHANDLER_INVOKE(name, _el , ## __VA_ARGS__); \ + } \ +} while (0) + +/* + * Event handlers need to be declared, but do not need to be defined. The * declaration must be in scope wherever the handler is to be invoked. */ #define EVENTHANDLER_DECLARE(name, type) \ @@ -141,14 +171,24 @@ do { \ if ((_el = eventhandler_find_list(#name)) != NULL) \ eventhandler_deregister(_el, tag); \ } while(0) - + +#define EVENTHANDLER_DEREGISTER_NOWAIT(name, tag) \ +do { \ + struct eventhandler_list *_el; \ + \ + if ((_el = eventhandler_find_list(#name)) != NULL) \ + eventhandler_deregister_nowait(_el, tag); \ +} while(0) eventhandler_tag eventhandler_register(struct eventhandler_list *list, const char *name, void *func, void *arg, int priority); void eventhandler_deregister(struct eventhandler_list *list, eventhandler_tag tag); +void eventhandler_deregister_nowait(struct eventhandler_list *list, + eventhandler_tag tag); struct eventhandler_list *eventhandler_find_list(const char *name); void eventhandler_prune_list(struct eventhandler_list *list); +struct eventhandler_list *eventhandler_create_list(const char *name); #ifdef VIMAGE typedef void (*vimage_iterator_func_t)(void *, ...); @@ -284,4 +324,15 @@ typedef void (*swapoff_fn)(void *, struct swdevt *); EVENTHANDLER_DECLARE(swapon, swapon_fn); EVENTHANDLER_DECLARE(swapoff, swapoff_fn); +/* newbus device events */ +enum evhdev_detach { + EVHDEV_DETACH_BEGIN, /* Before detach() is called */ + EVHDEV_DETACH_COMPLETE, /* After detach() returns 0 */ + EVHDEV_DETACH_FAILED /* After detach() returns err */ +}; +typedef void (*device_attach_fn)(void *, device_t); +typedef void (*device_detach_fn)(void *, device_t, enum evhdev_detach); +EVENTHANDLER_DECLARE(device_attach, device_attach_fn); +EVENTHANDLER_DECLARE(device_detach, device_detach_fn); + #endif /* _SYS_EVENTHANDLER_H_ */ diff --git a/freebsd/sys/sys/eventvar.h b/freebsd/sys/sys/eventvar.h index 335a6191..8afaa1aa 100644 --- a/freebsd/sys/sys/eventvar.h +++ b/freebsd/sys/sys/eventvar.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 1999,2000 Jonathan Lemon <jlemon@FreeBSD.org> * All rights reserved. * diff --git a/freebsd/sys/sys/fail.h b/freebsd/sys/sys/fail.h index 34695bc8..41e07bae 100644 --- a/freebsd/sys/sys/fail.h +++ b/freebsd/sys/sys/fail.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2009 Isilon Inc http://www.isilon.com/ * * Redistribution and use in source and binary forms, with or without diff --git a/freebsd/sys/sys/file.h b/freebsd/sys/sys/file.h index 2adbd0af..a566e69c 100644 --- a/freebsd/sys/sys/file.h +++ b/freebsd/sys/sys/file.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1982, 1986, 1989, 1993 * The Regents of the University of California. All rights reserved. * diff --git a/freebsd/sys/sys/filedesc.h b/freebsd/sys/sys/filedesc.h index 457898ef..5a0b2db1 100644 --- a/freebsd/sys/sys/filedesc.h +++ b/freebsd/sys/sys/filedesc.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1990, 1993 * The Regents of the University of California. All rights reserved. * diff --git a/freebsd/sys/sys/firmware.h b/freebsd/sys/sys/firmware.h index ce02831a..8a9b2cf2 100644 --- a/freebsd/sys/sys/firmware.h +++ b/freebsd/sys/sys/firmware.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2005, Sam Leffler <sam@errno.com> * All rights reserved. * diff --git a/freebsd/sys/sys/gpio.h b/freebsd/sys/sys/gpio.h index dbe55872..2505269d 100644 --- a/freebsd/sys/sys/gpio.h +++ b/freebsd/sys/sys/gpio.h @@ -1,6 +1,8 @@ /* $NetBSD: gpio.h,v 1.7 2009/09/25 20:27:50 mbalmer Exp $ */ /* $OpenBSD: gpio.h,v 1.7 2008/11/26 14:51:20 mbalmer Exp $ */ /*- + * SPDX-License-Identifier: (BSD-2-Clause-FreeBSD AND ISC) + * * Copyright (c) 2009, Oleksandr Tymoshenko <gonzo@FreeBSD.org> * All rights reserved. * diff --git a/freebsd/sys/sys/hash.h b/freebsd/sys/sys/hash.h index 8abf17bb..35e76ec7 100644 --- a/freebsd/sys/sys/hash.h +++ b/freebsd/sys/sys/hash.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2001 Tobias Weingartner * All rights reserved. * diff --git a/freebsd/sys/sys/hhook.h b/freebsd/sys/sys/hhook.h index 1d60dd3b..76c827e6 100644 --- a/freebsd/sys/sys/hhook.h +++ b/freebsd/sys/sys/hhook.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2010,2013 Lawrence Stewart <lstewart@freebsd.org> * Copyright (c) 2010 The FreeBSD Foundation * All rights reserved. diff --git a/freebsd/sys/sys/interrupt.h b/freebsd/sys/sys/interrupt.h index 44b769f2..7c9aad4d 100644 --- a/freebsd/sys/sys/interrupt.h +++ b/freebsd/sys/sys/interrupt.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 1997, Stefan Esser <se@freebsd.org> * All rights reserved. * diff --git a/freebsd/sys/sys/jail.h b/freebsd/sys/sys/jail.h index bc9025cf..3bbbf5e0 100644 --- a/freebsd/sys/sys/jail.h +++ b/freebsd/sys/sys/jail.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 1999 Poul-Henning Kamp. * Copyright (c) 2009 James Gritton. * All rights reserved. diff --git a/freebsd/sys/sys/kenv.h b/freebsd/sys/sys/kenv.h index 0a30ddb3..fd1ae31f 100644 --- a/freebsd/sys/sys/kenv.h +++ b/freebsd/sys/sys/kenv.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2002 Maxime Henrion <mux@FreeBSD.org> * All rights reserved. * diff --git a/freebsd/sys/sys/kernel.h b/freebsd/sys/sys/kernel.h index 051173f7..1cc03275 100644 --- a/freebsd/sys/sys/kernel.h +++ b/freebsd/sys/sys/kernel.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-4-Clause + * * Copyright (c) 1995 Terrence R. Lambert * All rights reserved. * diff --git a/freebsd/sys/sys/khelp.h b/freebsd/sys/sys/khelp.h index f542b148..54c4791d 100644 --- a/freebsd/sys/sys/khelp.h +++ b/freebsd/sys/sys/khelp.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2010 Lawrence Stewart <lstewart@freebsd.org> * Copyright (c) 2010 The FreeBSD Foundation * All rights reserved. diff --git a/freebsd/sys/sys/kobj.h b/freebsd/sys/sys/kobj.h index 862e79f0..5f8b2bb0 100644 --- a/freebsd/sys/sys/kobj.h +++ b/freebsd/sys/sys/kobj.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2000,2003 Doug Rabson * All rights reserved. * diff --git a/freebsd/sys/sys/kthread.h b/freebsd/sys/sys/kthread.h index b6304f52..e6f1fa41 100644 --- a/freebsd/sys/sys/kthread.h +++ b/freebsd/sys/sys/kthread.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 1999 Peter Wemm <peter@FreeBSD.org> * All rights reserved. * diff --git a/freebsd/sys/sys/ktr.h b/freebsd/sys/sys/ktr.h index 07d7c45b..d9bd2bf6 100644 --- a/freebsd/sys/sys/ktr.h +++ b/freebsd/sys/sys/ktr.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1996 Berkeley Software Design, Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/freebsd/sys/sys/ktr_class.h b/freebsd/sys/sys/ktr_class.h index 4bfc895b..9190ce27 100644 --- a/freebsd/sys/sys/ktr_class.h +++ b/freebsd/sys/sys/ktr_class.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1996 Berkeley Software Design, Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/freebsd/sys/sys/libkern.h b/freebsd/sys/sys/libkern.h index ab47eeaa..4d043f5a 100644 --- a/freebsd/sys/sys/libkern.h +++ b/freebsd/sys/sys/libkern.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1992, 1993 * The Regents of the University of California. All rights reserved. * diff --git a/freebsd/sys/sys/limits.h b/freebsd/sys/sys/limits.h index fdf98ba3..2de06c61 100644 --- a/freebsd/sys/sys/limits.h +++ b/freebsd/sys/sys/limits.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1988, 1993 * The Regents of the University of California. All rights reserved. * diff --git a/freebsd/sys/sys/linker.h b/freebsd/sys/sys/linker.h index 330af02e..6d560574 100644 --- a/freebsd/sys/sys/linker.h +++ b/freebsd/sys/sys/linker.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 1997-2000 Doug Rabson * All rights reserved. * diff --git a/freebsd/sys/sys/linker_set.h b/freebsd/sys/sys/linker_set.h index a310b066..7e33c93f 100755 --- a/freebsd/sys/sys/linker_set.h +++ b/freebsd/sys/sys/linker_set.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 1999 John D. Polstra * Copyright (c) 1999,2001 Peter Wemm <peter@FreeBSD.org> * All rights reserved. @@ -104,10 +106,7 @@ RTEMS_BSD_DEFINE_RWSET_ITEM(set, sym, const void *) = &sym #endif /* __rtems__ */ #else /* !__GNUCLIKE___SECTION */ -#ifndef lint #error this file needs to be ported to your compiler -#endif /* lint */ -#define __MAKE_SET(set, sym) extern void const * const (__set_##set##_sym_##sym) #endif /* __GNUCLIKE___SECTION */ /* diff --git a/freebsd/sys/sys/lock_profile.h b/freebsd/sys/sys/lock_profile.h index bf73ca14..7c7edee4 100644 --- a/freebsd/sys/sys/lock_profile.h +++ b/freebsd/sys/sys/lock_profile.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2006 Kip Macy kmacy@FreeBSD.org * Copyright (c) 2006 Kris Kennaway kris@FreeBSD.org * Copyright (c) 2006 Dag-Erling Smorgrav des@des.no diff --git a/freebsd/sys/sys/lockmgr.h b/freebsd/sys/sys/lockmgr.h index 60749228..03ae6f9e 100644 --- a/freebsd/sys/sys/lockmgr.h +++ b/freebsd/sys/sys/lockmgr.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2008 Attilio Rao <attilio@FreeBSD.org> * All rights reserved. * diff --git a/freebsd/sys/sys/lockstat.h b/freebsd/sys/sys/lockstat.h index 64745052..50747e89 100644 --- a/freebsd/sys/sys/lockstat.h +++ b/freebsd/sys/sys/lockstat.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2008-2009 Stacey Son <sson@FreeBSD.org> * * Redistribution and use in source and binary forms, with or without diff --git a/freebsd/sys/sys/loginclass.h b/freebsd/sys/sys/loginclass.h index 6783123a..9bc14766 100644 --- a/freebsd/sys/sys/loginclass.h +++ b/freebsd/sys/sys/loginclass.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2011 The FreeBSD Foundation * All rights reserved. * diff --git a/freebsd/sys/sys/mac.h b/freebsd/sys/sys/mac.h index 0aa89608..bc12cb75 100644 --- a/freebsd/sys/sys/mac.h +++ b/freebsd/sys/sys/mac.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 1999-2002 Robert N. M. Watson * Copyright (c) 2001-2005 Networks Associates Technology, Inc. * Copyright (c) 2005-2006 SPARTA, Inc. diff --git a/freebsd/sys/sys/malloc.h b/freebsd/sys/sys/malloc.h index c93439f3..c5ab6125 100644 --- a/freebsd/sys/sys/malloc.h +++ b/freebsd/sys/sys/malloc.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1987, 1993 * The Regents of the University of California. * Copyright (c) 2005, 2009 Robert N. M. Watson diff --git a/freebsd/sys/sys/mbuf.h b/freebsd/sys/sys/mbuf.h index ec98aaec..4a91b794 100644 --- a/freebsd/sys/sys/mbuf.h +++ b/freebsd/sys/sys/mbuf.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1982, 1986, 1988, 1993 * The Regents of the University of California. * All rights reserved. @@ -154,14 +156,20 @@ struct pkthdr { /* Layer crossing persistent information. */ uint32_t flowid; /* packet's 4-tuple system */ - uint64_t csum_flags; /* checksum and offload features */ + uint32_t csum_flags; /* checksum and offload features */ uint16_t fibnum; /* this packet should use this fib */ uint8_t cosqos; /* class/quality of service */ uint8_t rsstype; /* hash type */ - uint8_t l2hlen; /* layer 2 header length */ - uint8_t l3hlen; /* layer 3 header length */ - uint8_t l4hlen; /* layer 4 header length */ - uint8_t l5hlen; /* layer 5 header length */ + union { + uint64_t rcv_tstmp; /* timestamp in ns */ + struct { + uint8_t l2hlen; /* layer 2 hdr len */ + uint8_t l3hlen; /* layer 3 hdr len */ + uint8_t l4hlen; /* layer 4 hdr len */ + uint8_t l5hlen; /* layer 5 hdr len */ + uint32_t spare; + }; + }; union { uint8_t eight[8]; uint16_t sixteen[4]; @@ -197,17 +205,33 @@ struct pkthdr { * Compile-time assertions in uipc_mbuf.c test these values to ensure that * they are correct. */ +typedef void m_ext_free_t(struct mbuf *); struct m_ext { union { - volatile u_int ext_count; /* value of ref count info */ - volatile u_int *ext_cnt; /* pointer to ref count info */ + /* + * If EXT_FLAG_EMBREF is set, then we use refcount in the + * mbuf, the 'ext_count' member. Otherwise, we have a + * shadow copy and we use pointer 'ext_cnt'. The original + * mbuf is responsible to carry the pointer to free routine + * and its arguments. They aren't copied into shadows in + * mb_dupcl() to avoid dereferencing next cachelines. + */ + volatile u_int ext_count; + volatile u_int *ext_cnt; }; - caddr_t ext_buf; /* start of buffer */ + char *ext_buf; /* start of buffer */ uint32_t ext_size; /* size of buffer, for ext_free */ uint32_t ext_type:8, /* type of external storage */ ext_flags:24; /* external storage mbuf flags */ - void (*ext_free) /* free routine if not the usual */ - (struct mbuf *, void *, void *); + /* + * Fields below store the free context for the external storage. + * They are valid only in the refcount carrying mbuf, the one with + * EXT_FLAG_EMBREF flag, with exclusion for EXT_EXTREF type, where + * the free context is copied into all mbufs that use same external + * storage. + */ +#define m_ext_copylen offsetof(struct m_ext, ext_free) + m_ext_free_t *ext_free; /* free routine if not the usual */ void *ext_arg1; /* optional argument pointer */ void *ext_arg2; /* optional argument pointer */ }; @@ -277,6 +301,10 @@ struct mbuf { #define M_VLANTAG 0x00000080 /* ether_vtag is valid */ #define M_UNUSED_8 0x00000100 /* --available-- */ #define M_NOFREE 0x00000200 /* do not free mbuf, embedded in cluster */ +#define M_TSTMP 0x00000400 /* rcv_tstmp field is valid */ +#define M_TSTMP_HPREC 0x00000800 /* rcv_tstmp is high-prec, typically + hw-stamped on port (useful for IEEE 1588 + and 802.1AS) */ #define M_PROTO1 0x00001000 /* protocol-specific */ #define M_PROTO2 0x00002000 /* protocol-specific */ @@ -304,15 +332,15 @@ struct mbuf { * Flags preserved when copying m_pkthdr. */ #define M_COPYFLAGS \ - (M_PKTHDR|M_EOR|M_RDONLY|M_BCAST|M_MCAST|M_PROMISC|M_VLANTAG| \ - M_PROTOFLAGS) + (M_PKTHDR|M_EOR|M_RDONLY|M_BCAST|M_MCAST|M_PROMISC|M_VLANTAG|M_TSTMP| \ + M_TSTMP_HPREC|M_PROTOFLAGS) /* * Mbuf flag description for use with printf(9) %b identifier. */ #define M_FLAG_BITS \ "\20\1M_EXT\2M_PKTHDR\3M_EOR\4M_RDONLY\5M_BCAST\6M_MCAST" \ - "\7M_PROMISC\10M_VLANTAG" + "\7M_PROMISC\10M_VLANTAG\13M_TSTMP\14M_TSTMP_HPREC" #define M_FLAG_PROTOBITS \ "\15M_PROTO1\16M_PROTO2\17M_PROTO3\20M_PROTO4\21M_PROTO5" \ "\22M_PROTO6\23M_PROTO7\24M_PROTO8\25M_PROTO9\26M_PROTO10" \ @@ -412,9 +440,6 @@ struct mbuf { #define EXT_JUMBO16 5 /* jumbo cluster 16184 bytes */ #define EXT_PACKET 6 /* mbuf+cluster from packet zone */ #define EXT_MBUF 7 /* external mbuf reference */ -#ifndef __rtems__ -#define EXT_SFBUF_NOCACHE 8 /* sendfile(2)'s sf_buf not to be cached */ -#endif /* __rtems__ */ #define EXT_VENDOR1 224 /* for vendor-internal use */ #define EXT_VENDOR2 225 /* for vendor-internal use */ @@ -440,10 +465,10 @@ struct mbuf { #define EXT_FLAG_NOFREE 0x000010 /* don't free mbuf to pool, notyet */ -#define EXT_FLAG_VENDOR1 0x010000 /* for vendor-internal use */ -#define EXT_FLAG_VENDOR2 0x020000 /* for vendor-internal use */ -#define EXT_FLAG_VENDOR3 0x040000 /* for vendor-internal use */ -#define EXT_FLAG_VENDOR4 0x080000 /* for vendor-internal use */ +#define EXT_FLAG_VENDOR1 0x010000 /* These flags are vendor */ +#define EXT_FLAG_VENDOR2 0x020000 /* or submodule specific, */ +#define EXT_FLAG_VENDOR3 0x040000 /* not used by mbuf code. */ +#define EXT_FLAG_VENDOR4 0x080000 /* Set/read by submodule. */ #define EXT_FLAG_EXP1 0x100000 /* for experimental use */ #define EXT_FLAG_EXP2 0x200000 /* for experimental use */ @@ -460,12 +485,6 @@ struct mbuf { "\30EXT_FLAG_EXP4" /* - * External reference/free functions. - */ -void sf_ext_free(void *, void *); -void sf_ext_free_nocache(void *, void *); - -/* * Flags indicating checksum, segmentation and other offload work to be * done, or already done, by hardware or lower layers. It is split into * separate inbound and outbound flags. @@ -614,9 +633,8 @@ struct mbuf *m_devget(char *, int, int, struct ifnet *, void (*)(char *, caddr_t, u_int)); struct mbuf *m_dup(const struct mbuf *, int); int m_dup_pkthdr(struct mbuf *, const struct mbuf *, int); -void m_extadd(struct mbuf *, caddr_t, u_int, - void (*)(struct mbuf *, void *, void *), void *, void *, - int, int); +void m_extadd(struct mbuf *, char *, u_int, m_ext_free_t, + void *, void *, int, int); u_int m_fixhdr(struct mbuf *); struct mbuf *m_fragment(struct mbuf *, int, int); void m_freem(struct mbuf *); @@ -671,8 +689,8 @@ m_gettype(int size) * Associated an external reference counted buffer with an mbuf. */ static __inline void -m_extaddref(struct mbuf *m, caddr_t buf, u_int size, u_int *ref_cnt, - void (*freef)(struct mbuf *, void *, void *), void *arg1, void *arg2) +m_extaddref(struct mbuf *m, char *buf, u_int size, u_int *ref_cnt, + m_ext_free_t freef, void *arg1, void *arg2) { KASSERT(ref_cnt != NULL, ("%s: ref_cnt not provided", __func__)); @@ -869,7 +887,7 @@ m_extrefcnt(struct mbuf *m) #define MGETHDR(m, how, type) ((m) = m_gethdr((how), (type))) #define MCLGET(m, how) m_clget((m), (how)) #define MEXTADD(m, buf, size, free, arg1, arg2, flags, type) \ - m_extadd((m), (caddr_t)(buf), (size), (free), (arg1), (arg2), \ + m_extadd((m), (char *)(buf), (size), (free), (arg1), (arg2), \ (flags), (type)) #define m_getm(m, len, how, type) \ m_getm2((m), (len), (how), (type), M_PKTHDR) @@ -1345,5 +1363,17 @@ mbufq_concat(struct mbufq *mq_dst, struct mbufq *mq_src) mq_src->mq_len = 0; } +#ifdef _SYS_TIMESPEC_H_ +static inline void +mbuf_tstmp2timespec(struct mbuf *m, struct timespec *ts) +{ + + KASSERT((m->m_flags & M_PKTHDR) != 0, ("mbuf %p no M_PKTHDR", m)); + KASSERT((m->m_flags & M_TSTMP) != 0, ("mbuf %p no M_TSTMP", m)); + ts->tv_sec = m->m_pkthdr.rcv_tstmp / 1000000000; + ts->tv_nsec = m->m_pkthdr.rcv_tstmp % 1000000000; +} +#endif + #endif /* _KERNEL */ #endif /* !_SYS_MBUF_H_ */ diff --git a/freebsd/sys/sys/module.h b/freebsd/sys/sys/module.h index 75471611..eb8b03d8 100644 --- a/freebsd/sys/sys/module.h +++ b/freebsd/sys/sys/module.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 1997 Doug Rabson * All rights reserved. * diff --git a/freebsd/sys/sys/module_khelp.h b/freebsd/sys/sys/module_khelp.h index 371e4c31..a6644027 100644 --- a/freebsd/sys/sys/module_khelp.h +++ b/freebsd/sys/sys/module_khelp.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2010 Lawrence Stewart <lstewart@freebsd.org> * Copyright (c) 2010 The FreeBSD Foundation * All rights reserved. diff --git a/freebsd/sys/sys/mount.h b/freebsd/sys/sys/mount.h index 152b2586..362c54e9 100644 --- a/freebsd/sys/sys/mount.h +++ b/freebsd/sys/sys/mount.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1989, 1991, 1993 * The Regents of the University of California. All rights reserved. * diff --git a/freebsd/sys/sys/mqueue.h b/freebsd/sys/sys/mqueue.h index 36e89fa2..ca9fd13c 100644 --- a/freebsd/sys/sys/mqueue.h +++ b/freebsd/sys/sys/mqueue.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2005 David Xu <davidxu@freebsd.org> * All rights reserved. * diff --git a/freebsd/sys/sys/mutex.h b/freebsd/sys/sys/mutex.h index bd773b58..52587064 100644 --- a/freebsd/sys/sys/mutex.h +++ b/freebsd/sys/sys/mutex.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1997 Berkeley Software Design, Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -68,15 +70,11 @@ * State bits kept in mutex->mtx_lock, for the DEFAULT lock type. None of this, * with the exception of MTX_UNOWNED, applies to spin locks. */ +#define MTX_UNOWNED 0x00000000 /* Cookie for free mutex */ #define MTX_RECURSED 0x00000001 /* lock recursed (for MTX_DEF only) */ #define MTX_CONTESTED 0x00000002 /* lock contested (for MTX_DEF only) */ -#define MTX_UNOWNED 0x00000004 /* Cookie for free mutex */ -#define MTX_FLAGMASK (MTX_RECURSED | MTX_CONTESTED | MTX_UNOWNED) - -/* - * Value stored in mutex->mtx_lock to denote a destroyed mutex. - */ -#define MTX_DESTROYED (MTX_CONTESTED | MTX_UNOWNED) +#define MTX_DESTROYED 0x00000004 /* lock destroyed */ +#define MTX_FLAGMASK (MTX_RECURSED | MTX_CONTESTED | MTX_DESTROYED) /* * Prototypes @@ -101,6 +99,7 @@ void _mtx_destroy(volatile uintptr_t *c); #endif /* __rtems__ */ void mtx_sysinit(void *arg); #ifndef __rtems__ +int _mtx_trylock_flags_int(struct mtx *m, int opts LOCK_FILE_LINE_ARG_DEF); int _mtx_trylock_flags_(volatile uintptr_t *c, int opts, const char *file, int line); #endif /* __rtems__ */ @@ -109,16 +108,20 @@ void mutex_init(void); #if LOCK_DEBUG > 0 void __mtx_lock_sleep(volatile uintptr_t *c, uintptr_t v, int opts, const char *file, int line); -void __mtx_unlock_sleep(volatile uintptr_t *c, int opts, const char *file, - int line); +void __mtx_unlock_sleep(volatile uintptr_t *c, uintptr_t v, int opts, + const char *file, int line); #else void __mtx_lock_sleep(volatile uintptr_t *c, uintptr_t v); -void __mtx_unlock_sleep(volatile uintptr_t *c); +void __mtx_unlock_sleep(volatile uintptr_t *c, uintptr_t v); #endif #ifdef SMP -void _mtx_lock_spin_cookie(volatile uintptr_t *c, uintptr_t v, uintptr_t tid, - int opts, const char *file, int line); +#if LOCK_DEBUG > 0 +void _mtx_lock_spin_cookie(volatile uintptr_t *c, uintptr_t v, int opts, + const char *file, int line); +#else +void _mtx_lock_spin_cookie(volatile uintptr_t *c, uintptr_t v); +#endif #endif void __mtx_lock_flags(volatile uintptr_t *c, int opts, const char *file, int line); @@ -150,11 +153,31 @@ void _mtx_assert(struct mtx *m, int what, const char *file, int line); #endif #ifndef __rtems__ void thread_lock_flags_(struct thread *, int, const char *, int); +#if LOCK_DEBUG > 0 +void _thread_lock(struct thread *td, int opts, const char *file, int line); +#else +void _thread_lock(struct thread *); +#endif +#if defined(LOCK_PROFILING) || defined(KLD_MODULE) #define thread_lock(tdp) \ thread_lock_flags_((tdp), 0, __FILE__, __LINE__) +#elif LOCK_DEBUG > 0 +#define thread_lock(tdp) \ + _thread_lock((tdp), 0, __FILE__, __LINE__) +#else +#define thread_lock(tdp) \ + _thread_lock((tdp)) +#endif + +#if LOCK_DEBUG > 0 #define thread_lock_flags(tdp, opt) \ thread_lock_flags_((tdp), (opt), __FILE__, __LINE__) +#else +#define thread_lock_flags(tdp, opt) \ + _thread_lock(tdp) +#endif + #define thread_unlock(tdp) \ mtx_unlock_spin((tdp)->td_lock) #else /* __rtems__ */ @@ -178,17 +201,22 @@ void thread_lock_flags_(struct thread *, int, const char *, int); #if LOCK_DEBUG > 0 #define _mtx_lock_sleep(m, v, o, f, l) \ __mtx_lock_sleep(&(m)->mtx_lock, v, o, f, l) -#define _mtx_unlock_sleep(m, o, f, l) \ - __mtx_unlock_sleep(&(m)->mtx_lock, o, f, l) +#define _mtx_unlock_sleep(m, v, o, f, l) \ + __mtx_unlock_sleep(&(m)->mtx_lock, v, o, f, l) #else #define _mtx_lock_sleep(m, v, o, f, l) \ __mtx_lock_sleep(&(m)->mtx_lock, v) -#define _mtx_unlock_sleep(m, o, f, l) \ - __mtx_unlock_sleep(&(m)->mtx_lock) +#define _mtx_unlock_sleep(m, v, o, f, l) \ + __mtx_unlock_sleep(&(m)->mtx_lock, v) #endif #ifdef SMP -#define _mtx_lock_spin(m, v, t, o, f, l) \ - _mtx_lock_spin_cookie(&(m)->mtx_lock, v, t, o, f, l) +#if LOCK_DEBUG > 0 +#define _mtx_lock_spin(m, v, o, f, l) \ + _mtx_lock_spin_cookie(&(m)->mtx_lock, v, o, f, l) +#else +#define _mtx_lock_spin(m, v, o, f, l) \ + _mtx_lock_spin_cookie(&(m)->mtx_lock, v) +#endif #endif #define _mtx_lock_flags(m, o, f, l) \ __mtx_lock_flags(&(m)->mtx_lock, o, f, l) @@ -225,6 +253,9 @@ void thread_lock_flags_(struct thread *, int, const char *, int); #define _mtx_release_lock_quick(mp) \ atomic_store_rel_ptr(&(mp)->mtx_lock, MTX_UNOWNED) +#define _mtx_release_lock_fetch(mp, vp) \ + atomic_fcmpset_rel_ptr(&(mp)->mtx_lock, (vp), MTX_UNOWNED) + /* * Full lock operations that are suitable to be inlined in non-debug * kernels. If the lock cannot be acquired or released trivially then @@ -253,11 +284,9 @@ void thread_lock_flags_(struct thread *, int, const char *, int); uintptr_t _v = MTX_UNOWNED; \ \ spinlock_enter(); \ - if (!_mtx_obtain_lock_fetch((mp), &_v, _tid)) \ - _mtx_lock_spin((mp), _v, _tid, (opts), (file), (line)); \ - else \ - LOCKSTAT_PROFILE_OBTAIN_LOCK_SUCCESS(spin__acquire, \ - mp, 0, 0, file, line); \ + if (__predict_false(LOCKSTAT_PROFILE_ENABLED(spin__acquire) || \ + !_mtx_obtain_lock_fetch((mp), &_v, _tid))) \ + _mtx_lock_spin((mp), _v, (opts), (file), (line)); \ } while (0) #define __mtx_trylock_spin(mp, tid, opts, file, line) __extension__ ({ \ uintptr_t _tid = (uintptr_t)(tid); \ @@ -304,11 +333,11 @@ void thread_lock_flags_(struct thread *, int, const char *, int); /* Unlock a normal mutex. */ #define __mtx_unlock(mp, tid, opts, file, line) do { \ - uintptr_t _tid = (uintptr_t)(tid); \ + uintptr_t _v = (uintptr_t)(tid); \ \ if (__predict_false(LOCKSTAT_PROFILE_ENABLED(adaptive__release) ||\ - !_mtx_release_lock((mp), _tid))) \ - _mtx_unlock_sleep((mp), (opts), (file), (line)); \ + !_mtx_release_lock_fetch((mp), &_v))) \ + _mtx_unlock_sleep((mp), _v, (opts), (file), (line)); \ } while (0) /* diff --git a/freebsd/sys/sys/nlist_aout.h b/freebsd/sys/sys/nlist_aout.h index 79260ad6..0e1fa284 100644 --- a/freebsd/sys/sys/nlist_aout.h +++ b/freebsd/sys/sys/nlist_aout.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1991, 1993 * The Regents of the University of California. All rights reserved. * (c) UNIX System Laboratories, Inc. diff --git a/freebsd/sys/sys/osd.h b/freebsd/sys/sys/osd.h index c838e97d..a9824184 100644 --- a/freebsd/sys/sys/osd.h +++ b/freebsd/sys/sys/osd.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2007 Pawel Jakub Dawidek <pjd@FreeBSD.org> * All rights reserved. * diff --git a/freebsd/sys/sys/pciio.h b/freebsd/sys/sys/pciio.h index d70bfbcf..80d2019b 100644 --- a/freebsd/sys/sys/pciio.h +++ b/freebsd/sys/sys/pciio.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 1997, Stefan Esser <se@FreeBSD.ORG> * Copyright (c) 1997, 1998, 1999, Kenneth D. Merry <ken@FreeBSD.ORG> * All rights reserved. diff --git a/freebsd/sys/sys/pcpu.h b/freebsd/sys/sys/pcpu.h index 4430cc87..bfa7f34d 100644 --- a/freebsd/sys/sys/pcpu.h +++ b/freebsd/sys/sys/pcpu.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 2001 Wind River Systems, Inc. * All rights reserved. * Written by: John Baldwin <jhb@FreeBSD.org> diff --git a/freebsd/sys/sys/priv.h b/freebsd/sys/sys/priv.h index ec0943aa..52f1dbd2 100644 --- a/freebsd/sys/sys/priv.h +++ b/freebsd/sys/sys/priv.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2006 nCircle Network Security, Inc. * All rights reserved. * @@ -266,7 +268,7 @@ #define PRIV_VFS_GETFH 327 /* Can retrieve file handles. */ #define PRIV_VFS_GETQUOTA 328 /* getquota(). */ #define PRIV_VFS_LINK 329 /* bsd.hardlink_check_uid */ -#define PRIV_VFS_MKNOD_BAD 330 /* Can mknod() to mark bad inodes. */ +#define PRIV_VFS_MKNOD_BAD 330 /* Was: mknod() can mark bad inodes. */ #define PRIV_VFS_MKNOD_DEV 331 /* Can mknod() to create dev nodes. */ #define PRIV_VFS_MKNOD_WHT 332 /* Can mknod() to create whiteout. */ #define PRIV_VFS_MOUNT 333 /* Can mount(). */ diff --git a/freebsd/sys/sys/proc.h b/freebsd/sys/sys/proc.h index b28c19e6..7178c316 100644 --- a/freebsd/sys/sys/proc.h +++ b/freebsd/sys/sys/proc.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1986, 1989, 1991, 1993 * The Regents of the University of California. All rights reserved. * (c) UNIX System Laboratories, Inc. @@ -1005,6 +1007,7 @@ extern struct proc *initproc, *pageproc; /* Process slots for init, pager. */ extern struct uma_zone *proc_zone; struct proc *pfind(pid_t); /* Find process by id. */ +struct proc *pfind_any(pid_t); /* Find (zombie) process by id. */ struct proc *pfind_locked(pid_t pid); struct pgrp *pgfind(pid_t); /* Find process group by id. */ struct proc *zpfind(pid_t); /* Find zombie process by id. */ diff --git a/freebsd/sys/sys/protosw.h b/freebsd/sys/sys/protosw.h index 33cc2074..096b5077 100644 --- a/freebsd/sys/sys/protosw.h +++ b/freebsd/sys/sys/protosw.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1982, 1986, 1993 * The Regents of the University of California. All rights reserved. * diff --git a/freebsd/sys/sys/racct.h b/freebsd/sys/sys/racct.h index 9b8143f2..ec3322bd 100644 --- a/freebsd/sys/sys/racct.h +++ b/freebsd/sys/sys/racct.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2010 The FreeBSD Foundation * All rights reserved. * diff --git a/freebsd/sys/sys/random.h b/freebsd/sys/sys/random.h index 770a2f76..b022f5a3 100644 --- a/freebsd/sys/sys/random.h +++ b/freebsd/sys/sys/random.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2000-2015, 2017 Mark R. V. Murray * All rights reserved. * @@ -68,9 +70,9 @@ read_random(void *ptr, u_int n) #endif /* - * Note: if you add or remove members of random_entropy_source, remember to also update the - * KASSERT regarding what valid members are in random_harvest_internal(), and remember the - * strings in the static array random_source_descr[] in random_harvestq.c. + * Note: if you add or remove members of random_entropy_source, remember to + * also update the strings in the static array random_source_descr[] in + * random_harvestq.c. * * NOTE: complain loudly to markm@ or on the lists if this enum gets more than 32 * distinct values (0-31)! ENTROPYSOURCE may be == 32, but not > 32. @@ -91,7 +93,8 @@ enum random_entropy_source { RANDOM_UMA, /* Special!! UMA/SLAB Allocator */ RANDOM_ENVIRONMENTAL_END = RANDOM_UMA, /* Fast hardware random-number sources from here on. */ - RANDOM_PURE_OCTEON, + RANDOM_PURE_START, + RANDOM_PURE_OCTEON = RANDOM_PURE_START, RANDOM_PURE_SAFE, RANDOM_PURE_GLXSB, RANDOM_PURE_UBSEC, @@ -105,6 +108,7 @@ enum random_entropy_source { }; #define RANDOM_HARVEST_EVERYTHING_MASK ((1 << (RANDOM_ENVIRONMENTAL_END + 1)) - 1) +#define RANDOM_HARVEST_PURE_MASK (((1 << ENTROPYSOURCE) - 1) & (-1UL << RANDOM_PURE_START)) #define RANDOM_LEGACY_BOOT_ENTROPY_MODULE "/boot/entropy" #define RANDOM_CACHED_BOOT_ENTROPY_MODULE "boot_entropy_cache" @@ -114,10 +118,14 @@ enum random_entropy_source { void random_harvest_queue(const void *, u_int, u_int, enum random_entropy_source); void random_harvest_fast(const void *, u_int, u_int, enum random_entropy_source); void random_harvest_direct(const void *, u_int, u_int, enum random_entropy_source); +void random_harvest_register_source(enum random_entropy_source); +void random_harvest_deregister_source(enum random_entropy_source); #else #define random_harvest_queue(a, b, c, d) do {} while (0) #define random_harvest_fast(a, b, c, d) do {} while (0) #define random_harvest_direct(a, b, c, d) do {} while (0) +#define random_harvest_register_source(a) do {} while (0) +#define random_harvest_deregister_source(a) do {} while (0) #endif #if defined(RANDOM_ENABLE_UMA) diff --git a/freebsd/sys/sys/reboot.h b/freebsd/sys/sys/reboot.h index ec2a5705..d0dff609 100644 --- a/freebsd/sys/sys/reboot.h +++ b/freebsd/sys/sys/reboot.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1982, 1986, 1988, 1993, 1994 * The Regents of the University of California. All rights reserved. * @@ -60,6 +62,7 @@ #define RB_RESERVED2 0x80000 /* reserved for internal use of boot blocks */ #define RB_PAUSE 0x100000 /* pause after each output line during probe */ #define RB_REROOT 0x200000 /* unmount the rootfs and mount it again */ +#define RB_POWERCYCLE 0x400000 /* Power cycle if possible */ #define RB_MULTIPLE 0x20000000 /* use multiple consoles */ #define RB_BOOTINFO 0x80000000 /* have `struct bootinfo *' arg */ diff --git a/freebsd/sys/sys/refcount.h b/freebsd/sys/sys/refcount.h index ea846f8c..e6b26ce4 100644 --- a/freebsd/sys/sys/refcount.h +++ b/freebsd/sys/sys/refcount.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2005 John Baldwin <jhb@FreeBSD.org> * All rights reserved. * diff --git a/freebsd/sys/sys/resourcevar.h b/freebsd/sys/sys/resourcevar.h index d3c50830..b84bc432 100644 --- a/freebsd/sys/sys/resourcevar.h +++ b/freebsd/sys/sys/resourcevar.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1991, 1993 * The Regents of the University of California. All rights reserved. * diff --git a/freebsd/sys/sys/rmlock.h b/freebsd/sys/sys/rmlock.h index c14dcb15..1dd2740c 100644 --- a/freebsd/sys/sys/rmlock.h +++ b/freebsd/sys/sys/rmlock.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 2007 Stephan Uphoff <ups@FreeBSD.org> * All rights reserved. * @@ -120,35 +122,21 @@ void _rm_assert(const struct rmlock *rm, int what, const char *file, struct rm_args { struct rmlock *ra_rm; const char *ra_desc; + int ra_flags; }; -struct rm_args_flags { - struct rmlock *ra_rm; - const char *ra_desc; - int ra_opts; -}; - -#define RM_SYSINIT(name, rm, desc) \ +#define RM_SYSINIT_FLAGS(name, rm, desc, flags) \ static struct rm_args name##_args = { \ (rm), \ (desc), \ + (flags), \ }; \ SYSINIT(name##_rm_sysinit, SI_SUB_LOCK, SI_ORDER_MIDDLE, \ rm_sysinit, &name##_args); \ SYSUNINIT(name##_rm_sysuninit, SI_SUB_LOCK, SI_ORDER_MIDDLE, \ rm_destroy, (rm)) - -#define RM_SYSINIT_FLAGS(name, rm, desc, opts) \ - static struct rm_args name##_args = { \ - (rm), \ - (desc), \ - (opts), \ - }; \ - SYSINIT(name##_rm_sysinit, SI_SUB_LOCK, SI_ORDER_MIDDLE, \ - rm_sysinit_flags, &name##_args); \ - SYSUNINIT(name##_rm_sysuninit, SI_SUB_LOCK, SI_ORDER_MIDDLE, \ - rm_destroy, (rm)) +#define RM_SYSINIT(name, rm, desc) RM_SYSINIT_FLAGS(name, rm, desc, 0) #if defined(INVARIANTS) || defined(INVARIANT_SUPPORT) #define RA_LOCKED LA_LOCKED diff --git a/freebsd/sys/sys/rtprio.h b/freebsd/sys/sys/rtprio.h index 7ffdb732..52915603 100644 --- a/freebsd/sys/sys/rtprio.h +++ b/freebsd/sys/sys/rtprio.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-4-Clause + * * Copyright (c) 1994, Henrik Vestergaard Draboel * All rights reserved. * diff --git a/freebsd/sys/sys/runq.h b/freebsd/sys/sys/runq.h index 50c00eb6..0e3113b1 100644 --- a/freebsd/sys/sys/runq.h +++ b/freebsd/sys/sys/runq.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2001 Jake Burkholder <jake@FreeBSD.org> * All rights reserved. * diff --git a/freebsd/sys/sys/rwlock.h b/freebsd/sys/sys/rwlock.h index 8c1f8e6d..531f10d2 100644 --- a/freebsd/sys/sys/rwlock.h +++ b/freebsd/sys/sys/rwlock.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2006 John Baldwin <jhb@FreeBSD.org> * All rights reserved. * @@ -95,6 +97,9 @@ #define _rw_write_unlock(rw, tid) \ atomic_cmpset_rel_ptr(&(rw)->rw_lock, (tid), RW_UNLOCKED) +#define _rw_write_unlock_fetch(rw, tid) \ + atomic_fcmpset_rel_ptr(&(rw)->rw_lock, (tid), RW_UNLOCKED) + /* * Full lock operations that are suitable to be inlined in non-debug * kernels. If the lock cannot be acquired or released trivially then @@ -109,16 +114,16 @@ \ if (__predict_false(LOCKSTAT_PROFILE_ENABLED(rw__acquire) || \ !_rw_write_lock_fetch((rw), &_v, _tid))) \ - _rw_wlock_hard((rw), _v, _tid, (file), (line)); \ + _rw_wlock_hard((rw), _v, (file), (line)); \ } while (0) /* Release a write lock. */ #define __rw_wunlock(rw, tid, file, line) do { \ - uintptr_t _tid = (uintptr_t)(tid); \ + uintptr_t _v = (uintptr_t)(tid); \ \ if (__predict_false(LOCKSTAT_PROFILE_ENABLED(rw__release) || \ - !_rw_write_unlock((rw), _tid))) \ - _rw_wunlock_hard((rw), _tid, (file), (line)); \ + !_rw_write_unlock_fetch((rw), &_v))) \ + _rw_wunlock_hard((rw), _v, (file), (line)); \ } while (0) #endif /* __rtems__ */ @@ -134,16 +139,22 @@ void rw_sysinit(void *arg); void rw_sysinit_flags(void *arg); int _rw_wowned(const volatile uintptr_t *c); void _rw_wlock_cookie(volatile uintptr_t *c, const char *file, int line); +int __rw_try_wlock_int(struct rwlock *rw LOCK_FILE_LINE_ARG_DEF); int __rw_try_wlock(volatile uintptr_t *c, const char *file, int line); void _rw_wunlock_cookie(volatile uintptr_t *c, const char *file, int line); +void __rw_rlock_int(struct rwlock *rw LOCK_FILE_LINE_ARG_DEF); void __rw_rlock(volatile uintptr_t *c, const char *file, int line); +int __rw_try_rlock_int(struct rwlock *rw LOCK_FILE_LINE_ARG_DEF); int __rw_try_rlock(volatile uintptr_t *c, const char *file, int line); +void _rw_runlock_cookie_int(struct rwlock *rw LOCK_FILE_LINE_ARG_DEF); void _rw_runlock_cookie(volatile uintptr_t *c, const char *file, int line); -void __rw_wlock_hard(volatile uintptr_t *c, uintptr_t v, uintptr_t tid, - const char *file, int line); -void __rw_wunlock_hard(volatile uintptr_t *c, uintptr_t tid, - const char *file, int line); +void __rw_wlock_hard(volatile uintptr_t *c, uintptr_t v + LOCK_FILE_LINE_ARG_DEF); +void __rw_wunlock_hard(volatile uintptr_t *c, uintptr_t v + LOCK_FILE_LINE_ARG_DEF); +int __rw_try_upgrade_int(struct rwlock *rw LOCK_FILE_LINE_ARG_DEF); int __rw_try_upgrade(volatile uintptr_t *c, const char *file, int line); +void __rw_downgrade_int(struct rwlock *rw LOCK_FILE_LINE_ARG_DEF); void __rw_downgrade(volatile uintptr_t *c, const char *file, int line); #if defined(INVARIANTS) || defined(INVARIANT_SUPPORT) void __rw_assert(const volatile uintptr_t *c, int what, const char *file, @@ -190,20 +201,38 @@ void _rw_assert(const struct rwlock *rw, int what, const char *file, __rw_try_wlock(&(rw)->rw_lock, f, l) #define _rw_wunlock(rw, f, l) \ _rw_wunlock_cookie(&(rw)->rw_lock, f, l) -#define _rw_rlock(rw, f, l) \ - __rw_rlock(&(rw)->rw_lock, f, l) #define _rw_try_rlock(rw, f, l) \ __rw_try_rlock(&(rw)->rw_lock, f, l) +#if LOCK_DEBUG > 0 +#define _rw_rlock(rw, f, l) \ + __rw_rlock(&(rw)->rw_lock, f, l) #define _rw_runlock(rw, f, l) \ _rw_runlock_cookie(&(rw)->rw_lock, f, l) -#define _rw_wlock_hard(rw, v, t, f, l) \ - __rw_wlock_hard(&(rw)->rw_lock, v, t, f, l) -#define _rw_wunlock_hard(rw, t, f, l) \ - __rw_wunlock_hard(&(rw)->rw_lock, t, f, l) +#else +#define _rw_rlock(rw, f, l) \ + __rw_rlock_int((struct rwlock *)rw) +#define _rw_runlock(rw, f, l) \ + _rw_runlock_cookie_int((struct rwlock *)rw) +#endif +#if LOCK_DEBUG > 0 +#define _rw_wlock_hard(rw, v, f, l) \ + __rw_wlock_hard(&(rw)->rw_lock, v, f, l) +#define _rw_wunlock_hard(rw, v, f, l) \ + __rw_wunlock_hard(&(rw)->rw_lock, v, f, l) #define _rw_try_upgrade(rw, f, l) \ __rw_try_upgrade(&(rw)->rw_lock, f, l) #define _rw_downgrade(rw, f, l) \ __rw_downgrade(&(rw)->rw_lock, f, l) +#else +#define _rw_wlock_hard(rw, v, f, l) \ + __rw_wlock_hard(&(rw)->rw_lock, v) +#define _rw_wunlock_hard(rw, v, f, l) \ + __rw_wunlock_hard(&(rw)->rw_lock, v) +#define _rw_try_upgrade(rw, f, l) \ + __rw_try_upgrade_int(rw) +#define _rw_downgrade(rw, f, l) \ + __rw_downgrade_int(rw) +#endif #if defined(INVARIANTS) || defined(INVARIANT_SUPPORT) #define _rw_assert(rw, w, f, l) \ __rw_assert(&(rw)->rw_lock, w, f, l) @@ -248,35 +277,21 @@ void _rw_assert(const struct rwlock *rw, int what, const char *file, struct rw_args { void *ra_rw; const char *ra_desc; -}; - -struct rw_args_flags { - void *ra_rw; - const char *ra_desc; int ra_flags; }; -#define RW_SYSINIT(name, rw, desc) \ +#define RW_SYSINIT_FLAGS(name, rw, desc, flags) \ static struct rw_args name##_args = { \ (rw), \ (desc), \ + (flags), \ }; \ SYSINIT(name##_rw_sysinit, SI_SUB_LOCK, SI_ORDER_MIDDLE, \ rw_sysinit, &name##_args); \ SYSUNINIT(name##_rw_sysuninit, SI_SUB_LOCK, SI_ORDER_MIDDLE, \ _rw_destroy, __DEVOLATILE(void *, &(rw)->rw_lock)) - -#define RW_SYSINIT_FLAGS(name, rw, desc, flags) \ - static struct rw_args_flags name##_args = { \ - (rw), \ - (desc), \ - (flags), \ - }; \ - SYSINIT(name##_rw_sysinit, SI_SUB_LOCK, SI_ORDER_MIDDLE, \ - rw_sysinit_flags, &name##_args); \ - SYSUNINIT(name##_rw_sysuninit, SI_SUB_LOCK, SI_ORDER_MIDDLE, \ - _rw_destroy, __DEVOLATILE(void *, &(rw)->rw_lock)) +#define RW_SYSINIT(name, rw, desc) RW_SYSINIT_FLAGS(name, rw, desc, 0) /* * Options passed to rw_init_flags(). diff --git a/freebsd/sys/sys/sbuf.h b/freebsd/sys/sys/sbuf.h index d0f908be..8e958cbe 100644 --- a/freebsd/sys/sys/sbuf.h +++ b/freebsd/sys/sys/sbuf.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2000-2008 Poul-Henning Kamp * Copyright (c) 2000-2008 Dag-Erling Coïdan Smørgrav * All rights reserved. diff --git a/freebsd/sys/sys/sdt.h b/freebsd/sys/sys/sdt.h index c680ea85..424a0e3a 100644 --- a/freebsd/sys/sys/sdt.h +++ b/freebsd/sys/sys/sdt.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright 2006-2008 John Birrell <jb@FreeBSD.org> * * Redistribution and use in source and binary forms, with or without @@ -80,13 +82,14 @@ #include <sys/cdefs.h> #include <sys/linker_set.h> +extern volatile bool sdt_probes_enabled; + #ifndef KDTRACE_HOOKS #define SDT_PROVIDER_DEFINE(prov) #define SDT_PROVIDER_DECLARE(prov) #define SDT_PROBE_DEFINE(prov, mod, func, name) #define SDT_PROBE_DECLARE(prov, mod, func, name) -#define SDT_PROBE_ENABLED(prov, mod, func, name) 0 #define SDT_PROBE(prov, mod, func, name, arg0, arg1, arg2, arg3, arg4) #define SDT_PROBE_ARGTYPE(prov, mod, func, name, num, type, xtype) @@ -161,14 +164,13 @@ SET_DECLARE(sdt_argtypes_set, struct sdt_argtype); #define SDT_PROBE_DECLARE(prov, mod, func, name) \ extern struct sdt_probe sdt_##prov##_##mod##_##func##_##name[1] -#define SDT_PROBE_ENABLED(prov, mod, func, name) \ - __predict_false((sdt_##prov##_##mod##_##func##_##name->id)) - #define SDT_PROBE(prov, mod, func, name, arg0, arg1, arg2, arg3, arg4) do { \ - if (__predict_false(sdt_##prov##_##mod##_##func##_##name->id)) \ + if (__predict_false(sdt_probes_enabled)) { \ + if (__predict_false(sdt_##prov##_##mod##_##func##_##name->id)) \ (*sdt_probe_func)(sdt_##prov##_##mod##_##func##_##name->id, \ (uintptr_t) arg0, (uintptr_t) arg1, (uintptr_t) arg2, \ (uintptr_t) arg3, (uintptr_t) arg4); \ + } \ } while (0) #define SDT_PROBE_ARGTYPE(prov, mod, func, name, num, type, xtype) \ diff --git a/freebsd/sys/sys/selinfo.h b/freebsd/sys/sys/selinfo.h index 85de231e..c5f3ad6b 100644 --- a/freebsd/sys/sys/selinfo.h +++ b/freebsd/sys/sys/selinfo.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1992, 1993 * The Regents of the University of California. All rights reserved. * diff --git a/freebsd/sys/sys/serial.h b/freebsd/sys/sys/serial.h index 1a149a96..3293ebda 100644 --- a/freebsd/sys/sys/serial.h +++ b/freebsd/sys/sys/serial.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2004 Poul-Henning Kamp * All rights reserved. * diff --git a/freebsd/sys/sys/sf_buf.h b/freebsd/sys/sys/sf_buf.h index 6aebe430..08f1d9d7 100644 --- a/freebsd/sys/sys/sf_buf.h +++ b/freebsd/sys/sys/sf_buf.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2014 Gleb Smirnoff <glebius@FreeBSD.org> * Copyright (c) 2003-2004 Alan L. Cox <alc@cs.rice.edu> * All rights reserved. diff --git a/freebsd/sys/sys/sigio.h b/freebsd/sys/sys/sigio.h index e941ae96..6730f48a 100644 --- a/freebsd/sys/sys/sigio.h +++ b/freebsd/sys/sys/sigio.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1990, 1993 * The Regents of the University of California. All rights reserved. * diff --git a/freebsd/sys/sys/signalvar.h b/freebsd/sys/sys/signalvar.h index 22f9ef4a..8735e3a0 100644 --- a/freebsd/sys/sys/signalvar.h +++ b/freebsd/sys/sys/signalvar.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1991, 1993 * The Regents of the University of California. All rights reserved. * diff --git a/freebsd/sys/sys/sleepqueue.h b/freebsd/sys/sys/sleepqueue.h index 30a18933..07530e3b 100644 --- a/freebsd/sys/sys/sleepqueue.h +++ b/freebsd/sys/sys/sleepqueue.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2004 John Baldwin <jhb@FreeBSD.org> * All rights reserved. * diff --git a/freebsd/sys/sys/slicer.h b/freebsd/sys/sys/slicer.h index 53f680d8..1565ecce 100644 --- a/freebsd/sys/sys/slicer.h +++ b/freebsd/sys/sys/slicer.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2012 Semihalf. * All rights reserved. * diff --git a/freebsd/sys/sys/smp.h b/freebsd/sys/sys/smp.h index 9253304f..f1950fa2 100644 --- a/freebsd/sys/sys/smp.h +++ b/freebsd/sys/sys/smp.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: Beerware + * * ---------------------------------------------------------------------------- * "THE BEER-WARE LICENSE" (Revision 42): * <phk@FreeBSD.org> wrote this file. As long as you retain this notice you diff --git a/freebsd/sys/sys/sockbuf.h b/freebsd/sys/sys/sockbuf.h index c9cb4dd7..91a30b6f 100644 --- a/freebsd/sys/sys/sockbuf.h +++ b/freebsd/sys/sys/sockbuf.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1982, 1986, 1990, 1993 * The Regents of the University of California. All rights reserved. * @@ -32,15 +34,9 @@ */ #ifndef _SYS_SOCKBUF_H_ #define _SYS_SOCKBUF_H_ -#include <sys/_lock.h> -#include <sys/_mutex.h> -#include <sys/_sx.h> -#include <sys/_task.h> - -#define SB_MAX (2*1024*1024) /* default for max chars in sockbuf */ /* - * Constants for sb_flags field of struct sockbuf. + * Constants for sb_flags field of struct sockbuf/xsockbuf. */ #define SB_WAIT 0x04 /* someone is waiting for data/space */ #define SB_SEL 0x08 /* someone is selecting */ @@ -59,24 +55,20 @@ #define SBS_CANTRCVMORE 0x0020 /* can't receive more data from peer */ #define SBS_RCVATMARK 0x0040 /* at mark on input */ +#if defined(_KERNEL) || defined(_WANT_SOCKET) +#include <sys/_lock.h> +#include <sys/_mutex.h> +#include <sys/_sx.h> +#include <sys/_task.h> + +#define SB_MAX (2*1024*1024) /* default for max chars in sockbuf */ + struct mbuf; struct sockaddr; struct socket; struct thread; struct selinfo; -struct xsockbuf { - u_int sb_cc; - u_int sb_hiwat; - u_int sb_mbcnt; - u_int sb_mcnt; - u_int sb_ccnt; - u_int sb_mbmax; - int sb_lowat; - int sb_timeo; - short sb_flags; -}; - /* * Variables for socket buffering. * @@ -115,6 +107,7 @@ struct sockbuf { #endif /* __rtems__ */ }; +#endif /* defined(_KERNEL) || defined(_WANT_SOCKET) */ #ifdef _KERNEL /* @@ -176,7 +169,6 @@ struct mbuf * sbsndptr(struct sockbuf *sb, u_int off, u_int len, u_int *moff); struct mbuf * sbsndmbuf(struct sockbuf *sb, u_int off, u_int *moff); -void sbtoxsockbuf(struct sockbuf *sb, struct xsockbuf *xsb); int sbwait(struct sockbuf *sb); int sblock(struct sockbuf *sb, int flags); void sbunlock(struct sockbuf *sb); diff --git a/freebsd/sys/sys/socketvar.h b/freebsd/sys/sys/socketvar.h index 0c5b95ec..d58ac2ea 100644 --- a/freebsd/sys/sys/socketvar.h +++ b/freebsd/sys/sys/socketvar.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1982, 1986, 1990, 1993 * The Regents of the University of California. All rights reserved. * @@ -34,6 +36,12 @@ #ifndef _SYS_SOCKETVAR_H_ #define _SYS_SOCKETVAR_H_ +/* + * Socket generation count type. Also used in xinpcb, xtcpcb, xunpcb. + */ +typedef uint64_t so_gen_t; + +#if defined(_KERNEL) || defined(_WANT_SOCKET) #include <sys/queue.h> /* for TAILQ macros */ #include <sys/selinfo.h> /* for struct selinfo */ #include <sys/_lock.h> @@ -41,7 +49,6 @@ #include <sys/osd.h> #include <sys/_sx.h> #include <sys/sockbuf.h> -#include <sys/sockstate.h> #ifdef _KERNEL #include <sys/caprights.h> #include <sys/sockopt.h> @@ -55,7 +62,6 @@ struct vnet; * handle on protocol and pointer to protocol * private data and error information. */ -typedef uint64_t so_gen_t; typedef int so_upcall_t(struct socket *, void *, int); struct socket; @@ -167,6 +173,39 @@ struct socket { }; }; }; +#endif /* defined(_KERNEL) || defined(_WANT_SOCKET) */ + +/* + * Socket state bits. + * + * Historically, this bits were all kept in the so_state field. For + * locking reasons, they are now in multiple fields, as they are + * locked differently. so_state maintains basic socket state protected + * by the socket lock. so_qstate holds information about the socket + * accept queues. Each socket buffer also has a state field holding + * information relevant to that socket buffer (can't send, rcv). Many + * fields will be read without locks to improve performance and avoid + * lock order issues. However, this approach must be used with caution. + */ +#define SS_NOFDREF 0x0001 /* no file table ref any more */ +#define SS_ISCONNECTED 0x0002 /* socket connected to a peer */ +#define SS_ISCONNECTING 0x0004 /* in process of connecting to peer */ +#define SS_ISDISCONNECTING 0x0008 /* in process of disconnecting */ +#define SS_NBIO 0x0100 /* non-blocking ops */ +#define SS_ASYNC 0x0200 /* async i/o notify */ +#define SS_ISCONFIRMING 0x0400 /* deciding to accept connection req */ +#define SS_ISDISCONNECTED 0x2000 /* socket disconnected from peer */ + +/* + * Protocols can mark a socket as SS_PROTOREF to indicate that, following + * pru_detach, they still want the socket to persist, and will free it + * themselves when they are done. Protocols should only ever call sofree() + * following setting this flag in pru_detach(), and never otherwise, as + * sofree() bypasses socket reference counting. + */ +#define SS_PROTOREF 0x4000 /* strong protocol reference */ + +#ifdef _KERNEL #define SOCK_MTX(so) &(so)->so_lock #define SOCK_LOCK(so) mtx_lock(&(so)->so_lock) @@ -194,32 +233,6 @@ struct socket { } while (0) /* - * Externalized form of struct socket used by the sysctl(3) interface. - */ -struct xsocket { - size_t xso_len; /* length of this structure */ - struct socket *xso_so; /* makes a convenient handle sometimes */ - short so_type; - short so_options; - short so_linger; - short so_state; - caddr_t so_pcb; /* another convenient handle */ - int xso_protocol; - int xso_family; - u_int so_qlen; - u_int so_incqlen; - u_int so_qlimit; - short so_timeo; - u_short so_error; - pid_t so_pgid; - u_long so_oobmark; - struct xsockbuf so_rcv, so_snd; - uid_t so_uid; /* XXX */ -}; - -#ifdef _KERNEL - -/* * Macros for sockets and socket buffering. */ @@ -424,7 +437,6 @@ int sosend_generic(struct socket *so, struct sockaddr *addr, struct uio *uio, struct mbuf *top, struct mbuf *control, int flags, struct thread *td); int soshutdown(struct socket *so, int how); -void sotoxsocket(struct socket *so, struct xsocket *xso); void soupcall_clear(struct socket *, int); void soupcall_set(struct socket *, int, so_upcall_t, void *); void solisten_upcall_set(struct socket *, so_upcall_t, void *); @@ -437,6 +449,14 @@ void sowakeup_aio(struct socket *so, struct sockbuf *sb); void solisten_wakeup(struct socket *); int selsocket(struct socket *so, int events, struct timeval *tv, struct thread *td); +void soisconnected(struct socket *so); +void soisconnecting(struct socket *so); +void soisdisconnected(struct socket *so); +void soisdisconnecting(struct socket *so); +void socantrcvmore(struct socket *so); +void socantrcvmore_locked(struct socket *so); +void socantsendmore(struct socket *so); +void socantsendmore_locked(struct socket *so); /* * Accept filter functions (duh). @@ -453,4 +473,58 @@ int accept_filt_generic_mod_event(module_t mod, int event, void *data); #endif /* _KERNEL */ +/* + * Structure to export socket from kernel to utilities, via sysctl(3). + */ +struct xsocket { + size_t xso_len; /* length of this structure */ + union { + void *xso_so; /* kernel address of struct socket */ + int64_t ph_so; + }; + union { + void *so_pcb; /* kernel address of struct inpcb */ + int64_t ph_pcb; + }; + uint64_t so_oobmark; + int64_t so_spare64[8]; + int32_t xso_protocol; + int32_t xso_family; + uint32_t so_qlen; + uint32_t so_incqlen; + uint32_t so_qlimit; + pid_t so_pgid; + uid_t so_uid; + int32_t so_spare32[8]; + int16_t so_type; + int16_t so_options; + int16_t so_linger; + int16_t so_state; + int16_t so_timeo; + uint16_t so_error; + struct xsockbuf { + uint32_t sb_cc; + uint32_t sb_hiwat; + uint32_t sb_mbcnt; + uint32_t sb_mcnt; + uint32_t sb_ccnt; + uint32_t sb_mbmax; + int32_t sb_lowat; + int32_t sb_timeo; + int16_t sb_flags; + } so_rcv, so_snd; +}; + +#ifdef _KERNEL +void sotoxsocket(struct socket *so, struct xsocket *xso); +void sbtoxsockbuf(struct sockbuf *sb, struct xsockbuf *xsb); +#endif + +/* + * Socket buffer state bits. Exported via libprocstat(3). + */ +#define SBS_CANTSENDMORE 0x0010 /* can't send more data to peer */ +#define SBS_CANTRCVMORE 0x0020 /* can't receive more data from peer */ +#define SBS_RCVATMARK 0x0040 /* at mark on input */ + #endif /* !_SYS_SOCKETVAR_H_ */ diff --git a/freebsd/sys/sys/sockopt.h b/freebsd/sys/sys/sockopt.h index 029e5b4a..7f19ecf8 100644 --- a/freebsd/sys/sys/sockopt.h +++ b/freebsd/sys/sys/sockopt.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1982, 1986, 1990, 1993 * The Regents of the University of California. All rights reserved. * diff --git a/freebsd/sys/sys/stddef.h b/freebsd/sys/sys/stddef.h index 9b6ac537..76aabd86 100644 --- a/freebsd/sys/sys/stddef.h +++ b/freebsd/sys/sys/stddef.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2002 Maxime Henrion <mux@FreeBSD.org> * All rights reserved. * diff --git a/freebsd/sys/sys/stdint.h b/freebsd/sys/sys/stdint.h index 4c41ec14..98915f72 100644 --- a/freebsd/sys/sys/stdint.h +++ b/freebsd/sys/sys/stdint.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2001 Mike Barcroft <mike@FreeBSD.org> * All rights reserved. * diff --git a/freebsd/sys/sys/sx.h b/freebsd/sys/sys/sx.h index 0c95df16..33143057 100644 --- a/freebsd/sys/sys/sx.h +++ b/freebsd/sys/sys/sx.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2007 Attilio Rao <attilio@freebsd.org> * Copyright (c) 2001 Jason Evans <jasone@freebsd.org> * All rights reserved. @@ -43,10 +45,10 @@ #endif #ifdef __rtems__ -#define SX_NOINLINE 1 -#define _sx_slock _bsd__sx_xlock -#define sx_try_slock_ _bsd_sx_try_xlock_ -#define _sx_sunlock _bsd__sx_xunlock +#define SX_NOINLINE 1 +#define sx_try_xlock_ _bsd_sx_try_slock_int +#define sx_try_xlock_int _bsd_sx_try_slock_int +#define _sx_sunlock _bsd__sx_sunlock_int #endif /* __rtems__ */ /* * In general, the sx locks and rwlocks use very similar algorithms. @@ -107,18 +109,45 @@ void sx_sysinit(void *arg); #define sx_init(sx, desc) sx_init_flags((sx), (desc), 0) void sx_init_flags(struct sx *sx, const char *description, int opts); void sx_destroy(struct sx *sx); +int sx_try_slock_int(struct sx *sx LOCK_FILE_LINE_ARG_DEF); +#ifndef __rtems__ int sx_try_slock_(struct sx *sx, const char *file, int line); +int sx_try_xlock_int(struct sx *sx LOCK_FILE_LINE_ARG_DEF); int sx_try_xlock_(struct sx *sx, const char *file, int line); +#endif /* __rtems__ */ +int sx_try_upgrade_int(struct sx *sx LOCK_FILE_LINE_ARG_DEF); +#ifndef __rtems__ int sx_try_upgrade_(struct sx *sx, const char *file, int line); +#endif /* __rtems__ */ +void sx_downgrade_int(struct sx *sx LOCK_FILE_LINE_ARG_DEF); +#ifndef __rtems__ void sx_downgrade_(struct sx *sx, const char *file, int line); +#endif /* __rtems__ */ +int _sx_slock_int(struct sx *sx, int opts LOCK_FILE_LINE_ARG_DEF); +#ifndef __rtems__ int _sx_slock(struct sx *sx, int opts, const char *file, int line); int _sx_xlock(struct sx *sx, int opts, const char *file, int line); +#else /* __rtems__ */ +#if (LOCK_DEBUG > 0) +#define _sx_xlock(sx, opts, file, line) \ + _bsd__sx_slock_int(sx, opts, file, line) +#else +#define _sx_xlock(sx, opts, file, line) _bsd__sx_slock_int(sx, opts) +#endif +#endif /* __rtems__ */ +void _sx_sunlock_int(struct sx *sx LOCK_FILE_LINE_ARG_DEF); +#ifndef __rtems__ void _sx_sunlock(struct sx *sx, const char *file, int line); void _sx_xunlock(struct sx *sx, const char *file, int line); -int _sx_xlock_hard(struct sx *sx, uintptr_t v, uintptr_t tid, int opts, - const char *file, int line); -void _sx_xunlock_hard(struct sx *sx, uintptr_t tid, const char *file, int - line); +int _sx_xlock_hard(struct sx *sx, uintptr_t x, int opts LOCK_FILE_LINE_ARG_DEF); +void _sx_xunlock_hard(struct sx *sx, uintptr_t x LOCK_FILE_LINE_ARG_DEF); +#else /* __rtems__ */ +#if (LOCK_DEBUG > 0) +#define _sx_xunlock(sx, file, line) _bsd__sx_sunlock_int(sx, file, line) +#else +#define _sx_xunlock(sx, file, line) _bsd__sx_sunlock_int(sx) +#endif +#endif /* __rtems__ */ #if defined(INVARIANTS) || defined(INVARIANT_SUPPORT) void _sx_assert(const struct sx *sx, int what, const char *file, int line); #endif @@ -164,7 +193,7 @@ __sx_xlock(struct sx *sx, struct thread *td, int opts, const char *file, if (__predict_false(LOCKSTAT_PROFILE_ENABLED(sx__acquire) || !atomic_fcmpset_acq_ptr(&sx->sx_lock, &v, tid))) - error = _sx_xlock_hard(sx, v, tid, opts, file, line); + error = _sx_xlock_hard(sx, v, opts); return (error); } @@ -173,11 +202,11 @@ __sx_xlock(struct sx *sx, struct thread *td, int opts, const char *file, static __inline void __sx_xunlock(struct sx *sx, struct thread *td, const char *file, int line) { - uintptr_t tid = (uintptr_t)td; + uintptr_t x = (uintptr_t)td; if (__predict_false(LOCKSTAT_PROFILE_ENABLED(sx__release) || - !atomic_cmpset_rel_ptr(&sx->sx_lock, tid, SX_LOCK_UNLOCKED))) - _sx_xunlock_hard(sx, tid, file, line); + !atomic_fcmpset_rel_ptr(&sx->sx_lock, &x, SX_LOCK_UNLOCKED))) + _sx_xunlock_hard(sx, x); } #endif #endif /* __rtems__ */ @@ -203,6 +232,7 @@ __sx_xunlock(struct sx *sx, struct thread *td, const char *file, int line) #define sx_xunlock_(sx, file, line) \ __sx_xunlock((sx), curthread, (file), (line)) #endif /* LOCK_DEBUG > 0 || SX_NOINLINE */ +#if (LOCK_DEBUG > 0) #define sx_slock_(sx, file, line) \ (void)_sx_slock((sx), 0, (file), (line)) #define sx_slock_sig_(sx, file, line) \ @@ -213,6 +243,18 @@ __sx_xunlock(struct sx *sx, struct thread *td, const char *file, int line) #define sx_try_xlock(sx) sx_try_xlock_((sx), LOCK_FILE, LOCK_LINE) #define sx_try_upgrade(sx) sx_try_upgrade_((sx), LOCK_FILE, LOCK_LINE) #define sx_downgrade(sx) sx_downgrade_((sx), LOCK_FILE, LOCK_LINE) +#else +#define sx_slock_(sx, file, line) \ + (void)_sx_slock_int((sx), 0) +#define sx_slock_sig_(sx, file, line) \ + _sx_slock_int((sx), SX_INTERRUPTIBLE) +#define sx_sunlock_(sx, file, line) \ + _sx_sunlock_int((sx)) +#define sx_try_slock(sx) sx_try_slock_int((sx)) +#define sx_try_xlock(sx) sx_try_xlock_int((sx)) +#define sx_try_upgrade(sx) sx_try_upgrade_int((sx)) +#define sx_downgrade(sx) sx_downgrade_int((sx)) +#endif #ifdef INVARIANTS #define sx_assert_(sx, what, file, line) \ _sx_assert((sx), (what), (file), (line)) @@ -240,9 +282,6 @@ __sx_xunlock(struct sx *sx, struct thread *td, const char *file, int line) #define sx_xlocked(sx) \ (((sx)->sx_lock & ~(SX_LOCK_FLAGMASK & ~SX_LOCK_SHARED)) == \ (uintptr_t)curthread) -#else /* __rtems__ */ -int sx_xlocked(struct sx *sx); -#endif /* __rtems__ */ #define sx_unlock_(sx, file, line) do { \ if (sx_xlocked(sx)) \ @@ -252,6 +291,14 @@ int sx_xlocked(struct sx *sx); } while (0) #define sx_unlock(sx) sx_unlock_((sx), LOCK_FILE, LOCK_LINE) +#else /* __rtems__ */ +int sx_xlocked(struct sx *sx); +#if (LOCK_DEBUG > 0) +#define sx_unlock(sx) _sx_sunlock_int((sx), LOCK_FILE, LOCK_LINE) +#else +#define sx_unlock(sx) _sx_sunlock_int((sx)) +#endif +#endif /* __rtems__ */ #define sx_sleep(chan, sx, pri, wmesg, timo) \ _sleep((chan), &(sx)->lock_object, (pri), (wmesg), \ diff --git a/freebsd/sys/sys/sysctl.h b/freebsd/sys/sys/sysctl.h index 71da475b..874d226f 100644 --- a/freebsd/sys/sys/sysctl.h +++ b/freebsd/sys/sys/sysctl.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1989, 1993 * The Regents of the University of California. All rights reserved. * @@ -83,6 +85,7 @@ struct ctlname { #define CTLFLAG_RD 0x80000000 /* Allow reads of variable */ #define CTLFLAG_WR 0x40000000 /* Allow writes to the variable */ #define CTLFLAG_RW (CTLFLAG_RD|CTLFLAG_WR) +#define CTLFLAG_DORMANT 0x20000000 /* This sysctl is not active yet */ #define CTLFLAG_ANYBODY 0x10000000 /* All users can set this var */ #define CTLFLAG_SECURE 0x08000000 /* Permit set only if securelevel<=0 */ #define CTLFLAG_PRISON 0x04000000 /* Prisoned roots can fiddle */ @@ -144,7 +147,7 @@ struct ctlname { #define REQ_WIRED 2 /* definitions for sysctl_req 'flags' member */ -#if defined(__amd64__) || defined(__powerpc64__) ||\ +#if defined(__aarch64__) || defined(__amd64__) || defined(__powerpc64__) ||\ (defined(__mips__) && defined(__mips_n64)) #define SCTL_MASK32 1 /* 32 bit emulation */ #endif @@ -223,6 +226,8 @@ int sysctl_dpcpu_quad(SYSCTL_HANDLER_ARGS); * These functions are used to add/remove an oid from the mib. */ void sysctl_register_oid(struct sysctl_oid *oidp); +void sysctl_register_disabled_oid(struct sysctl_oid *oidp); +void sysctl_enable_oid(struct sysctl_oid *oidp); void sysctl_unregister_oid(struct sysctl_oid *oidp); /* Declare a static oid to allow child oids to be added to it. */ diff --git a/freebsd/sys/sys/syslog.h b/freebsd/sys/sys/syslog.h index f31cfb97..071b6842 100644 --- a/freebsd/sys/sys/syslog.h +++ b/freebsd/sys/sys/syslog.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1982, 1986, 1988, 1993 * The Regents of the University of California. All rights reserved. * diff --git a/freebsd/sys/sys/systm.h b/freebsd/sys/sys/systm.h index 92be461b..e89719b8 100644 --- a/freebsd/sys/sys/systm.h +++ b/freebsd/sys/sys/systm.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1982, 1988, 1991, 1993 * The Regents of the University of California. All rights reserved. * (c) UNIX System Laboratories, Inc. @@ -38,10 +40,10 @@ #ifndef _SYS_SYSTM_H_ #define _SYS_SYSTM_H_ +#include <sys/cdefs.h> #include <machine/atomic.h> #include <machine/cpufunc.h> #include <sys/callout.h> -#include <sys/cdefs.h> #include <sys/queue.h> #include <sys/stdint.h> /* for people using printf mainly */ #ifdef __rtems__ @@ -596,6 +598,7 @@ struct unrhdr; struct unrhdr *new_unrhdr(int low, int high, struct mtx *mutex); void init_unrhdr(struct unrhdr *uh, int low, int high, struct mtx *mutex); void delete_unrhdr(struct unrhdr *uh); +void clear_unrhdr(struct unrhdr *uh); void clean_unrhdr(struct unrhdr *uh); void clean_unrhdrl(struct unrhdr *uh); int alloc_unr(struct unrhdr *uh); diff --git a/freebsd/sys/sys/taskqueue.h b/freebsd/sys/sys/taskqueue.h index b5091d32..7ba9e268 100644 --- a/freebsd/sys/sys/taskqueue.h +++ b/freebsd/sys/sys/taskqueue.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2000 Doug Rabson * All rights reserved. * diff --git a/freebsd/sys/sys/timeet.h b/freebsd/sys/sys/timeet.h index 3d50e51d..dc43337d 100644 --- a/freebsd/sys/sys/timeet.h +++ b/freebsd/sys/sys/timeet.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2010-2013 Alexander Motin <mav@FreeBSD.org> * All rights reserved. * diff --git a/freebsd/sys/sys/tree.h b/freebsd/sys/sys/tree.h index c9df686f..539afb42 100644 --- a/freebsd/sys/sys/tree.h +++ b/freebsd/sys/sys/tree.h @@ -3,6 +3,8 @@ /* $FreeBSD$ */ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright 2002 Niels Provos <provos@citi.umich.edu> * All rights reserved. * diff --git a/freebsd/sys/sys/tty.h b/freebsd/sys/sys/tty.h index c37d0bf3..92ad89a6 100644 --- a/freebsd/sys/sys/tty.h +++ b/freebsd/sys/sys/tty.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2008 Ed Schouten <ed@FreeBSD.org> * All rights reserved. * diff --git a/freebsd/sys/sys/ttydevsw.h b/freebsd/sys/sys/ttydevsw.h index 98bebca7..b189335c 100644 --- a/freebsd/sys/sys/ttydevsw.h +++ b/freebsd/sys/sys/ttydevsw.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2008 Ed Schouten <ed@FreeBSD.org> * All rights reserved. * diff --git a/freebsd/sys/sys/ttydisc.h b/freebsd/sys/sys/ttydisc.h index 74a1a0ed..2ab0c05c 100644 --- a/freebsd/sys/sys/ttydisc.h +++ b/freebsd/sys/sys/ttydisc.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2008 Ed Schouten <ed@FreeBSD.org> * All rights reserved. * diff --git a/freebsd/sys/sys/ttyhook.h b/freebsd/sys/sys/ttyhook.h index 2a6d0887..0697a488 100644 --- a/freebsd/sys/sys/ttyhook.h +++ b/freebsd/sys/sys/ttyhook.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2008 Ed Schouten <ed@FreeBSD.org> * All rights reserved. * diff --git a/freebsd/sys/sys/ttyqueue.h b/freebsd/sys/sys/ttyqueue.h index c8d85d62..c1ddaa42 100644 --- a/freebsd/sys/sys/ttyqueue.h +++ b/freebsd/sys/sys/ttyqueue.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2008 Ed Schouten <ed@FreeBSD.org> * All rights reserved. * diff --git a/freebsd/sys/sys/ucred.h b/freebsd/sys/sys/ucred.h index bf5d99d8..37a93357 100644 --- a/freebsd/sys/sys/ucred.h +++ b/freebsd/sys/sys/ucred.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1989, 1993 * The Regents of the University of California. All rights reserved. * diff --git a/freebsd/sys/sys/un.h b/freebsd/sys/sys/un.h index 27d6a499..f83652e0 100644 --- a/freebsd/sys/sys/un.h +++ b/freebsd/sys/sys/un.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1982, 1986, 1993 * The Regents of the University of California. All rights reserved. * diff --git a/freebsd/sys/sys/unpcb.h b/freebsd/sys/sys/unpcb.h index 76bc63a9..1ab3457d 100644 --- a/freebsd/sys/sys/unpcb.h +++ b/freebsd/sys/sys/unpcb.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1982, 1986, 1989, 1993 * The Regents of the University of California. All rights reserved. * @@ -33,6 +35,9 @@ #ifndef _SYS_UNPCB_H_ #define _SYS_UNPCB_H_ +typedef uint64_t unp_gen_t; + +#if defined(_KERNEL) || defined(_WANT_UNPCB) #include <sys/queue.h> #include <sys/ucred.h> @@ -61,7 +66,6 @@ * so that changes in the sockbuf may be computed to modify * back pressure on the sender accordingly. */ -typedef u_quad_t unp_gen_t; LIST_HEAD(unp_head, unpcb); struct unpcb { @@ -78,8 +82,6 @@ struct unpcb { struct unp_head unp_refs; /* referencing socket linked list */ LIST_ENTRY(unpcb) unp_reflink; /* link in unp_refs list */ struct sockaddr_un *unp_addr; /* bound address of socket */ - int reserved1; - int reserved2; unp_gen_t unp_gencnt; /* generation count of this instance */ short unp_flags; /* flags */ short unp_gcflag; /* Garbage collector flags. */ @@ -120,32 +122,50 @@ struct unpcb { #define sotounpcb(so) ((struct unpcb *)((so)->so_pcb)) -/* Hack alert -- this structure depends on <sys/socketvar.h>. */ +#endif /* _KERNEL || _WANT_UNPCB */ + +/* + * UNPCB structure exported to user-land via sysctl(3). + * + * Fields prefixed with "xu_" are unique to the export structure, and fields + * with "unp_" or other prefixes match corresponding fields of 'struct unpcb'. + * + * Legend: + * (s) - used by userland utilities in src + * (p) - used by utilities in ports + * (3) - is known to be used by third party software not in ports + * (n) - no known usage + * + * Evil hack: declare only if sys/socketvar.h have been included. + */ #ifdef _SYS_SOCKETVAR_H_ struct xunpcb { - size_t xu_len; /* length of this structure */ - struct unpcb *xu_unpp; /* to help netstat, fstat */ - struct unpcb xu_unp; /* our information */ + size_t xu_len; /* length of this structure */ + void *xu_unpp; /* to help netstat, fstat */ + void *unp_vnode; /* (s) */ + void *unp_conn; /* (s) */ + void *xu_firstref; /* (s) */ + void *xu_nextref; /* (s) */ + unp_gen_t unp_gencnt; /* (s) */ + int64_t xu_spare64[8]; + int32_t xu_spare32[8]; union { - struct sockaddr_un xuu_addr; /* our bound address */ + struct sockaddr_un xu_addr; /* our bound address */ char xu_dummy1[256]; - } xu_au; -#define xu_addr xu_au.xuu_addr + }; union { - struct sockaddr_un xuu_caddr; /* their bound address */ + struct sockaddr_un xu_caddr; /* their bound address */ char xu_dummy2[256]; - } xu_cau; -#define xu_caddr xu_cau.xuu_caddr - struct xsocket xu_socket; - u_quad_t xu_alignment_hack; -}; + }; + struct xsocket xu_socket; +} __aligned(8); struct xunpgen { size_t xug_len; u_int xug_count; unp_gen_t xug_gen; so_gen_t xug_sogen; -}; +} __aligned(8);; #endif /* _SYS_SOCKETVAR_H_ */ #endif /* _SYS_UNPCB_H_ */ diff --git a/freebsd/sys/sys/user.h b/freebsd/sys/sys/user.h index 9fdb9dd6..f6aa2b3f 100644 --- a/freebsd/sys/sys/user.h +++ b/freebsd/sys/sys/user.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1982, 1986, 1989, 1991, 1993 * The Regents of the University of California. * Copyright (c) 2007 Robert N. M. Watson diff --git a/freebsd/sys/sys/uuid.h b/freebsd/sys/sys/uuid.h index 97971fd7..e60af218 100644 --- a/freebsd/sys/sys/uuid.h +++ b/freebsd/sys/sys/uuid.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2002 Marcel Moolenaar * All rights reserved. * diff --git a/freebsd/sys/sys/vmmeter.h b/freebsd/sys/sys/vmmeter.h index bc536f71..33d96b26 100644 --- a/freebsd/sys/sys/vmmeter.h +++ b/freebsd/sys/sys/vmmeter.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1982, 1986, 1993 * The Regents of the University of California. All rights reserved. * @@ -41,20 +43,23 @@ /* Systemwide totals computed every five seconds. */ struct vmtotal { - int16_t t_rq; /* length of the run queue */ - int16_t t_dw; /* jobs in ``disk wait'' (neg priority) */ - int16_t t_pw; /* jobs in page wait */ - int16_t t_sl; /* jobs sleeping in core */ - int16_t t_sw; /* swapped out runnable/short block jobs */ - int32_t t_vm; /* total virtual memory */ - int32_t t_avm; /* active virtual memory */ - int32_t t_rm; /* total real memory in use */ - int32_t t_arm; /* active real memory */ - int32_t t_vmshr; /* shared virtual memory */ - int32_t t_avmshr; /* active shared virtual memory */ - int32_t t_rmshr; /* shared real memory */ - int32_t t_armshr; /* active shared real memory */ - int32_t t_free; /* free memory pages */ + uint64_t t_vm; /* total virtual memory */ + uint64_t t_avm; /* active virtual memory */ + uint64_t t_rm; /* total real memory in use */ + uint64_t t_arm; /* active real memory */ + uint64_t t_vmshr; /* shared virtual memory */ + uint64_t t_avmshr; /* active shared virtual memory */ + uint64_t t_rmshr; /* shared real memory */ + uint64_t t_armshr; /* active shared real memory */ + uint64_t t_free; /* free memory pages */ + int16_t t_rq; /* length of the run queue */ + int16_t t_dw; /* jobs in ``disk wait'' (neg + priority) */ + int16_t t_pw; /* jobs in page wait */ + int16_t t_sl; /* jobs sleeping in core */ + int16_t t_sw; /* swapped out runnable/short + block jobs */ + uint16_t t_pad[3]; }; #if defined(_KERNEL) || defined(_WANT_VMMETER) @@ -131,7 +136,6 @@ struct vmmeter { u_int v_free_reserved; /* (c) pages reserved for deadlock */ u_int v_free_target; /* (c) pages desired free */ u_int v_free_min; /* (c) pages desired free */ - u_int v_free_count; /* (f) pages free */ u_int v_inactive_target; /* (c) pages desired inactive */ u_int v_pageout_free_min; /* (c) min pages reserved for kernel */ u_int v_interrupt_free_min; /* (c) reserved pages for int code */ @@ -141,6 +145,7 @@ struct vmmeter { u_int v_inactive_count VMMETER_ALIGNED; /* (a) pages inactive */ u_int v_laundry_count VMMETER_ALIGNED; /* (a) pages eligible for laundering */ + u_int v_free_count VMMETER_ALIGNED; /* (f) pages free */ }; #endif /* _KERNEL || _WANT_VMMETER */ @@ -208,10 +213,10 @@ vm_paging_target(void) * Returns TRUE if the pagedaemon needs to be woken up. */ static inline int -vm_paging_needed(void) +vm_paging_needed(u_int free_count) { - return (vm_cnt.v_free_count < vm_pageout_wakeup_thresh); + return (free_count < vm_pageout_wakeup_thresh); } /* diff --git a/freebsd/sys/sys/vnode.h b/freebsd/sys/sys/vnode.h index 0c533063..ac6f4f4e 100644 --- a/freebsd/sys/sys/vnode.h +++ b/freebsd/sys/sys/vnode.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1989, 1993 * The Regents of the University of California. All rights reserved. * diff --git a/freebsd/sys/sys/watchdog.h b/freebsd/sys/sys/watchdog.h index 92c47dee..1b85ce7a 100644 --- a/freebsd/sys/sys/watchdog.h +++ b/freebsd/sys/sys/watchdog.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2003 Poul-Henning Kamp * Copyright (c) 2013 iXsystems.com, * author: Alfred Perlstein <alfred@freebsd.org> diff --git a/freebsd/sys/v850/include/machine/in_cksum.h b/freebsd/sys/v850/include/machine/in_cksum.h index 72edfba9..d55b838b 100644 --- a/freebsd/sys/v850/include/machine/in_cksum.h +++ b/freebsd/sys/v850/include/machine/in_cksum.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1990 The Regents of the University of California. * All rights reserved. * diff --git a/freebsd/sys/vm/uma.h b/freebsd/sys/vm/uma.h index 3781fc8a..6fbe6588 100644 --- a/freebsd/sys/vm/uma.h +++ b/freebsd/sys/vm/uma.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2002, 2003, 2004, 2005 Jeffrey Roberson <jeff@FreeBSD.org> * Copyright (c) 2004, 2005 Bosko Milekic <bmilekic@FreeBSD.org> * All rights reserved. @@ -366,6 +368,11 @@ uma_zfree(uma_zone_t zone, void *item) } /* + * Wait until the specified zone can allocate an item. + */ +void uma_zwait(uma_zone_t zone); + +/* * XXX The rest of the prototypes in this header are h0h0 magic for the VM. * If you think you need to use it for a normal zone you're probably incorrect. */ @@ -603,14 +610,13 @@ void uma_zone_set_freef(uma_zone_t zone, uma_free freef); */ #ifndef __rtems__ #define UMA_SLAB_BOOT 0x01 /* Slab alloced from boot pages */ -#define UMA_SLAB_KMEM 0x02 /* Slab alloced from kmem_map */ #endif /* __rtems__ */ #define UMA_SLAB_KERNEL 0x04 /* Slab alloced from kernel_map */ #ifndef __rtems__ #define UMA_SLAB_PRIV 0x08 /* Slab alloced from priv allocator */ #define UMA_SLAB_OFFP 0x10 /* Slab is managed separately */ #define UMA_SLAB_MALLOC 0x20 /* Slab is a large malloc slab */ -/* 0x40 and 0x80 are available */ +/* 0x02, 0x40 and 0x80 are available */ #endif /* __rtems__ */ /* diff --git a/freebsd/sys/vm/uma_core.c b/freebsd/sys/vm/uma_core.c index c40e682d..3d4abec0 100644 --- a/freebsd/sys/vm/uma_core.c +++ b/freebsd/sys/vm/uma_core.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2002-2005, 2009, 2013 Jeffrey Roberson <jeff@FreeBSD.org> * Copyright (c) 2004, 2005 Bosko Milekic <bmilekic@FreeBSD.org> * Copyright (c) 2004-2006 Robert N. M. Watson @@ -91,6 +93,8 @@ __FBSDID("$FreeBSD$"); #include <ddb/ddb.h> #ifdef __rtems__ + #include <rtems/bsd/bsd.h> + #ifdef RTEMS_SMP #include <rtems/score/smp.h> @@ -168,6 +172,10 @@ static struct mtx uma_boot_pages_mtx; static struct sx uma_drain_lock; +/* kmem soft limit. */ +static unsigned long uma_kmem_limit; +static volatile unsigned long uma_kmem_total; + #ifndef __rtems__ /* Is the VM done starting up? */ static int booted = 0; @@ -320,6 +328,22 @@ static int zone_warnings = 1; SYSCTL_INT(_vm, OID_AUTO, zone_warnings, CTLFLAG_RWTUN, &zone_warnings, 0, "Warn when UMA zones becomes full"); +/* Adjust bytes under management by UMA. */ +static inline void +uma_total_dec(unsigned long size) +{ + + atomic_subtract_long(&uma_kmem_total, size); +} + +static inline void +uma_total_inc(unsigned long size) +{ + + if (atomic_fetchadd_long(&uma_kmem_total, size) > uma_kmem_limit) + uma_reclaim_wakeup(); +} + /* * This routine checks to see whether or not it's safe to enable buckets. */ @@ -872,6 +896,7 @@ keg_free_slab(uma_keg_t keg, uma_slab_t slab, int start) if (keg->uk_flags & UMA_ZONE_OFFPAGE) zone_free_item(keg->uk_slabzone, slab, NULL, SKIP_NONE); keg->uk_freef(mem, PAGE_SIZE * keg->uk_ppera, flags); + uma_total_dec(PAGE_SIZE * keg->uk_ppera); } /* @@ -978,6 +1003,7 @@ keg_alloc_slab(uma_keg_t keg, uma_zone_t zone, int wait) { uma_alloc allocf; uma_slab_t slab; + unsigned long size; uint8_t *mem; uint8_t flags; int i; @@ -988,6 +1014,7 @@ keg_alloc_slab(uma_keg_t keg, uma_zone_t zone, int wait) allocf = keg->uk_allocf; KEG_UNLOCK(keg); + size = keg->uk_ppera * PAGE_SIZE; if (keg->uk_flags & UMA_ZONE_OFFPAGE) { slab = zone_alloc_item(keg->uk_slabzone, NULL, wait); @@ -1011,13 +1038,14 @@ keg_alloc_slab(uma_keg_t keg, uma_zone_t zone, int wait) wait |= M_NODUMP; /* zone is passed for legacy reasons. */ - mem = allocf(zone, keg->uk_ppera * PAGE_SIZE, &flags, wait); + mem = allocf(zone, size, &flags, wait); if (mem == NULL) { if (keg->uk_flags & UMA_ZONE_OFFPAGE) zone_free_item(keg->uk_slabzone, slab, NULL, SKIP_NONE); slab = NULL; goto out; } + uma_total_inc(size); /* Point the slab into the allocated memory */ if (!(keg->uk_flags & UMA_ZONE_OFFPAGE)) @@ -1125,8 +1153,8 @@ page_alloc(uma_zone_t zone, vm_size_t bytes, uint8_t *pflag, int wait) void *p; /* Returned page */ #ifndef __rtems__ - *pflag = UMA_SLAB_KMEM; - p = (void *) kmem_malloc(kmem_arena, bytes, wait); + *pflag = UMA_SLAB_KERNEL; + p = (void *) kmem_malloc(kernel_arena, bytes, wait); #else /* __rtems__ */ *pflag = 0; p = rtems_bsd_page_alloc(bytes, wait); @@ -1162,7 +1190,9 @@ noobj_alloc(uma_zone_t zone, vm_size_t bytes, uint8_t *flags, int wait) npages = howmany(bytes, PAGE_SIZE); while (npages > 0) { p = vm_page_alloc(NULL, 0, VM_ALLOC_INTERRUPT | - VM_ALLOC_WIRED | VM_ALLOC_NOOBJ); + VM_ALLOC_WIRED | VM_ALLOC_NOOBJ | + ((wait & M_WAITOK) != 0 ? VM_ALLOC_WAITOK : + VM_ALLOC_NOWAIT)); if (p != NULL) { /* * Since the page does not belong to an object, its @@ -1172,11 +1202,6 @@ noobj_alloc(uma_zone_t zone, vm_size_t bytes, uint8_t *flags, int wait) npages--; continue; } - if (wait & M_WAITOK) { - VM_WAIT; - continue; - } - /* * Page allocation failed, free intermediate pages and * exit. @@ -1217,9 +1242,7 @@ page_free(void *mem, vm_size_t size, uint8_t flags) #ifndef __rtems__ struct vmem *vmem; - if (flags & UMA_SLAB_KMEM) - vmem = kmem_arena; - else if (flags & UMA_SLAB_KERNEL) + if (flags & UMA_SLAB_KERNEL) vmem = kernel_arena; else panic("UMA: page_free used with invalid flags %x", flags); @@ -1855,6 +1878,8 @@ rtems_bsd_uma_startup(void *unused) { (void) unused; + uma_kmem_limit = (rtems_bsd_get_allocator_domain_size( + RTEMS_BSD_ALLOCATOR_DOMAIN_PAGE) / 4) * 3; sx_init_flags(&uma_drain_lock, "umadrain", SX_RECURSE); uma_startup(NULL, 0); } @@ -2128,6 +2153,15 @@ uma_zdestroy(uma_zone_t zone) sx_sunlock(&uma_drain_lock); } +void +uma_zwait(uma_zone_t zone) +{ + void *item; + + item = uma_zalloc_arg(zone, NULL, M_WAITOK); + uma_zfree(zone, item); +} + /* See uma.h */ void * uma_zalloc_arg(uma_zone_t zone, void *udata, int flags) @@ -3245,33 +3279,35 @@ uma_reclaim(void) sx_xunlock(&uma_drain_lock); } -static int uma_reclaim_needed; +static volatile int uma_reclaim_needed; void uma_reclaim_wakeup(void) { - uma_reclaim_needed = 1; - wakeup(&uma_reclaim_needed); + if (atomic_fetchadd_int(&uma_reclaim_needed, 1) == 0) + wakeup(uma_reclaim); } void uma_reclaim_worker(void *arg __unused) { - sx_xlock(&uma_drain_lock); for (;;) { - sx_sleep(&uma_reclaim_needed, &uma_drain_lock, PVM, - "umarcl", 0); - if (uma_reclaim_needed) { - uma_reclaim_needed = 0; + sx_xlock(&uma_drain_lock); + while (uma_reclaim_needed == 0) + sx_sleep(uma_reclaim, &uma_drain_lock, PVM, "umarcl", + hz); #ifndef __rtems__ - sx_xunlock(&uma_drain_lock); - EVENTHANDLER_INVOKE(vm_lowmem, VM_LOW_KMEM); - sx_xlock(&uma_drain_lock); + sx_xunlock(&uma_drain_lock); + EVENTHANDLER_INVOKE(vm_lowmem, VM_LOW_KMEM); + sx_xlock(&uma_drain_lock); #endif /* __rtems__ */ - uma_reclaim_locked(true); - } + uma_reclaim_locked(true); + atomic_set_int(&uma_reclaim_needed, 0); + sx_xunlock(&uma_drain_lock); + /* Don't fire more than once per-second. */ + pause("umarclslp", hz); } } @@ -3310,6 +3346,7 @@ uma_large_malloc(vm_size_t size, int wait) slab->us_data = mem; slab->us_flags = flags | UMA_SLAB_MALLOC; slab->us_size = size; + uma_total_inc(size); } else { zone_free_item(slabzone, slab, NULL, SKIP_NONE); } @@ -3322,6 +3359,7 @@ uma_large_free(uma_slab_t slab) { page_free(slab->us_data, slab->us_size, slab->us_flags); + uma_total_dec(slab->us_size); zone_free_item(slabzone, slab, NULL, SKIP_NONE); } #endif /* __rtems__ */ @@ -3338,6 +3376,27 @@ uma_zero_item(void *item, uma_zone_t zone) bzero(item, zone->uz_size); } +unsigned long +uma_limit(void) +{ + + return (uma_kmem_limit); +} + +void +uma_set_limit(unsigned long limit) +{ + + uma_kmem_limit = limit; +} + +unsigned long +uma_size(void) +{ + + return uma_kmem_total; +} + void uma_print_stats(void) { diff --git a/freebsd/sys/vm/uma_dbg.c b/freebsd/sys/vm/uma_dbg.c index b7e9c266..9f7fac68 100644 --- a/freebsd/sys/vm/uma_dbg.c +++ b/freebsd/sys/vm/uma_dbg.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2002, 2003, 2004, 2005 Jeffrey Roberson <jeff@FreeBSD.org> * Copyright (c) 2004, 2005 Bosko Milekic <bmilekic@FreeBSD.org> * All rights reserved. diff --git a/freebsd/sys/vm/uma_dbg.h b/freebsd/sys/vm/uma_dbg.h index e3c9df02..c47273b6 100644 --- a/freebsd/sys/vm/uma_dbg.h +++ b/freebsd/sys/vm/uma_dbg.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2002, 2003, 2004, 2005 Jeffrey Roberson <jeff@FreeBSD.org> * Copyright (c) 2004, 2005 Bosko Milekic <bmilekic@FreeBSD.org> * All rights reserved. diff --git a/freebsd/sys/vm/uma_int.h b/freebsd/sys/vm/uma_int.h index df40efcd..592e79d7 100644 --- a/freebsd/sys/vm/uma_int.h +++ b/freebsd/sys/vm/uma_int.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2002-2005, 2009, 2013 Jeffrey Roberson <jeff@FreeBSD.org> * Copyright (c) 2004, 2005 Bosko Milekic <bmilekic@FreeBSD.org> * All rights reserved. @@ -438,6 +440,13 @@ vsetslab(vm_offset_t va, uma_slab_t slab) void *uma_small_alloc(uma_zone_t zone, vm_size_t bytes, uint8_t *pflag, int wait); void uma_small_free(void *mem, vm_size_t size, uint8_t flags); + +/* Set a global soft limit on UMA managed memory. */ +void uma_set_limit(unsigned long limit); +unsigned long uma_limit(void); + +/* Return the amount of memory managed by UMA. */ +unsigned long uma_size(void); #endif /* _KERNEL */ #endif /* VM_UMA_INT_H */ diff --git a/freebsd/sys/vm/vm.h b/freebsd/sys/vm/vm.h index d0945a3d..f674fc56 100644 --- a/freebsd/sys/vm/vm.h +++ b/freebsd/sys/vm/vm.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: (BSD-3-Clause AND MIT-CMU) + * * Copyright (c) 1991, 1993 * The Regents of the University of California. All rights reserved. * diff --git a/freebsd/sys/vm/vm_extern.h b/freebsd/sys/vm/vm_extern.h index 63248e64..c92933ca 100644 --- a/freebsd/sys/vm/vm_extern.h +++ b/freebsd/sys/vm/vm_extern.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1992, 1993 * The Regents of the University of California. All rights reserved. * @@ -71,7 +73,6 @@ void kmem_init(vm_offset_t, vm_offset_t); void kmem_init_zero_region(void); void kmeminit(void); -void swapout_procs(int); int kernacc(void *, int, int); int useracc(void *, int, int); int vm_fault(vm_map_t, vm_offset_t, vm_prot_t, int); diff --git a/freebsd/sys/x86/include/machine/bus.h b/freebsd/sys/x86/include/machine/bus.h index 91de8cb2..041ab156 100644 --- a/freebsd/sys/x86/include/machine/bus.h +++ b/freebsd/sys/x86/include/machine/bus.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-3-Clause AND BSD-2-Clause-NetBSDE + * * Copyright (c) KATO Takenori, 1999. * * All rights reserved. Unpublished rights reserved under the copyright @@ -101,9 +103,7 @@ #include <machine/cpufunc.h> #ifndef __GNUCLIKE_ASM -# ifndef lint -# error "no assembler code for your compiler" -# endif +#error "no assembler code for your compiler" #endif /* diff --git a/freebsd/sys/x86/include/machine/pci_cfgreg.h b/freebsd/sys/x86/include/machine/pci_cfgreg.h index 733b91c4..8083eb0e 100644 --- a/freebsd/sys/x86/include/machine/pci_cfgreg.h +++ b/freebsd/sys/x86/include/machine/pci_cfgreg.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 1997, Stefan Esser <se@freebsd.org> * All rights reserved. * diff --git a/freebsd/sys/x86/pci/pci_bus.c b/freebsd/sys/x86/pci/pci_bus.c index c08e115e..8d37bdcd 100644 --- a/freebsd/sys/x86/pci/pci_bus.c +++ b/freebsd/sys/x86/pci/pci_bus.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-kernel-space.h> /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 1997, Stefan Esser <se@freebsd.org> * All rights reserved. * diff --git a/freebsd/usr.bin/netstat/bpf.c b/freebsd/usr.bin/netstat/bpf.c index 6e7aad31..d5f06ffb 100644 --- a/freebsd/usr.bin/netstat/bpf.c +++ b/freebsd/usr.bin/netstat/bpf.c @@ -5,6 +5,8 @@ #endif /* __rtems__ */ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2005 Christian S.J. Peron * All rights reserved. * diff --git a/freebsd/usr.bin/netstat/if.c b/freebsd/usr.bin/netstat/if.c index 210660bc..c578629e 100644 --- a/freebsd/usr.bin/netstat/if.c +++ b/freebsd/usr.bin/netstat/if.c @@ -5,6 +5,8 @@ #endif /* __rtems__ */ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 2013 Gleb Smirnoff <glebius@FreeBSD.org> * Copyright (c) 1983, 1988, 1993 * The Regents of the University of California. All rights reserved. diff --git a/freebsd/usr.bin/netstat/inet.c b/freebsd/usr.bin/netstat/inet.c index 1b1bb2cb..681fef92 100644 --- a/freebsd/usr.bin/netstat/inet.c +++ b/freebsd/usr.bin/netstat/inet.c @@ -50,6 +50,7 @@ __FBSDID("$FreeBSD$"); #include <sys/domain.h> #include <sys/protosw.h> #include <sys/socket.h> +#define _WANT_SOCKET #include <sys/socketvar.h> #include <sys/sysctl.h> @@ -184,7 +185,7 @@ sotoxsocket(struct socket *so, struct xsocket *xso) xso->xso_family = domain.dom_family; xso->so_timeo = so->so_timeo; xso->so_error = so->so_error; - if (SOLISTENING(so)) { + if ((so->so_options & SO_ACCEPTCONN) != 0) { xso->so_qlen = so->sol_qlen; xso->so_incqlen = so->sol_incqlen; xso->so_qlimit = so->sol_qlimit; diff --git a/freebsd/usr.bin/netstat/inet6.c b/freebsd/usr.bin/netstat/inet6.c index 9d45cde6..9954a89f 100644 --- a/freebsd/usr.bin/netstat/inet6.c +++ b/freebsd/usr.bin/netstat/inet6.c @@ -6,6 +6,8 @@ /* BSDI inet.c,v 2.3 1995/10/24 02:19:29 prb Exp */ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1983, 1988, 1993 * The Regents of the University of California. All rights reserved. * diff --git a/freebsd/usr.bin/netstat/ipsec.c b/freebsd/usr.bin/netstat/ipsec.c index 94763c08..ba0fb483 100644 --- a/freebsd/usr.bin/netstat/ipsec.c +++ b/freebsd/usr.bin/netstat/ipsec.c @@ -7,6 +7,8 @@ /* $KAME: ipsec.c,v 1.33 2003/07/25 09:54:32 itojun Exp $ */ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 2005 NTT Multimedia Communications Laboratories, Inc. * All rights reserved. * diff --git a/freebsd/usr.bin/netstat/main.c b/freebsd/usr.bin/netstat/main.c index 0e51ddc3..067384b4 100644 --- a/freebsd/usr.bin/netstat/main.c +++ b/freebsd/usr.bin/netstat/main.c @@ -5,6 +5,8 @@ #endif /* __rtems__ */ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1983, 1988, 1993 * Regents of the University of California. All rights reserved. * diff --git a/freebsd/usr.bin/netstat/mbuf.c b/freebsd/usr.bin/netstat/mbuf.c index 355be1a6..4dfd70a2 100644 --- a/freebsd/usr.bin/netstat/mbuf.c +++ b/freebsd/usr.bin/netstat/mbuf.c @@ -5,6 +5,8 @@ #endif /* __rtems__ */ /*- + * SPDX-License-Identifier: BSD-4-Clause + * * Copyright (c) 1983, 1988, 1993 * The Regents of the University of California. * Copyright (c) 2005 Robert N. M. Watson diff --git a/freebsd/usr.bin/netstat/mroute.c b/freebsd/usr.bin/netstat/mroute.c index e6143204..f2937e30 100644 --- a/freebsd/usr.bin/netstat/mroute.c +++ b/freebsd/usr.bin/netstat/mroute.c @@ -5,6 +5,8 @@ #endif /* __rtems__ */ /*- + * SPDX-License-Identifier: BSD-4-Clause + * * Copyright (c) 1989 Stephen Deering * Copyright (c) 1992, 1993 * The Regents of the University of California. All rights reserved. diff --git a/freebsd/usr.bin/netstat/mroute6.c b/freebsd/usr.bin/netstat/mroute6.c index c4a87de1..f2849941 100644 --- a/freebsd/usr.bin/netstat/mroute6.c +++ b/freebsd/usr.bin/netstat/mroute6.c @@ -5,6 +5,8 @@ #endif /* __rtems__ */ /*- + * SPDX-License-Identifier: BSD-4-Clause AND BSD-3-Clause + * * Copyright (C) 1998 WIDE Project. * All rights reserved. * diff --git a/freebsd/usr.bin/netstat/netstat.h b/freebsd/usr.bin/netstat/netstat.h index d6402987..0d9e027e 100644 --- a/freebsd/usr.bin/netstat/netstat.h +++ b/freebsd/usr.bin/netstat/netstat.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1992, 1993 * Regents of the University of California. All rights reserved. * diff --git a/freebsd/usr.bin/netstat/pfkey.c b/freebsd/usr.bin/netstat/pfkey.c index ba54a30c..7c234dbe 100644 --- a/freebsd/usr.bin/netstat/pfkey.c +++ b/freebsd/usr.bin/netstat/pfkey.c @@ -7,6 +7,8 @@ /* $NetBSD: inet.c,v 1.35.2.1 1999/04/29 14:57:08 perry Exp $ */ /* $KAME: ipsec.c,v 1.25 2001/03/12 09:04:39 itojun Exp $ */ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (C) 1995, 1996, 1997, 1998, and 1999 WIDE Project. * All rights reserved. * diff --git a/freebsd/usr.bin/netstat/route.c b/freebsd/usr.bin/netstat/route.c index 2a99ad76..2e4682e4 100644 --- a/freebsd/usr.bin/netstat/route.c +++ b/freebsd/usr.bin/netstat/route.c @@ -5,6 +5,8 @@ #endif /* __rtems__ */ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1983, 1988, 1993 * The Regents of the University of California. All rights reserved. * diff --git a/freebsd/usr.bin/netstat/sctp.c b/freebsd/usr.bin/netstat/sctp.c index dc4be803..a2ef4767 100644 --- a/freebsd/usr.bin/netstat/sctp.c +++ b/freebsd/usr.bin/netstat/sctp.c @@ -5,6 +5,8 @@ #endif /* __rtems__ */ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 2001-2007, by Weongyo Jeong. All rights reserved. * Copyright (c) 2011, by Michael Tuexen. All rights reserved. * diff --git a/freebsd/usr.bin/netstat/unix.c b/freebsd/usr.bin/netstat/unix.c index 42093c25..bca42672 100644 --- a/freebsd/usr.bin/netstat/unix.c +++ b/freebsd/usr.bin/netstat/unix.c @@ -5,6 +5,8 @@ #endif /* __rtems__ */ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1983, 1988, 1993 * The Regents of the University of California. All rights reserved. * @@ -52,10 +54,12 @@ __FBSDID("$FreeBSD$"); #include <sys/queue.h> #include <sys/protosw.h> #include <sys/socket.h> +#define _WANT_SOCKET #include <sys/socketvar.h> #include <sys/mbuf.h> #include <sys/sysctl.h> #include <sys/un.h> +#define _WANT_UNPCB #include <sys/unpcb.h> #include <netinet/in.h> @@ -113,7 +117,7 @@ static int pcblist_kvm(u_long count_off, u_long gencnt_off, u_long head_off, char **bufp) { struct unp_head head; - struct unpcb *unp, unp_conn; + struct unpcb *unp, unp0, unp_conn; u_char sun_len; struct socket so; struct xunpgen xug; @@ -163,8 +167,8 @@ pcblist_kvm(u_long count_off, u_long gencnt_off, u_long head_off, char **bufp) KREAD(head_off, &head, sizeof(head)); LIST_FOREACH(unp, &head, unp_link) { xu.xu_unpp = unp; - KREAD(unp, &xu.xu_unp, sizeof (*unp)); - unp = &xu.xu_unp; + KREAD(unp, &unp0, sizeof (*unp)); + unp = &unp0; if (unp->unp_gencnt > unp_gencnt) continue; @@ -251,7 +255,7 @@ unixpr(u_long count_off, u_long gencnt_off, u_long dhead_off, u_long shead_off, so = &xunp->xu_socket; /* Ignore PCBs which were freed during copyout. */ - if (xunp->xu_unp.unp_gencnt > oxug->xug_gen) + if (xunp->unp_gencnt > oxug->xug_gen) continue; if (*first) { xo_open_list("socket"); @@ -285,7 +289,6 @@ unixpr(u_long count_off, u_long gencnt_off, u_long dhead_off, u_long shead_off, static void unixdomainpr(struct xunpcb *xunp, struct xsocket *so) { - struct unpcb *unp; struct sockaddr_un *sa; static int first = 1; char buf1[33]; @@ -309,11 +312,7 @@ unixdomainpr(struct xunpcb *xunp, struct xsocket *so) }; int fmt = (sizeof(void *) == 8) ? 1 : 0; - unp = &xunp->xu_unp; - if (unp->unp_addr) - sa = &xunp->xu_addr; - else - sa = (struct sockaddr_un *)0; + sa = (xunp->xu_addr.sun_family == AF_UNIX) ? &xunp->xu_addr : NULL; if (first && !Lflag) { xo_emit("{T:Active UNIX domain sockets}\n"); @@ -335,10 +334,9 @@ unixdomainpr(struct xunpcb *xunp, struct xsocket *so) } else { xo_emit(format[fmt], (long)so->so_pcb, socktype[so->so_type], so->so_rcv.sb_cc, - so->so_snd.sb_cc, (long)unp->unp_vnode, - (long)unp->unp_conn, - (long)LIST_FIRST(&unp->unp_refs), - (long)LIST_NEXT(unp, unp_reflink)); + so->so_snd.sb_cc, (long)xunp->unp_vnode, + (long)xunp->unp_conn, (long)xunp->xu_firstref, + (long)xunp->xu_nextref); } if (sa) xo_emit(" {:path/%.*s}", diff --git a/freebsd/usr.bin/vmstat/vmstat.c b/freebsd/usr.bin/vmstat/vmstat.c index 7c54ba8d..bd4997d6 100644 --- a/freebsd/usr.bin/vmstat/vmstat.c +++ b/freebsd/usr.bin/vmstat/vmstat.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-user-space.h> -/* +/*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1980, 1986, 1991, 1993 * The Regents of the University of California. All rights reserved. * @@ -719,7 +721,7 @@ getcpuinfo(u_long *maskp, int *maxidp) static void -prthuman(const char *name, u_int64_t val, int size) +prthuman(const char *name, uint64_t val, int size) { char buf[10]; int flags; @@ -871,22 +873,22 @@ dovmstat(unsigned int interval, int reps) total.t_rq - 1, total.t_dw + total.t_pw, total.t_sw); xo_close_container("processes"); xo_open_container("memory"); -#define vmstat_pgtok(a) ((a) * (sum.v_page_size >> 10)) +#define vmstat_pgtok(a) ((uintmax_t)(a) * (sum.v_page_size >> 10)) #define rate(x) (((x) * rate_adj + halfuptime) / uptime) /* round */ if (hflag) { xo_emit(""); prthuman("available-memory", - total.t_avm * (u_int64_t)sum.v_page_size, 5); + total.t_avm * (uint64_t)sum.v_page_size, 5); xo_emit(" "); prthuman("free-memory", - total.t_free * (u_int64_t)sum.v_page_size, 5); + total.t_free * (uint64_t)sum.v_page_size, 5); xo_emit(" "); } else { xo_emit(" "); - xo_emit("{:available-memory/%7d}", + xo_emit("{:available-memory/%7ju}", vmstat_pgtok(total.t_avm)); xo_emit(" "); - xo_emit("{:free-memory/%7d}", + xo_emit("{:free-memory/%7ju}", vmstat_pgtok(total.t_free)); xo_emit(" "); } @@ -1115,7 +1117,7 @@ dosum(void) sum.v_vnodepgsin); xo_emit("{:vnode-page-outs/%9u} {N:vnode pager pageouts}\n", sum.v_vnodeout); - xo_emit("{:vnode-page-outs/%9u} {N:vnode pager pages paged out}\n", + xo_emit("{:vnode-page-out-pages/%9u} {N:vnode pager pages paged out}\n", sum.v_vnodepgsout); xo_emit("{:page-daemon-wakeups/%9u} {N:page daemon wakeups}\n", sum.v_pdwakeups); @@ -1618,9 +1620,9 @@ display_object(struct kinfo_vmobject *kvo) const char *str; xo_open_instance("object"); - xo_emit("{:resident/%5jd} ", (uintmax_t)kvo->kvo_resident); - xo_emit("{:active/%5jd} ", (uintmax_t)kvo->kvo_active); - xo_emit("{:inactive/%5jd} ", (uintmax_t)kvo->kvo_inactive); + xo_emit("{:resident/%5ju} ", (uintmax_t)kvo->kvo_resident); + xo_emit("{:active/%5ju} ", (uintmax_t)kvo->kvo_active); + xo_emit("{:inactive/%5ju} ", (uintmax_t)kvo->kvo_inactive); xo_emit("{:refcount/%3d} ", kvo->kvo_ref_count); xo_emit("{:shadowcount/%3d} ", kvo->kvo_shadow_count); switch (kvo->kvo_memattr) { diff --git a/freebsd/usr.sbin/arp/arp.c b/freebsd/usr.sbin/arp/arp.c index 75853e5e..480bde62 100644 --- a/freebsd/usr.sbin/arp/arp.c +++ b/freebsd/usr.sbin/arp/arp.c @@ -4,7 +4,9 @@ #include "rtems-bsd-arp-namespace.h" #endif /* __rtems__ */ -/* +/*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1984, 1993 * The Regents of the University of California. All rights reserved. * diff --git a/freebsd/usr.sbin/tcpdump/tcpdump/config.h b/freebsd/usr.sbin/tcpdump/tcpdump/config.h index 3a6a3230..354a65db 100644 --- a/freebsd/usr.sbin/tcpdump/tcpdump/config.h +++ b/freebsd/usr.sbin/tcpdump/tcpdump/config.h @@ -20,7 +20,7 @@ /* Casper library support available */ /* See Makefile */ -/* #undef WITH_CASPER */ +/* #undef HAVE_CASPER */ /* Define to 1 if you have the `cap_enter' function. */ #define HAVE_CAP_ENTER 1 diff --git a/freebsd/usr.sbin/wpa/wpa_supplicant/Packet32.c b/freebsd/usr.sbin/wpa/wpa_supplicant/Packet32.c index b22d3488..a3160df5 100644 --- a/freebsd/usr.sbin/wpa/wpa_supplicant/Packet32.c +++ b/freebsd/usr.sbin/wpa/wpa_supplicant/Packet32.c @@ -1,6 +1,8 @@ #include <machine/rtems-bsd-user-space.h> /*- + * SPDX-License-Identifier: BSD-4-Clause + * * Copyright (c) 2005 * Bill Paul <wpaul@windriver.com>. All rights reserved. * diff --git a/freebsd/usr.sbin/wpa/wpa_supplicant/Packet32.h b/freebsd/usr.sbin/wpa/wpa_supplicant/Packet32.h index e0598e70..c96553af 100644 --- a/freebsd/usr.sbin/wpa/wpa_supplicant/Packet32.h +++ b/freebsd/usr.sbin/wpa/wpa_supplicant/Packet32.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-4-Clause + * * Copyright (c) 2005 * Bill Paul <wpaul@windriver.com>. All rights reserved. * @@ -64,6 +64,7 @@ _defaults = { 'freebsd/include', 'freebsd/lib', 'freebsd/lib/libbsdstat', + 'freebsd/lib/libcasper', 'freebsd/lib/libc/include', 'freebsd/lib/libc/isc/include', 'freebsd/lib/libc/resolv', @@ -443,7 +444,6 @@ class base(builder.Module): 'sys/sys/sockbuf.h', 'sys/sys/socketvar.h', 'sys/sys/sockopt.h', - 'sys/sys/sockstate.h', 'sys/sys/stddef.h', 'sys/sys/stdint.h', 'sys/sys/_sx.h', @@ -2591,6 +2591,9 @@ class user_space(builder.Module): 'include/sysexits.h', 'lib/lib80211/lib80211_ioctl.h', 'lib/lib80211/lib80211_regdomain.h', + 'lib/libcasper/libcasper/libcasper.h', + 'lib/libcasper/services/cap_dns/cap_dns.h', + 'lib/libcasper/services/cap_syslog/cap_syslog.h', 'lib/libc/db/btree/btree.h', 'lib/libc/db/btree/extern.h', 'lib/libc/db/recno/extern.h', @@ -3101,11 +3104,12 @@ class crypto_openssl(builder.Module): 'crypto/openssl/crypto/rsa/rsa_locl.h', 'crypto/openssl/crypto/whrlpool/whrlpool.h', 'crypto/openssl/crypto/whrlpool/wp_locl.h', - 'crypto/openssl/crypto/asn1/asn1t.h', - 'crypto/openssl/crypto/asn1/charmap.h', - 'crypto/openssl/crypto/asn1/asn1_mac.h', 'crypto/openssl/crypto/asn1/asn1.h', + 'crypto/openssl/crypto/asn1/asn1_int.h', 'crypto/openssl/crypto/asn1/asn1_locl.h', + 'crypto/openssl/crypto/asn1/asn1_mac.h', + 'crypto/openssl/crypto/asn1/asn1t.h', + 'crypto/openssl/crypto/asn1/charmap.h', 'crypto/openssl/crypto/ec/ec_lcl.h', 'crypto/openssl/crypto/ec/ec.h', 'crypto/openssl/crypto/conf/conf.h', diff --git a/rtemsbsd/include/casper/cap_dns.h b/rtemsbsd/include/casper/cap_dns.h new file mode 100644 index 00000000..5bd73ec5 --- /dev/null +++ b/rtemsbsd/include/casper/cap_dns.h @@ -0,0 +1 @@ +#include <services/cap_dns/cap_dns.h> diff --git a/rtemsbsd/include/casper/cap_syslog.h b/rtemsbsd/include/casper/cap_syslog.h new file mode 100644 index 00000000..783ec98e --- /dev/null +++ b/rtemsbsd/include/casper/cap_syslog.h @@ -0,0 +1 @@ +#include <services/cap_syslog/cap_syslog.h> diff --git a/rtemsbsd/include/libcasper.h b/rtemsbsd/include/libcasper.h new file mode 100644 index 00000000..c65a4711 --- /dev/null +++ b/rtemsbsd/include/libcasper.h @@ -0,0 +1 @@ +#include <libcasper/libcasper.h> diff --git a/rtemsbsd/include/machine/_kernel_lock.h b/rtemsbsd/include/machine/_kernel_lock.h index 5481813a..dc4f8255 100644 --- a/rtemsbsd/include/machine/_kernel_lock.h +++ b/rtemsbsd/include/machine/_kernel_lock.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 1997 Berkeley Software Design, Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -137,9 +139,13 @@ struct lock_class { * operations. Otherwise, use default values to avoid the unneeded bloat. */ #if LOCK_DEBUG > 0 +#define LOCK_FILE_LINE_ARG_DEF , const char *file, int line +#define LOCK_FILE_LINE_ARG , file, line #define LOCK_FILE __FILE__ #define LOCK_LINE __LINE__ #else +#define LOCK_FILE_LINE_ARG_DEF +#define LOCK_FILE_LINE_ARG #define LOCK_FILE NULL #define LOCK_LINE 0 #endif diff --git a/rtemsbsd/include/machine/rtems-bsd-kernel-namespace.h b/rtemsbsd/include/machine/rtems-bsd-kernel-namespace.h index 1d628f90..dd0b2ed2 100644 --- a/rtemsbsd/include/machine/rtems-bsd-kernel-namespace.h +++ b/rtemsbsd/include/machine/rtems-bsd-kernel-namespace.h @@ -61,6 +61,7 @@ #define arpresolve _bsd_arpresolve #define arpresolve_addr _bsd_arpresolve_addr #define arpstat _bsd_arpstat +#define async_crypto _bsd_async_crypto #define auth_algorithm_lookup _bsd_auth_algorithm_lookup #define auth_hash_hmac_md5 _bsd_auth_hash_hmac_md5 #define auth_hash_hmac_ripemd_160 _bsd_auth_hash_hmac_ripemd_160 @@ -530,6 +531,7 @@ #define clean_unrhdr _bsd_clean_unrhdr #define clean_unrhdrl _bsd_clean_unrhdrl #define ClearCheckNewLink _bsd_ClearCheckNewLink +#define clear_unrhdr _bsd_clear_unrhdr #define clk_intr_event _bsd_clk_intr_event #define comp_algo_deflate _bsd_comp_algo_deflate #define comp_algorithm_lookup _bsd_comp_algorithm_lookup @@ -1140,7 +1142,9 @@ #define evdev_support_sw _bsd_evdev_support_sw #define evdev_sysmouse_t_axis _bsd_evdev_sysmouse_t_axis #define evdev_unregister _bsd_evdev_unregister +#define eventhandler_create_list _bsd_eventhandler_create_list #define eventhandler_deregister _bsd_eventhandler_deregister +#define eventhandler_deregister_nowait _bsd_eventhandler_deregister_nowait #define eventhandler_find_list _bsd_eventhandler_find_list #define eventhandler_prune_list _bsd_eventhandler_prune_list #define eventhandler_register _bsd_eventhandler_register @@ -3802,7 +3806,6 @@ #define _rw_rlock _bsd__rw_rlock #define _rw_runlock _bsd__rw_runlock #define rw_sysinit _bsd_rw_sysinit -#define rw_sysinit_flags _bsd_rw_sysinit_flags #define _rw_try_rlock _bsd__rw_try_rlock #define _rw_try_upgrade _bsd__rw_try_upgrade #define _rw_try_wlock _bsd__rw_try_wlock @@ -4523,14 +4526,14 @@ #define swi_add _bsd_swi_add #define swi_sched _bsd_swi_sched #define sx_destroy _bsd_sx_destroy -#define sx_downgrade_ _bsd_sx_downgrade_ +#define sx_downgrade_int _bsd_sx_downgrade_int #define sx_init_flags _bsd_sx_init_flags +#define _sx_slock_int _bsd__sx_slock_int +#define _sx_sunlock_int _bsd__sx_sunlock_int #define sx_sysinit _bsd_sx_sysinit -#define sx_try_upgrade_ _bsd_sx_try_upgrade_ -#define sx_try_xlock_ _bsd_sx_try_xlock_ -#define _sx_xlock _bsd__sx_xlock +#define sx_try_slock_int _bsd_sx_try_slock_int +#define sx_try_upgrade_int _bsd_sx_try_upgrade_int #define sx_xlocked _bsd_sx_xlocked -#define _sx_xunlock _bsd__sx_xunlock #define syncache_add _bsd_syncache_add #define syncache_badack _bsd_syncache_badack #define syncache_chkrst _bsd_syncache_chkrst @@ -4556,6 +4559,7 @@ #define sysctl_ctx_init _bsd_sysctl_ctx_init #define sysctl___debug _bsd_sysctl___debug #define sysctl___dev _bsd_sysctl___dev +#define sysctl_enable_oid _bsd_sysctl_enable_oid #define sysctl_find_oid _bsd_sysctl_find_oid #define sysctl_handle_16 _bsd_sysctl_handle_16 #define sysctl_handle_32 _bsd_sysctl_handle_32 @@ -4625,6 +4629,7 @@ #define sysctl___net_pf _bsd_sysctl___net_pf #define sysctl___net_pfsync _bsd_sysctl___net_pfsync #define sysctl___net_wlan _bsd_sysctl___net_wlan +#define sysctl_register_disabled_oid _bsd_sysctl_register_disabled_oid #define sysctl_register_oid _bsd_sysctl_register_oid #define sysctl_remove_name _bsd_sysctl_remove_name #define sysctl_remove_oid _bsd_sysctl_remove_oid @@ -4741,6 +4746,8 @@ #define tcp_output _bsd_tcp_output #define tcp_persmax _bsd_tcp_persmax #define tcp_persmin _bsd_tcp_persmin +#define tcp_pmtud_blackhole_detect _bsd_tcp_pmtud_blackhole_detect +#define tcp_pmtud_blackhole_mss _bsd_tcp_pmtud_blackhole_mss #define tcp_pulloutofband _bsd_tcp_pulloutofband #define tcp_reass _bsd_tcp_reass #define tcp_reass_flush _bsd_tcp_reass_flush @@ -4787,6 +4794,7 @@ #define tcp_use_hostcache _bsd_tcp_use_hostcache #define tcp_usrreqs _bsd_tcp_usrreqs #define tcp_v6mssdflt _bsd_tcp_v6mssdflt +#define tcp_v6pmtud_blackhole_mss _bsd_tcp_v6pmtud_blackhole_mss #define tcp_xmit_timer _bsd_tcp_xmit_timer #define tc_tick_bt _bsd_tc_tick_bt #define tc_tick_sbt _bsd_tc_tick_sbt @@ -4955,12 +4963,15 @@ #define ulitecb _bsd_ulitecb #define ulitecbinfo _bsd_ulitecbinfo #define uma_align_cache _bsd_uma_align_cache +#define uma_limit _bsd_uma_limit #define uma_print_stats _bsd_uma_print_stats #define uma_print_zone _bsd_uma_print_zone #define uma_reclaim _bsd_uma_reclaim #define uma_reclaim_wakeup _bsd_uma_reclaim_wakeup #define uma_reclaim_worker _bsd_uma_reclaim_worker #define uma_set_align _bsd_uma_set_align +#define uma_set_limit _bsd_uma_set_limit +#define uma_size _bsd_uma_size #define uma_startup _bsd_uma_startup #define uma_zalloc_arg _bsd_uma_zalloc_arg #define uma_zcache_create _bsd_uma_zcache_create @@ -4982,6 +4993,7 @@ #define uma_zone_set_zfini _bsd_uma_zone_set_zfini #define uma_zone_set_zinit _bsd_uma_zone_set_zinit #define uma_zsecond_create _bsd_uma_zsecond_create +#define uma_zwait _bsd_uma_zwait #define untimeout _bsd_untimeout #define usb_alloc_device _bsd_usb_alloc_device #define usb_alloc_mbufs _bsd_usb_alloc_mbufs diff --git a/rtemsbsd/include/rtems/bsd/local/usbdevs.h b/rtemsbsd/include/rtems/bsd/local/usbdevs.h index c48a8765..dbb8b0f2 100644 --- a/rtemsbsd/include/rtems/bsd/local/usbdevs.h +++ b/rtemsbsd/include/rtems/bsd/local/usbdevs.h @@ -1680,8 +1680,10 @@ #define USB_PRODUCT_DLINK_DUB1312 0x4a00 /* 10/100/1000 Ethernet */ #define USB_PRODUCT_DLINK_DWM157 0x7d02 /* DWM-157 */ #define USB_PRODUCT_DLINK_DWR510 0x7e12 /* DWR-510 */ +#define USB_PRODUCT_DLINK_DWM222 0x7e35 /* DWM-222 */ #define USB_PRODUCT_DLINK_DWM157_CD 0xa707 /* DWM-157 CD-ROM Mode */ #define USB_PRODUCT_DLINK_DWR510_CD 0xa805 /* DWR-510 CD-ROM Mode */ +#define USB_PRODUCT_DLINK_DWM222_CD 0xab00 /* DWM-222 CD-ROM Mode */ #define USB_PRODUCT_DLINK_DSB650 0xabc1 /* 10/100 Ethernet */ #define USB_PRODUCT_DLINK_DUBH7 0xf103 /* DUB-H7 USB 2.0 7-Port Hub */ #define USB_PRODUCT_DLINK2_RTL8192SU_1 0x3300 /* RTL8192SU */ @@ -3684,6 +3686,7 @@ #define USB_PRODUCT_PROLIFIC_ATAPI4 0x2307 /* ATAPI-4 Controller */ #define USB_PRODUCT_PROLIFIC_PL2501 0x2501 /* PL2501 Host-Host interface */ #define USB_PRODUCT_PROLIFIC_PL2506 0x2506 /* PL2506 USB to IDE Bridge */ +#define USB_PRODUCT_PROLIFIC_PL27A1 0x27A1 /* PL27A1 USB 3.0 Host-Host interface */ #define USB_PRODUCT_PROLIFIC_HCR331 0x331a /* HCR331 Hybrid Card Reader */ #define USB_PRODUCT_PROLIFIC_PHAROS 0xaaa0 /* Prolific Pharos */ #define USB_PRODUCT_PROLIFIC_RSAQ3 0xaaa2 /* PL2303 Serial Adapter (IODATA USB-RSAQ3) */ @@ -4541,6 +4544,9 @@ #define USB_PRODUCT_TPLINK_T4U 0x0101 /* Archer T4U */ #define USB_PRODUCT_TPLINK_WN822NV4 0x0108 /* TL-WN822N v4 */ #define USB_PRODUCT_TPLINK_WN823NV2 0x0109 /* TL-WN823N v2 */ +#define USB_PRODUCT_TPLINK_T4UV2 0x010d /* Archer T4U ver 2 */ +#define USB_PRODUCT_TPLINK_T4UHV2 0x010e /* Archer T4UH ver 2 */ +#define USB_PRODUCT_TPLINK_RTL8153 0x0601 /* RTL8153 USB 10/100/1000 LAN */ /* Trek Technology products */ #define USB_PRODUCT_TREK_THUMBDRIVE 0x1111 /* ThumbDrive */ diff --git a/rtemsbsd/include/rtems/bsd/local/usbdevs_data.h b/rtemsbsd/include/rtems/bsd/local/usbdevs_data.h index bb52312d..ef168bbf 100644 --- a/rtemsbsd/include/rtems/bsd/local/usbdevs_data.h +++ b/rtemsbsd/include/rtems/bsd/local/usbdevs_data.h @@ -3820,6 +3820,12 @@ const struct usb_knowndev usb_knowndevs[] = { "DWR-510", }, { + USB_VENDOR_DLINK, USB_PRODUCT_DLINK_DWM222, + 0, + "D-Link", + "DWM-222", + }, + { USB_VENDOR_DLINK, USB_PRODUCT_DLINK_DWM157_CD, 0, "D-Link", @@ -3832,6 +3838,12 @@ const struct usb_knowndev usb_knowndevs[] = { "DWR-510 CD-ROM Mode", }, { + USB_VENDOR_DLINK, USB_PRODUCT_DLINK_DWM222_CD, + 0, + "D-Link", + "DWM-222 CD-ROM Mode", + }, + { USB_VENDOR_DLINK, USB_PRODUCT_DLINK_DSB650, 0, "D-Link", @@ -13372,6 +13384,12 @@ const struct usb_knowndev usb_knowndevs[] = { "PL2506 USB to IDE Bridge", }, { + USB_VENDOR_PROLIFIC, USB_PRODUCT_PROLIFIC_PL27A1, + 0, + "Prolific Technology", + "PL27A1 USB 3.0 Host-Host interface", + }, + { USB_VENDOR_PROLIFIC, USB_PRODUCT_PROLIFIC_HCR331, 0, "Prolific Technology", @@ -17404,6 +17422,24 @@ const struct usb_knowndev usb_knowndevs[] = { "TL-WN823N v2", }, { + USB_VENDOR_TPLINK, USB_PRODUCT_TPLINK_T4UV2, + 0, + "TP-Link", + "Archer T4U ver 2", + }, + { + USB_VENDOR_TPLINK, USB_PRODUCT_TPLINK_T4UHV2, + 0, + "TP-Link", + "Archer T4UH ver 2", + }, + { + USB_VENDOR_TPLINK, USB_PRODUCT_TPLINK_RTL8153, + 0, + "TP-Link", + "RTL8153 USB 10/100/1000 LAN", + }, + { USB_VENDOR_TREK, USB_PRODUCT_TREK_THUMBDRIVE, 0, "Trek Technology", diff --git a/rtemsbsd/rtems/rtems-kernel-rwlock.c b/rtemsbsd/rtems/rtems-kernel-rwlock.c index 80918f70..c204c04f 100644 --- a/rtemsbsd/rtems/rtems-kernel-rwlock.c +++ b/rtemsbsd/rtems/rtems-kernel-rwlock.c @@ -119,17 +119,10 @@ rw_destroy(struct rwlock *rw) void rw_sysinit(void *arg) { - struct rw_args *args = arg; + struct rw_args *args; - rw_init(args->ra_rw, args->ra_desc); -} - -void -rw_sysinit_flags(void *arg) -{ - struct rw_args_flags *args = arg; - - rw_init_flags(args->ra_rw, args->ra_desc, args->ra_flags); + args = arg; + rw_init(args->ra_rw, args->ra_desc); } int diff --git a/rtemsbsd/rtems/rtems-kernel-sx.c b/rtemsbsd/rtems/rtems-kernel-sx.c index 7f47bd71..4f8bea4d 100644 --- a/rtemsbsd/rtems/rtems-kernel-sx.c +++ b/rtemsbsd/rtems/rtems-kernel-sx.c @@ -7,7 +7,7 @@ */ /* - * Copyright (c) 2009-2015 embedded brains GmbH. All rights reserved. + * Copyright (c) 2009, 2018 embedded brains GmbH. All rights reserved. * * embedded brains GmbH * Dornierstr. 4 @@ -114,34 +114,38 @@ sx_destroy(struct sx *sx) } int -_sx_xlock(struct sx *sx, int opts, const char *file, int line) +_sx_slock_int(struct sx *sx, int opts LOCK_FILE_LINE_ARG_DEF) { - rtems_bsd_mutex_lock(&sx->lock_object, &sx->mutex); + rtems_bsd_mutex_lock(&sx->lock_object, &sx->mutex); return (0); } int -sx_try_xlock_(struct sx *sx, const char *file, int line) +sx_try_slock_int(struct sx *sx LOCK_FILE_LINE_ARG_DEF) { + return (rtems_bsd_mutex_trylock(&sx->lock_object, &sx->mutex)); } void -_sx_xunlock(struct sx *sx, const char *file, int line) +_sx_sunlock_int(struct sx *sx LOCK_FILE_LINE_ARG_DEF) { + rtems_bsd_mutex_unlock(&sx->mutex); } int -sx_try_upgrade_(struct sx *sx, const char *file, int line) +sx_try_upgrade_int(struct sx *sx LOCK_FILE_LINE_ARG_DEF) { + return (1); } void -sx_downgrade_(struct sx *sx, const char *file, int line) +sx_downgrade_int(struct sx *sx LOCK_FILE_LINE_ARG_DEF) { + /* Do nothing */ } |