xref: /freebsd/tests/sys/netinet/multicast.sh (revision 0849f1634a70099b90256ceece52a598eeb3280e)
1*0849f163SGleb Smirnoff#
2*0849f163SGleb Smirnoff# SPDX-License-Identifier: BSD-2-Clause
3*0849f163SGleb Smirnoff#
4*0849f163SGleb Smirnoff# Copyright (c) 2025 Gleb Smirnoff <glebius@FreeBSD.org>
5*0849f163SGleb Smirnoff#
6*0849f163SGleb Smirnoff# Redistribution and use in source and binary forms, with or without
7*0849f163SGleb Smirnoff# modification, are permitted provided that the following conditions
8*0849f163SGleb Smirnoff# are met:
9*0849f163SGleb Smirnoff# 1. Redistributions of source code must retain the above copyright
10*0849f163SGleb Smirnoff#    notice, this list of conditions and the following disclaimer.
11*0849f163SGleb Smirnoff# 2. Redistributions in binary form must reproduce the above copyright
12*0849f163SGleb Smirnoff#    notice, this list of conditions and the following disclaimer in the
13*0849f163SGleb Smirnoff#    documentation and/or other materials provided with the distribution.
14*0849f163SGleb Smirnoff#
15*0849f163SGleb Smirnoff# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16*0849f163SGleb Smirnoff# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17*0849f163SGleb Smirnoff# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18*0849f163SGleb Smirnoff# ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19*0849f163SGleb Smirnoff# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20*0849f163SGleb Smirnoff# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21*0849f163SGleb Smirnoff# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22*0849f163SGleb Smirnoff# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23*0849f163SGleb Smirnoff# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24*0849f163SGleb Smirnoff# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25*0849f163SGleb Smirnoff# SUCH DAMAGE.
26*0849f163SGleb Smirnoff
27*0849f163SGleb Smirnoff. $(atf_get_srcdir)/../common/vnet.subr
28*0849f163SGleb Smirnoff
29*0849f163SGleb Smirnoff# See regression fixed in baad45c9c12028964acd0b58096f3aaa0fb22859
30*0849f163SGleb Smirnoffatf_test_case "IP_MULTICAST_IF" "cleanup"
31*0849f163SGleb SmirnoffIP_MULTICAST_IF_head()
32*0849f163SGleb Smirnoff{
33*0849f163SGleb Smirnoff	atf_set descr \
34*0849f163SGleb Smirnoff	    'sendto() for IP_MULTICAST_IF socket does not do routing lookup'
35*0849f163SGleb Smirnoff	atf_set require.user root
36*0849f163SGleb Smirnoff
37*0849f163SGleb Smirnoff}
38*0849f163SGleb Smirnoff
39*0849f163SGleb SmirnoffIP_MULTICAST_IF_body()
40*0849f163SGleb Smirnoff{
41*0849f163SGleb Smirnoff	local epair mjail
42*0849f163SGleb Smirnoff
43*0849f163SGleb Smirnoff	vnet_init
44*0849f163SGleb Smirnoff	# The test doesn't use our half of epair
45*0849f163SGleb Smirnoff	epair=$(vnet_mkepair)
46*0849f163SGleb Smirnoff	vnet_mkjail mjail ${epair}a
47*0849f163SGleb Smirnoff	jexec mjail ifconfig ${epair}a up
48*0849f163SGleb Smirnoff	jexec mjail ifconfig ${epair}a 192.0.2.1/24
49*0849f163SGleb Smirnoff	atf_check -s exit:0 -o empty \
50*0849f163SGleb Smirnoff	    jexec mjail $(atf_get_srcdir)/sendto-IP_MULTICAST_IF 192.0.2.1
51*0849f163SGleb Smirnoff}
52*0849f163SGleb Smirnoff
53*0849f163SGleb SmirnoffIP_MULTICAST_IF_cleanup()
54*0849f163SGleb Smirnoff{
55*0849f163SGleb Smirnoff	vnet_cleanup
56*0849f163SGleb Smirnoff}
57*0849f163SGleb Smirnoff
58*0849f163SGleb Smirnoffatf_init_test_cases()
59*0849f163SGleb Smirnoff{
60*0849f163SGleb Smirnoff	atf_add_test_case "IP_MULTICAST_IF"
61*0849f163SGleb Smirnoff}
62