fibs_test.sh (263445) | fibs_test.sh (265586) |
---|---|
1# 2# Copyright (c) 2014 Spectra Logic Corporation 3# All rights reserved. | 1# 2# Copyright (c) 2014 Spectra Logic Corporation 3# All rights reserved. |
4# | 4# |
5# Redistribution and use in source and binary forms, with or without 6# modification, are permitted provided that the following conditions 7# are met: 8# 1. Redistributions of source code must retain the above copyright 9# notice, this list of conditions, and the following disclaimer, 10# without modification. 11# 2. Redistributions in binary form must reproduce at minimum a disclaimer 12# substantially similar to the "NO WARRANTY" disclaimer below 13# ("Disclaimer") and any redistribution must be conditioned upon 14# including a substantially similar Disclaimer requirement for further 15# binary redistribution. | 5# Redistribution and use in source and binary forms, with or without 6# modification, are permitted provided that the following conditions 7# are met: 8# 1. Redistributions of source code must retain the above copyright 9# notice, this list of conditions, and the following disclaimer, 10# without modification. 11# 2. Redistributions in binary form must reproduce at minimum a disclaimer 12# substantially similar to the "NO WARRANTY" disclaimer below 13# ("Disclaimer") and any redistribution must be conditioned upon 14# including a substantially similar Disclaimer requirement for further 15# binary redistribution. |
16# | 16# |
17# NO WARRANTY 18# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR 21# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22# HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 24# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 26# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 27# IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28# POSSIBILITY OF SUCH DAMAGES. | 17# NO WARRANTY 18# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR 21# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22# HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 24# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 26# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 27# IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28# POSSIBILITY OF SUCH DAMAGES. |
29# | 29# |
30# Authors: Alan Somers (Spectra Logic Corporation) 31# | 30# Authors: Alan Somers (Spectra Logic Corporation) 31# |
32# $FreeBSD: head/tests/sys/netinet/fibs_test.sh 263445 2014-03-20 20:39:41Z asomers $ | 32# $FreeBSD: stable/10/tests/sys/netinet/fibs_test.sh 265586 2014-05-07 18:49:25Z asomers $ |
33 34# All of the tests in this file requires the test-suite config variable "fibs" 35# to be defined to a space-delimited list of FIBs that may be used for testing. 36 37# arpresolve should check the interface fib for routes to a target when 38# creating an ARP table entry. This is a regression for kern/167947, where 39# arpresolve only checked the default route. 40# 41# Outline: 42# Create two tap(4) interfaces 43# Simulate a crossover cable between them by using net/socat 44# Use nping (from security/nmap) to send an ICMP echo request from one 45# interface to the other, spoofing the source IP. The source IP must be | 33 34# All of the tests in this file requires the test-suite config variable "fibs" 35# to be defined to a space-delimited list of FIBs that may be used for testing. 36 37# arpresolve should check the interface fib for routes to a target when 38# creating an ARP table entry. This is a regression for kern/167947, where 39# arpresolve only checked the default route. 40# 41# Outline: 42# Create two tap(4) interfaces 43# Simulate a crossover cable between them by using net/socat 44# Use nping (from security/nmap) to send an ICMP echo request from one 45# interface to the other, spoofing the source IP. The source IP must be |
46# spoofed, or else it will already have an entry in the arp table. | 46# spoofed, or else it will already have an entry in the arp table. |
47# Check whether an arp entry exists for the spoofed IP 48atf_test_case arpresolve_checks_interface_fib cleanup 49arpresolve_checks_interface_fib_head() 50{ 51 atf_set "descr" "arpresolve should check the interface fib, not the default fib, for routes" 52 atf_set "require.user" "root" 53 atf_set "require.config" "fibs" 54 atf_set "require.progs" "socat nping" --- 25 unchanged lines hidden (view full) --- 80 TAP0=$TAP 81 setup_tap "$FIB1" ${ADDR1} ${MASK1} 82 TAP1=$TAP 83 84 # Simulate a crossover cable 85 socat /dev/${TAP0} /dev/${TAP1} & 86 SOCAT_PID=$! 87 echo ${SOCAT_PID} >> "processes_to_kill" | 47# Check whether an arp entry exists for the spoofed IP 48atf_test_case arpresolve_checks_interface_fib cleanup 49arpresolve_checks_interface_fib_head() 50{ 51 atf_set "descr" "arpresolve should check the interface fib, not the default fib, for routes" 52 atf_set "require.user" "root" 53 atf_set "require.config" "fibs" 54 atf_set "require.progs" "socat nping" --- 25 unchanged lines hidden (view full) --- 80 TAP0=$TAP 81 setup_tap "$FIB1" ${ADDR1} ${MASK1} 82 TAP1=$TAP 83 84 # Simulate a crossover cable 85 socat /dev/${TAP0} /dev/${TAP1} & 86 SOCAT_PID=$! 87 echo ${SOCAT_PID} >> "processes_to_kill" |
88 | 88 |
89 # Send an ICMP echo request with a spoofed source IP 90 setfib 2 nping -c 1 -e ${TAP0} -S ${SPOOF_ADDR} \ 91 --source-mac ${SPOOF_MAC} --icmp --icmp-type "echo-request" \ 92 --icmp-code 0 --icmp-id 0xdead --icmp-seq 1 --data 0xbeef \ 93 ${ADDR1} 94 # For informational and debugging purposes only, look for the 95 # characteristic error message 96 dmesg | grep "llinfo.*${SPOOF_ADDR}" --- 200 unchanged lines hidden (view full) --- 297{ 298 cleanup_tap 299} 300 301 302atf_init_test_cases() 303{ 304 atf_add_test_case arpresolve_checks_interface_fib | 89 # Send an ICMP echo request with a spoofed source IP 90 setfib 2 nping -c 1 -e ${TAP0} -S ${SPOOF_ADDR} \ 91 --source-mac ${SPOOF_MAC} --icmp --icmp-type "echo-request" \ 92 --icmp-code 0 --icmp-id 0xdead --icmp-seq 1 --data 0xbeef \ 93 ${ADDR1} 94 # For informational and debugging purposes only, look for the 95 # characteristic error message 96 dmesg | grep "llinfo.*${SPOOF_ADDR}" --- 200 unchanged lines hidden (view full) --- 297{ 298 cleanup_tap 299} 300 301 302atf_init_test_cases() 303{ 304 atf_add_test_case arpresolve_checks_interface_fib |
305 atf_add_test_case loopback_and_network_routes_on_nondefault_fib 306 atf_add_test_case default_route_with_multiple_fibs_on_same_subnet 307 atf_add_test_case subnet_route_with_multiple_fibs_on_same_subnet | 305 atf_add_test_case loopback_and_network_routes_on_nondefault_fib 306 atf_add_test_case default_route_with_multiple_fibs_on_same_subnet 307 atf_add_test_case subnet_route_with_multiple_fibs_on_same_subnet |
308 atf_add_test_case udp_dontroute 309} 310 311# Looks up one or more fibs from the configuration data and validates them. 312# Returns the results in the env varilables FIB0, FIB1, etc. 313 314# parameter numfibs The number of fibs to lookup 315get_fibs() --- 56 unchanged lines hidden --- | 308 atf_add_test_case udp_dontroute 309} 310 311# Looks up one or more fibs from the configuration data and validates them. 312# Returns the results in the env varilables FIB0, FIB1, etc. 313 314# parameter numfibs The number of fibs to lookup 315get_fibs() --- 56 unchanged lines hidden --- |