routing_test.sh revision 300882
116663Sjkh# 25531Sjkh# Copyright (c) 2014 Spectra Logic Corporation 35388Sache# All rights reserved. 45345Sbde# 55345Sbde# Redistribution and use in source and binary forms, with or without 613973Smpp# modification, are permitted provided that the following conditions 75345Sbde# are met: 85429Sache# 1. Redistributions of source code must retain the above copyright 95429Sache# notice, this list of conditions, and the following disclaimer, 109725Swollman# without modification. 115345Sbde# 2. Redistributions in binary form must reproduce at minimum a disclaimer 125382Sache# substantially similar to the "NO WARRANTY" disclaimer below 135380Sache# ("Disclaimer") and any redistribution must be conditioned upon 145382Sache# including a substantially similar Disclaimer requirement for further 155345Sbde# binary redistribution. 165382Sache# 175382Sache# NO WARRANTY 189725Swollman# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 199725Swollman# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 2016663Sjkh# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR 219725Swollman# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 229725Swollman# HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 2316663Sjkh# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 249725Swollman# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 255382Sache# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 269734Swollman# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 279725Swollman# IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 289725Swollman# POSSIBILITY OF SUCH DAMAGES. 299725Swollman# 309734Swollman# Authors: Alan Somers (Spectra Logic Corporation) 319725Swollman# 329725Swollman# $FreeBSD: head/tests/etc/rc.d/routing_test.sh 300882 2016-05-27 22:40:40Z asomers $ 336309Sphk 345585Sjkhatf_test_case static_ipv4_loopback_route_for_each_fib cleanup 356309Sphkstatic_ipv4_loopback_route_for_each_fib_head() 366309Sphk{ 376309Sphk atf_set "descr" "Every FIB should have a static IPv4 loopback route" 386309Sphk} 395531Sjkhstatic_ipv4_loopback_route_for_each_fib_body() 4016663Sjkh{ 416716Sphk local nfibs fib 425531Sjkh nfibs=`sysctl -n net.fibs` 435531Sjkh 445380Sache # Check for an IPv4 loopback route 455382Sache for fib in `seq 0 $((${nfibs} - 1))`; do 465382Sache atf_check -o match:"interface: lo0" -s exit:0 \ 475380Sache setfib -F ${fib} route -4 get 127.0.0.1 485345Sbde done 4916663Sjkh} 505813Sjkh 515345Sbdeatf_test_case static_ipv6_loopback_route_for_each_fib cleanup 5216663Sjkhstatic_ipv6_loopback_route_for_each_fib_head() 5314410Swosch{ 545380Sache atf_set "descr" "Every FIB should have a static IPv6 loopback route" 5516663Sjkh} 565380Sachestatic_ipv6_loopback_route_for_each_fib_body() 575380Sache{ 585380Sache local nfibs fib 595380Sache nfibs=`sysctl -n net.fibs` 605380Sache 615380Sache # Check for an IPv6 loopback route 625380Sache for fib in `seq 0 $((${nfibs} - 1))`; do 635380Sache atf_check -o match:"interface: lo0" -s exit:0 \ 645380Sache setfib -F ${fib} route -6 get ::1 659725Swollman done 665380Sache} 676985Srgrimes 6816663Sjkhatf_init_test_cases() 6916663Sjkh{ 706985Srgrimes atf_add_test_case static_ipv4_loopback_route_for_each_fib 7116663Sjkh atf_add_test_case static_ipv6_loopback_route_for_each_fib 7216663Sjkh} 73 74