Merge ^/head r311940 through r312200.
This commit is contained in:
commit
d370fd1cd8
4
UPDATING
4
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)
|
||||
|
@ -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) {
|
||||
|
@ -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()
|
||||
{
|
||||
|
@ -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()
|
||||
{
|
||||
|
@ -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");
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
913
contrib/netbsd-tests/dev/cgd/t_cgd_3des.c
Normal file
913
contrib/netbsd-tests/dev/cgd/t_cgd_3des.c
Normal file
@ -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 <sys/types.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/sysctl.h>
|
||||
|
||||
#include <atf-c.h>
|
||||
#include <fcntl.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <util.h>
|
||||
|
||||
#include <dev/cgdvar.h>
|
||||
|
||||
#include <rump/rump.h>
|
||||
#include <rump/rump_syscalls.h>
|
||||
|
||||
#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,
|
||||
0x82, 0xa7, 0x80, 0x16, 0x34, 0xde, 0xb9, 0x82,
|
||||
0x4c, 0x42, 0x8e, 0x0d, 0x48, 0x7e, 0x38, 0xbd,
|
||||
0x1d, 0x7d, 0x98, 0xbb, 0x11, 0x8a, 0x72, 0x14,
|
||||
0x4e, 0xaa, 0xd0, 0xef, 0x4d, 0x7f, 0xa3, 0xa6,
|
||||
0xfc, 0x85, 0x9d, 0x74, 0x63, 0x9d, 0xe4, 0x5c,
|
||||
0xf7, 0xa8, 0xd0, 0xd7, 0x95, 0xb4, 0x28, 0x64,
|
||||
0x41, 0x2d, 0x5d, 0xd9, 0xba, 0x79, 0xa7, 0xb3,
|
||||
0x9c, 0x16, 0xfa, 0xb8, 0x10, 0x5d, 0x1d, 0xd4,
|
||||
0xce, 0xad, 0x67, 0x27, 0x91, 0x8a, 0xb3, 0xbc,
|
||||
0x37, 0x20, 0x95, 0xac, 0xf7, 0x0d, 0xe0, 0x1e,
|
||||
0x59, 0xa7, 0xe5, 0x81, 0x82, 0x6a, 0x71, 0x07,
|
||||
0x85, 0x43, 0x43, 0xdb, 0xbf, 0x56, 0xb0, 0x0a,
|
||||
0x4c, 0xf1, 0xcd, 0xcd, 0xa3, 0x9a, 0x10, 0x8e,
|
||||
0x0c, 0xe2, 0x6d, 0xf2, 0x16, 0xd0, 0x4c, 0xac,
|
||||
0xf9, 0xfc, 0xc9, 0x56, 0x1f, 0x31, 0x89, 0x1c,
|
||||
0xfa, 0xb7, 0x49, 0xea, 0x69, 0x91, 0xfe, 0x45,
|
||||
0x96, 0x5e, 0x45, 0xc3, 0x2c, 0xb1, 0x40, 0xd9,
|
||||
0x1f, 0x82, 0x3f, 0xc1, 0x45, 0x7c, 0x39, 0x72,
|
||||
0x6f, 0x52, 0xe4, 0xaf, 0x15, 0xa4, 0xe2, 0xd4,
|
||||
0xa1, 0xa4, 0xb2, 0xb5, 0x4a, 0x0b, 0xad, 0xe4,
|
||||
0x1e, 0x5c, 0x26, 0x62, 0x81, 0x78, 0x3e, 0xd3,
|
||||
0x6a, 0x98, 0x94, 0x2a, 0x00, 0xa7, 0xe4, 0x04,
|
||||
0x9d, 0x9a, 0xfc, 0xcf, 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, 0xd0, 0xa0, 0x6b, 0xe4, 0x88,
|
||||
0x5c, 0xd7, 0xf1, 0xbf, 0x5f, 0xce, 0xda, 0x19,
|
||||
0x81, 0x32, 0xbb, 0x96, 0x7e, 0xb9, 0x6e, 0xa1,
|
||||
0x43, 0xde, 0x53, 0x66, 0x9c, 0x27, 0x94, 0x85,
|
||||
0xcb, 0x09, 0x4e, 0x16, 0xd8, 0x60, 0x7a, 0x38,
|
||||
0x27, 0x21, 0x4d, 0x08, 0xaa, 0xe2, 0x1e, 0x6e,
|
||||
0xa3, 0xcb, 0x9a, 0x7f, 0xd1, 0xbf, 0x18, 0x36,
|
||||
0x5a, 0x4d, 0x7a, 0x7f, 0xcf, 0x3f, 0xba, 0xa5,
|
||||
0x77, 0x5b, 0xb4, 0x79, 0xdc, 0xbf, 0x2a, 0x28,
|
||||
0x16, 0x27, 0x0f, 0x8b, 0xd7, 0x95, 0xc3, 0xcb,
|
||||
0xa1, 0x6a, 0x49, 0x53, 0xa8, 0x0c, 0x70, 0xde,
|
||||
0x90, 0x2e, 0x36, 0x74, 0x40, 0x5d, 0x81, 0x74,
|
||||
0x03, 0x11, 0xbd, 0xba, 0x40, 0x8d, 0x03, 0x86,
|
||||
0x2b, 0x17, 0x55, 0x20, 0xd8, 0x81, 0x30, 0xd2,
|
||||
0x2a, 0xbd, 0xea, 0xff, 0x5c, 0x69, 0x9b, 0xe6,
|
||||
0xe3, 0x21, 0x9a, 0x10, 0x3e, 0xb0, 0xf4, 0x7a,
|
||||
0xfc, 0x6e, 0x66, 0xec, 0x44, 0x0b, 0x95, 0x8d,
|
||||
0x13, 0xd4, 0xf6, 0x3e, 0xa1, 0xa1, 0xac, 0xb1,
|
||||
0xd8, 0x3d, 0x86, 0xaf, 0x5e, 0xef, 0x14, 0x6a,
|
||||
0x32, 0xf3, 0x13, 0x75, 0x3b, 0x64, 0x9a, 0xf4,
|
||||
0xd0, 0xf5, 0x00, 0x36, 0x9e, 0xdb, 0xfd, 0xcb,
|
||||
0xda, 0x1f, 0xed, 0x9d, 0x6d, 0x52, 0xd7, 0xb5,
|
||||
0x48, 0xce, 0x53, 0x5e, 0xdc, 0xc8, 0xe4, 0x96,
|
||||
0x04, 0x32, 0xa5, 0xcf, 0x0c, 0xba, 0xa0, 0xd0,
|
||||
0x44, 0xb3, 0xe8, 0x72, 0xc6, 0xff, 0x8f, 0xd4,
|
||||
0x4d, 0x0a, 0x22, 0x89, 0x74, 0x50, 0xaa, 0x65,
|
||||
0x15, 0xab, 0x99, 0xc8, 0xf9, 0xa4, 0x10, 0xe6,
|
||||
0xa6, 0x4b, 0x0c, 0xc8, 0xb9, 0xa7, 0x60, 0x41,
|
||||
0xe7, 0x57, 0x31, 0xfa, 0x86, 0x55, 0xdf, 0x29,
|
||||
0x49, 0xac, 0x55, 0x7b, 0x21, 0xf9, 0x3b, 0x1e,
|
||||
0x1f, 0xb4, 0x1c, 0x0b, 0x77, 0xcb, 0x88, 0xbf,
|
||||
0xa6, 0x79, 0xbf, 0x9a, 0x51, 0xc4, 0x8e, 0x59,
|
||||
0x9c, 0xb3, 0x9d, 0x9d, 0x6b, 0xb2, 0x15, 0x41,
|
||||
0x0d, 0x6c, 0xf7, 0x5e, 0xe2, 0xf9, 0xb3, 0x80,
|
||||
0x8f, 0x03, 0x67, 0x68, 0x6e, 0x4b, 0x4d, 0x52,
|
||||
0xbc, 0x9b, 0xa2, 0xd8, 0x29, 0x1e, 0x5c, 0xd7,
|
||||
0x59, 0x67, 0x94, 0x40, 0x9e, 0x08, 0x15, 0x0d,
|
||||
0x7e, 0xc9, 0x14, 0x53, 0xa8, 0x67, 0xb3, 0xb8,
|
||||
0xaa, 0x21, 0x0f, 0x79, 0x69, 0x48, 0x52, 0xea,
|
||||
0x56, 0x03, 0x7b, 0x55, 0xb7, 0xf3, 0xfe, 0xb1,
|
||||
0x8a, 0x22, 0x7d, 0x75, 0x55, 0x31, 0xad, 0x20,
|
||||
0x6a, 0xc2, 0xa4, 0xd1, 0x1e, 0xab, 0xdd, 0x29,
|
||||
0xb5, 0xf8, 0xdd, 0x9b, 0x1a, 0xb8, 0xe7, 0xde,
|
||||
0xae, 0xa1, 0xab, 0xbb, 0xf6, 0x00, 0x87, 0xc4,
|
||||
0x29, 0xee, 0x2b, 0xa1, 0xa9, 0x1a, 0x46, 0x05,
|
||||
0x5a, 0x12, 0x3f, 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, 0x1a, 0x30, 0x1b,
|
||||
0xbb, 0xd9, 0xe2, 0xb5, 0xe8, 0xd9, 0x9b, 0x68,
|
||||
0x60, 0x90, 0xd3, 0x4a, 0xe8, 0x65, 0x7b, 0xaa,
|
||||
0xb0, 0xda, 0x69, 0x1d, 0x45, 0x78, 0x2c, 0x3b,
|
||||
0x59, 0x29, 0x3c, 0x26, 0x9a, 0xd2, 0xa5, 0xfd,
|
||||
0xb7, 0x16, 0x59, 0x7c, 0x46, 0xea, 0x99, 0xd0,
|
||||
0x06, 0x01, 0x3f, 0xd2, 0x23, 0xcc, 0xde, 0xb8,
|
||||
0xaa, 0x88, 0x17, 0x03, 0xe1, 0x48, 0x2c, 0xdd,
|
||||
0xce, 0xd1, 0x2c, 0xce, 0x37, 0xee, 0xe6, 0xa6,
|
||||
0x47, 0x8c, 0x07, 0xe5, 0xfe, 0x01, 0xc6, 0x27,
|
||||
0xfe, 0x3f, 0x9d, 0x30, 0x18, 0x36, 0xe7, 0xa7,
|
||||
0x37, 0x1d, 0xcf, 0x6d, 0x4c, 0x82, 0xec, 0x58,
|
||||
0xa1, 0x6f, 0x56, 0xc6, 0x08, 0x25, 0x94, 0xda,
|
||||
0xae, 0x1a, 0x4f, 0xda, 0xb2, 0xf4, 0xbf, 0x94,
|
||||
0xff, 0x66, 0x6a, 0xb1, 0x1f, 0x42, 0xfe, 0x32,
|
||||
0xa4, 0x0e, 0x3d, 0x6a, 0x16, 0x44, 0xe0, 0xac,
|
||||
0xe8, 0xc1, 0xe2, 0xa8, 0x73, 0xab, 0xac, 0x58,
|
||||
0xb1, 0xbc, 0x94, 0xb2, 0x6a, 0xe4, 0x45, 0xf5,
|
||||
0x90, 0x6b, 0x82, 0xeb, 0x9e, 0x22, 0x9e, 0xb2,
|
||||
0x27, 0x3e, 0xc8, 0x55, 0xf4, 0x8f, 0xda, 0x04,
|
||||
0xa3, 0x9c, 0xa4, 0x79, 0xbd, 0x79, 0xd3, 0xbd,
|
||||
0xbe, 0x72, 0x7f, 0x90, 0xef, 0xc3, 0x34, 0x17,
|
||||
0x72, 0x6f, 0xb4, 0xfe, 0x62, 0x56, 0xc3, 0xd6,
|
||||
0x43, 0xc8, 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, 0x7c, 0x8c, 0x8e, 0x3e, 0x61, 0x34, 0x3d,
|
||||
0xe0, 0x7f, 0xd3, 0xe1, 0x3a, 0xb9, 0xc8, 0xf2,
|
||||
0x98, 0xdc, 0x59, 0x26, 0xd2, 0xd8, 0xa7, 0x7f,
|
||||
0x41, 0x98, 0x24, 0xa8, 0x28, 0x0c, 0x88, 0x55,
|
||||
0x91, 0xdb, 0x29, 0x17, 0x70, 0xd7, 0x03, 0xff,
|
||||
0xbd, 0x0e, 0xbf, 0xf8, 0x73, 0x92, 0x19, 0xe9,
|
||||
0x92, 0x67, 0xdb, 0x08, 0x94, 0x77, 0x71, 0x2d,
|
||||
0x00, 0xad, 0x26, 0x42, 0x2d, 0xac, 0x8c, 0x67,
|
||||
0x6f, 0xb3, 0x8e, 0x36, 0x22, 0xeb, 0x1f, 0x8c,
|
||||
0xd4, 0x9b, 0x9f, 0xa6, 0xa9, 0xb1, 0x52, 0x65,
|
||||
0x9a, 0xfe, 0xcc, 0x92, 0x48, 0x75, 0xf6, 0xb8,
|
||||
0x59, 0xfe, 0x0e, 0x67, 0x93, 0xce, 0x3b, 0x7e,
|
||||
0x51, 0x74, 0xe5, 0x24, 0x35, 0x08, 0x68, 0x21,
|
||||
0x6a, 0x7f, 0xdd, 0x8c, 0xfd, 0xcd, 0x6d, 0x90,
|
||||
0xc5, 0x3b, 0x26, 0x9e, 0x00, 0xf4, 0x1e, 0x70,
|
||||
0xd3, 0xe7, 0xe8, 0x2f, 0x52, 0x87, 0x76, 0x84,
|
||||
0xbb, 0x5c, 0x76, 0x5a, 0xc8, 0xea, 0x74, 0xe2,
|
||||
0x9e, 0x85, 0xf6, 0x53, 0x85, 0x1a, 0x6e, 0x02,
|
||||
0x0d, 0x32, 0x11, 0xc4, 0xec, 0xee, 0x79, 0x27,
|
||||
0xda, 0xca, 0xc0, 0x0b, 0x8e, 0x2d, 0xb7, 0x7d,
|
||||
0x8c, 0x6e, 0xfb, 0xa3, 0xa8, 0x24, 0x24, 0x62,
|
||||
0xc8, 0xdd, 0xc7, 0x16, 0x09, 0x33, 0x0f, 0xe5,
|
||||
0xc8, 0x60, 0x3d, 0xb6, 0xbf, 0x6c, 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, 0xd6, 0x9f, 0x04, 0x5f, 0x69,
|
||||
0x54, 0xa3, 0x7c, 0x46, 0x7b, 0x18, 0x93, 0xc0,
|
||||
0xbb, 0x0c, 0x96, 0x6f, 0xb0, 0xbf, 0xce, 0x67,
|
||||
0x33, 0x3e, 0x56, 0xe8, 0x6b, 0x4d, 0x3f, 0xc8,
|
||||
0x3c, 0xc6, 0x89, 0x2c, 0x0b, 0x95, 0x3a, 0xaf,
|
||||
0xc0, 0xf3, 0x1f, 0x0e, 0x07, 0x01, 0xa6, 0x35,
|
||||
0x19, 0x79, 0x91, 0x24, 0xaa, 0x0d, 0xf0, 0x53,
|
||||
0x27, 0x7d, 0xbb, 0xa6, 0xb6, 0x44, 0x31, 0x4b,
|
||||
0xd4, 0xcf, 0xf6, 0x6d, 0x18, 0xa2, 0x28, 0x8a,
|
||||
0xc1, 0x0a, 0xbe, 0x57, 0x0c, 0x61, 0x5f, 0xd9,
|
||||
0x12, 0x14, 0xfe, 0xe2, 0xc7, 0x10, 0x72, 0xee,
|
||||
0x19, 0xb8, 0x16, 0x0b, 0x88, 0x87, 0xce, 0xf3,
|
||||
0xfe, 0x57, 0x37, 0xd1, 0xa2, 0xf7, 0xd0, 0x5e,
|
||||
0x73, 0xde, 0x39, 0x35, 0xbc, 0xde, 0xed, 0x61,
|
||||
0x4b, 0x31, 0xdc, 0xfe, 0x3c, 0x4d, 0x98, 0xa9,
|
||||
0x36, 0xb0, 0x34, 0x5b, 0xb4, 0xb7, 0x79, 0x25,
|
||||
0x6e, 0x24, 0x7e, 0x10, 0xfe, 0x20, 0xd5, 0x16,
|
||||
0x86, 0xaf, 0xcd, 0x26, 0x34, 0xd3, 0x2e, 0xdc,
|
||||
0x7c, 0x69, 0xe3, 0xc5, 0x62, 0x0c, 0xba, 0x29,
|
||||
0x9c, 0x4b, 0x2f, 0x39, 0x45, 0xe1, 0xcf, 0xc5,
|
||||
0xfe, 0x35, 0xb6, 0x2f, 0xb1, 0x1a, 0x90, 0xe1,
|
||||
0xa7, 0x39, 0xe8, 0x1e, 0x5f, 0xac, 0xab, 0x1e,
|
||||
0x32, 0xba, 0xc5, 0x92, 0x39, 0x62, 0x37, 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();
|
||||
}
|
3606
contrib/netbsd-tests/dev/cgd/t_cgd_aes.c
Normal file
3606
contrib/netbsd-tests/dev/cgd/t_cgd_aes.c
Normal file
File diff suppressed because it is too large
Load Diff
2341
contrib/netbsd-tests/dev/cgd/t_cgd_blowfish.c
Normal file
2341
contrib/netbsd-tests/dev/cgd/t_cgd_blowfish.c
Normal file
File diff suppressed because it is too large
Load Diff
@ -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}; \
|
||||
|
@ -1,9 +1,10 @@
|
||||
/* Test case written by Bharat Joshi */
|
||||
#include <sys/cdefs.h>
|
||||
__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 <sys/types.h>
|
||||
#include <sys/wait.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
@ -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 <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <rpc/rpc.h>
|
||||
#include <stdio.h>
|
||||
#include <netconfig.h>
|
||||
#include <syslog.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <rump/rump.h>
|
||||
#include <rump/rump_syscalls.h>
|
||||
|
||||
#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);
|
||||
}
|
@ -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 <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <stdio.h>
|
||||
#include <rpc/rpc.h>
|
||||
#include <rpc/pmap_prot.h>
|
||||
#include <rpc/rpcb_prot.h>
|
||||
#ifdef RPCBIND_DEBUG
|
||||
#include <stdlib.h>
|
||||
#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 */
|
@ -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 <stdio.h>
|
||||
#include <netconfig.h>
|
||||
#include <rpc/rpc.h>
|
||||
#include <rpc/rpcb_prot.h>
|
||||
#include <sys/stat.h>
|
||||
#ifdef PORTMAP
|
||||
#include <rpc/pmap_prot.h>
|
||||
#endif
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#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;
|
||||
}
|
@ -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 <sys/types.h>
|
||||
#include <rpc/rpc.h>
|
||||
#include <rpc/rpcb_prot.h>
|
||||
#include <netconfig.h>
|
||||
#include <syslog.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#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);
|
||||
}
|
@ -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 <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <rpc/rpc.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <netconfig.h>
|
||||
#include <syslog.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#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);
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@ -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
|
@ -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 <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/errno.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/resource.h>
|
||||
#include <sys/wait.h>
|
||||
#include <sys/signal.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/un.h>
|
||||
#include <rpc/rpc.h>
|
||||
#ifdef PORTMAP
|
||||
#include <netinet/in.h>
|
||||
#endif
|
||||
#include <netdb.h>
|
||||
#include <stdio.h>
|
||||
#include <netconfig.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <syslog.h>
|
||||
#include <err.h>
|
||||
#include <util.h>
|
||||
#include <pwd.h>
|
||||
#include <semaphore.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include "rpcbind.h"
|
||||
|
||||
#include <rump/rump.h>
|
||||
#include <rump/rump_syscalls.h>
|
||||
|
||||
/* 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;
|
||||
}
|
@ -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 <rpc/pmap_prot.h>
|
||||
#endif
|
||||
#include <rpc/rpcb_prot.h>
|
||||
|
||||
/*
|
||||
* 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 */
|
@ -1,282 +0,0 @@
|
||||
/* $NetBSD: security.c,v 1.1 2010/07/26 15:53:01 pooka Exp $ */
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <rpc/rpc.h>
|
||||
#include <rpc/rpcb_prot.h>
|
||||
#include <rpc/pmap_prot.h>
|
||||
#include <err.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <util.h>
|
||||
#include <syslog.h>
|
||||
#include <netdb.h>
|
||||
|
||||
/*
|
||||
* XXX for special case checks in check_callit.
|
||||
*/
|
||||
#include <rpcsvc/mount.h>
|
||||
#include <rpcsvc/rquota.h>
|
||||
#include <rpcsvc/nfs_prot.h>
|
||||
#include <rpcsvc/yp.h>
|
||||
#include <rpcsvc/ypclnt.h>
|
||||
#include <rpcsvc/yppasswd.h>
|
||||
|
||||
#include "rpcbind.h"
|
||||
|
||||
#ifdef LIBWRAP
|
||||
# include <tcpd.h>
|
||||
#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;
|
||||
}
|
@ -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 <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/queue.h>
|
||||
#include <net/if.h>
|
||||
#include <netinet/in.h>
|
||||
#include <assert.h>
|
||||
#include <ifaddrs.h>
|
||||
#include <poll.h>
|
||||
#include <rpc/rpc.h>
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <netdb.h>
|
||||
#include <netconfig.h>
|
||||
#include <stdio.h>
|
||||
#include <arpa/inet.h>
|
||||
|
||||
#include <rump/rump.h>
|
||||
#include <rump/rump_syscalls.h>
|
||||
|
||||
#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;
|
||||
}
|
||||
}
|
@ -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
|
||||
}
|
||||
|
@ -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 <sys/types.h>
|
||||
#include <sys/mount.h>
|
||||
@ -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);
|
||||
|
||||
|
@ -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 <sys/stat.h>
|
||||
#include <sys/statvfs.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
#include <assert.h>
|
||||
#include <atf-c.h>
|
||||
@ -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);
|
||||
|
@ -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; \
|
||||
|
136
contrib/netbsd-tests/kernel/msg.h
Normal file
136
contrib/netbsd-tests/kernel/msg.h
Normal file
@ -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;
|
||||
}
|
@ -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 <atf-c.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
208
contrib/netbsd-tests/kernel/t_ptrace.c
Normal file
208
contrib/netbsd-tests/kernel/t_ptrace.c
Normal file
@ -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 <sys/cdefs.h>
|
||||
__RCSID("$NetBSD: t_ptrace.c,v 1.17 2016/11/13 22:59:31 kamil Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/ptrace.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/sysctl.h>
|
||||
#include <err.h>
|
||||
#include <errno.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <atf-c.h>
|
||||
|
||||
#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();
|
||||
}
|
5082
contrib/netbsd-tests/kernel/t_ptrace_wait.c
Normal file
5082
contrib/netbsd-tests/kernel/t_ptrace_wait.c
Normal file
File diff suppressed because it is too large
Load Diff
431
contrib/netbsd-tests/kernel/t_ptrace_wait.h
Normal file
431
contrib/netbsd-tests/kernel/t_ptrace_wait.h
Normal file
@ -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
|
30
contrib/netbsd-tests/kernel/t_ptrace_wait3.c
Normal file
30
contrib/netbsd-tests/kernel/t_ptrace_wait3.c
Normal file
@ -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"
|
30
contrib/netbsd-tests/kernel/t_ptrace_wait4.c
Normal file
30
contrib/netbsd-tests/kernel/t_ptrace_wait4.c
Normal file
@ -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"
|
30
contrib/netbsd-tests/kernel/t_ptrace_wait6.c
Normal file
30
contrib/netbsd-tests/kernel/t_ptrace_wait6.c
Normal file
@ -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"
|
30
contrib/netbsd-tests/kernel/t_ptrace_waitid.c
Normal file
30
contrib/netbsd-tests/kernel/t_ptrace_waitid.c
Normal file
@ -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"
|
30
contrib/netbsd-tests/kernel/t_ptrace_waitpid.c
Normal file
30
contrib/netbsd-tests/kernel/t_ptrace_waitpid.c
Normal file
@ -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"
|
@ -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 <sys/cdefs.h>
|
||||
__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;
|
||||
}
|
||||
|
@ -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 <machine/asm.h>
|
||||
|
||||
.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:
|
||||
|
@ -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 <unistd.h>
|
||||
#include <err.h>
|
||||
#include <db.h>
|
||||
#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);
|
||||
}
|
||||
|
@ -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 - <<EOF
|
||||
p z999 1024
|
||||
p z998 1024
|
||||
p y999 1024
|
||||
p y990 1024
|
||||
p d999 1024
|
||||
p d990 1024
|
||||
p c999 1024
|
||||
p c990 1024
|
||||
p b999 1024
|
||||
p b990 1024
|
||||
p a999 1024
|
||||
p a990 1024
|
||||
p y998 1024
|
||||
r y990
|
||||
p d998 1024
|
||||
p d990 1024
|
||||
p c998 1024
|
||||
p c990 1024
|
||||
p b998 1024
|
||||
p b990 1024
|
||||
p a998 1024
|
||||
p a990 1024
|
||||
p y997 2014
|
||||
S
|
||||
o
|
||||
EOF
|
||||
echo "$list") |
|
||||
# awk script input:
|
||||
# {p|g|r} key [datasize]
|
||||
awk '/^[pgr]/{
|
||||
printf("%s\nk%s\n", $1, $2);
|
||||
}
|
||||
/^p/{
|
||||
s = $2;
|
||||
for (i = 0; i < $3; i++) {
|
||||
s = s "x";
|
||||
}
|
||||
printf("d%s\n", s);
|
||||
}
|
||||
!/^[pgr]/{
|
||||
print $0;
|
||||
}' > 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
|
||||
}
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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");
|
||||
|
||||
|
@ -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 <sys/cdefs.h>
|
||||
__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 <atf-c.h>
|
||||
#include <fnmatch.h>
|
||||
@ -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);
|
||||
|
@ -27,6 +27,7 @@
|
||||
*/
|
||||
|
||||
#ifdef __FreeBSD__
|
||||
/* kqueue(2) on FreeBSD requires sys/types.h for uintptr_t; NetBSD doesn't. */
|
||||
#include <sys/types.h>
|
||||
#endif
|
||||
#include <sys/cdefs.h>
|
||||
|
@ -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 <sys/cdefs.h>
|
||||
__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 <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
@ -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:
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -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);
|
||||
|
@ -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.
|
||||
|
@ -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<T> m_val;
|
||||
};
|
||||
|
||||
#if defined(__clang__) && defined(__sparc64__)
|
||||
#define NO_SHORT_ATOMICS
|
||||
#endif
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
#ifndef NO_SHORT_ATOMICS
|
||||
ATest<char>();
|
||||
ATest<signed char>();
|
||||
ATest<unsigned char>();
|
||||
ATest<short>();
|
||||
ATest<unsigned short>();
|
||||
#endif
|
||||
ATest<int>();
|
||||
ATest<unsigned int>();
|
||||
ATest<long>();
|
||||
@ -79,29 +73,23 @@ int main(int argc, char **argv)
|
||||
ATest<long long>();
|
||||
ATest<unsigned long long>();
|
||||
#endif
|
||||
#ifndef NO_SHORT_ATOMICS
|
||||
ATest<char16_t>();
|
||||
#endif
|
||||
ATest<char32_t>();
|
||||
ATest<wchar_t>();
|
||||
#ifndef NO_SHORT_ATOMICS
|
||||
ATest<int_least8_t>();
|
||||
ATest<uint_least8_t>();
|
||||
ATest<int_least16_t>();
|
||||
ATest<uint_least16_t>();
|
||||
#endif
|
||||
ATest<int_least32_t>();
|
||||
ATest<uint_least32_t>();
|
||||
#ifdef __HAVE_ATOMIC64_OPS
|
||||
ATest<int_least64_t>();
|
||||
ATest<uint_least64_t>();
|
||||
#endif
|
||||
#ifndef NO_SHORT_ATOMICS
|
||||
ATest<int_fast8_t>();
|
||||
ATest<uint_fast8_t>();
|
||||
ATest<int_fast16_t>();
|
||||
ATest<uint_fast16_t>();
|
||||
#endif
|
||||
ATest<int_fast32_t>();
|
||||
ATest<uint_fast32_t>();
|
||||
#ifdef __HAVE_ATOMIC64_OPS
|
||||
@ -115,5 +103,5 @@ int main(int argc, char **argv)
|
||||
#ifdef __HAVE_ATOMIC64_OPS
|
||||
ATest<intmax_t>();
|
||||
ATest<uintmax_t>();
|
||||
#endif /* NO_SHORT_ATOMICS */
|
||||
#endif
|
||||
}
|
||||
|
@ -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 <sys/cdefs.h>
|
||||
__RCSID("$NetBSD: t_access.c,v 1.2 2017/01/10 22:36:29 christos Exp $");
|
||||
|
||||
#ifdef __FreeBSD__
|
||||
#include <sys/param.h> /* For __FreeBSD_version */
|
||||
#endif
|
||||
|
||||
#include <atf-c.h>
|
||||
|
||||
#include <sys/stat.h>
|
||||
|
63
contrib/netbsd-tests/lib/libc/sys/t_clock_nanosleep.c
Normal file
63
contrib/netbsd-tests/lib/libc/sys/t_clock_nanosleep.c
Normal file
@ -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 <sys/cdefs.h>
|
||||
__RCSID("$NetBSD: t_clock_nanosleep.c,v 1.1 2016/11/11 15:30:44 njoly Exp $");
|
||||
|
||||
#include <atf-c.h>
|
||||
#include <time.h>
|
||||
|
||||
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();
|
||||
}
|
@ -56,6 +56,10 @@ sighandler(int signo)
|
||||
/* Nothing. */
|
||||
}
|
||||
|
||||
#ifdef __FreeBSD__
|
||||
#define asm __asm
|
||||
#endif
|
||||
|
||||
static void
|
||||
work(void)
|
||||
{
|
||||
|
345
contrib/netbsd-tests/lib/libc/sys/t_wait_noproc.c
Normal file
345
contrib/netbsd-tests/lib/libc/sys/t_wait_noproc.c
Normal file
@ -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 <sys/cdefs.h>
|
||||
__RCSID("$NetBSD: t_wait_noproc.c,v 1.5 2016/11/09 17:50:19 kamil Exp $");
|
||||
|
||||
#ifdef __FreeBSD__
|
||||
#include <sys/param.h> /* For NBBY -- it's in sys/types.h on NetBSD */
|
||||
#endif
|
||||
#include <sys/wait.h>
|
||||
#include <sys/resource.h>
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include <atf-c.h>
|
||||
|
||||
#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();
|
||||
}
|
30
contrib/netbsd-tests/lib/libc/sys/t_wait_noproc_wnohang.c
Normal file
30
contrib/netbsd-tests/lib/libc/sys/t_wait_noproc_wnohang.c
Normal file
@ -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"
|
81
contrib/netbsd-tests/lib/libm/t_casinh.c
Normal file
81
contrib/netbsd-tests/lib/libm/t_casinh.c
Normal file
@ -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 <atf-c.h>
|
||||
#include <complex.h>
|
||||
#include <math.h>
|
||||
|
||||
#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();
|
||||
}
|
124
contrib/netbsd-tests/lib/libm/t_fe_round.c
Normal file
124
contrib/netbsd-tests/lib/libm/t_fe_round.c
Normal file
@ -0,0 +1,124 @@
|
||||
/*
|
||||
* Written by Maya Rashish <maya@NetBSD.org>
|
||||
* Public domain.
|
||||
*
|
||||
* Testing IEEE-754 rounding modes (and lrint)
|
||||
*/
|
||||
|
||||
#include <atf-c.h>
|
||||
#include <fenv.h>
|
||||
#ifdef __HAVE_FENV
|
||||
#include <math.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
/*#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
|
130
contrib/netbsd-tests/lib/libm/t_ilogb.c
Normal file
130
contrib/netbsd-tests/lib/libm/t_ilogb.c
Normal file
@ -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 <limits.h>
|
||||
#endif
|
||||
#include <atf-c.h>
|
||||
#include <fenv.h>
|
||||
#include <math.h>
|
||||
|
||||
#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();
|
||||
}
|
@ -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 <sys/cdefs.h>
|
||||
__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 <sys/param.h>
|
||||
|
||||
@ -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);
|
||||
|
||||
|
@ -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 <sys/cdefs.h>
|
||||
__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 <atf-c.h>
|
||||
|
||||
@ -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;
|
||||
|
@ -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
|
||||
|
@ -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 <sys/cdefs.h>
|
||||
__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 <sys/time.h> /* For timespecadd */
|
||||
#include <inttypes.h> /* For UINT16_MAX */
|
||||
#endif
|
||||
#include <pthread.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <time.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/sched.h>
|
||||
#include <sys/param.h>
|
||||
@ -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();
|
||||
}
|
||||
|
30
contrib/netbsd-tests/lib/libpthread/t_timedmutex.c
Normal file
30
contrib/netbsd-tests/lib/libpthread/t_timedmutex.c
Normal file
@ -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"
|
@ -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 <rump/rumpclient.h>
|
||||
#include <rump/rump_syscalls.h>
|
||||
|
||||
//#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];
|
||||
|
@ -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 \
|
||||
|
@ -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 <sys/cdefs.h>
|
||||
__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 <atf-c.h>
|
||||
|
||||
@ -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);
|
||||
|
@ -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()
|
||||
|
@ -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()
|
||||
|
@ -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
|
||||
}
|
||||
|
@ -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()
|
||||
|
@ -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 <sys/socket.h>
|
||||
#include <sys/ioctl.h>
|
||||
@ -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));
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
}
|
||||
|
||||
|
@ -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}
|
||||
|
@ -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
|
||||
}
|
||||
|
@ -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()
|
||||
|
@ -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}"
|
||||
}
|
||||
|
@ -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
|
||||
}
|
||||
|
@ -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()
|
||||
|
@ -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.+<AUTOCONF>" \
|
||||
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.+<AUTOCONF,TEMPORARY>" \
|
||||
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
|
||||
}
|
||||
|
@ -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
|
||||
}
|
||||
|
||||
|
@ -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"
|
||||
}
|
||||
|
@ -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()
|
||||
|
@ -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}
|
||||
|
||||
|
192
contrib/netbsd-tests/net/net/t_mtudisc.sh
Executable file
192
contrib/netbsd-tests/net/net/t_mtudisc.sh
Executable file
@ -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
|
||||
}
|
179
contrib/netbsd-tests/net/net/t_mtudisc6.sh
Executable file
179
contrib/netbsd-tests/net/net/t_mtudisc6.sh
Executable file
@ -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
|
||||
}
|
380
contrib/netbsd-tests/net/net/t_ping6_opts.sh
Executable file
380
contrib/netbsd-tests/net/net/t_ping6_opts.sh
Executable file
@ -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 <sourceaddr>
|
||||
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 <interface>
|
||||
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 <gateway>
|
||||
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 <gateway> 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 <gateway> 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
|
||||
}
|
314
contrib/netbsd-tests/net/net_common.sh
Executable file
314
contrib/netbsd-tests/net/net_common.sh
Executable file
@ -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
|
||||
}
|
@ -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()
|
||||
|
@ -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}"
|
||||
|
@ -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}"
|
||||
|
@ -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
|
||||
}
|
||||
|
||||
|
@ -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 <sys/types.h>
|
||||
#include <sys/mount.h>
|
||||
@ -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,
|
||||
|
@ -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 <sys/types.h>
|
||||
#include <sys/wait.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include <rump/rump.h>
|
||||
#include <rump/rump_syscalls.h>
|
||||
|
@ -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 <sys/cdefs.h>
|
||||
__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);
|
||||
}
|
||||
|
@ -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 ] &&
|
||||
:
|
||||
}
|
||||
|
@ -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 @@ 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
|
||||
n+b9X9eu3bt7q394/aMPr/94/ZMP7352d918+Mn1648+++j6D5/1+Pzzrx9++PRx
|
||||
uX7nA/sw/fzw3sOH8/aX927cvxm++ua38XWJ1369/7ymm+17+3zkH279872fHvT/
|
||||
/PD0yYPHj2/PD8dP0f14/Z83H8Vvf7n+69fti099+MrcauXJi98/u/fs65++un0t
|
||||
3fn0zuN79397/uP1Gx9/6//VHzz51/ff/fbre3eex+tf57vPP19P//njV8+emtsf
|
||||
ffPvzx8+/Sp/8p9fyr9vxue3Pnlcn1376ZNwZz18/Ov2+Lt75e4HyTz95sHPn/34
|
||||
wN376P4Ht7/+bdz843n/+dPt2wfz/m/XP3n+2fPH33777G78/pfrT8ML+8O1L7/9
|
||||
/OdHPzz6an48b9775ofrf4xlvn3x+7M/1s+fPr3z+/e315f5h/fu/Oenj9uj6/9a
|
||||
T2/dvvVlvrke3L+brocvP/zl2qOPPrptHz68z/1Zuf3dneu/3/K32vfr26c37KPt
|
||||
yUf//vmfn74ov3/4/NPb9+6s8vXzf/rv73/Rfnj0Yt7//tfPb177j/3iu+9+84/j
|
||||
w5v+4Sd365d3/vhKEeEL88N3D57eeC/261/ffe/rJz8/+cDc/az9+uGzH3/7/unt
|
||||
F3X7/dkXv5p7N67d+jibO/+09+7cv3nn52Vv3H345Q+PP/vpt3+t35W6Xe/6bfnR
|
||||
vcfv/fbo1oMfv/zp1rMbLz6++/H99eDhH+WXr27/cu2Df3/5/NnH/873Xtxo8Zen
|
||||
5gP3z8+3G18//e3ZzY9++irdivX6wxg+/Pg7c6/Gb/4I9cUq9259/OX1W+3FXD99
|
||||
eu36HXvjs9sPXfz9x9/6wz8++KrcfjpvPfsgmE8f/bQ9efLxk5uPX9zIP3/+ONx3
|
||||
dx7M337+wM/HT3/+9ql87ntP+zVz/5t7Xzy78WmLP/z+9NGXpCsPntz66KPP7nz0
|
||||
/Yzx+/7z/XLvsxeP3rt+zz78z4379sObX/zw8H558Wm79ezOrbvX4h93f3x+49M7
|
||||
5Yv5xwfmvv32vV8/vvZ/H376fb/2/wGUHa4t0v0NAA==
|
||||
Bh1fXF4EQ/TgfzV3dl1CFUmXvudX9O0s12jmye9Zay4QUJFWQW21vZmVnzaIoCiC
|
||||
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
|
||||
CkCfGLqCepPV9bGCdp0QoADA/B8sgZOSNg9vmzLwvVugrjCjcCZU+AaQHymI2Jr5
|
||||
H1l/9xwpr64sygrOOz0s1+UgSsG/bdSJTYWXvLwcrWDNqgJicsRlKNGUM9xlmQRD
|
||||
TpqIIXdFIzUhIx+FhDyFkvphfRrFqdL1uSKkebNrhelD+fo/M/z+AkaJkzyfhVK+
|
||||
ucVl7JZok+9C0obCseQE9t/d5idOu41sfW0CpMEqbZOn0svSPKzN6eMxc7/QqILO
|
||||
7z/eocFSHsydnz7lqvDwUkxqgKFJxheyU1x7i9LJpYMrknvEb5eb8KTRP5+r4awj
|
||||
CYnuvOXwGi16d92W6CabaCB0LbLV4QCuc8pJRupxhOb5g94UTjsFwJs1yALXtUrW
|
||||
FtbC0ccwQdCqxqi8vB0165lJI1owIKxS4B8QhEFwsHP1CT53jtaE/RRrDpny7Oco
|
||||
M2m6TaBBDq1tCu6+C3wIigjonyc9df6QL4VTrN9kkbVzv1dbXdqPNjR9b+N+ElxW
|
||||
UyKYjpvu5cBCcEpCRkXIyFLQuZT7WApq9d3jtoFKFetLVC7nKL8LBleMLl5QCiaQ
|
||||
xP12cTPIBVq9czFTv8k3Lh7WXr9sfHa9Wk0eedmTxJujRq+vPo+b7eWEZxuRLb7B
|
||||
ba9glRWdKjCaBmmntaCIokDrD5rs5aj0FwvOt+aUnslULeZuBD7JU5LW3bX/zR8f
|
||||
3vr49uf/uPvx3X98dfvjz69//a8vb+2/fu2b+eRXjfd//vHxo6d3P/7H7/Z9/779
|
||||
07z/69q1+/du9w+v3/rw+g/XP/7w3qf31s1HH1+//vjTW9e//7TH55999ejDp7+U
|
||||
63c/sI/ST4/uP3o073xx/8aDm+HLr38bX5V47dcHz2u62b6zz0f+/vY/3/vxYf/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 644 expected18
|
||||
R29vZCBzaWduYXR1cmUgZm9yIGdwZ3NpZ25lZC1hLmdwZyBtYWRlIFN1biBTZXAg
|
||||
IDkgMTc6NDM6MDEgMjAxMgpzaWduYXR1cmUgIDIwNDgvUlNBIChFbmNyeXB0IG9y
|
||||
IFNpZ24pIDFiNjhkY2ZjYzA1OTY4MjMgMjAwNC0wMS0xMgpmaW5nZXJwcmludDog
|
||||
IGQ0MTUgOWRlYiAzMzZkIGU0Y2MgY2RmYSAwMGNkIDFiNjggZGNmYyBjMDU5IDY4
|
||||
MjMgCnVpZCAgICAgICAgICAgICAgQWxpc3RhaXIgQ3Jvb2tzIDxhZ2NAYWxpc3Rh
|
||||
aXJjcm9va3MuY29tPgp1aWQgICAgICAgICAgICAgIEFsaXN0YWlyIENyb29rcyA8
|
||||
YWdjQHBrZ3NyYy5vcmc+CnVpZCAgICAgICAgICAgICAgQWxpc3RhaXIgQ3Jvb2tz
|
||||
IDxhZ2NAbmV0YnNkLm9yZz4KdWlkICAgICAgICAgICAgICBBbGlzdGFpciBDcm9v
|
||||
a3MgPGFnY0BuZXRmbGl4LmNvbT4KZW5jcnlwdGlvbiAyMDQ4L1JTQSAoRW5jcnlw
|
||||
dCBvciBTaWduKSA3OWRlYjYxZTQ4OGVlZTc0IDIwMDQtMDEtMTIKZmluZ2VycHJp
|
||||
bnQ6ICA1N2MwIGMxZTYgYmY3MSA4ODQ1IDQxNmIgOTUyMiA3OWRlIGI2MWUgNDg4
|
||||
ZSBlZTc0IAoK
|
||||
R29vZCBzaWduYXR1cmUgZm9yIGEuZ3BnIG1hZGUgVHVlIE1heSAzMSAyMzoyOTox
|
||||
MCAyMDE2CnNpZ25hdHVyZSAgICAgMjA0OC9SU0EgKEVuY3J5cHQgb3IgU2lnbikg
|
||||
MWI2OGRjZmNjMDU5NjgyMyAyMDA0LTAxLTEyCmZpbmdlcnByaW50ICAgZDQxNSA5
|
||||
ZGViIDMzNmQgZTRjYyBjZGZhIDAwY2QgMWI2OCBkY2ZjIGMwNTkgNjgyMyAKdWlk
|
||||
ICAgICAgICAgICBBbGlzdGFpciBDcm9va3MgPGFnY0BhbGlzdGFpcmNyb29rcy5j
|
||||
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==
|
||||
R29vZCBzaWduYXR1cmUgZm9yIFtzdGRpbl0gbWFkZSBUdWUgTWF5IDMxIDIzOjI5
|
||||
OjEwIDIwMTYKc2lnbmF0dXJlICAgICAyMDQ4L1JTQSAoRW5jcnlwdCBvciBTaWdu
|
||||
KSAxYjY4ZGNmY2MwNTk2ODIzIDIwMDQtMDEtMTIKZmluZ2VycHJpbnQgICBkNDE1
|
||||
IDlkZWIgMzM2ZCBlNGNjIGNkZmEgMDBjZCAxYjY4IGRjZmMgYzA1OSA2ODIzIAp1
|
||||
aWQgICAgICAgICAgIEFsaXN0YWlyIENyb29rcyA8YWdjQGFsaXN0YWlyY3Jvb2tz
|
||||
LmNvbT4KdWlkICAgICAgICAgICBBbGlzdGFpciBDcm9va3MgPGFnY0Bwa2dzcmMu
|
||||
b3JnPgp1aWQgICAgICAgICAgIEFsaXN0YWlyIENyb29rcyA8YWdjQG5ldGJzZC5v
|
||||
cmc+CnVpZCAgICAgICAgICAgQWxpc3RhaXIgQ3Jvb2tzIDxhZ2NAbmV0ZmxpeC5j
|
||||
b20+Cgo=
|
||||
====
|
||||
EOF
|
||||
uudecode << EOF
|
||||
@ -7123,18 +7117,15 @@ MDIwNSA5ZmYyIGMyNGYgZGYyYyBlNjIwIAoK
|
||||
EOF
|
||||
uudecode << EOF
|
||||
begin-base64 644 expected31
|
||||
YmVnaW4tYmFzZTY0IDY0NCBleHBlY3RlZDMxClVGSlBSejF3Q2xOU1ExTTljR0Z5
|
||||
YzJVdVl3cFhRVkpPVXowMUNrMUxUVUZPUFc1dkNrTlFVRVpNUVVkVEt6MHQKWnlB
|
||||
dFR6QUtURVJHVEVGSFV5czlMV2NnTFU4d0Nnb3VhVzVqYkhWa1pTQThZbk5rTG5C
|
||||
eWIyY3ViV3MrQ2dwMApPaUFrZTFCU1QwZDlDZ2t1THlSN1VGSlBSMzBnWjNCbmMy
|
||||
bG5ibVZrTFdFdVozQm5DbEJTVDBjOWNBcFRVa05UClBYQmhjbk5sTG1NS1YwRlNU
|
||||
bE05TlFwTlMwMUJUajF1YndwRFVGQkdURUZIVXlzOUxXY2dMVTh3Q2t4RVJreEIK
|
||||
UjFNclBTMW5JQzFQTUFvS0xtbHVZMngxWkdVZ1BHSnpaQzV3Y205bkxtMXJQZ29L
|
||||
ZERvZ0pIdFFVazlIZlFvSgpMaThrZTFCU1QwZDlJR2R3WjNOcFoyNWxaQzFoTG1k
|
||||
d1p3cFFVazlIUFhBS1UxSkRVejF3WVhKelpTNWpDbGRCClVrNVRQVFVLVFV0TlFV
|
||||
NDlibThLUTFCUVJreEJSMU1yUFMxbklDMVBNQXBNUkVaTVFVZFRLejB0WnlBdFR6
|
||||
QUsKQ2k1cGJtTnNkV1JsSUR4aWMyUXVjSEp2Wnk1dGF6NEtDblE2SUNSN1VGSlBS
|
||||
MzBLQ1M0dkpIdFFVazlIZlNCbgpjR2R6YVdkdVpXUXRZUzVuY0djSwo9PT09Cg==
|
||||
UFJPRz1wClNSQ1M9cGFyc2UuYwpXQVJOUz01Ck1LTUFOPW5vCkNQUEZMQUdTKz0t
|
||||
ZyAtTzAKTERGTEFHUys9LWcgLU8wCgouaW5jbHVkZSA8YnNkLnByb2cubWs+Cgp0
|
||||
OiAke1BST0d9CgkuLyR7UFJPR30gZ3Bnc2lnbmVkLWEuZ3BnClBST0c9cApTUkNT
|
||||
PXBhcnNlLmMKV0FSTlM9NQpNS01BTj1ubwpDUFBGTEFHUys9LWcgLU8wCkxERkxB
|
||||
R1MrPS1nIC1PMAoKLmluY2x1ZGUgPGJzZC5wcm9nLm1rPgoKdDogJHtQUk9HfQoJ
|
||||
Li8ke1BST0d9IGdwZ3NpZ25lZC1hLmdwZwpQUk9HPXAKU1JDUz1wYXJzZS5jCldB
|
||||
Uk5TPTUKTUtNQU49bm8KQ1BQRkxBR1MrPS1nIC1PMApMREZMQUdTKz0tZyAtTzAK
|
||||
Ci5pbmNsdWRlIDxic2QucHJvZy5taz4KCnQ6ICR7UFJPR30KCS4vJHtQUk9HfSBn
|
||||
cGdzaWduZWQtYS5ncGcK
|
||||
====
|
||||
EOF
|
||||
uudecode << EOF
|
||||
@ -7168,20 +7159,16 @@ aXguY29tPgoK
|
||||
EOF
|
||||
uudecode << EOF
|
||||
begin-base64 644 expected33
|
||||
YmVnaW4tYmFzZTY0IDY0NCBleHBlY3RlZDMzClVGSlBSejF3Q2xOU1ExTTljR0Z5
|
||||
YzJVdVl3cFhRVkpPVXowMUNrMUxUVUZPUFc1dkNrTlFVRVpNUVVkVEt6MHQKWnlB
|
||||
dFR6QUtURVJHVEVGSFV5czlMV2NnTFU4d0Nnb3VhVzVqYkhWa1pTQThZbk5rTG5C
|
||||
eWIyY3ViV3MrQ2dwMApPaUFrZTFCU1QwZDlDZ2t1THlSN1VGSlBSMzBnWjNCbmMy
|
||||
bG5ibVZrTFdFdVozQm5DakV1SUhSaFp5QW1JREI0Ck0yWUtNaTRnYkdWdUNncHZi
|
||||
bVVnY0dGemN5QW9kR0ZuSURRcENqMDlQVDA5UFQwOUNtSWdkbVZ5YzJsdmJqb3oK
|
||||
Q21JZ2MybG5JSFI1Y0dVS1lpQm9ZWE5vSUdGc1p3cGlJSEIxWW10bGVTQmhiR2NL
|
||||
T0dJZ2EyVjVhV1FLQ214cApkR1Z5WVd3Z1pHRjBZU0FvZEdGbklERXhLUW85UFQw
|
||||
OVBUMDlQVDA5UFQwOUNtSWdZbWx1WVhKNUwzUmxlSFFLCllpQnNaVzVuZEdnS1l5
|
||||
QnpkSEpwYm1jS1RDQnRkR2x0WlFwMFpYaDBDbEJTVDBjOWNBcFRVa05UUFhCaGNu
|
||||
TmwKTG1NS1YwRlNUbE05TlFwTlMwMUJUajF1YndwRFVGQkdURUZIVXlzOUxXY2dM
|
||||
VTh3Q2t4RVJreEJSMU1yUFMxbgpJQzFQTUFvS0xtbHVZMngxWkdVZ1BHSnpaQzV3
|
||||
Y205bkxtMXJQZ29LZERvZ0pIdFFVazlIZlFvSkxpOGtlMUJTClQwZDlJR2R3WjNO
|
||||
cFoyNWxaQzFoTG1kd1p3bz0KPT09PQo=
|
||||
UFJPRz1wClNSQ1M9cGFyc2UuYwpXQVJOUz01Ck1LTUFOPW5vCkNQUEZMQUdTKz0t
|
||||
ZyAtTzAKTERGTEFHUys9LWcgLU8wCgouaW5jbHVkZSA8YnNkLnByb2cubWs+Cgp0
|
||||
OiAke1BST0d9CgkuLyR7UFJPR30gZ3Bnc2lnbmVkLWEuZ3BnCjEuIHRhZyAmIDB4
|
||||
M2YKMi4gbGVuCgpvbmUgcGFzcyAodGFnIDQpCj09PT09PT09CmIgdmVyc2lvbjoz
|
||||
CmIgc2lnIHR5cGUKYiBoYXNoIGFsZwpiIHB1YmtleSBhbGcKOGIga2V5aWQKCmxp
|
||||
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
|
||||
}
|
||||
|
||||
|
16
contrib/netbsd-tests/usr.bin/xlint/lint1/d_c99_anon_union.c
Normal file
16
contrib/netbsd-tests/usr.bin/xlint/lint1/d_c99_anon_union.c
Normal file
@ -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;
|
||||
}
|
18
contrib/netbsd-tests/usr.bin/xlint/lint1/d_c99_union_cast.c
Normal file
18
contrib/netbsd-tests/usr.bin/xlint/lint1/d_c99_union_cast.c
Normal file
@ -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;
|
||||
}
|
@ -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.
|
||||
|
||||
|
@ -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
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user