17afb8adfSEnji Cooper# 27afb8adfSEnji Cooper# Copyright (c) 2014 Spectra Logic Corporation 37afb8adfSEnji Cooper# All rights reserved. 47afb8adfSEnji Cooper# 57afb8adfSEnji Cooper# Redistribution and use in source and binary forms, with or without 67afb8adfSEnji Cooper# modification, are permitted provided that the following conditions 77afb8adfSEnji Cooper# are met: 87afb8adfSEnji Cooper# 1. Redistributions of source code must retain the above copyright 97afb8adfSEnji Cooper# notice, this list of conditions, and the following disclaimer, 107afb8adfSEnji Cooper# without modification. 117afb8adfSEnji Cooper# 2. Redistributions in binary form must reproduce at minimum a disclaimer 127afb8adfSEnji Cooper# substantially similar to the "NO WARRANTY" disclaimer below 137afb8adfSEnji Cooper# ("Disclaimer") and any redistribution must be conditioned upon 147afb8adfSEnji Cooper# including a substantially similar Disclaimer requirement for further 157afb8adfSEnji Cooper# binary redistribution. 167afb8adfSEnji Cooper# 177afb8adfSEnji Cooper# NO WARRANTY 187afb8adfSEnji Cooper# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 197afb8adfSEnji Cooper# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 207afb8adfSEnji Cooper# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR 217afb8adfSEnji Cooper# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 227afb8adfSEnji Cooper# HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 237afb8adfSEnji Cooper# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 247afb8adfSEnji Cooper# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 257afb8adfSEnji Cooper# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 267afb8adfSEnji Cooper# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 277afb8adfSEnji Cooper# IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 287afb8adfSEnji Cooper# POSSIBILITY OF SUCH DAMAGES. 297afb8adfSEnji Cooper# 307afb8adfSEnji Cooper# Authors: Alan Somers (Spectra Logic Corporation) 317afb8adfSEnji Cooper# 327afb8adfSEnji Cooper# $FreeBSD$ 337afb8adfSEnji Cooper 3430da6877SAlan Somersatf_test_case static_ipv4_loopback_route_for_each_fib cleanup 3530da6877SAlan Somersstatic_ipv4_loopback_route_for_each_fib_head() 3630da6877SAlan Somers{ 3730da6877SAlan Somers atf_set "descr" "Every FIB should have a static IPv4 loopback route" 3830da6877SAlan Somers} 3930da6877SAlan Somersstatic_ipv4_loopback_route_for_each_fib_body() 4030da6877SAlan Somers{ 4130da6877SAlan Somers local nfibs fib 4230da6877SAlan Somers nfibs=`sysctl -n net.fibs` 4330da6877SAlan Somers 4430da6877SAlan Somers # Check for an IPv4 loopback route 4530da6877SAlan Somers for fib in `seq 0 $((${nfibs} - 1))`; do 4630da6877SAlan Somers atf_check -o match:"interface: lo0" -s exit:0 \ 4730da6877SAlan Somers setfib -F ${fib} route -4 get 127.0.0.1 4830da6877SAlan Somers done 4930da6877SAlan Somers} 5030da6877SAlan Somers 517afb8adfSEnji Cooperatf_test_case static_ipv6_loopback_route_for_each_fib cleanup 527afb8adfSEnji Cooperstatic_ipv6_loopback_route_for_each_fib_head() 537afb8adfSEnji Cooper{ 547afb8adfSEnji Cooper atf_set "descr" "Every FIB should have a static IPv6 loopback route" 557afb8adfSEnji Cooper} 567afb8adfSEnji Cooperstatic_ipv6_loopback_route_for_each_fib_body() 577afb8adfSEnji Cooper{ 5830da6877SAlan Somers local nfibs fib 5930da6877SAlan Somers nfibs=`sysctl -n net.fibs` 607afb8adfSEnji Cooper 61*3a970562SRuslan Bukin if [ "`sysctl -in kern.features.inet6`" != "1" ]; then 62*3a970562SRuslan Bukin atf_skip "This test requires IPv6 support" 63*3a970562SRuslan Bukin fi 64*3a970562SRuslan Bukin 657afb8adfSEnji Cooper # Check for an IPv6 loopback route 6630da6877SAlan Somers for fib in `seq 0 $((${nfibs} - 1))`; do 6730da6877SAlan Somers atf_check -o match:"interface: lo0" -s exit:0 \ 6830da6877SAlan Somers setfib -F ${fib} route -6 get ::1 6930da6877SAlan Somers done 707afb8adfSEnji Cooper} 717afb8adfSEnji Cooper 727afb8adfSEnji Cooperatf_init_test_cases() 737afb8adfSEnji Cooper{ 7430da6877SAlan Somers atf_add_test_case static_ipv4_loopback_route_for_each_fib 757afb8adfSEnji Cooper atf_add_test_case static_ipv6_loopback_route_for_each_fib 767afb8adfSEnji Cooper} 777afb8adfSEnji Cooper 78