1#! /bin/sh 2 3# Copyright (c) 2015-2017 Oracle and/or its affiliates. All Rights Reserved. 4# Copyright (c) International Business Machines Corp., 2000 5# 6# This program is free software; you can redistribute it and/or 7# modify it under the terms of the GNU General Public License as 8# published by the Free Software Foundation; either version 2 of 9# the License, or (at your option) any later version. 10# 11# This program is distributed in the hope that it would be useful, 12# but WITHOUT ANY WARRANTY; without even the implied warranty of 13# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14# GNU General Public License for more details. 15# 16# You should have received a copy of the GNU General Public License 17# along with this program; if not, write the Free Software Foundation, 18# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 19# 20# TEST DESCRIPTION : 21# To determine the stability of the IP Multicast product 22# and to verify the accuracy and usability of IP Multicast 23# related publications associated with changes and/or 24# additions to command level interfaces for this implementations 25# of IP Multicast. 26# 27# Robbie Williamson (robbiew@us.ibm.com) 28 29TCID=mc_cmds 30TST_TOTAL=1 31 32TST_USE_LEGACY_API=1 33. tst_net.sh 34 35knob="net.ipv4.icmp_echo_ignore_broadcasts" 36knob_changed= 37 38setup() 39{ 40 val=$(sysctl -n $knob) 41 if [ "$val" -ne 0 ]; then 42 ROD sysctl -q ${knob}=0 43 knob_changed=1 44 fi 45 tst_tmpdir 46} 47 48do_test() 49{ 50 local ip_fixed_version=170220 51 52 ip addr show $(tst_iface) | grep -q 'MULTICAST' || \ 53 tst_brkm TFAIL "Multicast not listed for $(tst_iface)" 54 55 ip maddr show $(tst_iface) | grep -q '224.0.0.1' 56 if [ $? -ne 0 ]; then 57 [ `ip -V | cut -d's' -f3` -lt $ip_fixed_version ] && \ 58 tst_resm TINFO "'ip maddr show $(tst_iface)' failed"\ 59 "(caused by old ip version, fixed in"\ 60 "$ip_fixed_version)" || \ 61 tst_resm TWARN "'ip maddr show $(tst_iface)' failed" 62 tst_resm TINFO "parsing 'ip maddr show' command" 63 ip maddr show | sed -ne "/\s$(tst_iface)/,/^[0-9]/p" | \ 64 grep -q 224.0.0.1 || \ 65 tst_brkm TFAIL "$(tst_iface) not joined 224.0.0.1" 66 fi 67 68 tst_resm TINFO "Ping all-host-groups over specified interface" 69 ping -c2 -I $(tst_ipaddr) 224.0.0.1 > ping_out.log 70 if [ $? -ne 0 ]; then 71 tst_resm TINFO "Trying to ping with $(tst_iface)"\ 72 "with the -I option instead of IP address" 73 ping -c2 -I $(tst_iface) 224.0.0.1 > ping_out.log || \ 74 tst_brkm TFAIL "No response from MC hosts to ping -c2 "\ 75 "-I $(tst_ipaddr) 224.0.0.1" 76 fi 77 78 grep -q $(tst_ipaddr) ping_out.log 79 if [ $? -ne 0 ]; then 80 cat ping_out.log 81 tst_brkm TFAIL "Local host did not respond to ping -c2 "\ 82 "-I $(tst_iface) 224.0.0.1" 83 fi 84 85 tst_resm TPASS "Test Successful" 86 tst_exit 87} 88 89do_cleanup() 90{ 91 [ "$knob_changed" ] && sysctl -q ${knob}=1 92 tst_rmdir 93} 94 95setup 96TST_CLEANUP=do_cleanup 97 98do_test 99