1*32af08ecSBjoern A. Zeeb# $FreeBSD$ 2*32af08ecSBjoern A. Zeeb#- 3*32af08ecSBjoern A. Zeeb# SPDX-License-Identifier: BSD-2-Clause 4*32af08ecSBjoern A. Zeeb# 5*32af08ecSBjoern A. Zeeb# Copyright (c) 2019 Netflix, Inc. 6*32af08ecSBjoern A. Zeeb# 7*32af08ecSBjoern A. Zeeb# Redistribution and use in source and binary forms, with or without 8*32af08ecSBjoern A. Zeeb# modification, are permitted provided that the following conditions 9*32af08ecSBjoern A. Zeeb# are met: 10*32af08ecSBjoern A. Zeeb# 1. Redistributions of source code must retain the above copyright 11*32af08ecSBjoern A. Zeeb# notice, this list of conditions and the following disclaimer. 12*32af08ecSBjoern A. Zeeb# 2. Redistributions in binary form must reproduce the above copyright 13*32af08ecSBjoern A. Zeeb# notice, this list of conditions and the following disclaimer in the 14*32af08ecSBjoern A. Zeeb# documentation and/or other materials provided with the distribution. 15*32af08ecSBjoern A. Zeeb# 16*32af08ecSBjoern A. Zeeb# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 17*32af08ecSBjoern A. Zeeb# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18*32af08ecSBjoern A. Zeeb# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19*32af08ecSBjoern A. Zeeb# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 20*32af08ecSBjoern A. Zeeb# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21*32af08ecSBjoern A. Zeeb# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 22*32af08ecSBjoern A. Zeeb# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 23*32af08ecSBjoern A. Zeeb# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 24*32af08ecSBjoern A. Zeeb# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 25*32af08ecSBjoern A. Zeeb# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 26*32af08ecSBjoern A. Zeeb# SUCH DAMAGE. 27*32af08ecSBjoern A. Zeeb# 28*32af08ecSBjoern A. Zeeb 29*32af08ecSBjoern A. Zeeb. $(atf_get_srcdir)/../common/vnet.subr 30*32af08ecSBjoern A. Zeeb 31*32af08ecSBjoern A. Zeebatf_test_case "mldraw01" "cleanup" 32*32af08ecSBjoern A. Zeebmldraw01_head() { 33*32af08ecSBjoern A. Zeeb 34*32af08ecSBjoern A. Zeeb atf_set descr 'Test for correct Ethernet Destination MAC address' 35*32af08ecSBjoern A. Zeeb atf_set require.user root 36*32af08ecSBjoern A. Zeeb atf_set require.progs scapy 37*32af08ecSBjoern A. Zeeb} 38*32af08ecSBjoern A. Zeeb 39*32af08ecSBjoern A. Zeebmldraw01_body() { 40*32af08ecSBjoern A. Zeeb 41*32af08ecSBjoern A. Zeeb ids=65533 42*32af08ecSBjoern A. Zeeb id=`printf "%x" ${ids}` 43*32af08ecSBjoern A. Zeeb if [ $$ -gt 65535 ]; then 44*32af08ecSBjoern A. Zeeb xl=`printf "%x" $(($$ - 65535))` 45*32af08ecSBjoern A. Zeeb yl="1" 46*32af08ecSBjoern A. Zeeb else 47*32af08ecSBjoern A. Zeeb xl=`printf "%x" $$` 48*32af08ecSBjoern A. Zeeb yl="" 49*32af08ecSBjoern A. Zeeb fi 50*32af08ecSBjoern A. Zeeb 51*32af08ecSBjoern A. Zeeb vnet_init 52*32af08ecSBjoern A. Zeeb 53*32af08ecSBjoern A. Zeeb ip6a="2001:db8:6666:0000:${yl}:${id}:1:${xl}" 54*32af08ecSBjoern A. Zeeb ip6b="2001:db8:6666:0000:${yl}:${id}:2:${xl}" 55*32af08ecSBjoern A. Zeeb 56*32af08ecSBjoern A. Zeeb epair=$(vnet_mkepair) 57*32af08ecSBjoern A. Zeeb ifconfig ${epair}a up 58*32af08ecSBjoern A. Zeeb ifconfig ${epair}a inet6 ${ip6a}/64 59*32af08ecSBjoern A. Zeeb 60*32af08ecSBjoern A. Zeeb jname="v6t-${id}-${yl}-${xl}" 61*32af08ecSBjoern A. Zeeb vnet_mkjail ${jname} ${epair}b 62*32af08ecSBjoern A. Zeeb jexec ${jname} ifconfig ${epair}b up 63*32af08ecSBjoern A. Zeeb jexec ${jname} ifconfig ${epair}b inet6 ${ip6b}/64 64*32af08ecSBjoern A. Zeeb 65*32af08ecSBjoern A. Zeeb # Let IPv6 ND do its thing. 66*32af08ecSBjoern A. Zeeb #ping6 -q -c 1 ff02::1%${epair}a 67*32af08ecSBjoern A. Zeeb #ping6 -q -c 1 ${ip6b} 68*32af08ecSBjoern A. Zeeb sleep 3 69*32af08ecSBjoern A. Zeeb 70*32af08ecSBjoern A. Zeeb pyname=$(atf_get ident) 71*32af08ecSBjoern A. Zeeb 72*32af08ecSBjoern A. Zeeb atf_check -s exit:0 $(atf_get_srcdir)/mld.py \ 73*32af08ecSBjoern A. Zeeb --sendif ${epair}a --recvif ${epair}a \ 74*32af08ecSBjoern A. Zeeb --src ${ip6a} --to ${ip6b} \ 75*32af08ecSBjoern A. Zeeb --${pyname} 76*32af08ecSBjoern A. Zeeb} 77*32af08ecSBjoern A. Zeeb 78*32af08ecSBjoern A. Zeebmldraw01_cleanup() { 79*32af08ecSBjoern A. Zeeb 80*32af08ecSBjoern A. Zeeb vnet_cleanup 81*32af08ecSBjoern A. Zeeb} 82*32af08ecSBjoern A. Zeeb 83*32af08ecSBjoern A. Zeebatf_init_test_cases() 84*32af08ecSBjoern A. Zeeb{ 85*32af08ecSBjoern A. Zeeb 86*32af08ecSBjoern A. Zeeb atf_add_test_case "mldraw01" 87*32af08ecSBjoern A. Zeeb} 88*32af08ecSBjoern A. Zeeb 89*32af08ecSBjoern A. Zeeb# end 90