#-1# SPDX-License-Identifier: BSD-2-Clause2#3# Copyright (c) 2019 Netflix, Inc.4#5# Redistribution and use in source and binary forms, with or without6# modification, are permitted provided that the following conditions7# are met:8# 1. Redistributions of source code must retain the above copyright9# notice, this list of conditions and the following disclaimer.10# 2. Redistributions in binary form must reproduce the above copyright11# notice, this list of conditions and the following disclaimer in the12# documentation and/or other materials provided with the distribution.13#14# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND15# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE16# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE17# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE18# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL19# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS20# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)21# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT22# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY23# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF24# SUCH DAMAGE.25#2627. $(atf_get_srcdir)/../common/vnet.subr2829atf_test_case "mldraw01" "cleanup"30mldraw01_head() {3132atf_set descr 'Test for correct Ethernet Destination MAC address'33atf_set require.user root34atf_set require.progs python3 scapy35}3637mldraw01_body() {3839ids=6553340id=`printf "%x" ${ids}`41if [ $$ -gt 65535 ]; then42xl=`printf "%x" $(($$ - 65535))`43yl="1"44else45xl=`printf "%x" $$`46yl=""47fi4849vnet_init5051ip6a="2001:db8:6666:0000:${yl}:${id}:1:${xl}"52ip6b="2001:db8:6666:0000:${yl}:${id}:2:${xl}"5354epair=$(vnet_mkepair)55ifconfig ${epair}a up56ifconfig ${epair}a inet6 ${ip6a}/645758jname="v6t-${id}-${yl}-${xl}"59vnet_mkjail ${jname} ${epair}b60jexec ${jname} ifconfig ${epair}b up61jexec ${jname} ifconfig ${epair}b inet6 ${ip6b}/646263# Let IPv6 ND do its thing.64#ping6 -q -c 1 ff02::1%${epair}a65#ping6 -q -c 1 ${ip6b}66sleep 36768pyname=$(atf_get ident)6970atf_check -s exit:0 $(atf_get_srcdir)/mld.py \71--sendif ${epair}a --recvif ${epair}a \72--src ${ip6a} --to ${ip6b} \73--${pyname}74}7576mldraw01_cleanup() {7778vnet_cleanup79}8081atf_test_case "pr233683" "cleanup"82pr233683_head() {8384atf_set descr 'Test for PR233683'85atf_set require.user root86}8788pr233683_body() {89j="mld:pr233683"9091vnet_init9293epair=$(vnet_mkepair)9495vnet_mkjail ${j}a ${epair}a96jexec ${j}a ifconfig ${epair}a inet6 2001:db8::1/64 up97sleep 59899jexec ${j}a ifconfig ${epair}a inet6 2001:db8::1/64100101vnet_mkjail ${j}b ${epair}b102jexec ${j}b ifconfig ${epair}b inet6 2001:db8::2/64 up103104# Allow DAD to run105sleep 5106107# Debug output. If the bug is present we'd expect to not see a108# membership for ff02::1:ff00:1109jexec ${j}a ifmcstat -i ${epair}a110jexec ${j}a ifconfig ${epair}a111112atf_check -s exit:0 -o ignore \113jexec ${j}b ping -6 -c 1 2001:db8::1114}115116pr233683_cleanup() {117118vnet_cleanup119}120atf_init_test_cases()121{122123atf_add_test_case "mldraw01"124atf_add_test_case "pr233683"125}126127# end128129130