diff --git a/UPDATING b/UPDATING index e2723881f234..b7a4a46b9e61 100644 --- a/UPDATING +++ b/UPDATING @@ -56,6 +56,10 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 12.x IS SLOW: Please see the 20141231 entry below for information about prerequisites and upgrading, if you are not already using clang 3.5.0 or higher. +20170112: + The EM_MULTIQUEUE kernel configuration option is deprecated now that + the em(4) driver conforms to iflib specifications. + 20170109: The igb(4), em(4) and lem(4) ethernet drivers are now implemented via IFLIB. If you have a custom kernel configuration that excludes em(4) diff --git a/contrib/elftoolchain/libelftc/elftc_reloc_type_str.c b/contrib/elftoolchain/libelftc/elftc_reloc_type_str.c index 19b23ad52904..fdad9a6448c6 100644 --- a/contrib/elftoolchain/libelftc/elftc_reloc_type_str.c +++ b/contrib/elftoolchain/libelftc/elftc_reloc_type_str.c @@ -501,6 +501,120 @@ elftc_reloc_type_str(unsigned int mach, unsigned int type) case 116: return "R_PPC_EMB_RELSDA"; } break; + case EM_PPC64: + switch(type) { + case 0: return "R_PPC64_NONE"; + case 1: return "R_PPC64_ADDR32"; + case 2: return "R_PPC64_ADDR24"; + case 3: return "R_PPC64_ADDR16"; + case 4: return "R_PPC64_ADDR16_LO"; + case 5: return "R_PPC64_ADDR16_HI"; + case 6: return "R_PPC64_ADDR16_HA"; + case 7: return "R_PPC64_ADDR14"; + case 8: return "R_PPC64_ADDR14_BRTAKEN"; + case 9: return "R_PPC64_ADDR14_BRNTAKEN"; + case 10: return "R_PPC64_REL24"; + case 11: return "R_PPC64_REL14"; + case 12: return "R_PPC64_REL14_BRTAKEN"; + case 13: return "R_PPC64_REL14_BRNTAKEN"; + case 14: return "R_PPC64_GOT16"; + case 15: return "R_PPC64_GOT16_LO"; + case 16: return "R_PPC64_GOT16_HI"; + case 17: return "R_PPC64_GOT16_HA"; + case 19: return "R_PPC64_COPY"; + case 20: return "R_PPC64_GLOB_DAT"; + case 21: return "R_PPC64_JMP_SLOT"; + case 22: return "R_PPC64_RELATIVE"; + case 24: return "R_PPC64_UADDR32"; + case 25: return "R_PPC64_UADDR16"; + case 26: return "R_PPC64_REL32"; + case 27: return "R_PPC64_PLT32"; + case 28: return "R_PPC64_PLTREL32"; + case 29: return "R_PPC64_PLT16_LO"; + case 30: return "R_PPC64_PLT16_HI"; + case 31: return "R_PPC64_PLT16_HA"; + case 33: return "R_PPC64_SECTOFF"; + case 34: return "R_PPC64_SECTOFF_LO"; + case 35: return "R_PPC64_SECTOFF_HI"; + case 36: return "R_PPC64_SECTOFF_HA"; + case 37: return "R_PPC64_ADDR30"; + case 38: return "R_PPC64_ADDR64"; + case 39: return "R_PPC64_ADDR16_HIGHER"; + case 40: return "R_PPC64_ADDR16_HIGHERA"; + case 41: return "R_PPC64_ADDR16_HIGHEST"; + case 42: return "R_PPC64_ADDR16_HIGHESTA"; + case 43: return "R_PPC64_UADDR64"; + case 44: return "R_PPC64_REL64"; + case 45: return "R_PPC64_PLT64"; + case 46: return "R_PPC64_PLTREL64"; + case 47: return "R_PPC64_TOC16"; + case 48: return "R_PPC64_TOC16_LO"; + case 49: return "R_PPC64_TOC16_HI"; + case 50: return "R_PPC64_TOC16_HA"; + case 51: return "R_PPC64_TOC"; + case 52: return "R_PPC64_PLTGOT16"; + case 53: return "R_PPC64_PLTGOT16_LO"; + case 54: return "R_PPC64_PLTGOT16_HI"; + case 55: return "R_PPC64_PLTGOT16_HA"; + case 56: return "R_PPC64_ADDR16_DS"; + case 57: return "R_PPC64_ADDR16_LO_DS"; + case 58: return "R_PPC64_GOT16_DS"; + case 59: return "R_PPC64_GOT16_LO_DS"; + case 60: return "R_PPC64_PLT16_LO_DS"; + case 61: return "R_PPC64_SECTOFF_DS"; + case 62: return "R_PPC64_SECTOFF_LO_DS"; + case 63: return "R_PPC64_TOC16_DS"; + case 64: return "R_PPC64_TOC16_LO_DS"; + case 65: return "R_PPC64_PLTGOT16_DS"; + case 66: return "R_PPC64_PLTGOT16_LO_DS"; + case 67: return "R_PPC64_TLS"; + case 68: return "R_PPC64_DTPMOD64"; + case 69: return "R_PPC64_TPREL16"; + case 70: return "R_PPC64_TPREL16_LO"; + case 71: return "R_PPC64_TPREL16_HI"; + case 72: return "R_PPC64_TPREL16_HA"; + case 73: return "R_PPC64_TPREL64"; + case 74: return "R_PPC64_DTPREL16"; + case 75: return "R_PPC64_DTPREL16_LO"; + case 76: return "R_PPC64_DTPREL16_HI"; + case 77: return "R_PPC64_DTPREL16_HA"; + case 78: return "R_PPC64_DTPREL64"; + case 79: return "R_PPC64_GOT_TLSGD16"; + case 80: return "R_PPC64_GOT_TLSGD16_LO"; + case 81: return "R_PPC64_GOT_TLSGD16_HI"; + case 82: return "R_PPC64_GOT_TLSGD16_HA"; + case 83: return "R_PPC64_GOT_TLSLD16"; + case 84: return "R_PPC64_GOT_TLSLD16_LO"; + case 85: return "R_PPC64_GOT_TLSLD16_HI"; + case 86: return "R_PPC64_GOT_TLSLD16_HA"; + case 87: return "R_PPC64_GOT_TPREL16_DS"; + case 88: return "R_PPC64_GOT_TPREL16_LO_DS"; + case 89: return "R_PPC64_GOT_TPREL16_HI"; + case 90: return "R_PPC64_GOT_TPREL16_HA"; + case 91: return "R_PPC64_GOT_DTPREL16_DS"; + case 92: return "R_PPC64_GOT_DTPREL16_LO_DS"; + case 93: return "R_PPC64_GOT_DTPREL16_HI"; + case 94: return "R_PPC64_GOT_DTPREL16_HA"; + case 95: return "R_PPC64_TPREL16_DS"; + case 96: return "R_PPC64_TPREL16_LO_DS"; + case 97: return "R_PPC64_TPREL16_HIGHER"; + case 98: return "R_PPC64_TPREL16_HIGHERA"; + case 99: return "R_PPC64_TPREL16_HIGHEST"; + case 100: return "R_PPC64_TPREL16_HIGHESTA"; + case 101: return "R_PPC64_DTPREL16_DS"; + case 102: return "R_PPC64_DTPREL16_LO_DS"; + case 103: return "R_PPC64_DTPREL16_HIGHER"; + case 104: return "R_PPC64_DTPREL16_HIGHERA"; + case 105: return "R_PPC64_DTPREL16_HIGHEST"; + case 106: return "R_PPC64_DTPREL16_HIGHESTA"; + case 107: return "R_PPC64_TLSGD"; + case 108: return "R_PPC64_TLSLD"; + case 249: return "R_PPC64_REL16"; + case 250: return "R_PPC64_REL16_LO"; + case 251: return "R_PPC64_REL16_HI"; + case 252: return "R_PPC64_REL16_HA"; + } + break; case EM_RISCV: switch(type) { case 0: return "R_RISCV_NONE"; @@ -550,6 +664,37 @@ elftc_reloc_type_str(unsigned int mach, unsigned int type) case 48: return "R_RISCV_GPREL_S"; } break; + case EM_S390: + switch (type) { + case 0: return "R_390_NONE"; + case 1: return "R_390_8"; + case 2: return "R_390_12"; + case 3: return "R_390_16"; + case 4: return "R_390_32"; + case 5: return "R_390_PC32"; + case 6: return "R_390_GOT12"; + case 7: return "R_390_GOT32"; + case 8: return "R_390_PLT32"; + case 9: return "R_390_COPY"; + case 10: return "R_390_GLOB_DAT"; + case 11: return "R_390_JMP_SLOT"; + case 12: return "R_390_RELATIVE"; + case 13: return "R_390_GOTOFF"; + case 14: return "R_390_GOTPC"; + case 15: return "R_390_GOT16"; + case 16: return "R_390_PC16"; + case 17: return "R_390_PC16DBL"; + case 18: return "R_390_PLT16DBL"; + case 19: return "R_390_PC32DBL"; + case 20: return "R_390_PLT32DBL"; + case 21: return "R_390_GOTPCDBL"; + case 22: return "R_390_64"; + case 23: return "R_390_PC64"; + case 24: return "R_390_GOT64"; + case 25: return "R_390_PLT64"; + case 26: return "R_390_GOTENT"; + } + break; case EM_SPARC: case EM_SPARCV9: switch(type) { diff --git a/contrib/netbsd-tests/crypto/libcrypto/t_libcrypto.sh b/contrib/netbsd-tests/crypto/libcrypto/t_libcrypto.sh index aa7af27ceee4..f460cf58241b 100755 --- a/contrib/netbsd-tests/crypto/libcrypto/t_libcrypto.sh +++ b/contrib/netbsd-tests/crypto/libcrypto/t_libcrypto.sh @@ -1,4 +1,4 @@ -# $NetBSD: t_libcrypto.sh,v 1.3 2010/11/08 19:06:12 pooka Exp $ +# $NetBSD: t_libcrypto.sh,v 1.4 2016/10/13 09:25:37 martin Exp $ # # Copyright (c) 2008, 2009, 2010 The NetBSD Foundation, Inc. # All rights reserved. @@ -49,7 +49,7 @@ atf_test_case bn bn_head() { atf_set "descr" "Checks BIGNUM library" - atf_set "timeout" "300" + atf_set "timeout" "360" } bn_body() { diff --git a/contrib/netbsd-tests/crypto/libcrypto/t_pubkey.sh b/contrib/netbsd-tests/crypto/libcrypto/t_pubkey.sh index 1453e757a4cc..eb8d0f5b6d2a 100755 --- a/contrib/netbsd-tests/crypto/libcrypto/t_pubkey.sh +++ b/contrib/netbsd-tests/crypto/libcrypto/t_pubkey.sh @@ -1,4 +1,4 @@ -# $NetBSD: t_pubkey.sh,v 1.3 2011/06/09 05:25:21 spz Exp $ +# $NetBSD: t_pubkey.sh,v 1.4 2016/10/13 09:25:37 martin Exp $ # # Copyright (c) 2008, 2009, 2010 The NetBSD Foundation, Inc. # All rights reserved. @@ -49,7 +49,7 @@ atf_test_case rsa rsa_head() { atf_set "descr" "Checks RSA" - atf_set "timeout" "300" + atf_set "timeout" "420" } rsa_body() { @@ -60,7 +60,7 @@ atf_test_case ec ec_head() { atf_set "descr" "Checks EC cipher" - atf_set "timeout" "300" + atf_set "timeout" "480" } ec_body() { @@ -81,7 +81,7 @@ atf_test_case ecdsa ecdsa_head() { atf_set "descr" "Checks ECDSA algorithm" - atf_set "timeout" "300" + atf_set "timeout" "480" } ecdsa_body() { diff --git a/contrib/netbsd-tests/dev/audio/h_pad.c b/contrib/netbsd-tests/dev/audio/h_pad.c index dd481ac1a85c..b760d047c366 100644 --- a/contrib/netbsd-tests/dev/audio/h_pad.c +++ b/contrib/netbsd-tests/dev/audio/h_pad.c @@ -1,4 +1,4 @@ -/* $NetBSD: h_pad.c,v 1.1 2010/08/04 13:15:15 pooka Exp $ */ +/* $NetBSD: h_pad.c,v 1.2 2016/10/15 07:08:06 nat Exp $ */ /* * Copyright (c) 2010 Antti Kantee. All Rights Reserved. @@ -56,14 +56,14 @@ main(int argc, char *argv[]) ssize_t n; rump_init(); - audiofd = rump_sys_open("/dev/audio0", O_RDWR); - if (audiofd == -1) - err(1, "open audio"); - padfd = rump_sys_open("/dev/pad0", O_RDONLY); if (padfd == -1) err(1, "open pad"); + audiofd = rump_sys_open("/dev/audio0", O_RDWR); + if (audiofd == -1) + err(1, "open audio"); + if ((n = rump_sys_write(audiofd, musa, sizeof(musa))) != sizeof(musa)) err(1, "write"); diff --git a/contrib/netbsd-tests/dev/audio/t_pad_output.bz2.uue b/contrib/netbsd-tests/dev/audio/t_pad_output.bz2.uue index e0cbf5226c24..969ad9c88a25 100644 --- a/contrib/netbsd-tests/dev/audio/t_pad_output.bz2.uue +++ b/contrib/netbsd-tests/dev/audio/t_pad_output.bz2.uue @@ -1,1035 +1,1040 @@ begin 644 t_pad_output.bz2 -M0EIH.3%!629369%IQ#X`MT#FU'+1O7<;MT;NYNNYW<[N[OO;K>W7+>^Y[M;[LV]??=M] -MYZ[MMMO>WO;6=W.KIOKNUF:EFEJVK5I"+:J;8:B5K1JJIJVUJV,K6IK5MJJ6 -M--%5FJLS55K158M5K:U5FU4RVMJ(K0BK-6Q0-L+6JVLJ6MK559M5556*M54J -MJMIMFS-"U6LJRUBRJJRV;55::M6U[G=0JI5-4W66J=KVZ]LNW=]W=FW=S;YM -MDO<]LW>Z[WW%E@WUOD-[G!SN<'=W$CD8@[KN<36:PVO=W;*I*E%4SC -MV]XE)5!54*"@*JJMH)J0H*`4&V4`!11(``!4BJI27O>Z(]5()`22)**%4``I -M0`!*B5`D(DB*5@:5``AH`"8F3"8`F0#3(Q,FF@#1H&(&C)H-#3330!ID,C`C -M!-,F)IIA`TQ-,!,33$831@@R9&$T`!,`@TD@FC$``````&@```:-`3`F$P0T -M,$!@`$``#03T!H-`U,`33$TTQJ-,$P$P%/$R8",!-02FDI"!$QJ>S,`0`$!H -M:!#":$Q-,28$V@0-`34]$:;*:>D]1I[0H'HGDRC:AD&@]0&@/4`]0R`R,AH- -M!H`VHS2`:`(4E)*)&R>J-^GBGL!2,:::2;48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6 +M(6XSTY5J00"K07Y`N_R8GZ6CO_*WI%,3]Q>D"QE +M[5N/32)')>7*1I2E`:E8D@`)!8!`4_>I7FB[DFN=#7(IM;;?.J`8O +MW_1DZAL!#&N4T1ZXYG:T0H9J(@GT$!FOT>#*%U/`\_3^%CA(UBF4Y#.[K;.\ +M-_/=\VU`)VV'2H&[\#FA>1%;Q_-V-L"(8N*I\G9K#EFV5"SO#Y=6"UFFI6+T +M3G+?98@!?,N;SYNO-.T8M3+PL)2>9#)_:((%!7?$WL?Z+82G"_Z`=OG/?>X$ +M"&`^X.FC>[0?+XWG3LRP=J&B24*S8%_AM-Y>7>3POP4P"3^'QQ&\B%E96U-= +M_\T+P!3FTZN)(:$?3(77,J!;MN[Q((..(R75&P._B_E)98!$.?H&V,<(NF#W +MF7N*87EGT[@F`5/X:++MT"ZV@$,O+Q6/QI=\_Y(5TRD@`E6_MV&KS%1I_M!!;Z,JUFJ07_E],9`K_8=._^^O$]@_T6;`9K+P7A[JFLEQ +M(2)4E`Y;&DU,7U0]BB(@SF,#?$X"S:[ZWZ;?##S]/:.EM;R+\[!7)6`)*;Y) +MO\9Q?9T)`@D,8&,8P,8))[Y5(@3H#&,8P,PF(Z[H9MWSG1Z`MWE3#(#!(0Z[^<"%UJ_/$N7C^=F=5,B) +9@#N8461T+A7W1J)TTW_Q=R13A0D`S39&D(#! ` end diff --git a/contrib/netbsd-tests/dev/cgd/t_cgd_3des.c b/contrib/netbsd-tests/dev/cgd/t_cgd_3des.c new file mode 100644 index 000000000000..91e81f45ec5e --- /dev/null +++ b/contrib/netbsd-tests/dev/cgd/t_cgd_3des.c @@ -0,0 +1,913 @@ +/* $NetBSD: t_cgd_3des.c,v 1.1 2016/11/11 07:39:58 alnsn Exp $ */ +/*- + * Copyright (c) 2016 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Alexander Nasonov. + * + * 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 COPYRIGHT HOLDERS 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 + * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include + +#include "../../h_macros.h" + +#define SECSIZE 512 + +struct testvec { + unsigned int blkno; + const uint8_t *ptxt; /* PlainText */ + const uint8_t *ctxt; /* CipherText */ +}; + +/* + * 192 bits CBC key, NUL terminated. + */ +static const char c3des_cbc_192_key[25] = { + 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, /* ABCDEFGH */ + 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x50, /* IJKLMNOP */ + 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, /* QRSTUVWX */ + 0 +}; + +static const uint8_t c3des_cbc_ptxt[SECSIZE] = + " abcdefghijklmnop" + " abcdefghijklmnop" + " abcdefghijklmnop" + " abcdefghijklmnop" + " abcdefghijklmnop" + " abcdefghijklmnop" + " abcdefghijklmnop" + " abcdefghijklmnop" + " abcdefghijklmnop" + " abcdefghijklmnop" + " abcdefghijklmnop" + " abcdefghijklmnop" + " abcdefghijklmnop" + " abcdefghijklmnop" + " abcdefghijklmnop" + " abcdefghijklmnop"; + +/* + * IV method encblkno1, blkno 0. + */ +static const uint8_t c3des_cbc_192_encblkno1_vec0_ctxt[SECSIZE] = { + 0x19, 0x92, 0xc8, 0xce, 0xdf, 0xa3, 0x14, 0xef, + 0xff, 0x88, 0x9f, 0x01, 0xfa, 0x6f, 0xfa, 0xa6, + 0xdd, 0x2b, 0x43, 0x67, 0xfa, 0xce, 0x37, 0x95, + 0x73, 0x4d, 0x18, 0x33, 0x0c, 0x29, 0xb6, 0xbb, + 0x37, 0x77, 0x31, 0x74, 0xf6, 0x62, 0x03, 0xd2, + 0x78, 0x13, 0x55, 0xf6, 0x58, 0x49, 0xaf, 0x2a, + 0x15, 0x4c, 0xc2, 0x4a, 0x55, 0x99, 0x82, 0xb9, + 0xfb, 0x8b, 0x4f, 0x92, 0xe3, 0xbc, 0x9b, 0x09, + 0x42, 0x7b, 0x5f, 0x54, 0xed, 0xf0, 0xcb, 0x5d, + 0x93, 0xba, 0x09, 0x4b, 0x20, 0xf3, 0xe6, 0x44, + 0x30, 0x5e, 0x9e, 0xfc, 0x7a, 0x3c, 0x7d, 0x11, + 0x63, 0xea, 0x40, 0x94, 0xaa, 0xd0, 0xa9, 0xf6, + 0xc7, 0x1e, 0x8f, 0xc8, 0xa6, 0x2c, 0xf7, 0xeb, + 0x51, 0x26, 0xdc, 0xf8, 0x73, 0xf9, 0xb4, 0xa8, + 0x80, 0x4a, 0xe5, 0x6f, 0xb6, 0x33, 0x13, 0x6b, + 0x1b, 0x7d, 0x00, 0xde, 0x44, 0x7e, 0x26, 0xa2, + 0x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cf, 0xad, 0x2b, 0xba, 0x9b, + 0x40, 0x1e, 0x71, 0x3a, 0xb6, 0x92, 0xc4, 0xc5, + 0x56, 0x58, 0x92, 0x2a, 0x69, 0xbe, 0x0f, 0xb0, + 0x91, 0xae, 0xaa, 0x3f, 0x07, 0xe8, 0xf9, 0x71, + 0x20, 0x06, 0xed, 0xe0, 0x80, 0xec, 0xc9, 0xe7, + 0x54, 0xaa, 0xaa, 0xf4, 0x4c, 0xb2, 0x34, 0xf7, + 0x8a, 0x76, 0xc2, 0x4a, 0xae, 0x71, 0x7a, 0x07, + 0xd7, 0xec, 0x75, 0x2f, 0x8a, 0x99, 0x59, 0x13, + 0xd0, 0x8d, 0x18, 0x69, 0x0d, 0xd9, 0x39, 0x73, + 0x2b, 0xd0, 0xa3, 0xbc, 0x9e, 0x29, 0x4d, 0x88, + 0xff, 0x98, 0x02, 0xb4, 0xcf, 0xa1, 0xf9, 0x2a, + 0xa6, 0xef, 0x7c, 0x72, 0x26, 0x4e, 0xd7, 0xdf, + 0xec, 0x3a, 0xbc, 0x8e, 0xe6, 0xb3, 0x2b, 0x43, + 0xcd, 0x67, 0x8b, 0x72, 0x00, 0x6f, 0xe5, 0x85, + 0xe2, 0x2a, 0x4c, 0x8d, 0x02, 0x44, 0x6b, 0x7a, + 0x89, 0x7a, 0x18, 0x3b, 0xc8, 0x9c, 0x8d, 0x60, + 0xec, 0x79, 0x58, 0x15, 0x98, 0x71, 0x4b, 0x1a, + 0x34, 0x69, 0x96, 0xd0, 0x0f, 0x01, 0x27, 0x2e, + 0x19, 0x02, 0xf0, 0x17, 0x8c, 0x89, 0xbf, 0x05, + 0xf0, 0xfe, 0xc3, 0xe6, 0x90, 0x9d, 0xa2, 0xb1, + 0x40, 0x06, 0x7e, 0xcd, 0x20, 0x7e, 0x5f, 0x54, + 0x31, 0xfb, 0x79, 0x84, 0x47, 0x38, 0x71, 0x69, + 0xe1, 0xd5, 0x4e, 0x84, 0xa3, 0x2b, 0x4a, 0x86, + 0xc2, 0x21, 0x5b, 0x15, 0xc3, 0x63, 0xbb, 0xc5, + 0x5c, 0xc1, 0xfb, 0x31, 0x3a, 0x4d, 0xb1, 0x9e, + 0xe1, 0xd8, 0x67, 0x4b, 0x08, 0x42, 0xc4, 0xe8, +}; + +/* + * IV method encblkno1, blkno 1. + */ +static const uint8_t c3des_cbc_192_encblkno1_vec1_ctxt[SECSIZE] = { + 0x1d, 0x65, 0xdf, 0x01, 0x9b, 0x24, 0xa5, 0x10, + 0x94, 0x9a, 0x5b, 0x81, 0x96, 0x4e, 0xa3, 0x42, + 0x42, 0xd5, 0x05, 0x52, 0xab, 0x3c, 0x67, 0x40, + 0x79, 0xf9, 0x4b, 0x58, 0x39, 0xf6, 0xd0, 0x97, + 0x48, 0xf4, 0x77, 0xb8, 0xac, 0xe2, 0x10, 0x66, + 0xa8, 0x04, 0x0a, 0x1e, 0xa6, 0xbb, 0x4c, 0xd9, + 0x5d, 0x0c, 0x11, 0xb5, 0xe0, 0x26, 0x84, 0x50, + 0x10, 0x80, 0xbf, 0xd6, 0xdc, 0x82, 0x53, 0x0a, + 0xcf, 0xf6, 0xd3, 0x07, 0x45, 0xb0, 0x8e, 0x36, + 0x2e, 0x60, 0x0f, 0xd0, 0xc1, 0xb9, 0xd8, 0x29, + 0x6e, 0x13, 0x8e, 0xc1, 0xa8, 0x63, 0x20, 0xe0, + 0x8d, 0x47, 0x8b, 0xf9, 0xa0, 0x60, 0x55, 0x53, + 0x1d, 0xaf, 0x43, 0x46, 0xe5, 0x10, 0xd5, 0xcd, + 0x91, 0x9e, 0x11, 0x4a, 0x6f, 0x6a, 0x13, 0xdf, + 0xee, 0x7a, 0x88, 0xbe, 0x59, 0x96, 0xdb, 0x65, + 0x25, 0x57, 0x9e, 0x82, 0xad, 0xc2, 0xd6, 0x28, + 0x96, 0xb3, 0x7f, 0x57, 0x5d, 0xb2, 0xfa, 0x60, + 0x43, 0x22, 0xa5, 0x33, 0x14, 0x99, 0x8f, 0x68, + 0x5a, 0x7f, 0xaf, 0x9e, 0xe9, 0x23, 0x57, 0x9b, + 0x52, 0xe9, 0x20, 0x59, 0x26, 0x89, 0x9b, 0x59, + 0xb0, 0xee, 0xe8, 0x6d, 0x06, 0x8c, 0x01, 0xc2, + 0xea, 0xbc, 0x7d, 0x93, 0x3f, 0x79, 0x7f, 0xeb, + 0x57, 0xc9, 0x0a, 0xca, 0x37, 0x81, 0xa7, 0x82, + 0xde, 0x37, 0x7d, 0x69, 0x01, 0xaa, 0x19, 0x98, + 0x26, 0xfe, 0x06, 0x83, 0xeb, 0x9d, 0x26, 0xdc, + 0x04, 0x5d, 0xc9, 0x05, 0xee, 0x1a, 0xd3, 0xeb, + 0x20, 0x8c, 0xb7, 0x99, 0x75, 0xe0, 0x19, 0x98, + 0xca, 0x83, 0xae, 0x94, 0x28, 0xbf, 0x47, 0x42, + 0x92, 0x05, 0x8c, 0xaa, 0xeb, 0x99, 0x0f, 0xcc, + 0x33, 0x79, 0x24, 0x62, 0xa0, 0x7a, 0x65, 0xcb, + 0x53, 0xb7, 0x86, 0x0d, 0xcb, 0x44, 0x2d, 0xbf, + 0xe8, 0x5d, 0x62, 0xeb, 0x21, 0x4d, 0x35, 0x86, + 0x56, 0x6c, 0x51, 0xff, 0xa3, 0x45, 0xcc, 0x88, + 0x09, 0x43, 0x08, 0x97, 0x13, 0x7d, 0x00, 0xd8, + 0x82, 0x2d, 0xbe, 0xbe, 0x44, 0x0c, 0x2c, 0xa4, + 0x4f, 0x84, 0x07, 0x20, 0x9c, 0x3f, 0xf6, 0x5b, + 0x9e, 0xe8, 0x68, 0x40, 0xd3, 0x64, 0x8f, 0xb4, + 0x9e, 0xac, 0xc6, 0x41, 0x11, 0xda, 0xf2, 0x60, + 0xfa, 0x29, 0x9d, 0x26, 0x68, 0x5b, 0x79, 0x3a, + 0xd1, 0x66, 0x78, 0xca, 0x80, 0x87, 0xae, 0xab, + 0x7b, 0x29, 0x3c, 0xb0, 0xe6, 0xa2, 0x6b, 0x24, + 0x81, 0xeb, 0x51, 0xf9, 0xcb, 0x4a, 0x08, 0x37, + 0x2a, 0x75, 0xb5, 0xd3, 0xb3, 0x8f, 0x3d, 0x13, + 0x11, 0x0c, 0xa9, 0xf7, 0xf6, 0x57, 0x7e, 0xb7, + 0xa6, 0x22, 0xe8, 0x13, 0xfd, 0xf1, 0x6a, 0xe9, + 0xc1, 0x94, 0xa6, 0xf5, 0xa5, 0xec, 0xfa, 0x31, + 0xd2, 0x66, 0x8f, 0xe3, 0x6e, 0x9a, 0xaa, 0xb0, + 0xe3, 0x04, 0x09, 0x00, 0x1e, 0x67, 0x3c, 0xbe, + 0x2a, 0x8c, 0xd5, 0x1f, 0x4f, 0x55, 0x2c, 0x1d, + 0x26, 0x7f, 0xc9, 0x27, 0x00, 0x88, 0x7d, 0x45, + 0x4e, 0xe1, 0x36, 0xf6, 0xf5, 0xa8, 0xd4, 0xef, + 0x8b, 0x26, 0x76, 0x41, 0x28, 0x87, 0xf4, 0x51, + 0x14, 0x36, 0xad, 0x60, 0x8d, 0xe9, 0xe2, 0x9d, + 0x3c, 0xea, 0x09, 0x51, 0x3c, 0x81, 0xdf, 0x1a, + 0xc2, 0xc2, 0xf6, 0x45, 0xe1, 0x73, 0xac, 0xae, + 0x85, 0x74, 0x83, 0x8f, 0x56, 0x3c, 0x36, 0x1c, + 0xe0, 0x07, 0xc6, 0x6a, 0x48, 0xe4, 0x34, 0xe9, + 0x81, 0x53, 0xb7, 0x53, 0x95, 0xa7, 0x94, 0x21, + 0x7e, 0x32, 0x53, 0xda, 0x83, 0xd8, 0x57, 0x92, + 0xd1, 0x15, 0x45, 0x86, 0x40, 0xac, 0xf1, 0x6f, + 0x3c, 0x29, 0xef, 0x8d, 0x12, 0xe1, 0x9d, 0x04, + 0x17, 0x3a, 0xcc, 0xa6, 0xc5, 0xe4, 0x27, 0x41, + 0xcb, 0xfb, 0x5e, 0x77, 0x73, 0x5a, 0x2c, 0x03, + 0xe9, 0x2b, 0x76, 0x4e, 0x69, 0xea, 0xcb, 0xb3, +}; + +/* + * IV method encblkno1, blkno 2. + */ +static const uint8_t c3des_cbc_192_encblkno1_vec2_ctxt[SECSIZE] = { + 0x87, 0xb1, 0x3c, 0xd6, 0x60, 0xa0, 0x5a, 0x35, + 0xf7, 0xe1, 0x6b, 0x87, 0xa0, 0x90, 0x2f, 0xc7, + 0x8c, 0xed, 0x53, 0xda, 0x93, 0x32, 0x78, 0x5d, + 0x24, 0x23, 0x42, 0xdd, 0x93, 0x5b, 0x2e, 0x40, + 0xa1, 0xb1, 0x3b, 0xbb, 0xf0, 0x50, 0xb4, 0x61, + 0xea, 0x15, 0x37, 0xf3, 0x49, 0xe1, 0xa0, 0x32, + 0x88, 0x85, 0x81, 0xfd, 0xb7, 0x96, 0xd7, 0x9d, + 0xd7, 0x29, 0x4b, 0x14, 0xf9, 0x18, 0x6a, 0xf6, + 0x46, 0xae, 0x69, 0xdf, 0x63, 0x9a, 0xe0, 0x0b, + 0x2c, 0x53, 0xd7, 0x82, 0x6f, 0xe5, 0xa0, 0x95, + 0x2f, 0x61, 0x7f, 0x15, 0xff, 0xc7, 0xe8, 0x83, + 0xfc, 0xfc, 0x16, 0x1c, 0x37, 0x0f, 0x9b, 0xbb, + 0x14, 0xb2, 0xe2, 0xb7, 0x1f, 0x85, 0xb7, 0x07, + 0x8a, 0x18, 0xed, 0xf7, 0x5f, 0x27, 0xff, 0x2f, + 0x07, 0xf9, 0x9d, 0xe3, 0x79, 0x45, 0x1f, 0x51, + 0x08, 0x54, 0x0f, 0x56, 0x84, 0xee, 0x87, 0x9a, + 0xa9, 0x46, 0xb8, 0x77, 0x85, 0x40, 0x46, 0x50, + 0xc1, 0x58, 0x07, 0xfd, 0xfa, 0x2b, 0x20, 0xd6, + 0x4e, 0xba, 0x08, 0x02, 0x59, 0x3d, 0x23, 0x3b, + 0x5d, 0xf9, 0x5e, 0x2f, 0xac, 0x9e, 0xa0, 0xd7, + 0x3f, 0x9a, 0xdf, 0x50, 0x66, 0xcc, 0x28, 0xce, + 0x93, 0xc8, 0x11, 0x5c, 0x74, 0xe2, 0x4f, 0xfd, + 0xaf, 0x33, 0xbb, 0xce, 0x96, 0x1f, 0xb3, 0x46, + 0x6e, 0xcd, 0xe4, 0xef, 0xfa, 0x2f, 0x93, 0xb1, + 0xe5, 0x7c, 0x54, 0xbc, 0x17, 0x1f, 0xd5, 0x31, + 0x0e, 0x88, 0xe7, 0xcd, 0xb0, 0xb5, 0x2e, 0x1e, + 0x9e, 0x40, 0x36, 0xa5, 0xbb, 0xa7, 0x4e, 0xc8, + 0x11, 0x6c, 0xae, 0x1c, 0x2d, 0xdb, 0x55, 0xd8, + 0x14, 0x40, 0x02, 0xad, 0xaf, 0x19, 0x28, 0x59, + 0xd7, 0x4f, 0x81, 0xd0, 0xc1, 0x54, 0x63, 0x73, + 0x0e, 0xfb, 0x26, 0xf2, 0xa6, 0x80, 0xca, 0x2e, + 0xf3, 0xca, 0x1e, 0xa4, 0x62, 0x07, 0x22, 0x10, + 0x11, 0x6a, 0x57, 0x28, 0x45, 0x80, 0xdf, 0x34, + 0x88, 0xe5, 0xf1, 0x23, 0xe0, 0xb6, 0x44, 0x51, + 0x54, 0xd8, 0xb3, 0x66, 0xac, 0x46, 0x4d, 0xdf, + 0xa2, 0x8e, 0x72, 0x3a, 0x1c, 0x87, 0x2a, 0x43, + 0xfe, 0xdb, 0x00, 0xff, 0xb7, 0x1c, 0x13, 0xc3, + 0x18, 0xfc, 0x71, 0x13, 0xe3, 0xd1, 0x1f, 0xde, + 0x16, 0x63, 0x73, 0xf5, 0x0e, 0xf7, 0x18, 0xe5, + 0x48, 0x8d, 0x30, 0xd9, 0x26, 0x20, 0x6d, 0xa1, + 0xba, 0xde, 0xe8, 0x7d, 0x77, 0x02, 0x33, 0x0d, + 0x73, 0xb2, 0xab, 0x35, 0xfd, 0xa5, 0x6e, 0x4c, + 0x5c, 0x27, 0xc7, 0x7e, 0x4a, 0x28, 0xf8, 0xf5, + 0x00, 0xbe, 0x4c, 0xd7, 0x2c, 0x27, 0x83, 0x16, + 0x37, 0xda, 0x0c, 0xb1, 0xd7, 0x89, 0xd8, 0x8f, + 0x17, 0x69, 0x1b, 0x6b, 0x48, 0x2b, 0xce, 0x9c, + 0xbd, 0xf4, 0x0d, 0xb5, 0x4d, 0x12, 0x11, 0x36, + 0x49, 0xd3, 0x8b, 0x52, 0xce, 0x7e, 0x47, 0xb0, + 0xb5, 0x54, 0x77, 0xef, 0x90, 0xb8, 0x0e, 0xaf, + 0x6f, 0x97, 0x88, 0xde, 0x6b, 0x37, 0x24, 0xdd, + 0x91, 0x84, 0x00, 0x51, 0xab, 0x06, 0x96, 0x3c, + 0x82, 0x73, 0xcf, 0xae, 0x8d, 0x23, 0x86, 0x59, + 0x62, 0x5b, 0xeb, 0x2a, 0xaf, 0x40, 0x17, 0xed, + 0x2b, 0x60, 0x73, 0x7d, 0x99, 0x95, 0x3f, 0xd6, + 0x6c, 0xca, 0x1e, 0xf3, 0xb0, 0xcd, 0xd5, 0x1d, + 0x53, 0xe0, 0xd2, 0x8b, 0x57, 0x7b, 0xac, 0x67, + 0x5a, 0x5a, 0x0a, 0x64, 0x82, 0xab, 0x8f, 0x5a, + 0x36, 0xe2, 0x45, 0x50, 0xec, 0x3e, 0x14, 0x80, + 0x7c, 0xfd, 0x0c, 0xa9, 0x94, 0xfb, 0xfe, 0x72, + 0xec, 0x47, 0x71, 0x2e, 0x90, 0x97, 0xf6, 0x33, + 0xbd, 0x7d, 0x7e, 0x77, 0x8f, 0xad, 0xd4, 0x1d, + 0x1d, 0x53, 0x0f, 0x28, 0x39, 0x77, 0x06, 0x1a, + 0x75, 0xfc, 0x12, 0xe6, 0x45, 0xfc, 0x87, 0xe1, + 0x46, 0xac, 0xb0, 0x73, 0xca, 0x24, 0x7c, 0x71, +}; + +/* + * IV method encblkno1, blkno 3. + */ +static const uint8_t c3des_cbc_192_encblkno1_vec3_ctxt[SECSIZE] = { + 0xb1, 0xef, 0x7c,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x3f, 0x32, 0x81, 0x25, 0x20, 0x71, + 0xb6, 0xfa, 0x1f, 0x27, 0x2a, 0x33, 0x49, 0xfc, + 0x95, 0x00, 0x72, 0x6b, 0x03, 0x53, 0x94, 0x57, + 0x2f, 0x47, 0x3d, 0x2d, 0x7c, 0xb4, 0xde, 0xa7, + 0x96, 0x81, 0x12, 0xff, 0x2c, 0xec, 0x5c, 0x03, + 0x2a, 0x8c, 0x76, 0xc4, 0xed, 0x09, 0xe6, 0x00, + 0x28, 0xdb, 0x9b, 0x44, 0xb0, 0xb4, 0x7b, 0x57, + 0x3b, 0xb6, 0x4f, 0x0b, 0xff, 0xf2, 0xf5, 0x02, + 0x56, 0xcf, 0xd5, 0xbf, 0x71, 0xe6, 0x66, 0xf3, + 0x08, 0x8e, 0x8b, 0x15, 0x57, 0x07, 0x41, 0xa3, + 0x91, 0xc1, 0xe4, 0x64, 0x92, 0x89, 0xed, 0x22, + 0x88, 0x8f, 0x17, 0x91, 0xde, 0xea, 0x0c, 0xa6, + 0x86, 0x8e, 0x4c, 0xd9, 0x63, 0xc9, 0xe5, 0xdc, + 0xd6, 0xd3, 0x7b, 0x2b, 0x65, 0xfa, 0x36, 0x47, + 0x20, 0xa4, 0xe7, 0x0b, 0x52, 0xfa, 0xa6, 0xeb, + 0x1d, 0x20, 0xd0, 0x4b, 0xfd, 0x88, 0x8c, 0xbb, + 0x52, 0x9c, 0x2f, 0xb7, 0xba, 0x8b, 0xdd, 0x10, + 0x2d, 0x7d, 0x77, 0x79, 0x40, 0xa7, 0xed, 0xf9, + 0xbd, 0x2a, 0x55, 0x1f, 0x87, 0x1e, 0x3c, 0xfc, +}; + +const struct testvec c3des_cbc_192_1_vectors[] = { + { + .blkno = 0, + .ptxt = c3des_cbc_ptxt, + .ctxt = c3des_cbc_192_encblkno1_vec0_ctxt, + }, + { + .blkno = 1, + .ptxt = c3des_cbc_ptxt, + .ctxt = c3des_cbc_192_encblkno1_vec1_ctxt, + }, + { + .blkno = 2, + .ptxt = c3des_cbc_ptxt, + .ctxt = c3des_cbc_192_encblkno1_vec2_ctxt, + }, + { + .blkno = 3, + .ptxt = c3des_cbc_ptxt, + .ctxt = c3des_cbc_192_encblkno1_vec3_ctxt, + }, +}; + +/* + * IV method encblkno8, blkno 0. + */ +static const uint8_t c3des_cbc_192_encblkno8_vec0_ctxt[SECSIZE] = { + 0x9e, 0x5d, 0x35, 0x56, 0xa7, 0xcc, 0xc0, 0x1c, + 0x60, 0x4c, 0x42, 0x90, 0x35, 0xf3, 0xc1, 0x20, + 0xf2, 0x07, 0x6f, 0xf8, 0x7c, 0x33, 0x6a, 0x74, + 0xdc, 0x85, 0xbc, 0x9c, 0xa2, 0x29, 0xc6, 0x69, + 0x0e, 0xef, 0x0f, 0xa9, 0x6e, 0xec, 0xf2, 0x23, + 0x2f, 0x9a, 0xbe, 0x1a, 0x89, 0x22, 0x00, 0xc4, + 0x5a, 0xaf, 0x4a, 0xa0, 0x4f, 0x30, 0x8f, 0x99, + 0xd2, 0x93, 0x6d, 0xfa, 0xcd, 0x2f, 0xad, 0x19, + 0x10, 0x14, 0x90, 0x3a, 0x4b, 0xab, 0x17, 0x2e, + 0x2c, 0xe1, 0x26, 0xe5, 0x76, 0xf1, 0xd1, 0x1d, + 0x4c, 0x77, 0x68, 0xfb, 0x45, 0x9a, 0x3e, 0x19, + 0xe0, 0xfb, 0xdc, 0xd4, 0x0e, 0x29, 0x7c, 0x06, + 0xd3, 0x45, 0xa8, 0xf7, 0x39, 0x91, 0xe6, 0x18, + 0x0f, 0x81, 0xe6, 0x7d, 0x6c, 0x65, 0x2e, 0x16, + 0x24, 0xa4, 0x16, 0x96, 0x0a, 0x7b, 0x5f, 0x3a, + 0x0c, 0xe9, 0x0e, 0x3f, 0x34, 0x38, 0xb0, 0xe1, + 0x39, 0x23, 0x5c, 0x3c, 0x00, 0xb4, 0xa0, 0xf7, + 0x42, 0x18, 0x70, 0x25, 0x82, 0x13, 0x24, 0x49, + 0xbb, 0x3f, 0xfb, 0xef, 0xb6, 0xc6, 0x7f, 0x3d, + 0x8c, 0x17, 0x62, 0x60, 0x6f, 0xd5, 0xda, 0x2c, + 0xf8, 0x85, 0xee, 0xa7, 0xc2, 0x76, 0x5d, 0x34, + 0x4c, 0xe1, 0x0d, 0x36, 0x6e, 0x02, 0xdd, 0x08, + 0x85, 0xe4, 0x90, 0xfe, 0x1f, 0x81, 0x4a, 0x06, + 0xa6, 0x72, 0x81, 0x79, 0x47, 0xd7, 0x6d, 0x92, + 0x8f, 0xb7, 0xb2, 0xfd, 0xd0, 0x60, 0x6c, 0x06, + 0x44, 0xcd, 0x20, 0x28, 0xef, 0x16, 0xc3, 0x01, + 0x19, 0x14, 0x34, 0x39, 0xad, 0x87, 0x9f, 0xde, + 0x76, 0xb9, 0xb9, 0x87, 0x1a, 0xbd, 0x8e, 0x2c, + 0xe6, 0xb3, 0xe7, 0xb6, 0x80, 0xf8, 0xc5, 0x22, + 0x5f, 0x53, 0xed, 0x03, 0xfe, 0x09, 0x2c, 0x9d, + 0xb6, 0x61, 0x4a, 0xbb, 0x07, 0x5d, 0xbd, 0x68, + 0x74, 0xab, 0x02, 0x81, 0x64, 0x7b, 0x97, 0xa3, + 0xad, 0x15, 0x99, 0x7a, 0x04, 0x33, 0xbd, 0x50, + 0x94, 0x11, 0xcc, 0xf7, 0x8b, 0x77, 0x88, 0x78, + 0x80, 0xfe, 0x5f, 0xa1, 0x63, 0xbc, 0xb0, 0x65, + 0xcb, 0x9d, 0x4c, 0xfe, 0x66, 0x4e, 0xff, 0xe3, + 0x43, 0x61, 0x99, 0x88, 0x88, 0x4c, 0xbc, 0x8a, + 0xf1, 0x69, 0x00, 0xc2, 0xe5, 0xb9, 0x65, 0x8b, + 0x10, 0xdf, 0x38, 0x3e, 0x9e, 0x9f, 0x87, 0xed, + 0x84, 0x71, 0xe7, 0xf2, 0xb5, 0xb6, 0x11, 0xed, + 0x1e, 0xd4, 0xc0, 0x6d, 0x77, 0x08, 0x4b, 0xfd, + 0x95, 0xd5, 0xc0, 0xbe, 0xa6, 0xcc, 0x3b, 0xea, + 0x11, 0x38, 0xa5, 0x59, 0x36, 0x2a, 0xf4, 0x98, + 0x52, 0x9d, 0x3b, 0x8c, 0x8a, 0x19, 0xbd, 0xfb, + 0x49, 0xcb, 0xb0, 0x57, 0x91, 0xc7, 0xf8, 0x2a, + 0x89, 0xa8, 0x85, 0x03, 0xdf, 0x6e, 0xad, 0xf4, + 0x8a, 0x88, 0x9a, 0x2b, 0x5d, 0xe8, 0xca, 0xa9, + 0x8f, 0x18, 0xa3, 0x6a, 0x37, 0x84, 0xa9, 0x24, + 0x5b, 0xce, 0xd6, 0xbe, 0x7e, 0x40, 0x86, 0x6a, + 0xc3, 0x47, 0x28, 0x66, 0xf0, 0x8c, 0x2d, 0x69, + 0x22, 0x64, 0x61, 0x36, 0x6a, 0x0c, 0xc4, 0x18, + 0x5f, 0xd7, 0xff, 0xbc, 0xf1, 0x94, 0x16, 0xfb, + 0x26, 0xa7, 0x80, 0xa4, 0x2d, 0x72, 0xc6, 0x9d, + 0xa7, 0xed, 0x04, 0x13, 0x0f, 0xe7, 0xf8, 0x93, + 0x57, 0x6b, 0xd5, 0xa4, 0xad, 0x9a, 0x97, 0xeb, + 0x97, 0xe7, 0x60, 0x01, 0x89, 0x3f, 0x88, 0xf2, + 0xee, 0xf3, 0x79, 0xd6, 0x5a, 0x03, 0x94, 0x07, + 0xd3, 0x33, 0xc8, 0xda, 0x15, 0x17, 0x0a, 0x8f, + 0xbd, 0x58, 0x1b, 0xfe, 0x3d, 0x77, 0x5d, 0x8f, + 0x4e, 0x0e, 0x98, 0x7d, 0x02, 0x63, 0x94, 0x73, + 0x4a, 0x58, 0x47, 0xed, 0x52, 0xfc, 0x85, 0x19, + 0x5d, 0x2f, 0xfa, 0x07, 0x44, 0xbd, 0x8e, 0xcb, + 0x20, 0x63, 0x9d, 0x2b, 0x61, 0x5c, 0x19, 0x71, + 0x80, 0xe5, 0x25, 0x5b, 0x2e, 0xc5, 0xfe, 0x1a, +}; + +/* + * IV method encblkno8, blkno 1. + */ +static const uint8_t c3des_cbc_192_encblkno8_vec1_ctxt[SECSIZE] = { + 0xf4, 0xb0, 0xb0, 0xcb, 0x79, 0xcc, 0x8c, 0x0a, + 0x3b, 0xc7, 0x43, 0x4e, 0x62, 0x9d, 0xde, 0xb4, + 0xab, 0xa5, 0x62, 0x63, 0x32, 0xa7, 0x18, 0x2b, + 0xe3, 0xee, 0x44, 0xc6, 0x6f, 0xb2, 0xdc, 0x21, + 0xc5, 0xc8, 0x9e, 0x32, 0x71, 0x4c, 0x7a, 0x82, + 0x8d, 0xe0, 0xad, 0x91, 0x88, 0x0c, 0x41, 0x83, + 0x28, 0x0d, 0xed, 0xa7, 0xeb, 0x48, 0xb1, 0x31, + 0xfa, 0x40, 0xd9, 0x44, 0x19, 0xee, 0x8d, 0x2c, + 0x7d, 0xe2, 0x39, 0xa0, 0x39, 0xaa, 0x86, 0xab, + 0xb5, 0x68, 0xe5, 0x83, 0x06, 0x61, 0xec, 0xe6, + 0xc2, 0x85, 0xb2, 0x46, 0xf4, 0x5b, 0x0e, 0x34, + 0x7e, 0x0c, 0xa0, 0xda, 0xef, 0x58, 0x9c, 0x39, + 0x95, 0xa2, 0xca, 0xd3, 0x3b, 0x4d, 0x76, 0xe3, + 0x34, 0x6d, 0x08, 0xa4, 0xba, 0x88, 0x58, 0x39, + 0xb4, 0xe4, 0x6b, 0xb6, 0x32, 0x50, 0x2c, 0xe2, + 0x0a, 0x37, 0xbc, 0x98, 0x38, 0x32, 0x17, 0x1b, + 0x12, 0xef, 0xdc, 0x9d, 0x91, 0x09, 0x8e, 0xd8, + 0xc3, 0xf8, 0x7b, 0x35, 0x41, 0x3b, 0xf8, 0xf5, + 0x37, 0x48, 0x04, 0xf7, 0x94, 0xbf, 0x54, 0x8d, + 0x79, 0x49, 0x8f, 0xf0, 0x3f, 0xb7, 0x90, 0x76, + 0x14, 0x09, 0xc6, 0x8c, 0xba, 0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xc8, 0x4c, 0x76, 0x91, 0x04, 0x97, 0x4c, + 0x84, 0x98, 0x56, 0xb7, 0x7b, 0x4f, 0xd5, 0xcf, + 0x1b, 0x9c, 0x09, 0xe3, 0x1d, 0xdf, 0x0e, 0xfa, + 0x39, 0xc8, 0x48, 0x43, 0x84, 0xec, 0x79, 0xc8, + 0x7f, 0x4f, 0xa8, 0xc0, 0xb4, 0xde, 0x8b, 0x79, + 0xcb, 0x9c, 0x42, 0x81, 0x49, 0xdc, 0x39, 0xb5, + 0x31, 0xa6, 0x22, 0xba, 0x71, 0xb8, 0x2d, 0x1d, + 0xc8, 0x17, 0xd8, 0x9d, 0x26, 0x2b, 0xd5, 0xcf, + 0x57, 0x46, 0x0a, 0x61, 0x7e, 0xb7, 0xc3, 0x9c, + 0xa6, 0x44, 0x60, 0x2d, 0x30, 0xb8, 0x10, 0x47, + 0x7d, 0x7e, 0x87, 0x76, 0xc1, 0x4e, 0x85, 0x77, + 0xbc, 0x30, 0x32, 0x56, 0x0a, 0x5b, 0x1c, 0xd0, + 0xf6, 0x47, 0x48, 0x22, 0xf4, 0x6e, 0x38, 0xc5, + 0xab, 0xe2, 0xd0, 0x4d, 0x40, 0x27, 0xab, 0x8f, + 0x43, 0xb1, 0x60, 0x29, 0x07, 0xd0, 0xf5, 0x25, + 0xe5, 0xfa, 0xe7, 0x46, 0x32, 0x37, 0xb9, 0xae, + 0x2e, 0x02, 0x8c, 0x94, 0x15, 0x69, 0xd6, 0x74, + 0xb4, 0x36, 0xdd, 0x94, 0x70, 0xa7, 0x16, 0x7b, + 0x4c, 0xd3, 0x48, 0x83, 0xc5, 0xb2, 0xb0, 0x6a, + 0xfe, 0x7e, 0xd4, 0xe5, 0x6d, 0xa5, 0x96, 0x20, + 0x08, 0x59, 0xbd, 0x0c, 0x3d, 0x55, 0xa5, 0x03, +}; + +/* + * IV method encblkno8, blkno 2. + */ +static const uint8_t c3des_cbc_192_encblkno8_vec2_ctxt[SECSIZE] = { + 0xea, 0x7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 0x28, 0xd2, + 0x0b, 0x9c, 0xd9, 0xcb, 0x64, 0x49, 0xe4, 0x80, + 0x72, 0x58, 0xaa, 0xaa, 0x7e, 0x1d, 0x9f, 0xd7, + 0x29, 0x15, 0x65, 0xfc, 0xfd, 0x3f, 0xe1, 0x82, + 0x25, 0x3c, 0xd4, 0xbe, 0x59, 0x79, 0x63, 0xd1, + 0xd6, 0x0e, 0xda, 0x00, 0xf3, 0xaa, 0x13, 0xd3, + 0xed, 0xef, 0xca, 0x8b, 0x97, 0x15, 0x2d, 0x10, + 0x6f, 0xcf, 0xee, 0xc7, 0x21, 0xad, 0xe3, 0xe4, + 0xd8, 0x95, 0x21, 0x1f, 0xc0, 0x06, 0x3a, 0xbc, + 0xbb, 0x2a, 0x92, 0x78, 0x76, 0x9d, 0x1e, 0x7b, + 0xb5, 0x29, 0xaf, 0x96, 0x75, 0x2b, 0x41, 0xbd, + 0xae, 0x79, 0x28, 0x72, 0xe7, 0x54, 0xc4, 0x08, + 0xd3, 0xd2, 0xac, 0x96, 0xd0, 0x0f, 0x9b, 0x68, + 0x7d, 0x3f, 0xc2, 0xdd, 0x3d, 0xfc, 0xca, 0xcd, + 0x11, 0x71, 0xd9, 0x48, 0x53, 0x9f, 0xd3, 0x79, + 0x7d, 0x47, 0x71, 0x2a, 0x6d, 0x9e, 0xa9, 0x47, + 0xa1, 0xf7, 0x97, 0x80, 0x83, 0x70, 0x6b, 0xfe, + 0x10, 0x11, 0x6a, 0x0e, 0xdd, 0xde, 0x22, 0x3c, + 0x19, 0x30, 0x73, 0x73, 0x2e, 0x4b, 0x54, 0x17, + 0xc3, 0x2e, 0xe9, 0xce, 0xe0, 0xe3, 0xa0, 0x1a, + 0x28, 0xd1, 0x50, 0xa8, 0xd2, 0x40, 0xe2, 0x1b, + 0xfa, 0x49, 0x06, 0x49, 0x8b, 0x4b, 0xd9, 0xd5, + 0xf5, 0x50, 0xae, 0x64, 0x19, 0xe1, 0xd9, 0x4e, + 0xbb, 0x29, 0x70, 0x66, 0x46, 0xa8, 0x7e, 0x5b, + 0xdc, 0xe2, 0xd5, 0x9d, 0x56, 0x6d, 0x4c, 0xe6, + 0x0e, 0x6b, 0x71, 0x40, 0x82, 0xf7, 0xb3, 0xad, + 0x23, 0x17, 0xe3, 0x1c, 0x61, 0x1d, 0x3b, 0x71, + 0xfc, 0x06, 0x17, 0xec, 0x6c, 0x77, 0x98, 0x27, + 0xc7, 0x4b, 0x65, 0x17, 0x81, 0xe7, 0xcb, 0xce, + 0x09, 0x76, 0x82, 0x82, 0x4a, 0x53, 0x67, 0xa0, + 0x05, 0x25, 0x4c, 0xc4, 0xa7, 0xad, 0xa7, 0xaf, + 0xa0, 0x11, 0xd7, 0x73, 0x3b, 0x30, 0xbf, 0x53, + 0x50, 0x9b, 0xd8, 0xf3, 0x32, 0x15, 0xdd, 0x36, + 0x88, 0xc2, 0x39, 0x51, 0xb6, 0xb8, 0x0d, 0x5c, + 0x20, 0x4e, 0x24, 0xee, 0x95, 0x32, 0x61, 0x25, + 0xda, 0x73, 0x0d, 0x8a, 0x58, 0xe6, 0xcc, 0xad, + 0x79, 0x3d, 0xef, 0x29, 0x0c, 0x9f, 0xe1, 0xa7, + 0x22, 0x1e, 0xea, 0x7a, 0x4f, 0xfb, 0xc1, 0x1f, + 0x17, 0xca, 0x69, 0xd6, 0xa4, 0xce, 0x6e, 0xc0, + 0x70, 0xa3, 0x08, 0x32, 0x87, 0xb4, 0x6b, 0x80, + 0x5c, 0x7f, 0x88, 0x5c, 0xbf, 0x07, 0xd8, 0xe9, + 0xdd, 0xd2, 0x76, 0xa9, 0xaa, 0xd9, 0x55, 0x48, +}; + +/* + * IV method encblkno8, blkno 3. + */ +static const uint8_t c3des_cbc_192_encblkno8_vec3_ctxt[SECSIZE] = { + 0xf3, 0x49, 0xda, 0x5c, 0xde, 0x9d, 0x3e, 0x9d, + 0xb9, 0xc2, 0x6e, 0x96, 0xa9, 0x93, 0x10, 0x73, + 0x0e, 0x26, 0x39, 0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0x2c, + 0x49, 0xf1, 0x62, 0x90, 0xf7, 0x1e, 0x10, 0xce, + 0x8e, 0x95, 0xa3, 0xc6, 0xd8, 0xe5, 0xc8, 0xdf, + 0xcc, 0x94, 0x7d, 0x26, 0xab, 0x29, 0xbb, 0x9d, + 0xf3, 0x73, 0xce, 0xac, 0x76, 0xdf, 0x75, 0x2a, + 0x3e, 0x8f, 0x47, 0xff, 0x76, 0xfe, 0xea, 0xd4, + 0x4a, 0xa9, 0x36, 0x9d, 0x12, 0x45, 0xb7, 0x99, + 0x81, 0xb6, 0x77, 0x98, 0x13, 0xfb, 0x5a, 0xe5, + 0x40, 0x87, 0x61, 0x0d, 0x10, 0x76, 0xf6, 0x3e, + 0x48, 0xac, 0xc4, 0x27, 0x87, 0xcd, 0x07, 0xde, + 0x0b, 0x23, 0x97, 0x61, 0x3d, 0x18, 0x64, 0x7f, + 0xbf, 0xd6, 0x87, 0xc1, 0x11, 0xfb, 0xf9, 0xda, + 0x14, 0xa1, 0x01, 0xf8, 0x7e, 0xea, 0x5b, 0x5b, + 0xdd, 0x09, 0xf9, 0x31, 0x80, 0x3c, 0xee, 0x34, + 0x2d, 0xda, 0x71, 0xd9, 0x32, 0x7d, 0x45, 0xb2, + 0x53, 0xea, 0xd5, 0x7c, 0x85, 0x45, 0xce, 0x1d, + 0x2b, 0xe9, 0xd7, 0x95, 0xf8, 0x8c, 0x08, 0xe4, + 0xd0, 0x2f, 0x60, 0x75, 0x02, 0xf3, 0xde, 0xeb, + 0x46, 0x40, 0xa8, 0xd2, 0x37, 0xd6, 0xca, 0x5d, + 0xb9, 0xf4, 0x51, 0x31, 0x8a, 0x1a, 0x82, 0xbd, + 0x6f, 0x6d, 0x88, 0x2b, 0x63, 0x0f, 0xe1, 0xf0, + 0xcf, 0x13, 0x79, 0x1d, 0x78, 0x82, 0x66, 0xa1, + 0xef, 0xdb, 0x34, 0x50, 0xd2, 0x71, 0x47, 0x49, + 0x41, 0x74, 0xd9, 0x0b, 0x14, 0x38, 0x1f, 0xc3, + 0x09, 0x4d, 0xb3, 0xa6, 0x03, 0x3f, 0x56, 0x67, + 0xd7, 0x51, 0x4c, 0x8a, 0x1d, 0x37, 0x99, 0xfb, + 0xe1, 0x84, 0x57, 0x55, 0x9b, 0xf8, 0x73, 0x63, + 0x68, 0x73, 0x89, 0x52, 0x06, 0xe7, 0x34, 0xe7, + 0x1a, 0x15, 0x7e, 0xd9, 0x84, 0xa3, 0x0e, 0x68, + 0x14, 0x1c, 0xe8, 0x23, 0x9e, 0xe3, 0x8f, 0x71, + 0x02, 0x9b, 0x87, 0xd4, 0xd9, 0x1b, 0xd1, 0x9e, + 0x9e, 0xa0, 0x7e, 0x49, 0x8e, 0xaa, 0x89, 0xb5, + 0x16, 0x48, 0x07, 0xb3, 0x3d, 0x9e, 0x4c, 0x35, + 0x3e, 0x94, 0xa9, 0xf8, 0x82, 0x50, 0x6a, 0x41, + 0x28, 0x3e, 0x9f, 0x9a, 0x1a, 0x5d, 0x02, 0x7c, + 0xd0, 0x32, 0x52, 0xa5, 0xee, 0x09, 0x27, 0x2d, + 0x49, 0x17, 0xf7, 0x92, 0xa1, 0x63, 0x9d, 0x2a, + 0xfd, 0x53, 0x26, 0x14, 0x7c, 0x92, 0x72, 0xa6, + 0x38, 0x18, 0x8f, 0xb5, 0x54, 0xb3, 0x69, 0x63, + 0x6a, 0xdc, 0xb1, 0x5a, 0x12, 0x7a, 0x0b, 0xa3, +}; + +const struct testvec c3des_cbc_192_8_vectors[] = { + { + .blkno = 0, + .ptxt = c3des_cbc_ptxt, + .ctxt = c3des_cbc_192_encblkno8_vec0_ctxt, + }, + { + .blkno = 1, + .ptxt = c3des_cbc_ptxt, + .ctxt = c3des_cbc_192_encblkno8_vec1_ctxt, + }, + { + .blkno = 2, + .ptxt = c3des_cbc_ptxt, + .ctxt = c3des_cbc_192_encblkno8_vec2_ctxt, + }, + { + .blkno = 3, + .ptxt = c3des_cbc_ptxt, + .ctxt = c3des_cbc_192_encblkno8_vec3_ctxt, + }, +}; + +static int +open_disk(const char *devpath, const char *imgpath, size_t size) +{ + int fd; + + fd = open(imgpath, O_CREAT | O_RDWR | O_TRUNC, 0600); + if (fd < 0) + return -1; + + if (ftruncate(fd, size) < 0) + goto fail; + + if (rump_pub_etfs_register_withsize(devpath, + imgpath, RUMP_ETFS_BLK, 0, size) < 0) { + goto fail; + } + + unlink(imgpath); + return fd; +fail: + close(fd); + unlink(imgpath); + return -1; +} + +static int +open_cgd(int devno) +{ + char devpath[32]; + + sprintf(devpath, "/dev/rcgd%d%c", devno, getrawpartition() + 'a'); + + return rump_sys_open(devpath, O_RDWR, 0); +} + +static int +configure_cgd(int fd, const char *dkpath, const char *alg, + const char *ivmethod, const char *key, size_t keylen) +{ + struct cgd_ioctl ci; + + memset(&ci, 0, sizeof(ci)); + ci.ci_disk = dkpath; + ci.ci_alg = alg; + ci.ci_ivmethod = ivmethod; + ci.ci_keylen = 8 * keylen - 8; /* Exclude the NUL terminator. */ + ci.ci_key = key; + ci.ci_blocksize = 64; + + return rump_sys_ioctl(fd, CGDIOCSET, &ci); +} + +static int +unconfigure_cgd(int fd) +{ + struct cgd_ioctl ci; + + return rump_sys_ioctl(fd, CGDIOCCLR, &ci); +} + +static int +write_testvec(int cgdfd, const struct testvec *tv) +{ + + if (rump_sys_lseek(cgdfd, tv->blkno * SECSIZE, SEEK_SET) < 0) + return -1; + + if (rump_sys_write(cgdfd, tv->ptxt, SECSIZE) != SECSIZE) + return -1; + + return 0; +} + +static int +read_testvec(int cgdfd, const struct testvec *tv) +{ + char *buf; + int res = -1; + + buf = malloc(SECSIZE); + if (buf == NULL) + return -1; + + if (rump_sys_lseek(cgdfd, tv->blkno * SECSIZE, SEEK_SET) < 0) + goto fail; + + if (rump_sys_read(cgdfd, buf, SECSIZE) != SECSIZE) + goto fail; + + res = memcmp(buf, tv->ptxt, SECSIZE); +fail: + free(buf); + return res; +} + +static int +check_testvec(int dkfd, const struct testvec *tv) +{ + char *buf; + int res = -1; + + buf = malloc(SECSIZE); + if (buf == NULL) + return -1; + + if (lseek(dkfd, tv->blkno * SECSIZE, SEEK_SET) < 0) + goto fail; + + if (read(dkfd, buf, SECSIZE) != SECSIZE) + goto fail; + + res = memcmp(buf, tv->ctxt, SECSIZE); +fail: + free(buf); + return res; +} + +ATF_TC(cgd_3des_cbc_192_encblkno1); +ATF_TC_HEAD(cgd_3des_cbc_192_encblkno1, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Test 3des-cbc with 192 bits key, ivmethod encblkno1"); +} + +ATF_TC_BODY(cgd_3des_cbc_192_encblkno1, tc) +{ + const char imgpath[] = "3des-cbc-192-encblkno1.img"; + const char *dkpath = "/dev/dk"; + const size_t dksize = 4 * SECSIZE; /* Last blkno is 3. */ + int dkfd, cgdfd; + + rump_init(); + + RL(dkfd = open_disk(dkpath, imgpath, dksize)); + + RL(cgdfd = open_cgd(0)); + RL(configure_cgd(cgdfd, dkpath, "3des-cbc", "encblkno1", + c3des_cbc_192_key, sizeof(c3des_cbc_192_key))); + + ATF_CHECK_EQ(write_testvec(cgdfd, &c3des_cbc_192_1_vectors[0]), 0); + ATF_CHECK_EQ(write_testvec(cgdfd, &c3des_cbc_192_1_vectors[1]), 0); + ATF_CHECK_EQ(write_testvec(cgdfd, &c3des_cbc_192_1_vectors[2]), 0); + ATF_CHECK_EQ(write_testvec(cgdfd, &c3des_cbc_192_1_vectors[3]), 0); + + RL(unconfigure_cgd(cgdfd)); + RL(configure_cgd(cgdfd, dkpath, "3des-cbc", "encblkno1", + c3des_cbc_192_key, sizeof(c3des_cbc_192_key))); + + ATF_CHECK_EQ(read_testvec(cgdfd, &c3des_cbc_192_1_vectors[0]), 0); + ATF_CHECK_EQ(read_testvec(cgdfd, &c3des_cbc_192_1_vectors[1]), 0); + ATF_CHECK_EQ(read_testvec(cgdfd, &c3des_cbc_192_1_vectors[2]), 0); + ATF_CHECK_EQ(read_testvec(cgdfd, &c3des_cbc_192_1_vectors[3]), 0); + + RL(unconfigure_cgd(cgdfd)); + RL(rump_sys_close(cgdfd)); + + ATF_CHECK_EQ(check_testvec(dkfd, &c3des_cbc_192_1_vectors[0]), 0); + ATF_CHECK_EQ(check_testvec(dkfd, &c3des_cbc_192_1_vectors[1]), 0); + ATF_CHECK_EQ(check_testvec(dkfd, &c3des_cbc_192_1_vectors[2]), 0); + ATF_CHECK_EQ(check_testvec(dkfd, &c3des_cbc_192_1_vectors[3]), 0); + + RL(close(dkfd)); +} + +ATF_TC(cgd_3des_cbc_192_encblkno8); +ATF_TC_HEAD(cgd_3des_cbc_192_encblkno8, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Test 3des-cbc with 192 bits key, ivmethod encblkno8"); +} + +ATF_TC_BODY(cgd_3des_cbc_192_encblkno8, tc) +{ + const char imgpath[] = "3des-cbc-192-encblkno8.img"; + const char *dkpath = "/dev/dk"; + const size_t dksize = 4 * SECSIZE; /* Last blkno is 3. */ + int dkfd, cgdfd; + + rump_init(); + + RL(dkfd = open_disk(dkpath, imgpath, dksize)); + + RL(cgdfd = open_cgd(0)); + RL(configure_cgd(cgdfd, dkpath, "3des-cbc", "encblkno8", + c3des_cbc_192_key, sizeof(c3des_cbc_192_key))); + + ATF_CHECK_EQ(write_testvec(cgdfd, &c3des_cbc_192_8_vectors[0]), 0); + ATF_CHECK_EQ(write_testvec(cgdfd, &c3des_cbc_192_8_vectors[1]), 0); + ATF_CHECK_EQ(write_testvec(cgdfd, &c3des_cbc_192_8_vectors[2]), 0); + ATF_CHECK_EQ(write_testvec(cgdfd, &c3des_cbc_192_8_vectors[3]), 0); + + RL(unconfigure_cgd(cgdfd)); + RL(configure_cgd(cgdfd, dkpath, "3des-cbc", "encblkno8", + c3des_cbc_192_key, sizeof(c3des_cbc_192_key))); + + ATF_CHECK_EQ(read_testvec(cgdfd, &c3des_cbc_192_8_vectors[0]), 0); + ATF_CHECK_EQ(read_testvec(cgdfd, &c3des_cbc_192_8_vectors[1]), 0); + ATF_CHECK_EQ(read_testvec(cgdfd, &c3des_cbc_192_8_vectors[2]), 0); + ATF_CHECK_EQ(read_testvec(cgdfd, &c3des_cbc_192_8_vectors[3]), 0); + + RL(unconfigure_cgd(cgdfd)); + RL(rump_sys_close(cgdfd)); + + ATF_CHECK_EQ(check_testvec(dkfd, &c3des_cbc_192_8_vectors[0]), 0); + ATF_CHECK_EQ(check_testvec(dkfd, &c3des_cbc_192_8_vectors[1]), 0); + ATF_CHECK_EQ(check_testvec(dkfd, &c3des_cbc_192_8_vectors[2]), 0); + ATF_CHECK_EQ(check_testvec(dkfd, &c3des_cbc_192_8_vectors[3]), 0); + + RL(close(dkfd)); +} + +ATF_TP_ADD_TCS(tp) +{ + + ATF_TP_ADD_TC(tp, cgd_3des_cbc_192_encblkno1); + ATF_TP_ADD_TC(tp, cgd_3des_cbc_192_encblkno8); + + return atf_no_error(); +} diff --git a/contrib/netbsd-tests/dev/cgd/t_cgd_aes.c b/contrib/netbsd-tests/dev/cgd/t_cgd_aes.c new file mode 100644 index 000000000000..9416333a2d71 --- /dev/null +++ b/contrib/netbsd-tests/dev/cgd/t_cgd_aes.c @@ -0,0 +1,3606 @@ +/* $NetBSD: t_cgd_aes.c,v 1.5 2016/12/11 00:23:44 alnsn Exp $ */ +/*- + * Copyright (c) 2016 The NetBSD Foundation, Inc. + * Copyright (c) 2007 The Institute of Electrical and Electronics Engineers, Inc + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Alexander Nasonov. + * + * 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 COPYRIGHT HOLDERS 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 + * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include + +#include "../../h_macros.h" + +#define SECSIZE 512 + +struct testvec { + unsigned int blkno; + const uint8_t *ptxt; /* PlainText */ + const uint8_t *ctxt; /* CipherText */ +}; + +/* + * 128 bits CBC key, NUL terminated. + */ +static const char aes_cbc_128_key[17] = { + 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, /* 01234567 */ + 0x38, 0x39, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, /* 89ABCDEF */ + 0 +}; + +/* + * 192 bits CBC key, NUL terminated. + */ +static const char aes_cbc_192_key[25] = { + 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, /* ABCDEFGH */ + 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x50, /* IJKLMNOP */ + 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, /* QRSTUVWX */ + 0 +}; + +/* + * 256 bits CBC key, NUL terminated. + */ +static const char aes_cbc_256_key[33] = { + 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, /* 01234567 */ + 0x38, 0x39, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, /* 89ABCDEF */ + 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, /* 01234567 */ + 0x38, 0x39, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, /* 89abcdef */ + 0 +}; + +static const uint8_t aes_cbc_ptxt[SECSIZE] = + " abcdefghijklmnop" + " abcdefghijklmnop" + " abcdefghijklmnop" + " abcdefghijklmnop" + " abcdefghijklmnop" + " abcdefghijklmnop" + " abcdefghijklmnop" + " abcdefghijklmnop" + " abcdefghijklmnop" + " abcdefghijklmnop" + " abcdefghijklmnop" + " abcdefghijklmnop" + " abcdefghijklmnop" + " abcdefghijklmnop" + " abcdefghijklmnop" + " abcdefghijklmnop"; + +/* + * IV method encblkno1, blkno 0. + */ +static const uint8_t aes_cbc_128_encblkno1_vec0_ctxt[SECSIZE] = { + 0x1e, 0x95, 0x12, 0x15, 0xf6, 0xe0, 0xa7, 0x56, + 0x95, 0xa0, 0xa7, 0x35, 0x77, 0xf4, 0xdd, 0xdc, + 0x37, 0xc0, 0x28, 0x20, 0x00, 0x79, 0xa0, 0x35, + 0xe0, 0x83, 0x23, 0x95, 0x4e, 0xea, 0x8d, 0xa2, + 0x11, 0xbf, 0x9a, 0xd5, 0x21, 0x1e, 0x15, 0xb9, + 0xd1, 0x2e, 0xd2, 0xd9, 0xa5, 0xcc, 0x26, 0x75, + 0xba, 0x3e, 0x30, 0x11, 0xb2, 0x40, 0xdd, 0x1d, + 0x07, 0x3b, 0xe6, 0x00, 0xa7, 0x31, 0x9e, 0x58, + 0x41, 0xf3, 0x02, 0xf5, 0xad, 0x35, 0x79, 0x9a, + 0x9e, 0x03, 0xc8, 0x7a, 0x9d, 0x1d, 0x58, 0x9f, + 0x98, 0x67, 0xe2, 0x49, 0x81, 0x0c, 0x23, 0x90, + 0xd8, 0xc6, 0xf0, 0xc5, 0x73, 0x46, 0xd5, 0x14, + 0x1d, 0x78, 0x24, 0x7c, 0x9f, 0x5c, 0x8c, 0xe6, + 0x5d, 0x85, 0x7a, 0x5f, 0x76, 0xcc, 0xd8, 0xe9, + 0x03, 0xff, 0xfd, 0xd4, 0x12, 0x3f, 0xcb, 0xb0, + 0xfe, 0xfd, 0x86, 0x00, 0x0c, 0xe3, 0xdd, 0xa6, + 0x89, 0x92, 0xfe, 0xc8, 0x07, 0x5a, 0x94, 0x55, + 0x75, 0xae, 0x68, 0x47, 0xba, 0x84, 0x75, 0x58, + 0x33, 0x30, 0x2c, 0x16, 0x5b, 0xe9, 0x3f, 0x2a, + 0x09, 0xf9, 0x69, 0x23, 0x77, 0xd7, 0x2b, 0x95, + 0x4b, 0x78, 0x59, 0xcc, 0xfa, 0xf5, 0x79, 0xd2, + 0x05, 0x87, 0x66, 0x57, 0x93, 0xbf, 0x05, 0x90, + 0x4d, 0x6d, 0xd2, 0x72, 0x92, 0x24, 0xec, 0x14, + 0xe7, 0xbf, 0x82, 0x57, 0xbb, 0x14, 0x51, 0xe6, + 0xce, 0x3f, 0xa1, 0xfc, 0x63, 0x75, 0xee, 0xde, + 0xf9, 0x31, 0xd3, 0xa0, 0x07, 0xcd, 0x4d, 0x8f, + 0x83, 0x7d, 0x65, 0xe1, 0xc6, 0x60, 0x9e, 0x5c, + 0x51, 0x76, 0xfa, 0x64, 0xdf, 0xdc, 0xaf, 0x38, + 0xee, 0xe9, 0x8f, 0x4b, 0xa0, 0x3a, 0x21, 0xdf, + 0x58, 0x3b, 0x73, 0xf5, 0x30, 0xbb, 0x29, 0xe0, + 0xff, 0x60, 0xf0, 0x05, 0x5e, 0x37, 0xbc, 0x78, + 0x95, 0x3f, 0xa8, 0xd4, 0xb4, 0x82, 0x0d, 0xe1, + 0x10, 0xe3, 0xa7, 0x61, 0x37, 0x58, 0x28, 0x14, + 0x22, 0x57, 0x32, 0x28, 0x80, 0x98, 0x3e, 0x5f, + 0x71, 0xcf, 0x34, 0xb8, 0x6d, 0x6b, 0xc0, 0x23, + 0xc1, 0x9e, 0x58, 0x4f, 0xd5, 0xa4, 0x14, 0x03, + 0x2a, 0xed, 0xc4, 0xa7, 0x77, 0x7c, 0x4f, 0x94, + 0x91, 0x1d, 0x47, 0x34, 0x82, 0xe8, 0x9d, 0x32, + 0x5c, 0xc7, 0x38, 0xe9, 0x92, 0xcd, 0x35, 0xfd, + 0x1c, 0xcc, 0x3c, 0x28, 0x75, 0x6f, 0xff, 0xd5, + 0xe8, 0xbf, 0x90, 0x92, 0x34, 0x13, 0x11, 0x89, + 0xe0, 0xa2, 0x25, 0xeb, 0x82, 0x63, 0x31, 0x80, + 0x50, 0x6c, 0x99, 0xaa, 0x97, 0x0e, 0x59, 0x45, + 0x64, 0xb8, 0x77, 0x78, 0x6b, 0x24, 0xac, 0xc0, + 0xc9, 0xa9, 0xbc, 0x13, 0xd1, 0x5e, 0x50, 0x9a, + 0x91, 0x1a, 0x08, 0xf7, 0xc5, 0x18, 0x9f, 0x87, + 0x97, 0x9c, 0x0a, 0x27, 0xf1, 0x66, 0xf8, 0x09, + 0x52, 0x09, 0x41, 0x07, 0xc1, 0xa1, 0x91, 0xa4, + 0x59, 0x09, 0x75, 0x57, 0x5b, 0x53, 0x79, 0x58, + 0xa2, 0x9e, 0x49, 0xa2, 0x5e, 0xf7, 0x28, 0x1c, + 0x43, 0xa6, 0xcb, 0x88, 0x46, 0x84, 0xc9, 0x7f, + 0x84, 0xdb, 0x45, 0x0c, 0xb3, 0x7f, 0x01, 0x40, + 0x71, 0x3e, 0x48, 0x12, 0x1f, 0xbc, 0x1e, 0xdf, + 0x41, 0x50, 0xb2, 0x11, 0x67, 0x83, 0x19, 0x04, + 0x0e, 0x21, 0xd5, 0xf2, 0x54, 0x99, 0xfb, 0x47, + 0xf2, 0x5e, 0x02, 0x4b, 0x61, 0x6d, 0xef, 0x78, + 0x29, 0xe4, 0x3a, 0x56, 0x14, 0x20, 0x6f, 0x70, + 0x82, 0xea, 0x5d, 0xbc, 0x48, 0x89, 0x34, 0x69, + 0xdb, 0x4a, 0x06, 0xa7, 0xd6, 0xc7, 0xb7, 0x06, + 0x8e, 0x64, 0x21, 0x3e, 0xa6, 0x32, 0x61, 0x59, + 0x03, 0xea, 0xc3, 0x71, 0xf0, 0x26, 0x02, 0xe0, + 0x71, 0x95, 0x38, 0x11, 0x32, 0xe6, 0x3b, 0x25, + 0x53, 0x14, 0x24, 0x34, 0xe8, 0x8c, 0xa8, 0xef, + 0x52, 0xfe, 0x06, 0x2c, 0x20, 0x88, 0x4f, 0xa6, +}; + +/* + * IV method encblkno1, blkno 1. + */ +static const uint8_t aes_cbc_128_encblkno1_vec1_ctxt[SECSIZE] = { + 0x2f, 0x69, 0x3e, 0x95, 0x87, 0x91, 0x99, 0xd4, + 0xd9, 0x5d, 0xf2, 0x52, 0x32, 0x54, 0x2a, 0x80, + 0xa0, 0x77, 0x6e, 0x73, 0x15, 0xb4, 0xc9, 0x13, + 0x85, 0xed, 0x79, 0x9b, 0x84, 0x0a, 0x7e, 0xdb, + 0xee, 0x09, 0x78, 0x11, 0x28, 0xd5, 0x26, 0xec, + 0x1d, 0x52, 0xba, 0x33, 0x26, 0xeb, 0x91, 0xc6, + 0x4b, 0xf0, 0x38, 0xdf, 0x9f, 0x9d, 0x6c, 0xd8, + 0x49, 0x83, 0x88, 0xbe, 0x62, 0x2d, 0x5e, 0x88, + 0xc0, 0x35, 0xe4, 0xc3, 0xc9, 0x9f, 0x62, 0x59, + 0x16, 0xa7, 0x2e, 0xc0, 0xda, 0x3c, 0x2e, 0x10, + 0x53, 0xf0, 0x84, 0x27, 0x38, 0xd0, 0xf4, 0xb5, + 0x7c, 0x4a, 0x63, 0x04, 0x51, 0x22, 0xae, 0xf3, + 0xe7, 0x97, 0x53, 0xee, 0xe6, 0xaf, 0xc3, 0x49, + 0x3a, 0x5a, 0x74, 0x83, 0x18, 0xa3, 0x6b, 0xf3, + 0x6a, 0x3b, 0xe2, 0x1b, 0xd4, 0x64, 0x41, 0xdf, + 0xd1, 0xd2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0x3b, 0x3b, 0x3e, + 0x4f, 0xb5, 0x67, 0x9a, 0x9c, 0x37, 0x3d, 0xbf, + 0xd3, 0xab, 0xd7, 0x70, 0x03, 0x28, 0x5c, 0x3b, + 0xb7, 0x08, 0x38, 0x3d, 0x69, 0xa9, 0xcb, 0x63, + 0x04, 0x95, 0x8a, 0x16, 0x4c, 0xff, 0x9f, 0x0c, + 0xe2, 0x51, 0x95, 0x44, 0x52, 0x3b, 0x59, 0x9d, + 0x0b, 0x77, 0xa0, 0x39, 0x40, 0xea, 0x33, 0x25, + 0xc8, 0xc5, 0x90, 0x47, 0x23, 0xe3, 0x03, 0x8c, + 0x6a, 0xe0, 0x4f, 0x76, 0xe7, 0x72, 0x82, 0xcc, + 0xb2, 0xfd, 0xfb, 0x82, 0x1a, 0x28, 0x30, 0x89, + 0x0e, 0x25, 0xa7, 0x63, 0x85, 0x2e, 0x9b, 0xa6, + 0x0b, 0xa0, 0xb5, 0x34, 0xa2, 0x2e, 0x7f, 0xd4, + 0xe5, 0xd6, 0x95, 0xe8, 0x09, 0x3d, 0x4d, 0xdf, + 0xd9, 0xc0, 0x63, 0x17, 0xa5, 0x9c, 0xf6, 0xa3, + 0x59, 0x17, 0xc0, 0xf8, 0xa2, 0x11, 0x14, 0x88, + 0xf0, 0x1e, 0x4a, 0x4b, 0x13, 0xf6, 0xd6, 0x09, + 0xac, 0xf8, 0x39, 0x5d, 0x4c, 0x68, 0x69, 0x99, + 0x08, 0xd4, 0xf5, 0x39, 0x6d, 0x78, 0xde, 0xb5, + 0x6f, 0x34, 0xc4, 0x28, 0x73, 0x6c, 0x29, 0xa1, + 0xef, 0xfe, 0xed, 0x56, 0xb2, 0x70, 0x7b, 0xd5, + 0x5b, 0xd1, 0x09, 0x6a, 0x9a, 0x59, 0xe9, 0x79, + 0xe9, 0xee, 0xa4, 0x03, 0xc1, 0x67, 0xce, 0x62, + 0xf6, 0x4f, 0x04, 0xa5, 0x04, 0x71, 0x13, 0xeb, + 0x3d, 0x0a, 0x65, 0x2f, 0x57, 0xb0, 0xc0, 0xa4, + 0xf2, 0x8d, 0x78, 0x90, 0xeb, 0xc9, 0x5e, 0x8b, + 0xd8, 0xfb, 0xbc, 0x74, 0x1a, 0x70, 0x94, 0x2c, + 0xeb, 0xf2, 0x5e, 0x6d, 0xbb, 0x96, 0x7a, 0x2c, +}; + +/* + * IV method encblkno1, blkno 2. + */ +static const uint8_t aes_cbc_128_encblkno1_vec2_ctxt[SECSIZE] = { + 0xbc, 0x49, 0x35, 0x2c, 0xe3, 0x10, 0x12, 0x65, + 0x7a, 0xf4, 0xde, 0xd3, 0xf8, 0xe1, 0x49, 0x97, + 0x0a, 0x07, 0x93, 0x6c, 0xf8, 0x0e, 0xb7, 0xdf, + 0x53, 0xba, 0x1e, 0x8e, 0x14, 0xbd, 0xf6, 0x81, + 0xd6, 0xf6, 0x3d, 0xb2, 0xe7, 0x6a, 0x9d, 0x50, + 0x68, 0xc2, 0x75, 0x8e, 0xfb, 0x44, 0xfa, 0xc8, + 0x9f, 0x30, 0x15, 0xd5, 0xbe, 0xce, 0x04, 0xc1, + 0x99, 0xde, 0x3d, 0x2b, 0xc1, 0xc4, 0x8a, 0xb1, + 0xc5, 0x54, 0x47, 0x52, 0xf6, 0x38, 0x11, 0xcb, + 0x11, 0xf6, 0xb7, 0xbd, 0x4d, 0x24, 0xa1, 0xac, + 0x04, 0x17, 0x7e, 0x3c, 0xbc, 0x3b, 0xa0, 0x8d, + 0xfb, 0x22, 0x82, 0x56, 0xa2, 0xbe, 0xfe, 0xe7, + 0xde, 0xa4, 0xe9, 0xeb, 0xa0, 0x7a, 0x45, 0xc9, + 0x18, 0x0b, 0x14, 0xd5, 0xff, 0x4c, 0xe5, 0x86, + 0xac, 0xac, 0xaa, 0xb4, 0x70, 0x0c, 0x4a, 0x20, + 0xb6, 0xd8, 0x2d, 0xac, 0x09, 0xd8, 0xf6, 0x24, + 0xdf, 0xa5, 0x62, 0xef, 0x8c, 0x01, 0xa8, 0x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f, 0xe6, 0xa6, 0x2e, 0x06, 0x3a, + 0xf5, 0x27, 0x48, 0xe4, 0x31, 0x0f, 0xc5, 0xdf, + 0x29, 0x56, 0xed, 0x62, 0xf3, 0xef, 0xca, 0xa6, + 0x58, 0xd1, 0x84, 0x99, 0xd3, 0x34, 0x67, 0x92, + 0x6a, 0xb2, 0xd1, 0xd1, 0x50, 0x1f, 0xe9, 0xd8, + 0x3c, 0xbe, 0x12, 0x97, 0x7c, 0x4f, 0xc0, 0xbe, + 0x91, 0x32, 0x15, 0xd5, 0xf2, 0x5e, 0xe6, 0x13, + 0x86, 0xfa, 0xc6, 0xde, 0xd8, 0xe1, 0x70, 0xb4, + 0xf7, 0x5b, 0x9f, 0x79, 0x55, 0x22, 0x7a, 0xe1, + 0x54, 0x40, 0x39, 0x11, 0xe1, 0x78, 0x01, 0x01, + 0xc0, 0x44, 0xeb, 0x92, 0xb9, 0x01, 0xdd, 0x56, + 0xb9, 0x7e, 0xa0, 0x50, 0x41, 0x58, 0xb2, 0x13, + 0x12, 0x44, 0xd2, 0x39, 0xf2, 0x76, 0x3c, 0x53, + 0x36, 0xfe, 0x17, 0x74, 0x91, 0x8d, 0xbe, 0xc5, + 0x40, 0xf7, 0xa2, 0xe9, 0x65, 0xd9, 0xdf, 0x80, + 0x7b, 0xd9, 0xc3, 0x1f, 0xb4, 0xfc, 0x9f, 0x8d, + 0x7a, 0x4e, 0x1e, 0x32, 0x6d, 0xb1, 0x82, 0x1e, + 0x0c, 0xb6, 0x0b, 0xe6, 0x15, 0x82, 0x5c, 0xcc, + 0xc8, 0x4a, 0x73, 0x56, 0x9d, 0x11, 0xfa, 0xcd, + 0x21, 0x95, 0x23, 0x71, 0xe8, 0xfe, 0x06, 0x43, + 0xf6, 0x17, 0x51, 0x28, 0x0d, 0xfb, 0x0a, 0x49, + 0x1b, 0x35, 0x1e, 0x4a, 0x38, 0x08, 0x6b, 0xcd, + 0x67, 0x21, 0x94, 0x09, 0x28, 0xca, 0x0a, 0x18, + 0xdf, 0x6c, 0x86, 0x47, 0x10, 0x29, 0x81, 0x9a, + 0x73, 0xba, 0x78, 0xbd, 0xc0, 0x61, 0xee, 0x23, +}; + +/* + * IV method encblkno1, blkno 3. + */ +static const uint8_t aes_cbc_128_encblkno1_vec3_ctxt[SECSIZE] = { + 0x29, 0x9f, 0xb1, 0x0f, 0x7d, 0xb4, 0xd9, 0xbb, + 0xf9, 0x06, 0x60, 0xdc, 0xb9, 0xeb, 0x73, 0x6e, + 0xfe, 0xdb, 0x99, 0x29, 0xe8, 0x42, 0x46, 0xe7, + 0x49, 0xcf, 0x90, 0x2d, 0x08, 0xd7, 0xd5, 0xbf, + 0x0f, 0x4f, 0x66, 0xce, 0xcd, 0xb1, 0x8a, 0xc7, + 0x47, 0xc9, 0x8e, 0xe3, 0x9f, 0x80, 0x79, 0xc6, + 0xa8, 0xe5, 0x20, 0x66, 0x58, 0xde, 0xab, 0x87, + 0x5e, 0x7e, 0xcd, 0x55, 0x81, 0x09, 0x40, 0xd9, + 0x8b, 0x7e, 0xd3, 0xf9, 0x16, 0x55, 0x72, 0x7d, + 0xe8, 0x36, 0x76, 0x06, 0x77, 0x47, 0xa5, 0xdc, + 0x80, 0x33, 0x7d, 0x88, 0x5f, 0x56, 0x48, 0x0f, + 0x66, 0xb5, 0x91, 0x9d, 0xf8, 0xdb, 0x83, 0x0d, + 0xd4, 0xc6, 0x13, 0xfc, 0xd4, 0xe5, 0x34, 0x81, + 0x70, 0x4d, 0x96, 0x82, 0x5d, 0xb2, 0x36, 0x37, + 0xdf, 0xd2, 0x5e, 0x31, 0xf0, 0x9d, 0x6d, 0xb7, + 0xf9, 0x2d, 0xcb, 0x77, 0xb8, 0x59, 0xa0, 0xbb, + 0x4f, 0x8d, 0xa0, 0xd1, 0x49, 0x17, 0x93, 0x3c, + 0xf0, 0x4e, 0x72, 0xdd, 0x99, 0x9a, 0x87, 0xf1, + 0x01, 0x89, 0xdf, 0xef, 0xed, 0x04, 0x86, 0x3d, + 0x9b, 0xab, 0x6c, 0xa7, 0xef, 0x1b, 0xbb, 0x24, + 0xbc, 0x65, 0x01, 0x06, 0x12, 0x3f, 0x7e, 0x9f, + 0x83, 0xf3, 0xd4, 0x43, 0x18, 0x03, 0xa3, 0x07, + 0xbc, 0x85, 0xe8, 0xdb, 0x6c, 0x8f, 0xaf, 0x70, + 0x71, 0x5d, 0xbc, 0x6d, 0x14, 0x05, 0xdf, 0xce, + 0x9f, 0xe2, 0xa3, 0x51, 0x66, 0x92, 0x52, 0x19, + 0x98, 0xbd, 0xb2, 0x68, 0x79, 0xf4, 0x5d, 0x71, + 0xcb, 0xa0, 0x1b, 0x77, 0x34, 0x46, 0x69, 0x3c, + 0xa4, 0x0f, 0x72, 0xf5, 0x73, 0xf6, 0xa0, 0xe9, + 0x72, 0xef, 0xa1, 0xcc, 0x43, 0xfc, 0xb7, 0xf3, + 0x59, 0xeb, 0x40, 0x61, 0x02, 0x26, 0x9b, 0x71, + 0x57, 0x17, 0x36, 0xac, 0xc8, 0xd5, 0x9d, 0xcb, + 0x4d, 0x4f, 0xf7, 0xc1, 0x58, 0xce, 0xbf, 0x73, + 0xe7, 0xd0, 0x58, 0x0d, 0x08, 0x01, 0x8f, 0x68, + 0x1b, 0x3f, 0x3a, 0x7b, 0xdb, 0x9e, 0xa7, 0x33, + 0x59, 0x91, 0xa8, 0xe3, 0x58, 0x22, 0x3f, 0x97, + 0xe1, 0xdb, 0xd6, 0x99, 0x0e, 0xdd, 0x76, 0xcd, + 0x4d, 0x02, 0x28, 0x43, 0x8a, 0xdd, 0x10, 0xad, + 0x55, 0xe0, 0x62, 0xf7, 0x44, 0xbc, 0x3f, 0x99, + 0x3c, 0x09, 0x25, 0xfb, 0xfd, 0x1e, 0x4c, 0x45, + 0x0e, 0x6e, 0x75, 0x15, 0x48, 0x19, 0x08, 0xc3, + 0x2b, 0x81, 0x60, 0x5f, 0x19, 0x09, 0x74, 0x0a, + 0xbd, 0x0d, 0x8d, 0x94, 0x55, 0x04, 0x2b, 0x8e, + 0x0d, 0x10, 0x60, 0x64, 0x0d, 0x7f, 0x63, 0x2e, + 0x89, 0x0b, 0xfc, 0x1c, 0xbc, 0xf3, 0x66, 0xc5, + 0x80, 0x93, 0x3a, 0x74, 0x15, 0x11, 0xd5, 0xba, + 0xbc, 0x06, 0x3f, 0x85, 0xcc, 0x6c, 0xd3, 0xf2, + 0x74, 0xc6, 0x10, 0x15, 0x0a, 0x02, 0x66, 0xa4, + 0xa8, 0x93, 0x0b, 0x5c, 0xe7, 0x13, 0x96, 0x90, + 0xdd, 0xe3, 0x25, 0x22, 0x46, 0x7b, 0x49, 0xde, + 0x72, 0x55, 0xf3, 0x30, 0x62, 0x5f, 0x7a, 0x2a, + 0x37, 0x88, 0xea, 0x57, 0x99, 0x64, 0x50, 0x2d, + 0xd3, 0x6a, 0x09, 0x4b, 0xd6, 0x61, 0xf2, 0x22, + 0x53, 0x36, 0xf7, 0x42, 0x21, 0xde, 0xda, 0xcb, + 0x8b, 0x6f, 0xf3, 0x4e, 0x2c, 0x16, 0xfb, 0xfc, + 0x13, 0xa7, 0xd1, 0xd8, 0xfd, 0x16, 0x39, 0x20, + 0xe0, 0xb2, 0xb4, 0xd5, 0x40, 0x93, 0x30, 0xf3, + 0xab, 0x88, 0xe3, 0xfb, 0xbe, 0xb8, 0x02, 0x3a, + 0x78, 0x2d, 0x56, 0x4b, 0x92, 0x5b, 0x0a, 0x8d, + 0x18, 0xa4, 0x5b, 0x11, 0x60, 0x0b, 0x45, 0xad, + 0x0b, 0x64, 0x96, 0x7d, 0x84, 0xf2, 0x20, 0xa8, + 0x95, 0x78, 0xb3, 0xb5, 0x98, 0x1f, 0xa7, 0x3e, + 0x30, 0x77, 0x43, 0xd2, 0x8c, 0x20, 0xc5, 0x5e, + 0x76, 0xcd, 0x2c, 0x7c, 0xfa, 0x34, 0x36, 0xda, + 0x39, 0x00, 0x2e, 0x69, 0x4a, 0xb3, 0x0f, 0x6f, +}; + +const struct testvec aes_cbc_128_1_vectors[] = { + { + .blkno = 0, + .ptxt = aes_cbc_ptxt, + .ctxt = aes_cbc_128_encblkno1_vec0_ctxt, + }, + { + .blkno = 1, + .ptxt = aes_cbc_ptxt, + .ctxt = aes_cbc_128_encblkno1_vec1_ctxt, + }, + { + .blkno = 2, + .ptxt = aes_cbc_ptxt, + .ctxt = aes_cbc_128_encblkno1_vec2_ctxt, + }, + { + .blkno = 3, + .ptxt = aes_cbc_ptxt, + .ctxt = aes_cbc_128_encblkno1_vec3_ctxt, + }, +}; + +/* + * IV method encblkno8, blkno 0. + */ +static const uint8_t aes_cbc_128_encblkno8_vec0_ctxt[SECSIZE] = { + 0xa6, 0x64, 0xef, 0x0f, 0xc4, 0x45, 0xcc, 0x5e, + 0xf8, 0x27, 0x42, 0x5e, 0xbd, 0x93, 0x99, 0xcd, + 0x79, 0xa8, 0x7d, 0x72, 0xc4, 0x02, 0x99, 0xa6, + 0xe4, 0x69, 0x57, 0x82, 0xdf, 0x32, 0x4e, 0x67, + 0x2a, 0xd9, 0x58, 0x8c, 0x9f, 0xfc, 0x4d, 0xcf, + 0x7b, 0xa4, 0xa1, 0xfa, 0xd9, 0x4d, 0xb5, 0x67, + 0x06, 0x4a, 0x9e, 0x6d, 0xe8, 0xaa, 0xdd, 0xae, + 0x8c, 0xda, 0xcf, 0x26, 0xd5, 0x94, 0x8d, 0x12, + 0xf8, 0xdd, 0x21, 0x4c, 0xcb, 0xc8, 0x5d, 0xd1, + 0x6a, 0x89, 0x37, 0xd0, 0x32, 0xe4, 0x87, 0xbc, + 0x5d, 0xef, 0xca, 0x38, 0xd5, 0x08, 0xfb, 0xcf, + 0xb7, 0x8d, 0x65, 0x52, 0x13, 0xea, 0x2d, 0x30, + 0xd3, 0x9a, 0xe8, 0x9c, 0x76, 0x25, 0x44, 0x2a, + 0xf1, 0xe1, 0xbb, 0xcd, 0xbc, 0x9c, 0xf5, 0xa3, + 0xfb, 0x23, 0x53, 0x95, 0x61, 0xea, 0x46, 0x97, + 0xf6, 0xbf, 0xdf, 0xf9, 0xb7, 0x94, 0x73, 0xa8, + 0xc1, 0xaa, 0x64, 0xfb, 0x66, 0x26, 0x0f, 0x4c, + 0xee, 0x3c, 0xb6, 0x3f, 0x13, 0x88, 0xaa, 0x7d, + 0x91, 0x01, 0x1a, 0x95, 0x3b, 0xb5, 0x7e, 0x1f, + 0xc1, 0x84, 0xa6, 0x83, 0x99, 0xe6, 0xaf, 0x21, + 0x33, 0xff, 0x2e, 0xc9, 0xfe, 0xf2, 0xa1, 0x37, + 0xed, 0x91, 0x73, 0x70, 0x4f, 0xb4, 0x69, 0x69, + 0x98, 0x1d, 0x6d, 0xd4, 0xa4, 0xac, 0x73, 0x61, + 0x04, 0xf5, 0x13, 0x50, 0x2a, 0xa9, 0xf7, 0x61, + 0x78, 0xf5, 0x87, 0x26, 0xc5, 0x4a, 0x30, 0xbb, + 0x94, 0x55, 0x51, 0xb4, 0xa0, 0x83, 0x30, 0xe6, + 0xf7, 0xc7, 0x89, 0x61, 0x73, 0xd9, 0xbd, 0xe1, + 0x4e, 0x14, 0x8a, 0x02, 0x3d, 0x7a, 0x58, 0x92, + 0x41, 0xe7, 0x90, 0x8d, 0xd7, 0x67, 0x62, 0xf8, + 0x99, 0xa7, 0x9d, 0x55, 0xec, 0x18, 0x6b, 0x42, + 0xaf, 0x27, 0x97, 0xe5, 0x51, 0xa9, 0x10, 0x27, + 0x5e, 0x3f, 0xac, 0xda, 0xd3, 0xb5, 0x2b, 0x43, + 0x2e, 0x10, 0xdc, 0xd9, 0xe2, 0x2f, 0x4f, 0xfe, + 0xf3, 0x0d, 0x06, 0x76, 0xf9, 0x25, 0xcd, 0x26, + 0xef, 0x8e, 0x9b, 0xc2, 0xb3, 0x20, 0x2b, 0x00, + 0xb6, 0xe6, 0x2e, 0xf7, 0x17, 0xc7, 0xa8, 0x3c, + 0x00, 0xfc, 0x78, 0x8d, 0x10, 0x38, 0xd1, 0x11, + 0x94, 0xed, 0xb4, 0x22, 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 0x53, 0x20, 0x74, 0xab, 0x0c, 0xf6, 0xcd, 0x15, + 0x32, 0xa6, 0x01, 0x8d, 0x24, 0x1b, 0x4b, 0x1f, + 0xa3, 0xfc, 0x38, 0x82, 0x3a, 0xa1, 0xb5, 0x52, + 0x53, 0xc7, 0x2b, 0x30, 0x7c, 0x65, 0xb9, 0x7d, +}; + +/* + * IV method encblkno8, blkno 1. + */ +static const uint8_t aes_cbc_128_encblkno8_vec1_ctxt[SECSIZE] = { + 0x63, 0x45, 0x16, 0x0c, 0xe4, 0x4f, 0x51, 0xde, + 0x74, 0xf8, 0x7b, 0xf5, 0x05, 0x17, 0x13, 0x1e, + 0xa5, 0x3d, 0x84, 0xfa, 0x35, 0x5a, 0x2d, 0x3c, + 0xb7, 0x61, 0x68, 0xff, 0xcd, 0x33, 0x1f, 0x0b, + 0x53, 0x79, 0xf2, 0x2f, 0xbc, 0x8d, 0xac, 0xb9, + 0xf9, 0xb7, 0x9c, 0x0a, 0x9d, 0xa1, 0x4d, 0x78, + 0x9e, 0x4e, 0xfa, 0xe8, 0xc8, 0x46, 0x4b, 0x99, + 0x91, 0x7e, 0x33, 0x6e, 0x18, 0x24, 0x01, 0xc3, + 0x9f, 0x8c, 0x43, 0xb5, 0x15, 0x7e, 0xdd, 0xf9, + 0x1b, 0xb0, 0xf2, 0xc3, 0x97, 0x1f, 0x7c, 0x3f, + 0x43, 0x4c, 0x9f, 0x93, 0x29, 0x83, 0x8f, 0xad, + 0xd1, 0x5e, 0x92, 0x1a, 0x17, 0xd1, 0xa0, 0x05, + 0x6e, 0x62, 0x59, 0x80, 0x50, 0x6d, 0xe3, 0x28, + 0x9a, 0x43, 0xdc, 0x81, 0x4f, 0x49, 0xc4, 0x98, + 0xcd, 0x6d, 0x28, 0xb4, 0x86, 0xe4, 0x83, 0x45, + 0xd4, 0x43, 0x52, 0x8a, 0xd6, 0xc8, 0x1c, 0x90, + 0xeb, 0xf0, 0xe7, 0x76, 0xb4, 0x43, 0x9b, 0x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b3, 0x8b, 0xe3, 0xce, 0xf7, + 0x3e, 0x8e, 0xcf, 0x47, 0xe2, 0xf2, 0xad, 0x06, + 0x00, 0x9a, 0x3a, 0x55, 0xf5, 0x9e, 0xbf, 0x5a, + 0x2e, 0x5a, 0x6c, 0x2b, 0x8f, 0x33, 0x71, 0x2c, + 0x56, 0x43, 0xd1, 0x8b, 0xd2, 0x98, 0x14, 0xb7, + 0x5a, 0xdc, 0x8b, 0xbc, 0xfe, 0x50, 0x99, 0x84, + 0x48, 0x5f, 0xcd, 0xed, 0xce, 0x61, 0x6f, 0xa6, + 0x83, 0xa3, 0x34, 0xbe, 0xf2, 0x66, 0xf3, 0x09, + 0xf3, 0xd3, 0x97, 0xd4, 0xee, 0x66, 0x9a, 0x81, + 0x62, 0x84, 0x85, 0x7f, 0x79, 0x18, 0xd2, 0x82, + 0xd6, 0x96, 0x09, 0x61, 0x1e, 0x53, 0x97, 0x80, + 0x0a, 0x81, 0x4b, 0x93, 0xf0, 0x03, 0x65, 0x18, + 0x93, 0x5b, 0x60, 0x2f, 0xb5, 0xfe, 0x82, 0xaf, + 0x85, 0xb7, 0x79, 0x7c, 0xee, 0xad, 0xea, 0xfa, + 0x9b, 0xad, 0xca, 0x38, 0x21, 0x3d, 0x46, 0x8a, + 0x5b, 0xa7, 0x55, 0x3d, 0x88, 0x4a, 0x52, 0xdb, + 0xf2, 0x07, 0xed, 0xd6, 0x3c, 0x9f, 0x1b, 0x42, + 0xb4, 0x14, 0x12, 0xb7, 0x00, 0xfc, 0x6a, 0x79, + 0x61, 0x0b, 0x43, 0xaa, 0x44, 0x48, 0x30, 0x15, + 0x48, 0x76, 0x27, 0x32, 0x7a, 0x2e, 0x25, 0x6a, + 0x8c, 0x8c, 0x64, 0x67, 0x86, 0x54, 0x4a, 0x93, + 0x14, 0xfe, 0x81, 0xf5, 0xcf, 0x98, 0x92, 0xd3, + 0x92, 0xf5, 0x6a, 0x74, 0x28, 0x10, 0x6b, 0xd4, + 0x1d, 0x64, 0x7e, 0x05, 0x32, 0xba, 0xf7, 0x4c, + 0xe9, 0xa8, 0xa9, 0xc5, 0x35, 0x34, 0x26, 0x41, +}; + +/* + * IV method encblkno8, blkno 2. + */ +static const uint8_t aes_cbc_128_encblkno8_vec2_ctxt[SECSIZE] = { + 0x64, 0x7b, 0x62, 0x7a, 0xa6, 0xa9, 0xb3, 0x47, + 0xbc, 0x03, 0x14, 0x3d, 0x9b, 0x56, 0xfc, 0x13, + 0x08, 0x32, 0x81, 0xe3, 0x57, 0x3c, 0x0d, 0xbb, + 0x85, 0x44, 0x47, 0x12, 0xc4, 0x80, 0x35, 0x37, + 0xe1, 0xb4, 0x3f, 0x35, 0x98, 0x7c, 0xb0, 0x3b, + 0x85, 0xab, 0x3d, 0x0b, 0xd3, 0x6f, 0xf9, 0x92, + 0x00, 0x6b, 0x18, 0xe7, 0x31, 0x8b, 0x77, 0x4c, + 0xd0, 0x7b, 0x1d, 0xfc, 0x95, 0xe6, 0x02, 0x01, + 0x9c, 0x17, 0x4d, 0x9b, 0x3a, 0x1d, 0x12, 0x23, + 0xd4, 0x24, 0xf8, 0x47, 0x5e, 0x2d, 0xfd, 0xc8, + 0x74, 0x28, 0xb4, 0x3a, 0x99, 0x6b, 0xcc, 0xba, + 0xe5, 0x51, 0x0b, 0xab, 0x4d, 0x63, 0xfc, 0x6d, + 0x2d, 0xd9, 0x2b, 0x4f, 0xa4, 0x26, 0xc7, 0x8d, + 0x9d, 0x12, 0x7f, 0xc7, 0x6b, 0x15, 0x8b, 0x4a, + 0x41, 0xf8, 0x50, 0x32, 0x76, 0x10, 0xca, 0x8e, + 0xfe, 0x08, 0x7d, 0x9a, 0xb5, 0x1a, 0xdb, 0x10, + 0xb3, 0x6a, 0x5f, 0xd9, 0x0a, 0x5f, 0x31, 0x19, + 0x3e, 0xa9, 0xa1, 0x72, 0x1f, 0x6c, 0x97, 0x20, + 0xd4, 0xab, 0xb8, 0xad, 0xf7, 0x70, 0x12, 0xd0, + 0x8f, 0x70, 0x24, 0x58, 0x2e, 0x99, 0xcd, 0xd4, + 0xf4, 0xcd, 0xef, 0x93, 0xfb, 0x4f, 0x9a, 0x40, + 0x46, 0x92, 0x6b, 0xd0, 0x25, 0x24, 0xec, 0x4d, + 0x4c, 0x42, 0x50, 0x61, 0xb6, 0x21, 0xa6, 0x2e, + 0xc1, 0x42, 0x9e, 0x86, 0x9f, 0x57, 0x2a, 0x2c, + 0x82, 0xbd, 0xc2, 0x25, 0xb6, 0x9f, 0x2d, 0x9f, + 0xba, 0xe0, 0xa6, 0x06, 0x04, 0x08, 0xc5, 0x1d, + 0x8c, 0x0f, 0xbf, 0x21, 0x85, 0x6d, 0x61, 0x4d, + 0x93, 0xc0, 0xa2, 0x8b, 0xca, 0x07, 0xd0, 0x88, + 0x74, 0xf9, 0x42, 0x92, 0xd5, 0x0d, 0x0c, 0x34, + 0xa6, 0xa5, 0x86, 0x51, 0xcf, 0x40, 0x36, 0x66, + 0x35, 0x9f, 0xa8, 0x95, 0x0b, 0xfb, 0x0c, 0xe8, + 0xdc, 0x12, 0x78, 0x4c, 0x52, 0xf4, 0xfc, 0x4a, + 0x77, 0xdd, 0x77, 0x34, 0xf7, 0x35, 0x94, 0x7a, + 0x31, 0x16, 0x86, 0x44, 0x50, 0x30, 0x1c, 0x6d, + 0x9f, 0x66, 0x49, 0xb5, 0xe6, 0x71, 0x00, 0x83, + 0xd1, 0xa0, 0x01, 0xff, 0xc3, 0x27, 0xaa, 0x9a, + 0xdb, 0xad, 0x24, 0xdb, 0xbd, 0xde, 0xfd, 0xa6, + 0xaa, 0x87, 0x98, 0x98, 0xde, 0x90, 0xd5, 0x40, + 0x20, 0x8f, 0xe9, 0xdd, 0xa8, 0xec, 0xd3, 0x18, + 0x20, 0x85, 0x5e, 0xd5, 0xe7, 0x50, 0x58, 0x15, + 0x69, 0x03, 0xa5, 0xe8, 0xa9, 0x7a, 0x0f, 0xd1, + 0x7d, 0x22, 0x8a, 0xe0, 0xc6, 0x17, 0x33, 0x00, + 0x57, 0xcb, 0xf6, 0x8d, 0xf0, 0xc1, 0x7b, 0xb5, + 0x96, 0x0f, 0x08, 0x84, 0x5b, 0x7e, 0xa6, 0x1e, + 0xd8, 0x5e, 0x0c, 0xca, 0x30, 0x4b, 0xe0, 0x87, + 0x2f, 0xbc, 0x07, 0x83, 0x35, 0x76, 0x36, 0x17, + 0xcf, 0xdb, 0x27, 0x53, 0x43, 0xf5, 0x07, 0xd0, + 0x91, 0x83, 0xa1, 0xaa, 0x8d, 0xdb, 0x00, 0x2b, + 0xd1, 0x88, 0xe5, 0x59, 0x47, 0x17, 0xf0, 0xe8, + 0xce, 0x3b, 0xa0, 0x73, 0x1f, 0x22, 0x9b, 0x1b, + 0x59, 0x02, 0xe6, 0xaf, 0x3f, 0xdd, 0xfe, 0xba, + 0xc3, 0x6b, 0xe5, 0x82, 0x02, 0x92, 0x0c, 0x5e, + 0x5a, 0x87, 0x88, 0x91, 0x00, 0xb5, 0x30, 0x37, + 0xf5, 0xc6, 0xdf, 0x0a, 0x7f, 0x03, 0x1c, 0x1f, + 0x20, 0xf1, 0xd4, 0x5f, 0x94, 0xc3, 0x6f, 0x21, + 0x5e, 0xf2, 0x77, 0x5a, 0x42, 0xfd, 0xd3, 0xc4, + 0x31, 0xaf, 0xd6, 0x6c, 0x6c, 0xde, 0x8c, 0x50, + 0x01, 0x8f, 0x57, 0x90, 0x88, 0x43, 0xf9, 0x44, + 0x09, 0x4d, 0x27, 0x58, 0x9f, 0xae, 0x50, 0x28, + 0x12, 0x47, 0x20, 0x79, 0x2b, 0xe4, 0x02, 0x97, + 0xcd, 0xab, 0x53, 0x28, 0x8f, 0x8f, 0xe3, 0x3b, + 0xd6, 0xc9, 0xc8, 0xff, 0xbf, 0x18, 0x3b, 0x75, + 0xdb, 0xcf, 0x07, 0x8c, 0xfe, 0x58, 0xee, 0x75, + 0x01, 0x98, 0x98, 0xe4, 0x60, 0xfe, 0xe6, 0x7f, +}; + +/* + * IV method encblkno8, blkno 3. + */ +static const uint8_t aes_cbc_128_encblkno8_vec3_ctxt[SECSIZE] = { + 0x98, 0xae, 0x82, 0x1d, 0x76, 0x3a, 0xfe, 0x80, + 0x04, 0xa3, 0x43, 0xf0, 0x06, 0x45, 0x83, 0xb7, + 0xe2, 0xb5, 0x73, 0x46, 0x78, 0x01, 0x2f, 0xd6, + 0x0d, 0x49, 0x64, 0x4c, 0xeb, 0x8d, 0xdc, 0xa9, + 0xdc, 0xea, 0x22, 0x25, 0xd4, 0x8f, 0xba, 0x9f, + 0xd4, 0x7a, 0x3c, 0x9e, 0xd0, 0xd9, 0xcd, 0xa4, + 0x12, 0xdf, 0x8f, 0x50, 0x24, 0x18, 0xa2, 0x0b, + 0xd9, 0x7f, 0xda, 0x78, 0xd6, 0x11, 0xf3, 0x99, + 0xc4, 0xec, 0x95, 0xe2, 0x85, 0xe1, 0xa0, 0x0d, + 0x07, 0x22, 0x56, 0xaf, 0x2f, 0xf5, 0x7d, 0x63, + 0xf2, 0x90, 0x6c, 0x26, 0x4f, 0xa5, 0x47, 0xcd, + 0x66, 0x2d, 0x4c, 0x4d, 0x94, 0x6a, 0x3c, 0x98, + 0xe4, 0x5e, 0x3b, 0x42, 0x3a, 0x93, 0x02, 0xd0, + 0x90, 0xc7, 0xcd, 0x87, 0x0e, 0x84, 0x82, 0xf5, + 0x77, 0x7b, 0x29, 0xe4, 0xea, 0x5b, 0x60, 0x50, + 0xf7, 0x60, 0x8d, 0xf7, 0xd8, 0xd7, 0x7d, 0x99, + 0x8a, 0xdc, 0xe2, 0xb9, 0x40, 0xac, 0x4b, 0x9f, + 0x55, 0x30, 0xcb, 0x5a, 0x73, 0x64, 0xf2, 0xca, + 0x76, 0x88, 0xf7, 0x55, 0xb5, 0x33, 0xc0, 0x44, + 0xdf, 0x42, 0xee, 0xc9, 0xc5, 0x2a, 0x47, 0x18, + 0x8b, 0x74, 0xb9, 0x4f, 0x2c, 0xd8, 0x7a, 0xd1, + 0x12, 0x19, 0xf9,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, 0x95, 0x1e, 0x5c, + 0x05, 0x4e, 0x3c, 0x18, 0xee, 0xa9, 0x56, 0x9c, + 0x3c, 0xc3, 0x67, 0x84, 0x57, 0x77, 0x8d, 0xff, + 0xea, 0x34, 0x3c, 0xf9, 0x58, 0xb8, 0xdc, 0x4e, + 0xa1, 0x92, 0x2d, 0x9a, 0x91, 0x61, 0x23, 0x6a, + 0xd9, 0xb7, 0x41, 0xc5, 0x0d, 0xb6, 0x57, 0x58, + 0x42, 0x39, 0x4a, 0x86, 0x7e, 0x9d, 0xeb, 0x7d, + 0xa8, 0x14, 0x1a, 0x5c, 0xa1, 0x54, 0x34, 0xb6, + 0xb6, 0xbc, 0x1f, 0xf5, 0xe2, 0xb5, 0xe4, 0xa8, + 0x42, 0xe3, 0x3d, 0x06, 0x6b, 0x50, 0xbb, 0xa1, + 0x6b, 0x63, 0xe5, 0x60, 0x28, 0x07, 0x49, 0x06, + 0x61, 0x0e, 0xa3, 0x6c, 0xc3, 0xc8, 0x3e, 0x5a, + 0x9c, 0xa5, 0xb3, 0x9b, 0x8d, 0x46, 0xb9, 0xf5, + 0x4a, 0x4d, 0xbe, 0xc0, 0xc1, 0x24, 0x92, 0x09, + 0x7c, 0x9a, 0x21, 0x2c, 0x08, 0x8a, 0x0d, 0xfc, + 0xff, 0xda, 0xdc, 0xf1, 0x45, 0x66, 0xf9, 0xcd, + 0x64, 0x7c, 0x2f, 0x0e, 0x95, 0x5e, 0xec, 0x92, + 0xd1, 0x03, 0x03, 0xa0, 0xcc, 0x73, 0x92, 0x15, + 0x74, 0x42, 0x54, 0x48, 0x77, 0xbe, 0x96, 0xfb, + 0x1f, 0x0c, 0x7a, 0x25, 0x67, 0x6b, 0x85, 0x71, + 0x06, 0x15, 0xd3, 0x11, 0xfe, 0xf7, 0xa9, 0xb1, +}; + +const struct testvec aes_cbc_128_8_vectors[] = { + { + .blkno = 0, + .ptxt = aes_cbc_ptxt, + .ctxt = aes_cbc_128_encblkno8_vec0_ctxt, + }, + { + .blkno = 1, + .ptxt = aes_cbc_ptxt, + .ctxt = aes_cbc_128_encblkno8_vec1_ctxt, + }, + { + .blkno = 2, + .ptxt = aes_cbc_ptxt, + .ctxt = aes_cbc_128_encblkno8_vec2_ctxt, + }, + { + .blkno = 3, + .ptxt = aes_cbc_ptxt, + .ctxt = aes_cbc_128_encblkno8_vec3_ctxt, + }, +}; + +/* + * IV method encblkno1, blkno 0. + */ +static const uint8_t aes_cbc_192_encblkno1_vec0_ctxt[SECSIZE] = { + 0x7c, 0xc4, 0xec, 0x89, 0x7c, 0x13, 0xac, 0x99, + 0x49, 0xa9, 0x96, 0xe7, 0xb1, 0x1a, 0xd6, 0xb0, + 0xeb, 0x89, 0x27, 0x0f, 0x8b, 0x1b, 0xab, 0x8e, + 0x2c, 0xd4, 0x00, 0x66, 0x12, 0x3a, 0x9a, 0x03, + 0xc4, 0x49, 0xa4, 0xf0, 0xc1, 0x90, 0xf9, 0x38, + 0xb2, 0x5c, 0xa5, 0x0d, 0x1b, 0x60, 0x94, 0xf6, + 0x31, 0x4a, 0x72, 0xdb, 0xfc, 0xe1, 0x3c, 0xd6, + 0x9d, 0x03, 0x07, 0x45, 0xdb, 0xad, 0xdb, 0xb3, + 0x86, 0xfa, 0xce, 0x2c, 0xeb, 0xa2, 0xac, 0x05, + 0xd9, 0x52, 0xb8, 0xae, 0xa9, 0x91, 0x86, 0x4b, + 0xbb, 0xf8, 0x03, 0xb0, 0x6c, 0x40, 0xcc, 0xbf, + 0xa3, 0x76, 0x60, 0xf7, 0x29, 0x03, 0xe6, 0x44, + 0xcc, 0x2a, 0xe7, 0x74, 0x8e, 0x62, 0xfe, 0x99, + 0x6a, 0x6d, 0x04, 0x1b, 0xe7, 0xf7, 0x9f, 0x13, + 0xa7, 0x1d, 0x93, 0x0e, 0x8f, 0xe0, 0x77, 0x9b, + 0xe3, 0x91, 0x67, 0x12, 0x33, 0x12, 0x42, 0x55, + 0x28, 0x04, 0x2d, 0x01, 0x2b, 0xd2,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a, 0x27, 0x43, 0x46, 0x7f, 0x94, 0xe5, + 0x45, 0x67, 0x12, 0xc8, 0x99, 0x85, 0x08, 0x2a, + 0x37, 0x40, 0x0b, 0xb5, 0xd9, 0xa3, 0xf7, 0xc8, + 0x87, 0xb1, 0xe6, 0x87, 0x2f, 0x86, 0xd8, 0x9c, + 0x7b, 0xec, 0xcf, 0xa4, 0xe5, 0xd5, 0x50, 0x3f, + 0xdf, 0xc9, 0xb7, 0x29, 0x97, 0xd6, 0x33, 0xba, + 0xf0, 0x72, 0xf0, 0x76, 0x12, 0xd3, 0x99, 0x4f, + 0x1b, 0x36, 0xda, 0xa1, 0x83, 0xfe, 0xf5, 0x94, + 0x9e, 0x61, 0x82, 0x62, 0xe0, 0x08, 0x3a, 0xbd, + 0xba, 0x8b, 0x3d, 0xd6, 0xbd, 0x16, 0x5f, 0xd7, + 0x1d, 0x6c, 0x0e, 0x92, 0x89, 0x8c, 0x38, 0x62, + 0x80, 0xee, 0x7e, 0x63, 0x82, 0x88, 0x0b, 0xbf, + 0xdd, 0x9f, 0xbc, 0xba, 0xa7, 0x5a, 0xc6, 0x0d, + 0x87, 0x59, 0xbf, 0x0a, 0x85, 0x06, 0xa3, 0xb4, + 0x66, 0x63, 0xda, 0x12, 0x29, 0x5f, 0x2e, 0x4d, + 0x60, 0xfd, 0x85, 0x76, 0xaf, 0xf7, 0x87, 0xed, + 0x1f, 0x46, 0xc2, 0xd6, 0x6c, 0x98, 0x6b, 0x4b, + 0x60, 0x04, 0xed, 0x89, 0x3b, 0x85, 0x6c, 0xe9, + 0x46, 0xd9, 0xfa, 0x35, 0x61, 0xe8, 0x0c, 0x84, + 0x1b, 0x93, 0xc0, 0xfe, 0x5d, 0x29, 0x14, 0xe1, + 0x1c, 0x66, 0x73, 0xc8, 0x0b, 0x98, 0xff, 0x1a, + 0x78, 0x2b, 0x6a, 0x93, 0x7a, 0x29, 0xd8, 0x7b, + 0xb1, 0x39, 0xf0, 0xad, 0x93, 0x4d, 0x2d, 0xab, + 0x67, 0x3c, 0xa4, 0xa1, 0x08, 0x36, 0x0b, 0xe9, + 0x77, 0xd0, 0xe3, 0x45, 0x7d, 0x99, 0x75, 0xc3, +}; + +/* + * IV method encblkno1, blkno 1. + */ +static const uint8_t aes_cbc_192_encblkno1_vec1_ctxt[SECSIZE] = { + 0xe6, 0x41, 0x75, 0xd6, 0x80, 0xdf, 0x44, 0x37, + 0xa7, 0xa2, 0xb2, 0x29, 0x0d, 0xf0, 0x02, 0x78, + 0x92, 0xb2, 0x06, 0x5f, 0x86, 0xd3, 0x9c, 0xa3, + 0xd0, 0xc5, 0x08, 0x03, 0x6d, 0x41, 0x9d, 0x61, + 0xb4, 0xb9, 0xa1, 0x69, 0x6e, 0x3a, 0x78, 0xd7, + 0x04, 0x94, 0xf2, 0x53, 0xed, 0xd1, 0xf6, 0xd8, + 0x98, 0xe2, 0x49, 0x75, 0x15, 0x85, 0xe0, 0x78, + 0x5b, 0x28, 0x5e, 0xe6, 0xfa, 0x60, 0x3d, 0x4b, + 0x8c, 0xf1, 0x1a, 0xfd, 0x1f, 0xe8, 0xad, 0xb4, + 0xa1, 0xe7, 0xd3, 0x71, 0x16, 0xdf, 0xc6, 0x95, + 0xd4, 0x43, 0xaf, 0x92, 0xab, 0x74, 0x0f, 0x77, + 0x75, 0x4d, 0xd7, 0x13, 0x97, 0x18, 0xea, 0x43, + 0x92, 0x0d, 0x88, 0xc8, 0x41, 0xf7, 0x15, 0x34, + 0x0f, 0x63, 0xbf, 0x50, 0x18, 0xbe, 0x9d, 0x3b, + 0xfc, 0x17, 0x7d, 0x03, 0x39, 0xc2, 0x39, 0x28, + 0xb2, 0x23, 0x1c, 0x7f, 0x3f, 0x19, 0x6c, 0x2f, + 0x64, 0xbd, 0xc9, 0x7d, 0xbe, 0x98, 0xe0, 0x83, + 0xa4, 0x48, 0xfc, 0x89, 0xe7, 0xe0, 0x93, 0x93, + 0x7b, 0x15, 0x35, 0xaf, 0xf8, 0x00, 0x81, 0xcc, + 0x04, 0x80, 0x8b, 0x20, 0xc8, 0x6a, 0xb7, 0x5e, + 0x95, 0xce, 0x69, 0x50, 0x39, 0x88, 0x90, 0x41, + 0x3f, 0xa8, 0x62, 0x42, 0xf1, 0xa9, 0x56, 0xce, + 0x25, 0x53, 0x1d, 0x97, 0x5d, 0x3a, 0x4e, 0x6b, + 0x1f, 0xd6, 0xea, 0x20, 0x81, 0x6c, 0xe5, 0xa1, + 0x0d, 0x9a, 0xd9, 0x3c, 0xbb, 0xbc, 0xc1, 0x77, + 0xe2, 0xf4, 0x9c, 0x11, 0x3a, 0x2f, 0xd0, 0x77, + 0x10, 0xa6, 0x36, 0xd1, 0xbf, 0x3b, 0x50, 0x39, + 0x4b, 0x2c, 0x62, 0x06, 0x1a, 0xe4, 0x18, 0xc0, + 0x35, 0x7c, 0xc3, 0xd0, 0x22, 0xf8, 0xee, 0x19, + 0xa5, 0x3d, 0x69, 0xa9, 0x34, 0xe6, 0x29, 0xf9, + 0xf1, 0xff, 0x26, 0x7a, 0x66, 0x13, 0x1a, 0xa2, + 0xc6, 0xac, 0x84, 0xf6, 0x6b, 0x09, 0xbd, 0x32, + 0x6f, 0x26, 0x37, 0x7c, 0x7d, 0x74, 0xe4, 0xa0, + 0xeb, 0x85, 0x7a, 0xa1, 0x92, 0x19, 0x2e, 0x64, + 0x82, 0x7c, 0x89, 0x1b, 0x14, 0x92, 0xd1, 0xf4, + 0x1f, 0x29, 0x84, 0x04, 0x70, 0x09, 0x13, 0x4c, + 0x62, 0x9a, 0xb4, 0xf7, 0xc1, 0x7b, 0x83, 0xd1, + 0x2d, 0x1a, 0xbe, 0x83, 0x9b, 0x73, 0xba, 0x8d, + 0xbb, 0xb0, 0xf2, 0x5c, 0x72, 0x75, 0x01, 0x0b, + 0xa6, 0x43, 0x6b, 0x76, 0x56, 0x4e, 0x71, 0x1b, + 0xb2, 0x34, 0x1f, 0x70, 0x44, 0xe6, 0xfb, 0x67, + 0xd1, 0x4d, 0x63, 0xce, 0x17, 0x46, 0x9b, 0x11, + 0xda, 0x93, 0xf8, 0x03, 0x11, 0x8f, 0x90, 0xff, + 0x80, 0x85, 0x02, 0x1f, 0xb6, 0x6a, 0x28, 0x3f, + 0x01, 0xa8, 0x36, 0x2e, 0xc7, 0x42, 0xd4, 0x02, + 0x26, 0xea, 0xb5, 0x84, 0x6c, 0x9f, 0xa0, 0x4a, + 0x73, 0x49, 0xea, 0x91, 0x4d, 0x62, 0xf8, 0x23, + 0xe4, 0x3d, 0x91, 0xfb, 0x53, 0x2c, 0x8c, 0xa4, + 0xfe, 0x81, 0x05, 0x5d, 0x4b, 0x9a, 0x75, 0x29, + 0xf8, 0xbe, 0x3f, 0x05, 0xb4, 0x8f, 0xdc, 0xcc, + 0xfa, 0xcc, 0xd7, 0xb2, 0x06, 0x03, 0xd4, 0xf3, + 0x8e, 0x09, 0x09, 0x80, 0xf8, 0xc3, 0x3b, 0x66, + 0xe9, 0x9c, 0x5b, 0x16, 0xed, 0x2d, 0x35, 0x1c, + 0x99, 0x3b, 0x1f, 0x0e, 0x04, 0x30, 0x23, 0x3a, + 0x83, 0x0c, 0xec, 0x76, 0xf2, 0x5d, 0x13, 0x54, + 0x15, 0x62, 0x36, 0x26, 0x6b, 0x21, 0x62, 0xdd, + 0xb4, 0x1a, 0x57, 0x16, 0xfd, 0xa0, 0x9c, 0xfa, + 0x37, 0xb3, 0xda, 0xe0, 0x46, 0x91, 0xb3, 0x20, + 0xe7, 0xe2, 0xf3, 0x0e, 0x20, 0x3c, 0x98, 0x1b, + 0xe4, 0xc2, 0xd3, 0xa9, 0x97, 0xaf, 0x12, 0x69, + 0x23, 0x97, 0x62, 0x6e, 0xae, 0x54, 0x9c, 0x82, + 0x92, 0x50, 0x74, 0x07, 0x4a, 0xb1, 0xdc, 0xcf, + 0x53, 0x1d, 0xc8, 0x29, 0x1f, 0x6e, 0xf1, 0x13, + 0xec, 0xb6, 0x60, 0xb1, 0x4c, 0x9d, 0xd7, 0x77, +}; + +/* + * IV method encblkno1, blkno 2. + */ +static const uint8_t aes_cbc_192_encblkno1_vec2_ctxt[SECSIZE] = { + 0x33, 0xfd, 0xfa, 0x44, 0x64, 0x75, 0x22, 0x7e, + 0xe3, 0xb3, 0xa0, 0x75, 0x99, 0x96, 0xc0, 0xec, + 0x56, 0x06, 0x7d, 0x19, 0x0b, 0x66, 0x89, 0xe0, + 0x69, 0x1d, 0x93, 0x91, 0xd7, 0x0f, 0xf8, 0xf5, + 0x5a, 0x39, 0x30, 0xad, 0x64, 0x42, 0x06, 0xa3, + 0xce, 0x3f, 0x67, 0xd6, 0x6e, 0xcd, 0x3b, 0xf5, + 0x03, 0x2b, 0x07, 0x83, 0x18, 0x1a, 0x4f, 0x4c, + 0xe7, 0x6b, 0xe8, 0xf9, 0x19, 0xa5, 0x23, 0x8f, + 0x46, 0x35, 0x13, 0x7b, 0x61, 0x05, 0xfc, 0x7d, + 0x17, 0x39, 0x03, 0xa8, 0xec, 0x7a, 0xd2, 0x5f, + 0x91, 0xa7, 0x26, 0x07, 0x9d, 0xd7, 0x0c, 0xd7, + 0xd4, 0x8e, 0x37, 0xf3, 0x1a, 0x3c, 0x04, 0x83, + 0x04, 0x71, 0x06, 0xa6, 0x5f, 0x82, 0xe0, 0x6d, + 0x87, 0x5c, 0x7c, 0x03, 0x25, 0x03, 0x4b, 0x24, + 0x07, 0x40, 0xad, 0xe4, 0x1d, 0x1d, 0xcb, 0x34, + 0xc2, 0x53, 0x1d, 0x13, 0xc5, 0x87, 0xab, 0xa7, + 0x95, 0x11, 0x8b, 0xbb, 0xf0, 0xc3, 0x00, 0xeb, + 0xe5, 0xb0, 0x9e, 0x88, 0x8b, 0xad, 0xca, 0xcb, + 0x17, 0xf8, 0x92, 0x4d, 0x00, 0xb0, 0x08, 0x74, + 0x08, 0xb9, 0x8b, 0x95, 0x96, 0xd9, 0x36, 0x35, + 0x31, 0x92, 0x89, 0xf6, 0x35, 0x33, 0xfb, 0x18, + 0x5b, 0x84, 0xa1, 0xfe, 0xe1, 0x62, 0x04, 0x6f, + 0x3c, 0xc1, 0xd2, 0xc2, 0x10, 0xd7, 0x97, 0xba, + 0x29, 0x7c, 0xe3, 0x85, 0xee, 0x59, 0x90, 0xaf, + 0x7f, 0x6f, 0x97, 0x97, 0xa2, 0x41, 0x18, 0x7f, + 0x2f, 0x06, 0x15, 0xb2, 0x46, 0x82, 0x49, 0x39, + 0xd0, 0xfb, 0xa8, 0x48, 0x44, 0x28, 0x58, 0xff, + 0xd8, 0xf2, 0x65, 0xf9, 0x4f, 0x2c, 0xbe, 0xec, + 0xb6, 0xdf, 0x27, 0x1a, 0xf2, 0x05, 0x15, 0x5e, + 0xe3, 0x2a, 0x98, 0x29, 0x92, 0x4a, 0x1b, 0x5d, + 0x5c, 0x2c, 0x70, 0xf6, 0x41, 0xd4, 0xbe, 0x64, + 0xa1, 0xd9, 0x79, 0xf1, 0x11, 0x16, 0xda, 0xa2, + 0xaf, 0xdd, 0x4d, 0xa8, 0xed, 0xec, 0xbe, 0x7d, + 0x49, 0x6c, 0x30, 0xf2, 0xf5, 0x36, 0x3c, 0xae, + 0x4b, 0xa7, 0x77, 0xa3, 0xca, 0x22, 0xa5, 0xe2, + 0x4d, 0x44, 0xcb, 0x36, 0xd5, 0x3f, 0x20, 0x13, + 0xb6, 0xfb, 0xcd, 0x79, 0xd7, 0x42, 0xf9, 0x75, + 0x09, 0x45, 0x28, 0x9e, 0xf2, 0xbd, 0x15, 0x57, + 0xf8, 0x4b, 0xc0, 0xd3, 0xb3, 0xb8, 0xde, 0x55, + 0x9e, 0x11, 0x67, 0xab, 0xc5, 0x5d, 0x58, 0xdb, + 0x4d, 0x20, 0x34, 0x77, 0x33, 0x9c, 0x46, 0x76, + 0x9b, 0x1e, 0x0e, 0x6b, 0x4e, 0xd9, 0x63, 0x68, + 0x78, 0x5e, 0x7c, 0x52, 0xa2, 0x64, 0xa9, 0xfc, + 0x21, 0x35, 0x17, 0x93, 0x18, 0x9e, 0x10, 0xcf, + 0x95, 0x6b, 0xf0, 0x55, 0x46, 0xc3, 0x4b, 0xfc, + 0x86, 0x8b, 0x0d, 0x3b, 0x5c, 0x30, 0xcc, 0xf1, + 0x4c, 0x43, 0xf0, 0xd6, 0xf6, 0x3b, 0x0b, 0x68, + 0x6f, 0x21, 0xd1, 0x61, 0xda, 0x35, 0x92, 0x94, + 0xa5, 0x5d, 0x47, 0x39, 0x96, 0x50, 0x5f, 0xbd, + 0x57, 0x22, 0xd2, 0x65, 0x73, 0x05, 0x8f, 0x2b, + 0xf2, 0x96, 0x53, 0x6b, 0x8e, 0xd3, 0x1e, 0xe7, + 0x92, 0xd4, 0xea, 0x41, 0xee, 0x92, 0x4d, 0x10, + 0x9f, 0x68, 0xd8, 0xe9, 0xac, 0x1f, 0x38, 0x0b, + 0x12, 0xa4, 0x1c, 0xb2, 0x63, 0x2b, 0x87, 0x07, + 0xb8, 0x1e, 0x02, 0x2b, 0x4d, 0xad, 0x99, 0xdf, + 0xe3, 0x98, 0x69, 0x29, 0x11, 0xe3, 0x77, 0x45, + 0x9a, 0xe9, 0x6c, 0x47, 0x4e, 0xc0, 0x85, 0x15, + 0x68, 0x58, 0x41, 0x37, 0xab, 0x96, 0x11, 0x94, + 0x9e, 0xbb, 0xa8, 0x5d, 0x51, 0x05, 0x93, 0xdd, + 0x2e, 0xb8, 0xdf, 0xcf, 0x83, 0xbc, 0xf6, 0x53, + 0x95, 0x93, 0x27, 0xda, 0xa5, 0x20, 0x1b, 0x7d, + 0x1d, 0xd9, 0x0c, 0xde, 0xe5, 0x3f, 0xc8, 0x60, + 0x16, 0x32, 0x95, 0x24, 0xa7, 0x2b, 0x74, 0xf1, + 0x67, 0xf9, 0xf2, 0x49, 0xda, 0x12, 0x97, 0xdd, +}; + +/* + * IV method encblkno1, blkno 3. + */ +static const uint8_t aes_cbc_192_encblkno1_vec3_ctxt[SECSIZE] = { + 0xa5, 0x81, 0x86, 0x78, 0x4a, 0xd7, 0x5b, 0x83, + 0xcf, 0xbf, 0x7e, 0x3c, 0xd7, 0xcd, 0xaf, 0xfa, + 0x82, 0x18, 0xce, 0xbd, 0x8b, 0xe6, 0xd9, 0x39, + 0x22, 0x2d, 0x1e, 0x75, 0x65, 0xee, 0x61, 0xf2, + 0xc3, 0x8b, 0xf4, 0x40, 0x03, 0x73, 0x8a, 0x21, + 0x9f, 0xf3, 0xcc, 0x93, 0x08, 0x3d, 0xff, 0x8a, + 0xbc, 0x0f, 0x19, 0xa1, 0x9f, 0xc8, 0x73, 0xe8, + 0xa6, 0x14, 0x2e, 0x43, 0x19, 0x79, 0x61, 0x35, + 0x8d, 0x55, 0x06, 0xeb, 0x96, 0xe7, 0xf5, 0x4b, + 0x95, 0x5f, 0x9b, 0xb2, 0x18, 0x0d, 0x13, 0xc2, + 0x96, 0x79, 0x50, 0x78, 0x98, 0x50, 0x88, 0x2b, + 0xab, 0x05, 0x66, 0xa1, 0x3a, 0x25, 0x85, 0xe2, + 0xd0, 0xe2, 0xac, 0xb5, 0x26, 0xde, 0x95, 0x04, + 0x45, 0xe7, 0x22, 0x71, 0x02, 0xb3, 0x84, 0x4c, + 0xb5, 0xad, 0x64, 0x5c, 0x27, 0x5c, 0x71, 0xcd, + 0x0b, 0x62, 0x91, 0xd6, 0x84, 0x00, 0x62, 0x52, + 0x54, 0xbd, 0x22, 0xc8, 0x57, 0xa7, 0x41, 0xac, + 0xc7, 0xa8, 0x56, 0x6f, 0x1b, 0x7e, 0xce, 0x02, + 0x29, 0x3b, 0xc0, 0x5d, 0x8e, 0x11, 0xa9, 0x54, + 0xc2, 0xf2, 0xf0, 0x81, 0x6c, 0x9a, 0x24, 0x5b, + 0x81, 0x7d, 0xf3, 0x84, 0x93, 0xc6, 0x2a, 0xd4, + 0xd3, 0x1a, 0x2f, 0x97, 0x2e, 0x31, 0x8a, 0x62, + 0x43, 0xcb, 0xc7, 0x3d, 0x73, 0x8e, 0xd6, 0x86, + 0x17, 0x8f, 0x63, 0xd4, 0xb1, 0x50, 0x92, 0xce, + 0x90, 0x37, 0x91, 0xce, 0x37, 0x13, 0x8e, 0x61, + 0x21, 0xd8, 0x1a, 0xbf, 0x42, 0x65, 0x1d, 0x86, + 0x07, 0x04, 0x9b, 0xd1, 0xd3, 0x26, 0x6b, 0x7c, + 0xa1, 0x77, 0x54, 0x5b, 0x9f, 0x95, 0x62, 0x43, + 0xb3, 0x71, 0x1e, 0x4c, 0x32, 0xd1, 0x3e, 0xe8, + 0x60, 0x9c, 0x0c, 0x15, 0x55, 0xf0, 0x38, 0xb7, + 0x1e, 0x40, 0xe5, 0x26, 0x4e, 0x46, 0x49, 0x47, + 0x59, 0x3d, 0x49, 0x76, 0x28, 0xd3, 0xed, 0x03, + 0xdd, 0xf8, 0x1a, 0xf4, 0x1a, 0xfe, 0xe4, 0x03, + 0xb9, 0xa5, 0x8e, 0x7c, 0x91, 0x7a, 0xb2, 0x17, + 0x84, 0x97, 0x3f, 0x12, 0x68, 0xaa, 0xf5, 0x73, + 0xbc, 0x84, 0xdd, 0x03, 0x4a, 0xc4, 0xcd, 0xdb, + 0xb0, 0x8a, 0x3b, 0xac, 0xf1, 0xdd, 0x10, 0x20, + 0x69, 0xee, 0x94, 0xcd, 0x60, 0x3f, 0x01, 0xcf, + 0xf4, 0xff, 0xdb, 0x91, 0x8a, 0xf3, 0xb8, 0x44, + 0x62, 0xdc, 0xdc, 0xc8, 0x2b, 0xaf, 0x0d, 0x5e, + 0x1b, 0x58, 0x7f, 0x6b, 0x0d, 0xc4, 0xd4, 0x1c, + 0x89, 0x29, 0x60, 0x5d, 0xe9, 0x59, 0xbb, 0x19, + 0x03, 0x7c, 0x25, 0x63, 0xc6, 0x89, 0x6f, 0xe6, + 0xbe, 0xcd, 0xaa, 0xf2, 0xbf, 0x16, 0xcb, 0x47, + 0xc6, 0x74, 0xdd, 0x90, 0x41, 0x75, 0x7f, 0x26, + 0x7b, 0x5a, 0xb9, 0x11, 0xa0, 0xc7, 0x75, 0x60, + 0xc5, 0x54, 0x7d, 0xb0, 0xb4, 0xd0, 0x95, 0x01, + 0xff, 0x07, 0x49, 0x56, 0xfb, 0xec, 0xa9, 0x4c, + 0x68, 0x28, 0x41, 0x81, 0x80, 0x05, 0x88, 0x58, + 0xf5, 0xdc, 0x42, 0x99, 0xd8, 0xb7, 0x47, 0xd9, + 0xf7, 0x0e, 0x2c, 0x0f, 0x95, 0x04, 0xb3, 0xc8, + 0x8a, 0xe2, 0x21, 0x57, 0x8d, 0x64, 0x54, 0x40, + 0xf6, 0xd0, 0x3c, 0x97, 0xcf, 0x22, 0xce, 0xcd, + 0xbf, 0x05, 0x15, 0xaa, 0x89, 0xd9, 0x2b, 0x48, + 0xaf, 0x34, 0xe0, 0xf5, 0xe3, 0x58, 0x06, 0xd7, + 0x49, 0x00, 0x95, 0x3a, 0xb3, 0xc8, 0xcd, 0x2b, + 0x3e, 0xe8, 0x1b, 0x60, 0xe8, 0xea, 0xaf, 0x09, + 0xbb, 0xee, 0xce, 0xbc, 0xa0, 0x9b, 0x17, 0x90, + 0x42, 0x40, 0x18, 0x35, 0x2e, 0x17, 0xa0, 0x6e, + 0x43, 0xe7, 0xac, 0x89, 0x96, 0x3c, 0x16, 0xe0, + 0xdb, 0x09, 0x51, 0x4a, 0x45, 0x33, 0x63, 0xe9, + 0x4e, 0x3f, 0x32, 0x34, 0x36, 0x43, 0xd5, 0x0c, + 0x5a, 0x2e, 0x0e, 0x8b, 0x80, 0xb7, 0xf4, 0xe4, + 0x99, 0x9b, 0x05, 0xf5, 0xb2, 0xe4, 0x03, 0xe4, +}; + +const struct testvec aes_cbc_192_1_vectors[] = { + { + .blkno = 0, + .ptxt = aes_cbc_ptxt, + .ctxt = aes_cbc_192_encblkno1_vec0_ctxt, + }, + { + .blkno = 1, + .ptxt = aes_cbc_ptxt, + .ctxt = aes_cbc_192_encblkno1_vec1_ctxt, + }, + { + .blkno = 2, + .ptxt = aes_cbc_ptxt, + .ctxt = aes_cbc_192_encblkno1_vec2_ctxt, + }, + { + .blkno = 3, + .ptxt = aes_cbc_ptxt, + .ctxt = aes_cbc_192_encblkno1_vec3_ctxt, + }, +}; + +/* + * IV method encblkno8, blkno 0. + */ +static const uint8_t aes_cbc_192_encblkno8_vec0_ctxt[SECSIZE] = { + 0x87, 0x9c, 0x05, 0xd6, 0x25, 0xb9, 0xe0, 0xbe, + 0x78, 0x21, 0x85, 0x81, 0x8e, 0x2f, 0x13, 0x5e, + 0xf2, 0x73, 0x11, 0xfa, 0x73, 0x77, 0x93, 0x5e, + 0x71, 0x16, 0x98, 0x68, 0x6f, 0xe8, 0x22, 0x34, + 0xf5, 0x11, 0xfa, 0x61, 0xe6, 0x1a, 0xfb, 0x42, + 0xa7, 0xa3, 0x2e, 0x0d, 0xc1, 0x9d, 0x7d, 0xd9, + 0xfb, 0xbb, 0xc5, 0x08, 0x9d, 0xc2, 0xab, 0x5c, + 0xdf, 0x9b, 0x3c, 0x1a, 0xbd, 0x66, 0x5a, 0x91, + 0x1c, 0x00, 0x59, 0x2e, 0x92, 0xe9, 0x23, 0xf6, + 0x90, 0x3d, 0x5b, 0x72, 0x76, 0x78, 0xd9, 0xa2, + 0x48, 0x33, 0x29, 0xe2, 0xfd, 0x77, 0x14, 0xda, + 0x01, 0x92, 0x63, 0xdd, 0x8c, 0x1c, 0x2e, 0xf7, + 0x61, 0xfb, 0xc5, 0x76, 0xec, 0x7f, 0xef, 0xdc, + 0xbe, 0x2d, 0x3b, 0x69, 0x30, 0xb9, 0x08, 0x00, + 0xe8, 0x37, 0x09, 0xaa, 0x2a, 0x02, 0x80, 0x11, + 0x91, 0x16, 0x94, 0x7d, 0xb5, 0xdc, 0x9f, 0xb3, + 0xb0, 0x26, 0x72, 0x85, 0x93, 0x85, 0x19, 0x08, + 0x97, 0xef, 0x97, 0x57, 0xa8, 0x76, 0x0e, 0x85, + 0xb1, 0x1d, 0x79, 0xe3, 0x7a, 0xe8, 0x06, 0x3b, + 0xc4, 0x00, 0xbd, 0xaa, 0xd9, 0x17, 0x81, 0x37, + 0x12, 0x86, 0x52, 0xea, 0x04, 0xb2, 0x11, 0x0f, + 0x5a, 0x08, 0x68, 0xcb, 0x48, 0xca, 0x2f, 0xda, + 0xa3, 0x0a, 0x60, 0x57, 0xc7, 0x80, 0x36, 0x60, + 0x05, 0xce, 0xd5, 0x43, 0xc9, 0xbc, 0x6c, 0xe6, + 0x63, 0x38, 0x2e, 0x81, 0x90, 0x34, 0x11, 0x2c, + 0x84, 0x0c, 0x62, 0x68, 0xde, 0x17, 0x57, 0x43, + 0x19, 0xa5, 0x92, 0x9d, 0x91, 0x2b, 0xa2, 0x95, + 0x7c, 0x20, 0x72, 0xaa, 0x83, 0x24, 0x54, 0x94, + 0x10, 0x80, 0xd4, 0x3f, 0x58, 0xb9, 0x7b, 0x74, + 0x68, 0xd5, 0xfb, 0x3e, 0xdd, 0xb4, 0xdf, 0x65, + 0x72, 0x88, 0x45, 0x8a, 0xd0, 0x93, 0x6e, 0x99, + 0x84, 0xad, 0x39, 0x73, 0x16, 0x88, 0xdc, 0x89, + 0x33, 0x34, 0xd7, 0xd8, 0x97, 0xfb, 0x90, 0xd2, + 0xc5, 0x8e, 0x94, 0xc4, 0xf1, 0xfe, 0xbe, 0x23, + 0xf1, 0x3a, 0x10, 0x1c, 0x42, 0x6b, 0xf5, 0xee, + 0xe4, 0x78, 0x8a, 0x7e, 0x13, 0x02, 0x25, 0xcb, + 0xd1, 0x61, 0x1f, 0xab, 0x45, 0x1f, 0x90, 0x88, + 0x0f, 0x6b, 0xff, 0x61, 0xba, 0xf3, 0xac, 0x8e, + 0x13, 0xc2, 0xfb, 0xca, 0x41, 0xed, 0xfe, 0x6c, + 0xcb, 0xdf, 0x97, 0x60, 0x29, 0x8a, 0x72, 0x8d, + 0x7d, 0xad, 0x6e, 0xe9, 0x7b, 0xc4, 0x92, 0x14, + 0x5e, 0x33, 0x27, 0xe2, 0xda, 0x2f, 0x95, 0x5f, + 0x40, 0x27, 0xeb, 0xdb, 0x0d, 0x1e, 0xc5, 0xd4, + 0x43, 0x50, 0x1a, 0x62, 0x82, 0xbe, 0x24, 0x7f, + 0xb7, 0x46, 0xa8, 0x70, 0x10, 0x33, 0xb6, 0x3f, + 0xbf, 0xa8, 0xa8, 0x85, 0xab, 0x1d, 0xb4, 0x3f, + 0x84, 0x06, 0x91, 0xd6, 0x18, 0x3d, 0xeb, 0x8b, + 0x3f, 0x9b, 0x37, 0x9e, 0x2e, 0xd2, 0xec, 0xe5, + 0x2d, 0xf0, 0x3f, 0x45, 0xd5, 0x9d, 0xb9, 0x28, + 0x89, 0xe4, 0x0c, 0xa9, 0x38, 0xca, 0x22, 0x56, + 0x53, 0xdf, 0x49, 0xba, 0x5d, 0x99, 0xd6, 0x4b, + 0x1d, 0x0d, 0x6d, 0xee, 0x7c, 0xf2, 0x6f, 0x50, + 0x04, 0xf1, 0xf8, 0x49, 0xd1, 0x2f, 0x50, 0x3e, + 0xf1, 0x08, 0x49, 0x17, 0x08, 0xd2, 0xac, 0x5d, + 0x58, 0xe7, 0x27, 0xe6, 0x59, 0x02, 0x9f, 0x1c, + 0x40, 0xff, 0x6c, 0x67, 0xae, 0x49, 0x1a, 0x2a, + 0xab, 0xd9, 0x63, 0x25, 0x2d, 0x9b, 0xd8, 0x1a, + 0x41, 0xa6, 0xea, 0x72, 0xfd, 0x56, 0xa1, 0x57, + 0x59, 0xdd, 0xf5, 0xa3, 0xb2, 0x2f, 0x64, 0xb1, + 0xc5, 0xfe, 0x8d, 0x9b, 0x93, 0xd1, 0x51, 0x77, + 0x13, 0x50, 0x74, 0x30, 0x28, 0xe4, 0x7a, 0x06, + 0x69, 0xd4, 0xa8, 0x0a, 0xae, 0x02, 0x4a, 0x61, + 0x24, 0xc2, 0xcd, 0xc8, 0xd3, 0x12, 0x2e, 0xac, + 0x9a, 0x0c, 0x24, 0x06, 0xb8, 0x1e, 0x3d, 0x29, +}; + +/* + * IV method encblkno8, blkno 1. + */ +static const uint8_t aes_cbc_192_encblkno8_vec1_ctxt[SECSIZE] = { + 0x1e, 0x3b, 0x66, 0x76, 0xd9, 0x9e, 0xf7, 0x82, + 0x17, 0x76, 0x69, 0x4d, 0x64, 0x63, 0xf1, 0x01, + 0x81, 0x8a, 0xa4, 0x97, 0x05, 0x42, 0xdb, 0x8c, + 0x27, 0xc8, 0xfd, 0x08, 0x21, 0x17, 0x87, 0xa9, + 0x0c, 0x86, 0x2d, 0xda, 0x17, 0xd5, 0x5d, 0x67, + 0x12, 0x93, 0x8d, 0x34, 0x5a, 0xfc, 0x2a, 0x49, + 0x1a, 0x1a, 0x77, 0x20, 0xfb, 0x1d, 0x5d, 0xd8, + 0x99, 0xb0, 0x8f, 0x1c, 0x13, 0x4d, 0x28, 0x6d, + 0x2d, 0x79, 0xa9, 0x8e, 0x04, 0x0c, 0x5a, 0xd5, + 0x52, 0x09, 0x15, 0x4a, 0xfb, 0x7a, 0xf8, 0xdc, + 0x3b, 0x77, 0xaf, 0xe0, 0x80, 0x6b, 0xac, 0x5f, + 0xc0, 0x0f, 0x0f, 0x29, 0xf5, 0xcc, 0xbc, 0x85, + 0x77, 0xe7, 0x9f, 0x59, 0x23, 0x83, 0x67, 0x74, + 0x3b, 0x1c, 0x0f, 0x75, 0xd8, 0x58, 0xa2, 0xce, + 0x8c, 0x3a, 0x80, 0xd7, 0xff, 0xa1, 0x83, 0xa3, + 0xe0, 0xad, 0x18, 0x7a, 0xc5, 0x28, 0x28, 0x71, + 0x46, 0xb5, 0x13, 0x76, 0x4d, 0x67, 0x37, 0x38, + 0x3f, 0x9e, 0xa6, 0x8b, 0xc2, 0xaf, 0x83, 0x7d, + 0x8b, 0x82, 0xd0, 0xe2, 0xec, 0x13, 0xce, 0x2b, + 0x1e, 0x13, 0xe7, 0xb6, 0xfa, 0x9e, 0xa2, 0x32, + 0xb7, 0xdc, 0xe5, 0xb5, 0x35, 0xa3, 0xb4, 0x84, + 0x57, 0x05, 0x2d, 0x3e, 0xb0, 0x0a, 0x52, 0x61, + 0x00, 0xe4, 0x84, 0xab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7, + 0x3f, 0xe9, 0xee, 0x70, 0x6f, 0xd2, 0x80, 0x41, + 0x4d, 0xa0, 0xbc, 0x00, 0xaf, 0x30, 0xe4, 0x34, + 0x61, 0xda, 0xb4, 0xff, 0x2a, 0x85, 0x8b, 0x1a, + 0xbf, 0xb5, 0xe4, 0x7f, 0x27, 0xee, 0xf3, 0x25, + 0xe6, 0x52, 0x2a, 0x83, 0xbe, 0xe4, 0x64, 0xc3, + 0x67, 0x0c, 0x9e, 0x0f, 0xba, 0xb4, 0x67, 0xd1, + 0x1b, 0x4a, 0xb0, 0xb2, 0xb4, 0xf2, 0x8a, 0x1b, + 0x21, 0x34, 0x3c, 0x97, 0x5a, 0xdb, 0x92, 0x8b, + 0x2d, 0xe9, 0x94, 0x4e, 0x11, 0xfb, 0xd4, 0x2e, + 0xc2, 0xed, 0xf9, 0x75, 0xfd, 0x1a, 0xef, 0x3b, + 0x98, 0x5d, 0xa9, 0x75, 0xd5, 0x14, 0x0a, 0xe3, + 0xda, 0x07, 0xa6, 0x20, 0x7b, 0x49, 0x47, 0x87, + 0xff, 0xf0, 0xe8, 0x7e, 0xcf, 0xc4, 0x2c, 0x02, + 0xdd, 0x53, 0xe9, 0x79, 0xc7, 0x6d, 0x16, 0x9f, + 0x2b, 0xd7, 0x1a, 0x36, 0x25, 0x5c, 0xba, 0x5c, + 0xdb, 0x44, 0x88, 0x99, 0x32, 0x2e, 0xb6, 0x3f, + 0xb4, 0xdd, 0x15, 0xeb, 0xec, 0x2a, 0x9e, 0xc5, + 0x37, 0x30, 0x2a, 0xd5, 0xc4, 0x2a, 0x9b, 0x40, + 0x97, 0x83, 0x94, 0xe7, 0x79, 0x79, 0x63, 0x4b, +}; + +/* + * IV method encblkno8, blkno 2. + */ +static const uint8_t aes_cbc_192_encblkno8_vec2_ctxt[SECSIZE] = { + 0x34, 0x07, 0x20, 0x14, 0x64, 0x0b, 0xa2, 0x2c, + 0xed, 0xba, 0x46, 0x24, 0xa0, 0xe6, 0x99, 0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x45, + 0x28, 0x4f, 0xfc, 0x3f, 0xf1, 0x80, 0xc3, 0xf3, + 0xce, 0x5e, 0xfc, 0x56, 0xd9, 0x45, 0xdd, 0x81, + 0xe3, 0x48, 0x22, 0xc9, 0xb8, 0x13, 0xc1, 0x48, + 0x6c, 0x95, 0x97, 0xc0, 0x91, 0x37, 0xf5, 0x8a, + 0x11, 0x3b, 0xab, 0xce, 0x7a, 0xb0, 0xb4, 0x4c, + 0xba, 0xc0, 0x91, 0x7f, 0x3c, 0x27, 0xe9, 0xc0, + 0x58, 0x92, 0x70, 0x67, 0xf4, 0x80, 0x40, 0x92, + 0x51, 0x80, 0x8e, 0x9d, 0x2d, 0x87, 0x89, 0x8e, + 0xe7, 0xd1, 0xb5, 0xc5, 0x4f, 0xd0, 0x86, 0x31, + 0x7f, 0x90, 0x77, 0x05, 0x35, 0xfe, 0xa7, 0xcb, + 0x9d, 0x94, 0xf3, 0xf8, 0xbb, 0x4f, 0xe1, 0xb3, + 0x48, 0x57, 0xbf, 0xd1, 0x77, 0xe8, 0x72, 0x31, + 0x4d, 0x2f, 0xe8, 0xa0, 0xf4, 0x7c, 0x25, 0x9c, + 0xcd, 0xa5, 0x7e, 0xd3, 0x30, 0xda, 0x46, 0xf5, + 0x48, 0x9e, 0x39, 0x34, 0x94, 0xd6, 0x24, 0x10, + 0xfc, 0x74, 0x2b, 0x6d, 0xcc, 0x00, 0x76, 0x3e, + 0x3b, 0x85, 0xfa, 0xef, 0x87, 0x70, 0x53, 0x4e, +}; + +/* + * IV method encblkno8, blkno 3. + */ +static const uint8_t aes_cbc_192_encblkno8_vec3_ctxt[SECSIZE] = { + 0xfe, 0xad, 0xf3, 0x4a, 0x9d, 0x64, 0x4e, 0x5d, + 0xaf, 0xa8, 0x44, 0x7e, 0xc9, 0x75, 0xe8, 0xd0, + 0x87, 0x73, 0x66, 0x4c, 0x77, 0x00, 0xfb, 0x7b, + 0x04, 0xe7, 0xd8, 0x82, 0x75, 0xe3, 0xa5, 0xbc, + 0xf3, 0x80, 0xae, 0x7c, 0xc9, 0x75, 0x9a, 0xc1, + 0x73, 0x49, 0x69, 0xf6, 0xa0, 0x49, 0x6e, 0x77, + 0x5f, 0x9b, 0x95, 0x9b, 0x9f, 0x41, 0x54, 0x57, + 0x0e, 0x3c, 0xe5, 0x2c, 0xbb, 0xbf, 0xd5, 0x76, + 0xf6, 0xb6, 0x05, 0xaa, 0x20, 0x5b, 0xdb, 0xcb, + 0x81, 0xad, 0x0c, 0x8a, 0x68, 0x94, 0x7d, 0x88, + 0xdc, 0x15, 0x6c, 0x89, 0x97, 0x53, 0x30, 0x96, + 0x4a, 0x54, 0xf9, 0x88, 0x00, 0xf7, 0x3b, 0x99, + 0xfc, 0x82, 0xe3, 0x48, 0xd2, 0x16, 0x2b, 0xba, + 0xd4, 0xba, 0x24, 0xd0, 0xd1, 0xb0, 0x8e, 0xcd, + 0x77, 0xdc, 0x01, 0xdf, 0xb2, 0x20, 0xc5, 0xa7, + 0x48, 0x2a, 0xcf, 0x56, 0xc8, 0x63, 0x6e, 0xc9, + 0xa8, 0xa4, 0xc2, 0x9c, 0x66, 0x25, 0x50, 0x77, + 0x08, 0x51, 0x92, 0xce, 0x3c, 0xaf, 0xff, 0xee, + 0x3e, 0x6d, 0x61, 0x37, 0xcd, 0x85, 0x67, 0x9c, + 0xe0, 0x7e, 0xa6, 0x17, 0x7b, 0x5f, 0x6a, 0xe2, + 0x4e, 0x76, 0xca, 0x95, 0x88, 0xdf, 0xad, 0x78, + 0x91, 0xfa, 0x9e, 0x71, 0x3e, 0xfd, 0x10, 0x78, + 0x32, 0x2b, 0x75, 0xbc, 0x3a, 0x06, 0x55, 0x8b, + 0x9b, 0xfb, 0x9c, 0x4b, 0xa1, 0x7d, 0x35, 0x3d, + 0x63, 0x80, 0x30, 0x61, 0xe0, 0x2d, 0x8a, 0x28, + 0xb4, 0x2d, 0x48, 0x9d, 0x27, 0x1a, 0x28, 0x86, + 0xfc, 0xfa, 0x93, 0xcf,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+ 0x8f, 0xac, 0xc2, 0xee, 0x09, 0xcb, 0xed, 0x04, + 0x7b, 0x37, 0xa1, 0x1d, 0x9c, 0x90, 0x19, 0xb1, + 0xdd, 0xc3, 0x22, 0xc8, 0x70, 0x07, 0x26, 0xce, + 0x4a, 0xc4, 0xde, 0xee, 0x87, 0xf3, 0x62, 0x69, + 0xed, 0xb2, 0x2d, 0x10, 0xc4, 0xfa, 0x86, 0x2e, + 0xd1, 0xb8, 0x58, 0xa3, 0xa4, 0x0b, 0x30, 0x87, + 0x23, 0x62, 0xed, 0xf3, 0x7b, 0x80, 0x7e, 0x4f, + 0xc2, 0xb3, 0xe8, 0xba, 0x25, 0x3e, 0xd3, 0x12, + 0x7e, 0x27, 0xd5, 0x72, 0x3b, 0x02, 0xf4, 0xfd, + 0x2f, 0x8b, 0xc2, 0x5f, 0x44, 0x40, 0x31, 0x88, + 0x73, 0x81, 0xa3, 0xcc, 0xc4, 0x78, 0x2b, 0xfc, + 0x41, 0x2e, 0xb2, 0xd0, 0xb4, 0x00, 0x29, 0xc1, + 0x46, 0xdf, 0xc1, 0xbd, 0x15, 0x59, 0xa3, 0x6a, + 0xc8, 0x2f, 0x29, 0x28, 0x12, 0x9b, 0x1e, 0xea, + 0x4e, 0xa9, 0x80, 0xa1, 0xb8, 0x89, 0x21, 0x3b, +}; + +const struct testvec aes_cbc_192_8_vectors[] = { + { + .blkno = 0, + .ptxt = aes_cbc_ptxt, + .ctxt = aes_cbc_192_encblkno8_vec0_ctxt, + }, + { + .blkno = 1, + .ptxt = aes_cbc_ptxt, + .ctxt = aes_cbc_192_encblkno8_vec1_ctxt, + }, + { + .blkno = 2, + .ptxt = aes_cbc_ptxt, + .ctxt = aes_cbc_192_encblkno8_vec2_ctxt, + }, + { + .blkno = 3, + .ptxt = aes_cbc_ptxt, + .ctxt = aes_cbc_192_encblkno8_vec3_ctxt, + }, +}; + +/* + * IV method encblkno1, blkno 0. + */ +static const uint8_t aes_cbc_256_encblkno1_vec0_ctxt[SECSIZE] = { + 0x1a, 0xa4, 0xe3, 0x09, 0x23, 0x2e, 0x91, 0x1b, + 0xa8, 0x3e, 0xda, 0x92, 0xb3, 0x22, 0xd2, 0xe8, + 0x8b, 0xed, 0x6c, 0xa7, 0x78, 0xe6, 0x32, 0x25, + 0xc4, 0x88, 0xd5, 0xb7, 0x6e, 0xef, 0xbf, 0x37, + 0x00, 0xd9, 0xb2, 0x55, 0x10, 0x4f, 0x7d, 0x84, + 0x3a, 0xae, 0xd2, 0xc6, 0x48, 0xdd, 0x3c, 0xd5, + 0x9b, 0xa7, 0xf8, 0xc2, 0xda, 0x6d, 0x14, 0xa2, + 0xdc, 0x54, 0x12, 0x8f, 0x1c, 0x22, 0x98, 0x6a, + 0xc0, 0x5f, 0x47, 0xa7, 0x78, 0xec, 0x79, 0x5d, + 0x04, 0xed, 0x5e, 0x20, 0x33, 0x53, 0x66, 0x40, + 0x83, 0x94, 0x5b, 0x34, 0x05, 0x25, 0x2e, 0x17, + 0xba, 0x23, 0x60, 0xb1, 0xd0, 0x27, 0xf0, 0x24, + 0xd2, 0x0b, 0xd3, 0xea, 0xa7, 0x13, 0x1e, 0xf9, + 0x56, 0xe1, 0xd4, 0xa2, 0x89, 0x5a, 0xaa, 0x42, + 0xa9, 0xd7, 0x85, 0x64, 0x9e, 0x44, 0x71, 0xa2, + 0xf9, 0xc3, 0xf4, 0x81, 0xbd, 0xa0, 0x40, 0xed, + 0x33, 0xeb, 0x09, 0x0f, 0x7f, 0x78, 0xe4, 0xd5, + 0x7b, 0x61, 0x42, 0xee, 0x65, 0x25, 0xcc, 0xba, + 0xc6, 0x99, 0x29, 0x25, 0x71, 0x9a, 0xf0, 0x0e, + 0x98, 0x3f, 0x12, 0xf2, 0xf9, 0x4d, 0x00, 0x3c, + 0xbe, 0x9f, 0x2b, 0x83, 0x1e, 0x5b, 0xab, 0x80, + 0x4c, 0x81, 0x82, 0x29, 0xbb, 0xeb, 0xc0, 0x89, + 0x07, 0x43, 0xdd, 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 0x86, + 0x72, 0x4b, 0xf9, 0x3d, 0x87, 0x68, 0xec, 0x74, + 0x67, 0xee, 0xbd, 0xb8, 0xc6, 0x12, 0x91, 0x0f, + 0xf6, 0xd9, 0x4f, 0x34, 0x96, 0xa9, 0xe7, 0x52, + 0x7b, 0xe0, 0x08, 0x57, 0x0a, 0x8b, 0x09, 0xcb, + 0xd3, 0x3e, 0x4e, 0x64, 0xca, 0x38, 0x50, 0x07, + 0x0e, 0x7b, 0x95, 0x69, 0x1b, 0x82, 0xba, 0x50, + 0x93, 0x4f, 0x9a, 0x8e, 0x11, 0x9b, 0x64, 0xf5, + 0x6a, 0xd4, 0x81, 0xf0, 0x1f, 0xb8, 0x85, 0x90, + 0x9c, 0x79, 0xde, 0xcb, 0x50, 0xba, 0xa9, 0x56, + 0x66, 0xd1, 0x1e, 0x78, 0xa8, 0x6a, 0xd5, 0xa5, + 0x83, 0x73, 0xe2, 0x88, 0xf2, 0x04, 0x33, 0x61, + 0xdf, 0x89, 0xd5, 0x3d, 0x03, 0x4e, 0x94, 0xb0, + 0x0f, 0x8d, 0x4d, 0xb4, 0x09, 0xb2, 0xf1, 0xb0, + 0xe7, 0xfe, 0xb0, 0x18, 0xe2, 0xfc, 0x92, 0xeb, + 0x2d, 0x7d, 0x56, 0x29, 0xbd, 0x34, 0x20, 0x7c, + 0xb6, 0xe7, 0x7b, 0xd7, 0x95, 0xa5, 0x0d, 0x10, + 0xbc, 0x7d, 0x9d, 0xd9, 0xbe, 0xc7, 0x23, 0x44, + 0x37, 0xb3, 0x98, 0x36, 0x33, 0x1a, 0x11, 0xfe, + 0x41, 0xea, 0x59, 0x48, 0x75, 0x34, 0xf6, 0xc4, +}; + +/* + * IV method encblkno1, blkno 1. + */ +static const uint8_t aes_cbc_256_encblkno1_vec1_ctxt[SECSIZE] = { + 0x58, 0xfc, 0x1e, 0x48, 0x66, 0x7d, 0x91, 0xc7, + 0x56, 0xa3, 0x41, 0x89, 0xe8, 0x1e, 0x02, 0x77, + 0x93, 0x38, 0x12, 0x99, 0x06, 0x0d, 0xf3, 0x6d, + 0x2a, 0x5d, 0x3d, 0x7b, 0x4e, 0x05, 0x4f, 0x8f, + 0xe3, 0x86, 0x76, 0xfe, 0x11, 0x9d, 0xde, 0xd4, + 0x83, 0xd9, 0x47, 0x8d, 0x51, 0xdf, 0x4a, 0x24, + 0x2d, 0x11, 0xf0, 0xbd, 0xde, 0x17, 0x7e, 0x52, + 0x20, 0xc7, 0x17, 0x88, 0x2e, 0xa4, 0xd5, 0xa0, + 0x1e, 0xbc, 0x61, 0x15, 0x1e, 0x52, 0xa1, 0x8b, + 0xe9, 0xe4, 0x1f, 0x81, 0x49, 0x64, 0x17, 0xd4, + 0xef, 0xb6, 0x40, 0x05, 0x2f, 0x36, 0xf7, 0x39, + 0x03, 0x05, 0x80, 0xff, 0xf2, 0x1a, 0x15, 0xf1, + 0xfc, 0xaf, 0x71, 0x51, 0x73, 0xc5, 0x9e, 0x2f, + 0xd1, 0x7a, 0x2d, 0xd7, 0xed, 0x90, 0x11, 0xd2, + 0x80, 0x49, 0x46, 0x9f, 0x13, 0xa7, 0x32, 0x33, + 0x24, 0x39, 0x59, 0xf1, 0xed, 0x64, 0x75, 0x61, + 0xc3, 0x14, 0x68, 0x48, 0xf7, 0xc7, 0xbd, 0xe0, + 0x21, 0x59, 0x91, 0x07, 0x70, 0x83, 0x8f, 0xfc, + 0x59, 0x72, 0xca, 0xdd, 0x60, 0xa0, 0xbb, 0xb1, + 0x2f, 0xb8, 0x98, 0x8d, 0xf2, 0x4d, 0x3a, 0x19, + 0xbc, 0x6b, 0x37, 0xad, 0xd2, 0xb5, 0x7d, 0x1c, + 0x4a, 0x7b, 0x58, 0x76, 0x2e, 0xf5, 0x6b, 0xaf, + 0x4c, 0x92, 0x00, 0x8a, 0xb4, 0xa3, 0x86, 0x66, + 0x07, 0xc7, 0xfc, 0x57, 0x3c, 0x73, 0xf4, 0x8b, + 0xef, 0xb6, 0xae, 0x01, 0xfb, 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7d, 0x91, 0xed, 0x2b, 0x99, 0x74, 0x1c, 0x16, + 0x45, 0x55, 0x21, 0xbc, 0x7c, 0x52, 0x87, 0x0f, + 0xb9, 0xbf, 0x71, 0x7c, 0x3a, 0x81, 0x72, 0x97, + 0xf8, 0x86, 0x61, 0x20, 0x17, 0xd8, 0xc8, 0xe0, + 0xfc, 0x42, 0x0f, 0x5b, 0xd6, 0x7e, 0x99, 0x81, + 0x5c, 0x2e, 0x2e, 0x3e, 0xe8, 0xce, 0x12, 0xcf, + 0x2c, 0xe6, 0x7a, 0x00, 0x5d, 0x36, 0x00, 0x92, + 0x60, 0xc5, 0xc0, 0xfd, 0xe0, 0xa3, 0xb9, 0x3e, + 0x92, 0xf8, 0x8f, 0xe2, 0x0f, 0xe5, 0xb4, 0x6a, + 0xd6, 0x5b, 0xa4, 0x5d, 0xf9, 0xef, 0x7e, 0xae, + 0xdd, 0xd0, 0x5d, 0x40, 0xfe, 0xa7, 0xed, 0xda, + 0xa9, 0x48, 0x1d, 0x6f, 0xc2, 0xd3, 0x35, 0x65, + 0xd8, 0x67, 0xc2, 0x9d, 0xed, 0xf7, 0x9f, 0x7b, + 0x7c, 0xd4, 0x03, 0xe0, 0xa6, 0xf9, 0x3c, 0xd0, + 0x21, 0x98, 0x60, 0xa6, 0x59, 0x86, 0xbd, 0x40, + 0x17, 0x47, 0x82, 0xb9, 0xe1, 0x11, 0x8d, 0x4b, + 0xcd, 0x1f, 0x54, 0x96, 0x17, 0x42, 0x22, 0x44, +}; + +/* + * IV method encblkno1, blkno 2. + */ +static const uint8_t aes_cbc_256_encblkno1_vec2_ctxt[SECSIZE] = { + 0x1d, 0x65, 0xb2, 0x4e, 0xfa, 0x3f, 0xdb, 0xab, + 0x34, 0x9d, 0x37, 0x03, 0x17, 0x44, 0xed, 0x5b, + 0xf7, 0x1b, 0x6b, 0xc0, 0x5c, 0xfe, 0x5b, 0xcd, + 0xf0, 0xaf, 0x26, 0x82, 0x97, 0x12, 0xb8, 0x4f, + 0x76, 0x3d, 0x07, 0xd8, 0x29, 0x56, 0x3c, 0xbd, + 0x0e, 0xac, 0xd1, 0x8f, 0x53, 0x1a, 0x8f, 0xcd, + 0x04, 0x5b, 0x49, 0xe0, 0xf0, 0xea, 0xc9, 0x8a, + 0x08, 0x3d, 0x1f, 0x2d, 0x8c, 0xec, 0xb8, 0xea, + 0xe9, 0x24, 0xd1, 0x93, 0xd7, 0x9a, 0x0f, 0xd7, + 0x0f, 0x6b, 0xa0, 0x08, 0x58, 0x81, 0x68, 0x2f, + 0xde, 0x36, 0xb5, 0x87, 0xd9, 0xcd, 0x82, 0x13, + 0x36, 0x16, 0x6a, 0x9a, 0x02, 0xca, 0xda, 0x6f, + 0x51, 0x87, 0x75, 0x47, 0x89, 0xa4, 0x10, 0x60, + 0xfb, 0x1a, 0x74, 0x55, 0x6d, 0x18, 0x8d, 0x42, + 0x74, 0x2d, 0x12, 0x56, 0xc0, 0xcd, 0xa2, 0x57, + 0x53, 0x31, 0x8c, 0x7a, 0x8b, 0xa8, 0x6d, 0x89, + 0x81, 0xaf, 0x9c, 0xd9, 0x56, 0xe6, 0xdc, 0xe7, + 0x84, 0x0f, 0x81, 0x56, 0x1a, 0xc8, 0x5d, 0xa3, + 0xe0, 0x93, 0xea, 0x62, 0x7d, 0xa4, 0x5a, 0x58, + 0x8f, 0x05, 0x85, 0x34, 0x0c, 0x74, 0x8e, 0xe7, + 0xb4, 0x47, 0x93, 0x61, 0xbf, 0x61, 0x0a, 0xa2, + 0x37, 0xcd, 0x82, 0x9d, 0x55, 0x9e, 0x32, 0x9e, + 0x30, 0xce, 0x61, 0x89, 0xed, 0x25, 0x9e, 0x7c, + 0x2a, 0xcd, 0x39, 0x45, 0x56, 0xbb, 0x1a, 0xe8, + 0xb0, 0x75, 0x8f, 0xa1, 0x59, 0x09, 0xf8, 0x7a, + 0xbd, 0x4f, 0x69, 0x8b, 0xe2, 0xf3, 0xbe, 0x9b, + 0xea, 0x5f, 0x2c, 0x1e, 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, + 0xe5, 0xc8, 0x6a, 0x99, 0x46, 0x9d, 0x00, 0x77, + 0x3b, 0x60, 0x75, 0x04, 0x06, 0x4a, 0x5a, 0x64, + 0x6f, 0x2f, 0x58, 0x77, 0x27, 0x9a, 0xc5, 0x90, + 0x37, 0xa7, 0xf3, 0x89, 0x72, 0x47, 0x4e, 0x08, + 0xa5, 0x79, 0x11, 0x2f, 0x22, 0x5a, 0xbb, 0xcf, + 0x76, 0xb9, 0x28, 0xc8, 0xc4, 0x5a, 0xe5, 0x90, + 0xf7, 0x02, 0xe4, 0xf9, 0x0c, 0x4c, 0x9a, 0xb1, + 0xa7, 0x99, 0x34, 0xd4, 0x77, 0x66, 0xff, 0x3c, + 0x50, 0x9a, 0xff, 0x13, 0x49, 0xd6, 0x5a, 0xf6, + 0x17, 0x6f, 0xca, 0x1a, 0xef, 0x0a, 0x2d, 0xf1, + 0xdf, 0xd0, 0xa5, 0x6f, 0xa6, 0x22, 0x3c, 0x1f, + 0xcf, 0xe7, 0xec, 0x23, 0x39, 0x6e, 0xc0, 0x37, + 0x31, 0x84, 0xff, 0xe2, 0x5a, 0xd6, 0x88, 0x74, + 0x15, 0x15, 0x46, 0x21, 0x00, 0xe4, 0x13, 0x9a, + 0xfa, 0xb2, 0x49, 0x7e, 0x79, 0xfb, 0x8a, 0x2a, +}; + +/* + * IV method encblkno1, blkno 3. + */ +static const uint8_t aes_cbc_256_encblkno1_vec3_ctxt[SECSIZE] = { + 0xc1, 0x4a, 0x3c, 0x90, 0xba, 0xd4, 0x9c, 0xe7, + 0xf2, 0x5b, 0x3a, 0xc4, 0xce, 0x4a, 0x26, 0x4a, + 0x9c, 0x3f, 0xe5, 0x7a, 0x15, 0xbb, 0xbd, 0x3e, + 0xc6, 0x49, 0x47, 0x04, 0x4e, 0x8b, 0x73, 0xa6, + 0x02, 0x3a, 0xc1, 0xa3, 0xfa, 0x1a, 0xd0, 0x03, + 0xf7, 0x26, 0x9f, 0xad, 0x06, 0x8f, 0x86, 0xdc, + 0xb8, 0x73, 0x87, 0xa2, 0x82, 0xc6, 0x80, 0xe1, + 0xac, 0x3d, 0x16, 0x4c, 0xc3, 0x7c, 0x86, 0x01, + 0xa5, 0x7a, 0x1c, 0x4b, 0x56, 0x68, 0xf6, 0x06, + 0x99, 0x32, 0x42, 0x40, 0xf1, 0xb7, 0x44, 0x4b, + 0xd1, 0xdb, 0xad, 0x4e, 0xa6, 0xc2, 0x5f, 0xee, + 0x21, 0x1d, 0x58, 0xc6, 0xd5, 0x02, 0xef, 0xb2, + 0x38, 0xef, 0x29, 0x25, 0xfd, 0x28, 0x8a, 0x5b, + 0x8b, 0x36, 0x1a, 0xd6, 0x68, 0xf8, 0x77, 0xed, + 0xba, 0xb3, 0xa5, 0x6f, 0x76, 0x5e, 0xb5, 0xd4, + 0xc3, 0xb8, 0xf9, 0x67, 0x7a, 0x18, 0x43, 0xb6, + 0x65, 0x07, 0x48, 0x1d, 0x56, 0x20, 0x11, 0xe1, + 0x62, 0x6b, 0x70, 0xc9, 0x18, 0xa9, 0xa7, 0x36, + 0xbf, 0x31, 0x74, 0xe3, 0x33, 0x02, 0x96, 0x7a, + 0xf5, 0xd9, 0x8d, 0x05, 0x2b, 0xfd, 0x85, 0x4f, + 0x03, 0x0f, 0xe1, 0xfb, 0x1a, 0x57, 0xaf, 0xdc, + 0xff, 0xff, 0x5a, 0x96, 0x27, 0xca, 0xf3, 0x0c, + 0xd8, 0x39, 0x3e, 0xbe, 0x41, 0x5a, 0x21, 0x95, + 0x66, 0xe0, 0x69, 0x14, 0x2b, 0x18, 0xf2, 0x9b, + 0xf4, 0x22, 0xdf, 0xa9, 0xe4, 0x7d, 0x32, 0x5d, + 0x98, 0xa0, 0xe0, 0xe1, 0xe1, 0xbe, 0xae, 0x58, + 0x63, 0xbe, 0x4b, 0x97, 0x83, 0xaa, 0x67, 0xd3, + 0x1a, 0x70, 0xca, 0x82, 0x98, 0x77, 0x74, 0x1a, + 0xf2, 0x3d, 0x6a, 0x7b, 0x8e, 0xc8, 0xca, 0x34, + 0x44, 0xb8, 0xc0, 0xd0, 0x77, 0x8c, 0x4a, 0x5c, + 0xae, 0xd3, 0x17, 0x7c, 0x12, 0x47, 0x3e, 0xe2, + 0x2e, 0x51, 0xe0, 0x52, 0x88, 0x8e, 0xe9, 0x68, + 0xb6, 0x13, 0xf8, 0x69, 0xc9, 0x4b, 0xdd, 0x91, + 0x27, 0xb0, 0x22, 0x0c, 0x7d, 0xad, 0xb0, 0x75, + 0xe8, 0x76, 0x34, 0xc2, 0xd9, 0xf3, 0x20, 0xf7, + 0x1d, 0x0f, 0x07, 0x61, 0xc2, 0xb8, 0x7d, 0x00, + 0xa6, 0x68, 0xad, 0xd4, 0x0b, 0xa4, 0xa0, 0x32, + 0x6d, 0xa5, 0xc0, 0x07, 0x65, 0xae, 0xda, 0x2e, + 0xd6, 0xb7, 0xd3, 0x99, 0x8b, 0x37, 0x08, 0x13, + 0x6a, 0x94, 0xe9, 0xe4, 0xea, 0x34, 0xee, 0x07, + 0xee, 0x77, 0xb1, 0x3f, 0x54, 0x05, 0xbe, 0x66, + 0x7f, 0xf2, 0x70, 0x34, 0x45, 0xa7, 0x4b, 0x27, + 0xef, 0xe6, 0x39, 0x2e, 0x13, 0x41, 0xdb, 0x2d, + 0x1f, 0x76, 0x11, 0x76, 0x33, 0xf3, 0x92, 0x33, + 0x69, 0x16, 0x34, 0x86, 0x23, 0xc5, 0xfa, 0xaf, + 0xff, 0xbf, 0xee, 0x84, 0x56, 0xf6, 0x1e, 0x54, + 0x37, 0x32, 0x79, 0x83, 0x45, 0x04, 0x6f, 0x0e, + 0x75, 0x75, 0xd9, 0xd6, 0x4a, 0x87, 0xfb, 0x3c, + 0xb1, 0xcf, 0x66, 0xab, 0xa4, 0xaa, 0xf6, 0x96, + 0xb0, 0xcd, 0xaf, 0xac, 0x2c, 0x6d, 0x72, 0xca, + 0x43, 0xef, 0xb7, 0xa0, 0x4c, 0x62, 0xba, 0x7e, + 0x59, 0x0b, 0xff, 0x90, 0x49, 0x63, 0xf6, 0x31, + 0x8b, 0x50, 0x20, 0x82, 0x7d, 0xf0, 0x2d, 0xe4, + 0x5b, 0xda, 0xdf, 0xb0, 0xfb, 0x07, 0x7b, 0xe3, + 0x5f, 0xac, 0xd8, 0xe5, 0xa0, 0x3e, 0xc5, 0x60, + 0x94, 0xbc, 0xf7, 0x7e, 0xdc, 0x18, 0x27, 0x20, + 0xb1, 0xdd, 0x51, 0x4a, 0xb2, 0xe0, 0xc0, 0xe7, + 0x5d, 0x0f, 0x88, 0xb2, 0xa0, 0x42, 0x73, 0xfb, + 0xc4, 0x24, 0xa7, 0x17, 0x8a, 0xc9, 0x6d, 0x34, + 0xe8, 0x7b, 0x51, 0x37, 0x32, 0x3f, 0xf8, 0x7e, + 0x92, 0xe4, 0x87, 0xd2, 0x89, 0x66, 0xb0, 0xf6, + 0xc2, 0xba, 0x2f, 0x42, 0x8f, 0x1d, 0x5d, 0x81, + 0xad, 0xfd, 0x00, 0xbc, 0xa9, 0x11, 0x96, 0xae, + 0x80, 0xf1, 0x27, 0xe0, 0xeb, 0x5b, 0x60, 0x39, +}; + +const struct testvec aes_cbc_256_1_vectors[] = { + { + .blkno = 0, + .ptxt = aes_cbc_ptxt, + .ctxt = aes_cbc_256_encblkno1_vec0_ctxt, + }, + { + .blkno = 1, + .ptxt = aes_cbc_ptxt, + .ctxt = aes_cbc_256_encblkno1_vec1_ctxt, + }, + { + .blkno = 2, + .ptxt = aes_cbc_ptxt, + .ctxt = aes_cbc_256_encblkno1_vec2_ctxt, + }, + { + .blkno = 3, + .ptxt = aes_cbc_ptxt, + .ctxt = aes_cbc_256_encblkno1_vec3_ctxt, + }, +}; + +/* + * IV method encblkno8, blkno 0. + */ +static const uint8_t aes_cbc_256_encblkno8_vec0_ctxt[SECSIZE] = { + 0xe5, 0x55, 0xd9, 0xae, 0xc0, 0x66, 0x2d, 0x2f, + 0x11, 0xb1, 0x27, 0xd2, 0xb2, 0x73, 0xe4, 0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0x92, 0x6b, 0x45, 0xec, 0x20, + 0xd2, 0x2b, 0x98, 0x3f, 0x4f, 0x97, 0xf2, 0xed, + 0xf7, 0x9b, 0x89, 0x4e, 0xd6, 0x59, 0xbb, 0x24, + 0x22, 0x44, 0x9f, 0x03, 0xb5, 0x42, 0xc8, 0x97, + 0xc7, 0xdb, 0x21, 0xfc, 0xcf, 0x33, 0xa1, 0xf1, + 0xc0, 0x1f, 0x28, 0x77, 0xee, 0xa5, 0x6a, 0x12, + 0xef, 0x8b, 0x48, 0xd1, 0xb3, 0xac, 0x65, 0x69, + 0x46, 0x04, 0x39, 0xb1, 0x9e, 0xfa, 0xab, 0x21, + 0x51, 0xa4, 0x33, 0xe9, 0x58, 0x5d, 0xf1, 0xc6, + 0x69, 0x44, 0x8c, 0x17, 0xf9, 0xaa, 0x96, 0xcb, + 0x40, 0xb4, 0x5c, 0x83, 0x76, 0x1e, 0x8a, 0x2b, + 0x5f, 0x6b, 0xc1, 0x73, 0xd4, 0x5f, 0x48, 0xa3, + 0x0e, 0x07, 0x69, 0x12, 0xc1, 0xbd, 0x13, 0xad, + 0xe2, 0xcf, 0x3d, 0x96, 0xd8, 0xaf, 0xed, 0xdc, + 0x4c, 0x72, 0xf6, 0xce, 0x15, 0x86, 0x88, 0x8c, + 0xbb, 0x60, 0xb3, 0xb9, 0xde, 0x42, 0x58, 0x6e, + 0xc4, 0x58, 0xac, 0x77, 0x8d, 0x35, 0x23, 0x5f, + 0xc3, 0xf9, 0x33, 0x46, 0x17, 0x80, 0x31, 0xfd, + 0xcd, 0x0a, 0x1e, 0x9b, 0xac, 0x42, 0xda, 0x70, + 0x54, 0x9a, 0xeb, 0x22, 0x27, 0x09, 0x0c, 0x6c, + 0x18, 0x1d, 0x1a, 0x5b, 0x86, 0x4d, 0x80, 0xca, + 0x4d, 0xda, 0x0e, 0x9a, 0x8e, 0x61, 0x04, 0x68, + 0x29, 0x08, 0x3b, 0xae, 0x14, 0x7d, 0x8e, 0x43, + 0x7a, 0xa7, 0x83, 0xcf, 0xb3, 0x95, 0xd3, 0x42, + 0x2d, 0x6b, 0xd8, 0x5c, 0x43, 0x31, 0x5b, 0x9c, + 0x18, 0x30, 0x0d, 0x61, 0x9c, 0xab, 0x29, 0x55, + 0xdd, 0x84, 0x24, 0x21, 0xec, 0x44, 0xad, 0xf3, + 0xb3, 0x70, 0x77, 0x2b, 0xfc, 0x3f, 0x99, 0xb8, + 0x50, 0x26, 0x8d, 0x96, 0xa2, 0x22, 0x99, 0x33, + 0x53, 0xa8, 0x5d, 0x84, 0x9b, 0x76, 0x26, 0x6e, + 0x75, 0x14, 0x7e, 0x63, 0xc6, 0x7a, 0x4f, 0x5c, + 0xfe, 0x4b, 0x80, 0xee, 0xb3, 0x32, 0x8d, 0x25, + 0x1c, 0x80, 0x7b, 0x3d, 0xd3, 0x84, 0x01, 0x1e, + 0x16, 0xa4, 0xca, 0x0d, 0x38, 0x40, 0x03, 0x6f, + 0x81, 0x8b, 0x5c, 0xad, 0x22, 0xfa, 0x6f, 0xeb, + 0x60, 0xa1, 0xcb, 0x2d, 0x97, 0xf8, 0xa6, 0x5e, + 0xbe, 0x93, 0xb7, 0xe6, 0x66, 0xbf, 0x9b, 0xd2, + 0x5c, 0x31, 0xcc, 0x70, 0x0c, 0xf1, 0xfb, 0x9f, + 0x09, 0x1b, 0xc2, 0x85, 0x2f, 0x22, 0x7c, 0x95, + 0x58, 0x09, 0xce, 0x9c, 0x7c, 0x50, 0xca, 0x89, +}; + +/* + * IV method encblkno8, blkno 1. + */ +static const uint8_t aes_cbc_256_encblkno8_vec1_ctxt[SECSIZE] = { + 0x37, 0x4d, 0x25, 0xdb, 0x35, 0xe0, 0x8b, 0x82, + 0x5f, 0x77, 0xd2, 0x53, 0xd1, 0x1f, 0xf0, 0x91, + 0x5b, 0xd8, 0x93, 0x2f, 0xb2, 0x81, 0xbd, 0x75, + 0xf0, 0xd8, 0xff, 0x46, 0x8c, 0x9d, 0xf6, 0xe2, + 0x99, 0x1e, 0x76, 0x9d, 0x00, 0x3a, 0xe3, 0xcf, + 0x6d, 0x24, 0xa8, 0xe8, 0xb4, 0xa7, 0xa0, 0x87, + 0xa8, 0x43, 0x01, 0x21, 0x29, 0x70, 0x39, 0x2d, + 0x0b, 0x2a, 0xe9, 0x11, 0x57, 0x86, 0x13, 0xd4, + 0x1c, 0x1b, 0x59, 0x19, 0xc4, 0x7d, 0x2c, 0x94, + 0xc7, 0x01, 0xb8, 0x96, 0x01, 0xd2, 0x01, 0x17, + 0x97, 0x41, 0x68, 0xab, 0xba, 0x9c, 0xc8, 0xad, + 0x4e, 0xd7, 0xa8, 0x4c, 0x96, 0x3f, 0xf9, 0xfc, + 0x7e, 0xd7, 0x59, 0xe8, 0x25, 0x51, 0x4d, 0x1d, + 0x99, 0xfd, 0x0b, 0xe9, 0x88, 0x23, 0xd1, 0x4b, + 0x30, 0x6e, 0x18, 0x7c, 0xe3, 0x7a, 0x54, 0x2a, + 0x4f, 0x2a, 0x99, 0x8f, 0xaf, 0xd7, 0x5e, 0x25, + 0xfe, 0x9c, 0x47, 0x09, 0x63, 0x38, 0x0d, 0x5f, + 0xb3, 0x43, 0xa6, 0x66, 0x9b, 0xc5, 0x3d, 0x88, + 0x5e, 0xc7, 0x60, 0x99, 0x8e, 0xcb, 0x6a, 0x65, + 0x60, 0x92, 0x88, 0xe1, 0x2b, 0xfe, 0x83, 0x34, + 0x92, 0xa6, 0x6c, 0x22, 0x56, 0x5b, 0x75, 0x8a, + 0x93, 0xc3, 0x72, 0xca, 0xff, 0x59, 0x3b, 0xd8, + 0xa0, 0x80, 0x56, 0x98, 0x62, 0x8a, 0x70, 0xf2, + 0x5d, 0xd9, 0x40, 0x6b, 0xbf, 0x9f, 0x71, 0x8d, + 0x2e, 0x38, 0xe8, 0x06, 0x42, 0xa9, 0x95, 0x70, + 0x31, 0xd1, 0xe9, 0x6c, 0xab, 0xbb, 0xed, 0x25, + 0xe8, 0xca, 0xe8, 0xa4, 0x98, 0x82, 0xf5, 0xe3, + 0x11, 0x3c, 0xc4, 0xea, 0xea, 0x88, 0x56, 0x91, + 0xd6, 0x5d, 0xaa, 0xf7, 0xe9, 0x49, 0x2f, 0x42, + 0x5b, 0x76, 0xef, 0xed, 0x03, 0x9e, 0x5f, 0x4d, + 0x65, 0x25, 0xa5, 0xe8, 0x26, 0xba, 0x03, 0x4f, + 0x0e, 0x39, 0xd2, 0x53, 0x62, 0x98, 0x81, 0x9d, + 0x8e, 0xad, 0x50, 0x17, 0x9f, 0xcc, 0x34, 0x45, + 0x19, 0x5c, 0x1c, 0xd1, 0xbc, 0x71, 0x89, 0xaa, + 0x9a, 0x65, 0x55, 0x6f, 0x78, 0xd4, 0xd3, 0x5b, + 0x27, 0x8d, 0x94, 0x46, 0xd9, 0x95, 0xb3, 0x5f, + 0xc4, 0x35, 0x8d, 0xba, 0x1c, 0x40, 0x52, 0xd1, + 0x99, 0x27, 0x5d, 0x42, 0x28, 0xef, 0xcb, 0x9b, + 0x10, 0x7a, 0x19, 0xbf, 0x72, 0xa3, 0x4a, 0xb9, + 0x56, 0x83, 0x39, 0xa6, 0xb2, 0xcd, 0x48, 0x85, + 0xf9, 0xcc, 0x72, 0x88, 0xb3, 0x5a, 0x9b, 0x45, + 0xb2, 0xd3, 0x66, 0x2d, 0x24, 0x51, 0x68, 0x91, + 0x9d, 0x47, 0x6a, 0xb3, 0x9a, 0x60, 0xb3, 0xcd, + 0x6b, 0x43, 0x96, 0x21, 0xa0, 0x65, 0x43, 0xde, + 0x4f, 0x6e, 0xb5, 0x81, 0x50, 0x7e, 0xca, 0x4b, + 0xdb, 0x30, 0xf2, 0xcb, 0x28, 0x3b, 0x19, 0x6a, + 0x0a, 0xfa, 0x05, 0x5e, 0x61, 0xde, 0x76, 0x7e, + 0xdf, 0xd9, 0xa9, 0x1b, 0xd0, 0x8a, 0xb5, 0x04, + 0x51, 0xf5, 0x66, 0xa2, 0x32, 0x21, 0xb2, 0xa9, + 0x40, 0x78, 0x60, 0x9d, 0xdc, 0x45, 0xbe, 0xb4, + 0x3a, 0xba, 0xd1, 0xec, 0x31, 0x53, 0x24, 0x22, + 0x70, 0x99, 0xda, 0xc8, 0x17, 0x04, 0x87, 0x2c, + 0x89, 0x86, 0x24, 0xec, 0x52, 0x12, 0x6a, 0x51, + 0x1e, 0x2a, 0x5e, 0x96, 0xfb, 0xac, 0x95, 0x4a, + 0x1a, 0x06, 0x8f, 0xdf, 0xa7, 0x26, 0xeb, 0x6c, + 0x79, 0x4a, 0x77, 0xea, 0xb3, 0xb1, 0x3a, 0x19, + 0xe6, 0x5e, 0xe2, 0x26, 0x1b, 0x85, 0x3c, 0x9b, + 0x1d, 0x05, 0x1d, 0xbe, 0x5c, 0x25, 0x7f, 0x45, + 0x4c, 0x09, 0x4c, 0xc1, 0x47, 0xa5, 0x44, 0xfc, + 0x04, 0x2b, 0xad, 0x53, 0xac, 0x57, 0x22, 0x54, + 0x13, 0x7c, 0xc9, 0x96, 0x44, 0xda, 0x74, 0x95, + 0x6e, 0x8c, 0xe6, 0x6a, 0x05, 0x05, 0xf3, 0x8c, + 0x81, 0xaf, 0xbc, 0xb1, 0x91, 0xe7, 0xfd, 0x81, + 0x3f, 0x47, 0xc2, 0x6f, 0x0d, 0x62, 0xf6, 0x6e, +}; + +/* + * IV method encblkno8, blkno 2. + */ +static const uint8_t aes_cbc_256_encblkno8_vec2_ctxt[SECSIZE] = { + 0x5a, 0x24, 0xfd, 0xee, 0x9a, 0x44, 0xfb, 0xac, + 0x3e, 0x46, 0x53, 0x95, 0x9e, 0xeb, 0x1f, 0xd9, + 0xfd, 0xc6, 0x4f, 0xae, 0x0b, 0xc8, 0xf2, 0xbd, + 0x77, 0x16, 0x7a, 0x2e, 0x8e, 0xec, 0x7a, 0x53, + 0xf4, 0xe0, 0x34, 0xba, 0x6e, 0xfa, 0xc4, 0x69, + 0xd7, 0x50, 0x13, 0x03, 0xfb, 0xb9, 0x66, 0x96, + 0xd4, 0x21, 0x67, 0xcc, 0x4c,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, 0x70, 0xd4, 0xd3, 0x1b, 0x25, 0xbe, 0x0d, + 0x6b, 0x0a, 0x13, 0x9f, 0x4d, 0x3d, 0x7b, 0x10, + 0x9f, 0x93, 0x43, 0x50, 0xd1, 0x17, 0x08, 0x77, + 0x23, 0x58, 0x35, 0x41, 0x23, 0xf6, 0x9c, 0x6f, + 0x2e, 0x81, 0x6e, 0x75, 0x9b, 0x9f, 0x37, 0x4f, + 0xb7, 0xa1, 0xce, 0xde, 0x0c, 0x74, 0x99, 0x31, + 0x0e, 0x27, 0x42, 0x99, 0xdd, 0x93, 0x03, 0x6b, + 0x44, 0x22, 0xd4, 0xc8, 0x67, 0xb5, 0xb2, 0x4d, + 0x11, 0x2e, 0x80, 0x09, 0xa2, 0x5b, 0xcf, 0x0c, + 0xff, 0xfa, 0x51, 0xe5, 0x9b, 0xdd, 0x11, 0xa1, + 0x17, 0x04, 0x9e, 0xc8, 0xd8, 0x1d, 0xc1, 0x5c, + 0xc3, 0xde, 0x83, 0x77, 0xa3, 0xec, 0x59, 0x7e, + 0xfb, 0xe8, 0x45, 0xff, 0xc3, 0xb3, 0xd3, 0x9e, + 0x3e, 0xc4, 0x75, 0xca, 0xc1, 0x77, 0xee, 0x1a, + 0xdc, 0x58, 0xab, 0x27, 0xc1, 0xfe, 0x21, 0x26, + 0x9a, 0xe0, 0x15, 0xab, 0x35, 0x8d, 0xbc, 0x22, + 0x37, 0xbb, 0x4e, 0xab, 0x9d, 0xa2, 0xaf, 0xf9, + 0x45, 0x17, 0xb1, 0xb8, 0xd4, 0x52, 0x1e, 0x67, + 0xeb, 0xac, 0xe0, 0x87, 0x6c, 0xe4, 0x7a, 0x03, + 0x73, 0xe4, 0x43, 0xeb, 0x3b, 0x57, 0x3f, 0x56, + 0x4b, 0x6c, 0x26, 0x81, 0x27, 0xbf, 0x7e, 0x59, + 0xcd, 0xab, 0x67, 0x8c, 0x4b, 0x6f, 0xa5, 0x47, + 0x2c, 0x45, 0x28, 0x5a, 0x3d, 0x88, 0x53, 0xf9, + 0x25, 0xdf, 0x5d, 0xba, 0xf7, 0x18, 0xa7, 0x3d, + 0x79, 0xb4, 0x43, 0x59, 0x77, 0xf9, 0xd5, 0x5d, + 0x4f, 0x31, 0x56, 0x8c, 0x21, 0xb5, 0xc0, 0xa2, + 0xca, 0x04, 0x62, 0x2c, 0xc8, 0xa8, 0x11, 0x82, + 0x1b, 0xde, 0xad, 0x20, 0x5b, 0xd2, 0x63, 0xfb, + 0x6d, 0xba, 0xd4, 0xcc, 0xb4, 0x9d, 0xe8, 0xa8, + 0xd1, 0x06, 0x81, 0xf0, 0xb9, 0xd4, 0x90, 0x30, + 0xcd, 0x0a, 0xe8, 0xd2, 0x8c, 0x7a, 0xbf, 0xf6, + 0x0d, 0xa0, 0xae, 0x1b, 0x21, 0x18, 0x93, 0x18, + 0x71, 0xe1, 0xa0, 0x63, 0x5a, 0x9d, 0x4e, 0x6a, + 0x52, 0x90, 0xaf, 0xdb, 0x26, 0x1e, 0xa9, 0xa1, + 0xc7, 0xf9, 0xf8, 0xa7, 0x3f, 0x85, 0xa1, 0xa4, +}; + +/* + * IV method encblkno8, blkno 3. + */ +static const uint8_t aes_cbc_256_encblkno8_vec3_ctxt[SECSIZE] = { + 0x83, 0x77, 0xd8, 0xa8, 0x6a, 0x36, 0x41, 0x72, + 0xb6, 0x03, 0x4e, 0x5e, 0x39, 0x36, 0xe3, 0xf5, + 0xd0, 0x1b, 0x0d, 0x97, 0x78, 0x46, 0xee, 0xfd, + 0x34, 0x34, 0x16, 0xa0, 0x44, 0xcf, 0x0b, 0xdc, + 0xfb, 0x82, 0x98, 0xa2, 0x79, 0xc2, 0xe7, 0x1c, + 0x43, 0x43, 0x4c, 0x7f, 0xe7, 0xa6, 0xe6, 0x10, + 0x9e, 0x65, 0xb2, 0x09, 0xc7, 0x5f, 0xaa, 0xb7, + 0xb8, 0xad, 0x83, 0xd5, 0x9e, 0xd1, 0xb2, 0xce, + 0x4b, 0xa4, 0x5d, 0xbc, 0xd6, 0xf6, 0x0a, 0xe7, + 0x1b, 0xe9, 0x86, 0xbc, 0x72, 0xcc, 0x6f, 0xcc, + 0xf2, 0xde, 0x08, 0x48, 0xa2, 0x20, 0x31, 0x6a, + 0xdd, 0xbe, 0xc5, 0x36, 0x55, 0xff, 0xce, 0xfa, + 0xdf, 0x60, 0x26, 0x77, 0x7f, 0xd0, 0xfa, 0xd7, + 0x76, 0x70, 0x14, 0x11, 0xbf, 0x57, 0xc2, 0xdd, + 0x5f, 0xd3, 0x50, 0x49, 0xf8, 0xd1, 0xa7, 0xe2, + 0x8b, 0x89, 0xa0, 0xbc, 0x44, 0x42, 0x45, 0x10, + 0xfe, 0x66, 0x3d, 0x56, 0x09, 0x21, 0x7c, 0x49, + 0x30, 0xde, 0xe2, 0x4b, 0x26, 0x65, 0x8a, 0xe4, + 0x79, 0x08, 0x3a, 0xca, 0x36, 0x4f, 0x97, 0x3c, + 0xe4, 0x6a, 0xc3, 0xdb, 0xce, 0xac, 0x78, 0x76, + 0x25, 0x81, 0x7a, 0x01, 0x7b, 0xd8, 0xf1, 0x00, + 0x8d, 0x2e, 0xb7, 0x98, 0x3c, 0x86, 0x20, 0xa3, + 0x4c, 0x24, 0x2a, 0x78, 0x3a, 0x8d, 0xeb, 0xcd, + 0xae, 0xe1, 0x32, 0xf8, 0x21, 0x37, 0x30, 0x27, + 0xe1, 0xf3, 0x14, 0x60, 0x96, 0x77, 0x37, 0x50, + 0xa2, 0x92, 0xae, 0xe5, 0xd8, 0xea, 0x1a, 0x7e, + 0xa3, 0xd1, 0x04, 0x17, 0x03, 0x51, 0x2f, 0x21, + 0xa7, 0x00, 0x23, 0xb3, 0x24, 0xd8, 0x7d, 0xb7, + 0x4c, 0x51, 0xb1, 0xaf, 0xb0, 0x64, 0xe4, 0x62, + 0x91, 0x4c, 0xd5, 0x4b, 0xe8, 0xfb, 0x95, 0x61, + 0xa4, 0x6f, 0xf8, 0xb8, 0xea, 0xa9, 0xb2, 0x10, + 0xd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xe3, 0x83, 0x17, 0x39, + 0x34, 0xef, 0x49, 0x35, 0x68, 0x50, 0x80, 0xf9, + 0xcd, 0x3a, 0x10, 0xf6, 0x71, 0x1a, 0x94, 0xc3, + 0xec, 0xb9, 0x36, 0x84, 0x36, 0xe7, 0x3f, 0x6f, + 0x9b, 0xa9, 0x2b, 0x5c, 0x96, 0x49, 0x26, 0xda, + 0xb3, 0x08, 0x3d, 0x5e, 0x9e, 0x59, 0xdf, 0x0f, + 0xfc, 0xbe, 0xa8, 0x0b, 0xbc, 0xaa, 0x32, 0xf0, + 0xa5, 0x21, 0x50, 0x15, 0x7e, 0x46, 0xb9, 0x76, + 0x09, 0x4e, 0x4b, 0x6f, 0x9f, 0xc7, 0x8c, 0x6d, + 0x80, 0x37, 0xf9, 0xaa, 0xd1, 0x5f, 0x12, 0xb9, + 0xb3, 0x15, 0xe4, 0x96, 0xa1, 0x01, 0xd5, 0xa0, +}; + +const struct testvec aes_cbc_256_8_vectors[] = { + { + .blkno = 0, + .ptxt = aes_cbc_ptxt, + .ctxt = aes_cbc_256_encblkno8_vec0_ctxt, + }, + { + .blkno = 1, + .ptxt = aes_cbc_ptxt, + .ctxt = aes_cbc_256_encblkno8_vec1_ctxt, + }, + { + .blkno = 2, + .ptxt = aes_cbc_ptxt, + .ctxt = aes_cbc_256_encblkno8_vec2_ctxt, + }, + { + .blkno = 3, + .ptxt = aes_cbc_ptxt, + .ctxt = aes_cbc_256_encblkno8_vec3_ctxt, + }, +}; + +/* + * 256 bits key from IEEE 1619/D16, NUL terminated. + */ +static const char aes_xts_256_key[33] = { + 0x27, 0x18, 0x28, 0x18, 0x28, 0x45, 0x90, 0x45, + 0x23, 0x53, 0x60, 0x28, 0x74, 0x71, 0x35, 0x26, + 0x31, 0x41, 0x59, 0x26, 0x53, 0x58, 0x97, 0x93, + 0x23, 0x84, 0x62, 0x64, 0x33, 0x83, 0x27, 0x95, + 0 +}; + +/* + * 512 bits key from IEEE 1619/D16, NUL terminated. + */ +static const char aes_xts_512_key[65] = { + 0x27, 0x18, 0x28, 0x18, 0x28, 0x45, 0x90, 0x45, + 0x23, 0x53, 0x60, 0x28, 0x74, 0x71, 0x35, 0x26, + 0x62, 0x49, 0x77, 0x57, 0x24, 0x70, 0x93, 0x69, + 0x99, 0x59, 0x57, 0x49, 0x66, 0x96, 0x76, 0x27, + 0x31, 0x41, 0x59, 0x26, 0x53, 0x58, 0x97, 0x93, + 0x23, 0x84, 0x62, 0x64, 0x33, 0x83, 0x27, 0x95, + 0x02, 0x88, 0x41, 0x97, 0x16, 0x93, 0x99, 0x37, + 0x51, 0x05, 0x82, 0x09, 0x74, 0x94, 0x45, 0x92, + 0 +}; + +/* + * Vector 4 from IEEE 1619/D16, blkno 0. + */ +static const uint8_t aes_xts_256_vec4_ptxt[SECSIZE] = { + 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, + 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, + 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, + 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, + 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, + 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, + 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, + 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, + 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, + 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, + 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, + 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, + 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, + 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x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0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, + 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, + 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, + 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, + 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, + 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, + 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, + 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, + 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, + 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, + 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, + 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, + 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, + 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, + 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, + 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, + 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, + 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, + 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, + 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, + 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, + 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, + 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, + 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, + 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, + 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, + 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, + 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, +}; + +static const uint8_t aes_xts_256_vec4_ctxt[SECSIZE] = { + 0x27, 0xa7, 0x47, 0x9b, 0xef, 0xa1, 0xd4, 0x76, + 0x48, 0x9f, 0x30, 0x8c, 0xd4, 0xcf, 0xa6, 0xe2, + 0xa9, 0x6e, 0x4b, 0xbe, 0x32, 0x08, 0xff, 0x25, + 0x28, 0x7d, 0xd3, 0x81, 0x96, 0x16, 0xe8, 0x9c, + 0xc7, 0x8c, 0xf7, 0xf5, 0xe5, 0x43, 0x44, 0x5f, + 0x83, 0x33, 0xd8, 0xfa, 0x7f, 0x56, 0x00, 0x00, + 0x05, 0x27, 0x9f, 0xa5, 0xd8, 0xb5, 0xe4, 0xad, + 0x40, 0xe7, 0x36, 0xdd, 0xb4, 0xd3, 0x54, 0x12, + 0x32, 0x80, 0x63, 0xfd, 0x2a, 0xab, 0x53, 0xe5, + 0xea, 0x1e, 0x0a, 0x9f, 0x33, 0x25, 0x00, 0xa5, + 0xdf, 0x94, 0x87, 0xd0, 0x7a, 0x5c, 0x92, 0xcc, + 0x51, 0x2c, 0x88, 0x66, 0xc7, 0xe8, 0x60, 0xce, + 0x93, 0xfd, 0xf1, 0x66, 0xa2, 0x49, 0x12, 0xb4, + 0x22, 0x97, 0x61, 0x46, 0xae, 0x20, 0xce, 0x84, + 0x6b, 0xb7, 0xdc, 0x9b, 0xa9, 0x4a, 0x76, 0x7a, + 0xae, 0xf2, 0x0c, 0x0d, 0x61, 0xad, 0x02, 0x65, + 0x5e, 0xa9, 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, 0x73, 0x57, 0x79, 0xa4, 0x18, 0xf2, + 0x0a, 0x28, 0x2d, 0xf9, 0x20, 0x14, 0x7b, 0xea, + 0xbe, 0x42, 0x1e, 0xe5, 0x31, 0x9d, 0x05, 0x68, +}; + +/* + * Vector 5 from IEEE 1619/D16, blkno 1. + */ +static const uint8_t aes_xts_256_vec5_ptxt[SECSIZE] = { + 0x27, 0xa7, 0x47, 0x9b, 0xef, 0xa1, 0xd4, 0x76, + 0x48, 0x9f, 0x30, 0x8c, 0xd4, 0xcf, 0xa6, 0xe2, + 0xa9, 0x6e, 0x4b, 0xbe, 0x32, 0x08, 0xff, 0x25, + 0x28, 0x7d, 0xd3, 0x81, 0x96, 0x16, 0xe8, 0x9c, + 0xc7, 0x8c, 0xf7, 0xf5, 0xe5, 0x43, 0x44, 0x5f, + 0x83, 0x33, 0xd8, 0xfa, 0x7f, 0x56, 0x00, 0x00, + 0x05, 0x27, 0x9f, 0xa5, 0xd8, 0xb5, 0xe4, 0xad, + 0x40, 0xe7, 0x36, 0xdd, 0xb4, 0xd3, 0x54, 0x12, + 0x32, 0x80, 0x63, 0xfd, 0x2a, 0xab, 0x53, 0xe5, + 0xea, 0x1e, 0x0a, 0x9f, 0x33, 0x25, 0x00, 0xa5, + 0xdf, 0x94, 0x87, 0xd0, 0x7a, 0x5c, 0x92, 0xcc, + 0x51, 0x2c, 0x88, 0x66, 0xc7, 0xe8, 0x60, 0xce, + 0x93, 0xfd, 0xf1, 0x66, 0xa2, 0x49, 0x12, 0xb4, + 0x22, 0x97, 0x61, 0x46, 0xae, 0x20, 0xce, 0x84, + 0x6b, 0xb7, 0xdc, 0x9b, 0xa9, 0x4a, 0x76, 0x7a, + 0xae, 0xf2, 0x0c, 0x0d, 0x61, 0xad, 0x02, 0x65, + 0x5e, 0xa9, 0x2d, 0xc4, 0xc4, 0xe4, 0x1a, 0x89, + 0x52, 0xc6, 0x51, 0xd3, 0x31, 0x74, 0xbe, 0x51, + 0xa1, 0x0c, 0x42, 0x11, 0x10, 0xe6, 0xd8, 0x15, + 0x88, 0xed, 0xe8, 0x21, 0x03, 0xa2, 0x52, 0xd8, + 0xa7, 0x50, 0xe8, 0x76, 0x8d, 0xef, 0xff, 0xed, + 0x91, 0x22, 0x81, 0x0a, 0xae, 0xb9, 0x9f, 0x91, + 0x72, 0xaf, 0x82, 0xb6, 0x04, 0xdc, 0x4b, 0x8e, + 0x51, 0xbc, 0xb0, 0x82, 0x35, 0xa6, 0xf4, 0x34, + 0x13, 0x32, 0xe4, 0xca, 0x60, 0x48, 0x2a, 0x4b, + 0xa1, 0xa0, 0x3b, 0x3e, 0x65, 0x00, 0x8f, 0xc5, + 0xda, 0x76, 0xb7, 0x0b, 0xf1, 0x69, 0x0d, 0xb4, + 0xea, 0xe2, 0x9c, 0x5f, 0x1b, 0xad, 0xd0, 0x3c, + 0x5c, 0xcf, 0x2a, 0x55, 0xd7, 0x05, 0xdd, 0xcd, + 0x86, 0xd4, 0x49, 0x51, 0x1c, 0xeb, 0x7e, 0xc3, + 0x0b, 0xf1, 0x2b, 0x1f, 0xa3, 0x5b, 0x91, 0x3f, + 0x9f, 0x74, 0x7a, 0x8a, 0xfd, 0x1b, 0x13, 0x0e, + 0x94, 0xbf, 0xf9, 0x4e, 0xff, 0xd0, 0x1a, 0x91, + 0x73, 0x5c, 0xa1, 0x72, 0x6a, 0xcd, 0x0b, 0x19, + 0x7c, 0x4e, 0x5b, 0x03, 0x39, 0x36, 0x97, 0xe1, + 0x26, 0x82, 0x6f, 0xb6, 0xbb, 0xde, 0x8e, 0xcc, + 0x1e, 0x08, 0x29, 0x85, 0x16, 0xe2, 0xc9, 0xed, + 0x03, 0xff, 0x3c, 0x1b, 0x78, 0x60, 0xf6, 0xde, + 0x76, 0xd4, 0xce, 0xcd, 0x94, 0xc8, 0x11, 0x98, + 0x55, 0xef, 0x52, 0x97, 0xca, 0x67, 0xe9, 0xf3, + 0xe7, 0xff, 0x72, 0xb1, 0xe9, 0x97, 0x85, 0xca,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 0xe5, 0x31, 0x9d, 0x05, 0x68, +}; + +static const uint8_t aes_xts_256_vec5_ctxt[SECSIZE] = { + 0x26, 0x4d, 0x3c, 0xa8, 0x51, 0x21, 0x94, 0xfe, + 0xc3, 0x12, 0xc8, 0xc9, 0x89, 0x1f, 0x27, 0x9f, + 0xef, 0xdd, 0x60, 0x8d, 0x0c, 0x02, 0x7b, 0x60, + 0x48, 0x3a, 0x3f, 0xa8, 0x11, 0xd6, 0x5e, 0xe5, + 0x9d, 0x52, 0xd9, 0xe4, 0x0e, 0xc5, 0x67, 0x2d, + 0x81, 0x53, 0x2b, 0x38, 0xb6, 0xb0, 0x89, 0xce, + 0x95, 0x1f, 0x0f, 0x9c, 0x35, 0x59, 0x0b, 0x8b, + 0x97, 0x8d, 0x17, 0x52, 0x13, 0xf3, 0x29, 0xbb, + 0x1c, 0x2f, 0xd3, 0x0f, 0x2f, 0x7f, 0x30, 0x49, + 0x2a, 0x61, 0xa5, 0x32, 0xa7, 0x9f, 0x51, 0xd3, + 0x6f, 0x5e, 0x31, 0xa7, 0xc9, 0xa1, 0x2c, 0x28, + 0x60, 0x82, 0xff, 0x7d, 0x23, 0x94, 0xd1, 0x8f, + 0x78, 0x3e, 0x1a, 0x8e, 0x72, 0xc7, 0x22, 0xca, + 0xaa, 0xa5, 0x2d, 0x8f, 0x06, 0x56, 0x57, 0xd2, + 0x63, 0x1f, 0xd2, 0x5b, 0xfd, 0x8e, 0x5b, 0xaa, + 0xd6, 0xe5, 0x27, 0xd7, 0x63, 0x51, 0x75, 0x01, + 0xc6, 0x8c, 0x5e, 0xdc, 0x3c, 0xdd, 0x55, 0x43, + 0x5c, 0x53, 0x2d, 0x71, 0x25, 0xc8, 0x61, 0x4d, + 0xee, 0xd9, 0xad, 0xaa, 0x3a, 0xca, 0xde, 0x58, + 0x88, 0xb8, 0x7b, 0xef, 0x64, 0x1c, 0x4c, 0x99, + 0x4c, 0x80, 0x91, 0xb5, 0xbc, 0xd3, 0x87, 0xf3, +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, 0xbb, 0x2a, 0xae, 0xed, + 0x77, 0xcb, 0x3f, 0xc6, 0xdb, 0x15, 0xdc, 0xd7, + 0xd8, 0x0d, 0x7d, 0x5b, 0xc4, 0x06, 0xc4, 0x97, + 0x0a, 0x34, 0x78, 0xad, 0xa8, 0x89, 0x9b, 0x32, + 0x91, 0x98, 0xeb, 0x61, 0xc1, 0x93, 0xfb, 0x62, + 0x75, 0xaa, 0x8c, 0xa3, 0x40, 0x34, 0x4a, 0x75, + 0xa8, 0x62, 0xae, 0xbe, 0x92, 0xee, 0xe1, 0xce, + 0x03, 0x2f, 0xd9, 0x50, 0xb4, 0x7d, 0x77, 0x04, + 0xa3, 0x87, 0x69, 0x23, 0xb4, 0xad, 0x62, 0x84, + 0x4b, 0xf4, 0xa0, 0x9c, 0x4d, 0xbe, 0x8b, 0x43, + 0x97, 0x18, 0x4b, 0x74, 0x71, 0x36, 0x0c, 0x95, + 0x64, 0x88, 0x0a, 0xed, 0xdd, 0xb9, 0xba, 0xa4, + 0xaf, 0x2e, 0x75, 0x39, 0x4b, 0x08, 0xcd, 0x32, + 0xff, 0x47, 0x9c, 0x57, 0xa0, 0x7d, 0x3e, 0xab, + 0x5d, 0x54, 0xde, 0x5f, 0x97, 0x38, 0xb8, 0xd2, + 0x7f, 0x27, 0xa9, 0xf0, 0xab, 0x11, 0x79, 0x9d, + 0x7b, 0x7f, 0xfe, 0xfb, 0x27, 0x04, 0xc9, 0x5c, + 0x6a, 0xd1, 0x2c, 0x39, 0xf1, 0xe8, 0x67, 0xa4, + 0xb7, 0xb1, 0xd7, 0x81, 0x8a, 0x4b, 0x75, 0x3d, + 0xfd, 0x2a, 0x89, 0xcc, 0xb4, 0x5e, 0x00, 0x1a, + 0x03, 0xa8, 0x67, 0xb1, 0x87, 0xf2, 0x25, 0xdd, +}; + +/* + * Vector 6 from IEEE 1619/D16, blkno 2. + */ +static const uint8_t aes_xts_256_vec6_ptxt[SECSIZE] = { + 0x26, 0x4d, 0x3c, 0xa8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, 0x5b, 0xc4, 0x06, 0xc4, 0x97, + 0x0a, 0x34, 0x78, 0xad, 0xa8, 0x89, 0x9b, 0x32, + 0x91, 0x98, 0xeb, 0x61, 0xc1, 0x93, 0xfb, 0x62, + 0x75, 0xaa, 0x8c, 0xa3, 0x40, 0x34, 0x4a, 0x75, + 0xa8, 0x62, 0xae, 0xbe, 0x92, 0xee, 0xe1, 0xce, + 0x03, 0x2f, 0xd9, 0x50, 0xb4, 0x7d, 0x77, 0x04, + 0xa3, 0x87, 0x69, 0x23, 0xb4, 0xad, 0x62, 0x84, + 0x4b, 0xf4, 0xa0, 0x9c, 0x4d, 0xbe, 0x8b, 0x43, + 0x97, 0x18, 0x4b, 0x74, 0x71, 0x36, 0x0c, 0x95, + 0x64, 0x88, 0x0a, 0xed, 0xdd, 0xb9, 0xba, 0xa4, + 0xaf, 0x2e, 0x75, 0x39, 0x4b, 0x08, 0xcd, 0x32, + 0xff, 0x47, 0x9c, 0x57, 0xa0, 0x7d, 0x3e, 0xab, + 0x5d, 0x54, 0xde, 0x5f, 0x97, 0x38, 0xb8, 0xd2, + 0x7f, 0x27, 0xa9, 0xf0, 0xab, 0x11, 0x79, 0x9d, + 0x7b, 0x7f, 0xfe, 0xfb, 0x27, 0x04, 0xc9, 0x5c, + 0x6a, 0xd1, 0x2c, 0x39, 0xf1, 0xe8, 0x67, 0xa4, + 0xb7, 0xb1, 0xd7, 0x81, 0x8a, 0x4b, 0x75, 0x3d, + 0xfd, 0x2a, 0x89, 0xcc, 0xb4, 0x5e, 0x00, 0x1a, + 0x03, 0xa8, 0x67, 0xb1, 0x87, 0xf2, 0x25, 0xdd, +}; + +static const uint8_t aes_xts_256_vec6_ctxt[SECSIZE] = { + 0xfa, 0x76, 0x2a, 0x36, 0x80, 0xb7, 0x60, 0x07, + 0x92, 0x8e, 0xd4, 0xa4, 0xf4, 0x9a, 0x94, 0x56, + 0x03, 0x1b, 0x70, 0x47, 0x82, 0xe6, 0x5e, 0x16, + 0xce, 0xcb, 0x54, 0xed, 0x7d, 0x01, 0x7b, 0x5e, + 0x18, 0xab, 0xd6, 0x7b, 0x33, 0x8e, 0x81, 0x07, + 0x8f, 0x21, 0xed, 0xb7, 0x86, 0x8d, 0x90, 0x1e, + 0xbe, 0x9c, 0x73, 0x1a, 0x7c, 0x18, 0xb5, 0xe6, + 0xde, 0xc1, 0xd6, 0xa7, 0x2e, 0x07, 0x8a, 0xc9, + 0xa4, 0x26, 0x2f, 0x86, 0x0b, 0xee, 0xfa, 0x14, + 0xf4, 0xe8, 0x21, 0x01, 0x82, 0x72, 0xe4, 0x11, + 0xa9, 0x51, 0x50, 0x2b, 0x6e, 0x79, 0x06, 0x6e, + 0x84, 0x25, 0x2c, 0x33, 0x46, 0xf3, 0xaa, 0x62, + 0x34, 0x43, 0x51, 0xa2, 0x91, 0xd4, 0xbe, 0xdc, + 0x7a, 0x07, 0x61, 0x8b, 0xde, 0xa2, 0xaf, 0x63, + 0x14, 0x5c, 0xc7, 0xa4, 0xb8, 0xd4, 0x07, 0x06, + 0x91, 0xae, 0x89, 0x0c, 0xd6, 0x57, 0x33, 0xe7, + 0x94, 0x6e, 0x90, 0x21, 0xa1, 0xdf, 0xfc, 0x4c, + 0x59, 0xf1, 0x59, 0x42, 0x5e, 0xe6, 0xd5, 0x0c, + 0xa9, 0xb1, 0x35, 0xfa, 0x61, 0x62, 0xce, 0xa1, + 0x8a, 0x93, 0x98, 0x38, 0xdc, 0x00, 0x0f, 0xb3, + 0x86, 0xfa, 0xd0, 0x86, 0xac, 0xce, 0x5a, 0xc0, + 0x7c, 0xb2, 0xec, 0xe7, 0xfd, 0x58, 0x0b, 0x00, + 0xcf, 0xa5, 0xe9, 0x85, 0x89, 0x63, 0x1d, 0xc2, + 0x5e, 0x8e, 0x2a, 0x3d, 0xaf, 0x2f, 0xfd, 0xec, + 0x26, 0x53, 0x16, 0x59, 0x91, 0x2c, 0x9d, 0x8f, + 0x7a, 0x15, 0xe5, 0x86, 0x5e, 0xa8, 0xfb, 0x58, + 0x16, 0xd6, 0x20, 0x70, 0x52, 0xbd, 0x71, 0x28, + 0xcd, 0x74, 0x3c, 0x12, 0xc8, 0x11, 0x87, 0x91, + 0xa4, 0x73, 0x68, 0x11, 0x93, 0x5e, 0xb9, 0x82, + 0xa5, 0x32, 0x34, 0x9e, 0x31, 0xdd, 0x40, 0x1e, + 0x0b, 0x66, 0x0a, 0x56, 0x8c, 0xb1, 0xa4, 0x71, + 0x1f, 0x55, 0x2f, 0x55, 0xde, 0xd5, 0x9f, 0x1f, + 0x15, 0xbf, 0x71, 0x96, 0xb3, 0xca, 0x12, 0xa9, + 0x1e, 0x48, 0x8e, 0xf5, 0x9d, 0x64, 0xf3, 0xa0, + 0x2b, 0xf4, 0x52, 0x39, 0x49, 0x9a, 0xc6, 0x17, + 0x6a, 0xe3, 0x21, 0xc4, 0xa2, 0x11, 0xec, 0x54, + 0x53, 0x65, 0x97, 0x1c, 0x5d, 0x3f, 0x4f, 0x09, + 0xd4, 0xeb, 0x13, 0x9b, 0xfd, 0xf2, 0x07, 0x3d, + 0x33, 0x18, 0x0b, 0x21, 0x00, 0x2b, 0x65, 0xcc, + 0x98, 0x65, 0xe7, 0x6c, 0xb2, 0x4c, 0xd9, 0x2c, + 0x87, 0x4c, 0x24, 0xc1, 0x83, 0x50, 0x39, 0x9a, + 0x93, 0x6a, 0xb3, 0x63, 0x70, 0x79, 0x29, 0x5d, + 0x76, 0xc4, 0x17, 0x77, 0x6b, 0x94, 0xef, 0xce, + 0x3a, 0x0e, 0xf7, 0x20, 0x6b, 0x15, 0x11, 0x05, + 0x19, 0x65, 0x5c, 0x95, 0x6c, 0xbd, 0x8b, 0x24, + 0x89, 0x40, 0x5e, 0xe2, 0xb0, 0x9a, 0x6b, 0x6e, + 0xeb, 0xe0, 0xc5, 0x37, 0x90, 0xa1, 0x2a, 0x89, + 0x98, 0x37, 0x8b, 0x33, 0xa5, 0xb7, 0x11, 0x59, + 0x62, 0x5f, 0x4b, 0xa4, 0x9d, 0x2a, 0x2f, 0xdb, + 0xa5, 0x9f, 0xbf, 0x08, 0x97, 0xbc, 0x7a, 0xab, + 0xd8, 0xd7, 0x07, 0xdc, 0x14, 0x0a, 0x80, 0xf0, + 0xf3, 0x09, 0xf8, 0x35, 0xd3, 0xda, 0x54, 0xab, + 0x58, 0x4e, 0x50, 0x1d, 0xfa, 0x0e, 0xe9, 0x77, + 0xfe, 0xc5, 0x43, 0xf7, 0x41, 0x86, 0xa8, 0x02, + 0xb9, 0xa3, 0x7a, 0xdb, 0x3e, 0x82, 0x91, 0xec, + 0xa0, 0x4d, 0x66, 0x52, 0x0d, 0x22, 0x9e, 0x60, + 0x40, 0x1e, 0x72, 0x82, 0xbe, 0xf4, 0x86, 0xae, + 0x05, 0x9a, 0xa7, 0x06, 0x96, 0xe0, 0xe3, 0x05, + 0xd7, 0x77, 0x14, 0x0a, 0x7a, 0x88, 0x3e, 0xcd, + 0xcb, 0x69, 0xb9, 0xff, 0x93, 0x8e, 0x8a, 0x42, + 0x31, 0x86, 0x4c, 0x69, 0xca, 0x2c, 0x20, 0x43, + 0xbe, 0xd0, 0x07, 0xff, 0x3e, 0x60, 0x5e, 0x01, + 0x4b, 0xcf, 0x51, 0x81, 0x38, 0xdc, 0x3a, 0x25, + 0xc5, 0xe2, 0x36, 0x17, 0x1a, 0x2d, 0x01, 0xd6, +}; + +/* + * Vector 7 from IEEE 1619/D16, blkno 0xfd. + */ +static const uint8_t aes_xts_256_vec7_ptxt[SECSIZE] = { + 0x8e, 0x41, 0xb7, 0x8c, 0x39, 0x0b, 0x5a, 0xf9, + 0xd7, 0x58, 0xbb, 0x21, 0x4a, 0x67, 0xe9, 0xf6, + 0xbf, 0x77, 0x27, 0xb0, 0x9a, 0xc6, 0x12, 0x40, + 0x84, 0xc3, 0x76, 0x11, 0x39, 0x8f, 0xa4, 0x5d, + 0xaa, 0xd9, 0x48, 0x68, 0x60, 0x0e, 0xd3, 0x91, + 0xfb, 0x1a, 0xcd, 0x48, 0x57, 0xa9, 0x5b, 0x46, + 0x6e, 0x62, 0xef, 0x9f, 0x4b, 0x37, 0x72, 0x44, + 0xd1, 0xc1, 0x52, 0xe7, 0xb3, 0x0d, 0x73, 0x1a, + 0xad, 0x30, 0xc7, 0x16, 0xd2, 0x14, 0xb7, 0x07, + 0xae, 0xd9, 0x9e, 0xb5, 0xb5, 0xe5, 0x80, 0xb3, + 0xe8, 0x87, 0xcf, 0x74, 0x97, 0x46, 0x56, 0x51, + 0xd4, 0xb6, 0x0e, 0x60, 0x42, 0x05, 0x1d, 0xa3, + 0x69, 0x3c, 0x3b, 0x78, 0xc1, 0x44, 0x89, 0x54, + 0x3b, 0xe8, 0xb6, 0xad, 0x0b, 0xa6, 0x29, 0x56, + 0x5b, 0xba, 0x20, 0x23, 0x13, 0xba, 0x7b, 0x0d, + 0x0c, 0x94, 0xa3, 0x25, 0x2b, 0x67, 0x6f, 0x46, + 0xcc, 0x02, 0xce, 0x0f, 0x8a, 0x7d, 0x34, 0xc0, + 0xed, 0x22, 0x91, 0x29, 0x67, 0x3c, 0x1f, 0x61, + 0xae, 0xd5, 0x79, 0xd0, 0x8a, 0x92, 0x03, 0xa2, + 0x5a, 0xac, 0x3a, 0x77, 0xe9, 0xdb, 0x60, 0x26, + 0x79, 0x96, 0xdb, 0x38, 0xdf, 0x63, 0x73, 0x56, + 0xd9, 0xdc, 0xd1, 0x63, 0x2e, 0x36, 0x99, 0x39, + 0xf2, 0xa2, 0x9d, 0x89, 0x34, 0x5c, 0x66, 0xe0, + 0x50, 0x66, 0xf1, 0xa3, 0x67, 0x7a, 0xef, 0x18, + 0xde, 0xa4, 0x11, 0x3f, 0xae, 0xb6, 0x29, 0xe4, + 0x67, 0x21, 0xa6, 0x6d, 0x0a, 0x7e, 0x78, 0x5d, + 0x3e, 0x29, 0xaf, 0x25, 0x94, 0xeb, 0x67, 0xdf, + 0xa9, 0x82, 0xaf, 0xfe, 0x0a, 0xac, 0x05, 0x8f, + 0x6e, 0x15, 0x86, 0x42, 0x69, 0xb1, 0x35, 0x41, + 0x82, 0x61, 0xfc, 0x3a, 0xfb, 0x08, 0x94, 0x72, + 0xcf, 0x68, 0xc4, 0x5d, 0xd7, 0xf2, 0x31, 0xc6, + 0x24, 0x9b, 0xa0, 0x25, 0x5e, 0x1e, 0x03, 0x38, + 0x33, 0xfc, 0x4d, 0x00, 0xa3, 0xfe, 0x02, 0x13, + 0x2d, 0x7b, 0xc3, 0x87, 0x36, 0x14, 0xb8, 0xae, + 0xe3, 0x42, 0x73, 0x58, 0x1e, 0xa0, 0x32, 0x5c, + 0x81, 0xf0, 0x27, 0x0a, 0xff, 0xa1, 0x36, 0x41, + 0xd0, 0x52, 0xd3, 0x6f, 0x07, 0x57, 0xd4, 0x84, + 0x01, 0x43, 0x54, 0xd0, 0x2d, 0x68, 0x83, 0xca, + 0x15, 0xc2, 0x4d, 0x8c, 0x39, 0x56, 0xb1, 0xbd, + 0x02, 0x7b, 0xcf, 0x41, 0xf1, 0x51, 0xfd, 0x80, + 0x23, 0xc5, 0x34, 0x0e, 0x56, 0x06, 0xf3, 0x7e, + 0x90, 0xfd, 0xb8, 0x7c, 0x86, 0xfb, 0x4f, 0xa6, + 0x34, 0xb3, 0x71, 0x8a, 0x30, 0xba, 0xce, 0x06, + 0xa6, 0x6e, 0xaf, 0x8f, 0x63, 0xc4, 0xaa, 0x3b, + 0x63, 0x78, 0x26, 0xa8, 0x7f, 0xe8, 0xcf, 0xa4, + 0x42, 0x82, 0xe9, 0x2c, 0xb1, 0x61, 0x5a, 0xf3, + 0xa2, 0x8e, 0x53, 0xbc, 0x74, 0xc7, 0xcb, 0xa1, + 0xa0, 0x97, 0x7b, 0xe9, 0x06, 0x5d, 0x0c, 0x1a, + 0x5d, 0xec, 0x6c, 0x54, 0xae, 0x38, 0xd3, 0x7f, + 0x37, 0xaa, 0x35, 0x28, 0x3e, 0x04, 0x8e, 0x55, + 0x30, 0xa8, 0x5c, 0x4e, 0x7a, 0x29, 0xd7, 0xb9, + 0x2e, 0xc0, 0xc3, 0x16, 0x9c, 0xdf, 0x2a, 0x80, + 0x5c, 0x76, 0x04, 0xbc, 0xe6, 0x00, 0x49, 0xb9, + 0xfb, 0x7b, 0x8e, 0xaa, 0xc1, 0x0f, 0x51, 0xae, + 0x23, 0x79, 0x4c, 0xeb, 0xa6, 0x8b, 0xb5, 0x81, + 0x12, 0xe2, 0x93, 0xb9, 0xb6, 0x92, 0xca, 0x72, + 0x1b, 0x37, 0xc6, 0x62, 0xf8, 0x57, 0x4e, 0xd4, + 0xdb, 0xa6, 0xf8, 0x8e, 0x17, 0x08, 0x81, 0xc8, + 0x2c, 0xdd, 0xc1, 0x03, 0x4a, 0x0c, 0xa7, 0xe2, + 0x84, 0xbf, 0x09, 0x62, 0xb6, 0xb2, 0x62, 0x92, + 0xd8, 0x36, 0xfa, 0x9f, 0x73, 0xc1, 0xac, 0x77, + 0x0e, 0xef, 0x0f, 0x2d, 0x3a, 0x1e, 0xaf, 0x61, + 0xd3, 0xe0, 0x35, 0x55, 0xfd, 0x42, 0x4e, 0xed, + 0xd6, 0x7e, 0x18, 0xa1, 0x80, 0x94, 0xf8, 0x88, +}; + +static const uint8_t aes_xts_256_vec7_ctxt[SECSIZE] = { + 0xd5, 0x5f, 0x68, 0x4f, 0x81, 0xf4, 0x42, 0x6e, + 0x9f, 0xde, 0x92, 0xa5, 0xff, 0x02, 0xdf, 0x2a, + 0xc8, 0x96, 0xaf, 0x63, 0x96, 0x28, 0x88, 0xa9, + 0x79, 0x10, 0xc1, 0x37, 0x9e, 0x20, 0xb0, 0xa3, + 0xb1, 0xdb, 0x61, 0x3f, 0xb7, 0xfe, 0x2e, 0x07, + 0x00, 0x43, 0x29, 0xea, 0x5c, 0x22, 0xbf, 0xd3, + 0x3e, 0x3d, 0xbe, 0x4c, 0xf5, 0x8c, 0xc6, 0x08, + 0xc2, 0xc2, 0x6c, 0x19, 0xa2, 0xe2, 0xfe, 0x22, + 0xf9, 0x87, 0x32, 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0x99, 0xc9, 0xd6, + 0x2c, 0x51, 0x98, 0x80, 0xae, 0xe7, 0xe9, 0x69, + 0x76, 0x17, 0xc1, 0x49, 0x7d, 0x47, 0xbf, 0x3e, + 0x57, 0x19, 0x50, 0x31, 0x14, 0x21, 0xb6, 0xb7, + 0x34, 0xd3, 0x8b, 0x0d, 0xb9, 0x1e, 0xb8, 0x53, + 0x31, 0xb9, 0x1e, 0xa9, 0xf6, 0x15, 0x30, 0xf5, + 0x45, 0x12, 0xa5, 0xa5, 0x2a, 0x4b, 0xad, 0x58, + 0x9e, 0xb6, 0x97, 0x81, 0xd5, 0x37, 0xf2, 0x32, + 0x97, 0xbb, 0x45, 0x9b, 0xda, 0xd2, 0x94, 0x8a, + 0x29, 0xe1, 0x55, 0x0b, 0xf4, 0x78, 0x7e, 0x0b, + 0xe9, 0x5b, 0xb1, 0x73, 0xcf, 0x5f, 0xab, 0x17, + 0xda, 0xb7, 0xa1, 0x3a, 0x05, 0x2a, 0x63, 0x45, + 0x3d, 0x97, 0xcc, 0xec, 0x1a, 0x32, 0x19, 0x54, + 0x88, 0x6b, 0x7a, 0x12, 0x99, 0xfa, 0xae, 0xec, + 0xae, 0x35, 0xc6, 0xea, 0xac, 0xa7, 0x53, 0xb0, + 0x41, 0xb5, 0xe5, 0xf0, 0x93, 0xbf, 0x83, 0x39, + 0x7f, 0xd2, 0x1d, 0xd6, 0xb3, 0x01, 0x20, 0x66, + 0xfc, 0xc0, 0x58, 0xcc, 0x32, 0xc3, 0xb0, 0x9d, + 0x75, 0x62, 0xde, 0xe2, 0x95, 0x09, 0xb5, 0x83, + 0x93, 0x92, 0xc9, 0xff, 0x05, 0xf5, 0x1f, 0x31, + 0x66, 0xaa, 0xac, 0x4a, 0xc5, 0xf2, 0x38, 0x03, + 0x8a, 0x30, 0x45, 0xe6, 0xf7, 0x2e, 0x48, 0xef, + 0x0f, 0xe8, 0xbc, 0x67, 0x5e, 0x82, 0xc3, 0x18, + 0xa2, 0x68, 0xe4, 0x39, 0x70, 0x27, 0x1b, 0xf1, + 0x19, 0xb8, 0x1b, 0xf6, 0xa9, 0x82, 0x74, 0x65, + 0x54, 0xf8, 0x4e, 0x72, 0xb9, 0xf0, 0x02, 0x80, + 0xa3, 0x20, 0xa0, 0x81, 0x42, 0x92, 0x3c, 0x23, + 0xc8, 0x83, 0x42, 0x3f, 0xf9, 0x49, 0x82, 0x7f, + 0x29, 0xbb, 0xac, 0xdc, 0x1c, 0xcd, 0xb0, 0x49, + 0x38, 0xce, 0x60, 0x98, 0xc9, 0x5b, 0xa6, 0xb3, + 0x25, 0x28, 0xf4, 0xef, 0x78, 0xee, 0xd7, 0x78, + 0xb2, 0xe1, 0x22, 0xdd, 0xfd, 0x1c, 0xbd, 0xd1, + 0x1d, 0x1c, 0x0a, 0x67, 0x83, 0xe0, 0x11, 0xfc, + 0x53, 0x6d, 0x63, 0xd0, 0x53, 0x26, 0x06, 0x37, +}; + +/* + * Vector 8 from IEEE 1619/D16, blkno 0xfe. + */ +static const uint8_t aes_xts_256_vec8_ptxt[SECSIZE] = { + 0xd5, 0x5f, 0x68, 0x4f, 0x81, 0xf4, 0x42, 0x6e, + 0x9f, 0xde, 0x92, 0xa5, 0xff, 0x02, 0xdf, 0x2a, + 0xc8, 0x96, 0xaf, 0x63, 0x96, 0x28, 0x88, 0xa9, + 0x79, 0x10, 0xc1, 0x37, 0x9e, 0x20, 0xb0, 0xa3, + 0xb1, 0xdb, 0x61, 0x3f, 0xb7, 0xfe, 0x2e, 0x07, + 0x00, 0x43, 0x29, 0xea, 0x5c, 0x22, 0xbf, 0xd3, + 0x3e, 0x3d, 0xbe, 0x4c, 0xf5, 0x8c, 0xc6, 0x08, + 0xc2, 0xc2, 0x6c, 0x19, 0xa2, 0xe2, 0xfe, 0x22, + 0xf9, 0x87, 0x32, 0xc2, 0xb5, 0xcb, 0x84, 0x4c, + 0xc6, 0xc0, 0x70, 0x2d, 0x91, 0xe1, 0xd5, 0x0f, + 0xc4, 0x38, 0x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x47, 0xbf, 0x3e, + 0x57, 0x19, 0x50, 0x31, 0x14, 0x21, 0xb6, 0xb7, + 0x34, 0xd3, 0x8b, 0x0d, 0xb9, 0x1e, 0xb8, 0x53, + 0x31, 0xb9, 0x1e, 0xa9, 0xf6, 0x15, 0x30, 0xf5, + 0x45, 0x12, 0xa5, 0xa5, 0x2a, 0x4b, 0xad, 0x58, + 0x9e, 0xb6, 0x97, 0x81, 0xd5, 0x37, 0xf2, 0x32, + 0x97, 0xbb, 0x45, 0x9b, 0xda, 0xd2, 0x94, 0x8a, + 0x29, 0xe1, 0x55, 0x0b, 0xf4, 0x78, 0x7e, 0x0b, + 0xe9, 0x5b, 0xb1, 0x73, 0xcf, 0x5f, 0xab, 0x17, + 0xda, 0xb7, 0xa1, 0x3a, 0x05, 0x2a, 0x63, 0x45, + 0x3d, 0x97, 0xcc, 0xec, 0x1a, 0x32, 0x19, 0x54, + 0x88, 0x6b, 0x7a, 0x12, 0x99, 0xfa, 0xae, 0xec, + 0xae, 0x35, 0xc6, 0xea, 0xac, 0xa7, 0x53, 0xb0, + 0x41, 0xb5, 0xe5, 0xf0, 0x93, 0xbf, 0x83, 0x39, + 0x7f, 0xd2, 0x1d, 0xd6, 0xb3, 0x01, 0x20, 0x66, + 0xfc, 0xc0, 0x58, 0xcc, 0x32, 0xc3, 0xb0, 0x9d, + 0x75, 0x62, 0xde, 0xe2, 0x95, 0x09, 0xb5, 0x83, + 0x93, 0x92, 0xc9, 0xff, 0x05, 0xf5, 0x1f, 0x31, + 0x66, 0xaa, 0xac, 0x4a, 0xc5, 0xf2, 0x38, 0x03, + 0x8a, 0x30, 0x45, 0xe6, 0xf7, 0x2e, 0x48, 0xef, + 0x0f, 0xe8, 0xbc, 0x67, 0x5e, 0x82, 0xc3, 0x18, + 0xa2, 0x68, 0xe4, 0x39, 0x70, 0x27, 0x1b, 0xf1, + 0x19, 0xb8, 0x1b, 0xf6, 0xa9, 0x82, 0x74, 0x65, + 0x54, 0xf8, 0x4e, 0x72, 0xb9, 0xf0, 0x02, 0x80, + 0xa3, 0x20, 0xa0, 0x81, 0x42, 0x92, 0x3c, 0x23, + 0xc8, 0x83, 0x42, 0x3f, 0xf9, 0x49, 0x82, 0x7f, + 0x29, 0xbb, 0xac, 0xdc, 0x1c, 0xcd, 0xb0, 0x49, + 0x38, 0xce, 0x60, 0x98, 0xc9, 0x5b, 0xa6, 0xb3, + 0x25, 0x28, 0xf4, 0xef, 0x78, 0xee, 0xd7, 0x78, + 0xb2, 0xe1, 0x22, 0xdd, 0xfd, 0x1c, 0xbd, 0xd1, + 0x1d, 0x1c, 0x0a, 0x67, 0x83, 0xe0, 0x11, 0xfc, + 0x53, 0x6d, 0x63, 0xd0, 0x53, 0x26, 0x06, 0x37, +}; + +static const uint8_t aes_xts_256_vec8_ctxt[SECSIZE] = { + 0x72, 0xef, 0xc1, 0xeb, 0xfe, 0x1e, 0xe2, 0x59, + 0x75, 0xa6, 0xeb, 0x3a, 0xa8, 0x58, 0x9d, 0xda, + 0x2b, 0x26, 0x1f, 0x1c, 0x85, 0xbd, 0xab, 0x44, + 0x2a, 0x9e, 0x5b, 0x2d, 0xd1, 0xd7, 0xc3, 0x95, + 0x7a, 0x16, 0xfc, 0x08, 0xe5, 0x26, 0xd4, 0xb1, + 0x22, 0x3f, 0x1b, 0x12, 0x32, 0xa1, 0x1a, 0xf2, + 0x74, 0xc3, 0xd7, 0x0d, 0xac, 0x57, 0xf8, 0x3e, + 0x09, 0x83, 0xc4, 0x98, 0xf1, 0xa6, 0xf1, 0xae, + 0xcb, 0x02, 0x1c, 0x3e, 0x70, 0x08, 0x5a, 0x1e, + 0x52, 0x7f, 0x1c, 0xe4, 0x1e, 0xe5, 0x91, 0x1a, + 0x82, 0x02, 0x01, 0x61, 0x52, 0x9c, 0xd8, 0x27, + 0x73, 0x76, 0x2d, 0xaf, 0x54, 0x59, 0xde, 0x94, + 0xa0, 0xa8, 0x2a, 0xda, 0xe7, 0xe1, 0x70, 0x3c, + 0x80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 0x8d, 0x41, 0x26, 0xed, 0x18, + 0x39, 0xe0, 0xda, 0x29, 0xa5, 0x37, 0xa8, 0xc1, + 0x98, 0xb3, 0xc6, 0x6a, 0xb0, 0x07, 0x12, 0xdd, + 0x26, 0x16, 0x74, 0xbf, 0x45, 0xa7, 0x3d, 0x67, + 0xf7, 0x69, 0x14, 0xf8, 0x30, 0xca, 0x01, 0x4b, + 0x65, 0x59, 0x6f, 0x27, 0xe4, 0xcf, 0x62, 0xde, + 0x66, 0x12, 0x5a, 0x55, 0x66, 0xdf, 0x99, 0x75, + 0x15, 0x56, 0x28, 0xb4, 0x00, 0xfb, 0xfb, 0x3a, + 0x29, 0x04, 0x0e, 0xd5, 0x0f, 0xaf, 0xfd, 0xbb, + 0x18, 0xae, 0xce, 0x7c, 0x5c, 0x44, 0x69, 0x32, + 0x60, 0xaa, 0xb3, 0x86, 0xc0, 0xa3, 0x7b, 0x11, + 0xb1, 0x14, 0xf1, 0xc4, 0x15, 0xae, 0xbb, 0x65, + 0x3b, 0xe4, 0x68, 0x17, 0x94, 0x28, 0xd4, 0x3a, + 0x4d, 0x8b, 0xc3, 0xec, 0x38, 0x81, 0x3e, 0xca, + 0x30, 0xa1, 0x3c, 0xf1, 0xbb, 0x18, 0xd5, 0x24, + 0xf1, 0x99, 0x2d, 0x44, 0xd8, 0xb1, 0xa4, 0x2e, + 0xa3, 0x0b, 0x22, 0xe6, 0xc9, 0x5b, 0x19, 0x9d, + 0x8d, 0x18, 0x2f, 0x88, 0x40, 0xb0, 0x9d, 0x05, + 0x95, 0x85, 0xc3, 0x1a, 0xd6, 0x91, 0xfa, 0x06, + 0x19, 0xff, 0x03, 0x8a, 0xca, 0x2c, 0x39, 0xa9, + 0x43, 0x42, 0x11, 0x57, 0x36, 0x17, 0x17, 0xc4, + 0x9d, 0x32, 0x20, 0x28, 0xa7, 0x46, 0x48, 0x11, + 0x3b, 0xd8, 0xc9, 0xd7, 0xec, 0x77, 0xcf, 0x3c, + 0x89, 0xc1, 0xec, 0x87, 0x18, 0xce, 0xff, 0x85, + 0x16, 0xd9, 0x6b, 0x34, 0xc3, 0xc6, 0x14, 0xf1, + 0x06, 0x99, 0xc9, 0xab, 0xc4, 0xed, 0x04, 0x11, + 0x50, 0x62, 0x23, 0xbe, 0xa1, 0x6a, 0xf3, 0x5c, + 0x88, 0x3a, 0xcc, 0xdb, 0xe1, 0x10, 0x4e, 0xef, + 0x0c, 0xfd, 0xb5, 0x4e, 0x12, 0xfb, 0x23, 0x0a, +}; + +/* + * Vector 9 from IEEE 1619/D16, blkno 0xff. + */ +static const uint8_t aes_xts_256_vec9_ptxt[SECSIZE] = { + 0x72, 0xef, 0xc1, 0xeb, 0xfe, 0x1e, 0xe2, 0x59, + 0x75, 0xa6, 0xeb, 0x3a, 0xa8, 0x58, 0x9d, 0xda, + 0x2b, 0x26, 0x1f, 0x1c, 0x85, 0xbd, 0xab, 0x44, + 0x2a, 0x9e, 0x5b, 0x2d, 0xd1, 0xd7, 0xc3, 0x95, + 0x7a, 0x16, 0xfc, 0x08, 0xe5, 0x26, 0xd4, 0xb1, + 0x22, 0x3f, 0x1b, 0x12, 0x32, 0xa1, 0x1a, 0xf2, + 0x74, 0xc3, 0xd7, 0x0d, 0xac, 0x57, 0xf8, 0x3e, + 0x09, 0x83, 0xc4, 0x98, 0xf1, 0xa6, 0xf1, 0xae, + 0xcb, 0x02, 0x1c, 0x3e, 0x70, 0x08, 0x5a, 0x1e, + 0x52, 0x7f, 0x1c, 0xe4, 0x1e, 0xe5, 0x91, 0x1a, + 0x82, 0x02, 0x01, 0x61, 0x52, 0x9c, 0xd8, 0x27, + 0x73, 0x76, 0x2d, 0xaf, 0x54, 0x59, 0xde, 0x94, + 0xa0, 0xa8, 0x2a, 0xda, 0xe7, 0xe1, 0x70, 0x3c, + 0x80, 0x85, 0x43, 0xc2, 0x9e, 0xd6, 0xfb, 0x32, + 0xd9, 0xe0, 0x04, 0x32, 0x7c, 0x13, 0x55, 0x18, + 0x0c, 0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a, 0xb0, 0x07, 0x12, 0xdd, + 0x26, 0x16, 0x74, 0xbf, 0x45, 0xa7, 0x3d, 0x67, + 0xf7, 0x69, 0x14, 0xf8, 0x30, 0xca, 0x01, 0x4b, + 0x65, 0x59, 0x6f, 0x27, 0xe4, 0xcf, 0x62, 0xde, + 0x66, 0x12, 0x5a, 0x55, 0x66, 0xdf, 0x99, 0x75, + 0x15, 0x56, 0x28, 0xb4, 0x00, 0xfb, 0xfb, 0x3a, + 0x29, 0x04, 0x0e, 0xd5, 0x0f, 0xaf, 0xfd, 0xbb, + 0x18, 0xae, 0xce, 0x7c, 0x5c, 0x44, 0x69, 0x32, + 0x60, 0xaa, 0xb3, 0x86, 0xc0, 0xa3, 0x7b, 0x11, + 0xb1, 0x14, 0xf1, 0xc4, 0x15, 0xae, 0xbb, 0x65, + 0x3b, 0xe4, 0x68, 0x17, 0x94, 0x28, 0xd4, 0x3a, + 0x4d, 0x8b, 0xc3, 0xec, 0x38, 0x81, 0x3e, 0xca, + 0x30, 0xa1, 0x3c, 0xf1, 0xbb, 0x18, 0xd5, 0x24, + 0xf1, 0x99, 0x2d, 0x44, 0xd8, 0xb1, 0xa4, 0x2e, + 0xa3, 0x0b, 0x22, 0xe6, 0xc9, 0x5b, 0x19, 0x9d, + 0x8d, 0x18, 0x2f, 0x88, 0x40, 0xb0, 0x9d, 0x05, + 0x95, 0x85, 0xc3, 0x1a, 0xd6, 0x91, 0xfa, 0x06, + 0x19, 0xff, 0x03, 0x8a, 0xca, 0x2c, 0x39, 0xa9, + 0x43, 0x42, 0x11, 0x57, 0x36, 0x17, 0x17, 0xc4, + 0x9d, 0x32, 0x20, 0x28, 0xa7, 0x46, 0x48, 0x11, + 0x3b, 0xd8, 0xc9, 0xd7, 0xec, 0x77, 0xcf, 0x3c, + 0x89, 0xc1, 0xec, 0x87, 0x18, 0xce, 0xff, 0x85, + 0x16, 0xd9, 0x6b, 0x34, 0xc3, 0xc6, 0x14, 0xf1, + 0x06, 0x99, 0xc9, 0xab, 0xc4, 0xed, 0x04, 0x11, + 0x50, 0x62, 0x23, 0xbe, 0xa1, 0x6a, 0xf3, 0x5c, + 0x88, 0x3a, 0xcc, 0xdb, 0xe1, 0x10, 0x4e, 0xef, + 0x0c, 0xfd, 0xb5, 0x4e, 0x12, 0xfb, 0x23, 0x0a, +}; + +static const uint8_t aes_xts_256_vec9_ctxt[SECSIZE] = { + 0x32, 0x60, 0xae, 0x8d, 0xad, 0x1f, 0x4a, 0x32, + 0xc5, 0xca, 0xfe, 0x3a, 0xb0, 0xeb, 0x95, 0x54, + 0x9d, 0x46, 0x1a, 0x67, 0xce, 0xb9, 0xe5, 0xaa, + 0x2d, 0x3a, 0xfb, 0x62, 0xde, 0xce, 0x05, 0x53, + 0x19, 0x3b, 0xa5, 0x0c, 0x75, 0xbe, 0x25, 0x1e, + 0x08, 0xd1, 0xd0, 0x8f, 0x10, 0x88, 0x57, 0x6c, + 0x7e, 0xfd, 0xfa, 0xaf, 0x3f, 0x45, 0x95, 0x59, + 0x57, 0x1e, 0x12, 0x51, 0x17, 0x53, 0xb0, 0x7a, + 0xf0, 0x73, 0xf3, 0x5d, 0xa0, 0x6a, 0xf0, 0xce, + 0x0b, 0xbf, 0x6b, 0x8f, 0x5c, 0xcc, 0x5c, 0xea, + 0x50, 0x0e, 0xc1, 0xb2, 0x11, 0xbd, 0x51, 0xf6, + 0x3b, 0x60, 0x6b, 0xf6, 0x52, 0x87, 0x96, 0xca, + 0x12, 0x17, 0x3b, 0xa3, 0x9b, 0x89, 0x35, 0xee, + 0x44, 0xcc, 0xce, 0x64, 0x6f, 0x90, 0xa4, 0x5b, + 0xf9, 0xcc, 0xc5, 0x67, 0xf0, 0xac, 0xe1, 0x3d, + 0xc2, 0xd5, 0x3e, 0xbe, 0xed, 0xc8, 0x1f, 0x58, + 0xb2, 0xe4, 0x11, 0x79, 0xdd, 0xdf, 0x0d, 0x5a, + 0x5c, 0x42, 0xf5, 0xd8, 0x50, 0x6c, 0x1a, 0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0x84, 0xc2, 0x65, + 0x55, 0x44, 0x0e, 0xc7, 0xf1, 0x04, 0x45, 0xcd, +}; + +const struct testvec aes_xts_256_vectors[] = { + { + .blkno = 0, + .ptxt = aes_xts_256_vec4_ptxt, + .ctxt = aes_xts_256_vec4_ctxt, + }, + { + .blkno = 1, + .ptxt = aes_xts_256_vec5_ptxt, + .ctxt = aes_xts_256_vec5_ctxt, + }, + { + .blkno = 2, + .ptxt = aes_xts_256_vec6_ptxt, + .ctxt = aes_xts_256_vec6_ctxt, + }, + { + .blkno = 0xfd, + .ptxt = aes_xts_256_vec7_ptxt, + .ctxt = aes_xts_256_vec7_ctxt, + }, + { + .blkno = 0xfe, + .ptxt = aes_xts_256_vec8_ptxt, + .ctxt = aes_xts_256_vec8_ctxt, + }, + { + .blkno = 0xff, + .ptxt = aes_xts_256_vec9_ptxt, + .ctxt = aes_xts_256_vec9_ctxt, + }, +}; + +/* + * Vector 10 from IEEE 1619/D16, blkno 0xff. + */ +static const uint8_t aes_xts_512_vec10_ptxt[SECSIZE] = { + 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, + 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, + 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, + 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, + 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, + 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, + 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, + 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, + 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, + 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, + 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, + 0x58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, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, + 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, + 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, + 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, + 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, + 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, + 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, + 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, + 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, + 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, + 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, + 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, + 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, + 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, + 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, + 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, + 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, + 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, + 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, + 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, + 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, + 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, + 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, + 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, + 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, + 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, + 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, + 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, + 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, + 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, + 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, +}; + +static const uint8_t aes_xts_512_vec10_ctxt[SECSIZE] = { + 0x1c, 0x3b, 0x3a, 0x10, 0x2f, 0x77, 0x03, 0x86, + 0xe4, 0x83, 0x6c, 0x99, 0xe3, 0x70, 0xcf, 0x9b, + 0xea, 0x00, 0x80, 0x3f, 0x5e, 0x48, 0x23, 0x57, + 0xa4, 0xae, 0x12, 0xd4, 0x14, 0xa3, 0xe6, 0x3b, + 0x5d, 0x31, 0xe2, 0x76, 0xf8, 0xfe, 0x4a, 0x8d, + 0x66, 0xb3, 0x17, 0xf9, 0xac, 0x68, 0x3f, 0x44, + 0x68, 0x0a, 0x86, 0xac, 0x35, 0xad, 0xfc, 0x33, + 0x45, 0xbe, 0xfe, 0xcb, 0x4b, 0xb1, 0x88, 0xfd, + 0x57, 0x76, 0x92, 0x6c, 0x49, 0xa3, 0x09, 0x5e, + 0xb1, 0x08, 0xfd, 0x10, 0x98, 0xba, 0xec, 0x70, + 0xaa, 0xa6, 0x69, 0x99, 0xa7, 0x2a, 0x82, 0xf2, + 0x7d, 0x84, 0x8b, 0x21, 0xd4, 0xa7, 0x41, 0xb0, + 0xc5, 0xcd, 0x4d, 0x5f, 0xff, 0x9d, 0xac, 0x89, + 0xae, 0xba, 0x12, 0x29, 0x61, 0xd0, 0x3a, 0x75, + 0x71, 0x23, 0xe9, 0x87, 0x0f, 0x8a, 0xcf, 0x10, + 0x00, 0x02, 0x08, 0x87, 0x89, 0x14, 0x29, 0xca, + 0x2a, 0x3e, 0x7a, 0x7d, 0x7d, 0xf7, 0xb1, 0x03, + 0x55, 0x16, 0x5c, 0x8b, 0x9a, 0x6d, 0x0a, 0x7d, + 0xe8, 0xb0, 0x62, 0xc4, 0x50, 0x0d, 0xc4, 0xcd, + 0x12, 0x0c, 0x0f, 0x74, 0x18, 0xda, 0xe3, 0xd0, + 0xb5, 0x78, 0x1c, 0x34, 0x80, 0x3f, 0xa7, 0x54, + 0x21, 0xc7, 0x90, 0xdf, 0xe1, 0xde, 0x18, 0x34, + 0xf2, 0x80, 0xd7, 0x66, 0x7b, 0x32, 0x7f, 0x6c, + 0x8c, 0xd7, 0x55, 0x7e, 0x12, 0xac, 0x3a, 0x0f, + 0x93, 0xec, 0x05, 0xc5, 0x2e, 0x04, 0x93, 0xef, + 0x31, 0xa1, 0x2d, 0x3d, 0x92, 0x60, 0xf7, 0x9a, + 0x28, 0x9d, 0x6a, 0x37, 0x9b, 0xc7, 0x0c, 0x50, + 0x84, 0x14, 0x73, 0xd1, 0xa8, 0xcc, 0x81, 0xec, + 0x58, 0x3e, 0x96, 0x45, 0xe0, 0x7b, 0x8d, 0x96, + 0x70, 0x65, 0x5b, 0xa5, 0xbb, 0xcf, 0xec, 0xc6, + 0xdc, 0x39, 0x66, 0x38, 0x0a, 0xd8, 0xfe, 0xcb, + 0x17, 0xb6, 0xba, 0x02, 0x46, 0x9a, 0x02, 0x0a, + 0x84, 0xe1, 0x8e, 0x8f, 0x84, 0x25, 0x20, 0x70, + 0xc1, 0x3e, 0x9f, 0x1f, 0x28, 0x9b, 0xe5, 0x4f, + 0xbc, 0x48, 0x14, 0x57, 0x77, 0x8f, 0x61, 0x60, + 0x15, 0xe1, 0x32, 0x7a, 0x02, 0xb1, 0x40, 0xf1, + 0x50, 0x5e, 0xb3, 0x09, 0x32, 0x6d, 0x68, 0x37, + 0x8f, 0x83, 0x74, 0x59, 0x5c, 0x84, 0x9d, 0x84, + 0xf4, 0xc3, 0x33, 0xec, 0x44, 0x23, 0x88, 0x51, + 0x43, 0xcb, 0x47, 0xbd, 0x71, 0xc5, 0xed, 0xae, + 0x9b, 0xe6, 0x9a, 0x2f, 0xfe, 0xce, 0xb1, 0xbe, + 0xc9, 0xde, 0x24, 0x4f, 0xbe, 0x15, 0x99, 0x2b, + 0x11, 0xb7, 0x7c, 0x04, 0x0f, 0x12, 0xbd, 0x8f, + 0x6a, 0x97, 0x5a, 0x44, 0xa0, 0xf9, 0x0c, 0x29, + 0xa9, 0xab, 0xc3, 0xd4, 0xd8, 0x93, 0x92, 0x72, + 0x84, 0xc5, 0x87, 0x54, 0xcc, 0xe2, 0x94, 0x52, + 0x9f, 0x86, 0x14, 0xdc, 0xd2, 0xab, 0xa9, 0x91, + 0x92, 0x5f, 0xed, 0xc4, 0xae, 0x74, 0xff, 0xac, + 0x6e, 0x33, 0x3b, 0x93, 0xeb, 0x4a, 0xff, 0x04, + 0x79, 0xda, 0x9a, 0x41, 0x0e, 0x44, 0x50, 0xe0, + 0xdd, 0x7a, 0xe4, 0xc6, 0xe2, 0x91, 0x09, 0x00, + 0x57, 0x5d, 0xa4, 0x01, 0xfc, 0x07, 0x05, 0x9f, + 0x64, 0x5e, 0x8b, 0x7e, 0x9b, 0xfd, 0xef, 0x33, + 0x94, 0x30, 0x54, 0xff, 0x84, 0x01, 0x14, 0x93, + 0xc2, 0x7b, 0x34, 0x29, 0xea, 0xed, 0xb4, 0xed, + 0x53, 0x76, 0x44, 0x1a, 0x77, 0xed, 0x43, 0x85, + 0x1a, 0xd7, 0x7f, 0x16, 0xf5, 0x41, 0xdf, 0xd2, + 0x69, 0xd5, 0x0d, 0x6a, 0x5f, 0x14, 0xfb, 0x0a, + 0xab, 0x1c, 0xbb, 0x4c, 0x15, 0x50, 0xbe, 0x97, + 0xf7, 0xab, 0x40, 0x66, 0x19, 0x3c, 0x4c, 0xaa, + 0x77, 0x3d, 0xad, 0x38, 0x01, 0x4b, 0xd2, 0x09, + 0x2f, 0xa7, 0x55, 0xc8, 0x24, 0xbb, 0x5e, 0x54, + 0xc4, 0xf3, 0x6f, 0xfd, 0xa9, 0xfc, 0xea, 0x70, + 0xb9, 0xc6, 0xe6, 0x93, 0xe1, 0x48, 0xc1, 0x51, +}; + +/* + * Vector 11 from IEEE 1619/D16, blkno 0xffff. + */ +static const uint8_t aes_xts_512_vec11_ptxt[SECSIZE] = { + 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, + 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, + 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, + 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, + 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, + 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, + 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, + 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, + 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, + 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, + 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, + 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, + 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, + 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, + 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, + 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, + 0x80, 0x81, 0x82, 0x83, 0x84, 0x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ea, 0xeb, 0xec, 0xed, 0xee, 0xef, + 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, + 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, +}; + +static const uint8_t aes_xts_512_vec11_ctxt[SECSIZE] = { + 0x77, 0xa3, 0x12, 0x51, 0x61, 0x8a, 0x15, 0xe6, + 0xb9, 0x2d, 0x1d, 0x66, 0xdf, 0xfe, 0x7b, 0x50, + 0xb5, 0x0b, 0xad, 0x55, 0x23, 0x05, 0xba, 0x02, + 0x17, 0xa6, 0x10, 0x68, 0x8e, 0xff, 0x7e, 0x11, + 0xe1, 0xd0, 0x22, 0x54, 0x38, 0xe0, 0x93, 0x24, + 0x2d, 0x6d, 0xb2, 0x74, 0xfd, 0xe8, 0x01, 0xd4, + 0xca, 0xe0, 0x6f, 0x20, 0x92, 0xc7, 0x28, 0xb2, + 0x47, 0x85, 0x59, 0xdf, 0x58, 0xe8, 0x37, 0xc2, + 0x46, 0x9e, 0xe4, 0xa4, 0xfa, 0x79, 0x4e, 0x4b, + 0xbc, 0x7f, 0x39, 0xbc, 0x02, 0x6e, 0x3c, 0xb7, + 0x2c, 0x33, 0xb0, 0x88, 0x8f, 0x25, 0xb4, 0xac, + 0xf5, 0x6a, 0x2a, 0x98, 0x04, 0xf1, 0xce, 0x6d, + 0x3d, 0x6e, 0x1d, 0xc6, 0xca, 0x18, 0x1d, 0x4b, + 0x54, 0x61, 0x79, 0xd5, 0x55, 0x44, 0xaa, 0x77, + 0x60, 0xc4, 0x0d, 0x06, 0x74, 0x15, 0x39, 0xc7, + 0xe3, 0xcd, 0x9d, 0x2f, 0x66, 0x50, 0xb2, 0x01, + 0x3f, 0xd0, 0xee, 0xb8, 0xc2, 0xb8, 0xe3, 0xd8, + 0xd2, 0x40, 0xcc, 0xae, 0x2d, 0x4c, 0x98, 0x32, + 0x0a, 0x74, 0x42, 0xe1, 0xc8, 0xd7, 0x5a, 0x42, + 0xd6, 0xe6, 0xcf, 0xa4, 0xc2, 0xec, 0xa1, 0x79, + 0x8d, 0x15, 0x8c, 0x7a, 0xec, 0xdf, 0x82, 0x49, + 0x0f, 0x24, 0xbb, 0x9b, 0x38, 0xe1, 0x08, 0xbc, + 0xda, 0x12, 0xc3, 0xfa, 0xf9, 0xa2, 0x11, 0x41, + 0xc3, 0x61, 0x3b, 0x58, 0x36, 0x7f, 0x92, 0x2a, + 0xaa, 0x26, 0xcd, 0x22, 0xf2, 0x3d, 0x70, 0x8d, + 0xae, 0x69, 0x9a, 0xd7, 0xcb, 0x40, 0xa8, 0xad, + 0x0b, 0x6e, 0x27, 0x84, 0x97, 0x3d, 0xcb, 0x60, + 0x56, 0x84, 0xc0, 0x8b, 0x8d, 0x69, 0x98, 0xc6, + 0x9a, 0xac, 0x04, 0x99, 0x21, 0x87, 0x1e, 0xbb, + 0x65, 0x30, 0x1a, 0x46, 0x19, 0xca, 0x80, 0xec, + 0xb4, 0x85, 0xa3, 0x1d, 0x74, 0x42, 0x23, 0xce, + 0x8d, 0xdc, 0x23, 0x94, 0x82, 0x8d, 0x6a, 0x80, + 0x47, 0x0c, 0x09, 0x2f, 0x5b, 0xa4, 0x13, 0xc3, + 0x37, 0x8f, 0xa6, 0x05, 0x42, 0x55, 0xc6, 0xf9, + 0xdf, 0x44, 0x95, 0x86, 0x2b, 0xbb, 0x32, 0x87, + 0x68, 0x1f, 0x93, 0x1b, 0x68, 0x7c, 0x88, 0x8a, + 0xbf, 0x84, 0x4d, 0xfc, 0x8f, 0xc2, 0x83, 0x31, + 0xe5, 0x79, 0x92, 0x8c, 0xd1, 0x2b, 0xd2, 0x39, + 0x0a, 0xe1, 0x23, 0xcf, 0x03, 0x81, 0x8d, 0x14, + 0xde, 0xdd, 0xe5, 0xc0, 0xc2, 0x4c, 0x8a, 0xb0, + 0x18, 0xbf, 0xca, 0x75, 0xca, 0x09, 0x6f, 0x2d, + 0x53, 0x1f, 0x3d, 0x16, 0x19, 0xe7, 0x85, 0xf1, + 0xad, 0xa4, 0x37, 0xca, 0xb9, 0x2e, 0x98, 0x05, + 0x58, 0xb3, 0xdc, 0xe1, 0x47, 0x4a, 0xfb, 0x75, + 0xbf, 0xed, 0xbf, 0x8f, 0xf5, 0x4c, 0xb2, 0x61, + 0x8e, 0x02, 0x44, 0xc9, 0xac, 0x0d, 0x3c, 0x66, + 0xfb, 0x51, 0x59, 0x8c, 0xd2, 0xdb, 0x11, 0xf9, + 0xbe, 0x39, 0x79, 0x1a, 0xbe, 0x44, 0x7c, 0x63, + 0x09, 0x4f, 0x7c, 0x45, 0x3b, 0x7f, 0xf8, 0x7c, + 0xb5, 0xbb, 0x36, 0xb7, 0xc7, 0x9e, 0xfb, 0x08, + 0x72, 0xd1, 0x70, 0x58, 0xb8, 0x3b, 0x15, 0xab, + 0x08, 0x66, 0xad, 0x8a, 0x58, 0x65, 0x6c, 0x5a, + 0x7e, 0x20, 0xdb, 0xdf, 0x30, 0x8b, 0x24, 0x61, + 0xd9, 0x7c, 0x0e, 0xc0, 0x02, 0x4a, 0x27, 0x15, + 0x05, 0x52, 0x49, 0xcf, 0x3b, 0x47, 0x8d, 0xdd, + 0x47, 0x40, 0xde, 0x65, 0x4f, 0x75, 0xca, 0x68, + 0x6e, 0x0d, 0x73, 0x45, 0xc6, 0x9e, 0xd5, 0x0c, + 0xdc, 0x2a, 0x8b, 0x33, 0x2b, 0x1f, 0x88, 0x24, + 0x10, 0x8a, 0xc9, 0x37, 0xeb, 0x05, 0x05, 0x85, + 0x60, 0x8e, 0xe7, 0x34, 0x09, 0x7f, 0xc0, 0x90, + 0x54, 0xfb, 0xff, 0x89, 0xee, 0xae, 0xea, 0x79, + 0x1f, 0x4a, 0x7a, 0xb1, 0xf9, 0x86, 0x82, 0x94, + 0xa4, 0xf9, 0xe2, 0x7b, 0x42, 0xaf, 0x81, 0x00, + 0xcb, 0x9d, 0x59, 0xce, 0xf9, 0x64, 0x58, 0x03, +}; + +const struct testvec aes_xts_512_vectors[] = { + { + .blkno = 0xff, + .ptxt = aes_xts_512_vec10_ptxt, + .ctxt = aes_xts_512_vec10_ctxt, + }, + { + .blkno = 0xffff, + .ptxt = aes_xts_512_vec11_ptxt, + .ctxt = aes_xts_512_vec11_ctxt, + }, +}; + +static int +open_disk(const char *devpath, const char *imgpath, size_t size) +{ + int fd; + + fd = open(imgpath, O_CREAT | O_RDWR | O_TRUNC, 0600); + if (fd < 0) + return -1; + + if (ftruncate(fd, size) < 0) + goto fail; + + if (rump_pub_etfs_register_withsize(devpath, + imgpath, RUMP_ETFS_BLK, 0, size) < 0) { + goto fail; + } + + unlink(imgpath); + return fd; +fail: + close(fd); + unlink(imgpath); + return -1; +} + +static int +open_cgd(int devno) +{ + char devpath[32]; + + sprintf(devpath, "/dev/rcgd%d%c", devno, getrawpartition() + 'a'); + + return rump_sys_open(devpath, O_RDWR, 0); +} + +static int +configure_cgd(int fd, const char *dkpath, const char *alg, + const char *ivmethod, const char *key, size_t keylen) +{ + struct cgd_ioctl ci; + + memset(&ci, 0, sizeof(ci)); + ci.ci_disk = dkpath; + ci.ci_alg = alg; + ci.ci_ivmethod = ivmethod; + ci.ci_keylen = 8 * keylen - 8; /* Exclude the NUL terminator. */ + ci.ci_key = key; + ci.ci_blocksize = 128; + + return rump_sys_ioctl(fd, CGDIOCSET, &ci); +} + +static int +unconfigure_cgd(int fd) +{ + struct cgd_ioctl ci; + + return rump_sys_ioctl(fd, CGDIOCCLR, &ci); +} + +static int +write_testvec(int cgdfd, const struct testvec *tv) +{ + ssize_t written; + + if (rump_sys_lseek(cgdfd, tv->blkno * SECSIZE, SEEK_SET) < 0) + return -1; + + written = rump_sys_write(cgdfd, tv->ptxt, SECSIZE); + if (written < 0) + return -1; + if (written != SECSIZE) { + errno = EDOM; /* Something distinct. */ + return -1; + } + + return 0; +} + +static int +read_testvec(int cgdfd, const struct testvec *tv) +{ + char *buf; + int res = -1; + + buf = malloc(SECSIZE); + if (buf == NULL) + return -1; + + if (rump_sys_lseek(cgdfd, tv->blkno * SECSIZE, SEEK_SET) < 0) + goto fail; + + if (rump_sys_read(cgdfd, buf, SECSIZE) != SECSIZE) + goto fail; + + res = memcmp(buf, tv->ptxt, SECSIZE); +fail: + free(buf); + return res; +} + +static int +check_testvec(int dkfd, const struct testvec *tv) +{ + char *buf; + int res = -1; + + buf = malloc(SECSIZE); + if (buf == NULL) + return -1; + + if (lseek(dkfd, tv->blkno * SECSIZE, SEEK_SET) < 0) + goto fail; + + if (read(dkfd, buf, SECSIZE) != SECSIZE) + goto fail; + + res = memcmp(buf, tv->ctxt, SECSIZE); +fail: + free(buf); + return res; +} + +ATF_TC(cgd_aes_cbc_128_encblkno1); +ATF_TC_HEAD(cgd_aes_cbc_128_encblkno1, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Test aes-cbc with 128 bits key, ivmethod encblkno1"); +} + +ATF_TC_BODY(cgd_aes_cbc_128_encblkno1, tc) +{ + const char imgpath[] = "aes-cbc-128-encblkno1.img"; + const char *dkpath = "/dev/dk"; + const size_t dksize = 4 * SECSIZE; /* Last blkno is 3. */ + int dkfd, cgdfd; + + rump_init(); + + RL(dkfd = open_disk(dkpath, imgpath, dksize)); + + RL(cgdfd = open_cgd(0)); + RL(configure_cgd(cgdfd, dkpath, "aes-cbc", "encblkno1", + aes_cbc_128_key, sizeof(aes_cbc_128_key))); + + CHECK_LIBC(write_testvec(cgdfd, &aes_cbc_128_1_vectors[0]), -1); + CHECK_LIBC(write_testvec(cgdfd, &aes_cbc_128_1_vectors[1]), -1); + CHECK_LIBC(write_testvec(cgdfd, &aes_cbc_128_1_vectors[2]), -1); + CHECK_LIBC(write_testvec(cgdfd, &aes_cbc_128_1_vectors[3]), -1); + + RL(unconfigure_cgd(cgdfd)); + RL(configure_cgd(cgdfd, dkpath, "aes-cbc", "encblkno1", + aes_cbc_128_key, sizeof(aes_cbc_128_key))); + + ATF_CHECK_EQ(read_testvec(cgdfd, &aes_cbc_128_1_vectors[0]), 0); + ATF_CHECK_EQ(read_testvec(cgdfd, &aes_cbc_128_1_vectors[1]), 0); + ATF_CHECK_EQ(read_testvec(cgdfd, &aes_cbc_128_1_vectors[2]), 0); + ATF_CHECK_EQ(read_testvec(cgdfd, &aes_cbc_128_1_vectors[3]), 0); + + RL(unconfigure_cgd(cgdfd)); + RL(rump_sys_close(cgdfd)); + + ATF_CHECK_EQ(check_testvec(dkfd, &aes_cbc_128_1_vectors[0]), 0); + ATF_CHECK_EQ(check_testvec(dkfd, &aes_cbc_128_1_vectors[1]), 0); + ATF_CHECK_EQ(check_testvec(dkfd, &aes_cbc_128_1_vectors[2]), 0); + ATF_CHECK_EQ(check_testvec(dkfd, &aes_cbc_128_1_vectors[3]), 0); + + RL(close(dkfd)); +} + +ATF_TC(cgd_aes_cbc_128_encblkno8); +ATF_TC_HEAD(cgd_aes_cbc_128_encblkno8, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Test aes-cbc with 128 bits key, ivmethod encblkno8"); +} + +ATF_TC_BODY(cgd_aes_cbc_128_encblkno8, tc) +{ + const char imgpath[] = "aes-cbc-128-encblkno8.img"; + const char *dkpath = "/dev/dk"; + const size_t dksize = 4 * SECSIZE; /* Last blkno is 3. */ + int dkfd, cgdfd; + + rump_init(); + + RL(dkfd = open_disk(dkpath, imgpath, dksize)); + + RL(cgdfd = open_cgd(0)); + RL(configure_cgd(cgdfd, dkpath, "aes-cbc", "encblkno8", + aes_cbc_128_key, sizeof(aes_cbc_128_key))); + + CHECK_LIBC(write_testvec(cgdfd, &aes_cbc_128_8_vectors[0]), -1); + CHECK_LIBC(write_testvec(cgdfd, &aes_cbc_128_8_vectors[1]), -1); + CHECK_LIBC(write_testvec(cgdfd, &aes_cbc_128_8_vectors[2]), -1); + CHECK_LIBC(write_testvec(cgdfd, &aes_cbc_128_8_vectors[3]), -1); + + RL(unconfigure_cgd(cgdfd)); + RL(configure_cgd(cgdfd, dkpath, "aes-cbc", "encblkno8", + aes_cbc_128_key, sizeof(aes_cbc_128_key))); + + ATF_CHECK_EQ(read_testvec(cgdfd, &aes_cbc_128_8_vectors[0]), 0); + ATF_CHECK_EQ(read_testvec(cgdfd, &aes_cbc_128_8_vectors[1]), 0); + ATF_CHECK_EQ(read_testvec(cgdfd, &aes_cbc_128_8_vectors[2]), 0); + ATF_CHECK_EQ(read_testvec(cgdfd, &aes_cbc_128_8_vectors[3]), 0); + + RL(unconfigure_cgd(cgdfd)); + RL(rump_sys_close(cgdfd)); + + ATF_CHECK_EQ(check_testvec(dkfd, &aes_cbc_128_8_vectors[0]), 0); + ATF_CHECK_EQ(check_testvec(dkfd, &aes_cbc_128_8_vectors[1]), 0); + ATF_CHECK_EQ(check_testvec(dkfd, &aes_cbc_128_8_vectors[2]), 0); + ATF_CHECK_EQ(check_testvec(dkfd, &aes_cbc_128_8_vectors[3]), 0); + + RL(close(dkfd)); +} + +ATF_TC(cgd_aes_cbc_192_encblkno1); +ATF_TC_HEAD(cgd_aes_cbc_192_encblkno1, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Test aes-cbc with 192 bits key, ivmethod encblkno1"); +} + +ATF_TC_BODY(cgd_aes_cbc_192_encblkno1, tc) +{ + const char imgpath[] = "aes-cbc-192-encblkno1.img"; + const char *dkpath = "/dev/dk"; + const size_t dksize = 4 * SECSIZE; /* Last blkno is 3. */ + int dkfd, cgdfd; + + rump_init(); + + RL(dkfd = open_disk(dkpath, imgpath, dksize)); + + RL(cgdfd = open_cgd(0)); + RL(configure_cgd(cgdfd, dkpath, "aes-cbc", "encblkno1", + aes_cbc_192_key, sizeof(aes_cbc_192_key))); + + CHECK_LIBC(write_testvec(cgdfd, &aes_cbc_192_1_vectors[0]), -1); + CHECK_LIBC(write_testvec(cgdfd, &aes_cbc_192_1_vectors[1]), -1); + CHECK_LIBC(write_testvec(cgdfd, &aes_cbc_192_1_vectors[2]), -1); + CHECK_LIBC(write_testvec(cgdfd, &aes_cbc_192_1_vectors[3]), -1); + + RL(unconfigure_cgd(cgdfd)); + RL(configure_cgd(cgdfd, dkpath, "aes-cbc", "encblkno1", + aes_cbc_192_key, sizeof(aes_cbc_192_key))); + + ATF_CHECK_EQ(read_testvec(cgdfd, &aes_cbc_192_1_vectors[0]), 0); + ATF_CHECK_EQ(read_testvec(cgdfd, &aes_cbc_192_1_vectors[1]), 0); + ATF_CHECK_EQ(read_testvec(cgdfd, &aes_cbc_192_1_vectors[2]), 0); + ATF_CHECK_EQ(read_testvec(cgdfd, &aes_cbc_192_1_vectors[3]), 0); + + RL(unconfigure_cgd(cgdfd)); + RL(rump_sys_close(cgdfd)); + + ATF_CHECK_EQ(check_testvec(dkfd, &aes_cbc_192_1_vectors[0]), 0); + ATF_CHECK_EQ(check_testvec(dkfd, &aes_cbc_192_1_vectors[1]), 0); + ATF_CHECK_EQ(check_testvec(dkfd, &aes_cbc_192_1_vectors[2]), 0); + ATF_CHECK_EQ(check_testvec(dkfd, &aes_cbc_192_1_vectors[3]), 0); + + RL(close(dkfd)); +} + +ATF_TC(cgd_aes_cbc_192_encblkno8); +ATF_TC_HEAD(cgd_aes_cbc_192_encblkno8, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Test aes-cbc with 192 bits key, ivmethod encblkno8"); +} + +ATF_TC_BODY(cgd_aes_cbc_192_encblkno8, tc) +{ + const char imgpath[] = "aes-cbc-192-encblkno8.img"; + const char *dkpath = "/dev/dk"; + const size_t dksize = 4 * SECSIZE; /* Last blkno is 3. */ + int dkfd, cgdfd; + + rump_init(); + + RL(dkfd = open_disk(dkpath, imgpath, dksize)); + + RL(cgdfd = open_cgd(0)); + RL(configure_cgd(cgdfd, dkpath, "aes-cbc", "encblkno8", + aes_cbc_192_key, sizeof(aes_cbc_192_key))); + + CHECK_LIBC(write_testvec(cgdfd, &aes_cbc_192_8_vectors[0]), -1); + CHECK_LIBC(write_testvec(cgdfd, &aes_cbc_192_8_vectors[1]), -1); + CHECK_LIBC(write_testvec(cgdfd, &aes_cbc_192_8_vectors[2]), -1); + CHECK_LIBC(write_testvec(cgdfd, &aes_cbc_192_8_vectors[3]), -1); + + RL(unconfigure_cgd(cgdfd)); + RL(configure_cgd(cgdfd, dkpath, "aes-cbc", "encblkno8", + aes_cbc_192_key, sizeof(aes_cbc_192_key))); + + ATF_CHECK_EQ(read_testvec(cgdfd, &aes_cbc_192_8_vectors[0]), 0); + ATF_CHECK_EQ(read_testvec(cgdfd, &aes_cbc_192_8_vectors[1]), 0); + ATF_CHECK_EQ(read_testvec(cgdfd, &aes_cbc_192_8_vectors[2]), 0); + ATF_CHECK_EQ(read_testvec(cgdfd, &aes_cbc_192_8_vectors[3]), 0); + + RL(unconfigure_cgd(cgdfd)); + RL(rump_sys_close(cgdfd)); + + ATF_CHECK_EQ(check_testvec(dkfd, &aes_cbc_192_8_vectors[0]), 0); + ATF_CHECK_EQ(check_testvec(dkfd, &aes_cbc_192_8_vectors[1]), 0); + ATF_CHECK_EQ(check_testvec(dkfd, &aes_cbc_192_8_vectors[2]), 0); + ATF_CHECK_EQ(check_testvec(dkfd, &aes_cbc_192_8_vectors[3]), 0); + + RL(close(dkfd)); +} + +ATF_TC(cgd_aes_cbc_256_encblkno1); +ATF_TC_HEAD(cgd_aes_cbc_256_encblkno1, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Test aes-cbc with 256 bits key, ivmethod encblkno1"); +} + +ATF_TC_BODY(cgd_aes_cbc_256_encblkno1, tc) +{ + const char imgpath[] = "aes-cbc-256-encblkno1.img"; + const char *dkpath = "/dev/dk"; + const size_t dksize = 4 * SECSIZE; /* Last blkno is 3. */ + int dkfd, cgdfd; + + rump_init(); + + RL(dkfd = open_disk(dkpath, imgpath, dksize)); + + RL(cgdfd = open_cgd(0)); + RL(configure_cgd(cgdfd, dkpath, "aes-cbc", "encblkno1", + aes_cbc_256_key, sizeof(aes_cbc_256_key))); + + CHECK_LIBC(write_testvec(cgdfd, &aes_cbc_256_1_vectors[0]), -1); + CHECK_LIBC(write_testvec(cgdfd, &aes_cbc_256_1_vectors[1]), -1); + CHECK_LIBC(write_testvec(cgdfd, &aes_cbc_256_1_vectors[2]), -1); + CHECK_LIBC(write_testvec(cgdfd, &aes_cbc_256_1_vectors[3]), -1); + + RL(unconfigure_cgd(cgdfd)); + RL(configure_cgd(cgdfd, dkpath, "aes-cbc", "encblkno1", + aes_cbc_256_key, sizeof(aes_cbc_256_key))); + + ATF_CHECK_EQ(read_testvec(cgdfd, &aes_cbc_256_1_vectors[0]), 0); + ATF_CHECK_EQ(read_testvec(cgdfd, &aes_cbc_256_1_vectors[1]), 0); + ATF_CHECK_EQ(read_testvec(cgdfd, &aes_cbc_256_1_vectors[2]), 0); + ATF_CHECK_EQ(read_testvec(cgdfd, &aes_cbc_256_1_vectors[3]), 0); + + RL(unconfigure_cgd(cgdfd)); + RL(rump_sys_close(cgdfd)); + + ATF_CHECK_EQ(check_testvec(dkfd, &aes_cbc_256_1_vectors[0]), 0); + ATF_CHECK_EQ(check_testvec(dkfd, &aes_cbc_256_1_vectors[1]), 0); + ATF_CHECK_EQ(check_testvec(dkfd, &aes_cbc_256_1_vectors[2]), 0); + ATF_CHECK_EQ(check_testvec(dkfd, &aes_cbc_256_1_vectors[3]), 0); + + RL(close(dkfd)); +} + +ATF_TC(cgd_aes_cbc_256_encblkno8); +ATF_TC_HEAD(cgd_aes_cbc_256_encblkno8, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Test aes-cbc with 256 bits key, ivmethod encblkno8"); +} + +ATF_TC_BODY(cgd_aes_cbc_256_encblkno8, tc) +{ + const char imgpath[] = "aes-cbc-256-encblkno8.img"; + const char *dkpath = "/dev/dk"; + const size_t dksize = 4 * SECSIZE; /* Last blkno is 3. */ + int dkfd, cgdfd; + + rump_init(); + + RL(dkfd = open_disk(dkpath, imgpath, dksize)); + + RL(cgdfd = open_cgd(0)); + RL(configure_cgd(cgdfd, dkpath, "aes-cbc", "encblkno8", + aes_cbc_256_key, sizeof(aes_cbc_256_key))); + + CHECK_LIBC(write_testvec(cgdfd, &aes_cbc_256_8_vectors[0]), -1); + CHECK_LIBC(write_testvec(cgdfd, &aes_cbc_256_8_vectors[1]), -1); + CHECK_LIBC(write_testvec(cgdfd, &aes_cbc_256_8_vectors[2]), -1); + CHECK_LIBC(write_testvec(cgdfd, &aes_cbc_256_8_vectors[3]), -1); + + RL(unconfigure_cgd(cgdfd)); + RL(configure_cgd(cgdfd, dkpath, "aes-cbc", "encblkno8", + aes_cbc_256_key, sizeof(aes_cbc_256_key))); + + ATF_CHECK_EQ(read_testvec(cgdfd, &aes_cbc_256_8_vectors[0]), 0); + ATF_CHECK_EQ(read_testvec(cgdfd, &aes_cbc_256_8_vectors[1]), 0); + ATF_CHECK_EQ(read_testvec(cgdfd, &aes_cbc_256_8_vectors[2]), 0); + ATF_CHECK_EQ(read_testvec(cgdfd, &aes_cbc_256_8_vectors[3]), 0); + + RL(unconfigure_cgd(cgdfd)); + RL(rump_sys_close(cgdfd)); + + ATF_CHECK_EQ(check_testvec(dkfd, &aes_cbc_256_8_vectors[0]), 0); + ATF_CHECK_EQ(check_testvec(dkfd, &aes_cbc_256_8_vectors[1]), 0); + ATF_CHECK_EQ(check_testvec(dkfd, &aes_cbc_256_8_vectors[2]), 0); + ATF_CHECK_EQ(check_testvec(dkfd, &aes_cbc_256_8_vectors[3]), 0); + + RL(close(dkfd)); +} + +ATF_TC(cgd_aes_xts_256); +ATF_TC_HEAD(cgd_aes_xts_256, tc) +{ + atf_tc_set_md_var(tc, "descr", "Test aes-xts with 256 bits key"); +} + +ATF_TC_BODY(cgd_aes_xts_256, tc) +{ + const char imgpath[] = "aes-xts-256.img"; + const char *dkpath = "/dev/dk"; + const size_t dksize = 256 * SECSIZE; /* Last blkno is 0xff. */ + int dkfd, cgdfd; + + rump_init(); + + RL(dkfd = open_disk(dkpath, imgpath, dksize)); + + RL(cgdfd = open_cgd(0)); + RL(configure_cgd(cgdfd, dkpath, "aes-xts", "encblkno1", + aes_xts_256_key, sizeof(aes_xts_256_key))); + + CHECK_LIBC(write_testvec(cgdfd, &aes_xts_256_vectors[0]), -1); + CHECK_LIBC(write_testvec(cgdfd, &aes_xts_256_vectors[1]), -1); + CHECK_LIBC(write_testvec(cgdfd, &aes_xts_256_vectors[2]), -1); + CHECK_LIBC(write_testvec(cgdfd, &aes_xts_256_vectors[3]), -1); + CHECK_LIBC(write_testvec(cgdfd, &aes_xts_256_vectors[4]), -1); + CHECK_LIBC(write_testvec(cgdfd, &aes_xts_256_vectors[5]), -1); + + RL(unconfigure_cgd(cgdfd)); + RL(configure_cgd(cgdfd, dkpath, "aes-xts", "encblkno1", + aes_xts_256_key, sizeof(aes_xts_256_key))); + + ATF_CHECK_EQ(read_testvec(cgdfd, &aes_xts_256_vectors[0]), 0); + ATF_CHECK_EQ(read_testvec(cgdfd, &aes_xts_256_vectors[1]), 0); + ATF_CHECK_EQ(read_testvec(cgdfd, &aes_xts_256_vectors[2]), 0); + ATF_CHECK_EQ(read_testvec(cgdfd, &aes_xts_256_vectors[3]), 0); + ATF_CHECK_EQ(read_testvec(cgdfd, &aes_xts_256_vectors[4]), 0); + ATF_CHECK_EQ(read_testvec(cgdfd, &aes_xts_256_vectors[5]), 0); + + RL(unconfigure_cgd(cgdfd)); + RL(rump_sys_close(cgdfd)); + + ATF_CHECK_EQ(check_testvec(dkfd, &aes_xts_256_vectors[0]), 0); + ATF_CHECK_EQ(check_testvec(dkfd, &aes_xts_256_vectors[1]), 0); + ATF_CHECK_EQ(check_testvec(dkfd, &aes_xts_256_vectors[2]), 0); + ATF_CHECK_EQ(check_testvec(dkfd, &aes_xts_256_vectors[3]), 0); + ATF_CHECK_EQ(check_testvec(dkfd, &aes_xts_256_vectors[4]), 0); + ATF_CHECK_EQ(check_testvec(dkfd, &aes_xts_256_vectors[5]), 0); + + RL(close(dkfd)); +} + +ATF_TC(cgd_aes_xts_512); +ATF_TC_HEAD(cgd_aes_xts_512, tc) +{ + atf_tc_set_md_var(tc, "descr", "Test aes-xts with 512 bits key"); +} + +ATF_TC_BODY(cgd_aes_xts_512, tc) +{ + const char imgpath[] = "aes-xts-512.img"; + const char *dkpath = "/dev/dk"; + const size_t dksize = 65536 * SECSIZE; /* Last blkno is 0xffff. */ + int dkfd, cgdfd; + + rump_init(); + + RL(dkfd = open_disk(dkpath, imgpath, dksize)); + + RL(cgdfd = open_cgd(0)); + RL(configure_cgd(cgdfd, dkpath, "aes-xts", "encblkno1", + aes_xts_512_key, sizeof(aes_xts_512_key))); + + CHECK_LIBC(write_testvec(cgdfd, &aes_xts_512_vectors[0]), -1); + CHECK_LIBC(write_testvec(cgdfd, &aes_xts_512_vectors[1]), -1); + + RL(unconfigure_cgd(cgdfd)); + RL(configure_cgd(cgdfd, dkpath, "aes-xts", "encblkno1", + aes_xts_512_key, sizeof(aes_xts_512_key))); + + ATF_CHECK_EQ(read_testvec(cgdfd, &aes_xts_512_vectors[0]), 0); + ATF_CHECK_EQ(read_testvec(cgdfd, &aes_xts_512_vectors[1]), 0); + + RL(unconfigure_cgd(cgdfd)); + RL(rump_sys_close(cgdfd)); + + ATF_CHECK_EQ(check_testvec(dkfd, &aes_xts_512_vectors[0]), 0); + ATF_CHECK_EQ(check_testvec(dkfd, &aes_xts_512_vectors[1]), 0); + + RL(close(dkfd)); +} + +ATF_TP_ADD_TCS(tp) +{ + + ATF_TP_ADD_TC(tp, cgd_aes_cbc_128_encblkno1); + ATF_TP_ADD_TC(tp, cgd_aes_cbc_128_encblkno8); + ATF_TP_ADD_TC(tp, cgd_aes_cbc_192_encblkno1); + ATF_TP_ADD_TC(tp, cgd_aes_cbc_192_encblkno8); + ATF_TP_ADD_TC(tp, cgd_aes_cbc_256_encblkno1); + ATF_TP_ADD_TC(tp, cgd_aes_cbc_256_encblkno8); + ATF_TP_ADD_TC(tp, cgd_aes_xts_256); + ATF_TP_ADD_TC(tp, cgd_aes_xts_512); + + return atf_no_error(); +} diff --git a/contrib/netbsd-tests/dev/cgd/t_cgd_blowfish.c b/contrib/netbsd-tests/dev/cgd/t_cgd_blowfish.c new file mode 100644 index 000000000000..958ebaccf6ad --- /dev/null +++ b/contrib/netbsd-tests/dev/cgd/t_cgd_blowfish.c @@ -0,0 +1,2341 @@ +/* $NetBSD: t_cgd_blowfish.c,v 1.1 2016/11/10 23:44:36 alnsn Exp $ */ +/*- + * Copyright (c) 2016 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Alexander Nasonov. + * + * 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 COPYRIGHT HOLDERS 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 + * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include + +#include "../../h_macros.h" + +#define SECSIZE 512 + +struct testvec { + unsigned int blkno; + const uint8_t *ptxt; /* PlainText */ + const uint8_t *ctxt; /* CipherText */ +}; + +/* + * 128 bits Blowfish key, NUL terminated. + */ +static const char bf_cbc_128_key[17] = { + 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, /* 01234567 */ + 0x38, 0x39, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, /* 89ABCDEF */ + 0 +}; + +/* + * 256 bits Blowfish key, NUL terminated. + */ +static const char bf_cbc_256_key[33] = { + 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, /* 01234567 */ + 0x38, 0x39, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, /* 89ABCDEF */ + 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, /* 01234567 */ + 0x38, 0x39, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, /* 89abcdef */ + 0 +}; + +/* + * 448 bits Blowfish key, NUL terminated. + */ +static const char bf_cbc_448_key[57] = { + 0x3a, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, /* :ABCDEFG */ + 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, /* HIJKLMNO */ + 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, /* PQRSTUVW */ + 0x58, 0x59, 0x5a, 0x7e, 0x3a, 0x61, 0x62, 0x63, /* XYZ~:abc */ + 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, /* defghijk */ + 0x6c, 0x6d, 0x6e, 0x6f, 0x70, 0x71, 0x72, 0x73, /* lmnopqrs */ + 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7a, 0x23, /* tuvwxyz# */ + 0 +}; + +static const uint8_t bf_cbc_ptxt[SECSIZE] = + " abcdefghijklmnop" + " abcdefghijklmnop" + " abcdefghijklmnop" + " abcdefghijklmnop" + " abcdefghijklmnop" + " abcdefghijklmnop" + " abcdefghijklmnop" + " abcdefghijklmnop" + " abcdefghijklmnop" + " abcdefghijklmnop" + " abcdefghijklmnop" + " abcdefghijklmnop" + " abcdefghijklmnop" + " abcdefghijklmnop" + " abcdefghijklmnop" + " abcdefghijklmnop"; + +/* + * IV method encblkno1, blkno 0. + */ +static const uint8_t bf_cbc_128_encblkno1_vec0_ctxt[SECSIZE] = { + 0x78, 0x53, 0x43, 0x2a, 0x08, 0xe7, 0x84, 0x3f, + 0xb7, 0x61, 0x9c, 0x17, 0x81, 0xbe, 0x38, 0xb9, + 0x65, 0x51, 0x68, 0xa2, 0x29, 0xd7, 0x45, 0xc9, + 0xee, 0x0e, 0x9d, 0xe1, 0x69, 0xc6, 0x81, 0x81, + 0xf3, 0x93, 0xa6, 0x62, 0xc9, 0x05, 0x2c, 0x1b, + 0x0e, 0x05, 0xca, 0xbe, 0x12, 0x25, 0x37, 0xd8, + 0x98, 0x66, 0xa2, 0xd3, 0xd0, 0x8a, 0x89, 0x57, + 0x44, 0x91, 0x1e, 0xe9, 0x07, 0x03, 0x5c, 0xa6, + 0xb8, 0x30, 0xf1, 0xc7, 0x8c, 0x66, 0x05, 0xb0, + 0x2d, 0xc3, 0xc3, 0xd7, 0x60, 0xef, 0x62, 0xd3, + 0x34, 0x9c, 0xa9, 0xd2, 0x0c, 0x1a, 0x9c, 0xfe, + 0x74, 0x92, 0xcb, 0x90, 0x80, 0xfa, 0x71, 0x5c, + 0xaa, 0x29, 0x39, 0xdd, 0x3b, 0x62, 0xa1, 0xfc, + 0xa5, 0x35, 0xcd, 0xa3, 0x29, 0x41, 0x1a, 0x03, + 0xf7, 0xe1, 0x36, 0xb2, 0xdc, 0x1a, 0xb3, 0x9f, + 0x46, 0xa3, 0xf7, 0xc3, 0xd1, 0x29, 0x83, 0xcf, + 0x0d, 0x88, 0x0b, 0xd1, 0xb7, 0xc7, 0x87, 0x21, + 0xb7, 0x1f, 0xe7, 0xa2, 0x8e, 0x5f, 0xac, 0x6b, + 0x49, 0x9c, 0x93, 0x6b, 0x6b, 0x05, 0x8e, 0x4c, + 0xbd, 0x31, 0x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0x6b, 0xd7, + 0x5c, 0xfd, 0x32, 0x6c, 0x98, 0x05, 0x38, 0x0d, + 0x29, 0xb5, 0x5a, 0x5b, 0xbb, 0xad, 0xfd, 0x46, + 0x9b, 0x6a, 0x97, 0x4c, 0x24, 0xcc, 0x7d, 0x13, + 0x25, 0xe8, 0x2c, 0xb9, 0x13, 0x54, 0xb2, 0x8a, + 0x28, 0xa0, 0x8a, 0x3a, 0x4d, 0x7e, 0xf4, 0x29, + 0xff, 0xfb, 0x4f, 0xd6, 0x3d, 0xf7, 0xca, 0x89, + 0x2a, 0x58, 0x9e, 0x42, 0x00, 0x84, 0x61, 0x58, + 0x7c, 0x94, 0xf6, 0x50, 0x48, 0x2f, 0x34, 0x88, + 0xec, 0x97, 0xef, 0x8b, 0x2f, 0x84, 0xca, 0x23, + 0xe1, 0xb7, 0x63, 0x99, 0xdd, 0x4a, 0x76, 0xdd, + 0x20, 0xc1, 0xc2, 0x56, 0x45, 0xbe, 0x75, 0x9a, + 0x40, 0x72, 0xc8, 0xfb, 0x7e, 0x40, 0x6f, 0x38, + 0xfd, 0x76, 0xa4, 0x78, 0xf5, 0xde, 0x5f, 0xb7, + 0x4a, 0xa9, 0xaf, 0xad, 0xa1, 0x8b, 0x25, 0x8f, + 0xea, 0xb3, 0xeb, 0x54, 0x39, 0x5a, 0x91, 0xfe, + 0x86, 0x18, 0xea, 0x8c, 0xd6, 0x66, 0xd5, 0x85, + 0x02, 0x2b, 0x00, 0x5d, 0x7e, 0x13, 0xa0, 0x1f, + 0x73, 0x46, 0x6d, 0x5e, 0xcd, 0xe0, 0x82, 0x02, + 0x28, 0x88, 0xbf, 0x17, 0xfd, 0x9b, 0x83, 0x2c, + 0xa2, 0xf7, 0xde, 0x51, 0x98, 0x3f, 0xe2, 0x80, + 0x66, 0x14, 0x17, 0xce, 0x8e, 0x30, 0x2d, 0xe2, + 0x24, 0x68, 0x4b, 0xe5, 0xd1, 0x09, 0xfb, 0x6e, +}; + +/* + * IV method encblkno1, blkno 1. + */ +static const uint8_t bf_cbc_128_encblkno1_vec1_ctxt[SECSIZE] = { + 0x87, 0xae, 0x01, 0x52, 0xe8, 0xe9, 0xd9, 0xba, + 0xa9, 0x18, 0x31, 0x2c, 0x1b, 0xab, 0x57, 0xad, + 0x45, 0x0e, 0x25, 0x5e, 0x0e, 0x04, 0xfa, 0xdd, + 0xf1, 0x59, 0xe6, 0xea, 0x78, 0x4b, 0x83, 0x07, + 0x8b, 0x46, 0x91, 0x09, 0x58, 0x5a, 0x11, 0x2e, + 0x54, 0x43, 0xa4, 0xc1, 0x04, 0x35, 0xd3, 0x3e, + 0xc9, 0xc8, 0xf5, 0xff, 0x69, 0x1e, 0x57, 0x85, + 0x6d, 0x91, 0x03, 0xeb, 0x8c, 0xa7, 0xe8, 0xcc, + 0x3f, 0xac, 0xf9, 0x14, 0x1e, 0x88, 0x50, 0xa5, + 0x38, 0x66, 0xa9, 0xf4, 0xf5, 0xc6, 0x30, 0x95, + 0xd6, 0x84, 0x0b, 0x81, 0xf9, 0x51, 0x05, 0x80, + 0x9a, 0x89, 0xbf, 0xd4, 0x7d, 0x6a, 0x26, 0x59, + 0x29, 0x44, 0xe7, 0x1d, 0x0e, 0xad, 0x8c, 0xa0, + 0x93, 0xe9, 0x4b, 0x4b, 0x51, 0x46, 0xa5, 0x07, + 0xe8, 0xcb, 0x59, 0xf4, 0x63, 0xb5, 0x36, 0xdb, + 0xbc, 0x54, 0x2d, 0xec, 0xf0, 0x90, 0x3a, 0xa5, + 0xed, 0xc8, 0x28, 0x0e, 0xd3, 0x79, 0xb8, 0x57, + 0xc6, 0x7f, 0x02, 0x22, 0x5e, 0x80, 0xe8, 0x7f, + 0xdf, 0xa0, 0x0f, 0xbc, 0x98, 0x79, 0x6f, 0xd2, + 0xb0, 0xb2, 0x4f, 0x9b, 0x1a, 0x21, 0x8f, 0x63, + 0xce, 0x54, 0x41, 0x64, 0xbf, 0xb9, 0xa7, 0x93, + 0xd6, 0x5b, 0x89, 0x86, 0xda, 0x90, 0x23, 0x2e, + 0x25, 0x35, 0x1a, 0x9a, 0xf5, 0x1e, 0x8f, 0xb4, + 0xe6, 0x66, 0x8e, 0x0e, 0x2d, 0x91, 0x06, 0x4b, + 0x3d, 0x4a, 0x97, 0xab, 0x9b, 0x92, 0x09, 0xaa, + 0x07, 0xbf, 0xc1, 0x7d, 0xe2, 0xbc, 0xd2, 0xf1, + 0x38, 0x8d, 0x02, 0x45, 0xc8, 0x13, 0x12, 0xda, + 0xaa, 0x53, 0xa2, 0x2c, 0x96, 0x69, 0x64, 0xce, + 0x86, 0xe4, 0x84, 0x56, 0xd0, 0xe5, 0x81, 0x99, + 0x27, 0xad, 0x86, 0x47, 0x5f, 0xaf, 0xa2, 0xa2, + 0x90, 0x7f, 0xe7, 0x86, 0xec, 0x7f, 0xf4, 0xa3, + 0xcd, 0x4f, 0x60, 0xcc, 0x1e, 0x35, 0x44, 0xe8, + 0xe9, 0x06, 0xaf, 0x5e, 0x53, 0x3d, 0x30, 0x91, + 0xfe, 0x44, 0x59, 0x66, 0x82, 0xc2, 0xea, 0x9f, + 0xc8, 0x3b, 0xe2, 0xe5, 0x58, 0xf7, 0x34, 0xd5, + 0x9e, 0xfc, 0x20, 0x84, 0x34, 0xaa, 0x4f, 0xe1, + 0xd4, 0x95, 0x76, 0x11, 0x59, 0x90, 0x90, 0xfd, + 0x4d, 0xf9, 0xb8, 0x41, 0xe1, 0xdb, 0x36, 0x05, + 0xe3, 0x0f, 0xa4, 0x4f, 0x0c, 0x61, 0x70, 0xa5, + 0x1b, 0xbf, 0xab, 0x65, 0x67, 0x75, 0x5c, 0x7d, + 0x46, 0x3b, 0x29, 0xd0, 0x3d, 0x06, 0x40, 0x25, + 0x47, 0x3e, 0x8d, 0x62, 0xf8, 0xd8, 0x08, 0xc1, + 0x03, 0x04, 0x4b, 0x5a, 0x40, 0x65, 0x84, 0x52, + 0x34, 0xa2, 0x4a, 0xcc, 0x3a, 0x9c, 0x1e, 0xbf, + 0x2d, 0xed, 0x08, 0x8b, 0xc3, 0x8f, 0x48, 0xba, + 0x06, 0x03, 0xea, 0x5b, 0xba, 0x6a, 0xac, 0x23, + 0x5a, 0x5e, 0x31, 0x08, 0x29, 0x69, 0x64, 0x44, + 0x1c, 0x31, 0xae, 0xb1, 0x86, 0x7b, 0x26, 0x89, + 0xa6, 0xbe, 0xef, 0x69, 0x81, 0xf7, 0x77, 0xd5, + 0x8e, 0x78, 0xa5, 0x11, 0x51, 0xca, 0xec, 0xd0, + 0x86, 0xa5, 0x33, 0xf3, 0x65, 0x5d, 0x04, 0xc5, + 0xd2, 0x17, 0x2a, 0xfe, 0x4a, 0x58, 0x0f, 0x98, + 0x61, 0xad, 0xc3, 0xb8, 0x5b, 0x45, 0xcc, 0x28, + 0x3d, 0x4d, 0x00, 0xf5, 0x4a, 0xe2, 0xbc, 0x6c, + 0x1b, 0x80, 0x7a, 0x2b, 0x40, 0xb8, 0x34, 0x0e, + 0x44, 0x53, 0x16, 0xda, 0x7c, 0x46, 0x8b, 0x42, + 0x5e, 0xa8, 0xe1, 0xb8, 0xf8, 0xcf, 0xff, 0x48, + 0xcf, 0x2c, 0x4c, 0x98, 0xdb, 0xe5, 0x55, 0xfe, + 0x45, 0xfa, 0xf8, 0xde, 0x72, 0xf9, 0x84, 0x3c, + 0xc0, 0x0c, 0x1f, 0x86, 0x97, 0x86, 0xb8, 0xfe, + 0x7d, 0xff, 0xa3, 0xaf, 0x68, 0x00, 0x66, 0x90, + 0xac, 0xb5, 0xd8, 0xde, 0x35, 0x01, 0xf7, 0xab, + 0xab, 0xe3, 0xe9, 0x85, 0x4c, 0x6f, 0xe6, 0xbc, + 0xce, 0x67, 0x4a, 0xbd, 0xad, 0x7b, 0xec, 0xa1, +}; + +/* + * IV method encblkno1, blkno 2. + */ +static const uint8_t bf_cbc_128_encblkno1_vec2_ctxt[SECSIZE] = { + 0x17, 0xdd, 0x0f, 0x4b, 0x28, 0x33, 0x03, 0x89, + 0x21, 0x7b, 0x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, 0x1d, 0xbd, + 0x28, 0x5d, 0x1e, 0x15, 0x28, 0x80, 0x8c, 0x29, + 0x34, 0x96, 0x31, 0xda, 0xe1, 0x19, 0x88, 0xd5, + 0xe0, 0xc8, 0xb4, 0xaa, 0x04, 0x21, 0xf5, 0xef, + 0xfa, 0x0e, 0xc9, 0xa5, 0x88, 0x77, 0x49, 0xf4, + 0x02, 0x22, 0x0b, 0x8b, 0x5e, 0xe1, 0xab, 0xd4, + 0xb1, 0xb6, 0x48, 0x54, 0x96, 0x08, 0xaf, 0xa1, + 0x0b, 0xc0, 0xfe, 0x2a, 0x12, 0x36, 0x56, 0x85, + 0x6a, 0xf7, 0x3d, 0x82, 0xe6, 0xda, 0x5d, 0xfe, + 0x4f, 0x4f, 0xc9, 0x43, 0xdc, 0x0f, 0x53, 0x05, + 0x09, 0xd4, 0x9c, 0x2e, 0x6e, 0xf3, 0x52, 0x6a, + 0x10, 0xc6, 0x48, 0xb1, 0x54, 0x70, 0xab, 0x7c, + 0x31, 0xf6, 0x47, 0xef, 0x64, 0x5f, 0xff, 0x45, + 0x8c, 0x3f, 0x87, 0x3a, 0x2d, 0xa6, 0xaf, 0xb2, + 0x44, 0xdf, 0x80, 0x2e, 0x89, 0x4c, 0x94, 0x67, + 0xfc, 0x20, 0x98, 0xb4, 0xcf, 0x58, 0x1e, 0x33, + 0x55, 0x6a, 0x7c, 0x67, 0x5c, 0x28, 0x2f, 0x19, + 0x02, 0x14, 0x06, 0x93, 0x8c, 0x84, 0xae, 0x62, + 0x14, 0xf9, 0x87, 0xae, 0x85, 0xa3, 0x60, 0x26, + 0xfc, 0x8d, 0x04, 0x92, 0x27, 0xfe, 0x35, 0x7b, + 0x45, 0x9d, 0x4a, 0x86, 0x75, 0xa6, 0xb3, 0xa1, + 0x59, 0xe4, 0x4b, 0x1c, 0xd2, 0x71, 0x36, 0xfe, + 0x73, 0xed, 0x54, 0x0d, 0x9d, 0xde, 0x63, 0xb2, + 0xc0, 0x7c, 0xf2, 0xb3, 0x36, 0x62, 0x06, 0x1f, + 0xcd, 0x41, 0x92, 0x73, 0xbc, 0x11, 0x68, 0xc9, + 0x69, 0x20, 0xf9, 0xbb, 0x9a, 0xe9, 0x6c, 0x05, + 0xcf, 0x01, 0x57, 0xc4, 0x1d, 0x95, 0x5e, 0xe3, + 0xb7, 0x15, 0xde, 0xa7, 0xb5, 0x1a, 0x4e, 0x78, + 0x44, 0x5b, 0x9a, 0xee, 0x29, 0xe2, 0x22, 0x8b, + 0xe9, 0xe3, 0xe6, 0x70, 0x3e, 0xcb, 0x9f, 0x7f, + 0xc3, 0xd0, 0x2c, 0xdc, 0x55, 0xb4, 0x0d, 0x67, + 0xf5, 0xd8, 0xff, 0xbb, 0xb1, 0x02, 0xbf, 0xf6, + 0x33, 0x4e, 0x7a, 0x3a, 0x50, 0xb1, 0x01, 0x77, + 0x51, 0xef, 0xb5, 0x75, 0xb3, 0x66, 0xe8, 0xe6, + 0xd6, 0x53, 0x7d, 0x33, 0x51, 0x62, 0x5d, 0xf2, + 0x77, 0x02, 0x34, 0x42, 0xda, 0xee, 0xd9, 0xee, + 0x0b, 0x4d, 0x71, 0x5c, 0xc0, 0xec, 0xdd, 0xc0, + 0x34, 0x6f, 0xf4, 0x65, 0x32, 0xde, 0xc5, 0xb2, + 0x97, 0x60, 0x89, 0x4e, 0x3b, 0x0c, 0xf2, 0xa7, + 0x74, 0x61, 0xd7, 0xe4, 0xa6, 0x80, 0x78, 0x76, + 0xe5, 0x7d, 0xab, 0x96, 0x04, 0x00, 0x76, 0x22, +}; + +/* + * IV method encblkno1, blkno 3. + */ +static const uint8_t bf_cbc_128_encblkno1_vec3_ctxt[SECSIZE] = { + 0xdd, 0x8e, 0xce, 0x5b, 0xb8, 0x2a, 0xc8, 0x0e, + 0xd2, 0xbe, 0xcf, 0xa7, 0x2a, 0x5b, 0x0c, 0x1a, + 0xb2, 0x68, 0x5b, 0xe7, 0x53, 0xaf, 0xce, 0x56, + 0xfd, 0xbd, 0x73,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e, 0x56, 0x55, + 0xdf, 0x06, 0x76, 0xe0, 0x7b, 0xd0, 0x52, 0x54, + 0x38, 0xb0, 0xaa, 0xab, 0x62, 0x31, 0xd1, 0x79, + 0x19, 0xec, 0x82, 0x36, 0x58, 0x31, 0xf9, 0x01, + 0xf9, 0x5e, 0xaf, 0x24, 0xb3, 0xc9, 0xb2, 0x30, + 0x3d, 0xbc, 0xf1, 0xbe, 0x17, 0xeb, 0xa0, 0x31, + 0x43, 0xed, 0xd7, 0x50, 0xcc, 0xc2, 0xe2, 0xaa, + 0x68, 0xc8, 0xf0, 0xd3, 0x89, 0xbd, 0xf5, 0x69, + 0x56, 0xe3, 0x88, 0x92, 0x32, 0x56, 0x85, 0x6f, + 0x25, 0x30, 0x28, 0x37, 0xd5, 0xe2, 0xa6, 0xf7, + 0x6e, 0xa9, 0x71, 0xda, 0x4a, 0x25, 0x94, 0x0b, + 0x84, 0x7f, 0x1f, 0x6b, 0x89, 0x2a, 0xf8, 0x30, + 0xcb, 0x60, 0x75, 0x21, 0xbd, 0xe2, 0x34, 0xf7, + 0x8f, 0x30, 0xd5, 0xd5, 0x1f, 0x17, 0x0d, 0x00, + 0x6c, 0x50, 0xde, 0x56, 0x15, 0x33, 0x1b, 0x83, + 0x68, 0x7b, 0x24, 0xe3, 0xa0, 0xda, 0xd5, 0x7a, + 0x3e, 0x93, 0x6d, 0xe0, 0x02, 0x79, 0x62, 0x5d, + 0x71, 0xe3, 0x7b, 0xa9, 0x0b, 0x7a, 0xcd, 0xb3, + 0xb2, 0x6f, 0x96, 0x19, 0x8f, 0xf8, 0x8b, 0x26, + 0x7a, 0x40, 0xc8, 0xae, 0xfe, 0x0d, 0x6f, 0x67, + 0xce, 0x5e, 0xa0, 0x04, 0x7e, 0x93, 0x1d, 0x17, + 0x1c, 0x32, 0x82, 0xf4, 0x54, 0xb9, 0x80, 0xdd, + 0x82, 0xae, 0xf5, 0xc5, 0x1e, 0x15, 0xab, 0xc2, + 0x5c, 0x60, 0xd2, 0x08, 0xc2, 0xa1, 0x1f, 0x89, + 0x0b, 0x59, 0x36, 0x07, 0xdc, 0x57, 0xd3, 0xa0, + 0x32, 0x42, 0xac, 0xa6, 0x90, 0x0b, 0xc0, 0xe4, + 0x91, 0x45, 0x85, 0x27, 0xb9, 0x48, 0x2a, 0x88, + 0x0a, 0xbf, 0xf6, 0x2d, 0xef, 0x4d, 0x1b, 0x64, + 0x49, 0x23, 0x47, 0x30, 0x29, 0x25, 0xb2, 0xc9, + 0xaf, 0xcd, 0xae, 0x56, 0x43, 0x28, 0xcf, 0x81, + 0x95, 0xa7, 0x3e, 0x51, 0x5b, 0x3b, 0xf7, 0x87, + 0x13, 0xc6, 0xee, 0x50, 0x2f, 0x78, 0xdd, 0xcf, + 0x63, 0xef, 0x15, 0xb9, 0x4f, 0x21, 0x27, 0x5e, + 0x94, 0x78, 0xad, 0xcd, 0x9b, 0x3d, 0xf2, 0xdb, + 0xed, 0xf2, 0xa2, 0x39, 0xca, 0xa3, 0xa8, 0x2e, + 0x68, 0xd5, 0xc3, 0xcf, 0x71, 0xec, 0x92, 0xdc, + 0xce, 0xe7, 0x7d, 0x2b, 0xf7, 0xbc, 0xe9, 0x2b, + 0x2e, 0xae, 0xaf, 0x0b, 0x92, 0x72, 0xac, 0x6e, + 0x49, 0xe1, 0xb3, 0x1f, 0xe5, 0x43, 0x2f, 0xa7, +}; + +const struct testvec bf_cbc_128_1_vectors[] = { + { + .blkno = 0, + .ptxt = bf_cbc_ptxt, + .ctxt = bf_cbc_128_encblkno1_vec0_ctxt, + }, + { + .blkno = 1, + .ptxt = bf_cbc_ptxt, + .ctxt = bf_cbc_128_encblkno1_vec1_ctxt, + }, + { + .blkno = 2, + .ptxt = bf_cbc_ptxt, + .ctxt = bf_cbc_128_encblkno1_vec2_ctxt, + }, + { + .blkno = 3, + .ptxt = bf_cbc_ptxt, + .ctxt = bf_cbc_128_encblkno1_vec3_ctxt, + }, +}; + +/* + * IV method encblkno8, blkno 0. + */ +static const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1, 0x8c, 0xe4, 0x72, 0x05, + 0xb0, 0xfc, 0xb0, 0xf7, 0xfe, 0xf9, 0x3e, 0xa3, + 0xb9, 0xea, 0xc8, 0x69, 0xe3, 0x4e, 0x6d, 0xd1, + 0x8b, 0x2b, 0xf9, 0x2f, 0xd9, 0x40, 0x69, 0xff, + 0x90, 0x98, 0x7a, 0x82, 0xe3, 0x0d, 0x4e, 0x19, + 0x2f, 0x77, 0xf9, 0xab, 0x36, 0xa9, 0x4e, 0xbc, + 0x25, 0x32, 0xbd, 0x44, 0xea, 0x5a, 0x18, 0x31, + 0x37, 0xcd, 0x6c, 0x98, 0xdd, 0x1d, 0xf9, 0xf7, + 0x8f, 0x0b, 0x79, 0xbc, 0xe6, 0xf5, 0xf1, 0xa3, + 0x13, 0xe9, 0x39, 0xaf, 0xa4, 0x8a, 0x74, 0xae, + 0x60, 0x30, 0x63, 0x6e, 0xee, 0x97, 0x83, 0xee, + 0xc0, 0xdd, 0xde, 0xad, 0x92, 0x83, 0xc9, 0x3c, + 0xd8, 0x58, 0x6c, 0xcb, 0xe4, 0x29, 0x04, 0x69, + 0x4f, 0x45, 0xc2, 0x59, 0x98, 0x20, 0x91, 0x6e, + 0x95, 0x82, 0xb3, 0x47, 0x2c, 0xef, 0xdb, 0x96, + 0x38, 0xba, 0x01, 0x89, 0x84, 0x96, 0x71, 0xf9, + 0x2b, 0x23, 0xe0, 0x89, 0xb8, 0xb9, 0x80, 0xbf, + 0x0c, 0xdc, 0xf0, 0x5c, 0xd6, 0x4f, 0x18, 0x19, + 0xfe, 0x23, 0x5a, 0x1e, 0x20, 0x9a, 0x05, 0xf2, + 0x62, 0xd4, 0x04, 0x92, 0x24, 0xfc, 0xc0, 0x48, + 0xf0, 0x00, 0xb4, 0xbe, 0x2e, 0xea, 0x25, 0x17, + 0x5d, 0xab, 0x73, 0x26, 0x79, 0x77, 0xc5, 0x96, + 0xd3, 0xbf, 0x38, 0xda, 0x0f, 0xe1, 0x26, 0x9a, + 0x38, 0xfc, 0x43, 0x82, 0xd1, 0x4d, 0xf2, 0xae, + 0x98, 0x1e, 0xb0, 0x0d, 0xec, 0x7b, 0x56, 0x66, + 0xcb, 0x30, 0x57, 0x4f, 0xe7, 0x03, 0xe3, 0xa6, + 0x4a, 0x4a, 0xf9, 0xa3, 0xbf, 0x44, 0xac, 0x1a, + 0xe7, 0x4b, 0xc1, 0x5b, 0x03, 0x25, 0x4e, 0xc6, + 0x1f, 0x96, 0x4d, 0xf7, 0xbe, 0xa7, 0x5d, 0x60, + 0x20, 0x62, 0x10, 0xd7, 0xab, 0x64, 0xce, 0x22, + 0x8b, 0x52, 0x76, 0xa1, 0xa1, 0x8b, 0x1e, 0xb2, + 0x18, 0x29, 0x8f, 0xc5, 0x24, 0x39, 0xd4, 0xf8, + 0x75, 0x1e, 0x30, 0x57, 0x12, 0x01, 0x04, 0x78, + 0x68, 0x97, 0xa8, 0x65, 0x8c, 0xac, 0xb4, 0x3b, + 0x37, 0x45, 0x41, 0xbc, 0x7d, 0x4b, 0x09, 0xd7, + 0x46, 0x40, 0x99, 0x59, 0xa1, 0xb5, 0x9e, 0x84, + 0x24, 0x6d, 0xfb, 0x74, 0x22, 0xac, 0x4e, 0x5f, + 0x11, 0xd3, 0xa7, 0x9f, 0xa5, 0xca, 0x38, 0x54, + 0xe2, 0x65, 0x52, 0x02, 0x69, 0xe9, 0xa8, 0xf1, + 0xd7, 0x9d, 0x9a, 0x17, 0x54, 0xa0, 0xda, 0xbb, + 0x37, 0xb4, 0x0c, 0xb6, 0x00, 0xad, 0x6f, 0x88, + 0x84, 0xa7, 0x69, 0xd7, 0x0b, 0xbe, 0xb4, 0xbe, + 0x96, 0xbc, 0xcd, 0x08, 0xf1, 0x28, 0xe0, 0x6f, +}; + +/* + * IV method encblkno8, blkno 1. + */ +static const uint8_t bf_cbc_128_encblkno8_vec1_ctxt[SECSIZE] = { + 0x7d, 0x95, 0x5a, 0x66, 0x23, 0x98, 0xa8, 0xbe, + 0x53, 0x63, 0x0d, 0x46, 0x4e, 0x38, 0x1b, 0x1d, + 0x36, 0xdd, 0x2a, 0x57, 0x3c, 0x17, 0x01, 0xba, + 0x4e, 0xf8, 0xaa, 0x22, 0x74, 0x05, 0xa2, 0x40, + 0xd0, 0x30, 0x61, 0x6c, 0x65, 0x5e, 0xfb, 0x21, + 0x63, 0xef, 0x62, 0x01, 0x74, 0x15, 0xf6, 0x87, + 0x92, 0xc1, 0x4e, 0x46, 0xdd, 0x76, 0xdb, 0x8b, + 0x20, 0x44, 0xc4, 0xfa, 0x7c, 0xd2, 0x07, 0x32, + 0x11, 0xeb, 0x5b, 0x38, 0x44, 0x32, 0xa1, 0xe7, + 0xcb, 0xa6, 0x1a, 0x12, 0xb9, 0x53, 0x13, 0x6f, + 0xc2, 0x0e, 0x6a, 0x77, 0x8b, 0x96, 0x14, 0x0a, + 0x23, 0x48, 0x65, 0xa5, 0xcd, 0x39, 0x38, 0x03, + 0xc8, 0x3a, 0x98, 0x69, 0x3d, 0x14, 0xae, 0xad, + 0x54, 0x57, 0xf6, 0x5a, 0xdd, 0x46, 0x4c, 0x3a, + 0x68, 0xa8, 0xb7, 0x57, 0xdd, 0x1e, 0x66, 0x0e, + 0xc2, 0x4c, 0x17, 0xba, 0xa4, 0x7e, 0x83, 0x45, + 0xc6, 0xf2, 0x34, 0x3b, 0x4e, 0xab, 0x67, 0x0c, + 0x73, 0xbf, 0x87, 0x7e, 0x93, 0x2b, 0x14, 0x33, + 0xd6, 0x24, 0x8d, 0xc7, 0x90, 0x11, 0xd2, 0x38, + 0xe6, 0xe0, 0x39, 0x1f, 0x00, 0x74, 0x40, 0xab, + 0xdc, 0xdd, 0x46, 0xe8, 0x85, 0x14, 0xb1, 0x78, + 0x34, 0x24, 0x04, 0x97, 0xde, 0xf9, 0x04, 0x69, + 0x0b, 0x15, 0x72, 0x37, 0xf4, 0x0d, 0xf4, 0x76, + 0x6f, 0xd8, 0x05, 0x75, 0x8f, 0x7e, 0x6b, 0xca, + 0x55, 0x20, 0x4a, 0x29, 0x16, 0xc1, 0x6e, 0x91, + 0x22, 0x01, 0x0d, 0x39, 0x5d, 0xb9, 0x09, 0xa4, + 0xe8, 0xc7, 0xff, 0x60, 0x39, 0xc6, 0xe4, 0x2a, + 0x1c, 0xf2, 0x3c, 0xf7, 0xf9, 0xd7, 0xde, 0x0b, + 0x0e, 0x30, 0xf1, 0x20, 0x7c, 0x93, 0x2f, 0x74, + 0x72, 0x40, 0x47, 0x2d, 0xeb, 0x8a, 0x5f, 0x69, + 0x60, 0xdf, 0xe9, 0x4d, 0x06, 0x24, 0x9c, 0x79, + 0xe7, 0x61, 0xd3, 0xa7, 0x57, 0x44, 0x49, 0x97, + 0x3a, 0xa3, 0x11, 0xc4, 0x70, 0xf4, 0x3d, 0xb5, + 0x4b, 0xb7, 0xae, 0x77, 0x36, 0xcf, 0x65, 0x3e, + 0xb6, 0x51, 0x83, 0xcb, 0x43, 0x5f, 0xd0, 0xfb, + 0x69, 0xc4, 0x1b, 0x77, 0x71, 0xcc, 0x72, 0xf4, + 0x5f, 0xc2, 0xda, 0xea, 0xa4, 0x33, 0xec, 0x8e, + 0x92, 0x22, 0x6a, 0x55, 0x34, 0x6a, 0x10, 0xb8, + 0x62, 0x66, 0xc1, 0x6f, 0x65, 0xdd, 0x9a, 0x40, + 0xa0, 0xbf, 0x88, 0xbb, 0x79, 0x1c, 0xa4, 0xaa, + 0xdf, 0xe8, 0xe7, 0x40, 0x88, 0xc6, 0x0f, 0xa2, + 0x2c, 0xee, 0xe7, 0x41, 0x32, 0x46, 0xa2, 0x46, + 0x85, 0xbf, 0x4c, 0xca, 0x4d, 0xd3, 0x9b, 0x49, + 0x43, 0x98, 0xae, 0xfc, 0x93, 0xa7, 0x94, 0x98, + 0x86, 0xa1, 0x0a, 0x85, 0x77, 0x67, 0xa6, 0x16, + 0x94, 0x76, 0xe5, 0x2f, 0x88, 0x5f, 0x24, 0x16, + 0xe5, 0x84, 0x4c, 0xd2, 0x58, 0x59, 0x82, 0x59, + 0x2c, 0xe2, 0x8d, 0xba, 0x08, 0x01, 0x67, 0x1f, + 0x2a, 0x9e, 0x4d, 0x53, 0x57, 0x2d, 0x6e, 0x35, + 0x38, 0xd5, 0x50, 0xa7, 0x0c, 0xe6, 0x77, 0x71, + 0xbe, 0x45, 0x2e, 0xf4, 0x7a, 0x3a, 0x51, 0x03, + 0x04, 0x2b, 0xd7, 0x42, 0x6c, 0x5b, 0x82, 0xba, + 0xb4, 0x09, 0xee, 0x9d, 0xea, 0x8f, 0xf0, 0xb3, + 0xb2, 0x9d, 0x0e, 0x09, 0x72, 0x8c, 0xd9, 0x1e, + 0x6d, 0x78, 0x57, 0x10, 0x1f, 0xeb, 0x4e, 0x53, + 0x57, 0x65, 0xe5, 0x43, 0xe8, 0xb4, 0xb6, 0xb8, + 0x25, 0x8a, 0xe2, 0xb3, 0x99, 0x95, 0x2c, 0xd0, + 0xc7, 0x89, 0xad, 0xdb, 0x72, 0xf0, 0x83, 0xe3, + 0x2f, 0x30, 0x33, 0xf4, 0x03, 0x14, 0x86, 0xa0, + 0xe0, 0x57, 0x15, 0x53, 0x26, 0xd0, 0x6d, 0x12, + 0x51, 0x96, 0x9b, 0x00, 0x8e, 0x41, 0xea, 0x05, + 0x75, 0x5d, 0xb3, 0x8d, 0x44, 0x7f, 0x41, 0x7f, + 0xd1, 0xed, 0x7c, 0xf7, 0xac, 0x6b, 0x21, 0xc7, + 0x0c, 0x49, 0xa1, 0x2e, 0x57, 0xa1, 0x21, 0xe2, +}; + +/* + * IV method encblkno8, blkno 2. + */ +static const uint8_t bf_cbc_128_encblkno8_vec2_ctxt[SECSIZE] = { + 0x28, 0x0c, 0x49, 0x08, 0x84, 0xcb, 0xba, 0x4a, + 0xa5, 0xb6, 0x12, 0x4c, 0x14, 0x11, 0x1f, 0x88, + 0x57, 0x78, 0x1e, 0x51, 0x7c, 0x9d, 0xba, 0x31, + 0x80, 0x14, 0xeb, 0x4a, 0x98, 0x8a, 0xb5, 0x4d, + 0xc5, 0xbd, 0xd2, 0x48, 0x1e, 0x19, 0x43, 0x54, + 0x48, 0x1d, 0x24, 0x76, 0x7d, 0xd8, 0xcc, 0xe9, + 0xd9, 0x7b, 0xa9, 0xdf, 0xe3, 0x65, 0x85, 0x10, + 0xb8, 0x11, 0xce, 0xa3, 0x07, 0x4d, 0x87, 0x3f, + 0x95, 0xfb, 0xa5, 0x06, 0xa4, 0x37, 0xb0, 0x89, + 0x03, 0xa9, 0xef, 0x62, 0x98, 0xd3, 0x85, 0xe8, + 0xb3, 0x21, 0xab, 0xe9, 0xdc, 0x03, 0x2a, 0x20, + 0xf7, 0xb1, 0xa4, 0x7a, 0xd5, 0xdc, 0x61, 0x2e, + 0x15, 0x81, 0x3e, 0xcf, 0x8d, 0x8d, 0x54, 0x19, + 0x70, 0xde, 0xa9, 0x57, 0x93, 0x87, 0xc7, 0x16, + 0x06, 0x25, 0xf3, 0x93, 0x8f, 0x73, 0x92, 0x29, + 0x1e, 0xcd, 0x5a, 0x9d, 0x8f, 0x8d, 0x44, 0x15, + 0x8d, 0x92, 0x44, 0x95, 0x7a, 0x5e, 0x1b, 0xfd, + 0x31, 0xa5, 0x8c, 0x22, 0x89, 0xbb, 0x91, 0x15, + 0xad, 0x0a, 0x73, 0x94, 0x65, 0xae, 0xca, 0xfc, + 0x7e, 0xae, 0x85, 0x45, 0xe7, 0xd7, 0x8f, 0x89, + 0x8e, 0x44, 0x62, 0x7a, 0xe0, 0xee, 0x78, 0xbd, + 0x88, 0x62, 0x8e, 0xb8, 0x35, 0x7a, 0xa9, 0x12, + 0x56, 0x2d, 0xe4, 0xbb, 0x2d, 0xc8, 0x98, 0x0e, + 0x35, 0x9e, 0xea, 0x14, 0x43, 0x80, 0xde, 0x9e, + 0x2e, 0xf8, 0xf9, 0xcd, 0x61, 0xa6, 0x22, 0xc8, + 0x77, 0xfc, 0x32, 0x71, 0x4b, 0xcb, 0x00, 0x9b, + 0x9f, 0x85, 0x02, 0x92, 0xfa,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 0x93, 0xdc, 0x3b, 0xca, 0x34, 0x78, 0xcf, + 0xdb, 0x0c, 0x9d, 0x5c, 0x52, 0xb2, 0xd5, 0x7b, + 0xbb, 0x4e, 0xe1, 0xa9, 0x2a, 0xc6, 0x42, 0xf5, + 0x21, 0x9c, 0x15, 0xae, 0xb9, 0x08, 0x3a, 0xc4, + 0x50, 0x7e, 0x0e, 0xb6, 0xc3, 0xfe, 0xf4, 0xd9, + 0x1a, 0x97, 0x30, 0x9f, 0x51, 0x2c, 0xac, 0xd2, + 0x13, 0x93, 0x62, 0x56, 0xcb, 0x34, 0xf3, 0xca, + 0x26, 0xc6, 0x32, 0xbe, 0xf6, 0xd5, 0x1e, 0x5b, + 0x3a, 0x5c, 0x31, 0x08, 0xa1, 0x47, 0x6b, 0x75, + 0x95, 0x8e, 0x3d, 0xbf, 0x2e, 0x81, 0x02, 0x0d, + 0x17, 0x66, 0x6f, 0x04, 0xe0, 0x1e, 0x03, 0x27, + 0xd3, 0xcf, 0x45, 0xc6, 0x08, 0xdb, 0xdf, 0x83, + 0xd5, 0xc2, 0x7f, 0xe8, 0x5f, 0x4a, 0x36, 0x0a, + 0x6d, 0x3c, 0x91, 0x8e, 0x52, 0xf3, 0xdd, 0x62, + 0xff, 0x78, 0x87, 0xd9, 0x4c, 0xad, 0x5c, 0x9f, +}; + +/* + * IV method encblkno8, blkno 3. + */ +static const uint8_t bf_cbc_128_encblkno8_vec3_ctxt[SECSIZE] = { + 0xa3, 0x9a, 0x21, 0xbd, 0x1c, 0x97, 0x4f, 0xe2, + 0x7d, 0x63, 0xfe, 0x52, 0x07, 0xac, 0x81, 0x75, + 0x15, 0x04, 0x8c, 0xc7, 0x7c, 0x11, 0x8d, 0x53, + 0x17, 0x87, 0xe8, 0x5d, 0xb1, 0xe8, 0xcb, 0x43, + 0xe2, 0x4b, 0xce, 0x9b, 0xf7, 0x51, 0x0a, 0xee, + 0x0a, 0x49, 0xae, 0x9a, 0xbd, 0x33, 0x3f, 0x0b, + 0xd4, 0xe8, 0x57, 0x77, 0xb1, 0xe1, 0xa5, 0x22, + 0x83, 0xbf, 0x7c, 0x63, 0x6c, 0x3b, 0x25, 0xde, + 0x2c, 0x6a, 0x28, 0x66, 0x0e, 0xc4, 0x8d, 0x66, + 0x66, 0xb6, 0xc6, 0xb5, 0x38, 0x40, 0x84, 0x81, + 0xec, 0x03, 0xdb, 0xbf, 0xe1, 0x8f, 0xf4, 0xb3, + 0xc4, 0x50, 0x24, 0xa2, 0x48, 0x66, 0x73, 0xed, + 0x4b, 0x00, 0x12, 0xd5, 0x15, 0x5f, 0xfb, 0xd9, + 0x6c, 0x76, 0x3b, 0xa2, 0x68, 0x41, 0xc1, 0x96, + 0x50, 0xff, 0x8a, 0x83, 0xac, 0x02, 0x42, 0xcb, + 0xed, 0x93, 0xbf, 0xd9, 0x51, 0x46, 0x50, 0xd1, + 0xeb, 0x02, 0x61, 0x64, 0xa7, 0x0e, 0x95, 0xc2, + 0x95, 0x5a, 0x93, 0xd9, 0x77, 0x17, 0xa4, 0xc7, + 0x51, 0x42, 0xa3, 0xd4, 0x32, 0x4e, 0x4f, 0xe1, + 0xaa, 0x6d, 0xab, 0x08, 0xd9, 0xe9, 0xfe, 0x72, + 0xf3, 0x2c, 0xfb, 0x43, 0xdf, 0x88, 0x44, 0x94, + 0x0b, 0x5c, 0x85, 0x54, 0xe3, 0x13, 0xe2, 0x10, + 0x64, 0xa7, 0xcf, 0xe3, 0x2a, 0x3e, 0xfe, 0xd1, + 0x67, 0xcd, 0xd1, 0x66, 0x06, 0x26, 0x2f, 0x6f, + 0x6f, 0x44, 0xe7, 0xf4, 0xac, 0xe4, 0x58, 0x2f, + 0x61, 0xad, 0x64, 0xc6, 0x0c, 0xf0, 0x9a, 0x3b, + 0x85, 0x1f, 0x3c, 0xea, 0x8e, 0x84, 0xbb, 0x1a, + 0x51, 0x19, 0x3c, 0x6f, 0x5b, 0xf5, 0x6c, 0xb1, + 0x8c, 0x91, 0x25, 0x89, 0x3a, 0x45, 0xb5, 0x35, + 0x13, 0x74, 0xec, 0x68, 0x44, 0xb8, 0xfd, 0xd6, + 0x20, 0x78, 0x7b, 0xe3, 0xe0, 0x82, 0xb7, 0x4a, + 0x38, 0xb6, 0xe4, 0x1b, 0xbf, 0xd9, 0xd3, 0xe9, + 0xbf, 0xd7, 0xdc, 0x8e, 0x90, 0x7d, 0xcb, 0x39, + 0xc4, 0x6c, 0xa4, 0x70, 0x15, 0xf7, 0xa2, 0x16, + 0x04, 0x9b, 0xc0, 0x85, 0x04, 0x1e, 0x69, 0x73, + 0xf3, 0xbd, 0x64, 0x95, 0xfb, 0x21, 0xcb, 0xca, + 0x72, 0xd4, 0x33, 0xe5, 0x11, 0xc3, 0x46, 0xa6, + 0xd2, 0x4c, 0x8a, 0xbb, 0xba, 0x45, 0xcc, 0x45, + 0xdb, 0x8a, 0xec, 0xef, 0x8c, 0x04, 0xcc, 0xeb, + 0x42, 0xad, 0xc3, 0x87, 0xe2, 0x59, 0x3b, 0xed, + 0x2a, 0x11, 0x74, 0xc1, 0x28, 0x8a, 0xc2, 0x17, + 0xca, 0x5a, 0x88, 0xcc, 0x17, 0x2c, 0x03, 0xf6, + 0xcd, 0xd6, 0x92, 0xbd, 0x68, 0x26, 0x41, 0x40, + 0x15, 0x3e, 0x54, 0xf5, 0xb7, 0x4a, 0x82, 0x68, + 0xca, 0x27, 0xed, 0xed, 0x25, 0xd6, 0x0d, 0x0f, + 0x86, 0x62, 0xf0, 0x86, 0x5b, 0xed, 0x94, 0x0b, + 0xd0, 0xec, 0xc7, 0xfd, 0x9c, 0x8a, 0xdf, 0x4f, + 0x65, 0x7e, 0x63, 0x40, 0xeb, 0xe4, 0x79, 0xcb, + 0x67, 0xc6, 0x0e, 0x45, 0xf9, 0xb1, 0x48, 0x27, + 0x16, 0xfc, 0x99, 0x76, 0xac, 0xd0, 0xbc, 0xe6, + 0x9b, 0x29, 0x2d, 0xa5, 0x6c, 0x88, 0x45, 0x7a, + 0x01, 0xf3, 0xe3, 0x15, 0xfb, 0x29, 0xd4, 0x3b, + 0x9a, 0xa8, 0xc6, 0x98, 0x92, 0x19, 0x16, 0xba, + 0xdc, 0x41, 0x70, 0x40, 0x51, 0xfb, 0x7f, 0xb5, + 0xe4, 0x3f, 0x3f, 0x73, 0xb0, 0xb3, 0xd7, 0x6d, + 0x3e, 0x4d, 0x6b, 0x9e, 0x42, 0x8e, 0xbb, 0xd7, + 0xb5, 0x26, 0xa9, 0x19, 0xf5, 0x68, 0xf3, 0x8d, + 0x35, 0x91, 0x06, 0x48, 0xfa, 0x0e, 0x7d, 0xe2, + 0xd3, 0x71, 0x75, 0x44, 0xbd, 0xe6, 0xe6, 0xd6, + 0x36, 0x43, 0x64, 0x3a, 0xd5, 0x97, 0xfa, 0xc0, + 0x10, 0xf7, 0x6c, 0x26, 0xf1, 0xb4, 0xbc, 0xf5, + 0xf6, 0xa3, 0xec, 0x0a, 0xb5, 0x34, 0x55, 0x1a, + 0x67, 0xcb, 0xec, 0x2c, 0x2e, 0x2e, 0x74, 0xed, + 0xfc, 0x85, 0x53, 0x01, 0x87, 0xa7, 0xa0, 0x1f, +}; + +const struct testvec bf_cbc_128_8_vectors[] = { + { + .blkno = 0, + .ptxt = bf_cbc_ptxt, + .ctxt = bf_cbc_128_encblkno8_vec0_ctxt, + }, + { + .blkno = 1, + .ptxt = bf_cbc_ptxt, + .ctxt = bf_cbc_128_encblkno8_vec1_ctxt, + }, + { + .blkno = 2, + .ptxt = bf_cbc_ptxt, + .ctxt = bf_cbc_128_encblkno8_vec2_ctxt, + }, + { + .blkno = 3, + .ptxt = bf_cbc_ptxt, + .ctxt = bf_cbc_128_encblkno8_vec3_ctxt, + }, +}; + +/* + * IV method encblkno1, blkno 0. + */ +static const uint8_t bf_cbc_256_encblkno1_vec0_ctxt[SECSIZE] = { + 0x14, 0xec, 0xa9, 0xa0, 0x51, 0x9f, 0x5e, 0xb5, + 0x81, 0x6f, 0xa2, 0xbf, 0x5e, 0xf7, 0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 0xb9, 0xf4, 0xb9, 0x3f, 0xa5, 0xd2, + 0xfb, 0xa0, 0xfd, 0x10, 0xa5, 0xbb, 0xd7, 0x22, + 0x8c, 0xd1, 0xf5, 0xc4, 0x11, 0xc6, 0x1e, 0xb5, + 0xfc, 0x90, 0x84, 0xa2, 0x49, 0x38, 0x64, 0x92, + 0x6e, 0xf2, 0xaa, 0xed, 0xe8, 0x9d, 0xac, 0x86, + 0xb7, 0xb3, 0xd9, 0x98, 0x11, 0x8f, 0x51, 0x33, + 0x84, 0x06, 0x40, 0x26, 0x3f, 0xe1, 0xb3, 0x4a, + 0x76, 0x53, 0x68, 0x8b, 0xfe, 0x6f, 0xcd, 0x66, + 0x92, 0x24, 0x42, 0xf4, 0x11, 0x02, 0x01, 0x00, + 0xaa, 0x15, 0x35, 0x42, 0xab, 0x6f, 0x2b, 0x3b, + 0x9a, 0x23, 0x73, 0x18, 0xa8, 0x9b, 0x43, 0x4b, + 0xfb, 0xef, 0x07, 0x75, 0xd7, 0xd6, 0x08, 0x94, + 0xe3, 0x2d, 0xd9, 0xd4, 0x8e, 0x6b, 0x7c, 0xe0, + 0xae, 0xef, 0xcb, 0x5c, 0x46, 0x39, 0x64, 0x34, + 0x48, 0x77, 0x2c, 0x87, 0x68, 0x57, 0xef, 0xba, + 0xd3, 0x3b, 0xb8, 0x68, 0xc5, 0x65, 0x73, 0x44, + 0x0b, 0xef, 0xc7, 0x5e, 0xe6, 0xa2, 0xba, 0x24, + 0x8c, 0x67, 0xa0, 0xf4, 0xef, 0x18, 0x8c, 0x72, + 0x5b, 0x81, 0x8c, 0x81, 0x4f, 0x9a, 0xed, 0x46, + 0x5d, 0x05, 0x9a, 0xdc, 0x01, 0xbe, 0xe8, 0x3f, + 0xb7, 0x5c, 0x8b, 0x2f, 0x92, 0x2c, 0x93, 0x54, + 0x68, 0xfa, 0xd4, 0x27, 0x81, 0xab, 0xa9, 0xfd, + 0x20, 0x21, 0x1b, 0x3a, 0x6e, 0x6b, 0x02, 0x57, + 0x6e, 0xd6, 0x7b, 0x7e, 0x5d, 0x84, 0x47, 0x69, + 0x86, 0x7b, 0x8f, 0x8b, 0xff, 0xb5, 0xcd, 0xc1, + 0x03, 0x18, 0x23, 0x7f, 0x23, 0x2e, 0x3a, 0x48, + 0xe2, 0xf6, 0xb1, 0x78, 0x13, 0x81, 0xbb, 0x80, + 0x91, 0x89, 0x54, 0x7d, 0x1f, 0x1a, 0xd5, 0x35, + 0xad, 0x56, 0x6a, 0x0f, 0xeb, 0x4d, 0x00, 0xdf, + 0xe0, 0xf3, 0x7c, 0xd3, 0x2c, 0x5a, 0x48, 0x39, + 0xa1, 0xc1, 0xfa, 0x34, 0x5f, 0xf9, 0x0b, 0xcd, + 0x1f, 0x21, 0xc6, 0x46, 0xb3, 0xd8, 0x45, 0xc5, + 0x37, 0xf7, 0xd0, 0xda, 0x27, 0x0f, 0xec, 0xec, + 0x05, 0x81, 0x6f, 0x97, 0xca, 0x6d, 0xfa, 0x71, + 0xc9, 0x59, 0x84, 0xc3, 0x0d, 0x55, 0x12, 0xbf, + 0xe1, 0xd2, 0x7c, 0x51, 0x65, 0x8c, 0xc3, 0x8a, + 0x73, 0x2f, 0x1c, 0xd8, 0x13, 0x4a, 0xd1, 0x78, + 0xb2, 0xc8, 0x19, 0x09, 0xce, 0x7b, 0xb6, 0x77, + 0xcc, 0xc3, 0xe6, 0xee, 0x3a, 0x82, 0xf9, 0xc6, + 0x5a, 0x36, 0x46, 0xc0, 0x25, 0xee, 0xaf, 0x78, +}; + +/* + * IV method encblkno1, blkno 1. + */ +static const uint8_t bf_cbc_256_encblkno1_vec1_ctxt[SECSIZE] = { + 0x0b, 0xb6, 0x26, 0x92, 0x1d, 0x74, 0xc2, 0x10, + 0xb5, 0x99, 0x5f, 0x62, 0x7f, 0x3b, 0x49, 0x10, + 0xc1, 0x20, 0x9f, 0x38, 0x25, 0x0f, 0x59, 0xde, + 0xe4, 0xc8, 0xb5, 0x27, 0xb1, 0xec, 0x96, 0x40, + 0xe8, 0x05, 0x15, 0x40, 0x96, 0xe0, 0xff, 0xaf, + 0x53, 0x73, 0xa1, 0xa6, 0x73, 0x03, 0xcf, 0x1f, + 0x87, 0x48, 0x7d, 0x81, 0x0e, 0x35, 0x23, 0x7b, + 0xde, 0x12, 0xd8, 0xcd, 0x0a, 0xcb, 0x03, 0xc5, + 0x07, 0xf7, 0x7a, 0x04, 0xf3, 0xda, 0x7d, 0x3b, + 0x73, 0xc6, 0x31, 0xbc, 0x24, 0xde, 0x23, 0x05, + 0x3a, 0xdc, 0xe2, 0x96, 0x85, 0x06, 0xeb, 0x89, + 0xb0, 0x49, 0x3c, 0x79, 0x8e, 0xcf, 0x49, 0x0e, + 0x34, 0x04, 0xa5, 0xcf, 0x45, 0x56, 0xb6, 0xc2, + 0xf1, 0xf1, 0xab, 0x7c, 0x8a, 0xfc, 0xeb, 0xa0, + 0x8a, 0xe6, 0x73, 0xb4, 0xc3, 0x0c, 0x03, 0x5f, + 0x03, 0x53, 0x6f, 0x69, 0xa2, 0xd0, 0xa7, 0x48, + 0xc4, 0x11, 0x88, 0x75, 0xe1, 0xf3, 0xd0, 0x72, + 0x98, 0x6f, 0x84, 0xa6, 0xa8, 0x35, 0xbb, 0xac, + 0x4d, 0xac, 0x55, 0x88, 0x85, 0x86, 0x5a, 0xd9, + 0xb6, 0x57, 0xf9, 0x40, 0xf6, 0x7f, 0x1b, 0x4e, + 0x87, 0xc0, 0x56, 0x8a, 0x2f, 0x3a, 0xe5, 0xa6, + 0x67, 0x68, 0x21, 0x2b, 0xea, 0xfa, 0xee, 0x47, + 0xa0, 0x34, 0x56, 0x7d, 0xa0, 0x3d, 0x58, 0xd7, + 0xff, 0xa2, 0xb6, 0x03, 0x52, 0x16, 0xa5, 0x15, + 0x65, 0xdb, 0xe1, 0x1b, 0xdf, 0x69, 0xb1, 0x48, + 0x6a, 0xdf, 0xc1, 0x00, 0x07, 0xdc, 0x46, 0x4b, + 0x59, 0xcf, 0x15, 0x6b, 0xee, 0x4f, 0x72, 0x77, + 0x6e, 0xbf, 0x47, 0x0e, 0x84, 0x0b, 0xb1, 0xac, + 0x85, 0xce, 0x2b, 0x47, 0x7a, 0xcc, 0x30, 0x0c, + 0x2f, 0x10, 0x27, 0xaa, 0x83, 0x3f, 0x17, 0x39, + 0x84, 0x45, 0x8c, 0xb7, 0x31, 0xb3, 0x7c, 0xcd, + 0xed, 0x86, 0x7d, 0xa9, 0x06, 0x25, 0x1f, 0xe3, + 0x9a, 0x9b, 0x92, 0xdd, 0x07, 0x63, 0x3b, 0x51, + 0x32, 0x2e, 0xae, 0xdf, 0xad, 0xd4, 0x54, 0x5d, + 0x71, 0x36, 0xe9, 0xda, 0x70, 0xe9, 0xec, 0x75, + 0x0b, 0xbb, 0xcc, 0x5d, 0xc5, 0x45, 0x8e, 0x56, + 0x12, 0x87, 0x95, 0x0f, 0x0f, 0x5b, 0x22, 0xc2, + 0xe9, 0x71, 0xf2, 0x7e, 0x7b, 0xc2, 0xce, 0x1f, + 0xb4, 0x43, 0xa5, 0xf1, 0x80, 0x03, 0xd9, 0x44, + 0x3e, 0x97, 0xd6, 0x32, 0x80, 0x99, 0x6b, 0x5b, + 0x25, 0x8b, 0x73, 0x0c, 0x21, 0xda, 0x87, 0x29, + 0x57, 0x1e, 0xa3, 0x1f, 0xc1, 0xb2, 0xd6, 0xa4, + 0x72, 0x64, 0x4a, 0x6b, 0x6f, 0x4d, 0xa8, 0x03, + 0x59, 0x6f, 0xce, 0x8a, 0xd6, 0x1c, 0x63, 0x30, + 0x60, 0xd1, 0x55, 0xc5, 0x44, 0x9a, 0xa8, 0x69, + 0x9f, 0xc7, 0xbe, 0xca, 0x92, 0x83, 0xe9, 0xea, + 0x51, 0x00, 0x5a, 0xdc, 0xbb, 0xbd, 0x5d, 0xf2, + 0x6d, 0x3c, 0x09, 0xde, 0x68, 0x33, 0x5f, 0x5c, + 0x80, 0x8e, 0x22, 0x93, 0x28, 0x5b, 0x77, 0xae, + 0xcd, 0x0d, 0x08, 0xab, 0x94, 0xd6, 0x12, 0x72, + 0x3f, 0xd2, 0xb3, 0xff, 0x87, 0x0a, 0x6f, 0x72, + 0xa7, 0xff, 0xc1, 0xdc, 0x8a, 0x64, 0xdf, 0xeb, + 0x0e, 0x63, 0x71, 0x42, 0x88, 0x2b, 0x13, 0x17, + 0xf2, 0x3b, 0xf9, 0xbb, 0xc9, 0xcc, 0x32, 0x1f, + 0x12, 0x7f, 0xa0, 0x8e, 0x77, 0x31, 0x42, 0x46, + 0x3d, 0xb6, 0xa9, 0x14, 0x6e, 0x02, 0x5a, 0x4f, + 0xf1, 0x5b, 0x91, 0x7e, 0x93, 0xea, 0x94, 0xf1, + 0xcf, 0x0e, 0x10, 0xf8, 0xc2, 0x55, 0x87, 0x68, + 0xf9, 0x49, 0xfa, 0xeb, 0x0f, 0x2c, 0xd7, 0xd8, + 0x26, 0x1a, 0x5b, 0x1a, 0x42, 0x06, 0xea, 0x8a, + 0xb6, 0xec, 0x6e, 0xb0, 0x00, 0xb9, 0x3b, 0x50, + 0xe8, 0x9e, 0xc2, 0x51, 0x4f, 0x03, 0xcd, 0x9f, + 0x36, 0x27, 0xca, 0xa2, 0x98, 0x87, 0x5a, 0xae, + 0xd8, 0x87, 0x76, 0xb6, 0xb6, 0x19, 0x7d, 0x75, +}; + +/* + * IV method encblkno1, blkno 2. + */ +static const uint8_t bf_cbc_256_encblkno1_vec2_ctxt[SECSIZE] = { + 0x91, 0x45, 0x4e, 0xe8, 0xad, 0xe3, 0x95, 0x0f, + 0x40, 0x35, 0x21, 0x21, 0x77, 0x62, 0x1d, 0x65, + 0xe4, 0x93, 0x11, 0xd2, 0x20, 0xa4, 0xe4, 0x53, + 0x44, 0xff, 0x60, 0xe9, 0x34, 0xb2, 0x33, 0x87, + 0x3d, 0xb0, 0xd8, 0x37, 0x7e, 0x0e, 0x9a, 0x53, + 0x92, 0xeb, 0xee, 0x16, 0x41, 0x25, 0xe3, 0x80, + 0x0c, 0x53, 0xd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x53, 0x72, 0x59, 0x8b, 0xea, 0xbf, 0xde, + 0x2b, 0x35, 0xd5, 0x27, 0x57, 0x2e, 0x13, 0xa7, + 0x50, 0x2d, 0xa5, 0xd5, 0x43, 0x0b, 0x49, 0x87, + 0xd0, 0xbd, 0xdd, 0xec, 0x4b, 0xd1, 0x8b, 0xf6, + 0xf6, 0xd0, 0x97, 0xcb, 0x8d, 0x58, 0x35, 0x27, + 0xa5, 0x7e, 0x4a, 0xda, 0x93, 0xa4, 0x1e, 0x39, + 0x53, 0x59, 0x87, 0xfe, 0x82, 0x09, 0xda, 0x03, + 0x33, 0xcf, 0x94, 0x60, 0xb1, 0x0c, 0xa1, 0x0e, + 0xd6, 0xaa, 0xb0, 0x09, 0x96, 0x8b, 0x72, 0x15, + 0xfb, 0xb0, 0x7d, 0x06, 0xf5, 0x2d, 0x64, 0xcd, + 0x03, 0xf0, 0xfa, 0xed, 0x6f, 0x43, 0xe3, 0xf3, + 0x33, 0xaf, 0x65, 0x82, 0x1d, 0xad, 0x03, 0x62, + 0xbe, 0x12, 0x14, 0x85, 0x66, 0x45, 0x03, 0x79, +}; + +/* + * IV method encblkno1, blkno 3. + */ +static const uint8_t bf_cbc_256_encblkno1_vec3_ctxt[SECSIZE] = { + 0x65, 0xbb, 0x30, 0x13, 0x9a, 0x26, 0xe9, 0x3d, + 0x54, 0x28, 0x77, 0xf1, 0x3f, 0x9b, 0xe1, 0x3e, + 0x70, 0x90, 0x6f, 0x16, 0xfc, 0x2f, 0x27, 0xb3, + 0xc6, 0x3c, 0x38, 0x31, 0x11, 0xe1, 0x3b, 0x72, + 0x22, 0x1c, 0x01, 0xc5, 0xa6, 0x70, 0x16, 0x4d, + 0xd2, 0xbd, 0xcb, 0x15, 0x00, 0x22, 0xab, 0x65, + 0x6a, 0x96, 0x5e, 0x45, 0x7f, 0xfd, 0x76, 0x18, + 0x43, 0x25, 0x75, 0x73, 0xa4, 0x24, 0xe4, 0x5b, + 0xca, 0xf7, 0x6f, 0xfe, 0xc6, 0x4c, 0x81, 0x77, + 0xe5, 0x1b, 0xb4, 0x7b, 0x64, 0xc2, 0x0d, 0x2b, + 0xa9, 0x76, 0xae, 0x5d, 0xab, 0x81, 0x77, 0xa6, + 0x48, 0xe9, 0x0c, 0x6d, 0x93, 0xbd, 0x7e, 0xdc, + 0x39, 0x89, 0x72, 0xd2, 0x07, 0x87, 0x44, 0xa6, + 0x7d, 0x08, 0x54, 0xc6, 0x90, 0x1d, 0xa2, 0xd7, + 0xfd, 0xd5, 0x59, 0x67, 0xd9, 0x5f, 0x5c, 0xbc, + 0x60, 0xc7, 0xf6, 0x98, 0xad, 0x21, 0xdf, 0xde, + 0x27, 0xca, 0x73, 0x2f, 0x56, 0xb7, 0xd7, 0x54, + 0x6e, 0xc3, 0x09, 0x6f, 0x1b, 0x82, 0x6f, 0xf8, + 0x1b, 0xb2, 0x54, 0x47, 0x54, 0x55, 0x67, 0x1c, + 0x4a, 0x10, 0x44, 0xb8, 0x8e, 0x85, 0x71, 0x70, + 0x02, 0x49, 0xdd, 0x4f, 0xd4, 0xd4, 0x8a, 0x60, + 0x04, 0x17, 0x84, 0xbf, 0xb4, 0x0a, 0x6f, 0xc1, + 0xec, 0x1f, 0x5d, 0x79, 0x59, 0x15, 0x7b, 0x87, + 0xa2, 0xfe, 0x81, 0xa1, 0x0b, 0x74, 0xfa, 0xef, + 0xce, 0x96, 0xec, 0x4b, 0xd8, 0x8e, 0xe9, 0xc2, + 0x6b, 0x15, 0xd9, 0xe4, 0x1d, 0x81, 0xb2, 0x12, + 0xb9, 0x8b, 0x64, 0x3d, 0xfa, 0xf6, 0x29, 0x25, + 0x88, 0x4f, 0xfa, 0x56, 0x34, 0x85, 0xa6, 0xbe, + 0xf7, 0x9f, 0x54, 0xc4, 0xb7, 0x17, 0xd5, 0x00, + 0x2d, 0x06, 0xca, 0xf0, 0xec, 0xf9, 0x52, 0x62, + 0x12, 0xef, 0xc0, 0x57, 0xd1, 0xf3, 0xf2, 0xb1, + 0x3d, 0xc5, 0x69, 0x04, 0x95, 0xaf, 0xc6, 0x54, + 0x18, 0x08, 0x2f, 0xe2, 0xc2, 0xdb, 0x28, 0x63, + 0x7c, 0xf5, 0xba, 0xa4, 0xdf, 0xbd, 0xdd, 0xac, + 0x98, 0xec, 0x9e, 0x07, 0x48, 0xee, 0xb9, 0x6f, + 0x40, 0xba, 0x08, 0xd5, 0x74, 0x97, 0x34, 0x98, + 0x7a, 0x80, 0xc5, 0x78, 0x69, 0x11, 0xd9, 0xcb, + 0x3b, 0x6f, 0xe7, 0xb7, 0x78, 0xb0, 0x5e, 0x02, + 0xaf, 0x6c, 0xef, 0x36, 0x00, 0xca, 0x97, 0x1a, + 0x01, 0x2e, 0xe8, 0xc0, 0x8b, 0xc6, 0x78, 0xf4, + 0x2d, 0x60, 0x2c, 0x04, 0x3f, 0x0b, 0xca, 0x7e, + 0xf1, 0x2e, 0x67, 0x8f, 0x9d, 0xa7, 0xaa, 0xab, + 0xcf, 0xb3, 0x84, 0x9e, 0x14, 0x35, 0x15, 0x3b, + 0x88, 0x9a, 0x33, 0x5d, 0x68, 0x82, 0x29, 0x53, + 0x94, 0x18, 0x0d, 0x14, 0x9e, 0x5f, 0xc1, 0x32, + 0x0a, 0x95, 0x6e, 0xa3, 0x82, 0x4b, 0x58, 0x0f, + 0x9c, 0xf0, 0x26, 0x4b, 0x2f, 0x02, 0x60, 0x85, + 0xdd, 0x2c, 0xb8, 0x87, 0x8b, 0x14, 0x9c, 0x54, + 0x0a, 0x5a, 0x02, 0xbe, 0xe2, 0x71, 0xcc, 0x07, + 0xae, 0x67, 0x00, 0xa8, 0xd4, 0x09, 0x7c, 0xee, + 0x0d, 0x29, 0x17, 0x67, 0x96, 0x68, 0x41, 0xfa, + 0x72, 0x29, 0x98, 0x2b, 0x23, 0xd1, 0xa9, 0x89, + 0x1c, 0xcc, 0xaf, 0x88, 0xdb, 0xb5, 0x1e, 0xb1, + 0xae, 0x17, 0x5f, 0x29, 0x8d, 0x1c, 0x0a, 0x5c, + 0xb9, 0xa7, 0x59, 0x8b, 0x91, 0x41, 0xee, 0x89, + 0xe1, 0x0e, 0x7e, 0x0a, 0xee, 0xbc, 0x35, 0xab, + 0xf1, 0x5a, 0x58, 0x03, 0xa2, 0xcf, 0x33, 0xa3, + 0x74, 0x82, 0xd3, 0xa0, 0x32, 0xfc, 0x3b, 0x9c, + 0xdf, 0xc0, 0x3a, 0x76, 0xe1, 0xea, 0xf0, 0x6d, + 0xc8, 0xe7, 0x97, 0xec, 0x03, 0xc1, 0x72, 0x94, + 0xe5, 0xc4, 0x04, 0x2a, 0x38, 0xb4, 0xef, 0x47, + 0x1d, 0xf9, 0xb8, 0x0a, 0xa9, 0x45, 0xc1, 0x63, + 0xf8, 0x32, 0xdb, 0x5d, 0xb1, 0xa2, 0x80, 0x8c, + 0x23, 0xd3, 0x60, 0xfb, 0xf8, 0x84, 0x57, 0x8b, +}; + +const struct testvec bf_cbc_256_1_vectors[] = { + { + .blkno = 0, + .ptxt = bf_cbc_ptxt, + .ctxt = bf_cbc_256_encblkno1_vec0_ctxt, + }, + { + .blkno = 1, + .ptxt = bf_cbc_ptxt, + .ctxt = bf_cbc_256_encblkno1_vec1_ctxt, + }, + { + .blkno = 2, + .ptxt = bf_cbc_ptxt, + .ctxt = bf_cbc_256_encblkno1_vec2_ctxt, + }, + { + .blkno = 3, + .ptxt = bf_cbc_ptxt, + .ctxt = bf_cbc_256_encblkno1_vec3_ctxt, + }, +}; + +/* + * IV method encblkno8, blkno 0. + */ +static const uint8_t bf_cbc_256_encblkno8_vec0_ctxt[SECSIZE] = { + 0x90, 0x3d, 0xd2, 0xc0, 0xd3, 0x75, 0xe8, 0x04, + 0x34, 0x66, 0x76, 0x25, 0x70, 0xde, 0x41, 0xf1, + 0x35, 0x63, 0x5c, 0xac, 0x8f, 0x28, 0x17, 0xd3, + 0xae, 0x43, 0xfd, 0x8a, 0xb8, 0xc2, 0xd3, 0x88, + 0xef, 0xfa, 0x21, 0xeb, 0xb4, 0x33, 0x75, 0x69, + 0x7d, 0xe9, 0x27, 0x1c, 0x03, 0xcf, 0x90, 0xcf, + 0xf0, 0xaa, 0x3e, 0x01, 0x41, 0x24, 0xdc, 0x01, + 0x5a, 0xe8, 0x92, 0xea, 0xde, 0x87, 0xbf, 0x75, + 0xe4, 0x0b, 0xf7, 0xa3, 0x42, 0x27, 0xc4, 0xde, + 0x01, 0x6f, 0x5c, 0xec, 0x6d, 0x37, 0x38, 0xd7, + 0x4f, 0x85, 0xc0, 0xc2, 0x3a, 0xa7, 0x2d, 0x15, + 0xd5, 0x1c, 0xee, 0x15, 0x13, 0x7a, 0x4e, 0x33, + 0xc7, 0x59, 0x93, 0x73, 0xe9, 0xf5, 0x39, 0xb0, + 0xad, 0x8b, 0x61, 0xca, 0x4d, 0x31, 0xaa, 0x44, + 0xf6, 0x5c, 0xb7, 0x99, 0xe5, 0x92, 0x3d, 0x47, + 0x79, 0x9b, 0x29, 0x16, 0xe1, 0x2c, 0x30, 0x8b, + 0x1e, 0x17, 0xf0, 0x91, 0x59, 0x00, 0xab, 0x6d, + 0x4d, 0xa7, 0x4d, 0x96, 0xc3, 0xe4, 0x3d, 0x17, + 0x5c, 0x8e, 0xfc, 0x59, 0x48, 0xd4, 0xdd, 0xf4, + 0xea, 0x3a, 0x68, 0xc8, 0xb1, 0x74, 0x69, 0xcb, + 0x49, 0x1a, 0xec, 0x24, 0x4e, 0x7e, 0xe9, 0xba, + 0x75, 0xfb, 0x52, 0x85, 0x75, 0xe9, 0x41, 0x9a, + 0xc6, 0x40, 0x9c, 0x92, 0x3f, 0xe8, 0x99, 0x81, + 0x84, 0x14, 0x2b, 0x62, 0x94, 0xba, 0x56, 0x00, + 0xde, 0x88, 0xe1, 0x35, 0xea, 0x25, 0x88, 0xd1, + 0xce, 0xd4, 0xfc, 0xde, 0xee, 0x1a, 0xfd, 0xb1, + 0xa7, 0x46, 0x9d, 0x0c, 0x99, 0xa6, 0xab, 0x23, + 0x55, 0x2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, 0xde, 0xb5, + 0x6a, 0x7b, 0x3b, 0xe3, 0x4f, 0x8a, 0x49, 0xce, + 0xc9, 0x14, 0x29, 0x96, 0x84, 0xca, 0xe1, 0x49, + 0x41, 0x73, 0xb3, 0x2a, 0xbe, 0x37, 0xb6, 0x2d, + 0xff, 0xf2, 0x8e, 0x3d, 0x02, 0xeb, 0xd4, 0xd3, + 0x15, 0x8f, 0xc0, 0x00, 0x91, 0xd5, 0xe7, 0x76, + 0xf5, 0x6e, 0x81, 0x38, 0x38, 0x07, 0xa6, 0xe8, + 0x72, 0x14, 0x3b, 0x36, 0xef, 0xbc, 0x5b, 0x26, + 0xb0, 0x60, 0x25, 0x49, 0x7e, 0xfc, 0xd8, 0x3b, + 0x63, 0xdc, 0x7f, 0x80, 0xd5, 0x43, 0x78, 0xbb, + 0xf1, 0xf9, 0x3e, 0x75, 0x1d, 0x58, 0xb2, 0xc7, + 0xb6, 0x52, 0xfb, 0xe7, 0x42, 0xef, 0x87, 0xfd, + 0x3a, 0x02, 0x7a, 0xf9, 0xbc, 0xa8, 0x2f, 0xd6, + 0xc1, 0x5f, 0xa4, 0x57, 0x62, 0x83, 0x82, 0x8e, + 0x1e, 0xbb, 0x85, 0xf7, 0x1b, 0x2e, 0xe2, 0xb0, +}; + +/* + * IV method encblkno8, blkno 1. + */ +static const uint8_t bf_cbc_256_encblkno8_vec1_ctxt[SECSIZE] = { + 0x2b, 0xf6, 0xd4, 0x61, 0x3b, 0x1f, 0x5b, 0xe9, + 0x32, 0xab, 0x27, 0xa1, 0xaf, 0x5e, 0xf4, 0xa7, + 0xaa, 0xc5, 0x2a, 0x3c, 0x0d, 0x34, 0xd8, 0xb3, + 0xfd, 0xb2, 0xca, 0xfb, 0x3c, 0x38, 0x96, 0x71, + 0x47, 0xaa, 0xa7, 0x2f, 0x48, 0x2c, 0x39, 0x88, + 0x2d, 0xc6, 0xb1, 0xf7, 0xc7, 0x2d, 0xda, 0xe9, + 0xfb, 0x4f, 0x9b, 0x1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x0c, 0xdc, 0x36, 0x8d, 0xdc, 0xca, + 0x97, 0x0b, 0xbc, 0xcb, 0x79, 0xc7, 0x4c, 0xd2, + 0x21, 0x5c, 0xbd, 0xeb, 0xea, 0xfb, 0x87, 0xe1, + 0xe0, 0x75, 0x39, 0xb9, 0x84, 0x1e, 0xa7, 0xfe, + 0x7d, 0x41, 0x75, 0x15, 0x88, 0x98, 0xd4, 0x80, + 0x42, 0x57, 0xb5, 0x65, 0xbf, 0xb8, 0xbd, 0x19, + 0x28, 0xd8, 0xa7, 0x6c, 0xe7, 0xc1, 0x00, 0xdc, + 0xde, 0xcb, 0x30, 0x3d, 0x29, 0x5e, 0xa6, 0x9c, + 0xbb, 0xb8, 0xec, 0x28, 0x23, 0x36, 0x23, 0x27, + 0xee, 0xdd, 0x24, 0x7d, 0x9a, 0xc9, 0xb5, 0x3c, + 0x7a, 0x3f, 0x1d, 0xd9, 0x32, 0x47, 0xc0, 0x4d, + 0x86, 0x9b, 0x2d, 0xa9, 0x5c, 0x93, 0x90, 0x51, + 0x70, 0xe6, 0x8f, 0x35, 0x96, 0xe0, 0x11, 0x00, +}; + +/* + * IV method encblkno8, blkno 2. + */ +static const uint8_t bf_cbc_256_encblkno8_vec2_ctxt[SECSIZE] = { + 0x28, 0x93, 0x0f, 0x23, 0xfb, 0xa4, 0x9e, 0xe5, + 0x11, 0x38, 0x2b, 0xbd, 0x8d, 0x2d, 0xdb, 0x11, + 0xfa, 0xac, 0x74, 0x28, 0x95, 0x29, 0xf2, 0x92, + 0x8d, 0x00, 0x8a, 0x8a, 0x04, 0x92, 0x92, 0x33, + 0x8c, 0x4b, 0x29, 0x8e, 0xde, 0x59, 0xf4, 0x72, + 0xae, 0x2f, 0xe4, 0xe9, 0xd4, 0xe4, 0xb6, 0x69, + 0xc5, 0x1b, 0xbe, 0x02, 0x85, 0x4b, 0x24, 0x1e, + 0x79, 0xb9, 0x22, 0x29, 0x4c, 0x60, 0x8c, 0xc5, + 0x03, 0x1d, 0x79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0x30, 0xdc, 0xd0, 0x4d, 0xe6, 0xd6, + 0x0e, 0x2d, 0x77, 0xa3, 0xb3, 0x27, 0xda, 0x99, + 0x62, 0x88, 0x35, 0xba, 0x64, 0x15, 0xec, 0xaf, + 0x70, 0x97, 0x94, 0x81, 0x30, 0x6d, 0x63, 0x42, + 0x71, 0x3e, 0x06, 0xec, 0x50, 0x96, 0x87, 0x59, + 0xe7, 0x26, 0x9c, 0xcf, 0xc7, 0xe7, 0x62, 0x82, + 0x3b, 0xd7, 0xfe, 0xb4, 0x48, 0x45, 0x9d, 0x54, + 0x18, 0x15, 0x13, 0x74, 0x92, 0x6f, 0x43, 0xb3, + 0xa9, 0x82, 0xd4, 0xc2, 0xef, 0x61, 0x9d, 0x5e, + 0x1d, 0xc6, 0x80, 0xd3, 0xe9, 0xdd, 0x52, 0x9c, + 0x4d, 0x04, 0x05, 0xa0, 0x43, 0x36, 0xb6, 0x89, +}; + +/* + * IV method encblkno8, blkno 3. + */ +static const uint8_t bf_cbc_256_encblkno8_vec3_ctxt[SECSIZE] = { + 0x60, 0x91, 0x19, 0x89, 0xee, 0xac, 0x12, 0xe5, + 0x60, 0x6c, 0xfd, 0xf9, 0xe4, 0xc6, 0xc9, 0xbd, + 0x75, 0xe1, 0xa5, 0xe6, 0xf4, 0xed, 0x4b, 0xf4, + 0x16, 0xf4, 0x57, 0xa4, 0xe6, 0x60, 0x8e, 0x1b, + 0x97, 0x0e, 0xd5, 0x09, 0xa1, 0x3c, 0x6c, 0xe8, + 0x91, 0xaf, 0x19, 0x96, 0x2a, 0x7b, 0x77, 0x30, + 0xc7, 0x99, 0xe6, 0xaa, 0xb0, 0xe2, 0x29, 0x1c, + 0x39, 0x54, 0x1c, 0x0a, 0x4a, 0x51, 0xa2, 0xa2, + 0x22, 0x96, 0x05, 0x8b, 0x12, 0x80, 0x16, 0x28, + 0xdc, 0xfa, 0x22, 0x90, 0xa4, 0x33, 0xb1, 0x84, + 0x13, 0x52, 0x5d, 0xb5, 0xd4, 0xe8, 0x60, 0x18, + 0x6a, 0xb8, 0x1b, 0xdb, 0xb4, 0x69, 0xf6, 0x09, + 0x95, 0x71, 0xdd, 0x43, 0x21, 0xad, 0x7e, 0xf7, + 0x8e, 0x7a, 0x0d, 0xf0, 0x52, 0x54, 0xb8, 0xdc, + 0x7d, 0x72, 0x29, 0x97, 0x2b, 0x9c, 0x2c, 0xef, + 0xc3, 0x26, 0x68, 0x72, 0xae, 0x29, 0x0f, 0x67, + 0xbf, 0xea, 0x92, 0x27, 0xd1, 0xba, 0x8d, 0x32, + 0x8b, 0x26, 0x91, 0x30, 0x88, 0xcc, 0x47, 0xaf, + 0x54, 0x8c, 0x88, 0x88, 0x2f, 0x59, 0x76, 0x34, + 0x43, 0x35, 0x44, 0xc3, 0x16, 0x28, 0x62, 0x4b, + 0xbb, 0x47, 0x99, 0x7c, 0x26, 0x51, 0xe2, 0x7d, + 0xd8, 0x2c, 0x35, 0xf4, 0x24, 0xf1, 0x5b, 0x01, + 0xcc, 0x9a, 0x54, 0xd8, 0xc1, 0x73, 0x85, 0x83, + 0xdd, 0x0d, 0xd5, 0x75, 0xac, 0x67, 0x68, 0x59, + 0x3e, 0x6e, 0x9a, 0x4a, 0x7f, 0xbd, 0x85, 0xeb, + 0x36, 0x3e, 0xfd, 0x03, 0xfe, 0x2b, 0xe6, 0x97, + 0x16, 0x6b, 0xd0, 0x22, 0xb1, 0x00, 0xcc, 0x7c, + 0x03, 0xb1, 0x7c, 0x23, 0x7a, 0xca, 0x5e, 0x0b, + 0xba, 0x37, 0xa6, 0x08, 0x5b, 0xa6, 0x2b, 0x57, + 0x58, 0x0b, 0x5a, 0x58, 0x91, 0x3c, 0xf9, 0x46, + 0x05, 0x03, 0x0a, 0x9b, 0xca, 0x2d, 0x71, 0xe2, + 0xbb, 0x1e, 0xd3, 0xc5, 0xc2, 0xb4, 0xde, 0x7b, + 0xbb, 0x8b, 0x45, 0x39, 0xf5, 0x3d, 0xa2, 0xe5, + 0xb1, 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xb5, 0xeb, 0x62, 0xb8, + 0x31, 0x34, 0x07, 0x44, 0xa2, 0x18, 0xec, 0x76, + 0xf7, 0x77, 0x56, 0x86, 0xc7, 0xe0, 0x1e, 0x8e, + 0xec, 0x16, 0x2b, 0xeb, 0xff, 0xaa, 0xba, 0x83, + 0x1f, 0xdc, 0x32, 0x23, 0x27, 0xea, 0xea, 0x0c, + 0x3a, 0x5f, 0x2b, 0xb4, 0xee, 0x0c, 0xf2, 0x73, + 0xbb, 0x59, 0x9b, 0x73, 0xf7, 0xfa, 0xe1, 0x1f, + 0x3b, 0xdb, 0x40, 0x29, 0xf0, 0x6c, 0xbe, 0x8f, + 0x2e, 0xd0, 0x83, 0xf7, 0xe8, 0x2a, 0x81, 0x82, +}; + +const struct testvec bf_cbc_256_8_vectors[] = { + { + .blkno = 0, + .ptxt = bf_cbc_ptxt, + .ctxt = bf_cbc_256_encblkno8_vec0_ctxt, + }, + { + .blkno = 1, + .ptxt = bf_cbc_ptxt, + .ctxt = bf_cbc_256_encblkno8_vec1_ctxt, + }, + { + .blkno = 2, + .ptxt = bf_cbc_ptxt, + .ctxt = bf_cbc_256_encblkno8_vec2_ctxt, + }, + { + .blkno = 3, + .ptxt = bf_cbc_ptxt, + .ctxt = bf_cbc_256_encblkno8_vec3_ctxt, + }, +}; + +/* + * IV method encblkno1, blkno 0. + */ +static const uint8_t bf_cbc_448_encblkno1_vec0_ctxt[SECSIZE] = { + 0xb0, 0x1b, 0x43, 0xc9, 0x84, 0x53, 0x51, 0x72, + 0x1f, 0x93, 0x62, 0x94, 0x13, 0x1f, 0xe3, 0xc1, + 0x30, 0xee, 0xc4, 0x35, 0x98, 0xb8, 0x11, 0x9b, + 0xd1, 0x23, 0xfa, 0x2d, 0xc1, 0xe6, 0xf3, 0x8f, + 0x8b, 0x05, 0x8d, 0xc5, 0x1d, 0xc3, 0x29, 0x1a, + 0xff, 0x08, 0xb0, 0x97, 0x88, 0x50, 0x8f, 0x41, + 0x66, 0xc6, 0x70, 0x37, 0xca, 0xb2, 0xcd, 0x91, + 0x89, 0x41, 0x1b, 0x42, 0xce, 0x02, 0xec, 0xe8, + 0x9b, 0xf3, 0x50, 0x95, 0x5f, 0xba, 0xda, 0xd5, + 0x0c, 0x2f, 0x29, 0x2a, 0x14, 0x96, 0x4a, 0x60, + 0x04, 0x43, 0x62, 0x80, 0x89, 0xcf, 0xfd, 0xb6, + 0xc7, 0x2d, 0xb2, 0xac, 0xce, 0x51, 0xf5, 0xd1, + 0xcd, 0x41, 0x59, 0x8b, 0xf5, 0x02, 0x2d, 0xe8, + 0xc4, 0xee, 0xe9, 0x40, 0x6f, 0xcd, 0xbe, 0x3b, + 0xd0, 0x8d, 0x3e, 0x6c, 0x42, 0x2a, 0x17, 0xfd, + 0x78, 0xf6, 0xb2, 0xde, 0x69, 0x81, 0xbb, 0xae, + 0xd9, 0x1f, 0x49, 0xa6, 0x4c, 0x5a, 0xe9, 0x94, + 0x49, 0x9b, 0x7e, 0x32, 0x6d, 0x11, 0xea, 0x88, + 0xda, 0xf0, 0xc7, 0x8d, 0x07, 0x98, 0xab, 0xc7, + 0xf3, 0xcf, 0x2e, 0xda, 0x27, 0x44, 0x68, 0xc7, + 0xdc, 0xda, 0x00, 0xd0, 0x6d, 0x64, 0x5b, 0x39, + 0x46, 0x3d, 0x98, 0x24, 0xee, 0x3b, 0x36, 0x23, + 0x62, 0xf6, 0x8e, 0xb9, 0x8d, 0xc1, 0x9a, 0x7b, + 0xd7, 0x03, 0x6b, 0xb7, 0x81, 0x19, 0xec, 0x2f, + 0x0c, 0x0b, 0x32, 0x5a, 0xb3, 0x25, 0xf5, 0xcc, + 0xa3, 0x60, 0xe6, 0x4e, 0x03, 0xcd, 0xdc, 0x67, + 0xe5, 0x26, 0xda, 0xe0, 0x1f, 0x33, 0x99, 0xc3, + 0x43, 0x8c, 0x9c, 0x1a, 0x85, 0xb1, 0x15, 0x04, + 0xc1, 0x06, 0xd1, 0x2d, 0xc9, 0x67, 0x72, 0xe7, + 0xd6, 0x6d, 0x1f, 0x22, 0x56, 0x56, 0xfa, 0x8a, + 0xd7, 0x16, 0x37, 0x3f, 0x3e, 0x67, 0xa5, 0xb7, + 0xee, 0x3e, 0xd2, 0x38, 0xd5, 0xce, 0xa9, 0x62, + 0x82, 0x17, 0xae, 0xae, 0x62, 0xe6, 0xb7, 0xf2, + 0x73, 0xf1, 0xc1, 0xb7, 0xe9, 0x62, 0x79, 0x3b, + 0x3b, 0x3f, 0xaa, 0x0d, 0x42, 0x03, 0x35, 0x3f, + 0x5d, 0xa4, 0xba, 0x02, 0x23, 0x65, 0x40, 0x0e, + 0x61, 0x31, 0xc9, 0xd5, 0x79, 0x36, 0x76, 0x7c, + 0x21, 0x4a, 0x75, 0xb2, 0xa0, 0x2b, 0xc1, 0xb8, + 0xba, 0xf8, 0x10, 0x7a, 0x85, 0x32, 0x81, 0xbf, + 0x2d, 0x58, 0x3c, 0x22, 0x2f, 0x0b, 0xce, 0x03, + 0x12, 0xce, 0x13, 0xce, 0x4a, 0x81, 0x77, 0x1d, + 0x68, 0x99, 0xc0, 0x25, 0xeb, 0xd9, 0x80, 0x0d, + 0xe7, 0x17, 0xc8, 0x41, 0xbd, 0x4b, 0x9c, 0xdd, + 0x41, 0x74, 0x90, 0x2a, 0x65, 0x92, 0x05, 0xff, + 0x06, 0x24, 0xeb, 0x89, 0xd8, 0x41, 0xaa, 0x41, + 0xac, 0x8a, 0x31, 0xc6, 0x82, 0x44, 0x12, 0x5a, + 0xd9, 0x1c, 0xca, 0x76, 0x2b, 0x4e, 0xe8, 0x18, + 0x7e, 0x50, 0xf5, 0x8c, 0x7c, 0x11, 0xe7, 0x0e, + 0xfd, 0x08, 0x5e, 0x64, 0x8b, 0x5b, 0x9f, 0x94, + 0x8b, 0x0d, 0x83, 0x7e, 0xef, 0x89, 0x30, 0x4a, + 0x55, 0xce, 0x10, 0x5f, 0x15, 0xd2, 0xe7, 0x07, + 0x0c, 0x34, 0x92, 0xda, 0xae, 0x84, 0x26, 0x28, + 0x36, 0x1a, 0x96, 0xc6, 0xf1, 0x41, 0x2b, 0xb6, + 0x01, 0xfe, 0x20, 0x05, 0x43, 0x80, 0x45, 0xdf, + 0x5c, 0xc2, 0x96, 0xc8, 0x41, 0x68, 0x87, 0x78, + 0xbc, 0xf8, 0x34, 0xfb, 0x19, 0x61, 0xab, 0x7f, + 0x15, 0x56, 0x7f, 0x1a, 0xf5, 0x08, 0xf1, 0x1c, + 0x59, 0x70, 0x92, 0x3a, 0xda, 0x1a, 0xfd, 0xfc, + 0x4d, 0xe1, 0x12, 0x61, 0xc1, 0xd8, 0xdb, 0x63, + 0x6e, 0x6b, 0x19, 0x96, 0x68, 0x17, 0x9b, 0xf5, + 0xa9, 0x5d, 0x2c, 0xaf, 0xad, 0xc6, 0x26, 0x9e, + 0x09, 0xcb, 0x67, 0x4e, 0x50, 0x7d, 0x2f, 0xae, + 0x4e, 0x73, 0xd9, 0x5a, 0xaa, 0x5d, 0x54, 0x20, + 0x7b, 0x77, 0xcf, 0xf8, 0xad, 0x88, 0x6b, 0xc8, +}; + +/* + * IV method encblkno1, blkno 1. + */ +static const uint8_t bf_cbc_448_encblkno1_vec1_ctxt[SECSIZE] = { + 0x8b, 0x2a, 0xcf, 0x7d, 0x38, 0x1b, 0xaa, 0x33, + 0x1c, 0xe6, 0xa1, 0x37, 0x6e, 0x9e, 0xb3, 0x48, + 0x2a, 0xb8, 0x61, 0x11, 0x00, 0xe5, 0x48, 0xea, + 0xb5, 0x9f, 0x6c, 0xa4, 0xdf, 0x8d, 0x5a, 0xd8, + 0x03, 0x55, 0x4d, 0x07, 0x7d, 0x5f, 0x1b, 0x18, + 0xd1, 0x86, 0x52, 0xc1, 0x13, 0xda, 0x99, 0x23, + 0xeb, 0xab, 0xb2, 0x93, 0x40, 0x7c, 0x6a, 0x8a, + 0xaa, 0xf8, 0xf1, 0x66, 0xf1, 0x10, 0x1d, 0xcd, + 0x25, 0xc7, 0x84, 0x55, 0x02, 0x1d, 0xc0, 0x3c, + 0xba, 0xf4, 0xbf, 0xe2, 0xe4, 0xc3, 0x57, 0xdc, + 0x0d, 0xfd, 0xeb, 0xb3, 0x7d, 0x31, 0x82, 0x6b, + 0x5c, 0x0e, 0x92, 0xa5, 0x42, 0x8b, 0x7f, 0x36, + 0x74, 0x4d, 0xfd, 0x2f, 0xd7, 0x19, 0x0d, 0x23, + 0xa7, 0x36, 0xe8, 0xe4, 0xe5, 0xff, 0xc8, 0x0d, + 0xe1, 0x48, 0x25, 0x79, 0xa9, 0x22, 0xac, 0x72, + 0x86, 0x28, 0xcb, 0x63, 0xa6, 0xa0, 0x46, 0x08, + 0x53, 0xb8, 0x59, 0xab, 0x0f, 0x8f, 0xb1, 0x78, + 0xf8, 0x4e, 0x6d, 0x1a, 0xb5, 0xdd, 0x12, 0x02, + 0x57, 0x55, 0xf8, 0xab, 0x78, 0x7d, 0x75, 0x61, + 0x81, 0x20, 0xd6, 0x4b, 0x7d, 0x76, 0x05, 0xc9, + 0x56, 0xf2, 0xe9, 0x3f, 0xb6, 0xb5, 0x02, 0x2b, + 0x1c, 0x29, 0xbf, 0x07, 0xe9, 0x5f, 0x9b, 0x18, + 0x38, 0x26, 0xa0, 0x09, 0xde, 0x24, 0x5b, 0x37, + 0x72, 0x74, 0xf4, 0x9f, 0x86, 0x28, 0x89, 0xb6, + 0x0c, 0x95, 0x24, 0x2f, 0x88, 0x80, 0x6a, 0xc7, + 0x3a, 0xdc, 0x89, 0xb0, 0xa3, 0xfe, 0x6e, 0x38, + 0xec, 0x0b, 0x1d, 0xbc, 0xd5, 0x90, 0x48, 0xfb, + 0xb1, 0x54, 0xac, 0x6e, 0x35, 0xb0, 0x71, 0x9e, + 0x57, 0x07, 0x81, 0x90, 0xcb, 0x63, 0xb2, 0x7f, + 0x4c, 0x81, 0xe1, 0x58, 0xda, 0x27, 0xef, 0x77, + 0xe7, 0xde, 0x96, 0x83, 0x2a, 0xb1, 0x6b, 0x08, + 0x62, 0x89, 0xdc, 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 0x0a, + 0xde, 0xf4, 0x58, 0xe7, 0xd1, 0x04, 0x1d, 0xb7, + 0x1d, 0xa6, 0xcb, 0x49, 0x41, 0x30, 0xb5, 0x41, + 0xb5, 0x14, 0x19, 0xe4, 0xeb, 0x2c, 0xe2, 0xf0, + 0x66, 0x59, 0xe3, 0xc6, 0xb0, 0xd0, 0x1e, 0xaa, + 0x9f, 0xa5, 0x0b, 0xb8, 0xfd, 0xae, 0x62, 0xcf, + 0x3e, 0xe2, 0xea, 0x79, 0xc5, 0x3e, 0xcf, 0xf0, + 0x40, 0x00, 0x8c, 0x81, 0x97, 0xed, 0xac, 0xf9, + 0x61, 0x75, 0x4e, 0xd7, 0xb7, 0xb2, 0x02, 0x14, + 0x04, 0xf6, 0xbf, 0x25, 0xbe, 0x78, 0x2a, 0xea, + 0xd2, 0x61, 0xf2, 0x7e, 0x45, 0x6b, 0x20, 0xca, +}; + +/* + * IV method encblkno1, blkno 2. + */ +static const uint8_t bf_cbc_448_encblkno1_vec2_ctxt[SECSIZE] = { + 0x35, 0x34, 0x49, 0x29, 0x12, 0x3f, 0xc6, 0x2f, + 0xc9, 0x3d, 0xc9, 0x54, 0x46, 0xf3, 0x26, 0xf9, + 0x5e, 0x45, 0xb4, 0xba, 0x6d, 0x0f, 0x98, 0x53, + 0x8b, 0x7a, 0x00, 0x47, 0xb6, 0xbd, 0x70, 0x89, + 0x60, 0x8e, 0x52, 0x0b, 0xe3, 0x0a, 0xd8, 0x0e, + 0x48, 0xf3, 0xcc, 0x66, 0x8d, 0x71, 0xaa, 0x0e, + 0xc2, 0x68, 0x03, 0x05, 0xf9, 0xef, 0x1d, 0x14, + 0x5a, 0x85, 0x88, 0x70, 0x77, 0xcf, 0xe3, 0xdf, + 0x18, 0xe5, 0xfb, 0xea, 0xe1, 0xe8, 0xe0, 0x25, + 0xb2, 0x14, 0x61, 0x5d, 0x2f, 0xce, 0x61, 0xec, + 0x68, 0xc8, 0x06, 0x60, 0x41, 0xc1, 0xe3, 0x0a, + 0x5e, 0x96, 0x15, 0x9b, 0x2c, 0x5b, 0xfd, 0xba, + 0x17, 0x2e, 0x50, 0xb6, 0x68, 0x39, 0x21, 0x56, + 0x31, 0x2e, 0xb5, 0x29, 0xff, 0x4a, 0x12, 0x34, + 0x02, 0x54, 0xb1, 0x7f, 0xd8, 0x35, 0xec, 0x79, + 0x9e, 0xef, 0x62, 0xf3, 0x4b, 0x58, 0x96, 0xf1, + 0x83, 0x26, 0x57, 0x3d, 0x55, 0xb9, 0xb0, 0xa7, + 0x48, 0x65, 0x06, 0xee, 0x14, 0x88, 0xb5, 0x58, + 0xc8, 0x4d, 0x6e, 0xd8, 0x44, 0x76, 0x21, 0x16, + 0xa4, 0xdf, 0x68, 0x4b, 0xff, 0x69, 0x23, 0x66, + 0x18, 0x75, 0xe6, 0x29, 0xea, 0x95, 0x87, 0x1c, + 0xed, 0x2d, 0xbd, 0xbf, 0x22, 0x56, 0x11, 0xd5, + 0x59, 0x90, 0x24, 0xd7, 0xae, 0xda, 0x99, 0x49, + 0xe3, 0x23, 0x03, 0x24, 0x3b, 0x02, 0x49, 0x1d, + 0xa5, 0x57, 0x2f, 0xea, 0xd1, 0x6a, 0x17, 0x53, + 0x0f, 0xb3, 0xa9, 0x64, 0x8a, 0xdb, 0x62, 0x17, + 0xad, 0x5c, 0x7d, 0x56, 0x14, 0x0f, 0xfb, 0x14, + 0xbe, 0x7e, 0xa1, 0xa8, 0x27, 0xf0, 0xf0, 0x3a, + 0xe7, 0xc5, 0x26, 0x98, 0x9d, 0x29, 0xf7, 0xfd, + 0x43, 0x13, 0x34, 0xe2, 0xb8, 0x0b, 0x14, 0xe9, + 0x79, 0x66, 0x7a, 0xf2, 0xed, 0x79, 0x37, 0x16, + 0x75, 0x2b, 0xf2, 0x99, 0xa1, 0xba, 0xf1, 0xc1, + 0x61, 0x8d, 0x78, 0x46, 0x3a, 0x67, 0x58, 0x6a, + 0x55, 0x0d, 0x2e, 0x08, 0x47, 0xfc, 0x94, 0x2f, + 0x65, 0xa1, 0x1a, 0xfe, 0x05, 0xfa, 0x41, 0x00, + 0x6c, 0x42, 0xbc, 0x65, 0x37, 0xd9, 0x25, 0x9c, + 0xf4, 0x83, 0x8a, 0xdb, 0x91, 0x96, 0xc5, 0xa9, + 0x02, 0x44, 0xbc, 0x9a, 0x26, 0x9c, 0xd1, 0xfa, + 0x06, 0x8b, 0xd6, 0x40, 0x8f, 0x0a, 0xd2, 0x5b, + 0xd8, 0x57, 0xd5, 0x61, 0x1b, 0x86, 0xa6, 0x49, + 0x15, 0xe4, 0x06, 0x6c, 0x48, 0x24, 0xb8, 0xe3, + 0x23, 0xed, 0xcf, 0x39, 0x44, 0x4d, 0xf0, 0x4e, + 0x89, 0x44, 0x0d, 0x3a, 0xe6, 0x1b, 0x7c, 0x39, + 0xfd, 0x79, 0x0e, 0x78, 0xc7, 0xf6, 0xa3, 0x91, + 0x18, 0x2a, 0xfb, 0x92, 0x48, 0xcc, 0x8b, 0xbb, + 0x33, 0x07, 0x42, 0xf5, 0xd0, 0x01, 0x8b, 0x12, + 0xd9, 0x5e, 0x9d, 0xe4, 0x13, 0x99, 0x11, 0x18, + 0x86, 0x8a, 0xb7, 0xa6, 0xe2, 0x38, 0x34, 0x12, + 0x67, 0xd6, 0x4b, 0xc0, 0x23, 0x56, 0xba, 0x53, + 0xbe, 0x20, 0xe5, 0xec, 0x16, 0xf9, 0x74, 0x92, + 0x62, 0xfc, 0xb9, 0xe8, 0xa3, 0xbf, 0x3b, 0x06, + 0x76, 0xa5, 0xf5, 0x56, 0x81, 0x72, 0x50, 0xc8, + 0x55, 0x80, 0x7d, 0xe1, 0x46, 0x92, 0xa1, 0xeb, + 0x41, 0xaf, 0xce, 0x52, 0xb1, 0xb3, 0x51, 0xf2, + 0xba, 0x03, 0xb4, 0xcb, 0x16, 0xd2, 0x92, 0x3d, + 0x0c, 0x9b, 0xe9, 0xd9, 0x5d, 0xcf, 0x79, 0x05, + 0xbd, 0xe0, 0x44, 0x39, 0xf0, 0x35, 0x2d, 0x7a, + 0x31, 0x3b, 0x24, 0xb3, 0xb4, 0xa5, 0x08, 0xf5, + 0xac, 0x51, 0xf1, 0x09, 0x52, 0x14, 0xc7, 0xb5, + 0xe0, 0x65, 0x47, 0x30, 0xdd, 0xa4, 0xfd, 0x71, + 0x68, 0xa5, 0x4b, 0x00, 0x72, 0xe2, 0xc4, 0xa9, + 0x5d, 0x21, 0x6d, 0x83, 0x4e, 0x88, 0xaa, 0x76, + 0x07, 0xf0, 0xf7, 0x36, 0xa2, 0x5e, 0xd5, 0x4c, + 0x7f, 0x9b, 0x74, 0x89, 0x0a, 0x18, 0xdc, 0x9a, +}; + +/* + * IV method encblkno1, blkno 3. + */ +static const uint8_t bf_cbc_448_encblkno1_vec3_ctxt[SECSIZE] = { + 0xc3, 0xd3, 0xae, 0x7e, 0x4f, 0xbe, 0x0d, 0x50, + 0xd6, 0x63, 0x2c, 0xa2, 0xfd, 0x07, 0xf1, 0x33, + 0x2a, 0x15, 0x8f, 0xd7, 0x63, 0xb6, 0x5f, 0x04, + 0x69, 0x90, 0xa3, 0x1a, 0xd3, 0xdd, 0xe0, 0x70, + 0xb1, 0xcd, 0xd5, 0xe0, 0x75, 0xd2, 0x31, 0x38, + 0xcc, 0x65, 0xbb, 0xc3, 0x3b, 0xc6, 0xc9, 0x33, + 0x43, 0x9c, 0x32, 0x69, 0x95, 0x10, 0x74, 0x36, + 0x3a, 0x05, 0x9c, 0x26, 0x2f, 0x80, 0x20, 0x92, + 0x74, 0x31, 0xc0, 0xf4, 0xb1, 0x42, 0x58, 0xc8, + 0x3e, 0xaa, 0xd4, 0xba, 0xba, 0x4b, 0x5f, 0x47, + 0x1a, 0x9e, 0x43, 0xaf, 0x25, 0x64, 0x0c, 0x2e, + 0xa3, 0xf5, 0xde, 0x6e, 0x28, 0x5e, 0xb9, 0x9e, + 0xc9, 0xdf, 0x85, 0xda, 0xc9, 0xa8, 0x30, 0xf9, + 0x44, 0x9b, 0x16, 0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, 0x13, + 0x40, 0xea, 0xaa, 0x84, 0xd9, 0x47, 0xfd, 0x65, + 0x2c, 0x3d, 0xb0, 0x76, 0xe7, 0xdd, 0xd7, 0x06, + 0x8a, 0x79, 0xa7, 0x6c, 0x3a, 0x2d, 0x32, 0xf7, + 0xae, 0xe7, 0xd2, 0xb1, 0xf2, 0xe0, 0x3a, 0x10, + 0x19, 0xa1, 0x79, 0x7b, 0x76, 0x0b, 0xeb, 0xf3, + 0x01, 0x6e, 0x9f, 0xa1, 0x5d, 0x16, 0x09, 0xec, + 0x6b, 0x64, 0xe3, 0x96, 0xb8, 0x89, 0x99, 0x8c, + 0x77, 0xcf, 0x3f, 0x37, 0x42, 0x51, 0x82, 0x5a, + 0x63, 0x89, 0x12, 0x12, 0x59, 0x38, 0xe3, 0xcf, + 0xa0, 0xda, 0xbc, 0x69, 0x75, 0x48, 0x7c, 0x3e, + 0x56, 0x75, 0x12, 0x10, 0xc5, 0x96, 0x5b, 0x34, + 0x52, 0x2e, 0xce, 0xba, 0xd2, 0x7f, 0x8f, 0x1c, + 0xbd, 0x35, 0x3b, 0x74, 0x5b, 0x6c, 0xfe, 0xa7, + 0xf1, 0x4a, 0x07, 0x95, 0xff, 0xa8, 0xa0, 0x2a, + 0x85, 0xec, 0xd7, 0x56, 0x3b, 0x28, 0x2e, 0x09, + 0x50, 0x43, 0xbd, 0x49, 0x22, 0xdc, 0x78, 0x0e, + 0x7e, 0x68, 0x78, 0xd5, 0x57, 0xc2, 0xd6, 0x7c, + 0x2f, 0xd0, 0x4a, 0x62, 0x16, 0x38, 0x04, 0x23, + 0x43, 0x21, 0xaa, 0xe1, 0x96, 0x0e, 0xa9, 0x22, + 0xe7, 0x2c, 0xb8, 0x5e, 0x8f, 0xc6, 0x2d, 0xbd, + 0x99, 0x25, 0x33, 0xb8, 0x47, 0x99, 0x8d, 0xf5, + 0x22, 0x08, 0x9b, 0xd5, 0xad, 0x83, 0x67, 0xec, + 0x05, 0x89, 0xda, 0xd6, 0xe4, 0xe2, 0xd5, 0xef, + 0x7f, 0x61, 0x1e, 0x03, 0x81, 0x03, 0xb1, 0x98, + 0x5a, 0x29, 0x69, 0x13, 0xb2, 0xe6, 0xe1, 0x2c, + 0x66, 0x88, 0x39, 0x90, 0xf9, 0xae, 0x5d, 0x71, + 0xfe, 0x07, 0x30, 0x7d, 0xba, 0xa9, 0x37, 0xb5, + 0xff, 0x2c, 0xa9, 0xe6, 0x95, 0x48, 0xb2, 0xc8, +}; + +const struct testvec bf_cbc_448_1_vectors[] = { + { + .blkno = 0, + .ptxt = bf_cbc_ptxt, + .ctxt = bf_cbc_448_encblkno1_vec0_ctxt, + }, + { + .blkno = 1, + .ptxt = bf_cbc_ptxt, + .ctxt = bf_cbc_448_encblkno1_vec1_ctxt, + }, + { + .blkno = 2, + .ptxt = bf_cbc_ptxt, + .ctxt = bf_cbc_448_encblkno1_vec2_ctxt, + }, + { + .blkno = 3, + .ptxt = bf_cbc_ptxt, + .ctxt = bf_cbc_448_encblkno1_vec3_ctxt, + }, +}; + +/* + * IV method encblkno8, blkno 0. + */ +static const uint8_t bf_cbc_448_encblkno8_vec0_ctxt[SECSIZE] = { + 0x91, 0xb4, 0x8f, 0x78, 0x34, 0xbe, 0x03, 0xe9, + 0x4b, 0xca, 0xf4, 0xfa, 0x27, 0x99, 0xa0, 0xd0, + 0xa0, 0x85, 0xf9, 0xca, 0xcc, 0x2e, 0x0d, 0x41, + 0x91, 0xdb, 0xf9, 0x71, 0xcd, 0x49, 0xf7, 0x66, + 0x9b, 0x0c, 0x70, 0x49, 0x36, 0x72, 0xf4, 0xc0, + 0x17, 0xdd, 0xd8, 0x6a, 0xd2, 0x17, 0xfe, 0x50, + 0xa3, 0x2b, 0xa8, 0x7c, 0x9c, 0x12, 0x8c, 0x08, + 0x3d, 0xb5, 0x20, 0xc0, 0x83, 0xc1, 0xf5, 0x34, + 0x4b, 0xa5, 0xcc, 0x7c, 0xc6, 0x9f, 0x4b, 0x7f, + 0x09, 0x0c, 0x04, 0xe3, 0x02, 0xfe, 0xe2, 0x5a, + 0x45, 0xee, 0x4a, 0xcb, 0xc0, 0xe1, 0xf1, 0xae, + 0x1a, 0x22, 0x95, 0xb9, 0x30, 0xe8, 0x2d, 0x90, + 0xe5, 0x6a, 0x2f, 0x0a, 0x59, 0x15, 0xfc, 0x60, + 0xa5, 0x91, 0x95, 0x1a, 0xa2, 0xf5, 0x87, 0xa3, + 0x97, 0x45, 0x1b, 0xfb, 0x78, 0x62, 0x8b, 0xb6, + 0x86, 0xc6, 0x94, 0x9a, 0x9d, 0x09, 0x46, 0xc9, + 0x1f, 0x5f, 0x2e, 0x6c, 0xed, 0x5e, 0xe2, 0xab, + 0xca, 0x30, 0xdb, 0x13, 0x37, 0x8d, 0xb7, 0xc6, + 0xce, 0x74, 0xe3, 0xe2, 0x64, 0x7b, 0x74, 0x3e, + 0x9f, 0x18, 0x4e, 0xe2, 0x2b, 0x52, 0x08, 0x60, + 0x2b, 0x6d, 0x17, 0x1a, 0xff, 0xae, 0xfb, 0xea, + 0x59, 0x1d, 0x45, 0xe8, 0xf9, 0x0c, 0x56, 0xb8, + 0xb5, 0xc7, 0x8f, 0xa7, 0x9e, 0x67, 0x87, 0xbb, + 0xe2, 0x37, 0x56, 0x49, 0xed, 0x75, 0x27, 0x54, + 0xb5, 0x16, 0x34, 0xb6, 0xa6, 0xe0, 0x27, 0x48, + 0x91, 0xfb, 0x80, 0x4f, 0x5e, 0xef, 0x40, 0x6d, + 0x28, 0x8f, 0x2e, 0x56, 0xab, 0x6c, 0x7d, 0xde, + 0xbd, 0xa5, 0xa6, 0x47, 0xe2, 0xc9, 0xb0, 0xc5, + 0x69, 0x5d, 0x57, 0x18, 0x59, 0x08, 0x66, 0x1b, + 0xdc, 0x4f, 0xa4, 0xe2, 0xb5, 0xff, 0x72, 0x4d, + 0x25, 0x79, 0x38, 0x8f, 0xca, 0x23, 0x81, 0x31, + 0x1d, 0xeb, 0x7b, 0x7e, 0x04, 0xc3, 0x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xdc, 0xeb, 0x14, 0xe6, 0x8c, 0x21, 0x20, + 0xbb, 0x42, 0x6a, 0xba, 0x55, 0x79, 0x54, 0x8b, + 0xa8, 0x43, 0x14, 0x28, 0x66, 0xd2, 0x44, 0x65, + 0x9c, 0xa9, 0xdc, 0x3b, 0x3f, 0xab, 0x36, 0xb4, + 0xbc, 0x9d, 0x22, 0x92, 0x24, 0xa8, 0x29, 0x18, + 0x98, 0x3a, 0xbe, 0xa1, 0xb4, 0xf8, 0x7f, 0xea, + 0x2f, 0x58, 0x69, 0xce, 0xee, 0x99, 0x76, 0x2c, + 0x53, 0x84, 0xf5, 0x9e, 0xa3, 0x98, 0xe6, 0x94, + 0x39, 0xfa, 0xfa, 0x6d, 0x66, 0xe2, 0x39, 0x2b, + 0x4b, 0x84, 0x14, 0x89, 0x18, 0xa2, 0x03, 0xdd, +}; + +/* + * IV method encblkno8, blkno 1. + */ +static const uint8_t bf_cbc_448_encblkno8_vec1_ctxt[SECSIZE] = { + 0x90, 0x3d, 0xee, 0x58, 0xf7, 0xe3, 0xc4, 0x18, + 0xaf, 0xfa, 0xaf, 0xed, 0x9a, 0x45, 0xe7, 0xa8, + 0xbe, 0xcd, 0x0f, 0xb9, 0x53, 0x18, 0xc6, 0x14, + 0xbe, 0xbb, 0x90, 0x1c, 0x5c, 0x60, 0x93, 0xcb, + 0x62, 0xb3, 0xdb, 0x31, 0x19, 0x39, 0xce, 0x3f, + 0xe4, 0x8f, 0x44, 0xc1, 0x10, 0x80, 0x05, 0x6b, + 0x77, 0xe3, 0xe1, 0xe5, 0xd2, 0x6d, 0x93, 0xf2, + 0xb3, 0x81, 0x03, 0xf8, 0xbc, 0x7b, 0x5a, 0x71, + 0x15, 0x16, 0x3a, 0x2f, 0x03, 0xbb, 0x67, 0x6a, + 0xd9, 0xf5, 0x63, 0x6f, 0x3d, 0x75, 0x1b, 0x0a, + 0x4b, 0x9d, 0x04, 0x11, 0x7e, 0xe8, 0x3e, 0x2d, + 0x04, 0x8f, 0xbf, 0x8a, 0xb2, 0x35, 0x76, 0xc5, + 0xcc, 0x6d, 0x9e, 0x99, 0x71, 0x13, 0xf6, 0x5e, + 0xeb, 0x74, 0x96, 0x8a, 0x29, 0x38, 0x0b, 0x25, + 0x4b, 0x89, 0xa9, 0x43, 0x3c, 0x2f, 0x03, 0x14, + 0x8d, 0x0f, 0xe3, 0xe7, 0x01, 0xd1, 0x2e, 0x14, + 0x08, 0x51, 0xba, 0x06, 0x39, 0x76, 0x35, 0xbc, + 0x14, 0xa6, 0x16, 0x36, 0x47, 0xcc, 0x48, 0xe0, + 0xd6, 0xd7, 0x07, 0xb0, 0xf0, 0x30, 0x6c, 0xf8, + 0x68, 0x9d, 0x6c, 0x4b, 0x69, 0x33, 0x78, 0x0e, + 0x4a, 0xfa, 0x97, 0xfb, 0x0c, 0x0d, 0x0a, 0xc3, + 0x4b, 0x7b, 0x77, 0x77, 0x18, 0x9a, 0x74, 0x85, + 0x2f, 0xae, 0xc7, 0x90, 0x45, 0x4b, 0xa2, 0x06, + 0x3e, 0xa2, 0x48, 0xe7, 0x6c, 0x86, 0x65, 0x78, + 0x97, 0x0b, 0x97, 0xc1, 0x70, 0x91, 0x12, 0x79, + 0xae, 0xf0, 0x2b, 0x44, 0xe9, 0x84, 0x8d, 0x78, + 0x53, 0xf8, 0x3a, 0xf5, 0x9f, 0x27, 0x3d, 0x49, + 0x69, 0xd1, 0x18, 0xa4, 0xb2, 0xd0, 0xbb, 0xf2, + 0x57, 0x76, 0xb7, 0x77, 0x16, 0x2f, 0xf8, 0x0c, + 0xa5, 0x86, 0x43, 0x0d, 0x2d, 0xfe, 0x84, 0xc6, + 0xbb, 0x58, 0x81, 0x47, 0x3d, 0xa3, 0x93, 0xb0, + 0x50, 0xfc, 0x25, 0xf7, 0xc5, 0x05, 0xe5, 0xf2, + 0xb3, 0x79, 0x12, 0xe4, 0x37, 0x71, 0x2d, 0xe8, + 0xa5, 0x0b, 0xce, 0x67, 0x51, 0x4f, 0xab, 0xc7, + 0x7b, 0x3b, 0xac, 0x78, 0x97, 0x82, 0x02, 0xf4, + 0x62, 0x20, 0x1b, 0x8b, 0xac, 0x07, 0x3b, 0xd7, + 0x0b, 0x99, 0x27, 0x85, 0x52, 0x7a, 0x79, 0x18, + 0xfb, 0x81, 0x3a, 0x05, 0x76, 0x6c, 0x3c, 0x6a, + 0x35, 0xe1, 0x2b, 0x03, 0x48, 0x70, 0x1a, 0xa8, + 0x30, 0x33, 0x61, 0xe2, 0xd8, 0x99, 0x86, 0x7f, + 0xfd, 0xe0, 0x4a, 0xe4, 0x62, 0xa1, 0xac, 0xcb, + 0xb8, 0x8a, 0xf3, 0xaa, 0xd6, 0x61, 0x9d, 0xc5, + 0xdb, 0xf5, 0x53, 0x39, 0x1d, 0xd7, 0xf8, 0x96, + 0xc6, 0x2b, 0xca, 0xbf, 0x83, 0x4e, 0x89, 0x63, + 0x53, 0x6f, 0x17, 0xaa, 0xf3, 0x61, 0x9b, 0x75, + 0x8c, 0x5a, 0xf8, 0x21, 0x84, 0x52, 0xb8, 0x76, + 0xbc, 0xf5, 0x9b, 0xd6, 0x98, 0x26, 0x58, 0xec, + 0xdd, 0xa8, 0xf1, 0xee, 0x9e, 0x14, 0x24, 0x94, + 0x7c, 0xb6, 0x45, 0x8b, 0xc7, 0x85, 0x50, 0x4e, + 0x30, 0xd7, 0x51, 0x8c, 0x33, 0xeb, 0xeb, 0x5d, + 0x52, 0x58, 0x43, 0xcb, 0x25, 0x4a, 0x77, 0x34, + 0xe6, 0x70, 0x5b, 0x6f, 0x8f, 0xe8, 0x07, 0xee, + 0x76, 0x4a, 0xad, 0xab, 0x11, 0x8a, 0x1b, 0x92, + 0x60, 0x79, 0xb8, 0xe0, 0x88, 0xa7, 0x3a, 0xe0, + 0x15, 0xf6, 0x57, 0xf0, 0xe8, 0x87, 0xda, 0xf8, + 0x90, 0x4e, 0xe7, 0xb3, 0xb4, 0xe7, 0x73, 0x5c, + 0xd3, 0x69, 0xfb, 0x23, 0x4f, 0x4f, 0xc8, 0xd2, + 0xfb, 0xf5, 0xf5, 0x76, 0x80, 0xb6, 0xb7, 0xe2, + 0xb7, 0x96, 0x1a, 0x97, 0x12, 0x40, 0x16, 0x86, + 0xd6, 0x66, 0xf5, 0x46, 0x9e, 0x04, 0x62, 0xaa, + 0x9c, 0xc9, 0x45, 0x39, 0x5c, 0xd3, 0x58, 0x40, + 0xb4, 0x32, 0xd8, 0x6c, 0x19, 0xfa, 0xa5, 0x5f, + 0x1e, 0x83, 0x5a, 0x32, 0x5e, 0x1d, 0xab, 0xa9, + 0x48, 0x1b, 0x1b, 0x37, 0x66, 0xf8, 0x67, 0xd7, +}; + +/* + * IV method encblkno8, blkno 2. + */ +static const uint8_t bf_cbc_448_encblkno8_vec2_ctxt[SECSIZE] = { + 0xb3, 0x2d, 0x0d, 0x90, 0x7a, 0x50, 0xb6, 0x29, + 0x9d, 0xd4, 0x12, 0x1a, 0xc9, 0x71, 0x56, 0xc4, + 0xce, 0x3d, 0x74, 0xf9, 0x91, 0xe4, 0x79, 0x8a, + 0x42, 0x34, 0x1a, 0xd4, 0x84, 0xaa, 0x01, 0x85, + 0x13, 0xe8, 0xab, 0xaa, 0xb6, 0x81, 0x82, 0xd6, + 0x32, 0xd6, 0x9f, 0x63, 0x69, 0x55, 0x10, 0x5f, + 0x2e, 0xb3, 0x51, 0x74, 0x80, 0x5c, 0xe9, 0x8d, + 0x27, 0xd8, 0x41, 0x2d, 0x27, 0x07, 0xb4, 0x13, + 0xcd, 0xc0, 0xb3, 0x96, 0xaa, 0x59, 0x9c, 0x3e, + 0x16, 0x9e, 0x18, 0xa5, 0x92, 0x52, 0x59, 0x19, + 0x19, 0x62, 0xeb, 0xd9, 0xdf, 0x9d, 0x10, 0x77, + 0xfb, 0x3c, 0xf1, 0xeb, 0x70, 0xf6, 0x6a, 0x9b, + 0xad, 0x99, 0x35, 0xd7, 0xf8, 0xde, 0x2b, 0x52, + 0x85, 0xdd, 0x36, 0x07, 0x3a, 0x88, 0xa6, 0xbb, + 0x98, 0x7a, 0xe3, 0xb0, 0xe6, 0xae, 0x33, 0x5d, + 0x47, 0x0c, 0x6c, 0xd4, 0x84, 0x33, 0x7e, 0xf4, + 0xea, 0xfd, 0xf1, 0x1c, 0xdb, 0x8b, 0xfe, 0x01, + 0x77, 0xa3, 0x07, 0x21, 0x09, 0xac, 0x0c, 0xe4, + 0x63, 0xaa, 0x3d, 0xb3, 0x05, 0xf8, 0x73, 0x03, + 0x69, 0x53, 0x2f, 0xd3, 0x53, 0x29, 0xf2, 0x02, + 0x60, 0x41, 0xed, 0xc7, 0xe9, 0x2e, 0xba, 0x54, + 0xa4, 0xfe, 0x26, 0xf0, 0xd9, 0x2c, 0x58, 0x2d, + 0x90, 0x94, 0x19, 0xf9, 0xe5, 0xaa, 0xe2, 0x13, + 0x9a, 0x67, 0x90, 0x44, 0x61, 0x36, 0xd0, 0x3f, + 0xe7, 0xe8, 0x7e, 0x47, 0x2b, 0x84, 0x97, 0xe2, + 0x0b, 0x8a, 0xfa, 0x2f, 0xbc, 0x1a, 0x70, 0xed, + 0xb2, 0x93, 0x36, 0x0e, 0xe6, 0xb1, 0xa2, 0x5a, + 0x04, 0x04, 0x8d, 0x2f, 0x82, 0xdb, 0x49, 0x5e, + 0x1b, 0x90, 0xc1, 0x27, 0x2a, 0x2f, 0x64, 0x5b, + 0xce, 0x35, 0x06, 0x0d, 0xb6, 0x05, 0x50, 0x5a, + 0x90, 0xc8, 0x21, 0xd0, 0xf0, 0xb9, 0xf3, 0x43, + 0x25, 0xd8, 0xb9, 0x86, 0xb7, 0xd0, 0x29, 0x75, + 0xdc, 0xf6, 0xf6, 0x14, 0x5e, 0x1f, 0xad, 0x54, + 0x28, 0x63, 0x92, 0xcd, 0xcd, 0x75, 0xb2, 0xe8, + 0xf3, 0x1f, 0xfd, 0x88, 0x72, 0x04, 0xab, 0xe2, + 0x77, 0x21, 0xc1, 0xb4, 0x87, 0xa7, 0x98, 0x86, + 0x2d,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 0x45, 0x3c, 0x82, + 0x5b, 0xf6, 0x03, 0x35, 0xdd, 0x03, 0x22, 0xbe, + 0x77, 0x9c, 0x6a, 0x7d, 0xc8, 0x29, 0x41, 0x53, + 0xbb, 0xab, 0x6e, 0xa5, 0x00, 0xaf, 0x3b, 0x1d, + 0x76, 0x12, 0xac, 0x44, 0x5c, 0x7d, 0xd2, 0x3b, + 0x3a, 0x95, 0xb0, 0xa9, 0x4f, 0x27, 0x76, 0x17, +}; + +/* + * IV method encblkno8, blkno 3. + */ +static const uint8_t bf_cbc_448_encblkno8_vec3_ctxt[SECSIZE] = { + 0x8e, 0xc4, 0x56, 0x64, 0x1e, 0x2a, 0x0d, 0x60, + 0x54, 0x5c, 0xcd, 0xe0, 0x6d, 0xa7, 0x4c, 0x30, + 0x7e, 0x85, 0x21, 0xdf, 0xaa, 0xb2, 0x32, 0xde, + 0xc0, 0xc6, 0x56, 0xe0, 0x43, 0xc2, 0x3e, 0x6c, + 0x8c, 0x62, 0x35, 0xaa, 0xf9, 0xba, 0xc9, 0x52, + 0x38, 0x72, 0x06, 0xcc, 0x02, 0xa2, 0xb8, 0x85, + 0xf7, 0xcc, 0xe6, 0x8c, 0x86, 0x8f, 0x9c, 0xd6, + 0x1f, 0xf8, 0x24, 0x9d, 0xca, 0xe8, 0xed, 0x3c, + 0x80, 0x0b, 0xaf, 0x0c, 0x78, 0x4f, 0x5b, 0x2a, + 0x0f, 0xfe, 0xe5, 0xe6, 0x12, 0x8a, 0xff, 0xc7, + 0x6a, 0x97, 0xd9, 0xcb, 0xc8, 0x6a, 0x83, 0x12, + 0xa1, 0x12, 0x84, 0xc8, 0x72, 0x1c, 0xb7, 0x68, + 0x23, 0x24, 0xff, 0x5a, 0x78, 0x99, 0x9d, 0xb8, + 0x03, 0x70, 0x0a, 0x09, 0xa1, 0x3d, 0xfe, 0xe0, + 0xc5, 0x1b, 0xea, 0x58, 0xbc, 0x52, 0x70, 0xa2, + 0x4e, 0xcc, 0x43, 0xfb, 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 0x87, 0x55, 0x7c, 0x45, + 0x3a, 0xb4, 0xfe, 0x97, 0x24, 0x17, 0x1d, 0x5e, + 0xdf, 0xe0, 0xe8, 0x17, 0xa6, 0x31, 0x99, 0xeb, + 0xb7, 0xb5, 0xd5, 0xd7, 0x7c, 0x2f, 0x22, 0x26, +}; + +const struct testvec bf_cbc_448_8_vectors[] = { + { + .blkno = 0, + .ptxt = bf_cbc_ptxt, + .ctxt = bf_cbc_448_encblkno8_vec0_ctxt, + }, + { + .blkno = 1, + .ptxt = bf_cbc_ptxt, + .ctxt = bf_cbc_448_encblkno8_vec1_ctxt, + }, + { + .blkno = 2, + .ptxt = bf_cbc_ptxt, + .ctxt = bf_cbc_448_encblkno8_vec2_ctxt, + }, + { + .blkno = 3, + .ptxt = bf_cbc_ptxt, + .ctxt = bf_cbc_448_encblkno8_vec3_ctxt, + }, +}; + +static int +open_disk(const char *devpath, const char *imgpath, size_t size) +{ + int fd; + + fd = open(imgpath, O_CREAT | O_RDWR | O_TRUNC, 0600); + if (fd < 0) + return -1; + + if (ftruncate(fd, size) < 0) + goto fail; + + if (rump_pub_etfs_register_withsize(devpath, + imgpath, RUMP_ETFS_BLK, 0, size) < 0) { + goto fail; + } + + unlink(imgpath); + return fd; +fail: + close(fd); + unlink(imgpath); + return -1; +} + +static int +open_cgd(int devno) +{ + char devpath[32]; + + sprintf(devpath, "/dev/rcgd%d%c", devno, getrawpartition() + 'a'); + + return rump_sys_open(devpath, O_RDWR, 0); +} + +static int +configure_cgd(int fd, const char *dkpath, const char *alg, + const char *ivmethod, const char *key, size_t keylen) +{ + struct cgd_ioctl ci; + + memset(&ci, 0, sizeof(ci)); + ci.ci_disk = dkpath; + ci.ci_alg = alg; + ci.ci_ivmethod = ivmethod; + ci.ci_keylen = 8 * keylen - 8; /* Exclude the NUL terminator. */ + ci.ci_key = key; + ci.ci_blocksize = 64; + + return rump_sys_ioctl(fd, CGDIOCSET, &ci); +} + +static int +unconfigure_cgd(int fd) +{ + struct cgd_ioctl ci; + + return rump_sys_ioctl(fd, CGDIOCCLR, &ci); +} + +static int +write_testvec(int cgdfd, const struct testvec *tv) +{ + + if (rump_sys_lseek(cgdfd, tv->blkno * SECSIZE, SEEK_SET) < 0) + return -1; + + if (rump_sys_write(cgdfd, tv->ptxt, SECSIZE) != SECSIZE) + return -1; + + return 0; +} + +static int +read_testvec(int cgdfd, const struct testvec *tv) +{ + char *buf; + int res = -1; + + buf = malloc(SECSIZE); + if (buf == NULL) + return -1; + + if (rump_sys_lseek(cgdfd, tv->blkno * SECSIZE, SEEK_SET) < 0) + goto fail; + + if (rump_sys_read(cgdfd, buf, SECSIZE) != SECSIZE) + goto fail; + + res = memcmp(buf, tv->ptxt, SECSIZE); +fail: + free(buf); + return res; +} + +static int +check_testvec(int dkfd, const struct testvec *tv) +{ + char *buf; + int res = -1; + + buf = malloc(SECSIZE); + if (buf == NULL) + return -1; + + if (lseek(dkfd, tv->blkno * SECSIZE, SEEK_SET) < 0) + goto fail; + + if (read(dkfd, buf, SECSIZE) != SECSIZE) + goto fail; + + res = memcmp(buf, tv->ctxt, SECSIZE); +fail: + free(buf); + return res; +} + +ATF_TC(cgd_bf_cbc_128_encblkno1); +ATF_TC_HEAD(cgd_bf_cbc_128_encblkno1, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Test blowfish-cbc with 128 bits key, ivmethod encblkno1"); +} + +ATF_TC_BODY(cgd_bf_cbc_128_encblkno1, tc) +{ + const char imgpath[] = "blowfish-cbc-128-encblkno1.img"; + const char *dkpath = "/dev/dk"; + const size_t dksize = 4 * SECSIZE; /* Last blkno is 3. */ + int dkfd, cgdfd; + + rump_init(); + + RL(dkfd = open_disk(dkpath, imgpath, dksize)); + + RL(cgdfd = open_cgd(0)); + RL(configure_cgd(cgdfd, dkpath, "blowfish-cbc", "encblkno1", + bf_cbc_128_key, sizeof(bf_cbc_128_key))); + + ATF_CHECK_EQ(write_testvec(cgdfd, &bf_cbc_128_1_vectors[0]), 0); + ATF_CHECK_EQ(write_testvec(cgdfd, &bf_cbc_128_1_vectors[1]), 0); + ATF_CHECK_EQ(write_testvec(cgdfd, &bf_cbc_128_1_vectors[2]), 0); + ATF_CHECK_EQ(write_testvec(cgdfd, &bf_cbc_128_1_vectors[3]), 0); + + RL(unconfigure_cgd(cgdfd)); + RL(configure_cgd(cgdfd, dkpath, "blowfish-cbc", "encblkno1", + bf_cbc_128_key, sizeof(bf_cbc_128_key))); + + ATF_CHECK_EQ(read_testvec(cgdfd, &bf_cbc_128_1_vectors[0]), 0); + ATF_CHECK_EQ(read_testvec(cgdfd, &bf_cbc_128_1_vectors[1]), 0); + ATF_CHECK_EQ(read_testvec(cgdfd, &bf_cbc_128_1_vectors[2]), 0); + ATF_CHECK_EQ(read_testvec(cgdfd, &bf_cbc_128_1_vectors[3]), 0); + + RL(unconfigure_cgd(cgdfd)); + RL(rump_sys_close(cgdfd)); + + ATF_CHECK_EQ(check_testvec(dkfd, &bf_cbc_128_1_vectors[0]), 0); + ATF_CHECK_EQ(check_testvec(dkfd, &bf_cbc_128_1_vectors[1]), 0); + ATF_CHECK_EQ(check_testvec(dkfd, &bf_cbc_128_1_vectors[2]), 0); + ATF_CHECK_EQ(check_testvec(dkfd, &bf_cbc_128_1_vectors[3]), 0); + + RL(close(dkfd)); +} + +ATF_TC(cgd_bf_cbc_128_encblkno8); +ATF_TC_HEAD(cgd_bf_cbc_128_encblkno8, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Test blowfish-cbc with 128 bits key, ivmethod encblkno8"); +} + +ATF_TC_BODY(cgd_bf_cbc_128_encblkno8, tc) +{ + const char imgpath[] = "blowfish-cbc-128-encblkno8.img"; + const char *dkpath = "/dev/dk"; + const size_t dksize = 4 * SECSIZE; /* Last blkno is 3. */ + int dkfd, cgdfd; + + rump_init(); + + RL(dkfd = open_disk(dkpath, imgpath, dksize)); + + RL(cgdfd = open_cgd(0)); + RL(configure_cgd(cgdfd, dkpath, "blowfish-cbc", "encblkno8", + bf_cbc_128_key, sizeof(bf_cbc_128_key))); + + ATF_CHECK_EQ(write_testvec(cgdfd, &bf_cbc_128_8_vectors[0]), 0); + ATF_CHECK_EQ(write_testvec(cgdfd, &bf_cbc_128_8_vectors[1]), 0); + ATF_CHECK_EQ(write_testvec(cgdfd, &bf_cbc_128_8_vectors[2]), 0); + ATF_CHECK_EQ(write_testvec(cgdfd, &bf_cbc_128_8_vectors[3]), 0); + + RL(unconfigure_cgd(cgdfd)); + RL(configure_cgd(cgdfd, dkpath, "blowfish-cbc", "encblkno8", + bf_cbc_128_key, sizeof(bf_cbc_128_key))); + + ATF_CHECK_EQ(read_testvec(cgdfd, &bf_cbc_128_8_vectors[0]), 0); + ATF_CHECK_EQ(read_testvec(cgdfd, &bf_cbc_128_8_vectors[1]), 0); + ATF_CHECK_EQ(read_testvec(cgdfd, &bf_cbc_128_8_vectors[2]), 0); + ATF_CHECK_EQ(read_testvec(cgdfd, &bf_cbc_128_8_vectors[3]), 0); + + RL(unconfigure_cgd(cgdfd)); + RL(rump_sys_close(cgdfd)); + + ATF_CHECK_EQ(check_testvec(dkfd, &bf_cbc_128_8_vectors[0]), 0); + ATF_CHECK_EQ(check_testvec(dkfd, &bf_cbc_128_8_vectors[1]), 0); + ATF_CHECK_EQ(check_testvec(dkfd, &bf_cbc_128_8_vectors[2]), 0); + ATF_CHECK_EQ(check_testvec(dkfd, &bf_cbc_128_8_vectors[3]), 0); + + RL(close(dkfd)); +} + +ATF_TC(cgd_bf_cbc_256_encblkno1); +ATF_TC_HEAD(cgd_bf_cbc_256_encblkno1, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Test blowfish-cbc with 256 bits key, ivmethod encblkno1"); +} + +ATF_TC_BODY(cgd_bf_cbc_256_encblkno1, tc) +{ + const char imgpath[] = "blowfish-cbc-256-encblkno1.img"; + const char *dkpath = "/dev/dk"; + const size_t dksize = 4 * SECSIZE; /* Last blkno is 3. */ + int dkfd, cgdfd; + + rump_init(); + + RL(dkfd = open_disk(dkpath, imgpath, dksize)); + + RL(cgdfd = open_cgd(0)); + RL(configure_cgd(cgdfd, dkpath, "blowfish-cbc", "encblkno1", + bf_cbc_256_key, sizeof(bf_cbc_256_key))); + + ATF_CHECK_EQ(write_testvec(cgdfd, &bf_cbc_256_1_vectors[0]), 0); + ATF_CHECK_EQ(write_testvec(cgdfd, &bf_cbc_256_1_vectors[1]), 0); + ATF_CHECK_EQ(write_testvec(cgdfd, &bf_cbc_256_1_vectors[2]), 0); + ATF_CHECK_EQ(write_testvec(cgdfd, &bf_cbc_256_1_vectors[3]), 0); + + RL(unconfigure_cgd(cgdfd)); + RL(configure_cgd(cgdfd, dkpath, "blowfish-cbc", "encblkno1", + bf_cbc_256_key, sizeof(bf_cbc_256_key))); + + ATF_CHECK_EQ(read_testvec(cgdfd, &bf_cbc_256_1_vectors[0]), 0); + ATF_CHECK_EQ(read_testvec(cgdfd, &bf_cbc_256_1_vectors[1]), 0); + ATF_CHECK_EQ(read_testvec(cgdfd, &bf_cbc_256_1_vectors[2]), 0); + ATF_CHECK_EQ(read_testvec(cgdfd, &bf_cbc_256_1_vectors[3]), 0); + + RL(unconfigure_cgd(cgdfd)); + RL(rump_sys_close(cgdfd)); + + ATF_CHECK_EQ(check_testvec(dkfd, &bf_cbc_256_1_vectors[0]), 0); + ATF_CHECK_EQ(check_testvec(dkfd, &bf_cbc_256_1_vectors[1]), 0); + ATF_CHECK_EQ(check_testvec(dkfd, &bf_cbc_256_1_vectors[2]), 0); + ATF_CHECK_EQ(check_testvec(dkfd, &bf_cbc_256_1_vectors[3]), 0); + + RL(close(dkfd)); +} + +ATF_TC(cgd_bf_cbc_256_encblkno8); +ATF_TC_HEAD(cgd_bf_cbc_256_encblkno8, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Test blowfish-cbc with 256 bits key, ivmethod encblkno8"); +} + +ATF_TC_BODY(cgd_bf_cbc_256_encblkno8, tc) +{ + const char imgpath[] = "blowfish-cbc-256-encblkno8.img"; + const char *dkpath = "/dev/dk"; + const size_t dksize = 4 * SECSIZE; /* Last blkno is 3. */ + int dkfd, cgdfd; + + rump_init(); + + RL(dkfd = open_disk(dkpath, imgpath, dksize)); + + RL(cgdfd = open_cgd(0)); + RL(configure_cgd(cgdfd, dkpath, "blowfish-cbc", "encblkno8", + bf_cbc_256_key, sizeof(bf_cbc_256_key))); + + ATF_CHECK_EQ(write_testvec(cgdfd, &bf_cbc_256_8_vectors[0]), 0); + ATF_CHECK_EQ(write_testvec(cgdfd, &bf_cbc_256_8_vectors[1]), 0); + ATF_CHECK_EQ(write_testvec(cgdfd, &bf_cbc_256_8_vectors[2]), 0); + ATF_CHECK_EQ(write_testvec(cgdfd, &bf_cbc_256_8_vectors[3]), 0); + + RL(unconfigure_cgd(cgdfd)); + RL(configure_cgd(cgdfd, dkpath, "blowfish-cbc", "encblkno8", + bf_cbc_256_key, sizeof(bf_cbc_256_key))); + + ATF_CHECK_EQ(read_testvec(cgdfd, &bf_cbc_256_8_vectors[0]), 0); + ATF_CHECK_EQ(read_testvec(cgdfd, &bf_cbc_256_8_vectors[1]), 0); + ATF_CHECK_EQ(read_testvec(cgdfd, &bf_cbc_256_8_vectors[2]), 0); + ATF_CHECK_EQ(read_testvec(cgdfd, &bf_cbc_256_8_vectors[3]), 0); + + RL(unconfigure_cgd(cgdfd)); + RL(rump_sys_close(cgdfd)); + + ATF_CHECK_EQ(check_testvec(dkfd, &bf_cbc_256_8_vectors[0]), 0); + ATF_CHECK_EQ(check_testvec(dkfd, &bf_cbc_256_8_vectors[1]), 0); + ATF_CHECK_EQ(check_testvec(dkfd, &bf_cbc_256_8_vectors[2]), 0); + ATF_CHECK_EQ(check_testvec(dkfd, &bf_cbc_256_8_vectors[3]), 0); + + RL(close(dkfd)); +} + +ATF_TC(cgd_bf_cbc_448_encblkno1); +ATF_TC_HEAD(cgd_bf_cbc_448_encblkno1, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Test blowfish-cbc with 448 bits key, ivmethod encblkno1"); +} + +ATF_TC_BODY(cgd_bf_cbc_448_encblkno1, tc) +{ + const char imgpath[] = "blowfish-cbc-448-encblkno1.img"; + const char *dkpath = "/dev/dk"; + const size_t dksize = 4 * SECSIZE; /* Last blkno is 3. */ + int dkfd, cgdfd; + + rump_init(); + + RL(dkfd = open_disk(dkpath, imgpath, dksize)); + + RL(cgdfd = open_cgd(0)); + RL(configure_cgd(cgdfd, dkpath, "blowfish-cbc", "encblkno1", + bf_cbc_448_key, sizeof(bf_cbc_448_key))); + + ATF_CHECK_EQ(write_testvec(cgdfd, &bf_cbc_448_1_vectors[0]), 0); + ATF_CHECK_EQ(write_testvec(cgdfd, &bf_cbc_448_1_vectors[1]), 0); + ATF_CHECK_EQ(write_testvec(cgdfd, &bf_cbc_448_1_vectors[2]), 0); + ATF_CHECK_EQ(write_testvec(cgdfd, &bf_cbc_448_1_vectors[3]), 0); + + RL(unconfigure_cgd(cgdfd)); + RL(configure_cgd(cgdfd, dkpath, "blowfish-cbc", "encblkno1", + bf_cbc_448_key, sizeof(bf_cbc_448_key))); + + ATF_CHECK_EQ(read_testvec(cgdfd, &bf_cbc_448_1_vectors[0]), 0); + ATF_CHECK_EQ(read_testvec(cgdfd, &bf_cbc_448_1_vectors[1]), 0); + ATF_CHECK_EQ(read_testvec(cgdfd, &bf_cbc_448_1_vectors[2]), 0); + ATF_CHECK_EQ(read_testvec(cgdfd, &bf_cbc_448_1_vectors[3]), 0); + + RL(unconfigure_cgd(cgdfd)); + RL(rump_sys_close(cgdfd)); + + ATF_CHECK_EQ(check_testvec(dkfd, &bf_cbc_448_1_vectors[0]), 0); + ATF_CHECK_EQ(check_testvec(dkfd, &bf_cbc_448_1_vectors[1]), 0); + ATF_CHECK_EQ(check_testvec(dkfd, &bf_cbc_448_1_vectors[2]), 0); + ATF_CHECK_EQ(check_testvec(dkfd, &bf_cbc_448_1_vectors[3]), 0); + + RL(close(dkfd)); +} + +ATF_TC(cgd_bf_cbc_448_encblkno8); +ATF_TC_HEAD(cgd_bf_cbc_448_encblkno8, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Test blowfish-cbc with 448 bits key, ivmethod encblkno8"); +} + +ATF_TC_BODY(cgd_bf_cbc_448_encblkno8, tc) +{ + const char imgpath[] = "blowfish-cbc-448-encblkno8.img"; + const char *dkpath = "/dev/dk"; + const size_t dksize = 4 * SECSIZE; /* Last blkno is 3. */ + int dkfd, cgdfd; + + rump_init(); + + RL(dkfd = open_disk(dkpath, imgpath, dksize)); + + RL(cgdfd = open_cgd(0)); + RL(configure_cgd(cgdfd, dkpath, "blowfish-cbc", "encblkno8", + bf_cbc_448_key, sizeof(bf_cbc_448_key))); + + ATF_CHECK_EQ(write_testvec(cgdfd, &bf_cbc_448_8_vectors[0]), 0); + ATF_CHECK_EQ(write_testvec(cgdfd, &bf_cbc_448_8_vectors[1]), 0); + ATF_CHECK_EQ(write_testvec(cgdfd, &bf_cbc_448_8_vectors[2]), 0); + ATF_CHECK_EQ(write_testvec(cgdfd, &bf_cbc_448_8_vectors[3]), 0); + + RL(unconfigure_cgd(cgdfd)); + RL(configure_cgd(cgdfd, dkpath, "blowfish-cbc", "encblkno8", + bf_cbc_448_key, sizeof(bf_cbc_448_key))); + + ATF_CHECK_EQ(read_testvec(cgdfd, &bf_cbc_448_8_vectors[0]), 0); + ATF_CHECK_EQ(read_testvec(cgdfd, &bf_cbc_448_8_vectors[1]), 0); + ATF_CHECK_EQ(read_testvec(cgdfd, &bf_cbc_448_8_vectors[2]), 0); + ATF_CHECK_EQ(read_testvec(cgdfd, &bf_cbc_448_8_vectors[3]), 0); + + RL(unconfigure_cgd(cgdfd)); + RL(rump_sys_close(cgdfd)); + + ATF_CHECK_EQ(check_testvec(dkfd, &bf_cbc_448_8_vectors[0]), 0); + ATF_CHECK_EQ(check_testvec(dkfd, &bf_cbc_448_8_vectors[1]), 0); + ATF_CHECK_EQ(check_testvec(dkfd, &bf_cbc_448_8_vectors[2]), 0); + ATF_CHECK_EQ(check_testvec(dkfd, &bf_cbc_448_8_vectors[3]), 0); + + RL(close(dkfd)); +} + +ATF_TP_ADD_TCS(tp) +{ + + ATF_TP_ADD_TC(tp, cgd_bf_cbc_128_encblkno1); + ATF_TP_ADD_TC(tp, cgd_bf_cbc_128_encblkno8); + ATF_TP_ADD_TC(tp, cgd_bf_cbc_256_encblkno1); + ATF_TP_ADD_TC(tp, cgd_bf_cbc_256_encblkno8); + ATF_TP_ADD_TC(tp, cgd_bf_cbc_448_encblkno1); + ATF_TP_ADD_TC(tp, cgd_bf_cbc_448_encblkno8); + + return atf_no_error(); +} diff --git a/contrib/netbsd-tests/fs/ffs/ffs_common.sh b/contrib/netbsd-tests/fs/ffs/ffs_common.sh index eaf7142808a1..ee94a15f994a 100755 --- a/contrib/netbsd-tests/fs/ffs/ffs_common.sh +++ b/contrib/netbsd-tests/fs/ffs/ffs_common.sh @@ -1,4 +1,4 @@ -# $NetBSD: ffs_common.sh,v 1.2 2013/07/29 13:15:24 skrll Exp $ +# $NetBSD: ffs_common.sh,v 1.3 2016/10/08 13:23:53 gson Exp $ create_ffs() { @@ -45,7 +45,7 @@ test_case() eval "${name}_head() { \ atf_set "descr" "${descr}" - atf_set "timeout" "60" + atf_set "timeout" "120" }" eval "${name}_body() { \ RUMP_SOCKETS_LIST=\${RUMP_SOCKET}; \ diff --git a/contrib/netbsd-tests/fs/fifofs/t_fifo.c b/contrib/netbsd-tests/fs/fifofs/t_fifo.c index c4a2060a6ebc..4b37bb85b8c2 100644 --- a/contrib/netbsd-tests/fs/fifofs/t_fifo.c +++ b/contrib/netbsd-tests/fs/fifofs/t_fifo.c @@ -1,9 +1,10 @@ /* Test case written by Bharat Joshi */ #include -__RCSID("$NetBSD: t_fifo.c,v 1.1 2011/12/21 00:17:07 christos Exp $"); +__RCSID("$NetBSD: t_fifo.c,v 1.2 2017/01/10 22:36:29 christos Exp $"); #include #include +#include #include #include diff --git a/contrib/netbsd-tests/fs/nfs/nfsservice/rpcbind/check_bound.c b/contrib/netbsd-tests/fs/nfs/nfsservice/rpcbind/check_bound.c deleted file mode 100644 index 2ea7c31d16ca..000000000000 --- a/contrib/netbsd-tests/fs/nfs/nfsservice/rpcbind/check_bound.c +++ /dev/null @@ -1,231 +0,0 @@ -/* $NetBSD: check_bound.c,v 1.1 2010/07/26 15:53:00 pooka Exp $ */ - -/* - * Sun RPC is a product of Sun Microsystems, Inc. and is provided for - * unrestricted use provided that this legend is included on all tape - * media and as a part of the software program in whole or part. Users - * may copy or modify Sun RPC without charge, but are not authorized - * to license or distribute it to anyone else except as part of a product or - * program developed by the user. - * - * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE - * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR - * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. - * - * Sun RPC is provided with no support and without any obligation on the - * part of Sun Microsystems, Inc. to assist in its use, correction, - * modification or enhancement. - * - * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE - * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC - * OR ANY PART THEREOF. - * - * In no event will Sun Microsystems, Inc. be liable for any lost revenue - * or profits or other special, indirect and consequential damages, even if - * Sun has been advised of the possibility of such damages. - * - * Sun Microsystems, Inc. - * 2550 Garcia Avenue - * Mountain View, California 94043 - */ -/* - * Copyright (c) 1986 - 1991 by Sun Microsystems, Inc. - */ - -/* #ident "@(#)check_bound.c 1.15 93/07/05 SMI" */ - -#if 0 -#ifndef lint -static char sccsid[] = "@(#)check_bound.c 1.11 89/04/21 Copyr 1989 Sun Micro"; -#endif -#endif - -/* - * check_bound.c - * Checks to see whether the program is still bound to the - * claimed address and returns the univeral merged address - * - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#include "rpcbind.h" - -struct fdlist { - int fd; - struct netconfig *nconf; - struct fdlist *next; - int check_binding; -}; - -static struct fdlist *fdhead; /* Link list of the check fd's */ -static struct fdlist *fdtail; -static const char emptystring[] = ""; - -static bool_t check_bound(struct fdlist *, const char *uaddr); - -/* - * Returns 1 if the given address is bound for the given addr & transport - * For all error cases, we assume that the address is bound - * Returns 0 for success. - */ -static bool_t -check_bound(struct fdlist *fdl, const char *uaddr) -{ - int fd; - struct netbuf *na; - int ans; - - if (fdl->check_binding == FALSE) - return (TRUE); - - na = uaddr2taddr(fdl->nconf, uaddr); - if (!na) - return (TRUE); /* punt, should never happen */ - - fd = __rpc_nconf2fd(fdl->nconf); - if (fd < 0) { - free(na); - return (TRUE); - } - - ans = bind(fd, (struct sockaddr *)na->buf, na->len); - - rump_sys_close(fd); - free(na); - - return (ans == 0 ? FALSE : TRUE); -} - -int -add_bndlist(struct netconfig *nconf, struct netbuf *baddr) -{ - struct fdlist *fdl; - struct netconfig *newnconf; - - newnconf = getnetconfigent(nconf->nc_netid); - if (newnconf == NULL) - return (-1); - fdl = (struct fdlist *)malloc((u_int)sizeof (struct fdlist)); - if (fdl == NULL) { - freenetconfigent(newnconf); - syslog(LOG_ERR, "no memory!"); - return (-1); - } - fdl->nconf = newnconf; - fdl->next = NULL; - if (fdhead == NULL) { - fdhead = fdl; - fdtail = fdl; - } else { - fdtail->next = fdl; - fdtail = fdl; - } - /* XXX no bound checking for now */ - fdl->check_binding = FALSE; - - return 0; -} - -bool_t -is_bound(const char *netid, const char *uaddr) -{ - struct fdlist *fdl; - - for (fdl = fdhead; fdl; fdl = fdl->next) - if (strcmp(fdl->nconf->nc_netid, netid) == 0) - break; - if (fdl == NULL) - return (TRUE); - return (check_bound(fdl, uaddr)); -} - -/* - * Returns NULL if there was some system error. - * Returns "" if the address was not bound, i.e the server crashed. - * Returns the merged address otherwise. - */ -char * -mergeaddr(SVCXPRT *xprt, char *netid, char *uaddr, char *saddr) -{ - struct fdlist *fdl; - char *c_uaddr, *s_uaddr, *m_uaddr, *allocated_uaddr = NULL; - - for (fdl = fdhead; fdl; fdl = fdl->next) - if (strcmp(fdl->nconf->nc_netid, netid) == 0) - break; - if (fdl == NULL) - return (NULL); - if (check_bound(fdl, uaddr) == FALSE) - /* that server died */ - return strdup(emptystring); - /* - * If saddr is not NULL, the remote client may have included the - * address by which it contacted us. Use that for the "client" uaddr, - * otherwise use the info from the SVCXPRT. - */ - if (saddr != NULL) { - c_uaddr = saddr; - } else { - c_uaddr = taddr2uaddr(fdl->nconf, svc_getrpccaller(xprt)); - if (c_uaddr == NULL) { - syslog(LOG_ERR, "taddr2uaddr failed for %s", - fdl->nconf->nc_netid); - return (NULL); - } - allocated_uaddr = c_uaddr; - } - -#ifdef RPCBIND_DEBUG - if (debugging) { - if (saddr == NULL) { - fprintf(stderr, "mergeaddr: client uaddr = %s\n", - c_uaddr); - } else { - fprintf(stderr, "mergeaddr: contact uaddr = %s\n", - c_uaddr); - } - } -#endif - s_uaddr = uaddr; - /* - * This is all we should need for IP 4 and 6 - */ - m_uaddr = addrmerge(svc_getrpccaller(xprt), s_uaddr, c_uaddr, netid); -#ifdef RPCBIND_DEBUG - if (debugging) - fprintf(stderr, "mergeaddr: uaddr = %s, merged uaddr = %s\n", - uaddr, m_uaddr); -#endif - if (allocated_uaddr != NULL) - free(allocated_uaddr); - return (m_uaddr); -} - -/* - * Returns a netconf structure from its internal list. This - * structure should not be freed. - */ -struct netconfig * -rpcbind_get_conf(const char *netid) -{ - struct fdlist *fdl; - - for (fdl = fdhead; fdl; fdl = fdl->next) - if (strcmp(fdl->nconf->nc_netid, netid) == 0) - break; - if (fdl == NULL) - return (NULL); - return (fdl->nconf); -} diff --git a/contrib/netbsd-tests/fs/nfs/nfsservice/rpcbind/pmap_svc.c b/contrib/netbsd-tests/fs/nfs/nfsservice/rpcbind/pmap_svc.c deleted file mode 100644 index 3f9eb4731ce1..000000000000 --- a/contrib/netbsd-tests/fs/nfs/nfsservice/rpcbind/pmap_svc.c +++ /dev/null @@ -1,366 +0,0 @@ -/* $NetBSD: pmap_svc.c,v 1.2 2013/10/19 17:45:00 christos Exp $ */ - -/* - * Sun RPC is a product of Sun Microsystems, Inc. and is provided for - * unrestricted use provided that this legend is included on all tape - * media and as a part of the software program in whole or part. Users - * may copy or modify Sun RPC without charge, but are not authorized - * to license or distribute it to anyone else except as part of a product or - * program developed by the user. - * - * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE - * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR - * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. - * - * Sun RPC is provided with no support and without any obligation on the - * part of Sun Microsystems, Inc. to assist in its use, correction, - * modification or enhancement. - * - * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE - * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC - * OR ANY PART THEREOF. - * - * In no event will Sun Microsystems, Inc. be liable for any lost revenue - * or profits or other special, indirect and consequential damages, even if - * Sun has been advised of the possibility of such damages. - * - * Sun Microsystems, Inc. - * 2550 Garcia Avenue - * Mountain View, California 94043 - */ -/* - * Copyright (c) 1984 - 1991 by Sun Microsystems, Inc. - */ - -/* #ident "@(#)pmap_svc.c 1.14 93/07/05 SMI" */ - -#if 0 -#ifndef lint -static char sccsid[] = "@(#)pmap_svc.c 1.23 89/04/05 Copyr 1984 Sun Micro"; -#endif -#endif - -/* - * pmap_svc.c - * The server procedure for the version 2 portmapper. - * All the portmapper related interface from the portmap side. - */ - -#ifdef PORTMAP -#include -#include -#include -#include -#include -#include -#ifdef RPCBIND_DEBUG -#include -#endif -#include "rpcbind.h" - -static struct pmaplist *find_service_pmap(rpcprog_t, rpcvers_t, rpcprot_t); -static bool_t pmapproc_change(struct svc_req *, SVCXPRT *, u_long); -static bool_t pmapproc_getport(struct svc_req *, SVCXPRT *); -static bool_t pmapproc_dump(struct svc_req *, SVCXPRT *); - -/* - * Called for all the version 2 inquiries. - */ -void -pmap_service(struct svc_req *rqstp, SVCXPRT *xprt) -{ - rpcbs_procinfo(RPCBVERS_2_STAT, rqstp->rq_proc); - switch (rqstp->rq_proc) { - case PMAPPROC_NULL: - /* - * Null proc call - */ -#ifdef RPCBIND_DEBUG - if (debugging) - fprintf(stderr, "PMAPPROC_NULL\n"); -#endif - check_access(xprt, rqstp->rq_proc, NULL, PMAPVERS); - if ((!svc_sendreply(xprt, (xdrproc_t) xdr_void, NULL)) && - debugging) { - if (doabort) { - rpcbind_abort(); - } - } - break; - - case PMAPPROC_SET: - /* - * Set a program, version to port mapping - */ - pmapproc_change(rqstp, xprt, rqstp->rq_proc); - break; - - case PMAPPROC_UNSET: - /* - * Remove a program, version to port mapping. - */ - pmapproc_change(rqstp, xprt, rqstp->rq_proc); - break; - - case PMAPPROC_GETPORT: - /* - * Lookup the mapping for a program, version and return its - * port number. - */ - pmapproc_getport(rqstp, xprt); - break; - - case PMAPPROC_DUMP: - /* - * Return the current set of mapped program, version - */ -#ifdef RPCBIND_DEBUG - if (debugging) - fprintf(stderr, "PMAPPROC_DUMP\n"); -#endif - pmapproc_dump(rqstp, xprt); - break; - - case PMAPPROC_CALLIT: - /* - * Calls a procedure on the local machine. If the requested - * procedure is not registered this procedure does not return - * error information!! - * This procedure is only supported on rpc/udp and calls via - * rpc/udp. It passes null authentication parameters. - */ - rpcbproc_callit_com(rqstp, xprt, PMAPPROC_CALLIT, PMAPVERS); - break; - - default: - svcerr_noproc(xprt); - break; - } -} - -/* - * returns the item with the given program, version number. If that version - * number is not found, it returns the item with that program number, so that - * the port number is now returned to the caller. The caller when makes a - * call to this program, version number, the call will fail and it will - * return with PROGVERS_MISMATCH. The user can then determine the highest - * and the lowest version number for this program using clnt_geterr() and - * use those program version numbers. - */ -static struct pmaplist * -find_service_pmap(rpcprog_t prog, rpcvers_t vers, rpcprot_t prot) -{ - register struct pmaplist *hit = NULL; - register struct pmaplist *pml; - - for (pml = list_pml; pml != NULL; pml = pml->pml_next) { - if ((pml->pml_map.pm_prog != prog) || - (pml->pml_map.pm_prot != prot)) - continue; - hit = pml; - if (pml->pml_map.pm_vers == vers) - break; - } - return (hit); -} - -static bool_t -pmapproc_change(struct svc_req *rqstp, SVCXPRT *xprt, unsigned long op) -{ - struct pmap reg; - RPCB rpcbreg; - long ans; - struct sockcred *sc; - char uidbuf[32]; - -#ifdef RPCBIND_DEBUG - if (debugging) - fprintf(stderr, "%s request for (%lu, %lu) : ", - op == PMAPPROC_SET ? "PMAP_SET" : "PMAP_UNSET", - reg.pm_prog, reg.pm_vers); -#endif - - if (!svc_getargs(xprt, (xdrproc_t) xdr_pmap, (char *)®)) { - svcerr_decode(xprt); - return (FALSE); - } - - if (!check_access(xprt, op, ®, PMAPVERS)) { - svcerr_weakauth(xprt); - return FALSE; - } - - (void)svc_getcaller(xprt); - sc = __svc_getcallercreds(xprt); - - /* - * Can't use getpwnam here. We might end up calling ourselves - * and looping. - */ - if (sc == NULL) - rpcbreg.r_owner = __UNCONST(rpcbind_unknown); - else if (sc->sc_uid == 0) - rpcbreg.r_owner = __UNCONST(rpcbind_superuser); - else { - /* r_owner will be strdup-ed later */ - snprintf(uidbuf, sizeof uidbuf, "%d", sc->sc_uid); - rpcbreg.r_owner = uidbuf; - } - - rpcbreg.r_prog = reg.pm_prog; - rpcbreg.r_vers = reg.pm_vers; - - if (op == PMAPPROC_SET) { - char buf[32]; - - snprintf(buf, sizeof(buf), "0.0.0.0.%d.%d", - (int)((reg.pm_port >> 8) & 0xff), - (int)(reg.pm_port & 0xff)); - rpcbreg.r_addr = buf; - if (reg.pm_prot == IPPROTO_UDP) { - rpcbreg.r_netid = __UNCONST(udptrans); - } else if (reg.pm_prot == IPPROTO_TCP) { - rpcbreg.r_netid = __UNCONST(tcptrans); - } else { - ans = FALSE; - goto done_change; - } - ans = map_set(&rpcbreg, rpcbreg.r_owner); - } else if (op == PMAPPROC_UNSET) { - bool_t ans1, ans2; - - rpcbreg.r_addr = NULL; - rpcbreg.r_netid = __UNCONST(tcptrans); - ans1 = map_unset(&rpcbreg, rpcbreg.r_owner); - rpcbreg.r_netid = __UNCONST(udptrans); - ans2 = map_unset(&rpcbreg, rpcbreg.r_owner); - ans = ans1 || ans2; - } else { - ans = FALSE; - } -done_change: - if ((!svc_sendreply(xprt, (xdrproc_t) xdr_long, (caddr_t) &ans)) && - debugging) { - fprintf(stderr, "portmap: svc_sendreply\n"); - if (doabort) { - rpcbind_abort(); - } - } -#ifdef RPCBIND_DEBUG - if (debugging) - fprintf(stderr, "%s\n", ans == TRUE ? "succeeded" : "failed"); -#endif - if (op == PMAPPROC_SET) - rpcbs_set(RPCBVERS_2_STAT, ans); - else - rpcbs_unset(RPCBVERS_2_STAT, ans); - return (TRUE); -} - -/* ARGSUSED */ -static bool_t -pmapproc_getport(struct svc_req *rqstp, SVCXPRT *xprt) -{ - struct pmap reg; - long lport; - int port = 0; - struct pmaplist *fnd; -#ifdef RPCBIND_DEBUG - char *uaddr; -#endif - - if (!svc_getargs(xprt, (xdrproc_t) xdr_pmap, (char *)®)) { - svcerr_decode(xprt); - return (FALSE); - } - - if (!check_access(xprt, PMAPPROC_GETPORT, ®, PMAPVERS)) { - svcerr_weakauth(xprt); - return FALSE; - } - -#ifdef RPCBIND_DEBUG - if (debugging) { - uaddr = taddr2uaddr(rpcbind_get_conf(xprt->xp_netid), - svc_getrpccaller(xprt)); - fprintf(stderr, "PMAP_GETPORT req for (%lu, %lu, %s) from %s :", - reg.pm_prog, reg.pm_vers, - reg.pm_prot == IPPROTO_UDP ? "udp" : "tcp", uaddr); - free(uaddr); - } -#endif - fnd = find_service_pmap(reg.pm_prog, reg.pm_vers, reg.pm_prot); - if (fnd) { - char serveuaddr[32]; - int h1, h2, h3, h4, p1, p2; - const char *netid, *ua; - - if (reg.pm_prot == IPPROTO_UDP) { - ua = udp_uaddr; - netid = udptrans; - } else { - ua = tcp_uaddr; /* To get the len */ - netid = tcptrans; - } - if (ua == NULL) { - goto sendreply; - } - if (sscanf(ua, "%d.%d.%d.%d.%d.%d", &h1, &h2, &h3, - &h4, &p1, &p2) == 6) { - p1 = (fnd->pml_map.pm_port >> 8) & 0xff; - p2 = (fnd->pml_map.pm_port) & 0xff; - snprintf(serveuaddr, sizeof(serveuaddr), - "%d.%d.%d.%d.%d.%d", h1, h2, h3, h4, p1, p2); - if (is_bound(netid, serveuaddr)) { - port = fnd->pml_map.pm_port; - } else { /* this service is dead; delete it */ - delete_prog(reg.pm_prog); - } - } - } -sendreply: - lport = port; - if ((!svc_sendreply(xprt, (xdrproc_t) xdr_long, (caddr_t)&lport)) && - debugging) { - (void) fprintf(stderr, "portmap: svc_sendreply\n"); - if (doabort) { - rpcbind_abort(); - } - } -#ifdef RPCBIND_DEBUG - if (debugging) - fprintf(stderr, "port = %d\n", port); -#endif - rpcbs_getaddr(RPCBVERS_2_STAT, reg.pm_prog, reg.pm_vers, - reg.pm_prot == IPPROTO_UDP ? udptrans : tcptrans, - port ? udptrans : ""); - - return (TRUE); -} - -/* ARGSUSED */ -static bool_t -pmapproc_dump(struct svc_req *rqstp, SVCXPRT *xprt) -{ - if (!svc_getargs(xprt, (xdrproc_t)xdr_void, NULL)) { - svcerr_decode(xprt); - return (FALSE); - } - - if (!check_access(xprt, PMAPPROC_DUMP, NULL, PMAPVERS)) { - svcerr_weakauth(xprt); - return FALSE; - } - - if ((!svc_sendreply(xprt, (xdrproc_t) xdr_pmaplist_ptr, - (caddr_t)&list_pml)) && debugging) { - if (debugging) - (void) fprintf(stderr, "portmap: svc_sendreply\n"); - if (doabort) { - rpcbind_abort(); - } - } - return (TRUE); -} - -#endif /* PORTMAP */ diff --git a/contrib/netbsd-tests/fs/nfs/nfsservice/rpcbind/rpcb_stat.c b/contrib/netbsd-tests/fs/nfs/nfsservice/rpcbind/rpcb_stat.c deleted file mode 100644 index 5bc5a0fde55a..000000000000 --- a/contrib/netbsd-tests/fs/nfs/nfsservice/rpcbind/rpcb_stat.c +++ /dev/null @@ -1,206 +0,0 @@ -/* $NetBSD: rpcb_stat.c,v 1.1 2010/07/26 15:53:00 pooka Exp $ */ - -/* - * Sun RPC is a product of Sun Microsystems, Inc. and is provided for - * unrestricted use provided that this legend is included on all tape - * media and as a part of the software program in whole or part. Users - * may copy or modify Sun RPC without charge, but are not authorized - * to license or distribute it to anyone else except as part of a product or - * program developed by the user. - * - * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE - * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR - * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. - * - * Sun RPC is provided with no support and without any obligation on the - * part of Sun Microsystems, Inc. to assist in its use, correction, - * modification or enhancement. - * - * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE - * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC - * OR ANY PART THEREOF. - * - * In no event will Sun Microsystems, Inc. be liable for any lost revenue - * or profits or other special, indirect and consequential damages, even if - * Sun has been advised of the possibility of such damages. - * - * Sun Microsystems, Inc. - * 2550 Garcia Avenue - * Mountain View, California 94043 - */ -/* #pragma ident "@(#)rpcb_stat.c 1.7 94/04/25 SMI" */ - -/* - * rpcb_stat.c - * Allows for gathering of statistics - * - * Copyright (c) 1990 by Sun Microsystems, Inc. - */ - -#include -#include -#include -#include -#include -#ifdef PORTMAP -#include -#endif -#include -#include -#include "rpcbind.h" - -static rpcb_stat_byvers inf; - -void -rpcbs_init(void) -{ - -} - -void -rpcbs_procinfo(rpcvers_t rtype, rpcproc_t proc) -{ - switch (rtype + 2) { -#ifdef PORTMAP - case PMAPVERS: /* version 2 */ - if (proc > rpcb_highproc_2) - return; - break; -#endif - case RPCBVERS: /* version 3 */ - if (proc > rpcb_highproc_3) - return; - break; - case RPCBVERS4: /* version 4 */ - if (proc > rpcb_highproc_4) - return; - break; - default: return; - } - inf[rtype].info[proc]++; - return; -} - -void -rpcbs_set(rpcvers_t rtype, bool_t success) -{ - if ((rtype >= RPCBVERS_STAT) || (success == FALSE)) - return; - inf[rtype].setinfo++; - return; -} - -void -rpcbs_unset(rpcvers_t rtype, bool_t success) -{ - if ((rtype >= RPCBVERS_STAT) || (success == FALSE)) - return; - inf[rtype].unsetinfo++; - return; -} - -void -rpcbs_getaddr(rpcvers_t rtype, rpcprog_t prog, rpcvers_t vers, - const char *netid, const char *uaddr) -{ - rpcbs_addrlist *al; - struct netconfig *nconf; - - if (rtype >= RPCBVERS_STAT) - return; - for (al = inf[rtype].addrinfo; al; al = al->next) { - - if(al->netid == NULL) - return; - if ((al->prog == prog) && (al->vers == vers) && - (strcmp(al->netid, netid) == 0)) { - if ((uaddr == NULL) || (uaddr[0] == 0)) - al->failure++; - else - al->success++; - return; - } - } - nconf = rpcbind_get_conf(netid); - if (nconf == NULL) { - return; - } - al = (rpcbs_addrlist *) malloc(sizeof (rpcbs_addrlist)); - if (al == NULL) { - return; - } - al->prog = prog; - al->vers = vers; - al->netid = nconf->nc_netid; - if ((uaddr == NULL) || (uaddr[0] == 0)) { - al->failure = 1; - al->success = 0; - } else { - al->failure = 0; - al->success = 1; - } - al->next = inf[rtype].addrinfo; - inf[rtype].addrinfo = al; -} - -void -rpcbs_rmtcall(rpcvers_t rtype, rpcproc_t rpcbproc, rpcprog_t prog, - rpcvers_t vers, rpcproc_t proc, char *netid, rpcblist_ptr rbl) -{ - rpcbs_rmtcalllist *rl; - struct netconfig *nconf; - - if (rtype >= RPCBVERS_STAT) - return; - for (rl = inf[rtype].rmtinfo; rl; rl = rl->next) { - - if(rl->netid == NULL) - return; - - if ((rl->prog == prog) && (rl->vers == vers) && - (rl->proc == proc) && - (strcmp(rl->netid, netid) == 0)) { - if ((rbl == NULL) || - (rbl->rpcb_map.r_vers != vers)) - rl->failure++; - else - rl->success++; - if (rpcbproc == RPCBPROC_INDIRECT) - rl->indirect++; - return; - } - } - nconf = rpcbind_get_conf(netid); - if (nconf == NULL) { - return; - } - rl = (rpcbs_rmtcalllist *) malloc(sizeof (rpcbs_rmtcalllist)); - if (rl == NULL) { - return; - } - rl->prog = prog; - rl->vers = vers; - rl->proc = proc; - rl->netid = nconf->nc_netid; - if ((rbl == NULL) || - (rbl->rpcb_map.r_vers != vers)) { - rl->failure = 1; - rl->success = 0; - } else { - rl->failure = 0; - rl->success = 1; - } - rl->indirect = 1; - rl->next = inf[rtype].rmtinfo; - inf[rtype].rmtinfo = rl; - return; -} - -/* - */ -void * -rpcbproc_getstat(void *arg, struct svc_req *req, SVCXPRT *xprt, - rpcvers_t versnum) -{ - return (void *)&inf; -} diff --git a/contrib/netbsd-tests/fs/nfs/nfsservice/rpcbind/rpcb_svc.c b/contrib/netbsd-tests/fs/nfs/nfsservice/rpcbind/rpcb_svc.c deleted file mode 100644 index 16c86f67a375..000000000000 --- a/contrib/netbsd-tests/fs/nfs/nfsservice/rpcbind/rpcb_svc.c +++ /dev/null @@ -1,232 +0,0 @@ -/* $NetBSD: rpcb_svc.c,v 1.2 2011/09/16 16:13:18 plunky Exp $ */ - -/* - * Sun RPC is a product of Sun Microsystems, Inc. and is provided for - * unrestricted use provided that this legend is included on all tape - * media and as a part of the software program in whole or part. Users - * may copy or modify Sun RPC without charge, but are not authorized - * to license or distribute it to anyone else except as part of a product or - * program developed by the user. - * - * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE - * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR - * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. - * - * Sun RPC is provided with no support and without any obligation on the - * part of Sun Microsystems, Inc. to assist in its use, correction, - * modification or enhancement. - * - * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE - * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC - * OR ANY PART THEREOF. - * - * In no event will Sun Microsystems, Inc. be liable for any lost revenue - * or profits or other special, indirect and consequential damages, even if - * Sun has been advised of the possibility of such damages. - * - * Sun Microsystems, Inc. - * 2550 Garcia Avenue - * Mountain View, California 94043 - */ -/* - * Copyright (c) 1986 - 1991 by Sun Microsystems, Inc. - */ - -/* #ident "@(#)rpcb_svc.c 1.16 93/07/05 SMI" */ - -/* - * rpcb_svc.c - * The server procedure for the version 3 rpcbind (TLI). - * - * It maintains a separate list of all the registered services with the - * version 3 of rpcbind. - */ -#include -#include -#include -#include -#include -#include -#include -#include - -#include "rpcbind.h" - -static void *rpcbproc_getaddr_3_local(void *, struct svc_req *, SVCXPRT *, - rpcvers_t); -static void *rpcbproc_dump_3_local(void *, struct svc_req *, SVCXPRT *, - rpcvers_t); - -/* - * Called by svc_getreqset. There is a separate server handle for - * every transport that it waits on. - */ -void -rpcb_service_3(struct svc_req *rqstp, SVCXPRT *transp) -{ - union { - RPCB rpcbproc_set_3_arg; - RPCB rpcbproc_unset_3_arg; - RPCB rpcbproc_getaddr_3_local_arg; - struct rpcb_rmtcallargs rpcbproc_callit_3_arg; - char *rpcbproc_uaddr2taddr_3_arg; - struct netbuf rpcbproc_taddr2uaddr_3_arg; - } argument; - char *result; - xdrproc_t xdr_argument, xdr_result; - void *(*local)(void *, struct svc_req *, SVCXPRT *, rpcvers_t); - - rpcbs_procinfo(RPCBVERS_3_STAT, rqstp->rq_proc); - - switch (rqstp->rq_proc) { - case NULLPROC: - /* - * Null proc call - */ -#ifdef RPCBIND_DEBUG - if (debugging) - fprintf(stderr, "RPCBPROC_NULL\n"); -#endif - /* This call just logs, no actual checks */ - check_access(transp, rqstp->rq_proc, NULL, RPCBVERS); - (void) svc_sendreply(transp, (xdrproc_t)xdr_void, NULL); - return; - - case RPCBPROC_SET: - xdr_argument = (xdrproc_t )xdr_rpcb; - xdr_result = (xdrproc_t )xdr_bool; - local = rpcbproc_set_com; - break; - - case RPCBPROC_UNSET: - xdr_argument = (xdrproc_t)xdr_rpcb; - xdr_result = (xdrproc_t)xdr_bool; - local = rpcbproc_unset_com; - break; - - case RPCBPROC_GETADDR: - xdr_argument = (xdrproc_t)xdr_rpcb; - xdr_result = (xdrproc_t)xdr_wrapstring; - local = rpcbproc_getaddr_3_local; - break; - - case RPCBPROC_DUMP: -#ifdef RPCBIND_DEBUG - if (debugging) - fprintf(stderr, "RPCBPROC_DUMP\n"); -#endif - xdr_argument = (xdrproc_t)xdr_void; - xdr_result = (xdrproc_t)xdr_rpcblist_ptr; - local = rpcbproc_dump_3_local; - break; - - case RPCBPROC_CALLIT: - rpcbproc_callit_com(rqstp, transp, rqstp->rq_proc, RPCBVERS); - return; - - case RPCBPROC_GETTIME: -#ifdef RPCBIND_DEBUG - if (debugging) - fprintf(stderr, "RPCBPROC_GETTIME\n"); -#endif - xdr_argument = (xdrproc_t)xdr_void; - xdr_result = (xdrproc_t)xdr_u_long; - local = rpcbproc_gettime_com; - break; - - case RPCBPROC_UADDR2TADDR: -#ifdef RPCBIND_DEBUG - if (debugging) - fprintf(stderr, "RPCBPROC_UADDR2TADDR\n"); -#endif - xdr_argument = (xdrproc_t)xdr_wrapstring; - xdr_result = (xdrproc_t)xdr_netbuf; - local = rpcbproc_uaddr2taddr_com; - break; - - case RPCBPROC_TADDR2UADDR: -#ifdef RPCBIND_DEBUG - if (debugging) - fprintf(stderr, "RPCBPROC_TADDR2UADDR\n"); -#endif - xdr_argument = (xdrproc_t)xdr_netbuf; - xdr_result = (xdrproc_t)xdr_wrapstring; - local = rpcbproc_taddr2uaddr_com; - break; - - default: - svcerr_noproc(transp); - return; - } - (void) memset((char *)&argument, 0, sizeof (argument)); - if (!svc_getargs(transp, (xdrproc_t) xdr_argument, - (char *) &argument)) { - svcerr_decode(transp); - if (debugging) - (void) fprintf(stderr, "rpcbind: could not decode\n"); - return; - } - if (!check_access(transp, rqstp->rq_proc, &argument, RPCBVERS)) { - svcerr_weakauth(transp); - goto done; - } - result = (*local)(&argument, rqstp, transp, RPCBVERS); - if (result != NULL && !svc_sendreply(transp, (xdrproc_t)xdr_result, - result)) { - svcerr_systemerr(transp); - if (debugging) { - (void) fprintf(stderr, "rpcbind: svc_sendreply\n"); - if (doabort) { - rpcbind_abort(); - } - } - } -done: - if (!svc_freeargs(transp, (xdrproc_t)xdr_argument, (char *) - &argument)) { - if (debugging) { - (void) fprintf(stderr, "unable to free arguments\n"); - if (doabort) { - rpcbind_abort(); - } - } - } -} - -/* - * Lookup the mapping for a program, version and return its - * address. Assuming that the caller wants the address of the - * server running on the transport on which the request came. - * - * We also try to resolve the universal address in terms of - * address of the caller. - */ -/* ARGSUSED */ -static void * -rpcbproc_getaddr_3_local(void *arg, struct svc_req *rqstp, SVCXPRT *transp, - rpcvers_t versnum) -{ - RPCB *regp = (RPCB *)arg; -#ifdef RPCBIND_DEBUG - if (debugging) { - char *uaddr; - - uaddr = taddr2uaddr(rpcbind_get_conf(transp->xp_netid), - svc_getrpccaller(transp)); - fprintf(stderr, "RPCB_GETADDR req for (%lu, %lu, %s) from %s: ", - (unsigned long)regp->r_prog, (unsigned long)regp->r_vers, - regp->r_netid, uaddr); - free(uaddr); - } -#endif - return (rpcbproc_getaddr_com(regp, rqstp, transp, RPCBVERS, - RPCB_ALLVERS)); -} - -/* ARGSUSED */ -static void * -rpcbproc_dump_3_local(void *arg, struct svc_req *rqstp, SVCXPRT *transp, - rpcvers_t versnum) -{ - return ((void *)&list_rbl); -} diff --git a/contrib/netbsd-tests/fs/nfs/nfsservice/rpcbind/rpcb_svc_4.c b/contrib/netbsd-tests/fs/nfs/nfsservice/rpcbind/rpcb_svc_4.c deleted file mode 100644 index c4e8edb0994f..000000000000 --- a/contrib/netbsd-tests/fs/nfs/nfsservice/rpcbind/rpcb_svc_4.c +++ /dev/null @@ -1,455 +0,0 @@ -/* $NetBSD: rpcb_svc_4.c,v 1.2 2011/09/16 16:13:18 plunky Exp $ */ - -/* - * Sun RPC is a product of Sun Microsystems, Inc. and is provided for - * unrestricted use provided that this legend is included on all tape - * media and as a part of the software program in whole or part. Users - * may copy or modify Sun RPC without charge, but are not authorized - * to license or distribute it to anyone else except as part of a product or - * program developed by the user. - * - * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE - * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR - * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. - * - * Sun RPC is provided with no support and without any obligation on the - * part of Sun Microsystems, Inc. to assist in its use, correction, - * modification or enhancement. - * - * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE - * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC - * OR ANY PART THEREOF. - * - * In no event will Sun Microsystems, Inc. be liable for any lost revenue - * or profits or other special, indirect and consequential damages, even if - * Sun has been advised of the possibility of such damages. - * - * Sun Microsystems, Inc. - * 2550 Garcia Avenue - * Mountain View, California 94043 - */ -/* - * Copyright (c) 1986 - 1991 by Sun Microsystems, Inc. - */ - -/* #ident "@(#)rpcb_svc_4.c 1.8 93/07/05 SMI" */ - -/* - * rpcb_svc_4.c - * The server procedure for the version 4 rpcbind. - * - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "rpcbind.h" - -static void *rpcbproc_getaddr_4_local(void *, struct svc_req *, SVCXPRT *, - rpcvers_t); -static void *rpcbproc_getversaddr_4_local(void *, struct svc_req *, SVCXPRT *, - rpcvers_t); -static void *rpcbproc_getaddrlist_4_local(void *, struct svc_req *, SVCXPRT *, - rpcvers_t); -static void free_rpcb_entry_list(rpcb_entry_list_ptr *); -static void *rpcbproc_dump_4_local(void *, struct svc_req *, SVCXPRT *, - rpcvers_t); - -/* - * Called by svc_getreqset. There is a separate server handle for - * every transport that it waits on. - */ -void -rpcb_service_4(struct svc_req *rqstp, SVCXPRT *transp) -{ - union { - rpcb rpcbproc_set_4_arg; - rpcb rpcbproc_unset_4_arg; - rpcb rpcbproc_getaddr_4_local_arg; - char *rpcbproc_uaddr2taddr_4_arg; - struct netbuf rpcbproc_taddr2uaddr_4_arg; - } argument; - char *result; - xdrproc_t xdr_argument, xdr_result; - void *(*local)(void *, struct svc_req *, SVCXPRT *, rpcvers_t); - - rpcbs_procinfo(RPCBVERS_4_STAT, rqstp->rq_proc); - - switch (rqstp->rq_proc) { - case NULLPROC: - /* - * Null proc call - */ -#ifdef RPCBIND_DEBUG - if (debugging) - fprintf(stderr, "RPCBPROC_NULL\n"); -#endif - check_access(transp, rqstp->rq_proc, NULL, RPCBVERS4); - (void) svc_sendreply(transp, (xdrproc_t) xdr_void, NULL); - return; - - case RPCBPROC_SET: - /* - * Check to see whether the message came from - * loopback transports (for security reasons) - */ - xdr_argument = (xdrproc_t)xdr_rpcb; - xdr_result = (xdrproc_t)xdr_bool; - local = rpcbproc_set_com; - break; - - case RPCBPROC_UNSET: - /* - * Check to see whether the message came from - * loopback transports (for security reasons) - */ - xdr_argument = (xdrproc_t)xdr_rpcb; - xdr_result = (xdrproc_t)xdr_bool; - local = rpcbproc_unset_com; - break; - - case RPCBPROC_GETADDR: - xdr_argument = (xdrproc_t)xdr_rpcb; - xdr_result = (xdrproc_t)xdr_wrapstring; - local = rpcbproc_getaddr_4_local; - break; - - case RPCBPROC_GETVERSADDR: -#ifdef RPCBIND_DEBUG - if (debugging) - fprintf(stderr, "RPCBPROC_GETVERSADDR\n"); -#endif - xdr_argument = (xdrproc_t)xdr_rpcb; - xdr_result = (xdrproc_t)xdr_wrapstring; - local = rpcbproc_getversaddr_4_local; - break; - - case RPCBPROC_DUMP: -#ifdef RPCBIND_DEBUG - if (debugging) - fprintf(stderr, "RPCBPROC_DUMP\n"); -#endif - xdr_argument = (xdrproc_t)xdr_void; - xdr_result = (xdrproc_t)xdr_rpcblist_ptr; - local = rpcbproc_dump_4_local; - break; - - case RPCBPROC_INDIRECT: -#ifdef RPCBIND_DEBUG - if (debugging) - fprintf(stderr, "RPCBPROC_INDIRECT\n"); -#endif - rpcbproc_callit_com(rqstp, transp, rqstp->rq_proc, RPCBVERS4); - return; - -/* case RPCBPROC_CALLIT: */ - case RPCBPROC_BCAST: -#ifdef RPCBIND_DEBUG - if (debugging) - fprintf(stderr, "RPCBPROC_BCAST\n"); -#endif - rpcbproc_callit_com(rqstp, transp, rqstp->rq_proc, RPCBVERS4); - return; - - case RPCBPROC_GETTIME: -#ifdef RPCBIND_DEBUG - if (debugging) - fprintf(stderr, "RPCBPROC_GETTIME\n"); -#endif - xdr_argument = (xdrproc_t)xdr_void; - xdr_result = (xdrproc_t)xdr_u_long; - local = rpcbproc_gettime_com; - break; - - case RPCBPROC_UADDR2TADDR: -#ifdef RPCBIND_DEBUG - if (debugging) - fprintf(stderr, "RPCBPROC_UADDR2TADDR\n"); -#endif - xdr_argument = (xdrproc_t)xdr_wrapstring; - xdr_result = (xdrproc_t)xdr_netbuf; - local = rpcbproc_uaddr2taddr_com; - break; - - case RPCBPROC_TADDR2UADDR: -#ifdef RPCBIND_DEBUG - if (debugging) - fprintf(stderr, "RPCBPROC_TADDR2UADDR\n"); -#endif - xdr_argument = (xdrproc_t)xdr_netbuf; - xdr_result = (xdrproc_t)xdr_wrapstring; - local = rpcbproc_taddr2uaddr_com; - break; - - case RPCBPROC_GETADDRLIST: -#ifdef RPCBIND_DEBUG - if (debugging) - fprintf(stderr, "RPCBPROC_GETADDRLIST\n"); -#endif - xdr_argument = (xdrproc_t)xdr_rpcb; - xdr_result = (xdrproc_t)xdr_rpcb_entry_list_ptr; - local = rpcbproc_getaddrlist_4_local; - break; - - case RPCBPROC_GETSTAT: -#ifdef RPCBIND_DEBUG - if (debugging) - fprintf(stderr, "RPCBPROC_GETSTAT\n"); -#endif - xdr_argument = (xdrproc_t)xdr_void; - xdr_result = (xdrproc_t)xdr_rpcb_stat_byvers; - local = rpcbproc_getstat; - break; - - default: - svcerr_noproc(transp); - return; - } - memset((char *)&argument, 0, sizeof (argument)); - if (!svc_getargs(transp, (xdrproc_t) xdr_argument, - (char *)&argument)) { - svcerr_decode(transp); - if (debugging) - (void) fprintf(stderr, "rpcbind: could not decode\n"); - return; - } - if (!check_access(transp, rqstp->rq_proc, &argument, RPCBVERS4)) { - svcerr_weakauth(transp); - goto done; - } - result = (*local)(&argument, rqstp, transp, RPCBVERS4); - if (result != NULL && !svc_sendreply(transp, (xdrproc_t) xdr_result, - result)) { - svcerr_systemerr(transp); - if (debugging) { - (void) fprintf(stderr, "rpcbind: svc_sendreply\n"); - if (doabort) { - rpcbind_abort(); - } - } - } -done: - if (!svc_freeargs(transp, (xdrproc_t) xdr_argument, - (char *)&argument)) { - if (debugging) { - (void) fprintf(stderr, "unable to free arguments\n"); - if (doabort) { - rpcbind_abort(); - } - } - } - return; -} - -/* - * Lookup the mapping for a program, version and return its - * address. Assuming that the caller wants the address of the - * server running on the transport on which the request came. - * Even if a service with a different version number is available, - * it will return that address. The client should check with an - * clnt_call to verify whether the service is the one that is desired. - * We also try to resolve the universal address in terms of - * address of the caller. - */ -/* ARGSUSED */ -static void * -rpcbproc_getaddr_4_local(void *arg, struct svc_req *rqstp, SVCXPRT *transp, - rpcvers_t rpcbversnum) -{ - RPCB *regp = (RPCB *)arg; -#ifdef RPCBIND_DEBUG - if (debugging) { - char *uaddr; - - uaddr = taddr2uaddr(rpcbind_get_conf(transp->xp_netid), - svc_getrpccaller(transp)); - fprintf(stderr, "RPCB_GETADDR req for (%lu, %lu, %s) from %s: ", - (unsigned long)regp->r_prog, (unsigned long)regp->r_vers, - regp->r_netid, uaddr); - free(uaddr); - } -#endif - return (rpcbproc_getaddr_com(regp, rqstp, transp, RPCBVERS4, - RPCB_ALLVERS)); -} - -/* - * Lookup the mapping for a program, version and return its - * address. Assuming that the caller wants the address of the - * server running on the transport on which the request came. - * - * We also try to resolve the universal address in terms of - * address of the caller. - */ -/* ARGSUSED */ -static void * -rpcbproc_getversaddr_4_local(void *arg, struct svc_req *rqstp, SVCXPRT *transp, - rpcvers_t versnum) -{ - RPCB *regp = (RPCB *)arg; -#ifdef RPCBIND_DEBUG - if (debugging) { - char *uaddr; - - uaddr = taddr2uaddr(rpcbind_get_conf(transp->xp_netid), - svc_getrpccaller(transp)); - fprintf(stderr, "RPCB_GETVERSADDR rqst for (%lu, %lu, %s)" - " from %s : ", - (unsigned long)regp->r_prog, (unsigned long)regp->r_vers, - regp->r_netid, uaddr); - free(uaddr); - } -#endif - return (rpcbproc_getaddr_com(regp, rqstp, transp, RPCBVERS4, - RPCB_ONEVERS)); -} - -/* - * Lookup the mapping for a program, version and return the - * addresses for all transports in the current transport family. - * We return a merged address. - */ -/* ARGSUSED */ -static void * -rpcbproc_getaddrlist_4_local(void *arg, struct svc_req *rqstp, SVCXPRT *transp, - rpcvers_t versnum) -{ - RPCB *regp = (RPCB *)arg; - static rpcb_entry_list_ptr rlist; - register rpcblist_ptr rbl; - rpcb_entry_list_ptr rp, tail = NULL; - rpcprog_t prog; - rpcvers_t vers; - rpcb_entry *a; - struct netconfig *nconf; - struct netconfig *reg_nconf; - char *saddr, *maddr = NULL; - - free_rpcb_entry_list(&rlist); - prog = regp->r_prog; - vers = regp->r_vers; - reg_nconf = rpcbind_get_conf(transp->xp_netid); - if (reg_nconf == NULL) - return (NULL); - if (*(regp->r_addr) != '\0') { - saddr = regp->r_addr; - } else { - saddr = NULL; - } -#ifdef RPCBIND_DEBUG - if (debugging) { - fprintf(stderr, "r_addr: %s r_netid: %s nc_protofmly: %s\n", - regp->r_addr, regp->r_netid, reg_nconf->nc_protofmly); - } -#endif - for (rbl = list_rbl; rbl != NULL; rbl = rbl->rpcb_next) { - if ((rbl->rpcb_map.r_prog == prog) && - (rbl->rpcb_map.r_vers == vers)) { - nconf = rpcbind_get_conf(rbl->rpcb_map.r_netid); - if (nconf == NULL) - goto fail; - if (strcmp(nconf->nc_protofmly, reg_nconf->nc_protofmly) - != 0) { - continue; /* not same proto family */ - } -#ifdef RPCBIND_DEBUG - if (debugging) - fprintf(stderr, "\tmerge with: %s\n", rbl->rpcb_map.r_addr); -#endif - if ((maddr = mergeaddr(transp, rbl->rpcb_map.r_netid, - rbl->rpcb_map.r_addr, saddr)) == NULL) { -#ifdef RPCBIND_DEBUG - if (debugging) - fprintf(stderr, " FAILED\n"); -#endif - continue; - } else if (!maddr[0]) { -#ifdef RPCBIND_DEBUG - if (debugging) - fprintf(stderr, " SUCCEEDED, but port died - maddr: nullstring\n"); -#endif - /* The server died. Unset this combination */ - delete_prog(regp->r_prog); - free(maddr); - continue; - } -#ifdef RPCBIND_DEBUG - if (debugging) - fprintf(stderr, " SUCCEEDED maddr: %s\n", maddr); -#endif - /* - * Add it to rlist. - */ - rp = (rpcb_entry_list_ptr) - malloc((u_int)sizeof (rpcb_entry_list)); - if (rp == NULL) { - free(maddr); - goto fail; - } - a = &rp->rpcb_entry_map; - a->r_maddr = maddr; - a->r_nc_netid = nconf->nc_netid; - a->r_nc_semantics = nconf->nc_semantics; - a->r_nc_protofmly = nconf->nc_protofmly; - a->r_nc_proto = nconf->nc_proto; - rp->rpcb_entry_next = NULL; - if (rlist == NULL) { - rlist = rp; - tail = rp; - } else if (tail) { - tail->rpcb_entry_next = rp; - tail = rp; - } - rp = NULL; - } - } -#ifdef RPCBIND_DEBUG - if (debugging) { - for (rp = rlist; rp; rp = rp->rpcb_entry_next) { - fprintf(stderr, "\t%s %s\n", rp->rpcb_entry_map.r_maddr, - rp->rpcb_entry_map.r_nc_proto); - } - } -#endif - /* - * XXX: getaddrlist info is also being stuffed into getaddr. - * Perhaps wrong, but better than it not getting counted at all. - */ - rpcbs_getaddr(RPCBVERS4 - 2, prog, vers, transp->xp_netid, maddr); - return (void *)&rlist; - -fail: free_rpcb_entry_list(&rlist); - return (NULL); -} - -/* - * Free only the allocated structure, rest is all a pointer to some - * other data somewhere else. - */ -static void -free_rpcb_entry_list(rpcb_entry_list_ptr *rlistp) -{ - register rpcb_entry_list_ptr rbl, tmp; - - for (rbl = *rlistp; rbl != NULL; ) { - tmp = rbl; - rbl = rbl->rpcb_entry_next; - free((char *)tmp->rpcb_entry_map.r_maddr); - free((char *)tmp); - } - *rlistp = NULL; -} - -/* ARGSUSED */ -static void * -rpcbproc_dump_4_local(void *arg, struct svc_req *req, SVCXPRT *xprt, - rpcvers_t versnum) -{ - return ((void *)&list_rbl); -} diff --git a/contrib/netbsd-tests/fs/nfs/nfsservice/rpcbind/rpcb_svc_com.c b/contrib/netbsd-tests/fs/nfs/nfsservice/rpcbind/rpcb_svc_com.c deleted file mode 100644 index d7ac0db55d3a..000000000000 --- a/contrib/netbsd-tests/fs/nfs/nfsservice/rpcbind/rpcb_svc_com.c +++ /dev/null @@ -1,1460 +0,0 @@ -/* $NetBSD: rpcb_svc_com.c,v 1.2 2011/09/16 16:13:18 plunky Exp $ */ - -/* - * Sun RPC is a product of Sun Microsystems, Inc. and is provided for - * unrestricted use provided that this legend is included on all tape - * media and as a part of the software program in whole or part. Users - * may copy or modify Sun RPC without charge, but are not authorized - * to license or distribute it to anyone else except as part of a product or - * program developed by the user. - * - * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE - * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR - * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. - * - * Sun RPC is provided with no support and without any obligation on the - * part of Sun Microsystems, Inc. to assist in its use, correction, - * modification or enhancement. - * - * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE - * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC - * OR ANY PART THEREOF. - * - * In no event will Sun Microsystems, Inc. be liable for any lost revenue - * or profits or other special, indirect and consequential damages, even if - * Sun has been advised of the possibility of such damages. - * - * Sun Microsystems, Inc. - * 2550 Garcia Avenue - * Mountain View, California 94043 - */ -/* - * Copyright (c) 1986 - 1991 by Sun Microsystems, Inc. - */ - -/* #ident "@(#)rpcb_svc_com.c 1.18 94/05/02 SMI" */ - -/* - * rpcb_svc_com.c - * The commom server procedure for the rpcbind. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#ifdef PORTMAP -#include -#include -#endif /* PORTMAP */ -#include -#include - -#include -#include - -#include "rpcbind.h" -#include "svc_dg.h" -#include "svc_fdset.h" - -#define RPC_BUF_MAX 65536 /* can be raised if required */ - -static char emptystring[] = ""; -static int rpcb_rmtcalls; - -struct rmtcallfd_list { - int fd; - SVCXPRT *xprt; - char *netid; - struct rmtcallfd_list *next; -}; - -#define NFORWARD 64 -#define MAXTIME_OFF 300 /* 5 minutes */ - -struct finfo { - int flag; -#define FINFO_ACTIVE 0x1 - u_int32_t caller_xid; - struct netbuf *caller_addr; - u_int32_t forward_xid; - int forward_fd; - char *uaddr; - rpcproc_t reply_type; - rpcvers_t versnum; - time_t time; -}; -static struct finfo FINFO[NFORWARD]; - - -static bool_t xdr_encap_parms(XDR *, struct encap_parms *); -static bool_t xdr_rmtcall_args(XDR *, struct r_rmtcall_args *); -static bool_t xdr_rmtcall_result(XDR *, struct r_rmtcall_args *); -static bool_t xdr_opaque_parms(XDR *, struct r_rmtcall_args *); -static int find_rmtcallfd_by_netid(char *); -static SVCXPRT *find_rmtcallxprt_by_fd(int); -static u_int32_t forward_register(u_int32_t, struct netbuf *, int, char *, - rpcproc_t, rpcvers_t); -static struct finfo *forward_find(u_int32_t); -static int free_slot_by_xid(u_int32_t); -static int free_slot_by_index(int); -static int netbufcmp(struct netbuf *, struct netbuf *); -static struct netbuf *netbufdup(struct netbuf *); -static void netbuffree(struct netbuf *); -static int check_rmtcalls(struct pollfd *, int); -static void xprt_set_caller(SVCXPRT *, struct finfo *); -static void send_svcsyserr(SVCXPRT *, struct finfo *); -static void handle_reply(int, SVCXPRT *); -static void find_versions(rpcprog_t, char *, rpcvers_t *, rpcvers_t *); -static rpcblist_ptr find_service(rpcprog_t, rpcvers_t, char *); -static char *getowner(SVCXPRT *, char *, size_t); -static int add_pmaplist(RPCB *); -static int del_pmaplist(RPCB *); - -/* - * Set a mapping of program, version, netid - */ -/* ARGSUSED */ -void * -rpcbproc_set_com(void *arg, struct svc_req *rqstp, SVCXPRT *transp, - rpcvers_t rpcbversnum) -{ - RPCB *regp = (RPCB *)arg; - static bool_t ans; - char owner[64]; - -#ifdef RPCBIND_DEBUG - if (debugging) - fprintf(stderr, "RPCB_SET request for (%lu, %lu, %s, %s) : ", - (unsigned long)regp->r_prog, (unsigned long)regp->r_vers, - regp->r_netid, regp->r_addr); -#endif - ans = map_set(regp, getowner(transp, owner, sizeof owner)); -#ifdef RPCBIND_DEBUG - if (debugging) - fprintf(stderr, "%s\n", ans == TRUE ? "succeeded" : "failed"); -#endif - /* XXX: should have used some defined constant here */ - rpcbs_set(rpcbversnum - 2, ans); - return (void *)&ans; -} - -bool_t -map_set(RPCB *regp, char *owner) -{ - RPCB reg, *a; - rpcblist_ptr rbl, fnd; - - reg = *regp; - /* - * check to see if already used - * find_service returns a hit even if - * the versions don't match, so check for it - */ - fnd = find_service(reg.r_prog, reg.r_vers, reg.r_netid); - if (fnd && (fnd->rpcb_map.r_vers == reg.r_vers)) { - if (!strcmp(fnd->rpcb_map.r_addr, reg.r_addr)) - /* - * if these match then it is already - * registered so just say "OK". - */ - return (TRUE); - else - return (FALSE); - } - /* - * add to the end of the list - */ - rbl = (rpcblist_ptr) malloc((u_int)sizeof (RPCBLIST)); - if (rbl == NULL) { - return (FALSE); - } - a = &(rbl->rpcb_map); - a->r_prog = reg.r_prog; - a->r_vers = reg.r_vers; - a->r_netid = strdup(reg.r_netid); - a->r_addr = strdup(reg.r_addr); - a->r_owner = strdup(owner); - if (!a->r_addr || !a->r_netid || !a->r_owner) { - if (a->r_netid) - free((void *) a->r_netid); - if (a->r_addr) - free((void *) a->r_addr); - if (a->r_owner) - free((void *) a->r_owner); - free((void *)rbl); - return (FALSE); - } - rbl->rpcb_next = NULL; - if (list_rbl == NULL) { - list_rbl = rbl; - } else { - for (fnd = list_rbl; fnd->rpcb_next; - fnd = fnd->rpcb_next) - ; - fnd->rpcb_next = rbl; - } -#ifdef PORTMAP - (void) add_pmaplist(regp); -#endif - return (TRUE); -} - -/* - * Unset a mapping of program, version, netid - */ -/* ARGSUSED */ -void * -rpcbproc_unset_com(void *arg, struct svc_req *rqstp, SVCXPRT *transp, - rpcvers_t rpcbversnum) -{ - RPCB *regp = (RPCB *)arg; - static bool_t ans; - char owner[64]; - -#ifdef RPCBIND_DEBUG - if (debugging) - fprintf(stderr, "RPCB_UNSET request for (%lu, %lu, %s) : ", - (unsigned long)regp->r_prog, (unsigned long)regp->r_vers, - regp->r_netid); -#endif - ans = map_unset(regp, getowner(transp, owner, sizeof owner)); -#ifdef RPCBIND_DEBUG - if (debugging) - fprintf(stderr, "%s\n", ans == TRUE ? "succeeded" : "failed"); -#endif - /* XXX: should have used some defined constant here */ - rpcbs_unset(rpcbversnum - 2, ans); - return (void *)&ans; -} - -bool_t -map_unset(RPCB *regp, const char *owner) -{ - int ans = 0; - rpcblist_ptr rbl, prev, tmp; - - if (owner == NULL) - return (0); - - for (prev = NULL, rbl = list_rbl; rbl; /* cstyle */) { - if ((rbl->rpcb_map.r_prog != regp->r_prog) || - (rbl->rpcb_map.r_vers != regp->r_vers) || - (regp->r_netid[0] && strcasecmp(regp->r_netid, - rbl->rpcb_map.r_netid))) { - /* both rbl & prev move forwards */ - prev = rbl; - rbl = rbl->rpcb_next; - continue; - } - /* - * Check whether appropriate uid. Unset only - * if superuser or the owner itself. - */ - if (strcmp(owner, rpcbind_superuser) && - strcmp(rbl->rpcb_map.r_owner, owner)) - return (0); - /* found it; rbl moves forward, prev stays */ - ans = 1; - tmp = rbl; - rbl = rbl->rpcb_next; - if (prev == NULL) - list_rbl = rbl; - else - prev->rpcb_next = rbl; - free((void *) tmp->rpcb_map.r_addr); - free((void *) tmp->rpcb_map.r_netid); - free((void *) tmp->rpcb_map.r_owner); - free((void *) tmp); - } -#ifdef PORTMAP - if (ans) - (void) del_pmaplist(regp); -#endif - /* - * We return 1 either when the entry was not there or it - * was able to unset it. It can come to this point only if - * atleast one of the conditions is true. - */ - return (1); -} - -void -delete_prog(int prog) -{ - RPCB reg; - register rpcblist_ptr rbl; - - for (rbl = list_rbl; rbl != NULL; rbl = rbl->rpcb_next) { - if ((rbl->rpcb_map.r_prog != prog)) - continue; - if (is_bound(rbl->rpcb_map.r_netid, rbl->rpcb_map.r_addr)) - continue; - reg.r_prog = rbl->rpcb_map.r_prog; - reg.r_vers = rbl->rpcb_map.r_vers; - reg.r_netid = strdup(rbl->rpcb_map.r_netid); - (void)map_unset(®, rpcbind_superuser); - free(reg.r_netid); - } -} - -void * -rpcbproc_getaddr_com(RPCB *regp, struct svc_req *rqstp, SVCXPRT *transp, - rpcvers_t rpcbversnum, rpcvers_t verstype) -{ - static char *uaddr; - char *saddr = NULL; - rpcblist_ptr fnd; - - if (uaddr && uaddr[0]) - free((void *) uaddr); - fnd = find_service(regp->r_prog, regp->r_vers, transp->xp_netid); - if (fnd && ((verstype == RPCB_ALLVERS) || - (regp->r_vers == fnd->rpcb_map.r_vers))) { - if (*(regp->r_addr) != '\0') { /* may contain a hint about */ - saddr = regp->r_addr; /* the interface that we */ - } /* should use */ - if (!(uaddr = mergeaddr(transp, transp->xp_netid, - fnd->rpcb_map.r_addr, saddr))) { - /* Try whatever we have */ - uaddr = strdup(fnd->rpcb_map.r_addr); - } else if (!uaddr[0]) { - /* - * The server died. Unset all versions of this prog. - */ - delete_prog(regp->r_prog); - uaddr = emptystring; - } - } else { - uaddr = emptystring; - } -#ifdef RPCBIND_DEBUG - if (debugging) - fprintf(stderr, "getaddr: %s\n", uaddr); -#endif - /* XXX: should have used some defined constant here */ - rpcbs_getaddr(rpcbversnum - 2, regp->r_prog, regp->r_vers, - transp->xp_netid, uaddr); - return (void *)&uaddr; -} - -/* ARGSUSED */ -void * -rpcbproc_gettime_com(void *arg, struct svc_req *rqstp, SVCXPRT *transp, - rpcvers_t rpcbversnum) -{ - static time_t curtime; - - (void) time(&curtime); - return (void *)&curtime; -} - -/* - * Convert uaddr to taddr. Should be used only by - * local servers/clients. (kernel level stuff only) - */ -/* ARGSUSED */ -void * -rpcbproc_uaddr2taddr_com(void *arg, struct svc_req *rqstp, SVCXPRT *transp, - rpcvers_t rpcbversnum) -{ - char **uaddrp = (char **)arg; - struct netconfig *nconf; - static struct netbuf nbuf; - static struct netbuf *taddr; - - if (taddr) { - free((void *) taddr->buf); - free((void *) taddr); - } - if (((nconf = rpcbind_get_conf(transp->xp_netid)) == NULL) || - ((taddr = uaddr2taddr(nconf, *uaddrp)) == NULL)) { - (void) memset((char *)&nbuf, 0, sizeof (struct netbuf)); - return (void *)&nbuf; - } - return (void *)taddr; -} - -/* - * Convert taddr to uaddr. Should be used only by - * local servers/clients. (kernel level stuff only) - */ -/* ARGSUSED */ -void * -rpcbproc_taddr2uaddr_com(void *arg, struct svc_req *rqstp, SVCXPRT *transp, - rpcvers_t rpcbversnum) -{ - struct netbuf *taddr = (struct netbuf *)arg; - static char *uaddr; - struct netconfig *nconf; - - if (uaddr && !uaddr[0]) - free((void *) uaddr); - if (((nconf = rpcbind_get_conf(transp->xp_netid)) == NULL) || - ((uaddr = taddr2uaddr(nconf, taddr)) == NULL)) { - uaddr = emptystring; - } - return (void *)&uaddr; -} - - -static bool_t -xdr_encap_parms(XDR *xdrs, struct encap_parms *epp) -{ - return (xdr_bytes(xdrs, &(epp->args), (u_int *) &(epp->arglen), ~0)); -} - -/* - * XDR remote call arguments. It ignores the address part. - * written for XDR_DECODE direction only - */ -static bool_t -xdr_rmtcall_args(XDR *xdrs, struct r_rmtcall_args *cap) -{ - /* does not get the address or the arguments */ - if (xdr_u_int32_t(xdrs, &(cap->rmt_prog)) && - xdr_u_int32_t(xdrs, &(cap->rmt_vers)) && - xdr_u_int32_t(xdrs, &(cap->rmt_proc))) { - return (xdr_encap_parms(xdrs, &(cap->rmt_args))); - } - return (FALSE); -} - -/* - * XDR remote call results along with the address. Ignore - * program number, version number and proc number. - * Written for XDR_ENCODE direction only. - */ -static bool_t -xdr_rmtcall_result(XDR *xdrs, struct r_rmtcall_args *cap) -{ - bool_t result; - -#ifdef PORTMAP - if (cap->rmt_localvers == PMAPVERS) { - int h1, h2, h3, h4, p1, p2; - u_long port; - - /* interpret the universal address for TCP/IP */ - if (sscanf(cap->rmt_uaddr, "%d.%d.%d.%d.%d.%d", - &h1, &h2, &h3, &h4, &p1, &p2) != 6) - return (FALSE); - port = ((p1 & 0xff) << 8) + (p2 & 0xff); - result = xdr_u_long(xdrs, &port); - } else -#endif - if ((cap->rmt_localvers == RPCBVERS) || - (cap->rmt_localvers == RPCBVERS4)) { - result = xdr_wrapstring(xdrs, &(cap->rmt_uaddr)); - } else { - return (FALSE); - } - if (result == TRUE) - return (xdr_encap_parms(xdrs, &(cap->rmt_args))); - return (FALSE); -} - -/* - * only worries about the struct encap_parms part of struct r_rmtcall_args. - * The arglen must already be set!! - */ -static bool_t -xdr_opaque_parms(XDR *xdrs, struct r_rmtcall_args *cap) -{ - return (xdr_opaque(xdrs, cap->rmt_args.args, cap->rmt_args.arglen)); -} - -static struct rmtcallfd_list *rmthead; -static struct rmtcallfd_list *rmttail; - -int -create_rmtcall_fd(struct netconfig *nconf) -{ - int fd; - struct rmtcallfd_list *rmt; - SVCXPRT *xprt; - - if ((fd = __rpc_nconf2fd(nconf)) == -1) { - if (debugging) - fprintf(stderr, - "create_rmtcall_fd: couldn't open \"%s\" (errno %d)\n", - nconf->nc_device, errno); - return (-1); - } - xprt = svc_tli_create(fd, 0, (struct t_bind *) 0, 0, 0); - if (xprt == NULL) { - if (debugging) - fprintf(stderr, - "create_rmtcall_fd: svc_tli_create failed\n"); - return (-1); - } - rmt = (struct rmtcallfd_list *)malloc((u_int) - sizeof (struct rmtcallfd_list)); - if (rmt == NULL) { - syslog(LOG_ERR, "create_rmtcall_fd: no memory!"); - return (-1); - } - rmt->xprt = xprt; - rmt->netid = strdup(nconf->nc_netid); - xprt->xp_netid = rmt->netid; - rmt->fd = fd; - rmt->next = NULL; - if (rmthead == NULL) { - rmthead = rmt; - rmttail = rmt; - } else { - rmttail->next = rmt; - rmttail = rmt; - } - /* XXX not threadsafe */ - if (fd > *get_fdsetmax()) - *get_fdsetmax() = fd; - FD_SET(fd, get_fdset()); - return (fd); -} - -static int -find_rmtcallfd_by_netid(char *netid) -{ - struct rmtcallfd_list *rmt; - - for (rmt = rmthead; rmt != NULL; rmt = rmt->next) { - if (strcmp(netid, rmt->netid) == 0) { - return (rmt->fd); - } - } - return (-1); -} - -static SVCXPRT * -find_rmtcallxprt_by_fd(int fd) -{ - struct rmtcallfd_list *rmt; - - for (rmt = rmthead; rmt != NULL; rmt = rmt->next) { - if (fd == rmt->fd) { - return (rmt->xprt); - } - } - return (NULL); -} - - -/* - * Call a remote procedure service. This procedure is very quiet when things - * go wrong. The proc is written to support broadcast rpc. In the broadcast - * case, a machine should shut-up instead of complain, lest the requestor be - * overrun with complaints at the expense of not hearing a valid reply. - * When receiving a request and verifying that the service exists, we - * - * receive the request - * - * open a new TLI endpoint on the same transport on which we received - * the original request - * - * remember the original request's XID (which requires knowing the format - * of the svc_dg_data structure) - * - * forward the request, with a new XID, to the requested service, - * remembering the XID used to send this request (for later use in - * reassociating the answer with the original request), the requestor's - * address, the file descriptor on which the forwarded request is - * made and the service's address. - * - * mark the file descriptor on which we anticipate receiving a reply from - * the service and one to select for in our private svc_run procedure - * - * At some time in the future, a reply will be received from the service to - * which we forwarded the request. At that time, we detect that the socket - * used was for forwarding (by looking through the finfo structures to see - * whether the fd corresponds to one of those) and call handle_reply() to - * - * receive the reply - * - * bundle the reply, along with the service's universal address - * - * create a SVCXPRT structure and use a version of svc_sendreply - * that allows us to specify the reply XID and destination, send the reply - * to the original requestor. - */ - -void -rpcbproc_callit_com(struct svc_req *rqstp, SVCXPRT *transp, - rpcproc_t reply_type, rpcvers_t versnum) -{ - register rpcblist_ptr rbl; - struct netconfig *nconf; - struct netbuf *caller; - struct r_rmtcall_args a; - char *buf_alloc = NULL, *outbufp; - char *outbuf_alloc = NULL; - char buf[RPC_BUF_MAX], outbuf[RPC_BUF_MAX]; - struct netbuf *na = NULL; - struct rpc_msg call_msg; - int outlen; - u_int sendsz; - XDR outxdr; - AUTH *auth; - int fd = -1; - char *uaddr, *m_uaddr, *local_uaddr = NULL; - u_int32_t *xidp; - struct __rpc_sockinfo si; - struct sockaddr *localsa; - struct netbuf tbuf; - - if (!__rpc_fd2sockinfo(transp->xp_fd, &si)) { - if (reply_type == RPCBPROC_INDIRECT) - svcerr_systemerr(transp); - return; - } - if (si.si_socktype != SOCK_DGRAM) - return; /* Only datagram type accepted */ - sendsz = __rpc_get_t_size(si.si_af, si.si_proto, UDPMSGSIZE); - if (sendsz == 0) { /* data transfer not supported */ - if (reply_type == RPCBPROC_INDIRECT) - svcerr_systemerr(transp); - return; - } - /* - * Should be multiple of 4 for XDR. - */ - sendsz = ((sendsz + 3) / 4) * 4; - if (sendsz > RPC_BUF_MAX) { -#ifdef notyet - buf_alloc = alloca(sendsz); /* not in IDR2? */ -#else - buf_alloc = malloc(sendsz); -#endif /* notyet */ - if (buf_alloc == NULL) { - if (debugging) - fprintf(stderr, - "rpcbproc_callit_com: No Memory!\n"); - if (reply_type == RPCBPROC_INDIRECT) - svcerr_systemerr(transp); - return; - } - a.rmt_args.args = buf_alloc; - } else { - a.rmt_args.args = buf; - } - - call_msg.rm_xid = 0; /* For error checking purposes */ - if (!svc_getargs(transp, (xdrproc_t) xdr_rmtcall_args, (char *) &a)) { - if (reply_type == RPCBPROC_INDIRECT) - svcerr_decode(transp); - if (debugging) - fprintf(stderr, - "rpcbproc_callit_com: svc_getargs failed\n"); - goto error; - } - - if (!check_callit(transp, &a, versnum)) { - svcerr_weakauth(transp); - goto error; - } - - caller = svc_getrpccaller(transp); -#ifdef RPCBIND_DEBUG - if (debugging) { - uaddr = taddr2uaddr(rpcbind_get_conf(transp->xp_netid), caller); - fprintf(stderr, "%s %s req for (%lu, %lu, %lu, %s) from %s : ", - versnum == PMAPVERS ? "pmap_rmtcall" : - versnum == RPCBVERS ? "rpcb_rmtcall" : - versnum == RPCBVERS4 ? "rpcb_indirect" : - rpcbind_unknown, - reply_type == RPCBPROC_INDIRECT ? "indirect" : "callit", - (unsigned long)a.rmt_prog, (unsigned long)a.rmt_vers, - (unsigned long)a.rmt_proc, transp->xp_netid, - uaddr ? uaddr : rpcbind_unknown); - if (uaddr) - free((void *) uaddr); - } -#endif - - rbl = find_service(a.rmt_prog, a.rmt_vers, transp->xp_netid); - - rpcbs_rmtcall(versnum - 2, reply_type, a.rmt_prog, a.rmt_vers, - a.rmt_proc, transp->xp_netid, rbl); - - if (rbl == NULL) { -#ifdef RPCBIND_DEBUG - if (debugging) - fprintf(stderr, "not found\n"); -#endif - if (reply_type == RPCBPROC_INDIRECT) - svcerr_noprog(transp); - goto error; - } - if (rbl->rpcb_map.r_vers != a.rmt_vers) { - if (reply_type == RPCBPROC_INDIRECT) { - rpcvers_t vers_low, vers_high; - - find_versions(a.rmt_prog, transp->xp_netid, - &vers_low, &vers_high); - svcerr_progvers(transp, vers_low, vers_high); - } - goto error; - } - -#ifdef RPCBIND_DEBUG - if (debugging) - fprintf(stderr, "found at uaddr %s\n", rbl->rpcb_map.r_addr); -#endif - /* - * Check whether this entry is valid and a server is present - * Mergeaddr() returns NULL if no such entry is present, and - * returns "" if the entry was present but the server is not - * present (i.e., it crashed). - */ - if (reply_type == RPCBPROC_INDIRECT) { - uaddr = mergeaddr(transp, transp->xp_netid, - rbl->rpcb_map.r_addr, NULL); - if (uaddr == NULL || uaddr[0] == '\0') { - svcerr_noprog(transp); - if (uaddr != NULL) { - free((void *) uaddr); - } - goto error; - } - if (uaddr != NULL) { - free((void *) uaddr); - } - } - nconf = rpcbind_get_conf(transp->xp_netid); - if (nconf == NULL) { - if (reply_type == RPCBPROC_INDIRECT) - svcerr_systemerr(transp); - if (debugging) - fprintf(stderr, - "rpcbproc_callit_com: rpcbind_get_conf failed\n"); - goto error; - } - localsa = local_sa(((struct sockaddr *)caller->buf)->sa_family); - if (localsa == NULL) { - if (debugging) - fprintf(stderr, - "rpcbproc_callit_com: no local address\n"); - goto error; - } - tbuf.len = tbuf.maxlen = localsa->sa_len; - tbuf.buf = localsa; - local_uaddr = - addrmerge(&tbuf, rbl->rpcb_map.r_addr, NULL, nconf->nc_netid); - m_uaddr = addrmerge(caller, rbl->rpcb_map.r_addr, NULL, - nconf->nc_netid); -#ifdef RPCBIND_DEBUG - if (debugging) - fprintf(stderr, "merged uaddr %s\n", m_uaddr); -#endif - if ((fd = find_rmtcallfd_by_netid(nconf->nc_netid)) == -1) { - if (reply_type == RPCBPROC_INDIRECT) - svcerr_systemerr(transp); - free((void *) m_uaddr); - goto error; - } - xidp = __rpcb_get_dg_xidp(transp); - call_msg.rm_xid = forward_register(*xidp, - caller, fd, m_uaddr, reply_type, versnum); - if (call_msg.rm_xid == 0) { - /* - * A duplicate request for the slow server. Let's not - * beat on it any more. - */ - if (debugging) - fprintf(stderr, - "rpcbproc_callit_com: duplicate request\n"); - free((void *) m_uaddr); - goto error; - } else if (call_msg.rm_xid == -1) { - /* forward_register failed. Perhaps no memory. */ - if (debugging) - fprintf(stderr, - "rpcbproc_callit_com: forward_register failed\n"); - free((void *) m_uaddr); - goto error; - } - -#ifdef DEBUG_RMTCALL - if (debugging) - fprintf(stderr, - "rpcbproc_callit_com: original XID %x, new XID %x\n", - *xidp, call_msg.rm_xid); -#endif - call_msg.rm_direction = CALL; - call_msg.rm_call.cb_rpcvers = RPC_MSG_VERSION; - call_msg.rm_call.cb_prog = a.rmt_prog; - call_msg.rm_call.cb_vers = a.rmt_vers; - if (sendsz > RPC_BUF_MAX) { -#ifdef notyet - outbuf_alloc = alloca(sendsz); /* not in IDR2? */ -#else - outbuf_alloc = malloc(sendsz); -#endif /* notyet */ - if (outbuf_alloc == NULL) { - if (reply_type == RPCBPROC_INDIRECT) - svcerr_systemerr(transp); - if (debugging) - fprintf(stderr, - "rpcbproc_callit_com: No memory!\n"); - goto error; - } - xdrmem_create(&outxdr, outbuf_alloc, sendsz, XDR_ENCODE); - } else { - xdrmem_create(&outxdr, outbuf, sendsz, XDR_ENCODE); - } - if (!xdr_callhdr(&outxdr, &call_msg)) { - if (reply_type == RPCBPROC_INDIRECT) - svcerr_systemerr(transp); - if (debugging) - fprintf(stderr, - "rpcbproc_callit_com: xdr_callhdr failed\n"); - goto error; - } - if (!xdr_u_int32_t(&outxdr, &(a.rmt_proc))) { - if (reply_type == RPCBPROC_INDIRECT) - svcerr_systemerr(transp); - if (debugging) - fprintf(stderr, - "rpcbproc_callit_com: xdr_u_long failed\n"); - goto error; - } - - if (rqstp->rq_cred.oa_flavor == AUTH_NULL) { - auth = authnone_create(); - } else if (rqstp->rq_cred.oa_flavor == AUTH_SYS) { - struct authunix_parms *au; - - au = (struct authunix_parms *)rqstp->rq_clntcred; - auth = authunix_create(au->aup_machname, - au->aup_uid, au->aup_gid, - au->aup_len, au->aup_gids); - if (auth == NULL) /* fall back */ - auth = authnone_create(); - } else { - /* we do not support any other authentication scheme */ - if (debugging) - fprintf(stderr, -"rpcbproc_callit_com: oa_flavor != AUTH_NONE and oa_flavor != AUTH_SYS\n"); - if (reply_type == RPCBPROC_INDIRECT) - svcerr_weakauth(transp); /* XXX too strong.. */ - goto error; - } - if (auth == NULL) { - if (reply_type == RPCBPROC_INDIRECT) - svcerr_systemerr(transp); - if (debugging) - fprintf(stderr, - "rpcbproc_callit_com: authwhatever_create returned NULL\n"); - goto error; - } - if (!AUTH_MARSHALL(auth, &outxdr)) { - if (reply_type == RPCBPROC_INDIRECT) - svcerr_systemerr(transp); - AUTH_DESTROY(auth); - if (debugging) - fprintf(stderr, - "rpcbproc_callit_com: AUTH_MARSHALL failed\n"); - goto error; - } - AUTH_DESTROY(auth); - if (!xdr_opaque_parms(&outxdr, &a)) { - if (reply_type == RPCBPROC_INDIRECT) - svcerr_systemerr(transp); - if (debugging) - fprintf(stderr, - "rpcbproc_callit_com: xdr_opaque_parms failed\n"); - goto error; - } - outlen = (int) XDR_GETPOS(&outxdr); - if (outbuf_alloc) - outbufp = outbuf_alloc; - else - outbufp = outbuf; - - na = uaddr2taddr(nconf, local_uaddr); - if (!na) { - if (reply_type == RPCBPROC_INDIRECT) - svcerr_systemerr(transp); - goto error; - } - - if (sendto(fd, outbufp, outlen, 0, (struct sockaddr *)na->buf, na->len) - != outlen) { - if (debugging) - fprintf(stderr, - "rpcbproc_callit_com: sendto failed: errno %d\n", errno); - if (reply_type == RPCBPROC_INDIRECT) - svcerr_systemerr(transp); - goto error; - } - goto out; - -error: - if (call_msg.rm_xid != 0) - (void) free_slot_by_xid(call_msg.rm_xid); -out: - if (local_uaddr) - free(local_uaddr); - if (buf_alloc) - free((void *) buf_alloc); - if (outbuf_alloc) - free((void *) outbuf_alloc); - if (na) { - free(na->buf); - free(na); - } -} - -/* - * Makes an entry into the FIFO for the given request. - * If duplicate request, returns a 0, else returns the xid of its call. - */ -static u_int32_t -forward_register(u_int32_t caller_xid, struct netbuf *caller_addr, - int forward_fd, char *uaddr, rpcproc_t reply_type, - rpcvers_t versnum) -{ - int i; - int j = 0; - time_t min_time, time_now; - static u_int32_t lastxid; - int entry = -1; - - min_time = FINFO[0].time; - time_now = time((time_t *)0); - /* initialization */ - if (lastxid == 0) - lastxid = time_now * NFORWARD; - - /* - * Check if it is an duplicate entry. Then, - * try to find an empty slot. If not available, then - * use the slot with the earliest time. - */ - for (i = 0; i < NFORWARD; i++) { - if (FINFO[i].flag & FINFO_ACTIVE) { - if ((FINFO[i].caller_xid == caller_xid) && - (FINFO[i].reply_type == reply_type) && - (FINFO[i].versnum == versnum) && - (!netbufcmp(FINFO[i].caller_addr, - caller_addr))) { - FINFO[i].time = time((time_t *)0); - return (0); /* Duplicate entry */ - } else { - /* Should we wait any longer */ - if ((time_now - FINFO[i].time) > MAXTIME_OFF) - (void) free_slot_by_index(i); - } - } - if (entry == -1) { - if ((FINFO[i].flag & FINFO_ACTIVE) == 0) { - entry = i; - } else if (FINFO[i].time < min_time) { - j = i; - min_time = FINFO[i].time; - } - } - } - if (entry != -1) { - /* use this empty slot */ - j = entry; - } else { - (void) free_slot_by_index(j); - } - if ((FINFO[j].caller_addr = netbufdup(caller_addr)) == NULL) { - return (-1); - } - rpcb_rmtcalls++; /* no of pending calls */ - FINFO[j].flag = FINFO_ACTIVE; - FINFO[j].reply_type = reply_type; - FINFO[j].versnum = versnum; - FINFO[j].time = time_now; - FINFO[j].caller_xid = caller_xid; - FINFO[j].forward_fd = forward_fd; - /* - * Though uaddr is not allocated here, it will still be freed - * from free_slot_*(). - */ - FINFO[j].uaddr = uaddr; - lastxid = lastxid + NFORWARD; - FINFO[j].forward_xid = lastxid + j; /* encode slot */ - return (FINFO[j].forward_xid); /* forward on this xid */ -} - -static struct finfo * -forward_find(u_int32_t reply_xid) -{ - int i; - - i = reply_xid % NFORWARD; - if (i < 0) - i += NFORWARD; - if ((FINFO[i].flag & FINFO_ACTIVE) && - (FINFO[i].forward_xid == reply_xid)) { - return (&FINFO[i]); - } - return (NULL); -} - -static int -free_slot_by_xid(u_int32_t xid) -{ - int entry; - - entry = xid % NFORWARD; - if (entry < 0) - entry += NFORWARD; - return (free_slot_by_index(entry)); -} - -static int -free_slot_by_index(int idx) -{ - struct finfo *fi; - - fi = &FINFO[idx]; - if (fi->flag & FINFO_ACTIVE) { - netbuffree(fi->caller_addr); - /* XXX may be too big, but can't access xprt array here */ - if (fi->forward_fd >= *get_fdsetmax()) - (*get_fdsetmax())--; - free((void *) fi->uaddr); - fi->flag &= ~FINFO_ACTIVE; - rpcb_rmtcalls--; - return (1); - } - return (0); -} - -static int -netbufcmp(struct netbuf *n1, struct netbuf *n2) -{ - return ((n1->len != n2->len) || memcmp(n1->buf, n2->buf, n1->len)); -} - -static struct netbuf * -netbufdup(struct netbuf *ap) -{ - struct netbuf *np; - - np = (struct netbuf *) malloc(sizeof (struct netbuf) + ap->len); - if (np) { - np->maxlen = np->len = ap->len; - np->buf = ((char *) np) + sizeof (struct netbuf); - (void) memcpy(np->buf, ap->buf, ap->len); - } - return (np); -} - -static void -netbuffree(struct netbuf *ap) -{ - free((void *) ap); -} - - -#define MASKVAL (POLLIN | POLLPRI | POLLRDNORM | POLLRDBAND) -extern bool_t __svc_clean_idle(fd_set *, int, bool_t); - -void -my_svc_run() -{ - size_t nfds; - struct pollfd pollfds[FD_SETSIZE]; - int poll_ret, check_ret; - int n; -#ifdef SVC_RUN_DEBUG - int i; -#endif - register struct pollfd *p; - fd_set cleanfds; - - for (;;) { - p = pollfds; - for (n = 0; n <= *get_fdsetmax(); n++) { - if (FD_ISSET(n, get_fdset())) { - p->fd = n; - p->events = MASKVAL; - p++; - } - } - nfds = p - pollfds; - poll_ret = 0; -#ifdef SVC_RUN_DEBUG - if (debugging) { - fprintf(stderr, "polling for read on fd < "); - for (i = 0, p = pollfds; i < nfds; i++, p++) - if (p->events) - fprintf(stderr, "%d ", p->fd); - fprintf(stderr, ">\n"); - } -#endif - poll_ret = rump_sys_poll(pollfds, nfds, 30 * 1000); - //printf("rpcbind poll got %d\n", poll_ret); - switch (poll_ret) { - case -1: - /* - * We ignore all errors, continuing with the assumption - * that it was set by the signal handlers (or any - * other outside event) and not caused by poll(). - */ - case 0: - cleanfds = *get_fdset(); - __svc_clean_idle(&cleanfds, 30, FALSE); - continue; - default: -#ifdef SVC_RUN_DEBUG - if (debugging) { - fprintf(stderr, "poll returned read fds < "); - for (i = 0, p = pollfds; i < nfds; i++, p++) - if (p->revents) - fprintf(stderr, "%d (0x%x) ", p->fd, p->revents); - fprintf(stderr, ">\n"); - } -#endif - /* - * If we found as many replies on callback fds - * as the number of descriptors selectable which - * poll() returned, there can be no more so we - * don't call svc_getreq_poll. Otherwise, there - * must be another so we must call svc_getreq_poll. - */ - if ((check_ret = check_rmtcalls(pollfds, nfds)) == - poll_ret) - continue; - svc_getreq_poll(pollfds, poll_ret-check_ret); - } -#ifdef SVC_RUN_DEBUG - if (debugging) { - fprintf(stderr, "svc_maxfd now %u\n", *get_fdsetmax()); - } -#endif - } -} - -static int -check_rmtcalls(struct pollfd *pfds, int nfds) -{ - int j, ncallbacks_found = 0, rmtcalls_pending; - SVCXPRT *xprt; - - if (rpcb_rmtcalls == 0) - return (0); - - rmtcalls_pending = rpcb_rmtcalls; - for (j = 0; j < nfds; j++) { - if ((xprt = find_rmtcallxprt_by_fd(pfds[j].fd)) != NULL) { - if (pfds[j].revents) { - ncallbacks_found++; -#ifdef DEBUG_RMTCALL - if (debugging) - fprintf(stderr, -"my_svc_run: polled on forwarding fd %d, netid %s - calling handle_reply\n", - pfds[j].fd, xprt->xp_netid); -#endif - handle_reply(pfds[j].fd, xprt); - pfds[j].revents = 0; - if (ncallbacks_found >= rmtcalls_pending) { - break; - } - } - } - } - return (ncallbacks_found); -} - -static void -xprt_set_caller(SVCXPRT *xprt, struct finfo *fi) -{ - u_int32_t *xidp; - - *(svc_getrpccaller(xprt)) = *(fi->caller_addr); - xidp = __rpcb_get_dg_xidp(xprt); - *xidp = fi->caller_xid; -} - -/* - * Call svcerr_systemerr() only if RPCBVERS4 - */ -static void -send_svcsyserr(SVCXPRT *xprt, struct finfo *fi) -{ - if (fi->reply_type == RPCBPROC_INDIRECT) { - xprt_set_caller(xprt, fi); - svcerr_systemerr(xprt); - } - return; -} - -static void -handle_reply(int fd, SVCXPRT *xprt) -{ - XDR reply_xdrs; - struct rpc_msg reply_msg; - struct rpc_err reply_error; - char *buffer; - struct finfo *fi; - int inlen, pos, len; - struct r_rmtcall_args a; - struct sockaddr_storage ss; - socklen_t fromlen; -#ifdef SVC_RUN_DEBUG - char *uaddr; -#endif - - buffer = malloc(RPC_BUF_MAX); - if (buffer == NULL) - goto done; - - do { - fromlen = sizeof ss; - inlen = recvfrom(fd, buffer, RPC_BUF_MAX, 0, - (struct sockaddr *)&ss, &fromlen); - } while (inlen < 0 && errno == EINTR); - if (inlen < 0) { - if (debugging) - fprintf(stderr, - "handle_reply: recvfrom returned %d, errno %d\n", inlen, errno); - goto done; - } - - reply_msg.acpted_rply.ar_verf = _null_auth; - reply_msg.acpted_rply.ar_results.where = 0; - reply_msg.acpted_rply.ar_results.proc = (xdrproc_t) xdr_void; - - xdrmem_create(&reply_xdrs, buffer, (u_int)inlen, XDR_DECODE); - if (!xdr_replymsg(&reply_xdrs, &reply_msg)) { - if (debugging) - (void) fprintf(stderr, - "handle_reply: xdr_replymsg failed\n"); - goto done; - } - fi = forward_find(reply_msg.rm_xid); -#ifdef SVC_RUN_DEBUG - if (debugging) { - fprintf(stderr, "handle_reply: reply xid: %d fi addr: %p\n", - reply_msg.rm_xid, fi); - } -#endif - if (fi == NULL) { - goto done; - } - _seterr_reply(&reply_msg, &reply_error); - if (reply_error.re_status != RPC_SUCCESS) { - if (debugging) - (void) fprintf(stderr, "handle_reply: %s\n", - clnt_sperrno(reply_error.re_status)); - send_svcsyserr(xprt, fi); - goto done; - } - pos = XDR_GETPOS(&reply_xdrs); - len = inlen - pos; - a.rmt_args.args = &buffer[pos]; - a.rmt_args.arglen = len; - a.rmt_uaddr = fi->uaddr; - a.rmt_localvers = fi->versnum; - - xprt_set_caller(xprt, fi); -#ifdef SVC_RUN_DEBUG - uaddr = taddr2uaddr(rpcbind_get_conf("udp"), - svc_getrpccaller(xprt)); - if (debugging) { - fprintf(stderr, "handle_reply: forwarding address %s to %s\n", - a.rmt_uaddr, uaddr ? uaddr : rpcbind_unknown); - } - if (uaddr) - free((void *) uaddr); -#endif - svc_sendreply(xprt, (xdrproc_t) xdr_rmtcall_result, (char *) &a); -done: - if (buffer) - free(buffer); - - if (reply_msg.rm_xid == 0) { -#ifdef SVC_RUN_DEBUG - if (debugging) { - fprintf(stderr, "handle_reply: NULL xid on exit!\n"); - } -#endif - } else - (void) free_slot_by_xid(reply_msg.rm_xid); - return; -} - -static void -find_versions(rpcprog_t prog, char *netid, rpcvers_t *lowvp, rpcvers_t *highvp) -{ - register rpcblist_ptr rbl; - int lowv = 0; - int highv = 0; - - for (rbl = list_rbl; rbl != NULL; rbl = rbl->rpcb_next) { - if ((rbl->rpcb_map.r_prog != prog) || - ((rbl->rpcb_map.r_netid != NULL) && - (strcasecmp(rbl->rpcb_map.r_netid, netid) != 0))) - continue; - if (lowv == 0) { - highv = rbl->rpcb_map.r_vers; - lowv = highv; - } else if (rbl->rpcb_map.r_vers < lowv) { - lowv = rbl->rpcb_map.r_vers; - } else if (rbl->rpcb_map.r_vers > highv) { - highv = rbl->rpcb_map.r_vers; - } - } - *lowvp = lowv; - *highvp = highv; - return; -} - -/* - * returns the item with the given program, version number and netid. - * If that version number is not found, it returns the item with that - * program number, so that address is now returned to the caller. The - * caller when makes a call to this program, version number, the call - * will fail and it will return with PROGVERS_MISMATCH. The user can - * then determine the highest and the lowest version number for this - * program using clnt_geterr() and use those program version numbers. - * - * Returns the RPCBLIST for the given prog, vers and netid - */ -static rpcblist_ptr -find_service(rpcprog_t prog, rpcvers_t vers, char *netid) -{ - register rpcblist_ptr hit = NULL; - register rpcblist_ptr rbl; - - for (rbl = list_rbl; rbl != NULL; rbl = rbl->rpcb_next) { - if ((rbl->rpcb_map.r_prog != prog) || - ((rbl->rpcb_map.r_netid != NULL) && - (strcasecmp(rbl->rpcb_map.r_netid, netid) != 0))) - continue; - hit = rbl; - if (rbl->rpcb_map.r_vers == vers) - break; - } - return (hit); -} - -/* - * Copies the name associated with the uid of the caller and returns - * a pointer to it. Similar to getwd(). - */ -static char * -getowner(SVCXPRT *transp, char *owner, size_t ownersize) -{ - struct sockcred *sc; - - sc = __svc_getcallercreds(transp); - if (sc == NULL) - strlcpy(owner, rpcbind_unknown, ownersize); - else if (sc->sc_uid == 0) - strlcpy(owner, rpcbind_superuser, ownersize); - else - snprintf(owner, ownersize, "%d", sc->sc_uid); - - return owner; -} - -#ifdef PORTMAP -/* - * Add this to the pmap list only if it is UDP or TCP. - */ -static int -add_pmaplist(RPCB *arg) -{ - struct pmap pmap; - struct pmaplist *pml; - int h1, h2, h3, h4, p1, p2; - - if (strcmp(arg->r_netid, udptrans) == 0) { - /* It is UDP! */ - pmap.pm_prot = IPPROTO_UDP; - } else if (strcmp(arg->r_netid, tcptrans) == 0) { - /* It is TCP */ - pmap.pm_prot = IPPROTO_TCP; - } else - /* Not a IP protocol */ - return (0); - - /* interpret the universal address for TCP/IP */ - if (sscanf(arg->r_addr, "%d.%d.%d.%d.%d.%d", - &h1, &h2, &h3, &h4, &p1, &p2) != 6) - return (0); - pmap.pm_port = ((p1 & 0xff) << 8) + (p2 & 0xff); - pmap.pm_prog = arg->r_prog; - pmap.pm_vers = arg->r_vers; - /* - * add to END of list - */ - pml = (struct pmaplist *) malloc((u_int)sizeof (struct pmaplist)); - if (pml == NULL) { - (void) syslog(LOG_ERR, "rpcbind: no memory!\n"); - return (1); - } - pml->pml_map = pmap; - pml->pml_next = NULL; - if (list_pml == NULL) { - list_pml = pml; - } else { - struct pmaplist *fnd; - - /* Attach to the end of the list */ - for (fnd = list_pml; fnd->pml_next; fnd = fnd->pml_next) - ; - fnd->pml_next = pml; - } - return (0); -} - -/* - * Delete this from the pmap list only if it is UDP or TCP. - */ -static int -del_pmaplist(RPCB *arg) -{ - struct pmaplist *pml; - struct pmaplist *prevpml, *fnd; - long prot; - - if (strcmp(arg->r_netid, udptrans) == 0) { - /* It is UDP! */ - prot = IPPROTO_UDP; - } else if (strcmp(arg->r_netid, tcptrans) == 0) { - /* It is TCP */ - prot = IPPROTO_TCP; - } else if (arg->r_netid[0] == 0) { - prot = 0; /* Remove all occurrences */ - } else { - /* Not a IP protocol */ - return (0); - } - for (prevpml = NULL, pml = list_pml; pml; /* cstyle */) { - if ((pml->pml_map.pm_prog != arg->r_prog) || - (pml->pml_map.pm_vers != arg->r_vers) || - (prot && (pml->pml_map.pm_prot != prot))) { - /* both pml & prevpml move forwards */ - prevpml = pml; - pml = pml->pml_next; - continue; - } - /* found it; pml moves forward, prevpml stays */ - fnd = pml; - pml = pml->pml_next; - if (prevpml == NULL) - list_pml = pml; - else - prevpml->pml_next = pml; - free((void *) fnd); - } - return (0); -} -#endif /* PORTMAP */ diff --git a/contrib/netbsd-tests/fs/nfs/nfsservice/rpcbind/rpcbind.8 b/contrib/netbsd-tests/fs/nfs/nfsservice/rpcbind/rpcbind.8 deleted file mode 100644 index c77f1d5e8631..000000000000 --- a/contrib/netbsd-tests/fs/nfs/nfsservice/rpcbind/rpcbind.8 +++ /dev/null @@ -1,127 +0,0 @@ -.\" $NetBSD: rpcbind.8,v 1.1 2010/07/26 15:53:00 pooka Exp $ -.\" @(#)rpcbind.1m 1.19 92/09/14 SMI; from SVr4 -.\" Copyright 1989 AT&T -.\" Copyright 1991 Sun Microsystems, Inc. -.Dd October 19, 2008 -.Dt RPCBIND 8 -.Sh NAME -.Nm rpcbind -.Nd universal addresses to RPC program number mapper -.Sh SYNOPSIS -.Nm -.Op Fl dilLs -.Sh DESCRIPTION -.Nm -is a server that converts -.Tn RPC -program numbers into -universal addresses. -It must be running on the host to be able to make -.Tn RPC -calls -on a server on that machine. -.Pp -When an -.Tn RPC -service is started, -it tells -.Nm -the address at which it is listening, -and the -.Tn RPC -program numbers it is prepared to serve. -When a client wishes to make an -.Tn RPC -call to a given program number, -it first contacts -.Nm -on the server machine to determine -the address where -.Tn RPC -requests should be sent. -.Pp -.Nm -should be started before any other RPC service. -Normally, standard -.Tn RPC -servers are started by port monitors, so -.Nm -must be started before port monitors are invoked. -.Pp -When -.Nm -is started, it checks that certain name-to-address -translation-calls function correctly. -If they fail, the network configuration databases may be corrupt. -Since -.Tn RPC -services cannot function correctly in this situation, -.Nm -reports the condition and terminates. -.Pp -.Nm -can only be started by the super-user. -.Pp -Access control is provided by -.Pa /etc/hosts.allow -and -.Pa /etc/hosts.deny , -as described in -.Xr hosts_access 5 -with daemon name -.Nm . -.Sh OPTIONS -.Bl -tag -width Ds -.It Fl d -Run in debug mode. -In this mode, -.Nm -will not fork when it starts, will print additional information -during operation, and will abort on certain errors. -With this option, the name-to-address translation consistency -checks are shown in detail. -.It Fl i -.Dq insecure -mode. -Allows calls to SET and UNSET from any host. -Normally -.Nm -accepts these requests only from the loopback interface for security reasons. -This change is necessary for programs that were compiled with earlier -versions of the rpc library and do not make those requests using the -loopback interface. -.It Fl l -Turns on libwrap connection logging. -.It Fl s -Causes -.Nm -to change to the user daemon as soon as possible. -This causes -.Nm -to use non-privileged ports for outgoing connections, preventing non-privileged -clients from using -.Nm -to connect to services from a privileged port. -.It Fl L -Allow old-style local connections over the loopback interface. -Without this flag, local connections are only allowed over a local socket, -.Pa /var/run/rpcbind.sock -.El -.Sh NOTES -All RPC servers must be restarted if -.Nm -is restarted. -.Sh FILES -.Bl -tag -width "/var/run/rpcbind.sock" -compact -.It Pa /var/run/rpcbind.sock -.It Pa /etc/hosts.allow -explicit remote host access list. -.It Pa /etc/hosts.deny -explicit remote host denial of service list. -.El -.Sh SEE ALSO -.Xr rpcbind 3 , -.Xr hosts_access 5 , -.Xr hosts_options 5 , -.Xr netconfig 5 , -.Xr rpcinfo 8 diff --git a/contrib/netbsd-tests/fs/nfs/nfsservice/rpcbind/rpcbind.c b/contrib/netbsd-tests/fs/nfs/nfsservice/rpcbind/rpcbind.c deleted file mode 100644 index 492b0b676a85..000000000000 --- a/contrib/netbsd-tests/fs/nfs/nfsservice/rpcbind/rpcbind.c +++ /dev/null @@ -1,613 +0,0 @@ -/* $NetBSD: rpcbind.c,v 1.4 2013/10/19 17:45:00 christos Exp $ */ - -/* - * Sun RPC is a product of Sun Microsystems, Inc. and is provided for - * unrestricted use provided that this legend is included on all tape - * media and as a part of the software program in whole or part. Users - * may copy or modify Sun RPC without charge, but are not authorized - * to license or distribute it to anyone else except as part of a product or - * program developed by the user. - * - * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE - * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR - * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. - * - * Sun RPC is provided with no support and without any obligation on the - * part of Sun Microsystems, Inc. to assist in its use, correction, - * modification or enhancement. - * - * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE - * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC - * OR ANY PART THEREOF. - * - * In no event will Sun Microsystems, Inc. be liable for any lost revenue - * or profits or other special, indirect and consequential damages, even if - * Sun has been advised of the possibility of such damages. - * - * Sun Microsystems, Inc. - * 2550 Garcia Avenue - * Mountain View, California 94043 - */ -/* - * Copyright (c) 1984 - 1991 by Sun Microsystems, Inc. - */ - -/* #ident "@(#)rpcbind.c 1.19 94/04/25 SMI" */ - -#if 0 -#ifndef lint -static char sccsid[] = "@(#)rpcbind.c 1.35 89/04/21 Copyr 1984 Sun Micro"; -#endif -#endif - -/* - * rpcbind.c - * Implements the program, version to address mapping for rpc. - * - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#ifdef PORTMAP -#include -#endif -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "rpcbind.h" - -#include -#include - -/* Global variables */ -int debugging = 1; /* Tell me what's going on */ -int doabort = 0; /* When debugging, do an abort on errors */ -rpcblist_ptr list_rbl; /* A list of version 3/4 rpcbind services */ - -#include "svc_fdset.h" - -/* who to suid to if -s is given */ -#define RUN_AS "daemon" - -int runasdaemon = 0; -int insecure = 0; -int oldstyle_local = 0; -int verboselog = 0; - -#ifdef WARMSTART -/* Local Variable */ -static int warmstart = 0; /* Grab a old copy of registrations */ -#endif - -#ifdef PORTMAP -struct pmaplist *list_pml; /* A list of version 2 rpcbind services */ -const char *udptrans; /* Name of UDP transport */ -const char *tcptrans; /* Name of TCP transport */ -const char *udp_uaddr; /* Universal UDP address */ -const char *tcp_uaddr; /* Universal TCP address */ -#endif -static const char servname[] = "sunrpc"; - -const char rpcbind_superuser[] = "superuser"; -const char rpcbind_unknown[] = "unknown"; - -static int init_transport(struct netconfig *); -static void rbllist_add(rpcprog_t, rpcvers_t, struct netconfig *, - struct netbuf *); -static void terminate(int); -#if 0 -static void parseargs(int, char *[]); -#endif - -int rpcbind_main(void *); -int -rpcbind_main(void *arg) -{ - struct netconfig *nconf; - void *nc_handle; /* Net config handle */ - struct rlimit rl; - int maxrec = RPC_MAXDATASIZE; - extern sem_t gensem; - -#if 0 - parseargs(argc, argv); -#endif - - alloc_fdset(); - - getrlimit(RLIMIT_NOFILE, &rl); - if (rl.rlim_cur < 128) { - if (rl.rlim_max <= 128) - rl.rlim_cur = rl.rlim_max; - else - rl.rlim_cur = 128; - setrlimit(RLIMIT_NOFILE, &rl); - } -#if 0 - if (geteuid()) /* This command allowed only to root */ - errx(1, "Sorry. You are not superuser"); -#endif - nc_handle = setnetconfig(); /* open netconfig file */ - if (nc_handle == NULL) - errx(1, "could not read /etc/netconfig"); -#ifdef PORTMAP - udptrans = ""; - tcptrans = ""; -#endif - - nconf = getnetconfigent("local"); - if (nconf == NULL) - errx(1, "can't find local transport"); - - rpc_control(RPC_SVC_CONNMAXREC_SET, &maxrec); - - init_transport(nconf); - - while ((nconf = getnetconfig(nc_handle))) { - if (nconf->nc_flag & NC_VISIBLE) - init_transport(nconf); - } - endnetconfig(nc_handle); - - /* catch the usual termination signals for graceful exit */ - (void) signal(SIGCHLD, reap); - (void) signal(SIGINT, terminate); - (void) signal(SIGTERM, terminate); - (void) signal(SIGQUIT, terminate); - /* ignore others that could get sent */ - (void) signal(SIGPIPE, SIG_IGN); - //(void) signal(SIGHUP, SIG_IGN); used by mountd - (void) signal(SIGUSR1, SIG_IGN); - (void) signal(SIGUSR2, SIG_IGN); -#ifdef WARMSTART - if (warmstart) { - read_warmstart(); - } -#endif - if (debugging) { - printf("rpcbind debugging enabled."); - if (doabort) { - printf(" Will abort on errors!\n"); - } else { - printf("\n"); - } - } else { - if (daemon(0, 0)) - err(1, "fork failed"); - } - - openlog("rpcbind", 0, LOG_DAEMON); - pidfile(NULL); - - if (runasdaemon) { - struct passwd *p; - - if((p = getpwnam(RUN_AS)) == NULL) { - syslog(LOG_ERR, "cannot get uid of daemon: %m"); - exit(1); - } - if (setuid(p->pw_uid) == -1) { - syslog(LOG_ERR, "setuid to daemon failed: %m"); - exit(1); - } - } - - network_init(); - - sem_post(&gensem); - my_svc_run(); - syslog(LOG_ERR, "svc_run returned unexpectedly"); - rpcbind_abort(); - /* NOTREACHED */ - - return 0; -} - -/* - * Adds the entry into the rpcbind database. - * If PORTMAP, then for UDP and TCP, it adds the entries for version 2 also - * Returns 0 if succeeds, else fails - */ -static int -init_transport(struct netconfig *nconf) -{ - int fd; - struct t_bind taddr; - struct addrinfo hints, *res = NULL; - struct __rpc_sockinfo si; - SVCXPRT *my_xprt; - int aicode, status, addrlen; - struct sockaddr *sa; - struct sockaddr_un sun; - const int one = 1; - - if ((nconf->nc_semantics != NC_TPI_CLTS) && - (nconf->nc_semantics != NC_TPI_COTS) && - (nconf->nc_semantics != NC_TPI_COTS_ORD)) - return 1; /* not my type */ -#ifdef RPCBIND_DEBUG - if (debugging) { - int i; - char **s; - - (void)fprintf(stderr, "%s: %ld lookup routines :\n", - nconf->nc_netid, nconf->nc_nlookups); - for (i = 0, s = nconf->nc_lookups; i < nconf->nc_nlookups; - i++, s++) - (void)fprintf(stderr, "[%d] - %s\n", i, *s); - } -#endif - - /* - * XXX - using RPC library internal functions. - */ - if ((fd = __rpc_nconf2fd(nconf)) < 0) { - if (errno == EAFNOSUPPORT) - return 1; - warn("Cannot create socket for `%s'", nconf->nc_netid); - return 1; - } - - if (!__rpc_nconf2sockinfo(nconf, &si)) { - warnx("Cannot get information for `%s'", nconf->nc_netid); - return 1; - } - - if (si.si_af == AF_INET6) { - /* - * We're doing host-based access checks here, so don't allow - * v4-in-v6 to confuse things. - */ - if (setsockopt(fd, IPPROTO_IPV6, IPV6_V6ONLY, &one, - sizeof one) < 0) { - warn("Can't make socket ipv6 only"); - return 1; - } - } - - - if (!strcmp(nconf->nc_netid, "local")) { - (void)memset(&sun, 0, sizeof sun); - sun.sun_family = AF_LOCAL; - (void)rump_sys_unlink(_PATH_RPCBINDSOCK); - (void)strlcpy(sun.sun_path, _PATH_RPCBINDSOCK, - sizeof(sun.sun_path)); - sun.sun_len = SUN_LEN(&sun); - addrlen = sizeof(struct sockaddr_un); - sa = (struct sockaddr *)&sun; - } else { - /* Get rpcbind's address on this transport */ - - (void)memset(&hints, 0, sizeof hints); - hints.ai_flags = AI_PASSIVE; - hints.ai_family = si.si_af; - hints.ai_socktype = si.si_socktype; - hints.ai_protocol = si.si_proto; - if ((aicode = getaddrinfo(NULL, servname, &hints, &res)) != 0) { - warnx("Cannot get local address for `%s' (%s)", - nconf->nc_netid, gai_strerror(aicode)); - return 1; - } - addrlen = res->ai_addrlen; - sa = (struct sockaddr *)res->ai_addr; - } - - if (bind(fd, sa, addrlen) < 0) { - warn("Cannot bind `%s'", nconf->nc_netid); - if (res != NULL) - freeaddrinfo(res); - return 1; - } -#if 0 - if (sa->sa_family == AF_LOCAL) - if (rump_sys_chmod(sun.sun_path, S_IRWXU|S_IRWXG|S_IRWXO) == -1) - warn("Cannot chmod `%s'", sun.sun_path); -#endif - - /* Copy the address */ - taddr.addr.len = taddr.addr.maxlen = addrlen; - taddr.addr.buf = malloc(addrlen); - if (taddr.addr.buf == NULL) { - warn("Cannot allocate memory for `%s' address", - nconf->nc_netid); - if (res != NULL) - freeaddrinfo(res); - return 1; - } - (void)memcpy(taddr.addr.buf, sa, addrlen); -#ifdef RPCBIND_DEBUG - if (debugging) { - /* for debugging print out our universal address */ - char *uaddr; - struct netbuf nb; - - nb.buf = sa; - nb.len = nb.maxlen = sa->sa_len; - uaddr = taddr2uaddr(nconf, &nb); - (void)fprintf(stderr, "rpcbind: my address is %s\n", uaddr); - (void)free(uaddr); - } -#endif - - if (res != NULL) - freeaddrinfo(res); - - if (nconf->nc_semantics != NC_TPI_CLTS) - listen(fd, SOMAXCONN); - - my_xprt = (SVCXPRT *)svc_tli_create(fd, nconf, &taddr, RPC_MAXDATASIZE, - RPC_MAXDATASIZE); - if (my_xprt == NULL) { - warnx("Could not create service for `%s'", nconf->nc_netid); - goto error; - } - -#ifdef PORTMAP - /* - * Register both the versions for tcp/ip, udp/ip and local. - */ - if ((strcmp(nconf->nc_protofmly, NC_INET) == 0 && - (strcmp(nconf->nc_proto, NC_TCP) == 0 || - strcmp(nconf->nc_proto, NC_UDP) == 0)) || - strcmp(nconf->nc_netid, "local") == 0) { - struct pmaplist *pml; - - if (!svc_register(my_xprt, PMAPPROG, PMAPVERS, - pmap_service, 0)) { - warn("Could not register on `%s'", nconf->nc_netid); - goto error; - } - pml = malloc(sizeof (struct pmaplist)); - if (pml == NULL) { - warn("Cannot allocate memory"); - goto error; - } - pml->pml_map.pm_prog = PMAPPROG; - pml->pml_map.pm_vers = PMAPVERS; - pml->pml_map.pm_port = PMAPPORT; - if (strcmp(nconf->nc_proto, NC_TCP) == 0) { - if (tcptrans[0]) { - warnx( - "Cannot have more than one TCP transport"); - free(pml); - goto error; - } - tcptrans = strdup(nconf->nc_netid); - if (tcptrans == NULL) { - free(pml); - warn("Cannot allocate memory"); - goto error; - } - pml->pml_map.pm_prot = IPPROTO_TCP; - - /* Let's snarf the universal address */ - /* "h1.h2.h3.h4.p1.p2" */ - tcp_uaddr = taddr2uaddr(nconf, &taddr.addr); - } else if (strcmp(nconf->nc_proto, NC_UDP) == 0) { - if (udptrans[0]) { - free(pml); - warnx( - "Cannot have more than one UDP transport"); - goto error; - } - udptrans = strdup(nconf->nc_netid); - if (udptrans == NULL) { - free(pml); - warn("Cannot allocate memory"); - goto error; - } - pml->pml_map.pm_prot = IPPROTO_UDP; - - /* Let's snarf the universal address */ - /* "h1.h2.h3.h4.p1.p2" */ - udp_uaddr = taddr2uaddr(nconf, &taddr.addr); - } - pml->pml_next = list_pml; - list_pml = pml; - - /* Add version 3 information */ - pml = malloc(sizeof (struct pmaplist)); - if (pml == NULL) { - warn("Cannot allocate memory"); - goto error; - } - pml->pml_map = list_pml->pml_map; - pml->pml_map.pm_vers = RPCBVERS; - pml->pml_next = list_pml; - list_pml = pml; - - /* Add version 4 information */ - pml = malloc(sizeof (struct pmaplist)); - if (pml == NULL) { - warn("Cannot allocate memory"); - goto error; - } - pml->pml_map = list_pml->pml_map; - pml->pml_map.pm_vers = RPCBVERS4; - pml->pml_next = list_pml; - list_pml = pml; - - /* Also add version 2 stuff to rpcbind list */ - rbllist_add(PMAPPROG, PMAPVERS, nconf, &taddr.addr); - } -#endif - - /* version 3 registration */ - if (!svc_reg(my_xprt, RPCBPROG, RPCBVERS, rpcb_service_3, NULL)) { - warn("Could not register %s version 3", nconf->nc_netid); - goto error; - } - rbllist_add(RPCBPROG, RPCBVERS, nconf, &taddr.addr); - - /* version 4 registration */ - if (!svc_reg(my_xprt, RPCBPROG, RPCBVERS4, rpcb_service_4, NULL)) { - warn("Could not register %s version 4", nconf->nc_netid); - goto error; - } - rbllist_add(RPCBPROG, RPCBVERS4, nconf, &taddr.addr); - - /* decide if bound checking works for this transport */ - status = add_bndlist(nconf, &taddr.addr); -#ifdef RPCBIND_DEBUG - if (debugging) { - if (status < 0) { - fprintf(stderr, "Error in finding bind status for %s\n", - nconf->nc_netid); - } else if (status == 0) { - fprintf(stderr, "check binding for %s\n", - nconf->nc_netid); - } else if (status > 0) { - fprintf(stderr, "No check binding for %s\n", - nconf->nc_netid); - } - } -#else - __USE(status); -#endif - /* - * rmtcall only supported on CLTS transports for now. - */ - if (nconf->nc_semantics == NC_TPI_CLTS) { - status = create_rmtcall_fd(nconf); - -#ifdef RPCBIND_DEBUG - if (debugging) { - if (status < 0) { - fprintf(stderr, - "Could not create rmtcall fd for %s\n", - nconf->nc_netid); - } else { - fprintf(stderr, "rmtcall fd for %s is %d\n", - nconf->nc_netid, status); - } - } -#endif - } - return (0); -error: - (void)rump_sys_close(fd); - return (1); -} - -static void -rbllist_add(rpcprog_t prog, rpcvers_t vers, struct netconfig *nconf, - struct netbuf *addr) -{ - rpcblist_ptr rbl; - - rbl = malloc(sizeof(rpcblist)); - if (rbl == NULL) { - warn("Out of memory"); - return; - } - - rbl->rpcb_map.r_prog = prog; - rbl->rpcb_map.r_vers = vers; - rbl->rpcb_map.r_netid = strdup(nconf->nc_netid); - rbl->rpcb_map.r_addr = taddr2uaddr(nconf, addr); - rbl->rpcb_map.r_owner = strdup(rpcbind_superuser); - rbl->rpcb_next = list_rbl; /* Attach to global list */ - list_rbl = rbl; -} - -/* - * Catch the signal and die - */ -static void -terminate(int dummy) -{ -#ifdef WARMSTART - syslog(LOG_ERR, - "rpcbind terminating on signal. Restart with \"rpcbind -w\""); - write_warmstart(); /* Dump yourself */ -#endif - exit(2); -} - -void -rpcbind_abort() -{ -#ifdef WARMSTART - write_warmstart(); /* Dump yourself */ -#endif - abort(); -} - -#if 0 -/* get command line options */ -static void -parseargs(int argc, char *argv[]) -{ - int c; - - while ((c = getopt(argc, argv, "dwailLs")) != -1) { - switch (c) { - case 'a': - doabort = 1; /* when debugging, do an abort on */ - break; /* errors; for rpcbind developers */ - /* only! */ - case 'd': - debugging = 1; - break; - case 'i': - insecure = 1; - break; - case 'L': - oldstyle_local = 1; - break; - case 'l': - verboselog = 1; - break; - case 's': - runasdaemon = 1; - break; -#ifdef WARMSTART - case 'w': - warmstart = 1; - break; -#endif - default: /* error */ - fprintf(stderr, "usage: rpcbind [-Idwils]\n"); - exit (1); - } - } - if (doabort && !debugging) { - fprintf(stderr, - "-a (abort) specified without -d (debugging) -- ignored.\n"); - doabort = 0; - } -} -#endif - -void -reap(int dummy) -{ - int save_errno = errno; - - while (wait3(NULL, WNOHANG, NULL) > 0) - ; - errno = save_errno; -} - -void -toggle_verboselog(int dummy) -{ - verboselog = !verboselog; -} diff --git a/contrib/netbsd-tests/fs/nfs/nfsservice/rpcbind/rpcbind.h b/contrib/netbsd-tests/fs/nfs/nfsservice/rpcbind/rpcbind.h deleted file mode 100644 index 1717e31643b1..000000000000 --- a/contrib/netbsd-tests/fs/nfs/nfsservice/rpcbind/rpcbind.h +++ /dev/null @@ -1,146 +0,0 @@ -/* $NetBSD: rpcbind.h,v 1.1 2010/07/26 15:53:00 pooka Exp $ */ - -/* - * Sun RPC is a product of Sun Microsystems, Inc. and is provided for - * unrestricted use provided that this legend is included on all tape - * media and as a part of the software program in whole or part. Users - * may copy or modify Sun RPC without charge, but are not authorized - * to license or distribute it to anyone else except as part of a product or - * program developed by the user. - * - * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE - * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR - * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. - * - * Sun RPC is provided with no support and without any obligation on the - * part of Sun Microsystems, Inc. to assist in its use, correction, - * modification or enhancement. - * - * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE - * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC - * OR ANY PART THEREOF. - * - * In no event will Sun Microsystems, Inc. be liable for any lost revenue - * or profits or other special, indirect and consequential damages, even if - * Sun has been advised of the possibility of such damages. - * - * Sun Microsystems, Inc. - * 2550 Garcia Avenue - * Mountain View, California 94043 - */ -/* - * Copyright (c) 1986 - 1991 by Sun Microsystems, Inc. - */ - -/* #ident "@(#)rpcbind.h 1.4 90/04/12 SMI" */ - -/* - * rpcbind.h - * The common header declarations - */ - -#ifndef rpcbind_h -#define rpcbind_h - -#ifdef PORTMAP -#include -#endif -#include - -/* - * Stuff for the rmtcall service - */ -struct encap_parms { - u_int32_t arglen; - char *args; -}; - -struct r_rmtcall_args { - u_int32_t rmt_prog; - u_int32_t rmt_vers; - u_int32_t rmt_proc; - int rmt_localvers; /* whether to send port # or uaddr */ - char *rmt_uaddr; - struct encap_parms rmt_args; -}; - -extern int debugging; -extern int doabort; -extern int verboselog; -extern int insecure; -extern int oldstyle_local; -extern rpcblist_ptr list_rbl; /* A list of version 3 & 4 rpcbind services */ - -#ifdef PORTMAP -extern struct pmaplist *list_pml; /* A list of version 2 rpcbind services */ -extern const char *udptrans; /* Name of UDP transport */ -extern const char *tcptrans; /* Name of TCP transport */ -extern const char *udp_uaddr; /* Universal UDP address */ -extern const char *tcp_uaddr; /* Universal TCP address */ -#endif - -extern const char rpcbind_superuser[]; -extern const char rpcbind_unknown[]; - -int add_bndlist(struct netconfig *, struct netbuf *); -bool_t is_bound(const char *, const char *); -char *mergeaddr(SVCXPRT *, char *, char *, char *); -struct netconfig *rpcbind_get_conf(const char *); - -void rpcbs_init(void); -void rpcbs_procinfo(rpcvers_t, rpcproc_t); -void rpcbs_set(rpcvers_t, bool_t); -void rpcbs_unset(rpcvers_t, bool_t); -void rpcbs_getaddr(rpcvers_t, rpcprog_t, rpcvers_t, const char *, const char *); -void rpcbs_rmtcall(rpcvers_t, rpcproc_t, rpcprog_t, rpcvers_t, rpcproc_t, - char *, rpcblist_ptr); -void *rpcbproc_getstat(void *, struct svc_req *, SVCXPRT *, rpcvers_t); - -void rpcb_service_3(struct svc_req *, SVCXPRT *); -void rpcb_service_4(struct svc_req *, SVCXPRT *); - -/* Common functions shared between versions */ -void *rpcbproc_set_com(void *, struct svc_req *, SVCXPRT *, rpcvers_t); -void *rpcbproc_unset_com(void *, struct svc_req *, SVCXPRT *, rpcvers_t); -bool_t map_set(RPCB *, char *); -bool_t map_unset(RPCB *, const char *); -void delete_prog(int); -void *rpcbproc_getaddr_com(RPCB *, struct svc_req *, SVCXPRT *, rpcvers_t, - rpcvers_t); -void *rpcbproc_gettime_com(void *, struct svc_req *, SVCXPRT *, - rpcvers_t); -void *rpcbproc_uaddr2taddr_com(void *, struct svc_req *, - SVCXPRT *, rpcvers_t); -void *rpcbproc_taddr2uaddr_com(void *, struct svc_req *, SVCXPRT *, - rpcvers_t); -int create_rmtcall_fd(struct netconfig *); -void rpcbproc_callit_com(struct svc_req *, SVCXPRT *, rpcvers_t, - rpcvers_t); -void my_svc_run(void); - -void rpcbind_abort(void); -void reap(int); -void toggle_verboselog(int); - -int check_access(SVCXPRT *, rpcproc_t, void *, int); -int check_callit(SVCXPRT *, struct r_rmtcall_args *, int); -void logit(int, struct sockaddr *, rpcproc_t, rpcprog_t, const char *); -int is_loopback(struct netbuf *); - -#ifdef PORTMAP -extern void pmap_service(struct svc_req *, SVCXPRT *); -#endif - -void write_warmstart(void); -void read_warmstart(void); - -char *addrmerge(struct netbuf *caller, char *serv_uaddr, char *clnt_uaddr, - char *netid); -void network_init(void); -struct sockaddr *local_sa(int); - -/* For different getaddr semantics */ -#define RPCB_ALLVERS 0 -#define RPCB_ONEVERS 1 - -#endif /* rpcbind_h */ diff --git a/contrib/netbsd-tests/fs/nfs/nfsservice/rpcbind/security.c b/contrib/netbsd-tests/fs/nfs/nfsservice/rpcbind/security.c deleted file mode 100644 index 755c0d3ffe30..000000000000 --- a/contrib/netbsd-tests/fs/nfs/nfsservice/rpcbind/security.c +++ /dev/null @@ -1,282 +0,0 @@ -/* $NetBSD: security.c,v 1.1 2010/07/26 15:53:01 pooka Exp $ */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -/* - * XXX for special case checks in check_callit. - */ -#include -#include -#include -#include -#include -#include - -#include "rpcbind.h" - -#ifdef LIBWRAP -# include -#ifndef LIBWRAP_ALLOW_FACILITY -# define LIBWRAP_ALLOW_FACILITY LOG_AUTH -#endif -#ifndef LIBWRAP_ALLOW_SEVERITY -# define LIBWRAP_ALLOW_SEVERITY LOG_INFO -#endif -#ifndef LIBWRAP_DENY_FACILITY -# define LIBWRAP_DENY_FACILITY LOG_AUTH -#endif -#ifndef LIBWRAP_DENY_SEVERITY -# define LIBWRAP_DENY_SEVERITY LOG_WARNING -#endif -int allow_severity = LIBWRAP_ALLOW_FACILITY|LIBWRAP_ALLOW_SEVERITY; -int deny_severity = LIBWRAP_DENY_FACILITY|LIBWRAP_DENY_SEVERITY; -#endif - -#ifndef PORTMAP_LOG_FACILITY -# define PORTMAP_LOG_FACILITY LOG_AUTH -#endif -#ifndef PORTMAP_LOG_SEVERITY -# define PORTMAP_LOG_SEVERITY LOG_INFO -#endif -int log_severity = PORTMAP_LOG_FACILITY|PORTMAP_LOG_SEVERITY; - -extern int verboselog; - -int -check_access(SVCXPRT *xprt, rpcproc_t proc, void *args, int rpcbvers) -{ - struct netbuf *caller = svc_getrpccaller(xprt); - struct sockaddr *addr = (struct sockaddr *)caller->buf; -#ifdef LIBWRAP - struct request_info req; -#endif - rpcprog_t prog = 0; - rpcb *rpcbp; - struct pmap *pmap; - - /* - * The older PMAP_* equivalents have the same numbers, so - * they are accounted for here as well. - */ - switch (proc) { - case RPCBPROC_GETADDR: - case RPCBPROC_SET: - case RPCBPROC_UNSET: - if (rpcbvers > PMAPVERS) { - rpcbp = (rpcb *)args; - prog = rpcbp->r_prog; - } else { - pmap = (struct pmap *)args; - prog = pmap->pm_prog; - } - if (proc == RPCBPROC_GETADDR) - break; - if (!insecure && !is_loopback(caller)) { - if (verboselog) - logit(log_severity, addr, proc, prog, - " declined (non-loopback sender)"); - return 0; - } - break; - case RPCBPROC_CALLIT: - case RPCBPROC_INDIRECT: - case RPCBPROC_DUMP: - case RPCBPROC_GETTIME: - case RPCBPROC_UADDR2TADDR: - case RPCBPROC_TADDR2UADDR: - case RPCBPROC_GETVERSADDR: - case RPCBPROC_GETADDRLIST: - case RPCBPROC_GETSTAT: - default: - break; - } - -#ifdef LIBWRAP - if (addr->sa_family == AF_LOCAL) - return 1; - request_init(&req, RQ_DAEMON, "rpcbind", RQ_CLIENT_SIN, addr, 0); - sock_methods(&req); - if(!hosts_access(&req)) { - logit(deny_severity, addr, proc, prog, ": request from unauthorized host"); - return 0; - } -#endif - if (verboselog) - logit(log_severity, addr, proc, prog, ""); - return 1; -} - -int -is_loopback(struct netbuf *nbuf) -{ - struct sockaddr *addr = (struct sockaddr *)nbuf->buf; - struct sockaddr_in *sin; -#ifdef INET6 - struct sockaddr_in6 *sin6; -#endif - - switch (addr->sa_family) { - case AF_INET: - if (!oldstyle_local) - return 0; - sin = (struct sockaddr_in *)addr; - return ((sin->sin_addr.s_addr == htonl(INADDR_LOOPBACK)) && - (ntohs(sin->sin_port) < IPPORT_RESERVED)); -#ifdef INET6 - case AF_INET6: - if (!oldstyle_local) - return 0; - sin6 = (struct sockaddr_in6 *)addr; - return (IN6_IS_ADDR_LOOPBACK(&sin6->sin6_addr) && - (ntohs(sin6->sin6_port) < IPV6PORT_RESERVED)); -#endif - case AF_LOCAL: - return 1; - default: - break; - } - - return 0; -} - - -/* logit - report events of interest via the syslog daemon */ -void -logit(int severity, struct sockaddr *addr, rpcproc_t procnum, rpcprog_t prognum, - const char *text) -{ - const char *procname; - char procbuf[32]; - char *progname; - char progbuf[32]; - char fromname[NI_MAXHOST]; - struct rpcent *rpc; - static const char *procmap[] = { - /* RPCBPROC_NULL */ "null", - /* RPCBPROC_SET */ "set", - /* RPCBPROC_UNSET */ "unset", - /* RPCBPROC_GETADDR */ "getport/addr", - /* RPCBPROC_DUMP */ "dump", - /* RPCBPROC_CALLIT */ "callit", - /* RPCBPROC_GETTIME */ "gettime", - /* RPCBPROC_UADDR2TADDR */ "uaddr2taddr", - /* RPCBPROC_TADDR2UADDR */ "taddr2uaddr", - /* RPCBPROC_GETVERSADDR */ "getversaddr", - /* RPCBPROC_INDIRECT */ "indirect", - /* RPCBPROC_GETADDRLIST */ "getaddrlist", - /* RPCBPROC_GETSTAT */ "getstat" - }; - - /* - * Fork off a process or the portmap daemon might hang while - * getrpcbynumber() or syslog() does its thing. - */ - - if (fork() == 0) { - setproctitle("logit"); - - /* Try to map program number to name. */ - - if (prognum == 0) { - progname = __UNCONST(""); - } else if ((rpc = getrpcbynumber((int) prognum))) { - progname = rpc->r_name; - } else { - snprintf(progname = progbuf, sizeof(progbuf), "%u", - (unsigned)prognum); - } - - /* Try to map procedure number to name. */ - - if (procnum >= (sizeof procmap / sizeof (char *))) { - snprintf(procbuf, sizeof procbuf, "%u", - (unsigned)procnum); - procname = procbuf; - } else - procname = procmap[procnum]; - - /* Write syslog record. */ - - if (addr->sa_family == AF_LOCAL) - strlcpy(fromname, "local", sizeof(fromname)); - else - getnameinfo(addr, addr->sa_len, fromname, - sizeof fromname, NULL, 0, NI_NUMERICHOST); - - syslog(severity, "connect from %s to %s(%s)%s", - fromname, procname, progname, text); - _exit(0); - } -} - -int -check_callit(SVCXPRT *xprt, struct r_rmtcall_args *args, int versnum) -{ - struct sockaddr *sa = (struct sockaddr *)svc_getrpccaller(xprt)->buf; - - /* - * Always allow calling NULLPROC - */ - if (args->rmt_proc == 0) - return 1; - - /* - * XXX - this special casing sucks. - */ - switch (args->rmt_prog) { - case RPCBPROG: - /* - * Allow indirect calls to ourselves in insecure mode. - * The is_loopback checks aren't useful then anyway. - */ - if (!insecure) - goto deny; - break; - case MOUNTPROG: - if (args->rmt_proc != MOUNTPROC_MNT && - args->rmt_proc != MOUNTPROC_UMNT) - break; - goto deny; - case YPBINDPROG: - if (args->rmt_proc != YPBINDPROC_SETDOM) - break; - /* FALLTHROUGH */ - case YPPASSWDPROG: - case NFS_PROGRAM: - case RQUOTAPROG: - goto deny; - case YPPROG: - switch (args->rmt_proc) { - case YPPROC_ALL: - case YPPROC_MATCH: - case YPPROC_FIRST: - case YPPROC_NEXT: - goto deny; - default: - break; - } - default: - break; - } - - return 1; -deny: - logit(deny_severity, sa, args->rmt_proc, args->rmt_prog, - ": indirect call not allowed"); - - return 0; -} diff --git a/contrib/netbsd-tests/fs/nfs/nfsservice/rpcbind/util.c b/contrib/netbsd-tests/fs/nfs/nfsservice/rpcbind/util.c deleted file mode 100644 index f67e98d4d250..000000000000 --- a/contrib/netbsd-tests/fs/nfs/nfsservice/rpcbind/util.c +++ /dev/null @@ -1,401 +0,0 @@ -/* $NetBSD: util.c,v 1.2 2011/06/11 18:03:17 christos Exp $ */ - -/*- - * Copyright (c) 2000 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. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#include "rpcbind.h" - -static struct sockaddr_in *local_in4; -#ifdef INET6 -static struct sockaddr_in6 *local_in6; -#endif - -static int bitmaskcmp(void *, void *, void *, int); -#ifdef INET6 -static void in6_fillscopeid(struct sockaddr_in6 *); -#endif - -/* - * For all bits set in "mask", compare the corresponding bits in - * "dst" and "src", and see if they match. - */ -static int -bitmaskcmp(void *dst, void *src, void *mask, int bytelen) -{ - int i, j; - u_int8_t *p1 = dst, *p2 = src, *netmask = mask; - u_int8_t bitmask; - - for (i = 0; i < bytelen; i++) { - for (j = 0; j < 8; j++) { - bitmask = 1 << j; - if (!(netmask[i] & bitmask)) - continue; - if ((p1[i] & bitmask) != (p2[i] & bitmask)) - return 1; - } - } - - return 0; -} - -/* - * Taken from ifconfig.c - */ -#ifdef INET6 -static void -in6_fillscopeid(struct sockaddr_in6 *sin6) -{ - if (IN6_IS_ADDR_LINKLOCAL(&sin6->sin6_addr)) { - sin6->sin6_scope_id = - ntohs(*(u_int16_t *)&sin6->sin6_addr.s6_addr[2]); - sin6->sin6_addr.s6_addr[2] = sin6->sin6_addr.s6_addr[3] = 0; - } -} -#endif - -char * -addrmerge(struct netbuf *caller, char *serv_uaddr, char *clnt_uaddr, - char *netid) -{ - struct ifaddrs *ifap, *ifp, *bestif; -#ifdef INET6 - struct sockaddr_in6 *servsin6, *sin6mask, *clntsin6, *ifsin6, *realsin6; - struct sockaddr_in6 *newsin6; -#endif - struct sockaddr_in *servsin, *sinmask, *clntsin, *newsin, *ifsin; - struct netbuf *serv_nbp, *clnt_nbp = NULL, tbuf; - struct sockaddr *serv_sa; - struct sockaddr *clnt_sa; - struct sockaddr_storage ss; - struct netconfig *nconf; - struct sockaddr *clnt = caller->buf; - char *ret = NULL; - -#ifdef INET6 - servsin6 = ifsin6 = newsin6 = NULL; /* XXXGCC -Wuninitialized */ -#endif - servsin = newsin = NULL; /* XXXGCC -Wuninitialized */ - -#ifdef RPCBIND_DEBUG - if (debugging) - fprintf(stderr, "addrmerge(caller, %s, %s, %s\n", serv_uaddr, - clnt_uaddr, netid); -#endif - nconf = getnetconfigent(netid); - if (nconf == NULL) - return NULL; - - /* - * Local merge, just return a duplicate. - */ - if (clnt_uaddr != NULL && strncmp(clnt_uaddr, "0.0.0.0.", 8) == 0) - return strdup(clnt_uaddr); - - serv_nbp = uaddr2taddr(nconf, serv_uaddr); - if (serv_nbp == NULL) - return NULL; - - serv_sa = (struct sockaddr *)serv_nbp->buf; - if (clnt_uaddr != NULL) { - clnt_nbp = uaddr2taddr(nconf, clnt_uaddr); - if (clnt_nbp == NULL) { - free(serv_nbp); - return NULL; - } - clnt_sa = (struct sockaddr *)clnt_nbp->buf; - if (clnt_sa->sa_family == AF_LOCAL) { - free(serv_nbp); - free(clnt_nbp); - free(clnt_sa); - return strdup(serv_uaddr); - } - } else { - clnt_sa = (struct sockaddr *) - malloc(sizeof (struct sockaddr_storage)); - memcpy(clnt_sa, clnt, clnt->sa_len); - } - - if (getifaddrs(&ifp) < 0) { - free(serv_nbp); - free(clnt_sa); - if (clnt_nbp != NULL) - free(clnt_nbp); - return 0; - } - - /* - * Loop through all interfaces. For each interface, see if the - * network portion of its address is equal to that of the client. - * If so, we have found the interface that we want to use. - */ - for (ifap = ifp; ifap != NULL; ifap = ifap->ifa_next) { - if (ifap->ifa_addr->sa_family != clnt->sa_family || - !(ifap->ifa_flags & IFF_UP)) - continue; - - switch (clnt->sa_family) { - case AF_INET: - /* - * realsin: address that recvfrom gave us. - * ifsin: address of interface being examined. - * clntsin: address that client want us to contact - * it on - * servsin: local address of RPC service. - * sinmask: netmask of this interface - * newsin: initially a copy of clntsin, eventually - * the merged address - */ - servsin = (struct sockaddr_in *)serv_sa; - clntsin = (struct sockaddr_in *)clnt_sa; - sinmask = (struct sockaddr_in *)ifap->ifa_netmask; - newsin = (struct sockaddr_in *)&ss; - ifsin = (struct sockaddr_in *)ifap->ifa_addr; - if (!bitmaskcmp(&ifsin->sin_addr, &clntsin->sin_addr, - &sinmask->sin_addr, sizeof (struct in_addr))) { - goto found; - } - break; -#ifdef INET6 - case AF_INET6: - /* - * realsin6: address that recvfrom gave us. - * ifsin6: address of interface being examined. - * clntsin6: address that client want us to contact - * it on - * servsin6: local address of RPC service. - * sin6mask: netmask of this interface - * newsin6: initially a copy of clntsin, eventually - * the merged address - * - * For v6 link local addresses, if the client contacted - * us via a link-local address, and wants us to reply - * to one, use the scope id to see which one. - */ - realsin6 = (struct sockaddr_in6 *)clnt; - ifsin6 = (struct sockaddr_in6 *)ifap->ifa_addr; - in6_fillscopeid(ifsin6); - clntsin6 = (struct sockaddr_in6 *)clnt_sa; - servsin6 = (struct sockaddr_in6 *)serv_sa; - sin6mask = (struct sockaddr_in6 *)ifap->ifa_netmask; - newsin6 = (struct sockaddr_in6 *)&ss; - if (IN6_IS_ADDR_LINKLOCAL(&ifsin6->sin6_addr) && - IN6_IS_ADDR_LINKLOCAL(&realsin6->sin6_addr) && - IN6_IS_ADDR_LINKLOCAL(&clntsin6->sin6_addr)) { - if (ifsin6->sin6_scope_id != - realsin6->sin6_scope_id) - continue; - goto found; - } - if (!bitmaskcmp(&ifsin6->sin6_addr, - &clntsin6->sin6_addr, &sin6mask->sin6_addr, - sizeof (struct in6_addr))) - goto found; - break; -#endif - default: - goto freeit; - } - } - /* - * Didn't find anything. Get the first possibly useful interface, - * preferring "normal" interfaces to point-to-point and loopback - * ones. - */ - bestif = NULL; - for (ifap = ifp; ifap != NULL; ifap = ifap->ifa_next) { - if (ifap->ifa_addr->sa_family != clnt->sa_family || - !(ifap->ifa_flags & IFF_UP)) - continue; - if (!(ifap->ifa_flags & IFF_LOOPBACK) && - !(ifap->ifa_flags & IFF_POINTOPOINT)) { - bestif = ifap; - break; - } - if (bestif == NULL) - bestif = ifap; - else if ((bestif->ifa_flags & IFF_LOOPBACK) && - !(ifap->ifa_flags & IFF_LOOPBACK)) - bestif = ifap; - } - ifap = bestif; -found: - switch (clnt->sa_family) { - case AF_INET: - memcpy(newsin, ifap->ifa_addr, clnt_sa->sa_len); - newsin->sin_port = servsin->sin_port; - tbuf.len = clnt_sa->sa_len; - tbuf.maxlen = sizeof (struct sockaddr_storage); - tbuf.buf = newsin; - break; -#ifdef INET6 - case AF_INET6: - assert(newsin6); - memcpy(newsin6, ifsin6, clnt_sa->sa_len); - newsin6->sin6_port = servsin6->sin6_port; - tbuf.maxlen = sizeof (struct sockaddr_storage); - tbuf.len = clnt_sa->sa_len; - tbuf.buf = newsin6; - break; -#endif - default: - goto freeit; - } - if (ifap != NULL) - ret = taddr2uaddr(nconf, &tbuf); -freeit: - freenetconfigent(nconf); - free(serv_sa); - free(serv_nbp); - if (clnt_sa != NULL) - free(clnt_sa); - if (clnt_nbp != NULL) - free(clnt_nbp); - freeifaddrs(ifp); - -#ifdef RPCBIND_DEBUG - if (debugging) - fprintf(stderr, "addrmerge: returning %s\n", ret); -#endif - return ret; -} - -void -network_init() -{ -#ifdef INET6 - struct ifaddrs *ifap, *ifp; - struct ipv6_mreq mreq6; - int ifindex, s; -#endif - int ecode; - struct addrinfo hints, *res; - - memset(&hints, 0, sizeof hints); - hints.ai_family = AF_INET; - if ((ecode = getaddrinfo(NULL, "sunrpc", &hints, &res))) { - if (debugging) - fprintf(stderr, "can't get local ip4 address: %s\n", - gai_strerror(ecode)); - } else { - local_in4 = (struct sockaddr_in *)malloc(sizeof *local_in4); - if (local_in4 == NULL) { - if (debugging) - fprintf(stderr, "can't alloc local ip4 addr\n"); - } - memcpy(local_in4, res->ai_addr, sizeof *local_in4); - } - -#ifdef INET6 - hints.ai_family = AF_INET6; - if ((ecode = getaddrinfo(NULL, "sunrpc", &hints, &res))) { - if (debugging) - fprintf(stderr, "can't get local ip6 address: %s\n", - gai_strerror(ecode)); - } else { - local_in6 = (struct sockaddr_in6 *)malloc(sizeof *local_in6); - if (local_in6 == NULL) { - if (debugging) - fprintf(stderr, "can't alloc local ip6 addr\n"); - } - memcpy(local_in6, res->ai_addr, sizeof *local_in6); - } - - /* - * Now join the RPC ipv6 multicast group on all interfaces. - */ - if (getifaddrs(&ifp) < 0) - return; - - mreq6.ipv6mr_interface = 0; - inet_pton(AF_INET6, RPCB_MULTICAST_ADDR, &mreq6.ipv6mr_multiaddr); - - s = socket(AF_INET6, SOCK_DGRAM, IPPROTO_UDP); - - /* - * Loop through all interfaces. For each interface, see if the - * network portion of its address is equal to that of the client. - * If so, we have found the interface that we want to use. - */ - for (ifap = ifp; ifap != NULL; ifap = ifap->ifa_next) { - if (ifap->ifa_addr->sa_family != AF_INET6 || - !(ifap->ifa_flags & IFF_MULTICAST)) - continue; - ifindex = if_nametoindex(ifap->ifa_name); - if (ifindex == mreq6.ipv6mr_interface) - /* - * Already did this one. - */ - continue; - mreq6.ipv6mr_interface = ifindex; - if (setsockopt(s, IPPROTO_IPV6, IPV6_JOIN_GROUP, &mreq6, - sizeof mreq6) < 0) - if (debugging) - warn("setsockopt v6 multicast"); - } -#endif - - /* close(s); */ -} - -struct sockaddr * -local_sa(int af) -{ - switch (af) { - case AF_INET: - return (struct sockaddr *)local_in4; -#ifdef INET6 - case AF_INET6: - return (struct sockaddr *)local_in6; -#endif - default: - return NULL; - } -} diff --git a/contrib/netbsd-tests/fs/psshfs/t_psshfs.sh b/contrib/netbsd-tests/fs/psshfs/t_psshfs.sh index 241d46d5d040..4d8fede15494 100755 --- a/contrib/netbsd-tests/fs/psshfs/t_psshfs.sh +++ b/contrib/netbsd-tests/fs/psshfs/t_psshfs.sh @@ -1,4 +1,4 @@ -# $NetBSD: t_psshfs.sh,v 1.7 2013/03/16 07:54:04 jmmv Exp $ +# $NetBSD: t_psshfs.sh,v 1.8 2016/09/05 08:53:57 christos Exp $ # # Copyright (c) 2007, 2008 The NetBSD Foundation, Inc. # All rights reserved. @@ -262,6 +262,26 @@ setattr_cache_cleanup() { stop_ssh } +atf_test_case read_empty_file cleanup +read_empty_file_head() { + atf_set "descr" "Checks whether an empty file can be read" + # This test is supposed to make sure psshfs does not hang + # when reading from an empty file, hence the timeout. + atf_set "timeout" 8 +} +read_empty_file_body() { + require_puffs + start_ssh + atf_check mkdir root mnt + atf_check -x ': > root/empty' + mount_psshfs root mnt + atf_check cat mnt/empty +} +read_empty_file_cleanup() { + umount mnt + stop_ssh +} + # ------------------------------------------------------------------------- # Initialization. # ------------------------------------------------------------------------- @@ -271,4 +291,5 @@ atf_init_test_cases() { atf_add_test_case pwd atf_add_test_case ls #atf_add_test_case setattr_cache + atf_add_test_case read_empty_file } diff --git a/contrib/netbsd-tests/fs/puffs/t_basic.c b/contrib/netbsd-tests/fs/puffs/t_basic.c index ce5e4ea15f83..735108d64f44 100644 --- a/contrib/netbsd-tests/fs/puffs/t_basic.c +++ b/contrib/netbsd-tests/fs/puffs/t_basic.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_basic.c,v 1.12 2013/10/19 17:45:00 christos Exp $ */ +/* $NetBSD: t_basic.c,v 1.13 2016/12/01 14:49:04 hannken Exp $ */ #include #include @@ -286,7 +286,7 @@ ATF_TC_BODY(inactive_reclaim, tc) rump_sys_close(fd); syncbar(FSTEST_MNTNAME); - ATF_REQUIRE_EQ(pargs->pta_vn_toserv_ops[PUFFS_VN_INACTIVE], 1); + ATF_REQUIRE(pargs->pta_vn_toserv_ops[PUFFS_VN_INACTIVE] > 0); ATF_REQUIRE_EQ(pargs->pta_vn_toserv_ops[PUFFS_VN_RECLAIM], 1); FSTEST_EXIT(); @@ -383,7 +383,7 @@ ATF_TC_BODY(unlink_accessible, tc) syncbar(FSTEST_MNTNAME); ATF_REQUIRE_EQ(pargs->pta_vn_toserv_ops[PUFFS_VN_RECLAIM], 1); - ATF_REQUIRE_EQ(pargs->pta_vn_toserv_ops[PUFFS_VN_INACTIVE], ianow+1); + ATF_REQUIRE(pargs->pta_vn_toserv_ops[PUFFS_VN_INACTIVE] > ianow); ATF_REQUIRE_STREQ(buf, MAGICSTR); diff --git a/contrib/netbsd-tests/fs/vfs/t_vnops.c b/contrib/netbsd-tests/fs/vfs/t_vnops.c index 08203dde0cfa..978fadb04c26 100644 --- a/contrib/netbsd-tests/fs/vfs/t_vnops.c +++ b/contrib/netbsd-tests/fs/vfs/t_vnops.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_vnops.c,v 1.55 2016/01/28 10:10:09 martin Exp $ */ +/* $NetBSD: t_vnops.c,v 1.58 2016/08/29 02:31:46 kre Exp $ */ /*- * Copyright (c) 2010 The NetBSD Foundation, Inc. @@ -28,6 +28,7 @@ #include #include +#include #include #include @@ -55,10 +56,10 @@ atf_tc_skip("symlinks not supported by file system") static char * -md(char *buf, const char *base, const char *tail) +md(char *buf, size_t buflen, const char *base, const char *tail) { - sprintf(buf, "%s/%s", base, tail); + snprintf(buf, buflen, "%s/%s", base, tail); return buf; } @@ -69,11 +70,11 @@ lookup_simple(const atf_tc_t *tc, const char *mountpath) struct stat sb1, sb2; strcpy(final, mountpath); - sprintf(pb, "%s/../%s", mountpath, basename(final)); + snprintf(pb, sizeof(pb), "%s/../%s", mountpath, basename(final)); if (rump_sys_stat(pb, &sb1) == -1) atf_tc_fail_errno("stat 1"); - sprintf(pb, "%s/./../%s", mountpath, basename(final)); + snprintf(pb, sizeof(pb), "%s/./../%s", mountpath, basename(final)); if (rump_sys_stat(pb, &sb2) == -1) atf_tc_fail_errno("stat 2"); @@ -85,22 +86,38 @@ lookup_complex(const atf_tc_t *tc, const char *mountpath) { char pb[MAXPATHLEN]; struct stat sb1, sb2; + struct timespec atplus1, onesec; USES_DIRS; - if (FSTYPE_UDF(tc)) - atf_tc_expect_fail("PR kern/49033"); - - sprintf(pb, "%s/dir", mountpath); + snprintf(pb, sizeof(pb), "%s/dir", mountpath); if (rump_sys_mkdir(pb, 0777) == -1) atf_tc_fail_errno("mkdir"); if (rump_sys_stat(pb, &sb1) == -1) atf_tc_fail_errno("stat 1"); - sprintf(pb, "%s/./dir/../././dir/.", mountpath); + snprintf(pb, sizeof(pb), "%s/./dir/../././dir/.", mountpath); if (rump_sys_stat(pb, &sb2) == -1) atf_tc_fail_errno("stat 2"); + /* + * The lookup is permitted to modify the access time of + * any directories searched - such a directory is the + * subject of this test. Any difference should cause + * the 2nd lookup atime tp be >= the first, if it is ==, all is + * OK (atime is not required to be modified by the search, or + * both references may happen within the came clock tick), if the + * 2nd lookup atime is > the first, but not "too much" greater, + * just set it back, so the memcmp just below succeeds + * (assuming all else is OK). + */ + onesec.tv_sec = 1; + onesec.tv_nsec = 0; + timespecadd(&sb1.st_atimespec, &onesec, &atplus1); + if (timespeccmp(&sb2.st_atimespec, &sb1.st_atimespec, >) && + timespeccmp(&sb2.st_atimespec, &atplus1, <)) + sb2.st_atimespec = sb1.st_atimespec; + if (memcmp(&sb1, &sb2, sizeof(sb1)) != 0) { printf("what\tsb1\t\tsb2\n"); @@ -133,9 +150,6 @@ lookup_complex(const atf_tc_t *tc, const char *mountpath) atf_tc_fail("stat results differ, see ouput for more details"); } - if (FSTYPE_UDF(tc)) - atf_tc_fail("random failure of PR kern/49033 " - "did not happen this time"); } static void @@ -147,7 +161,7 @@ dir_simple(const atf_tc_t *tc, const char *mountpath) USES_DIRS; /* check we can create directories */ - sprintf(pb, "%s/dir", mountpath); + snprintf(pb, sizeof(pb), "%s/dir", mountpath); if (rump_sys_mkdir(pb, 0777) == -1) atf_tc_fail_errno("mkdir"); if (rump_sys_stat(pb, &sb) == -1) @@ -169,11 +183,11 @@ dir_notempty(const atf_tc_t *tc, const char *mountpath) USES_DIRS; /* check we can create directories */ - sprintf(pb, "%s/dir", mountpath); + snprintf(pb, sizeof(pb), "%s/dir", mountpath); if (rump_sys_mkdir(pb, 0777) == -1) atf_tc_fail_errno("mkdir"); - sprintf(pb2, "%s/dir/file", mountpath); + snprintf(pb2, sizeof(pb2), "%s/dir/file", mountpath); fd = rump_sys_open(pb2, O_RDWR | O_CREAT, 0777); if (fd == -1) atf_tc_fail_errno("create file"); @@ -205,9 +219,9 @@ dir_rmdirdotdot(const atf_tc_t *tc, const char *mp) RL(rump_sys_mkdir("subtest", 0777)); RL(rump_sys_chdir("subtest")); - md(pb, mp, "test/subtest"); + md(pb, sizeof(pb), mp, "test/subtest"); RL(rump_sys_rmdir(pb)); - md(pb, mp, "test"); + md(pb, sizeof(pb), mp, "test"); RL(rump_sys_rmdir(pb)); if (FSTYPE_NFS(tc)) @@ -225,7 +239,7 @@ checkfile(const char *path, struct stat *refp) struct stat sb; static int n = 1; - md(buf, path, "file"); + md(buf, sizeof(buf), path, "file"); if (rump_sys_stat(buf, &sb) == -1) atf_tc_fail_errno("cannot stat file %d (%s)", n, buf); if (memcmp(&sb, refp, sizeof(sb)) != 0) @@ -244,18 +258,18 @@ rename_dir(const atf_tc_t *tc, const char *mp) USES_DIRS; - md(pb1, mp, "dir1"); + md(pb1, sizeof(pb1), mp, "dir1"); if (rump_sys_mkdir(pb1, 0777) == -1) atf_tc_fail_errno("mkdir 1"); - md(pb2, mp, "dir2"); + md(pb2, sizeof(pb2), mp, "dir2"); if (rump_sys_mkdir(pb2, 0777) == -1) atf_tc_fail_errno("mkdir 2"); - md(pb2, mp, "dir2/subdir"); + md(pb2, sizeof(pb2), mp, "dir2/subdir"); if (rump_sys_mkdir(pb2, 0777) == -1) atf_tc_fail_errno("mkdir 3"); - md(pb3, mp, "dir1/file"); + md(pb3, sizeof(pb3), mp, "dir1/file"); if (rump_sys_mknod(pb3, S_IFREG | 0777, -1) == -1) atf_tc_fail_errno("create file"); if (rump_sys_stat(pb3, &ref) == -1) @@ -266,13 +280,13 @@ rename_dir(const atf_tc_t *tc, const char *mp) */ /* rename within directory */ - md(pb3, mp, "dir3"); + md(pb3, sizeof(pb3), mp, "dir3"); if (rump_sys_rename(pb1, pb3) == -1) atf_tc_fail_errno("rename 1"); checkfile(pb3, &ref); /* rename directory onto itself (two ways, should fail) */ - md(pb1, mp, "dir3/."); + md(pb1, sizeof(pb1), mp, "dir3/."); if (rump_sys_rename(pb1, pb3) != -1 || errno != EINVAL) atf_tc_fail_errno("rename 2"); if (rump_sys_rename(pb3, pb1) != -1 || errno != EISDIR) @@ -281,13 +295,13 @@ rename_dir(const atf_tc_t *tc, const char *mp) checkfile(pb3, &ref); /* rename father of directory into directory */ - md(pb1, mp, "dir2/dir"); - md(pb2, mp, "dir2"); + md(pb1, sizeof(pb1), mp, "dir2/dir"); + md(pb2, sizeof(pb2), mp, "dir2"); if (rump_sys_rename(pb2, pb1) != -1 || errno != EINVAL) atf_tc_fail_errno("rename 4"); /* same for grandfather */ - md(pb1, mp, "dir2/subdir/dir2"); + md(pb1, sizeof(pb1), mp, "dir2/subdir/dir2"); if (rump_sys_rename(pb2, pb1) != -1 || errno != EINVAL) atf_tc_fail("rename 5"); @@ -298,29 +312,29 @@ rename_dir(const atf_tc_t *tc, const char *mp) atf_tc_fail("rename 6"); /* cross-directory rename */ - md(pb1, mp, "dir3"); - md(pb2, mp, "dir2/somedir"); + md(pb1, sizeof(pb1), mp, "dir3"); + md(pb2, sizeof(pb2), mp, "dir2/somedir"); if (rump_sys_rename(pb1, pb2) == -1) atf_tc_fail_errno("rename 7"); checkfile(pb2, &ref); /* move to parent directory */ - md(pb1, mp, "dir2/somedir/../../dir3"); + md(pb1, sizeof(pb1), mp, "dir2/somedir/../../dir3"); if (rump_sys_rename(pb2, pb1) == -1) atf_tc_fail_errno("rename 8"); - md(pb1, mp, "dir2/../dir3"); + md(pb1, sizeof(pb1), mp, "dir2/../dir3"); checkfile(pb1, &ref); /* atomic cross-directory rename */ - md(pb3, mp, "dir2/subdir"); + md(pb3, sizeof(pb3), mp, "dir2/subdir"); if (rump_sys_rename(pb1, pb3) == -1) atf_tc_fail_errno("rename 9"); checkfile(pb3, &ref); /* rename directory over an empty directory */ - md(pb1, mp, "parent"); - md(pb2, mp, "parent/dir1"); - md(pb3, mp, "parent/dir2"); + md(pb1, sizeof(pb1), mp, "parent"); + md(pb2, sizeof(pb2), mp, "parent/dir1"); + md(pb3, sizeof(pb3), mp, "parent/dir2"); RL(rump_sys_mkdir(pb1, 0777)); RL(rump_sys_mkdir(pb2, 0777)); RL(rump_sys_mkdir(pb3, 0777)); @@ -467,15 +481,15 @@ create_many(const atf_tc_t *tc, const char *mp) for (i = 0; i < nfiles; i++) { int fd; - sprintf(buf, TESTFN "%d", i); + snprintf(buf, sizeof(buf), TESTFN "%d", i); RL(fd = rump_sys_open(buf, O_RDWR|O_CREAT|O_EXCL, 0666)); RL(rump_sys_close(fd)); } /* wipe them out */ for (i = 0; i < nfiles; i++) { - sprintf(buf, TESTFN "%d", i); - RL(rump_sys_unlink(buf)); + snprintf(buf, sizeof(buf), TESTFN "%d", i); + RLF(rump_sys_unlink(buf), "%s", buf); } #undef TESTFN @@ -499,12 +513,12 @@ create_nonalphanum(const atf_tc_t *tc, const char *mp) for (i = 0; i < 256; i++) { int fd; - sprintf(buf, "%c", i); + snprintf(buf, sizeof(buf), "%c", i); fd = rump_sys_open(buf, O_RDWR|O_CREAT|O_EXCL, 0666); if (fd == -1) continue; - RL(rump_sys_close(fd)); - RL(rump_sys_unlink(buf)); + RLF(rump_sys_close(fd), "%d", fd); + RLF(rump_sys_unlink(buf), "%s", buf); } printf("\n"); @@ -632,7 +646,7 @@ symlink_len(const atf_tc_t *tc, const char *mp, size_t len) USES_SYMLINKS; - RL(rump_sys_chdir(mp)); + RLF(rump_sys_chdir(mp), "%s", mp); buf = malloc(len + 1); ATF_REQUIRE(buf); diff --git a/contrib/netbsd-tests/h_macros.h b/contrib/netbsd-tests/h_macros.h index 29b4e9901042..dd730c9efe4d 100644 --- a/contrib/netbsd-tests/h_macros.h +++ b/contrib/netbsd-tests/h_macros.h @@ -1,4 +1,4 @@ -/* $NetBSD: h_macros.h,v 1.12 2016/08/04 11:49:07 jakllsch Exp $ */ +/* $NetBSD: h_macros.h,v 1.13 2016/08/20 15:49:08 christos Exp $ */ /*- * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc. @@ -45,6 +45,8 @@ ATF_CHECK_MSG((x) != (v), "%s: %s", #x, strerror(errno)) #define RL(x) REQUIRE_LIBC(x, -1) +#define RLF(x, fmt, arg) \ + ATF_CHECK_MSG((x) != -1, "%s [" fmt "]: %s", #x, arg, strerror(errno)) #define RZ(x) \ do { \ int RZ_rv = x; \ diff --git a/contrib/netbsd-tests/kernel/msg.h b/contrib/netbsd-tests/kernel/msg.h new file mode 100644 index 000000000000..547400ee73a6 --- /dev/null +++ b/contrib/netbsd-tests/kernel/msg.h @@ -0,0 +1,136 @@ +/* $NetBSD: msg.h,v 1.1 2016/12/05 20:10:10 christos Exp $ */ + +/*- + * Copyright (c) 2016 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Christos Zoulas. + * + * 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. + */ + +struct msg_fds { + int pfd[2]; + int cfd[2]; +}; + +#define CLOSEFD(fd) do { \ + if (fd != -1) { \ + close(fd); \ + fd = -1; \ + } \ +} while (/*CONSTCOND*/ 0) + +static int +msg_open(struct msg_fds *fds) +{ + if (pipe(fds->pfd) == -1) + return -1; + if (pipe(fds->cfd) == -1) { + close(fds->pfd[0]); + close(fds->pfd[1]); + return -1; + } + return 0; +} + +static void +msg_close(struct msg_fds *fds) +{ + CLOSEFD(fds->pfd[0]); + CLOSEFD(fds->pfd[1]); + CLOSEFD(fds->cfd[0]); + CLOSEFD(fds->cfd[1]); +} + +static int +msg_write_child(const char *info, struct msg_fds *fds, void *msg, size_t len) +{ + ssize_t rv; + CLOSEFD(fds->cfd[1]); + CLOSEFD(fds->pfd[0]); + + printf("Send %s\n", info); + rv = write(fds->pfd[1], msg, len); + if (rv != (ssize_t)len) + return 1; +// printf("Wait %s\n", info); + rv = read(fds->cfd[0], msg, len); + if (rv != (ssize_t)len) + return 1; + return 0; +} + +static int +msg_write_parent(const char *info, struct msg_fds *fds, void *msg, size_t len) +{ + ssize_t rv; + CLOSEFD(fds->pfd[1]); + CLOSEFD(fds->cfd[0]); + + printf("Send %s\n", info); + rv = write(fds->cfd[1], msg, len); + if (rv != (ssize_t)len) + return 1; +// printf("Wait %s\n", info); + rv = read(fds->pfd[0], msg, len); + if (rv != (ssize_t)len) + return 1; + return 0; +} + +static int +msg_read_parent(const char *info, struct msg_fds *fds, void *msg, size_t len) +{ + ssize_t rv; + CLOSEFD(fds->pfd[1]); + CLOSEFD(fds->cfd[0]); + + printf("Wait %s\n", info); + rv = read(fds->pfd[0], msg, len); + if (rv != (ssize_t)len) + return 1; +// printf("Send %s\n", info); + rv = write(fds->cfd[1], msg, len); + if (rv != (ssize_t)len) + return 1; + return 0; +} + +static int +msg_read_child(const char *info, struct msg_fds *fds, void *msg, size_t len) +{ + ssize_t rv; + CLOSEFD(fds->cfd[1]); + CLOSEFD(fds->pfd[0]); + + printf("Wait %s\n", info); + rv = read(fds->cfd[0], msg, len); + if (rv != (ssize_t)len) + return 1; +// printf("Send %s\n", info); + rv = write(fds->pfd[1], msg, len); + if (rv != (ssize_t)len) + return 1; + return 0; +} diff --git a/contrib/netbsd-tests/kernel/t_mqueue.c b/contrib/netbsd-tests/kernel/t_mqueue.c index aa98d91ead5c..485269fa9937 100644 --- a/contrib/netbsd-tests/kernel/t_mqueue.c +++ b/contrib/netbsd-tests/kernel/t_mqueue.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_mqueue.c,v 1.4 2014/03/02 19:56:48 jmmv Exp $ */ +/* $NetBSD: t_mqueue.c,v 1.5 2017/01/10 22:10:22 christos Exp $ */ /* * Test for POSIX message queue priority handling. @@ -14,6 +14,7 @@ #endif #include +#include #include #include diff --git a/contrib/netbsd-tests/kernel/t_ptrace.c b/contrib/netbsd-tests/kernel/t_ptrace.c new file mode 100644 index 000000000000..074a953a93e7 --- /dev/null +++ b/contrib/netbsd-tests/kernel/t_ptrace.c @@ -0,0 +1,208 @@ +/* $NetBSD: t_ptrace.c,v 1.17 2016/11/13 22:59:31 kamil Exp $ */ + +/*- + * Copyright (c) 2016 The NetBSD Foundation, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include +__RCSID("$NetBSD: t_ptrace.c,v 1.17 2016/11/13 22:59:31 kamil Exp $"); + +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include "../h_macros.h" + +/* + * A child process cannot call atf functions and expect them to magically + * work like in the parent. + * The printf(3) messaging from a child will not work out of the box as well + * without estabilishing a communication protocol with its parent. To not + * overcomplicate the tests - do not log from a child and use err(3)/errx(3) + * wrapped with FORKEE_ASSERT()/FORKEE_ASSERTX() as that is guaranteed to work. + */ +#define FORKEE_ASSERTX(x) \ +do { \ + int ret = (x); \ + if (!ret) \ + errx(EXIT_FAILURE, "%s:%d %s(): Assertion failed for: %s", \ + __FILE__, __LINE__, __func__, #x); \ +} while (0) + +#define FORKEE_ASSERT(x) \ +do { \ + int ret = (x); \ + if (!ret) \ + err(EXIT_FAILURE, "%s:%d %s(): Assertion failed for: %s", \ + __FILE__, __LINE__, __func__, #x); \ +} while (0) + +ATF_TC(attach_pid0); +ATF_TC_HEAD(attach_pid0, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Assert that a debugger cannot attach to PID 0"); +} + +ATF_TC_BODY(attach_pid0, tc) +{ + errno = 0; + ATF_REQUIRE_ERRNO(EPERM, ptrace(PT_ATTACH, 0, NULL, 0) == -1); +} + +ATF_TC(attach_pid1); +ATF_TC_HEAD(attach_pid1, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Assert that a debugger cannot attach to PID 1 (as non-root)"); + + atf_tc_set_md_var(tc, "require.user", "unprivileged"); +} + +ATF_TC_BODY(attach_pid1, tc) +{ + ATF_REQUIRE_ERRNO(EPERM, ptrace(PT_ATTACH, 1, NULL, 0) == -1); +} + +ATF_TC(attach_pid1_securelevel); +ATF_TC_HEAD(attach_pid1_securelevel, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Assert that a debugger cannot attach to PID 1 with " + "securelevel >= 1 (as root)"); + + atf_tc_set_md_var(tc, "require.user", "root"); +} + +ATF_TC_BODY(attach_pid1_securelevel, tc) +{ + int level; + size_t len = sizeof(level); + + ATF_REQUIRE(sysctlbyname("kern.securelevel", &level, &len, NULL, 0) + != -1); + + if (level < 1) { + atf_tc_skip("Test must be run with securelevel >= 1"); + } + + ATF_REQUIRE_ERRNO(EPERM, ptrace(PT_ATTACH, 1, NULL, 0) == -1); +} + +ATF_TC(attach_self); +ATF_TC_HEAD(attach_self, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Assert that a debugger cannot attach to self (as it's nonsense)"); +} + +ATF_TC_BODY(attach_self, tc) +{ + ATF_REQUIRE_ERRNO(EINVAL, ptrace(PT_ATTACH, getpid(), NULL, 0) == -1); +} + +ATF_TC(attach_chroot); +ATF_TC_HEAD(attach_chroot, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Assert that a debugger cannot trace another process unless the " + "process's root directory is at or below the tracing process's " + "root"); + + atf_tc_set_md_var(tc, "require.user", "root"); +} + +ATF_TC_BODY(attach_chroot, tc) +{ + char buf[PATH_MAX]; + pid_t child; + int fds_toparent[2], fds_fromparent[2]; + int rv; + uint8_t msg = 0xde; /* dummy message for IPC based on pipe(2) */ + + (void)memset(buf, '\0', sizeof(buf)); + ATF_REQUIRE(getcwd(buf, sizeof(buf)) != NULL); + (void)strlcat(buf, "/dir", sizeof(buf)); + + ATF_REQUIRE(mkdir(buf, 0500) == 0); + ATF_REQUIRE(chdir(buf) == 0); + + ATF_REQUIRE(pipe(fds_toparent) == 0); + ATF_REQUIRE(pipe(fds_fromparent) == 0); + child = atf_utils_fork(); + if (child == 0) { + FORKEE_ASSERT(close(fds_toparent[0]) == 0); + FORKEE_ASSERT(close(fds_fromparent[1]) == 0); + + FORKEE_ASSERT(chroot(buf) == 0); + + rv = write(fds_toparent[1], &msg, sizeof(msg)); + FORKEE_ASSERTX(rv == sizeof(msg)); + + ATF_REQUIRE_ERRNO(EPERM, + ptrace(PT_ATTACH, getppid(), NULL, 0) == -1); + + rv = read(fds_fromparent[0], &msg, sizeof(msg)); + FORKEE_ASSERTX(rv == sizeof(msg)); + + _exit(0); + } + ATF_REQUIRE(close(fds_toparent[1]) == 0); + ATF_REQUIRE(close(fds_fromparent[0]) == 0); + + printf("Waiting for chrooting of the child PID %d", child); + rv = read(fds_toparent[0], &msg, sizeof(msg)); + ATF_REQUIRE(rv == sizeof(msg)); + + printf("Child is ready, it will try to PT_ATTACH to parent\n"); + rv = write(fds_fromparent[1], &msg, sizeof(msg)); + ATF_REQUIRE(rv == sizeof(msg)); + + printf("fds_fromparent is no longer needed - close it\n"); + ATF_REQUIRE(close(fds_fromparent[1]) == 0); + + printf("fds_toparent is no longer needed - close it\n"); + ATF_REQUIRE(close(fds_toparent[0]) == 0); +} + +ATF_TP_ADD_TCS(tp) +{ + setvbuf(stdout, NULL, _IONBF, 0); + setvbuf(stderr, NULL, _IONBF, 0); + ATF_TP_ADD_TC(tp, attach_pid0); + ATF_TP_ADD_TC(tp, attach_pid1); + ATF_TP_ADD_TC(tp, attach_pid1_securelevel); + ATF_TP_ADD_TC(tp, attach_self); + ATF_TP_ADD_TC(tp, attach_chroot); + + return atf_no_error(); +} diff --git a/contrib/netbsd-tests/kernel/t_ptrace_wait.c b/contrib/netbsd-tests/kernel/t_ptrace_wait.c new file mode 100644 index 000000000000..e502a034eb1b --- /dev/null +++ b/contrib/netbsd-tests/kernel/t_ptrace_wait.c @@ -0,0 +1,5082 @@ +/* $NetBSD: t_ptrace_wait.c,v 1.53 2017/01/10 05:08:24 kamil Exp $ */ + +/*- + * Copyright (c) 2016 The NetBSD Foundation, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include +__RCSID("$NetBSD: t_ptrace_wait.c,v 1.53 2017/01/10 05:08:24 kamil Exp $"); + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include "../h_macros.h" + +#include "t_ptrace_wait.h" +#include "msg.h" + +#define PARENT_TO_CHILD(info, fds, msg) \ + ATF_REQUIRE(msg_write_child(info " to child " # fds, &fds, &msg, sizeof(msg)) == 0) + +#define CHILD_FROM_PARENT(info, fds, msg) \ + FORKEE_ASSERT(msg_read_parent(info " from parent " # fds, &fds, &msg, sizeof(msg)) == 0) + +#define CHILD_TO_PARENT(info, fds, msg) \ + FORKEE_ASSERT(msg_write_parent(info " to parent " # fds, &fds, &msg, sizeof(msg)) == 0) + +#define PARENT_FROM_CHILD(info, fds, msg) \ + ATF_REQUIRE(msg_read_child(info " from parent " # fds, &fds, &msg, sizeof(msg)) == 0) + +ATF_TC(traceme1); +ATF_TC_HEAD(traceme1, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Verify SIGSTOP followed by _exit(2) in a child"); +} + +ATF_TC_BODY(traceme1, tc) +{ + const int exitval = 5; + const int sigval = SIGSTOP; + pid_t child, wpid; +#if defined(TWAIT_HAVE_STATUS) + int status; +#endif + + printf("Before forking process PID=%d\n", getpid()); + ATF_REQUIRE((child = fork()) != -1); + if (child == 0) { + printf("Before calling PT_TRACE_ME from child %d\n", getpid()); + FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1); + + printf("Before raising %s from child\n", strsignal(sigval)); + FORKEE_ASSERT(raise(sigval) == 0); + + printf("Before exiting of the child process\n"); + _exit(exitval); + } + printf("Parent process PID=%d, child's PID=%d\n", getpid(), child); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_stopped(status, sigval); + + printf("Before resuming the child process where it left off and " + "without signal to be sent\n"); + ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_exited(status, exitval); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0)); +} + +ATF_TC(traceme2); +ATF_TC_HEAD(traceme2, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Verify SIGSTOP followed by _exit(2) in a child"); +} + +static int traceme2_caught = 0; + +static void +traceme2_sighandler(int sig) +{ + FORKEE_ASSERT_EQ(sig, SIGINT); + + ++traceme2_caught; +} + +ATF_TC_BODY(traceme2, tc) +{ + const int exitval = 5; + const int sigval = SIGSTOP, sigsent = SIGINT; + pid_t child, wpid; + struct sigaction sa; +#if defined(TWAIT_HAVE_STATUS) + int status; +#endif + + printf("Before forking process PID=%d\n", getpid()); + ATF_REQUIRE((child = fork()) != -1); + if (child == 0) { + printf("Before calling PT_TRACE_ME from child %d\n", getpid()); + FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1); + + sa.sa_handler = traceme2_sighandler; + sa.sa_flags = SA_SIGINFO; + sigemptyset(&sa.sa_mask); + + FORKEE_ASSERT(sigaction(sigsent, &sa, NULL) != -1); + + printf("Before raising %s from child\n", strsignal(sigval)); + FORKEE_ASSERT(raise(sigval) == 0); + + FORKEE_ASSERT_EQ(traceme2_caught, 1); + + printf("Before exiting of the child process\n"); + _exit(exitval); + } + printf("Parent process PID=%d, child's PID=%d\n", getpid(), child); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_stopped(status, sigval); + + printf("Before resuming the child process where it left off and with " + "signal %s to be sent\n", strsignal(sigsent)); + ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, sigsent) != -1); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_exited(status, exitval); + + printf("Before calling %s() for the exited child\n", TWAIT_FNAME); + TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0)); +} + +ATF_TC(traceme3); +ATF_TC_HEAD(traceme3, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Verify SIGSTOP followed by termination by a signal in a child"); +} + +ATF_TC_BODY(traceme3, tc) +{ + const int sigval = SIGSTOP, sigsent = SIGINT /* Without core-dump */; + pid_t child, wpid; +#if defined(TWAIT_HAVE_STATUS) + int status; +#endif + + printf("Before forking process PID=%d\n", getpid()); + ATF_REQUIRE((child = fork()) != -1); + if (child == 0) { + printf("Before calling PT_TRACE_ME from child %d\n", getpid()); + FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1); + + printf("Before raising %s from child\n", strsignal(sigval)); + FORKEE_ASSERT(raise(sigval) == 0); + + /* NOTREACHED */ + FORKEE_ASSERTX(0 && + "Child should be terminated by a signal from its parent"); + } + printf("Parent process PID=%d, child's PID=%d\n", getpid(), child); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_stopped(status, sigval); + + printf("Before resuming the child process where it left off and with " + "signal %s to be sent\n", strsignal(sigsent)); + ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, sigsent) != -1); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_signaled(status, sigsent, 0); + + printf("Before calling %s() for the exited child\n", TWAIT_FNAME); + TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0)); +} + +ATF_TC(traceme4); +ATF_TC_HEAD(traceme4, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Verify SIGSTOP followed by SIGCONT and _exit(2) in a child"); +} + +ATF_TC_BODY(traceme4, tc) +{ + const int exitval = 5; + const int sigval = SIGSTOP, sigsent = SIGCONT; + pid_t child, wpid; +#if defined(TWAIT_HAVE_STATUS) + int status; +#endif + + printf("Before forking process PID=%d\n", getpid()); + ATF_REQUIRE((child = fork()) != -1); + if (child == 0) { + printf("Before calling PT_TRACE_ME from child %d\n", getpid()); + FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1); + + printf("Before raising %s from child\n", strsignal(sigval)); + FORKEE_ASSERT(raise(sigval) == 0); + + printf("Before raising %s from child\n", strsignal(sigsent)); + FORKEE_ASSERT(raise(sigsent) == 0); + + printf("Before exiting of the child process\n"); + _exit(exitval); + } + printf("Parent process PID=%d, child's PID=%d\n", getpid(),child); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_stopped(status, sigval); + + printf("Before resuming the child process where it left off and " + "without signal to be sent\n"); + ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_stopped(status, sigsent); + + printf("Before resuming the child process where it left off and " + "without signal to be sent\n"); + ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_exited(status, exitval); + + printf("Before calling %s() for the exited child\n", TWAIT_FNAME); + TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0)); +} + +#if defined(TWAIT_HAVE_PID) +ATF_TC(attach1); +ATF_TC_HEAD(attach1, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Assert that tracer sees process termination before the parent"); +} + +ATF_TC_BODY(attach1, tc) +{ + struct msg_fds parent_tracee, parent_tracer; + const int exitval_tracee = 5; + const int exitval_tracer = 10; + pid_t tracee, tracer, wpid; + uint8_t msg = 0xde; /* dummy message for IPC based on pipe(2) */ +#if defined(TWAIT_HAVE_STATUS) + int status; +#endif + + printf("Spawn tracee\n"); + ATF_REQUIRE(msg_open(&parent_tracee) == 0); + tracee = atf_utils_fork(); + if (tracee == 0) { + // Wait for parent to let us exit + CHILD_FROM_PARENT("exit tracee", parent_tracee, msg); + _exit(exitval_tracee); + } + + printf("Spawn debugger\n"); + ATF_REQUIRE(msg_open(&parent_tracer) == 0); + tracer = atf_utils_fork(); + if (tracer == 0) { + printf("Before calling PT_ATTACH from tracee %d\n", getpid()); + FORKEE_ASSERT(ptrace(PT_ATTACH, tracee, NULL, 0) != -1); + + /* Wait for tracee and assert that it was stopped w/ SIGSTOP */ + FORKEE_REQUIRE_SUCCESS( + wpid = TWAIT_GENERIC(tracee, &status, 0), tracee); + + forkee_status_stopped(status, SIGSTOP); + + /* Resume tracee with PT_CONTINUE */ + FORKEE_ASSERT(ptrace(PT_CONTINUE, tracee, (void *)1, 0) != -1); + + /* Inform parent that tracer has attached to tracee */ + CHILD_TO_PARENT("tracer ready", parent_tracer, msg); + + /* Wait for parent to tell use that tracee should have exited */ + CHILD_FROM_PARENT("wait for tracee exit", parent_tracer, msg); + + /* Wait for tracee and assert that it exited */ + FORKEE_REQUIRE_SUCCESS( + wpid = TWAIT_GENERIC(tracee, &status, 0), tracee); + + forkee_status_exited(status, exitval_tracee); + printf("Tracee %d exited with %d\n", tracee, exitval_tracee); + + printf("Before exiting of the tracer process\n"); + _exit(exitval_tracer); + } + + printf("Wait for the tracer to attach to the tracee\n"); + PARENT_FROM_CHILD("tracer ready", parent_tracer, msg); + + printf("Resume the tracee and let it exit\n"); + PARENT_TO_CHILD("exit tracee", parent_tracee, msg); + + printf("Detect that tracee is zombie\n"); + await_zombie(tracee); + + + printf("Assert that there is no status about tracee %d - " + "Tracer must detect zombie first - calling %s()\n", tracee, + TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS( + wpid = TWAIT_GENERIC(tracee, &status, WNOHANG), 0); + + printf("Tell the tracer child should have exited\n"); + PARENT_TO_CHILD("wait for tracee exit", parent_tracer, msg); + printf("Wait for tracer to finish its job and exit - calling %s()\n", + TWAIT_FNAME); + + printf("Wait from tracer child to complete waiting for tracee\n"); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(tracer, &status, 0), + tracer); + + validate_status_exited(status, exitval_tracer); + + printf("Wait for tracee to finish its job and exit - calling %s()\n", + TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(tracee, &status, WNOHANG), + tracee); + + validate_status_exited(status, exitval_tracee); + + msg_close(&parent_tracer); + msg_close(&parent_tracee); +} +#endif + +#if defined(TWAIT_HAVE_PID) +ATF_TC(attach2); +ATF_TC_HEAD(attach2, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Assert that any tracer sees process termination before its " + "parent"); +} + +ATF_TC_BODY(attach2, tc) +{ + struct msg_fds parent_tracer, parent_tracee; + const int exitval_tracee = 5; + const int exitval_tracer1 = 10, exitval_tracer2 = 20; + pid_t tracee, tracer, wpid; + uint8_t msg = 0xde; /* dummy message for IPC based on pipe(2) */ +#if defined(TWAIT_HAVE_STATUS) + int status; +#endif + + printf("Spawn tracee\n"); + ATF_REQUIRE(msg_open(&parent_tracee) == 0); + tracee = atf_utils_fork(); + if (tracee == 0) { + /* Wait for message from the parent */ + CHILD_FROM_PARENT("Message 1", parent_tracee, msg); + _exit(exitval_tracee); + } + + printf("Spawn debugger\n"); + ATF_REQUIRE(msg_open(&parent_tracer) == 0); + tracer = atf_utils_fork(); + if (tracer == 0) { + /* Fork again and drop parent to reattach to PID 1 */ + tracer = atf_utils_fork(); + if (tracer != 0) + _exit(exitval_tracer1); + + printf("Before calling PT_ATTACH from tracee %d\n", getpid()); + FORKEE_ASSERT(ptrace(PT_ATTACH, tracee, NULL, 0) != -1); + + /* Wait for tracee and assert that it was stopped w/ SIGSTOP */ + FORKEE_REQUIRE_SUCCESS( + wpid = TWAIT_GENERIC(tracee, &status, 0), tracee); + + forkee_status_stopped(status, SIGSTOP); + + /* Resume tracee with PT_CONTINUE */ + FORKEE_ASSERT(ptrace(PT_CONTINUE, tracee, (void *)1, 0) != -1); + + /* Inform parent that tracer has attached to tracee */ + CHILD_TO_PARENT("Message 1", parent_tracer, msg); + CHILD_FROM_PARENT("Message 2", parent_tracer, msg); + + /* Wait for tracee and assert that it exited */ + FORKEE_REQUIRE_SUCCESS( + wpid = TWAIT_GENERIC(tracee, &status, 0), tracee); + + forkee_status_exited(status, exitval_tracee); + + printf("Before exiting of the tracer process\n"); + _exit(exitval_tracer2); + } + printf("Wait for the tracer process (direct child) to exit calling " + "%s()\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS( + wpid = TWAIT_GENERIC(tracer, &status, 0), tracer); + + validate_status_exited(status, exitval_tracer1); + + printf("Wait for the non-exited tracee process with %s()\n", + TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS( + wpid = TWAIT_GENERIC(tracee, NULL, WNOHANG), 0); + + printf("Wait for the tracer to attach to the tracee\n"); + PARENT_FROM_CHILD("Message 1", parent_tracer, msg); + printf("Resume the tracee and let it exit\n"); + PARENT_TO_CHILD("Message 1", parent_tracee, msg); + + printf("Detect that tracee is zombie\n"); + await_zombie(tracee); + + printf("Assert that there is no status about tracee - " + "Tracer must detect zombie first - calling %s()\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS( + wpid = TWAIT_GENERIC(tracee, &status, WNOHANG), 0); + + printf("Resume the tracer and let it detect exited tracee\n"); + PARENT_TO_CHILD("Message 2", parent_tracer, msg); + + printf("Wait for tracee to finish its job and exit - calling %s()\n", + TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(tracee, &status, WNOHANG), + tracee); + + validate_status_exited(status, exitval_tracee); + + msg_close(&parent_tracer); + msg_close(&parent_tracee); + +} +#endif + +ATF_TC(attach3); +ATF_TC_HEAD(attach3, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Assert that tracer parent can PT_ATTACH to its child"); +} + +ATF_TC_BODY(attach3, tc) +{ + struct msg_fds parent_tracee; + const int exitval_tracee = 5; + pid_t tracee, wpid; + uint8_t msg = 0xde; /* dummy message for IPC based on pipe(2) */ +#if defined(TWAIT_HAVE_STATUS) + int status; +#endif + + printf("Spawn tracee\n"); + ATF_REQUIRE(msg_open(&parent_tracee) == 0); + tracee = atf_utils_fork(); + if (tracee == 0) { + CHILD_FROM_PARENT("Message 1", parent_tracee, msg); + printf("Parent should now attach to tracee\n"); + + CHILD_FROM_PARENT("Message 2", parent_tracee, msg); + /* Wait for message from the parent */ + _exit(exitval_tracee); + } + PARENT_TO_CHILD("Message 1", parent_tracee, msg); + + printf("Before calling PT_ATTACH for tracee %d\n", tracee); + ATF_REQUIRE(ptrace(PT_ATTACH, tracee, NULL, 0) != -1); + + printf("Wait for the stopped tracee process with %s()\n", + TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS( + wpid = TWAIT_GENERIC(tracee, &status, 0), tracee); + + validate_status_stopped(status, SIGSTOP); + + printf("Resume tracee with PT_CONTINUE\n"); + ATF_REQUIRE(ptrace(PT_CONTINUE, tracee, (void *)1, 0) != -1); + + printf("Let the tracee exit now\n"); + PARENT_TO_CHILD("Message 2", parent_tracee, msg); + + printf("Wait for tracee to exit with %s()\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS( + wpid = TWAIT_GENERIC(tracee, &status, 0), tracee); + + validate_status_exited(status, exitval_tracee); + + printf("Before calling %s() for tracee\n", TWAIT_FNAME); + TWAIT_REQUIRE_FAILURE(ECHILD, + wpid = TWAIT_GENERIC(tracee, &status, 0)); + + msg_close(&parent_tracee); +} + +ATF_TC(attach4); +ATF_TC_HEAD(attach4, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Assert that tracer child can PT_ATTACH to its parent"); +} + +ATF_TC_BODY(attach4, tc) +{ + struct msg_fds parent_tracee; + const int exitval_tracer = 5; + pid_t tracer, wpid; + uint8_t msg = 0xde; /* dummy message for IPC based on pipe(2) */ +#if defined(TWAIT_HAVE_STATUS) + int status; +#endif + + printf("Spawn tracer\n"); + ATF_REQUIRE(msg_open(&parent_tracee) == 0); + tracer = atf_utils_fork(); + if (tracer == 0) { + + /* Wait for message from the parent */ + CHILD_FROM_PARENT("Message 1", parent_tracee, msg); + + printf("Attach to parent PID %d with PT_ATTACH from child\n", + getppid()); + FORKEE_ASSERT(ptrace(PT_ATTACH, getppid(), NULL, 0) != -1); + + printf("Wait for the stopped parent process with %s()\n", + TWAIT_FNAME); + FORKEE_REQUIRE_SUCCESS( + wpid = TWAIT_GENERIC(getppid(), &status, 0), getppid()); + + forkee_status_stopped(status, SIGSTOP); + + printf("Resume parent with PT_DETACH\n"); + FORKEE_ASSERT(ptrace(PT_DETACH, getppid(), (void *)1, 0) + != -1); + + /* Tell parent we are ready */ + CHILD_TO_PARENT("Message 1", parent_tracee, msg); + + _exit(exitval_tracer); + } + + printf("Wait for the tracer to become ready\n"); + PARENT_TO_CHILD("Message 1", parent_tracee, msg); + printf("Allow the tracer to exit now\n"); + PARENT_FROM_CHILD("Message 1", parent_tracee, msg); + + printf("Wait for tracer to exit with %s()\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS( + wpid = TWAIT_GENERIC(tracer, &status, 0), tracer); + + validate_status_exited(status, exitval_tracer); + + printf("Before calling %s() for tracer\n", TWAIT_FNAME); + TWAIT_REQUIRE_FAILURE(ECHILD, + wpid = TWAIT_GENERIC(tracer, &status, 0)); + + msg_close(&parent_tracee); +} + +#if defined(TWAIT_HAVE_PID) +ATF_TC(attach5); +ATF_TC_HEAD(attach5, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Assert that tracer sees its parent when attached to tracer " + "(check getppid(2))"); +} + +ATF_TC_BODY(attach5, tc) +{ + struct msg_fds parent_tracer, parent_tracee; + const int exitval_tracee = 5; + const int exitval_tracer = 10; + pid_t parent, tracee, tracer, wpid; + uint8_t msg = 0xde; /* dummy message for IPC based on pipe(2) */ +#if defined(TWAIT_HAVE_STATUS) + int status; +#endif + + printf("Spawn tracee\n"); + ATF_REQUIRE(msg_open(&parent_tracer) == 0); + ATF_REQUIRE(msg_open(&parent_tracee) == 0); + tracee = atf_utils_fork(); + if (tracee == 0) { + parent = getppid(); + + /* Emit message to the parent */ + CHILD_TO_PARENT("tracee ready", parent_tracee, msg); + CHILD_FROM_PARENT("exit tracee", parent_tracee, msg); + + FORKEE_ASSERT_EQ(parent, getppid()); + + _exit(exitval_tracee); + } + printf("Wait for child to record its parent identifier (pid)\n"); + PARENT_FROM_CHILD("tracee ready", parent_tracee, msg); + + printf("Spawn debugger\n"); + tracer = atf_utils_fork(); + if (tracer == 0) { + /* No IPC to communicate with the child */ + printf("Before calling PT_ATTACH from tracee %d\n", getpid()); + FORKEE_ASSERT(ptrace(PT_ATTACH, tracee, NULL, 0) != -1); + + /* Wait for tracee and assert that it was stopped w/ SIGSTOP */ + FORKEE_REQUIRE_SUCCESS( + wpid = TWAIT_GENERIC(tracee, &status, 0), tracee); + + forkee_status_stopped(status, SIGSTOP); + + /* Resume tracee with PT_CONTINUE */ + FORKEE_ASSERT(ptrace(PT_CONTINUE, tracee, (void *)1, 0) != -1); + + /* Inform parent that tracer has attached to tracee */ + CHILD_TO_PARENT("tracer ready", parent_tracer, msg); + + /* Wait for parent to tell use that tracee should have exited */ + CHILD_FROM_PARENT("wait for tracee exit", parent_tracer, msg); + + /* Wait for tracee and assert that it exited */ + FORKEE_REQUIRE_SUCCESS( + wpid = TWAIT_GENERIC(tracee, &status, 0), tracee); + + forkee_status_exited(status, exitval_tracee); + + printf("Before exiting of the tracer process\n"); + _exit(exitval_tracer); + } + + printf("Wait for the tracer to attach to the tracee\n"); + PARENT_FROM_CHILD("tracer ready", parent_tracer, msg); + + printf("Resume the tracee and let it exit\n"); + PARENT_TO_CHILD("exit tracee", parent_tracee, msg); + + printf("Detect that tracee is zombie\n"); + await_zombie(tracee); + + printf("Assert that there is no status about tracee - " + "Tracer must detect zombie first - calling %s()\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS( + wpid = TWAIT_GENERIC(tracee, &status, WNOHANG), 0); + + printf("Tell the tracer child should have exited\n"); + PARENT_TO_CHILD("wait for tracee exit", parent_tracer, msg); + + printf("Wait from tracer child to complete waiting for tracee\n"); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(tracer, &status, 0), + tracer); + + validate_status_exited(status, exitval_tracer); + + printf("Wait for tracee to finish its job and exit - calling %s()\n", + TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(tracee, &status, WNOHANG), + tracee); + + validate_status_exited(status, exitval_tracee); + + msg_close(&parent_tracer); + msg_close(&parent_tracee); +} +#endif + +#if defined(TWAIT_HAVE_PID) +ATF_TC(attach6); +ATF_TC_HEAD(attach6, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Assert that tracer sees its parent when attached to tracer " + "(check sysctl(7) and struct kinfo_proc2)"); +} + +ATF_TC_BODY(attach6, tc) +{ + struct msg_fds parent_tracee, parent_tracer; + const int exitval_tracee = 5; + const int exitval_tracer = 10; + pid_t parent, tracee, tracer, wpid; + uint8_t msg = 0xde; /* dummy message for IPC based on pipe(2) */ +#if defined(TWAIT_HAVE_STATUS) + int status; +#endif + int name[CTL_MAXNAME]; + struct kinfo_proc2 kp; + size_t len = sizeof(kp); + unsigned int namelen; + + printf("Spawn tracee\n"); + ATF_REQUIRE(msg_open(&parent_tracee) == 0); + ATF_REQUIRE(msg_open(&parent_tracer) == 0); + tracee = atf_utils_fork(); + if (tracee == 0) { + parent = getppid(); + + /* Emit message to the parent */ + CHILD_TO_PARENT("Message 1", parent_tracee, msg); + CHILD_FROM_PARENT("Message 2", parent_tracee, msg); + + namelen = 0; + name[namelen++] = CTL_KERN; + name[namelen++] = KERN_PROC2; + name[namelen++] = KERN_PROC_PID; + name[namelen++] = getpid(); + name[namelen++] = len; + name[namelen++] = 1; + + FORKEE_ASSERT(sysctl(name, namelen, &kp, &len, NULL, 0) == 0); + FORKEE_ASSERT_EQ(parent, kp.p_ppid); + + _exit(exitval_tracee); + } + + printf("Wait for child to record its parent identifier (pid)\n"); + PARENT_FROM_CHILD("Message 1", parent_tracee, msg); + + printf("Spawn debugger\n"); + tracer = atf_utils_fork(); + if (tracer == 0) { + /* No IPC to communicate with the child */ + printf("Before calling PT_ATTACH from tracee %d\n", getpid()); + FORKEE_ASSERT(ptrace(PT_ATTACH, tracee, NULL, 0) != -1); + + /* Wait for tracee and assert that it was stopped w/ SIGSTOP */ + FORKEE_REQUIRE_SUCCESS( + wpid = TWAIT_GENERIC(tracee, &status, 0), tracee); + + forkee_status_stopped(status, SIGSTOP); + + /* Resume tracee with PT_CONTINUE */ + FORKEE_ASSERT(ptrace(PT_CONTINUE, tracee, (void *)1, 0) != -1); + + /* Inform parent that tracer has attached to tracee */ + CHILD_TO_PARENT("Message 1", parent_tracer, msg); + + CHILD_FROM_PARENT("Message 2", parent_tracer, msg); + + /* Wait for tracee and assert that it exited */ + FORKEE_REQUIRE_SUCCESS( + wpid = TWAIT_GENERIC(tracee, &status, 0), tracee); + + forkee_status_exited(status, exitval_tracee); + + printf("Before exiting of the tracer process\n"); + _exit(exitval_tracer); + } + + printf("Wait for the tracer to attach to the tracee\n"); + PARENT_FROM_CHILD("Message 1", parent_tracer, msg); + + printf("Resume the tracee and let it exit\n"); + PARENT_TO_CHILD("Message 1", parent_tracee, msg); + + printf("Detect that tracee is zombie\n"); + await_zombie(tracee); + + printf("Assert that there is no status about tracee - " + "Tracer must detect zombie first - calling %s()\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS( + wpid = TWAIT_GENERIC(tracee, &status, WNOHANG), 0); + + printf("Resume the tracer and let it detect exited tracee\n"); + PARENT_TO_CHILD("Message 2", parent_tracer, msg); + + printf("Wait for tracer to finish its job and exit - calling %s()\n", + TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(tracer, &status, 0), + tracer); + + validate_status_exited(status, exitval_tracer); + + printf("Wait for tracee to finish its job and exit - calling %s()\n", + TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(tracee, &status, WNOHANG), + tracee); + + validate_status_exited(status, exitval_tracee); + + msg_close(&parent_tracee); + msg_close(&parent_tracer); +} +#endif + +#if defined(TWAIT_HAVE_PID) +ATF_TC(attach7); +ATF_TC_HEAD(attach7, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Assert that tracer sees its parent when attached to tracer " + "(check /proc/curproc/status 3rd column)"); +} + +ATF_TC_BODY(attach7, tc) +{ + struct msg_fds parent_tracee, parent_tracer; + int rv; + const int exitval_tracee = 5; + const int exitval_tracer = 10; + pid_t parent, tracee, tracer, wpid; + uint8_t msg = 0xde; /* dummy message for IPC based on pipe(2) */ +#if defined(TWAIT_HAVE_STATUS) + int status; +#endif + FILE *fp; + struct stat st; + const char *fname = "/proc/curproc/status"; + char s_executable[MAXPATHLEN]; + int s_pid, s_ppid; + /* + * Format: + * EXECUTABLE PID PPID ... + */ + + ATF_REQUIRE((rv = stat(fname, &st)) == 0 || (errno == ENOENT)); + if (rv != 0) { + atf_tc_skip("/proc/curproc/status not found"); + } + + printf("Spawn tracee\n"); + ATF_REQUIRE(msg_open(&parent_tracee) == 0); + ATF_REQUIRE(msg_open(&parent_tracer) == 0); + tracee = atf_utils_fork(); + if (tracee == 0) { + parent = getppid(); + + // Wait for parent to let us exit + CHILD_TO_PARENT("tracee ready", parent_tracee, msg); + CHILD_FROM_PARENT("tracee exit", parent_tracee, msg); + + FORKEE_ASSERT((fp = fopen(fname, "r")) != NULL); + fscanf(fp, "%s %d %d", s_executable, &s_pid, &s_ppid); + FORKEE_ASSERT(fclose(fp) == 0); + FORKEE_ASSERT_EQ(parent, s_ppid); + + _exit(exitval_tracee); + } + + printf("Wait for child to record its parent identifier (pid)\n"); + PARENT_FROM_CHILD("tracee ready", parent_tracee, msg); + + printf("Spawn debugger\n"); + tracer = atf_utils_fork(); + if (tracer == 0) { + printf("Before calling PT_ATTACH from tracee %d\n", getpid()); + FORKEE_ASSERT(ptrace(PT_ATTACH, tracee, NULL, 0) != -1); + + /* Wait for tracee and assert that it was stopped w/ SIGSTOP */ + FORKEE_REQUIRE_SUCCESS( + wpid = TWAIT_GENERIC(tracee, &status, 0), tracee); + + forkee_status_stopped(status, SIGSTOP); + + /* Resume tracee with PT_CONTINUE */ + FORKEE_ASSERT(ptrace(PT_CONTINUE, tracee, (void *)1, 0) != -1); + + /* Inform parent that tracer has attached to tracee */ + CHILD_TO_PARENT("tracer ready", parent_tracer, msg); + + /* Wait for parent to tell use that tracee should have exited */ + CHILD_FROM_PARENT("wait for tracee exit", parent_tracer, msg); + + /* Wait for tracee and assert that it exited */ + FORKEE_REQUIRE_SUCCESS( + wpid = TWAIT_GENERIC(tracee, &status, 0), tracee); + + forkee_status_exited(status, exitval_tracee); + + printf("Before exiting of the tracer process\n"); + _exit(exitval_tracer); + } + printf("Wait for the tracer to attach to the tracee\n"); + PARENT_FROM_CHILD("tracer ready", parent_tracer, msg); + printf("Resume the tracee and let it exit\n"); + PARENT_TO_CHILD("tracee exit", parent_tracee, msg); + + printf("Detect that tracee is zombie\n"); + await_zombie(tracee); + + printf("Assert that there is no status about tracee - " + "Tracer must detect zombie first - calling %s()\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS( + wpid = TWAIT_GENERIC(tracee, &status, WNOHANG), 0); + + printf("Resume the tracer and let it detect exited tracee\n"); + PARENT_TO_CHILD("Message 2", parent_tracer, msg); + + printf("Wait for tracer to finish its job and exit - calling %s()\n", + TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(tracer, &status, 0), + tracer); + + validate_status_exited(status, exitval_tracer); + + printf("Wait for tracee to finish its job and exit - calling %s()\n", + TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(tracee, &status, WNOHANG), + tracee); + + validate_status_exited(status, exitval_tracee); + + msg_close(&parent_tracee); + msg_close(&parent_tracer); +} +#endif + +ATF_TC(eventmask1); +ATF_TC_HEAD(eventmask1, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Verify that empty EVENT_MASK is preserved"); +} + +ATF_TC_BODY(eventmask1, tc) +{ + const int exitval = 5; + const int sigval = SIGSTOP; + pid_t child, wpid; +#if defined(TWAIT_HAVE_STATUS) + int status; +#endif + ptrace_event_t set_event, get_event; + const int len = sizeof(ptrace_event_t); + + printf("Before forking process PID=%d\n", getpid()); + ATF_REQUIRE((child = fork()) != -1); + if (child == 0) { + printf("Before calling PT_TRACE_ME from child %d\n", getpid()); + FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1); + + printf("Before raising %s from child\n", strsignal(sigval)); + FORKEE_ASSERT(raise(sigval) == 0); + + printf("Before exiting of the child process\n"); + _exit(exitval); + } + printf("Parent process PID=%d, child's PID=%d\n", getpid(), child); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_stopped(status, sigval); + + set_event.pe_set_event = 0; + ATF_REQUIRE(ptrace(PT_SET_EVENT_MASK, child, &set_event, len) != -1); + ATF_REQUIRE(ptrace(PT_GET_EVENT_MASK, child, &get_event, len) != -1); + ATF_REQUIRE(memcmp(&set_event, &get_event, len) == 0); + + printf("Before resuming the child process where it left off and " + "without signal to be sent\n"); + ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_exited(status, exitval); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0)); +} + +ATF_TC(eventmask2); +ATF_TC_HEAD(eventmask2, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Verify that PTRACE_FORK in EVENT_MASK is preserved"); +} + +ATF_TC_BODY(eventmask2, tc) +{ + const int exitval = 5; + const int sigval = SIGSTOP; + pid_t child, wpid; +#if defined(TWAIT_HAVE_STATUS) + int status; +#endif + ptrace_event_t set_event, get_event; + const int len = sizeof(ptrace_event_t); + + printf("Before forking process PID=%d\n", getpid()); + ATF_REQUIRE((child = fork()) != -1); + if (child == 0) { + printf("Before calling PT_TRACE_ME from child %d\n", getpid()); + FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1); + + printf("Before raising %s from child\n", strsignal(sigval)); + FORKEE_ASSERT(raise(sigval) == 0); + + printf("Before exiting of the child process\n"); + _exit(exitval); + } + printf("Parent process PID=%d, child's PID=%d\n", getpid(), child); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_stopped(status, sigval); + + set_event.pe_set_event = PTRACE_FORK; + ATF_REQUIRE(ptrace(PT_SET_EVENT_MASK, child, &set_event, len) != -1); + ATF_REQUIRE(ptrace(PT_GET_EVENT_MASK, child, &get_event, len) != -1); + ATF_REQUIRE(memcmp(&set_event, &get_event, len) == 0); + + printf("Before resuming the child process where it left off and " + "without signal to be sent\n"); + ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_exited(status, exitval); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0)); +} + +#if defined(TWAIT_HAVE_PID) +ATF_TC(fork1); +ATF_TC_HEAD(fork1, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Verify that fork(2) is intercepted by ptrace(2) with EVENT_MASK " + "set to PTRACE_FORK"); +} + +ATF_TC_BODY(fork1, tc) +{ + const int exitval = 5; + const int exitval2 = 15; + const int sigval = SIGSTOP; + pid_t child, child2, wpid; +#if defined(TWAIT_HAVE_STATUS) + int status; +#endif + ptrace_state_t state; + const int slen = sizeof(state); + ptrace_event_t event; + const int elen = sizeof(event); + + printf("Before forking process PID=%d\n", getpid()); + ATF_REQUIRE((child = fork()) != -1); + if (child == 0) { + printf("Before calling PT_TRACE_ME from child %d\n", getpid()); + FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1); + + printf("Before raising %s from child\n", strsignal(sigval)); + FORKEE_ASSERT(raise(sigval) == 0); + + FORKEE_ASSERT((child2 = fork()) != 1); + + if (child2 == 0) + _exit(exitval2); + + FORKEE_REQUIRE_SUCCESS + (wpid = TWAIT_GENERIC(child2, &status, 0), child2); + + forkee_status_exited(status, exitval2); + + printf("Before exiting of the child process\n"); + _exit(exitval); + } + printf("Parent process PID=%d, child's PID=%d\n", getpid(), child); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_stopped(status, sigval); + + printf("Enable PTRACE_FORK in EVENT_MASK for the child %d\n", child); + event.pe_set_event = PTRACE_FORK; + ATF_REQUIRE(ptrace(PT_SET_EVENT_MASK, child, &event, elen) != -1); + + printf("Before resuming the child process where it left off and " + "without signal to be sent\n"); + ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1); + + printf("Before calling %s() for the child %d\n", TWAIT_FNAME, child); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_stopped(status, SIGTRAP); + + ATF_REQUIRE(ptrace(PT_GET_PROCESS_STATE, child, &state, slen) != -1); + ATF_REQUIRE_EQ(state.pe_report_event, PTRACE_FORK); + + child2 = state.pe_other_pid; + printf("Reported PTRACE_FORK event with forkee %d\n", child2); + + printf("Before calling %s() for the forkee %d of the child %d\n", + TWAIT_FNAME, child2, child); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child2, &status, 0), + child2); + + validate_status_stopped(status, SIGTRAP); + + ATF_REQUIRE(ptrace(PT_GET_PROCESS_STATE, child2, &state, slen) != -1); + ATF_REQUIRE_EQ(state.pe_report_event, PTRACE_FORK); + ATF_REQUIRE_EQ(state.pe_other_pid, child); + + printf("Before resuming the forkee process where it left off and " + "without signal to be sent\n"); + ATF_REQUIRE(ptrace(PT_CONTINUE, child2, (void *)1, 0) != -1); + + printf("Before resuming the child process where it left off and " + "without signal to be sent\n"); + ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1); + + printf("Before calling %s() for the forkee - expected exited\n", + TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child2, &status, 0), + child2); + + validate_status_exited(status, exitval2); + + printf("Before calling %s() for the forkee - expected no process\n", + TWAIT_FNAME); + TWAIT_REQUIRE_FAILURE(ECHILD, + wpid = TWAIT_GENERIC(child2, &status, 0)); + + printf("Before calling %s() for the child - expected stopped " + "SIGCHLD\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_stopped(status, SIGCHLD); + + printf("Before resuming the child process where it left off and " + "without signal to be sent\n"); + ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1); + + printf("Before calling %s() for the child - expected exited\n", + TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_exited(status, exitval); + + printf("Before calling %s() for the child - expected no process\n", + TWAIT_FNAME); + TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0)); +} +#endif + +ATF_TC(fork2); +ATF_TC_HEAD(fork2, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Verify that fork(2) is not intercepted by ptrace(2) with empty " + "EVENT_MASK"); +} + +ATF_TC_BODY(fork2, tc) +{ + const int exitval = 5; + const int exitval2 = 15; + const int sigval = SIGSTOP; + pid_t child, child2, wpid; +#if defined(TWAIT_HAVE_STATUS) + int status; +#endif + ptrace_event_t event; + const int elen = sizeof(event); + + printf("Before forking process PID=%d\n", getpid()); + ATF_REQUIRE((child = fork()) != -1); + if (child == 0) { + printf("Before calling PT_TRACE_ME from child %d\n", getpid()); + FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1); + + printf("Before raising %s from child\n", strsignal(sigval)); + FORKEE_ASSERT(raise(sigval) == 0); + + FORKEE_ASSERT((child2 = fork()) != 1); + + if (child2 == 0) + _exit(exitval2); + + FORKEE_REQUIRE_SUCCESS + (wpid = TWAIT_GENERIC(child2, &status, 0), child2); + + forkee_status_exited(status, exitval2); + + printf("Before exiting of the child process\n"); + _exit(exitval); + } + printf("Parent process PID=%d, child's PID=%d\n", getpid(), child); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_stopped(status, sigval); + + printf("Set empty EVENT_MASK for the child %d\n", child); + event.pe_set_event = 0; + ATF_REQUIRE(ptrace(PT_SET_EVENT_MASK, child, &event, elen) != -1); + + printf("Before resuming the child process where it left off and " + "without signal to be sent\n"); + ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1); + + printf("Before calling %s() for the child - expected stopped " + "SIGCHLD\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_stopped(status, SIGCHLD); + + printf("Before resuming the child process where it left off and " + "without signal to be sent\n"); + ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1); + + printf("Before calling %s() for the child - expected exited\n", + TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_exited(status, exitval); + + printf("Before calling %s() for the child - expected no process\n", + TWAIT_FNAME); + TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0)); +} + +#if defined(TWAIT_HAVE_PID) +ATF_TC(vfork1); +ATF_TC_HEAD(vfork1, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Verify that vfork(2) is intercepted by ptrace(2) with EVENT_MASK " + "set to PTRACE_VFORK"); +} + +ATF_TC_BODY(vfork1, tc) +{ + const int exitval = 5; + const int exitval2 = 15; + const int sigval = SIGSTOP; + pid_t child, child2, wpid; +#if defined(TWAIT_HAVE_STATUS) + int status; +#endif + ptrace_state_t state; + const int slen = sizeof(state); + ptrace_event_t event; + const int elen = sizeof(event); + + /* + * ptrace(2) command PT_SET_EVENT_MASK: option PTRACE_VFORK unsupported + */ +#ifndef PTRACE_VFORK +#define PTRACE_VFORK 0 +#endif + atf_tc_expect_fail("PR kern/51630"); + + printf("Before forking process PID=%d\n", getpid()); + ATF_REQUIRE((child = fork()) != -1); + if (child == 0) { + printf("Before calling PT_TRACE_ME from child %d\n", getpid()); + FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1); + + printf("Before raising %s from child\n", strsignal(sigval)); + FORKEE_ASSERT(raise(sigval) == 0); + + FORKEE_ASSERT((child2 = vfork()) != 1); + + if (child2 == 0) + _exit(exitval2); + + FORKEE_REQUIRE_SUCCESS + (wpid = TWAIT_GENERIC(child2, &status, 0), child2); + + forkee_status_exited(status, exitval2); + + printf("Before exiting of the child process\n"); + _exit(exitval); + } + printf("Parent process PID=%d, child's PID=%d\n", getpid(), child); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_stopped(status, sigval); + + printf("Enable PTRACE_VFORK in EVENT_MASK for the child %d\n", child); + event.pe_set_event = PTRACE_VFORK; + ATF_REQUIRE(ptrace(PT_SET_EVENT_MASK, child, &event, elen) != -1); + + printf("Before resuming the child process where it left off and " + "without signal to be sent\n"); + ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1); + + printf("Before calling %s() for the child %d\n", TWAIT_FNAME, child); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_stopped(status, SIGTRAP); + + ATF_REQUIRE(ptrace(PT_GET_PROCESS_STATE, child, &state, slen) != -1); + ATF_REQUIRE_EQ(state.pe_report_event, PTRACE_VFORK); + + child2 = state.pe_other_pid; + printf("Reported PTRACE_VFORK event with forkee %d\n", child2); + + printf("Before calling %s() for the forkee %d of the child %d\n", + TWAIT_FNAME, child2, child); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child2, &status, 0), + child2); + + validate_status_stopped(status, SIGTRAP); + + ATF_REQUIRE(ptrace(PT_GET_PROCESS_STATE, child2, &state, slen) != -1); + ATF_REQUIRE_EQ(state.pe_report_event, PTRACE_VFORK); + ATF_REQUIRE_EQ(state.pe_other_pid, child); + + printf("Before resuming the forkee process where it left off and " + "without signal to be sent\n"); + ATF_REQUIRE(ptrace(PT_CONTINUE, child2, (void *)1, 0) != -1); + + printf("Before resuming the child process where it left off and " + "without signal to be sent\n"); + ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1); + + printf("Before calling %s() for the forkee - expected exited\n", + TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child2, &status, 0), + child2); + + validate_status_exited(status, exitval2); + + printf("Before calling %s() for the forkee - expected no process\n", + TWAIT_FNAME); + TWAIT_REQUIRE_FAILURE(ECHILD, + wpid = TWAIT_GENERIC(child2, &status, 0)); + + printf("Before calling %s() for the child - expected stopped " + "SIGCHLD\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_stopped(status, SIGCHLD); + + printf("Before resuming the child process where it left off and " + "without signal to be sent\n"); + ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1); + + printf("Before calling %s() for the child - expected exited\n", + TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_exited(status, exitval); + + printf("Before calling %s() for the child - expected no process\n", + TWAIT_FNAME); + TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0)); +} +#endif + +ATF_TC(vfork2); +ATF_TC_HEAD(vfork2, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Verify that vfork(2) is not intercepted by ptrace(2) with empty " + "EVENT_MASK"); +} + +ATF_TC_BODY(vfork2, tc) +{ + const int exitval = 5; + const int exitval2 = 15; + const int sigval = SIGSTOP; + pid_t child, child2, wpid; +#if defined(TWAIT_HAVE_STATUS) + int status; +#endif + ptrace_event_t event; + const int elen = sizeof(event); + + printf("Before forking process PID=%d\n", getpid()); + ATF_REQUIRE((child = fork()) != -1); + if (child == 0) { + printf("Before calling PT_TRACE_ME from child %d\n", getpid()); + FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1); + + printf("Before raising %s from child\n", strsignal(sigval)); + FORKEE_ASSERT(raise(sigval) == 0); + + FORKEE_ASSERT((child2 = vfork()) != 1); + + if (child2 == 0) + _exit(exitval2); + + FORKEE_REQUIRE_SUCCESS + (wpid = TWAIT_GENERIC(child2, &status, 0), child2); + + forkee_status_exited(status, exitval2); + + printf("Before exiting of the child process\n"); + _exit(exitval); + } + printf("Parent process PID=%d, child's PID=%d\n", getpid(), child); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_stopped(status, sigval); + + printf("Set empty EVENT_MASK for the child %d\n", child); + event.pe_set_event = 0; + ATF_REQUIRE(ptrace(PT_SET_EVENT_MASK, child, &event, elen) != -1); + + printf("Before resuming the child process where it left off and " + "without signal to be sent\n"); + ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1); + + printf("Before calling %s() for the child - expected stopped " + "SIGCHLD\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_stopped(status, SIGCHLD); + + printf("Before resuming the child process where it left off and " + "without signal to be sent\n"); + ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1); + + printf("Before calling %s() for the child - expected exited\n", + TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_exited(status, exitval); + + printf("Before calling %s() for the child - expected no process\n", + TWAIT_FNAME); + TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0)); +} + +ATF_TC(io_read_d1); +ATF_TC_HEAD(io_read_d1, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Verify PT_IO with PIOD_READ_D and len = sizeof(uint8_t)"); +} + +ATF_TC_BODY(io_read_d1, tc) +{ + const int exitval = 5; + const int sigval = SIGSTOP; + pid_t child, wpid; + uint8_t lookup_me = 0; + const uint8_t magic = 0xab; + struct ptrace_io_desc io = { + .piod_op = PIOD_READ_D, + .piod_offs = &lookup_me, + .piod_addr = &lookup_me, + .piod_len = sizeof(lookup_me) + }; +#if defined(TWAIT_HAVE_STATUS) + int status; +#endif + + printf("Before forking process PID=%d\n", getpid()); + ATF_REQUIRE((child = fork()) != -1); + if (child == 0) { + printf("Before calling PT_TRACE_ME from child %d\n", getpid()); + FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1); + + lookup_me = magic; + + printf("Before raising %s from child\n", strsignal(sigval)); + FORKEE_ASSERT(raise(sigval) == 0); + + printf("Before exiting of the child process\n"); + _exit(exitval); + } + printf("Parent process PID=%d, child's PID=%d\n", getpid(), child); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_stopped(status, sigval); + + printf("Read lookup_me from tracee (PID=%d) by tracer (PID=%d)\n", + child, getpid()); + ATF_REQUIRE(ptrace(PT_IO, child, &io, 0) != -1); + + ATF_REQUIRE_EQ_MSG(lookup_me, magic, + "got value %" PRIx8 " != expected %" PRIx8, lookup_me, magic); + + printf("Before resuming the child process where it left off and " + "without signal to be sent\n"); + ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_exited(status, exitval); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0)); +} + +ATF_TC(io_read_d2); +ATF_TC_HEAD(io_read_d2, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Verify PT_IO with PIOD_READ_D and len = sizeof(uint16_t)"); +} + +ATF_TC_BODY(io_read_d2, tc) +{ + const int exitval = 5; + const int sigval = SIGSTOP; + pid_t child, wpid; + uint16_t lookup_me = 0; + const uint16_t magic = 0x1234; + struct ptrace_io_desc io = { + .piod_op = PIOD_READ_D, + .piod_offs = &lookup_me, + .piod_addr = &lookup_me, + .piod_len = sizeof(lookup_me) + }; +#if defined(TWAIT_HAVE_STATUS) + int status; +#endif + + printf("Before forking process PID=%d\n", getpid()); + ATF_REQUIRE((child = fork()) != -1); + if (child == 0) { + printf("Before calling PT_TRACE_ME from child %d\n", getpid()); + FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1); + + lookup_me = magic; + + printf("Before raising %s from child\n", strsignal(sigval)); + FORKEE_ASSERT(raise(sigval) == 0); + + printf("Before exiting of the child process\n"); + _exit(exitval); + } + printf("Parent process PID=%d, child's PID=%d\n", getpid(), child); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_stopped(status, sigval); + + printf("Read lookup_me from tracee (PID=%d) by tracer (PID=%d)\n", + child, getpid()); + ATF_REQUIRE(ptrace(PT_IO, child, &io, 0) != -1); + + ATF_REQUIRE_EQ_MSG(lookup_me, magic, + "got value %" PRIx16 " != expected %" PRIx16, lookup_me, magic); + + printf("Before resuming the child process where it left off and " + "without signal to be sent\n"); + ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_exited(status, exitval); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0)); +} + +ATF_TC(io_read_d3); +ATF_TC_HEAD(io_read_d3, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Verify PT_IO with PIOD_READ_D and len = sizeof(uint32_t)"); +} + +ATF_TC_BODY(io_read_d3, tc) +{ + const int exitval = 5; + const int sigval = SIGSTOP; + pid_t child, wpid; + uint32_t lookup_me = 0; + const uint32_t magic = 0x1234abcd; + struct ptrace_io_desc io = { + .piod_op = PIOD_READ_D, + .piod_offs = &lookup_me, + .piod_addr = &lookup_me, + .piod_len = sizeof(lookup_me) + }; +#if defined(TWAIT_HAVE_STATUS) + int status; +#endif + + printf("Before forking process PID=%d\n", getpid()); + ATF_REQUIRE((child = fork()) != -1); + if (child == 0) { + printf("Before calling PT_TRACE_ME from child %d\n", getpid()); + FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1); + + lookup_me = magic; + + printf("Before raising %s from child\n", strsignal(sigval)); + FORKEE_ASSERT(raise(sigval) == 0); + + printf("Before exiting of the child process\n"); + _exit(exitval); + } + printf("Parent process PID=%d, child's PID=%d\n", getpid(), child); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_stopped(status, sigval); + + printf("Read lookup_me from tracee (PID=%d) by tracer (PID=%d)\n", + child, getpid()); + ATF_REQUIRE(ptrace(PT_IO, child, &io, 0) != -1); + + ATF_REQUIRE_EQ_MSG(lookup_me, magic, + "got value %" PRIx32 " != expected %" PRIx32, lookup_me, magic); + + printf("Before resuming the child process where it left off and " + "without signal to be sent\n"); + ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_exited(status, exitval); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0)); +} + +ATF_TC(io_read_d4); +ATF_TC_HEAD(io_read_d4, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Verify PT_IO with PIOD_READ_D and len = sizeof(uint64_t)"); +} + +ATF_TC_BODY(io_read_d4, tc) +{ + const int exitval = 5; + const int sigval = SIGSTOP; + pid_t child, wpid; + uint64_t lookup_me = 0; + const uint64_t magic = 0x1234abcd9876dcfa; + struct ptrace_io_desc io = { + .piod_op = PIOD_READ_D, + .piod_offs = &lookup_me, + .piod_addr = &lookup_me, + .piod_len = sizeof(lookup_me) + }; +#if defined(TWAIT_HAVE_STATUS) + int status; +#endif + + printf("Before forking process PID=%d\n", getpid()); + ATF_REQUIRE((child = fork()) != -1); + if (child == 0) { + printf("Before calling PT_TRACE_ME from child %d\n", getpid()); + FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1); + + lookup_me = magic; + + printf("Before raising %s from child\n", strsignal(sigval)); + FORKEE_ASSERT(raise(sigval) == 0); + + printf("Before exiting of the child process\n"); + _exit(exitval); + } + printf("Parent process PID=%d, child's PID=%d\n", getpid(), child); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_stopped(status, sigval); + + printf("Read lookup_me from tracee (PID=%d) by tracer (PID=%d)\n", + child, getpid()); + ATF_REQUIRE(ptrace(PT_IO, child, &io, 0) != -1); + + ATF_REQUIRE_EQ_MSG(lookup_me, magic, + "got value %" PRIx64 " != expected %" PRIx64, lookup_me, magic); + + printf("Before resuming the child process where it left off and " + "without signal to be sent\n"); + ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_exited(status, exitval); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0)); +} + +ATF_TC(io_write_d1); +ATF_TC_HEAD(io_write_d1, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Verify PT_IO with PIOD_WRITE_D and len = sizeof(uint8_t)"); +} + +ATF_TC_BODY(io_write_d1, tc) +{ + const int exitval = 5; + const int sigval = SIGSTOP; + pid_t child, wpid; + uint8_t lookup_me = 0; + const uint8_t magic = 0xab; + struct ptrace_io_desc io = { + .piod_op = PIOD_WRITE_D, + .piod_offs = &lookup_me, + .piod_addr = &lookup_me, + .piod_len = sizeof(lookup_me) + }; +#if defined(TWAIT_HAVE_STATUS) + int status; +#endif + + printf("Before forking process PID=%d\n", getpid()); + ATF_REQUIRE((child = fork()) != -1); + if (child == 0) { + printf("Before calling PT_TRACE_ME from child %d\n", getpid()); + FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1); + + printf("Before raising %s from child\n", strsignal(sigval)); + FORKEE_ASSERT(raise(sigval) == 0); + + FORKEE_ASSERT_EQ(lookup_me, magic); + + printf("Before exiting of the child process\n"); + _exit(exitval); + } + printf("Parent process PID=%d, child's PID=%d\n", getpid(), child); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_stopped(status, sigval); + + lookup_me = magic; + + printf("Write new lookup_me to tracee (PID=%d) from tracer (PID=%d)\n", + child, getpid()); + ATF_REQUIRE(ptrace(PT_IO, child, &io, 0) != -1); + + printf("Before resuming the child process where it left off and " + "without signal to be sent\n"); + ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_exited(status, exitval); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0)); +} + +ATF_TC(io_write_d2); +ATF_TC_HEAD(io_write_d2, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Verify PT_IO with PIOD_WRITE_D and len = sizeof(uint16_t)"); +} + +ATF_TC_BODY(io_write_d2, tc) +{ + const int exitval = 5; + const int sigval = SIGSTOP; + pid_t child, wpid; + uint16_t lookup_me = 0; + const uint16_t magic = 0xab12; + struct ptrace_io_desc io = { + .piod_op = PIOD_WRITE_D, + .piod_offs = &lookup_me, + .piod_addr = &lookup_me, + .piod_len = sizeof(lookup_me) + }; +#if defined(TWAIT_HAVE_STATUS) + int status; +#endif + + printf("Before forking process PID=%d\n", getpid()); + ATF_REQUIRE((child = fork()) != -1); + if (child == 0) { + printf("Before calling PT_TRACE_ME from child %d\n", getpid()); + FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1); + + printf("Before raising %s from child\n", strsignal(sigval)); + FORKEE_ASSERT(raise(sigval) == 0); + + FORKEE_ASSERT_EQ(lookup_me, magic); + + printf("Before exiting of the child process\n"); + _exit(exitval); + } + printf("Parent process PID=%d, child's PID=%d\n", getpid(), child); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_stopped(status, sigval); + + lookup_me = magic; + + printf("Write new lookup_me to tracee (PID=%d) from tracer (PID=%d)\n", + child, getpid()); + ATF_REQUIRE(ptrace(PT_IO, child, &io, 0) != -1); + + printf("Before resuming the child process where it left off and " + "without signal to be sent\n"); + ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_exited(status, exitval); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0)); +} + +ATF_TC(io_write_d3); +ATF_TC_HEAD(io_write_d3, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Verify PT_IO with PIOD_WRITE_D and len = sizeof(uint32_t)"); +} + +ATF_TC_BODY(io_write_d3, tc) +{ + const int exitval = 5; + const int sigval = SIGSTOP; + pid_t child, wpid; + uint32_t lookup_me = 0; + const uint32_t magic = 0xab127643; + struct ptrace_io_desc io = { + .piod_op = PIOD_WRITE_D, + .piod_offs = &lookup_me, + .piod_addr = &lookup_me, + .piod_len = sizeof(lookup_me) + }; +#if defined(TWAIT_HAVE_STATUS) + int status; +#endif + + printf("Before forking process PID=%d\n", getpid()); + ATF_REQUIRE((child = fork()) != -1); + if (child == 0) { + printf("Before calling PT_TRACE_ME from child %d\n", getpid()); + FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1); + + printf("Before raising %s from child\n", strsignal(sigval)); + FORKEE_ASSERT(raise(sigval) == 0); + + FORKEE_ASSERT_EQ(lookup_me, magic); + + printf("Before exiting of the child process\n"); + _exit(exitval); + } + printf("Parent process PID=%d, child's PID=%d\n", getpid(), child); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_stopped(status, sigval); + + lookup_me = magic; + + printf("Write new lookup_me to tracee (PID=%d) from tracer (PID=%d)\n", + child, getpid()); + ATF_REQUIRE(ptrace(PT_IO, child, &io, 0) != -1); + + printf("Before resuming the child process where it left off and " + "without signal to be sent\n"); + ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_exited(status, exitval); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0)); +} + +ATF_TC(io_write_d4); +ATF_TC_HEAD(io_write_d4, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Verify PT_IO with PIOD_WRITE_D and len = sizeof(uint64_t)"); +} + +ATF_TC_BODY(io_write_d4, tc) +{ + const int exitval = 5; + const int sigval = SIGSTOP; + pid_t child, wpid; + uint64_t lookup_me = 0; + const uint64_t magic = 0xab12764376490123; + struct ptrace_io_desc io = { + .piod_op = PIOD_WRITE_D, + .piod_offs = &lookup_me, + .piod_addr = &lookup_me, + .piod_len = sizeof(lookup_me) + }; +#if defined(TWAIT_HAVE_STATUS) + int status; +#endif + + printf("Before forking process PID=%d\n", getpid()); + ATF_REQUIRE((child = fork()) != -1); + if (child == 0) { + printf("Before calling PT_TRACE_ME from child %d\n", getpid()); + FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1); + + printf("Before raising %s from child\n", strsignal(sigval)); + FORKEE_ASSERT(raise(sigval) == 0); + + FORKEE_ASSERT_EQ(lookup_me, magic); + + printf("Before exiting of the child process\n"); + _exit(exitval); + } + printf("Parent process PID=%d, child's PID=%d\n", getpid(), child); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_stopped(status, sigval); + + lookup_me = magic; + + printf("Write new lookup_me to tracee (PID=%d) from tracer (PID=%d)\n", + child, getpid()); + ATF_REQUIRE(ptrace(PT_IO, child, &io, 0) != -1); + + printf("Before resuming the child process where it left off and " + "without signal to be sent\n"); + ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_exited(status, exitval); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0)); +} + +ATF_TC(read_d1); +ATF_TC_HEAD(read_d1, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Verify PT_READ_D called once"); +} + +ATF_TC_BODY(read_d1, tc) +{ + const int exitval = 5; + const int sigval = SIGSTOP; + pid_t child, wpid; + int lookup_me = 0; + const int magic = (int)random(); +#if defined(TWAIT_HAVE_STATUS) + int status; +#endif + + printf("Before forking process PID=%d\n", getpid()); + ATF_REQUIRE((child = fork()) != -1); + if (child == 0) { + printf("Before calling PT_TRACE_ME from child %d\n", getpid()); + FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1); + + lookup_me = magic; + + printf("Before raising %s from child\n", strsignal(sigval)); + FORKEE_ASSERT(raise(sigval) == 0); + + printf("Before exiting of the child process\n"); + _exit(exitval); + } + printf("Parent process PID=%d, child's PID=%d\n", getpid(), child); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_stopped(status, sigval); + + printf("Read new lookup_me from tracee (PID=%d) by tracer (PID=%d)\n", + child, getpid()); + errno = 0; + lookup_me = ptrace(PT_READ_D, child, &lookup_me, 0); + ATF_REQUIRE_EQ(errno, 0); + + ATF_REQUIRE_EQ_MSG(lookup_me, magic, + "got value %#x != expected %#x", lookup_me, magic); + + printf("Before resuming the child process where it left off and " + "without signal to be sent\n"); + ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_exited(status, exitval); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0)); +} + +ATF_TC(read_d2); +ATF_TC_HEAD(read_d2, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Verify PT_READ_D called twice"); +} + +ATF_TC_BODY(read_d2, tc) +{ + const int exitval = 5; + const int sigval = SIGSTOP; + pid_t child, wpid; + int lookup_me1 = 0; + int lookup_me2 = 0; + const int magic1 = (int)random(); + const int magic2 = (int)random(); +#if defined(TWAIT_HAVE_STATUS) + int status; +#endif + + printf("Before forking process PID=%d\n", getpid()); + ATF_REQUIRE((child = fork()) != -1); + if (child == 0) { + printf("Before calling PT_TRACE_ME from child %d\n", getpid()); + FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1); + + lookup_me1 = magic1; + lookup_me2 = magic2; + + printf("Before raising %s from child\n", strsignal(sigval)); + FORKEE_ASSERT(raise(sigval) == 0); + + printf("Before exiting of the child process\n"); + _exit(exitval); + } + printf("Parent process PID=%d, child's PID=%d\n", getpid(), child); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_stopped(status, sigval); + + printf("Read new lookup_me1 from tracee (PID=%d) by tracer (PID=%d)\n", + child, getpid()); + errno = 0; + lookup_me1 = ptrace(PT_READ_D, child, &lookup_me1, 0); + ATF_REQUIRE_EQ(errno, 0); + + ATF_REQUIRE_EQ_MSG(lookup_me1, magic1, + "got value %#x != expected %#x", lookup_me1, magic1); + + printf("Read new lookup_me2 from tracee (PID=%d) by tracer (PID=%d)\n", + child, getpid()); + errno = 0; + lookup_me2 = ptrace(PT_READ_D, child, &lookup_me2, 0); + ATF_REQUIRE_EQ(errno, 0); + + ATF_REQUIRE_EQ_MSG(lookup_me2, magic2, + "got value %#x != expected %#x", lookup_me2, magic2); + + printf("Before resuming the child process where it left off and " + "without signal to be sent\n"); + ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_exited(status, exitval); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0)); +} + +ATF_TC(read_d3); +ATF_TC_HEAD(read_d3, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Verify PT_READ_D called three times"); +} + +ATF_TC_BODY(read_d3, tc) +{ + const int exitval = 5; + const int sigval = SIGSTOP; + pid_t child, wpid; + int lookup_me1 = 0; + int lookup_me2 = 0; + int lookup_me3 = 0; + const int magic1 = (int)random(); + const int magic2 = (int)random(); + const int magic3 = (int)random(); +#if defined(TWAIT_HAVE_STATUS) + int status; +#endif + + printf("Before forking process PID=%d\n", getpid()); + ATF_REQUIRE((child = fork()) != -1); + if (child == 0) { + printf("Before calling PT_TRACE_ME from child %d\n", getpid()); + FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1); + + lookup_me1 = magic1; + lookup_me2 = magic2; + lookup_me3 = magic3; + + printf("Before raising %s from child\n", strsignal(sigval)); + FORKEE_ASSERT(raise(sigval) == 0); + + printf("Before exiting of the child process\n"); + _exit(exitval); + } + printf("Parent process PID=%d, child's PID=%d\n", getpid(), child); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_stopped(status, sigval); + + printf("Read new lookup_me1 from tracee (PID=%d) by tracer (PID=%d)\n", + child, getpid()); + errno = 0; + lookup_me1 = ptrace(PT_READ_D, child, &lookup_me1, 0); + ATF_REQUIRE_EQ(errno, 0); + + ATF_REQUIRE_EQ_MSG(lookup_me1, magic1, + "got value %#x != expected %#x", lookup_me1, magic1); + + printf("Read new lookup_me2 from tracee (PID=%d) by tracer (PID=%d)\n", + child, getpid()); + errno = 0; + lookup_me2 = ptrace(PT_READ_D, child, &lookup_me2, 0); + ATF_REQUIRE_EQ(errno, 0); + + ATF_REQUIRE_EQ_MSG(lookup_me2, magic2, + "got value %#x != expected %#x", lookup_me2, magic2); + + printf("Read new lookup_me3 from tracee (PID=%d) by tracer (PID=%d)\n", + child, getpid()); + errno = 0; + lookup_me3 = ptrace(PT_READ_D, child, &lookup_me3, 0); + ATF_REQUIRE_EQ(errno, 0); + + ATF_REQUIRE_EQ_MSG(lookup_me3, magic3, + "got value %#x != expected %#x", lookup_me3, magic3); + + printf("Before resuming the child process where it left off and " + "without signal to be sent\n"); + ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_exited(status, exitval); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0)); +} + +ATF_TC(read_d4); +ATF_TC_HEAD(read_d4, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Verify PT_READ_D called four times"); +} + +ATF_TC_BODY(read_d4, tc) +{ + const int exitval = 5; + const int sigval = SIGSTOP; + pid_t child, wpid; + int lookup_me1 = 0; + int lookup_me2 = 0; + int lookup_me3 = 0; + int lookup_me4 = 0; + const int magic1 = (int)random(); + const int magic2 = (int)random(); + const int magic3 = (int)random(); + const int magic4 = (int)random(); +#if defined(TWAIT_HAVE_STATUS) + int status; +#endif + + printf("Before forking process PID=%d\n", getpid()); + ATF_REQUIRE((child = fork()) != -1); + if (child == 0) { + printf("Before calling PT_TRACE_ME from child %d\n", getpid()); + FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1); + + lookup_me1 = magic1; + lookup_me2 = magic2; + lookup_me3 = magic3; + lookup_me4 = magic4; + + printf("Before raising %s from child\n", strsignal(sigval)); + FORKEE_ASSERT(raise(sigval) == 0); + + printf("Before exiting of the child process\n"); + _exit(exitval); + } + printf("Parent process PID=%d, child's PID=%d\n", getpid(), child); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_stopped(status, sigval); + + printf("Read new lookup_me1 from tracee (PID=%d) by tracer (PID=%d)\n", + child, getpid()); + errno = 0; + lookup_me1 = ptrace(PT_READ_D, child, &lookup_me1, 0); + ATF_REQUIRE_EQ(errno, 0); + + ATF_REQUIRE_EQ_MSG(lookup_me1, magic1, + "got value %#x != expected %#x", lookup_me1, magic1); + + printf("Read new lookup_me2 from tracee (PID=%d) by tracer (PID=%d)\n", + child, getpid()); + errno = 0; + lookup_me2 = ptrace(PT_READ_D, child, &lookup_me2, 0); + ATF_REQUIRE_EQ(errno, 0); + + ATF_REQUIRE_EQ_MSG(lookup_me2, magic2, + "got value %#x != expected %#x", lookup_me2, magic2); + + printf("Read new lookup_me3 from tracee (PID=%d) by tracer (PID=%d)\n", + child, getpid()); + errno = 0; + lookup_me3 = ptrace(PT_READ_D, child, &lookup_me3, 0); + ATF_REQUIRE_EQ(errno, 0); + + ATF_REQUIRE_EQ_MSG(lookup_me3, magic3, + "got value %#x != expected %#x", lookup_me3, magic3); + + printf("Read new lookup_me4 from tracee (PID=%d) by tracer (PID=%d)\n", + child, getpid()); + errno = 0; + lookup_me4 = ptrace(PT_READ_D, child, &lookup_me4, 0); + ATF_REQUIRE_EQ(errno, 0); + + ATF_REQUIRE_EQ_MSG(lookup_me4, magic4, + "got value %#x != expected %#x", lookup_me4, magic4); + + printf("Before resuming the child process where it left off and " + "without signal to be sent\n"); + ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_exited(status, exitval); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0)); +} + +ATF_TC(write_d1); +ATF_TC_HEAD(write_d1, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Verify PT_WRITE_D called once"); +} + +ATF_TC_BODY(write_d1, tc) +{ + const int exitval = 5; + const int sigval = SIGSTOP; + pid_t child, wpid; + int lookup_me = 0; + const int magic = (int)random(); +#if defined(TWAIT_HAVE_STATUS) + int status; +#endif + + printf("Before forking process PID=%d\n", getpid()); + ATF_REQUIRE((child = fork()) != -1); + if (child == 0) { + printf("Before calling PT_TRACE_ME from child %d\n", getpid()); + FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1); + + printf("Before raising %s from child\n", strsignal(sigval)); + FORKEE_ASSERT(raise(sigval) == 0); + + FORKEE_ASSERT_EQ(lookup_me, magic); + + printf("Before exiting of the child process\n"); + _exit(exitval); + } + printf("Parent process PID=%d, child's PID=%d\n", getpid(), child); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_stopped(status, sigval); + + printf("Write new lookup_me to tracee (PID=%d) from tracer (PID=%d)\n", + child, getpid()); + ATF_REQUIRE(ptrace(PT_WRITE_D, child, &lookup_me, magic) != -1); + + printf("Before resuming the child process where it left off and " + "without signal to be sent\n"); + ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_exited(status, exitval); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0)); +} + +ATF_TC(write_d2); +ATF_TC_HEAD(write_d2, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Verify PT_WRITE_D called twice"); +} + +ATF_TC_BODY(write_d2, tc) +{ + const int exitval = 5; + const int sigval = SIGSTOP; + pid_t child, wpid; + int lookup_me1 = 0; + int lookup_me2 = 0; + const int magic1 = (int)random(); + const int magic2 = (int)random(); +#if defined(TWAIT_HAVE_STATUS) + int status; +#endif + + printf("Before forking process PID=%d\n", getpid()); + ATF_REQUIRE((child = fork()) != -1); + if (child == 0) { + printf("Before calling PT_TRACE_ME from child %d\n", getpid()); + FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1); + + printf("Before raising %s from child\n", strsignal(sigval)); + FORKEE_ASSERT(raise(sigval) == 0); + + FORKEE_ASSERT_EQ(lookup_me1, magic1); + FORKEE_ASSERT_EQ(lookup_me2, magic2); + + printf("Before exiting of the child process\n"); + _exit(exitval); + } + printf("Parent process PID=%d, child's PID=%d\n", getpid(), child); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_stopped(status, sigval); + + printf("Write new lookup_me1 to tracee (PID=%d) from tracer (PID=%d)\n", + child, getpid()); + ATF_REQUIRE(ptrace(PT_WRITE_D, child, &lookup_me1, magic1) != -1); + + printf("Write new lookup_me2 to tracee (PID=%d) from tracer (PID=%d)\n", + child, getpid()); + ATF_REQUIRE(ptrace(PT_WRITE_D, child, &lookup_me2, magic2) != -1); + + printf("Before resuming the child process where it left off and " + "without signal to be sent\n"); + ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_exited(status, exitval); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0)); +} + +ATF_TC(write_d3); +ATF_TC_HEAD(write_d3, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Verify PT_WRITE_D called three times"); +} + +ATF_TC_BODY(write_d3, tc) +{ + const int exitval = 5; + const int sigval = SIGSTOP; + pid_t child, wpid; + int lookup_me1 = 0; + int lookup_me2 = 0; + int lookup_me3 = 0; + const int magic1 = (int)random(); + const int magic2 = (int)random(); + const int magic3 = (int)random(); +#if defined(TWAIT_HAVE_STATUS) + int status; +#endif + + printf("Before forking process PID=%d\n", getpid()); + ATF_REQUIRE((child = fork()) != -1); + if (child == 0) { + printf("Before calling PT_TRACE_ME from child %d\n", getpid()); + FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1); + + printf("Before raising %s from child\n", strsignal(sigval)); + FORKEE_ASSERT(raise(sigval) == 0); + + FORKEE_ASSERT_EQ(lookup_me1, magic1); + FORKEE_ASSERT_EQ(lookup_me2, magic2); + FORKEE_ASSERT_EQ(lookup_me3, magic3); + + printf("Before exiting of the child process\n"); + _exit(exitval); + } + printf("Parent process PID=%d, child's PID=%d\n", getpid(), child); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_stopped(status, sigval); + + printf("Write new lookup_me1 to tracee (PID=%d) from tracer (PID=%d)\n", + child, getpid()); + ATF_REQUIRE(ptrace(PT_WRITE_D, child, &lookup_me1, magic1) != -1); + + printf("Write new lookup_me2 to tracee (PID=%d) from tracer (PID=%d)\n", + child, getpid()); + ATF_REQUIRE(ptrace(PT_WRITE_D, child, &lookup_me2, magic2) != -1); + + printf("Write new lookup_me3 to tracee (PID=%d) from tracer (PID=%d)\n", + child, getpid()); + ATF_REQUIRE(ptrace(PT_WRITE_D, child, &lookup_me3, magic3) != -1); + + printf("Before resuming the child process where it left off and " + "without signal to be sent\n"); + ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_exited(status, exitval); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0)); +} + +ATF_TC(write_d4); +ATF_TC_HEAD(write_d4, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Verify PT_WRITE_D called four times"); +} + +ATF_TC_BODY(write_d4, tc) +{ + const int exitval = 5; + const int sigval = SIGSTOP; + pid_t child, wpid; + int lookup_me1 = 0; + int lookup_me2 = 0; + int lookup_me3 = 0; + int lookup_me4 = 0; + const int magic1 = (int)random(); + const int magic2 = (int)random(); + const int magic3 = (int)random(); + const int magic4 = (int)random(); +#if defined(TWAIT_HAVE_STATUS) + int status; +#endif + + printf("Before forking process PID=%d\n", getpid()); + ATF_REQUIRE((child = fork()) != -1); + if (child == 0) { + printf("Before calling PT_TRACE_ME from child %d\n", getpid()); + FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1); + + printf("Before raising %s from child\n", strsignal(sigval)); + FORKEE_ASSERT(raise(sigval) == 0); + + FORKEE_ASSERT_EQ(lookup_me1, magic1); + FORKEE_ASSERT_EQ(lookup_me2, magic2); + FORKEE_ASSERT_EQ(lookup_me3, magic3); + FORKEE_ASSERT_EQ(lookup_me4, magic4); + + printf("Before exiting of the child process\n"); + _exit(exitval); + } + printf("Parent process PID=%d, child's PID=%d\n", getpid(), child); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_stopped(status, sigval); + + printf("Write new lookup_me1 to tracee (PID=%d) from tracer (PID=%d)\n", + child, getpid()); + ATF_REQUIRE(ptrace(PT_WRITE_D, child, &lookup_me1, magic1) != -1); + + printf("Write new lookup_me2 to tracee (PID=%d) from tracer (PID=%d)\n", + child, getpid()); + ATF_REQUIRE(ptrace(PT_WRITE_D, child, &lookup_me2, magic2) != -1); + + printf("Write new lookup_me3 to tracee (PID=%d) from tracer (PID=%d)\n", + child, getpid()); + ATF_REQUIRE(ptrace(PT_WRITE_D, child, &lookup_me3, magic3) != -1); + + printf("Write new lookup_me4 to tracee (PID=%d) from tracer (PID=%d)\n", + child, getpid()); + ATF_REQUIRE(ptrace(PT_WRITE_D, child, &lookup_me4, magic4) != -1); + + printf("Before resuming the child process where it left off and " + "without signal to be sent\n"); + ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_exited(status, exitval); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0)); +} + +ATF_TC(io_read_d_write_d_handshake1); +ATF_TC_HEAD(io_read_d_write_d_handshake1, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Verify PT_IO with PIOD_READ_D and PIOD_WRITE_D handshake"); +} + +ATF_TC_BODY(io_read_d_write_d_handshake1, tc) +{ + const int exitval = 5; + const int sigval = SIGSTOP; + pid_t child, wpid; + uint8_t lookup_me_fromtracee = 0; + const uint8_t magic_fromtracee = (uint8_t)random(); + uint8_t lookup_me_totracee = 0; + const uint8_t magic_totracee = (uint8_t)random(); + struct ptrace_io_desc io_fromtracee = { + .piod_op = PIOD_READ_D, + .piod_offs = &lookup_me_fromtracee, + .piod_addr = &lookup_me_fromtracee, + .piod_len = sizeof(lookup_me_fromtracee) + }; + struct ptrace_io_desc io_totracee = { + .piod_op = PIOD_WRITE_D, + .piod_offs = &lookup_me_totracee, + .piod_addr = &lookup_me_totracee, + .piod_len = sizeof(lookup_me_totracee) + }; +#if defined(TWAIT_HAVE_STATUS) + int status; +#endif + + printf("Before forking process PID=%d\n", getpid()); + ATF_REQUIRE((child = fork()) != -1); + if (child == 0) { + printf("Before calling PT_TRACE_ME from child %d\n", getpid()); + FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1); + + lookup_me_fromtracee = magic_fromtracee; + + printf("Before raising %s from child\n", strsignal(sigval)); + FORKEE_ASSERT(raise(sigval) == 0); + + FORKEE_ASSERT_EQ(lookup_me_totracee, magic_totracee); + + printf("Before exiting of the child process\n"); + _exit(exitval); + } + printf("Parent process PID=%d, child's PID=%d\n", getpid(), child); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_stopped(status, sigval); + + printf("Read lookup_me_fromtracee PID=%d by tracer (PID=%d)\n", + child, getpid()); + ATF_REQUIRE(ptrace(PT_IO, child, &io_fromtracee, 0) != -1); + + ATF_REQUIRE_EQ_MSG(lookup_me_fromtracee, magic_fromtracee, + "got value %" PRIx8 " != expected %" PRIx8, lookup_me_fromtracee, + magic_fromtracee); + + lookup_me_totracee = magic_totracee; + + printf("Write lookup_me_totracee to PID=%d by tracer (PID=%d)\n", + child, getpid()); + ATF_REQUIRE(ptrace(PT_IO, child, &io_totracee, 0) != -1); + + ATF_REQUIRE_EQ_MSG(lookup_me_totracee, magic_totracee, + "got value %" PRIx8 " != expected %" PRIx8, lookup_me_totracee, + magic_totracee); + + printf("Before resuming the child process where it left off and " + "without signal to be sent\n"); + ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_exited(status, exitval); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0)); +} + +ATF_TC(io_read_d_write_d_handshake2); +ATF_TC_HEAD(io_read_d_write_d_handshake2, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Verify PT_IO with PIOD_WRITE_D and PIOD_READ_D handshake"); +} + +ATF_TC_BODY(io_read_d_write_d_handshake2, tc) +{ + const int exitval = 5; + const int sigval = SIGSTOP; + pid_t child, wpid; + uint8_t lookup_me_fromtracee = 0; + const uint8_t magic_fromtracee = (uint8_t)random(); + uint8_t lookup_me_totracee = 0; + const uint8_t magic_totracee = (uint8_t)random(); + struct ptrace_io_desc io_fromtracee = { + .piod_op = PIOD_READ_D, + .piod_offs = &lookup_me_fromtracee, + .piod_addr = &lookup_me_fromtracee, + .piod_len = sizeof(lookup_me_fromtracee) + }; + struct ptrace_io_desc io_totracee = { + .piod_op = PIOD_WRITE_D, + .piod_offs = &lookup_me_totracee, + .piod_addr = &lookup_me_totracee, + .piod_len = sizeof(lookup_me_totracee) + }; +#if defined(TWAIT_HAVE_STATUS) + int status; +#endif + + printf("Before forking process PID=%d\n", getpid()); + ATF_REQUIRE((child = fork()) != -1); + if (child == 0) { + printf("Before calling PT_TRACE_ME from child %d\n", getpid()); + FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1); + + lookup_me_fromtracee = magic_fromtracee; + + printf("Before raising %s from child\n", strsignal(sigval)); + FORKEE_ASSERT(raise(sigval) == 0); + + FORKEE_ASSERT_EQ(lookup_me_totracee, magic_totracee); + + printf("Before exiting of the child process\n"); + _exit(exitval); + } + printf("Parent process PID=%d, child's PID=%d\n", getpid(), child); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_stopped(status, sigval); + + lookup_me_totracee = magic_totracee; + + printf("Write lookup_me_totracee to PID=%d by tracer (PID=%d)\n", + child, getpid()); + ATF_REQUIRE(ptrace(PT_IO, child, &io_totracee, 0) != -1); + + ATF_REQUIRE_EQ_MSG(lookup_me_totracee, magic_totracee, + "got value %" PRIx8 " != expected %" PRIx8, lookup_me_totracee, + magic_totracee); + + printf("Read lookup_me_fromtracee PID=%d by tracer (PID=%d)\n", + child, getpid()); + ATF_REQUIRE(ptrace(PT_IO, child, &io_fromtracee, 0) != -1); + + ATF_REQUIRE_EQ_MSG(lookup_me_fromtracee, magic_fromtracee, + "got value %" PRIx8 " != expected %" PRIx8, lookup_me_fromtracee, + magic_fromtracee); + + printf("Before resuming the child process where it left off and " + "without signal to be sent\n"); + ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_exited(status, exitval); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0)); +} + +ATF_TC(read_d_write_d_handshake1); +ATF_TC_HEAD(read_d_write_d_handshake1, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Verify PT_READ_D with PT_WRITE_D handshake"); +} + +ATF_TC_BODY(read_d_write_d_handshake1, tc) +{ + const int exitval = 5; + const int sigval = SIGSTOP; + pid_t child, wpid; + int lookup_me_fromtracee = 0; + const int magic_fromtracee = (int)random(); + int lookup_me_totracee = 0; + const int magic_totracee = (int)random(); +#if defined(TWAIT_HAVE_STATUS) + int status; +#endif + + printf("Before forking process PID=%d\n", getpid()); + ATF_REQUIRE((child = fork()) != -1); + if (child == 0) { + printf("Before calling PT_TRACE_ME from child %d\n", getpid()); + FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1); + + lookup_me_fromtracee = magic_fromtracee; + + printf("Before raising %s from child\n", strsignal(sigval)); + FORKEE_ASSERT(raise(sigval) == 0); + + FORKEE_ASSERT_EQ(lookup_me_totracee, magic_totracee); + + printf("Before exiting of the child process\n"); + _exit(exitval); + } + printf("Parent process PID=%d, child's PID=%d\n", getpid(), child); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_stopped(status, sigval); + + printf("Read new lookup_me_fromtracee PID=%d by tracer (PID=%d)\n", + child, getpid()); + errno = 0; + lookup_me_fromtracee = + ptrace(PT_READ_D, child, &lookup_me_fromtracee, 0); + ATF_REQUIRE_EQ(errno, 0); + + ATF_REQUIRE_EQ_MSG(lookup_me_fromtracee, magic_fromtracee, + "got value %#x != expected %#x", lookup_me_fromtracee, + magic_fromtracee); + + printf("Write new lookup_me_totracee to PID=%d from tracer (PID=%d)\n", + child, getpid()); + ATF_REQUIRE + (ptrace(PT_WRITE_D, child, &lookup_me_totracee, magic_totracee) + != -1); + + printf("Before resuming the child process where it left off and " + "without signal to be sent\n"); + ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_exited(status, exitval); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0)); +} + +ATF_TC(read_d_write_d_handshake2); +ATF_TC_HEAD(read_d_write_d_handshake2, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Verify PT_WRITE_D with PT_READ_D handshake"); +} + +ATF_TC_BODY(read_d_write_d_handshake2, tc) +{ + const int exitval = 5; + const int sigval = SIGSTOP; + pid_t child, wpid; + int lookup_me_fromtracee = 0; + const int magic_fromtracee = (int)random(); + int lookup_me_totracee = 0; + const int magic_totracee = (int)random(); +#if defined(TWAIT_HAVE_STATUS) + int status; +#endif + + printf("Before forking process PID=%d\n", getpid()); + ATF_REQUIRE((child = fork()) != -1); + if (child == 0) { + printf("Before calling PT_TRACE_ME from child %d\n", getpid()); + FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1); + + lookup_me_fromtracee = magic_fromtracee; + + printf("Before raising %s from child\n", strsignal(sigval)); + FORKEE_ASSERT(raise(sigval) == 0); + + FORKEE_ASSERT_EQ(lookup_me_totracee, magic_totracee); + + printf("Before exiting of the child process\n"); + _exit(exitval); + } + printf("Parent process PID=%d, child's PID=%d\n", getpid(), child); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_stopped(status, sigval); + + printf("Write new lookup_me_totracee to PID=%d from tracer (PID=%d)\n", + child, getpid()); + ATF_REQUIRE + (ptrace(PT_WRITE_D, child, &lookup_me_totracee, magic_totracee) + != -1); + + printf("Read new lookup_me_fromtracee PID=%d by tracer (PID=%d)\n", + child, getpid()); + errno = 0; + lookup_me_fromtracee = + ptrace(PT_READ_D, child, &lookup_me_fromtracee, 0); + ATF_REQUIRE_EQ(errno, 0); + + ATF_REQUIRE_EQ_MSG(lookup_me_fromtracee, magic_fromtracee, + "got value %#x != expected %#x", lookup_me_fromtracee, + magic_fromtracee); + + printf("Before resuming the child process where it left off and " + "without signal to be sent\n"); + ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_exited(status, exitval); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0)); +} + +/* These dummy functions are used to be copied with ptrace(2) calls */ +static int __used +dummy_fn1(int a, int b, int c, int d) +{ + + a *= 1; + b += 2; + c -= 3; + d /= 4; + + return a + b * c - d; +} + +static int __used +dummy_fn2(int a, int b, int c, int d) +{ + + a *= 4; + b += 3; + c -= 2; + d /= 1; + + return a + b * c - d; +} + +static int __used +dummy_fn3(int a, int b, int c, int d) +{ + + a *= 10; + b += 20; + c -= 30; + d /= 40; + + return a + b * c - d; +} + +static int __used +dummy_fn4(int a, int b, int c, int d) +{ + + a *= 40; + b += 30; + c -= 20; + d /= 10; + + return a + b * c - d; +} + +ATF_TC(io_read_i1); +ATF_TC_HEAD(io_read_i1, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Verify PT_IO with PIOD_READ_I and len = sizeof(uint8_t)"); +} + +ATF_TC_BODY(io_read_i1, tc) +{ + const int exitval = 5; + const int sigval = SIGSTOP; + pid_t child, wpid; + uint8_t lookup_me = 0; + uint8_t magic; + memcpy(&magic, dummy_fn1, sizeof(magic)); + struct ptrace_io_desc io = { + .piod_op = PIOD_READ_I, + .piod_offs = dummy_fn1, + .piod_addr = &lookup_me, + .piod_len = sizeof(lookup_me) + }; +#if defined(TWAIT_HAVE_STATUS) + int status; +#endif + + printf("Before forking process PID=%d\n", getpid()); + ATF_REQUIRE((child = fork()) != -1); + if (child == 0) { + printf("Before calling PT_TRACE_ME from child %d\n", getpid()); + FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1); + + printf("Before raising %s from child\n", strsignal(sigval)); + FORKEE_ASSERT(raise(sigval) == 0); + + printf("Before exiting of the child process\n"); + _exit(exitval); + } + printf("Parent process PID=%d, child's PID=%d\n", getpid(), child); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_stopped(status, sigval); + + printf("Read lookup_me from tracee (PID=%d) by tracer (PID=%d)\n", + child, getpid()); + ATF_REQUIRE(ptrace(PT_IO, child, &io, 0) != -1); + + ATF_REQUIRE_EQ_MSG(lookup_me, magic, + "got value %" PRIx8 " != expected %" PRIx8, lookup_me, magic); + + printf("Before resuming the child process where it left off and " + "without signal to be sent\n"); + ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_exited(status, exitval); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0)); +} + +ATF_TC(io_read_i2); +ATF_TC_HEAD(io_read_i2, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Verify PT_IO with PIOD_READ_I and len = sizeof(uint16_t)"); +} + +ATF_TC_BODY(io_read_i2, tc) +{ + const int exitval = 5; + const int sigval = SIGSTOP; + pid_t child, wpid; + uint16_t lookup_me = 0; + uint16_t magic; + memcpy(&magic, dummy_fn1, sizeof(magic)); + struct ptrace_io_desc io = { + .piod_op = PIOD_READ_I, + .piod_offs = dummy_fn1, + .piod_addr = &lookup_me, + .piod_len = sizeof(lookup_me) + }; +#if defined(TWAIT_HAVE_STATUS) + int status; +#endif + + printf("Before forking process PID=%d\n", getpid()); + ATF_REQUIRE((child = fork()) != -1); + if (child == 0) { + printf("Before calling PT_TRACE_ME from child %d\n", getpid()); + FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1); + + printf("Before raising %s from child\n", strsignal(sigval)); + FORKEE_ASSERT(raise(sigval) == 0); + + printf("Before exiting of the child process\n"); + _exit(exitval); + } + printf("Parent process PID=%d, child's PID=%d\n", getpid(), child); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_stopped(status, sigval); + + printf("Read lookup_me from tracee (PID=%d) by tracer (PID=%d)\n", + child, getpid()); + ATF_REQUIRE(ptrace(PT_IO, child, &io, 0) != -1); + + ATF_REQUIRE_EQ_MSG(lookup_me, magic, + "got value %" PRIx16 " != expected %" PRIx16, lookup_me, magic); + + printf("Before resuming the child process where it left off and " + "without signal to be sent\n"); + ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_exited(status, exitval); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0)); +} + +ATF_TC(io_read_i3); +ATF_TC_HEAD(io_read_i3, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Verify PT_IO with PIOD_READ_I and len = sizeof(uint32_t)"); +} + +ATF_TC_BODY(io_read_i3, tc) +{ + const int exitval = 5; + const int sigval = SIGSTOP; + pid_t child, wpid; + uint32_t lookup_me = 0; + uint32_t magic; + memcpy(&magic, dummy_fn1, sizeof(magic)); + struct ptrace_io_desc io = { + .piod_op = PIOD_READ_I, + .piod_offs = dummy_fn1, + .piod_addr = &lookup_me, + .piod_len = sizeof(lookup_me) + }; +#if defined(TWAIT_HAVE_STATUS) + int status; +#endif + + printf("Before forking process PID=%d\n", getpid()); + ATF_REQUIRE((child = fork()) != -1); + if (child == 0) { + printf("Before calling PT_TRACE_ME from child %d\n", getpid()); + FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1); + + printf("Before raising %s from child\n", strsignal(sigval)); + FORKEE_ASSERT(raise(sigval) == 0); + + printf("Before exiting of the child process\n"); + _exit(exitval); + } + printf("Parent process PID=%d, child's PID=%d\n", getpid(), child); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_stopped(status, sigval); + + printf("Read lookup_me from tracee (PID=%d) by tracer (PID=%d)\n", + child, getpid()); + ATF_REQUIRE(ptrace(PT_IO, child, &io, 0) != -1); + + ATF_REQUIRE_EQ_MSG(lookup_me, magic, + "got value %" PRIx32 " != expected %" PRIx32, lookup_me, magic); + + printf("Before resuming the child process where it left off and " + "without signal to be sent\n"); + ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_exited(status, exitval); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0)); +} + +ATF_TC(io_read_i4); +ATF_TC_HEAD(io_read_i4, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Verify PT_IO with PIOD_READ_I and len = sizeof(uint64_t)"); +} + +ATF_TC_BODY(io_read_i4, tc) +{ + const int exitval = 5; + const int sigval = SIGSTOP; + pid_t child, wpid; + uint64_t lookup_me = 0; + uint64_t magic; + memcpy(&magic, dummy_fn1, sizeof(magic)); + struct ptrace_io_desc io = { + .piod_op = PIOD_READ_I, + .piod_offs = dummy_fn1, + .piod_addr = &lookup_me, + .piod_len = sizeof(lookup_me) + }; +#if defined(TWAIT_HAVE_STATUS) + int status; +#endif + + printf("Before forking process PID=%d\n", getpid()); + ATF_REQUIRE((child = fork()) != -1); + if (child == 0) { + printf("Before calling PT_TRACE_ME from child %d\n", getpid()); + FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1); + + printf("Before raising %s from child\n", strsignal(sigval)); + FORKEE_ASSERT(raise(sigval) == 0); + + printf("Before exiting of the child process\n"); + _exit(exitval); + } + printf("Parent process PID=%d, child's PID=%d\n", getpid(), child); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_stopped(status, sigval); + + printf("Read lookup_me from tracee (PID=%d) by tracer (PID=%d)\n", + child, getpid()); + ATF_REQUIRE(ptrace(PT_IO, child, &io, 0) != -1); + + ATF_REQUIRE_EQ_MSG(lookup_me, magic, + "got value %" PRIx64 " != expected %" PRIx64, lookup_me, magic); + + printf("Before resuming the child process where it left off and " + "without signal to be sent\n"); + ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_exited(status, exitval); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0)); +} + +ATF_TC(read_i1); +ATF_TC_HEAD(read_i1, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Verify PT_READ_I called once"); +} + +ATF_TC_BODY(read_i1, tc) +{ + const int exitval = 5; + const int sigval = SIGSTOP; + pid_t child, wpid; + int lookup_me = 0; + int magic; + memcpy(&magic, dummy_fn1, sizeof(magic)); +#if defined(TWAIT_HAVE_STATUS) + int status; +#endif + + printf("Before forking process PID=%d\n", getpid()); + ATF_REQUIRE((child = fork()) != -1); + if (child == 0) { + printf("Before calling PT_TRACE_ME from child %d\n", getpid()); + FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1); + + printf("Before raising %s from child\n", strsignal(sigval)); + FORKEE_ASSERT(raise(sigval) == 0); + + printf("Before exiting of the child process\n"); + _exit(exitval); + } + printf("Parent process PID=%d, child's PID=%d\n", getpid(), child); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_stopped(status, sigval); + + printf("Read new lookup_me from tracee (PID=%d) by tracer (PID=%d)\n", + child, getpid()); + errno = 0; + lookup_me = ptrace(PT_READ_I, child, dummy_fn1, 0); + ATF_REQUIRE_EQ(errno, 0); + + ATF_REQUIRE_EQ_MSG(lookup_me, magic, + "got value %#x != expected %#x", lookup_me, magic); + + printf("Before resuming the child process where it left off and " + "without signal to be sent\n"); + ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_exited(status, exitval); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0)); +} + +ATF_TC(read_i2); +ATF_TC_HEAD(read_i2, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Verify PT_READ_I called twice"); +} + +ATF_TC_BODY(read_i2, tc) +{ + const int exitval = 5; + const int sigval = SIGSTOP; + pid_t child, wpid; + int lookup_me1 = 0; + int lookup_me2 = 0; + int magic1; + int magic2; + memcpy(&magic1, dummy_fn1, sizeof(magic1)); + memcpy(&magic2, dummy_fn2, sizeof(magic2)); +#if defined(TWAIT_HAVE_STATUS) + int status; +#endif + + printf("Before forking process PID=%d\n", getpid()); + ATF_REQUIRE((child = fork()) != -1); + if (child == 0) { + printf("Before calling PT_TRACE_ME from child %d\n", getpid()); + FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1); + + printf("Before raising %s from child\n", strsignal(sigval)); + FORKEE_ASSERT(raise(sigval) == 0); + + printf("Before exiting of the child process\n"); + _exit(exitval); + } + printf("Parent process PID=%d, child's PID=%d\n", getpid(), child); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_stopped(status, sigval); + + printf("Read new lookup_me1 from tracee (PID=%d) by tracer (PID=%d)\n", + child, getpid()); + errno = 0; + lookup_me1 = ptrace(PT_READ_I, child, dummy_fn1, 0); + ATF_REQUIRE_EQ(errno, 0); + + ATF_REQUIRE_EQ_MSG(lookup_me1, magic1, + "got value %#x != expected %#x", lookup_me1, magic1); + + printf("Read new lookup_me2 from tracee (PID=%d) by tracer (PID=%d)\n", + child, getpid()); + errno = 0; + lookup_me2 = ptrace(PT_READ_I, child, dummy_fn2, 0); + ATF_REQUIRE_EQ(errno, 0); + + ATF_REQUIRE_EQ_MSG(lookup_me2, magic2, + "got value %#x != expected %#x", lookup_me2, magic2); + + printf("Before resuming the child process where it left off and " + "without signal to be sent\n"); + ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_exited(status, exitval); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0)); +} + +ATF_TC(read_i3); +ATF_TC_HEAD(read_i3, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Verify PT_READ_I called three times"); +} + +ATF_TC_BODY(read_i3, tc) +{ + const int exitval = 5; + const int sigval = SIGSTOP; + pid_t child, wpid; + int lookup_me1 = 0; + int lookup_me2 = 0; + int lookup_me3 = 0; + int magic1; + int magic2; + int magic3; + memcpy(&magic1, dummy_fn1, sizeof(magic1)); + memcpy(&magic2, dummy_fn2, sizeof(magic2)); + memcpy(&magic3, dummy_fn3, sizeof(magic3)); +#if defined(TWAIT_HAVE_STATUS) + int status; +#endif + + printf("Before forking process PID=%d\n", getpid()); + ATF_REQUIRE((child = fork()) != -1); + if (child == 0) { + printf("Before calling PT_TRACE_ME from child %d\n", getpid()); + FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1); + + printf("Before raising %s from child\n", strsignal(sigval)); + FORKEE_ASSERT(raise(sigval) == 0); + + printf("Before exiting of the child process\n"); + _exit(exitval); + } + printf("Parent process PID=%d, child's PID=%d\n", getpid(), child); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_stopped(status, sigval); + + printf("Read new lookup_me1 from tracee (PID=%d) by tracer (PID=%d)\n", + child, getpid()); + errno = 0; + lookup_me1 = ptrace(PT_READ_I, child, dummy_fn1, 0); + ATF_REQUIRE_EQ(errno, 0); + + ATF_REQUIRE_EQ_MSG(lookup_me1, magic1, + "got value %#x != expected %#x", lookup_me1, magic1); + + printf("Read new lookup_me2 from tracee (PID=%d) by tracer (PID=%d)\n", + child, getpid()); + errno = 0; + lookup_me2 = ptrace(PT_READ_I, child, dummy_fn2, 0); + ATF_REQUIRE_EQ(errno, 0); + + ATF_REQUIRE_EQ_MSG(lookup_me2, magic2, + "got value %#x != expected %#x", lookup_me2, magic2); + + printf("Read new lookup_me3 from tracee (PID=%d) by tracer (PID=%d)\n", + child, getpid()); + errno = 0; + lookup_me3 = ptrace(PT_READ_I, child, dummy_fn3, 0); + ATF_REQUIRE_EQ(errno, 0); + + ATF_REQUIRE_EQ_MSG(lookup_me3, magic3, + "got value %#x != expected %#x", lookup_me3, magic3); + + printf("Before resuming the child process where it left off and " + "without signal to be sent\n"); + ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_exited(status, exitval); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0)); +} + +ATF_TC(read_i4); +ATF_TC_HEAD(read_i4, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Verify PT_READ_I called four times"); +} + +ATF_TC_BODY(read_i4, tc) +{ + const int exitval = 5; + const int sigval = SIGSTOP; + pid_t child, wpid; + int lookup_me1 = 0; + int lookup_me2 = 0; + int lookup_me3 = 0; + int lookup_me4 = 0; + int magic1; + int magic2; + int magic3; + int magic4; + memcpy(&magic1, dummy_fn1, sizeof(magic1)); + memcpy(&magic2, dummy_fn2, sizeof(magic2)); + memcpy(&magic3, dummy_fn3, sizeof(magic3)); + memcpy(&magic4, dummy_fn4, sizeof(magic4)); +#if defined(TWAIT_HAVE_STATUS) + int status; +#endif + + printf("Before forking process PID=%d\n", getpid()); + ATF_REQUIRE((child = fork()) != -1); + if (child == 0) { + printf("Before calling PT_TRACE_ME from child %d\n", getpid()); + FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1); + + printf("Before raising %s from child\n", strsignal(sigval)); + FORKEE_ASSERT(raise(sigval) == 0); + + printf("Before exiting of the child process\n"); + _exit(exitval); + } + printf("Parent process PID=%d, child's PID=%d\n", getpid(), child); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_stopped(status, sigval); + + printf("Read new lookup_me1 from tracee (PID=%d) by tracer (PID=%d)\n", + child, getpid()); + errno = 0; + lookup_me1 = ptrace(PT_READ_I, child, dummy_fn1, 0); + ATF_REQUIRE_EQ(errno, 0); + + ATF_REQUIRE_EQ_MSG(lookup_me1, magic1, + "got value %#x != expected %#x", lookup_me1, magic1); + + printf("Read new lookup_me2 from tracee (PID=%d) by tracer (PID=%d)\n", + child, getpid()); + errno = 0; + lookup_me2 = ptrace(PT_READ_I, child, dummy_fn2, 0); + ATF_REQUIRE_EQ(errno, 0); + + ATF_REQUIRE_EQ_MSG(lookup_me2, magic2, + "got value %#x != expected %#x", lookup_me2, magic2); + + printf("Read new lookup_me3 from tracee (PID=%d) by tracer (PID=%d)\n", + child, getpid()); + errno = 0; + lookup_me3 = ptrace(PT_READ_I, child, dummy_fn3, 0); + ATF_REQUIRE_EQ(errno, 0); + + ATF_REQUIRE_EQ_MSG(lookup_me3, magic3, + "got value %#x != expected %#x", lookup_me3, magic3); + + printf("Read new lookup_me4 from tracee (PID=%d) by tracer (PID=%d)\n", + child, getpid()); + errno = 0; + lookup_me4 = ptrace(PT_READ_I, child, dummy_fn4, 0); + ATF_REQUIRE_EQ(errno, 0); + + ATF_REQUIRE_EQ_MSG(lookup_me4, magic4, + "got value %#x != expected %#x", lookup_me4, magic4); + + printf("Before resuming the child process where it left off and " + "without signal to be sent\n"); + ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_exited(status, exitval); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0)); +} + +#if defined(HAVE_GPREGS) +ATF_TC(regs1); +ATF_TC_HEAD(regs1, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Verify plain PT_GETREGS call without further steps"); +} + +ATF_TC_BODY(regs1, tc) +{ + const int exitval = 5; + const int sigval = SIGSTOP; + pid_t child, wpid; +#if defined(TWAIT_HAVE_STATUS) + int status; +#endif + struct reg r; + + printf("Before forking process PID=%d\n", getpid()); + ATF_REQUIRE((child = fork()) != -1); + if (child == 0) { + printf("Before calling PT_TRACE_ME from child %d\n", getpid()); + FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1); + + printf("Before raising %s from child\n", strsignal(sigval)); + FORKEE_ASSERT(raise(sigval) == 0); + + printf("Before exiting of the child process\n"); + _exit(exitval); + } + printf("Parent process PID=%d, child's PID=%d\n", getpid(), child); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_stopped(status, sigval); + + printf("Call GETREGS for the child process\n"); + ATF_REQUIRE(ptrace(PT_GETREGS, child, &r, 0) != -1); + + printf("Before resuming the child process where it left off and " + "without signal to be sent\n"); + ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_exited(status, exitval); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0)); +} +#endif + +#if defined(HAVE_GPREGS) +ATF_TC(regs2); +ATF_TC_HEAD(regs2, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Verify plain PT_GETREGS call and retrieve PC"); +} + +ATF_TC_BODY(regs2, tc) +{ + const int exitval = 5; + const int sigval = SIGSTOP; + pid_t child, wpid; +#if defined(TWAIT_HAVE_STATUS) + int status; +#endif + struct reg r; + + printf("Before forking process PID=%d\n", getpid()); + ATF_REQUIRE((child = fork()) != -1); + if (child == 0) { + printf("Before calling PT_TRACE_ME from child %d\n", getpid()); + FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1); + + printf("Before raising %s from child\n", strsignal(sigval)); + FORKEE_ASSERT(raise(sigval) == 0); + + printf("Before exiting of the child process\n"); + _exit(exitval); + } + printf("Parent process PID=%d, child's PID=%d\n", getpid(), child); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_stopped(status, sigval); + + printf("Call GETREGS for the child process\n"); + ATF_REQUIRE(ptrace(PT_GETREGS, child, &r, 0) != -1); + + printf("Retrieved PC=%" PRIxREGISTER "\n", PTRACE_REG_PC(&r)); + + printf("Before resuming the child process where it left off and " + "without signal to be sent\n"); + ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_exited(status, exitval); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0)); +} +#endif + +#if defined(HAVE_GPREGS) +ATF_TC(regs3); +ATF_TC_HEAD(regs3, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Verify plain PT_GETREGS call and retrieve SP"); +} + +ATF_TC_BODY(regs3, tc) +{ + const int exitval = 5; + const int sigval = SIGSTOP; + pid_t child, wpid; +#if defined(TWAIT_HAVE_STATUS) + int status; +#endif + struct reg r; + + printf("Before forking process PID=%d\n", getpid()); + ATF_REQUIRE((child = fork()) != -1); + if (child == 0) { + printf("Before calling PT_TRACE_ME from child %d\n", getpid()); + FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1); + + printf("Before raising %s from child\n", strsignal(sigval)); + FORKEE_ASSERT(raise(sigval) == 0); + + printf("Before exiting of the child process\n"); + _exit(exitval); + } + printf("Parent process PID=%d, child's PID=%d\n", getpid(), child); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_stopped(status, sigval); + + printf("Call GETREGS for the child process\n"); + ATF_REQUIRE(ptrace(PT_GETREGS, child, &r, 0) != -1); + + printf("Retrieved SP=%" PRIxREGISTER "\n", PTRACE_REG_SP(&r)); + + printf("Before resuming the child process where it left off and " + "without signal to be sent\n"); + ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_exited(status, exitval); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0)); +} +#endif + +#if defined(HAVE_GPREGS) +ATF_TC(regs4); +ATF_TC_HEAD(regs4, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Verify plain PT_GETREGS call and retrieve INTRV"); +} + +ATF_TC_BODY(regs4, tc) +{ + const int exitval = 5; + const int sigval = SIGSTOP; + pid_t child, wpid; +#if defined(TWAIT_HAVE_STATUS) + int status; +#endif + struct reg r; + + printf("Before forking process PID=%d\n", getpid()); + ATF_REQUIRE((child = fork()) != -1); + if (child == 0) { + printf("Before calling PT_TRACE_ME from child %d\n", getpid()); + FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1); + + printf("Before raising %s from child\n", strsignal(sigval)); + FORKEE_ASSERT(raise(sigval) == 0); + + printf("Before exiting of the child process\n"); + _exit(exitval); + } + printf("Parent process PID=%d, child's PID=%d\n", getpid(), child); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_stopped(status, sigval); + + printf("Call GETREGS for the child process\n"); + ATF_REQUIRE(ptrace(PT_GETREGS, child, &r, 0) != -1); + + printf("Retrieved INTRV=%" PRIxREGISTER "\n", PTRACE_REG_INTRV(&r)); + + printf("Before resuming the child process where it left off and " + "without signal to be sent\n"); + ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_exited(status, exitval); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0)); +} +#endif + +#if defined(HAVE_GPREGS) +ATF_TC(regs5); +ATF_TC_HEAD(regs5, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Verify PT_GETREGS and PT_SETREGS calls without changing regs"); +} + +ATF_TC_BODY(regs5, tc) +{ + const int exitval = 5; + const int sigval = SIGSTOP; + pid_t child, wpid; +#if defined(TWAIT_HAVE_STATUS) + int status; +#endif + struct reg r; + + printf("Before forking process PID=%d\n", getpid()); + ATF_REQUIRE((child = fork()) != -1); + if (child == 0) { + printf("Before calling PT_TRACE_ME from child %d\n", getpid()); + FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1); + + printf("Before raising %s from child\n", strsignal(sigval)); + FORKEE_ASSERT(raise(sigval) == 0); + + printf("Before exiting of the child process\n"); + _exit(exitval); + } + printf("Parent process PID=%d, child's PID=%d\n", getpid(), child); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_stopped(status, sigval); + + printf("Call GETREGS for the child process\n"); + ATF_REQUIRE(ptrace(PT_GETREGS, child, &r, 0) != -1); + + printf("Call SETREGS for the child process (without changed regs)\n"); + ATF_REQUIRE(ptrace(PT_GETREGS, child, &r, 0) != -1); + + printf("Before resuming the child process where it left off and " + "without signal to be sent\n"); + ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_exited(status, exitval); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0)); +} +#endif + +#if defined(HAVE_FPREGS) +ATF_TC(fpregs1); +ATF_TC_HEAD(fpregs1, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Verify plain PT_GETFPREGS call without further steps"); +} + +ATF_TC_BODY(fpregs1, tc) +{ + const int exitval = 5; + const int sigval = SIGSTOP; + pid_t child, wpid; +#if defined(TWAIT_HAVE_STATUS) + int status; +#endif + struct fpreg r; + + printf("Before forking process PID=%d\n", getpid()); + ATF_REQUIRE((child = fork()) != -1); + if (child == 0) { + printf("Before calling PT_TRACE_ME from child %d\n", getpid()); + FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1); + + printf("Before raising %s from child\n", strsignal(sigval)); + FORKEE_ASSERT(raise(sigval) == 0); + + printf("Before exiting of the child process\n"); + _exit(exitval); + } + printf("Parent process PID=%d, child's PID=%d\n", getpid(), child); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_stopped(status, sigval); + + printf("Call GETFPREGS for the child process\n"); + ATF_REQUIRE(ptrace(PT_GETFPREGS, child, &r, 0) != -1); + + printf("Before resuming the child process where it left off and " + "without signal to be sent\n"); + ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_exited(status, exitval); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0)); +} +#endif + +#if defined(HAVE_FPREGS) +ATF_TC(fpregs2); +ATF_TC_HEAD(fpregs2, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Verify PT_GETFPREGS and PT_SETFPREGS calls without changing " + "regs"); +} + +ATF_TC_BODY(fpregs2, tc) +{ + const int exitval = 5; + const int sigval = SIGSTOP; + pid_t child, wpid; +#if defined(TWAIT_HAVE_STATUS) + int status; +#endif + struct fpreg r; + + printf("Before forking process PID=%d\n", getpid()); + ATF_REQUIRE((child = fork()) != -1); + if (child == 0) { + printf("Before calling PT_TRACE_ME from child %d\n", getpid()); + FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1); + + printf("Before raising %s from child\n", strsignal(sigval)); + FORKEE_ASSERT(raise(sigval) == 0); + + printf("Before exiting of the child process\n"); + _exit(exitval); + } + printf("Parent process PID=%d, child's PID=%d\n", getpid(), child); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_stopped(status, sigval); + + printf("Call GETFPREGS for the child process\n"); + ATF_REQUIRE(ptrace(PT_GETFPREGS, child, &r, 0) != -1); + + printf("Call SETFPREGS for the child (without changed regs)\n"); + ATF_REQUIRE(ptrace(PT_SETFPREGS, child, &r, 0) != -1); + + printf("Before resuming the child process where it left off and " + "without signal to be sent\n"); + ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_exited(status, exitval); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0)); +} +#endif + +#if defined(PT_STEP) +ATF_TC(step1); +ATF_TC_HEAD(step1, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Verify single PT_STEP call"); +} + +ATF_TC_BODY(step1, tc) +{ + const int exitval = 5; + const int sigval = SIGSTOP; + pid_t child, wpid; +#if defined(TWAIT_HAVE_STATUS) + int status; +#endif + int happy; + + printf("Before forking process PID=%d\n", getpid()); + ATF_REQUIRE((child = fork()) != -1); + if (child == 0) { + printf("Before calling PT_TRACE_ME from child %d\n", getpid()); + FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1); + + happy = check_happy(100); + + printf("Before raising %s from child\n", strsignal(sigval)); + FORKEE_ASSERT(raise(sigval) == 0); + + FORKEE_ASSERT_EQ(happy, check_happy(100)); + + printf("Before exiting of the child process\n"); + _exit(exitval); + } + printf("Parent process PID=%d, child's PID=%d\n", getpid(), child); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_stopped(status, sigval); + + printf("Before resuming the child process where it left off and " + "without signal to be sent (use PT_STEP)\n"); + ATF_REQUIRE(ptrace(PT_STEP, child, (void *)1, 0) != -1); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_stopped(status, SIGTRAP); + + printf("Before resuming the child process where it left off and " + "without signal to be sent\n"); + ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_exited(status, exitval); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0)); +} +#endif + +#if defined(PT_STEP) +ATF_TC(step2); +ATF_TC_HEAD(step2, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Verify PT_STEP called twice"); +} + +ATF_TC_BODY(step2, tc) +{ + const int exitval = 5; + const int sigval = SIGSTOP; + pid_t child, wpid; +#if defined(TWAIT_HAVE_STATUS) + int status; +#endif + int happy; + int N = 2; + + printf("Before forking process PID=%d\n", getpid()); + ATF_REQUIRE((child = fork()) != -1); + if (child == 0) { + printf("Before calling PT_TRACE_ME from child %d\n", getpid()); + FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1); + + happy = check_happy(999); + + printf("Before raising %s from child\n", strsignal(sigval)); + FORKEE_ASSERT(raise(sigval) == 0); + + FORKEE_ASSERT_EQ(happy, check_happy(999)); + + printf("Before exiting of the child process\n"); + _exit(exitval); + } + printf("Parent process PID=%d, child's PID=%d\n", getpid(), child); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_stopped(status, sigval); + + while (N --> 0) { + printf("Before resuming the child process where it left off " + "and without signal to be sent (use PT_STEP)\n"); + ATF_REQUIRE(ptrace(PT_STEP, child, (void *)1, 0) != -1); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), + child); + + validate_status_stopped(status, SIGTRAP); + } + + printf("Before resuming the child process where it left off and " + "without signal to be sent\n"); + ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_exited(status, exitval); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0)); +} +#endif + +#if defined(PT_STEP) +ATF_TC(step3); +ATF_TC_HEAD(step3, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Verify PT_STEP called three times"); +} + +ATF_TC_BODY(step3, tc) +{ + const int exitval = 5; + const int sigval = SIGSTOP; + pid_t child, wpid; +#if defined(TWAIT_HAVE_STATUS) + int status; +#endif + int happy; + int N = 3; + + printf("Before forking process PID=%d\n", getpid()); + ATF_REQUIRE((child = fork()) != -1); + if (child == 0) { + printf("Before calling PT_TRACE_ME from child %d\n", getpid()); + FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1); + + happy = check_happy(999); + + printf("Before raising %s from child\n", strsignal(sigval)); + FORKEE_ASSERT(raise(sigval) == 0); + + FORKEE_ASSERT_EQ(happy, check_happy(999)); + + printf("Before exiting of the child process\n"); + _exit(exitval); + } + printf("Parent process PID=%d, child's PID=%d\n", getpid(), child); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_stopped(status, sigval); + + while (N --> 0) { + printf("Before resuming the child process where it left off " + "and without signal to be sent (use PT_STEP)\n"); + ATF_REQUIRE(ptrace(PT_STEP, child, (void *)1, 0) != -1); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), + child); + + validate_status_stopped(status, SIGTRAP); + } + + printf("Before resuming the child process where it left off and " + "without signal to be sent\n"); + ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_exited(status, exitval); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0)); +} +#endif + +#if defined(PT_STEP) +ATF_TC(step4); +ATF_TC_HEAD(step4, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Verify PT_STEP called four times"); +} + +ATF_TC_BODY(step4, tc) +{ + const int exitval = 5; + const int sigval = SIGSTOP; + pid_t child, wpid; +#if defined(TWAIT_HAVE_STATUS) + int status; +#endif + int happy; + int N = 4; + + printf("Before forking process PID=%d\n", getpid()); + ATF_REQUIRE((child = fork()) != -1); + if (child == 0) { + printf("Before calling PT_TRACE_ME from child %d\n", getpid()); + FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1); + + happy = check_happy(999); + + printf("Before raising %s from child\n", strsignal(sigval)); + FORKEE_ASSERT(raise(sigval) == 0); + + FORKEE_ASSERT_EQ(happy, check_happy(999)); + + printf("Before exiting of the child process\n"); + _exit(exitval); + } + printf("Parent process PID=%d, child's PID=%d\n", getpid(), child); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_stopped(status, sigval); + + while (N --> 0) { + printf("Before resuming the child process where it left off " + "and without signal to be sent (use PT_STEP)\n"); + ATF_REQUIRE(ptrace(PT_STEP, child, (void *)1, 0) != -1); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), + child); + + validate_status_stopped(status, SIGTRAP); + } + + printf("Before resuming the child process where it left off and " + "without signal to be sent\n"); + ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_exited(status, exitval); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0)); +} +#endif + +ATF_TC(kill1); +ATF_TC_HEAD(kill1, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Verify that PT_CONTINUE with SIGKILL terminates child"); +} + +ATF_TC_BODY(kill1, tc) +{ + const int sigval = SIGSTOP, sigsent = SIGKILL; + pid_t child, wpid; +#if defined(TWAIT_HAVE_STATUS) + int status; +#endif + + printf("Before forking process PID=%d\n", getpid()); + ATF_REQUIRE((child = fork()) != -1); + if (child == 0) { + printf("Before calling PT_TRACE_ME from child %d\n", getpid()); + FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1); + + printf("Before raising %s from child\n", strsignal(sigval)); + FORKEE_ASSERT(raise(sigval) == 0); + + /* NOTREACHED */ + FORKEE_ASSERTX(0 && + "Child should be terminated by a signal from its parent"); + } + printf("Parent process PID=%d, child's PID=%d\n", getpid(), child); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_stopped(status, sigval); + + printf("Before resuming the child process where it left off and " + "without signal to be sent\n"); + ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, sigsent) != -1); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_signaled(status, sigsent, 0); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0)); +} + +ATF_TC(kill2); +ATF_TC_HEAD(kill2, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Verify that PT_KILL terminates child"); +} + +ATF_TC_BODY(kill2, tc) +{ + const int sigval = SIGSTOP; + pid_t child, wpid; +#if defined(TWAIT_HAVE_STATUS) + int status; +#endif + + printf("Before forking process PID=%d\n", getpid()); + ATF_REQUIRE((child = fork()) != -1); + if (child == 0) { + printf("Before calling PT_TRACE_ME from child %d\n", getpid()); + FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1); + + printf("Before raising %s from child\n", strsignal(sigval)); + FORKEE_ASSERT(raise(sigval) == 0); + + /* NOTREACHED */ + FORKEE_ASSERTX(0 && + "Child should be terminated by a signal from its parent"); + } + printf("Parent process PID=%d, child's PID=%d\n", getpid(), child); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_stopped(status, sigval); + + printf("Before resuming the child process where it left off and " + "without signal to be sent\n"); + ATF_REQUIRE(ptrace(PT_KILL, child, (void*)1, 0) != -1); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_signaled(status, SIGKILL, 0); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0)); +} + +ATF_TC(lwpinfo1); +ATF_TC_HEAD(lwpinfo1, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Verify basic LWPINFO call for single thread (PT_TRACE_ME)"); +} + +ATF_TC_BODY(lwpinfo1, tc) +{ + const int exitval = 5; + const int sigval = SIGSTOP; + pid_t child, wpid; +#if defined(TWAIT_HAVE_STATUS) + int status; +#endif + struct ptrace_lwpinfo info = {0, 0}; + + printf("Before forking process PID=%d\n", getpid()); + ATF_REQUIRE((child = fork()) != -1); + if (child == 0) { + printf("Before calling PT_TRACE_ME from child %d\n", getpid()); + FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1); + + printf("Before raising %s from child\n", strsignal(sigval)); + FORKEE_ASSERT(raise(sigval) == 0); + + printf("Before exiting of the child process\n"); + _exit(exitval); + } + printf("Parent process PID=%d, child's PID=%d\n", getpid(), child); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_stopped(status, sigval); + + printf("Before calling ptrace(2) with PT_LWPINFO for child\n"); + ATF_REQUIRE(ptrace(PT_LWPINFO, child, &info, sizeof(info)) != -1); + + printf("Assert that there exists a thread\n"); + ATF_REQUIRE(info.pl_lwpid > 0); + + printf("Assert that lwp thread %d received event PL_EVENT_SIGNAL\n", + info.pl_lwpid); + ATF_REQUIRE_EQ_MSG(info.pl_event, PL_EVENT_SIGNAL, + "Received event %d != expected event %d", + info.pl_event, PL_EVENT_SIGNAL); + + printf("Before calling ptrace(2) with PT_LWPINFO for child\n"); + ATF_REQUIRE(ptrace(PT_LWPINFO, child, &info, sizeof(info)) != -1); + + printf("Assert that there are no more lwp threads in child\n"); + ATF_REQUIRE_EQ(info.pl_lwpid, 0); + + printf("Before resuming the child process where it left off and " + "without signal to be sent\n"); + ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_exited(status, exitval); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0)); +} + +#if defined(TWAIT_HAVE_PID) +ATF_TC(lwpinfo2); +ATF_TC_HEAD(lwpinfo2, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Verify basic LWPINFO call for single thread (PT_ATTACH from " + "tracer)"); +} + +ATF_TC_BODY(lwpinfo2, tc) +{ + struct msg_fds parent_tracee, parent_tracer; + const int exitval_tracee = 5; + const int exitval_tracer = 10; + pid_t tracee, tracer, wpid; + uint8_t msg = 0xde; /* dummy message for IPC based on pipe(2) */ +#if defined(TWAIT_HAVE_STATUS) + int status; +#endif + struct ptrace_lwpinfo info = {0, 0}; + + printf("Spawn tracee\n"); + ATF_REQUIRE(msg_open(&parent_tracee) == 0); + ATF_REQUIRE(msg_open(&parent_tracer) == 0); + tracee = atf_utils_fork(); + if (tracee == 0) { + + /* Wait for message from the parent */ + CHILD_TO_PARENT("tracee ready", parent_tracee, msg); + CHILD_FROM_PARENT("tracee exit", parent_tracee, msg); + + _exit(exitval_tracee); + } + PARENT_FROM_CHILD("tracee ready", parent_tracee, msg); + + printf("Spawn debugger\n"); + tracer = atf_utils_fork(); + if (tracer == 0) { + /* No IPC to communicate with the child */ + printf("Before calling PT_ATTACH from tracee %d\n", getpid()); + FORKEE_ASSERT(ptrace(PT_ATTACH, tracee, NULL, 0) != -1); + + /* Wait for tracee and assert that it was stopped w/ SIGSTOP */ + FORKEE_REQUIRE_SUCCESS( + wpid = TWAIT_GENERIC(tracee, &status, 0), tracee); + + forkee_status_stopped(status, SIGSTOP); + + printf("Before calling ptrace(2) with PT_LWPINFO for child\n"); + FORKEE_ASSERT(ptrace(PT_LWPINFO, tracee, &info, sizeof(info)) + != -1); + + printf("Assert that there exists a thread\n"); + FORKEE_ASSERTX(info.pl_lwpid > 0); + + printf("Assert that lwp thread %d received event " + "PL_EVENT_SIGNAL\n", info.pl_lwpid); + FORKEE_ASSERT_EQ(info.pl_event, PL_EVENT_SIGNAL); + + printf("Before calling ptrace(2) with PT_LWPINFO for child\n"); + FORKEE_ASSERT(ptrace(PT_LWPINFO, tracee, &info, sizeof(info)) + != -1); + + printf("Assert that there are no more lwp threads in child\n"); + FORKEE_ASSERTX(info.pl_lwpid == 0); + + /* Resume tracee with PT_CONTINUE */ + FORKEE_ASSERT(ptrace(PT_CONTINUE, tracee, (void *)1, 0) != -1); + + /* Inform parent that tracer has attached to tracee */ + CHILD_TO_PARENT("tracer ready", parent_tracer, msg); + /* Wait for parent */ + CHILD_FROM_PARENT("tracer wait", parent_tracer, msg); + + /* Wait for tracee and assert that it exited */ + FORKEE_REQUIRE_SUCCESS( + wpid = TWAIT_GENERIC(tracee, &status, 0), tracee); + + forkee_status_exited(status, exitval_tracee); + + printf("Before exiting of the tracer process\n"); + _exit(exitval_tracer); + } + + printf("Wait for the tracer to attach to the tracee\n"); + PARENT_FROM_CHILD("tracer ready", parent_tracer, msg); + + printf("Resume the tracee and let it exit\n"); + PARENT_TO_CHILD("tracee exit", parent_tracee, msg); + + printf("Detect that tracee is zombie\n"); + await_zombie(tracee); + + printf("Assert that there is no status about tracee - " + "Tracer must detect zombie first - calling %s()\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS( + wpid = TWAIT_GENERIC(tracee, &status, WNOHANG), 0); + + printf("Resume the tracer and let it detect exited tracee\n"); + PARENT_TO_CHILD("tracer wait", parent_tracer, msg); + + printf("Wait for tracer to finish its job and exit - calling %s()\n", + TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(tracer, &status, 0), + tracer); + + validate_status_exited(status, exitval_tracer); + + printf("Wait for tracee to finish its job and exit - calling %s()\n", + TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(tracee, &status, WNOHANG), + tracee); + + validate_status_exited(status, exitval_tracee); + + msg_close(&parent_tracer); + msg_close(&parent_tracee); +} +#endif + +ATF_TC(siginfo1); +ATF_TC_HEAD(siginfo1, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Verify basic PT_GET_SIGINFO call for SIGTRAP from tracee"); +} + +ATF_TC_BODY(siginfo1, tc) +{ + const int exitval = 5; + const int sigval = SIGTRAP; + pid_t child, wpid; +#if defined(TWAIT_HAVE_STATUS) + int status; +#endif + struct ptrace_siginfo info; + memset(&info, 0, sizeof(info)); + + printf("Before forking process PID=%d\n", getpid()); + ATF_REQUIRE((child = fork()) != -1); + if (child == 0) { + printf("Before calling PT_TRACE_ME from child %d\n", getpid()); + FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1); + + printf("Before raising %s from child\n", strsignal(sigval)); + FORKEE_ASSERT(raise(sigval) == 0); + + printf("Before exiting of the child process\n"); + _exit(exitval); + } + printf("Parent process PID=%d, child's PID=%d\n", getpid(), child); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_stopped(status, sigval); + + printf("Before calling ptrace(2) with PT_GET_SIGINFO for child\n"); + ATF_REQUIRE(ptrace(PT_GET_SIGINFO, child, &info, sizeof(info)) != -1); + + printf("Signal traced to lwpid=%d\n", info.psi_lwpid); + printf("Signal properties: si_signo=%#x si_code=%#x si_errno=%#x\n", + info.psi_siginfo.si_signo, info.psi_siginfo.si_code, + info.psi_siginfo.si_errno); + + printf("Before resuming the child process where it left off and " + "without signal to be sent\n"); + ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_exited(status, exitval); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0)); +} + +ATF_TC(siginfo2); +ATF_TC_HEAD(siginfo2, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Verify basic PT_GET_SIGINFO and PT_SET_SIGINFO calls without " + "modification of SIGINT from tracee"); +} + +static int siginfo2_caught = 0; + +static void +siginfo2_sighandler(int sig) +{ + FORKEE_ASSERT_EQ(sig, SIGINT); + + ++siginfo2_caught; +} + +ATF_TC_BODY(siginfo2, tc) +{ + const int exitval = 5; + const int sigval = SIGINT; + pid_t child, wpid; + struct sigaction sa; +#if defined(TWAIT_HAVE_STATUS) + int status; +#endif + struct ptrace_siginfo info; + memset(&info, 0, sizeof(info)); + + printf("Before forking process PID=%d\n", getpid()); + ATF_REQUIRE((child = fork()) != -1); + if (child == 0) { + printf("Before calling PT_TRACE_ME from child %d\n", getpid()); + FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1); + + sa.sa_handler = siginfo2_sighandler; + sa.sa_flags = SA_SIGINFO; + sigemptyset(&sa.sa_mask); + + FORKEE_ASSERT(sigaction(sigval, &sa, NULL) != -1); + + printf("Before raising %s from child\n", strsignal(sigval)); + FORKEE_ASSERT(raise(sigval) == 0); + + FORKEE_ASSERT_EQ(siginfo2_caught, 1); + + printf("Before exiting of the child process\n"); + _exit(exitval); + } + printf("Parent process PID=%d, child's PID=%d\n", getpid(), child); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_stopped(status, sigval); + + printf("Before calling ptrace(2) with PT_GET_SIGINFO for child\n"); + ATF_REQUIRE(ptrace(PT_GET_SIGINFO, child, &info, sizeof(info)) != -1); + + printf("Signal traced to lwpid=%d\n", info.psi_lwpid); + printf("Signal properties: si_signo=%#x si_code=%#x si_errno=%#x\n", + info.psi_siginfo.si_signo, info.psi_siginfo.si_code, + info.psi_siginfo.si_errno); + + printf("Before calling ptrace(2) with PT_SET_SIGINFO for child\n"); + ATF_REQUIRE(ptrace(PT_SET_SIGINFO, child, &info, sizeof(info)) != -1); + + printf("Before resuming the child process where it left off and " + "without signal to be sent\n"); + ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, sigval) != -1); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_exited(status, exitval); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0)); +} + +ATF_TC(siginfo3); +ATF_TC_HEAD(siginfo3, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Verify basic PT_GET_SIGINFO and PT_SET_SIGINFO calls with " + "setting signal to new value"); +} + +static int siginfo3_caught = 0; + +static void +siginfo3_sigaction(int sig, siginfo_t *info, void *ctx) +{ + FORKEE_ASSERT_EQ(sig, SIGTRAP); + + FORKEE_ASSERT_EQ(info->si_signo, SIGTRAP); + FORKEE_ASSERT_EQ(info->si_code, TRAP_BRKPT); + + ++siginfo3_caught; +} + +ATF_TC_BODY(siginfo3, tc) +{ + const int exitval = 5; + const int sigval = SIGINT; + const int sigfaked = SIGTRAP; + const int sicodefaked = TRAP_BRKPT; + pid_t child, wpid; + struct sigaction sa; +#if defined(TWAIT_HAVE_STATUS) + int status; +#endif + struct ptrace_siginfo info; + memset(&info, 0, sizeof(info)); + + printf("Before forking process PID=%d\n", getpid()); + ATF_REQUIRE((child = fork()) != -1); + if (child == 0) { + printf("Before calling PT_TRACE_ME from child %d\n", getpid()); + FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1); + + sa.sa_sigaction = siginfo3_sigaction; + sa.sa_flags = SA_SIGINFO; + sigemptyset(&sa.sa_mask); + + FORKEE_ASSERT(sigaction(sigfaked, &sa, NULL) != -1); + + printf("Before raising %s from child\n", strsignal(sigval)); + FORKEE_ASSERT(raise(sigval) == 0); + + FORKEE_ASSERT_EQ(siginfo3_caught, 1); + + printf("Before exiting of the child process\n"); + _exit(exitval); + } + printf("Parent process PID=%d, child's PID=%d\n", getpid(), child); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_stopped(status, sigval); + + printf("Before calling ptrace(2) with PT_GET_SIGINFO for child\n"); + ATF_REQUIRE(ptrace(PT_GET_SIGINFO, child, &info, sizeof(info)) != -1); + + printf("Signal traced to lwpid=%d\n", info.psi_lwpid); + printf("Signal properties: si_signo=%#x si_code=%#x si_errno=%#x\n", + info.psi_siginfo.si_signo, info.psi_siginfo.si_code, + info.psi_siginfo.si_errno); + + printf("Before setting new faked signal to signo=%d si_code=%d\n", + sigfaked, sicodefaked); + info.psi_siginfo.si_signo = sigfaked; + info.psi_siginfo.si_code = sicodefaked; + + printf("Before calling ptrace(2) with PT_SET_SIGINFO for child\n"); + ATF_REQUIRE(ptrace(PT_SET_SIGINFO, child, &info, sizeof(info)) != -1); + + printf("Before calling ptrace(2) with PT_GET_SIGINFO for child\n"); + ATF_REQUIRE(ptrace(PT_GET_SIGINFO, child, &info, sizeof(info)) != -1); + + printf("Before checking siginfo_t\n"); + ATF_REQUIRE_EQ(info.psi_siginfo.si_signo, sigfaked); + ATF_REQUIRE_EQ(info.psi_siginfo.si_code, sicodefaked); + + printf("Before resuming the child process where it left off and " + "without signal to be sent\n"); + ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, sigfaked) != -1); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_exited(status, exitval); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0)); +} + +ATF_TC(siginfo4); +ATF_TC_HEAD(siginfo4, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Detect SIGTRAP TRAP_EXEC from tracee"); +} + +ATF_TC_BODY(siginfo4, tc) +{ + const int sigval = SIGTRAP; + pid_t child, wpid; +#if defined(TWAIT_HAVE_STATUS) + int status; +#endif + + struct ptrace_siginfo info; + memset(&info, 0, sizeof(info)); + + printf("Before forking process PID=%d\n", getpid()); + ATF_REQUIRE((child = fork()) != -1); + if (child == 0) { + printf("Before calling PT_TRACE_ME from child %d\n", getpid()); + FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1); + + printf("Before calling execve(2) from child\n"); + execlp("/bin/echo", "/bin/echo", NULL); + + FORKEE_ASSERT(0 && "Not reached"); + } + printf("Parent process PID=%d, child's PID=%d\n", getpid(), child); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_stopped(status, sigval); + + printf("Before calling ptrace(2) with PT_GET_SIGINFO for child\n"); + ATF_REQUIRE(ptrace(PT_GET_SIGINFO, child, &info, sizeof(info)) != -1); + + printf("Signal traced to lwpid=%d\n", info.psi_lwpid); + printf("Signal properties: si_signo=%#x si_code=%#x si_errno=%#x\n", + info.psi_siginfo.si_signo, info.psi_siginfo.si_code, + info.psi_siginfo.si_errno); + + ATF_REQUIRE_EQ(info.psi_siginfo.si_signo, sigval); + ATF_REQUIRE_EQ(info.psi_siginfo.si_code, TRAP_EXEC); + + printf("Before resuming the child process where it left off and " + "without signal to be sent\n"); + ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0)); +} + +#if defined(TWAIT_HAVE_PID) +ATF_TC(siginfo5); +ATF_TC_HEAD(siginfo5, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Verify that fork(2) is intercepted by ptrace(2) with EVENT_MASK " + "set to PTRACE_FORK and reports correct signal information"); +} + +ATF_TC_BODY(siginfo5, tc) +{ + const int exitval = 5; + const int exitval2 = 15; + const int sigval = SIGSTOP; + pid_t child, child2, wpid; +#if defined(TWAIT_HAVE_STATUS) + int status; +#endif + ptrace_state_t state; + const int slen = sizeof(state); + ptrace_event_t event; + const int elen = sizeof(event); + struct ptrace_siginfo info; + + memset(&info, 0, sizeof(info)); + + printf("Before forking process PID=%d\n", getpid()); + ATF_REQUIRE((child = fork()) != -1); + if (child == 0) { + printf("Before calling PT_TRACE_ME from child %d\n", getpid()); + FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1); + + printf("Before raising %s from child\n", strsignal(sigval)); + FORKEE_ASSERT(raise(sigval) == 0); + + FORKEE_ASSERT((child2 = fork()) != 1); + + if (child2 == 0) + _exit(exitval2); + + FORKEE_REQUIRE_SUCCESS + (wpid = TWAIT_GENERIC(child2, &status, 0), child2); + + forkee_status_exited(status, exitval2); + + printf("Before exiting of the child process\n"); + _exit(exitval); + } + printf("Parent process PID=%d, child's PID=%d\n", getpid(), child); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_stopped(status, sigval); + + printf("Before calling ptrace(2) with PT_GET_SIGINFO for child\n"); + ATF_REQUIRE(ptrace(PT_GET_SIGINFO, child, &info, sizeof(info)) != -1); + + printf("Before checking siginfo_t\n"); + ATF_REQUIRE_EQ(info.psi_siginfo.si_signo, sigval); + ATF_REQUIRE_EQ(info.psi_siginfo.si_code, SI_LWP); + + printf("Enable PTRACE_FORK in EVENT_MASK for the child %d\n", child); + event.pe_set_event = PTRACE_FORK; + ATF_REQUIRE(ptrace(PT_SET_EVENT_MASK, child, &event, elen) != -1); + + printf("Before resuming the child process where it left off and " + "without signal to be sent\n"); + ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1); + + printf("Before calling %s() for the child %d\n", TWAIT_FNAME, child); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_stopped(status, SIGTRAP); + + printf("Before calling ptrace(2) with PT_GET_SIGINFO for child\n"); + ATF_REQUIRE(ptrace(PT_GET_SIGINFO, child, &info, sizeof(info)) != -1); + + printf("Before checking siginfo_t\n"); + ATF_REQUIRE_EQ(info.psi_siginfo.si_signo, SIGTRAP); + ATF_REQUIRE_EQ(info.psi_siginfo.si_code, TRAP_CHLD); + + ATF_REQUIRE(ptrace(PT_GET_PROCESS_STATE, child, &state, slen) != -1); + ATF_REQUIRE_EQ(state.pe_report_event, PTRACE_FORK); + + child2 = state.pe_other_pid; + printf("Reported PTRACE_FORK event with forkee %d\n", child2); + + printf("Before calling %s() for the forkee %d of the child %d\n", + TWAIT_FNAME, child2, child); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child2, &status, 0), + child2); + + validate_status_stopped(status, SIGTRAP); + + printf("Before calling ptrace(2) with PT_GET_SIGINFO for child\n"); + ATF_REQUIRE(ptrace(PT_GET_SIGINFO, child, &info, sizeof(info)) != -1); + + printf("Before checking siginfo_t\n"); + ATF_REQUIRE_EQ(info.psi_siginfo.si_signo, SIGTRAP); + ATF_REQUIRE_EQ(info.psi_siginfo.si_code, TRAP_CHLD); + + ATF_REQUIRE(ptrace(PT_GET_PROCESS_STATE, child2, &state, slen) != -1); + ATF_REQUIRE_EQ(state.pe_report_event, PTRACE_FORK); + ATF_REQUIRE_EQ(state.pe_other_pid, child); + + printf("Before resuming the forkee process where it left off and " + "without signal to be sent\n"); + ATF_REQUIRE(ptrace(PT_CONTINUE, child2, (void *)1, 0) != -1); + + printf("Before resuming the child process where it left off and " + "without signal to be sent\n"); + ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1); + + printf("Before calling %s() for the forkee - expected exited\n", + TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child2, &status, 0), + child2); + + validate_status_exited(status, exitval2); + + printf("Before calling %s() for the forkee - expected no process\n", + TWAIT_FNAME); + TWAIT_REQUIRE_FAILURE(ECHILD, + wpid = TWAIT_GENERIC(child2, &status, 0)); + + printf("Before calling %s() for the child - expected stopped " + "SIGCHLD\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_stopped(status, SIGCHLD); + + printf("Before calling ptrace(2) with PT_GET_SIGINFO for child\n"); + ATF_REQUIRE(ptrace(PT_GET_SIGINFO, child, &info, sizeof(info)) != -1); + + printf("Before checking siginfo_t\n"); + ATF_REQUIRE_EQ(info.psi_siginfo.si_signo, SIGCHLD); + ATF_REQUIRE_EQ(info.psi_siginfo.si_code, CLD_EXITED); + + printf("Before resuming the child process where it left off and " + "without signal to be sent\n"); + ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1); + + printf("Before calling %s() for the child - expected exited\n", + TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_exited(status, exitval); + + printf("Before calling %s() for the child - expected no process\n", + TWAIT_FNAME); + TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0)); +} +#endif + +#if defined(PT_STEP) +ATF_TC(siginfo6); +ATF_TC_HEAD(siginfo6, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Verify single PT_STEP call with signal information check"); +} + +ATF_TC_BODY(siginfo6, tc) +{ + const int exitval = 5; + const int sigval = SIGSTOP; + pid_t child, wpid; +#if defined(TWAIT_HAVE_STATUS) + int status; +#endif + int happy; + struct ptrace_siginfo info; + + memset(&info, 0, sizeof(info)); + + printf("Before forking process PID=%d\n", getpid()); + ATF_REQUIRE((child = fork()) != -1); + if (child == 0) { + printf("Before calling PT_TRACE_ME from child %d\n", getpid()); + FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1); + + happy = check_happy(100); + + printf("Before raising %s from child\n", strsignal(sigval)); + FORKEE_ASSERT(raise(sigval) == 0); + + FORKEE_ASSERT_EQ(happy, check_happy(100)); + + printf("Before exiting of the child process\n"); + _exit(exitval); + } + printf("Parent process PID=%d, child's PID=%d\n", getpid(), child); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_stopped(status, sigval); + + printf("Before calling ptrace(2) with PT_GET_SIGINFO for child\n"); + ATF_REQUIRE(ptrace(PT_GET_SIGINFO, child, &info, sizeof(info)) != -1); + + printf("Before checking siginfo_t\n"); + ATF_REQUIRE_EQ(info.psi_siginfo.si_signo, sigval); + ATF_REQUIRE_EQ(info.psi_siginfo.si_code, SI_LWP); + + printf("Before resuming the child process where it left off and " + "without signal to be sent (use PT_STEP)\n"); + ATF_REQUIRE(ptrace(PT_STEP, child, (void *)1, 0) != -1); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_stopped(status, SIGTRAP); + + printf("Before calling ptrace(2) with PT_GET_SIGINFO for child\n"); + ATF_REQUIRE(ptrace(PT_GET_SIGINFO, child, &info, sizeof(info)) != -1); + + printf("Before checking siginfo_t\n"); + ATF_REQUIRE_EQ(info.psi_siginfo.si_signo, SIGTRAP); + ATF_REQUIRE_EQ(info.psi_siginfo.si_code, TRAP_TRACE); + + printf("Before resuming the child process where it left off and " + "without signal to be sent\n"); + ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_exited(status, exitval); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0)); +} +#endif + +ATF_TP_ADD_TCS(tp) +{ + setvbuf(stdout, NULL, _IONBF, 0); + setvbuf(stderr, NULL, _IONBF, 0); + ATF_TP_ADD_TC(tp, traceme1); + ATF_TP_ADD_TC(tp, traceme2); + ATF_TP_ADD_TC(tp, traceme3); + ATF_TP_ADD_TC(tp, traceme4); + + ATF_TP_ADD_TC_HAVE_PID(tp, attach1); + ATF_TP_ADD_TC_HAVE_PID(tp, attach2); + ATF_TP_ADD_TC(tp, attach3); + ATF_TP_ADD_TC(tp, attach4); + ATF_TP_ADD_TC_HAVE_PID(tp, attach5); + ATF_TP_ADD_TC_HAVE_PID(tp, attach6); + ATF_TP_ADD_TC_HAVE_PID(tp, attach7); + + ATF_TP_ADD_TC(tp, eventmask1); + ATF_TP_ADD_TC(tp, eventmask2); + + ATF_TP_ADD_TC_HAVE_PID(tp, fork1); + ATF_TP_ADD_TC(tp, fork2); + + ATF_TP_ADD_TC_HAVE_PID(tp, vfork1); + ATF_TP_ADD_TC(tp, vfork2); + + ATF_TP_ADD_TC(tp, io_read_d1); + ATF_TP_ADD_TC(tp, io_read_d2); + ATF_TP_ADD_TC(tp, io_read_d3); + ATF_TP_ADD_TC(tp, io_read_d4); + + ATF_TP_ADD_TC(tp, io_write_d1); + ATF_TP_ADD_TC(tp, io_write_d2); + ATF_TP_ADD_TC(tp, io_write_d3); + ATF_TP_ADD_TC(tp, io_write_d4); + + ATF_TP_ADD_TC(tp, read_d1); + ATF_TP_ADD_TC(tp, read_d2); + ATF_TP_ADD_TC(tp, read_d3); + ATF_TP_ADD_TC(tp, read_d4); + + ATF_TP_ADD_TC(tp, write_d1); + ATF_TP_ADD_TC(tp, write_d2); + ATF_TP_ADD_TC(tp, write_d3); + ATF_TP_ADD_TC(tp, write_d4); + + ATF_TP_ADD_TC(tp, io_read_d_write_d_handshake1); + ATF_TP_ADD_TC(tp, io_read_d_write_d_handshake2); + + ATF_TP_ADD_TC(tp, read_d_write_d_handshake1); + ATF_TP_ADD_TC(tp, read_d_write_d_handshake2); + + ATF_TP_ADD_TC(tp, io_read_i1); + ATF_TP_ADD_TC(tp, io_read_i2); + ATF_TP_ADD_TC(tp, io_read_i3); + ATF_TP_ADD_TC(tp, io_read_i4); + + ATF_TP_ADD_TC(tp, read_i1); + ATF_TP_ADD_TC(tp, read_i2); + ATF_TP_ADD_TC(tp, read_i3); + ATF_TP_ADD_TC(tp, read_i4); + + ATF_TP_ADD_TC_HAVE_GPREGS(tp, regs1); + ATF_TP_ADD_TC_HAVE_GPREGS(tp, regs2); + ATF_TP_ADD_TC_HAVE_GPREGS(tp, regs3); + ATF_TP_ADD_TC_HAVE_GPREGS(tp, regs4); + ATF_TP_ADD_TC_HAVE_GPREGS(tp, regs5); + + ATF_TP_ADD_TC_HAVE_FPREGS(tp, fpregs1); + ATF_TP_ADD_TC_HAVE_FPREGS(tp, fpregs2); + + ATF_TP_ADD_TC_PT_STEP(tp, step1); + ATF_TP_ADD_TC_PT_STEP(tp, step2); + ATF_TP_ADD_TC_PT_STEP(tp, step3); + ATF_TP_ADD_TC_PT_STEP(tp, step4); + + ATF_TP_ADD_TC(tp, kill1); + ATF_TP_ADD_TC(tp, kill2); + + ATF_TP_ADD_TC(tp, lwpinfo1); + ATF_TP_ADD_TC_HAVE_PID(tp, lwpinfo2); + + ATF_TP_ADD_TC(tp, siginfo1); + ATF_TP_ADD_TC(tp, siginfo2); + ATF_TP_ADD_TC(tp, siginfo3); + ATF_TP_ADD_TC(tp, siginfo4); + ATF_TP_ADD_TC_HAVE_PID(tp, siginfo5); + ATF_TP_ADD_TC_PT_STEP(tp, siginfo6); + + return atf_no_error(); +} diff --git a/contrib/netbsd-tests/kernel/t_ptrace_wait.h b/contrib/netbsd-tests/kernel/t_ptrace_wait.h new file mode 100644 index 000000000000..9c6921c70683 --- /dev/null +++ b/contrib/netbsd-tests/kernel/t_ptrace_wait.h @@ -0,0 +1,431 @@ +/* $NetBSD: t_ptrace_wait.h,v 1.7 2017/01/09 22:09:20 kamil Exp $ */ + +/*- + * Copyright (c) 2016 The NetBSD Foundation, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +/* Detect plain wait(2) use-case */ +#if !defined(TWAIT_WAITPID) && \ + !defined(TWAIT_WAITID) && \ + !defined(TWAIT_WAIT3) && \ + !defined(TWAIT_WAIT4) && \ + !defined(TWAIT_WAIT6) +#define TWAIT_WAIT +#endif + +/* + * There are two classes of wait(2)-like functions: + * - wait4(2)-like accepting pid_t, optional options parameter, struct rusage* + * - wait6(2)-like accepting idtype_t, id_t, struct wrusage, mandatory options + * + * The TWAIT_FNAME value is to be used for convenience in debug messages. + * + * The TWAIT_GENERIC() macro is designed to reuse the same unmodified + * code with as many wait(2)-like functions as possible. + * + * In a common use-case wait4(2) and wait6(2)-like function can work the almost + * the same way, however there are few important differences: + * wait6(2) must specify P_PID for idtype to match wpid from wait4(2). + * To behave like wait4(2), wait6(2) the 'options' to wait must include + * WEXITED|WTRUNCATED. + * + * There are two helper macros (they purpose it to mach more than one + * wait(2)-like function): + * The TWAIT_HAVE_STATUS - specifies whether a function can retrieve + * status (as integer value). + * The TWAIT_HAVE_PID - specifies whether a function can request + * exact process identifier + * The TWAIT_HAVE_RUSAGE - specifies whether a function can request + * the struct rusage value + * + */ + +#if defined(TWAIT_WAIT) +# define TWAIT_FNAME "wait" +# define TWAIT_WAIT4TYPE(a,b,c,d) wait((b)) +# define TWAIT_GENERIC(a,b,c) wait((b)) +# define TWAIT_HAVE_STATUS 1 +#elif defined(TWAIT_WAITPID) +# define TWAIT_FNAME "waitpid" +# define TWAIT_WAIT4TYPE(a,b,c,d) waitpid((a),(b),(c)) +# define TWAIT_GENERIC(a,b,c) waitpid((a),(b),(c)) +# define TWAIT_HAVE_PID 1 +# define TWAIT_HAVE_STATUS 1 +#elif defined(TWAIT_WAITID) +# define TWAIT_FNAME "waitid" +# define TWAIT_GENERIC(a,b,c) \ + waitid(P_PID,(a),NULL,(c)|WEXITED|WTRAPPED) +# define TWAIT_WAIT6TYPE(a,b,c,d,e,f) waitid((a),(b),(f),(d)) +# define TWAIT_HAVE_PID 1 +#elif defined(TWAIT_WAIT3) +# define TWAIT_FNAME "wait3" +# define TWAIT_WAIT4TYPE(a,b,c,d) wait3((b),(c),(d)) +# define TWAIT_GENERIC(a,b,c) wait3((b),(c),NULL) +# define TWAIT_HAVE_STATUS 1 +# define TWAIT_HAVE_RUSAGE 1 +#elif defined(TWAIT_WAIT4) +# define TWAIT_FNAME "wait4" +# define TWAIT_WAIT4TYPE(a,b,c,d) wait4((a),(b),(c),(d)) +# define TWAIT_GENERIC(a,b,c) wait4((a),(b),(c),NULL) +# define TWAIT_HAVE_PID 1 +# define TWAIT_HAVE_STATUS 1 +# define TWAIT_HAVE_RUSAGE 1 +#elif defined(TWAIT_WAIT6) +# define TWAIT_FNAME "wait6" +# define TWAIT_WAIT6TYPE(a,b,c,d,e,f) wait6((a),(b),(c),(d),(e),(f)) +# define TWAIT_GENERIC(a,b,c) \ + wait6(P_PID,(a),(b),(c)|WEXITED|WTRAPPED,NULL,NULL) +# define TWAIT_HAVE_PID 1 +# define TWAIT_HAVE_STATUS 1 +#endif + +/* + * There are 3 groups of tests: + * - TWAIT_GENERIC() (wait, wait2, waitpid, wait3, wait4, wait6) + * - TWAIT_WAIT4TYPE() (wait2, waitpid, wait3, wait4) + * - TWAIT_WAIT6TYPE() (waitid, wait6) + * + * Tests only in the above categories are allowed. However some tests are not + * possible in the context requested functionality to be verified, therefore + * there are helper macros: + * - TWAIT_HAVE_PID (wait2, waitpid, waitid, wait4, wait6) + * - TWAIT_HAVE_STATUS (wait, wait2, waitpid, wait3, wait4, wait6) + * - TWAIT_HAVE_RUSAGE (wait3, wait4) + * - TWAIT_HAVE_RETPID (wait, wait2, waitpid, wait3, wait4, wait6) + * + * If there is an intention to test e.g. wait6(2) specific features in the + * ptrace(2) context, find the most matching group and with #ifdefs reduce + * functionality of less featured than wait6(2) interface (TWAIT_WAIT6TYPE). + * + * For clarity never use negative preprocessor checks, like: + * #if !defined(TWAIT_WAIT4) + * always refer to checks for positive values. + */ + +#define TEST_REQUIRE_EQ(x, y) \ +do { \ + uintmax_t vx = (x); \ + uintmax_t vy = (y); \ + int ret = vx == vy; \ + if (!ret) \ + ATF_REQUIRE_EQ_MSG(vx, vy, "%s(%ju) == %s(%ju)", \ + #x, vx, #y, vy); \ +} while (/*CONSTCOND*/0) + +/* + * A child process cannot call atf functions and expect them to magically + * work like in the parent. + * The printf(3) messaging from a child will not work out of the box as well + * without estabilishing a communication protocol with its parent. To not + * overcomplicate the tests - do not log from a child and use err(3)/errx(3) + * wrapped with FORKEE_ASSERT()/FORKEE_ASSERTX() as that is guaranteed to work. + */ +#define FORKEE_ASSERT_EQ(x, y) \ +do { \ + uintmax_t vx = (x); \ + uintmax_t vy = (y); \ + int ret = vx == vy; \ + if (!ret) \ + errx(EXIT_FAILURE, "%s:%d %s(): Assertion failed for: " \ + "%s(%ju) == %s(%ju)", __FILE__, __LINE__, __func__, \ + #x, vx, #y, vy); \ +} while (/*CONSTCOND*/0) + +#define FORKEE_ASSERTX(x) \ +do { \ + int ret = (x); \ + if (!ret) \ + errx(EXIT_FAILURE, "%s:%d %s(): Assertion failed for: %s",\ + __FILE__, __LINE__, __func__, #x); \ +} while (/*CONSTCOND*/0) + +#define FORKEE_ASSERT(x) \ +do { \ + int ret = (x); \ + if (!ret) \ + err(EXIT_FAILURE, "%s:%d %s(): Assertion failed for: %s",\ + __FILE__, __LINE__, __func__, #x); \ +} while (/*CONSTCOND*/0) + +/* + * Simplify logic for functions using general purpose registers add HAVE_GPREGS + * + * For platforms that do not implement all needed calls for simplicity assume + * that they are unsupported at all. + */ +#if defined(PT_GETREGS) \ + && defined(PT_SETREGS) \ + && defined(PTRACE_REG_PC) \ + && defined(PTRACE_REG_SET_PC) \ + && defined(PTRACE_REG_SP) \ + && defined(PTRACE_REG_INTRV) +#define HAVE_GPREGS +#endif + +/* Add guards for floating point registers */ +#if defined(PT_GETFPREGS) \ + && defined(PT_SETFPREGS) +#define HAVE_FPREGS +#endif + +/* Add guards for cpu debug registers */ +#if defined(PT_GETDBREGS) \ + && defined(PT_SETDBREGS) +#define HAVE_DBREGS +#endif + +/* + * If waitid(2) returns because one or more processes have a state change to + * report, 0 is returned. If an error is detected, a value of -1 is returned + * and errno is set to indicate the error. If WNOHANG is specified and there + * are no stopped, continued or exited children, 0 is returned. + */ +#if defined(TWAIT_WAITID) +#define TWAIT_REQUIRE_SUCCESS(a,b) TEST_REQUIRE_EQ((a), 0) +#define TWAIT_REQUIRE_FAILURE(a,b) ATF_REQUIRE_ERRNO((a),(b) == -1) +#define FORKEE_REQUIRE_SUCCESS(a,b) FORKEE_ASSERT_EQ(a, 0) +#define FORKEE_REQUIRE_FAILURE(a,b) \ + FORKEE_ASSERTX(((a) == errno) && ((b) == -1)) +#else +#define TWAIT_REQUIRE_SUCCESS(a,b) TEST_REQUIRE_EQ((a), (b)) +#define TWAIT_REQUIRE_FAILURE(a,b) ATF_REQUIRE_ERRNO((a),(b) == -1) +#define FORKEE_REQUIRE_SUCCESS(a,b) FORKEE_ASSERT_EQ(a, b) +#define FORKEE_REQUIRE_FAILURE(a,b) \ + FORKEE_ASSERTX(((a) == errno) && ((b) == -1)) +#endif + +/* + * Helper tools to verify whether status reports exited value + */ +#if TWAIT_HAVE_STATUS +static void __used +validate_status_exited(int status, int expected) +{ + ATF_REQUIRE_MSG(WIFEXITED(status), "Reported !exited process"); + ATF_REQUIRE_MSG(!WIFCONTINUED(status), "Reported continued process"); + ATF_REQUIRE_MSG(!WIFSIGNALED(status), "Reported signaled process"); + ATF_REQUIRE_MSG(!WIFSTOPPED(status), "Reported stopped process"); + + ATF_REQUIRE_EQ_MSG(WEXITSTATUS(status), expected, + "The process has exited with invalid value %d != %d", + WEXITSTATUS(status), expected); +} + +static void __used +forkee_status_exited(int status, int expected) +{ + FORKEE_ASSERTX(WIFEXITED(status)); + FORKEE_ASSERTX(!WIFCONTINUED(status)); + FORKEE_ASSERTX(!WIFSIGNALED(status)); + FORKEE_ASSERTX(!WIFSTOPPED(status)); + + FORKEE_ASSERT_EQ(WEXITSTATUS(status), expected); +} + +static void __used +validate_status_continued(int status) +{ + ATF_REQUIRE_MSG(!WIFEXITED(status), "Reported exited process"); + ATF_REQUIRE_MSG(WIFCONTINUED(status), "Reported !continued process"); + ATF_REQUIRE_MSG(!WIFSIGNALED(status), "Reported signaled process"); + ATF_REQUIRE_MSG(!WIFSTOPPED(status), "Reported stopped process"); +} + +static void __used +forkee_status_continued(int status) +{ + FORKEE_ASSERTX(!WIFEXITED(status)); + FORKEE_ASSERTX(WIFCONTINUED(status)); + FORKEE_ASSERTX(!WIFSIGNALED(status)); + FORKEE_ASSERTX(!WIFSTOPPED(status)); +} + +static void __used +validate_status_signaled(int status, int expected_termsig, int expected_core) +{ + ATF_REQUIRE_MSG(!WIFEXITED(status), "Reported exited process"); + ATF_REQUIRE_MSG(!WIFCONTINUED(status), "Reported continued process"); + ATF_REQUIRE_MSG(WIFSIGNALED(status), "Reported !signaled process"); + ATF_REQUIRE_MSG(!WIFSTOPPED(status), "Reported stopped process"); + + ATF_REQUIRE_EQ_MSG(WTERMSIG(status), expected_termsig, + "Unexpected signal received"); + + ATF_REQUIRE_EQ_MSG(WCOREDUMP(status), expected_core, + "Unexpectedly core file %s generated", expected_core ? "not" : ""); +} + +static void __used +forkee_status_signaled(int status, int expected_termsig, int expected_core) +{ + FORKEE_ASSERTX(!WIFEXITED(status)); + FORKEE_ASSERTX(!WIFCONTINUED(status)); + FORKEE_ASSERTX(WIFSIGNALED(status)); + FORKEE_ASSERTX(!WIFSTOPPED(status)); + + FORKEE_ASSERT_EQ(WTERMSIG(status), expected_termsig); + FORKEE_ASSERT_EQ(WCOREDUMP(status), expected_core); +} + +static void __used +validate_status_stopped(int status, int expected) +{ + ATF_REQUIRE_MSG(!WIFEXITED(status), "Reported exited process"); + ATF_REQUIRE_MSG(!WIFCONTINUED(status), "Reported continued process"); + ATF_REQUIRE_MSG(!WIFSIGNALED(status), "Reported signaled process"); + ATF_REQUIRE_MSG(WIFSTOPPED(status), "Reported !stopped process"); + + char st[128], ex[128]; + strlcpy(st, strsignal(WSTOPSIG(status)), sizeof(st)); + strlcpy(ex, strsignal(expected), sizeof(ex)); + + ATF_REQUIRE_EQ_MSG(WSTOPSIG(status), expected, + "Unexpected stop signal received [%s] != [%s]", st, ex); +} + +static void __used +forkee_status_stopped(int status, int expected) +{ + FORKEE_ASSERTX(!WIFEXITED(status)); + FORKEE_ASSERTX(!WIFCONTINUED(status)); + FORKEE_ASSERTX(!WIFSIGNALED(status)); + FORKEE_ASSERTX(WIFSTOPPED(status)); + + FORKEE_ASSERT_EQ(WSTOPSIG(status), expected); +} +#else +#define validate_status_exited(a,b) +#define forkee_status_exited(a,b) +#define validate_status_continued(a,b) +#define forkee_status_continued(a,b) +#define validate_status_signaled(a,b,c) +#define forkee_status_signaled(a,b,c) +#define validate_status_stopped(a,b) +#define forkee_status_stopped(a,b) +#endif + +/* This function is currently designed to be run in the main/parent process */ +static void __used +await_zombie(pid_t process) +{ + struct kinfo_proc2 p; + size_t len = sizeof(p); + + const int name[] = { + [0] = CTL_KERN, + [1] = KERN_PROC2, + [2] = KERN_PROC_PID, + [3] = process, + [4] = sizeof(p), + [5] = 1 + }; + + const size_t namelen = __arraycount(name); + + /* Await the process becoming a zombie */ + while(1) { + ATF_REQUIRE(sysctl(name, namelen, &p, &len, NULL, 0) == 0); + + if (p.p_stat == LSZOMB) + break; + + ATF_REQUIRE(usleep(1000) == 0); + } +} + +/* Happy number sequence -- this function is used to just consume cpu cycles */ +#define HAPPY_NUMBER 1 + +/* If n is not happy then its sequence ends in the cycle: + * 4, 16, 37, 58, 89, 145, 42, 20, 4, ... */ +#define SAD_NUMBER 4 + +/* Calculate the sum of the squares of the digits of n */ +static unsigned __used +dsum(unsigned n) +{ + unsigned sum, x; + for (sum = 0; n; n /= 10) { + x = n % 10; + sum += x * x; + } + return sum; +} + +/* + * XXX: Disabled optimization is required to make tests for hardware assisted + * traps in .text functional + * + * Tested with GCC 5.4 on NetBSD 7.99.47 amd64 + */ +static int __used +#ifdef __clang__ +__attribute__((__optnone__)) +#else +__attribute__((__optimize__("O0"))) +#endif +check_happy(unsigned n) +{ + for (;;) { + unsigned total = dsum(n); + + if (total == HAPPY_NUMBER) + return 1; + if (total == SAD_NUMBER) + return 0; + + n = total; + } +} + +#if defined(TWAIT_HAVE_PID) +#define ATF_TP_ADD_TC_HAVE_PID(a,b) ATF_TP_ADD_TC(a,b) +#else +#define ATF_TP_ADD_TC_HAVE_PID(a,b) +#endif + +#if defined(HAVE_GPREGS) +#define ATF_TP_ADD_TC_HAVE_GPREGS(a,b) ATF_TP_ADD_TC(a,b) +#else +#define ATF_TP_ADD_TC_HAVE_GPREGS(a,b) +#endif + +#if defined(HAVE_FPREGS) +#define ATF_TP_ADD_TC_HAVE_FPREGS(a,b) ATF_TP_ADD_TC(a,b) +#else +#define ATF_TP_ADD_TC_HAVE_FPREGS(a,b) +#endif + +#if defined(PT_STEP) +#define ATF_TP_ADD_TC_PT_STEP(a,b) ATF_TP_ADD_TC(a,b) +#else +#define ATF_TP_ADD_TC_PT_STEP(a,b) +#endif + +#if defined(__HAVE_PTRACE_WATCHPOINTS) +#define ATF_TP_ADD_TC_HAVE_PTRACE_WATCHPOINTS(a,b) ATF_TP_ADD_TC(a,b) +#else +#define ATF_TP_ADD_TC_HAVE_PTRACE_WATCHPOINTS(a,b) +#endif diff --git a/contrib/netbsd-tests/kernel/t_ptrace_wait3.c b/contrib/netbsd-tests/kernel/t_ptrace_wait3.c new file mode 100644 index 000000000000..c136431af818 --- /dev/null +++ b/contrib/netbsd-tests/kernel/t_ptrace_wait3.c @@ -0,0 +1,30 @@ +/* $NetBSD: t_ptrace_wait3.c,v 1.1 2016/11/07 21:09:03 kamil Exp $ */ + +/*- + * Copyright (c) 2016 The NetBSD Foundation, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#define TWAIT_WAIT3 +#include "t_ptrace_wait.c" diff --git a/contrib/netbsd-tests/kernel/t_ptrace_wait4.c b/contrib/netbsd-tests/kernel/t_ptrace_wait4.c new file mode 100644 index 000000000000..7ae771bb7075 --- /dev/null +++ b/contrib/netbsd-tests/kernel/t_ptrace_wait4.c @@ -0,0 +1,30 @@ +/* $NetBSD: t_ptrace_wait4.c,v 1.1 2016/11/07 21:09:03 kamil Exp $ */ + +/*- + * Copyright (c) 2016 The NetBSD Foundation, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#define TWAIT_WAIT4 +#include "t_ptrace_wait.c" diff --git a/contrib/netbsd-tests/kernel/t_ptrace_wait6.c b/contrib/netbsd-tests/kernel/t_ptrace_wait6.c new file mode 100644 index 000000000000..122cb1d9a1cc --- /dev/null +++ b/contrib/netbsd-tests/kernel/t_ptrace_wait6.c @@ -0,0 +1,30 @@ +/* $NetBSD: t_ptrace_wait6.c,v 1.1 2016/11/07 21:09:03 kamil Exp $ */ + +/*- + * Copyright (c) 2016 The NetBSD Foundation, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#define TWAIT_WAIT6 +#include "t_ptrace_wait.c" diff --git a/contrib/netbsd-tests/kernel/t_ptrace_waitid.c b/contrib/netbsd-tests/kernel/t_ptrace_waitid.c new file mode 100644 index 000000000000..1c09be70d8a5 --- /dev/null +++ b/contrib/netbsd-tests/kernel/t_ptrace_waitid.c @@ -0,0 +1,30 @@ +/* $NetBSD: t_ptrace_waitid.c,v 1.1 2016/11/07 21:09:03 kamil Exp $ */ + +/*- + * Copyright (c) 2016 The NetBSD Foundation, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#define TWAIT_WAITID +#include "t_ptrace_wait.c" diff --git a/contrib/netbsd-tests/kernel/t_ptrace_waitpid.c b/contrib/netbsd-tests/kernel/t_ptrace_waitpid.c new file mode 100644 index 000000000000..c8f107dbda51 --- /dev/null +++ b/contrib/netbsd-tests/kernel/t_ptrace_waitpid.c @@ -0,0 +1,30 @@ +/* $NetBSD: t_ptrace_waitpid.c,v 1.1 2016/11/07 21:09:03 kamil Exp $ */ + +/*- + * Copyright (c) 2016 The NetBSD Foundation, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#define TWAIT_WAITPID +#include "t_ptrace_wait.c" diff --git a/contrib/netbsd-tests/lib/libc/arch/sparc64/exec_prot_support.c b/contrib/netbsd-tests/lib/libc/arch/sparc64/exec_prot_support.c index 474cfc742f69..8ca38b4fb209 100644 --- a/contrib/netbsd-tests/lib/libc/arch/sparc64/exec_prot_support.c +++ b/contrib/netbsd-tests/lib/libc/arch/sparc64/exec_prot_support.c @@ -1,4 +1,4 @@ -/* $NetBSD: exec_prot_support.c,v 1.1 2011/07/18 23:16:10 jym Exp $ */ +/* $NetBSD: exec_prot_support.c,v 1.2 2016/12/31 11:51:20 martin Exp $ */ /*- * Copyright (c) 2011 The NetBSD Foundation, Inc. @@ -30,12 +30,13 @@ */ #include -__RCSID("$NetBSD: exec_prot_support.c,v 1.1 2011/07/18 23:16:10 jym Exp $"); +__RCSID("$NetBSD: exec_prot_support.c,v 1.2 2016/12/31 11:51:20 martin Exp $"); #include "../../common/exec_prot.h" int exec_prot_support(void) { - return NOTIMPL; + + return PERPAGE_XP; } diff --git a/contrib/netbsd-tests/lib/libc/arch/sparc64/return_one.S b/contrib/netbsd-tests/lib/libc/arch/sparc64/return_one.S index 3495260d6f68..ec8bcdd9de7f 100644 --- a/contrib/netbsd-tests/lib/libc/arch/sparc64/return_one.S +++ b/contrib/netbsd-tests/lib/libc/arch/sparc64/return_one.S @@ -1,8 +1,11 @@ -/* $NetBSD: return_one.S,v 1.1 2011/07/18 23:16:10 jym Exp $ */ +/* $NetBSD: return_one.S,v 1.2 2016/12/31 11:51:20 martin Exp $ */ #include -.globl return_one, return_one_end; +.global return_one_end -return_one: return_one_end: - nop +ENTRY(return_one) +return_one: + retl + mov 1, %o0 +return_one_end: diff --git a/contrib/netbsd-tests/lib/libc/db/h_db.c b/contrib/netbsd-tests/lib/libc/db/h_db.c index dfb13859d3f2..dd19a034aa36 100644 --- a/contrib/netbsd-tests/lib/libc/db/h_db.c +++ b/contrib/netbsd-tests/lib/libc/db/h_db.c @@ -1,4 +1,4 @@ -/* $NetBSD: h_db.c,v 1.1 2011/01/07 15:05:58 pgoyette Exp $ */ +/* $NetBSD: h_db.c,v 1.3 2016/09/24 21:18:22 christos Exp $ */ /*- * Copyright (c) 1992, 1993, 1994 @@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1992, 1993, 1994\ #if 0 static char sccsid[] = "@(#)dbtest.c 8.17 (Berkeley) 9/1/94"; #else -__RCSID("$NetBSD: h_db.c,v 1.1 2011/01/07 15:05:58 pgoyette Exp $"); +__RCSID("$NetBSD: h_db.c,v 1.3 2016/09/24 21:18:22 christos Exp $"); #endif #endif /* not lint */ @@ -57,12 +57,13 @@ __RCSID("$NetBSD: h_db.c,v 1.1 2011/01/07 15:05:58 pgoyette Exp $"); #include #include #include +#include "btree.h" enum S { COMMAND, COMPARE, GET, PUT, REMOVE, SEQ, SEQFLAG, KEY, DATA }; static void compare(DBT *, DBT *); static DBTYPE dbtype(const char *); -static void dump(DB *, int); +static void dump(DB *, int, int); static void get(DB *, DBT *); static void getdata(DB *, DBT *, DBT *); static void put(DB *, DBT *, DBT *); @@ -73,6 +74,9 @@ static void *rfile(char *, size_t *); static void seq(DB *, DBT *); static u_int setflags(char *); static void *setinfo(DBTYPE, char *); +#ifdef __NetBSD__ +static void unlinkpg(DB *); +#endif static void usage(void) __attribute__((__noreturn__)); static void *xcopy(void *, size_t); static void chkcmd(enum S); @@ -82,6 +86,9 @@ static void chkkey(enum S); #ifdef STATISTICS extern void __bt_stat(DB *); #endif +#ifdef __NetBSD__ +extern int __bt_relink(BTREE *, PAGE *); +#endif static DBTYPE type; /* Database type. */ static void *infop; /* Iflags. */ @@ -315,8 +322,16 @@ lkey: switch (command) { } break; case 'o': - dump(dbp, p[1] == 'r'); + dump(dbp, p[1] == 'r', 0); break; +#ifdef __NetBSD__ + case 'O': + dump(dbp, p[1] == 'r', 1); + break; + case 'u': + unlinkpg(dbp); + break; +#endif default: errx(1, "line %zu: %s: unknown command character", lineno, p); @@ -483,17 +498,25 @@ seq(DB *dbp, DBT *kp) } static void -dump(DB *dbp, int rev) +dump(DB *dbp, int rev, int recurse) { DBT key, data; int xflags, nflags; if (rev) { xflags = R_LAST; +#ifdef __NetBSD__ + nflags = recurse ? R_RPREV : R_PREV; +#else nflags = R_PREV; +#endif } else { xflags = R_FIRST; +#ifdef __NetBSD__ + nflags = recurse ? R_RNEXT : R_NEXT; +#else nflags = R_NEXT; +#endif } for (;; xflags = nflags) switch (dbp->seq(dbp, &key, &data, xflags)) { @@ -511,6 +534,42 @@ dump(DB *dbp, int rev) done: return; } +#ifdef __NetBSD__ +void +unlinkpg(DB *dbp) +{ + BTREE *t = dbp->internal; + PAGE *h = NULL; + pgno_t pg; + + for (pg = P_ROOT; pg < t->bt_mp->npages; + mpool_put(t->bt_mp, h, 0), pg++) { + if ((h = mpool_get(t->bt_mp, pg, 0)) == NULL) + break; + /* Look for a nonempty leaf page that has both left + * and right siblings. */ + if (h->prevpg == P_INVALID || h->nextpg == P_INVALID) + continue; + if (NEXTINDEX(h) == 0) + continue; + if ((h->flags & (P_BLEAF | P_RLEAF))) + break; + } + if (h == NULL || pg == t->bt_mp->npages) { + errx(1, "%s: no appropriate page found", __func__); + return; + } + if (__bt_relink(t, h) != 0) { + perror("unlinkpg"); + goto cleanup; + } + h->prevpg = P_INVALID; + h->nextpg = P_INVALID; +cleanup: + mpool_put(t->bt_mp, h, MPOOL_DIRTY); +} +#endif + static u_int setflags(char *s) { @@ -725,7 +784,11 @@ static void usage(void) { (void)fprintf(stderr, - "Usage: %s [-l] [-f file] [-i info] [-o file] type script\n", - getprogname()); +#ifdef __NetBSD__ + "Usage: %s [-lu] [-f file] [-i info] [-o file] [-O file] " +#else + "Usage: %s [-l] [-f file] [-i info] [-o file] " +#endif + "type script\n", getprogname()); exit(1); } diff --git a/contrib/netbsd-tests/lib/libc/db/t_db.sh b/contrib/netbsd-tests/lib/libc/db/t_db.sh index eb6b8c9250d1..6858e3610a4c 100755 --- a/contrib/netbsd-tests/lib/libc/db/t_db.sh +++ b/contrib/netbsd-tests/lib/libc/db/t_db.sh @@ -1,4 +1,4 @@ -# $NetBSD: t_db.sh,v 1.6 2015/11/18 18:35:35 christos Exp $ +# $NetBSD: t_db.sh,v 1.7 2016/09/24 20:12:33 christos Exp $ # # Copyright (c) 2008 The NetBSD Foundation, Inc. # All rights reserved. @@ -563,6 +563,7 @@ delete_recno_body() h_repeated() { + local type="$1" TMPDIR="$(pwd)/db_dir"; export TMPDIR mkdir ${TMPDIR} @@ -581,7 +582,7 @@ h_repeated() } }' >in - $(prog_db) btree in + $(prog_db) $type in } atf_test_case repeated_btree @@ -641,11 +642,10 @@ duplicate_btree_body() h_cursor_flags() { + local type=$1 TMPDIR="$(pwd)/db_dir"; export TMPDIR mkdir ${TMPDIR} - type=$1 - echo $SEVEN_SEVEN | awk '{ for (i = 1; i <= 20; ++i) @@ -784,6 +784,7 @@ h_byte_orders() echo p echo k$i echo d$i + echo S echo g echo k$i done >in @@ -974,6 +975,298 @@ bsize_torture_body() done } +atf_test_case btree_weird_page_split +btree_weird_page_split_head() +{ + atf_set "descr" \ + "Test for a weird page split condition where an insertion " \ + "into index 0 of a page that would cause the new item to " \ + "be the only item on the left page results in index 0 of " \ + "the right page being erroneously skipped; this only " \ + "happens with one particular key+data length for each page size." +} +btree_weird_page_split_body() +{ + for psize in 512 1024 2048 4096 8192; do + echo " page size $psize" + kdsizes=`awk 'BEGIN { + psize = '$psize'; hsize = int(psize/2); + for (kdsize = hsize-40; kdsize <= hsize; kdsize++) { + print kdsize; + } + }' /dev/null` + + # Use a series of keylen+datalen values in the right + # neighborhood to find the one that triggers the bug. + # We could compute the exact size that triggers the + # bug but this additional fuzz may be useful. + + # Insert keys in reverse order to maximize the chances + # for a split on index 0. + + for kdsize in $kdsizes; do + awk 'BEGIN { + kdsize = '$kdsize'; + for (i = 8; i-- > 0; ) { + s = sprintf("a%03d:%09d", i, kdsize); + for (j = 0; j < kdsize-20; j++) { + s = s "x"; + } + printf("p\nka%03d\nd%s\n", i, s); + } + print "o"; + }' /dev/null > in + sed -n 's/^d//p' in | sort > exp + atf_check -o file:exp \ + "$(prog_db)" -i psize=$psize btree in + done + done +} + +# Extremely tricky test attempting to replicate some unusual database +# corruption seen in the field: pieces of the database becoming +# inaccessible to random access, sequential access, or both. The +# hypothesis is that at least some of these are triggered by the bug +# in page splits on index 0 with a particular exact keylen+datalen. +# (See Test 40.) For psize=4096, this size is exactly 2024. + +# The order of operations here relies on very specific knowledge of +# the internals of the btree access method in order to place records +# at specific offsets in a page and to create certain keys on internal +# pages. The to-be-split page immediately prior to the bug-triggering +# split has the following properties: +# +# * is not the leftmost leaf page +# * key on the parent page is compares less than the key of the item +# on index 0 +# * triggering record's key also compares greater than the key on the +# parent page + +# Additionally, we prime the mpool LRU chain so that the head page on +# the chain has the following properties: +# +# * record at index 0 is located where it will not get overwritten by +# items written to the right-hand page during the split +# * key of the record at index 0 compares less than the key of the +# bug-triggering record + +# If the page-split bug exists, this test appears to create a database +# where some records are inaccessible to a search, but still remain in +# the file and are accessible by sequential traversal. At least one +# record gets duplicated out of sequence. + +atf_test_case btree_tricky_page_split +btree_tricky_page_split_head() +{ + atf_set "descr" \ + "btree: no unsearchables due to page split on index 0" +} +btree_tricky_page_split_body() +{ + list=`(for i in a b c d; do + for j in 990 998 999; do + echo g ${i}${j} 1024 + done + done; + echo g y997 2014 + for i in y z; do + for j in 998 999; do + echo g ${i}${j} 1024 + done + done)` + # Exact number for trigger condition accounts for newlines + # retained by dbtest with -ofile but not without; we use + # -ofile, so count newlines. keylen=5,datalen=5+2014 for + # psize=4096 here. + (cat - < in + (echo "$list"; echo "$list") | awk '{ + s = $2; + for (i = 0; i < $3; i++) { + s = s "x"; + } + print s; + }' > exp + atf_check -o file:exp \ + "$(prog_db)" -i psize=4096 btree in +} + +# Begin FreeBSD +if false; then +# End FreeBSD +atf_test_case btree_recursive_traversal +btree_recursive_traversal_head() +{ + atf_set "descr" \ + "btree: Test for recursive traversal successfully " \ + "retrieving records that are inaccessible to normal " \ + "sequential 'sibling-link' traversal. This works by " \ + "unlinking a few leaf pages but leaving their parent " \ + "links intact. To verify that the unlink actually makes " \ + "records inaccessible, the test first uses 'o' to do a " \ + "normal sequential traversal, followed by 'O' to do a " \ + "recursive traversal." +} +btree_recursive_traversal_body() +{ + fill="abcdefghijklmnopqrstuvwxyzy" + script='{ + for (i = 0; i < 20000; i++) { + printf("p\nkAA%05d\nd%05d%s\n", i, i, $0); + } + print "u"; + print "u"; + print "u"; + print "u"; + }' + (echo $fill | awk "$script"; echo o) > in1 + echo $fill | + awk '{ + for (i = 0; i < 20000; i++) { + if (i >= 5 && i <= 40) + continue; + printf("%05d%s\n", i, $0); + } + }' > exp1 + atf_check -o file:exp1 \ + "$(prog_db)" -i psize=512 btree in1 + echo $fill | + awk '{ + for (i = 0; i < 20000; i++) { + printf("%05d%s\n", i, $0); + } + }' > exp2 + (echo $fill | awk "$script"; echo O) > in2 + atf_check -o file:exp2 \ + "$(prog_db)" -i psize=512 btree in2 +} +# Begin FreeBSD +fi +# End FreeBSD + +atf_test_case btree_byteswap_unaligned_access_bksd +btree_byteswap_unaligned_access_bksd_head() +{ + atf_set "descr" \ + "btree: big key, small data, byteswap unaligned access" +} +btree_byteswap_unaligned_access_bksd_body() +{ + (echo foo; echo bar) | + awk '{ + s = $0 + for (i = 0; i < 488; i++) { + s = s "x"; + } + printf("p\nk%s\ndx\n", s); + }' > in + for order in 1234 4321; do + atf_check \ + "$(prog_db)" -o out -i psize=512,lorder=$order btree in + done +} + +atf_test_case btree_byteswap_unaligned_access_skbd +btree_byteswap_unaligned_access_skbd_head() +{ + atf_set "descr" \ + "btree: small key, big data, byteswap unaligned access" +} +btree_byteswap_unaligned_access_skbd_body() +{ + # 484 = 512 - 20 (header) - 7 ("foo1234") - 1 (newline) + (echo foo1234; echo bar1234) | + awk '{ + s = $0 + for (i = 0; i < 484; i++) { + s = s "x"; + } + printf("p\nk%s\nd%s\n", $0, s); + }' > in + for order in 1234 4321; do + atf_check \ + "$(prog_db)" -o out -i psize=512,lorder=$order btree in + done +} + +atf_test_case btree_known_byte_order +btree_known_byte_order_head() +{ + atf_set "descr" \ + "btree: small key, big data, known byte order" +} +btree_known_byte_order_body() +{ + local a="-i psize=512,lorder=" + + (echo foo1234; echo bar1234) | + awk '{ + s = $0 + for (i = 0; i < 484; i++) { + s = s "x"; + } + printf("%s\n", s); + }' > exp + (echo foo1234; echo bar1234) | + awk '{ + s = $0 + for (i = 0; i < 484; i++) { + s = s "x"; + } + printf("p\nk%s\nd%s\n", $0, s); + }' > in1 + for order in 1234 4321; do + atf_check \ + "$(prog_db)" -f out.$order $a$order btree in1 + done + (echo g; echo kfoo1234; echo g; echo kbar1234) > in2 + for order in 1234 4321; do + atf_check -o file:exp \ + "$(prog_db)" -s -f out.$order $a$order btree in2 + done +} + atf_init_test_cases() { atf_add_test_case small_btree @@ -1002,4 +1295,16 @@ atf_init_test_cases() atf_add_test_case bsize_ffactor atf_add_test_case four_char_hash atf_add_test_case bsize_torture + atf_add_test_case btree_weird_page_split + atf_add_test_case btree_tricky_page_split + # Begin FreeBSD + if false; then + # End FreeBSD + atf_add_test_case btree_recursive_traversal + # Begin FreeBSD + fi + # End FreeBSD + atf_add_test_case btree_byteswap_unaligned_access_bksd + atf_add_test_case btree_byteswap_unaligned_access_skbd + atf_add_test_case btree_known_byte_order } diff --git a/contrib/netbsd-tests/lib/libc/gen/posix_spawn/t_spawnattr.c b/contrib/netbsd-tests/lib/libc/gen/posix_spawn/t_spawnattr.c index 78313cd8f809..2085b9e06394 100644 --- a/contrib/netbsd-tests/lib/libc/gen/posix_spawn/t_spawnattr.c +++ b/contrib/netbsd-tests/lib/libc/gen/posix_spawn/t_spawnattr.c @@ -60,16 +60,16 @@ get_different_scheduler(void) /* get current schedule policy */ scheduler = sched_getscheduler(0); - for (i = 0; i < nitems(schedulers); i++) { + for (i = 0; i < __arraycount(schedulers); i++) { if (schedulers[i] == scheduler) break; } - ATF_REQUIRE_MSG(i < nitems(schedulers), + ATF_REQUIRE_MSG(i < __arraycount(schedulers), "Unknown current scheduler %d", scheduler); - + /* new scheduler */ i++; - if (i >= nitems(schedulers)) + if (i >= __arraycount(schedulers)) i = 0; return schedulers[i]; } @@ -85,7 +85,7 @@ get_different_priority(int scheduler) sched_getparam(0, ¶m); priority = param.sched_priority; - + /* * Change numerical value of the priority, to ensure that it * was set for the spawned child. @@ -127,7 +127,7 @@ ATF_TC_BODY(t_spawnattr, tc) scheduler = get_different_scheduler(); priority = get_different_priority(scheduler); sp.sched_priority = priority; - + sigemptyset(&sig); sigaddset(&sig, SIGUSR1); diff --git a/contrib/netbsd-tests/lib/libc/gen/t_dir.c b/contrib/netbsd-tests/lib/libc/gen/t_dir.c index c05873870a3b..362692f7df0d 100644 --- a/contrib/netbsd-tests/lib/libc/gen/t_dir.c +++ b/contrib/netbsd-tests/lib/libc/gen/t_dir.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_dir.c,v 1.8 2017/01/11 07:26:17 christos Exp $ */ +/* $NetBSD: t_dir.c,v 1.10 2017/01/11 18:15:02 christos Exp $ */ /*- * Copyright (c) 2010 The NetBSD Foundation, Inc. @@ -75,33 +75,40 @@ ATF_TC_BODY(seekdir_basic, tc) /* skip two for . and .. */ entry = readdir(dp); + ATF_REQUIRE_MSG(entry != NULL, "readdir[%s] failed: %s", + ".", strerror(errno)); + entry = readdir(dp); + ATF_REQUIRE_MSG(entry != NULL, "readdir[%s] failed: %s", + "..", strerror(errno)); /* get first entry */ entry = readdir(dp); + ATF_REQUIRE_MSG(entry != NULL, "readdir[%s] failed: %s", + "first", strerror(errno)); + here = telldir(dp); - ATF_REQUIRE_MSG(here != -1, - "telldir failed: %s", strerror(errno)); + ATF_REQUIRE_MSG(here != -1, "telldir failed: %s", strerror(errno)); /* get second entry */ entry = readdir(dp); -#ifdef __FreeBSD__ - ATF_REQUIRE_MSG(entry != NULL, - "readdir failed: %s", strerror(errno)); -#endif + ATF_REQUIRE_MSG(entry != NULL, "readdir[%s] failed: %s", + "second", strerror(errno)); + wasname = strdup(entry->d_name); if (wasname == NULL) atf_tc_fail("cannot allocate memory"); /* get third entry */ entry = readdir(dp); + ATF_REQUIRE_MSG(entry != NULL, "readdir[%s] failed: %s", + "third", strerror(errno)); /* try to return to the position after the first entry */ seekdir(dp, here); entry = readdir(dp); - - if (entry == NULL) - atf_tc_fail("entry 1 not found"); + ATF_REQUIRE_MSG(entry != NULL, "readdir[%s] failed: %s", + "first[1]", strerror(errno)); if (strcmp(entry->d_name, wasname) != 0) atf_tc_fail("1st seekdir found wrong name"); @@ -109,18 +116,17 @@ ATF_TC_BODY(seekdir_basic, tc) seekdir(dp, here); here = telldir(dp); entry = readdir(dp); - - if (entry == NULL) - atf_tc_fail("entry 2 not found"); + ATF_REQUIRE_MSG(entry != NULL, "readdir[%s] failed: %s", + "second[1]", strerror(errno)); if (strcmp(entry->d_name, wasname) != 0) atf_tc_fail("2nd seekdir found wrong name"); /* One more time, to make sure that telldir() doesn't affect result */ seekdir(dp, here); entry = readdir(dp); + ATF_REQUIRE_MSG(entry != NULL, "readdir[%s] failed: %s", + "third[1]", strerror(errno)); - if (entry == NULL) - atf_tc_fail("entry 3 not found"); if (strcmp(entry->d_name, wasname) != 0) atf_tc_fail("3rd seekdir found wrong name"); diff --git a/contrib/netbsd-tests/lib/libc/gen/t_fnmatch.c b/contrib/netbsd-tests/lib/libc/gen/t_fnmatch.c index c0064c38f66a..69ee8d2f793d 100644 --- a/contrib/netbsd-tests/lib/libc/gen/t_fnmatch.c +++ b/contrib/netbsd-tests/lib/libc/gen/t_fnmatch.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_fnmatch.c,v 1.6 2014/10/12 22:33:41 christos Exp $ */ +/* $NetBSD: t_fnmatch.c,v 1.7 2016/10/31 05:08:53 dholland Exp $ */ /*- * Copyright (c) 2012 The NetBSD Foundation, Inc. @@ -29,7 +29,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include -__RCSID("$NetBSD: t_fnmatch.c,v 1.6 2014/10/12 22:33:41 christos Exp $"); +__RCSID("$NetBSD: t_fnmatch.c,v 1.7 2016/10/31 05:08:53 dholland Exp $"); #include #include @@ -166,6 +166,7 @@ ATF_TC_BODY(fnmatch_initialbracket, tc) ATF_CHECK(fnmatch("[!]a-]", "b", 0) == 0); ATF_CHECK(fnmatch("[]-_]", "^", 0) == 0); /* range: ']', '^', '_' */ ATF_CHECK(fnmatch("[!]-_]", "X", 0) == 0); + ATF_CHECK(fnmatch("[A-\\\\]", "[", 0) == 0); ATF_CHECK(fnmatch("[a-z]/[a-z]", "a/b", 0) == 0); ATF_CHECK(fnmatch("[*]/b", "*/b", 0) == 0); ATF_CHECK(fnmatch("[?]/b", "?/b", 0) == 0); diff --git a/contrib/netbsd-tests/lib/libc/gen/t_sleep.c b/contrib/netbsd-tests/lib/libc/gen/t_sleep.c index 5e364569fbc2..e85867a3f4c1 100644 --- a/contrib/netbsd-tests/lib/libc/gen/t_sleep.c +++ b/contrib/netbsd-tests/lib/libc/gen/t_sleep.c @@ -27,6 +27,7 @@ */ #ifdef __FreeBSD__ +/* kqueue(2) on FreeBSD requires sys/types.h for uintptr_t; NetBSD doesn't. */ #include #endif #include diff --git a/contrib/netbsd-tests/lib/libc/rpc/t_rpc.c b/contrib/netbsd-tests/lib/libc/rpc/t_rpc.c index 28a8763fcaaf..bce363375be5 100644 --- a/contrib/netbsd-tests/lib/libc/rpc/t_rpc.c +++ b/contrib/netbsd-tests/lib/libc/rpc/t_rpc.c @@ -1,7 +1,7 @@ -/* $NetBSD: t_rpc.c,v 1.9 2015/11/27 13:59:40 christos Exp $ */ +/* $NetBSD: t_rpc.c,v 1.10 2016/08/27 14:36:22 christos Exp $ */ #include -__RCSID("$NetBSD: t_rpc.c,v 1.9 2015/11/27 13:59:40 christos Exp $"); +__RCSID("$NetBSD: t_rpc.c,v 1.10 2016/08/27 14:36:22 christos Exp $"); #include #include @@ -21,7 +21,7 @@ __RCSID("$NetBSD: t_rpc.c,v 1.9 2015/11/27 13:59:40 christos Exp $"); #define SKIPX(ev, msg, ...) do { \ atf_tc_skip(msg, __VA_ARGS__); \ - return; \ + return ev; \ } while(/*CONSTCOND*/0) #ifdef __FreeBSD__ @@ -32,8 +32,8 @@ __RCSID("$NetBSD: t_rpc.c,v 1.9 2015/11/27 13:59:40 christos Exp $"); #endif #else -#define ERRX(ev, msg, ...) errx(ev, msg, __VA_ARGS__) -#define SKIPX(ev, msg, ...) errx(ev, msg, __VA_ARGS__) +#define ERRX(ev, msg, ...) errx(EXIT_FAILURE, msg, __VA_ARGS__) +#define SKIPX(ev, msg, ...) errx(EXIT_FAILURE, msg, __VA_ARGS__) #endif #ifdef DEBUG @@ -83,7 +83,7 @@ onehost(const char *host, const char *transp) __rpc_control(CLCR_SET_RPCB_TIMEOUT, &tv); if ((clnt = clnt_create(host, RPCBPROG, RPCBVERS, transp)) == NULL) - SKIPX(EXIT_FAILURE, "clnt_create (%s)", clnt_spcreateerror("")); + SKIPX(, "clnt_create (%s)", clnt_spcreateerror("")); tv.tv_sec = 1; tv.tv_usec = 0; @@ -95,7 +95,7 @@ onehost(const char *host, const char *transp) if (clnt_call(clnt, RPCBPROC_NULL, xdr_void, NULL, xdr_void, NULL, tv) != RPC_SUCCESS) #endif - ERRX(EXIT_FAILURE, "clnt_call (%s)", clnt_sperror(clnt, "")); + ERRX(, "clnt_call (%s)", clnt_sperror(clnt, "")); clnt_control(clnt, CLGET_SVC_ADDR, (char *) &addr); reply(NULL, &addr, NULL); } @@ -117,13 +117,13 @@ server(struct svc_req *rqstp, SVCXPRT *transp) switch (rqstp->rq_proc) { case NULLPROC: if (!svc_sendreply(transp, (xdrproc_t)xdr_void, NULL)) - ERRX(EXIT_FAILURE, "svc_sendreply failed %d", 0); + ERRX(, "svc_sendreply failed %d", 0); return; case PLUSONE: break; case DESTROY: if (!svc_sendreply(transp, (xdrproc_t)xdr_void, NULL)) - ERRX(EXIT_FAILURE, "svc_sendreply failed %d", 0); + ERRX(, "svc_sendreply failed %d", 0); svc_destroy(transp); exit(0); default: @@ -138,7 +138,7 @@ server(struct svc_req *rqstp, SVCXPRT *transp) DPRINTF("About to increment\n"); num++; if (!svc_sendreply(transp, (xdrproc_t)xdr_int, (void *)&num)) - ERRX(EXIT_FAILURE, "svc_sendreply failed %d", 1); + ERRX(, "svc_sendreply failed %d", 1); DPRINTF("Leaving server procedure.\n"); } @@ -195,13 +195,9 @@ regtest(const char *hostname, const char *transp, const char *arg, int p) svc_fdset_init(p ? SVC_FDSET_POLL : 0); #endif if (!svc_create(server, PROGNUM, VERSNUM, transp)) -#ifdef __NetBSD__ - ERRX(EXIT_FAILURE, "Cannot create server %d", num); -#else { SKIPXI(EXIT_FAILURE, "Cannot create server %d", num); } -#endif switch ((pid = fork())) { case 0: diff --git a/contrib/netbsd-tests/lib/libc/stdlib/t_strtod.c b/contrib/netbsd-tests/lib/libc/stdlib/t_strtod.c index 905306d042bf..06f2de09c50b 100644 --- a/contrib/netbsd-tests/lib/libc/stdlib/t_strtod.c +++ b/contrib/netbsd-tests/lib/libc/stdlib/t_strtod.c @@ -51,10 +51,6 @@ static const char * const inf_strings[] = const char *nan_string = "NaN(x)y"; #endif -#ifdef __FreeBSD__ -#define __HAVE_LONG_DOUBLE -#endif - ATF_TC(strtod_basic); ATF_TC_HEAD(strtod_basic, tc) { diff --git a/contrib/netbsd-tests/lib/libc/string/t_memcpy.c b/contrib/netbsd-tests/lib/libc/string/t_memcpy.c index 5bbd924b6619..64cdb29602ab 100644 --- a/contrib/netbsd-tests/lib/libc/string/t_memcpy.c +++ b/contrib/netbsd-tests/lib/libc/string/t_memcpy.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_memcpy.c,v 1.5 2013/03/17 02:23:31 christos Exp $ */ +/* $NetBSD: t_memcpy.c,v 1.6 2017/01/11 18:05:54 christos Exp $ */ /*- * Copyright (c) 2010 The NetBSD Foundation, Inc. @@ -108,12 +108,8 @@ ATF_TC_BODY(memcpy_basic, tc) if (i != j) runTest(start[i], start[j]); MD5End(mc, result); -#ifdef __NetBSD__ - ATF_REQUIRE_EQ(strcmp(result, goodResult), 0); -#else ATF_REQUIRE_EQ_MSG(strcmp(result, goodResult), 0, "%s != %s", result, goodResult); -#endif } ATF_TC(memccpy_simple); diff --git a/contrib/netbsd-tests/lib/libc/string/t_memmem.c b/contrib/netbsd-tests/lib/libc/string/t_memmem.c index c11b6982b716..5bf60cec3059 100644 --- a/contrib/netbsd-tests/lib/libc/string/t_memmem.c +++ b/contrib/netbsd-tests/lib/libc/string/t_memmem.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_memmem.c,v 1.2 2011/07/07 08:27:36 jruoho Exp $ */ +/* $NetBSD: t_memmem.c,v 1.3 2017/01/11 18:07:37 christos Exp $ */ /*- * Copyright (c) 2005 The NetBSD Foundation, Inc. diff --git a/contrib/netbsd-tests/lib/libc/sync/cpp_atomic_ops_linkable.cc b/contrib/netbsd-tests/lib/libc/sync/cpp_atomic_ops_linkable.cc index 742685103dba..e7822b768d7f 100644 --- a/contrib/netbsd-tests/lib/libc/sync/cpp_atomic_ops_linkable.cc +++ b/contrib/netbsd-tests/lib/libc/sync/cpp_atomic_ops_linkable.cc @@ -1,4 +1,4 @@ -/* $NetBSD: cpp_atomic_ops_linkable.cc,v 1.4 2016/02/27 18:50:39 joerg Exp $ */ +/* $NetBSD: cpp_atomic_ops_linkable.cc,v 1.5 2017/01/11 12:10:26 joerg Exp $ */ /*- * Copyright (c) 2014 The NetBSD Foundation, Inc. @@ -58,19 +58,13 @@ private: volatile std::atomic m_val; }; -#if defined(__clang__) && defined(__sparc64__) -#define NO_SHORT_ATOMICS -#endif - int main(int argc, char **argv) { -#ifndef NO_SHORT_ATOMICS ATest(); ATest(); ATest(); ATest(); ATest(); -#endif ATest(); ATest(); ATest(); @@ -79,29 +73,23 @@ int main(int argc, char **argv) ATest(); ATest(); #endif -#ifndef NO_SHORT_ATOMICS ATest(); -#endif ATest(); ATest(); -#ifndef NO_SHORT_ATOMICS ATest(); ATest(); ATest(); ATest(); -#endif ATest(); ATest(); #ifdef __HAVE_ATOMIC64_OPS ATest(); ATest(); #endif -#ifndef NO_SHORT_ATOMICS ATest(); ATest(); ATest(); ATest(); -#endif ATest(); ATest(); #ifdef __HAVE_ATOMIC64_OPS @@ -115,5 +103,5 @@ int main(int argc, char **argv) #ifdef __HAVE_ATOMIC64_OPS ATest(); ATest(); -#endif /* NO_SHORT_ATOMICS */ +#endif } diff --git a/contrib/netbsd-tests/lib/libc/sys/t_access.c b/contrib/netbsd-tests/lib/libc/sys/t_access.c index e15241febc64..c537ecaf954b 100644 --- a/contrib/netbsd-tests/lib/libc/sys/t_access.c +++ b/contrib/netbsd-tests/lib/libc/sys/t_access.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_access.c,v 1.2 2017/01/10 22:36:29 christos Exp $ */ +/* $NetBSD: t_access.c,v 2.2 2017/01/10 22:36:29 christos Exp $ */ /*- * Copyright (c) 2011 The NetBSD Foundation, Inc. @@ -31,6 +31,10 @@ #include __RCSID("$NetBSD: t_access.c,v 1.2 2017/01/10 22:36:29 christos Exp $"); +#ifdef __FreeBSD__ +#include /* For __FreeBSD_version */ +#endif + #include #include diff --git a/contrib/netbsd-tests/lib/libc/sys/t_clock_nanosleep.c b/contrib/netbsd-tests/lib/libc/sys/t_clock_nanosleep.c new file mode 100644 index 000000000000..8c1fd036b8ba --- /dev/null +++ b/contrib/netbsd-tests/lib/libc/sys/t_clock_nanosleep.c @@ -0,0 +1,63 @@ +/* $NetBSD: t_clock_nanosleep.c,v 1.1 2016/11/11 15:30:44 njoly Exp $ */ + +/*- + * Copyright (c) 2016 The NetBSD Foundation, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include +__RCSID("$NetBSD: t_clock_nanosleep.c,v 1.1 2016/11/11 15:30:44 njoly Exp $"); + +#include +#include + +ATF_TC(clock_nanosleep_remain); +ATF_TC_HEAD(clock_nanosleep_remain, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Check clock_nanosleep(2) remaining time"); +} + +ATF_TC_BODY(clock_nanosleep_remain, tc) +{ + struct timespec rqtp, rmtp; + + rqtp.tv_sec = 0; rqtp.tv_nsec = 0; + rmtp.tv_sec = -1; rmtp.tv_nsec = -1; + ATF_REQUIRE(clock_nanosleep(CLOCK_REALTIME, 0, &rqtp, &rmtp) == 0); + ATF_CHECK(rmtp.tv_sec == 0 && rmtp.tv_nsec == 0); + + ATF_REQUIRE(clock_gettime(CLOCK_REALTIME, &rqtp) == 0); + rmtp.tv_sec = -1; rmtp.tv_nsec = -1; + ATF_REQUIRE(clock_nanosleep(CLOCK_REALTIME, TIMER_ABSTIME, &rqtp, &rmtp) == 0); + ATF_CHECK(rmtp.tv_sec == -1 && rmtp.tv_nsec == -1); +} + +ATF_TP_ADD_TCS(tp) +{ + + ATF_TP_ADD_TC(tp, clock_nanosleep_remain); + + return atf_no_error(); +} diff --git a/contrib/netbsd-tests/lib/libc/sys/t_getrusage.c b/contrib/netbsd-tests/lib/libc/sys/t_getrusage.c index aa5c4d567a0e..f4ee96b057f2 100644 --- a/contrib/netbsd-tests/lib/libc/sys/t_getrusage.c +++ b/contrib/netbsd-tests/lib/libc/sys/t_getrusage.c @@ -56,6 +56,10 @@ sighandler(int signo) /* Nothing. */ } +#ifdef __FreeBSD__ +#define asm __asm +#endif + static void work(void) { diff --git a/contrib/netbsd-tests/lib/libc/sys/t_wait_noproc.c b/contrib/netbsd-tests/lib/libc/sys/t_wait_noproc.c new file mode 100644 index 000000000000..e5ddcbd5aa3b --- /dev/null +++ b/contrib/netbsd-tests/lib/libc/sys/t_wait_noproc.c @@ -0,0 +1,345 @@ +/* $NetBSD: t_wait_noproc.c,v 1.5 2016/11/09 17:50:19 kamil Exp $ */ + +/*- + * Copyright (c) 2016 The NetBSD Foundation, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include +__RCSID("$NetBSD: t_wait_noproc.c,v 1.5 2016/11/09 17:50:19 kamil Exp $"); + +#ifdef __FreeBSD__ +#include /* For NBBY -- it's in sys/types.h on NetBSD */ +#endif +#include +#include + +#include +#include + +#include + +#ifndef TWAIT_OPTION +#define TWAIT_OPTION 0 +#endif + +#if TWAIT_OPTION == 0 +ATF_TC(wait); +ATF_TC_HEAD(wait, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Test that wait(2) returns ECHILD for no child"); +} + +ATF_TC_BODY(wait, tc) +{ + ATF_REQUIRE_ERRNO(ECHILD, wait(NULL) == -1); +} +#endif + +ATF_TC(waitpid); +ATF_TC_HEAD(waitpid, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Test that waitpid(2) returns ECHILD for WAIT_ANY and option %s", + ___STRING(TWAIT_OPTION)); +} + +ATF_TC_BODY(waitpid, tc) +{ + ATF_REQUIRE_ERRNO(ECHILD, waitpid(WAIT_ANY, NULL, TWAIT_OPTION) == -1); +} + +ATF_TC(waitid); +ATF_TC_HEAD(waitid, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Test that waitid(2) returns ECHILD for P_ALL and option %s", + ___STRING(TWAIT_OPTION)); +} + +ATF_TC_BODY(waitid, tc) +{ + ATF_REQUIRE_ERRNO(ECHILD, + waitid(P_ALL, 0, NULL, + WTRAPPED | WEXITED | TWAIT_OPTION) == -1); +} + +ATF_TC(wait3); +ATF_TC_HEAD(wait3, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Test that wait3(2) returns ECHILD for no child"); +} + +ATF_TC_BODY(wait3, tc) +{ + ATF_REQUIRE_ERRNO(ECHILD, wait3(NULL, TWAIT_OPTION, NULL) == -1); +} + +ATF_TC(wait4); +ATF_TC_HEAD(wait4, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Test that wait4(2) returns ECHILD for WAIT_ANY and option %s", + ___STRING(TWAIT_OPTION)); +} + +ATF_TC_BODY(wait4, tc) +{ + ATF_REQUIRE_ERRNO(ECHILD, + wait4(WAIT_ANY, NULL, TWAIT_OPTION, NULL) == -1); +} + +ATF_TC(wait6); +ATF_TC_HEAD(wait6, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Test that wait6(2) returns ECHILD for P_ALL and option %s", + ___STRING(TWAIT_OPTION)); +} + +ATF_TC_BODY(wait6, tc) +{ + ATF_REQUIRE_ERRNO(ECHILD, + wait6(P_ALL, 0, NULL, + WTRAPPED | WEXITED | TWAIT_OPTION, NULL, NULL) == -1); +} + +/* + * Generator of valid combinations of options + * Usage: i = 0; while ((o = get_options_wait6(i++)) != -1) {} + */ +static int +get_options6(size_t pos) +{ + int rv = 0; + size_t n; + + /* + * waitid(2) must specify at least one of WEXITED, WUNTRACED, + * WSTOPPED, WTRAPPED or WCONTINUED. Single option WNOWAIT + * isn't valid. + */ + + const int matrix[] = { + WNOWAIT, /* First in order to blacklist it easily */ + WEXITED, + WUNTRACED, + WSTOPPED, /* SUS compatibility, equal to WUNTRACED */ + WTRAPPED, + WCONTINUED + }; + + const size_t M = (1 << __arraycount(matrix)) - 1; + + /* Skip empty and sole WNOWAIT option */ + pos+=2; + + if (pos > M) + return -1; + + for (n = 0; n < __arraycount(matrix); n++) { + if (pos & __BIT(n)) + rv |= matrix[n]; + } + + return rv; +} + +/* + * Generator of valid combinations of options + * Usage: i = 0; while ((o = get_options_wait4(i++)) != -1) {} + */ +static int +get_options4(size_t pos) +{ + int rv = 0; + size_t n; + + const int special[] = { + 0, +#ifdef __NetBSD__ + WALLSIG, + WALTSIG, + __WALL, /* Linux compatibility, equal to WALLSIG */ + __WCLONE /* Linux compatibility, equal to WALTSIG */ +#endif + }; + + const int matrix[] = { + WNOWAIT, + WEXITED, + WUNTRACED, + WSTOPPED, /* SUS compatibility, equal to WUNTRACED */ + WTRAPPED, + WCONTINUED + }; + + const size_t M = (1 << __arraycount(special)) - 1; + + if (pos < __arraycount(special)) + return special[pos]; + + pos -= __arraycount(special); + + ++pos; /* Don't start with empty mask */ + + if (pos > M) + return -1; + + for (n = 0; n < __arraycount(special); n++) { + if (pos & __BIT(n)) + rv |= matrix[n]; + } + + return rv; +} + +ATF_TC(waitpid_options); +ATF_TC_HEAD(waitpid_options, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Test that waitpid(2) returns ECHILD for WAIT_ANY and valid " + "combination of options with%s WNOHANG", + TWAIT_OPTION == 0 ? "out" : ""); +} + +ATF_TC_BODY(waitpid_options, tc) +{ + size_t i = 0; + int o; + + while((o = get_options4(i++)) != -1) { + printf("Testing waitpid(2) with options %x\n", o); + + ATF_REQUIRE_ERRNO(ECHILD, + waitpid(WAIT_ANY, NULL, o | TWAIT_OPTION) == -1); + } +} + +ATF_TC(waitid_options); +ATF_TC_HEAD(waitid_options, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Test that waitid(2) returns ECHILD for P_ALL and valid " + "combination of options with%s WNOHANG", + TWAIT_OPTION == 0 ? "out" : ""); +} + +ATF_TC_BODY(waitid_options, tc) +{ + size_t i = 0; + int o; + + while((o = get_options6(i++)) != -1) { + printf("Testing waitid(2) with options %x\n", o); + + ATF_REQUIRE_ERRNO(ECHILD, + waitid(P_ALL, 0, NULL, o | TWAIT_OPTION) == -1); + } +} + +ATF_TC(wait3_options); +ATF_TC_HEAD(wait3_options, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Test that wait3(2) returns ECHILD for no child"); +} + +ATF_TC_BODY(wait3_options, tc) +{ + size_t i = 0; + int o; + + while((o = get_options4(i++)) != -1) { + printf("Testing wait3(2) with options %x\n", o); + + ATF_REQUIRE_ERRNO(ECHILD, + wait3(NULL, o | TWAIT_OPTION, NULL) == -1); + } +} + +ATF_TC(wait4_options); +ATF_TC_HEAD(wait4_options, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Test that wait4(2) returns ECHILD for WAIT_ANY and option %s", + ___STRING(TWAIT_OPTION)); +} + +ATF_TC_BODY(wait4_options, tc) +{ + size_t i = 0; + int o; + + while((o = get_options4(i++)) != -1) { + printf("Testing wait4(2) with options %x\n", o); + + ATF_REQUIRE_ERRNO(ECHILD, + wait4(WAIT_ANY, NULL, o | TWAIT_OPTION, NULL) == -1); + } +} + +ATF_TC(wait6_options); +ATF_TC_HEAD(wait6_options, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Test that wait6(2) returns ECHILD for P_ALL and option %s", + ___STRING(TWAIT_OPTION)); +} + +ATF_TC_BODY(wait6_options, tc) +{ + size_t i = 0; + int o; + + while((o = get_options6(i++)) != -1) { + printf("Testing wait6(2) with options %x\n", o); + + ATF_REQUIRE_ERRNO(ECHILD, + wait6(P_ALL, 0, NULL, o | TWAIT_OPTION, NULL, NULL) == -1); + } +} + +ATF_TP_ADD_TCS(tp) +{ + +#if TWAIT_OPTION == 0 + ATF_TP_ADD_TC(tp, wait); +#endif + ATF_TP_ADD_TC(tp, waitpid); + ATF_TP_ADD_TC(tp, waitid); + ATF_TP_ADD_TC(tp, wait3); + ATF_TP_ADD_TC(tp, wait4); + ATF_TP_ADD_TC(tp, wait6); + + ATF_TP_ADD_TC(tp, waitpid_options); + ATF_TP_ADD_TC(tp, waitid_options); + ATF_TP_ADD_TC(tp, wait3_options); + ATF_TP_ADD_TC(tp, wait4_options); + ATF_TP_ADD_TC(tp, wait6_options); + + return atf_no_error(); +} diff --git a/contrib/netbsd-tests/lib/libc/sys/t_wait_noproc_wnohang.c b/contrib/netbsd-tests/lib/libc/sys/t_wait_noproc_wnohang.c new file mode 100644 index 000000000000..45a9998580f0 --- /dev/null +++ b/contrib/netbsd-tests/lib/libc/sys/t_wait_noproc_wnohang.c @@ -0,0 +1,30 @@ +/* $NetBSD: t_wait_noproc_wnohang.c,v 1.1 2016/11/06 15:03:30 kamil Exp $ */ + +/*- + * Copyright (c) 2016 The NetBSD Foundation, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#define TWAIT_OPTION WNOHANG +#include "t_wait_noproc.c" diff --git a/contrib/netbsd-tests/lib/libm/t_casinh.c b/contrib/netbsd-tests/lib/libm/t_casinh.c new file mode 100644 index 000000000000..f9f93c31b9f9 --- /dev/null +++ b/contrib/netbsd-tests/lib/libm/t_casinh.c @@ -0,0 +1,81 @@ +/* $NetBSD: t_casinh.c,v 1.2 2016/09/20 17:19:28 christos Exp $ */ + +/* + * Written by Maya Rashish + * Public domain. + * + * Testing special values of casinh + * Values from ISO/IEC 9899:201x G.6.2.2 + */ + +#include +#include +#include + +#define RE(z) (((double *)(&z))[0]) +#define IM(z) (((double *)(&z))[1]) + +static const struct { + double input_re; + double input_im; + double result_re; + double result_im; +} values[] = { + { +0, +0, +0, +0}, + { +5.032E3, +INFINITY, +INFINITY, +M_PI/2}, + { +INFINITY, +5.023E3, +INFINITY, +0}, + { +INFINITY, +INFINITY, +INFINITY, +M_PI/4}, +#ifdef __HAVE_NANF + { +INFINITY, +NAN, +INFINITY, +NAN}, + { +5.032E3, +NAN, +NAN, +NAN}, /* + FE_INVALID optionally raised */ + { +NAN, +0, +NAN, +0}, + { +NAN, -5.023E3, +NAN, +NAN}, /* + FE_INVALID optionally raised */ + { +NAN, +INFINITY, +INFINITY, +NAN}, /* sign of real part of result unspecified */ + { +NAN, +NAN, +NAN, +NAN}, +#endif +}; + +#ifdef __HAVE_NANF +#define both_nan(a,b) (isnan(a) && isnan(b)) +#else +#define both_nan(a,b) 0 +#endif + +#define crude_equality(a,b) ((a == b) || both_nan(a,b)) + +#define ATF_COMPLEX_EQUAL(a,b) do { \ + complex double ci = casinh(a); \ + ATF_CHECK_MSG(crude_equality(creal(ci),creal(b)) && \ + crude_equality(cimag(ci), cimag(b)), \ + "for casinh([%g,%g]) = [%g,%g] != [%g,%g]", \ + creal(a), cimag(a), creal(ci), cimag(ci), creal(b), cimag(b)); \ +} while (0/*CONSTCOND*/) + + +ATF_TC(casinh); +ATF_TC_HEAD(casinh, tc) +{ + atf_tc_set_md_var(tc, "descr","Check casinh family - special values"); +} + +ATF_TC_BODY(casinh, tc) +{ + complex double input; + complex double result; + unsigned int i; + for (i = 0; i < __arraycount(values); i++) { + RE(input) = values[i].input_re; + IM(input) = values[i].input_im; + RE(result) = values[i].result_re; + IM(result) = values[i].result_im; + ATF_COMPLEX_EQUAL(input, result); + } +} + +ATF_TP_ADD_TCS(tp) +{ + + ATF_TP_ADD_TC(tp, casinh); + + return atf_no_error(); +} diff --git a/contrib/netbsd-tests/lib/libm/t_fe_round.c b/contrib/netbsd-tests/lib/libm/t_fe_round.c new file mode 100644 index 000000000000..fe805b4f86b8 --- /dev/null +++ b/contrib/netbsd-tests/lib/libm/t_fe_round.c @@ -0,0 +1,124 @@ +/* + * Written by Maya Rashish + * Public domain. + * + * Testing IEEE-754 rounding modes (and lrint) + */ + +#include +#include +#ifdef __HAVE_FENV +#include +#include +#include + +/*#pragma STDC FENV_ACCESS ON gcc?? */ + +#define INT 9223L + +#define EPSILON 0.001 + +static const struct { + int round_mode; + double input; + long int expected; +} values[] = { + { FE_DOWNWARD, 3.7, 3}, + { FE_DOWNWARD, -3.7, -4}, + { FE_DOWNWARD, +0, 0}, + { FE_DOWNWARD, -INT-0.01, -INT-1}, + { FE_DOWNWARD, +INT-0.01, INT-1}, + { FE_DOWNWARD, -INT+0.01, -INT}, + { FE_DOWNWARD, +INT+0.01, INT}, +#if 0 /* cpu bugs? */ + { FE_DOWNWARD, -0, -1}, + + { FE_UPWARD, +0, 1}, +#endif + { FE_UPWARD, -0, 0}, + { FE_UPWARD, -123.7, -123}, + { FE_UPWARD, 123.999, 124}, + { FE_UPWARD, -INT-0.01, -INT}, + { FE_UPWARD, +INT-0.01, INT}, + { FE_UPWARD, -INT+0.01, -INT+1}, + { FE_UPWARD, +INT+0.01, INT+1}, + + { FE_TOWARDZERO, 1.99, 1}, + { FE_TOWARDZERO, -1.99, -1}, + { FE_TOWARDZERO, 0.2, 0}, + { FE_TOWARDZERO, INT+0.01, INT}, + { FE_TOWARDZERO, INT-0.01, INT - 1}, + { FE_TOWARDZERO, -INT+0.01, -INT + 1}, + { FE_TOWARDZERO, +0, 0}, + { FE_TOWARDZERO, -0, 0}, + + { FE_TONEAREST, -INT-0.01, -INT}, + { FE_TONEAREST, +INT-0.01, INT}, + { FE_TONEAREST, -INT+0.01, -INT}, + { FE_TONEAREST, +INT+0.01, INT}, + { FE_TONEAREST, -INT-0.501, -INT-1}, + { FE_TONEAREST, +INT-0.501, INT-1}, + { FE_TONEAREST, -INT+0.501, -INT+1}, + { FE_TONEAREST, +INT+0.501, INT+1}, + { FE_TONEAREST, +0, 0}, + { FE_TONEAREST, -0, 0}, +}; + +ATF_TC(fe_round); +ATF_TC_HEAD(fe_round, tc) +{ + atf_tc_set_md_var(tc, "descr","Checking IEEE 754 rounding modes using lrint"); +} + +ATF_TC_BODY(fe_round, tc) +{ + long int received; + + for (unsigned int i = 0; i < __arraycount(values); i++) { + fesetround(values[i].round_mode); + + received = lrint(values[i].input); + ATF_CHECK_MSG( + (labs(received - values[i].expected) < EPSILON), + "lrint rounding wrong, difference too large\n" + "input: %f (index %d): got %ld, expected %ld\n", + values[i].input, i, received, values[i].expected); + + /* Do we get the same rounding mode out? */ + ATF_CHECK_MSG( + (fegetround() == values[i].round_mode), + "Didn't get the same rounding mode out!\n" + "(index %d) fed in %d rounding mode, got %d out\n", + i, fegetround(), values[i].round_mode); + } +} + +ATF_TP_ADD_TCS(tp) +{ + + ATF_TP_ADD_TC(tp, fe_round); + + return atf_no_error(); +} +#else +ATF_TC(t_nofe_round); + +ATF_TC_HEAD(t_nofe_round, tc) +{ + atf_tc_set_md_var(tc, "descr", + "dummy test case - no fenv.h support"); +} + + +ATF_TC_BODY(t_nofe_round, tc) +{ + atf_tc_skip("no fenv.h support on this architecture"); +} + +ATF_TP_ADD_TCS(tp) +{ + ATF_TP_ADD_TC(tp, t_nofe_round); + return atf_no_error(); +} + +#endif diff --git a/contrib/netbsd-tests/lib/libm/t_ilogb.c b/contrib/netbsd-tests/lib/libm/t_ilogb.c new file mode 100644 index 000000000000..b3c212645603 --- /dev/null +++ b/contrib/netbsd-tests/lib/libm/t_ilogb.c @@ -0,0 +1,130 @@ +/* $NetBSD: t_ilogb.c,v 1.6 2016/08/26 08:01:55 christos Exp $ */ + +/*- + * Copyright (c) 2016 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Maya Rashish. + * + * 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. + */ + +#ifdef __FreeBSD__ +#include +#endif +#include +#include +#include + +#ifndef __HAVE_FENV + +# define ATF_CHECK_RAISED_INVALID +# define ATF_CHECK_RAISED_NOTHING + +#else +# define ATF_CHECK_RAISED_INVALID do { \ + int r = fetestexcept(FE_ALL_EXCEPT); \ + ATF_CHECK_MSG(r == FE_INVALID, "r=%#x != %#x\n", r, FE_INVALID); \ + (void)feclearexcept(FE_ALL_EXCEPT); \ +} while (/*CONSTCOND*/0) + +# define ATF_CHECK_RAISED_NOTHING do { \ + int r = fetestexcept(FE_ALL_EXCEPT); \ + ATF_CHECK_MSG(r == 0, "r=%#x != 0\n", r); \ + (void)feclearexcept(FE_ALL_EXCEPT); \ +} while (/*CONSTCOND*/0) +#endif + +ATF_TC(ilogb); +ATF_TC_HEAD(ilogb, tc) +{ + atf_tc_set_md_var(tc, "descr","Check ilogb family"); +} + +ATF_TC_BODY(ilogb, tc) +{ + + ATF_CHECK(ilogbf(0) == FP_ILOGB0); + ATF_CHECK_RAISED_INVALID; + ATF_CHECK(ilogb(0) == FP_ILOGB0); + ATF_CHECK_RAISED_INVALID; +#ifdef __HAVE_LONG_DOUBLE + ATF_CHECK(ilogbl(0) == FP_ILOGB0); + ATF_CHECK_RAISED_INVALID; +#endif + + ATF_CHECK(ilogbf(-0) == FP_ILOGB0); + ATF_CHECK_RAISED_INVALID; + ATF_CHECK(ilogb(-0) == FP_ILOGB0); + ATF_CHECK_RAISED_INVALID; +#ifdef __HAVE_LONG_DOUBLE + ATF_CHECK(ilogbl(-0) == FP_ILOGB0); + ATF_CHECK_RAISED_INVALID; +#endif + + ATF_CHECK(ilogbf(INFINITY) == INT_MAX); + ATF_CHECK_RAISED_INVALID; + ATF_CHECK(ilogb(INFINITY) == INT_MAX); + ATF_CHECK_RAISED_INVALID; +#ifdef __HAVE_LONG_DOUBLE + ATF_CHECK(ilogbl(INFINITY) == INT_MAX); + ATF_CHECK_RAISED_INVALID; +#endif + + ATF_CHECK(ilogbf(-INFINITY) == INT_MAX); + ATF_CHECK_RAISED_INVALID; + ATF_CHECK(ilogb(-INFINITY) == INT_MAX); + ATF_CHECK_RAISED_INVALID; +#ifdef __HAVE_LONG_DOUBLE + ATF_CHECK(ilogbl(-INFINITY) == INT_MAX); + ATF_CHECK_RAISED_INVALID; +#endif + + ATF_CHECK(ilogbf(1024) == 10); + ATF_CHECK_RAISED_NOTHING; + ATF_CHECK(ilogb(1024) == 10); + ATF_CHECK_RAISED_NOTHING; +#ifdef __HAVE_LONG_DOUBLE + ATF_CHECK(ilogbl(1024) == 10); + ATF_CHECK_RAISED_NOTHING; +#endif + +#ifndef __vax__ + ATF_CHECK(ilogbf(NAN) == FP_ILOGBNAN); + ATF_CHECK_RAISED_INVALID; + ATF_CHECK(ilogb(NAN) == FP_ILOGBNAN); + ATF_CHECK_RAISED_INVALID; +#ifdef __HAVE_LONG_DOUBLE + ATF_CHECK(ilogbl(NAN) == FP_ILOGBNAN); + ATF_CHECK_RAISED_INVALID; +#endif +#endif +} + +ATF_TP_ADD_TCS(tp) +{ + + ATF_TP_ADD_TC(tp, ilogb); + + return atf_no_error(); +} diff --git a/contrib/netbsd-tests/lib/libm/t_ldexp.c b/contrib/netbsd-tests/lib/libm/t_ldexp.c index eaf8a4bfdb18..251f2aeba5fb 100644 --- a/contrib/netbsd-tests/lib/libm/t_ldexp.c +++ b/contrib/netbsd-tests/lib/libm/t_ldexp.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_ldexp.c,v 1.14 2014/11/04 00:20:19 justin Exp $ */ +/* $NetBSD: t_ldexp.c,v 1.16 2016/08/25 00:32:31 maya Exp $ */ /*- * Copyright (c) 2011 The NetBSD Foundation, Inc. @@ -29,7 +29,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include -__RCSID("$NetBSD: t_ldexp.c,v 1.14 2014/11/04 00:20:19 justin Exp $"); +__RCSID("$NetBSD: t_ldexp.c,v 1.16 2016/08/25 00:32:31 maya Exp $"); #include @@ -96,10 +96,12 @@ struct ldexp_test ldexp_overflow[] = { { 1.0, 1023, 1, " inf" }, { 1.0, -1022, 2046, " inf" }, { 1.0, 1025, SKIP, " inf" }, + { 2.0, INT_MAX,SKIP, " inf" }, { -1.0, 1024, SKIP, " -inf" }, { -1.0, 1023, 1, " -inf" }, { -1.0, -1022, 2046, " -inf" }, { -1.0, 1025, SKIP, " -inf" }, + { -2.0, INT_MAX,SKIP, " -inf" }, { 0, 0, 0, NULL } }; @@ -170,10 +172,8 @@ run_test(struct ldexp_test *table) v = ldexp(table->x, table->exp1); - if (table->exp2 == SKIP) - continue; - - v = ldexp(v, table->exp2); + if (table->exp2 != SKIP) + v = ldexp(v, table->exp2); (void)snprintf(outbuf, sizeof(outbuf), FORMAT, v); diff --git a/contrib/netbsd-tests/lib/libm/t_precision.c b/contrib/netbsd-tests/lib/libm/t_precision.c index c01debac5d0b..df2d8a36e3f6 100644 --- a/contrib/netbsd-tests/lib/libm/t_precision.c +++ b/contrib/netbsd-tests/lib/libm/t_precision.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_precision.c,v 1.2 2014/11/04 00:20:19 justin Exp $ */ +/* $NetBSD: t_precision.c,v 1.3 2016/08/27 10:07:05 christos Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -29,7 +29,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include -__RCSID("$NetBSD: t_precision.c,v 1.2 2014/11/04 00:20:19 justin Exp $"); +__RCSID("$NetBSD: t_precision.c,v 1.3 2016/08/27 10:07:05 christos Exp $"); #include @@ -45,7 +45,9 @@ ATF_TC_HEAD(t_precision, tc) } volatile double x = 1; +#if __HAVE_LONG_DOUBLE volatile long double y = 1; +#endif ATF_TC_BODY(t_precision, tc) { @@ -58,7 +60,7 @@ ATF_TC_BODY(t_precision, tc) x += DBL_EPSILON; ATF_CHECK(x == 2.0); -#if !defined(__FreeBSD__) || !defined(__i386__) +#if __HAVE_LONG_DOUBLE y += LDBL_EPSILON; ATF_CHECK(y != 1.0L); y -= 1; diff --git a/contrib/netbsd-tests/lib/libpthread/h_common.h b/contrib/netbsd-tests/lib/libpthread/h_common.h index f4d03bcdec9e..2e8b0a123e75 100644 --- a/contrib/netbsd-tests/lib/libpthread/h_common.h +++ b/contrib/netbsd-tests/lib/libpthread/h_common.h @@ -9,4 +9,10 @@ ATF_REQUIRE_MSG(ret == 0, "%s: %s", #x, strerror(ret)); \ } while (0) +#define PTHREAD_REQUIRE_STATUS(x, v) \ + do { \ + int ret = (x); \ + ATF_REQUIRE_MSG(ret == (v), "%s: %s", #x, strerror(ret)); \ + } while (0) + #endif // H_COMMON_H diff --git a/contrib/netbsd-tests/lib/libpthread/t_mutex.c b/contrib/netbsd-tests/lib/libpthread/t_mutex.c index 1fcd69ed470c..b8d60e6cc25d 100644 --- a/contrib/netbsd-tests/lib/libpthread/t_mutex.c +++ b/contrib/netbsd-tests/lib/libpthread/t_mutex.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_mutex.c,v 1.10 2016/07/31 13:01:29 christos Exp $ */ +/* $NetBSD: t_mutex.c,v 1.14 2016/10/31 23:51:20 christos Exp $ */ /* * Copyright (c) 2008 The NetBSD Foundation, Inc. @@ -29,12 +29,17 @@ #include __COPYRIGHT("@(#) Copyright (c) 2008\ The NetBSD Foundation, inc. All rights reserved."); -__RCSID("$NetBSD: t_mutex.c,v 1.10 2016/07/31 13:01:29 christos Exp $"); +__RCSID("$NetBSD: t_mutex.c,v 1.14 2016/10/31 23:51:20 christos Exp $"); +#ifdef __FreeBSD__ +#include /* For timespecadd */ +#include /* For UINT16_MAX */ +#endif #include #include #include #include +#include #include #include #include @@ -47,6 +52,31 @@ static pthread_mutex_t mutex; static pthread_mutex_t static_mutex = PTHREAD_MUTEX_INITIALIZER; static int global_x; +#ifdef TIMEDMUTEX +/* This code is used for verifying non-timed specific code */ +static struct timespec ts_lengthy = { + .tv_sec = UINT16_MAX, + .tv_nsec = 0 +}; +/* This code is used for verifying timed-only specific code */ +static struct timespec ts_shortlived = { + .tv_sec = 0, + .tv_nsec = 120 +}; + +static int +mutex_lock(pthread_mutex_t *m, const struct timespec *ts) +{ + struct timespec ts_wait; + ATF_REQUIRE(clock_gettime(CLOCK_REALTIME, &ts_wait) != -1); + timespecadd(&ts_wait, ts, &ts_wait); + + return pthread_mutex_timedlock(m, &ts_wait); +} +#else +#define mutex_lock(a, b) pthread_mutex_lock(a) +#endif + static void * mutex1_threadfunc(void *arg) { @@ -56,7 +86,7 @@ mutex1_threadfunc(void *arg) param = arg; printf("2: Locking mutex\n"); - pthread_mutex_lock(&mutex); + mutex_lock(&mutex, &ts_lengthy); printf("2: Got mutex. *param = %d\n", *param); ATF_REQUIRE_EQ(*param, 20); (*param)++; @@ -81,7 +111,7 @@ ATF_TC_BODY(mutex1, tc) PTHREAD_REQUIRE(pthread_mutex_init(&mutex, NULL)); x = 1; - PTHREAD_REQUIRE(pthread_mutex_lock(&mutex)); + PTHREAD_REQUIRE(mutex_lock(&mutex, &ts_lengthy)); PTHREAD_REQUIRE(pthread_create(&new, NULL, mutex1_threadfunc, &x)); printf("1: Before changing the value.\n"); sleep(2); @@ -92,7 +122,7 @@ ATF_TC_BODY(mutex1, tc) printf("1: After releasing the mutex.\n"); PTHREAD_REQUIRE(pthread_join(new, &joinval)); - PTHREAD_REQUIRE(pthread_mutex_lock(&mutex)); + PTHREAD_REQUIRE(mutex_lock(&mutex, &ts_lengthy)); printf("1: Thread joined. X was %d. Return value (int) was %d\n", x, *(int *)joinval); ATF_REQUIRE_EQ(x, 21); @@ -108,7 +138,7 @@ mutex2_threadfunc(void *arg) printf("2: Second thread (%p). Count is %ld\n", pthread_self(), count); while (count--) { - PTHREAD_REQUIRE(pthread_mutex_lock(&mutex)); + PTHREAD_REQUIRE(mutex_lock(&mutex, &ts_lengthy)); global_x++; PTHREAD_REQUIRE(pthread_mutex_unlock(&mutex)); } @@ -145,7 +175,7 @@ ATF_TC_BODY(mutex2, tc) global_x = 0; count = count2 = 10000000; - PTHREAD_REQUIRE(pthread_mutex_lock(&mutex)); + PTHREAD_REQUIRE(mutex_lock(&mutex, &ts_lengthy)); PTHREAD_REQUIRE(pthread_create(&new, NULL, mutex2_threadfunc, &count2)); printf("1: Thread %p\n", pthread_self()); @@ -153,14 +183,14 @@ ATF_TC_BODY(mutex2, tc) PTHREAD_REQUIRE(pthread_mutex_unlock(&mutex)); while (count--) { - PTHREAD_REQUIRE(pthread_mutex_lock(&mutex)); + PTHREAD_REQUIRE(mutex_lock(&mutex, &ts_lengthy)); global_x++; PTHREAD_REQUIRE(pthread_mutex_unlock(&mutex)); } PTHREAD_REQUIRE(pthread_join(new, &joinval)); - PTHREAD_REQUIRE(pthread_mutex_lock(&mutex)); + PTHREAD_REQUIRE(mutex_lock(&mutex, &ts_lengthy)); printf("1: Thread joined. X was %d. Return value (long) was %ld\n", global_x, (long)joinval); ATF_REQUIRE_EQ(global_x, 20000000); @@ -184,7 +214,7 @@ mutex3_threadfunc(void *arg) printf("2: Second thread (%p). Count is %ld\n", pthread_self(), count); while (count--) { - PTHREAD_REQUIRE(pthread_mutex_lock(&static_mutex)); + PTHREAD_REQUIRE(mutex_lock(&static_mutex, &ts_lengthy)); global_x++; PTHREAD_REQUIRE(pthread_mutex_unlock(&static_mutex)); } @@ -220,7 +250,7 @@ ATF_TC_BODY(mutex3, tc) global_x = 0; count = count2 = 10000000; - PTHREAD_REQUIRE(pthread_mutex_lock(&static_mutex)); + PTHREAD_REQUIRE(mutex_lock(&static_mutex, &ts_lengthy)); PTHREAD_REQUIRE(pthread_create(&new, NULL, mutex3_threadfunc, &count2)); printf("1: Thread %p\n", pthread_self()); @@ -228,14 +258,14 @@ ATF_TC_BODY(mutex3, tc) PTHREAD_REQUIRE(pthread_mutex_unlock(&static_mutex)); while (count--) { - PTHREAD_REQUIRE(pthread_mutex_lock(&static_mutex)); + PTHREAD_REQUIRE(mutex_lock(&static_mutex, &ts_lengthy)); global_x++; PTHREAD_REQUIRE(pthread_mutex_unlock(&static_mutex)); } PTHREAD_REQUIRE(pthread_join(new, &joinval)); - PTHREAD_REQUIRE(pthread_mutex_lock(&static_mutex)); + PTHREAD_REQUIRE(mutex_lock(&static_mutex, &ts_lengthy)); printf("1: Thread joined. X was %d. Return value (long) was %ld\n", global_x, (long)joinval); ATF_REQUIRE_EQ(global_x, 20000000); @@ -260,7 +290,7 @@ mutex4_threadfunc(void *arg) param = arg; printf("2: Locking mutex\n"); - PTHREAD_REQUIRE(pthread_mutex_lock(&mutex)); + PTHREAD_REQUIRE(mutex_lock(&mutex, &ts_lengthy)); printf("2: Got mutex. *param = %d\n", *param); (*param)++; @@ -291,11 +321,11 @@ ATF_TC_BODY(mutex4, tc) PTHREAD_REQUIRE(pthread_mutexattr_destroy(&mattr)); x = 1; - PTHREAD_REQUIRE(pthread_mutex_lock(&mutex)); + PTHREAD_REQUIRE(mutex_lock(&mutex, &ts_lengthy)); PTHREAD_REQUIRE(pthread_create(&new, NULL, mutex4_threadfunc, &x)); printf("1: Before recursively acquiring the mutex.\n"); - PTHREAD_REQUIRE(pthread_mutex_lock(&mutex)); + PTHREAD_REQUIRE(mutex_lock(&mutex, &ts_lengthy)); printf("1: Before releasing the mutex once.\n"); sleep(2); @@ -311,7 +341,7 @@ ATF_TC_BODY(mutex4, tc) PTHREAD_REQUIRE(pthread_join(new, &joinval)); - PTHREAD_REQUIRE(pthread_mutex_lock(&mutex)); + PTHREAD_REQUIRE(mutex_lock(&mutex, &ts_lengthy)); printf("1: Thread joined. X was %d. Return value (int) was %d\n", x, *(int *)joinval); ATF_REQUIRE_EQ(x, 21); @@ -333,7 +363,7 @@ child_func(void* arg) res = _sched_protect(-2); ATF_REQUIRE_EQ_MSG(res, -1, "sched_protect returned %d", res); ATF_REQUIRE_EQ(errno, ENOENT); - PTHREAD_REQUIRE(pthread_mutex_lock(&mutex5)); + PTHREAD_REQUIRE(mutex_lock(&mutex5, &ts_lengthy)); printf("child is owning resource\n"); res = _sched_protect(-2); ATF_REQUIRE_EQ(res, max_fifo_prio); @@ -376,7 +406,7 @@ ATF_TC_BODY(mutex5, tc) max_fifo_prio)); PTHREAD_REQUIRE(pthread_mutex_init(&mutex5, &attr5)); - PTHREAD_REQUIRE(pthread_mutex_lock(&mutex5)); + PTHREAD_REQUIRE(mutex_lock(&mutex5, &ts_lengthy)); printf("enter critical section for main\n"); PTHREAD_REQUIRE(pthread_create(&child, NULL, child_func, NULL)); printf("main starts to sleep\n"); @@ -414,7 +444,7 @@ high_prio(void* arg) high_cnt = 0; sleep(1); } - PTHREAD_REQUIRE(pthread_mutex_lock(&mutex6)); + PTHREAD_REQUIRE(mutex_lock(&mutex6, &ts_lengthy)); if (start == 0) start = 2; PTHREAD_REQUIRE(pthread_mutex_unlock(&mutex6)); @@ -446,7 +476,7 @@ low_prio(void* arg) low_cnt = 0; sleep(1); } - PTHREAD_REQUIRE(pthread_mutex_lock(&mutex6)); + PTHREAD_REQUIRE(mutex_lock(&mutex6, &ts_lengthy)); if (start == 0) start = 1; PTHREAD_REQUIRE(pthread_mutex_unlock(&mutex6)); @@ -582,6 +612,123 @@ ATF_TC_BODY(mutexattr2, tc) } } +#ifdef TIMEDMUTEX +ATF_TC(timedmutex1); +ATF_TC_HEAD(timedmutex1, tc) +{ + atf_tc_set_md_var(tc, "descr", "Checks timeout on selflock"); +} + +ATF_TC_BODY(timedmutex1, tc) +{ + + printf("Timed mutex-test 1\n"); + + PTHREAD_REQUIRE(pthread_mutex_init(&mutex, NULL)); + + printf("Before acquiring mutex\n"); + PTHREAD_REQUIRE(pthread_mutex_lock(&mutex)); + + printf("Before endeavor to reacquire timed-mutex (timeout expected)\n"); + PTHREAD_REQUIRE_STATUS(mutex_lock(&mutex, &ts_shortlived), + ETIMEDOUT); + + printf("Unlocking mutex\n"); + PTHREAD_REQUIRE(pthread_mutex_unlock(&mutex)); +} + +ATF_TC(timedmutex2); +ATF_TC_HEAD(timedmutex2, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Checks timeout on selflock with timedlock"); +} + +ATF_TC_BODY(timedmutex2, tc) +{ + + printf("Timed mutex-test 2\n"); + + PTHREAD_REQUIRE(pthread_mutex_init(&mutex, NULL)); + + printf("Before acquiring mutex with timedlock\n"); + PTHREAD_REQUIRE(mutex_lock(&mutex, &ts_lengthy)); + + printf("Before endeavor to reacquire timed-mutex (timeout expected)\n"); + PTHREAD_REQUIRE_STATUS(mutex_lock(&mutex, &ts_shortlived), + ETIMEDOUT); + + printf("Unlocking mutex\n"); + PTHREAD_REQUIRE(pthread_mutex_unlock(&mutex)); +} + +ATF_TC(timedmutex3); +ATF_TC_HEAD(timedmutex3, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Checks timeout on selflock in a new thread"); +} + +static void * +timedmtx_thrdfunc(void *arg) +{ + printf("Before endeavor to reacquire timed-mutex (timeout expected)\n"); + PTHREAD_REQUIRE_STATUS(mutex_lock(&mutex, &ts_shortlived), + ETIMEDOUT); + + return NULL; +} + +ATF_TC_BODY(timedmutex3, tc) +{ + pthread_t new; + + printf("Timed mutex-test 3\n"); + + PTHREAD_REQUIRE(pthread_mutex_init(&mutex, NULL)); + + printf("Before acquiring mutex with timedlock\n"); + PTHREAD_REQUIRE(pthread_mutex_lock(&mutex)); + + printf("Before creating new thread\n"); + PTHREAD_REQUIRE(pthread_create(&new, NULL, timedmtx_thrdfunc, NULL)); + + printf("Before joining the mutex\n"); + PTHREAD_REQUIRE(pthread_join(new, NULL)); + + printf("Unlocking mutex\n"); + PTHREAD_REQUIRE(pthread_mutex_unlock(&mutex)); +} + +ATF_TC(timedmutex4); +ATF_TC_HEAD(timedmutex4, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Checks timeout on selflock with timedlock in a new thread"); +} + +ATF_TC_BODY(timedmutex4, tc) +{ + pthread_t new; + + printf("Timed mutex-test 4\n"); + + PTHREAD_REQUIRE(pthread_mutex_init(&mutex, NULL)); + + printf("Before acquiring mutex with timedlock\n"); + PTHREAD_REQUIRE(mutex_lock(&mutex, &ts_lengthy)); + + printf("Before creating new thread\n"); + PTHREAD_REQUIRE(pthread_create(&new, NULL, timedmtx_thrdfunc, NULL)); + + printf("Before joining the mutex\n"); + PTHREAD_REQUIRE(pthread_join(new, NULL)); + + printf("Unlocking mutex\n"); + PTHREAD_REQUIRE(pthread_mutex_unlock(&mutex)); +} +#endif + ATF_TP_ADD_TCS(tp) { ATF_TP_ADD_TC(tp, mutex1); @@ -594,6 +741,13 @@ ATF_TP_ADD_TCS(tp) #endif ATF_TP_ADD_TC(tp, mutexattr1); ATF_TP_ADD_TC(tp, mutexattr2); - + +#ifdef TIMEDMUTEX + ATF_TP_ADD_TC(tp, timedmutex1); + ATF_TP_ADD_TC(tp, timedmutex2); + ATF_TP_ADD_TC(tp, timedmutex3); + ATF_TP_ADD_TC(tp, timedmutex4); +#endif + return atf_no_error(); } diff --git a/contrib/netbsd-tests/lib/libpthread/t_timedmutex.c b/contrib/netbsd-tests/lib/libpthread/t_timedmutex.c new file mode 100644 index 000000000000..4f71acdc72fb --- /dev/null +++ b/contrib/netbsd-tests/lib/libpthread/t_timedmutex.c @@ -0,0 +1,30 @@ +/* $NetBSD: t_timedmutex.c,v 1.2 2016/10/31 16:21:23 christos Exp $ */ + +/* + * Copyright (c) 2008 The NetBSD Foundation, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#define TIMEDMUTEX +#include "t_mutex.c" diff --git a/contrib/netbsd-tests/lib/librumpclient/h_execthr.c b/contrib/netbsd-tests/lib/librumpclient/h_execthr.c index f653fe6afe0a..c209375e4b9f 100644 --- a/contrib/netbsd-tests/lib/librumpclient/h_execthr.c +++ b/contrib/netbsd-tests/lib/librumpclient/h_execthr.c @@ -1,4 +1,4 @@ -/* $NetBSD: h_execthr.c,v 1.3 2014/08/13 00:03:00 pooka Exp $ */ +/* $NetBSD: h_execthr.c,v 1.7 2016/11/24 00:37:29 dholland Exp $ */ /* * Copyright (c) 2011 The NetBSD Foundation, Inc. @@ -42,6 +42,14 @@ #include #include +//#define VERBOSE + +#ifdef VERBOSE +#define SAY(...) printf(__VA_ARGS__) +#else +#define SAY(...) +#endif + static int canreturn = 0; /* @@ -103,6 +111,7 @@ main(int argc, char *argv[], char *envp[]) else execd = 0; sprintf(nexec, "%d", execd+1); + SAY("execd: %d\n", execd); if (rumpclient_init() == -1) { if (execd) @@ -111,33 +120,43 @@ main(int argc, char *argv[], char *envp[]) err(1, "init"); } mypid = rump_sys_getpid(); + SAY("rumpclient_init finished.\n"); if (execd) { canreturn = 1; - if (pthread_create(&pt, NULL, - wrk, (void *)(uintptr_t)P2_0) != 0) - errx(1, "exec pthread_create"); + errno = pthread_create(&pt, NULL, + wrk, (void *)(uintptr_t)P2_0); + if (errno != 0) + err(1, "exec pthread_create"); + SAY("startup pthread_create finished.\n"); i = 37; rump_sys_write(P2_1, &i, sizeof(i)); pthread_join(pt, NULL); + SAY("startup pthread_join finished.\n"); n = rump_sys_read(P1_0, &i, sizeof(i)); if (n != -1 || errno != EBADF) errx(1, "post-exec cloexec works"); + SAY("startup rump_sys_read finished.\n"); getproc(mypid, &p); + SAY("startup getproc finished.\n"); if (p.p_nlwps != 2) errx(1, "invalid nlwps: %lld", (long long)p.p_nlwps); /* we passed? */ - if (execd > 10) + if (execd > 10) { + SAY("done.\n"); exit(0); + } rump_sys_close(P2_0); rump_sys_close(P2_1); } + SAY("making pipes...\n"); + if (rump_sys_pipe(p1) == -1) err(1, "pipe1"); if (p1[0] != P1_0 || p1[1] != P1_1) @@ -151,32 +170,47 @@ main(int argc, char *argv[], char *envp[]) if (rump_sys_fcntl(p1[1], F_SETFD, FD_CLOEXEC) == -1) err(1, "cloexec"); - for (i = 0; i < NTHR; i++) - if (pthread_create(&pt, NULL, - wrk, (void *)(uintptr_t)p1[0]) != 0) - errx(1, "pthread_create 1 %d", i); + SAY("making threads...\n"); - for (i = 0; i < NTHR; i++) - if (pthread_create(&pt, NULL, - wrk, (void *)(uintptr_t)p2[0]) != 0) - errx(1, "pthread_create 2 %d", i); + for (i = 0; i < NTHR; i++) { + errno = pthread_create(&pt, NULL, + wrk, (void *)(uintptr_t)p1[0]); + if (errno != 0) + err(1, "pthread_create 1 %d", i); + } + + for (i = 0; i < NTHR; i++) { + errno = pthread_create(&pt, NULL, + wrk, (void *)(uintptr_t)p2[0]); + if (errno != 0) + err(1, "pthread_create 2 %d", i); + } + + SAY("waiting for threads to start...\n"); /* wait for all the threads to be enjoying themselves */ for (;;) { getproc(mypid, &p); + SAY("getproc finished.\n"); if (p.p_nlwps == 2*NTHR + 2) break; usleep(10000); } + SAY("making some more threads start...\n"); + /* * load up one more (big) set. these won't start executing, though, * but we're interested in if they create blockage */ - for (i = 0; i < 3*NTHR; i++) - if (pthread_create(&pt, NULL, - wrk, (void *)(uintptr_t)p1[0]) != 0) - errx(1, "pthread_create 1 %d", i); + for (i = 0; i < 3*NTHR; i++) { + errno = pthread_create(&pt, NULL, + wrk, (void *)(uintptr_t)p1[0]); + if (errno != 0) + err(1, "pthread_create 3 %d", i); + } + + SAY("calling exec...\n"); /* then, we exec! */ execarg[0] = argv[0]; diff --git a/contrib/netbsd-tests/lib/librumphijack/t_tcpip.sh b/contrib/netbsd-tests/lib/librumphijack/t_tcpip.sh index 718dfdc1de4c..411be3340bbc 100755 --- a/contrib/netbsd-tests/lib/librumphijack/t_tcpip.sh +++ b/contrib/netbsd-tests/lib/librumphijack/t_tcpip.sh @@ -1,4 +1,4 @@ -# $NetBSD: t_tcpip.sh,v 1.17 2016/08/11 21:29:44 kre Exp $ +# $NetBSD: t_tcpip.sh,v 1.18 2016/08/13 11:22:11 christos Exp $ # # Copyright (c) 2011 The NetBSD Foundation, Inc. # All rights reserved. @@ -25,7 +25,8 @@ # POSSIBILITY OF SUCH DAMAGE. # -rumpnetsrv='rump_server -lrumpnet -lrumpnet_net -lrumpnet_netinet -lrumpdev' +rumpnetlibs="-lrumpnet -lrumpnet_net -lrumpnet_netinet6 -lrumpnet_netinet" +rumpnetsrv="rump_server $rumpnetlibs -lrumpdev" export RUMP_SERVER=unix://csock atf_test_case http cleanup @@ -37,7 +38,7 @@ http_head() http_body() { - atf_check -s exit:0 ${rumpnetsrv} -lrumpnet_netinet6 ${RUMP_SERVER} + atf_check -s exit:0 ${rumpnetsrv} ${RUMP_SERVER} # start bozo in daemon mode atf_check -s exit:0 env LD_PRELOAD=/usr/lib/librumphijack.so \ diff --git a/contrib/netbsd-tests/lib/libusbhid/t_usbhid.c b/contrib/netbsd-tests/lib/libusbhid/t_usbhid.c index f20652a926f1..2766da234f1a 100644 --- a/contrib/netbsd-tests/lib/libusbhid/t_usbhid.c +++ b/contrib/netbsd-tests/lib/libusbhid/t_usbhid.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_usbhid.c,v 1.11 2016/01/07 16:10:49 jakllsch Exp $ */ +/* $NetBSD: t_usbhid.c,v 1.12 2016/08/17 12:10:42 jakllsch Exp $ */ /* * Copyright (c) 2016 Jonathan A. Kollasch @@ -27,7 +27,7 @@ */ #include -__RCSID("$NetBSD: t_usbhid.c,v 1.11 2016/01/07 16:10:49 jakllsch Exp $"); +__RCSID("$NetBSD: t_usbhid.c,v 1.12 2016/08/17 12:10:42 jakllsch Exp $"); #include @@ -244,6 +244,9 @@ ATF_TC_BODY(check_hid_get_data, tc) int32_t data; uint32_t udat; + atf_tc_expect_fail("only the 32-bit opcode works, " + "8 and 16-bit is broken"); + ATF_REQUIRE((hrd = hid_use_report_desc( range_test_report_descriptor, __arraycount(range_test_report_descriptor))) != NULL); diff --git a/contrib/netbsd-tests/net/arp/t_arp.sh b/contrib/netbsd-tests/net/arp/t_arp.sh index ab55eb326ed0..04e2f70375c2 100755 --- a/contrib/netbsd-tests/net/arp/t_arp.sh +++ b/contrib/netbsd-tests/net/arp/t_arp.sh @@ -1,4 +1,4 @@ -# $NetBSD: t_arp.sh,v 1.16 2016/06/21 05:04:16 ozaki-r Exp $ +# $NetBSD: t_arp.sh,v 1.22 2016/11/25 08:51:16 ozaki-r Exp $ # # Copyright (c) 2015 The NetBSD Foundation, Inc. # All rights reserved. @@ -25,10 +25,6 @@ # POSSIBILITY OF SUCH DAMAGE. # -inetserver="rump_server -lrumpnet -lrumpnet_net -lrumpnet_netinet -lrumpnet_shmif" -inetserver="$inetserver -lrumpdev -lrumpnet_tap" -HIJACKING="env LD_PRELOAD=/usr/lib/librumphijack.so RUMPHIJACK=sysctl=yes" - SOCKSRC=unix://commsock1 SOCKDST=unix://commsock2 IP4SRC=10.0.1.1 @@ -36,7 +32,7 @@ IP4DST=10.0.1.2 IP4DST_PROXYARP1=10.0.1.3 IP4DST_PROXYARP2=10.0.1.4 -DEBUG=false +DEBUG=${DEBUG:-false} TIMEOUT=1 atf_test_case arp_cache_expiration_5s cleanup @@ -106,9 +102,9 @@ arp_static_head() setup_dst_server() { + + rump_server_add_iface $SOCKDST shmif0 bus1 export RUMP_SERVER=$SOCKDST - atf_check -s exit:0 rump.ifconfig shmif0 create - atf_check -s exit:0 rump.ifconfig shmif0 linkstr bus1 atf_check -s exit:0 rump.ifconfig shmif0 inet $IP4DST/24 atf_check -s exit:0 rump.ifconfig shmif0 up atf_check -s exit:0 rump.ifconfig -w 10 @@ -127,8 +123,7 @@ setup_src_server() atf_check -s exit:0 -o ignore rump.sysctl -w net.inet.arp.keep=$keep # Setup an interface - atf_check -s exit:0 rump.ifconfig shmif0 create - atf_check -s exit:0 rump.ifconfig shmif0 linkstr bus1 + rump_server_add_iface $SOCKSRC shmif0 bus1 atf_check -s exit:0 rump.ifconfig shmif0 inet $IP4SRC/24 atf_check -s exit:0 rump.ifconfig shmif0 up atf_check -s exit:0 rump.ifconfig -w 10 @@ -145,8 +140,8 @@ test_cache_expiration() local arp_keep=$1 local bonus=2 - atf_check -s exit:0 ${inetserver} $SOCKSRC - atf_check -s exit:0 ${inetserver} $SOCKDST + rump_server_start $SOCKSRC + rump_server_start $SOCKDST setup_dst_server setup_src_server $arp_keep @@ -172,12 +167,16 @@ test_cache_expiration() arp_cache_expiration_5s_body() { + test_cache_expiration 5 + rump_server_destroy_ifaces } arp_cache_expiration_10s_body() { + test_cache_expiration 10 + rump_server_destroy_ifaces } arp_command_body() @@ -185,8 +184,8 @@ arp_command_body() local arp_keep=5 local bonus=2 - atf_check -s exit:0 ${inetserver} $SOCKSRC - atf_check -s exit:0 ${inetserver} $SOCKDST + rump_server_start $SOCKSRC + rump_server_start $SOCKDST setup_dst_server setup_src_server $arp_keep @@ -257,7 +256,7 @@ arp_command_body() $DEBUG && rump.arp -n -a #atf_check -s not-exit:0 -e ignore rump.arp -n 10.0.1.10 - return 0 + rump_server_destroy_ifaces } make_pkt_str_arpreq() @@ -273,12 +272,12 @@ arp_garp_body() { local pkt= - atf_check -s exit:0 ${inetserver} $SOCKSRC + rump_server_start $SOCKSRC + export RUMP_SERVER=$SOCKSRC # Setup an interface - atf_check -s exit:0 rump.ifconfig shmif0 create - atf_check -s exit:0 rump.ifconfig shmif0 linkstr bus1 + rump_server_add_iface $SOCKSRC shmif0 bus1 atf_check -s exit:0 rump.ifconfig shmif0 inet 10.0.0.1/24 atf_check -s exit:0 rump.ifconfig shmif0 inet 10.0.0.2/24 alias atf_check -s exit:0 rump.ifconfig shmif0 up @@ -304,6 +303,8 @@ arp_garp_body() atf_check -s not-exit:0 -x "cat ./out |grep -q '$pkt'" pkt=$(make_pkt_str_arpreq 10.0.0.4 10.0.0.4) atf_check -s not-exit:0 -x "cat ./out |grep -q '$pkt'" + + rump_server_destroy_ifaces } arp_cache_overwriting_body() @@ -311,8 +312,8 @@ arp_cache_overwriting_body() local arp_keep=5 local bonus=2 - atf_check -s exit:0 ${inetserver} $SOCKSRC - atf_check -s exit:0 ${inetserver} $SOCKDST + rump_server_start $SOCKSRC + rump_server_start $SOCKDST setup_dst_server setup_src_server $arp_keep @@ -341,7 +342,7 @@ arp_cache_overwriting_body() atf_check -s exit:0 -o match:'b2:a0:20:00:00:ff' rump.arp -n 10.0.1.10 $DEBUG && rump.arp -n -a - return 0 + rump_server_destroy_ifaces } make_pkt_str_arprep() @@ -363,36 +364,21 @@ make_pkt_str_garp() echo $pkt } -extract_new_packets() -{ - local old=./old - - if [ ! -f $old ]; then - old=/dev/null - fi - - shmif_dumpbus -p - bus1 2>/dev/null| \ - tcpdump -n -e -r - 2>/dev/null > ./new - diff -u $old ./new |grep '^+' |cut -d '+' -f 2 > ./diff - mv -f ./new ./old - cat ./diff -} - test_proxy_arp() { local arp_keep=5 local opts= title= flags= local type=$1 - atf_check -s exit:0 ${inetserver} $SOCKSRC - atf_check -s exit:0 ${inetserver} $SOCKDST + rump_server_start $SOCKSRC + rump_server_start $SOCKDST tap setup_dst_server setup_src_server $arp_keep export RUMP_SERVER=$SOCKDST atf_check -s exit:0 -o ignore rump.sysctl -w net.inet.ip.forwarding=1 - macaddr_dst=$(rump.ifconfig shmif0 |awk '/address/ {print $2;}') + macaddr_dst=$(get_macaddr $SOCKDST shmif0) if [ "$type" = "pub" ]; then opts="pub" @@ -416,7 +402,7 @@ test_proxy_arp() rump.ping -n -w 1 -c 1 $IP4DST_PROXYARP1 # Flushing - extract_new_packets > ./out + extract_new_packets bus1 > ./out # Set up proxy ARP entry export RUMP_SERVER=$SOCKDST @@ -435,7 +421,7 @@ test_proxy_arp() rump.ping -n -w 1 -c 1 $IP4DST_PROXYARP1 fi - extract_new_packets > ./out + extract_new_packets bus1 > ./out $DEBUG && cat ./out pkt1=$(make_pkt_str_arprep $IP4DST_PROXYARP1 $macaddr_dst) @@ -461,7 +447,7 @@ test_proxy_arp() atf_check -s not-exit:0 -o ignore -e ignore \ rump.ping -n -w 1 -c 1 $IP4DST_PROXYARP2 - extract_new_packets > ./out + extract_new_packets bus1 > ./out $DEBUG && cat ./out # ARP reply should be sent @@ -482,12 +468,14 @@ arp_proxy_arp_pub_body() { test_proxy_arp pub + rump_server_destroy_ifaces } arp_proxy_arp_pubproxy_body() { test_proxy_arp pubproxy + rump_server_destroy_ifaces } arp_link_activation_body() @@ -495,14 +483,14 @@ arp_link_activation_body() local arp_keep=5 local bonus=2 - atf_check -s exit:0 ${inetserver} $SOCKSRC - atf_check -s exit:0 ${inetserver} $SOCKDST + rump_server_start $SOCKSRC + rump_server_start $SOCKDST setup_dst_server setup_src_server $arp_keep # flush old packets - extract_new_packets > ./out + extract_new_packets bus1 > ./out export RUMP_SERVER=$SOCKSRC @@ -510,7 +498,7 @@ arp_link_activation_body() b2:a1:00:00:00:01 atf_check -s exit:0 sleep 1 - extract_new_packets > ./out + extract_new_packets bus1 > ./out $DEBUG && cat ./out pkt=$(make_pkt_str_arpreq $IP4SRC $IP4SRC) @@ -520,12 +508,14 @@ arp_link_activation_body() b2:a1:00:00:00:02 active atf_check -s exit:0 sleep 1 - extract_new_packets > ./out + extract_new_packets bus1 > ./out $DEBUG && cat ./out pkt=$(make_pkt_str_arpreq $IP4SRC $IP4SRC) atf_check -s exit:0 -x \ "cat ./out |grep '$pkt' |grep -q 'b2:a1:00:00:00:02'" + + rump_server_destroy_ifaces } arp_static_body() @@ -533,14 +523,13 @@ arp_static_body() local arp_keep=5 local macaddr_src= - atf_check -s exit:0 ${inetserver} $SOCKSRC - atf_check -s exit:0 ${inetserver} $SOCKDST + rump_server_start $SOCKSRC + rump_server_start $SOCKDST setup_dst_server setup_src_server $arp_keep - export RUMP_SERVER=$SOCKSRC - macaddr_src=$(rump.ifconfig shmif0 |awk '/address/ {print $2;}') + macaddr_src=$(get_macaddr $SOCKSRC shmif0) # Set a (valid) static ARP entry for the src server export RUMP_SERVER=$SOCKDST @@ -551,37 +540,8 @@ arp_static_body() # Test receiving an ARP request with the static ARP entry (as spa/sha) export RUMP_SERVER=$SOCKSRC atf_check -s exit:0 -o ignore rump.ping -n -w 1 -c 1 $IP4DST -} -cleanup() -{ - env RUMP_SERVER=$SOCKSRC rump.halt - env RUMP_SERVER=$SOCKDST rump.halt -} - -dump_src() -{ - export RUMP_SERVER=$SOCKSRC - rump.netstat -nr - rump.arp -n -a - rump.ifconfig - $HIJACKING dmesg -} - -dump_dst() -{ - export RUMP_SERVER=$SOCKDST - rump.netstat -nr - rump.arp -n -a - rump.ifconfig - $HIJACKING dmesg -} - -dump() -{ - dump_src - dump_dst - shmif_dumpbus -p - bus1 2>/dev/null| tcpdump -n -e -r - + rump_server_destroy_ifaces } arp_cache_expiration_5s_cleanup() @@ -604,9 +564,8 @@ arp_command_cleanup() arp_garp_cleanup() { - $DEBUG && dump_src - $DEBUG && shmif_dumpbus -p - bus1 2>/dev/null| tcpdump -n -e -r - - env RUMP_SERVER=$SOCKSRC rump.halt + $DEBUG && dump + cleanup } arp_cache_overwriting_cleanup() diff --git a/contrib/netbsd-tests/net/arp/t_dad.sh b/contrib/netbsd-tests/net/arp/t_dad.sh index aefcb0befa45..57a7d4b0ecc4 100755 --- a/contrib/netbsd-tests/net/arp/t_dad.sh +++ b/contrib/netbsd-tests/net/arp/t_dad.sh @@ -1,4 +1,4 @@ -# $NetBSD: t_dad.sh,v 1.7 2016/08/10 22:05:07 kre Exp $ +# $NetBSD: t_dad.sh,v 1.13 2016/11/25 08:51:16 ozaki-r Exp $ # # Copyright (c) 2015 The NetBSD Foundation, Inc. # All rights reserved. @@ -25,14 +25,10 @@ # POSSIBILITY OF SUCH DAMAGE. # -inetserver="rump_server -lrumpnet -lrumpnet_net -lrumpnet_netinet -lrumpnet_shmif" -inetserver="${inetserver} -lrumpdev" -HIJACKING="env LD_PRELOAD=/usr/lib/librumphijack.so RUMPHIJACK=sysctl=yes" - SOCKLOCAL=unix://commsock1 SOCKPEER=unix://commsock2 -DEBUG=false +DEBUG=${DEBUG:-false} atf_test_case dad_basic cleanup atf_test_case dad_duplicated cleanup @@ -54,10 +50,9 @@ setup_server() local sock=$1 local ip=$2 - export RUMP_SERVER=$sock + rump_server_add_iface $sock shmif0 bus1 - atf_check -s exit:0 rump.ifconfig shmif0 create - atf_check -s exit:0 rump.ifconfig shmif0 linkstr bus1 + export RUMP_SERVER=$sock atf_check -s exit:0 rump.ifconfig shmif0 inet $ip/24 atf_check -s exit:0 rump.ifconfig shmif0 up atf_check -s exit:0 rump.ifconfig -w 10 @@ -74,30 +69,15 @@ make_pkt_str() echo $pkt } -extract_new_packets() -{ - local old=./old - - if [ ! -f $old ]; then - old=/dev/null - fi - - shmif_dumpbus -p - bus1 2>/dev/null| \ - tcpdump -n -e -r - 2>/dev/null > ./new - diff -u $old ./new |grep '^+' |cut -d '+' -f 2 > ./diff - mv -f ./new ./old - cat ./diff -} - dad_basic_body() { local pkt= - atf_check -s exit:0 ${inetserver} $SOCKLOCAL + rump_server_start $SOCKLOCAL + rump_server_add_iface $SOCKLOCAL shmif0 bus1 + export RUMP_SERVER=$SOCKLOCAL - atf_check -s exit:0 rump.ifconfig shmif0 create - atf_check -s exit:0 rump.ifconfig shmif0 linkstr bus1 atf_check -s exit:0 rump.ifconfig shmif0 inet 10.0.0.1/24 atf_check -s exit:0 rump.ifconfig shmif0 inet 10.0.0.2/24 alias $DEBUG && rump.ifconfig shmif0 @@ -107,13 +87,13 @@ dad_basic_body() $DEBUG && cat ./out # The primary address doesn't start with tentative state - atf_check -s not-exit:0 -x "cat ./out |grep 10.0.0.1 |grep -q tentative" + atf_check -s not-exit:0 -x "cat ./out |grep 10.0.0.1 |grep -iq tentative" # The alias address starts with tentative state # XXX we have no stable way to check this, so skip for now - #atf_check -s exit:0 -x "cat ./out |grep 10.0.0.2 |grep -q tentative" + #atf_check -s exit:0 -x "cat ./out |grep 10.0.0.2 |grep -iq tentative" atf_check -s exit:0 sleep 2 - extract_new_packets > ./out + extract_new_packets bus1 > ./out $DEBUG && cat ./out # Check DAD probe packets @@ -127,14 +107,14 @@ dad_basic_body() atf_check -s exit:0 rump.ifconfig -w 10 # Give a chance to send a DAD announce packet atf_check -s exit:0 sleep 1 - extract_new_packets > ./out + extract_new_packets bus1 > ./out $DEBUG && cat ./out # Check the DAD announce packet pkt=$(make_pkt_str 10.0.0.2 10.0.0.2) atf_check -s exit:0 -x "cat ./out |grep -q '$pkt'" # The alias address left tentative - atf_check -s not-exit:0 -x "rump.ifconfig shmif0 |grep 10.0.0.2 |grep -q tentative" + atf_check -s not-exit:0 -x "rump.ifconfig shmif0 |grep 10.0.0.2 |grep -iq tentative" # # Add a new address on the fly @@ -143,11 +123,11 @@ dad_basic_body() # The new address starts with tentative state # XXX we have no stable way to check this, so skip for now - #atf_check -s exit:0 -x "rump.ifconfig shmif0 |grep 10.0.0.3 |grep -q tentative" + #atf_check -s exit:0 -x "rump.ifconfig shmif0 |grep 10.0.0.3 |grep -iq tentative" # Check DAD probe packets atf_check -s exit:0 sleep 2 - extract_new_packets > ./out + extract_new_packets bus1 > ./out $DEBUG && cat ./out pkt=$(make_pkt_str 10.0.0.3 0.0.0.0) atf_check -s exit:0 -x "cat ./out |grep -q '$pkt'" @@ -156,14 +136,16 @@ dad_basic_body() atf_check -s exit:0 rump.ifconfig -w 10 # Give a chance to send a DAD announce packet atf_check -s exit:0 sleep 1 - extract_new_packets > ./out + extract_new_packets bus1 > ./out $DEBUG && cat ./out # Check the DAD announce packet pkt=$(make_pkt_str 10.0.0.3 10.0.0.3) atf_check -s exit:0 -x "cat ./out |grep -q '$pkt'" # The new address left tentative - atf_check -s not-exit:0 -x "rump.ifconfig shmif0 |grep 10.0.0.3 |grep -q tentative" + atf_check -s not-exit:0 -x "rump.ifconfig shmif0 |grep 10.0.0.3 |grep -iq tentative" + + rump_server_destroy_ifaces } dad_duplicated_body() @@ -172,8 +154,8 @@ dad_duplicated_body() local localip2=10.0.1.11 local peerip=10.0.1.2 - atf_check -s exit:0 ${inetserver} $SOCKLOCAL - atf_check -s exit:0 ${inetserver} $SOCKPEER + rump_server_start $SOCKLOCAL + rump_server_start $SOCKPEER setup_server $SOCKLOCAL $localip1 setup_server $SOCKPEER $peerip @@ -181,7 +163,7 @@ dad_duplicated_body() export RUMP_SERVER=$SOCKLOCAL # The primary address isn't marked as duplicated - atf_check -s not-exit:0 -x "rump.ifconfig shmif0 |grep $localip1 |grep -q duplicated" + atf_check -s not-exit:0 -x "rump.ifconfig shmif0 |grep $localip1 |grep -iq duplicated" # # Add a new address duplicated with the peer server @@ -190,50 +172,20 @@ dad_duplicated_body() atf_check -s exit:0 sleep 1 # The new address is marked as duplicated - atf_check -s exit:0 -x "rump.ifconfig shmif0 |grep $peerip |grep -q duplicated" + atf_check -s exit:0 -x "rump.ifconfig shmif0 |grep $peerip |grep -iq duplicated" # A unique address isn't marked as duplicated atf_check -s exit:0 rump.ifconfig shmif0 inet $localip2 alias atf_check -s exit:0 sleep 1 - atf_check -s not-exit:0 -x "rump.ifconfig shmif0 |grep $localip2 |grep -q duplicated" -} + atf_check -s not-exit:0 -x "rump.ifconfig shmif0 |grep $localip2 |grep -iq duplicated" -cleanup() -{ - env RUMP_SERVER=$SOCKLOCAL rump.halt - env RUMP_SERVER=$SOCKPEER rump.halt -} - -dump_local() -{ - export RUMP_SERVER=$SOCKLOCAL - rump.netstat -nr - rump.arp -n -a - rump.ifconfig - $HIJACKING dmesg -} - -dump_peer() -{ - export RUMP_SERVER=$SOCKPEER - rump.netstat -nr - rump.arp -n -a - rump.ifconfig - $HIJACKING dmesg -} - -dump() -{ - dump_local - dump_peer - shmif_dumpbus -p - bus1 2>/dev/null| tcpdump -n -e -r - + rump_server_destroy_ifaces } dad_basic_cleanup() { - $DEBUG && dump_local - $DEBUG && shmif_dumpbus -p - bus1 2>/dev/null| tcpdump -n -e -r - - env RUMP_SERVER=$SOCKLOCAL rump.halt + $DEBUG && dump + cleanup } dad_duplicated_cleanup() diff --git a/contrib/netbsd-tests/net/icmp/t_icmp6_redirect.sh b/contrib/netbsd-tests/net/icmp/t_icmp6_redirect.sh index c12017d5b090..5dcdc9cda03e 100755 --- a/contrib/netbsd-tests/net/icmp/t_icmp6_redirect.sh +++ b/contrib/netbsd-tests/net/icmp/t_icmp6_redirect.sh @@ -1,4 +1,4 @@ -# $NetBSD: t_icmp6_redirect.sh,v 1.2 2016/08/10 22:17:44 kre Exp $ +# $NetBSD: t_icmp6_redirect.sh,v 1.7 2016/11/25 08:51:16 ozaki-r Exp $ # # Copyright (c) 2015 Internet Initiative Japan Inc. # All rights reserved. @@ -24,8 +24,6 @@ # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE # POSSIBILITY OF SUCH DAMAGE. # -netserver="rump_server -lrumpnet -lrumpnet_net -lrumpnet_shmif" -netserver="${netserver} -lrumpnet_netinet -lrumpnet_netinet6 -lrumpdev" SOCK_LOCAL=unix://commsock1 SOCK_PEER=unix://commsock2 @@ -44,50 +42,38 @@ IP6IF0_GW2=fc00:1::3 REDIRECT_TIMEOUT=5 -DEBUG=true +DEBUG=${DEBUG:-true} -get_lladdr() -{ +atf_test_case icmp6_redirect_basic cleanup - export RUMP_SERVER=${1} - rump.ifconfig ${2} inet6 | awk "/fe80/ {sub(/%$2/, \"\"); print \$2;}" - unset RUMP_SERVER - - return 0 -} - -atf_test_case basic cleanup - -basic_head() +icmp6_redirect_basic_head() { atf_set "descr" "Test for the basically function of the ICMP6 redirect" atf_set "require.progs" "rump_server rump.route rump.ping rump.ifconfig" } -basic_body() +icmp6_redirect_basic_body() { local gw1_lladdr0= local gw1_lladdr1= local gw2_lladdr0= - atf_check -s exit:0 ${netserver} ${SOCK_LOCAL} - atf_check -s exit:0 ${netserver} ${SOCK_PEER} - atf_check -s exit:0 ${netserver} ${SOCK_GW1} - atf_check -s exit:0 ${netserver} ${SOCK_GW2} + rump_server_start $SOCK_LOCAL netinet6 + rump_server_start $SOCK_PEER netinet6 + rump_server_start $SOCK_GW1 netinet6 + rump_server_start $SOCK_GW2 netinet6 # # Setup # # Setup gateway #1 (real gateway) export RUMP_SERVER=${SOCK_GW1} - atf_check -s exit:0 rump.ifconfig shmif0 create - atf_check -s exit:0 rump.ifconfig shmif0 linkstr ${BUS1} + rump_server_add_iface $SOCK_GW1 shmif0 $BUS1 + rump_server_add_iface $SOCK_GW1 shmif1 $BUS2 + atf_check -s exit:0 rump.ifconfig shmif0 inet6 ${IP6IF0_GW1} atf_check -s exit:0 rump.ifconfig shmif0 up - - atf_check -s exit:0 rump.ifconfig shmif1 create - atf_check -s exit:0 rump.ifconfig shmif1 linkstr ${BUS2} atf_check -s exit:0 rump.ifconfig shmif1 inet6 ${IP6IF1_GW1} atf_check -s exit:0 rump.ifconfig shmif1 up @@ -95,13 +81,12 @@ basic_body() net.inet6.ip6.forwarding=1 unset RUMP_SERVER - gw1_lladdr0=`get_lladdr ${SOCK_GW1} shmif0` - gw1_lladdr1=`get_lladdr ${SOCK_GW1} shmif1` + gw1_lladdr0=`get_linklocal_addr ${SOCK_GW1} shmif0` + gw1_lladdr1=`get_linklocal_addr ${SOCK_GW1} shmif1` # Setup a peer behind gateway #1 export RUMP_SERVER=${SOCK_PEER} - atf_check -s exit:0 rump.ifconfig shmif0 create - atf_check -s exit:0 rump.ifconfig shmif0 linkstr ${BUS2} + rump_server_add_iface $SOCK_PEER shmif0 $BUS2 atf_check -s exit:0 rump.ifconfig shmif0 inet6 ${IP6IF0_PEER} atf_check -s exit:0 rump.ifconfig shmif0 up atf_check -s exit:0 -o ignore rump.route add \ @@ -110,8 +95,7 @@ basic_body() # Setup gateway #2 (fake gateway) export RUMP_SERVER=${SOCK_GW2} - atf_check -s exit:0 rump.ifconfig shmif0 create - atf_check -s exit:0 rump.ifconfig shmif0 linkstr ${BUS1} + rump_server_add_iface $SOCK_GW2 shmif0 $BUS1 atf_check -s exit:0 rump.ifconfig shmif0 inet6 ${IP6IF0_GW2} atf_check -s exit:0 rump.ifconfig shmif0 up @@ -121,11 +105,10 @@ basic_body() net.inet6.ip6.forwarding=1 unset RUMP_SERVER - gw2_lladdr0=`get_lladdr ${SOCK_GW2} shmif0` + gw2_lladdr0=`get_linklocal_addr ${SOCK_GW2} shmif0` export RUMP_SERVER=${SOCK_LOCAL} - atf_check -s exit:0 rump.ifconfig shmif0 create - atf_check -s exit:0 rump.ifconfig shmif0 linkstr ${BUS1} + rump_server_add_iface $SOCK_LOCAL shmif0 $BUS1 atf_check -s exit:0 rump.ifconfig shmif0 inet6 ${IP6IF0_LOCAL} atf_check -s exit:0 rump.ifconfig shmif0 up @@ -152,20 +135,18 @@ basic_body() atf_check -s exit:0 -o not-match:"gateway: ${gw1_lladdr0}" rump.route get \ -inet6 ${IP6IF0_PEER} - unset RUMP_SERVER + rump_server_destroy_ifaces } -basic_cleanup() +icmp6_redirect_basic_cleanup() { - env RUMP_SERVER=$SOCK_LOCAL rump.halt - env RUMP_SERVER=$SOCK_PEER rump.halt - env RUMP_SERVER=$SOCK_GW1 rump.halt - env RUMP_SERVER=$SOCK_GW2 rump.halt + $DEBUG && dump + cleanup } atf_init_test_cases() { - atf_add_test_case basic + atf_add_test_case icmp6_redirect_basic } diff --git a/contrib/netbsd-tests/net/icmp/t_icmp_redirect.sh b/contrib/netbsd-tests/net/icmp/t_icmp_redirect.sh index 730f2d28a11f..669721649365 100755 --- a/contrib/netbsd-tests/net/icmp/t_icmp_redirect.sh +++ b/contrib/netbsd-tests/net/icmp/t_icmp_redirect.sh @@ -1,4 +1,4 @@ -# $NetBSD: t_icmp_redirect.sh,v 1.3 2016/08/10 22:17:44 kre Exp $ +# $NetBSD: t_icmp_redirect.sh,v 1.6 2016/11/25 08:51:16 ozaki-r Exp $ # # Copyright (c) 2015 The NetBSD Foundation, Inc. # All rights reserved. @@ -27,8 +27,6 @@ # Most codes are derived from tests/net/route/t_flags.sh -netserver=\ -"rump_server -lrumpnet -lrumpnet_net -lrumpnet_netinet -lrumpnet_shmif -lrumpdev" SOCK_LOCAL=unix://commsock1 SOCK_PEER=unix://commsock2 SOCK_GW=unix://commsock3 @@ -36,7 +34,7 @@ BUS=bus1 BUS2=bus2 REDIRECT_TIMEOUT=5 -DEBUG=false +DEBUG=${DEBUG:-false} atf_test_case icmp_redirect_timeout cleanup @@ -50,11 +48,10 @@ icmp_redirect_timeout_head() setup_local() { - atf_check -s exit:0 ${netserver} ${SOCK_LOCAL} + rump_server_start $SOCK_LOCAL + rump_server_add_iface $SOCK_LOCAL shmif0 $BUS export RUMP_SERVER=$SOCK_LOCAL - atf_check -s exit:0 -o ignore rump.ifconfig shmif0 create - atf_check -s exit:0 -o ignore rump.ifconfig shmif0 linkstr ${BUS} atf_check -s exit:0 -o ignore rump.ifconfig shmif0 10.0.0.2/24 atf_check -s exit:0 -o ignore rump.ifconfig shmif0 up @@ -68,11 +65,10 @@ setup_local() setup_peer() { - atf_check -s exit:0 ${netserver} ${SOCK_PEER} + rump_server_start $SOCK_PEER + rump_server_add_iface $SOCK_PEER shmif0 $BUS export RUMP_SERVER=$SOCK_PEER - atf_check -s exit:0 -o ignore rump.ifconfig shmif0 create - atf_check -s exit:0 -o ignore rump.ifconfig shmif0 linkstr ${BUS} atf_check -s exit:0 -o ignore rump.ifconfig shmif0 10.0.0.1/24 atf_check -s exit:0 -o ignore rump.ifconfig shmif0 up @@ -83,16 +79,14 @@ setup_peer() setup_gw() { - atf_check -s exit:0 ${netserver} ${SOCK_GW} + rump_server_start $SOCK_GW + rump_server_add_iface $SOCK_GW shmif0 $BUS + rump_server_add_iface $SOCK_GW shmif1 $BUS2 export RUMP_SERVER=$SOCK_GW - atf_check -s exit:0 -o ignore rump.ifconfig shmif0 create - atf_check -s exit:0 -o ignore rump.ifconfig shmif0 linkstr ${BUS} atf_check -s exit:0 -o ignore rump.ifconfig shmif0 10.0.0.254/24 atf_check -s exit:0 -o ignore rump.ifconfig shmif0 up - atf_check -s exit:0 -o ignore rump.ifconfig shmif1 create - atf_check -s exit:0 -o ignore rump.ifconfig shmif1 linkstr ${BUS2} atf_check -s exit:0 -o ignore rump.ifconfig shmif1 10.0.2.1/24 atf_check -s exit:0 -o ignore rump.ifconfig shmif1 alias 10.0.2.2/24 atf_check -s exit:0 -o ignore rump.ifconfig shmif1 up @@ -105,39 +99,6 @@ setup_gw() $DEBUG && rump.netstat -rn -f inet } -teardown_gw() -{ - - env RUMP_SERVER=$SOCK_GW rump.halt -} - -check_entry_flags() -{ - local ip=$(echo $1 |sed 's/\./\\./g') - local flags=$2 - - atf_check -s exit:0 -o match:" $flags " -e ignore -x \ - "rump.netstat -rn -f inet | grep ^'$ip'" -} - -check_entry_gw() -{ - local ip=$(echo $1 |sed 's/\./\\./g') - local gw=$2 - - atf_check -s exit:0 -o match:" $gw " -e ignore -x \ - "rump.netstat -rn -f inet | grep ^'$ip'" -} - -check_entry_fail() -{ - local ip=$(echo $1 |sed 's/\./\\./g') - local flags=$2 # Not used currently - - atf_check -s not-exit:0 -e ignore -x \ - "rump.netstat -rn -f inet | grep ^'$ip'" -} - icmp_redirect_timeout_body() { @@ -159,7 +120,7 @@ icmp_redirect_timeout_body() export RUMP_SERVER=$SOCK_PEER atf_check -s exit:0 -o ignore rump.route add -net 10.0.2.0/24 10.0.0.254 # Up, Gateway, Static - check_entry_flags 10.0.2/24 UGS + check_route_flags 10.0.2/24 UGS # # Setup the default gateway to the peer, 10.0.0.1 @@ -167,39 +128,25 @@ icmp_redirect_timeout_body() export RUMP_SERVER=$SOCK_LOCAL atf_check -s exit:0 -o ignore rump.route add default 10.0.0.1 # Up, Gateway, Static - check_entry_flags default UGS + check_route_flags default UGS # Try ping 10.0.2.1 atf_check -s exit:0 -o ignore rump.ping -n -w 1 -c 1 10.0.2.1 $DEBUG && rump.netstat -rn -f inet # Up, Gateway, Host, Dynamic - check_entry_flags 10.0.2.1 UGHD - check_entry_gw 10.0.2.1 10.0.0.254 + check_route_flags 10.0.2.1 UGHD + check_route_gw 10.0.2.1 10.0.0.254 atf_check -s exit:0 sleep $((REDIRECT_TIMEOUT + 2)) # The dynamic entry should be expired and removed - check_entry_fail 10.0.2.1 + check_route_no_entry 10.0.2.1 export RUMP_SERVER=$SOCK_PEER $DEBUG && rump.netstat -rn -f inet - teardown_gw -} - -dump() -{ - - shmif_dumpbus -p - $BUS 2>/dev/null | tcpdump -n -e -r - - gdb -ex bt /usr/bin/rump_server rump_server.core -} - -cleanup() -{ - - env RUMP_SERVER=$SOCK_LOCAL rump.halt - env RUMP_SERVER=$SOCK_PEER rump.halt + rump_server_destroy_ifaces } icmp_redirect_timeout_cleanup() @@ -249,7 +196,7 @@ icmp_redirect_body() export RUMP_SERVER=$SOCK_PEER atf_check -s exit:0 -o ignore rump.route add -net 10.0.2.0/24 10.0.0.254 # Up, Gateway, Static - check_entry_flags 10.0.2/24 UGS + check_route_flags 10.0.2/24 UGS # # Setup the default gateway to the peer, 10.0.0.1 @@ -257,7 +204,7 @@ icmp_redirect_body() export RUMP_SERVER=$SOCK_LOCAL atf_check -s exit:0 -o ignore rump.route add default 10.0.0.1 # Up, Gateway, Static - check_entry_flags default UGS + check_route_flags default UGS ### ICMP redirects are NOT sent by the peer ### @@ -274,7 +221,7 @@ icmp_redirect_body() $DEBUG && rump.netstat -rn -f inet # A direct route shouldn't be created - check_entry_fail 10.0.2.1 + check_route_no_entry 10.0.2.1 ### ICMP redirects are sent by the peer ### @@ -291,8 +238,8 @@ icmp_redirect_body() $DEBUG && rump.netstat -rn -f inet # Up, Gateway, Host, Dynamic - check_entry_flags 10.0.2.1 UGHD - check_entry_gw 10.0.2.1 10.0.0.254 + check_route_flags 10.0.2.1 UGHD + check_route_gw 10.0.2.1 10.0.0.254 export RUMP_SERVER=$SOCK_PEER $DEBUG && rump.netstat -rn -f inet @@ -301,7 +248,7 @@ icmp_redirect_body() # cleanup export RUMP_SERVER=$SOCK_LOCAL atf_check -s exit:0 -o ignore rump.route delete 10.0.2.1 - check_entry_fail 10.0.2.1 + check_route_no_entry 10.0.2.1 ### ICMP redirects are NOT sent by the peer (again) ### @@ -318,10 +265,9 @@ icmp_redirect_body() $DEBUG && rump.netstat -rn -f inet # A direct route shouldn't be created - check_entry_fail 10.0.2.1 + check_route_no_entry 10.0.2.1 - - teardown_gw + rump_server_destroy_ifaces } icmp_redirect_cleanup() diff --git a/contrib/netbsd-tests/net/if/t_compat.c b/contrib/netbsd-tests/net/if/t_compat.c index 4798034fa2cc..9eb84a3bbbe9 100644 --- a/contrib/netbsd-tests/net/if/t_compat.c +++ b/contrib/netbsd-tests/net/if/t_compat.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_compat.c,v 1.1 2010/11/07 19:53:42 pooka Exp $ */ +/* $NetBSD: t_compat.c,v 1.4 2016/11/12 15:12:59 kre Exp $ */ #include #include @@ -65,6 +65,8 @@ ATF_TC_BODY(OOSIOCGIFBRDADDR, tc) sprintf(ifreq.ifr_name, "shmif%d", ifnum); netcfg_rump_if(ifreq.ifr_name, "1.7.64.10", "255.255.0.0"); + atf_tc_expect_fail("PR kern/51610: rump does not include COMPAT_43"); + /* query kernel for iface bcast */ RL(fd = rump_sys_socket(AF_INET, SOCK_DGRAM, 0)); RL(rump_sys_ioctl(fd, OOSIOCGIFBRDADDR, &ifreq)); diff --git a/contrib/netbsd-tests/net/if/t_ifconfig.sh b/contrib/netbsd-tests/net/if/t_ifconfig.sh index e8c53e675b41..a6100179de43 100755 --- a/contrib/netbsd-tests/net/if/t_ifconfig.sh +++ b/contrib/netbsd-tests/net/if/t_ifconfig.sh @@ -1,4 +1,4 @@ -# $NetBSD: t_ifconfig.sh,v 1.11 2016/08/10 22:30:02 kre Exp $ +# $NetBSD: t_ifconfig.sh,v 1.14 2016/10/01 22:15:04 kre Exp $ # # Copyright (c) 2015 The NetBSD Foundation, Inc. # All rights reserved. @@ -34,6 +34,9 @@ RUMP_FLAGS="${RUMP_FLAGS} -lrumpdev" TIMEOUT=3 +anycast="[Aa][Nn][Yy][Cc][Aa][Ss][Tt]" +deprecated="[Dd][Ee][Pp][Rr][Ee][Cc][Aa][Tt][Ee][Dd]" + atf_test_case ifconfig_create_destroy cleanup ifconfig_create_destroy_head() { @@ -227,16 +230,17 @@ ifconfig_parameters_body() rump.ifconfig shmif0 # down, up atf_check -s exit:0 rump.ifconfig shmif0 down - atf_check -s ignore -o ignore -e match:'down' rump.ping -c 1 \ + atf_check -s not-exit:0 -o ignore -e ignore rump.ping -c 1 \ -w $TIMEOUT -n 192.168.0.2 atf_check -s exit:0 rump.ifconfig shmif0 up + atf_check -s exit:0 rump.ifconfig -w 10 atf_check -s exit:0 -o ignore rump.ping -c 1 -w $TIMEOUT -n 192.168.0.2 # alias atf_check -s exit:0 rump.ifconfig shmif0 inet 192.168.1.1/24 alias - atf_check -s exit:0 -o match:'alias 192.168.1.1' rump.ifconfig shmif0 + atf_check -s exit:0 -o match:'192.168.1.1/24' rump.ifconfig shmif0 atf_check -s exit:0 rump.ifconfig shmif0 inet 192.168.1.1/24 -alias - atf_check -s exit:0 -o not-match:'192.168.1.1' rump.ifconfig shmif0 + atf_check -s exit:0 -o not-match:'192.168.1.1/24' rump.ifconfig shmif0 atf_check -s exit:0 rump.ifconfig shmif0 inet6 fc00::1 atf_check -s exit:0 rump.ifconfig shmif0 inet6 fc00::2 atf_check -s exit:0 -o match:'fc00::1' rump.ifconfig shmif0 inet6 @@ -290,22 +294,22 @@ ifconfig_parameters_body() # anycast atf_check -s exit:0 rump.ifconfig shmif0 inet6 fc00::2 anycast - atf_check -s exit:0 -o match:'fc00::2.+anycast' rump.ifconfig shmif0 inet6 + atf_check -s exit:0 -o match:"fc00::2.+$anycast" rump.ifconfig shmif0 inet6 # deprecated atf_check -s exit:0 rump.ifconfig shmif0 inet6 fc00::3 deprecated # Not deprecated immediately. Need to wait nd6_timer that does it is scheduled. interval=$(sysctl -n net.inet6.icmp6.nd6_prune) atf_check -s exit:0 sleep $((interval + 1)) - atf_check -s exit:0 -o match:'fc00::3.+deprecated' rump.ifconfig shmif0 inet6 + atf_check -s exit:0 -o match:"fc00::3.+$deprecated" rump.ifconfig shmif0 inet6 atf_check -s exit:0 rump.ifconfig shmif0 inet6 fc00::3 -deprecated - atf_check -s exit:0 -o not-match:'fc00::3.+deprecated' rump.ifconfig shmif0 inet6 + atf_check -s exit:0 -o not-match:"fc00::3.+$deprecated" rump.ifconfig shmif0 inet6 # pltime atf_check -s exit:0 rump.ifconfig shmif0 inet6 fc00::3 pltime 3 - atf_check -s exit:0 -o not-match:'fc00::3.+deprecated' rump.ifconfig shmif0 inet6 + atf_check -s exit:0 -o not-match:"fc00::3.+$deprecated" rump.ifconfig shmif0 inet6 atf_check -s exit:0 sleep 5 - atf_check -s exit:0 -o match:'fc00::3.+deprecated' rump.ifconfig shmif0 inet6 + atf_check -s exit:0 -o match:"fc00::3.+$deprecated" rump.ifconfig shmif0 inet6 # eui64 atf_check -s exit:0 rump.ifconfig shmif0 inet6 fc00:1::0 eui64 diff --git a/contrib/netbsd-tests/net/if_bridge/t_bridge.sh b/contrib/netbsd-tests/net/if_bridge/t_bridge.sh index 769893d44781..25edb35895ba 100755 --- a/contrib/netbsd-tests/net/if_bridge/t_bridge.sh +++ b/contrib/netbsd-tests/net/if_bridge/t_bridge.sh @@ -1,4 +1,4 @@ -# $NetBSD: t_bridge.sh,v 1.13 2016/08/10 22:37:07 kre Exp $ +# $NetBSD: t_bridge.sh,v 1.16 2016/11/25 08:51:16 ozaki-r Exp $ # # Copyright (c) 2014 The NetBSD Foundation, Inc. # All rights reserved. @@ -25,13 +25,6 @@ # POSSIBILITY OF SUCH DAMAGE. # -libs1="-lrumpnet -lrumpnet_net -lrumpnet_netinet" -libs2="-lrumpnet_bridge -lrumpnet_shmif -lrumpdev" -libs6="-lrumpnet_netinet6" - -inetserver="rump_server ${libs1} ${libs2}" -inet6server="rump_server ${libs1} ${libs6} ${libs2}" - SOCK1=unix://commsock1 SOCK2=unix://commsock2 SOCK3=unix://commsock3 @@ -44,6 +37,7 @@ IPBR2=10.0.0.12 IP6BR1=fc00::11 IP6BR2=fc00::12 +DEBUG=${DEBUG:-false} TIMEOUT=5 atf_test_case bridge_ipv4 cleanup @@ -89,9 +83,8 @@ setup_endpoint() bus=${3} mode=${4} + rump_server_add_iface $sock shmif0 $bus export RUMP_SERVER=${sock} - atf_check -s exit:0 rump.ifconfig shmif0 create - atf_check -s exit:0 rump.ifconfig shmif0 linkstr ${bus} if [ $mode = "ipv6" ]; then atf_check -s exit:0 rump.ifconfig shmif0 inet6 ${addr} else @@ -99,7 +92,7 @@ setup_endpoint() fi atf_check -s exit:0 rump.ifconfig shmif0 up - rump.ifconfig shmif0 + $DEBUG && rump.ifconfig shmif0 } test_endpoint() @@ -118,14 +111,6 @@ test_endpoint() fi } -show_endpoint() -{ - sock=${1} - - export RUMP_SERVER=${sock} - rump.ifconfig -v shmif0 -} - test_setup() { test_endpoint $SOCK1 $IP1 bus1 ipv4 @@ -148,21 +133,20 @@ test_setup6() setup_bridge_server() { - export RUMP_SERVER=$SOCK2 - atf_check -s exit:0 rump.ifconfig shmif0 create - atf_check -s exit:0 rump.ifconfig shmif0 linkstr bus1 - atf_check -s exit:0 rump.ifconfig shmif0 up - atf_check -s exit:0 rump.ifconfig shmif1 create - atf_check -s exit:0 rump.ifconfig shmif1 linkstr bus2 + rump_server_add_iface $SOCK2 shmif0 bus1 + rump_server_add_iface $SOCK2 shmif1 bus2 + export RUMP_SERVER=$SOCK2 + atf_check -s exit:0 rump.ifconfig shmif0 up atf_check -s exit:0 rump.ifconfig shmif1 up } setup() { - atf_check -s exit:0 ${inetserver} $SOCK1 - atf_check -s exit:0 ${inetserver} $SOCK2 - atf_check -s exit:0 ${inetserver} $SOCK3 + + rump_server_start $SOCK1 bridge + rump_server_start $SOCK2 bridge + rump_server_start $SOCK3 bridge setup_endpoint $SOCK1 $IP1 bus1 ipv4 setup_endpoint $SOCK3 $IP2 bus2 ipv4 @@ -171,9 +155,10 @@ setup() setup6() { - atf_check -s exit:0 ${inet6server} $SOCK1 - atf_check -s exit:0 ${inet6server} $SOCK2 - atf_check -s exit:0 ${inet6server} $SOCK3 + + rump_server_start $SOCK1 netinet6 bridge + rump_server_start $SOCK2 netinet6 bridge + rump_server_start $SOCK3 netinet6 bridge setup_endpoint $SOCK1 $IP61 bus1 ipv6 setup_endpoint $SOCK3 $IP62 bus2 ipv6 @@ -244,19 +229,6 @@ test_setup_bridge() unset LD_PRELOAD } -cleanup() -{ - env RUMP_SERVER=$SOCK1 rump.halt - env RUMP_SERVER=$SOCK2 rump.halt - env RUMP_SERVER=$SOCK3 rump.halt -} - -dump_bus() -{ - /usr/bin/shmif_dumpbus -p - bus1 2>/dev/null| /usr/sbin/tcpdump -n -e -r - - /usr/bin/shmif_dumpbus -p - bus2 2>/dev/null| /usr/sbin/tcpdump -n -e -r - -} - down_up_interfaces() { export RUMP_SERVER=$SOCK1 @@ -360,11 +332,8 @@ test_brconfig_maxaddr() addr1= addr3= n= # Get MAC addresses of the endpoints. - export RUMP_SERVER=$SOCK1 - addr1=$(rump.ifconfig shmif0 |awk '/address:/ { print $2;}') - export RUMP_SERVER=$SOCK3 - addr3=$(rump.ifconfig shmif0 |awk '/address:/ { print $2;}') - unset RUMP_SERVER + addr1=$(get_macaddr $SOCK1 shmif0) + addr3=$(get_macaddr $SOCK3 shmif0) # Refill the MAC addresses of the endpoints. export RUMP_SERVER=$SOCK1 @@ -422,6 +391,8 @@ bridge_ipv4_body() teardown_bridge test_ping_failure + + rump_server_destroy_ifaces } bridge_ipv6_body() @@ -438,6 +409,8 @@ bridge_ipv6_body() teardown_bridge test_ping6_failure + + rump_server_destroy_ifaces } bridge_rtable_body() @@ -448,16 +421,13 @@ bridge_rtable_body() setup_bridge # Get MAC addresses of the endpoints. - export RUMP_SERVER=$SOCK1 - addr1=$(rump.ifconfig shmif0 |awk '/address:/ { print $2;}') - export RUMP_SERVER=$SOCK3 - addr3=$(rump.ifconfig shmif0 |awk '/address:/ { print $2;}') - unset RUMP_SERVER + addr1=$(get_macaddr $SOCK1 shmif0) + addr3=$(get_macaddr $SOCK3 shmif0) # Confirm there is no MAC address caches. export RUMP_SERVER=$SOCK2 export LD_PRELOAD=/usr/lib/librumphijack.so - /sbin/brconfig bridge0 + $DEBUG && /sbin/brconfig bridge0 atf_check -s exit:0 -o not-match:"$addr1" /sbin/brconfig bridge0 atf_check -s exit:0 -o not-match:"$addr3" /sbin/brconfig bridge0 unset LD_PRELOAD @@ -470,7 +440,7 @@ bridge_rtable_body() # Tests the addresses are in the cache. export RUMP_SERVER=$SOCK2 export LD_PRELOAD=/usr/lib/librumphijack.so - /sbin/brconfig bridge0 + $DEBUG && /sbin/brconfig bridge0 atf_check -s exit:0 -o match:"$addr1 shmif0" /sbin/brconfig bridge0 atf_check -s exit:0 -o match:"$addr3 shmif1" /sbin/brconfig bridge0 @@ -487,7 +457,7 @@ bridge_rtable_body() unset RUMP_SERVER export RUMP_SERVER=$SOCK2 export LD_PRELOAD=/usr/lib/librumphijack.so - /sbin/brconfig bridge0 + $DEBUG && /sbin/brconfig bridge0 atf_check -s exit:0 -o match:"$addr1 shmif0" /sbin/brconfig bridge0 atf_check -s exit:0 -o match:"$addr3 shmif1" /sbin/brconfig bridge0 @@ -511,6 +481,8 @@ bridge_rtable_body() # TODO: brconfig static/flushall/discover/learn # TODO: cache expiration; it takes 5 minutes at least and we want to # wait here so long. Should we have a sysctl to change the period? + + rump_server_destroy_ifaces } bridge_member_ipv4_body() @@ -531,6 +503,8 @@ bridge_member_ipv4_body() teardown_bridge test_ping_failure + + rump_server_destroy_ifaces } bridge_member_ipv6_body() @@ -550,35 +524,42 @@ bridge_member_ipv6_body() teardown_bridge test_ping6_failure + + rump_server_destroy_ifaces } bridge_ipv4_cleanup() { - dump_bus + + $DEBUG && dump cleanup } bridge_ipv6_cleanup() { - dump_bus + + $DEBUG && dump cleanup } bridge_rtable_cleanup() { - dump_bus + + $DEBUG && dump cleanup } bridge_member_ipv4_cleanup() { - dump_bus + + $DEBUG && dump cleanup } bridge_member_ipv6_cleanup() { - dump_bus + + $DEBUG && dump cleanup } diff --git a/contrib/netbsd-tests/net/if_gif/t_gif.sh b/contrib/netbsd-tests/net/if_gif/t_gif.sh index b804d7b21cc4..8690d78b2dde 100755 --- a/contrib/netbsd-tests/net/if_gif/t_gif.sh +++ b/contrib/netbsd-tests/net/if_gif/t_gif.sh @@ -1,4 +1,4 @@ -# $NetBSD: t_gif.sh,v 1.5 2016/08/10 08:29:20 ozaki-r Exp $ +# $NetBSD: t_gif.sh,v 1.9 2016/12/21 09:46:39 ozaki-r Exp $ # # Copyright (c) 2015 Internet Initiative Japan Inc. # All rights reserved. @@ -25,10 +25,6 @@ # POSSIBILITY OF SUCH DAMAGE. # -server="rump_server -v -lrumpdev -lrumpnet -lrumpnet_net -lrumpnet_netinet \ - -lrumpnet_netinet6 -lrumpnet_shmif -lrumpnet_gif" -HIJACKING="env LD_PRELOAD=/usr/lib/librumphijack.so RUMPHIJACK=sysctl=yes" - SOCK1=unix://commsock1 # for ROUTER1 SOCK2=unix://commsock2 # for ROUTER2 ROUTER1_LANIP=192.168.1.1 @@ -65,6 +61,7 @@ ROUTER2_GIFIP6_DUMMY=fc00:14::1 ROUTER2_GIFIP6_RECURSIVE1=fc00:104::1 ROUTER2_GIFIP6_RECURSIVE2=fc00:204::1 +DEBUG=${DEBUG:-true} TIMEOUT=5 setup_router() @@ -75,9 +72,10 @@ setup_router() wan=${4} wan_mode=${5} + rump_server_add_iface $sock shmif0 bus0 + rump_server_add_iface $sock shmif1 bus1 + export RUMP_SERVER=${sock} - atf_check -s exit:0 rump.ifconfig shmif0 create - atf_check -s exit:0 rump.ifconfig shmif0 linkstr bus0 if [ ${lan_mode} = "ipv6" ]; then atf_check -s exit:0 rump.ifconfig shmif0 inet6 ${lan} else @@ -86,8 +84,6 @@ setup_router() atf_check -s exit:0 rump.ifconfig shmif0 up rump.ifconfig shmif0 - atf_check -s exit:0 rump.ifconfig shmif1 create - atf_check -s exit:0 rump.ifconfig shmif1 linkstr bus1 if [ ${wan_mode} = "ipv6" ]; then atf_check -s exit:0 rump.ifconfig shmif1 inet6 ${wan} else @@ -126,8 +122,8 @@ setup() inner=${1} outer=${2} - atf_check -s exit:0 ${server} $SOCK1 - atf_check -s exit:0 ${server} $SOCK2 + rump_server_start $SOCK1 netinet6 gif + rump_server_start $SOCK2 netinet6 gif router1_lan="" router1_lan_mode="" @@ -482,18 +478,6 @@ teardown_recursive_tunnels() atf_check -s exit:0 rump.ifconfig gif2 destroy } -cleanup() -{ - env RUMP_SERVER=$SOCK1 rump.halt - env RUMP_SERVER=$SOCK2 rump.halt -} - -dump_bus() -{ - /usr/bin/shmif_dumpbus -p - bus0 2>/dev/null| /usr/sbin/tcpdump -n -e -r - - /usr/bin/shmif_dumpbus -p - bus1 2>/dev/null| /usr/sbin/tcpdump -n -e -r - -} - test_ping_failure() { mode=$1 @@ -739,7 +723,7 @@ add_test() inner=$3 outer=$4 - name="${category}${inner}over${outer}" + name="gif_${category}_${inner}over${outer}" fulldesc="Does ${inner} over ${outer} if_gif ${desc}" atf_test_case ${name} cleanup @@ -751,9 +735,10 @@ add_test() ${category}_setup ${inner} ${outer}; \ ${category}_test ${inner} ${outer}; \ ${category}_teardown ${inner} ${outer}; \ + rump_server_destroy_ifaces; \ }; \ ${name}_cleanup() { \ - dump_bus; \ + $DEBUG && dump; \ cleanup; \ }" atf_add_test_case ${name} diff --git a/contrib/netbsd-tests/net/if_pppoe/t_pppoe.sh b/contrib/netbsd-tests/net/if_pppoe/t_pppoe.sh index 3199ca0a73e9..8d9d5c23a7a1 100755 --- a/contrib/netbsd-tests/net/if_pppoe/t_pppoe.sh +++ b/contrib/netbsd-tests/net/if_pppoe/t_pppoe.sh @@ -1,4 +1,4 @@ -# $NetBSD: t_pppoe.sh,v 1.2 2016/08/07 23:34:31 pgoyette Exp $ +# $NetBSD: t_pppoe.sh,v 1.16 2016/12/14 03:30:30 knakahara Exp $ # # Copyright (c) 2016 Internet Initiative Japan Inc. # All rights reserved. @@ -28,6 +28,7 @@ server="rump_server -lrump -lrumpnet -lrumpnet_net -lrumpnet_netinet \ -lrumpnet_netinet6 -lrumpnet_shmif -lrumpdev \ -lrumpnet_pppoe" +# pppoectl doesn't work with RUMPHIJACK=sysctl=yes HIJACKING="env LD_PRELOAD=/usr/lib/librumphijack.so" SERVER=unix://commsock1 @@ -35,17 +36,23 @@ CLIENT=unix://commsock2 SERVER_IP=10.3.3.1 CLIENT_IP=10.3.3.3 +SERVER_IP6=fc00::1 +CLIENT_IP6=fc00::3 AUTHNAME=foobar@baz.com SECRET=oink BUS=bus0 TIMEOUT=3 -WAITTIME=5 -DEBUG=false - -atf_test_case pap cleanup +WAITTIME=10 +DEBUG=${DEBUG:-false} setup() { + inet=true + + if [ $# -ne 0 ]; then + eval $@ + fi + atf_check -s exit:0 ${server} $SERVER atf_check -s exit:0 ${server} $CLIENT @@ -55,7 +62,8 @@ setup() atf_check -s exit:0 rump.ifconfig shmif0 up atf_check -s exit:0 rump.ifconfig pppoe0 create - atf_check -s exit:0 rump.ifconfig pppoe0 inet $SERVER_IP $CLIENT_IP down + $inet && atf_check -s exit:0 rump.ifconfig pppoe0 \ + inet $SERVER_IP $CLIENT_IP down atf_check -s exit:0 rump.ifconfig pppoe0 link0 $DEBUG && rump.ifconfig @@ -70,22 +78,19 @@ setup() atf_check -s exit:0 rump.ifconfig shmif0 up atf_check -s exit:0 rump.ifconfig pppoe0 create - atf_check -s exit:0 rump.ifconfig pppoe0 inet 0.0.0.0 0.0.0.1 down + $inet && atf_check -s exit:0 rump.ifconfig pppoe0 \ + inet 0.0.0.0 0.0.0.1 down atf_check -s exit:0 -x "$HIJACKING pppoectl -e shmif0 pppoe0" unset RUMP_SERVER } + cleanup() { env RUMP_SERVER=$SERVER rump.halt env RUMP_SERVER=$CLIENT rump.halt } -pap_head() -{ - atf_set "descr" "Does simple pap tests" - atf_set "require.progs" "rump_server pppoectl" -} wait_for_session_established() { @@ -98,21 +103,50 @@ wait_for_session_established() sleep 1 done - if [ $dontfail != "dontfail" ]; then + if [ "$dontfail" != "dontfail" ]; then atf_fail "Couldn't connect to the server for $n seconds." fi } -pap_body() +wait_for_disconnected() { - local auth=pap + local dontfail=$1 + local n=$WAITTIME + + for i in $(seq $n); do + $HIJACKING pppoectl -d pppoe0 | grep -q "state = initial" + [ $? = 0 ] && return + # If PPPoE client is disconnected by PPPoE server and then + # the client kicks callout of pppoe_timeout(), the client + # state is changed to PPPOE_STATE_PADI_SENT while padi retrying. + $HIJACKING pppoectl -d pppoe0 | grep -q "state = PADI sent" + [ $? = 0 ] && return + + sleep 1 + done + + if [ "$dontfail" != "dontfail" ]; then + atf_fail "Couldn't disconnect for $n seconds." + fi +} + +run_test() +{ + local auth=$1 setup + # As pppoe client doesn't support rechallenge yet. + local server_optparam="" + if [ $auth = "chap" ]; then + server_optparam="norechallenge" + fi + export RUMP_SERVER=$SERVER local setup_serverparam="pppoectl pppoe0 hisauthproto=$auth \ 'hisauthname=$AUTHNAME' \ 'hisauthsecret=$SECRET' \ - 'myauthproto=none'" + 'myauthproto=none' \ + $server_optparam" atf_check -s exit:0 -x "$HIJACKING $setup_serverparam" atf_check -s exit:0 rump.ifconfig pppoe0 up unset RUMP_SERVER @@ -130,8 +164,11 @@ pap_body() unset RUMP_SERVER # test for disconnection from server - atf_check -s exit:0 -x "env RUMP_SERVER=$SERVER rump.ifconfig pppoe0 down" + export RUMP_SERVER=$SERVER + atf_check -s exit:0 rump.ifconfig pppoe0 down + wait_for_disconnected export RUMP_SERVER=$CLIENT + wait_for_disconnected atf_check -s not-exit:0 -o ignore -e ignore \ rump.ping -c 1 -w $TIMEOUT $SERVER_IP atf_check -s exit:0 -o match:'PADI sent' -x "$HIJACKING pppoectl -d pppoe0" @@ -145,15 +182,18 @@ pap_body() unset RUMP_SERVER # test for disconnection from client - atf_check -s exit:0 -x "env RUMP_SERVER=$CLIENT rump.ifconfig pppoe0 down" + export RUMP_SERVER=$CLIENT + atf_check -s exit:0 -x rump.ifconfig pppoe0 down + wait_for_disconnected export RUMP_SERVER=$SERVER + wait_for_disconnected $DEBUG && $HIJACKING pppoectl -d pppoe0 atf_check -s not-exit:0 -o ignore -e ignore \ rump.ping -c 1 -w $TIMEOUT $CLIENT_IP atf_check -s exit:0 -o match:'initial' -x "$HIJACKING pppoectl -d pppoe0" unset RUMP_SERVER - # test for recconecting + # test for reconnecting export RUMP_SERVER=$CLIENT atf_check -s exit:0 -x rump.ifconfig pppoe0 up wait_for_session_established @@ -162,6 +202,7 @@ pap_body() unset RUMP_SERVER export RUMP_SERVER=$SERVER + atf_check -s exit:0 rump.ifconfig -w 10 atf_check -s exit:0 -o ignore rump.ping -c 1 -w $TIMEOUT $CLIENT_IP atf_check -s exit:0 -o match:'session' -x "$HIJACKING pppoectl -d pppoe0" $DEBUG && HIJACKING pppoectl -d pppoe0 @@ -170,6 +211,7 @@ pap_body() # test for invalid password export RUMP_SERVER=$CLIENT atf_check -s exit:0 rump.ifconfig pppoe0 down + wait_for_disconnected local setup_clientparam="pppoectl pppoe0 myauthproto=$auth \ 'myauthname=$AUTHNAME' \ 'myauthsecret=invalidsecret' \ @@ -179,15 +221,196 @@ pap_body() wait_for_session_established dontfail atf_check -s not-exit:0 -o ignore -e ignore \ rump.ping -c 1 -w $TIMEOUT $SERVER_IP - atf_check -s exit:0 -o match:'initial' -x "$HIJACKING pppoectl -d pppoe0" + atf_check -s exit:0 -o match:'DETACHED' rump.ifconfig pppoe0 unset RUMP_SERVER } -pap_cleanup() +atf_test_case pppoe_pap cleanup + +pppoe_pap_head() +{ + atf_set "descr" "Does simple pap tests" + atf_set "require.progs" "rump_server pppoectl" +} + +pppoe_pap_body() +{ + run_test pap +} + +pppoe_pap_cleanup() { cleanup } + +atf_test_case pppoe_chap cleanup + +pppoe_chap_head() +{ + atf_set "descr" "Does simple chap tests" + atf_set "require.progs" "rump_server pppoectl" +} + +pppoe_chap_body() +{ + run_test chap +} + +pppoe_chap_cleanup() +{ + cleanup +} + +run_test6() +{ + local auth=$1 + setup "inet=false" + + # As pppoe client doesn't support rechallenge yet. + local server_optparam="" + if [ $auth = "chap" ]; then + server_optparam="norechallenge" + fi + + export RUMP_SERVER=$SERVER + local setup_serverparam="pppoectl pppoe0 hisauthproto=$auth \ + 'hisauthname=$AUTHNAME' \ + 'hisauthsecret=$SECRET' \ + 'myauthproto=none' \ + $server_optparam" + atf_check -s exit:0 -x "$HIJACKING $setup_serverparam" + atf_check -s exit:0 rump.ifconfig pppoe0 inet6 $SERVER_IP6/64 down + atf_check -s exit:0 rump.ifconfig pppoe0 up + unset RUMP_SERVER + + export RUMP_SERVER=$CLIENT + local setup_clientparam="pppoectl pppoe0 myauthproto=$auth \ + 'myauthname=$AUTHNAME' \ + 'myauthsecret=$SECRET' \ + 'hisauthproto=none'" + atf_check -s exit:0 -x "$HIJACKING $setup_clientparam" + atf_check -s exit:0 rump.ifconfig pppoe0 inet6 $CLIENT_IP6/64 down + atf_check -s exit:0 rump.ifconfig pppoe0 up + $DEBUG && rump.ifconfig + wait_for_session_established + atf_check -s exit:0 -o ignore rump.ifconfig -w 10 + export RUMP_SERVER=$SERVER + atf_check -s exit:0 -o ignore rump.ifconfig -w 10 + export RUMP_SERVER=$CLIENT + atf_check -s exit:0 -o ignore rump.ping6 -c 1 -X $TIMEOUT $SERVER_IP6 + unset RUMP_SERVER + + # test for disconnection from server + export RUMP_SERVER=$SERVER + session_id=`$HIJACKING pppoectl -d pppoe0 | grep state` + atf_check -s exit:0 rump.ifconfig pppoe0 down + wait_for_disconnected + export RUMP_SERVER=$CLIENT + wait_for_disconnected + atf_check -s not-exit:0 -o ignore -e ignore \ + rump.ping6 -c 1 -X $TIMEOUT $SERVER_IP6 + atf_check -s exit:0 -o not-match:"$session_id" -x "$HIJACKING pppoectl -d pppoe0" + unset RUMP_SERVER + + # test for recoonecting + export RUMP_SERVER=$SERVER + atf_check -s exit:0 rump.ifconfig pppoe0 up + wait_for_session_established + atf_check -s exit:0 rump.ifconfig -w 10 + $DEBUG && $HIJACKING pppoectl -d pppoe0 + $DEBUG && rump.ifconfig pppoe0 + export RUMP_SERVER=$CLIENT + atf_check -s exit:0 -o ignore rump.ifconfig -w 10 + atf_check -s exit:0 -o ignore rump.ping6 -c 1 -X $TIMEOUT $SERVER_IP6 + unset RUMP_SERVER + + # test for disconnection from client + export RUMP_SERVER=$CLIENT + atf_check -s exit:0 rump.ifconfig pppoe0 down + wait_for_disconnected + + export RUMP_SERVER=$SERVER + wait_for_disconnected + $DEBUG && $HIJACKING pppoectl -d pppoe0 + atf_check -s not-exit:0 -o ignore -e ignore \ + rump.ping6 -c 1 -X $TIMEOUT $CLIENT_IP6 + atf_check -s exit:0 -o match:'initial' -x "$HIJACKING pppoectl -d pppoe0" + unset RUMP_SERVER + + # test for reconnecting + export RUMP_SERVER=$CLIENT + atf_check -s exit:0 rump.ifconfig pppoe0 up + wait_for_session_established + atf_check -s exit:0 rump.ifconfig -w 10 + + $DEBUG && rump.ifconfig pppoe0 + $DEBUG && $HIJACKING pppoectl -d pppoe0 + unset RUMP_SERVER + + export RUMP_SERVER=$SERVER + atf_check -s exit:0 rump.ifconfig -w 10 + atf_check -s exit:0 -o ignore rump.ping6 -c 1 -X $TIMEOUT $CLIENT_IP6 + atf_check -s exit:0 -o match:'session' -x "$HIJACKING pppoectl -d pppoe0" + $DEBUG && HIJACKING pppoectl -d pppoe0 + unset RUMP_SERVER + + # test for invalid password + export RUMP_SERVER=$CLIENT + atf_check -s exit:0 rump.ifconfig pppoe0 down + wait_for_disconnected + local setup_clientparam="pppoectl pppoe0 myauthproto=$auth \ + 'myauthname=$AUTHNAME' \ + 'myauthsecret=invalidsecret' \ + 'hisauthproto=none'" + atf_check -s exit:0 -x "$HIJACKING $setup_clientparam" + atf_check -s exit:0 rump.ifconfig pppoe0 up + wait_for_session_established dontfail + atf_check -s not-exit:0 -o ignore -e ignore \ + rump.ping6 -c 1 -X $TIMEOUT $SERVER_IP6 + atf_check -s exit:0 -o match:'DETACHED' rump.ifconfig pppoe0 + unset RUMP_SERVER +} + +atf_test_case pppoe6_pap cleanup + +pppoe6_pap_head() +{ + atf_set "descr" "Does simple pap using IPv6 tests" + atf_set "require.progs" "rump_server pppoectl" +} + +pppoe6_pap_body() +{ + run_test6 pap +} + +pppoe6_pap_cleanup() +{ + cleanup +} + +atf_test_case pppoe6_chap cleanup + +pppoe6_chap_head() +{ + atf_set "descr" "Does simple chap using IPv6 tests" + atf_set "require.progs" "rump_server pppoectl" +} + +pppoe6_chap_body() +{ + run_test6 chap +} + +pppoe6_chap_cleanup() +{ + cleanup +} + atf_init_test_cases() { - atf_add_test_case pap + atf_add_test_case pppoe_pap + atf_add_test_case pppoe_chap + atf_add_test_case pppoe6_pap + atf_add_test_case pppoe6_chap } diff --git a/contrib/netbsd-tests/net/if_tap/t_tap.sh b/contrib/netbsd-tests/net/if_tap/t_tap.sh index 29efc201b488..4b1ce2566e2f 100755 --- a/contrib/netbsd-tests/net/if_tap/t_tap.sh +++ b/contrib/netbsd-tests/net/if_tap/t_tap.sh @@ -1,4 +1,4 @@ -# $NetBSD: t_tap.sh,v 1.3 2016/08/10 22:42:21 kre Exp $ +# $NetBSD: t_tap.sh,v 1.6 2016/11/25 08:51:16 ozaki-r Exp $ # # Copyright (c) 2016 Internet Initiative Japan Inc. # All rights reserved. @@ -25,10 +25,6 @@ # POSSIBILITY OF SUCH DAMAGE. # -RUMP_FLAGS="-lrumpnet -lrumpnet_net -lrumpnet_netinet -lrumpnet_netinet6" -RUMP_FLAGS="$RUMP_FLAGS -lrumpnet_shmif -lrumpnet_tap -lrumpnet_bridge -lrumpdev" -HIJACKING="env LD_PRELOAD=/usr/lib/librumphijack.so RUMPHIJACK=sysctl=yes" - SOCK_LOCAL=unix://commsock1 SOCK_REMOTE=unix://commsock2 BUS=bus1 @@ -39,7 +35,7 @@ IP6_LOCAL=fc00::1 IP6_TAP=fc00::2 IP6_REMOTE=fc00::3 -DEBUG=false +DEBUG=${DEBUG:-false} TIMEOUT=1 atf_test_case tap_create_destroy cleanup @@ -53,7 +49,7 @@ tap_create_destroy_head() tap_create_destroy_body() { - atf_check -s exit:0 rump_server ${RUMP_FLAGS} ${SOCK_LOCAL} + rump_server_start $SOCK_LOCAL netinet6 tap export RUMP_SERVER=${SOCK_LOCAL} @@ -77,7 +73,8 @@ tap_create_destroy_body() tap_create_destroy_cleanup() { - RUMP_SERVER=${SOCK_LOCAL} rump.halt + $DEBUG && dump + cleanup } atf_test_case tap_stand_alone cleanup @@ -90,13 +87,14 @@ tap_create_destroy_head() tap_stand_alone_body() { - atf_check -s exit:0 rump_server ${RUMP_FLAGS} ${SOCK_LOCAL} - atf_check -s exit:0 rump_server ${RUMP_FLAGS} ${SOCK_REMOTE} + + rump_server_start $SOCK_LOCAL netinet6 tap + rump_server_start $SOCK_REMOTE netinet6 tap + + rump_server_add_iface $SOCK_LOCAL shmif0 $BUS + rump_server_add_iface $SOCK_REMOTE shmif0 $BUS export RUMP_SERVER=${SOCK_LOCAL} - - atf_check -s exit:0 rump.ifconfig shmif0 create - atf_check -s exit:0 rump.ifconfig shmif0 linkstr $BUS atf_check -s exit:0 rump.ifconfig shmif0 $IP4_LOCAL atf_check -s exit:0 rump.ifconfig shmif0 inet6 $IP6_LOCAL atf_check -s exit:0 rump.ifconfig shmif0 up @@ -108,8 +106,6 @@ tap_stand_alone_body() export RUMP_SERVER=${SOCK_REMOTE} - atf_check -s exit:0 rump.ifconfig shmif0 create - atf_check -s exit:0 rump.ifconfig shmif0 linkstr $BUS atf_check -s exit:0 rump.ifconfig shmif0 $IP4_REMOTE atf_check -s exit:0 rump.ifconfig shmif0 inet6 $IP6_REMOTE atf_check -s exit:0 rump.ifconfig shmif0 up @@ -124,13 +120,15 @@ tap_stand_alone_body() # Cannot reach to an alone tap atf_check -s not-exit:0 -o ignore -e ignore \ rump.ping6 -n -X $TIMEOUT -c 1 $IP6_TAP + + rump_server_destroy_ifaces } tap_stand_alone_cleanup() { - RUMP_SERVER=${SOCK_LOCAL} rump.halt - RUMP_SERVER=${SOCK_REMOTE} rump.halt + $DEBUG && dump + cleanup } atf_test_case tap_bridged cleanup @@ -143,13 +141,15 @@ tap_bridged_head() tap_bridged_body() { - atf_check -s exit:0 rump_server ${RUMP_FLAGS} ${SOCK_LOCAL} - atf_check -s exit:0 rump_server ${RUMP_FLAGS} ${SOCK_REMOTE} + + rump_server_start $SOCK_LOCAL netinet6 tap bridge + rump_server_start $SOCK_REMOTE netinet6 tap + + rump_server_add_iface $SOCK_LOCAL shmif0 $BUS + rump_server_add_iface $SOCK_REMOTE shmif0 $BUS export RUMP_SERVER=${SOCK_LOCAL} - atf_check -s exit:0 rump.ifconfig shmif0 create - atf_check -s exit:0 rump.ifconfig shmif0 linkstr $BUS atf_check -s exit:0 rump.ifconfig shmif0 $IP4_LOCAL atf_check -s exit:0 rump.ifconfig shmif0 inet6 $IP6_LOCAL atf_check -s exit:0 rump.ifconfig shmif0 up @@ -168,8 +168,6 @@ tap_bridged_body() export RUMP_SERVER=${SOCK_REMOTE} - atf_check -s exit:0 rump.ifconfig shmif0 create - atf_check -s exit:0 rump.ifconfig shmif0 linkstr $BUS atf_check -s exit:0 rump.ifconfig shmif0 $IP4_REMOTE atf_check -s exit:0 rump.ifconfig shmif0 inet6 $IP6_REMOTE atf_check -s exit:0 rump.ifconfig shmif0 up @@ -180,13 +178,15 @@ tap_bridged_body() atf_check -s exit:0 -o ignore rump.ping6 -n -X $TIMEOUT -c 1 $IP6_LOCAL atf_check -s exit:0 -o ignore rump.ping6 -n -X $TIMEOUT -c 1 $IP6_TAP + + rump_server_destroy_ifaces } tap_bridged_cleanup() { - RUMP_SERVER=${SOCK_LOCAL} rump.halt - RUMP_SERVER=${SOCK_REMOTE} rump.halt + $DEBUG && dump + cleanup } atf_init_test_cases() diff --git a/contrib/netbsd-tests/net/mcast/t_mcast.sh b/contrib/netbsd-tests/net/mcast/t_mcast.sh index 67e13d4a9cdc..aeb70001716f 100755 --- a/contrib/netbsd-tests/net/mcast/t_mcast.sh +++ b/contrib/netbsd-tests/net/mcast/t_mcast.sh @@ -1,4 +1,4 @@ -# $NetBSD: t_mcast.sh,v 1.2 2016/08/10 22:45:39 kre Exp $ +# $NetBSD: t_mcast.sh,v 1.4 2016/11/25 08:51:16 ozaki-r Exp $ # # Copyright (c) 2015 The NetBSD Foundation, Inc. # All rights reserved. @@ -25,12 +25,9 @@ # POSSIBILITY OF SUCH DAMAGE. # -netserver="rump_server -lrumpnet -lrumpnet_net" -netserver="$netserver -lrumpnet_netinet -lrumpnet_netinet6 -lrumpnet_shmif" -netserver="$netserver -lrumpdev" export RUMP_SERVER=unix://commsock -DEBUG=false +DEBUG=${DEBUG:-false} run_test() { @@ -38,9 +35,8 @@ run_test() local opts="$2" local mcast="$(atf_get_srcdir)/mcast" - atf_check -s exit:0 ${netserver} ${RUMP_SERVER} - atf_check -s exit:0 rump.ifconfig shmif0 create - atf_check -s exit:0 rump.ifconfig shmif0 linkstr bus1 + rump_server_start $RUMP_SERVER netinet6 + rump_server_add_iface $RUMP_SERVER shmif0 bus1 atf_check -s exit:0 rump.ifconfig shmif0 10.0.0.2/24 atf_check -s exit:0 rump.ifconfig shmif0 inet6 fc00::2/64 atf_check -s exit:0 rump.ifconfig shmif0 up @@ -79,11 +75,11 @@ add_test() }; \ mcast_${name}_body() { \ run_test \"${name}\" \"${opts}\"; \ + rump_server_destroy_ifaces; \ }; \ mcast_${name}_cleanup() { \ - ${DEBUG} && /usr/bin/shmif_dumpbus -p - bus1 2>/dev/null | \ - /usr/sbin/tcpdump -n -e -r -; \ - env RUMP_SERVER=unix://commsock rump.halt; \ + ${DEBUG} && dump; \ + cleanup; \ }" atf_add_test_case "mcast_${name}" } diff --git a/contrib/netbsd-tests/net/ndp/t_dad.sh b/contrib/netbsd-tests/net/ndp/t_dad.sh index 98b8ae0b8c8b..50ec933560de 100755 --- a/contrib/netbsd-tests/net/ndp/t_dad.sh +++ b/contrib/netbsd-tests/net/ndp/t_dad.sh @@ -1,4 +1,4 @@ -# $NetBSD: t_dad.sh,v 1.5 2016/08/10 23:07:57 kre Exp $ +# $NetBSD: t_dad.sh,v 1.12 2016/11/25 08:51:17 ozaki-r Exp $ # # Copyright (c) 2015 The NetBSD Foundation, Inc. # All rights reserved. @@ -25,18 +25,16 @@ # POSSIBILITY OF SUCH DAMAGE. # -inetserver="rump_server -lrumpnet -lrumpnet_net -lrumpnet_netinet" -inetserver="$inetserver -lrumpnet_netinet6 -lrumpnet_shmif" -inetserver="$inetserver -lrumpdev" -HIJACKING="env LD_PRELOAD=/usr/lib/librumphijack.so RUMPHIJACK=sysctl=yes" - SOCKLOCAL=unix://commsock1 SOCKPEER=unix://commsock2 -DEBUG=false +DEBUG=${DEBUG:-false} + +duplicated="[Dd][Uu][Pp][Ll][Ii][Cc][Aa][Tt][Ee][Dd]" atf_test_case dad_basic cleanup atf_test_case dad_duplicated cleanup +atf_test_case dad_count cleanup dad_basic_head() { @@ -50,15 +48,20 @@ dad_duplicated_head() atf_set "require.progs" "rump_server" } +dad_count_head() +{ + atf_set "descr" "Tests for IPv6 DAD count behavior" + atf_set "require.progs" "rump_server" +} + setup_server() { local sock=$1 local ip=$2 - export RUMP_SERVER=$sock + rump_server_add_iface $sock shmif0 bus1 - atf_check -s exit:0 rump.ifconfig shmif0 create - atf_check -s exit:0 rump.ifconfig shmif0 linkstr bus1 + export RUMP_SERVER=$sock atf_check -s exit:0 rump.ifconfig shmif0 inet6 $ip atf_check -s exit:0 rump.ifconfig shmif0 up atf_check -s exit:0 rump.ifconfig -w 10 @@ -76,21 +79,6 @@ make_ns_pkt_str() echo $pkt } -extract_new_packets() -{ - local old=./old - - if [ ! -f $old ]; then - old=/dev/null - fi - - shmif_dumpbus -p - bus1 2>/dev/null| \ - tcpdump -n -e -r - 2>/dev/null > ./new - diff -u $old ./new |grep '^+' |cut -d '+' -f 2 > ./diff - mv -f ./new ./old - cat ./diff -} - dad_basic_body() { local pkt= @@ -98,11 +86,10 @@ dad_basic_body() local localip2=fc00::2 local localip3=fc00::3 - atf_check -s exit:0 ${inetserver} $SOCKLOCAL - export RUMP_SERVER=$SOCKLOCAL + rump_server_start $SOCKLOCAL netinet6 + rump_server_add_iface $SOCKLOCAL shmif0 bus1 - atf_check -s exit:0 rump.ifconfig shmif0 create - atf_check -s exit:0 rump.ifconfig shmif0 linkstr bus1 + export RUMP_SERVER=$SOCKLOCAL atf_check -s exit:0 rump.ifconfig shmif0 inet6 $localip1 atf_check -s exit:0 rump.ifconfig shmif0 inet6 $localip2 $DEBUG && rump.ifconfig shmif0 @@ -118,7 +105,7 @@ dad_basic_body() #atf_check -s exit:0 -x "cat ./out |grep $localip2 |grep -q tentative" atf_check -s exit:0 sleep 2 - extract_new_packets > ./out + extract_new_packets bus1 > ./out $DEBUG && cat ./out # Check DAD probe packets (Neighbor Solicitation Message) @@ -130,7 +117,7 @@ dad_basic_body() # Waiting for DAD complete atf_check -s exit:0 rump.ifconfig -w 10 - extract_new_packets > ./out + extract_new_packets bus1 > ./out $DEBUG && cat ./out # IPv6 DAD doesn't announce (Neighbor Advertisement Message) @@ -149,20 +136,22 @@ dad_basic_body() # Check DAD probe packets (Neighbor Solicitation Message) atf_check -s exit:0 sleep 2 - extract_new_packets > ./out + extract_new_packets bus1 > ./out $DEBUG && cat ./out pkt=$(make_ns_pkt_str 3 $localip3) atf_check -s exit:0 -x "cat ./out |grep -q '$pkt'" # Waiting for DAD complete atf_check -s exit:0 rump.ifconfig -w 10 - extract_new_packets > ./out + extract_new_packets bus1 > ./out $DEBUG && cat ./out # IPv6 DAD doesn't announce (Neighbor Advertisement Message) # The new address left tentative atf_check -s not-exit:0 -x "rump.ifconfig shmif0 |grep $localip3 |grep -q tentative" + + rump_server_destroy_ifaces } dad_duplicated_body() @@ -171,8 +160,8 @@ dad_duplicated_body() local localip2=fc00::11 local peerip=fc00::2 - atf_check -s exit:0 ${inetserver} $SOCKLOCAL - atf_check -s exit:0 ${inetserver} $SOCKPEER + rump_server_start $SOCKLOCAL netinet6 + rump_server_start $SOCKPEER netinet6 setup_server $SOCKLOCAL $localip1 setup_server $SOCKPEER $peerip @@ -180,7 +169,8 @@ dad_duplicated_body() export RUMP_SERVER=$SOCKLOCAL # The primary address isn't marked as duplicated - atf_check -s not-exit:0 -x "rump.ifconfig shmif0 |grep $localip1 |grep -q duplicated" + atf_check -s exit:0 -o not-match:"$localip1.+$duplicated" \ + rump.ifconfig shmif0 # # Add a new address duplicated with the peer server @@ -189,52 +179,81 @@ dad_duplicated_body() atf_check -s exit:0 sleep 1 # The new address is marked as duplicated - atf_check -s exit:0 -x "rump.ifconfig shmif0 |grep $peerip |grep -q duplicated" + atf_check -s exit:0 -o match:"$peerip.+$duplicated" \ + rump.ifconfig shmif0 # A unique address isn't marked as duplicated atf_check -s exit:0 rump.ifconfig shmif0 inet6 $localip2 atf_check -s exit:0 sleep 1 - atf_check -s not-exit:0 -x "rump.ifconfig shmif0 |grep $localip2 |grep -q duplicated" + atf_check -s exit:0 -o not-match:"$localip2.+$duplicated" \ + rump.ifconfig shmif0 + + rump_server_destroy_ifaces } -cleanup() +dad_count_test() { - gdb -ex bt /usr/bin/rump_server rump_server.core - gdb -ex bt /usr/sbin/arp arp.core - env RUMP_SERVER=$SOCKLOCAL rump.halt - env RUMP_SERVER=$SOCKPEER rump.halt + local pkt= + local count=$1 + local id=$2 + local target=$3 + + # + # Set DAD count to $count + # + atf_check -s exit:0 rump.sysctl -w -q net.inet6.ip6.dad_count=$count + + # Add a new address + atf_check -s exit:0 rump.ifconfig shmif0 inet6 $target + + # Waiting for DAD complete + atf_check -s exit:0 rump.ifconfig -w 20 + + # Check the number of DAD probe packets (Neighbor Solicitation Message) + atf_check -s exit:0 sleep 2 + extract_new_packets bus1 > ./out + $DEBUG && cat ./out + pkt=$(make_ns_pkt_str $id $target) + atf_check -s exit:0 -o match:"$count" \ + -x "cat ./out |grep '$pkt' | wc -l | tr -d ' '" } -dump_local() +dad_count_body() { + local localip1=fc00::1 + local localip2=fc00::2 + + rump_server_start $SOCKLOCAL netinet6 + rump_server_add_iface $SOCKLOCAL shmif0 bus1 + export RUMP_SERVER=$SOCKLOCAL - rump.netstat -nr - rump.arp -n -a - rump.ifconfig - $HIJACKING dmesg -} -dump_peer() -{ - export RUMP_SERVER=$SOCKPEER - rump.netstat -nr - rump.arp -n -a - rump.ifconfig - $HIJACKING dmesg -} + # Check default value + atf_check -s exit:0 -o match:"1" rump.sysctl -n net.inet6.ip6.dad_count -dump() -{ - dump_local - dump_peer - shmif_dumpbus -p - bus1 2>/dev/null| tcpdump -n -e -r - + # Setup interface + atf_check -s exit:0 rump.ifconfig shmif0 up + atf_check -s exit:0 sleep 2 + rump.ifconfig shmif0 > ./out + $DEBUG && cat ./out + + # + # Set and test DAD count (count=1) + # + dad_count_test 1 1 $localip1 + + # + # Set and test DAD count (count=8) + # + dad_count_test 8 2 $localip2 + + rump_server_destroy_ifaces } dad_basic_cleanup() { - $DEBUG && dump_local - $DEBUG && shmif_dumpbus -p - bus1 2>/dev/null| tcpdump -n -e -r - - env RUMP_SERVER=$SOCKLOCAL rump.halt + $DEBUG && dump + cleanup } dad_duplicated_cleanup() @@ -243,8 +262,15 @@ dad_duplicated_cleanup() cleanup } +dad_count_cleanup() +{ + $DEBUG && dump + cleanup +} + atf_init_test_cases() { atf_add_test_case dad_basic atf_add_test_case dad_duplicated + atf_add_test_case dad_count } diff --git a/contrib/netbsd-tests/net/ndp/t_ndp.sh b/contrib/netbsd-tests/net/ndp/t_ndp.sh index 449198122f69..aa96390cf96e 100755 --- a/contrib/netbsd-tests/net/ndp/t_ndp.sh +++ b/contrib/netbsd-tests/net/ndp/t_ndp.sh @@ -1,4 +1,4 @@ -# $NetBSD: t_ndp.sh,v 1.13 2016/08/10 23:07:57 kre Exp $ +# $NetBSD: t_ndp.sh,v 1.17 2016/11/25 08:51:17 ozaki-r Exp $ # # Copyright (c) 2015 The NetBSD Foundation, Inc. # All rights reserved. @@ -25,17 +25,12 @@ # POSSIBILITY OF SUCH DAMAGE. # -inetserver="rump_server -lrumpnet -lrumpnet_net -lrumpnet_netinet" -inetserver="$inetserver -lrumpnet_netinet6 -lrumpnet_shmif" -inetserver="$inetserver -lrumpdev" -HIJACKING="env LD_PRELOAD=/usr/lib/librumphijack.so RUMPHIJACK=sysctl=yes" - SOCKSRC=unix://commsock1 SOCKDST=unix://commsock2 IP6SRC=fc00::1 IP6DST=fc00::2 -DEBUG=true +DEBUG=${DEBUG:-true} TIMEOUT=1 atf_test_case ndp_cache_expiration cleanup @@ -78,9 +73,8 @@ setup_dst_server() { local assign_ip=$1 + rump_server_add_iface $SOCKDST shmif0 bus1 export RUMP_SERVER=$SOCKDST - atf_check -s exit:0 rump.ifconfig shmif0 create - atf_check -s exit:0 rump.ifconfig shmif0 linkstr bus1 if [ "$assign_ip" != no ]; then atf_check -s exit:0 rump.ifconfig shmif0 inet6 $IP6DST fi @@ -97,8 +91,7 @@ setup_src_server() export RUMP_SERVER=$SOCKSRC # Setup an interface - atf_check -s exit:0 rump.ifconfig shmif0 create - atf_check -s exit:0 rump.ifconfig shmif0 linkstr bus1 + rump_server_add_iface $SOCKSRC shmif0 bus1 atf_check -s exit:0 rump.ifconfig shmif0 inet6 $IP6SRC atf_check -s exit:0 rump.ifconfig shmif0 up atf_check -s exit:0 rump.ifconfig -w 10 @@ -119,8 +112,9 @@ get_timeout() ndp_cache_expiration_body() { - atf_check -s exit:0 ${inetserver} $SOCKSRC - atf_check -s exit:0 ${inetserver} $SOCKDST + + rump_server_start $SOCKSRC netinet6 + rump_server_start $SOCKDST netinet6 setup_dst_server setup_src_server @@ -144,6 +138,8 @@ ndp_cache_expiration_body() atf_check -s exit:0 -o match:'permanent' rump.ndp -n $IP6SRC # Expired but remains until GC sweaps it (1 day) atf_check -s exit:0 -o match:'(1d0h0m|23h59m)' rump.ndp -n $IP6DST + + rump_server_destroy_ifaces } ifdown_dst_server() @@ -155,8 +151,9 @@ ifdown_dst_server() ndp_commands_body() { - atf_check -s exit:0 ${inetserver} $SOCKSRC - atf_check -s exit:0 ${inetserver} $SOCKDST + + rump_server_start $SOCKSRC netinet6 + rump_server_start $SOCKDST netinet6 setup_dst_server setup_src_server @@ -217,13 +214,14 @@ ndp_commands_body() $DEBUG && rump.ndp -n -a atf_check -s exit:0 -o not-match:'permanent' rump.ndp -n fc00::10 - return 0 + rump_server_destroy_ifaces } ndp_cache_overwriting_body() { - atf_check -s exit:0 ${inetserver} $SOCKSRC - atf_check -s exit:0 ${inetserver} $SOCKDST + + rump_server_start $SOCKSRC netinet6 + rump_server_start $SOCKDST netinet6 setup_dst_server setup_src_server @@ -249,7 +247,7 @@ ndp_cache_overwriting_body() #atf_check -s not-exit:0 -e ignore rump.ndp -s fc00::10 b2:a0:20:00:00:ff #$DEBUG && rump.ndp -n -a - return 0 + rump_server_destroy_ifaces } get_n_caches() @@ -261,8 +259,8 @@ get_n_caches() ndp_neighborgcthresh_body() { - atf_check -s exit:0 ${inetserver} $SOCKSRC - atf_check -s exit:0 ${inetserver} $SOCKDST + rump_server_start $SOCKSRC netinet6 + rump_server_start $SOCKDST netinet6 setup_dst_server no setup_src_server @@ -311,7 +309,7 @@ ndp_neighborgcthresh_body() atf_fail "Neighbor caches are not GC-ed" fi - return 0 + rump_server_destroy_ifaces } make_pkt_str_na() @@ -324,33 +322,18 @@ make_pkt_str_na() echo $pkt } -extract_new_packets() -{ - local old=./old - - if [ ! -f $old ]; then - old=/dev/null - fi - - shmif_dumpbus -p - bus1 2>/dev/null| \ - tcpdump -n -e -r - 2>/dev/null > ./new - diff -u $old ./new |grep '^+' |cut -d '+' -f 2 > ./diff - mv -f ./new ./old - cat ./diff -} - ndp_link_activation_body() { local linklocal= - atf_check -s exit:0 ${inetserver} $SOCKSRC - atf_check -s exit:0 ${inetserver} $SOCKDST + rump_server_start $SOCKSRC netinet6 + rump_server_start $SOCKDST netinet6 setup_dst_server setup_src_server # flush old packets - extract_new_packets > ./out + extract_new_packets bus1 > ./out export RUMP_SERVER=$SOCKSRC @@ -358,7 +341,7 @@ ndp_link_activation_body() b2:a1:00:00:00:01 atf_check -s exit:0 sleep 1 - extract_new_packets > ./out + extract_new_packets bus1 > ./out $DEBUG && cat ./out linklocal=$(rump.ifconfig shmif0 |awk '/fe80/ {print $2;}' |awk -F % '{print $1;}') @@ -371,7 +354,7 @@ ndp_link_activation_body() b2:a1:00:00:00:02 active atf_check -s exit:0 sleep 1 - extract_new_packets > ./out + extract_new_packets bus1 > ./out $DEBUG && cat ./out linklocal=$(rump.ifconfig shmif0 |awk '/fe80/ {print $2;}' |awk -F % '{print $1;}') @@ -379,39 +362,8 @@ ndp_link_activation_body() pkt=$(make_pkt_str_na $linklocal b2:a1:00:00:00:02) atf_check -s exit:0 -x "cat ./out |grep -q '$pkt'" -} -cleanup() -{ - env RUMP_SERVER=$SOCKSRC rump.halt - env RUMP_SERVER=$SOCKDST rump.halt -} - -dump_src() -{ - export RUMP_SERVER=$SOCKSRC - rump.netstat -nr - rump.ndp -n -a - rump.ifconfig - $HIJACKING dmesg -} - -dump_dst() -{ - export RUMP_SERVER=$SOCKDST - rump.netstat -nr - rump.ndp -n -a - rump.ifconfig - $HIJACKING dmesg -} - -dump() -{ - dump_src - dump_dst - shmif_dumpbus -p - bus1 2>/dev/null| tcpdump -n -e -r - - $DEBUG && gdb -ex bt /usr/bin/rump_server rump_server.core - $DEBUG && gdb -ex bt /usr/sbin/rump.ndp rump.ndp.core + rump_server_destroy_ifaces } ndp_cache_expiration_cleanup() diff --git a/contrib/netbsd-tests/net/ndp/t_ra.sh b/contrib/netbsd-tests/net/ndp/t_ra.sh index cf81683fc0f4..b2345704f462 100755 --- a/contrib/netbsd-tests/net/ndp/t_ra.sh +++ b/contrib/netbsd-tests/net/ndp/t_ra.sh @@ -1,4 +1,4 @@ -# $NetBSD: t_ra.sh,v 1.3 2016/08/10 23:07:57 kre Exp $ +# $NetBSD: t_ra.sh,v 1.20 2017/01/11 03:15:44 ozaki-r Exp $ # # Copyright (c) 2015 Internet Initiative Japan Inc. # All rights reserved. @@ -25,27 +25,49 @@ # POSSIBILITY OF SUCH DAMAGE. # -RUMPFLAGS="-lrumpnet -lrumpnet_net -lrumpnet_netinet -lrumpnet_netinet6" -RUMPFLAGS="${RUMPFLAGS} -lrumpnet_shmif -lrumpdev" -RUMPFLAGS="${RUMPFLAGS} -lrumpvfs -lrumpfs_ffs" - RUMPSRV=unix://r1 +RUMPSRV1_2=unix://r12 RUMPCLI=unix://r2 +RUMPSRV3=unix://r3 +RUMPSRV4=unix://r4 IP6SRV=fc00:1::1 +IP6SRV1_2=fc00:1::2 +IP6SRV_PREFIX=fc00:1: IP6CLI=fc00:2::2 -PIDFILE=/var/run/rump.rtadvd.pid +IP6SRV3=fc00:3::1 +IP6SRV3_PREFIX=fc00:3: +IP6SRV4=fc00:4::1 +IP6SRV4_PREFIX=fc00:4: +PIDFILE=./rump.rtadvd.pid +PIDFILE1_2=./rump.rtadvd.pid12 +PIDFILE3=./rump.rtadvd.pid3 +PIDFILE4=./rump.rtadvd.pid4 CONFIG=./rtadvd.conf -DEBUG=true +WAITTIME=2 +DEBUG=${DEBUG:-true} + +init_server() +{ + + export RUMP_SERVER=$1 + atf_check -s exit:0 -o match:'0.->.1' rump.sysctl -w net.inet6.ip6.forwarding=1 + export LD_PRELOAD=/usr/lib/librumphijack.so + atf_check -s exit:0 mkdir -p /rump/var/chroot/rtadvd + unset LD_PRELOAD + unset RUMP_SERVER +} setup_shmif0() { - local IP6ADDR=${1} - shift + local sock=$1 + local IP6ADDR=$2 - atf_check -s exit:0 rump.ifconfig shmif0 create - atf_check -s exit:0 rump.ifconfig shmif0 linkstr bus1 + rump_server_add_iface $sock shmif0 bus1 + + export RUMP_SERVER=$sock atf_check -s exit:0 rump.ifconfig shmif0 inet6 ${IP6ADDR} atf_check -s exit:0 rump.ifconfig shmif0 up + atf_check -s exit:0 rump.ifconfig -w 10 $DEBUG && rump.ifconfig } @@ -72,41 +94,81 @@ shmif0:\ _EOF } -atf_test_case basic cleanup -basic_head() +start_rtadvd() +{ + local sock=$1 + local pidfile=$2 + + export RUMP_SERVER=$sock + atf_check -s exit:0 rump.rtadvd -c ${CONFIG} -p $pidfile shmif0 + while [ ! -f $pidfile ]; do + sleep 0.2 + done + unset RUMP_SERVER +} + +check_entries() +{ + local cli=$1 + local srv=$2 + local addr_prefix=$3 + local mac_srv= ll_srv= + + ll_srv=$(get_linklocal_addr $srv shmif0) + mac_srv=$(get_macaddr $srv shmif0) + + export RUMP_SERVER=$cli + $DEBUG && dump_entries + atf_check -s exit:0 -o match:'if=shmif0' rump.ndp -r + atf_check -s exit:0 -o match:'advertised' rump.ndp -p + atf_check -s exit:0 -o match:"${ll_srv}%shmif0 \(reachable\)" rump.ndp -p + atf_check -s exit:0 -o match:'linkmtu=1300' rump.ndp -n -i shmif0 + atf_check -s exit:0 \ + -o match:"$ll_srv%shmif0 +$mac_srv +shmif0 +(23h59m|1d0h0m)..s S R" \ + rump.ndp -n -a + atf_check -s exit:0 -o match:$addr_prefix rump.ndp -n -a + atf_check -s exit:0 -o match:"$addr_prefix.+" \ + rump.ifconfig shmif0 inet6 + unset RUMP_SERVER +} + +dump_entries() +{ + + echo ndp -n -a + rump.ndp -n -a + echo ndp -p + rump.ndp -p + echo ndp -r + rump.ndp -r +} + +atf_test_case ra_basic cleanup +ra_basic_head() { atf_set "descr" "Tests for basic functions of router advaertisement(RA)" atf_set "require.progs" "rump_server rump.rtadvd rump.ndp rump.ifconfig" } -basic_body() +ra_basic_body() { - atf_check -s exit:0 rump_server ${RUMPFLAGS} ${RUMPSRV} - atf_check -s exit:0 rump_server ${RUMPFLAGS} ${RUMPCLI} + rump_server_fs_start $RUMPSRV netinet6 + rump_server_start $RUMPCLI netinet6 - export RUMP_SERVER=${RUMPSRV} - setup_shmif0 ${IP6SRV} - atf_check -s exit:0 -o match:'0.->.1' rump.sysctl -w net.inet6.ip6.forwarding=1 - export LD_PRELOAD=/usr/lib/librumphijack.so - atf_check -s exit:0 mkdir -p /rump/var/chroot/rtadvd - unset LD_PRELOAD - unset RUMP_SERVER + setup_shmif0 ${RUMPSRV} ${IP6SRV} + init_server $RUMPSRV + setup_shmif0 ${RUMPCLI} ${IP6CLI} export RUMP_SERVER=${RUMPCLI} - setup_shmif0 ${IP6CLI} $DEBUG && rump.ndp -n -a atf_check -s exit:0 -o match:'= 0' rump.sysctl net.inet6.ip6.accept_rtadv unset RUMP_SERVER create_rtadvdconfig - - export RUMP_SERVER=${RUMPSRV} - atf_check -s exit:0 rump.rtadvd -c ${CONFIG} shmif0 - atf_check -s exit:0 sleep 3 - atf_check -s exit:0 -o ignore -e empty cat ${PIDFILE} - unset RUMP_SERVER + start_rtadvd $RUMPSRV $PIDFILE + sleep $WAITTIME export RUMP_SERVER=${RUMPCLI} atf_check -s exit:0 -o empty rump.ndp -r @@ -124,30 +186,18 @@ basic_body() atf_check -s exit:0 -o match:'0.->.1' rump.sysctl -w net.inet6.ip6.accept_rtadv=1 unset RUMP_SERVER - export RUMP_SERVER=${RUMPSRV} - atf_check -s exit:0 rump.rtadvd -c ${CONFIG} shmif0 - atf_check -s exit:0 sleep 3 - atf_check -s exit:0 -o ignore -e empty cat ${PIDFILE} - unset RUMP_SERVER + start_rtadvd $RUMPSRV $PIDFILE + sleep $WAITTIME - export RUMP_SERVER=${RUMPCLI} - $DEBUG && rump.ndp -n -a - $DEBUG && rump.ndp -r - atf_check -s exit:0 -o match:'if=shmif0' rump.ndp -r - atf_check -s exit:0 -o match:'advertised' rump.ndp -p - atf_check -s exit:0 -o match:'linkmtu=1300' rump.ndp -n -i shmif0 - atf_check -s exit:0 -o match:'23h59m..s S R' rump.ndp -n -a - atf_check -s exit:0 -o match:'fc00:1:' rump.ndp -n -a - atf_check -s exit:0 -o match:'fc00:1:' rump.ifconfig shmif0 inet6 - unset RUMP_SERVER + check_entries $RUMPCLI $RUMPSRV $IP6SRV_PREFIX atf_check -s exit:0 kill -TERM `cat ${PIDFILE}` wait_term ${PIDFILE} - return 0 + rump_server_destroy_ifaces } -basic_cleanup() +ra_basic_cleanup() { if [ -f ${PIDFILE} ]; then @@ -155,12 +205,483 @@ basic_cleanup() wait_term ${PIDFILE} fi - env RUMP_SERVER=${RUMPSRV} rump.halt - env RUMP_SERVER=${RUMPCLI} rump.halt + $DEBUG && dump + cleanup +} + +atf_test_case ra_flush_prefix_entries cleanup +ra_flush_prefix_entries_head() +{ + + atf_set "descr" "Tests for flushing prefixes (ndp -P)" + atf_set "require.progs" "rump_server rump.rtadvd rump.ndp rump.ifconfig" +} + +ra_flush_prefix_entries_body() +{ + + rump_server_fs_start $RUMPSRV netinet6 + rump_server_start $RUMPCLI netinet6 + + setup_shmif0 ${RUMPSRV} ${IP6SRV} + setup_shmif0 ${RUMPCLI} ${IP6CLI} + + init_server $RUMPSRV + + create_rtadvdconfig + + export RUMP_SERVER=${RUMPCLI} + atf_check -s exit:0 -o match:'0.->.1' rump.sysctl -w net.inet6.ip6.accept_rtadv=1 + unset RUMP_SERVER + + start_rtadvd $RUMPSRV $PIDFILE + sleep $WAITTIME + + check_entries $RUMPCLI $RUMPSRV $IP6SRV_PREFIX + + export RUMP_SERVER=${RUMPCLI} + + # Terminate rtadvd to prevent new RA messages from coming + # Note that ifconfig down; kill -TERM doesn't work + kill -KILL `cat ${PIDFILE}` + + # Flush all the entries in the prefix list + atf_check -s exit:0 rump.ndp -P + + $DEBUG && dump_entries + atf_check -s exit:0 -o match:'if=shmif0' rump.ndp -r + atf_check -s exit:0 -o empty rump.ndp -p + atf_check -s exit:0 -o match:'linkmtu=1300' rump.ndp -n -i shmif0 + atf_check -s exit:0 -o match:'(23h59m|1d0h0m)..s S R' rump.ndp -n -a + atf_check -s exit:0 -o match:'fc00:1:' rump.ndp -n -a + atf_check -s exit:0 -o not-match:'fc00:1:' rump.ifconfig shmif0 inet6 + unset RUMP_SERVER + + rump_server_destroy_ifaces +} + +ra_flush_prefix_entries_cleanup() +{ + + $DEBUG && dump + cleanup +} + +atf_test_case ra_flush_defrouter_entries cleanup +ra_flush_defrouter_entries_head() +{ + + atf_set "descr" "Tests for flushing default routers (ndp -R)" + atf_set "require.progs" "rump_server rump.rtadvd rump.ndp rump.ifconfig" +} + +ra_flush_defrouter_entries_body() +{ + + rump_server_fs_start $RUMPSRV netinet6 + rump_server_start $RUMPCLI netinet6 + + setup_shmif0 ${RUMPSRV} ${IP6SRV} + setup_shmif0 ${RUMPCLI} ${IP6CLI} + + init_server $RUMPSRV + + create_rtadvdconfig + + export RUMP_SERVER=${RUMPCLI} + atf_check -s exit:0 -o match:'0.->.1' rump.sysctl -w net.inet6.ip6.accept_rtadv=1 + unset RUMP_SERVER + + start_rtadvd $RUMPSRV $PIDFILE + sleep $WAITTIME + + check_entries $RUMPCLI $RUMPSRV $IP6SRV_PREFIX + + export RUMP_SERVER=${RUMPCLI} + + # Terminate rtadvd to prevent new RA messages from coming + # Note that ifconfig down; kill -TERM doesn't work + kill -KILL `cat ${PIDFILE}` + + # Flush all the entries in the default router list + atf_check -s exit:0 rump.ndp -R + + $DEBUG && dump_entries + atf_check -s exit:0 -o empty rump.ndp -r + atf_check -s exit:0 -o match:'No advertising router' rump.ndp -p + atf_check -s exit:0 -o match:'linkmtu=1300' rump.ndp -n -i shmif0 + atf_check -s exit:0 -o match:'(23h59m|1d0h0m)..s S R' rump.ndp -n -a + atf_check -s exit:0 -o match:'fc00:1:' rump.ndp -n -a + atf_check -s exit:0 -o match:'fc00:1:' rump.ifconfig shmif0 inet6 + unset RUMP_SERVER + + rump_server_destroy_ifaces +} + +ra_flush_defrouter_entries_cleanup() +{ + + $DEBUG && dump + cleanup +} + +atf_test_case ra_delete_address cleanup +ra_delete_address_head() +{ + + atf_set "descr" "Tests for deleting auto-configured address" + atf_set "require.progs" "rump_server rump.rtadvd rump.ndp rump.ifconfig" +} + +ra_delete_address_body() +{ + + rump_server_fs_start $RUMPSRV netinet6 + rump_server_start $RUMPCLI netinet6 + + setup_shmif0 ${RUMPSRV} ${IP6SRV} + setup_shmif0 ${RUMPCLI} ${IP6CLI} + + init_server $RUMPSRV + + create_rtadvdconfig + + export RUMP_SERVER=${RUMPCLI} + atf_check -s exit:0 -o match:'0.->.1' rump.sysctl -w net.inet6.ip6.accept_rtadv=1 + unset RUMP_SERVER + + start_rtadvd $RUMPSRV $PIDFILE + sleep $WAITTIME + + check_entries $RUMPCLI $RUMPSRV $IP6SRV_PREFIX + + export RUMP_SERVER=${RUMPCLI} + $DEBUG && rump.ifconfig shmif0 + atf_check -s exit:0 rump.ifconfig shmif0 inet6 \ + $(rump.ifconfig shmif0 |awk '/AUTOCONF/ {print $2}') delete + unset RUMP_SERVER + + atf_check -s exit:0 kill -TERM `cat ${PIDFILE}` + wait_term ${PIDFILE} + + rump_server_destroy_ifaces +} + +ra_delete_address_cleanup() +{ + + if [ -f ${PIDFILE} ]; then + kill -TERM `cat ${PIDFILE}` + wait_term ${PIDFILE} + fi + + $DEBUG && dump + cleanup +} + +atf_test_case ra_multiple_routers cleanup +ra_multiple_routers_head() +{ + + atf_set "descr" "Tests for multiple routers" + atf_set "require.progs" "rump_server rump.rtadvd rump.ndp rump.ifconfig" +} + +ra_multiple_routers_body() +{ + local n= + + rump_server_fs_start $RUMPSRV netinet6 + rump_server_fs_start $RUMPSRV3 netinet6 + rump_server_start $RUMPCLI netinet6 + + setup_shmif0 ${RUMPSRV} ${IP6SRV} + setup_shmif0 ${RUMPSRV3} ${IP6SRV3} + setup_shmif0 ${RUMPCLI} ${IP6CLI} + + init_server $RUMPSRV + init_server $RUMPSRV3 + + create_rtadvdconfig + + export RUMP_SERVER=${RUMPCLI} + atf_check -s exit:0 -o match:'0.->.1' rump.sysctl -w net.inet6.ip6.accept_rtadv=1 + unset RUMP_SERVER + + start_rtadvd $RUMPSRV $PIDFILE + start_rtadvd $RUMPSRV3 $PIDFILE3 + sleep $WAITTIME + + check_entries $RUMPCLI $RUMPSRV $IP6SRV_PREFIX + check_entries $RUMPCLI $RUMPSRV3 $IP6SRV3_PREFIX + + export RUMP_SERVER=$RUMPCLI + # Two prefixes are advertised by differnt two routers + n=$(rump.ndp -p |grep 'advertised by' |wc -l) + atf_check_equal $n 2 + unset RUMP_SERVER + + atf_check -s exit:0 kill -TERM `cat ${PIDFILE}` + wait_term ${PIDFILE} + atf_check -s exit:0 kill -TERM `cat ${PIDFILE3}` + wait_term ${PIDFILE3} + + rump_server_destroy_ifaces +} + +ra_multiple_routers_cleanup() +{ + + if [ -f ${PIDFILE} ]; then + kill -TERM `cat ${PIDFILE}` + wait_term ${PIDFILE} + fi + if [ -f ${PIDFILE3} ]; then + kill -TERM `cat ${PIDFILE3}` + wait_term ${PIDFILE3} + fi + + $DEBUG && dump + cleanup +} + +atf_test_case ra_multiple_routers_single_prefix cleanup +ra_multiple_routers_single_prefix_head() +{ + + atf_set "descr" "Tests for multiple routers with a single prefix" + atf_set "require.progs" "rump_server rump.rtadvd rump.ndp rump.ifconfig" +} + +ra_multiple_routers_single_prefix_body() +{ + local n= + + rump_server_fs_start $RUMPSRV netinet6 + rump_server_fs_start $RUMPSRV1_2 netinet6 + rump_server_start $RUMPCLI netinet6 + + setup_shmif0 ${RUMPSRV} ${IP6SRV} + setup_shmif0 ${RUMPSRV1_2} ${IP6SRV1_2} + setup_shmif0 ${RUMPCLI} ${IP6CLI} + + init_server $RUMPSRV + init_server $RUMPSRV1_2 + + create_rtadvdconfig + + export RUMP_SERVER=${RUMPCLI} + atf_check -s exit:0 -o match:'0.->.1' rump.sysctl -w net.inet6.ip6.accept_rtadv=1 + unset RUMP_SERVER + + start_rtadvd $RUMPSRV $PIDFILE + start_rtadvd $RUMPSRV1_2 $PIDFILE1_2 + sleep $WAITTIME + + check_entries $RUMPCLI $RUMPSRV $IP6SRV_PREFIX + check_entries $RUMPCLI $RUMPSRV1_2 $IP6SRV_PREFIX + + export RUMP_SERVER=$RUMPCLI + # One prefix is advertised by differnt two routers + n=$(rump.ndp -p |grep 'advertised by' |wc -l) + atf_check_equal $n 1 + unset RUMP_SERVER + + atf_check -s exit:0 kill -TERM `cat ${PIDFILE}` + wait_term ${PIDFILE} + atf_check -s exit:0 kill -TERM `cat ${PIDFILE1_2}` + wait_term ${PIDFILE1_2} + + rump_server_destroy_ifaces +} + +ra_multiple_routers_single_prefix_cleanup() +{ + + if [ -f ${PIDFILE} ]; then + kill -TERM `cat ${PIDFILE}` + wait_term ${PIDFILE} + fi + if [ -f ${PIDFILE1_2} ]; then + kill -TERM `cat ${PIDFILE1_2}` + wait_term ${PIDFILE1_2} + fi + + $DEBUG && dump + cleanup +} + +atf_test_case ra_multiple_routers_maxifprefixes cleanup +ra_multiple_routers_maxifprefixes_head() +{ + + atf_set "descr" "Tests for exceeding the number of maximum prefixes" + atf_set "require.progs" "rump_server rump.rtadvd rump.ndp rump.ifconfig" +} + +ra_multiple_routers_maxifprefixes_body() +{ + local n= + + rump_server_fs_start $RUMPSRV netinet6 + rump_server_fs_start $RUMPSRV3 netinet6 + rump_server_fs_start $RUMPSRV4 netinet6 + rump_server_start $RUMPCLI netinet6 + + setup_shmif0 ${RUMPSRV} ${IP6SRV} + setup_shmif0 ${RUMPSRV3} ${IP6SRV3} + setup_shmif0 ${RUMPSRV4} ${IP6SRV4} + setup_shmif0 ${RUMPCLI} ${IP6CLI} + + init_server $RUMPSRV + init_server $RUMPSRV3 + init_server $RUMPSRV4 + + create_rtadvdconfig + + export RUMP_SERVER=${RUMPCLI} + atf_check -s exit:0 -o match:'0.->.1' \ + rump.sysctl -w net.inet6.ip6.accept_rtadv=1 + # Limit the maximum number of prefix entries to 2 + atf_check -s exit:0 -o match:'16.->.2' \ + rump.sysctl -w net.inet6.ip6.maxifprefixes=2 + unset RUMP_SERVER + + start_rtadvd $RUMPSRV $PIDFILE + start_rtadvd $RUMPSRV3 $PIDFILE3 + sleep $WAITTIME + + check_entries $RUMPCLI $RUMPSRV $IP6SRV_PREFIX + check_entries $RUMPCLI $RUMPSRV3 $IP6SRV3_PREFIX + + start_rtadvd $RUMPSRV4 $PIDFILE4 + sleep $WAITTIME + + export RUMP_SERVER=${RUMPCLI} + $DEBUG && dump_entries + # There should remain two prefixes + n=$(rump.ndp -p |grep 'advertised by' |wc -l) + atf_check_equal $n 2 + # TODO check other conditions + unset RUMP_SERVER + + atf_check -s exit:0 kill -TERM `cat ${PIDFILE}` + wait_term ${PIDFILE} + atf_check -s exit:0 kill -TERM `cat ${PIDFILE3}` + wait_term ${PIDFILE3} + atf_check -s exit:0 kill -TERM `cat ${PIDFILE4}` + wait_term ${PIDFILE4} + + rump_server_destroy_ifaces +} + +ra_multiple_routers_maxifprefixes_cleanup() +{ + + if [ -f ${PIDFILE} ]; then + kill -TERM `cat ${PIDFILE}` + wait_term ${PIDFILE} + fi + if [ -f ${PIDFILE3} ]; then + kill -TERM `cat ${PIDFILE3}` + wait_term ${PIDFILE3} + fi + if [ -f ${PIDFILE4} ]; then + kill -TERM `cat ${PIDFILE4}` + wait_term ${PIDFILE4} + fi + + $DEBUG && dump + cleanup +} + +atf_test_case ra_temporary_address cleanup +ra_temporary_address_head() +{ + + atf_set "descr" "Tests for IPv6 temporary address" + atf_set "require.progs" "rump_server rump.rtadvd rump.ndp rump.ifconfig" +} + +ra_temporary_address_body() +{ + + rump_server_fs_start $RUMPSRV netinet6 + rump_server_start $RUMPCLI netinet6 + + setup_shmif0 ${RUMPSRV} ${IP6SRV} + init_server $RUMPSRV + + setup_shmif0 ${RUMPCLI} ${IP6CLI} + export RUMP_SERVER=${RUMPCLI} + $DEBUG && rump.ndp -n -a + atf_check -s exit:0 -o match:'= 0' \ + rump.sysctl net.inet6.ip6.accept_rtadv + atf_check -s exit:0 -o match:'= 0' \ + rump.sysctl net.inet6.ip6.use_tempaddr + unset RUMP_SERVER + + create_rtadvdconfig + start_rtadvd $RUMPSRV $PIDFILE + sleep $WAITTIME + + export RUMP_SERVER=${RUMPCLI} + atf_check -s exit:0 -o empty rump.ndp -r + atf_check -s exit:0 -o not-match:'advertised' rump.ndp -p + atf_check -s exit:0 -o match:'linkmtu=0' rump.ndp -n -i shmif0 + atf_check -s exit:0 -o not-match:'S R' rump.ndp -n -a + atf_check -s exit:0 -o not-match:'fc00:1:' rump.ndp -n -a + atf_check -s exit:0 -o not-match:'fc00:1:' rump.ifconfig shmif0 inet6 + unset RUMP_SERVER + + atf_check -s exit:0 kill -TERM `cat ${PIDFILE}` + wait_term ${PIDFILE} + + export RUMP_SERVER=${RUMPCLI} + atf_check -s exit:0 -o match:'0.->.1' \ + rump.sysctl -w net.inet6.ip6.accept_rtadv=1 + atf_check -s exit:0 -o match:'0.->.1' \ + rump.sysctl -w net.inet6.ip6.use_tempaddr=1 + unset RUMP_SERVER + + start_rtadvd $RUMPSRV $PIDFILE + sleep $WAITTIME + + check_entries $RUMPCLI $RUMPSRV $IP6SRV_PREFIX + + # Check temporary address + export RUMP_SERVER=${RUMPCLI} + atf_check -s exit:0 -o match:"$IP6SRV_PREFIX.+" \ + rump.ifconfig shmif0 inet6 + unset RUMP_SERVER + + atf_check -s exit:0 kill -TERM `cat ${PIDFILE}` + wait_term ${PIDFILE} + + rump_server_destroy_ifaces +} + +ra_temporary_address_cleanup() +{ + + if [ -f ${PIDFILE} ]; then + kill -TERM `cat ${PIDFILE}` + wait_term ${PIDFILE} + fi + + $DEBUG && dump + cleanup } atf_init_test_cases() { - atf_add_test_case basic + atf_add_test_case ra_basic + atf_add_test_case ra_flush_prefix_entries + atf_add_test_case ra_flush_defrouter_entries + atf_add_test_case ra_delete_address + atf_add_test_case ra_multiple_routers + atf_add_test_case ra_multiple_routers_single_prefix + atf_add_test_case ra_multiple_routers_maxifprefixes + atf_add_test_case ra_temporary_address } diff --git a/contrib/netbsd-tests/net/net/t_forwarding.sh b/contrib/netbsd-tests/net/net/t_forwarding.sh index 9e96738311f0..fc30530f14cc 100755 --- a/contrib/netbsd-tests/net/net/t_forwarding.sh +++ b/contrib/netbsd-tests/net/net/t_forwarding.sh @@ -1,4 +1,4 @@ -# $NetBSD: t_forwarding.sh,v 1.15 2016/08/10 21:33:52 kre Exp $ +# $NetBSD: t_forwarding.sh,v 1.19 2016/11/25 08:51:17 ozaki-r Exp $ # # Copyright (c) 2015 The NetBSD Foundation, Inc. # All rights reserved. @@ -25,9 +25,6 @@ # POSSIBILITY OF SUCH DAMAGE. # -inetserver="rump_server -lrumpnet -lrumpnet_net -lrumpnet_netinet -lrumpnet_shmif -lrumpdev" -inet6server="rump_server -lrumpnet -lrumpnet_net -lrumpnet_netinet -lrumpnet_netinet6 -lrumpnet_shmif -lrumpdev" - SOCKSRC=unix://commsock1 SOCKFWD=unix://commsock2 SOCKDST=unix://commsock3 @@ -40,10 +37,9 @@ IP6SRC=fc00:0:0:1::2 IP6SRCGW=fc00:0:0:1::1 IP6DSTGW=fc00:0:0:2::1 IP6DST=fc00:0:0:2::2 -HTTPD_PID=httpd.pid HTML_FILE=index.html -DEBUG=false +DEBUG=${DEBUG:-false} TIMEOUT=5 atf_test_case ipforwarding_v4 cleanup @@ -64,6 +60,18 @@ ipforwarding_v6_head() atf_set "require.progs" "rump_server" } +ipforwarding_fastforward_v4_head() +{ + atf_set "descr" "Tests for IPv4 fastforward" + atf_set "require.progs" "rump_server" +} + +ipforwarding_fastforward_v6_head() +{ + atf_set "descr" "Tests for IPv6 fastfoward" + atf_set "require.progs" "rump_server" +} + ipforwarding_misc_head() { atf_set "descr" "Does IPv4 forwarding tests" @@ -78,9 +86,9 @@ setup_endpoint() mode=${4} gw=${5} + rump_server_add_iface $sock shmif0 $bus + export RUMP_SERVER=${sock} - atf_check -s exit:0 rump.ifconfig shmif0 create - atf_check -s exit:0 rump.ifconfig shmif0 linkstr ${bus} if [ $mode = "ipv6" ]; then atf_check -s exit:0 rump.ifconfig shmif0 inet6 ${addr} atf_check -s exit:0 -o ignore rump.route add -inet6 default ${gw} @@ -116,12 +124,10 @@ setup_forwarder() { mode=${1} - export RUMP_SERVER=$SOCKFWD - atf_check -s exit:0 rump.ifconfig shmif0 create - atf_check -s exit:0 rump.ifconfig shmif0 linkstr bus1 + rump_server_add_iface $SOCKFWD shmif0 bus1 + rump_server_add_iface $SOCKFWD shmif1 bus2 - atf_check -s exit:0 rump.ifconfig shmif1 create - atf_check -s exit:0 rump.ifconfig shmif1 linkstr bus2 + export RUMP_SERVER=$SOCKFWD if [ $mode = "ipv6" ]; then atf_check -s exit:0 rump.ifconfig shmif0 inet6 ${IP6SRCGW} @@ -146,9 +152,9 @@ setup_forwarder() setup() { - atf_check -s exit:0 ${inetserver} $SOCKSRC - atf_check -s exit:0 ${inetserver} $SOCKFWD - atf_check -s exit:0 ${inetserver} $SOCKDST + rump_server_start $SOCKSRC + rump_server_start $SOCKFWD + rump_server_start $SOCKDST setup_endpoint $SOCKSRC $IP4SRC bus1 ipv4 $IP4SRCGW setup_endpoint $SOCKDST $IP4DST bus2 ipv4 $IP4DSTGW @@ -157,29 +163,15 @@ setup() setup6() { - atf_check -s exit:0 ${inet6server} $SOCKSRC - atf_check -s exit:0 ${inet6server} $SOCKFWD - atf_check -s exit:0 ${inet6server} $SOCKDST + rump_server_start $SOCKSRC netinet6 + rump_server_start $SOCKFWD netinet6 + rump_server_start $SOCKDST netinet6 setup_endpoint $SOCKSRC $IP6SRC bus1 ipv6 $IP6SRCGW setup_endpoint $SOCKDST $IP6DST bus2 ipv6 $IP6DSTGW setup_forwarder ipv6 } -setup_bozo() -{ - local ip=$1 - - export RUMP_SERVER=$SOCKDST - - touch $HTML_FILE - # start bozo in daemon mode - atf_check -s exit:0 env LD_PRELOAD=/usr/lib/librumphijack.so \ - /usr/libexec/httpd -P $HTTPD_PID -i $ip -b -s $(pwd) - - $DEBUG && rump.netstat -a -} - test_http_get() { local ip=$1 @@ -270,15 +262,8 @@ teardown_icmp_bmcastecho() teardown_interfaces() { - export RUMP_SERVER=$SOCKSRC - atf_check -s exit:0 -o ignore rump.ifconfig shmif0 destroy - export RUMP_SERVER=$SOCKFWD - atf_check -s exit:0 -o ignore rump.ifconfig shmif0 destroy - atf_check -s exit:0 -o ignore rump.ifconfig shmif1 destroy - - export RUMP_SERVER=$SOCKDST - atf_check -s exit:0 -o ignore rump.ifconfig shmif0 destroy + rump_server_destroy_ifaces } test_setup_forwarding() @@ -307,33 +292,6 @@ test_teardown_forwarding6() rump.sysctl net.inet6.ip6.forwarding } -cleanup() -{ - env RUMP_SERVER=$SOCKSRC rump.halt - env RUMP_SERVER=$SOCKFWD rump.halt - env RUMP_SERVER=$SOCKDST rump.halt -} - -cleanup_bozo() -{ - - if [ -f $HTTPD_PID ]; then - kill -9 "$(cat $HTTPD_PID)" - rm -f $HTTPD_PID - fi - rm -f $HTML_FILE -} - -dump() -{ - env RUMP_SERVER=$SOCKSRC rump.netstat -nr - env RUMP_SERVER=$SOCKFWD rump.netstat -nr - env RUMP_SERVER=$SOCKDST rump.netstat -nr - - /usr/bin/shmif_dumpbus -p - bus1 2>/dev/null| /usr/sbin/tcpdump -n -e -r - - /usr/bin/shmif_dumpbus -p - bus2 2>/dev/null| /usr/sbin/tcpdump -n -e -r - -} - test_ping_failure() { export RUMP_SERVER=$SOCKSRC @@ -481,7 +439,10 @@ ipforwarding_fastforward_v4_body() setup_forwarding test_setup_forwarding - setup_bozo $IP4DST + touch $HTML_FILE + start_httpd $SOCKDST $IP4DST + $DEBUG && rump.netstat -a + test_http_get $IP4DST teardown_interfaces @@ -495,7 +456,10 @@ ipforwarding_fastforward_v6_body() setup_forwarding6 test_setup_forwarding6 - setup_bozo $IP6DST + touch $HTML_FILE + start_httpd $SOCKDST $IP6DST + $DEBUG && rump.netstat -a + test_http_get "[$IP6DST]" teardown_interfaces @@ -513,7 +477,10 @@ ipforwarding_misc_body() test_directed_broadcast - setup_bozo $IP4DST + touch $HTML_FILE + start_httpd $SOCKDST $IP4DST + $DEBUG && rump.netstat -a + test_sysctl_ttl $IP4DST teardown_interfaces @@ -522,34 +489,34 @@ ipforwarding_misc_body() ipforwarding_v4_cleanup() { - dump + $DEBUG && dump cleanup } ipforwarding_v6_cleanup() { - dump + $DEBUG && dump cleanup } ipforwarding_fastforward_v4_cleanup() { - dump - cleanup_bozo + $DEBUG && dump + stop_httpd cleanup } ipforwarding_fastforward_v6_cleanup() { - dump - cleanup_bozo + $DEBUG && dump + stop_httpd cleanup } ipforwarding_misc_cleanup() { - dump - cleanup_bozo + $DEBUG && dump + stop_httpd cleanup } diff --git a/contrib/netbsd-tests/net/net/t_ipaddress.sh b/contrib/netbsd-tests/net/net/t_ipaddress.sh index a46f484b6ff3..4cdd9545b693 100755 --- a/contrib/netbsd-tests/net/net/t_ipaddress.sh +++ b/contrib/netbsd-tests/net/net/t_ipaddress.sh @@ -1,4 +1,4 @@ -# $NetBSD: t_ipaddress.sh,v 1.3 2016/08/10 21:33:52 kre Exp $ +# $NetBSD: t_ipaddress.sh,v 1.9 2016/12/15 02:43:56 ozaki-r Exp $ # # Copyright (c) 2015 Internet Initiative Japan Inc. # All rights reserved. @@ -25,61 +25,37 @@ # POSSIBILITY OF SUCH DAMAGE. # -SERVER="rump_server -lrumpnet -lrumpnet_net -lrumpnet_netinet -lrumpnet_shmif -lrumpdev" -SERVER6="$SERVER -lrumpnet_netinet6" SOCK_LOCAL=unix://commsock1 BUS=bus -DEBUG=false - -check_entry() -{ - local ip=$(echo $1 |sed 's/\./\\./g') - local word=$2 - - atf_check -s exit:0 -o match:"$word" -e ignore -x \ - "rump.netstat -rn | grep ^'$ip'" -} - -check_entry_fail() -{ - local ip=$(echo $1 |sed 's/\./\\./g') - local flags=$2 # Not used currently - - atf_check -s not-exit:0 -e ignore -x \ - "rump.netstat -rn | grep ^'$ip'" -} +DEBUG=${DEBUG:-false} test_same_address() { local ip=10.0.0.1 local net=10.0.0/24 - atf_check -s exit:0 ${SERVER} ${SOCK_LOCAL} + rump_server_start $SOCK_LOCAL + rump_server_add_iface $SOCK_LOCAL shmif0 $BUS + export RUMP_SERVER=$SOCK_LOCAL - atf_check -s exit:0 -o ignore rump.ifconfig shmif0 create - atf_check -s exit:0 -o ignore rump.ifconfig shmif0 linkstr ${BUS} atf_check -s exit:0 -o ignore rump.ifconfig shmif0 $ip/24 atf_check -s exit:0 -o ignore rump.ifconfig shmif0 up atf_check -s exit:0 -o ignore rump.ifconfig -w 10 $DEBUG && rump.netstat -nr -f inet - check_entry $ip UHl - check_entry $ip lo0 - check_entry $ip 'link#2' - check_entry $net U - check_entry $net shmif0 - check_entry $net 'link#2' + check_route $ip 'link#2' UHl lo0 + check_route $net 'link#2' UC shmif0 # Delete the address atf_check -s exit:0 -o ignore rump.ifconfig shmif0 $ip delete $DEBUG && rump.netstat -nr -f inet - check_entry_fail $ip - check_entry_fail $net + check_route_no_entry $ip + check_route_no_entry $net # Assign the same address again atf_check -s exit:0 -o ignore rump.ifconfig shmif0 $ip/24 @@ -87,20 +63,18 @@ test_same_address() $DEBUG && rump.netstat -nr -f inet - check_entry $ip UHl - check_entry $ip lo0 - check_entry $ip 'link#2' - check_entry $net U - check_entry $net shmif0 - check_entry $net 'link#2' + check_route $ip 'link#2' UHl lo0 + check_route $net 'link#2' UC shmif0 # Delete the address again atf_check -s exit:0 -o ignore rump.ifconfig shmif0 $ip delete $DEBUG && rump.netstat -nr -f inet - check_entry_fail $ip - check_entry_fail $net + check_route_no_entry $ip + check_route_no_entry $net + + rump_server_destroy_ifaces } test_same_address6() @@ -108,31 +82,27 @@ test_same_address6() local ip=fc00::1 local net=fc00::/64 - atf_check -s exit:0 ${SERVER6} ${SOCK_LOCAL} + rump_server_start $SOCK_LOCAL netinet6 + rump_server_add_iface $SOCK_LOCAL shmif0 $BUS + export RUMP_SERVER=$SOCK_LOCAL - atf_check -s exit:0 -o ignore rump.ifconfig shmif0 create - atf_check -s exit:0 -o ignore rump.ifconfig shmif0 linkstr ${BUS} atf_check -s exit:0 -o ignore rump.ifconfig shmif0 inet6 $ip atf_check -s exit:0 -o ignore rump.ifconfig shmif0 up atf_check -s exit:0 -o ignore rump.ifconfig -w 10 $DEBUG && rump.netstat -nr -f inet6 - check_entry $ip UHl - check_entry $ip lo0 - check_entry $ip 'link#2' - check_entry $net U - check_entry $net shmif0 - check_entry $net 'link#2' + check_route $ip 'link#2' UHl lo0 + check_route $net 'link#2' UC shmif0 # Delete the address atf_check -s exit:0 -o ignore rump.ifconfig shmif0 inet6 $ip delete $DEBUG && rump.netstat -nr -f inet6 - check_entry_fail $ip - check_entry_fail $net + check_route_no_entry $ip + check_route_no_entry $net # Assign the same address again atf_check -s exit:0 -o ignore rump.ifconfig shmif0 inet6 $ip @@ -140,27 +110,58 @@ test_same_address6() $DEBUG && rump.netstat -nr -f inet6 - check_entry $ip UHl - check_entry $ip lo0 - check_entry $ip 'link#2' - check_entry $net U - check_entry $net shmif0 - check_entry $net 'link#2' + check_route $ip 'link#2' UHl lo0 + check_route $net 'link#2' UC shmif0 # Delete the address again atf_check -s exit:0 -o ignore rump.ifconfig shmif0 inet6 $ip delete $DEBUG && rump.netstat -nr -f inet6 - check_entry_fail $ip - check_entry_fail $net + check_route_no_entry $ip + check_route_no_entry $net + + rump_server_destroy_ifaces } -cleanup() +test_auto_linklocal() { - $DEBUG && shmif_dumpbus -p - $BUS 2>/dev/null | tcpdump -n -e -r - - env RUMP_SERVER=$SOCK_LOCAL rump.halt + rump_server_start $SOCK_LOCAL netinet6 + rump_server_add_iface $SOCK_LOCAL shmif0 $BUS + + export RUMP_SERVER=$SOCK_LOCAL + + # + # Test enabled auto linklocal + # + + # Check default value + atf_check -s exit:0 -o match:"1" rump.sysctl -n net.inet6.ip6.auto_linklocal + + atf_check -s exit:0 -o ignore rump.ifconfig shmif0 up + atf_check -s exit:0 -o ignore rump.ifconfig -w 10 + + $DEBUG && rump.netstat -nr -f inet + + # IPv6 link-local address is set + atf_check -s exit:0 -o match:"inet6 fe80::" rump.ifconfig shmif0 + + # + # Test disabled auto linklocal + # + atf_check -s exit:0 -o ignore rump.sysctl -w -q net.inet6.ip6.auto_linklocal=0 + + rump_server_add_iface $SOCK_LOCAL shmif1 $BUS + atf_check -s exit:0 -o ignore rump.ifconfig shmif1 up + atf_check -s exit:0 -o ignore rump.ifconfig -w 10 + + $DEBUG && rump.netstat -nr -f inet + + # IPv6 link-local address is not set + atf_check -s exit:0 -o not-match:"inet6 fe80::" rump.ifconfig shmif1 + + rump_server_destroy_ifaces } add_test() @@ -177,6 +178,7 @@ add_test() test_${name}; \ }; \ ipaddr_${name}_cleanup() { \ + $DEBUG && dump; \ cleanup; \ }" atf_add_test_case "ipaddr_${name}" @@ -187,4 +189,5 @@ atf_init_test_cases() add_test same_address "Assigning/deleting an IP address twice" add_test same_address6 "Assigning/deleting an IPv6 address twice" + add_test auto_linklocal "Assigning an IPv6 link-local address automatically" } diff --git a/contrib/netbsd-tests/net/net/t_ipv6_lifetime.sh b/contrib/netbsd-tests/net/net/t_ipv6_lifetime.sh index 5fb34d0649c0..10e50fd3e1e6 100755 --- a/contrib/netbsd-tests/net/net/t_ipv6_lifetime.sh +++ b/contrib/netbsd-tests/net/net/t_ipv6_lifetime.sh @@ -1,4 +1,4 @@ -# $NetBSD: t_ipv6_lifetime.sh,v 1.2 2016/08/10 21:33:52 kre Exp $ +# $NetBSD: t_ipv6_lifetime.sh,v 1.6 2016/11/25 08:51:17 ozaki-r Exp $ # # Copyright (c) 2015 The NetBSD Foundation, Inc. # All rights reserved. @@ -25,13 +25,12 @@ # POSSIBILITY OF SUCH DAMAGE. # -INET6SERVER="rump_server -lrumpnet -lrumpnet_net -lrumpnet_netinet -lrumpdev" -INET6SERVER="$INET6SERVER -lrumpnet_netinet6 -lrumpnet_shmif" - SOCK=unix://sock BUS=./bus -DEBUG=false +DEBUG=${DEBUG:-false} + +deprecated="[Dd][Ee][Pp][Rr][Ee][Cc][Aa][Tt][Ee][Dd]" atf_test_case basic cleanup @@ -47,11 +46,11 @@ basic_body() local bonus=2 local ip="fc00::1" - atf_check -s exit:0 ${INET6SERVER} $SOCK + rump_server_start $SOCK netinet6 + rump_server_add_iface $SOCK shmif0 $BUS + export RUMP_SERVER=$SOCK - atf_check -s exit:0 rump.ifconfig shmif0 create - atf_check -s exit:0 rump.ifconfig shmif0 linkstr $BUS atf_check -s exit:0 rump.ifconfig shmif0 up # A normal IP address doesn't contain preferred/valid lifetime @@ -69,7 +68,7 @@ basic_body() atf_check -s exit:0 sleep $(($time + $bonus)) $DEBUG && rump.ifconfig -L shmif0 # Should remain but marked as deprecated - atf_check -s exit:0 -o match:'deprecated' rump.ifconfig -L shmif0 + atf_check -s exit:0 -o match:"$ip.+$deprecated" rump.ifconfig -L shmif0 atf_check -s exit:0 rump.ifconfig shmif0 inet6 $ip delete # Setting only a valid lifetime (invalid) @@ -87,38 +86,33 @@ basic_body() # Shouldn't remain anymore atf_check -s exit:0 -o not-match:"$ip" rump.ifconfig -L shmif0 + # Setting both preferred and valid lifetimes (pltime > vltime) + atf_check -s not-exit:0 -e match:'Invalid argument' rump.ifconfig \ + shmif0 inet6 $ip pltime $(($time * 2)) vltime $time + # Setting both preferred and valid lifetimes (pltime < vltime) atf_check -s exit:0 rump.ifconfig shmif0 inet6 $ip \ pltime $time vltime $((time * 2)) $DEBUG && rump.ifconfig -L shmif0 atf_check -s exit:0 -o match:'pltime' rump.ifconfig -L shmif0 atf_check -s exit:0 -o match:'vltime' rump.ifconfig -L shmif0 + + if sysctl machdep.cpu_brand 2>/dev/null | grep QEMU >/dev/null 2>&1 + then + atf_check -s exit:0 rump.ifconfig shmif0 inet6 $ip delete + atf_skip "unreliable under qemu, skip until PR kern/43997 fixed" + fi + atf_check -s exit:0 sleep $(($time + $bonus)) $DEBUG && rump.ifconfig -L shmif0 # Should remain but marked as deprecated - atf_check -s exit:0 -o match:'deprecated' rump.ifconfig -L shmif0 + atf_check -s exit:0 -o match:"$ip.+$deprecated" rump.ifconfig -L shmif0 atf_check -s exit:0 sleep $(($time + $bonus)) $DEBUG && rump.ifconfig -L shmif0 # Shouldn't remain anymore atf_check -s exit:0 -o not-match:"$ip" rump.ifconfig -L shmif0 - # Setting both preferred and valid lifetimes (pltime > vltime) - atf_check -s not-exit:0 -e match:'Invalid argument' rump.ifconfig \ - shmif0 inet6 $ip pltime $(($time * 2)) vltime $time - - return 0 -} - -cleanup() -{ - env RUMP_SERVER=$SOCK rump.halt -} - -dump() -{ - env RUMP_SERVER=$SOCK rump.ifconfig - env RUMP_SERVER=$SOCK rump.netstat -nr - shmif_dumpbus -p - $BUS 2>/dev/null| tcpdump -n -e -r - + rump_server_destroy_ifaces } basic_cleanup() diff --git a/contrib/netbsd-tests/net/net/t_ipv6address.sh b/contrib/netbsd-tests/net/net/t_ipv6address.sh index 3448e86b3d92..539a16d38061 100755 --- a/contrib/netbsd-tests/net/net/t_ipv6address.sh +++ b/contrib/netbsd-tests/net/net/t_ipv6address.sh @@ -1,4 +1,4 @@ -# $NetBSD: t_ipv6address.sh,v 1.7 2016/08/10 21:33:52 kre Exp $ +# $NetBSD: t_ipv6address.sh,v 1.12 2016/12/14 02:50:42 ozaki-r Exp $ # # Copyright (c) 2015 Internet Initiative Japan Inc. # All rights reserved. @@ -24,8 +24,9 @@ # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE # POSSIBILITY OF SUCH DAMAGE. -SERVER="rump_server -lrumpnet -lrumpnet_net -lrumpnet_netinet -lrumpnet_shmif -lrumpdev" -SERVER6="$SERVER -lrumpnet_netinet6" +SERVER="rump_server -lrumpnet -lrumpnet_net -lrumpnet_netinet" +SERVER="${SERVER} -lrumpnet_shmif -lrumpdev" +SERVER6="${SERVER} -lrumpnet_netinet6" SOCKSRC=unix://commsock1 SOCKFWD=unix://commsock2 @@ -40,7 +41,7 @@ BUS2=bus2 BUSSRC=bus_src BUSDST=bus_dst -DEBUG=true +DEBUG=${DEBUG:-true} TIMEOUT=3 atf_test_case linklocal cleanup @@ -118,41 +119,41 @@ setup_route() { local tmp_rump_server=$RUMP_SERVER - local src_if0_lladdr=`get_lladdr ${SOCKSRC} shmif0` - local dst_if0_lladdr=`get_lladdr ${SOCKDST} shmif0` - local fwd_if0_lladdr=`get_lladdr ${SOCKFWD} shmif0` - local fwd_if1_lladdr=`get_lladdr ${SOCKFWD} shmif1` + local src_if0_lladdr=`get_linklocal_addr ${SOCKSRC} shmif0` + local dst_if0_lladdr=`get_linklocal_addr ${SOCKDST} shmif0` + local fwd_if0_lladdr=`get_linklocal_addr ${SOCKFWD} shmif0` + local fwd_if1_lladdr=`get_linklocal_addr ${SOCKFWD} shmif1` export RUMP_SERVER=${SOCKSRC} - atf_check -s ignore -o ignore -e ignore rump.route delete -inet6 default \ - ${fwd_if0_lladdr}%shmif0 - atf_check -s exit:0 -o match:"add net default:" rump.route add -inet6 default \ - ${fwd_if0_lladdr}%shmif0 + atf_check -s ignore -o ignore -e ignore \ + rump.route delete -inet6 default ${fwd_if0_lladdr}%shmif0 + atf_check -s exit:0 -o match:"add net default:" \ + rump.route add -inet6 default ${fwd_if0_lladdr}%shmif0 atf_check -s exit:0 rump.ifconfig shmif1 inet6 ${IP6SRC} atf_check -s exit:0 -o ignore rump.ifconfig -w 10 $DEBUG && rump.netstat -rn -f inet6 unset RUMP_SERVER export RUMP_SERVER=${SOCKDST} - atf_check -s ignore -o ignore -e ignore rump.route delete -inet6 default \ - ${fwd_if1_lladdr}%shmif0 - atf_check -s exit:0 -o match:"add net default:" rump.route add -inet6 default \ - ${fwd_if1_lladdr}%shmif0 + atf_check -s ignore -o ignore -e ignore \ + rump.route delete -inet6 default ${fwd_if1_lladdr}%shmif0 + atf_check -s exit:0 -o match:"add net default:" \ + rump.route add -inet6 default ${fwd_if1_lladdr}%shmif0 atf_check -s exit:0 rump.ifconfig shmif1 inet6 ${IP6DST} atf_check -s exit:0 -o ignore rump.ifconfig -w 10 $DEBUG && rump.netstat -rn -f inet6 unset RUMP_SERVER export RUMP_SERVER=${SOCKFWD} - atf_check -s ignore -o ignore -e ignore rump.route delete -inet6 ${IP6SRCNW} \ - ${src_if0_lladdr}%shmif0 - atf_check -s exit:0 -o match:"add net" rump.route add -inet6 ${IP6SRCNW} \ - ${src_if0_lladdr}%shmif0 + atf_check -s ignore -o ignore -e ignore \ + rump.route delete -inet6 ${IP6SRCNW} ${src_if0_lladdr}%shmif0 + atf_check -s exit:0 -o match:"add net" \ + rump.route add -inet6 ${IP6SRCNW} ${src_if0_lladdr}%shmif0 - atf_check -s ignore -o ignore -e ignore rump.route delete -inet6 ${IP6DSTNW} \ - ${dst_if0_lladdr}%shmif1 - atf_check -s exit:0 -o match:"add net" rump.route add -inet6 ${IP6DSTNW} \ - ${dst_if0_lladdr}%shmif1 + atf_check -s ignore -o ignore -e ignore \ + rump.route delete -inet6 ${IP6DSTNW} ${dst_if0_lladdr}%shmif1 + atf_check -s exit:0 -o match:"add net" \ + rump.route add -inet6 ${IP6DSTNW} ${dst_if0_lladdr}%shmif1 atf_check -s exit:0 -o ignore rump.ifconfig -w 10 $DEBUG && rump.netstat -rn -f inet6 unset RUMP_SERVER @@ -197,17 +198,6 @@ cleanup_bus() export RUMP_SERVER=$tmp_rump_server } - -get_lladdr() -{ - export RUMP_SERVER=${1} - rump.ifconfig ${2} inet6 | grep "fe80" \ - | awk '{print $2}' | sed -e "s/%$2//g" - unset RUMP_SERVER - - return 0 -} - cleanup_rump_servers() { @@ -221,11 +211,11 @@ dump_bus() shmif_dumpbus -p - ${BUSSRC} 2>/dev/null| tcpdump -n -e -r - shmif_dumpbus -p - ${BUSDST} 2>/dev/null| tcpdump -n -e -r - - shmif_dumpbus -p - ${BUS1} 2>/dev/null| tcpdump -n -e -r - - shmif_dumpbus -p - ${BUS2} 2>/dev/null| tcpdump -n -e -r - + shmif_dumpbus -p - ${BUS1} 2>/dev/null| tcpdump -n -e -r - + shmif_dumpbus -p - ${BUS2} 2>/dev/null| tcpdump -n -e -r - } -dump() +_dump() { export RUMP_SERVER=${SOCKSRC} @@ -242,19 +232,21 @@ dump() linklocal_head() { - atf_set "descr" "Test for bassically function of the IPv6 linklocal address" - atf_set "require.progs" "rump_server rump.route rump.ifconfig rump.ping6" + atf_set "descr" \ + "Test for bassically function of the IPv6 linklocal address" + atf_set "require.progs" \ + "rump_server rump.route rump.ifconfig rump.ping6" } linklocal_body() { setup - local src_if0_lladdr=`get_lladdr ${SOCKSRC} shmif0` - local src_if1_lladdr=`get_lladdr ${SOCKSRC} shmif1` - local dst_if0_lladdr=`get_lladdr ${SOCKDST} shmif0` - local fwd_if0_lladdr=`get_lladdr ${SOCKFWD} shmif0` - local fwd_if1_lladdr=`get_lladdr ${SOCKFWD} shmif1` + local src_if0_lladdr=`get_linklocal_addr ${SOCKSRC} shmif0` + local src_if1_lladdr=`get_linklocal_addr ${SOCKSRC} shmif1` + local dst_if0_lladdr=`get_linklocal_addr ${SOCKDST} shmif0` + local fwd_if0_lladdr=`get_linklocal_addr ${SOCKFWD} shmif0` + local fwd_if1_lladdr=`get_linklocal_addr ${SOCKFWD} shmif1` export RUMP_SERVER=${SOCKSRC} $DEBUG && rump.ifconfig @@ -271,7 +263,7 @@ linklocal_body() atf_check -s ignore -o empty -e ignore \ -x "shmif_dumpbus -p - ${BUSSRC} | tcpdump -r - -n -p icmp6" atf_check -s ignore -o not-empty -e ignore \ - -x "shmif_dumpbus -p - ${BUS1} | tcpdump -r - -n -p icmp6" + -x "shmif_dumpbus -p - ${BUS1} | tcpdump -r - -n -p icmp6" cleanup_bus @@ -279,7 +271,7 @@ linklocal_body() rump.ping6 -c 1 -X $TIMEOUT -n -S ${src_if1_lladdr}%shmif1 \ ${fwd_if0_lladdr}%shmif0 atf_check -s ignore -o not-match:"${src_if1_lladdr}" -e ignore \ - -x "shmif_dumpbus -p - ${BUS1} | tcpdump -r - -n -p icmp6" + -x "shmif_dumpbus -p - ${BUS1} | tcpdump -r - -n -p icmp6" $DEBUG && shmif_dumpbus -p - ${BUS1} | tcpdump -r - -n -p icmp6 unset RUMP_SERVER @@ -290,16 +282,16 @@ linklocal_body() unset RUMP_SERVER export RUMP_SERVER=${SOCKSRC} - atf_check -s exit:0 -o match:"add net default:" rump.route add -inet6 default \ - ${fwd_if0_lladdr}%shmif0 + atf_check -s exit:0 -o match:"add net default:" \ + rump.route add -inet6 default ${fwd_if0_lladdr}%shmif0 atf_check -s exit:0 -o ignore rump.ifconfig -w 10 $DEBUG && rump.ifconfig shmif0 - $DEBUG && dump + $DEBUG && _dump export RUMP_SERVER=${SOCKSRC} atf_check -s exit:0 -o match:"0.0% packet loss" \ - rump.ping6 -c 1 -X $TIMEOUT -n -S ${src_if0_lladdr}%shmif0 ${IP6FWD0} + rump.ping6 -c 1 -X $TIMEOUT -n -S ${src_if0_lladdr}%shmif0 ${IP6FWD0} unset RUMP_SERVER export RUMP_SERVER=${SOCKFWD} @@ -340,7 +332,7 @@ linklocal_body() linklocal_cleanup() { - $DEBUG && dump + $DEBUG && _dump $DEBUG && dump_bus cleanup_rump_servers } @@ -348,7 +340,8 @@ linklocal_cleanup() linklocal_ops_head() { - atf_set "descr" "Test for various operations to IPv6 linklocal addresses" + atf_set "descr" \ + "Test for various operations to IPv6 linklocal addresses" atf_set "require.progs" "rump_server rump.route rump.ndp" } @@ -358,7 +351,7 @@ linklocal_ops_body() setup - src_if0_lladdr=`get_lladdr ${SOCKSRC} shmif0` + src_if0_lladdr=`get_linklocal_addr ${SOCKSRC} shmif0` export RUMP_SERVER=${SOCKSRC} diff --git a/contrib/netbsd-tests/net/net/t_mtudisc.sh b/contrib/netbsd-tests/net/net/t_mtudisc.sh new file mode 100755 index 000000000000..a99d652c477d --- /dev/null +++ b/contrib/netbsd-tests/net/net/t_mtudisc.sh @@ -0,0 +1,192 @@ +# $NetBSD: t_mtudisc.sh,v 1.8 2016/12/21 01:16:18 ozaki-r Exp $ +# +# Copyright (c) 2016 Internet Initiative Japan Inc. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# + +SOCKLOCAL=unix://commsock1 +SOCKGATEWAY=unix://commsock2 +SOCKREMOTE=unix://commsock3 +HTML_FILE=index.html + +DEBUG=${DEBUG:-false} + +atf_test_case mtudisc_basic cleanup + +mtudisc_basic_head() +{ + atf_set "descr" "Tests for IPv4 Path MTU Dicorvery basic behavior" + atf_set "require.progs" "rump_server" +} + +setup_server() +{ + local sock=$1 + local if=$2 + local bus=$3 + local ip=$4 + + rump_server_add_iface $sock $if $bus + + export RUMP_SERVER=$sock + atf_check -s exit:0 rump.ifconfig $if $ip + atf_check -s exit:0 rump.ifconfig $if up + atf_check -s exit:0 rump.ifconfig -w 10 + + $DEBUG && rump.ifconfig $if +} + +prepare_download_file() +{ + local file=$1 + local data="0123456789" + + touch $file + for i in `seq 1 512` + do + echo $data >> $file + done +} + +do_http_get() +{ + local ip=$1 + local ret=$2 + local timeout=5 + + # get the webpage + atf_check -s exit:$ret env LD_PRELOAD=/usr/lib/librumphijack.so \ + ftp -q $timeout -o ./out http://$ip/$HTML_FILE +} + +mtudisc_basic_body() +{ + local pkt= + local local_ip=10.0.0.2 + local gateway_local_ip=10.0.0.1 + local gateway_remote_ip=10.0.1.1 + local remote_ip=10.0.1.2 + local prefixlen=24 + + rump_server_start $SOCKLOCAL + rump_server_start $SOCKGATEWAY + rump_server_start $SOCKREMOTE + + # + # Setup servers + # + # [local server] [gateway server] [remote server with httpd] + # | 10.0.0.2 10.0.0.1 | | 10.0.1.1 10.0.1.2 | + # shmif0(mtu=1500) ----- shmif1(mtu=1280) shmif0(mtu=1500) ----- shmif0(mtu=1500) + # + + # Assign IP addresses + setup_server $SOCKLOCAL shmif0 bus1 $local_ip/$prefixlen + setup_server $SOCKGATEWAY shmif0 bus1 $gateway_local_ip/$prefixlen + setup_server $SOCKGATEWAY shmif1 bus2 $gateway_remote_ip/$prefixlen + setup_server $SOCKREMOTE shmif0 bus2 $remote_ip/$prefixlen + + ### Setup gateway server + export RUMP_SERVER=$SOCKGATEWAY + + # Set mtu of shmif0 to 1280 + export RUMP_SERVER=$SOCKGATEWAY + atf_check -s exit:0 rump.ifconfig shmif0 mtu 1280 + + # Enable IPv4 forwarding + atf_check -s exit:0 rump.sysctl -w -q net.inet.ip.forwarding=1 + + ### Setup remote server + export RUMP_SERVER=$SOCKREMOTE + + # Check default value + atf_check -s exit:0 -o match:"1" rump.sysctl -n net.inet.ip.mtudisc + + # Start httpd daemon + prepare_download_file $HTML_FILE + start_httpd $SOCKREMOTE $remote_ip + $DEBUG && rump.netstat -a -f inet + + # Teach the peer thar 10.0.0.2(local serer) is behind 10.0.1.1(gateway server) + atf_check -s exit:0 -o ignore rump.route add $local_ip/32 $gateway_remote_ip + + ### Setup local server + export RUMP_SERVER=$SOCKLOCAL + + # Teach the peer thar 10.0.1.2(remote serer) is behind 10.0.0.1(gateway server) + atf_check -s exit:0 -o ignore rump.route add $remote_ip/32 $gateway_local_ip + + # Don't accept fragmented packets + atf_check -s exit:0 -o ignore rump.sysctl -w -q net.inet.ip.maxfragpackets=0 + + # + # Test disabled path mtu discorvery + # + export RUMP_SERVER=$SOCKREMOTE + atf_check -s exit:0 -o ignore rump.sysctl -w -q net.inet.ip.mtudisc=0 + + # Get the webpage (expect: failed) + export RUMP_SERVER=$SOCKLOCAL + do_http_get $remote_ip 1 + $DEBUG && extract_new_packets bus2 > ./out + $DEBUG && cat ./out + + # Check path mtu size on remote server + export RUMP_SERVER=$SOCKREMOTE + atf_check -s exit:0 \ + -o match:"^10.0.0.2 +10.0.1.1 +UGHS +- +- +- +shmif0" \ + rump.netstat -nr -f inet + + # + # Test enabled path mtu discorvery + # + export RUMP_SERVER=$SOCKREMOTE + atf_check -s exit:0 -o ignore rump.sysctl -w -q net.inet.ip.mtudisc=1 + + # Get the webpage (expect: success) + export RUMP_SERVER=$SOCKLOCAL + do_http_get $remote_ip 0 + $DEBUG && extract_new_packets bus2 > ./out + $DEBUG && cat ./out + + # Check path mtu size on remote server + export RUMP_SERVER=$SOCKREMOTE + atf_check -s exit:0 \ + -o match:"^10.0.0.2 +10.0.1.1 +UGHS +- +- +1280 +shmif0" \ + rump.netstat -nr -f inet + + rump_server_destroy_ifaces +} + +mtudisc_basic_cleanup() +{ + $DEBUG && dump + stop_httpd + cleanup +} + +atf_init_test_cases() +{ + atf_add_test_case mtudisc_basic +} diff --git a/contrib/netbsd-tests/net/net/t_mtudisc6.sh b/contrib/netbsd-tests/net/net/t_mtudisc6.sh new file mode 100755 index 000000000000..93bc12e3623f --- /dev/null +++ b/contrib/netbsd-tests/net/net/t_mtudisc6.sh @@ -0,0 +1,179 @@ +# $NetBSD: t_mtudisc6.sh,v 1.5 2016/11/25 08:51:17 ozaki-r Exp $ +# +# Copyright (c) 2016 Internet Initiative Japan Inc. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# + +SOCKLOCAL=unix://commsock1 +SOCKGATEWAY=unix://commsock2 +SOCKREMOTE=unix://commsock3 +HTML_FILE=index.html + +DEBUG=${DEBUG:-false} + +atf_test_case mtudisc6_basic cleanup + +mtudisc6_basic_head() +{ + + atf_set "descr" "Tests for IPv6 Path MTU Dicorvery basic behavior" + atf_set "require.progs" "rump_server" +} + +setup_server() +{ + local sock=$1 + local if=$2 + local bus=$3 + local ip=$4 + + rump_server_add_iface $sock $if $bus + + export RUMP_SERVER=$sock + atf_check -s exit:0 rump.ifconfig $if inet6 $ip + atf_check -s exit:0 rump.ifconfig $if up + atf_check -s exit:0 rump.ifconfig -w 10 + + $DEBUG && rump.ifconfig $if +} + +prepare_download_file() +{ + local file=$1 + local data="0123456789" + + touch $file + for i in `seq 1 512` + do + echo $data >> $file + done +} + +do_http_get() +{ + local ip=$1 + local ret=$2 + local timeout=5 + + # get the webpage + atf_check -s exit:$ret env LD_PRELOAD=/usr/lib/librumphijack.so \ + ftp -q $timeout -o ./out "http://[$ip]/$HTML_FILE" +} + +mtudisc6_basic_body() +{ + local pkt= + local local_ip=fc00:0:0:1::2 + local gateway_local_ip=fc00:0:0:1::1 + local gateway_remote_ip=fc00:0:0:2::1 + local remote_ip=fc00:0:0:2::2 + local prefixlen=64 + + rump_server_start $SOCKLOCAL netinet6 + rump_server_start $SOCKGATEWAY netinet6 + rump_server_start $SOCKREMOTE netinet6 + + # + # Setup servers + # + # [local server] [gateway server] [remote server] + # | | | | + # shmif0(1500) -- shmif1(1280) shmif0(1500) -- shmif0(1500) + # + + # Assign IP addresses + setup_server $SOCKLOCAL shmif0 bus1 $local_ip/$prefixlen + setup_server $SOCKGATEWAY shmif0 bus1 $gateway_local_ip/$prefixlen + setup_server $SOCKGATEWAY shmif1 bus2 $gateway_remote_ip/$prefixlen + setup_server $SOCKREMOTE shmif0 bus2 $remote_ip/$prefixlen + + ### Setup gateway server + export RUMP_SERVER=$SOCKGATEWAY + + # Set MTU of shmif0 to 1280 + export RUMP_SERVER=$SOCKGATEWAY + atf_check -s exit:0 rump.ifconfig shmif0 mtu 1280 + + # Enable IPv6 forwarding + atf_check -s exit:0 rump.sysctl -w -q net.inet6.ip6.forwarding=1 + + ### Setup remote server + export RUMP_SERVER=$SOCKREMOTE + + # Start httpd daemon + prepare_download_file $HTML_FILE + start_httpd $SOCKREMOTE $remote_ip + $DEBUG && rump.netstat -a + + # Teach the peer that local serer is behind gateway server + atf_check -s exit:0 -o ignore \ + rump.route add -inet6 $local_ip/128 $gateway_remote_ip + + # Check path MTU size on remote server + atf_check -s exit:0 \ + -o match:"^$local_ip +$gateway_remote_ip +UGHS +- +- +- +shmif0" \ + rump.netstat -nr -f inet6 + + ### Setup local server + export RUMP_SERVER=$SOCKLOCAL + + # Teach the peer that remote serer is behind gateway server + atf_check -s exit:0 -o ignore \ + rump.route add -inet6 $remote_ip/128 $gateway_local_ip + + # Don't accept fragmented packets + atf_check -s exit:0 -o ignore \ + rump.sysctl -w -q net.inet6.ip6.maxfragpackets=0 + + # + # Test enabled path MTU discorvery + # + # Get the webpage (expect: success) + export RUMP_SERVER=$SOCKLOCAL + do_http_get $remote_ip 0 + $DEBUG && extract_new_packets bus2 > ./out + $DEBUG && cat ./out + + # Check path MTU size on remote server + export RUMP_SERVER=$SOCKREMOTE + atf_check -s exit:0 \ + -o match:"^$local_ip +$gateway_remote_ip +UGHS +- +- +1280 +shmif0" \ + rump.netstat -nr -f inet6 + + rump_server_destroy_ifaces +} + +mtudisc6_basic_cleanup() +{ + + $DEBUG && dump + stop_httpd + cleanup +} + +atf_init_test_cases() +{ + + atf_add_test_case mtudisc6_basic +} diff --git a/contrib/netbsd-tests/net/net/t_ping6_opts.sh b/contrib/netbsd-tests/net/net/t_ping6_opts.sh new file mode 100755 index 000000000000..e2e774e75783 --- /dev/null +++ b/contrib/netbsd-tests/net/net/t_ping6_opts.sh @@ -0,0 +1,380 @@ +# $NetBSD: t_ping6_opts.sh,v 1.8 2016/11/25 08:51:17 ozaki-r Exp $ +# +# Copyright (c) 2016 Internet Initiative Japan Inc. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# + +SOCKSRC=unix://commsock1 +SOCKFWD=unix://commsock2 +SOCKDST=unix://commsock3 +IP6SRC=fc00:0:0:1::2 +IP6SRCGW=fc00:0:0:1::1 +IP6DSTGW=fc00:0:0:2::1 +IP6DST=fc00:0:0:2::2 +BUS_SRCGW=bus1 +BUS_DSTGW=bus2 + +IP6SRC2=fc00:0:0:1::3 +IP6SRCGW2=fc00:0:0:1::254 + +DEBUG=${DEBUG:-false} +TIMEOUT=1 + +# +# Utility functions +# +setup_endpoint() +{ + local sock=${1} + local addr=${2} + local bus=${3} + local gw=${4} + + rump_server_add_iface $sock shmif0 $bus + + export RUMP_SERVER=${sock} + atf_check -s exit:0 rump.ifconfig shmif0 inet6 ${addr} + atf_check -s exit:0 -o ignore rump.route add -inet6 default ${gw} + atf_check -s exit:0 rump.ifconfig shmif0 up + atf_check -s exit:0 rump.ifconfig -w 10 + + if $DEBUG; then + rump.ifconfig shmif0 + rump.netstat -nr + fi +} + +setup_forwarder() +{ + + rump_server_add_iface $SOCKFWD shmif0 $BUS_SRCGW + rump_server_add_iface $SOCKFWD shmif1 $BUS_DSTGW + + export RUMP_SERVER=$SOCKFWD + + atf_check -s exit:0 rump.ifconfig shmif0 inet6 ${IP6SRCGW} + atf_check -s exit:0 rump.ifconfig shmif1 inet6 ${IP6DSTGW} + + atf_check -s exit:0 rump.ifconfig shmif0 up + atf_check -s exit:0 rump.ifconfig shmif1 up + atf_check -s exit:0 rump.ifconfig -w 10 + + if $DEBUG; then + rump.netstat -nr + rump.sysctl net.inet6.ip6.forwarding + fi +} + +setup_forwarding6() +{ + export RUMP_SERVER=$SOCKFWD + atf_check -s exit:0 -o ignore rump.sysctl -w net.inet6.ip6.forwarding=1 +} + +setup6() +{ + + rump_server_start $SOCKSRC netinet6 + rump_server_start $SOCKFWD netinet6 + rump_server_start $SOCKDST netinet6 + + setup_endpoint $SOCKSRC $IP6SRC $BUS_SRCGW $IP6SRCGW + setup_endpoint $SOCKDST $IP6DST $BUS_DSTGW $IP6DSTGW + setup_forwarder +} + +check_echo_request_pkt() +{ + local pkt="$1 > $2: .+ echo request" + + extract_new_packets $BUS_SRCGW > ./out + $DEBUG && echo $pkt + $DEBUG && cat ./out + atf_check -s exit:0 -o match:"$pkt" cat ./out +} + +check_echo_request_pkt_with_macaddr() +{ + local pkt="$1 > $2, .+ $3 > $4: .+ echo request" + + extract_new_packets $BUS_SRCGW > ./out + $DEBUG && echo $pkt + $DEBUG && cat ./out + atf_check -s exit:0 -o match:"$pkt" cat ./out +} + +check_echo_request_pkt_with_macaddr_and_rthdr0() +{ + local pkt= + + pkt="$1 > $2, .+ $3 > $4:" + pkt="$pkt srcrt \\(len=2, type=0, segleft=1, \\[0\\]$5\\)" + pkt="$pkt .+ echo request" + + extract_new_packets $BUS_SRCGW > ./out + $DEBUG && echo $pkt + $DEBUG && cat ./out + atf_check -s exit:0 -o match:"$pkt" cat ./out +} + +# +# Tests +# +atf_test_case ping6_opts_sourceaddr cleanup +ping6_opts_sourceaddr_head() +{ + + atf_set "descr" "tests of ping6 -S option" + atf_set "require.progs" "rump_server" +} + +ping6_opts_sourceaddr_body() +{ + + setup6 + setup_forwarding6 + + export RUMP_SERVER=$SOCKSRC + atf_check -s exit:0 -o ignore rump.ping6 -n -c 1 -X $TIMEOUT $IP6DST + check_echo_request_pkt $IP6SRC $IP6DST + + atf_check -s exit:0 rump.ifconfig shmif0 inet6 $IP6SRC2 + atf_check -s exit:0 rump.ifconfig -w 10 + + atf_check -s exit:0 -o ignore rump.ping6 -n -c 1 -X $TIMEOUT $IP6DST + check_echo_request_pkt $IP6SRC $IP6DST + + # ping6 -S + atf_check -s exit:0 -o ignore rump.ping6 -n -c 1 -X $TIMEOUT \ + -S $IP6SRC $IP6DST + check_echo_request_pkt $IP6SRC $IP6DST + + atf_check -s exit:0 -o ignore rump.ping6 -n -c 1 -X $TIMEOUT \ + -S $IP6SRC2 $IP6DST + check_echo_request_pkt $IP6SRC2 $IP6DST + + rump_server_destroy_ifaces +} + +ping6_opts_sourceaddr_cleanup() +{ + + $DEBUG && dump + cleanup +} + +atf_test_case ping6_opts_interface cleanup +ping6_opts_interface_head() +{ + + atf_set "descr" "tests of ping6 -I option" + atf_set "require.progs" "rump_server" +} + +ping6_opts_interface_body() +{ + local shmif0_lladdr= + local shmif1_lladdr= + local gw_lladdr= + + setup6 + setup_forwarding6 + + shmif0_lladdr=$(get_linklocal_addr ${SOCKSRC} shmif0) + gw_lladdr=$(get_linklocal_addr ${SOCKFWD} shmif0) + + export RUMP_SERVER=$SOCKSRC + atf_check -s exit:0 -o ignore rump.ping6 -n -c 1 -X $TIMEOUT $gw_lladdr + check_echo_request_pkt $shmif0_lladdr $gw_lladdr + + rump_server_add_iface $SOCKSRC shmif1 $BUS_SRCGW + atf_check -s exit:0 rump.ifconfig shmif1 up + atf_check -s exit:0 rump.ifconfig -w 10 + shmif1_lladdr=$(get_linklocal_addr ${SOCKSRC} shmif1) + + atf_check -s exit:0 -o ignore rump.ping6 -n -c 1 -X $TIMEOUT $gw_lladdr + check_echo_request_pkt $shmif0_lladdr $gw_lladdr + + # ping6 -I + atf_check -s exit:0 -o ignore rump.ping6 -n -c 1 -X $TIMEOUT \ + -I shmif0 $gw_lladdr + check_echo_request_pkt $shmif0_lladdr $gw_lladdr + + atf_check -s exit:0 -o ignore rump.ping6 -n -c 1 -X $TIMEOUT \ + -I shmif1 $gw_lladdr + check_echo_request_pkt $shmif1_lladdr $gw_lladdr + + rump_server_destroy_ifaces +} + +ping6_opts_interface_cleanup() +{ + + $DEBUG && dump + cleanup +} + +atf_test_case ping6_opts_gateway cleanup +ping6_opts_gateway_head() +{ + + atf_set "descr" "tests of ping6 -g option" + atf_set "require.progs" "rump_server" +} + +ping6_opts_gateway_body() +{ + local my_macaddr= + local gw_shmif0_macaddr= + local gw_shmif2_macaddr= + + setup6 + setup_forwarding6 + + my_macaddr=$(get_macaddr ${SOCKSRC} shmif0) + gw_shmif0_macaddr=$(get_macaddr ${SOCKFWD} shmif0) + + export RUMP_SERVER=$SOCKSRC + atf_check -s exit:0 -o ignore rump.ping6 -n -c 1 -X $TIMEOUT $IP6DST + check_echo_request_pkt_with_macaddr \ + $my_macaddr $gw_shmif0_macaddr $IP6SRC $IP6DST + + rump_server_add_iface $SOCKFWD shmif2 $BUS_SRCGW + export RUMP_SERVER=$SOCKFWD + atf_check -s exit:0 rump.ifconfig shmif2 inet6 $IP6SRCGW2 + atf_check -s exit:0 rump.ifconfig -w 10 + gw_shmif2_macaddr=$(get_macaddr ${SOCKFWD} shmif2) + + export RUMP_SERVER=$SOCKSRC + atf_check -s exit:0 -o ignore rump.ping6 -n -c 1 -X $TIMEOUT $IP6DST + check_echo_request_pkt_with_macaddr \ + $my_macaddr $gw_shmif0_macaddr $IP6SRC $IP6DST + + # ping6 -g + atf_check -s exit:0 -o ignore rump.ping6 -n -c 1 -X $TIMEOUT \ + -g $IP6SRCGW $IP6DST + check_echo_request_pkt_with_macaddr \ + $my_macaddr $gw_shmif0_macaddr $IP6SRC $IP6DST + + atf_check -s exit:0 -o ignore rump.ping6 -n -c 1 -X $TIMEOUT \ + -g $IP6SRCGW2 $IP6DST + check_echo_request_pkt_with_macaddr \ + $my_macaddr $gw_shmif2_macaddr $IP6SRC $IP6DST + + rump_server_destroy_ifaces +} + +ping6_opts_gateway_cleanup() +{ + + $DEBUG && dump + cleanup +} + +atf_test_case ping6_opts_hops cleanup +ping6_opts_hops_head() +{ + + atf_set "descr" "tests of ping6 hops (Type 0 Routing Header)" + atf_set "require.progs" "rump_server" +} + +ping6_opts_hops_body() +{ + local my_macaddr= + local gw_shmif0_macaddr= + local gw_shmif2_macaddr= + + setup6 + setup_forwarding6 + + my_macaddr=$(get_macaddr ${SOCKSRC} shmif0) + gw_shmif0_macaddr=$(get_macaddr ${SOCKFWD} shmif0) + + export RUMP_SERVER=$SOCKSRC + atf_check -s exit:0 -o ignore rump.ping6 -n -c 1 -X $TIMEOUT $IP6DST + check_echo_request_pkt_with_macaddr \ + $my_macaddr $gw_shmif0_macaddr $IP6SRC $IP6DST + + rump_server_add_iface $SOCKFWD shmif2 $BUS_SRCGW + export RUMP_SERVER=$SOCKFWD + atf_check -s exit:0 rump.ifconfig shmif2 inet6 $IP6SRCGW2 + atf_check -s exit:0 rump.ifconfig -w 10 + gw_shmif2_macaddr=$(get_macaddr ${SOCKFWD} shmif2) + + export RUMP_SERVER=$SOCKSRC + atf_check -s exit:0 -o ignore rump.ping6 -n -c 1 -X $TIMEOUT $IP6DST + check_echo_request_pkt_with_macaddr \ + $my_macaddr $gw_shmif0_macaddr $IP6SRC $IP6DST + + # ping6 hops + + # ping6 fails expectedly because the kernel doesn't support + # to receive packets with type 0 routing headers, but we can + # check whether a sent packet is correct. + atf_check -s not-exit:0 -o ignore rump.ping6 -n -c 1 -X $TIMEOUT \ + $IP6SRCGW $IP6DST + check_echo_request_pkt_with_macaddr_and_rthdr0 \ + $my_macaddr $gw_shmif0_macaddr $IP6SRC $IP6SRCGW $IP6DST + + atf_check -s not-exit:0 -o ignore rump.ping6 -n -c 1 -X $TIMEOUT \ + $IP6SRCGW2 $IP6DST + check_echo_request_pkt_with_macaddr_and_rthdr0 \ + $my_macaddr $gw_shmif2_macaddr $IP6SRC $IP6SRCGW2 $IP6DST + + # ping6 -g hops + atf_check -s not-exit:0 -o ignore rump.ping6 -n -c 1 -X $TIMEOUT \ + -g $IP6SRCGW $IP6SRCGW $IP6DST + check_echo_request_pkt_with_macaddr_and_rthdr0 \ + $my_macaddr $gw_shmif0_macaddr $IP6SRC $IP6SRCGW $IP6DST + + atf_check -s not-exit:0 -o ignore rump.ping6 -n -c 1 -X $TIMEOUT \ + -g $IP6SRCGW2 $IP6SRCGW2 $IP6DST + check_echo_request_pkt_with_macaddr_and_rthdr0 \ + $my_macaddr $gw_shmif2_macaddr $IP6SRC $IP6SRCGW2 $IP6DST + + # ping6 -g hops, but different nexthops (is it valid?) + atf_check -s not-exit:0 -o ignore rump.ping6 -n -c 1 -X $TIMEOUT \ + -g $IP6SRCGW $IP6SRCGW2 $IP6DST + check_echo_request_pkt_with_macaddr_and_rthdr0 \ + $my_macaddr $gw_shmif0_macaddr $IP6SRC $IP6SRCGW2 $IP6DST + + rump_server_destroy_ifaces +} + +ping6_opts_hops_cleanup() +{ + + $DEBUG && dump + cleanup +} + +atf_init_test_cases() +{ + + atf_add_test_case ping6_opts_sourceaddr + atf_add_test_case ping6_opts_interface + atf_add_test_case ping6_opts_gateway + atf_add_test_case ping6_opts_hops +} diff --git a/contrib/netbsd-tests/net/net_common.sh b/contrib/netbsd-tests/net/net_common.sh new file mode 100755 index 000000000000..df21a881ab5d --- /dev/null +++ b/contrib/netbsd-tests/net/net_common.sh @@ -0,0 +1,314 @@ +# $NetBSD: net_common.sh,v 1.11 2017/01/10 05:55:34 ozaki-r Exp $ +# +# Copyright (c) 2016 Internet Initiative Japan Inc. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# + +# +# Common utility functions for tests/net +# + +HIJACKING="env LD_PRELOAD=/usr/lib/librumphijack.so RUMPHIJACK=sysctl=yes" + +extract_new_packets() +{ + local bus=$1 + local old=./.__old + + if [ ! -f $old ]; then + old=/dev/null + fi + + shmif_dumpbus -p - $bus 2>/dev/null| \ + tcpdump -n -e -r - 2>/dev/null > ./.__new + diff -u $old ./.__new |grep '^+' |cut -d '+' -f 2 > ./.__diff + mv -f ./.__new ./.__old + cat ./.__diff +} + +check_route() +{ + local target=$1 + local gw=$2 + local flags=${3:-\.\+} + local ifname=${4:-\.\+} + + target=$(echo $target |sed 's/\./\\./g') + if [ "$gw" = "" ]; then + gw=".+" + else + gw=$(echo $gw |sed 's/\./\\./g') + fi + + atf_check -s exit:0 -e ignore \ + -o match:"^$target +$gw +$flags +- +- +.+ +$ifname" \ + rump.netstat -rn +} + +check_route_flags() +{ + + check_route "$1" "" "$2" "" +} + +check_route_gw() +{ + + check_route "$1" "$2" "" "" +} + +check_route_no_entry() +{ + local target=$(echo $1 |sed 's/\./\\./g') + + atf_check -s exit:0 -e ignore -o not-match:"^$target" \ + rump.netstat -rn +} + +get_linklocal_addr() +{ + + export RUMP_SERVER=${1} + rump.ifconfig ${2} inet6 | + awk "/fe80/ {sub(/%$2/, \"\"); sub(/\\/[0-9]*/, \"\"); print \$2;}" + unset RUMP_SERVER + + return 0 +} + +get_macaddr() +{ + + env RUMP_SERVER=${1} \ + rump.ifconfig ${2} |awk '/address/ {print $2;}' +} + +HTTPD_PID=./.__httpd.pid +start_httpd() +{ + local sock=$1 + local ip=$2 + local backup=$RUMP_SERVER + + export RUMP_SERVER=$sock + + # start httpd in daemon mode + atf_check -s exit:0 env LD_PRELOAD=/usr/lib/librumphijack.so \ + /usr/libexec/httpd -P $HTTPD_PID -i $ip -b -s $(pwd) + + export RUMP_SERVER=$backup + + sleep 3 +} + +stop_httpd() +{ + + if [ -f $HTTPD_PID ]; then + kill -9 $(cat $HTTPD_PID) + rm -f $HTTPD_PID + sleep 1 + fi +} + +BASIC_LIBS="-lrumpnet -lrumpnet_net -lrumpnet_netinet \ + -lrumpnet_shmif -lrumpdev" +FS_LIBS="$BASIC_LIBS -lrumpvfs -lrumpfs_ffs" + +# We cannot keep variables between test phases, so need to store in files +_rump_server_socks=./.__socks +_rump_server_ifaces=./.__ifaces +_rump_server_buses=./.__buses + +_rump_server_start_common() +{ + local sock=$1 + local libs= + + shift 1 + libs="$*" + + atf_check -s exit:0 rump_server $libs $sock + + echo $sock >> $_rump_server_socks + $DEBUG && cat $_rump_server_socks +} + +rump_server_start() +{ + local sock=$1 + local _libs= + local libs="$BASIC_LIBS" + + shift 1 + _libs="$*" + + for lib in $_libs; do + libs="$libs -lrumpnet_$lib" + done + + _rump_server_start_common $sock $libs + + return 0 +} + +rump_server_fs_start() +{ + local sock=$1 + local _libs= + local libs="$FS_LIBS" + + shift 1 + _libs="$*" + + for lib in $_libs; do + libs="$libs -lrumpnet_$lib" + done + + _rump_server_start_common $sock $libs + + return 0 +} + +rump_server_add_iface() +{ + local sock=$1 + local ifname=$2 + local bus=$3 + local backup=$RUMP_SERVER + + export RUMP_SERVER=$sock + atf_check -s exit:0 rump.ifconfig $ifname create + atf_check -s exit:0 rump.ifconfig $ifname linkstr $bus + export RUMP_SERVER=$backup + + echo $sock $ifname >> $_rump_server_ifaces + $DEBUG && cat $_rump_server_ifaces + + echo $bus >> $_rump_server_buses + cat $_rump_server_buses |sort -u >./.__tmp + mv -f ./.__tmp $_rump_server_buses + $DEBUG && cat $_rump_server_buses + + return 0 +} + +rump_server_destroy_ifaces() +{ + local backup=$RUMP_SERVER + + $DEBUG && cat $_rump_server_ifaces + + # Try to dump states before destroying interfaces + for sock in $(cat $_rump_server_socks); do + export RUMP_SERVER=$sock + atf_check -s exit:0 -o ignore rump.ifconfig + atf_check -s exit:0 -o ignore rump.netstat -nr + # XXX still need hijacking + atf_check -s exit:0 -o ignore $HIJACKING rump.netstat -i -a + atf_check -s exit:0 -o ignore rump.arp -na + atf_check -s exit:0 -o ignore rump.ndp -na + atf_check -s exit:0 -o ignore $HIJACKING ifmcstat + done + + # XXX using pipe doesn't work. See PR bin/51667 + #cat $_rump_server_ifaces | while read sock ifname; do + while read sock ifname; do + export RUMP_SERVER=$sock + if rump.ifconfig -l |grep -q $ifname; then + atf_check -s exit:0 rump.ifconfig $ifname destroy + fi + atf_check -s exit:0 -o ignore rump.ifconfig + done < $_rump_server_ifaces + export RUMP_SERVER=$backup + + return 0 +} + +rump_server_halt_servers() +{ + local backup=$RUMP_SERVER + + $DEBUG && cat $_rump_server_socks + for sock in $(cat $_rump_server_socks); do + env RUMP_SERVER=$sock rump.halt + done + export RUMP_SERVER=$backup + + return 0 +} + +rump_server_dump_servers() +{ + local backup=$RUMP_SERVER + + $DEBUG && cat $_rump_server_socks + for sock in $(cat $_rump_server_socks); do + echo "### Dumping $sock" + export RUMP_SERVER=$sock + rump.ifconfig + rump.netstat -nr + # XXX still need hijacking + $HIJACKING rump.netstat -i -a + rump.arp -na + rump.ndp -na + $HIJACKING ifmcstat + $HIJACKING dmesg + done + export RUMP_SERVER=$backup + + if [ -f rump_server.core ]; then + gdb -ex bt /usr/bin/rump_server rump_server.core + strings rump_server.core |grep panic + fi + return 0 +} + +rump_server_dump_buses() +{ + + if [ ! -f $_rump_server_buses ]; then + return 0 + fi + + $DEBUG && cat $_rump_server_buses + for bus in $(cat $_rump_server_buses); do + echo "### Dumping $bus" + shmif_dumpbus -p - $bus 2>/dev/null| tcpdump -n -e -r - + done + return 0 +} + +cleanup() +{ + + rump_server_halt_servers +} + +dump() +{ + + rump_server_dump_servers + rump_server_dump_buses +} diff --git a/contrib/netbsd-tests/net/route/t_change.sh b/contrib/netbsd-tests/net/route/t_change.sh index 669c9f3baae7..260cad02d7bf 100755 --- a/contrib/netbsd-tests/net/route/t_change.sh +++ b/contrib/netbsd-tests/net/route/t_change.sh @@ -1,4 +1,4 @@ -# $NetBSD: t_change.sh,v 1.8 2016/08/10 23:00:39 roy Exp $ +# $NetBSD: t_change.sh,v 1.9 2016/11/07 05:25:37 ozaki-r Exp $ # # Copyright (c) 2011 The NetBSD Foundation, Inc. # All rights reserved. @@ -30,7 +30,7 @@ netserver=\ -lrumpnet_netinet -lrumpnet_shmif" export RUMP_SERVER=unix://commsock -DEBUG=false +DEBUG=${DEBUG:-false} atf_test_case route_change_reject2blackhole cleanup route_change_reject2blackhole_head() diff --git a/contrib/netbsd-tests/net/route/t_flags.sh b/contrib/netbsd-tests/net/route/t_flags.sh index 26625bbb899f..457e3f5bdd94 100755 --- a/contrib/netbsd-tests/net/route/t_flags.sh +++ b/contrib/netbsd-tests/net/route/t_flags.sh @@ -1,4 +1,4 @@ -# $NetBSD: t_flags.sh,v 1.11 2016/08/10 23:00:39 roy Exp $ +# $NetBSD: t_flags.sh,v 1.15 2016/12/21 02:46:08 ozaki-r Exp $ # # Copyright (c) 2015 The NetBSD Foundation, Inc. # All rights reserved. @@ -25,27 +25,24 @@ # POSSIBILITY OF SUCH DAMAGE. # -netserver=\ -"rump_server -lrumpdev -lrumpnet -lrumpnet_net -lrumpnet_netinet \ - -lrumpnet_shmif" SOCK_LOCAL=unix://commsock1 SOCK_PEER=unix://commsock2 SOCK_GW=unix://commsock3 BUS=bus1 BUS2=bus2 -DEBUG=false +DEBUG=${DEBUG:-false} setup_local() { - atf_check -s exit:0 ${netserver} ${SOCK_LOCAL} + rump_server_start $SOCK_LOCAL + rump_server_add_iface $SOCK_LOCAL shmif0 $BUS export RUMP_SERVER=$SOCK_LOCAL - atf_check -s exit:0 -o ignore rump.ifconfig shmif0 create - atf_check -s exit:0 -o ignore rump.ifconfig shmif0 linkstr ${BUS} atf_check -s exit:0 -o ignore rump.ifconfig shmif0 10.0.0.2/24 atf_check -s exit:0 -o ignore rump.ifconfig shmif0 up + atf_check -s exit:0 -o ignore rump.ifconfig -w 10 $DEBUG && rump.ifconfig $DEBUG && rump.netstat -rn -f inet @@ -54,13 +51,13 @@ setup_local() setup_peer() { - atf_check -s exit:0 ${netserver} ${SOCK_PEER} + rump_server_start $SOCK_PEER + rump_server_add_iface $SOCK_PEER shmif0 $BUS export RUMP_SERVER=$SOCK_PEER - atf_check -s exit:0 -o ignore rump.ifconfig shmif0 create - atf_check -s exit:0 -o ignore rump.ifconfig shmif0 linkstr ${BUS} atf_check -s exit:0 -o ignore rump.ifconfig shmif0 10.0.0.1/24 atf_check -s exit:0 -o ignore rump.ifconfig shmif0 up + atf_check -s exit:0 -o ignore rump.ifconfig -w 10 $DEBUG && rump.ifconfig $DEBUG && rump.netstat -rn -f inet @@ -69,16 +66,14 @@ setup_peer() setup_gw() { - atf_check -s exit:0 ${netserver} ${SOCK_GW} + rump_server_start $SOCK_GW + rump_server_add_iface $SOCK_GW shmif0 $BUS + rump_server_add_iface $SOCK_GW shmif1 $BUS2 export RUMP_SERVER=$SOCK_GW - atf_check -s exit:0 -o ignore rump.ifconfig shmif0 create - atf_check -s exit:0 -o ignore rump.ifconfig shmif0 linkstr ${BUS} atf_check -s exit:0 -o ignore rump.ifconfig shmif0 10.0.0.254/24 atf_check -s exit:0 -o ignore rump.ifconfig shmif0 up - atf_check -s exit:0 -o ignore rump.ifconfig shmif1 create - atf_check -s exit:0 -o ignore rump.ifconfig shmif1 linkstr ${BUS2} atf_check -s exit:0 -o ignore rump.ifconfig shmif1 10.0.2.1/24 atf_check -s exit:0 -o ignore rump.ifconfig shmif1 alias 10.0.2.2/24 atf_check -s exit:0 -o ignore rump.ifconfig shmif1 up @@ -91,46 +86,13 @@ setup_gw() $DEBUG && rump.netstat -rn -f inet } -teardown_gw() -{ - - env RUMP_SERVER=$SOCK_GW rump.halt -} - -check_entry_flags() -{ - local ip=$(echo $1 |sed 's/\./\\./g') - local flags=$2 - - atf_check -s exit:0 -o match:" $flags " -e ignore -x \ - "rump.netstat -rn -f inet | grep ^'$ip'" -} - -check_entry_gw() -{ - local ip=$(echo $1 |sed 's/\./\\./g') - local gw=$2 - - atf_check -s exit:0 -o match:" $gw " -e ignore -x \ - "rump.netstat -rn -f inet | grep ^'$ip'" -} - -check_entry_fail() -{ - ip=$(echo $1 |sed 's/\./\\./g') - flags=$2 # Not used currently - - atf_check -s not-exit:0 -e ignore -x \ - "rump.netstat -rn -f inet | grep ^'$ip'" -} - test_lo() { export RUMP_SERVER=$SOCK_LOCAL # Up, Host, local - check_entry_flags 127.0.0.1 UHl + check_route_flags 127.0.0.1 UHl } test_connected() @@ -139,10 +101,10 @@ test_connected() export RUMP_SERVER=$SOCK_LOCAL # Up, Host, LLINFO, local - check_entry_flags 10.0.0.2 UHl + check_route_flags 10.0.0.2 UHl # Up, Cloning - check_entry_flags 10.0.0/24 UC + check_route_flags 10.0.0/24 UC } test_default_gateway() @@ -154,7 +116,7 @@ test_default_gateway() $DEBUG && rump.netstat -rn -f inet # Up, Gateway, Static - check_entry_flags default UGS + check_route_flags default UGS } test_static() @@ -167,14 +129,14 @@ test_static() $DEBUG && rump.netstat -rn -f inet # Up, Gateway, Host, Static - check_entry_flags 10.0.1.1 UGHS + check_route_flags 10.0.1.1 UGHS # Static route to network atf_check -s exit:0 -o ignore rump.route add -net 10.0.2.0/24 10.0.0.1 $DEBUG && rump.netstat -rn -f inet # Up, Gateway, Static - check_entry_flags 10.0.2/24 UGS + check_route_flags 10.0.2/24 UGS } test_blackhole() @@ -193,14 +155,14 @@ test_blackhole() $DEBUG && rump.netstat -rn -f inet # Up, Gateway, Blackhole, Static - check_entry_flags 10.0.0/24 UGBS + check_route_flags 10.0.0/24 UGBS atf_check -s not-exit:0 -o match:'100.0% packet loss' \ rump.ping -n -w 1 -c 1 10.0.0.1 $DEBUG && rump.netstat -rn -f inet # Shouldn't be created - check_entry_fail 10.0.0.1 UH + check_route_no_entry 10.0.0.1 } test_reject() @@ -215,14 +177,14 @@ test_reject() $DEBUG && rump.netstat -rn -f inet # Up, Gateway, Reject, Static - check_entry_flags 10.0.0/24 UGRS + check_route_flags 10.0.0/24 UGRS atf_check -s not-exit:0 -o ignore -e match:'No route to host' \ rump.ping -n -w 1 -c 1 10.0.0.1 $DEBUG && rump.netstat -rn -f inet # Shouldn't be created - check_entry_fail 10.0.0.1 UH + check_route_no_entry 10.0.0.1 # Gateway is lo0 (RTF_GATEWAY) @@ -234,14 +196,14 @@ test_reject() $DEBUG && rump.netstat -rn -f inet # Up, Gateway, Reject, Static - check_entry_flags 10.0.0/24 UGRS + check_route_flags 10.0.0/24 UGRS atf_check -s not-exit:0 -o ignore -e match:'Network is unreachable' \ rump.ping -n -w 1 -c 1 10.0.0.1 $DEBUG && rump.netstat -rn -f inet # Shouldn't be created - check_entry_fail 10.0.0.1 UH + check_route_no_entry 10.0.0.1 # Gateway is lo0 (RTF_HOST) @@ -253,7 +215,7 @@ test_reject() $DEBUG && rump.netstat -rn -f inet # Up, Host, Reject, Static - check_entry_flags 10.0.0.1 UHRS + check_route_flags 10.0.0.1 UHRS atf_check -s not-exit:0 -o ignore -e match:'No route to host' \ rump.ping -n -w 1 -c 1 10.0.0.1 @@ -278,7 +240,7 @@ test_icmp_redirect() export RUMP_SERVER=$SOCK_PEER atf_check -s exit:0 -o ignore rump.route add -net 10.0.2.0/24 10.0.0.254 # Up, Gateway, Static - check_entry_flags 10.0.2/24 UGS + check_route_flags 10.0.2/24 UGS # # Setup the default gateway to the peer, 10.0.0.1 @@ -286,15 +248,15 @@ test_icmp_redirect() export RUMP_SERVER=$SOCK_LOCAL atf_check -s exit:0 -o ignore rump.route add default 10.0.0.1 # Up, Gateway, Static - check_entry_flags default UGS + check_route_flags default UGS # Try ping 10.0.2.1 atf_check -s exit:0 -o ignore rump.ping -n -w 1 -c 1 10.0.2.1 $DEBUG && rump.netstat -rn -f inet # Up, Gateway, Host, Dynamic - check_entry_flags 10.0.2.1 UGHD - check_entry_gw 10.0.2.1 10.0.0.254 + check_route_flags 10.0.2.1 UGHD + check_route_gw 10.0.2.1 10.0.0.254 export RUMP_SERVER=$SOCK_PEER $DEBUG && rump.netstat -rn -f inet @@ -307,18 +269,16 @@ test_icmp_redirect() export RUMP_SERVER=$SOCK_LOCAL atf_check -s exit:0 -o ignore rump.route add 10.0.2.2 10.0.0.1 # Up, Gateway, Host, Static - check_entry_flags 10.0.2.2 UGHS - check_entry_gw 10.0.2.2 10.0.0.1 + check_route_flags 10.0.2.2 UGHS + check_route_gw 10.0.2.2 10.0.0.1 # Try ping 10.0.2.2 atf_check -s exit:0 -o ignore rump.ping -n -w 1 -c 1 10.0.2.2 $DEBUG && rump.netstat -rn -f inet # Up, Gateway, Host, Modified, Static - check_entry_flags 10.0.2.2 UGHMS - check_entry_gw 10.0.2.2 10.0.0.254 - - teardown_gw + check_route_flags 10.0.2.2 UGHMS + check_route_gw 10.0.2.2 10.0.0.254 } test_announce() @@ -332,19 +292,11 @@ test_announce() $DEBUG && rump.netstat -rn -f inet # Up, Gateway, Static, proxy - check_entry_flags 10.0.0/24 UGSp + check_route_flags 10.0.0/24 UGSp # TODO test its behavior } -cleanup() -{ - $DEBUG && /usr/bin/shmif_dumpbus -p - $BUS 2>/dev/null | \ - /usr/sbin/tcpdump -n -e -r - - env RUMP_SERVER=$SOCK_LOCAL rump.halt - env RUMP_SERVER=$SOCK_PEER rump.halt -} - add_test() { local name=$1 @@ -359,8 +311,10 @@ add_test() setup_local; \ setup_peer; \ test_${name}; \ + rump_server_destroy_ifaces; \ }; \ route_flags_${name}_cleanup() { \ + $DEBUG && dump; \ cleanup; \ }" atf_add_test_case "route_flags_${name}" diff --git a/contrib/netbsd-tests/net/route/t_flags6.sh b/contrib/netbsd-tests/net/route/t_flags6.sh index 20b800e57ba2..e5708296b7bf 100755 --- a/contrib/netbsd-tests/net/route/t_flags6.sh +++ b/contrib/netbsd-tests/net/route/t_flags6.sh @@ -1,4 +1,4 @@ -# $NetBSD: t_flags6.sh,v 1.7 2016/08/10 23:00:39 roy Exp $ +# $NetBSD: t_flags6.sh,v 1.12 2016/12/21 02:46:08 ozaki-r Exp $ # # Copyright (c) 2016 Internet Initiative Japan Inc. # All rights reserved. @@ -25,9 +25,6 @@ # POSSIBILITY OF SUCH DAMAGE. # -RUMP_OPTS="-lrumpdev -lrumpnet -lrumpnet_net" -RUMP_OPTS="$RUMP_OPTS -lrumpnet_netinet -lrumpnet_netinet6" -RUMP_OPTS="$RUMP_OPTS -lrumpnet_shmif" SOCK_LOCAL=unix://commsock1 SOCK_PEER=unix://commsock2 SOCK_GW=unix://commsock3 @@ -37,18 +34,18 @@ BUS2=bus2 IP6_LOCAL=fc00::2 IP6_PEER=fc00::1 -DEBUG=false +DEBUG=${DEBUG:-false} setup_local() { - atf_check -s exit:0 rump_server ${RUMP_OPTS} ${SOCK_LOCAL} + rump_server_start $SOCK_LOCAL netinet6 + rump_server_add_iface $SOCK_LOCAL shmif0 $BUS export RUMP_SERVER=$SOCK_LOCAL - atf_check -s exit:0 -o ignore rump.ifconfig shmif0 create - atf_check -s exit:0 -o ignore rump.ifconfig shmif0 linkstr ${BUS} atf_check -s exit:0 -o ignore rump.ifconfig shmif0 inet6 $IP6_LOCAL atf_check -s exit:0 -o ignore rump.ifconfig shmif0 up + atf_check -s exit:0 -o ignore rump.ifconfig -w 10 $DEBUG && rump.ifconfig $DEBUG && rump.netstat -rn -f inet6 @@ -57,55 +54,28 @@ setup_local() setup_peer() { - atf_check -s exit:0 rump_server ${RUMP_OPTS} ${SOCK_PEER} + rump_server_start $SOCK_PEER netinet6 + rump_server_add_iface $SOCK_PEER shmif0 $BUS export RUMP_SERVER=$SOCK_PEER - atf_check -s exit:0 -o ignore rump.ifconfig shmif0 create - atf_check -s exit:0 -o ignore rump.ifconfig shmif0 linkstr ${BUS} atf_check -s exit:0 -o ignore rump.ifconfig shmif0 inet6 $IP6_PEER atf_check -s exit:0 -o ignore rump.ifconfig shmif0 up + atf_check -s exit:0 -o ignore rump.ifconfig -w 10 $DEBUG && rump.ifconfig $DEBUG && rump.netstat -rn -f inet6 } -check_entry_flags() -{ - local ip=$(echo $1 |sed 's/\./\\./g') - local flags=$2 - - atf_check -s exit:0 -o match:" $flags " -e ignore -x \ - "rump.netstat -rn -f inet6 | grep ^'$ip'" -} - -check_entry_gw() -{ - local ip=$(echo $1 |sed 's/\./\\./g') - local gw=$2 - - atf_check -s exit:0 -o match:" $gw " -e ignore -x \ - "rump.netstat -rn -f inet6 | grep ^'$ip'" -} - -check_entry_fail() -{ - ip=$(echo $1 |sed 's/\./\\./g') - flags=$2 # Not used currently - - atf_check -s not-exit:0 -e ignore -x \ - "rump.netstat -rn -f inet6 | grep ^'$ip'" -} - test_lo6() { export RUMP_SERVER=$SOCK_LOCAL # Up, Host, local - check_entry_flags fe80::1 UHl + check_route_flags fe80::1 UHl - # Up, Host - check_entry_flags ::1 UH + # Up, Host, local + check_route_flags ::1 UHl } test_connected6() @@ -114,10 +84,10 @@ test_connected6() export RUMP_SERVER=$SOCK_LOCAL # Up, Host, local - check_entry_flags $IP6_LOCAL UHl + check_route_flags $IP6_LOCAL UHl # Up, Connected - check_entry_flags fc00::/64 UC + check_route_flags fc00::/64 UC } test_default_gateway6() @@ -129,7 +99,7 @@ test_default_gateway6() $DEBUG && rump.netstat -rn -f inet6 # Up, Gateway, Static - check_entry_flags default UGS + check_route_flags default UGS } test_static6() @@ -143,7 +113,7 @@ test_static6() $DEBUG && rump.netstat -rn -f inet6 # Up, Gateway, Host, Static - check_entry_flags fc00::1:1 UGHS + check_route_flags fc00::1:1 UGHS # Static route to network atf_check -s exit:0 -o ignore \ @@ -151,7 +121,7 @@ test_static6() $DEBUG && rump.netstat -rn -f inet6 # Up, Gateway, Static - check_entry_flags fc00::/24 UGS + check_route_flags fc00::/24 UGS } test_blackhole6() @@ -171,14 +141,14 @@ test_blackhole6() $DEBUG && rump.netstat -rn -f inet6 # Up, Gateway, Blackhole, Static - check_entry_flags fc00::/64 UGBS + check_route_flags fc00::/64 UGBS atf_check -s not-exit:0 -o match:'100.0% packet loss' \ rump.ping6 -n -X 1 -c 1 $IP6_PEER $DEBUG && rump.netstat -rn -f inet6 # Shouldn't be created - check_entry_fail $IP6_PEER UH + check_route_no_entry $IP6_PEER } test_reject6() @@ -195,14 +165,14 @@ test_reject6() $DEBUG && rump.netstat -rn -f inet6 # Up, Gateway, Reject, Static - check_entry_flags fc00::/64 UGRS + check_route_flags fc00::/64 UGRS atf_check -s not-exit:0 -o ignore -e match:'No route to host' \ rump.ping6 -n -X 1 -c 1 $IP6_PEER $DEBUG && rump.netstat -rn -f inet6 # Shouldn't be created - check_entry_fail $IP6_PEER UH + check_route_no_entry $IP6_PEER # Gateway is lo0 (RTF_GATEWAY) @@ -215,14 +185,14 @@ test_reject6() $DEBUG && rump.netstat -rn -f inet6 # Up, Gateway, Reject, Static - check_entry_flags fc00::/64 UGRS + check_route_flags fc00::/64 UGRS atf_check -s not-exit:0 -o ignore -e match:'Network is unreachable' \ rump.ping6 -n -X 1 -c 1 $IP6_PEER $DEBUG && rump.netstat -rn -f inet6 # Shouldn't be created - check_entry_fail $IP6_PEER UH + check_route_no_entry $IP6_PEER # Gateway is lo0 (RTF_HOST) @@ -235,7 +205,7 @@ test_reject6() $DEBUG && rump.netstat -rn -f inet6 # Up, Host, Reject, Static - check_entry_flags fc00:: UHRS + check_route_flags fc00:: UHRS atf_check -s not-exit:0 -o ignore -e match:'No route to host' \ rump.ping6 -n -X 1 -c 1 $IP6_PEER @@ -257,19 +227,11 @@ test_announce6() $DEBUG && rump.netstat -rn -f inet6 # Up, Gateway, Static, proxy - check_entry_flags fc00::/64 UGSp + check_route_flags fc00::/64 UGSp # TODO test its behavior } -cleanup() -{ - $DEBUG && /usr/bin/shmif_dumpbus -p - $BUS 2>/dev/null | \ - /usr/sbin/tcpdump -n -e -r - - env RUMP_SERVER=$SOCK_LOCAL rump.halt - env RUMP_SERVER=$SOCK_PEER rump.halt -} - add_test() { local name=$1 @@ -284,8 +246,10 @@ add_test() setup_local; \ setup_peer; \ test_${name}; \ + rump_server_destroy_ifaces; \ }; \ route_flags_${name}_cleanup() { \ + $DEBUG && dump; \ cleanup; \ }" atf_add_test_case "route_flags_${name}" diff --git a/contrib/netbsd-tests/net/route/t_route.sh b/contrib/netbsd-tests/net/route/t_route.sh index 37ede4cec7b7..053f48f7286e 100755 --- a/contrib/netbsd-tests/net/route/t_route.sh +++ b/contrib/netbsd-tests/net/route/t_route.sh @@ -1,4 +1,4 @@ -# $NetBSD: t_route.sh,v 1.7 2016/08/10 23:00:39 roy Exp $ +# $NetBSD: t_route.sh,v 1.10 2016/12/21 02:46:08 ozaki-r Exp $ # # Copyright (c) 2016 Internet Initiative Japan Inc. # All rights reserved. @@ -25,9 +25,6 @@ # POSSIBILITY OF SUCH DAMAGE. # -RUMP_LIBS="-lrumpdev -lrumpnet -lrumpnet_net -lrumpnet_netinet -lrumpnet_shmif" -RUMP_LIBS_IPV6="$RUMP_LIBS -lrumpnet_netinet6" - # non_subnet_gateway SOCK_CLIENT=unix://commsock1 SOCK_GW=unix://commsock2 @@ -49,7 +46,7 @@ IP6DST=fc00:0:0:2::2 BUS_SRCGW=bus1 BUS_DSTGW=bus2 -DEBUG=false +DEBUG=${DEBUG:-false} TIMEOUT=1 PING_OPTS="-n -c 1 -w $TIMEOUT" @@ -64,13 +61,11 @@ route_non_subnet_gateway_head() route_non_subnet_gateway_body() { - atf_check -s exit:0 rump_server ${RUMP_LIBS} ${SOCK_CLIENT} - atf_check -s exit:0 rump_server ${RUMP_LIBS} ${SOCK_GW} + rump_server_start $SOCK_CLIENT + rump_server_start $SOCK_GW export RUMP_SERVER=${SOCK_GW} - - atf_check -s exit:0 rump.ifconfig shmif0 create - atf_check -s exit:0 rump.ifconfig shmif0 linkstr $BUS + rump_server_add_iface $SOCK_GW shmif0 $BUS atf_check -s exit:0 rump.ifconfig shmif0 192.168.0.1 atf_check -s exit:0 rump.ifconfig shmif0 up @@ -81,11 +76,10 @@ route_non_subnet_gateway_body() $DEBUG && rump.netstat -nr -f inet export RUMP_SERVER=${SOCK_CLIENT} - - atf_check -s exit:0 rump.ifconfig shmif0 create - atf_check -s exit:0 rump.ifconfig shmif0 linkstr $BUS + rump_server_add_iface $SOCK_CLIENT shmif0 $BUS atf_check -s exit:0 rump.ifconfig shmif0 10.0.0.1/32 atf_check -s exit:0 rump.ifconfig shmif0 up + atf_check -s exit:0 rump.ifconfig -w 10 $DEBUG && rump.netstat -nr -f inet @@ -104,15 +98,14 @@ route_non_subnet_gateway_body() # Be reachable to the gateway atf_check -s exit:0 -o ignore rump.ping $PING_OPTS 192.168.0.1 - unset RUMP_SERVER + rump_server_destroy_ifaces } route_non_subnet_gateway_cleanup() { - $DEBUG && shmif_dumpbus -p - $BUS 2>/dev/null | tcpdump -n -e -r - - env RUMP_SERVER=$SOCK_CLIENT rump.halt - env RUMP_SERVER=$SOCK_GW rump.halt + $DEBUG && dump + cleanup } atf_test_case route_command_get cleanup @@ -140,8 +133,7 @@ setup_endpoint() local gw=${5} export RUMP_SERVER=${sock} - atf_check -s exit:0 rump.ifconfig shmif0 create - atf_check -s exit:0 rump.ifconfig shmif0 linkstr ${bus} + rump_server_add_iface $sock shmif0 $bus if [ $mode = "ipv6" ]; then atf_check -s exit:0 rump.ifconfig shmif0 inet6 ${addr} atf_check -s exit:0 -o ignore rump.route add -inet6 default ${gw} @@ -150,6 +142,7 @@ setup_endpoint() atf_check -s exit:0 -o ignore rump.route add default ${gw} fi atf_check -s exit:0 rump.ifconfig shmif0 up + atf_check -s exit:0 rump.ifconfig -w 10 if $DEBUG; then rump.ifconfig shmif0 @@ -161,13 +154,10 @@ setup_forwarder() { mode=${1} + rump_server_add_iface $SOCKFWD shmif0 $BUS_SRCGW + rump_server_add_iface $SOCKFWD shmif1 $BUS_DSTGW + export RUMP_SERVER=$SOCKFWD - atf_check -s exit:0 rump.ifconfig shmif0 create - atf_check -s exit:0 rump.ifconfig shmif0 linkstr $BUS_SRCGW - - atf_check -s exit:0 rump.ifconfig shmif1 create - atf_check -s exit:0 rump.ifconfig shmif1 linkstr $BUS_DSTGW - if [ $mode = "ipv6" ]; then atf_check -s exit:0 rump.ifconfig shmif0 inet6 ${IP6SRCGW} atf_check -s exit:0 rump.ifconfig shmif1 inet6 ${IP6DSTGW} @@ -178,6 +168,7 @@ setup_forwarder() atf_check -s exit:0 rump.ifconfig shmif0 up atf_check -s exit:0 rump.ifconfig shmif1 up + atf_check -s exit:0 rump.ifconfig -w 10 if $DEBUG; then rump.netstat -nr @@ -204,9 +195,9 @@ setup_forwarding6() setup() { - atf_check -s exit:0 rump_server $RUMP_LIBS $SOCKSRC - atf_check -s exit:0 rump_server $RUMP_LIBS $SOCKFWD - atf_check -s exit:0 rump_server $RUMP_LIBS $SOCKDST + rump_server_start $SOCKSRC + rump_server_start $SOCKFWD + rump_server_start $SOCKDST setup_endpoint $SOCKSRC $IP4SRC $BUS_SRCGW ipv4 $IP4SRCGW setup_endpoint $SOCKDST $IP4DST $BUS_DSTGW ipv4 $IP4DSTGW @@ -216,9 +207,9 @@ setup() setup6() { - atf_check -s exit:0 rump_server $RUMP_LIBS_IPV6 $SOCKSRC - atf_check -s exit:0 rump_server $RUMP_LIBS_IPV6 $SOCKFWD - atf_check -s exit:0 rump_server $RUMP_LIBS_IPV6 $SOCKDST + rump_server_start $SOCKSRC netinet6 + rump_server_start $SOCKFWD netinet6 + rump_server_start $SOCKDST netinet6 setup_endpoint $SOCKSRC $IP6SRC $BUS_SRCGW ipv6 $IP6SRCGW setup_endpoint $SOCKDST $IP6DST $BUS_DSTGW ipv6 $IP6DSTGW @@ -380,6 +371,7 @@ route_command_get_body() setup setup_forwarding test_route_get + rump_server_destroy_ifaces } route_command_get6_body() @@ -388,36 +380,20 @@ route_command_get6_body() setup6 setup_forwarding6 test_route_get6 -} - -dump() -{ - - env RUMP_SERVER=$SOCKSRC rump.netstat -nr - env RUMP_SERVER=$SOCKFWD rump.netstat -nr - env RUMP_SERVER=$SOCKDST rump.netstat -nr - - shmif_dumpbus -p - bus1 2>/dev/null| tcpdump -n -e -r - - shmif_dumpbus -p - bus2 2>/dev/null| tcpdump -n -e -r - -} - -cleanup() -{ - - env RUMP_SERVER=$SOCKSRC rump.halt - env RUMP_SERVER=$SOCKFWD rump.halt - env RUMP_SERVER=$SOCKDST rump.halt + rump_server_destroy_ifaces } route_command_get_cleanup() { + $DEBUG && dump cleanup } route_command_get6_cleanup() { - dump + + $DEBUG && dump cleanup } diff --git a/contrib/netbsd-tests/rump/modautoload/t_modautoload.c b/contrib/netbsd-tests/rump/modautoload/t_modautoload.c index b73e52a2963b..2c21a90b664b 100644 --- a/contrib/netbsd-tests/rump/modautoload/t_modautoload.c +++ b/contrib/netbsd-tests/rump/modautoload/t_modautoload.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_modautoload.c,v 1.4 2015/12/27 08:21:44 pgoyette Exp $ */ +/* $NetBSD: t_modautoload.c,v 1.5 2016/09/14 03:19:11 ozaki-r Exp $ */ #include #include @@ -46,6 +46,7 @@ mountkernfs(void) atf_tc_fail_errno("mkdir /kern"); new_autoload = true; + old_len = sizeof(old_autoload); new_len = sizeof(new_autoload); error = sysctlbyname("kern.module.autoload", &old_autoload, &old_len, diff --git a/contrib/netbsd-tests/rump/rumpkern/t_lwproc.c b/contrib/netbsd-tests/rump/rumpkern/t_lwproc.c index d4eee3a6119a..6e78d0219e2b 100644 --- a/contrib/netbsd-tests/rump/rumpkern/t_lwproc.c +++ b/contrib/netbsd-tests/rump/rumpkern/t_lwproc.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_lwproc.c,v 1.7 2015/01/21 15:19:01 pooka Exp $ */ +/* $NetBSD: t_lwproc.c,v 1.8 2017/01/10 22:36:29 christos Exp $ */ /* * Copyright (c) 2010 The NetBSD Foundation, Inc. @@ -29,6 +29,7 @@ #include #include +#include #include #include diff --git a/contrib/netbsd-tests/sys/net/t_print.c b/contrib/netbsd-tests/sys/net/t_print.c index 0aaeb3070f98..ff178952a90d 100644 --- a/contrib/netbsd-tests/sys/net/t_print.c +++ b/contrib/netbsd-tests/sys/net/t_print.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_print.c,v 1.1 2014/12/02 19:48:21 christos Exp $ */ +/* $NetBSD: t_print.c,v 1.2 2016/08/27 11:30:49 christos Exp $ */ /*- * Copyright (c) 2014 The NetBSD Foundation, Inc. @@ -29,7 +29,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include -__RCSID("$NetBSD: t_print.c,v 1.1 2014/12/02 19:48:21 christos Exp $"); +__RCSID("$NetBSD: t_print.c,v 1.2 2016/08/27 11:30:49 christos Exp $"); #include "net/dl_print.c" @@ -147,7 +147,10 @@ ATF_TC_BODY(sdl_print, tc) memcpy(&sdl.sdl_addr, &tst[i].ia, sizeof(sdl.sdl_addr)); sdl.sdl_index = (uint16_t)i; r = sdl_print(buf, l, &sdl); - e = snprintf(res, l, "[%s]:%zu", tst[i].str, i); + if (i == 3) + e = snprintf(res, l, "link#%zu", i); + else + e = snprintf(res, l, "[%s]:%zu", tst[i].str, i); ATF_REQUIRE_STREQ(buf, res); ATF_REQUIRE_EQ(r, e); } @@ -157,7 +160,10 @@ ATF_TC_BODY(sdl_print, tc) memcpy(&sdl.sdl_addr, &tst[i].ia, sizeof(sdl.sdl_addr)); sdl.sdl_index = (uint16_t)i; r = sdl_print(buf, l, &sdl); - e = snprintf(res, l, "[%s]:%zu", tst[i].str, i); + if (i == 3) + e = snprintf(res, l, "link#%zu", i); + else + e = snprintf(res, l, "[%s]:%zu", tst[i].str, i); ATF_REQUIRE_STREQ(buf, res); ATF_REQUIRE_EQ(r, e); } diff --git a/contrib/netbsd-tests/usr.bin/config/t_config.sh b/contrib/netbsd-tests/usr.bin/config/t_config.sh index 8a8079c6a814..55af069f5afd 100755 --- a/contrib/netbsd-tests/usr.bin/config/t_config.sh +++ b/contrib/netbsd-tests/usr.bin/config/t_config.sh @@ -1,4 +1,4 @@ -# $NetBSD: t_config.sh,v 1.7 2015/10/04 07:59:47 uebayasi Exp $ +# $NetBSD: t_config.sh,v 1.8 2016/08/27 12:08:14 christos Exp $ # # Copyright (c) 2008, 2010 The NetBSD Foundation, Inc. # All rights reserved. @@ -25,12 +25,32 @@ # POSSIBILITY OF SUCH DAMAGE. # +srcdir=.. +merge_backslash() +{ + sed ' +: again +/\\$/ { + N + s/\\\n// + t again +} +' "$1" +} run_and_check_prep() { local name="${1}"; shift - mkdir compile - supportdir="$(atf_get_srcdir)/support" + mkdir -p compile + srcdir="$(atf_get_srcdir)" + if [ ! -d "${srcdir}/support" ]; then + srcdir="$(dirname "${srcdir}")" + if [ ! -d "${srcdir}/support" ]; then + atf_fail "bad source directory ${srcdir}" + exit 1 + fi + fi + supportdir="${srcdir}/support" local config_str eval config_str=\$${name}_config_str @@ -38,7 +58,7 @@ run_and_check_prep() config="d_${name}" printf "$config_str" >"${config}" else - config="$(atf_get_srcdir)/d_${name}" + config="${srcdir}/d_${name}" fi } @@ -121,28 +141,28 @@ test_case deffs_redef fail "Checks that config doesn't allow a deffs to use" \ "the same name as a previous defflag/defparam" # Selecting an undefined option. -undefined_opt_config_str=' -include "../d_min" +undefined_opt_config_str=" +include \"${srcdir}/d_min\" options UNDEFINED -' +" test_case undefined_opt pass \ "Checks that config allows a selection for an undefined options" # Negating an undefined option. -no_undefined_opt_config_str=' -include "../d_min" +no_undefined_opt_config_str=" +include \"${srcdir}/d_min\" no options UNDEFINED -' +" no_undefined_opt_stderr='match:UNDEFINED' test_case no_undefined_opt warn \ "Checks that config allows a negation for an undefined options" # Attribute selection test_case select pass "Attribute selection" -select_config_str=' -include "../d_min" +select_config_str=" +include \"${srcdir}/d_min\" select c -' +" check_select() { local f=Makefile @@ -158,11 +178,11 @@ select_body() { # Attribute negation test_case no_select pass "Attribute negation" -no_select_config_str=' -include "../d_min" +no_select_config_str=" +include \"${srcdir}/d_min\" select c no select a -' +" check_no_select() { local f=Makefile @@ -181,10 +201,10 @@ no_select_body() { # Device instance test_case devi pass "Device instance" -devi_config_str=' -include "../d_min" +devi_config_str=" +include \"${srcdir}/d_min\" d0 at root -' +" check_devi() { local f=ioconf.c @@ -226,9 +246,7 @@ check_min_makefile() grep -q '^%' $f >tmp.template grep -q '^MACHINE=regress$' $f && - grep -q '^PARAM=-DMAXUSERS=4$' $f && - grep -q '^all: regress$' $f && - grep -q '^regress:' $f && + (merge_backslash $f | grep -q '^IDENT=[ ]*-DMAXUSERS="4"') && [ ! -s tmp.template ] && : } diff --git a/contrib/netbsd-tests/usr.bin/netpgpverify/t_netpgpverify.sh b/contrib/netbsd-tests/usr.bin/netpgpverify/t_netpgpverify.sh index 9c191160c7bf..2d532c0cb72d 100755 --- a/contrib/netbsd-tests/usr.bin/netpgpverify/t_netpgpverify.sh +++ b/contrib/netbsd-tests/usr.bin/netpgpverify/t_netpgpverify.sh @@ -1,6 +1,6 @@ #! /bin/sh -# $NetBSD: t_netpgpverify.sh,v 1.3 2016/06/01 06:39:11 agc Exp $ +# $NetBSD: t_netpgpverify.sh,v 1.4 2016/08/28 15:59:15 christos Exp $ # # Copyright (c) 2016 The NetBSD Foundation, Inc. @@ -525,7 +525,7 @@ StZtC+VbuN66pfHwsAIAAw== EOF uudecode << EOF begin-base64 644 NetBSD-6.0_hashes.asc.gz -H4sICAAAAAACA05ldEJTRC02LjBfaGFzaGVzLmFzYwDUvduOXceVpX3deoq87B8o +H4sICLYIw1cCA05ldEJTRC02LjBfaGFzaGVzLmFzYwDUvduOXceVpX3deoq87B8o y3E+NNDA7yqrXQZKsmHZQN8V4igTRYkCSVWV++n7G4tMcu9kZnJlSgW4SYsmM3fG ihUz5pxjRMzDr37Fr3/86ne//+bmj7/74823v//dN1/99ubrr7799je/+0rf+9UX /9ze/PV/3Hz7z7+xX/Drz39dN/vVy5ev/uPFD9/dvHhz027Gq+9/fLnerpuXL968 @@ -6708,223 +6708,223 @@ pL+3CVk1P6YRa9KiMyiRJWfnUcDul1ZuoxYIExVsxJTRktenJljvSqENKgZEXQQW BeCV0wUcL/W2jQwurZdliEKl2Ol1HS0Xpw+yNnd9qx0rSprqJhxbsLFvfQAi0aZN pTRGqo9C9qYTP8xFN3tCiDKUTNeRnoJ2u51wDl1ddeJgE/FtR7seraSeOo4asdKK bxwm6/orfaEf8K9bixVNVftP13/91f5hVoH4dzDUKrcQQIuRU4qxndLiRl+02mk/ -Bh1fXF4EQ/TgfzV3bl1CFcmXf+dT9Oss12jmyfusNQ8IXpBWQW21fZmVVxtEEBRB -Pv3s3ymwq6CoOsXfB221Fak8eU5kRuzIjNi7Vu0jbRwtMMQ4a+7dRjdho1Re1isd -jn4IRwv/dXIzoZ9ZKHiqm4BLHEZZrFxTLDkprfdCiDD1piSMKCchDGZXsyvSn4kg -l1ahU6K3Ynyb+S6ZNo1KSiiGAF2hsHMklKdnizClGkjiYD5q9lwTXjI2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/P +90+fPPzllzvzw/FjdD9c/+fNx/Gbn6//+lX7/BMfvjS3W3ny4vdP7z/76scv71xL +dz+5+8v9B789/+H6jY++8f/qD5/867tvf/v1vbvP4/Wv8r3nn62n//zhy2dPzZ1b +X//7s0dPv8wf/+fn8u+b8fntj3+pz679+HG4ux798uv2y7f3y70Pknn69cOfPv3h +obt/68EHd776bdz843n/6ZPtm4fzwW/XP37+6fNfvvnm2b343c/Xn4YX9vtrX3zz +2U+Pv3/85fxo3rz/9ffX/xjLfPPi92d/rJ8+eXr39+/urC/y9+/d/c+PH7XH1/+1 +nt6+c/uLfHM9fHAvXQ9ffPjztce3bt2xjx494P6s3Pn27vXfb/vb7bv1zdMb9vH2 +5Na/f/rnJy/K7x8+/+TO/burfPX8n/67B5+37x+/mA+++/Wzm9f+Yz//9tvf/C/x +0U3/6ON79Yu7f3ypiPC5+f7bh09vvBf79a/uvffVk5+efGDufdp+/fDZD7999/TO +i7r9/uzzX839G9duf5TN3X/a+3cf3Lz707I37j364vtfPv3xt3+t35W6Xe/6bfnx +/V/e++3x7Yc/fPHj7Wc3Xnx076MH6+GjP8rPX975+doH//7i+bOP/p3vv7jR4s9P +zQfun59tN756+tuzm7d+/DLdjvX6oxg+/Ohbc7/Gr/8I9cUq929/9MX12+3FXD9+ +cu36XXvj0zuPXPz9h9/6oz8++LLceTpvP/sgmE8e/7g9efLRk5u/vLiRf/rsl/DA +3X04f/vpAz9/efrTN0/lc9972q+ZB1/f//zZjU9a/P73p4+/IF15+OT2rVuf3r31 +3Yzxu/7Tg3L/0xeP37t+3z76z40H9sObn3//6EF58Um7/ezu7XvX4h/3fnh+45O7 +5fP5xwfmgf3mvV8/uvZ/H33yXT/ZJLc+v3neFvn/qZKFEe79DQA= ==== EOF gunzip NetBSD-6.0_hashes.asc.gz @@ -6958,18 +6958,15 @@ YzFlNiBiZjcxIDg4NDUgNDE2YiA5NTIyIDc5ZGUgYjYxZSA0ODhlIGVlNzQgCgo= EOF uudecode << EOF begin-base64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cmNyb29rcy5j +b20+CnVpZCAgICAgICAgICAgQWxpc3RhaXIgQ3Jvb2tzIDxhZ2NAcGtnc3JjLm9y +Zz4KdWlkICAgICAgICAgICBBbGlzdGFpciBDcm9va3MgPGFnY0BuZXRic2Qub3Jn +Pgp1aWQgICAgICAgICAgIEFsaXN0YWlyIENyb29rcyA8YWdjQG5ldGZsaXguY29t +PgoK ==== EOF uudecode << EOF @@ -6995,18 +6992,15 @@ aW5hcnkvdGV4dApiIGxlbmd0aApjIHN0cmluZwpMIG10aW1lCnRleHQK EOF uudecode << EOF begin-base64 644 expected21 -R29vZCBzaWduYXR1cmUgZm9yIFtzdGRpbl0gbWFkZSBTdW4gU2VwICA5IDE3OjQ0 -OjExIDIwMTIKc2lnbmF0dXJlICAyMDQ4L1JTQSAoRW5jcnlwdCBvciBTaWduKSAx -YjY4ZGNmY2MwNTk2ODIzIDIwMDQtMDEtMTIKZmluZ2VycHJpbnQ6ICBkNDE1IDlk -ZWIgMzM2ZCBlNGNjIGNkZmEgMDBjZCAxYjY4IGRjZmMgYzA1OSA2ODIzIAp1aWQg -ICAgICAgICAgICAgIEFsaXN0YWlyIENyb29rcyA8YWdjQGFsaXN0YWlyY3Jvb2tz -LmNvbT4KdWlkICAgICAgICAgICAgICBBbGlzdGFpciBDcm9va3MgPGFnY0Bwa2dz -cmMub3JnPgp1aWQgICAgICAgICAgICAgIEFsaXN0YWlyIENyb29rcyA8YWdjQG5l -dGJzZC5vcmc+CnVpZCAgICAgICAgICAgICAgQWxpc3RhaXIgQ3Jvb2tzIDxhZ2NA -bmV0ZmxpeC5jb20+CmVuY3J5cHRpb24gMjA0OC9SU0EgKEVuY3J5cHQgb3IgU2ln -bikgNzlkZWI2MWU0ODhlZWU3NCAyMDA0LTAxLTEyCmZpbmdlcnByaW50OiAgNTdj -MCBjMWU2IGJmNzEgODg0NSA0MTZiIDk1MjIgNzlkZSBiNjFlIDQ4OGUgZWU3NCAK -Cg== +R29vZCBzaWduYXR1cmUgZm9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YXNoIGFsZwpiIHB1YmtleSBhbGcKOGIga2V5aWQKCmxp +dGVyYWwgZGF0YSAodGFnIDExKQo9PT09PT09PT09PT09CmIgYmluYXJ5L3RleHQK +YiBsZW5ndGgKYyBzdHJpbmcKTCBtdGltZQp0ZXh0ClBST0c9cApTUkNTPXBhcnNl +LmMKV0FSTlM9NQpNS01BTj1ubwpDUFBGTEFHUys9LWcgLU8wCkxERkxBR1MrPS1n +IC1PMAoKLmluY2x1ZGUgPGJzZC5wcm9nLm1rPgoKdDogJHtQUk9HfQoJLi8ke1BS +T0d9IGdwZ3NpZ25lZC1hLmdwZwo= ==== EOF uudecode << EOF @@ -7207,13 +7194,12 @@ IG5ldHBncHZlcmlmeQo= ==== EOF atf_check -s eq:0 -o file:expected16 -e empty env TZ=US/Pacific netpgpverify -k pubring.gpg -c verify b.gpg - atf_check -s eq:0 -o file:2.expected -e empty b2e < 2.in - atf_check -s eq:0 -o file:expected18 -e empty env TZ=US/Pacific netpgpverify -c verify a.gpg - atf_check -s eq:0 -o file:expected19 -e empty env TZ=US/Pacific netpgpverify -c verify NetBSD-6.0_RC2_hashes.asc + atf_check -s eq:0 -o file:expected18 -e empty env TZ=US/Pacific netpgpverify -k pubring.gpg -c verify a.gpg +# atf_check -s eq:0 -o file:expected19 -e empty env TZ=US/Pacific netpgpverify -k pubring.gpg -c verify NetBSD-6.0_RC2_hashes.asc atf_check -s eq:0 -o file:expected20 -e empty env TZ=US/Pacific netpgpverify -k pubring.gpg -c cat jj.asc - atf_check -s eq:0 -o file:expected21 -e empty env TZ=US/Pacific netpgpverify < a.gpg + atf_check -s eq:0 -o file:expected21 -e empty env TZ=US/Pacific netpgpverify -k pubring.gpg < a.gpg atf_check -s eq:0 -o file:expected22 -e empty env TZ=US/Pacific netpgpverify -k pubring.gpg < jj.asc - atf_check -s eq:0 -o file:expected23 -e empty env TZ=US/Pacific netpgpverify < NetBSD-6.0_RC2_hashes.asc +# atf_check -s eq:0 -o file:expected23 -e empty env TZ=US/Pacific netpgpverify < NetBSD-6.0_RC2_hashes.asc atf_check -s eq:0 -o file:expected24 -e empty env TZ=US/Pacific netpgpverify -k pubring.gpg < b.gpg #atf_check -s eq:0 -o file:expected25 -e empty netpgpverify NetBSD-6.0_RC1_hashes.gpg #atf_check -s eq:0 -o file:expected26 -e empty netpgpverify < NetBSD-6.0_RC1_hashes.gpg @@ -7225,7 +7211,7 @@ EOF atf_check -s eq:0 -o file:expected32 -e empty env TZ=US/Pacific netpgpverify -k pubring.gpg b.gpg b.gpg b.gpg atf_check -s eq:0 -o file:expected33 -e empty env TZ=US/Pacific netpgpverify -k pubring.gpg -c cat b.gpg jj.asc b.gpg atf_check -s eq:0 -o file:expected34 -e empty env TZ=US/Pacific netpgpverify -k pubring.gpg det.sig - atf_check -s eq:0 -o file:expected35 -e empty env TZ=US/Pacific netpgpverify -c cat -k pubring.gpg det.sig + atf_check -s eq:0 -o file:expected35 -e empty env TZ=US/Pacific netpgpverify -k pubring.gpg -c cat det.sig #atf_check -s eq:0 -o file:expected46 -e empty netpgpverify -k problem-pubring.gpg NetBSD-6.0_hashes.asc } diff --git a/contrib/netbsd-tests/usr.bin/xlint/lint1/d_c99_anon_union.c b/contrib/netbsd-tests/usr.bin/xlint/lint1/d_c99_anon_union.c new file mode 100644 index 000000000000..508bcc9bdf43 --- /dev/null +++ b/contrib/netbsd-tests/usr.bin/xlint/lint1/d_c99_anon_union.c @@ -0,0 +1,16 @@ +/* struct with only anonymous members */ + +struct foo { + union { + long loo; + double doo; + }; +}; + +int +main(void) { + + struct foo *f = 0; + printf("%p\n", &f[1]); + return 0; +} diff --git a/contrib/netbsd-tests/usr.bin/xlint/lint1/d_c99_union_cast.c b/contrib/netbsd-tests/usr.bin/xlint/lint1/d_c99_union_cast.c new file mode 100644 index 000000000000..31628b456288 --- /dev/null +++ b/contrib/netbsd-tests/usr.bin/xlint/lint1/d_c99_union_cast.c @@ -0,0 +1,18 @@ +/* union cast */ + +struct bar { + int a; + int b; +}; + +union foo { + struct bar *a; + int b; +}; + +void +foo(void) { + struct bar *a; + + ((union foo)a).a; +} diff --git a/lib/libc/gen/tcsendbreak.3 b/lib/libc/gen/tcsendbreak.3 index a7e86d0aed5b..dd43a298941e 100644 --- a/lib/libc/gen/tcsendbreak.3 +++ b/lib/libc/gen/tcsendbreak.3 @@ -28,7 +28,7 @@ .\" @(#)tcsendbreak.3 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd June 4, 1993 +.Dd January 11, 2017 .Dt TCSENDBREAK 3 .Os .Sh NAME @@ -137,17 +137,44 @@ is not a terminal. A signal interrupted the .Fn tcdrain function. +.It Bq Er EWOULDBLOCK +The configured timeout expired before the +.Fn tcdrain +function could write all buffered output. .El .Sh SEE ALSO .Xr tcsetattr 3 , -.Xr termios 4 +.Xr termios 4 , +.Xr tty 4 , +.Xr comcontrol 8 .Sh STANDARDS The .Fn tcsendbreak , -.Fn tcdrain , .Fn tcflush and .Fn tcflow functions are expected to be compliant with the .St -p1003.1-88 specification. +.Pp +The +.Fn tcdrain +function is expected to be compliant with +.St -p1003.1-88 +when the drain wait value is set to zero with +.Xr comcontrol 8 , +or with +.Xr ioctl 2 +.Va TIOCSDRAINWAIT , +or with +.Xr sysctl 8 +.Va kern.tty_drainwait . +A non-zero drain wait value can result in +.Fn tcdrain +returning +.Va EWOULDBLOCK +without writing all output. +The default value for +.Va kern.tty_drainwait +is 300 seconds. + diff --git a/lib/libc/sys/shm_open.2 b/lib/libc/sys/shm_open.2 index b56f717b76d5..f77eb49736a4 100644 --- a/lib/libc/sys/shm_open.2 +++ b/lib/libc/sys/shm_open.2 @@ -28,7 +28,7 @@ .\" .\" $FreeBSD$ .\" -.Dd December 18, 2013 +.Dd January 13, 2017 .Dt SHM_OPEN 2 .Os .Sh NAME @@ -171,7 +171,8 @@ and .Dv O_TRUNC flags may be used in portable programs. .Pp -The result of using +.Tn POSIX +specifications state that the result of using .Xr open 2 , .Xr read 2 , or @@ -179,19 +180,43 @@ or on a shared memory object, or on the descriptor returned by .Fn shm_open , is undefined. -It is also undefined whether the shared memory object itself, or its -contents, persist across reboots. -.Pp -In FreeBSD, +However, the +.Fx +kernel implementation explicitly includes support for .Xr read 2 and -.Xr write 2 -on a shared memory object will fail with -.Er EOPNOTSUPP -and neither shared memory objects nor their contents persist across reboots. +.Xr write 2 . +.Pp +Neither shared memory objects nor their contents persist across reboots. +.Pp +Writes do not extend shared memory objects, so +.Xr ftruncate 2 +must be called before any data can be written. +See +.Sx EXAMPLES . +.Sh EXAMPLES +This example fails without the call to +.Xr ftruncate 2 : +.Bd -literal -compact + + uint8_t buffer[getpagesize()]; + ssize_t len; + int fd; + + fd = shm_open(SHM_ANON, O_RDWR | O_CREAT, 0600); + if (fd < 0) + err(EX_OSERR, "%s: shm_open", __func__); + if (ftruncate(fd, getpagesize()) < 0) + err(EX_IOERR, "%s: ftruncate", __func__); + len = pwrite(fd, buffer, getpagesize(), 0); + if (len < 0) + err(EX_IOERR, "%s: pwrite", __func__); + if (len != getpagesize()) + errx(EX_IOERR, "%s: pwrite length mismatch", __func__); +.Ed .Sh ERRORS -The following errors are defined for -.Fn shm_open : +.Fn shm_open +fails with these error codes for these conditions: .Bl -tag -width Er .It Bq Er EINVAL A flag other than @@ -235,8 +260,8 @@ are specified and the named shared memory object does exist. The required permissions (for reading or reading and writing) are denied. .El .Pp -The following errors are defined for -.Fn shm_unlink : +.Fn shm_unlink +fails with these error codes for these conditions: .Bl -tag -width Er .It Bq Er EFAULT The diff --git a/lib/libc/tests/db/Makefile b/lib/libc/tests/db/Makefile index e9c76d266797..132cfb321a22 100644 --- a/lib/libc/tests/db/Makefile +++ b/lib/libc/tests/db/Makefile @@ -13,6 +13,8 @@ NETBSD_ATF_TESTS_C+= db_hash_seq_test NETBSD_ATF_TESTS_SH+= db_test ATF_TESTS_SH_SED_db_test= -e 's,/bin/csh,/bin/cat,g' +CFLAGS+= -I${SRCTOP}/lib/libc/db/btree + .include "../Makefile.netbsd-tests" .include diff --git a/lib/libc/tests/gen/Makefile b/lib/libc/tests/gen/Makefile index 083097730cc0..2ec336ee5b28 100644 --- a/lib/libc/tests/gen/Makefile +++ b/lib/libc/tests/gen/Makefile @@ -13,10 +13,20 @@ ATF_TESTS_C+= posix_spawn_test ATF_TESTS_C+= wordexp_test ATF_TESTS_C+= dlopen_empty_test -# TODO: t_closefrom, t_cpuset, t_fmtcheck, t_randomid, t_sleep +# TODO: t_closefrom, t_cpuset, t_fmtcheck, t_randomid, # TODO: t_siginfo (fixes require further inspection) # TODO: t_sethostname_test (consistently screws up the hostname) +CFLAGS+= -DTEST_LONG_DOUBLE + +# Not sure why this isn't defined for all architectures, since most +# have long double. +.if ${MACHINE_CPUARCH} == "aarch64" || \ + ${MACHINE_CPUARCH} == "amd64" || \ + ${MACHINE_CPUARCH} == "i386" +CFLAGS+= -D__HAVE_LONG_DOUBLE +.endif + NETBSD_ATF_TESTS_C= alarm_test NETBSD_ATF_TESTS_C+= assert_test NETBSD_ATF_TESTS_C+= basedirname_test diff --git a/lib/libc/tests/stdlib/Makefile b/lib/libc/tests/stdlib/Makefile index f2d866c4c9df..c681cb604383 100644 --- a/lib/libc/tests/stdlib/Makefile +++ b/lib/libc/tests/stdlib/Makefile @@ -11,6 +11,14 @@ ATF_TESTS_CXX+= cxa_thread_atexit_test ATF_TESTS_CXX+= cxa_thread_atexit_nothr_test .endif +# Not sure why this isn't defined for all architectures, since most +# have long double. +.if ${MACHINE_CPUARCH} == "aarch64" || \ + ${MACHINE_CPUARCH} == "amd64" || \ + ${MACHINE_CPUARCH} == "i386" +CFLAGS+= -D__HAVE_LONG_DOUBLE +.endif + # TODO: t_getenv_thread, t_mi_vector_hash, t_strtoi NETBSD_ATF_TESTS_C+= abs_test NETBSD_ATF_TESTS_C+= atoi_test diff --git a/lib/libc/tests/sys/Makefile b/lib/libc/tests/sys/Makefile index 5db76af32305..794e1f2cce1a 100644 --- a/lib/libc/tests/sys/Makefile +++ b/lib/libc/tests/sys/Makefile @@ -61,8 +61,12 @@ NETBSD_ATF_TESTS_C+= ucontext_test NETBSD_ATF_TESTS_C+= umask_test NETBSD_ATF_TESTS_C+= unlink_test NETBSD_ATF_TESTS_C+= wait_test +NETBSD_ATF_TESTS_C+= wait_noproc_test +NETBSD_ATF_TESTS_C+= wait_noproc_wnohang_test NETBSD_ATF_TESTS_C+= write_test +CSTD?= c99 + LIBADD.getpid_test+= pthread LIBADD.timer_create_test+= rt diff --git a/lib/libgcc_s/Makefile b/lib/libgcc_s/Makefile index e4887a631ded..78b6515996fb 100644 --- a/lib/libgcc_s/Makefile +++ b/lib/libgcc_s/Makefile @@ -8,6 +8,7 @@ MK_SSP= no WARNS?= 2 LDFLAGS+= -nodefaultlibs +LIBADD+= c VERSION_MAP= ${.CURDIR}/Version.map .include "../libcompiler_rt/Makefile.inc" diff --git a/lib/libnetbsd/sys/cdefs.h b/lib/libnetbsd/sys/cdefs.h index 46372f368afd..325c23422446 100644 --- a/lib/libnetbsd/sys/cdefs.h +++ b/lib/libnetbsd/sys/cdefs.h @@ -71,4 +71,13 @@ */ #define __arraycount(__x) (sizeof(__x) / sizeof(__x[0])) +/* __BIT(n): nth bit, where __BIT(0) == 0x1. */ +#define __BIT(__n) \ + (((uintmax_t)(__n) >= NBBY * sizeof(uintmax_t)) ? 0 : \ + ((uintmax_t)1 << (uintmax_t)((__n) & (NBBY * sizeof(uintmax_t) - 1)))) + +/* __BITS(m, n): bits m through n, m < n. */ +#define __BITS(__m, __n) \ + ((__BIT(MAX((__m), (__n)) + 1) - 1) ^ (__BIT(MIN((__m), (__n))) - 1)) + #endif /* _LIBNETBSD_SYS_CDEFS_H_ */ diff --git a/lib/libthr/tests/Makefile b/lib/libthr/tests/Makefile index 159cc3b4d030..7e6617d3b316 100644 --- a/lib/libthr/tests/Makefile +++ b/lib/libthr/tests/Makefile @@ -26,6 +26,7 @@ NETBSD_ATF_TESTS_C+= sleep_test .if ${MACHINE} != "arm64" # ARM64TODO: Missing makecontext NETBSD_ATF_TESTS_C+= swapcontext_test .endif +NETBSD_ATF_TESTS_C+= timedmutex_test NETBSD_ATF_TESTS_SH= atexit_test NETBSD_ATF_TESTS_SH+= cancel_test diff --git a/lib/msun/tests/Makefile b/lib/msun/tests/Makefile index a9acebea3cda..3a61b4d6b6db 100644 --- a/lib/msun/tests/Makefile +++ b/lib/msun/tests/Makefile @@ -23,12 +23,15 @@ NETBSD_ATF_TESTS_C+= asin_test NETBSD_ATF_TESTS_C+= atan_test NETBSD_ATF_TESTS_C+= cbrt_test NETBSD_ATF_TESTS_C+= ceil_test +NETBSD_ATF_TESTS_C+= casinh_test NETBSD_ATF_TESTS_C+= cos_test NETBSD_ATF_TESTS_C+= cosh_test NETBSD_ATF_TESTS_C+= erf_test NETBSD_ATF_TESTS_C+= exp_test NETBSD_ATF_TESTS_C+= fmod_test +NETBSD_ATF_TESTS_C+= fe_round_test NETBSD_ATF_TESTS_C+= infinity_test +NETBSD_ATF_TESTS_C+= ilogb_test NETBSD_ATF_TESTS_C+= ldexp_test NETBSD_ATF_TESTS_C+= log_test NETBSD_ATF_TESTS_C+= pow_test @@ -53,10 +56,10 @@ TAP_TESTS_C+= exponential_test TAP_TESTS_C+= fenv_test TAP_TESTS_C+= fma_test # clang 3.8.0 fails always fails this test. See: bug 208703 -.if ! (${COMPILER_TYPE} == "clang" && ${COMPILER_VERSION} == 30800) +.if ! (${COMPILER_TYPE} == "clang" && ${COMPILER_VERSION} >= 30800) TAP_TESTS_C+= fmaxmin_test .endif -TAP_TESTS_C+= ilogb_test +TAP_TESTS_C+= ilogb2_test TAP_TESTS_C+= invtrig_test TAP_TESTS_C+= invctrig_test TAP_TESTS_C+= logarithm_test @@ -80,6 +83,8 @@ CSTD= c99 IGNORE_PRAGMA= +SRCS.ilogb2_test= ilogb_test.c + LIBADD+= m # Copied from lib/msun/Makefile diff --git a/libexec/rtld-elf/rtld.c b/libexec/rtld-elf/rtld.c index 50e1a0e9105a..327c939b9b27 100644 --- a/libexec/rtld-elf/rtld.c +++ b/libexec/rtld-elf/rtld.c @@ -103,6 +103,7 @@ static int load_needed_objects(Obj_Entry *, int); static int load_preload_objects(void); static Obj_Entry *load_object(const char *, int fd, const Obj_Entry *, int); static void map_stacks_exec(RtldLockState *); +static int obj_enforce_relro(Obj_Entry *); static Obj_Entry *obj_from_addr(const void *); static void objlist_call_fini(Objlist *, Obj_Entry *, RtldLockState *); static void objlist_call_init(Objlist *, RtldLockState *); @@ -617,6 +618,10 @@ _rtld(Elf_Addr *sp, func_ptr_type *exit_proc, Obj_Entry **objp) if (do_copy_relocations(obj_main) == -1) rtld_die(); + dbg("enforcing main obj relro"); + if (obj_enforce_relro(obj_main) == -1) + rtld_die(); + if (getenv(_LD("DUMP_REL_POST")) != NULL) { dump_relocations(obj_main); exit (0); @@ -2746,14 +2751,8 @@ relocate_object(Obj_Entry *obj, bool bind_now, Obj_Entry *rtldobj, reloc_non_plt(obj, rtldobj, flags | SYMLOOK_IFUNC, lockstate)) return (-1); - if (obj->relro_size > 0) { - if (mprotect(obj->relro_page, obj->relro_size, - PROT_READ) == -1) { - _rtld_error("%s: Cannot enforce relro protection: %s", - obj->path, rtld_strerror(errno)); - return (-1); - } - } + if (!obj->mainprog && obj_enforce_relro(obj) == -1) + return (-1); /* * Set up the magic number and version in the Obj_Entry. These @@ -5124,6 +5123,19 @@ _rtld_is_dlopened(void *arg) return (res); } +int +obj_enforce_relro(Obj_Entry *obj) +{ + + if (obj->relro_size > 0 && mprotect(obj->relro_page, obj->relro_size, + PROT_READ) == -1) { + _rtld_error("%s: Cannot enforce relro protection: %s", + obj->path, rtld_strerror(errno)); + return (-1); + } + return (0); +} + static void map_stacks_exec(RtldLockState *lockstate) { diff --git a/share/man/man4/em.4 b/share/man/man4/em.4 index ac7319d011f5..38fa449cfe3e 100644 --- a/share/man/man4/em.4 +++ b/share/man/man4/em.4 @@ -31,7 +31,7 @@ .\" .\" $FreeBSD$ .\" -.Dd August 16, 2015 +.Dd January 12, 2016 .Dt EM 4 .Os .Sh NAME @@ -45,14 +45,6 @@ kernel configuration file: .Cd "device em" .Ed .Pp -Optional multiqueue support is available via the following kernel -compile options: -.Bd -ragged -offset indent -.Cd "options EM_MULTIQUEUE" -.Ed -.Pp -Note: Activating EM_MULTIQUEUE support is not supported by Intel. -.Pp Alternatively, to load the driver as a module at boot time, place the following line in .Xr loader.conf 5 : @@ -253,12 +245,6 @@ If .Va hw.em.tx_int_delay is non-zero, this tunable limits the maximum delay in which a transmit interrupt is generated. -.It Va hw.em.num_queues -Number of hardware queues that will be configured on this adapter (maximum of 2) -Defaults to 1. -Only valid with kernel configuration -.Cd "options EM_MULTIQUEUE". -.El .Sh FILES .Bl -tag -width /dev/led/em* .It Pa /dev/led/em* @@ -311,5 +297,3 @@ The .Nm driver was written by .An Intel Corporation Aq Mt freebsd@intel.com . -.Sh BUGS -Activating EM_MULTIQUEUE support requires MSI-X features. diff --git a/share/man/man4/sfxge.4 b/share/man/man4/sfxge.4 index 9be27e018047..589129792ceb 100644 --- a/share/man/man4/sfxge.4 +++ b/share/man/man4/sfxge.4 @@ -158,6 +158,16 @@ The default for each port will be the value of .Va hw.sfxge.mcdi_logging. The logging may also be enabled or disabled after the driver is loaded using the sysctl .Va dev.sfxge.%d.mcdi_logging. +.It Va hw.sfxge.stats_update_period_ms +Period in milliseconds to refresh interface statistics from hardware. +The accepted range is 0 to 65535, the default is 1000 (1 second). +Use zero value to disable periodic statistics update. +Supported on SFN8xxx series adapters with firmware v6.2.1.1033 and later and +SFN5xxx and SFN6xxx series adapters. +SFN7xxx series adapters and SFN8xxx series with earlier firmware use a +fixed 1000 milliseconds statistics update period. +The period may also be changed after the driver is loaded using the sysctl +.Va dev.sfxge.%d.stats_update_period_ms . .El .Sh SUPPORT For general information and support, diff --git a/share/man/man4/tty.4 b/share/man/man4/tty.4 index ec6d9f155aca..ef5bed8be554 100644 --- a/share/man/man4/tty.4 +++ b/share/man/man4/tty.4 @@ -28,7 +28,7 @@ .\" @(#)tty.4 8.3 (Berkeley) 4/19/94 .\" $FreeBSD$ .\" -.Dd December 26, 2009 +.Dd January 11, 2017 .Dt TTY 4 .Os .Sh NAME @@ -238,7 +238,16 @@ Start output on the terminal (like typing ^Q at the keyboard). Make the terminal the controlling terminal for the process (the process must not currently have a controlling terminal). .It Dv TIOCDRAIN Fa void -Wait until all output is drained. +Wait until all output is drained, or until the drain wait timeout expires. +.It Dv TIOCGDRAINWAIT Fa int *timeout +Return the current drain wait timeout in seconds. +.It Dv TIOCSDRAINWAIT Fa int *timeout +Set the drain wait timeout in seconds. +A value of zero disables timeouts. +The default drain wait timeout is controlled by the tunable +.Xr sysctl 8 +OID +.Va kern.tty_drainwait . .It Dv TIOCEXCL Fa void Set exclusive use on the terminal. No further opens are permitted except by root. diff --git a/sys/cam/cam_ccb.h b/sys/cam/cam_ccb.h index b638ab1dba9f..4cfe2e4fa34a 100644 --- a/sys/cam/cam_ccb.h +++ b/sys/cam/cam_ccb.h @@ -784,6 +784,13 @@ struct ccb_accept_tio { struct scsi_sense_data sense_data; }; +static __inline uint8_t * +atio_cdb_ptr(struct ccb_accept_tio *ccb) +{ + return ((ccb->ccb_h.flags & CAM_CDB_POINTER) ? + ccb->cdb_io.cdb_ptr : ccb->cdb_io.cdb_bytes); +} + /* Release SIM Queue */ struct ccb_relsim { struct ccb_hdr ccb_h; diff --git a/sys/cam/cam_periph.c b/sys/cam/cam_periph.c index ae4134504b9c..1bd7395e77ca 100644 --- a/sys/cam/cam_periph.c +++ b/sys/cam/cam_periph.c @@ -1930,10 +1930,7 @@ cam_periph_devctl_notify(union ccb *ccb) if (ccb->ccb_h.func_code == XPT_SCSI_IO) { sbuf_printf(&sb, "CDB=\""); - if ((ccb->ccb_h.flags & CAM_CDB_POINTER) != 0) - scsi_cdb_sbuf(ccb->csio.cdb_io.cdb_ptr, &sb); - else - scsi_cdb_sbuf(ccb->csio.cdb_io.cdb_bytes, &sb); + scsi_cdb_sbuf(scsiio_cdb_ptr(&ccb->csio), &sb); sbuf_printf(&sb, "\" "); } else if (ccb->ccb_h.func_code == XPT_ATA_IO) { sbuf_printf(&sb, "ACB=\""); diff --git a/sys/cam/ctl/ctl_frontend_cam_sim.c b/sys/cam/ctl/ctl_frontend_cam_sim.c index 04f2226208c8..ef9aabaadbab 100644 --- a/sys/cam/ctl/ctl_frontend_cam_sim.c +++ b/sys/cam/ctl/ctl_frontend_cam_sim.c @@ -587,8 +587,7 @@ cfcs_action(struct cam_sim *sim, union ccb *ccb) __func__, csio->cdb_len, sizeof(io->scsiio.cdb)); } io->scsiio.cdb_len = min(csio->cdb_len, sizeof(io->scsiio.cdb)); - bcopy(csio->cdb_io.cdb_bytes, io->scsiio.cdb, - io->scsiio.cdb_len); + bcopy(scsiio_cdb_ptr(csio), io->scsiio.cdb, io->scsiio.cdb_len); ccb->ccb_h.status |= CAM_SIM_QUEUED; err = ctl_queue(io); diff --git a/sys/cam/ctl/scsi_ctl.c b/sys/cam/ctl/scsi_ctl.c index a8bc77b8e4e6..d03966ee82f3 100644 --- a/sys/cam/ctl/scsi_ctl.c +++ b/sys/cam/ctl/scsi_ctl.c @@ -941,7 +941,7 @@ ctlfestart(struct cam_periph *periph, union ccb *start_ccb) && (csio->sglist_cnt != 0))) { printf("%s: tag %04x cdb %02x flags %#x dxfer_len " "%d sg %u\n", __func__, atio->tag_id, - atio->cdb_io.cdb_bytes[0], flags, dxfer_len, + atio_cdb_ptr(atio)[0], flags, dxfer_len, csio->sglist_cnt); printf("%s: tag %04x io status %#x\n", __func__, atio->tag_id, io->io_hdr.status); @@ -1027,8 +1027,7 @@ ctlfe_adjust_cdb(struct ccb_accept_tio *atio, uint32_t offset) { uint64_t lba; uint32_t num_blocks, nbc; - uint8_t *cmdbyt = (atio->ccb_h.flags & CAM_CDB_POINTER)? - atio->cdb_io.cdb_ptr : atio->cdb_io.cdb_bytes; + uint8_t *cmdbyt = atio_cdb_ptr(atio); nbc = offset >> 9; /* ASSUMING 512 BYTE BLOCKS */ @@ -1206,8 +1205,7 @@ ctlfedone(struct cam_periph *periph, union ccb *done_ccb) __func__, atio->cdb_len, sizeof(io->scsiio.cdb)); } io->scsiio.cdb_len = min(atio->cdb_len, sizeof(io->scsiio.cdb)); - bcopy(atio->cdb_io.cdb_bytes, io->scsiio.cdb, - io->scsiio.cdb_len); + bcopy(atio_cdb_ptr(atio), io->scsiio.cdb, io->scsiio.cdb_len); #ifdef CTLFEDEBUG printf("%s: %u:%u:%u: tag %04x CDB %02x\n", __func__, @@ -1388,7 +1386,7 @@ ctlfedone(struct cam_periph *periph, union ccb *done_ccb) printf("%s: tag %04x no status or " "len cdb = %02x\n", __func__, atio->tag_id, - atio->cdb_io.cdb_bytes[0]); + atio_cdb_ptr(atio)[0]); printf("%s: tag %04x io status %#x\n", __func__, atio->tag_id, io->io_hdr.status); diff --git a/sys/cam/nvme/nvme_da.c b/sys/cam/nvme/nvme_da.c index 5e316c365295..1aa9954747a3 100644 --- a/sys/cam/nvme/nvme_da.c +++ b/sys/cam/nvme/nvme_da.c @@ -761,7 +761,7 @@ ndaregister(struct cam_periph *periph, void *arg) MIN(sizeof(softc->disk->d_descr), sizeof(cd->mn))); strlcpy(softc->disk->d_ident, cd->sn, MIN(sizeof(softc->disk->d_ident), sizeof(cd->sn))); - disk->d_rotation_rate = 0; /* Spinning rust need not apply */ + disk->d_rotation_rate = DISK_RR_NON_ROTATING; disk->d_open = ndaopen; disk->d_close = ndaclose; disk->d_strategy = ndastrategy; diff --git a/sys/cam/scsi/scsi_all.c b/sys/cam/scsi/scsi_all.c index 192a8d4a5eeb..bf2ee2f69e9c 100644 --- a/sys/cam/scsi/scsi_all.c +++ b/sys/cam/scsi/scsi_all.c @@ -3617,15 +3617,9 @@ scsi_command_string(struct cam_device *device, struct ccb_scsiio *csio, #endif /* _KERNEL/!_KERNEL */ - if ((csio->ccb_h.flags & CAM_CDB_POINTER) != 0) { - sbuf_printf(sb, "%s. CDB: ", - scsi_op_desc(csio->cdb_io.cdb_ptr[0], inq_data)); - scsi_cdb_sbuf(csio->cdb_io.cdb_ptr, sb); - } else { - sbuf_printf(sb, "%s. CDB: ", - scsi_op_desc(csio->cdb_io.cdb_bytes[0], inq_data)); - scsi_cdb_sbuf(csio->cdb_io.cdb_bytes, sb); - } + sbuf_printf(sb, "%s. CDB: ", + scsi_op_desc(scsiio_cdb_ptr(csio)[0], inq_data)); + scsi_cdb_sbuf(scsiio_cdb_ptr(csio), sb); #ifdef _KERNEL xpt_free_ccb((union ccb *)cgd); @@ -5030,7 +5024,6 @@ scsi_sense_sbuf(struct cam_device *device, struct ccb_scsiio *csio, struct ccb_getdev *cgd; #endif /* _KERNEL */ char path_str[64]; - uint8_t *cdb; #ifndef _KERNEL if (device == NULL) @@ -5128,14 +5121,9 @@ scsi_sense_sbuf(struct cam_device *device, struct ccb_scsiio *csio, sense = &csio->sense_data; } - if (csio->ccb_h.flags & CAM_CDB_POINTER) - cdb = csio->cdb_io.cdb_ptr; - else - cdb = csio->cdb_io.cdb_bytes; - scsi_sense_only_sbuf(sense, csio->sense_len - csio->sense_resid, sb, - path_str, inq_data, cdb, csio->cdb_len); - + path_str, inq_data, scsiio_cdb_ptr(csio), csio->cdb_len); + #ifdef _KERNEL xpt_free_ccb((union ccb*)cgd); #endif /* _KERNEL/!_KERNEL */ diff --git a/sys/cam/scsi/scsi_xpt.c b/sys/cam/scsi/scsi_xpt.c index cb7205e3331b..065d433e5c76 100644 --- a/sys/cam/scsi/scsi_xpt.c +++ b/sys/cam/scsi/scsi_xpt.c @@ -3139,6 +3139,6 @@ scsi_proto_debug_out(union ccb *ccb) device = ccb->ccb_h.path->device; CAM_DEBUG(ccb->ccb_h.path, CAM_DEBUG_CDB,("%s. CDB: %s\n", - scsi_op_desc(ccb->csio.cdb_io.cdb_bytes[0], &device->inq_data), - scsi_cdb_string(ccb->csio.cdb_io.cdb_bytes, cdb_str, sizeof(cdb_str)))); + scsi_op_desc(scsiio_cdb_ptr(&ccb->csio)[0], &device->inq_data), + scsi_cdb_string(scsiio_cdb_ptr(&ccb->csio), cdb_str, sizeof(cdb_str)))); } diff --git a/sys/conf/NOTES b/sys/conf/NOTES index 711c9a88de4a..2e430bc129da 100644 --- a/sys/conf/NOTES +++ b/sys/conf/NOTES @@ -3055,9 +3055,6 @@ options RANDOM_ENABLE_UMA # slab allocator # Module to enable execution of application via emulators like QEMU options IMAGACT_BINMISC -# Intel em(4) driver -options EM_MULTIQUEUE # Activate multiqueue features/disable MSI-X - # zlib I/O stream support # This enables support for compressed core dumps. options GZIO diff --git a/sys/conf/options b/sys/conf/options index 17923ea628b9..dee1eaddbb0d 100644 --- a/sys/conf/options +++ b/sys/conf/options @@ -986,9 +986,6 @@ RANDOM_LOADABLE opt_global.h # the uma slab allocator. RANDOM_ENABLE_UMA opt_global.h -# Intel em(4) driver -EM_MULTIQUEUE opt_em.h - # BHND(4) driver BHND_LOGLEVEL opt_global.h diff --git a/sys/contrib/ipfilter/netinet/ip_fil.h b/sys/contrib/ipfilter/netinet/ip_fil.h index 076433c01439..646f5d661dc4 100644 --- a/sys/contrib/ipfilter/netinet/ip_fil.h +++ b/sys/contrib/ipfilter/netinet/ip_fil.h @@ -11,6 +11,10 @@ #ifndef __IP_FIL_H__ #define __IP_FIL_H__ +#if !defined(linux) || !defined(_KERNEL) +# include +#endif + #include "netinet/ip_compat.h" #include "netinet/ipf_rb.h" #if NETBSD_GE_REV(104040000) @@ -24,10 +28,6 @@ # endif #endif -#if !defined(linux) || !defined(_KERNEL) -# include -#endif - #ifndef SOLARIS # if defined(sun) && (defined(__svr4__) || defined(__SVR4)) # define SOLARIS 1 diff --git a/sys/dev/cxgbe/tom/t4_connect.c b/sys/dev/cxgbe/tom/t4_connect.c index f2e4ad456ef4..bd78c7fced61 100644 --- a/sys/dev/cxgbe/tom/t4_connect.c +++ b/sys/dev/cxgbe/tom/t4_connect.c @@ -126,6 +126,7 @@ do_act_establish(struct sge_iq *iq, const struct rss_header *rss, CTR3(KTR_CXGBE, "%s: atid %u, tid %u", __func__, atid, tid); free_atid(sc, atid); + CURVNET_SET(toep->vnet); INP_WLOCK(inp); toep->tid = tid; insert_tid(sc, tid, toep, inp->inp_vflag & INP_IPV6 ? 2 : 1); @@ -141,6 +142,7 @@ do_act_establish(struct sge_iq *iq, const struct rss_header *rss, make_established(toep, cpl->snd_isn, cpl->rcv_isn, cpl->tcp_opt); done: INP_WUNLOCK(inp); + CURVNET_RESTORE(); return (0); } @@ -178,6 +180,7 @@ act_open_failure_cleanup(struct adapter *sc, u_int atid, u_int status) free_atid(sc, atid); toep->tid = -1; + CURVNET_SET(toep->vnet); if (status != EAGAIN) INP_INFO_RLOCK(&V_tcbinfo); INP_WLOCK(inp); @@ -185,6 +188,7 @@ act_open_failure_cleanup(struct adapter *sc, u_int atid, u_int status) final_cpl_received(toep); /* unlocks inp */ if (status != EAGAIN) INP_INFO_RUNLOCK(&V_tcbinfo); + CURVNET_RESTORE(); } /* @@ -360,6 +364,7 @@ t4_connect(struct toedev *tod, struct socket *so, struct rtentry *rt, if (wr == NULL) DONT_OFFLOAD_ACTIVE_OPEN(ENOMEM); + toep->vnet = so->so_vnet; if (sc->tt.ddp && (so->so_options & SO_NO_DDP) == 0) set_tcpddp_ulp_mode(toep); else diff --git a/sys/dev/cxgbe/tom/t4_cpl_io.c b/sys/dev/cxgbe/tom/t4_cpl_io.c index c22f8bb17271..25ad1e355348 100644 --- a/sys/dev/cxgbe/tom/t4_cpl_io.c +++ b/sys/dev/cxgbe/tom/t4_cpl_io.c @@ -306,7 +306,6 @@ make_established(struct toepcb *toep, uint32_t snd_isn, uint32_t rcv_isn, uint16_t tcpopt = be16toh(opt); struct flowc_tx_params ftxp; - CURVNET_SET(so->so_vnet); INP_WLOCK_ASSERT(inp); KASSERT(tp->t_state == TCPS_SYN_SENT || tp->t_state == TCPS_SYN_RECEIVED, @@ -357,7 +356,6 @@ make_established(struct toepcb *toep, uint32_t snd_isn, uint32_t rcv_isn, send_flowc_wr(toep, &ftxp); soisconnected(so); - CURVNET_RESTORE(); } static int @@ -1146,6 +1144,7 @@ do_peer_close(struct sge_iq *iq, const struct rss_header *rss, struct mbuf *m) KASSERT(toep->tid == tid, ("%s: toep tid mismatch", __func__)); + CURVNET_SET(toep->vnet); INP_INFO_RLOCK(&V_tcbinfo); INP_WLOCK(inp); tp = intotcpcb(inp); @@ -1191,6 +1190,7 @@ do_peer_close(struct sge_iq *iq, const struct rss_header *rss, struct mbuf *m) tcp_twstart(tp); INP_UNLOCK_ASSERT(inp); /* safe, we have a ref on the inp */ INP_INFO_RUNLOCK(&V_tcbinfo); + CURVNET_RESTORE(); INP_WLOCK(inp); final_cpl_received(toep); @@ -1203,6 +1203,7 @@ do_peer_close(struct sge_iq *iq, const struct rss_header *rss, struct mbuf *m) done: INP_WUNLOCK(inp); INP_INFO_RUNLOCK(&V_tcbinfo); + CURVNET_RESTORE(); return (0); } @@ -1229,6 +1230,7 @@ do_close_con_rpl(struct sge_iq *iq, const struct rss_header *rss, KASSERT(m == NULL, ("%s: wasn't expecting payload", __func__)); KASSERT(toep->tid == tid, ("%s: toep tid mismatch", __func__)); + CURVNET_SET(toep->vnet); INP_INFO_RLOCK(&V_tcbinfo); INP_WLOCK(inp); tp = intotcpcb(inp); @@ -1248,6 +1250,7 @@ do_close_con_rpl(struct sge_iq *iq, const struct rss_header *rss, release: INP_UNLOCK_ASSERT(inp); /* safe, we have a ref on the inp */ INP_INFO_RUNLOCK(&V_tcbinfo); + CURVNET_RESTORE(); INP_WLOCK(inp); final_cpl_received(toep); /* no more CPLs expected */ @@ -1272,6 +1275,7 @@ do_close_con_rpl(struct sge_iq *iq, const struct rss_header *rss, done: INP_WUNLOCK(inp); INP_INFO_RUNLOCK(&V_tcbinfo); + CURVNET_RESTORE(); return (0); } @@ -1345,6 +1349,7 @@ do_abort_req(struct sge_iq *iq, const struct rss_header *rss, struct mbuf *m) } inp = toep->inp; + CURVNET_SET(toep->vnet); INP_INFO_RLOCK(&V_tcbinfo); /* for tcp_close */ INP_WLOCK(inp); @@ -1380,6 +1385,7 @@ do_abort_req(struct sge_iq *iq, const struct rss_header *rss, struct mbuf *m) final_cpl_received(toep); done: INP_INFO_RUNLOCK(&V_tcbinfo); + CURVNET_RESTORE(); send_abort_rpl(sc, ofld_txq, tid, CPL_ABORT_NO_RST); return (0); } @@ -1501,18 +1507,21 @@ do_rx_data(struct sge_iq *iq, const struct rss_header *rss, struct mbuf *m) DDP_UNLOCK(toep); INP_WUNLOCK(inp); + CURVNET_SET(toep->vnet); INP_INFO_RLOCK(&V_tcbinfo); INP_WLOCK(inp); tp = tcp_drop(tp, ECONNRESET); if (tp) INP_WUNLOCK(inp); INP_INFO_RUNLOCK(&V_tcbinfo); + CURVNET_RESTORE(); return (0); } /* receive buffer autosize */ - CURVNET_SET(so->so_vnet); + MPASS(toep->vnet == so->so_vnet); + CURVNET_SET(toep->vnet); if (sb->sb_flags & SB_AUTOSIZE && V_tcp_do_autorcvbuf && sb->sb_hiwat < V_tcp_autorcvbuf_max && @@ -1713,10 +1722,12 @@ do_fw4_ack(struct sge_iq *iq, const struct rss_header *rss, struct mbuf *m) tid); #endif toep->flags &= ~TPF_TX_SUSPENDED; + CURVNET_SET(toep->vnet); if (toep->ulp_mode == ULP_MODE_ISCSI) t4_push_pdus(sc, toep, plen); else t4_push_frames(sc, toep, plen); + CURVNET_RESTORE(); } else if (plen > 0) { struct sockbuf *sb = &so->so_snd; int sbu; @@ -2143,7 +2154,7 @@ t4_aiotx_task(void *context, int pending) struct socket *so = inp->inp_socket; struct kaiocb *job; - CURVNET_SET(so->so_vnet); + CURVNET_SET(toep->vnet); SOCKBUF_LOCK(&so->so_snd); while (!TAILQ_EMPTY(&toep->aiotx_jobq) && sowriteable(so)) { job = TAILQ_FIRST(&toep->aiotx_jobq); diff --git a/sys/dev/cxgbe/tom/t4_ddp.c b/sys/dev/cxgbe/tom/t4_ddp.c index 1a4cb7104360..762eb2eeeffa 100644 --- a/sys/dev/cxgbe/tom/t4_ddp.c +++ b/sys/dev/cxgbe/tom/t4_ddp.c @@ -546,7 +546,8 @@ handle_ddp_data(struct toepcb *toep, __be32 ddp_report, __be32 rcv_nxt, int len) #endif /* receive buffer autosize */ - CURVNET_SET(so->so_vnet); + MPASS(toep->vnet == so->so_vnet); + CURVNET_SET(toep->vnet); SOCKBUF_LOCK(sb); if (sb->sb_flags & SB_AUTOSIZE && V_tcp_do_autorcvbuf && diff --git a/sys/dev/cxgbe/tom/t4_listen.c b/sys/dev/cxgbe/tom/t4_listen.c index bdb93ac9a427..836c9cb6fcf4 100644 --- a/sys/dev/cxgbe/tom/t4_listen.c +++ b/sys/dev/cxgbe/tom/t4_listen.c @@ -222,6 +222,7 @@ alloc_lctx(struct adapter *sc, struct inpcb *inp, struct vi_info *vi) TAILQ_INIT(&lctx->synq); lctx->inp = inp; + lctx->vnet = inp->inp_socket->so_vnet; in_pcbref(inp); return (lctx); @@ -1200,6 +1201,8 @@ do_pass_accept_req(struct sge_iq *iq, const struct rss_header *rss, pi = sc->port[G_SYN_INTF(be16toh(cpl->l2info))]; + CURVNET_SET(lctx->vnet); + /* * Use the MAC index to lookup the associated VI. If this SYN * didn't match a perfect MAC filter, punt. @@ -1274,6 +1277,13 @@ do_pass_accept_req(struct sge_iq *iq, const struct rss_header *rss, ntids = 1; } + /* + * Don't offload if the ifnet that the SYN came in on is not in the same + * vnet as the listening socket. + */ + if (lctx->vnet != ifp->if_vnet) + REJECT_PASS_ACCEPT(); + e = get_l2te_for_nexthop(pi, ifp, &inc); if (e == NULL) REJECT_PASS_ACCEPT(); @@ -1313,7 +1323,6 @@ do_pass_accept_req(struct sge_iq *iq, const struct rss_header *rss, REJECT_PASS_ACCEPT(); } so = inp->inp_socket; - CURVNET_SET(so->so_vnet); mtu_idx = find_best_mtu_idx(sc, &inc, be16toh(cpl->tcpopt.mss)); rscale = cpl->tcpopt.wsf && V_tcp_do_rfc1323 ? select_rcv_wscale() : 0; @@ -1360,7 +1369,6 @@ do_pass_accept_req(struct sge_iq *iq, const struct rss_header *rss, */ toe_syncache_add(&inc, &to, &th, inp, tod, synqe); INP_UNLOCK_ASSERT(inp); /* ok to assert, we have a ref on the inp */ - CURVNET_RESTORE(); /* * If we replied during syncache_add (synqe->wr has been consumed), @@ -1415,10 +1423,12 @@ do_pass_accept_req(struct sge_iq *iq, const struct rss_header *rss, return (__LINE__); } INP_WUNLOCK(inp); + CURVNET_RESTORE(); release_synqe(synqe); /* extra hold */ return (0); reject: + CURVNET_RESTORE(); CTR4(KTR_CXGBE, "%s: stid %u, tid %u, REJECT (%d)", __func__, stid, tid, reject_reason); @@ -1490,6 +1500,7 @@ do_pass_establish(struct sge_iq *iq, const struct rss_header *rss, KASSERT(synqe->flags & TPF_SYNQE, ("%s: tid %u (ctx %p) not a synqe", __func__, tid, synqe)); + CURVNET_SET(lctx->vnet); INP_INFO_RLOCK(&V_tcbinfo); /* for syncache_expand */ INP_WLOCK(inp); @@ -1507,6 +1518,7 @@ do_pass_establish(struct sge_iq *iq, const struct rss_header *rss, INP_WUNLOCK(inp); INP_INFO_RUNLOCK(&V_tcbinfo); + CURVNET_RESTORE(); return (0); } @@ -1532,6 +1544,7 @@ do_pass_establish(struct sge_iq *iq, const struct rss_header *rss, send_reset_synqe(TOEDEV(ifp), synqe); INP_WUNLOCK(inp); INP_INFO_RUNLOCK(&V_tcbinfo); + CURVNET_RESTORE(); return (0); } toep->tid = tid; @@ -1568,6 +1581,8 @@ do_pass_establish(struct sge_iq *iq, const struct rss_header *rss, /* New connection inpcb is already locked by syncache_expand(). */ new_inp = sotoinpcb(so); INP_WLOCK_ASSERT(new_inp); + MPASS(so->so_vnet == lctx->vnet); + toep->vnet = lctx->vnet; /* * This is for the unlikely case where the syncache entry that we added @@ -1591,6 +1606,7 @@ do_pass_establish(struct sge_iq *iq, const struct rss_header *rss, if (inp != NULL) INP_WUNLOCK(inp); INP_INFO_RUNLOCK(&V_tcbinfo); + CURVNET_RESTORE(); release_synqe(synqe); return (0); diff --git a/sys/dev/cxgbe/tom/t4_tom.c b/sys/dev/cxgbe/tom/t4_tom.c index 5445e265f7dc..1448aad009f8 100644 --- a/sys/dev/cxgbe/tom/t4_tom.c +++ b/sys/dev/cxgbe/tom/t4_tom.c @@ -799,74 +799,96 @@ update_clip_table(struct adapter *sc, struct tom_data *td) struct in6_addr *lip, tlip; struct clip_head stale; struct clip_entry *ce, *ce_temp; - int rc, gen = atomic_load_acq_int(&in6_ifaddr_gen); + struct vi_info *vi; + int rc, gen, i, j; + uintptr_t last_vnet; ASSERT_SYNCHRONIZED_OP(sc); IN6_IFADDR_RLOCK(&in6_ifa_tracker); mtx_lock(&td->clip_table_lock); + gen = atomic_load_acq_int(&in6_ifaddr_gen); if (gen == td->clip_gen) goto done; TAILQ_INIT(&stale); TAILQ_CONCAT(&stale, &td->clip_table, link); - TAILQ_FOREACH(ia, &V_in6_ifaddrhead, ia_link) { - lip = &ia->ia_addr.sin6_addr; - - KASSERT(!IN6_IS_ADDR_MULTICAST(lip), - ("%s: mcast address in in6_ifaddr list", __func__)); - - if (IN6_IS_ADDR_LOOPBACK(lip)) + /* + * last_vnet optimizes the common cases where all if_vnet = NULL (no + * VIMAGE) or all if_vnet = vnet0. + */ + last_vnet = (uintptr_t)(-1); + for_each_port(sc, i) + for_each_vi(sc->port[i], j, vi) { + if (last_vnet == (uintptr_t)vi->ifp->if_vnet) continue; - if (IN6_IS_SCOPE_EMBED(lip)) { - /* Remove the embedded scope */ - tlip = *lip; - lip = &tlip; - in6_clearscope(lip); - } - /* - * XXX: how to weed out the link local address for the loopback - * interface? It's fe80::1 usually (always?). - */ - /* - * If it's in the main list then we already know it's not stale. - */ - TAILQ_FOREACH(ce, &td->clip_table, link) { - if (IN6_ARE_ADDR_EQUAL(&ce->lip, lip)) - goto next; - } + /* XXX: races with if_vmove */ + CURVNET_SET(vi->ifp->if_vnet); + TAILQ_FOREACH(ia, &V_in6_ifaddrhead, ia_link) { + lip = &ia->ia_addr.sin6_addr; - /* - * If it's in the stale list we should move it to the main list. - */ - TAILQ_FOREACH(ce, &stale, link) { - if (IN6_ARE_ADDR_EQUAL(&ce->lip, lip)) { - TAILQ_REMOVE(&stale, ce, link); - TAILQ_INSERT_TAIL(&td->clip_table, ce, link); - goto next; + KASSERT(!IN6_IS_ADDR_MULTICAST(lip), + ("%s: mcast address in in6_ifaddr list", __func__)); + + if (IN6_IS_ADDR_LOOPBACK(lip)) + continue; + if (IN6_IS_SCOPE_EMBED(lip)) { + /* Remove the embedded scope */ + tlip = *lip; + lip = &tlip; + in6_clearscope(lip); } - } + /* + * XXX: how to weed out the link local address for the + * loopback interface? It's fe80::1 usually (always?). + */ - /* A new IP6 address; add it to the CLIP table */ - ce = malloc(sizeof(*ce), M_CXGBE, M_NOWAIT); - memcpy(&ce->lip, lip, sizeof(ce->lip)); - ce->refcount = 0; - rc = add_lip(sc, lip); - if (rc == 0) - TAILQ_INSERT_TAIL(&td->clip_table, ce, link); - else { - char ip[INET6_ADDRSTRLEN]; + /* + * If it's in the main list then we already know it's + * not stale. + */ + TAILQ_FOREACH(ce, &td->clip_table, link) { + if (IN6_ARE_ADDR_EQUAL(&ce->lip, lip)) + goto next; + } - inet_ntop(AF_INET6, &ce->lip, &ip[0], sizeof(ip)); - log(LOG_ERR, "%s: could not add %s (%d)\n", - __func__, ip, rc); - free(ce, M_CXGBE); - } + /* + * If it's in the stale list we should move it to the + * main list. + */ + TAILQ_FOREACH(ce, &stale, link) { + if (IN6_ARE_ADDR_EQUAL(&ce->lip, lip)) { + TAILQ_REMOVE(&stale, ce, link); + TAILQ_INSERT_TAIL(&td->clip_table, ce, + link); + goto next; + } + } + + /* A new IP6 address; add it to the CLIP table */ + ce = malloc(sizeof(*ce), M_CXGBE, M_NOWAIT); + memcpy(&ce->lip, lip, sizeof(ce->lip)); + ce->refcount = 0; + rc = add_lip(sc, lip); + if (rc == 0) + TAILQ_INSERT_TAIL(&td->clip_table, ce, link); + else { + char ip[INET6_ADDRSTRLEN]; + + inet_ntop(AF_INET6, &ce->lip, &ip[0], + sizeof(ip)); + log(LOG_ERR, "%s: could not add %s (%d)\n", + __func__, ip, rc); + free(ce, M_CXGBE); + } next: - continue; + continue; + } + CURVNET_RESTORE(); + last_vnet = (uintptr_t)vi->ifp->if_vnet; } /* diff --git a/sys/dev/cxgbe/tom/t4_tom.h b/sys/dev/cxgbe/tom/t4_tom.h index c0a5288e9ad8..29d819252b4d 100644 --- a/sys/dev/cxgbe/tom/t4_tom.h +++ b/sys/dev/cxgbe/tom/t4_tom.h @@ -141,6 +141,7 @@ struct toepcb { int refcount; struct tom_data *td; struct inpcb *inp; /* backpointer to host stack's PCB */ + struct vnet *vnet; struct vi_info *vi; /* virtual interface */ struct sge_wrq *ofld_txq; struct sge_ofld_rxq *ofld_rxq; @@ -232,6 +233,7 @@ struct listen_ctx { struct stid_region stid_region; int flags; struct inpcb *inp; /* listening socket's inp */ + struct vnet *vnet; struct sge_wrq *ctrlq; struct sge_ofld_rxq *ofld_rxq; struct clip_entry *ce; diff --git a/sys/dev/e1000/if_em.c b/sys/dev/e1000/if_em.c index 629ae91025d3..e874fc31474a 100644 --- a/sys/dev/e1000/if_em.c +++ b/sys/dev/e1000/if_em.c @@ -770,6 +770,8 @@ em_if_attach_pre(if_ctx_t ctx) if (adapter->hw.mac.type >= igb_mac_min) { + int try_second_bar; + scctx->isc_txqsizes[0] = roundup2(scctx->isc_ntxd[0] * sizeof(union e1000_adv_tx_desc), EM_DBA_ALIGN); scctx->isc_rxqsizes[0] = roundup2(scctx->isc_nrxd[0] * sizeof(union e1000_adv_rx_desc), EM_DBA_ALIGN); scctx->isc_txrx = &igb_txrx; @@ -779,6 +781,15 @@ em_if_attach_pre(if_ctx_t ctx) if (adapter->hw.mac.type != e1000_82575) scctx->isc_tx_csum_flags |= CSUM_SCTP | CSUM_IP6_SCTP; + /* + ** Some new devices, as with ixgbe, now may + ** use a different BAR, so we need to keep + ** track of which is used. + */ + try_second_bar = pci_read_config(dev, scctx->isc_msix_bar, 4); + if (try_second_bar == 0) + scctx->isc_msix_bar += 4; + } else if (adapter->hw.mac.type >= em_mac_min) { scctx->isc_txqsizes[0] = roundup2(scctx->isc_ntxd[0]* sizeof(struct e1000_tx_desc), EM_DBA_ALIGN); scctx->isc_rxqsizes[0] = roundup2(scctx->isc_nrxd[0] * sizeof(union e1000_rx_desc_extended), EM_DBA_ALIGN); @@ -3106,7 +3117,7 @@ em_if_enable_intr(if_ctx_t ctx) u32 ims_mask = IMS_ENABLE_MASK; if (hw->mac.type == e1000_82574) { - E1000_WRITE_REG(hw, EM_EIAC, adapter->ims); + E1000_WRITE_REG(hw, EM_EIAC, EM_MSIX_MASK); ims_mask |= adapter->ims; } if (adapter->intr_type == IFLIB_INTR_MSIX && hw->mac.type >= igb_mac_min) { u32 mask = (adapter->que_mask | adapter->link_mask); @@ -3297,6 +3308,8 @@ em_get_wakeup(if_ctx_t ctx) case e1000_ich10lan: case e1000_pchlan: case e1000_pch2lan: + case e1000_pch_lpt: + case e1000_pch_spt: apme_mask = E1000_WUC_APME; adapter->has_amt = TRUE; eeprom_data = E1000_READ_REG(&adapter->hw, E1000_WUC); @@ -3365,7 +3378,7 @@ em_enable_wakeup(if_ctx_t ctx) struct adapter *adapter = iflib_get_softc(ctx); device_t dev = iflib_get_dev(ctx); if_t ifp = iflib_get_ifp(ctx); - u32 pmc, ctrl, ctrl_ext, rctl; + u32 pmc, ctrl, ctrl_ext, rctl, wuc; u16 status; if ((pci_find_cap(dev, PCIY_PMG, &pmc) != 0)) @@ -3375,7 +3388,9 @@ em_enable_wakeup(if_ctx_t ctx) ctrl = E1000_READ_REG(&adapter->hw, E1000_CTRL); ctrl |= (E1000_CTRL_SWDPIN2 | E1000_CTRL_SWDPIN3); E1000_WRITE_REG(&adapter->hw, E1000_CTRL, ctrl); - E1000_WRITE_REG(&adapter->hw, E1000_WUC, E1000_WUC_PME_EN); + wuc = E1000_READ_REG(&adapter->hw, E1000_WUC); + wuc |= E1000_WUC_PME_EN ; + E1000_WRITE_REG(&adapter->hw, E1000_WUC, wuc); if ((adapter->hw.mac.type == e1000_ich8lan) || (adapter->hw.mac.type == e1000_pchlan) || @@ -3407,7 +3422,9 @@ em_enable_wakeup(if_ctx_t ctx) } if ((adapter->hw.mac.type == e1000_pchlan) || - (adapter->hw.mac.type == e1000_pch2lan)) { + (adapter->hw.mac.type == e1000_pch2lan) || + (adapter->hw.mac.type == e1000_pch_lpt) || + (adapter->hw.mac.type == e1000_pch_spt)) { if (em_enable_phy_wakeup(adapter)) return; } else { diff --git a/sys/dev/e1000/if_em.h b/sys/dev/e1000/if_em.h index 635d172bf458..d7290fd72455 100644 --- a/sys/dev/e1000/if_em.h +++ b/sys/dev/e1000/if_em.h @@ -25,7 +25,6 @@ */ /*$FreeBSD$*/ -#include "opt_em.h" #include "opt_ddb.h" #include "opt_inet.h" #include "opt_inet6.h" @@ -176,11 +175,7 @@ * restoring the network connection. To eliminate the potential * for the hang ensure that EM_RDTR is set to 0. */ -#ifdef EM_MULTIQUEUE -#define EM_RDTR 64 -#else #define EM_RDTR 0 -#endif /* * Receive Interrupt Absolute Delay Timer (Not valid for 82542/82543/82544) @@ -193,11 +188,7 @@ * along with EM_RDTR, may improve traffic throughput in specific network * conditions. */ -#ifdef EM_MULTIQUEUE -#define EM_RADV 128 -#else #define EM_RADV 64 -#endif /* * This parameter controls whether or not autonegotation is enabled. diff --git a/sys/dev/iscsi_initiator/isc_soc.c b/sys/dev/iscsi_initiator/isc_soc.c index 228267716b58..1e25f7268360 100644 --- a/sys/dev/iscsi_initiator/isc_soc.c +++ b/sys/dev/iscsi_initiator/isc_soc.c @@ -680,7 +680,6 @@ isc_stop_receiver(isc_session_t *sp) if(sp->fp != NULL) fdrop(sp->fp, sp->td); - fputsock(sp->soc); sp->soc = NULL; sp->fp = NULL; diff --git a/sys/dev/iscsi_initiator/iscsi.c b/sys/dev/iscsi_initiator/iscsi.c index e607f18a7296..ac3d1cc15547 100644 --- a/sys/dev/iscsi_initiator/iscsi.c +++ b/sys/dev/iscsi_initiator/iscsi.c @@ -388,20 +388,14 @@ i_setsoc(isc_session_t *sp, int fd, struct thread *td) if(sp->soc != NULL) isc_stop_receiver(sp); - error = fget(td, fd, cap_rights_init(&rights, CAP_SOCK_CLIENT), &sp->fp); + error = getsock_cap(td, fd, cap_rights_init(&rights, CAP_SOCK_CLIENT), + &sp->fp, NULL, NULL); if(error) return error; - error = fgetsock(td, fd, cap_rights_init(&rights, CAP_SOCK_CLIENT), - &sp->soc, 0); - if(error == 0) { - sp->td = td; - isc_start_receiver(sp); - } - else { - fdrop(sp->fp, td); - sp->fp = NULL; - } + sp->soc = sp->fp->f_data; + sp->td = td; + isc_start_receiver(sp); return error; } diff --git a/sys/dev/mmc/mmcsd.c b/sys/dev/mmc/mmcsd.c index 3132c21aea01..ac697a3cf814 100644 --- a/sys/dev/mmc/mmcsd.c +++ b/sys/dev/mmc/mmcsd.c @@ -170,6 +170,7 @@ mmcsd_attach(device_t dev) d->d_delmaxsize = mmc_get_erase_sector(dev) * d->d_sectorsize; strlcpy(d->d_ident, mmc_get_card_sn_string(dev), sizeof(d->d_ident)); strlcpy(d->d_descr, mmc_get_card_id_string(dev), sizeof(d->d_descr)); + d->d_rotation_rate = DISK_RR_NON_ROTATING; /* * Display in most natural units. There's no cards < 1MB. The SD diff --git a/sys/dev/mpr/mpr_table.c b/sys/dev/mpr/mpr_table.c index 6ec6492d6402..de715259de79 100644 --- a/sys/dev/mpr/mpr_table.c +++ b/sys/dev/mpr/mpr_table.c @@ -209,6 +209,7 @@ mpr_print_iocfacts(struct mpr_softc *sc, MPI2_IOC_FACTS_REPLY *facts) mpr_dprint_field(sc, MPR_XINFO, "WhoInit: %s\n", mpr_describe_table(mpr_whoinit_names, facts->WhoInit)); MPR_PRINTFIELD(sc, facts, NumberOfPorts, %d); + MPR_PRINTFIELD(sc, facts, MaxMSIxVectors, %d); MPR_PRINTFIELD(sc, facts, RequestCredit, %d); MPR_PRINTFIELD(sc, facts, ProductID, 0x%x); mpr_dprint_field(sc, MPR_XINFO, "IOCCapabilities: %b\n", diff --git a/sys/dev/mps/mps_table.c b/sys/dev/mps/mps_table.c index f6e125d77c0c..d85a71a2e55d 100644 --- a/sys/dev/mps/mps_table.c +++ b/sys/dev/mps/mps_table.c @@ -208,6 +208,7 @@ mps_print_iocfacts(struct mps_softc *sc, MPI2_IOC_FACTS_REPLY *facts) mps_dprint_field(sc, MPS_XINFO, "WhoInit: %s\n", mps_describe_table(mps_whoinit_names, facts->WhoInit)); MPS_PRINTFIELD(sc, facts, NumberOfPorts, %d); + MPS_PRINTFIELD(sc, facts, MaxMSIxVectors, %d); MPS_PRINTFIELD(sc, facts, RequestCredit, %d); MPS_PRINTFIELD(sc, facts, ProductID, 0x%x); mps_dprint_field(sc, MPS_XINFO, "IOCCapabilities: %b\n", diff --git a/sys/dev/nand/nand_geom.c b/sys/dev/nand/nand_geom.c index 593b5f5e766a..cd3f5211630b 100644 --- a/sys/dev/nand/nand_geom.c +++ b/sys/dev/nand/nand_geom.c @@ -394,6 +394,7 @@ create_geom_disk(struct nand_chip *chip) snprintf(ndisk->d_ident, sizeof(ndisk->d_ident), "nand: Man:0x%02x Dev:0x%02x", chip->id.man_id, chip->id.dev_id); + ndisk->d_rotation_rate = DISK_RR_NON_ROTATING; disk_create(ndisk, DISK_VERSION); @@ -415,6 +416,7 @@ create_geom_disk(struct nand_chip *chip) snprintf(rdisk->d_ident, sizeof(rdisk->d_ident), "nand_raw: Man:0x%02x Dev:0x%02x", chip->id.man_id, chip->id.dev_id); + rdisk->d_rotation_rate = DISK_RR_NON_ROTATING; disk_create(rdisk, DISK_VERSION); diff --git a/sys/dev/netmap/netmap_generic.c b/sys/dev/netmap/netmap_generic.c index 87072069fbcf..cb1cff1f0e71 100644 --- a/sys/dev/netmap/netmap_generic.c +++ b/sys/dev/netmap/netmap_generic.c @@ -165,12 +165,12 @@ nm_os_get_mbuf(struct ifnet *ifp, int len) * has a KASSERT(), checking that the mbuf dtor function is not NULL. */ -#define SET_MBUF_DESTRUCTOR(m, fn) do { \ - (m)->m_ext.ext_free = (void *)fn; \ -} while (0) - static void void_mbuf_dtor(struct mbuf *m, void *arg1, void *arg2) { } +#define SET_MBUF_DESTRUCTOR(m, fn) do { \ + (m)->m_ext.ext_free = fn ? (void *)fn : (void *)void_mbuf_dtor; \ +} while (0) + static inline struct mbuf * nm_os_get_mbuf(struct ifnet *ifp, int len) { diff --git a/sys/dev/nvd/nvd.c b/sys/dev/nvd/nvd.c index a9c623fe9172..bfb3d264d1e1 100644 --- a/sys/dev/nvd/nvd.c +++ b/sys/dev/nvd/nvd.c @@ -352,13 +352,11 @@ nvd_new_disk(struct nvme_namespace *ns, void *ctrlr_arg) */ nvme_strvis(disk->d_ident, nvme_ns_get_serial_number(ns), sizeof(disk->d_ident), NVME_SERIAL_NUMBER_LENGTH); - nvme_strvis(descr, nvme_ns_get_model_number(ns), sizeof(descr), NVME_MODEL_NUMBER_LENGTH); - -#if __FreeBSD_version >= 900034 strlcpy(disk->d_descr, descr, sizeof(descr)); -#endif + + disk->d_rotation_rate = DISK_RR_NON_ROTATING; ndisk->ns = ns; ndisk->disk = disk; diff --git a/sys/dev/rtwn/rtl8188e/r88e_fw.c b/sys/dev/rtwn/rtl8188e/r88e_fw.c index 435fb650238b..4ae4abbda1d7 100644 --- a/sys/dev/rtwn/rtl8188e/r88e_fw.c +++ b/sys/dev/rtwn/rtl8188e/r88e_fw.c @@ -69,7 +69,7 @@ r88e_fw_cmd(struct rtwn_softc *sc, uint8_t id, const void *buf, int len) } /* Wait for current FW box to be empty. */ - for (ntries = 0; ntries < 50; ntries++) { + for (ntries = 0; ntries < 100; ntries++) { if (!(rtwn_read_1(sc, R92C_HMETFR) & (1 << sc->fwcur))) break; rtwn_delay(sc, 2000); diff --git a/sys/dev/rtwn/rtl8192c/r92c_fw.c b/sys/dev/rtwn/rtl8192c/r92c_fw.c index b6de795e37ac..96ea3449dfea 100644 --- a/sys/dev/rtwn/rtl8192c/r92c_fw.c +++ b/sys/dev/rtwn/rtl8192c/r92c_fw.c @@ -80,7 +80,7 @@ r92c_fw_cmd(struct rtwn_softc *sc, uint8_t id, const void *buf, int len) } /* Wait for current FW box to be empty. */ - for (ntries = 0; ntries < 50; ntries++) { + for (ntries = 0; ntries < 100; ntries++) { if (!(rtwn_read_1(sc, R92C_HMETFR) & (1 << sc->fwcur))) break; rtwn_delay(sc, 2000); diff --git a/sys/dev/rtwn/rtl8192c/r92c_tx_desc.h b/sys/dev/rtwn/rtl8192c/r92c_tx_desc.h index 037ac0e2066f..c3bc87caa31f 100644 --- a/sys/dev/rtwn/rtl8192c/r92c_tx_desc.h +++ b/sys/dev/rtwn/rtl8192c/r92c_tx_desc.h @@ -68,7 +68,7 @@ struct r92c_tx_desc { uint16_t txdseq; uint32_t txdw4; -#define R92C_TXDW4_RTSRATE_M 0x0000003f +#define R92C_TXDW4_RTSRATE_M 0x0000001f #define R92C_TXDW4_RTSRATE_S 0 #define R92C_TXDW4_SEQ_SEL_M 0x00000040 #define R92C_TXDW4_SEQ_SEL_S 6 diff --git a/sys/dev/sdhci/sdhci_fdt_gpio.c b/sys/dev/sdhci/sdhci_fdt_gpio.c index c3fa6ba583d3..9935f17c66a2 100644 --- a/sys/dev/sdhci/sdhci_fdt_gpio.c +++ b/sys/dev/sdhci/sdhci_fdt_gpio.c @@ -35,6 +35,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include diff --git a/sys/dev/sfxge/common/efx_mcdi.c b/sys/dev/sfxge/common/efx_mcdi.c index dabf85e4c68f..81fb6a05c994 100644 --- a/sys/dev/sfxge/common/efx_mcdi.c +++ b/sys/dev/sfxge/common/efx_mcdi.c @@ -1725,7 +1725,8 @@ static __checkReturn efx_rc_t efx_mcdi_mac_stats( __in efx_nic_t *enp, __in_opt efsys_mem_t *esmp, - __in efx_stats_action_t action) + __in efx_stats_action_t action, + __in uint16_t period_ms) { efx_mcdi_req_t req; uint8_t payload[MAX(MC_CMD_MAC_STATS_IN_LEN, @@ -1750,7 +1751,7 @@ efx_mcdi_mac_stats( MAC_STATS_IN_PERIODIC_CHANGE, enable | events | disable, MAC_STATS_IN_PERIODIC_ENABLE, enable | events, MAC_STATS_IN_PERIODIC_NOEVENT, !events, - MAC_STATS_IN_PERIOD_MS, (enable | events) ? 1000 : 0); + MAC_STATS_IN_PERIOD_MS, (enable | events) ? period_ms : 0); if (esmp != NULL) { int bytes = MC_CMD_MAC_NSTATS * sizeof (uint64_t); @@ -1800,7 +1801,7 @@ efx_mcdi_mac_stats_clear( { efx_rc_t rc; - if ((rc = efx_mcdi_mac_stats(enp, NULL, EFX_STATS_CLEAR)) != 0) + if ((rc = efx_mcdi_mac_stats(enp, NULL, EFX_STATS_CLEAR, 0)) != 0) goto fail1; return (0); @@ -1823,7 +1824,7 @@ efx_mcdi_mac_stats_upload( * avoid having to pull the statistics buffer into the cache to * maintain cumulative statistics. */ - if ((rc = efx_mcdi_mac_stats(enp, esmp, EFX_STATS_UPLOAD)) != 0) + if ((rc = efx_mcdi_mac_stats(enp, esmp, EFX_STATS_UPLOAD, 0)) != 0) goto fail1; return (0); @@ -1838,7 +1839,7 @@ efx_mcdi_mac_stats_upload( efx_mcdi_mac_stats_periodic( __in efx_nic_t *enp, __in efsys_mem_t *esmp, - __in uint16_t period, + __in uint16_t period_ms, __in boolean_t events) { efx_rc_t rc; @@ -1847,14 +1848,17 @@ efx_mcdi_mac_stats_periodic( * The MC DMAs aggregate statistics for our convenience, so we can * avoid having to pull the statistics buffer into the cache to * maintain cumulative statistics. - * Huntington uses a fixed 1sec period, so use that on Siena too. + * Huntington uses a fixed 1sec period. + * Medford uses a fixed 1sec period before v6.2.1.1033 firmware. */ - if (period == 0) - rc = efx_mcdi_mac_stats(enp, NULL, EFX_STATS_DISABLE); + if (period_ms == 0) + rc = efx_mcdi_mac_stats(enp, NULL, EFX_STATS_DISABLE, 0); else if (events) - rc = efx_mcdi_mac_stats(enp, esmp, EFX_STATS_ENABLE_EVENTS); + rc = efx_mcdi_mac_stats(enp, esmp, EFX_STATS_ENABLE_EVENTS, + period_ms); else - rc = efx_mcdi_mac_stats(enp, esmp, EFX_STATS_ENABLE_NOEVENTS); + rc = efx_mcdi_mac_stats(enp, esmp, EFX_STATS_ENABLE_NOEVENTS, + period_ms); if (rc != 0) goto fail1; diff --git a/sys/dev/sfxge/common/efx_mcdi.h b/sys/dev/sfxge/common/efx_mcdi.h index ffa50f1948dc..ee11789e83aa 100644 --- a/sys/dev/sfxge/common/efx_mcdi.h +++ b/sys/dev/sfxge/common/efx_mcdi.h @@ -218,7 +218,7 @@ extern __checkReturn efx_rc_t efx_mcdi_mac_stats_periodic( __in efx_nic_t *enp, __in efsys_mem_t *esmp, - __in uint16_t period, + __in uint16_t period_ms, __in boolean_t events); diff --git a/sys/dev/sfxge/sfxge.h b/sys/dev/sfxge/sfxge.h index 2000652974d9..ed8b49d6fb28 100644 --- a/sys/dev/sfxge/sfxge.h +++ b/sys/dev/sfxge/sfxge.h @@ -159,6 +159,8 @@ enum sfxge_evq_state { #define SFXGE_EV_BATCH 16384 +#define SFXGE_STATS_UPDATE_PERIOD_MS 1000 + struct sfxge_evq { /* Structure members below are sorted by usage order */ struct sfxge_softc *sc; @@ -246,6 +248,7 @@ struct sfxge_port { #endif struct sfxge_hw_stats phy_stats; struct sfxge_hw_stats mac_stats; + uint16_t stats_update_period_ms; efx_link_mode_t link_mode; uint8_t mcast_addrs[EFX_MAC_MULTICAST_LIST_MAX * EFX_MAC_ADDR_LEN]; diff --git a/sys/dev/sfxge/sfxge_port.c b/sys/dev/sfxge/sfxge_port.c index 58793ca54efd..5723f31b507a 100644 --- a/sys/dev/sfxge/sfxge_port.c +++ b/sys/dev/sfxge/sfxge_port.c @@ -43,6 +43,15 @@ __FBSDID("$FreeBSD$"); #include "sfxge.h" +#define SFXGE_PARAM_STATS_UPDATE_PERIOD_MS \ + SFXGE_PARAM(stats_update_period_ms) +static int sfxge_stats_update_period_ms = SFXGE_STATS_UPDATE_PERIOD_MS; +TUNABLE_INT(SFXGE_PARAM_STATS_UPDATE_PERIOD_MS, + &sfxge_stats_update_period_ms); +SYSCTL_INT(_hw_sfxge, OID_AUTO, stats_update_period_ms, CTLFLAG_RDTUN, + &sfxge_stats_update_period_ms, 0, + "netstat interface statistics update period in milliseconds"); + static int sfxge_phy_cap_mask(struct sfxge_softc *, int, uint32_t *); static int @@ -51,6 +60,7 @@ sfxge_mac_stat_update(struct sfxge_softc *sc) struct sfxge_port *port = &sc->port; efsys_mem_t *esmp = &(port->mac_stats.dma_buf); clock_t now; + unsigned int min_ticks; unsigned int count; int rc; @@ -61,8 +71,10 @@ sfxge_mac_stat_update(struct sfxge_softc *sc) goto out; } + min_ticks = (unsigned int)hz * port->stats_update_period_ms / 1000; + now = ticks; - if ((unsigned int)(now - port->mac_stats.update_time) < (unsigned int)hz) { + if ((unsigned int)(now - port->mac_stats.update_time) < min_ticks) { rc = 0; goto out; } @@ -510,9 +522,10 @@ sfxge_port_start(struct sfxge_softc *sc) sfxge_mac_filter_set_locked(sc); - /* Update MAC stats by DMA every second */ + /* Update MAC stats by DMA every period */ if ((rc = efx_mac_stats_periodic(enp, &port->mac_stats.dma_buf, - 1000, B_FALSE)) != 0) + port->stats_update_period_ms, + B_FALSE)) != 0) goto fail6; if ((rc = efx_mac_drain(enp, B_FALSE)) != 0) @@ -669,6 +682,68 @@ sfxge_port_fini(struct sfxge_softc *sc) port->sc = NULL; } +static uint16_t +sfxge_port_stats_update_period_ms(struct sfxge_softc *sc) +{ + int period_ms = sfxge_stats_update_period_ms; + + if (period_ms < 0) { + device_printf(sc->dev, + "treat negative stats update period %d as 0 (disable)\n", + period_ms); + period_ms = 0; + } else if (period_ms > UINT16_MAX) { + device_printf(sc->dev, + "treat too big stats update period %d as %u\n", + period_ms, UINT16_MAX); + period_ms = UINT16_MAX; + } + + return period_ms; +} + +static int +sfxge_port_stats_update_period_ms_handler(SYSCTL_HANDLER_ARGS) +{ + struct sfxge_softc *sc; + struct sfxge_port *port; + unsigned int period_ms; + int error; + + sc = arg1; + port = &sc->port; + + if (req->newptr != NULL) { + error = SYSCTL_IN(req, &period_ms, sizeof(period_ms)); + if (error != 0) + return (error); + + if (period_ms > UINT16_MAX) + return (EINVAL); + + SFXGE_PORT_LOCK(port); + + if (port->stats_update_period_ms != period_ms) { + if (port->init_state == SFXGE_PORT_STARTED) + error = efx_mac_stats_periodic(sc->enp, + &port->mac_stats.dma_buf, + period_ms, B_FALSE); + if (error == 0) + port->stats_update_period_ms = period_ms; + } + + SFXGE_PORT_UNLOCK(port); + } else { + SFXGE_PORT_LOCK(port); + period_ms = port->stats_update_period_ms; + SFXGE_PORT_UNLOCK(port); + + error = SYSCTL_OUT(req, &period_ms, sizeof(period_ms)); + } + + return (error); +} + int sfxge_port_init(struct sfxge_softc *sc) { @@ -717,8 +792,14 @@ sfxge_port_init(struct sfxge_softc *sc) M_SFXGE, M_WAITOK | M_ZERO); if ((rc = sfxge_dma_alloc(sc, EFX_MAC_STATS_SIZE, mac_stats_buf)) != 0) goto fail2; + port->stats_update_period_ms = sfxge_port_stats_update_period_ms(sc); sfxge_mac_stat_init(sc); + SYSCTL_ADD_PROC(sysctl_ctx, SYSCTL_CHILDREN(sysctl_tree), OID_AUTO, + "stats_update_period_ms", CTLTYPE_UINT|CTLFLAG_RW, sc, 0, + sfxge_port_stats_update_period_ms_handler, "IU", + "interface statistics refresh period"); + port->init_state = SFXGE_PORT_INITIALIZED; DBGPRINT(sc->dev, "success"); diff --git a/sys/dev/uart/uart_bus_pci.c b/sys/dev/uart/uart_bus_pci.c index 2203c3f2d66f..13be31f6c4fe 100644 --- a/sys/dev/uart/uart_bus_pci.c +++ b/sys/dev/uart/uart_bus_pci.c @@ -45,12 +45,14 @@ __FBSDID("$FreeBSD$"); #define DEFAULT_RCLK 1843200 static int uart_pci_probe(device_t dev); +static int uart_pci_attach(device_t dev); +static int uart_pci_detach(device_t dev); static device_method_t uart_pci_methods[] = { /* Device interface */ DEVMETHOD(device_probe, uart_pci_probe), - DEVMETHOD(device_attach, uart_bus_attach), - DEVMETHOD(device_detach, uart_bus_detach), + DEVMETHOD(device_attach, uart_pci_attach), + DEVMETHOD(device_detach, uart_pci_detach), DEVMETHOD(device_resume, uart_bus_resume), DEVMETHOD_END }; @@ -209,4 +211,40 @@ uart_pci_probe(device_t dev) return (result); } +static int +uart_pci_attach(device_t dev) +{ + struct uart_softc *sc; + int count; + + sc = device_get_softc(dev); + + /* + * Use MSI in preference to legacy IRQ if available. + * Whilst some PCIe UARTs support >1 MSI vector, use only the first. + */ + if (pci_msi_count(dev) > 0) { + count = 1; + if (pci_alloc_msi(dev, &count) == 0) { + sc->sc_irid = 1; + device_printf(dev, "Using %d MSI message\n", count); + } + } + + return (uart_bus_attach(dev)); +} + +static int +uart_pci_detach(device_t dev) +{ + struct uart_softc *sc; + + sc = device_get_softc(dev); + + if (sc->sc_irid != 0) + pci_release_msi(dev); + + return (uart_bus_detach(dev)); +} + DRIVER_MODULE(uart, pci, uart_pci_driver, uart_devclass, NULL, NULL); diff --git a/sys/dev/uart/uart_core.c b/sys/dev/uart/uart_core.c index 6c9d7aa23a06..cc2d0dc82ff0 100644 --- a/sys/dev/uart/uart_core.c +++ b/sys/dev/uart/uart_core.c @@ -677,7 +677,6 @@ uart_bus_attach(device_t dev) * safest thing to do. */ if (filt != FILTER_SCHEDULE_THREAD && !uart_force_poll) { - sc->sc_irid = 0; sc->sc_ires = bus_alloc_resource_any(dev, SYS_RES_IRQ, &sc->sc_irid, RF_ACTIVE | RF_SHAREABLE); } diff --git a/sys/fs/tmpfs/tmpfs.h b/sys/fs/tmpfs/tmpfs.h index cf1e3fa3cac9..8cd1c4b6dcdf 100644 --- a/sys/fs/tmpfs/tmpfs.h +++ b/sys/fs/tmpfs/tmpfs.h @@ -312,12 +312,12 @@ struct tmpfs_mount { /* Maximum number of memory pages available for use by the file * system, set during mount time. This variable must never be * used directly as it may be bigger than the current amount of - * free memory; in the extreme case, it will hold the SIZE_MAX + * free memory; in the extreme case, it will hold the ULONG_MAX * value. */ - size_t tm_pages_max; + u_long tm_pages_max; /* Number of pages in use by the file system. */ - size_t tm_pages_used; + u_long tm_pages_used; /* Pointer to the node representing the root directory of this * file system. */ diff --git a/sys/fs/tmpfs/tmpfs_subr.c b/sys/fs/tmpfs/tmpfs_subr.c index 42a822c2038e..0af55eccf8bf 100644 --- a/sys/fs/tmpfs/tmpfs_subr.c +++ b/sys/fs/tmpfs/tmpfs_subr.c @@ -129,7 +129,7 @@ tmpfs_pages_check_avail(struct tmpfs_mount *tmp, size_t req_pages) if (tmpfs_mem_avail() < req_pages) return (0); - if (tmp->tm_pages_max != SIZE_MAX && + if (tmp->tm_pages_max != ULONG_MAX && tmp->tm_pages_max < req_pages + tmpfs_pages_used(tmp)) return (0); @@ -327,9 +327,7 @@ tmpfs_free_node(struct tmpfs_mount *tmp, struct tmpfs_node *node) case VREG: uobj = node->tn_reg.tn_aobj; if (uobj != NULL) { - TMPFS_LOCK(tmp); - tmp->tm_pages_used -= uobj->size; - TMPFS_UNLOCK(tmp); + atomic_subtract_long(&tmp->tm_pages_used, uobj->size); KASSERT((uobj->flags & OBJ_TMPFS) == 0, ("leaked OBJ_TMPFS node %p vm_obj %p", node, uobj)); vm_object_deallocate(uobj); @@ -1417,9 +1415,7 @@ tmpfs_reg_resize(struct vnode *vp, off_t newsize, boolean_t ignerr) uobj->size = newpages; VM_OBJECT_WUNLOCK(uobj); - TMPFS_LOCK(tmp); - tmp->tm_pages_used += (newpages - oldpages); - TMPFS_UNLOCK(tmp); + atomic_add_long(&tmp->tm_pages_used, newpages - oldpages); node->tn_size = newsize; return (0); diff --git a/sys/fs/tmpfs/tmpfs_vfsops.c b/sys/fs/tmpfs/tmpfs_vfsops.c index 67de4b6716f2..869b6f1feafb 100644 --- a/sys/fs/tmpfs/tmpfs_vfsops.c +++ b/sys/fs/tmpfs/tmpfs_vfsops.c @@ -397,7 +397,7 @@ tmpfs_statfs(struct mount *mp, struct statfs *sbp) sbp->f_bsize = PAGE_SIZE; used = tmpfs_pages_used(tmp); - if (tmp->tm_pages_max != SIZE_MAX) + if (tmp->tm_pages_max != ULONG_MAX) sbp->f_blocks = tmp->tm_pages_max; else sbp->f_blocks = used + tmpfs_mem_avail(); diff --git a/sys/geom/geom_disk.c b/sys/geom/geom_disk.c index dbaa6b524db3..9a52ad1a3586 100644 --- a/sys/geom/geom_disk.c +++ b/sys/geom/geom_disk.c @@ -588,12 +588,12 @@ g_disk_dumpconf(struct sbuf *sb, const char *indent, struct g_geom *gp, struct g * special cases, and there's also a valid range. */ sbuf_printf(sb, "%s", indent); - if (dp->d_rotation_rate == 0) /* Old drives don't */ - sbuf_printf(sb, "unknown"); /* report RPM. */ - else if (dp->d_rotation_rate == 1) /* Since 0 is used */ - sbuf_printf(sb, "0"); /* above, SSDs use 1. */ - else if ((dp->d_rotation_rate >= 0x041) && - (dp->d_rotation_rate <= 0xfffe)) + if (dp->d_rotation_rate == DISK_RR_UNKNOWN) /* Old drives */ + sbuf_printf(sb, "unknown"); /* don't report RPM. */ + else if (dp->d_rotation_rate == DISK_RR_NON_ROTATING) + sbuf_printf(sb, "0"); + else if ((dp->d_rotation_rate >= DISK_RR_MIN) && + (dp->d_rotation_rate <= DISK_RR_MAX)) sbuf_printf(sb, "%u", dp->d_rotation_rate); else sbuf_printf(sb, "invalid"); diff --git a/sys/geom/geom_disk.h b/sys/geom/geom_disk.h index 5fce5b93f69c..642a51296051 100644 --- a/sys/geom/geom_disk.h +++ b/sys/geom/geom_disk.h @@ -119,6 +119,11 @@ struct disk { #define DISKFLAG_DIRECT_COMPLETION 0x20 #define DISKFLAG_CANZONE 0x80 +#define DISK_RR_UNKNOWN 0 +#define DISK_RR_NON_ROTATING 1 +#define DISK_RR_MIN 0x0401 +#define DISK_RR_MAX 0xfffe + struct disk *disk_alloc(void); void disk_create(struct disk *disk, int version); void disk_destroy(struct disk *disk); diff --git a/sys/geom/raid/md_ddf.c b/sys/geom/raid/md_ddf.c index df58a1e8da03..87da8feedf9f 100644 --- a/sys/geom/raid/md_ddf.c +++ b/sys/geom/raid/md_ddf.c @@ -1161,6 +1161,16 @@ ddf_meta_read(struct g_consumer *cp, struct ddf_meta *meta) (GET16(meta, hdr->Configuration_Record_Length) * ss - 512) / 12)); } + if (GET32(meta, hdr->cd_length) * ss >= MAXPHYS || + GET32(meta, hdr->pdr_length) * ss >= MAXPHYS || + GET32(meta, hdr->vdr_length) * ss >= MAXPHYS || + GET32(meta, hdr->cr_length) * ss >= MAXPHYS || + GET32(meta, hdr->pdd_length) * ss >= MAXPHYS || + GET32(meta, hdr->bbmlog_length) * ss >= MAXPHYS) { + G_RAID_DEBUG(1, "%s: Blocksize is too big.", pp->name); + goto hdrerror; + } + /* Read controller data. */ buf = g_read_data(cp, (lba + GET32(meta, hdr->cd_section)) * ss, GET32(meta, hdr->cd_length) * ss, &error); diff --git a/sys/geom/raid/md_promise.c b/sys/geom/raid/md_promise.c index 245cd74f7dbb..258b4d30ec19 100644 --- a/sys/geom/raid/md_promise.c +++ b/sys/geom/raid/md_promise.c @@ -341,6 +341,11 @@ promise_meta_read(struct g_consumer *cp, struct promise_raid_conf **metaarr) pp = cp->provider; subdisks = 0; + + if (pp->sectorsize * 4 > MAXPHYS) { + G_RAID_DEBUG(1, "%s: Blocksize is too big.", pp->name); + return (subdisks); + } next: /* Read metadata block. */ buf = g_read_data(cp, pp->mediasize - pp->sectorsize * diff --git a/sys/i386/i386/pmap.c b/sys/i386/i386/pmap.c index b4eef419a698..1dc61ad4002d 100644 --- a/sys/i386/i386/pmap.c +++ b/sys/i386/i386/pmap.c @@ -4216,8 +4216,14 @@ pmap_zero_page(vm_page_t m) invlcaddr(pc->pc_cmap_addr2); pagezero(pc->pc_cmap_addr2); *cmap_pte2 = 0; - mtx_unlock(&pc->pc_cmap_lock); + + /* + * Unpin the thread before releasing the lock. Otherwise the thread + * could be rescheduled while still bound to the current CPU, only + * to unpin itself immediately upon resuming execution. + */ sched_unpin(); + mtx_unlock(&pc->pc_cmap_lock); } /* @@ -4244,8 +4250,8 @@ pmap_zero_page_area(vm_page_t m, int off, int size) else bzero(pc->pc_cmap_addr2 + off, size); *cmap_pte2 = 0; - mtx_unlock(&pc->pc_cmap_lock); sched_unpin(); + mtx_unlock(&pc->pc_cmap_lock); } /* @@ -4275,8 +4281,8 @@ pmap_copy_page(vm_page_t src, vm_page_t dst) bcopy(pc->pc_cmap_addr1, pc->pc_cmap_addr2, PAGE_SIZE); *cmap_pte1 = 0; *cmap_pte2 = 0; - mtx_unlock(&pc->pc_cmap_lock); sched_unpin(); + mtx_unlock(&pc->pc_cmap_lock); } int unmapped_buf_allowed = 1; @@ -4323,8 +4329,8 @@ pmap_copy_pages(vm_page_t ma[], vm_offset_t a_offset, vm_page_t mb[], } *cmap_pte1 = 0; *cmap_pte2 = 0; - mtx_unlock(&pc->pc_cmap_lock); sched_unpin(); + mtx_unlock(&pc->pc_cmap_lock); } /* @@ -5310,8 +5316,8 @@ pmap_flush_page(vm_page_t m) if (useclflushopt || cpu_vendor_id != CPU_VENDOR_INTEL) mfence(); *cmap_pte2 = 0; - mtx_unlock(&pc->pc_cmap_lock); sched_unpin(); + mtx_unlock(&pc->pc_cmap_lock); } else pmap_invalidate_cache(); } diff --git a/sys/kern/kern_acct.c b/sys/kern/kern_acct.c index 622a6a49ea19..5d17642e625b 100644 --- a/sys/kern/kern_acct.c +++ b/sys/kern/kern_acct.c @@ -469,8 +469,8 @@ static uint32_t encode_timeval(struct timeval tv) { int log2_s; - int val, exp; /* Unnormalized value and exponent */ - int norm_exp; /* Normalized exponent */ + int val, exponent; /* Unnormalized value and exponent */ + int norm_exponent; /* Normalized exponent */ int shift; /* @@ -481,7 +481,7 @@ encode_timeval(struct timeval tv) if (tv.tv_sec == 0) { if (tv.tv_usec == 0) return (0); - exp = 0; + exponent = 0; val = tv.tv_usec; } else { /* @@ -490,24 +490,24 @@ encode_timeval(struct timeval tv) */ log2_s = fls(tv.tv_sec) - 1; if (log2_s + LOG2_1M < CALC_BITS) { - exp = 0; + exponent = 0; val = 1000000 * tv.tv_sec + tv.tv_usec; } else { - exp = log2_s + LOG2_1M - CALC_BITS; + exponent = log2_s + LOG2_1M - CALC_BITS; val = (unsigned int)(((uint64_t)1000000 * tv.tv_sec + - tv.tv_usec) >> exp); + tv.tv_usec) >> exponent); } } /* Now normalize and pack the value into an IEEE-754 float. */ - norm_exp = fls(val) - 1; - shift = FLT_MANT_DIG - norm_exp - 1; + norm_exponent = fls(val) - 1; + shift = FLT_MANT_DIG - norm_exponent - 1; #ifdef ACCT_DEBUG printf("val=%d exp=%d shift=%d log2(val)=%d\n", - val, exp, shift, norm_exp); - printf("exp=%x mant=%x\n", FLT_MAX_EXP - 1 + exp + norm_exp, + val, exponent, shift, norm_exponent); + printf("exp=%x mant=%x\n", FLT_MAX_EXP - 1 + exponent + norm_exponent, ((shift > 0 ? (val << shift) : (val >> -shift)) & MANT_MASK)); #endif - return (((FLT_MAX_EXP - 1 + exp + norm_exp) << (FLT_MANT_DIG - 1)) | + return (((FLT_MAX_EXP - 1 + exponent + norm_exponent) << (FLT_MANT_DIG - 1)) | ((shift > 0 ? val << shift : val >> -shift) & MANT_MASK)); } @@ -518,7 +518,7 @@ encode_timeval(struct timeval tv) static uint32_t encode_long(long val) { - int norm_exp; /* Normalized exponent */ + int norm_exponent; /* Normalized exponent */ int shift; if (val == 0) @@ -529,15 +529,15 @@ encode_long(long val) val); val = LONG_MAX; } - norm_exp = fls(val) - 1; - shift = FLT_MANT_DIG - norm_exp - 1; + norm_exponent = fls(val) - 1; + shift = FLT_MANT_DIG - norm_exponent - 1; #ifdef ACCT_DEBUG printf("val=%d shift=%d log2(val)=%d\n", - val, shift, norm_exp); - printf("exp=%x mant=%x\n", FLT_MAX_EXP - 1 + exp + norm_exp, + val, shift, norm_exponent); + printf("exp=%x mant=%x\n", FLT_MAX_EXP - 1 + exp + norm_exponent, ((shift > 0 ? (val << shift) : (val >> -shift)) & MANT_MASK)); #endif - return (((FLT_MAX_EXP - 1 + norm_exp) << (FLT_MANT_DIG - 1)) | + return (((FLT_MAX_EXP - 1 + norm_exponent) << (FLT_MANT_DIG - 1)) | ((shift > 0 ? val << shift : val >> -shift) & MANT_MASK)); } diff --git a/sys/kern/kern_descrip.c b/sys/kern/kern_descrip.c index f470b045de66..fd6c796da14d 100644 --- a/sys/kern/kern_descrip.c +++ b/sys/kern/kern_descrip.c @@ -67,7 +67,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include #include @@ -2839,61 +2838,6 @@ fgetvp_write(struct thread *td, int fd, cap_rights_t *rightsp, } #endif -/* - * Like fget() but loads the underlying socket, or returns an error if the - * descriptor does not represent a socket. - * - * We bump the ref count on the returned socket. XXX Also obtain the SX lock - * in the future. - * - * Note: fgetsock() and fputsock() are deprecated, as consumers should rely - * on their file descriptor reference to prevent the socket from being free'd - * during use. - */ -int -fgetsock(struct thread *td, int fd, cap_rights_t *rightsp, struct socket **spp, - u_int *fflagp) -{ - struct file *fp; - int error; - - *spp = NULL; - if (fflagp != NULL) - *fflagp = 0; - if ((error = _fget(td, fd, &fp, 0, rightsp, NULL)) != 0) - return (error); - if (fp->f_type != DTYPE_SOCKET) { - error = ENOTSOCK; - } else { - *spp = fp->f_data; - if (fflagp) - *fflagp = fp->f_flag; - SOCK_LOCK(*spp); - soref(*spp); - SOCK_UNLOCK(*spp); - } - fdrop(fp, td); - - return (error); -} - -/* - * Drop the reference count on the socket and XXX release the SX lock in the - * future. The last reference closes the socket. - * - * Note: fputsock() is deprecated, see comment for fgetsock(). - */ -void -fputsock(struct socket *so) -{ - - ACCEPT_LOCK(); - SOCK_LOCK(so); - CURVNET_SET(so->so_vnet); - sorele(so); - CURVNET_RESTORE(); -} - /* * Handle the last reference to a file being closed. */ diff --git a/sys/kern/kern_shutdown.c b/sys/kern/kern_shutdown.c index f981c8093623..370a5447be4d 100644 --- a/sys/kern/kern_shutdown.c +++ b/sys/kern/kern_shutdown.c @@ -733,13 +733,13 @@ vpanic(const char *fmt, va_list ap) CPU_CLR(PCPU_GET(cpuid), &other_cpus); stop_cpus_hard(other_cpus); } +#endif /* * Ensure that the scheduler is stopped while panicking, even if panic * has been entered from kdb. */ td->td_stopsched = 1; -#endif bootopt = RB_AUTOBOOT; newpanic = 0; diff --git a/sys/kern/subr_unit.c b/sys/kern/subr_unit.c index 5a627625cb6c..3d510775b9ef 100644 --- a/sys/kern/subr_unit.c +++ b/sys/kern/subr_unit.c @@ -216,7 +216,7 @@ ub_full(struct unrb *ub, int len) * Consistency check function. * * Checks the internal consistency as well as we can. - * + * * Called at all boundaries of this API. */ static void @@ -240,7 +240,7 @@ check_unrhdr(struct unrhdr *uh, int line) w = 0; bit_count(ub->map, 0, up->len, &w); y += w; - } else if (up->ptr != NULL) + } else if (up->ptr != NULL) y += up->len; } KASSERT (y == uh->busy, @@ -375,7 +375,7 @@ is_bitmap(struct unrhdr *uh, struct unr *up) /* * Look for sequence of items which can be combined into a bitmap, if * multiple are present, take the one which saves most memory. - * + * * Return (1) if a sequence was found to indicate that another call * might be able to do more. Return (0) if we found no suitable sequence. * @@ -591,7 +591,7 @@ alloc_unrl(struct unrhdr *uh) } /* - * We can always allocate from the first list element, so if we have + * We can always allocate from the first list element, so if we have * nothing on the list, we must have run out of unit numbers. */ if (up == NULL) @@ -803,7 +803,7 @@ free_unrl(struct unrhdr *uh, u_int item, void **p1, void **p2) /* Handle bitmap items */ if (is_bitmap(uh, up)) { ub = up->ptr; - + KASSERT(bit_test(ub->map, item) != 0, ("UNR: Freeing free item %d (bitmap)\n", item)); bit_clear(ub->map, item); @@ -909,7 +909,7 @@ print_unr(struct unrhdr *uh, struct unr *up) for (x = 0; x < up->len; x++) { if (bit_test(ub->map, x)) printf("#"); - else + else printf(" "); } printf("]\n"); @@ -986,7 +986,7 @@ main(int argc, char **argv) long count = 10000; /* Number of unrs to test */ long reps = 1, m; int ch; - u_int i, x, j; + u_int i, j; verbose = false; @@ -999,7 +999,7 @@ main(int argc, char **argv) usage(argv); exit(2); } - + break; case 'v': verbose = true; @@ -1026,7 +1026,6 @@ main(int argc, char **argv) printf("sizeof(struct unrb) %zu\n", sizeof(struct unrb)); printf("sizeof(struct unrhdr) %zu\n", sizeof(struct unrhdr)); printf("NBITS %lu\n", (unsigned long)NBITS); - x = 1; for (m = 0; m < count * reps; m++) { j = random(); i = (j >> 1) % count; diff --git a/sys/kern/tty.c b/sys/kern/tty.c index b37d5a557b4c..b0a535cb67e3 100644 --- a/sys/kern/tty.c +++ b/sys/kern/tty.c @@ -95,64 +95,101 @@ static const char *dev_console_filename; #define TTY_CALLOUT(tp,d) (dev2unit(d) & TTYUNIT_CALLOUT) +static int tty_drainwait = 5 * 60; +SYSCTL_INT(_kern, OID_AUTO, tty_drainwait, CTLFLAG_RWTUN, + &tty_drainwait, 0, "Default output drain timeout in seconds"); + /* * Set TTY buffer sizes. */ #define TTYBUF_MAX 65536 -static void +/* + * Allocate buffer space if necessary, and set low watermarks, based on speed. + * Note that the ttyxxxq_setsize() functions may drop and then reacquire the tty + * lock during memory allocation. They will return ENXIO if the tty disappears + * while unlocked. + */ +static int tty_watermarks(struct tty *tp) { size_t bs = 0; + int error; - /* Provide an input buffer for 0.2 seconds of data. */ + /* Provide an input buffer for 2 seconds of data. */ if (tp->t_termios.c_cflag & CREAD) bs = MIN(tp->t_termios.c_ispeed / 5, TTYBUF_MAX); - ttyinq_setsize(&tp->t_inq, tp, bs); + error = ttyinq_setsize(&tp->t_inq, tp, bs); + if (error != 0) + return (error); /* Set low watermark at 10% (when 90% is available). */ tp->t_inlow = (ttyinq_getallocatedsize(&tp->t_inq) * 9) / 10; - /* Provide an output buffer for 0.2 seconds of data. */ + /* Provide an output buffer for 2 seconds of data. */ bs = MIN(tp->t_termios.c_ospeed / 5, TTYBUF_MAX); - ttyoutq_setsize(&tp->t_outq, tp, bs); + error = ttyoutq_setsize(&tp->t_outq, tp, bs); + if (error != 0) + return (error); /* Set low watermark at 10% (when 90% is available). */ tp->t_outlow = (ttyoutq_getallocatedsize(&tp->t_outq) * 9) / 10; + + return (0); } static int tty_drain(struct tty *tp, int leaving) { - size_t bytesused; + sbintime_t timeout_at; + size_t bytes; int error; if (ttyhook_hashook(tp, getc_inject)) /* buffer is inaccessible */ return (0); - while (ttyoutq_bytesused(&tp->t_outq) > 0 || ttydevsw_busy(tp)) { - ttydevsw_outwakeup(tp); - /* Could be handled synchronously. */ - bytesused = ttyoutq_bytesused(&tp->t_outq); - if (bytesused == 0 && !ttydevsw_busy(tp)) + /* + * For close(), use the recent historic timeout of "1 second without + * making progress". For tcdrain(), use t_drainwait as the timeout, + * with zero meaning "no timeout" which gives POSIX behavior. + */ + if (leaving) + timeout_at = getsbinuptime() + SBT_1S; + else if (tp->t_drainwait != 0) + timeout_at = getsbinuptime() + SBT_1S * tp->t_drainwait; + else + timeout_at = 0; + + /* + * Poll the output buffer and the hardware for completion, at 10 Hz. + * Polling is required for devices which are not able to signal an + * interrupt when the transmitter becomes idle (most USB serial devs). + * The unusual structure of this loop ensures we check for busy one more + * time after tty_timedwait() returns EWOULDBLOCK, so that success has + * higher priority than timeout if the IO completed in the last 100mS. + */ + error = 0; + bytes = ttyoutq_bytesused(&tp->t_outq); + for (;;) { + if (ttyoutq_bytesused(&tp->t_outq) == 0 && !ttydevsw_busy(tp)) return (0); - - /* Wait for data to be drained. */ - if (leaving) { - error = tty_timedwait(tp, &tp->t_outwait, hz); - if (error == EWOULDBLOCK && - ttyoutq_bytesused(&tp->t_outq) < bytesused) - error = 0; - } else - error = tty_wait(tp, &tp->t_outwait); - - if (error) + if (error != 0) return (error); + ttydevsw_outwakeup(tp); + error = tty_timedwait(tp, &tp->t_outwait, hz / 10); + if (error != 0 && error != EWOULDBLOCK) + return (error); + else if (timeout_at == 0 || getsbinuptime() < timeout_at) + error = 0; + else if (leaving && ttyoutq_bytesused(&tp->t_outq) < bytes) { + /* In close, making progress, grant an extra second. */ + error = 0; + timeout_at += SBT_1S; + bytes = ttyoutq_bytesused(&tp->t_outq); + } } - - return (0); } /* @@ -294,7 +331,9 @@ ttydev_open(struct cdev *dev, int oflags, int devtype __unused, goto done; ttydisc_open(tp); - tty_watermarks(tp); /* XXXGL: drops lock */ + error = tty_watermarks(tp); + if (error != 0) + goto done; } /* Wait for Carrier Detect. */ @@ -1015,6 +1054,7 @@ tty_alloc_mutex(struct ttydevsw *tsw, void *sc, struct mtx *mutex) tp->t_devsw = tsw; tp->t_devswsoftc = sc; tp->t_flags = tsw->tsw_flags; + tp->t_drainwait = tty_drainwait; tty_init_termios(tp); @@ -1602,7 +1642,9 @@ tty_generic_ioctl(struct tty *tp, u_long cmd, void *data, int fflag, tp->t_termios.c_ospeed = t->c_ospeed; /* Baud rate has changed - update watermarks. */ - tty_watermarks(tp); + error = tty_watermarks(tp); + if (error) + return (error); } /* Copy new non-device driver parameters. */ @@ -1755,6 +1797,14 @@ tty_generic_ioctl(struct tty *tp, u_long cmd, void *data, int fflag, case TIOCDRAIN: /* Drain TTY output. */ return tty_drain(tp, 0); + case TIOCGDRAINWAIT: + *(int *)data = tp->t_drainwait; + return (0); + case TIOCSDRAINWAIT: + error = priv_check(td, PRIV_TTY_DRAINWAIT); + if (error == 0) + tp->t_drainwait = *(int *)data; + return (error); case TIOCCONS: /* Set terminal as console TTY. */ if (*(int *)data) { diff --git a/sys/kern/tty_inq.c b/sys/kern/tty_inq.c index 97017ac75a41..163b19459fe9 100644 --- a/sys/kern/tty_inq.c +++ b/sys/kern/tty_inq.c @@ -112,7 +112,7 @@ static uma_zone_t ttyinq_zone; TTYINQ_INSERT_TAIL(ti, tib); \ } while (0) -void +int ttyinq_setsize(struct ttyinq *ti, struct tty *tp, size_t size) { struct ttyinq_block *tib; @@ -134,8 +134,14 @@ ttyinq_setsize(struct ttyinq *ti, struct tty *tp, size_t size) tib = uma_zalloc(ttyinq_zone, M_WAITOK); tty_lock(tp); + if (tty_gone(tp)) { + uma_zfree(ttyinq_zone, tib); + return (ENXIO); + } + TTYINQ_INSERT_TAIL(ti, tib); } + return (0); } void diff --git a/sys/kern/tty_outq.c b/sys/kern/tty_outq.c index 5d40abe1a853..3f86e11b9b30 100644 --- a/sys/kern/tty_outq.c +++ b/sys/kern/tty_outq.c @@ -89,7 +89,7 @@ ttyoutq_flush(struct ttyoutq *to) to->to_end = 0; } -void +int ttyoutq_setsize(struct ttyoutq *to, struct tty *tp, size_t size) { struct ttyoutq_block *tob; @@ -111,8 +111,14 @@ ttyoutq_setsize(struct ttyoutq *to, struct tty *tp, size_t size) tob = uma_zalloc(ttyoutq_zone, M_WAITOK); tty_lock(tp); + if (tty_gone(tp)) { + uma_zfree(ttyoutq_zone, tob); + return (ENXIO); + } + TTYOUTQ_INSERT_TAIL(to, tob); } + return (0); } void diff --git a/sys/kern/uipc_mbuf2.c b/sys/kern/uipc_mbuf2.c index 7e44eb6d3de8..3568a3aa609a 100644 --- a/sys/kern/uipc_mbuf2.c +++ b/sys/kern/uipc_mbuf2.c @@ -159,7 +159,7 @@ m_pulldown(struct mbuf *m, int off, int len, int *offp) * the target data is on . * if we got enough data on the mbuf "n", we're done. */ - if ((off == 0 || offp) && len <= n->m_len - off && writable) + if ((off == 0 || offp) && len <= n->m_len - off) goto ok; /* diff --git a/sys/libkern/bcmp.c b/sys/libkern/bcmp.c index 90576c6d4c62..cd00ba9e6b52 100644 --- a/sys/libkern/bcmp.c +++ b/sys/libkern/bcmp.c @@ -44,7 +44,7 @@ typedef const unsigned long *culp; int bcmp(b1, b2, length) const void *b1, *b2; - register size_t length; + size_t length; { #if BYTE_ORDER == LITTLE_ENDIAN /* diff --git a/sys/libkern/bsearch.c b/sys/libkern/bsearch.c index 298f32735dfc..cbac2fb762b2 100644 --- a/sys/libkern/bsearch.c +++ b/sys/libkern/bsearch.c @@ -54,16 +54,16 @@ __FBSDID("$FreeBSD$"); */ void * bsearch(key, base0, nmemb, size, compar) - register const void *key; + const void *key; const void *base0; size_t nmemb; - register size_t size; - register int (*compar)(const void *, const void *); + size_t size; + int (*compar)(const void *, const void *); { - register const char *base = base0; - register size_t lim; - register int cmp; - register const void *p; + const char *base = base0; + size_t lim; + int cmp; + const void *p; for (lim = nmemb; lim != 0; lim >>= 1) { p = base + (lim >> 1) * size; diff --git a/sys/libkern/iconv_ucs.c b/sys/libkern/iconv_ucs.c index 047436de351e..6d63f0b9e89d 100644 --- a/sys/libkern/iconv_ucs.c +++ b/sys/libkern/iconv_ucs.c @@ -523,14 +523,14 @@ ucs4_to_utf8(uint32_t ucs4, char *dst, size_t *utf8width, size_t dstlen) } static uint32_t -encode_surrogate(register uint32_t code) +encode_surrogate(uint32_t code) { return ((((code - 0x10000) << 6) & 0x3ff0000) | ((code - 0x10000) & 0x3ff) | 0xd800dc00); } static uint32_t -decode_surrogate(register const u_char *ucs) +decode_surrogate(const u_char *ucs) { return ((((ucs[0] & 0x3) << 18) | (ucs[1] << 10) | ((ucs[2] & 0x3) << 8) | ucs[3]) + 0x10000); diff --git a/sys/libkern/iconv_xlat16.c b/sys/libkern/iconv_xlat16.c index dbac8926b376..630cbd3aff76 100644 --- a/sys/libkern/iconv_xlat16.c +++ b/sys/libkern/iconv_xlat16.c @@ -298,10 +298,10 @@ iconv_xlat16_name(struct iconv_converter_class *dcp) } static int -iconv_xlat16_tolower(void *d2p, register int c) +iconv_xlat16_tolower(void *d2p, int c) { struct iconv_xlat16 *dp = (struct iconv_xlat16*)d2p; - register int c1, c2, out; + int c1, c2, out; if (c < 0x100) { c1 = C2I1(c << 8); @@ -323,10 +323,10 @@ iconv_xlat16_tolower(void *d2p, register int c) } static int -iconv_xlat16_toupper(void *d2p, register int c) +iconv_xlat16_toupper(void *d2p, int c) { struct iconv_xlat16 *dp = (struct iconv_xlat16*)d2p; - register int c1, c2, out; + int c1, c2, out; if (c < 0x100) { c1 = C2I1(c << 8); diff --git a/sys/libkern/memmem.c b/sys/libkern/memmem.c index 11c3d9eec508..b4720e64fe7e 100644 --- a/sys/libkern/memmem.c +++ b/sys/libkern/memmem.c @@ -35,7 +35,7 @@ __FBSDID("$FreeBSD$"); void * memmem(const void *l, size_t l_len, const void *s, size_t s_len) { - register char *cur, *last; + char *cur, *last; const char *cl = (const char *)l; const char *cs = (const char *)s; diff --git a/sys/libkern/qdivrem.c b/sys/libkern/qdivrem.c index fbfd715ef0af..b4cc91f1cff2 100644 --- a/sys/libkern/qdivrem.c +++ b/sys/libkern/qdivrem.c @@ -59,9 +59,9 @@ typedef u_long digit; * We may assume len >= 0. NOTE THAT THIS WRITES len+1 DIGITS. */ static void -__shl(register digit *p, register int len, register int sh) +__shl(digit *p, int len, int sh) { - register int i; + int i; for (i = 0; i < len; i++) p[i] = LHALF(p[i] << sh) | (p[i + 1] >> (HALF_BITS - sh)); @@ -82,7 +82,7 @@ __qdivrem(uq, vq, arq) { union uu tmp; digit *u, *v, *q; - register digit v1, v2; + digit v1, v2; u_long qhat, rhat, t; int m, n, d, j, i; digit uspace[5], vspace[5], qspace[5]; @@ -192,7 +192,7 @@ __qdivrem(uq, vq, arq) v1 = v[1]; /* for D3 -- note that v[1..n] are constant */ v2 = v[2]; /* for D3 */ do { - register digit uj0, uj1, uj2; + digit uj0, uj1, uj2; /* * D3: Calculate qhat (\^q, in TeX notation). diff --git a/sys/libkern/qsort.c b/sys/libkern/qsort.c index bb0baee73c9f..7a758d3a8555 100644 --- a/sys/libkern/qsort.c +++ b/sys/libkern/qsort.c @@ -48,10 +48,10 @@ static __inline void swapfunc(char *, char *, int, int); */ #define swapcode(TYPE, parmi, parmj, n) { \ long i = (n) / sizeof (TYPE); \ - register TYPE *pi = (TYPE *) (parmi); \ - register TYPE *pj = (TYPE *) (parmj); \ + TYPE *pi = (TYPE *) (parmi); \ + TYPE *pj = (TYPE *) (parmj); \ do { \ - register TYPE t = *pi; \ + TYPE t = *pi; \ *pi++ = *pj; \ *pj++ = t; \ } while (--i > 0); \ diff --git a/sys/libkern/random.c b/sys/libkern/random.c index 3ad75bfb2e9b..22a14ef5021f 100644 --- a/sys/libkern/random.c +++ b/sys/libkern/random.c @@ -57,7 +57,7 @@ srandom(seed) u_long random() { - register long x, hi, lo, t; + long x, hi, lo, t; /* * Compute x[n + 1] = (7^5 * x[n]) mod (2^31 - 1). diff --git a/sys/libkern/scanc.c b/sys/libkern/scanc.c index 28a5b7ec1f14..a7800d0eeb55 100644 --- a/sys/libkern/scanc.c +++ b/sys/libkern/scanc.c @@ -37,11 +37,11 @@ __FBSDID("$FreeBSD$"); int scanc(size, cp, table, mask0) u_int size; - register const u_char *cp, table[]; + const u_char *cp, table[]; int mask0; { - register const u_char *end; - register u_char mask; + const u_char *end; + u_char mask; mask = mask0; for (end = &cp[size]; cp < end; ++cp) { diff --git a/sys/libkern/strcmp.c b/sys/libkern/strcmp.c index 7313e6011c04..43a06d9be587 100644 --- a/sys/libkern/strcmp.c +++ b/sys/libkern/strcmp.c @@ -40,7 +40,7 @@ __FBSDID("$FreeBSD$"); */ int strcmp(s1, s2) - register const char *s1, *s2; + const char *s1, *s2; { while (*s1 == *s2++) if (*s1++ == 0) diff --git a/sys/libkern/strncpy.c b/sys/libkern/strncpy.c index 7daaaea3dc1d..d4d0964317ba 100644 --- a/sys/libkern/strncpy.c +++ b/sys/libkern/strncpy.c @@ -43,8 +43,8 @@ char * strncpy(char * __restrict dst, const char * __restrict src, size_t n) { if (n != 0) { - register char *d = dst; - register const char *s = src; + char *d = dst; + const char *s = src; do { if ((*d++ = *s++) == 0) { diff --git a/sys/mips/mips/mem.c b/sys/mips/mips/mem.c index 08bb6b094c4a..30f4b34f57af 100644 --- a/sys/mips/mips/mem.c +++ b/sys/mips/mips/mem.c @@ -151,12 +151,6 @@ int memmmap(struct cdev *dev, vm_ooffset_t offset, vm_paddr_t *paddr, int prot, vm_memattr_t *memattr) { - /* - * /dev/mem is the only one that makes sense through this - * interface. For /dev/kmem any physaddr we return here - * could be transient and hence incorrect or invalid at - * a later time. - */ if (dev2unit(dev) != CDEV_MINOR_MEM) return (-1); diff --git a/sys/modules/em/Makefile b/sys/modules/em/Makefile index ead132978052..18f16756bfa5 100644 --- a/sys/modules/em/Makefile +++ b/sys/modules/em/Makefile @@ -3,7 +3,7 @@ .PATH: ${.CURDIR}/../../dev/e1000 KMOD = if_em -SRCS = device_if.h bus_if.h pci_if.h opt_ddb.h opt_em.h opt_inet.h \ +SRCS = device_if.h bus_if.h pci_if.h opt_ddb.h opt_inet.h \ opt_inet6.h ifdi_if.h SRCS += $(CORE_SRC) $(LEGACY_SRC) SRCS += $(COMMON_SHARED) $(LEGACY_SHARED) $(PCIE_SHARED) diff --git a/sys/net80211/ieee80211.c b/sys/net80211/ieee80211.c index 487e1505ef08..4ef900ac748e 100644 --- a/sys/net80211/ieee80211.c +++ b/sys/net80211/ieee80211.c @@ -54,6 +54,7 @@ __FBSDID("$FreeBSD$"); #include #endif #include +#include #include @@ -119,6 +120,8 @@ static const struct ieee80211_rateset ieee80211_rateset_11g = { 12, { B(2), B(4), B(11), B(22), 12, 18, 24, 36, 48, 72, 96, 108 } }; #undef B +static int set_vht_extchan(struct ieee80211_channel *c); + /* * Fill in 802.11 available channel set, mark * all available channels as active, and pick @@ -150,10 +153,23 @@ ieee80211_chan_init(struct ieee80211com *ic) */ if (c->ic_ieee == 0) c->ic_ieee = ieee80211_mhz2ieee(c->ic_freq,c->ic_flags); + + /* + * Setup the HT40/VHT40 upper/lower bits. + * The VHT80 math is done elsewhere. + */ if (IEEE80211_IS_CHAN_HT40(c) && c->ic_extieee == 0) c->ic_extieee = ieee80211_mhz2ieee(c->ic_freq + (IEEE80211_IS_CHAN_HT40U(c) ? 20 : -20), c->ic_flags); + + /* Update VHT math */ + /* + * XXX VHT again, note that this assumes VHT80 channels + * are legit already + */ + set_vht_extchan(c); + /* default max tx power to max regulatory */ if (c->ic_maxpower == 0) c->ic_maxpower = 2*c->ic_maxregpower; @@ -343,6 +359,7 @@ ieee80211_ifattach(struct ieee80211com *ic) ieee80211_superg_attach(ic); #endif ieee80211_ht_attach(ic); + ieee80211_vht_attach(ic); ieee80211_scan_attach(ic); ieee80211_regdomain_attach(ic); ieee80211_dfs_attach(ic); @@ -386,6 +403,7 @@ ieee80211_ifdetach(struct ieee80211com *ic) #ifdef IEEE80211_SUPPORT_SUPERG ieee80211_superg_detach(ic); #endif + ieee80211_vht_detach(ic); ieee80211_ht_detach(ic); /* NB: must be called before ieee80211_node_detach */ ieee80211_proto_detach(ic); @@ -515,8 +533,15 @@ ieee80211_vap_setup(struct ieee80211com *ic, struct ieee80211vap *vap, vap->iv_flags_ext = ic->ic_flags_ext; vap->iv_flags_ven = ic->ic_flags_ven; vap->iv_caps = ic->ic_caps &~ IEEE80211_C_OPMODE; + + /* 11n capabilities - XXX methodize */ vap->iv_htcaps = ic->ic_htcaps; vap->iv_htextcaps = ic->ic_htextcaps; + + /* 11ac capabilities - XXX methodize */ + vap->iv_vhtcaps = ic->ic_vhtcaps; + vap->iv_vhtextcaps = ic->ic_vhtextcaps; + vap->iv_opmode = opmode; vap->iv_caps |= ieee80211_opcap[opmode]; IEEE80211_ADDR_COPY(vap->iv_myaddr, ic->ic_macaddr); @@ -601,6 +626,7 @@ ieee80211_vap_setup(struct ieee80211com *ic, struct ieee80211vap *vap, ieee80211_superg_vattach(vap); #endif ieee80211_ht_vattach(vap); + ieee80211_vht_vattach(vap); ieee80211_scan_vattach(vap); ieee80211_regdomain_vattach(vap); ieee80211_radiotap_vattach(vap); @@ -737,6 +763,7 @@ ieee80211_vap_detach(struct ieee80211vap *vap) #ifdef IEEE80211_SUPPORT_SUPERG ieee80211_superg_vdetach(vap); #endif + ieee80211_vht_vdetach(vap); ieee80211_ht_vdetach(vap); /* NB: must be before ieee80211_node_vdetach */ ieee80211_proto_vdetach(vap); @@ -1081,6 +1108,110 @@ set_extchan(struct ieee80211_channel *c) c->ic_extieee = 0; } +/* + * Populate the freq1/freq2 fields as appropriate for VHT channels. + * + * This for now uses a hard-coded list of 80MHz wide channels. + * + * For HT20/HT40, freq1 just is the centre frequency of the 40MHz + * wide channel we've already decided upon. + * + * For VHT80 and VHT160, there are only a small number of fixed + * 80/160MHz wide channels, so we just use those. + * + * This is all likely very very wrong - both the regulatory code + * and this code needs to ensure that all four channels are + * available and valid before the VHT80 (and eight for VHT160) channel + * is created. + */ + +struct vht_chan_range { + uint16_t freq_start; + uint16_t freq_end; +}; + +struct vht_chan_range vht80_chan_ranges[] = { + { 5170, 5250 }, + { 5250, 5330 }, + { 5490, 5570 }, + { 5570, 5650 }, + { 5650, 5730 }, + { 5735, 5815 }, + { 0, 0, } +}; + +static int +set_vht_extchan(struct ieee80211_channel *c) +{ + int i; + + if (! IEEE80211_IS_CHAN_VHT(c)) { + return (0); + } + + if (IEEE80211_IS_CHAN_VHT20(c)) { + c->ic_vht_ch_freq1 = c->ic_ieee; + return (1); + } + + if (IEEE80211_IS_CHAN_VHT40(c)) { + if (IEEE80211_IS_CHAN_HT40U(c)) + c->ic_vht_ch_freq1 = c->ic_ieee + 2; + else if (IEEE80211_IS_CHAN_HT40D(c)) + c->ic_vht_ch_freq1 = c->ic_ieee - 2; + else + return (0); + return (1); + } + + if (IEEE80211_IS_CHAN_VHT80(c)) { + for (i = 0; vht80_chan_ranges[i].freq_start != 0; i++) { + if (c->ic_freq >= vht80_chan_ranges[i].freq_start && + c->ic_freq < vht80_chan_ranges[i].freq_end) { + int midpoint; + + midpoint = vht80_chan_ranges[i].freq_start + 40; + c->ic_vht_ch_freq1 = + ieee80211_mhz2ieee(midpoint, c->ic_flags); + c->ic_vht_ch_freq2 = 0; +#if 0 + printf("%s: %d, freq=%d, midpoint=%d, freq1=%d, freq2=%d\n", + __func__, c->ic_ieee, c->ic_freq, midpoint, + c->ic_vht_ch_freq1, c->ic_vht_ch_freq2); +#endif + return (1); + } + } + return (0); + } + + printf("%s: unknown VHT channel type (ieee=%d, flags=0x%08x)\n", + __func__, + c->ic_ieee, + c->ic_flags); + + return (0); +} + +/* + * Return whether the current channel could possibly be a part of + * a VHT80 channel. + * + * This doesn't check that the whole range is in the allowed list + * according to regulatory. + */ +static int +is_vht80_valid_freq(uint16_t freq) +{ + int i; + for (i = 0; vht80_chan_ranges[i].freq_start != 0; i++) { + if (freq >= vht80_chan_ranges[i].freq_start && + freq < vht80_chan_ranges[i].freq_end) + return (1); + } + return (0); +} + static int addchan(struct ieee80211_channel chans[], int maxchans, int *nchans, uint8_t ieee, uint16_t freq, int8_t maxregpower, uint32_t flags) @@ -1090,13 +1221,25 @@ addchan(struct ieee80211_channel chans[], int maxchans, int *nchans, if (*nchans >= maxchans) return (ENOBUFS); +#if 0 + printf("%s: %d: ieee=%d, freq=%d, flags=0x%08x\n", + __func__, + *nchans, + ieee, + freq, + flags); +#endif + c = &chans[(*nchans)++]; c->ic_ieee = ieee; c->ic_freq = freq != 0 ? freq : ieee80211_ieee2mhz(ieee, flags); c->ic_maxregpower = maxregpower; c->ic_maxpower = 2 * maxregpower; c->ic_flags = flags; + c->ic_vht_ch_freq1 = 0; + c->ic_vht_ch_freq2 = 0; set_extchan(c); + set_vht_extchan(c); return (0); } @@ -1112,14 +1255,27 @@ copychan_prev(struct ieee80211_channel chans[], int maxchans, int *nchans, if (*nchans >= maxchans) return (ENOBUFS); +#if 0 + printf("%s: %d: flags=0x%08x\n", + __func__, + *nchans, + flags); +#endif + c = &chans[(*nchans)++]; c[0] = c[-1]; c->ic_flags = flags; + c->ic_vht_ch_freq1 = 0; + c->ic_vht_ch_freq2 = 0; set_extchan(c); + set_vht_extchan(c); return (0); } +/* + * XXX VHT-2GHz + */ static void getflags_2ghz(const uint8_t bands[], uint32_t flags[], int ht40) { @@ -1140,35 +1296,73 @@ getflags_2ghz(const uint8_t bands[], uint32_t flags[], int ht40) } static void -getflags_5ghz(const uint8_t bands[], uint32_t flags[], int ht40) +getflags_5ghz(const uint8_t bands[], uint32_t flags[], int ht40, int vht80) { int nmodes; + /* + * the addchan_list function seems to expect the flags array to + * be in channel width order, so the VHT bits are interspersed + * as appropriate to maintain said order. + * + * It also assumes HT40U is before HT40D. + */ nmodes = 0; + + /* 20MHz */ if (isset(bands, IEEE80211_MODE_11A)) flags[nmodes++] = IEEE80211_CHAN_A; if (isset(bands, IEEE80211_MODE_11NA)) flags[nmodes++] = IEEE80211_CHAN_A | IEEE80211_CHAN_HT20; + if (isset(bands, IEEE80211_MODE_VHT_5GHZ)) { + flags[nmodes++] = IEEE80211_CHAN_A | IEEE80211_CHAN_HT20 | + IEEE80211_CHAN_VHT20; + + /* 40MHz */ if (ht40) { flags[nmodes++] = IEEE80211_CHAN_A | IEEE80211_CHAN_HT40U; + } + if (ht40 && isset(bands, IEEE80211_MODE_VHT_5GHZ)) { + flags[nmodes++] = IEEE80211_CHAN_A | IEEE80211_CHAN_HT40U + | IEEE80211_CHAN_VHT40U; + } + if (ht40) { flags[nmodes++] = IEEE80211_CHAN_A | IEEE80211_CHAN_HT40D; } + if (ht40 && isset(bands, IEEE80211_MODE_VHT_5GHZ)) { + flags[nmodes++] = IEEE80211_CHAN_A | IEEE80211_CHAN_HT40D + | IEEE80211_CHAN_VHT40D; + } + + /* 80MHz */ + if (vht80 && isset(bands, IEEE80211_MODE_VHT_5GHZ)) { + flags[nmodes++] = IEEE80211_CHAN_A | + IEEE80211_CHAN_HT40U | IEEE80211_CHAN_VHT80; + flags[nmodes++] = IEEE80211_CHAN_A | + IEEE80211_CHAN_HT40D | IEEE80211_CHAN_VHT80; + } + } + + /* XXX VHT80+80 */ + /* XXX VHT160 */ flags[nmodes] = 0; } static void -getflags(const uint8_t bands[], uint32_t flags[], int ht40) +getflags(const uint8_t bands[], uint32_t flags[], int ht40, int vht80) { flags[0] = 0; if (isset(bands, IEEE80211_MODE_11A) || - isset(bands, IEEE80211_MODE_11NA)) { + isset(bands, IEEE80211_MODE_11NA) || + isset(bands, IEEE80211_MODE_VHT_5GHZ)) { if (isset(bands, IEEE80211_MODE_11B) || isset(bands, IEEE80211_MODE_11G) || - isset(bands, IEEE80211_MODE_11NG)) + isset(bands, IEEE80211_MODE_11NG) || + isset(bands, IEEE80211_MODE_VHT_2GHZ)) return; - getflags_5ghz(bands, flags, ht40); + getflags_5ghz(bands, flags, ht40, vht80); } else getflags_2ghz(bands, flags, ht40); } @@ -1176,6 +1370,7 @@ getflags(const uint8_t bands[], uint32_t flags[], int ht40) /* * Add one 20 MHz channel into specified channel list. */ +/* XXX VHT */ int ieee80211_add_channel(struct ieee80211_channel chans[], int maxchans, int *nchans, uint8_t ieee, uint16_t freq, int8_t maxregpower, @@ -1184,7 +1379,7 @@ ieee80211_add_channel(struct ieee80211_channel chans[], int maxchans, uint32_t flags[IEEE80211_MODE_MAX]; int i, error; - getflags(bands, flags, 0); + getflags(bands, flags, 0, 0); KASSERT(flags[0] != 0, ("%s: no correct mode provided\n", __func__)); error = addchan(chans, maxchans, nchans, ieee, freq, maxregpower, @@ -1218,6 +1413,7 @@ findchannel(struct ieee80211_channel chans[], int nchans, uint16_t freq, /* * Add 40 MHz channel pair into specified channel list. */ +/* XXX VHT */ int ieee80211_add_channel_ht40(struct ieee80211_channel chans[], int maxchans, int *nchans, uint8_t ieee, int8_t maxregpower, uint32_t flags) @@ -1275,11 +1471,17 @@ ieee80211_get_channel_center_freq(const struct ieee80211_channel *c) * For 80+80MHz channels this will be the centre of the primary * 80MHz channel; the secondary 80MHz channel will be center_freq2(). */ - uint32_t ieee80211_get_channel_center_freq1(const struct ieee80211_channel *c) { + /* + * VHT - use the pre-calculated centre frequency + * of the given channel. + */ + if (IEEE80211_IS_CHAN_VHT(c)) + return (ieee80211_ieee2mhz(c->ic_vht_ch_freq1, c->ic_flags)); + if (IEEE80211_IS_CHAN_HT40U(c)) { return (c->ic_freq + 10); } @@ -1291,12 +1493,15 @@ ieee80211_get_channel_center_freq1(const struct ieee80211_channel *c) } /* - * For now, no 80+80 support; this is zero. + * For now, no 80+80 support; it will likely always return 0. */ uint32_t ieee80211_get_channel_center_freq2(const struct ieee80211_channel *c) { + if (IEEE80211_IS_CHAN_VHT(c) && (c->ic_vht_ch_freq2 != 0)) + return (ieee80211_ieee2mhz(c->ic_vht_ch_freq2, c->ic_flags)); + return (0); } @@ -1310,16 +1515,70 @@ add_chanlist(struct ieee80211_channel chans[], int maxchans, int *nchans, { uint16_t freq; int i, j, error; + int is_vht; for (i = 0; i < nieee; i++) { freq = ieee80211_ieee2mhz(ieee[i], flags[0]); for (j = 0; flags[j] != 0; j++) { + /* + * Notes: + * + HT40 and VHT40 channels occur together, so + * we need to be careful that we actually allow that. + * + VHT80, VHT160 will coexist with HT40/VHT40, so + * make sure it's not skipped because of the overlap + * check used for (V)HT40. + */ + is_vht = !! (flags[j] & IEEE80211_CHAN_VHT); + + /* + * Test for VHT80. + * XXX This is all very broken right now. + * What we /should/ do is: + * + * + check that the frequency is in the list of + * allowed VHT80 ranges; and + * + the other 3 channels in the list are actually + * also available. + */ + if (is_vht && flags[j] & IEEE80211_CHAN_VHT80) + if (! is_vht80_valid_freq(freq)) + continue; + + /* + * Test for (V)HT40. + * + * This is also a fall through from VHT80; as we only + * allow a VHT80 channel if the VHT40 combination is + * also valid. If the VHT40 form is not valid then + * we certainly can't do VHT80.. + */ if (flags[j] & IEEE80211_CHAN_HT40D) + /* + * Can't have a "lower" channel if we are the + * first channel. + * + * Can't have a "lower" channel if it's below/ + * within 20MHz of the first channel. + * + * Can't have a "lower" channel if the channel + * below it is not 20MHz away. + */ if (i == 0 || ieee[i] < ieee[0] + 4 || freq - 20 != ieee80211_ieee2mhz(ieee[i] - 4, flags[j])) continue; if (flags[j] & IEEE80211_CHAN_HT40U) + /* + * Can't have an "upper" channel if we are + * the last channel. + * + * Can't have an "upper" channel be above the + * last channel in the list. + * + * Can't have an "upper" channel if the next + * channel according to the math isn't 20MHz + * away. (Likely for channel 13/14.) + */ if (i == nieee - 1 || ieee[i] + 4 > ieee[nieee - 1] || freq + 20 != @@ -1348,6 +1607,7 @@ ieee80211_add_channel_list_2ghz(struct ieee80211_channel chans[], int maxchans, { uint32_t flags[IEEE80211_MODE_MAX]; + /* XXX no VHT for now */ getflags_2ghz(bands, flags, ht40); KASSERT(flags[0] != 0, ("%s: no correct mode provided\n", __func__)); @@ -1360,8 +1620,15 @@ ieee80211_add_channel_list_5ghz(struct ieee80211_channel chans[], int maxchans, int ht40) { uint32_t flags[IEEE80211_MODE_MAX]; + int vht80 = 0; - getflags_5ghz(bands, flags, ht40); + /* + * For now, assume VHT == VHT80 support as a minimum. + */ + if (isset(bands, IEEE80211_MODE_VHT_5GHZ)) + vht80 = 1; + + getflags_5ghz(bands, flags, ht40, vht80); KASSERT(flags[0] != 0, ("%s: no correct mode provided\n", __func__)); return (add_chanlist(chans, maxchans, nchans, ieee, nieee, flags)); @@ -1662,6 +1929,7 @@ ieee80211_announce(struct ieee80211com *ic) printf("\n"); } ieee80211_ht_announce(ic); + ieee80211_vht_announce(ic); } void diff --git a/sys/net80211/ieee80211_adhoc.c b/sys/net80211/ieee80211_adhoc.c index ec39a54d672f..6d26f85b56bc 100644 --- a/sys/net80211/ieee80211_adhoc.c +++ b/sys/net80211/ieee80211_adhoc.c @@ -822,10 +822,14 @@ adhoc_recv_mgmt(struct ieee80211_node *ni, struct mbuf *m0, #if 0 if (scan.htcap != NULL && scan.htinfo != NULL && (vap->iv_flags_ht & IEEE80211_FHT_HT)) { - if (ieee80211_ht_updateparams(ni, + ieee80211_ht_updateparams(ni, + scan.htcap, scan.htinfo)); + if (ieee80211_ht_updateparams_final(ni, scan.htcap, scan.htinfo)) ht_state_change = 1; } + + /* XXX same for VHT? */ #endif if (ni != NULL) { IEEE80211_RSSI_LPF(ni->ni_avgrssi, rssi); diff --git a/sys/net80211/ieee80211_hostap.c b/sys/net80211/ieee80211_hostap.c index 9868f133bca7..66df1bd463a1 100644 --- a/sys/net80211/ieee80211_hostap.c +++ b/sys/net80211/ieee80211_hostap.c @@ -62,6 +62,7 @@ __FBSDID("$FreeBSD$"); #include #endif #include +#include #define IEEE80211_RATE2MBS(r) (((r) & IEEE80211_RATE_VAL) / 2) @@ -1745,6 +1746,7 @@ hostap_recv_mgmt(struct ieee80211_node *ni, struct mbuf *m0, struct ieee80211_frame *wh; uint8_t *frm, *efrm, *sfrm; uint8_t *ssid, *rates, *xrates, *wpa, *rsn, *wme, *ath, *htcap; + uint8_t *vhtcap, *vhtinfo; int reassoc, resp; uint8_t rate; @@ -2042,6 +2044,7 @@ hostap_recv_mgmt(struct ieee80211_node *ni, struct mbuf *m0, if (reassoc) frm += 6; /* ignore current AP info */ ssid = rates = xrates = wpa = rsn = wme = ath = htcap = NULL; + vhtcap = vhtinfo = NULL; sfrm = frm; while (efrm - frm > 1) { IEEE80211_VERIFY_LENGTH(efrm - frm, frm[1] + 2, return); @@ -2061,6 +2064,12 @@ hostap_recv_mgmt(struct ieee80211_node *ni, struct mbuf *m0, case IEEE80211_ELEMID_HTCAP: htcap = frm; break; + case IEEE80211_ELEMID_VHT_CAP: + vhtcap = frm; + break; + case IEEE80211_ELEMID_VHT_OPMODE: + vhtinfo = frm; + break; case IEEE80211_ELEMID_VENDOR: if (iswpaoui(frm)) wpa = frm; @@ -2135,10 +2144,22 @@ hostap_recv_mgmt(struct ieee80211_node *ni, struct mbuf *m0, vap->iv_stats.is_rx_assoc_norate++; return; } + /* * Do HT rate set handling and setup HT node state. */ ni->ni_chan = vap->iv_bss->ni_chan; + + /* VHT */ + if (IEEE80211_IS_CHAN_VHT(ni->ni_chan)) { + /* XXX TODO; see below */ + printf("%s: VHT TODO!\n", __func__); + ieee80211_vht_node_init(ni); + ieee80211_vht_update_cap(ni, vhtcap, vhtinfo); + } else if (ni->ni_flags & IEEE80211_NODE_VHT) + ieee80211_vht_node_cleanup(ni); + + /* HT */ if (IEEE80211_IS_CHAN_HT(ni->ni_chan) && htcap != NULL) { rate = ieee80211_setup_htrates(ni, htcap, IEEE80211_F_DOFMCS | IEEE80211_F_DONEGO | @@ -2153,6 +2174,12 @@ hostap_recv_mgmt(struct ieee80211_node *ni, struct mbuf *m0, ieee80211_ht_updatehtcap(ni, htcap); } else if (ni->ni_flags & IEEE80211_NODE_HT) ieee80211_ht_node_cleanup(ni); + + /* Finally - this will use HT/VHT info to change node channel */ + if (IEEE80211_IS_CHAN_HT(ni->ni_chan) && htcap != NULL) { + ieee80211_ht_updatehtcap_final(ni); + } + #ifdef IEEE80211_SUPPORT_SUPERG /* Always do ff node cleanup; for A-MSDU */ ieee80211_ff_node_cleanup(ni); diff --git a/sys/net80211/ieee80211_ht.c b/sys/net80211/ieee80211_ht.c index 74e265ec9dce..2f28f002ec32 100644 --- a/sys/net80211/ieee80211_ht.c +++ b/sys/net80211/ieee80211_ht.c @@ -1490,52 +1490,117 @@ ieee80211_parse_htinfo(struct ieee80211_node *ni, const uint8_t *ie) } /* - * Handle 11n channel switch. Use the received HT ie's to - * identify the right channel to use. If we cannot locate it - * in the channel table then fallback to legacy operation. + * Handle 11n/11ac channel switch. + * + * Use the received HT/VHT ie's to identify the right channel to use. + * If we cannot locate it in the channel table then fallback to + * legacy operation. + * * Note that we use this information to identify the node's * channel only; the caller is responsible for insuring any * required channel change is done (e.g. in sta mode when * parsing the contents of a beacon frame). */ static int -htinfo_update_chw(struct ieee80211_node *ni, int htflags) +htinfo_update_chw(struct ieee80211_node *ni, int htflags, int vhtflags) { struct ieee80211com *ic = ni->ni_ic; struct ieee80211_channel *c; int chanflags; int ret = 0; - chanflags = (ni->ni_chan->ic_flags &~ IEEE80211_CHAN_HT) | htflags; - if (chanflags != ni->ni_chan->ic_flags) { - /* XXX not right for ht40- */ - c = ieee80211_find_channel(ic, ni->ni_chan->ic_freq, chanflags); - if (c == NULL && (htflags & IEEE80211_CHAN_HT40)) { - /* - * No HT40 channel entry in our table; fall back - * to HT20 operation. This should not happen. - */ - c = findhtchan(ic, ni->ni_chan, IEEE80211_CHAN_HT20); + /* + * First step - do HT/VHT only channel lookup based on operating mode + * flags. This involves masking out the VHT flags as well. + * Otherwise we end up doing the full channel walk each time + * we trigger this, which is expensive. + */ + chanflags = (ni->ni_chan->ic_flags &~ + (IEEE80211_CHAN_HT | IEEE80211_CHAN_VHT)) | htflags | vhtflags; + + if (chanflags == ni->ni_chan->ic_flags) + goto done; + + /* + * If HT /or/ VHT flags have changed then check both. + * We need to start by picking a HT channel anyway. + */ + + c = NULL; + chanflags = (ni->ni_chan->ic_flags &~ + (IEEE80211_CHAN_HT | IEEE80211_CHAN_VHT)) | htflags; + /* XXX not right for ht40- */ + c = ieee80211_find_channel(ic, ni->ni_chan->ic_freq, chanflags); + if (c == NULL && (htflags & IEEE80211_CHAN_HT40)) { + /* + * No HT40 channel entry in our table; fall back + * to HT20 operation. This should not happen. + */ + c = findhtchan(ic, ni->ni_chan, IEEE80211_CHAN_HT20); #if 0 - IEEE80211_NOTE(ni->ni_vap, - IEEE80211_MSG_ASSOC | IEEE80211_MSG_11N, ni, - "no HT40 channel (freq %u), falling back to HT20", - ni->ni_chan->ic_freq); + IEEE80211_NOTE(ni->ni_vap, + IEEE80211_MSG_ASSOC | IEEE80211_MSG_11N, ni, + "no HT40 channel (freq %u), falling back to HT20", + ni->ni_chan->ic_freq); #endif - /* XXX stat */ - } - if (c != NULL && c != ni->ni_chan) { - IEEE80211_NOTE(ni->ni_vap, - IEEE80211_MSG_ASSOC | IEEE80211_MSG_11N, ni, - "switch station to HT%d channel %u/0x%x", - IEEE80211_IS_CHAN_HT40(c) ? 40 : 20, - c->ic_freq, c->ic_flags); - ni->ni_chan = c; - ret = 1; - } - /* NB: caller responsible for forcing any channel change */ + /* XXX stat */ } - /* update node's tx channel width */ + + /* Nothing found - leave it alone; move onto VHT */ + if (c == NULL) + c = ni->ni_chan; + + /* + * If it's non-HT, then bail out now. + */ + if (! IEEE80211_IS_CHAN_HT(c)) { + IEEE80211_NOTE(ni->ni_vap, + IEEE80211_MSG_ASSOC | IEEE80211_MSG_11N, ni, + "not HT; skipping VHT check (%u/0x%x)", + c->ic_freq, c->ic_flags); + goto done; + } + + /* + * Next step - look at the current VHT flags and determine + * if we need to upgrade. Mask out the VHT and HT flags since + * the vhtflags field will already have the correct HT + * flags to use. + */ + if (IEEE80211_CONF_VHT(ic) && ni->ni_vhtcap != 0 && vhtflags != 0) { + chanflags = (c->ic_flags + &~ (IEEE80211_CHAN_HT | IEEE80211_CHAN_VHT)) + | vhtflags; + IEEE80211_NOTE(ni->ni_vap, + IEEE80211_MSG_ASSOC | IEEE80211_MSG_11N, + ni, + "%s: VHT; chanwidth=0x%02x; vhtflags=0x%08x", + __func__, ni->ni_vht_chanwidth, vhtflags); + + IEEE80211_NOTE(ni->ni_vap, + IEEE80211_MSG_ASSOC | IEEE80211_MSG_11N, + ni, + "%s: VHT; trying lookup for %d/0x%08x", + __func__, c->ic_freq, chanflags); + c = ieee80211_find_channel(ic, c->ic_freq, chanflags); + } + + /* Finally, if it's changed */ + if (c != NULL && c != ni->ni_chan) { + IEEE80211_NOTE(ni->ni_vap, + IEEE80211_MSG_ASSOC | IEEE80211_MSG_11N, ni, + "switch station to %s%d channel %u/0x%x", + IEEE80211_IS_CHAN_VHT(c) ? "VHT" : "HT", + IEEE80211_IS_CHAN_VHT80(c) ? 80 : + (IEEE80211_IS_CHAN_HT40(c) ? 40 : 20), + c->ic_freq, c->ic_flags); + ni->ni_chan = c; + ret = 1; + } + /* NB: caller responsible for forcing any channel change */ + +done: + /* update node's (11n) tx channel width */ ni->ni_chw = IEEE80211_IS_CHAN_HT40(ni->ni_chan)? 40 : 20; return (ret); } @@ -1587,15 +1652,18 @@ htcap_update_shortgi(struct ieee80211_node *ni) /* * Parse and update HT-related state extracted from * the HT cap and info ie's. + * + * This is called from the STA management path and + * the ieee80211_node_join() path. It will take into + * account the IEs discovered during scanning and + * adjust things accordingly. */ -int +void ieee80211_ht_updateparams(struct ieee80211_node *ni, const uint8_t *htcapie, const uint8_t *htinfoie) { struct ieee80211vap *vap = ni->ni_vap; const struct ieee80211_ie_htinfo *htinfo; - int htflags; - int ret = 0; ieee80211_parse_htcap(ni, htcapie); if (vap->iv_htcaps & IEEE80211_HTCAP_SMPS) @@ -1607,8 +1675,115 @@ ieee80211_ht_updateparams(struct ieee80211_node *ni, htinfo = (const struct ieee80211_ie_htinfo *) htinfoie; htinfo_parse(ni, htinfo); + /* + * Defer the node channel change; we need to now + * update VHT parameters before we do it. + */ + + if ((htinfo->hi_byte1 & IEEE80211_HTINFO_RIFSMODE_PERM) && + (vap->iv_flags_ht & IEEE80211_FHT_RIFS)) + ni->ni_flags |= IEEE80211_NODE_RIFS; + else + ni->ni_flags &= ~IEEE80211_NODE_RIFS; +} + +static uint32_t +ieee80211_vht_get_vhtflags(struct ieee80211_node *ni, uint32_t htflags) +{ + struct ieee80211vap *vap = ni->ni_vap; + uint32_t vhtflags = 0; + + vhtflags = 0; + if (ni->ni_flags & IEEE80211_NODE_VHT && vap->iv_flags_vht & IEEE80211_FVHT_VHT) { + if ((ni->ni_vht_chanwidth == IEEE80211_VHT_CHANWIDTH_160MHZ) && + /* XXX 2 means "160MHz and 80+80MHz", 1 means "160MHz" */ + (MS(vap->iv_vhtcaps, + IEEE80211_VHTCAP_SUPP_CHAN_WIDTH_MASK) >= 1) && + (vap->iv_flags_vht & IEEE80211_FVHT_USEVHT160)) { + vhtflags = IEEE80211_CHAN_VHT160; + /* Mirror the HT40 flags */ + if (htflags == IEEE80211_CHAN_HT40U) { + vhtflags |= IEEE80211_CHAN_HT40U; + } else if (htflags == IEEE80211_CHAN_HT40D) { + vhtflags |= IEEE80211_CHAN_HT40D; + } + } else if ((ni->ni_vht_chanwidth == IEEE80211_VHT_CHANWIDTH_80P80MHZ) && + /* XXX 2 means "160MHz and 80+80MHz" */ + (MS(vap->iv_vhtcaps, + IEEE80211_VHTCAP_SUPP_CHAN_WIDTH_MASK) == 2) && + (vap->iv_flags_vht & IEEE80211_FVHT_USEVHT80P80)) { + vhtflags = IEEE80211_CHAN_VHT80_80; + /* Mirror the HT40 flags */ + if (htflags == IEEE80211_CHAN_HT40U) { + vhtflags |= IEEE80211_CHAN_HT40U; + } else if (htflags == IEEE80211_CHAN_HT40D) { + vhtflags |= IEEE80211_CHAN_HT40D; + } + } else if ((ni->ni_vht_chanwidth == IEEE80211_VHT_CHANWIDTH_80MHZ) && + (vap->iv_flags_vht & IEEE80211_FVHT_USEVHT80)) { + vhtflags = IEEE80211_CHAN_VHT80; + /* Mirror the HT40 flags */ + if (htflags == IEEE80211_CHAN_HT40U) { + vhtflags |= IEEE80211_CHAN_HT40U; + } else if (htflags == IEEE80211_CHAN_HT40D) { + vhtflags |= IEEE80211_CHAN_HT40D; + } + } else if (ni->ni_vht_chanwidth == IEEE80211_VHT_CHANWIDTH_USE_HT) { + /* Mirror the HT40 flags */ + /* + * XXX TODO: if ht40 is disabled, but vht40 isn't + * disabled then this logic will get very, very sad. + * It's quite possible the only sane thing to do is + * to not have vht40 as an option, and just obey + * 'ht40' as that flag. + */ + if ((htflags == IEEE80211_CHAN_HT40U) && + (vap->iv_flags_vht & IEEE80211_FVHT_USEVHT40)) { + vhtflags = IEEE80211_CHAN_VHT40U + | IEEE80211_CHAN_HT40U; + } else if (htflags == IEEE80211_CHAN_HT40D && + (vap->iv_flags_vht & IEEE80211_FVHT_USEVHT40)) { + vhtflags = IEEE80211_CHAN_VHT40D + | IEEE80211_CHAN_HT40D; + } else if (htflags == IEEE80211_CHAN_HT20) { + vhtflags = IEEE80211_CHAN_VHT20 + | IEEE80211_CHAN_HT20; + } + } else { + vhtflags = IEEE80211_CHAN_VHT20; + } + } + return (vhtflags); +} + +/* + * Final part of updating the HT parameters. + * + * This is called from the STA management path and + * the ieee80211_node_join() path. It will take into + * account the IEs discovered during scanning and + * adjust things accordingly. + * + * This is done after a call to ieee80211_ht_updateparams() + * because it (and the upcoming VHT version of updateparams) + * needs to ensure everything is parsed before htinfo_update_chw() + * is called - which will change the channel config for the + * node for us. + */ +int +ieee80211_ht_updateparams_final(struct ieee80211_node *ni, + const uint8_t *htcapie, const uint8_t *htinfoie) +{ + struct ieee80211vap *vap = ni->ni_vap; + const struct ieee80211_ie_htinfo *htinfo; + int htflags, vhtflags; + int ret = 0; + + htinfo = (const struct ieee80211_ie_htinfo *) htinfoie; + htflags = (vap->iv_flags_ht & IEEE80211_FHT_HT) ? IEEE80211_CHAN_HT20 : 0; + /* NB: honor operating mode constraint */ if ((htinfo->hi_byte1 & IEEE80211_HTINFO_TXWIDTH_2040) && (vap->iv_flags_ht & IEEE80211_FHT_USEHT40)) { @@ -1617,14 +1792,16 @@ ieee80211_ht_updateparams(struct ieee80211_node *ni, else if (ni->ni_ht2ndchan == IEEE80211_HTINFO_2NDCHAN_BELOW) htflags = IEEE80211_CHAN_HT40D; } - if (htinfo_update_chw(ni, htflags)) - ret = 1; - if ((htinfo->hi_byte1 & IEEE80211_HTINFO_RIFSMODE_PERM) && - (vap->iv_flags_ht & IEEE80211_FHT_RIFS)) - ni->ni_flags |= IEEE80211_NODE_RIFS; - else - ni->ni_flags &= ~IEEE80211_NODE_RIFS; + /* + * VHT flags - do much the same; check whether VHT is available + * and if so, what our ideal channel use would be based on our + * capabilities and the (pre-parsed) VHT info IE. + */ + vhtflags = ieee80211_vht_get_vhtflags(ni, htflags); + + if (htinfo_update_chw(ni, htflags, vhtflags)) + ret = 1; return (ret); } @@ -1632,17 +1809,31 @@ ieee80211_ht_updateparams(struct ieee80211_node *ni, /* * Parse and update HT-related state extracted from the HT cap ie * for a station joining an HT BSS. + * + * This is called from the hostap path for each station. */ void ieee80211_ht_updatehtcap(struct ieee80211_node *ni, const uint8_t *htcapie) { struct ieee80211vap *vap = ni->ni_vap; - int htflags; ieee80211_parse_htcap(ni, htcapie); if (vap->iv_htcaps & IEEE80211_HTCAP_SMPS) htcap_update_mimo_ps(ni); htcap_update_shortgi(ni); +} + +/* + * Called once HT and VHT capabilities are parsed in hostap mode - + * this will adjust the channel configuration of the given node + * based on the configuration and capabilities. + */ +void +ieee80211_ht_updatehtcap_final(struct ieee80211_node *ni) +{ + struct ieee80211vap *vap = ni->ni_vap; + int htflags; + int vhtflags; /* NB: honor operating mode constraint */ /* XXX 40 MHz intolerant */ @@ -1655,7 +1846,14 @@ ieee80211_ht_updatehtcap(struct ieee80211_node *ni, const uint8_t *htcapie) else if (IEEE80211_IS_CHAN_HT40D(vap->iv_bss->ni_chan)) htflags = IEEE80211_CHAN_HT40D; } - (void) htinfo_update_chw(ni, htflags); + /* + * VHT flags - do much the same; check whether VHT is available + * and if so, what our ideal channel use would be based on our + * capabilities and the (pre-parsed) VHT info IE. + */ + vhtflags = ieee80211_vht_get_vhtflags(ni, htflags); + + (void) htinfo_update_chw(ni, htflags, vhtflags); } /* @@ -2135,6 +2333,7 @@ ht_recv_action_ht_txchwidth(struct ieee80211_node *ni, "%s: HT txchwidth, width %d%s", __func__, chw, ni->ni_chw != chw ? "*" : ""); if (chw != ni->ni_chw) { + /* XXX does this need to change the ht40 station count? */ ni->ni_chw = chw; /* XXX notify on change */ } @@ -2229,6 +2428,10 @@ ieee80211_ampdu_request(struct ieee80211_node *ni, dialogtoken = (tokens+1) % 63; /* XXX */ tid = tap->txa_tid; + + /* + * XXX TODO: This is racy with any other parallel TX going on. :( + */ tap->txa_start = ni->ni_txseqs[tid]; args[0] = dialogtoken; diff --git a/sys/net80211/ieee80211_ht.h b/sys/net80211/ieee80211_ht.h index dfc7d1c312a0..b34d4edf3895 100644 --- a/sys/net80211/ieee80211_ht.h +++ b/sys/net80211/ieee80211_ht.h @@ -201,9 +201,12 @@ void ieee80211_htprot_update(struct ieee80211com *, int protmode); void ieee80211_ht_timeout(struct ieee80211com *); void ieee80211_parse_htcap(struct ieee80211_node *, const uint8_t *); void ieee80211_parse_htinfo(struct ieee80211_node *, const uint8_t *); -int ieee80211_ht_updateparams(struct ieee80211_node *, const uint8_t *, +void ieee80211_ht_updateparams(struct ieee80211_node *, const uint8_t *, const uint8_t *); +int ieee80211_ht_updateparams_final(struct ieee80211_node *, + const uint8_t *, const uint8_t *); void ieee80211_ht_updatehtcap(struct ieee80211_node *, const uint8_t *); +void ieee80211_ht_updatehtcap_final(struct ieee80211_node *); int ieee80211_ampdu_request(struct ieee80211_node *, struct ieee80211_tx_ampdu *); void ieee80211_ampdu_stop(struct ieee80211_node *, diff --git a/sys/net80211/ieee80211_input.c b/sys/net80211/ieee80211_input.c index 3f50268bedce..8af041eb8533 100644 --- a/sys/net80211/ieee80211_input.c +++ b/sys/net80211/ieee80211_input.c @@ -494,6 +494,8 @@ ieee80211_parse_beacon(struct ieee80211_node *ni, struct mbuf *m, scan->status = 0; /* * beacon/probe response frame format + * + * XXX Update from 802.11-2012 - eg where HT is * [8] time stamp * [2] beacon interval * [2] capability information @@ -508,6 +510,8 @@ ieee80211_parse_beacon(struct ieee80211_node *ni, struct mbuf *m, * [tlv] WPA or RSN * [tlv] HT capabilities * [tlv] HT information + * [tlv] VHT capabilities + * [tlv] VHT information * [tlv] Atheros capabilities * [tlv] Mesh ID * [tlv] Mesh Configuration @@ -585,6 +589,12 @@ ieee80211_parse_beacon(struct ieee80211_node *ni, struct mbuf *m, case IEEE80211_ELEMID_HTCAP: scan->htcap = frm; break; + case IEEE80211_ELEMID_VHT_CAP: + scan->vhtcap = frm; + break; + case IEEE80211_ELEMID_VHT_OPMODE: + scan->vhtopmode = frm; + break; case IEEE80211_ELEMID_RSN: scan->rsn = frm; break; @@ -718,6 +728,19 @@ ieee80211_parse_beacon(struct ieee80211_node *ni, struct mbuf *m, sizeof(struct ieee80211_ie_htinfo)-2, scan->htinfo = NULL); } + + /* Process VHT IEs */ + if (scan->vhtcap != NULL) { + IEEE80211_VERIFY_LENGTH(scan->vhtcap[1], + sizeof(struct ieee80211_ie_vhtcap) - 2, + scan->vhtcap = NULL); + } + if (scan->vhtopmode != NULL) { + IEEE80211_VERIFY_LENGTH(scan->vhtopmode[1], + sizeof(struct ieee80211_ie_vht_operation) - 2, + scan->vhtopmode = NULL); + } + return scan->status; } @@ -838,6 +861,9 @@ ieee80211_parse_action(struct ieee80211_node *ni, struct mbuf *m) } break; #endif + case IEEE80211_ACTION_CAT_VHT: + printf("%s: TODO: VHT handling!\n", __func__); + break; } return 0; } diff --git a/sys/net80211/ieee80211_node.c b/sys/net80211/ieee80211_node.c index c08051f68272..45899c0b3210 100644 --- a/sys/net80211/ieee80211_node.c +++ b/sys/net80211/ieee80211_node.c @@ -53,6 +53,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include @@ -412,7 +413,11 @@ ieee80211_create_ibss(struct ieee80211vap* vap, struct ieee80211_channel *chan) /* XXX TODO: other bits and pieces - eg fast-frames? */ /* If we're an 11n channel then initialise the 11n bits */ - if (IEEE80211_IS_CHAN_HT(ni->ni_chan)) { + if (IEEE80211_IS_CHAN_VHT(ni->ni_chan)) { + /* XXX what else? */ + ieee80211_ht_node_init(ni); + ieee80211_vht_node_init(ni); + } else if (IEEE80211_IS_CHAN_HT(ni->ni_chan)) { /* XXX what else? */ ieee80211_ht_node_init(ni); } @@ -707,10 +712,43 @@ gethtadjustflags(struct ieee80211com *ic) return flags; } +/* + * Calculate VHT channel promotion flags for all vaps. + * This assumes ni_chan have been setup for each vap. + */ +static int +getvhtadjustflags(struct ieee80211com *ic) +{ + struct ieee80211vap *vap; + int flags; + + flags = 0; + /* XXX locking */ + TAILQ_FOREACH(vap, &ic->ic_vaps, iv_next) { + if (vap->iv_state < IEEE80211_S_RUN) + continue; + switch (vap->iv_opmode) { + case IEEE80211_M_WDS: + case IEEE80211_M_STA: + case IEEE80211_M_AHDEMO: + case IEEE80211_M_HOSTAP: + case IEEE80211_M_IBSS: + case IEEE80211_M_MBSS: + flags |= ieee80211_vhtchanflags(vap->iv_bss->ni_chan); + break; + default: + break; + } + } + return flags; +} + /* * Check if the current channel needs to change based on whether * any vap's are using HT20/HT40. This is used to sync the state * of ic_curchan after a channel width change on a running vap. + * + * Same applies for VHT. */ void ieee80211_sync_curchan(struct ieee80211com *ic) @@ -718,6 +756,8 @@ ieee80211_sync_curchan(struct ieee80211com *ic) struct ieee80211_channel *c; c = ieee80211_ht_adjust_channel(ic, ic->ic_curchan, gethtadjustflags(ic)); + c = ieee80211_vht_adjust_channel(ic, c, getvhtadjustflags(ic)); + if (c != ic->ic_curchan) { ic->ic_curchan = c; ic->ic_curmode = ieee80211_chan2mode(ic->ic_curchan); @@ -743,10 +783,23 @@ ieee80211_setupcurchan(struct ieee80211com *ic, struct ieee80211_channel *c) * set of running vap's. This assumes we are called * after ni_chan is setup for each vap. */ + /* XXX VHT? */ /* NB: this assumes IEEE80211_FHT_USEHT40 > IEEE80211_FHT_HT */ if (flags > ieee80211_htchanflags(c)) c = ieee80211_ht_adjust_channel(ic, c, flags); } + + /* + * VHT promotion - this will at least promote to VHT20/40 + * based on what HT has done; it may further promote the + * channel to VHT80 or above. + */ + if (ic->ic_vhtcaps != 0) { + int flags = getvhtadjustflags(ic); + if (flags > ieee80211_vhtchanflags(c)) + c = ieee80211_vht_adjust_channel(ic, c, flags); + } + ic->ic_bsschan = ic->ic_curchan = c; ic->ic_curmode = ieee80211_chan2mode(ic->ic_curchan); ic->ic_rt = ieee80211_get_ratetable(ic->ic_curchan); @@ -849,6 +902,7 @@ ieee80211_sta_join(struct ieee80211vap *vap, struct ieee80211_channel *chan, { struct ieee80211com *ic = vap->iv_ic; struct ieee80211_node *ni; + int do_ht = 0; ni = ieee80211_alloc_node(&ic->ic_sta, vap, se->se_macaddr); if (ni == NULL) { @@ -896,9 +950,13 @@ ieee80211_sta_join(struct ieee80211vap *vap, struct ieee80211_channel *chan, if (ni->ni_ies.tdma_ie != NULL) ieee80211_parse_tdma(ni, ni->ni_ies.tdma_ie); #endif + if (ni->ni_ies.vhtcap_ie != NULL) + ieee80211_parse_vhtcap(ni, ni->ni_ies.vhtcap_ie); + if (ni->ni_ies.vhtopmode_ie != NULL) + ieee80211_parse_vhtopmode(ni, ni->ni_ies.vhtopmode_ie); - /* XXX parse VHT IEs */ /* XXX parse BSSLOAD IE */ + /* XXX parse TXPWRENV IE */ /* XXX parse APCHANREP IE */ } @@ -926,10 +984,43 @@ ieee80211_sta_join(struct ieee80211vap *vap, struct ieee80211_channel *chan, ieee80211_ht_updateparams(ni, ni->ni_ies.htcap_ie, ni->ni_ies.htinfo_ie); + do_ht = 1; + } + + /* + * Setup VHT state for this node if it's available. + * Same as the above. + * + * For now, don't allow 2GHz VHT operation. + */ + if (ni->ni_ies.vhtopmode_ie != NULL && + ni->ni_ies.vhtcap_ie != NULL && + vap->iv_flags_vht & IEEE80211_FVHT_VHT) { + if (IEEE80211_IS_CHAN_2GHZ(ni->ni_chan)) { + printf("%s: BSS %6D: 2GHz channel, VHT info; ignoring\n", + __func__, + ni->ni_macaddr, + ":"); + } else { + ieee80211_vht_node_init(ni); + ieee80211_vht_updateparams(ni, + ni->ni_ies.vhtcap_ie, + ni->ni_ies.vhtopmode_ie); + ieee80211_setup_vht_rates(ni, ni->ni_ies.vhtcap_ie, + ni->ni_ies.vhtopmode_ie); + do_ht = 1; + } + } + + /* Finally do the node channel change */ + if (do_ht) { + ieee80211_ht_updateparams_final(ni, ni->ni_ies.htcap_ie, + ni->ni_ies.htinfo_ie); ieee80211_setup_htrates(ni, ni->ni_ies.htcap_ie, IEEE80211_F_JOIN | IEEE80211_F_DOBRS); ieee80211_setup_basic_htrates(ni, ni->ni_ies.htinfo_ie); } + /* XXX else check for ath FF? */ /* XXX QoS? Difficult given that WME config is specific to a master */ @@ -1102,8 +1193,10 @@ node_cleanup(struct ieee80211_node *ni) "power save mode off, %u sta's in ps mode", vap->iv_ps_sta); } /* - * Cleanup any HT-related state. + * Cleanup any VHT and HT-related state. */ + if (ni->ni_flags & IEEE80211_NODE_VHT) + ieee80211_vht_node_cleanup(ni); if (ni->ni_flags & IEEE80211_NODE_HT) ieee80211_ht_node_cleanup(ni); #ifdef IEEE80211_SUPPORT_SUPERG @@ -1423,6 +1516,7 @@ ieee80211_node_create_wds(struct ieee80211vap *vap, if (vap->iv_flags & IEEE80211_F_FF) ni->ni_flags |= IEEE80211_NODE_FF; #endif + /* XXX VHT */ if ((ic->ic_htcaps & IEEE80211_HTC_HT) && (vap->iv_flags_ht & IEEE80211_FHT_HT)) { /* @@ -1431,6 +1525,9 @@ ieee80211_node_create_wds(struct ieee80211vap *vap, * ni_chan will be adjusted to an HT channel. */ ieee80211_ht_wds_init(ni); + if (vap->iv_flags_vht & IEEE80211_FVHT_VHT) { + printf("%s: TODO: vht_wds_init\n", __func__); + } } else { struct ieee80211_channel *c = ni->ni_chan; /* @@ -1638,7 +1735,7 @@ ieee80211_init_neighbor(struct ieee80211_node *ni, const struct ieee80211_frame *wh, const struct ieee80211_scanparams *sp) { - int do_ht_setup = 0; + int do_ht_setup = 0, do_vht_setup = 0; ni->ni_esslen = sp->ssid[1]; memcpy(ni->ni_essid, sp->ssid + 2, sp->ssid[1]); @@ -1670,11 +1767,23 @@ ieee80211_init_neighbor(struct ieee80211_node *ni, if (ni->ni_ies.htinfo_ie != NULL) ieee80211_parse_htinfo(ni, ni->ni_ies.htinfo_ie); + if (ni->ni_ies.vhtcap_ie != NULL) + ieee80211_parse_vhtcap(ni, ni->ni_ies.vhtcap_ie); + if (ni->ni_ies.vhtopmode_ie != NULL) + ieee80211_parse_vhtopmode(ni, ni->ni_ies.vhtopmode_ie); + if ((ni->ni_ies.htcap_ie != NULL) && (ni->ni_ies.htinfo_ie != NULL) && (ni->ni_vap->iv_flags_ht & IEEE80211_FHT_HT)) { do_ht_setup = 1; } + + if ((ni->ni_ies.vhtcap_ie != NULL) && + (ni->ni_ies.vhtopmode_ie != NULL) && + (ni->ni_vap->iv_flags_vht & IEEE80211_FVHT_VHT)) { + do_vht_setup = 1; + } + } /* NB: must be after ni_chan is setup */ @@ -1692,15 +1801,40 @@ ieee80211_init_neighbor(struct ieee80211_node *ni, ieee80211_ht_updateparams(ni, ni->ni_ies.htcap_ie, ni->ni_ies.htinfo_ie); + + if (do_vht_setup) { + if (IEEE80211_IS_CHAN_2GHZ(ni->ni_chan)) { + printf("%s: BSS %6D: 2GHz channel, VHT info; ignoring\n", + __func__, + ni->ni_macaddr, + ":"); + } else { + ieee80211_vht_node_init(ni); + ieee80211_vht_updateparams(ni, + ni->ni_ies.vhtcap_ie, + ni->ni_ies.vhtopmode_ie); + ieee80211_setup_vht_rates(ni, + ni->ni_ies.vhtcap_ie, + ni->ni_ies.vhtopmode_ie); + } + } + + /* + * Finally do the channel upgrade/change based + * on the HT/VHT configuration. + */ + ieee80211_ht_updateparams_final(ni, ni->ni_ies.htcap_ie, + ni->ni_ies.htinfo_ie); ieee80211_setup_htrates(ni, ni->ni_ies.htcap_ie, IEEE80211_F_JOIN | IEEE80211_F_DOBRS); ieee80211_setup_basic_htrates(ni, ni->ni_ies.htinfo_ie); + ieee80211_node_setuptxparms(ni); ieee80211_ratectl_node_init(ni); - /* Reassociate; we're now 11n */ + /* Reassociate; we're now 11n/11ac */ /* * XXX TODO: this is the wrong thing to do - * we're calling it with isnew=1 so the ath(4) @@ -2365,6 +2499,7 @@ ieee80211_node_timeout(void *arg) IEEE80211_LOCK(ic); ieee80211_erp_timeout(ic); ieee80211_ht_timeout(ic); + ieee80211_vht_timeout(ic); IEEE80211_UNLOCK(ic); } callout_reset(&ic->ic_inact, IEEE80211_INACT_WAIT*hz, @@ -2462,8 +2597,12 @@ ieee80211_dump_node(struct ieee80211_node_table *nt, struct ieee80211_node *ni) printf("\thtcap %x htparam %x htctlchan %u ht2ndchan %u\n", ni->ni_htcap, ni->ni_htparam, ni->ni_htctlchan, ni->ni_ht2ndchan); - printf("\thtopmode %x htstbc %x chw %u\n", + printf("\thtopmode %x htstbc %x htchw %u\n", ni->ni_htopmode, ni->ni_htstbc, ni->ni_chw); + printf("\tvhtcap %x freq1 %d freq2 %d vhtbasicmcs %x\n", + ni->ni_vhtcap, (int) ni->ni_vht_chan1, (int) ni->ni_vht_chan2, + (int) ni->ni_vht_basicmcs); + /* XXX VHT state */ } void @@ -2594,6 +2733,8 @@ ieee80211_node_join(struct ieee80211_node *ni, int resp) if (IEEE80211_IS_CHAN_HT(ic->ic_bsschan)) ieee80211_ht_node_join(ni); + if (IEEE80211_IS_CHAN_VHT(ic->ic_bsschan)) + ieee80211_vht_node_join(ni); if (IEEE80211_IS_CHAN_ANYG(ic->ic_bsschan) && IEEE80211_IS_CHAN_FULL(ic->ic_bsschan)) ieee80211_node_join_11g(ni); @@ -2603,6 +2744,9 @@ ieee80211_node_join(struct ieee80211_node *ni, int resp) } else newassoc = 0; + /* + * XXX VHT - should log VHT channel width, etc + */ IEEE80211_NOTE(vap, IEEE80211_MSG_ASSOC | IEEE80211_MSG_DEBUG, ni, "station associated at aid %d: %s preamble, %s slot time%s%s%s%s%s%s%s%s", IEEE80211_NODE_AID(ni), @@ -2610,6 +2754,7 @@ ieee80211_node_join(struct ieee80211_node *ni, int resp) ic->ic_flags & IEEE80211_F_SHSLOT ? "short" : "long", ic->ic_flags & IEEE80211_F_USEPROT ? ", protection" : "", ni->ni_flags & IEEE80211_NODE_QOS ? ", QoS" : "", + /* XXX update for VHT string */ ni->ni_flags & IEEE80211_NODE_HT ? (ni->ni_chw == 40 ? ", HT40" : ", HT20") : "", ni->ni_flags & IEEE80211_NODE_AMPDU ? " (+AMPDU)" : "", @@ -2774,6 +2919,8 @@ ieee80211_node_leave(struct ieee80211_node *ni) vap->iv_sta_assoc--; ic->ic_sta_assoc--; + if (IEEE80211_IS_CHAN_VHT(ic->ic_bsschan)) + ieee80211_vht_node_leave(ni); if (IEEE80211_IS_CHAN_HT(ic->ic_bsschan)) ieee80211_ht_node_leave(ni); if (IEEE80211_IS_CHAN_ANYG(ic->ic_bsschan) && diff --git a/sys/net80211/ieee80211_output.c b/sys/net80211/ieee80211_output.c index c71f8541085b..09a9b00668a0 100644 --- a/sys/net80211/ieee80211_output.c +++ b/sys/net80211/ieee80211_output.c @@ -58,6 +58,7 @@ __FBSDID("$FreeBSD$"); #endif #include #include +#include #if defined(INET) || defined(INET6) #include @@ -764,6 +765,16 @@ ieee80211_send_setup( } *(uint16_t *)&wh->i_dur[0] = 0; + /* + * XXX TODO: this is what the TX lock is for. + * Here we're incrementing sequence numbers, and they + * need to be in lock-step with what the driver is doing + * both in TX ordering and crypto encap (IV increment.) + * + * If the driver does seqno itself, then we can skip + * assigning sequence numbers here, and we can avoid + * requiring the TX lock. + */ tap = &ni->ni_tx_ampdu[tid]; if (tid != IEEE80211_NONQOS_TID && IEEE80211_AMPDU_RUNNING(tap)) m->m_flags |= M_AMPDU_MPDU; @@ -1542,6 +1553,11 @@ ieee80211_encap(struct ieee80211vap *vap, struct ieee80211_node *ni, if (is_amsdu) qos[0] |= IEEE80211_QOS_AMSDU; + /* + * XXX TODO TX lock is needed for atomic updates of sequence + * numbers. If the driver does it, then don't do it here; + * and we don't need the TX lock held. + */ if ((m->m_flags & M_AMPDU_MPDU) == 0) { /* * NB: don't assign a sequence # to potential @@ -1561,6 +1577,11 @@ ieee80211_encap(struct ieee80211vap *vap, struct ieee80211_node *ni, M_SEQNO_SET(m, seqno); } } else { + /* + * XXX TODO TX lock is needed for atomic updates of sequence + * numbers. If the driver does it, then don't do it here; + * and we don't need the TX lock held. + */ seqno = ni->ni_txseqs[IEEE80211_NONQOS_TID]++; *(uint16_t *)wh->i_seq = htole16(seqno << IEEE80211_SEQ_SEQ_SHIFT); @@ -2065,6 +2086,7 @@ ieee80211_add_qos(uint8_t *frm, const struct ieee80211_node *ni) * Send a probe request frame with the specified ssid * and any optional information element data. */ +/* XXX VHT? */ int ieee80211_send_probereq(struct ieee80211_node *ni, const uint8_t sa[IEEE80211_ADDR_LEN], @@ -2111,6 +2133,7 @@ ieee80211_send_probereq(struct ieee80211_node *ni, * [tlv] RSN (optional) * [tlv] extended supported rates * [tlv] HT cap (optional) + * [tlv] VHT cap (optional) * [tlv] WPA (optional) * [tlv] user-specified ie's */ @@ -2119,7 +2142,8 @@ ieee80211_send_probereq(struct ieee80211_node *ni, 2 + IEEE80211_NWID_LEN + 2 + IEEE80211_RATE_SIZE + sizeof(struct ieee80211_ie_htcap) - + sizeof(struct ieee80211_ie_htinfo) + + sizeof(struct ieee80211_ie_vhtcap) + + sizeof(struct ieee80211_ie_htinfo) /* XXX not needed? */ + sizeof(struct ieee80211_ie_wpa) + 2 + (IEEE80211_RATE_MAXSIZE - IEEE80211_RATE_SIZE) + sizeof(struct ieee80211_ie_wpa) @@ -2159,6 +2183,21 @@ ieee80211_send_probereq(struct ieee80211_node *ni, frm = ieee80211_add_htcap_ch(frm, vap, c); } + /* + * XXX TODO: need to figure out what/how to update the + * VHT channel. + */ +#if 0 + (vap->iv_flags_vht & IEEE80211_FVHT_VHT) { + struct ieee80211_channel *c; + + c = ieee80211_ht_adjust_channel(ic, ic->ic_curchan, + vap->iv_flags_ht); + c = ieee80211_vht_adjust_channel(ic, c, vap->iv_flags_vht); + frm = ieee80211_add_vhtcap_ch(frm, vap, c); + } +#endif + frm = ieee80211_add_wpa(frm, vap); if (vap->iv_appie_probereq != NULL) frm = add_appie(frm, vap->iv_appie_probereq); @@ -2357,6 +2396,7 @@ ieee80211_send_mgmt(struct ieee80211_node *ni, int type, int arg) case IEEE80211_FC0_SUBTYPE_ASSOC_REQ: case IEEE80211_FC0_SUBTYPE_REASSOC_REQ: + /* XXX VHT? */ /* * asreq frame format * [2] capability information @@ -2368,6 +2408,7 @@ ieee80211_send_mgmt(struct ieee80211_node *ni, int type, int arg) * [4] power capability (optional) * [28] supported channels (optional) * [tlv] HT capabilities + * [tlv] VHT capabilities * [tlv] WME (optional) * [tlv] Vendor OUI HT capabilities (optional) * [tlv] Atheros capabilities (if negotiated) @@ -2385,6 +2426,7 @@ ieee80211_send_mgmt(struct ieee80211_node *ni, int type, int arg) + 2 + 26 + sizeof(struct ieee80211_wme_info) + sizeof(struct ieee80211_ie_htcap) + + sizeof(struct ieee80211_ie_vhtcap) + 4 + sizeof(struct ieee80211_ie_htcap) #ifdef IEEE80211_SUPPORT_SUPERG + sizeof(struct ieee80211_ath_ie) @@ -2449,6 +2491,14 @@ ieee80211_send_mgmt(struct ieee80211_node *ni, int type, int arg) ni->ni_ies.htcap_ie[0] == IEEE80211_ELEMID_HTCAP) { frm = ieee80211_add_htcap(frm, ni); } + + if ((vap->iv_flags_vht & IEEE80211_FVHT_VHT) && + IEEE80211_IS_CHAN_VHT(ni->ni_chan) && + ni->ni_ies.vhtcap_ie != NULL && + ni->ni_ies.vhtcap_ie[0] == IEEE80211_ELEMID_VHT_CAP) { + frm = ieee80211_add_vhtcap(frm, ni); + } + frm = ieee80211_add_wpa(frm, vap); if ((ic->ic_flags & IEEE80211_F_WME) && ni->ni_ies.wme_ie != NULL) @@ -2492,6 +2542,8 @@ ieee80211_send_mgmt(struct ieee80211_node *ni, int type, int arg) * [tlv] extended supported rates * [tlv] HT capabilities (standard, if STA enabled) * [tlv] HT information (standard, if STA enabled) + * [tlv] VHT capabilities (standard, if STA enabled) + * [tlv] VHT information (standard, if STA enabled) * [tlv] WME (if configured and STA enabled) * [tlv] HT capabilities (vendor OUI, if STA enabled) * [tlv] HT information (vendor OUI, if STA enabled) @@ -2507,6 +2559,8 @@ ieee80211_send_mgmt(struct ieee80211_node *ni, int type, int arg) + 2 + (IEEE80211_RATE_MAXSIZE - IEEE80211_RATE_SIZE) + sizeof(struct ieee80211_ie_htcap) + 4 + sizeof(struct ieee80211_ie_htinfo) + 4 + + sizeof(struct ieee80211_ie_vhtcap) + + sizeof(struct ieee80211_ie_vht_operation) + sizeof(struct ieee80211_wme_param) #ifdef IEEE80211_SUPPORT_SUPERG + sizeof(struct ieee80211_ath_ie) @@ -2545,6 +2599,10 @@ ieee80211_send_mgmt(struct ieee80211_node *ni, int type, int arg) frm = ieee80211_add_htcap_vendor(frm, ni); frm = ieee80211_add_htinfo_vendor(frm, ni); } + if (ni->ni_flags & IEEE80211_NODE_VHT) { + frm = ieee80211_add_vhtcap(frm, ni); + frm = ieee80211_add_vhtinfo(frm, ni); + } #ifdef IEEE80211_SUPPORT_SUPERG if (IEEE80211_ATH_CAP(vap, ni, IEEE80211_F_ATHEROS)) frm = ieee80211_add_ath(frm, @@ -2600,6 +2658,7 @@ ieee80211_send_mgmt(struct ieee80211_node *ni, int type, int arg) * Space is left to prepend and 802.11 header at the * front but it's left to the caller to fill in. */ +/* XXX VHT? */ struct mbuf * ieee80211_alloc_proberesp(struct ieee80211_node *bss, int legacy) { @@ -2934,6 +2993,7 @@ ieee80211_tx_mgt_cb(struct ieee80211_node *ni, void *arg, int status) } } +/* XXX VHT? */ static void ieee80211_beacon_construct(struct mbuf *m, uint8_t *frm, struct ieee80211_node *ni) @@ -2946,6 +3006,10 @@ ieee80211_beacon_construct(struct mbuf *m, uint8_t *frm, /* * beacon frame format + * + * TODO: update to 802.11-2012; a lot of stuff has changed; + * vendor extensions should be at the end, etc. + * * [8] time stamp * [2] beacon interval * [2] cabability information @@ -2957,11 +3021,34 @@ ieee80211_beacon_construct(struct mbuf *m, uint8_t *frm, * [tlv] country (optional) * [3] power control (optional) * [5] channel switch announcement (CSA) (optional) + * XXX TODO: Quiet + * XXX TODO: IBSS DFS + * XXX TODO: TPC report * [tlv] extended rate phy (ERP) * [tlv] extended supported rates * [tlv] RSN parameters + * XXX TODO: BSSLOAD + * (XXX EDCA parameter set, QoS capability?) + * XXX TODO: AP channel report + * * [tlv] HT capabilities * [tlv] HT information + * XXX TODO: 20/40 BSS coexistence + * Mesh: + * XXX TODO: Meshid + * XXX TODO: mesh config + * XXX TODO: mesh awake window + * XXX TODO: beacon timing (mesh, etc) + * XXX TODO: MCCAOP Advertisement Overview + * XXX TODO: MCCAOP Advertisement + * XXX TODO: Mesh channel switch parameters + * VHT: + * XXX TODO: VHT capabilities + * XXX TODO: VHT operation + * XXX TODO: VHT transmit power envelope + * XXX TODO: channel switch wrapper element + * XXX TODO: extended BSS load element + * * XXX Vendor-specific OIDs (e.g. Atheros) * [tlv] WPA parameters * [tlv] WME parameters @@ -3055,6 +3142,16 @@ ieee80211_beacon_construct(struct mbuf *m, uint8_t *frm, bo->bo_htinfo = frm; frm = ieee80211_add_htinfo(frm, ni); } + + if (IEEE80211_IS_CHAN_VHT(ni->ni_chan)) { + frm = ieee80211_add_vhtcap(frm, ni); + bo->bo_vhtinfo = frm; + frm = ieee80211_add_vhtinfo(frm, ni); + /* Transmit power envelope */ + /* Channel switch wrapper element */ + /* Extended bss load element */ + } + frm = ieee80211_add_wpa(frm, vap); if (vap->iv_flags & IEEE80211_F_WME) { bo->bo_wme = frm; @@ -3065,6 +3162,7 @@ ieee80211_beacon_construct(struct mbuf *m, uint8_t *frm, frm = ieee80211_add_htcap_vendor(frm, ni); frm = ieee80211_add_htinfo_vendor(frm, ni); } + #ifdef IEEE80211_SUPPORT_SUPERG if (vap->iv_flags & IEEE80211_F_ATHEROS) { bo->bo_ath = frm; @@ -3082,6 +3180,8 @@ ieee80211_beacon_construct(struct mbuf *m, uint8_t *frm, bo->bo_appie_len = vap->iv_appie_beacon->ie_len; frm = add_appie(frm, vap->iv_appie_beacon); } + + /* XXX TODO: move meshid/meshconf up to before vendor extensions? */ #ifdef IEEE80211_SUPPORT_MESH if (vap->iv_opmode == IEEE80211_M_MBSS) { frm = ieee80211_add_meshid(frm, vap); @@ -3097,6 +3197,7 @@ ieee80211_beacon_construct(struct mbuf *m, uint8_t *frm, /* * Allocate a beacon frame and fillin the appropriate bits. */ +/* XXX VHT? */ struct mbuf * ieee80211_beacon_alloc(struct ieee80211_node *ni) { @@ -3110,6 +3211,9 @@ ieee80211_beacon_alloc(struct ieee80211_node *ni) /* * beacon frame format + * + * Note: This needs updating for 802.11-2012. + * * [8] time stamp * [2] beacon interval * [2] cabability information @@ -3126,6 +3230,8 @@ ieee80211_beacon_alloc(struct ieee80211_node *ni) * [tlv] RSN parameters * [tlv] HT capabilities * [tlv] HT information + * [tlv] VHT capabilities + * [tlv] VHT operation * [tlv] Vendor OUI HT capabilities (optional) * [tlv] Vendor OUI HT information (optional) * XXX Vendor-specific OIDs (e.g. Atheros) @@ -3138,6 +3244,7 @@ ieee80211_beacon_alloc(struct ieee80211_node *ni) * NB: we allocate the max space required for the TIM bitmap. * XXX how big is this? */ + /* XXX VHT? */ pktlen = 8 /* time stamp */ + sizeof(uint16_t) /* beacon interval */ + sizeof(uint16_t) /* capabilities */ @@ -3157,6 +3264,8 @@ ieee80211_beacon_alloc(struct ieee80211_node *ni) /* XXX conditional? */ + 4+2*sizeof(struct ieee80211_ie_htcap)/* HT caps */ + 4+2*sizeof(struct ieee80211_ie_htinfo)/* HT info */ + + sizeof(struct ieee80211_ie_vhtcap)/* VHT caps */ + + sizeof(struct ieee80211_ie_vht_operation)/* VHT info */ + (vap->iv_caps & IEEE80211_C_WME ? /* WME */ sizeof(struct ieee80211_wme_param) : 0) #ifdef IEEE80211_SUPPORT_SUPERG @@ -3242,6 +3351,15 @@ ieee80211_beacon_update(struct ieee80211_node *ni, struct mbuf *m, int mcast) } wh = mtod(m, struct ieee80211_frame *); + + /* + * XXX TODO Strictly speaking this should be incremented with the TX + * lock held so as to serialise access to the non-qos TID sequence + * number space. + * + * If the driver identifies it does its own TX seqno management then + * we can skip this (and still not do the TX seqno.) + */ seqno = ni->ni_txseqs[IEEE80211_NONQOS_TID]++; *(uint16_t *)&wh->i_seq[0] = htole16(seqno << IEEE80211_SEQ_SEQ_SHIFT); @@ -3347,6 +3465,10 @@ ieee80211_beacon_update(struct ieee80211_node *ni, struct mbuf *m, int mcast) timoff = 0; timlen = 1; } + + /* + * TODO: validate this! + */ if (timlen != bo->bo_tim_len) { /* copy up/down trailer */ int adjust = tie->tim_bitmap+timlen @@ -3357,6 +3479,7 @@ ieee80211_beacon_update(struct ieee80211_node *ni, struct mbuf *m, int mcast) bo->bo_tim_trailer += adjust; bo->bo_erp += adjust; bo->bo_htinfo += adjust; + bo->bo_vhtinfo += adjust; #ifdef IEEE80211_SUPPORT_SUPERG bo->bo_ath += adjust; #endif @@ -3411,6 +3534,7 @@ ieee80211_beacon_update(struct ieee80211_node *ni, struct mbuf *m, int mcast) memmove(&csa[1], csa, bo->bo_csa_trailer_len); bo->bo_erp += sizeof(*csa); bo->bo_htinfo += sizeof(*csa); + bo->bo_vhtinfo += sizeof(*csa); bo->bo_wme += sizeof(*csa); #ifdef IEEE80211_SUPPORT_SUPERG bo->bo_ath += sizeof(*csa); diff --git a/sys/net80211/ieee80211_scan_sta.c b/sys/net80211/ieee80211_scan_sta.c index 82d65c6ecf73..29e4db849a90 100644 --- a/sys/net80211/ieee80211_scan_sta.c +++ b/sys/net80211/ieee80211_scan_sta.c @@ -55,6 +55,7 @@ __FBSDID("$FreeBSD$"); #include #endif #include +#include #include @@ -325,14 +326,33 @@ sta_add(struct ieee80211_scan_state *ss, } } else ise->se_chan = curchan; + + /* VHT demotion */ + if (IEEE80211_IS_CHAN_VHT(ise->se_chan) && sp->vhtcap == NULL) { + IEEE80211_DPRINTF(vap, IEEE80211_MSG_11N, + "%s: demoting VHT->HT %d/0x%08x\n", + __func__, ise->se_chan->ic_freq, ise->se_chan->ic_flags); + /* Demote legacy networks to a non-VHT channel. */ + c = ieee80211_find_channel(ic, ise->se_chan->ic_freq, + ise->se_chan->ic_flags & ~IEEE80211_CHAN_VHT); + KASSERT(c != NULL, + ("no non-VHT channel %u", ise->se_chan->ic_ieee)); + ise->se_chan = c; + } + + /* HT demotion */ if (IEEE80211_IS_CHAN_HT(ise->se_chan) && sp->htcap == NULL) { /* Demote legacy networks to a non-HT channel. */ + IEEE80211_DPRINTF(vap, IEEE80211_MSG_11N, + "%s: demoting HT->legacy %d/0x%08x\n", + __func__, ise->se_chan->ic_freq, ise->se_chan->ic_flags); c = ieee80211_find_channel(ic, ise->se_chan->ic_freq, ise->se_chan->ic_flags & ~IEEE80211_CHAN_HT); KASSERT(c != NULL, ("no legacy channel %u", ise->se_chan->ic_ieee)); ise->se_chan = c; } + ise->se_fhdwell = sp->fhdwell; ise->se_fhindex = sp->fhindex; ise->se_erp = sp->erp; @@ -531,10 +551,11 @@ sweepchannels(struct ieee80211_scan_state *ss, struct ieee80211vap *vap, /* * Ignore dynamic turbo channels; we scan them * in normal mode (i.e. not boosted). Likewise - * for HT channels, they get scanned using + * for HT/VHT channels, they get scanned using * legacy rates. */ - if (IEEE80211_IS_CHAN_DTURBO(c) || IEEE80211_IS_CHAN_HT(c)) + if (IEEE80211_IS_CHAN_DTURBO(c) || IEEE80211_IS_CHAN_HT(c) || + IEEE80211_IS_CHAN_VHT(c)) continue; /* @@ -819,6 +840,9 @@ maxrate(const struct ieee80211_scan_entry *se) * that we assume compatibility/usability has already been checked * so we don't need to (e.g. validate whether privacy is supported). * Used to select the best scan candidate for association in a BSS. + * + * TODO: should we take 11n, 11ac into account when selecting the + * best? Right now it just compares frequency band and RSSI. */ static int sta_compare(const struct sta_entry *a, const struct sta_entry *b) @@ -1626,6 +1650,8 @@ adhoc_pick_bss(struct ieee80211_scan_state *ss, struct ieee80211vap *vap) */ chan = ieee80211_ht_adjust_channel(ic, chan, vap->iv_flags_ht); + chan = ieee80211_vht_adjust_channel(ic, + chan, vap->iv_flags_vht); ieee80211_create_ibss(vap, chan); return 1; } @@ -1657,6 +1683,8 @@ adhoc_pick_bss(struct ieee80211_scan_state *ss, struct ieee80211vap *vap) */ chan = ieee80211_ht_adjust_channel(ic, chan, vap->iv_flags_ht); + chan = ieee80211_vht_adjust_channel(ic, + chan, vap->iv_flags_vht); if (!ieee80211_sta_join(vap, chan, &selbs->base)) goto notfound; return 1; /* terminate scan */ @@ -1776,7 +1804,7 @@ static int ap_end(struct ieee80211_scan_state *ss, struct ieee80211vap *vap) { struct ieee80211com *ic = vap->iv_ic; - struct ieee80211_channel *bestchan; + struct ieee80211_channel *bestchan, *chan; KASSERT(vap->iv_opmode == IEEE80211_M_HOSTAP, ("wrong opmode %u", vap->iv_opmode)); @@ -1808,8 +1836,10 @@ ap_end(struct ieee80211_scan_state *ss, struct ieee80211vap *vap) ss->ss_flags &= ~IEEE80211_SCAN_NOPICK; return 1; } - ieee80211_create_ibss(vap, - ieee80211_ht_adjust_channel(ic, bestchan, vap->iv_flags_ht)); + chan = ieee80211_ht_adjust_channel(ic, bestchan, vap->iv_flags_ht); + chan = ieee80211_vht_adjust_channel(ic, chan, vap->iv_flags_vht); + ieee80211_create_ibss(vap, chan); + return 1; } @@ -1881,10 +1911,14 @@ mesh_pick_bss(struct ieee80211_scan_state *ss, struct ieee80211vap *vap) IEEE80211_IS_CHAN_RADAR(vap->iv_des_chan)) { struct ieee80211com *ic = vap->iv_ic; + /* XXX VHT */ chan = adhoc_pick_channel(ss, 0); - if (chan != NULL) + if (chan != NULL) { chan = ieee80211_ht_adjust_channel(ic, chan, vap->iv_flags_ht); + chan = ieee80211_vht_adjust_channel(ic, + chan, vap->iv_flags_vht); + } } else chan = vap->iv_des_chan; if (chan != NULL) { diff --git a/sys/net80211/ieee80211_sta.c b/sys/net80211/ieee80211_sta.c index dd9ef6e4d21a..f64232a2b804 100644 --- a/sys/net80211/ieee80211_sta.c +++ b/sys/net80211/ieee80211_sta.c @@ -64,6 +64,7 @@ __FBSDID("$FreeBSD$"); #endif #include #include +#include #define IEEE80211_RATE2MBS(r) (((r) & IEEE80211_RATE_VAL) / 2) @@ -1330,8 +1331,9 @@ sta_recv_mgmt(struct ieee80211_node *ni, struct mbuf *m0, int subtype, struct ieee80211_frame *wh; uint8_t *frm, *efrm; uint8_t *rates, *xrates, *wme, *htcap, *htinfo; + uint8_t *vhtcap, *vhtopmode; uint8_t rate; - int ht_state_change = 0; + int ht_state_change = 0, do_ht = 0; wh = mtod(m0, struct ieee80211_frame *); frm = (uint8_t *)&wh[1]; @@ -1430,10 +1432,23 @@ sta_recv_mgmt(struct ieee80211_node *ni, struct mbuf *m0, int subtype, if (scan.htcap != NULL && scan.htinfo != NULL && (vap->iv_flags_ht & IEEE80211_FHT_HT)) { /* XXX state changes? */ - if (ieee80211_ht_updateparams(ni, + ieee80211_ht_updateparams(ni, + scan.htcap, scan.htinfo); + do_ht = 1; + } + if (scan.vhtcap != NULL && scan.vhtopmode != NULL && + (vap->iv_flags_vht & IEEE80211_FVHT_VHT)) { + /* XXX state changes? */ + ieee80211_vht_updateparams(ni, + scan.vhtcap, scan.vhtopmode); + do_ht = 1; + } + if (do_ht) { + if (ieee80211_ht_updateparams_final(ni, scan.htcap, scan.htinfo)) ht_state_change = 1; } + if (scan.quiet) ic->ic_set_quiet(ni, scan.quiet); @@ -1660,6 +1675,7 @@ sta_recv_mgmt(struct ieee80211_node *ni, struct mbuf *m0, int subtype, frm += 2; rates = xrates = wme = htcap = htinfo = NULL; + vhtcap = vhtopmode = NULL; while (efrm - frm > 1) { IEEE80211_VERIFY_LENGTH(efrm - frm, frm[1] + 2, return); switch (*frm) { @@ -1693,6 +1709,12 @@ sta_recv_mgmt(struct ieee80211_node *ni, struct mbuf *m0, int subtype, } /* XXX Atheros OUI support */ break; + case IEEE80211_ELEMID_VHT_CAP: + vhtcap = frm; + break; + case IEEE80211_ELEMID_VHT_OPMODE: + vhtopmode = frm; + break; } frm += frm[1] + 2; } @@ -1737,9 +1759,30 @@ sta_recv_mgmt(struct ieee80211_node *ni, struct mbuf *m0, int subtype, (vap->iv_flags_ht & IEEE80211_FHT_HT)) { ieee80211_ht_node_init(ni); ieee80211_ht_updateparams(ni, htcap, htinfo); + + if ((vhtcap != NULL) && (vhtopmode != NULL) & + (vap->iv_flags_vht & IEEE80211_FVHT_VHT)) { + /* + * Log if we get a VHT assoc/reassoc response. + * We aren't ready for 2GHz VHT support. + */ + if (IEEE80211_IS_CHAN_2GHZ(ni->ni_chan)) { + printf("%s: peer %6D: VHT on 2GHz, ignoring\n", + __func__, + ni->ni_macaddr, + ":"); + } else { + ieee80211_vht_node_init(ni); + ieee80211_vht_updateparams(ni, vhtcap, vhtopmode); + ieee80211_setup_vht_rates(ni, vhtcap, vhtopmode); + } + } + + ieee80211_ht_updateparams_final(ni, htcap, htinfo); ieee80211_setup_htrates(ni, htcap, IEEE80211_F_JOIN | IEEE80211_F_DOBRS); ieee80211_setup_basic_htrates(ni, htinfo); + ieee80211_node_setuptxparms(ni); ieee80211_ratectl_node_init(ni); } diff --git a/sys/net80211/ieee80211_var.h b/sys/net80211/ieee80211_var.h index 1b73d3929620..48b9196846e3 100644 --- a/sys/net80211/ieee80211_var.h +++ b/sys/net80211/ieee80211_var.h @@ -95,6 +95,9 @@ */ #define IEEE80211_CONF_VHT(ic) ((ic)->ic_vhtcaps != 0) +#define IEEE80211_CONF_SEQNO_OFFLOAD(ic) \ + ((ic)->ic_flags_ext & IEEE80211_FEXT_SEQNO_OFFLOAD) + /* * 802.11 control state is split into a common portion that maps * 1-1 to a physical device and one or more "Virtual AP's" (VAP) @@ -629,11 +632,12 @@ MALLOC_DECLARE(M_80211_VAP); #define IEEE80211_FEXT_PROBECHAN 0x00020000 /* CONF: probe passive channel*/ #define IEEE80211_FEXT_UNIQMAC 0x00040000 /* CONF: user or computed mac */ #define IEEE80211_FEXT_SCAN_OFFLOAD 0x00080000 /* CONF: scan is fully offloaded */ +#define IEEE80211_FEXT_SEQNO_OFFLOAD 0x00100000 /* CONF: driver does seqno insertion/allocation */ #define IEEE80211_FEXT_BITS \ "\20\2INACT\3SCANWAIT\4BGSCAN\5WPS\6TSN\7SCANREQ\10RESUME" \ "\0114ADDR\12NONEPR_PR\13SWBMISS\14DFS\15DOTD\16STATEWAIT\17REINIT" \ - "\20BPF\21WDSLEGACY\22PROBECHAN\23UNIQMAC\24SCAN_OFFLOAD" + "\20BPF\21WDSLEGACY\22PROBECHAN\23UNIQMAC\24SCAN_OFFLOAD\25SEQNO_OFFLOAD" /* ic_flags_ht/iv_flags_ht */ #define IEEE80211_FHT_NONHT_PR 0x00000001 /* STATUS: non-HT sta present */ diff --git a/sys/netinet/raw_ip.c b/sys/netinet/raw_ip.c index d741cc7f8511..c8f944c9e252 100644 --- a/sys/netinet/raw_ip.c +++ b/sys/netinet/raw_ip.c @@ -508,7 +508,7 @@ rip_output(struct mbuf *m, struct socket *so, ...) * and don't allow packet length sizes that will crash. */ if (((ip->ip_hl != (sizeof (*ip) >> 2)) && inp->inp_options) - || (ntohs(ip->ip_len) > m->m_pkthdr.len) + || (ntohs(ip->ip_len) != m->m_pkthdr.len) || (ntohs(ip->ip_len) < (ip->ip_hl << 2))) { INP_RUNLOCK(inp); m_freem(m); diff --git a/sys/netinet/sctp_syscalls.c b/sys/netinet/sctp_syscalls.c index eea70e23d208..66df3141ec5a 100644 --- a/sys/netinet/sctp_syscalls.c +++ b/sys/netinet/sctp_syscalls.c @@ -121,17 +121,18 @@ sys_sctp_peeloff(td, uap) } */ *uap; { #if (defined(INET) || defined(INET6)) && defined(SCTP) - struct file *nfp = NULL; + struct file *headfp, *nfp = NULL; struct socket *head, *so; cap_rights_t rights; u_int fflag; int error, fd; AUDIT_ARG_FD(uap->sd); - error = fgetsock(td, uap->sd, cap_rights_init(&rights, CAP_PEELOFF), - &head, &fflag); + error = getsock_cap(td, uap->sd, cap_rights_init(&rights, CAP_PEELOFF), + &headfp, &fflag, NULL); if (error != 0) goto done2; + head = headfp->f_data; if (head->so_proto->pr_protocol != IPPROTO_SCTP) { error = EOPNOTSUPP; goto done; @@ -196,7 +197,7 @@ sys_sctp_peeloff(td, uap) done: if (nfp != NULL) fdrop(nfp, td); - fputsock(head); + fdrop(headfp, td); done2: return (error); #else /* SCTP */ diff --git a/sys/netinet/tcp_var.h b/sys/netinet/tcp_var.h index f4ea246b1837..38e8a15e7e19 100644 --- a/sys/netinet/tcp_var.h +++ b/sys/netinet/tcp_var.h @@ -452,7 +452,7 @@ struct tcptw { tcp_seq iss; tcp_seq irs; u_short last_win; /* cached window value */ - u_short tw_so_options; /* copy of so_options */ + short tw_so_options; /* copy of so_options */ struct ucred *tw_cred; /* user credentials */ u_int32_t t_recent; u_int32_t ts_offset; /* our timestamp offset */ diff --git a/sys/sparc64/sparc64/mem.c b/sys/sparc64/sparc64/mem.c index 6bd52253666c..a25bef49f3d2 100644 --- a/sys/sparc64/sparc64/mem.c +++ b/sys/sparc64/sparc64/mem.c @@ -43,7 +43,7 @@ __FBSDID("$FreeBSD$"); /* * Memory special file * - * NOTE: other architectures support mmap()'ing the mem and kmem devices; this + * NOTE: other architectures support mmap()'ing the mem device; this * might cause illegal aliases to be created for the locked kernel page(s), so * it is not implemented. */ diff --git a/sys/sys/file.h b/sys/sys/file.h index c30eb0584f70..353c92f365a9 100644 --- a/sys/sys/file.h +++ b/sys/sys/file.h @@ -50,8 +50,6 @@ struct thread; struct uio; struct knote; struct vnode; -struct socket; - #endif /* _KERNEL */ @@ -267,10 +265,6 @@ int fgetvp_read(struct thread *td, int fd, cap_rights_t *rightsp, int fgetvp_write(struct thread *td, int fd, cap_rights_t *rightsp, struct vnode **vpp); -int fgetsock(struct thread *td, int fd, cap_rights_t *rightsp, - struct socket **spp, u_int *fflagp); -void fputsock(struct socket *sp); - static __inline int _fnoop(void) { diff --git a/sys/sys/param.h b/sys/sys/param.h index b182fa39378d..07b11e2daf5c 100644 --- a/sys/sys/param.h +++ b/sys/sys/param.h @@ -58,7 +58,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1200019 /* Master, propagated to newvers */ +#define __FreeBSD_version 1200020 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, diff --git a/sys/sys/tty.h b/sys/sys/tty.h index f1a044f1488c..09e04195ae55 100644 --- a/sys/sys/tty.h +++ b/sys/sys/tty.h @@ -62,6 +62,7 @@ struct tty { struct mtx *t_mtx; /* TTY lock. */ struct mtx t_mtxobj; /* Per-TTY lock (when not borrowing). */ TAILQ_ENTRY(tty) t_list; /* (l) TTY list entry. */ + int t_drainwait; /* (t) TIOCDRAIN timeout seconds. */ unsigned int t_flags; /* (t) Terminal option flags. */ /* Keep flags in sync with db_show_tty and pstat(8). */ #define TF_NOPREFIX 0x00001 /* Don't prepend "tty" to device name. */ diff --git a/sys/sys/ttyqueue.h b/sys/sys/ttyqueue.h index 2d1a565af965..c8d85d6280d5 100644 --- a/sys/sys/ttyqueue.h +++ b/sys/sys/ttyqueue.h @@ -69,7 +69,7 @@ struct ttyoutq { #ifdef _KERNEL /* Input queue handling routines. */ -void ttyinq_setsize(struct ttyinq *ti, struct tty *tp, size_t len); +int ttyinq_setsize(struct ttyinq *ti, struct tty *tp, size_t len); void ttyinq_free(struct ttyinq *ti); int ttyinq_read_uio(struct ttyinq *ti, struct tty *tp, struct uio *uio, size_t readlen, size_t flushlen); @@ -136,7 +136,7 @@ void ttyinq_line_iterate_from_reprintpos(struct ttyinq *ti, /* Output queue handling routines. */ void ttyoutq_flush(struct ttyoutq *to); -void ttyoutq_setsize(struct ttyoutq *to, struct tty *tp, size_t len); +int ttyoutq_setsize(struct ttyoutq *to, struct tty *tp, size_t len); void ttyoutq_free(struct ttyoutq *to); size_t ttyoutq_read(struct ttyoutq *to, void *buf, size_t len); int ttyoutq_read_uio(struct ttyoutq *to, struct tty *tp, struct uio *uio); diff --git a/sys/vm/vnode_pager.c b/sys/vm/vnode_pager.c index ccb4b8a5713a..2368fc2073a2 100644 --- a/sys/vm/vnode_pager.c +++ b/sys/vm/vnode_pager.c @@ -974,7 +974,7 @@ vnode_pager_generic_getpages(struct vnode *vp, vm_page_t *m, int count, #ifdef INVARIANTS KASSERT(bp->b_npages <= nitems(bp->b_pages), ("%s: buf %p overflowed", __func__, bp)); - for (int j = 1, prev = 1; j < bp->b_npages; j++) { + for (int j = 1, prev = 0; j < bp->b_npages; j++) { if (bp->b_pages[j] == bogus_page) continue; KASSERT(bp->b_pages[j]->pindex - bp->b_pages[prev]->pindex == diff --git a/sys/x86/x86/mca.c b/sys/x86/x86/mca.c index 1d99efc74ed8..a917cc45f26b 100644 --- a/sys/x86/x86/mca.c +++ b/sys/x86/x86/mca.c @@ -247,7 +247,7 @@ mca_error_mmtype(uint16_t mca_error) return ("???"); } -static int __nonnull(1) +static int mca_mute(const struct mca_record *rec) { @@ -276,7 +276,7 @@ mca_mute(const struct mca_record *rec) } /* Dump details about a single machine check. */ -static void __nonnull(1) +static void mca_log(const struct mca_record *rec) { uint16_t mca_error; @@ -415,7 +415,7 @@ mca_log(const struct mca_record *rec) printf("MCA: Misc 0x%llx\n", (long long)rec->mr_misc); } -static int __nonnull(2) +static int mca_check_status(int bank, struct mca_record *rec) { uint64_t status; @@ -482,7 +482,7 @@ mca_refill(void *context, int pending) mca_fill_freelist(); } -static void __nonnull(2) +static void mca_record_entry(enum scan_mode mode, const struct mca_record *record) { struct mca_internal *rec; diff --git a/tests/sys/Makefile.inc b/tests/sys/Makefile.inc new file mode 100644 index 000000000000..f3418421919d --- /dev/null +++ b/tests/sys/Makefile.inc @@ -0,0 +1,3 @@ +# $FreeBSD$ + +WARNS?= 6 diff --git a/tests/sys/file/ftruncate_test.c b/tests/sys/file/ftruncate_test.c index 7eaba14e2bfa..b657acad7fcb 100644 --- a/tests/sys/file/ftruncate_test.c +++ b/tests/sys/file/ftruncate_test.c @@ -57,7 +57,7 @@ static off_t lengths[] = {0, 1, 2, 3, 4, 127, 128, 129, 511, 512, 513, 1023, static int lengths_count = sizeof(lengths) / sizeof(off_t); int -main(int argc, char *argv[]) +main(void) { int error, fd, fds[2], i, read_only_fd; char path[PATH_MAX]; diff --git a/tests/sys/fs/Makefile.inc b/tests/sys/fs/Makefile.inc new file mode 100644 index 000000000000..265f86d1ed55 --- /dev/null +++ b/tests/sys/fs/Makefile.inc @@ -0,0 +1,3 @@ +# $FreeBSD$ + +.include "../Makefile.inc" diff --git a/tests/sys/kern/Makefile.inc b/tests/sys/kern/Makefile.inc new file mode 100644 index 000000000000..265f86d1ed55 --- /dev/null +++ b/tests/sys/kern/Makefile.inc @@ -0,0 +1,3 @@ +# $FreeBSD$ + +.include "../Makefile.inc" diff --git a/tests/sys/kern/execve/execve_helper.c b/tests/sys/kern/execve/execve_helper.c index 164a8f3fc61e..989b3e4b9761 100644 --- a/tests/sys/kern/execve/execve_helper.c +++ b/tests/sys/kern/execve/execve_helper.c @@ -50,5 +50,5 @@ main(int argc, char **argv) } execve(argv[1], &argv[1], NULL); - err(1, ""); + err(1, "execve failed"); } diff --git a/tests/sys/kqueue/Makefile.inc b/tests/sys/kqueue/Makefile.inc new file mode 100644 index 000000000000..265f86d1ed55 --- /dev/null +++ b/tests/sys/kqueue/Makefile.inc @@ -0,0 +1,3 @@ +# $FreeBSD$ + +.include "../Makefile.inc" diff --git a/tests/sys/mac/Makefile.inc b/tests/sys/mac/Makefile.inc new file mode 100644 index 000000000000..265f86d1ed55 --- /dev/null +++ b/tests/sys/mac/Makefile.inc @@ -0,0 +1,3 @@ +# $FreeBSD$ + +.include "../Makefile.inc" diff --git a/tests/sys/mac/bsdextended/ugidfw_test.c b/tests/sys/mac/bsdextended/ugidfw_test.c index aab8553c89e2..57a283ba2251 100644 --- a/tests/sys/mac/bsdextended/ugidfw_test.c +++ b/tests/sys/mac/bsdextended/ugidfw_test.c @@ -71,7 +71,7 @@ static const char *test_groups[] = { "bin", }; -int test_num; +static int test_num; /* * List of test strings that must go in (and come out) of libugidfw intact. @@ -149,7 +149,8 @@ test_libugidfw_strings(void) struct mac_bsdextended_rule rule; char errorstr[256]; char rulestr[256]; - int error, i; + size_t i; + int error; for (i = 0; i < nitems(test_users); i++, test_num++) { if (getpwnam(test_users[i]) == NULL) @@ -171,7 +172,7 @@ test_libugidfw_strings(void) error = bsde_parse_rule_string(test_strings[i], &rule, sizeof(errorstr), errorstr); if (error == -1) - printf("not ok %d # bsde_parse_rule_string: '%s' (%d) " + printf("not ok %d # bsde_parse_rule_string: '%s' (%zu) " "failed: %s\n", test_num, test_strings[i], i, errorstr); else printf("ok %d\n", test_num); @@ -221,7 +222,7 @@ main(void) return (0); } - printf("1..%lu\n", nitems(test_users) + nitems(test_groups) + + printf("1..%zu\n", nitems(test_users) + nitems(test_groups) + 3 * nitems(test_strings) + 2); test_libugidfw_strings(); diff --git a/tests/sys/vfs/Makefile b/tests/sys/vfs/Makefile index 43fde788f652..9e2d79ef773a 100644 --- a/tests/sys/vfs/Makefile +++ b/tests/sys/vfs/Makefile @@ -9,6 +9,4 @@ CFLAGS.lookup_cap_dotdot.c+= -I${SRCTOP}/tests PLAIN_TESTS_SH+= trailing_slash -WARNS?= 6 - .include diff --git a/tests/sys/vfs/lookup_cap_dotdot.c b/tests/sys/vfs/lookup_cap_dotdot.c index e14b5887a75e..c1a90cc2af5f 100644 --- a/tests/sys/vfs/lookup_cap_dotdot.c +++ b/tests/sys/vfs/lookup_cap_dotdot.c @@ -31,20 +31,16 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include -#include #include #include #include #include "freebsd_test_suite/macros.h" -static char *abspath; -static int dirfd = -1; - -typedef void (*child_test_fn_t)(void); +static int dirfd = -1; +static char *abspath; static void touchat(int _dirfd, const char *name) @@ -82,43 +78,10 @@ prepare_dotdot_tests(void) static void check_capsicum(void) { - ATF_REQUIRE_FEATURE("security_capabilities"); ATF_REQUIRE_FEATURE("security_capability_mode"); } -static void -run_capsicum_test(child_test_fn_t test_func) -{ - int child_exit_code, child_status; - pid_t child_pid; - - check_capsicum(); - prepare_dotdot_tests(); - - ATF_REQUIRE_MSG((child_pid = fork()) != -1, - "fork failed: %s", strerror(errno)); - - if (child_pid == 0) { - test_func(); - _exit(0); - } - - ATF_REQUIRE_MSG(waitpid(child_pid, &child_status, 0) != -1, - "waitpid failed: %s", strerror(errno)); - if (WIFEXITED(child_status)) { - child_exit_code = WEXITSTATUS(child_status); - ATF_REQUIRE_MSG(child_exit_code == 0, - "child exited with non-zero exit code: %d", - child_exit_code); - } else if (WIFSIGNALED(child_status)) - atf_tc_fail("child exited with signal: %d", - WTERMSIG(child_status)); - else - atf_tc_fail("child exited with unexpected status: %d", - child_status); -} - /* * Positive tests */ @@ -130,7 +93,6 @@ ATF_TC_HEAD(openat__basic_positive, tc) ATF_TC_BODY(openat__basic_positive, tc) { - prepare_dotdot_tests(); ATF_REQUIRE(openat(dirfd, "d1/d2/d3/f3", O_RDONLY) >= 0); @@ -152,22 +114,20 @@ ATF_TC_HEAD(lookup_cap_dotdot__basic, tc) "Validate cap-mode (testdir)/d1/.. lookup"); } -static void -lookup_cap_dotdot__basic_child(void) +ATF_TC_BODY(lookup_cap_dotdot__basic, tc) { cap_rights_t rights; + check_capsicum(); + prepare_dotdot_tests(); + cap_rights_init(&rights, CAP_LOOKUP, CAP_READ); + ATF_REQUIRE(cap_rights_limit(dirfd, &rights) >= 0); - assert(cap_rights_limit(dirfd, &rights) >= 0); - assert(cap_enter() >= 0); - assert(openat(dirfd, "d1/..", O_RDONLY) >= 0); -} + ATF_REQUIRE(cap_enter() >= 0); -ATF_TC_BODY(lookup_cap_dotdot__basic, tc) -{ - - run_capsicum_test(lookup_cap_dotdot__basic_child); + ATF_REQUIRE_MSG(openat(dirfd, "d1/..", O_RDONLY) >= 0, "%s", + strerror(errno)); } ATF_TC(lookup_cap_dotdot__advanced); @@ -177,26 +137,22 @@ ATF_TC_HEAD(lookup_cap_dotdot__advanced, tc) "Validate cap-mode (testdir)/d1/.. lookup"); } -static void -lookup_cap_dotdot__advanced_child(void) +ATF_TC_BODY(lookup_cap_dotdot__advanced, tc) { cap_rights_t rights; + check_capsicum(); + prepare_dotdot_tests(); + cap_rights_init(&rights, CAP_LOOKUP, CAP_READ); - assert(cap_rights_limit(dirfd, &rights) >= 0); + ATF_REQUIRE(cap_rights_limit(dirfd, &rights) >= 0); - assert(cap_enter() >= 0); + ATF_REQUIRE(cap_enter() >= 0); - assert(openat(dirfd, "d1/d2/d3/../../f1", O_RDONLY) >= 0); - assert(openat(dirfd, "l3/../../f1", O_RDONLY) >= 0); - assert(openat(dirfd, "l3/ld1", O_RDONLY) >= 0); - assert(openat(dirfd, "l3/lf1", O_RDONLY) >= 0); -} - -ATF_TC_BODY(lookup_cap_dotdot__advanced, tc) -{ - - run_capsicum_test(lookup_cap_dotdot__advanced_child); + ATF_REQUIRE(openat(dirfd, "d1/d2/d3/../../f1", O_RDONLY) >= 0); + ATF_REQUIRE(openat(dirfd, "l3/../../f1", O_RDONLY) >= 0); + ATF_REQUIRE(openat(dirfd, "l3/ld1", O_RDONLY) >= 0); + ATF_REQUIRE(openat(dirfd, "l3/lf1", O_RDONLY) >= 0); } /* @@ -210,7 +166,6 @@ ATF_TC_HEAD(openat__basic_negative, tc) ATF_TC_BODY(openat__basic_negative, tc) { - prepare_dotdot_tests(); ATF_REQUIRE_ERRNO(ENOENT, @@ -225,43 +180,32 @@ ATF_TC_HEAD(capmode__negative, tc) atf_tc_set_md_var(tc, "descr", "Negative Capability mode testcases"); } -static void -capmode__negative_child(void) +ATF_TC_BODY(capmode__negative, tc) { int subdirfd; - assert(cap_enter() == 0); + check_capsicum(); + prepare_dotdot_tests(); + + ATF_REQUIRE(cap_enter() == 0); /* open() not permitted in capability mode */ - assert(open("testdir", O_RDONLY) < 0); - assert(errno == ECAPMODE); + ATF_REQUIRE_ERRNO(ECAPMODE, open("testdir", O_RDONLY) < 0); /* AT_FDCWD not permitted in capability mode */ - assert(openat(AT_FDCWD, "d1/f1", O_RDONLY) < 0); - assert(errno == ECAPMODE); + ATF_REQUIRE_ERRNO(ECAPMODE, openat(AT_FDCWD, "d1/f1", O_RDONLY) < 0); /* Relative path above dirfd not capable */ - assert(openat(dirfd, "..", O_RDONLY) < 0); - assert(errno == ENOTCAPABLE); - - assert((subdirfd = openat(dirfd, "l3", O_RDONLY)) >= 0); - assert(openat(subdirfd, "../../f1", O_RDONLY) < 0); - assert(errno == ENOTCAPABLE); - (void)close(subdirfd); + ATF_REQUIRE_ERRNO(ENOTCAPABLE, openat(dirfd, "..", O_RDONLY) < 0); + ATF_REQUIRE((subdirfd = openat(dirfd, "l3", O_RDONLY)) >= 0); + ATF_REQUIRE_ERRNO(ENOTCAPABLE, + openat(subdirfd, "../../f1", O_RDONLY) < 0); /* Absolute paths not capable */ - assert(openat(dirfd, abspath, O_RDONLY) < 0); - assert(errno == ENOTCAPABLE); + ATF_REQUIRE_ERRNO(ENOTCAPABLE, openat(dirfd, abspath, O_RDONLY) < 0); /* Symlink above dirfd */ - assert(openat(dirfd, "lup/f1", O_RDONLY) < 0); - assert(errno == ENOTCAPABLE); -} - -ATF_TC_BODY(capmode__negative, tc) -{ - - run_capsicum_test(capmode__negative_child); + ATF_REQUIRE_ERRNO(ENOTCAPABLE, openat(dirfd, "lup/f1", O_RDONLY) < 0); } ATF_TC(lookup_cap_dotdot__negative); @@ -271,30 +215,21 @@ ATF_TC_HEAD(lookup_cap_dotdot__negative, tc) "Validate cap-mode (testdir)/.. lookup fails"); } -static void -lookup_cap_dotdot__negative_child(void) +ATF_TC_BODY(lookup_cap_dotdot__negative, tc) { cap_rights_t rights; + check_capsicum(); + prepare_dotdot_tests(); + cap_rights_init(&rights, CAP_LOOKUP, CAP_READ); - assert(cap_rights_limit(dirfd, &rights) >= 0); + ATF_REQUIRE(cap_rights_limit(dirfd, &rights) >= 0); - assert(cap_enter() >= 0); + ATF_REQUIRE(cap_enter() >= 0); - assert(openat(dirfd, "..", O_RDONLY) < 0); - assert(errno == ENOTCAPABLE); - - assert(openat(dirfd, "d1/../..", O_RDONLY) < 0); - assert(errno == ENOTCAPABLE); - - assert(openat(dirfd, "../testdir/d1/f1", O_RDONLY) < 0); - assert(errno == ENOTCAPABLE); -} - -ATF_TC_BODY(lookup_cap_dotdot__negative, tc) -{ - - run_capsicum_test(lookup_cap_dotdot__negative_child); + ATF_REQUIRE_ERRNO(ENOTCAPABLE, openat(dirfd, "..", O_RDONLY) < 0); + ATF_REQUIRE_ERRNO(ENOTCAPABLE, openat(dirfd, "d1/../..", O_RDONLY) < 0); + ATF_REQUIRE_ERRNO(ENOTCAPABLE, openat(dirfd, "../testdir/d1/f1", O_RDONLY) < 0); } ATF_TP_ADD_TCS(tp) diff --git a/tests/sys/vm/mmap_test.c b/tests/sys/vm/mmap_test.c index 8ed873896f03..afabb5c41b83 100644 --- a/tests/sys/vm/mmap_test.c +++ b/tests/sys/vm/mmap_test.c @@ -184,8 +184,7 @@ ATF_TC_WITHOUT_HEAD(mmap__dev_zero_private); ATF_TC_BODY(mmap__dev_zero_private, tc) { char *p1, *p2, *p3; - size_t i; - int fd, pagesize; + int fd, i, pagesize; ATF_REQUIRE((pagesize = getpagesize()) > 0); ATF_REQUIRE((fd = open("/dev/zero", O_RDONLY)) >= 0); @@ -197,7 +196,7 @@ ATF_TC_BODY(mmap__dev_zero_private, tc) ATF_REQUIRE(p2 != MAP_FAILED); for (i = 0; i < pagesize; i++) - ATF_REQUIRE_EQ_MSG(0, p1[i], "byte at p1[%zu] is %x", i, p1[i]); + ATF_REQUIRE_EQ_MSG(0, p1[i], "byte at p1[%d] is %x", i, p1[i]); ATF_REQUIRE(memcmp(p1, p2, pagesize) == 0); @@ -224,8 +223,7 @@ ATF_TC_WITHOUT_HEAD(mmap__dev_zero_shared); ATF_TC_BODY(mmap__dev_zero_shared, tc) { char *p1, *p2, *p3; - size_t i; - int fd, pagesize; + int fd, i, pagesize; ATF_REQUIRE((pagesize = getpagesize()) > 0); ATF_REQUIRE((fd = open("/dev/zero", O_RDWR)) >= 0); @@ -237,7 +235,7 @@ ATF_TC_BODY(mmap__dev_zero_shared, tc) ATF_REQUIRE(p2 != MAP_FAILED); for (i = 0; i < pagesize; i++) - ATF_REQUIRE_EQ_MSG(0, p1[i], "byte at p1[%zu] is %x", i, p1[i]); + ATF_REQUIRE_EQ_MSG(0, p1[i], "byte at p1[%d] is %x", i, p1[i]); ATF_REQUIRE(memcmp(p1, p2, pagesize) == 0); diff --git a/usr.bin/fortune/fortune/fortune.6 b/usr.bin/fortune/fortune/fortune.6 index d8f6bad177d0..bc6e26e182a0 100644 --- a/usr.bin/fortune/fortune/fortune.6 +++ b/usr.bin/fortune/fortune/fortune.6 @@ -176,7 +176,6 @@ it was up to on disk. .El .Sh FILES .Bl -tag -width ".Pa /usr/share/games/fortune/*" -.It Pa /usr/games/fortune .It Pa /usr/share/games/fortune/* the fortunes databases (those files ending .Dq Pa -o diff --git a/usr.bin/rpcgen/rpc_cout.c b/usr.bin/rpcgen/rpc_cout.c index 0c2ce2098b36..6e245bf6ca42 100644 --- a/usr.bin/rpcgen/rpc_cout.c +++ b/usr.bin/rpcgen/rpc_cout.c @@ -551,7 +551,8 @@ emit_struct(definition *def) } for (dl = def->def.st.decls; dl != NULL; dl = dl->next) - if (dl->decl.rel == REL_VECTOR){ + if (dl->decl.rel == REL_VECTOR && + strcmp(dl->decl.type, "opaque") != 0){ f_print(fout, "\tint i;\n"); break; } diff --git a/usr.bin/rpcgen/rpc_svcout.c b/usr.bin/rpcgen/rpc_svcout.c index aa5a86ad2ba9..3c6d0824f11a 100644 --- a/usr.bin/rpcgen/rpc_svcout.c +++ b/usr.bin/rpcgen/rpc_svcout.c @@ -728,7 +728,8 @@ write_timeout_func(void) if (tirpcflag) { f_print(fout, "\t\t\tstruct rlimit rl;\n\n"); f_print(fout, "\t\t\trl.rlim_max = 0;\n"); - f_print(fout, "\t\t\tgetrlimit(RLIMIT_NOFILE, &rl);\n"); + f_print(fout, "\t\t\tif (getrlimit(RLIMIT_NOFILE, &rl) == -1)\n"); + f_print(fout, "\t\t\t\treturn;\n"); f_print(fout, "\t\t\tif ((size = rl.rlim_max) == 0) {\n"); if (mtflag) @@ -902,7 +903,11 @@ write_rpc_svc_fg(const char *infile, const char *sp) /* get number of file descriptors */ if (tirpcflag) { f_print(fout, "%srl.rlim_max = 0;\n", sp); - f_print(fout, "%sgetrlimit(RLIMIT_NOFILE, &rl);\n", sp); + f_print(fout, "%sif (getrlimit(RLIMIT_NOFILE, &rl) == -1) {\n", + sp); + f_print(fout, "%s\tperror(\"getrlimit\");\n", sp); + f_print(fout, "%s\texit(1);\n", sp); + f_print(fout, "%s}\n", sp); f_print(fout, "%sif ((size = rl.rlim_max) == 0)\n", sp); f_print(fout, "%s\texit(1);\n", sp); } else { diff --git a/usr.sbin/ctld/ctld.c b/usr.sbin/ctld/ctld.c index d812bd271564..4f0521f718e9 100644 --- a/usr.sbin/ctld/ctld.c +++ b/usr.sbin/ctld/ctld.c @@ -1582,6 +1582,7 @@ connection_new(struct portal *portal, int fd, const char *host, * Default values, from RFC 3720, section 12. */ conn->conn_max_recv_data_segment_length = 8192; + conn->conn_max_send_data_segment_length = 8192; conn->conn_max_burst_length = 262144; conn->conn_first_burst_length = 65536; conn->conn_immediate_data = true; diff --git a/usr.sbin/ctld/ctld.h b/usr.sbin/ctld/ctld.h index 85cbd324507e..8452a158e980 100644 --- a/usr.sbin/ctld/ctld.h +++ b/usr.sbin/ctld/ctld.h @@ -48,8 +48,6 @@ #define MAX_LUNS 1024 #define MAX_NAME_LEN 223 #define MAX_DATA_SEGMENT_LENGTH (128 * 1024) -#define MAX_BURST_LENGTH 16776192 -#define FIRST_BURST_LENGTH (128 * 1024) #define SOCKBUF_SIZE 1048576 struct auth { @@ -242,6 +240,10 @@ struct connection { struct sockaddr_storage conn_initiator_sa; uint32_t conn_cmdsn; uint32_t conn_statsn; + int conn_max_recv_data_segment_limit; + int conn_max_send_data_segment_limit; + int conn_max_burst_limit; + int conn_first_burst_limit; int conn_max_recv_data_segment_length; int conn_max_send_data_segment_length; int conn_max_burst_length; diff --git a/usr.sbin/ctld/login.c b/usr.sbin/ctld/login.c index 5c3586821b2f..221b6eb7edda 100644 --- a/usr.sbin/ctld/login.c +++ b/usr.sbin/ctld/login.c @@ -557,13 +557,15 @@ login_negotiate_key(struct pdu *request, const char *name, * our MaxRecvDataSegmentLength is not influenced by the * initiator in any way. */ - if ((int)tmp > conn->conn_max_send_data_segment_length) { - log_debugx("capping max_send_data_segment_length " + if ((int)tmp > conn->conn_max_send_data_segment_limit) { + log_debugx("capping MaxRecvDataSegmentLength " "from %zd to %d", tmp, - conn->conn_max_send_data_segment_length); - tmp = conn->conn_max_send_data_segment_length; + conn->conn_max_send_data_segment_limit); + tmp = conn->conn_max_send_data_segment_limit; } conn->conn_max_send_data_segment_length = tmp; + conn->conn_max_recv_data_segment_length = + conn->conn_max_recv_data_segment_limit; keys_add_int(response_keys, name, conn->conn_max_recv_data_segment_length); } else if (strcmp(name, "MaxBurstLength") == 0) { @@ -572,10 +574,10 @@ login_negotiate_key(struct pdu *request, const char *name, login_send_error(request, 0x02, 0x00); log_errx(1, "received invalid MaxBurstLength"); } - if ((int)tmp > conn->conn_max_burst_length) { + if ((int)tmp > conn->conn_max_burst_limit) { log_debugx("capping MaxBurstLength from %zd to %d", - tmp, conn->conn_max_burst_length); - tmp = conn->conn_max_burst_length; + tmp, conn->conn_max_burst_limit); + tmp = conn->conn_max_burst_limit; } conn->conn_max_burst_length = tmp; keys_add_int(response_keys, name, tmp); @@ -585,10 +587,10 @@ login_negotiate_key(struct pdu *request, const char *name, login_send_error(request, 0x02, 0x00); log_errx(1, "received invalid FirstBurstLength"); } - if ((int)tmp > conn->conn_first_burst_length) { + if ((int)tmp > conn->conn_first_burst_limit) { log_debugx("capping FirstBurstLength from %zd to %d", - tmp, conn->conn_first_burst_length); - tmp = conn->conn_first_burst_length; + tmp, conn->conn_first_burst_limit); + tmp = conn->conn_first_burst_limit; } conn->conn_first_burst_length = tmp; keys_add_int(response_keys, name, tmp); @@ -694,25 +696,42 @@ login_negotiate(struct connection *conn, struct pdu *request) * offload, it depends on hardware capabilities. */ assert(conn->conn_target != NULL); + conn->conn_max_recv_data_segment_limit = (1 << 24) - 1; + conn->conn_max_send_data_segment_limit = (1 << 24) - 1; + conn->conn_max_burst_limit = (1 << 24) - 1; + conn->conn_first_burst_limit = (1 << 24) - 1; kernel_limits(conn->conn_portal->p_portal_group->pg_offload, - &conn->conn_max_recv_data_segment_length, - &conn->conn_max_send_data_segment_length, - &conn->conn_max_burst_length, - &conn->conn_first_burst_length); + &conn->conn_max_recv_data_segment_limit, + &conn->conn_max_send_data_segment_limit, + &conn->conn_max_burst_limit, + &conn->conn_first_burst_limit); /* We expect legal, usable values at this point. */ - assert(conn->conn_max_recv_data_segment_length >= 512); - assert(conn->conn_max_recv_data_segment_length < (1 << 24)); - assert(conn->conn_max_burst_length >= 512); - assert(conn->conn_max_burst_length < (1 << 24)); - assert(conn->conn_first_burst_length >= 512); - assert(conn->conn_first_burst_length < (1 << 24)); - assert(conn->conn_first_burst_length <= - conn->conn_max_burst_length); + assert(conn->conn_max_recv_data_segment_limit >= 512); + assert(conn->conn_max_recv_data_segment_limit < (1 << 24)); + assert(conn->conn_max_send_data_segment_limit >= 512); + assert(conn->conn_max_send_data_segment_limit < (1 << 24)); + assert(conn->conn_max_burst_limit >= 512); + assert(conn->conn_max_burst_limit < (1 << 24)); + assert(conn->conn_first_burst_limit >= 512); + assert(conn->conn_first_burst_limit < (1 << 24)); + assert(conn->conn_first_burst_limit <= + conn->conn_max_burst_limit); + + /* + * Limit default send length in case it won't be negotiated. + * We can't do it for other limits, since they may affect both + * sender and receiver operation, and we must obey defaults. + */ + if (conn->conn_max_send_data_segment_limit < + conn->conn_max_send_data_segment_length) { + conn->conn_max_send_data_segment_length = + conn->conn_max_send_data_segment_limit; + } } else { - conn->conn_max_recv_data_segment_length = + conn->conn_max_recv_data_segment_limit = MAX_DATA_SEGMENT_LENGTH; - conn->conn_max_send_data_segment_length = + conn->conn_max_send_data_segment_limit = MAX_DATA_SEGMENT_LENGTH; } diff --git a/usr.sbin/fstyp/Makefile b/usr.sbin/fstyp/Makefile index 2397b806c8b9..8379c0206d10 100644 --- a/usr.sbin/fstyp/Makefile +++ b/usr.sbin/fstyp/Makefile @@ -3,7 +3,7 @@ .include PROG= fstyp -SRCS= cd9660.c ext2fs.c fstyp.c geli.c msdosfs.c ntfs.c ufs.c +SRCS= cd9660.c exfat.c ext2fs.c fstyp.c geli.c msdosfs.c ntfs.c ufs.c .if ${MK_ZFS} != "no" SRCS += zfs.c diff --git a/usr.sbin/fstyp/exfat.c b/usr.sbin/fstyp/exfat.c new file mode 100644 index 000000000000..9c379df0c3f6 --- /dev/null +++ b/usr.sbin/fstyp/exfat.c @@ -0,0 +1,77 @@ +/* + * Copyright (c) 2017 Conrad Meyer + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include + +#include "fstyp.h" + +struct exfat_vbr { + char ev_jmp[3]; + char ev_fsname[8]; + char ev_zeros[53]; + uint64_t ev_part_offset; + uint64_t ev_vol_length; + uint32_t ev_fat_offset; + uint32_t ev_fat_length; + uint32_t ev_cluster_offset; + uint32_t ev_cluster_count; + uint32_t ev_rootdir_cluster; + uint32_t ev_vol_serial; + uint16_t ev_fs_revision; + uint16_t ev_vol_flags; + uint8_t ev_log_bytes_per_sect; + uint8_t ev_log_sect_per_clust; + uint8_t ev_num_fats; + uint8_t ev_drive_sel; + uint8_t ev_percent_used; +} __packed; + +int +fstyp_exfat(FILE *fp, char *label, size_t size) +{ + struct exfat_vbr *ev; + + ev = (struct exfat_vbr *)read_buf(fp, 0, 512); + if (ev == NULL || strncmp(ev->ev_fsname, "EXFAT ", 8) != 0) + goto fail; + + /* + * Reading the volume label requires walking the root directory to look + * for a special label file. Left as an exercise for the reader. + */ + free(ev); + return (0); + +fail: + free(ev); + return (1); +} diff --git a/usr.sbin/fstyp/fstyp.8 b/usr.sbin/fstyp/fstyp.8 index 628fc998082b..03cf247a9dfa 100644 --- a/usr.sbin/fstyp/fstyp.8 +++ b/usr.sbin/fstyp/fstyp.8 @@ -27,7 +27,7 @@ .\" .\" $FreeBSD$ .\" -.Dd February 28, 2016 +.Dd January 13, 2017 .Dt FSTYP 8 .Os .Sh NAME @@ -51,9 +51,10 @@ flag is specified, also recognizes certain additional metadata formats that cannot be handled using .Xr mount 8 , -such as ZFS pools and +such as exFAT filesystems, .Xr geli 8 -providers. +providers, and +ZFS pools. .Pp The filesystem name is printed to the standard output as, respectively: @@ -61,6 +62,8 @@ as, respectively: .It cd9660 .It +exfat +.It ext2fs .It geli diff --git a/usr.sbin/fstyp/fstyp.c b/usr.sbin/fstyp/fstyp.c index 803a4c8a797a..76ec7948ca0d 100644 --- a/usr.sbin/fstyp/fstyp.c +++ b/usr.sbin/fstyp/fstyp.c @@ -57,6 +57,7 @@ static struct { bool unmountable; } fstypes[] = { { "cd9660", &fstyp_cd9660, false }, + { "exfat", &fstyp_exfat, true }, { "ext2fs", &fstyp_ext2fs, false }, { "geli", &fstyp_geli, true }, { "msdosfs", &fstyp_msdosfs, false }, diff --git a/usr.sbin/fstyp/fstyp.h b/usr.sbin/fstyp/fstyp.h index 8deba5ece1b5..f858b0c53827 100644 --- a/usr.sbin/fstyp/fstyp.h +++ b/usr.sbin/fstyp/fstyp.h @@ -39,6 +39,7 @@ char *checked_strdup(const char *s); void rtrim(char *label, size_t size); int fstyp_cd9660(FILE *fp, char *label, size_t size); +int fstyp_exfat(FILE *fp, char *label, size_t size); int fstyp_ext2fs(FILE *fp, char *label, size_t size); int fstyp_geli(FILE *fp, char *label, size_t size); int fstyp_msdosfs(FILE *fp, char *label, size_t size); diff --git a/usr.sbin/fstyp/tests/Makefile b/usr.sbin/fstyp/tests/Makefile index 71fc811a7eda..9c4624af3a4c 100644 --- a/usr.sbin/fstyp/tests/Makefile +++ b/usr.sbin/fstyp/tests/Makefile @@ -4,6 +4,7 @@ PACKAGE= tests ATF_TESTS_SH= fstyp_test +${PACKAGE}FILES+= dfr-01-xfat.img.bz2 ${PACKAGE}FILES+= ext2.img.bz2 ${PACKAGE}FILES+= ext3.img.bz2 ${PACKAGE}FILES+= ext4.img.bz2 diff --git a/usr.sbin/fstyp/tests/dfr-01-xfat.img.bz2 b/usr.sbin/fstyp/tests/dfr-01-xfat.img.bz2 new file mode 100644 index 000000000000..418d6379948e Binary files /dev/null and b/usr.sbin/fstyp/tests/dfr-01-xfat.img.bz2 differ diff --git a/usr.sbin/fstyp/tests/fstyp_test.sh b/usr.sbin/fstyp/tests/fstyp_test.sh index 8a1ea7209cc2..e7a4108b5fd4 100755 --- a/usr.sbin/fstyp/tests/fstyp_test.sh +++ b/usr.sbin/fstyp/tests/fstyp_test.sh @@ -1,3 +1,29 @@ +#!/bin/sh +# +# Copyright (c) 2015 Alan Somers +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. + # $FreeBSD$ atf_test_case cd9660 @@ -9,7 +35,7 @@ cd9660_body() { atf_check -s exit:0 -o ignore makefs -t cd9660 -Z -s 64m cd9660.img dir atf_check -s exit:0 -o inline:"cd9660\n" fstyp cd9660.img atf_check -s exit:0 -o inline:"cd9660\n" fstyp -l cd9660.img -} +} atf_test_case cd9660_label cd9660_label_head() { @@ -21,7 +47,7 @@ cd9660_label_body() { atf_check -s exit:0 -o inline:"cd9660\n" fstyp cd9660.img # Note: cd9660 labels are always upper case atf_check -s exit:0 -o inline:"cd9660 FOO\n" fstyp -l cd9660.img -} +} atf_test_case dir dir_head() { @@ -32,6 +58,15 @@ dir_body() { atf_check -s exit:1 -e match:"not a disk" fstyp dir } +atf_test_case exfat +exfat_head() { + atf_set "descr" "fstyp(8) can detect exFAT filesystems" +} +exfat_body() { + bzcat $(atf_get_srcdir)/dfr-01-xfat.img.bz2 > exfat.img + atf_check -s exit:0 -o inline:"exfat\n" fstyp -u exfat.img +} + atf_test_case empty empty_head() { atf_set "descr" "fstyp(8) should fail on an empty file" @@ -177,7 +212,7 @@ ufs2_label_body() { atf_check -s exit:0 mkdir dir atf_check -s exit:0 -o ignore makefs -o version=2,label="foo" -Z -s 64m ufs.img dir atf_check -s exit:0 -o inline:"ufs foo\n" fstyp -l ufs.img -} +} atf_test_case ufs_on_device cleanup ufs_on_device_head() { @@ -216,6 +251,7 @@ atf_init_test_cases() { atf_add_test_case cd9660_label atf_add_test_case dir atf_add_test_case empty + atf_add_test_case exfat atf_add_test_case ext2 atf_add_test_case ext3 atf_add_test_case ext4 diff --git a/usr.sbin/inetd/Makefile b/usr.sbin/inetd/Makefile index 6174592b34bb..da390081a873 100644 --- a/usr.sbin/inetd/Makefile +++ b/usr.sbin/inetd/Makefile @@ -16,7 +16,12 @@ CFLAGS+= -DLOGIN_CAP CFLAGS+= -DINET6 .endif -LIBADD= util wrap +LIBADD= util + +.if ${MK_TCP_WRAPPERS} != "no" +CFLAGS+= -DLIBWRAP +LIBADD+= wrap +.endif # XXX for src/release/picobsd .if !defined(RELEASE_CRUNCH) diff --git a/usr.sbin/inetd/inetd.c b/usr.sbin/inetd/inetd.c index 5788497c1e25..e073f8f9c0ac 100644 --- a/usr.sbin/inetd/inetd.c +++ b/usr.sbin/inetd/inetd.c @@ -138,7 +138,9 @@ __FBSDID("$FreeBSD$"); #include #include #include +#ifdef LIBWRAP #include +#endif #include #include "inetd.h" @@ -307,6 +309,7 @@ getvalue(const char *arg, int *value, const char *whine) return 0; /* success */ } +#ifdef LIBWRAP static sa_family_t whichaf(struct request_info *req) { @@ -322,6 +325,7 @@ whichaf(struct request_info *req) #endif return sa->sa_family; } +#endif int main(int argc, char **argv) @@ -336,9 +340,11 @@ main(int argc, char **argv) #ifdef LOGIN_CAP login_cap_t *lc = NULL; #endif +#ifdef LIBWRAP struct request_info req; int denied; char *service = NULL; +#endif struct sockaddr_storage peer; int i; struct addrinfo hints, *res; @@ -748,6 +754,7 @@ main(int argc, char **argv) _exit(0); } } +#ifdef LIBWRAP if (ISWRAP(sep)) { inetd_setproctitle("wrapping", ctrl); service = sep->se_server_name ? @@ -776,6 +783,7 @@ main(int argc, char **argv) (whichaf(&req) == AF_INET6) ? "6" : ""); } } +#endif if (sep->se_bi) { (*sep->se_bi->bi_fn)(ctrl, sep); } else { diff --git a/usr.sbin/iscsid/iscsid.c b/usr.sbin/iscsid/iscsid.c index 8e94c8a430c8..392c7a681f3d 100644 --- a/usr.sbin/iscsid/iscsid.c +++ b/usr.sbin/iscsid/iscsid.c @@ -172,8 +172,10 @@ connection_new(int iscsi_fd, const struct iscsi_daemon_request *request) conn->conn_data_digest = CONN_DIGEST_NONE; conn->conn_initial_r2t = true; conn->conn_immediate_data = true; - conn->conn_max_burst_length = MAX_BURST_LENGTH; - conn->conn_first_burst_length = FIRST_BURST_LENGTH; + conn->conn_max_recv_data_segment_length = 8192; + conn->conn_max_send_data_segment_length = 8192; + conn->conn_max_burst_length = 262144; + conn->conn_first_burst_length = 65536; conn->conn_iscsi_fd = iscsi_fd; conn->conn_session_id = request->idr_session_id; @@ -190,31 +192,28 @@ connection_new(int iscsi_fd, const struct iscsi_daemon_request *request) */ isl = &conn->conn_limits; memcpy(isl, &request->idr_limits, sizeof(*isl)); - if (isl->isl_max_recv_data_segment_length == 0) { - conn->conn_max_recv_data_segment_length = 8192; - conn->conn_max_send_data_segment_length = 8192; - isl->isl_max_recv_data_segment_length = 8192; - } else { - conn->conn_max_recv_data_segment_length = - isl->isl_max_recv_data_segment_length; - conn->conn_max_send_data_segment_length = - isl->isl_max_recv_data_segment_length; - } - if (isl->isl_max_send_data_segment_length == 0) { + if (isl->isl_max_recv_data_segment_length == 0) + isl->isl_max_recv_data_segment_length = (1 << 24) - 1; + if (isl->isl_max_send_data_segment_length == 0) isl->isl_max_send_data_segment_length = isl->isl_max_recv_data_segment_length; - } else { + if (isl->isl_max_burst_length == 0) + isl->isl_max_burst_length = (1 << 24) - 1; + if (isl->isl_first_burst_length == 0) + isl->isl_first_burst_length = (1 << 24) - 1; + if (isl->isl_first_burst_length > isl->isl_max_burst_length) + isl->isl_first_burst_length = isl->isl_max_burst_length; + + /* + * Limit default send length in case it won't be negotiated. + * We can't do it for other limits, since they may affect both + * sender and receiver operation, and we must obey defaults. + */ + if (conn->conn_max_send_data_segment_length > + isl->isl_max_send_data_segment_length) { conn->conn_max_send_data_segment_length = isl->isl_max_send_data_segment_length; } - if (isl->isl_max_burst_length == 0) - isl->isl_max_burst_length = conn->conn_max_burst_length; - if (isl->isl_first_burst_length == 0) { - if (isl->isl_max_burst_length < (int)conn->conn_first_burst_length) - isl->isl_first_burst_length = isl->isl_max_burst_length; - else - isl->isl_first_burst_length = conn->conn_first_burst_length; - } from_addr = conn->conn_conf.isc_initiator_addr; to_addr = conn->conn_conf.isc_target_addr; diff --git a/usr.sbin/iscsid/iscsid.h b/usr.sbin/iscsid/iscsid.h index 6a4e6cd2fbc9..52f773fdcf09 100644 --- a/usr.sbin/iscsid/iscsid.h +++ b/usr.sbin/iscsid/iscsid.h @@ -44,8 +44,6 @@ #define CONN_MUTUAL_CHALLENGE_LEN 1024 #define SOCKBUF_SIZE 1048576 -#define MAX_BURST_LENGTH (256 * 1024) -#define FIRST_BURST_LENGTH (128 * 1024) struct connection { int conn_iscsi_fd; diff --git a/usr.sbin/iscsid/login.c b/usr.sbin/iscsid/login.c index 0b2d994c1be8..60941f0f3a0b 100644 --- a/usr.sbin/iscsid/login.c +++ b/usr.sbin/iscsid/login.c @@ -397,6 +397,9 @@ login_negotiate_key(struct connection *conn, const char *name, tmp = isl->isl_max_send_data_segment_length; } conn->conn_max_send_data_segment_length = tmp; + /* We received target's limit, that means it accepted our's. */ + conn->conn_max_recv_data_segment_length = + isl->isl_max_recv_data_segment_length; } else if (strcmp(name, "MaxBurstLength") == 0) { tmp = strtoul(value, NULL, 10); if (tmp <= 0) diff --git a/usr.sbin/pciconf/pciconf.c b/usr.sbin/pciconf/pciconf.c index 1bc5526a61aa..bfbcf742e84d 100644 --- a/usr.sbin/pciconf/pciconf.c +++ b/usr.sbin/pciconf/pciconf.c @@ -917,11 +917,8 @@ parsesel(const char *str) while (isdigit(*ep) && i < 4) { selarr[i++] = strtoul(ep, &eppos, 10); ep = eppos; - if (*ep == ':') { + if (*ep == ':') ep++; - if (*ep == '\0') - i = 0; - } } if (i > 0 && *ep == '\0') { sel.pc_func = (i > 2) ? selarr[--i] : 0; diff --git a/usr.sbin/route6d/route6d.c b/usr.sbin/route6d/route6d.c index 90a492f7fe8a..e746acf5f575 100644 --- a/usr.sbin/route6d/route6d.c +++ b/usr.sbin/route6d/route6d.c @@ -57,11 +57,7 @@ static const char _rcsid[] = "$KAME: route6d.c,v 1.104 2003/10/31 00:30:20 itoju #endif #include #include -#ifdef __STDC__ #include -#else -#include -#endif #include #include #include @@ -100,7 +96,7 @@ struct ifc { /* Configuration of an interface */ TAILQ_HEAD(, iff) ifc_iff_head; /* list of filters */ int ifc_joined; /* joined to ff02::9 */ }; -TAILQ_HEAD(, ifc) ifc_head = TAILQ_HEAD_INITIALIZER(ifc_head); +static TAILQ_HEAD(, ifc) ifc_head = TAILQ_HEAD_INITIALIZER(ifc_head); struct ifac { /* Adddress associated to an interface */ TAILQ_ENTRY(ifac) ifac_next; @@ -120,21 +116,21 @@ struct iff { /* Filters for an interface */ int iff_plen; }; -struct ifc **index2ifc; -unsigned int nindex2ifc; -struct ifc *loopifcp = NULL; /* pointing to loopback */ +static struct ifc **index2ifc; +static unsigned int nindex2ifc; +static struct ifc *loopifcp = NULL; /* pointing to loopback */ #ifdef HAVE_POLL_H -struct pollfd set[2]; +static struct pollfd set[2]; #else -fd_set *sockvecp; /* vector to select() for receiving */ -fd_set *recvecp; -int fdmasks; -int maxfd; /* maximum fd for select() */ +static fd_set *sockvecp; /* vector to select() for receiving */ +static fd_set *recvecp; +static int fdmasks; +static int maxfd; /* maximum fd for select() */ #endif -int rtsock; /* the routing socket */ -int ripsock; /* socket to send/receive RIP datagram */ +static int rtsock; /* the routing socket */ +static int ripsock; /* socket to send/receive RIP datagram */ -struct rip6 *ripbuf; /* packet buffer for sending */ +static struct rip6 *ripbuf; /* packet buffer for sending */ /* * Maintain the routes in a linked list. When the number of the routes @@ -159,41 +155,43 @@ struct riprt { time_t rrt_t; /* when the route validated */ int rrt_index; /* ifindex from which this route got */ }; -TAILQ_HEAD(, riprt) riprt_head = TAILQ_HEAD_INITIALIZER(riprt_head); +static TAILQ_HEAD(, riprt) riprt_head = TAILQ_HEAD_INITIALIZER(riprt_head); -int dflag = 0; /* debug flag */ -int qflag = 0; /* quiet flag */ -int nflag = 0; /* don't update kernel routing table */ -int aflag = 0; /* age out even the statically defined routes */ -int hflag = 0; /* don't split horizon */ -int lflag = 0; /* exchange site local routes */ -int Pflag = 0; /* don't age out routes with RTF_PROTO[123] */ -int Qflag = RTF_PROTO2; /* set RTF_PROTO[123] flag to routes by RIPng */ -int sflag = 0; /* announce static routes w/ split horizon */ -int Sflag = 0; /* announce static routes to every interface */ -unsigned long routetag = 0; /* route tag attached on originating case */ +static int dflag = 0; /* debug flag */ +static int qflag = 0; /* quiet flag */ +static int nflag = 0; /* don't update kernel routing table */ +static int aflag = 0; /* age out even the statically defined routes */ +static int hflag = 0; /* don't split horizon */ +static int lflag = 0; /* exchange site local routes */ +static int Pflag = 0; /* don't age out routes with RTF_PROTO[123] */ +static int Qflag = RTF_PROTO2; /* set RTF_PROTO[123] flag to routes by RIPng */ +static int sflag = 0; /* announce static routes w/ split horizon */ +static int Sflag = 0; /* announce static routes to every interface */ +static unsigned long routetag = 0; /* route tag attached on originating case */ -char *filter[MAXFILTER]; -int filtertype[MAXFILTER]; -int nfilter = 0; +static char *filter[MAXFILTER]; +static int filtertype[MAXFILTER]; +static int nfilter = 0; -pid_t pid; +static pid_t pid; -struct sockaddr_storage ripsin; +static struct sockaddr_storage ripsin; -int interval = 1; -time_t nextalarm = 0; -time_t sup_trig_update = 0; +static int interval = 1; +static time_t nextalarm = 0; +#if 0 +static time_t sup_trig_update = 0; +#endif -FILE *rtlog = NULL; +static FILE *rtlog = NULL; -int logopened = 0; +static int logopened = 0; static int seq = 0; -volatile sig_atomic_t seenalrm; -volatile sig_atomic_t seenquit; -volatile sig_atomic_t seenusr1; +static volatile sig_atomic_t seenalrm; +static volatile sig_atomic_t seenquit; +static volatile sig_atomic_t seenusr1; #define RRTF_AGGREGATE 0x08000000 #define RRTF_NOADVERTISE 0x10000000 @@ -201,67 +199,67 @@ volatile sig_atomic_t seenusr1; #define RRTF_SENDANYWAY 0x40000000 #define RRTF_CHANGED 0x80000000 -int main(int, char **); -void sighandler(int); -void ripalarm(void); -void riprecv(void); -void ripsend(struct ifc *, struct sockaddr_in6 *, int); -int out_filter(struct riprt *, struct ifc *); -void init(void); -void sockopt(struct ifc *); -void ifconfig(void); -int ifconfig1(const char *, const struct sockaddr *, struct ifc *, int); -void rtrecv(void); -int rt_del(const struct sockaddr_in6 *, const struct sockaddr_in6 *, +static void sighandler(int); +static void ripalarm(void); +static void riprecv(void); +static void ripsend(struct ifc *, struct sockaddr_in6 *, int); +static int out_filter(struct riprt *, struct ifc *); +static void init(void); +static void ifconfig(void); +static int ifconfig1(const char *, const struct sockaddr *, struct ifc *, int); +static void rtrecv(void); +static int rt_del(const struct sockaddr_in6 *, const struct sockaddr_in6 *, const struct sockaddr_in6 *); -int rt_deladdr(struct ifc *, const struct sockaddr_in6 *, +static int rt_deladdr(struct ifc *, const struct sockaddr_in6 *, const struct sockaddr_in6 *); -void filterconfig(void); -int getifmtu(int); -const char *rttypes(struct rt_msghdr *); -const char *rtflags(struct rt_msghdr *); -const char *ifflags(int); -int ifrt(struct ifc *, int); -void ifrt_p2p(struct ifc *, int); -void applymask(struct in6_addr *, struct in6_addr *); -void applyplen(struct in6_addr *, int); -void ifrtdump(int); -void ifdump(int); -void ifdump0(FILE *, const struct ifc *); -void ifremove(int); -void rtdump(int); -void rt_entry(struct rt_msghdr *, int); -void rtdexit(void); -void riprequest(struct ifc *, struct netinfo6 *, int, +static void filterconfig(void); +static int getifmtu(int); +static const char *rttypes(struct rt_msghdr *); +static const char *rtflags(struct rt_msghdr *); +static const char *ifflags(int); +static int ifrt(struct ifc *, int); +static void ifrt_p2p(struct ifc *, int); +static void applyplen(struct in6_addr *, int); +static void ifrtdump(int); +static void ifdump(int); +static void ifdump0(FILE *, const struct ifc *); +static void ifremove(int); +static void rtdump(int); +static void rt_entry(struct rt_msghdr *, int); +static void rtdexit(void); +static void riprequest(struct ifc *, struct netinfo6 *, int, struct sockaddr_in6 *); -void ripflush(struct ifc *, struct sockaddr_in6 *, int, struct netinfo6 *np); -void sendrequest(struct ifc *); -int sin6mask2len(const struct sockaddr_in6 *); -int mask2len(const struct in6_addr *, int); -int sendpacket(struct sockaddr_in6 *, int); -int addroute(struct riprt *, const struct in6_addr *, struct ifc *); -int delroute(struct netinfo6 *, struct in6_addr *); -struct in6_addr *getroute(struct netinfo6 *, struct in6_addr *); -void krtread(int); -int tobeadv(struct riprt *, struct ifc *); -char *allocopy(char *); -char *hms(void); -const char *inet6_n2p(const struct in6_addr *); -struct ifac *ifa_match(const struct ifc *, const struct in6_addr *, int); -struct in6_addr *plen2mask(int); -struct riprt *rtsearch(struct netinfo6 *); -int ripinterval(int); -time_t ripsuptrig(void); -void fatal(const char *, ...) +static void ripflush(struct ifc *, struct sockaddr_in6 *, int, struct netinfo6 *np); +static void sendrequest(struct ifc *); +static int sin6mask2len(const struct sockaddr_in6 *); +static int mask2len(const struct in6_addr *, int); +static int sendpacket(struct sockaddr_in6 *, int); +static int addroute(struct riprt *, const struct in6_addr *, struct ifc *); +static int delroute(struct netinfo6 *, struct in6_addr *); +#if 0 +static struct in6_addr *getroute(struct netinfo6 *, struct in6_addr *); +#endif +static void krtread(int); +static int tobeadv(struct riprt *, struct ifc *); +static char *allocopy(char *); +static char *hms(void); +static const char *inet6_n2p(const struct in6_addr *); +static struct ifac *ifa_match(const struct ifc *, const struct in6_addr *, int); +static struct in6_addr *plen2mask(int); +static struct riprt *rtsearch(struct netinfo6 *); +static int ripinterval(int); +#if 0 +static time_t ripsuptrig(void); +#endif +static void fatal(const char *, ...) __attribute__((__format__(__printf__, 1, 2))); -void trace(int, const char *, ...) +static void trace(int, const char *, ...) __attribute__((__format__(__printf__, 2, 3))); -void tracet(int, const char *, ...) +static void tracet(int, const char *, ...) __attribute__((__format__(__printf__, 2, 3))); -unsigned int if_maxindex(void); -struct ifc *ifc_find(char *); -struct iff *iff_find(struct ifc *, int); -void setindex2ifc(int, struct ifc *); +static struct ifc *ifc_find(char *); +static struct iff *iff_find(struct ifc *, int); +static void setindex2ifc(int, struct ifc *); #define MALLOC(type) ((type *)malloc(sizeof(type))) @@ -523,7 +521,7 @@ main(int argc, char *argv[]) } } -void +static void sighandler(int signo) { @@ -547,7 +545,7 @@ sighandler(int signo) * gracefully exits after resetting sockopts. */ /* ARGSUSED */ -void +static void rtdexit(void) { struct riprt *rrt; @@ -574,7 +572,7 @@ rtdexit(void) * routes more precisely. */ /* ARGSUSED */ -void +static void ripalarm(void) { struct ifc *ifcp; @@ -602,7 +600,7 @@ ripalarm(void) alarm(ripinterval(SUPPLY_INTERVAL6)); } -void +static void init(void) { int error; @@ -684,6 +682,7 @@ init(void) /*NOTREACHED*/ } #endif + freeaddrinfo(res); memset(&hints, 0, sizeof(hints)); hints.ai_family = PF_INET6; @@ -699,6 +698,7 @@ init(void) /*NOTREACHED*/ } memcpy(&ripsin, res->ai_addr, res->ai_addrlen); + freeaddrinfo(res); #ifdef HAVE_POLL_H set[0].fd = ripsock; @@ -750,7 +750,7 @@ init(void) /* * ripflush flushes the rip datagram stored in the rip buffer */ -void +static void ripflush(struct ifc *ifcp, struct sockaddr_in6 *sin6, int nrt, struct netinfo6 *np) { int i; @@ -788,17 +788,24 @@ ripflush(struct ifc *ifcp, struct sockaddr_in6 *sin6, int nrt, struct netinfo6 * error = sendpacket(sin6, RIPSIZE(nrt)); if (error == EAFNOSUPPORT) { /* Protocol not supported */ - tracet(1, "Could not send info to %s (%s): " - "set IFF_UP to 0\n", - ifcp->ifc_name, inet6_n2p(&ifcp->ifc_ripsin.sin6_addr)); - ifcp->ifc_flags &= ~IFF_UP; /* As if down for AF_INET6 */ + if (ifcp != NULL) { + tracet(1, "Could not send info to %s (%s): " + "set IFF_UP to 0\n", + ifcp->ifc_name, + inet6_n2p(&ifcp->ifc_ripsin.sin6_addr)); + /* As if down for AF_INET6 */ + ifcp->ifc_flags &= ~IFF_UP; + } else { + tracet(1, "Could not send info to %s\n", + inet6_n2p(&sin6->sin6_addr)); + } } } /* * Generate RIP6_RESPONSE packets and send them. */ -void +static void ripsend(struct ifc *ifcp, struct sockaddr_in6 *sin6, int flag) { struct riprt *rrt; @@ -939,7 +946,7 @@ ripsend(struct ifc *ifcp, struct sockaddr_in6 *sin6, int flag) /* * outbound filter logic, per-route/interface. */ -int +static int out_filter(struct riprt *rrt, struct ifc *ifcp) { struct iff *iffp; @@ -1010,7 +1017,7 @@ out_filter(struct riprt *rrt, struct ifc *ifcp) * Determine if the route is to be advertised on the specified interface. * It checks options specified in the arguments and the split horizon rule. */ -int +static int tobeadv(struct riprt *rrt, struct ifc *ifcp) { @@ -1035,14 +1042,14 @@ tobeadv(struct riprt *rrt, struct ifc *ifcp) /* * Send a rip packet actually. */ -int +static int sendpacket(struct sockaddr_in6 *sin6, int len) { struct msghdr m; struct cmsghdr *cm; struct iovec iov[2]; - u_char cmsgbuf[256]; struct in6_pktinfo *pi; + u_char cmsgbuf[256]; int idx; struct sockaddr_in6 sincopy; @@ -1062,19 +1069,20 @@ sendpacket(struct sockaddr_in6 *sin6, int len) iov[0].iov_len = len; m.msg_iov = iov; m.msg_iovlen = 1; + m.msg_flags = 0; if (!idx) { m.msg_control = NULL; m.msg_controllen = 0; } else { memset(cmsgbuf, 0, sizeof(cmsgbuf)); - cm = (struct cmsghdr *)cmsgbuf; + cm = (struct cmsghdr *)(void *)cmsgbuf; m.msg_control = (caddr_t)cm; m.msg_controllen = CMSG_SPACE(sizeof(struct in6_pktinfo)); cm->cmsg_len = CMSG_LEN(sizeof(struct in6_pktinfo)); cm->cmsg_level = IPPROTO_IPV6; cm->cmsg_type = IPV6_PKTINFO; - pi = (struct in6_pktinfo *)CMSG_DATA(cm); + pi = (struct in6_pktinfo *)(void *)CMSG_DATA(cm); memset(&pi->ipi6_addr, 0, sizeof(pi->ipi6_addr)); /*::*/ pi->ipi6_ifindex = idx; } @@ -1091,7 +1099,7 @@ sendpacket(struct sockaddr_in6 *sin6, int len) * Receive and process RIP packets. Update the routes/kernel forwarding * table if necessary. */ -void +static void riprecv(void) { struct ifc *ifcp, *ic; @@ -1123,9 +1131,10 @@ riprecv(void) iov[0].iov_len = sizeof(buf); m.msg_iov = iov; m.msg_iovlen = 1; - cm = (struct cmsghdr *)cmsgbuf; + cm = (struct cmsghdr *)(void *)cmsgbuf; m.msg_control = (caddr_t)cm; m.msg_controllen = sizeof(cmsgbuf); + m.msg_flags = 0; if ((len = recvmsg(ripsock, &m, 0)) < 0) { fatal("recvmsg"); /*NOTREACHED*/ @@ -1143,7 +1152,7 @@ riprecv(void) "invalid cmsg length for IPV6_PKTINFO\n"); return; } - pi = (struct in6_pktinfo *)(CMSG_DATA(cm)); + pi = (struct in6_pktinfo *)(void *)CMSG_DATA(cm); idx = pi->ipi6_ifindex; break; case IPV6_HOPLIMIT: @@ -1152,7 +1161,7 @@ riprecv(void) "invalid cmsg length for IPV6_HOPLIMIT\n"); return; } - hlimp = (int *)CMSG_DATA(cm); + hlimp = (int *)(void *)CMSG_DATA(cm); break; } } @@ -1177,7 +1186,7 @@ riprecv(void) nh = fsock.sin6_addr; nn = (len - sizeof(struct rip6) + sizeof(struct netinfo6)) / sizeof(struct netinfo6); - rp = (struct rip6 *)buf; + rp = (struct rip6 *)(void *)buf; np = rp->rip6_nets; if (rp->rip6_vers != RIP6_VERSION) { @@ -1438,7 +1447,7 @@ riprecv(void) /* * Send all routes request packet to the specified interface. */ -void +static void sendrequest(struct ifc *ifcp) { struct netinfo6 *np; @@ -1466,7 +1475,7 @@ sendrequest(struct ifc *ifcp) /* * Process a RIP6_REQUEST packet. */ -void +static void riprequest(struct ifc *ifcp, struct netinfo6 *np, int nn, @@ -1497,7 +1506,7 @@ riprequest(struct ifc *ifcp, /* * Get information of each interface. */ -void +static void ifconfig(void) { struct ifaddrs *ifap, *ifa; @@ -1572,7 +1581,7 @@ ifconfig(void) freeifaddrs(ifap); } -int +static int ifconfig1(const char *name, const struct sockaddr *sa, struct ifc *ifcp, @@ -1584,7 +1593,7 @@ ifconfig1(const char *name, int plen; char buf[BUFSIZ]; - sin6 = (const struct sockaddr_in6 *)sa; + sin6 = (const struct sockaddr_in6 *)(const void *)sa; if (IN6_IS_ADDR_SITELOCAL(&sin6->sin6_addr) && !lflag) return (-1); ifr.ifr_addr = *sin6; @@ -1652,7 +1661,7 @@ ifconfig1(const char *name, return 0; } -void +static void ifremove(int ifindex) { struct ifc *ifcp; @@ -1680,7 +1689,7 @@ ifremove(int ifindex) * Receive and process routing messages. * Update interface information as necesssary. */ -void +static void rtrecv(void) { char buf[BUFSIZ]; @@ -1719,33 +1728,34 @@ rtrecv(void) fprintf(stderr, "\n"); } - for (p = buf; p - buf < len; p += ((struct rt_msghdr *)p)->rtm_msglen) { - if (((struct rt_msghdr *)p)->rtm_version != RTM_VERSION) + for (p = buf; p - buf < len; p += + ((struct rt_msghdr *)(void *)p)->rtm_msglen) { + if (((struct rt_msghdr *)(void *)p)->rtm_version != RTM_VERSION) continue; /* safety against bogus message */ - if (((struct rt_msghdr *)p)->rtm_msglen <= 0) { + if (((struct rt_msghdr *)(void *)p)->rtm_msglen <= 0) { trace(1, "bogus rtmsg: length=%d\n", - ((struct rt_msghdr *)p)->rtm_msglen); + ((struct rt_msghdr *)(void *)p)->rtm_msglen); break; } rtm = NULL; ifam = NULL; ifm = NULL; - switch (((struct rt_msghdr *)p)->rtm_type) { + switch (((struct rt_msghdr *)(void *)p)->rtm_type) { case RTM_NEWADDR: case RTM_DELADDR: - ifam = (struct ifa_msghdr *)p; + ifam = (struct ifa_msghdr *)(void *)p; addrs = ifam->ifam_addrs; q = (char *)(ifam + 1); break; case RTM_IFINFO: - ifm = (struct if_msghdr *)p; + ifm = (struct if_msghdr *)(void *)p; addrs = ifm->ifm_addrs; q = (char *)(ifm + 1); break; case RTM_IFANNOUNCE: - ifan = (struct if_announcemsghdr *)p; + ifan = (struct if_announcemsghdr *)(void *)p; switch (ifan->ifan_what) { case IFAN_ARRIVAL: iface++; @@ -1757,7 +1767,7 @@ rtrecv(void) } break; default: - rtm = (struct rt_msghdr *)p; + rtm = (struct rt_msghdr *)(void *)p; addrs = rtm->rtm_addrs; q = (char *)(rtm + 1); if (rtm->rtm_version != RTM_VERSION) { @@ -1777,16 +1787,16 @@ rtrecv(void) memset(&rta, 0, sizeof(rta)); for (i = 0; i < RTAX_MAX; i++) { if (addrs & (1 << i)) { - rta[i] = (struct sockaddr_in6 *)q; + rta[i] = (struct sockaddr_in6 *)(void *)q; q += ROUNDUP(rta[i]->sin6_len); } } trace(1, "rtsock: %s (addrs=%x)\n", - rttypes((struct rt_msghdr *)p), addrs); + rttypes((struct rt_msghdr *)(void *)p), addrs); if (dflag >= 2) { for (i = 0; - i < ((struct rt_msghdr *)p)->rtm_msglen; + i < ((struct rt_msghdr *)(void *)p)->rtm_msglen; i++) { fprintf(stderr, "%02x ", p[i] & 0xff); if (i % 16 == 15) fprintf(stderr, "\n"); @@ -1800,7 +1810,7 @@ rtrecv(void) * We may be able to optimize by using ifm->ifm_index or * ifam->ifam_index. For simplicity we don't do that here. */ - switch (((struct rt_msghdr *)p)->rtm_type) { + switch (((struct rt_msghdr *)(void *)p)->rtm_type) { case RTM_NEWADDR: case RTM_IFINFO: iface++; @@ -1841,7 +1851,7 @@ rtrecv(void) #endif /* hard ones */ - switch (((struct rt_msghdr *)p)->rtm_type) { + switch (((struct rt_msghdr *)(void *)p)->rtm_type) { case RTM_NEWADDR: case RTM_IFINFO: case RTM_ADD: @@ -1929,7 +1939,7 @@ rtrecv(void) /* * remove specified route from the internal routing table. */ -int +static int rt_del(const struct sockaddr_in6 *sdst, const struct sockaddr_in6 *sgw, const struct sockaddr_in6 *smask) @@ -2027,7 +2037,7 @@ rt_del(const struct sockaddr_in6 *sdst, /* * remove specified address from internal interface/routing table. */ -int +static int rt_deladdr(struct ifc *ifcp, const struct sockaddr_in6 *sifa, const struct sockaddr_in6 *smask) @@ -2128,7 +2138,7 @@ rt_deladdr(struct ifc *ifcp, * Get each interface address and put those interface routes to the route * list. */ -int +static int ifrt(struct ifc *ifcp, int again) { struct ifac *ifac; @@ -2239,7 +2249,7 @@ ifrt(struct ifc *ifcp, int again) * you pick one. it looks that gated behavior fits best with BSDs, * since BSD kernels do not look at prefix length on p2p interfaces. */ -void +static void ifrt_p2p(struct ifc *ifcp, int again) { struct ifac *ifac; @@ -2403,7 +2413,7 @@ ifrt_p2p(struct ifc *ifcp, int again) #undef P2PADVERT_MAX } -int +static int getifmtu(int ifindex) { int mib[6]; @@ -2430,7 +2440,7 @@ getifmtu(int ifindex) fatal("sysctl NET_RT_IFLIST"); /*NOTREACHED*/ } - ifm = (struct if_msghdr *)buf; + ifm = (struct if_msghdr *)(void *)buf; mtu = ifm->ifm_data.ifi_mtu; if (ifindex != ifm->ifm_index) { fatal("ifindex does not match with ifm_index"); @@ -2440,7 +2450,7 @@ getifmtu(int ifindex) return mtu; } -const char * +static const char * rttypes(struct rt_msghdr *rtm) { #define RTTYPE(s, f) \ @@ -2475,7 +2485,7 @@ do { \ return NULL; } -const char * +static const char * rtflags(struct rt_msghdr *rtm) { static char buf[BUFSIZ]; @@ -2535,7 +2545,7 @@ do { \ return buf; } -const char * +static const char * ifflags(int flags) { static char buf[BUFSIZ]; @@ -2571,7 +2581,7 @@ do { \ return buf; } -void +static void krtread(int again) { int mib[6]; @@ -2620,13 +2630,13 @@ krtread(int again) lim = buf + msize; for (p = buf; p < lim; p += rtm->rtm_msglen) { - rtm = (struct rt_msghdr *)p; + rtm = (struct rt_msghdr *)(void *)p; rt_entry(rtm, again); } free(buf); } -void +static void rt_entry(struct rt_msghdr *rtm, int again) { struct sockaddr_in6 *sin6_dst, *sin6_gw, *sin6_mask; @@ -2663,22 +2673,22 @@ rt_entry(struct rt_msghdr *rtm, int again) /* Destination */ if ((rtm->rtm_addrs & RTA_DST) == 0) return; /* ignore routes without destination address */ - sin6_dst = (struct sockaddr_in6 *)rtmp; + sin6_dst = (struct sockaddr_in6 *)(void *)rtmp; rtmp += ROUNDUP(sin6_dst->sin6_len); if (rtm->rtm_addrs & RTA_GATEWAY) { - sin6_gw = (struct sockaddr_in6 *)rtmp; + sin6_gw = (struct sockaddr_in6 *)(void *)rtmp; rtmp += ROUNDUP(sin6_gw->sin6_len); } if (rtm->rtm_addrs & RTA_NETMASK) { - sin6_mask = (struct sockaddr_in6 *)rtmp; + sin6_mask = (struct sockaddr_in6 *)(void *)rtmp; rtmp += ROUNDUP(sin6_mask->sin6_len); } if (rtm->rtm_addrs & RTA_GENMASK) { - sin6_genmask = (struct sockaddr_in6 *)rtmp; + sin6_genmask = (struct sockaddr_in6 *)(void *)rtmp; rtmp += ROUNDUP(sin6_genmask->sin6_len); } if (rtm->rtm_addrs & RTA_IFP) { - sin6_ifp = (struct sockaddr_in6 *)rtmp; + sin6_ifp = (struct sockaddr_in6 *)(void *)rtmp; rtmp += ROUNDUP(sin6_ifp->sin6_len); } @@ -2787,7 +2797,7 @@ rt_entry(struct rt_msghdr *rtm, int again) TAILQ_INSERT_HEAD(&riprt_head, rrt, rrt_next); } -int +static int addroute(struct riprt *rrt, const struct in6_addr *gw, struct ifc *ifcp) @@ -2812,7 +2822,7 @@ addroute(struct riprt *rrt, return 0; memset(buf, 0, sizeof(buf)); - rtm = (struct rt_msghdr *)buf; + rtm = (struct rt_msghdr *)(void *)buf; rtm->rtm_type = RTM_ADD; rtm->rtm_version = RTM_VERSION; rtm->rtm_seq = ++seq; @@ -2822,24 +2832,24 @@ addroute(struct riprt *rrt, rtm->rtm_addrs = RTA_DST | RTA_GATEWAY | RTA_NETMASK; rtm->rtm_rmx.rmx_hopcount = np->rip6_metric - 1; rtm->rtm_inits = RTV_HOPCOUNT; - sin6 = (struct sockaddr_in6 *)&buf[sizeof(struct rt_msghdr)]; + sin6 = (struct sockaddr_in6 *)(void *)&buf[sizeof(struct rt_msghdr)]; /* Destination */ sin6->sin6_len = sizeof(struct sockaddr_in6); sin6->sin6_family = AF_INET6; sin6->sin6_addr = np->rip6_dest; - sin6 = (struct sockaddr_in6 *)((char *)sin6 + ROUNDUP(sin6->sin6_len)); + sin6 = (struct sockaddr_in6 *)(void *)((char *)sin6 + ROUNDUP(sin6->sin6_len)); /* Gateway */ sin6->sin6_len = sizeof(struct sockaddr_in6); sin6->sin6_family = AF_INET6; sin6->sin6_addr = *gw; if (IN6_IS_ADDR_LINKLOCAL(&sin6->sin6_addr)) sin6->sin6_scope_id = ifcp->ifc_index; - sin6 = (struct sockaddr_in6 *)((char *)sin6 + ROUNDUP(sin6->sin6_len)); + sin6 = (struct sockaddr_in6 *)(void *)((char *)sin6 + ROUNDUP(sin6->sin6_len)); /* Netmask */ sin6->sin6_len = sizeof(struct sockaddr_in6); sin6->sin6_family = AF_INET6; sin6->sin6_addr = *(plen2mask(np->rip6_plen)); - sin6 = (struct sockaddr_in6 *)((char *)sin6 + ROUNDUP(sin6->sin6_len)); + sin6 = (struct sockaddr_in6 *)(void *)((char *)sin6 + ROUNDUP(sin6->sin6_len)); len = (char *)sin6 - (char *)buf; rtm->rtm_msglen = len; @@ -2862,7 +2872,7 @@ addroute(struct riprt *rrt, return -1; } -int +static int delroute(struct netinfo6 *np, struct in6_addr *gw) { u_char buf[BUFSIZ], buf2[BUFSIZ]; @@ -2880,7 +2890,7 @@ delroute(struct netinfo6 *np, struct in6_addr *gw) return 0; memset(buf, 0, sizeof(buf)); - rtm = (struct rt_msghdr *)buf; + rtm = (struct rt_msghdr *)(void *)buf; rtm->rtm_type = RTM_DELETE; rtm->rtm_version = RTM_VERSION; rtm->rtm_seq = ++seq; @@ -2890,22 +2900,22 @@ delroute(struct netinfo6 *np, struct in6_addr *gw) if (np->rip6_plen == sizeof(struct in6_addr) * 8) rtm->rtm_flags |= RTF_HOST; rtm->rtm_addrs = RTA_DST | RTA_GATEWAY | RTA_NETMASK; - sin6 = (struct sockaddr_in6 *)&buf[sizeof(struct rt_msghdr)]; + sin6 = (struct sockaddr_in6 *)(void *)&buf[sizeof(struct rt_msghdr)]; /* Destination */ sin6->sin6_len = sizeof(struct sockaddr_in6); sin6->sin6_family = AF_INET6; sin6->sin6_addr = np->rip6_dest; - sin6 = (struct sockaddr_in6 *)((char *)sin6 + ROUNDUP(sin6->sin6_len)); + sin6 = (struct sockaddr_in6 *)(void *)((char *)sin6 + ROUNDUP(sin6->sin6_len)); /* Gateway */ sin6->sin6_len = sizeof(struct sockaddr_in6); sin6->sin6_family = AF_INET6; sin6->sin6_addr = *gw; - sin6 = (struct sockaddr_in6 *)((char *)sin6 + ROUNDUP(sin6->sin6_len)); + sin6 = (struct sockaddr_in6 *)(void *)((char *)sin6 + ROUNDUP(sin6->sin6_len)); /* Netmask */ sin6->sin6_len = sizeof(struct sockaddr_in6); sin6->sin6_family = AF_INET6; sin6->sin6_addr = *(plen2mask(np->rip6_plen)); - sin6 = (struct sockaddr_in6 *)((char *)sin6 + ROUNDUP(sin6->sin6_len)); + sin6 = (struct sockaddr_in6 *)(void *)((char *)sin6 + ROUNDUP(sin6->sin6_len)); len = (char *)sin6 - (char *)buf; rtm->rtm_msglen = len; @@ -2928,7 +2938,8 @@ delroute(struct netinfo6 *np, struct in6_addr *gw) return -1; } -struct in6_addr * +#if 0 +static struct in6_addr * getroute(struct netinfo6 *np, struct in6_addr *gw) { u_char buf[BUFSIZ]; @@ -2937,7 +2948,7 @@ getroute(struct netinfo6 *np, struct in6_addr *gw) struct rt_msghdr *rtm; struct sockaddr_in6 *sin6; - rtm = (struct rt_msghdr *)buf; + rtm = (struct rt_msghdr *)(void *)buf; len = sizeof(struct rt_msghdr) + sizeof(struct sockaddr_in6); memset(rtm, 0, len); rtm->rtm_type = RTM_GET; @@ -2946,7 +2957,7 @@ getroute(struct netinfo6 *np, struct in6_addr *gw) rtm->rtm_seq = myseq; rtm->rtm_addrs = RTA_DST; rtm->rtm_msglen = len; - sin6 = (struct sockaddr_in6 *)&buf[sizeof(struct rt_msghdr)]; + sin6 = (struct sockaddr_in6 *)(void *)&buf[sizeof(struct rt_msghdr)]; sin6->sin6_len = sizeof(struct sockaddr_in6); sin6->sin6_family = AF_INET6; sin6->sin6_addr = np->rip6_dest; @@ -2961,11 +2972,11 @@ getroute(struct netinfo6 *np, struct in6_addr *gw) perror("read from rtsock"); exit(1); } - rtm = (struct rt_msghdr *)buf; + rtm = (struct rt_msghdr *)(void *)buf; } while (rtm->rtm_seq != myseq || rtm->rtm_pid != pid); - sin6 = (struct sockaddr_in6 *)&buf[sizeof(struct rt_msghdr)]; + sin6 = (struct sockaddr_in6 *)(void *)&buf[sizeof(struct rt_msghdr)]; if (rtm->rtm_addrs & RTA_DST) { - sin6 = (struct sockaddr_in6 *) + sin6 = (struct sockaddr_in6 *)(void *) ((char *)sin6 + ROUNDUP(sin6->sin6_len)); } if (rtm->rtm_addrs & RTA_GATEWAY) { @@ -2974,8 +2985,9 @@ getroute(struct netinfo6 *np, struct in6_addr *gw) } return NULL; } +#endif -const char * +static const char * inet6_n2p(const struct in6_addr *p) { static char buf[BUFSIZ]; @@ -2983,7 +2995,7 @@ inet6_n2p(const struct in6_addr *p) return inet_ntop(AF_INET6, (const void *)p, buf, sizeof(buf)); } -void +static void ifrtdump(int sig) { @@ -2991,7 +3003,7 @@ ifrtdump(int sig) rtdump(sig); } -void +static void ifdump(int sig) { struct ifc *ifcp; @@ -3030,7 +3042,7 @@ ifdump(int sig) fclose(dump); } -void +static void ifdump0(FILE *dump, const struct ifc *ifcp) { struct ifac *ifac; @@ -3086,7 +3098,7 @@ ifdump0(FILE *dump, const struct ifc *ifcp) fprintf(dump, "\n"); } -void +static void rtdump(int sig) { struct riprt *rrt; @@ -3135,7 +3147,7 @@ rtdump(int sig) * syntax: -A 5f09:c400::/32,ef0,ef1 (aggregate) * -O 5f09:c400::/32,ef0,ef1 (only when match) */ -void +static void filterconfig(void) { int i; @@ -3266,7 +3278,7 @@ filterconfig(void) * Returns a pointer to ifac whose address and prefix length matches * with the address and prefix length specified in the arguments. */ -struct ifac * +static struct ifac * ifa_match(const struct ifc *ifcp, const struct in6_addr *ia, int plen) @@ -3287,7 +3299,7 @@ ifa_match(const struct ifc *ifcp, * matches with the address and prefix length found in the argument. * Note: This is not a rtalloc(). Therefore exact match is necessary. */ -struct riprt * +static struct riprt * rtsearch(struct netinfo6 *np) { struct riprt *rrt; @@ -3302,7 +3314,7 @@ rtsearch(struct netinfo6 *np) return (rrt); } -int +static int sin6mask2len(const struct sockaddr_in6 *sin6) { @@ -3310,7 +3322,7 @@ sin6mask2len(const struct sockaddr_in6 *sin6) sin6->sin6_len - offsetof(struct sockaddr_in6, sin6_addr)); } -int +static int mask2len(const struct in6_addr *addr, int lenlim) { int i = 0, j; @@ -3337,22 +3349,11 @@ mask2len(const struct in6_addr *addr, int lenlim) return i; } -void -applymask(struct in6_addr *addr, struct in6_addr *mask) -{ - int i; - u_long *p, *q; - - p = (u_long *)addr; q = (u_long *)mask; - for (i = 0; i < 4; i++) - *p++ &= *q++; -} - static const u_char plent[8] = { 0x00, 0x80, 0xc0, 0xe0, 0xf0, 0xf8, 0xfc, 0xfe }; -void +static void applyplen(struct in6_addr *ia, int plen) { u_char *p; @@ -3372,7 +3373,7 @@ static const int pl2m[9] = { 0x00, 0x80, 0xc0, 0xe0, 0xf0, 0xf8, 0xfc, 0xfe, 0xff }; -struct in6_addr * +static struct in6_addr * plen2mask(int n) { static struct in6_addr ia; @@ -3392,7 +3393,7 @@ plen2mask(int n) return &ia; } -char * +static char * allocopy(char *p) { int len = strlen(p) + 1; @@ -3407,7 +3408,7 @@ allocopy(char *p) return q; } -char * +static char * hms(void) { static char buf[BUFSIZ]; @@ -3426,7 +3427,7 @@ hms(void) #define RIPRANDDEV 1.0 /* 30 +- 15, max - min = 30 */ -int +static int ripinterval(int timer) { double r = rand(); @@ -3436,7 +3437,8 @@ ripinterval(int timer) return interval; } -time_t +#if 0 +static time_t ripsuptrig(void) { time_t t; @@ -3447,24 +3449,15 @@ ripsuptrig(void) sup_trig_update = time(NULL) + t; return t; } - -void -#ifdef __STDC__ -fatal(const char *fmt, ...) -#else -fatal(fmt, va_alist) - char *fmt; - va_dcl #endif + +static void +fatal(const char *fmt, ...) { va_list ap; char buf[1024]; -#ifdef __STDC__ va_start(ap, fmt); -#else - va_start(ap); -#endif vsnprintf(buf, sizeof(buf), fmt, ap); va_end(ap); perror(buf); @@ -3475,34 +3468,19 @@ fatal(fmt, va_alist) rtdexit(); } -void -#ifdef __STDC__ +static void tracet(int level, const char *fmt, ...) -#else -tracet(level, fmt, va_alist) - int level; - char *fmt; - va_dcl -#endif { va_list ap; if (level <= dflag) { -#ifdef __STDC__ va_start(ap, fmt); -#else - va_start(ap); -#endif fprintf(stderr, "%s: ", hms()); vfprintf(stderr, fmt, ap); va_end(ap); } if (dflag) { -#ifdef __STDC__ va_start(ap, fmt); -#else - va_start(ap); -#endif if (level > 0) vsyslog(LOG_DEBUG, fmt, ap); else @@ -3511,33 +3489,18 @@ tracet(level, fmt, va_alist) } } -void -#ifdef __STDC__ +static void trace(int level, const char *fmt, ...) -#else -trace(level, fmt, va_alist) - int level; - char *fmt; - va_dcl -#endif { va_list ap; if (level <= dflag) { -#ifdef __STDC__ va_start(ap, fmt); -#else - va_start(ap); -#endif vfprintf(stderr, fmt, ap); va_end(ap); } if (dflag) { -#ifdef __STDC__ va_start(ap, fmt); -#else - va_start(ap); -#endif if (level > 0) vsyslog(LOG_DEBUG, fmt, ap); else @@ -3546,22 +3509,7 @@ trace(level, fmt, va_alist) } } -unsigned int -if_maxindex(void) -{ - struct if_nameindex *p, *p0; - unsigned int max = 0; - - p0 = if_nameindex(); - for (p = p0; p && p->if_index && p->if_name; p++) { - if (max < p->if_index) - max = p->if_index; - } - if_freenameindex(p0); - return max; -} - -struct ifc * +static struct ifc * ifc_find(char *name) { struct ifc *ifcp; @@ -3573,7 +3521,7 @@ ifc_find(char *name) return (ifcp); } -struct iff * +static struct iff * iff_find(struct ifc *ifcp, int type) { struct iff *iffp; @@ -3587,7 +3535,7 @@ iff_find(struct ifc *ifcp, int type) return (iffp); } -void +static void setindex2ifc(int idx, struct ifc *ifcp) { int n, nsize;