1#!/bin/sh
2# Copyright (c) 2015 Oracle and/or its affiliates. All Rights Reserved.
3# Copyright (c) International Business Machines  Corp., 2000
4#
5# This program is free software; you can redistribute it and/or
6# modify it under the terms of the GNU General Public License as
7# published by the Free Software Foundation; either version 2 of
8# the License, or (at your option) any later version.
9#
10# This program is distributed in the hope that it would be useful,
11# but WITHOUT ANY WARRANTY; without even the implied warranty of
12# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13# GNU General Public License for more details.
14#
15# You should have received a copy of the GNU General Public License
16# along with this program; if not, write the Free Software Foundation,
17# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
18#
19#  PURPOSE: To verify that three of the new options for level IPPROTO_IP
20#           Service Interface are initially set to the default values as
21#           defined in the documentation and that each of the new options
22#           can be set and read properly by the setsockopt and getsockopt
23#           routines, respectively.  To test boundary conditions and to
24#           generate errors while exercising the IP Multicast Service
25#           Interface options.
26#
27#
28# Robbie Williamson (robbiew@us.ibm.com)
29#  -Ported
30
31EXECUTABLES=${EXECUTABLES:-"mc_verify_opts mc_verify_opts_error"}
32TCID=mc_opts
33TST_TOTAL=1
34
35. test_net.sh
36
37COUNT=1
38while [ $COUNT -le 10 ]; do
39	# Run setsockopt/getsockopt test
40	tst_resm TINFO "Running $EXECUTABLES on $(tst_ipaddr)"
41	for i in $EXECUTABLES; do
42		$i $(tst_ipaddr) > /dev/null || \
43			tst_brkm TFAIL "$i $(tst_ipaddr) failed"
44	done
45
46	tst_resm TINFO "Running ping with bad values"
47	ping -T 777 224.0.0.1 > /dev/null 2>&1 && \
48		tst_brkm TFAIL "Multicast range should be out of range"
49
50	tst_resm TINFO "Running ping on a invalid interface!"
51	ping -I 3.3.3.3 224.0.0.1 > /dev/null 2>&1 && \
52		tst_brkm TFAIL "ping on bogus interface should fail"
53
54	COUNT=$(( $COUNT + 1 ))
55done
56
57tst_resm TPASS "Test Successful"
58tst_exit
59