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 ([email protected]) 28 29TCID=mc_cmds 30TST_TOTAL=1 31TST_CLEANUP=do_cleanup 32TST_USE_LEGACY_API=1 33 34knob="net.ipv4.icmp_echo_ignore_broadcasts" 35knob_changed= 36 37setup() 38{ 39 val=$(sysctl -n $knob) 40 if [ "$val" -ne 0 ]; then 41 ROD sysctl -q ${knob}=0 42 knob_changed=1 43 fi 44 tst_tmpdir 45} 46 47do_test() 48{ 49 local ip_fixed_version=170220 50 51 ip addr show $(tst_iface) | grep -q 'MULTICAST' || \ 52 tst_brkm TFAIL "Multicast not listed for $(tst_iface)" 53 54 ip maddr show $(tst_iface) | grep -q '224.0.0.1' 55 if [ $? -ne 0 ]; then 56 [ `ip -V | cut -d's' -f3` -lt $ip_fixed_version ] && \ 57 tst_resm TINFO "'ip maddr show $(tst_iface)' failed"\ 58 "(caused by old ip version, fixed in"\ 59 "$ip_fixed_version)" || \ 60 tst_resm TWARN "'ip maddr show $(tst_iface)' failed" 61 tst_resm TINFO "parsing 'ip maddr show' command" 62 ip maddr show | sed -ne "/\s$(tst_iface)/,/^[0-9]/p" | \ 63 grep -q 224.0.0.1 || \ 64 tst_brkm TFAIL "$(tst_iface) not joined 224.0.0.1" 65 fi 66 67 tst_resm TINFO "Ping all-host-groups over specified interface" 68 ping -c2 -I $(tst_ipaddr) 224.0.0.1 > ping_out.log 69 if [ $? -ne 0 ]; then 70 tst_resm TINFO "Trying to ping with $(tst_iface)"\ 71 "with the -I option instead of IP address" 72 ping -c2 -I $(tst_iface) 224.0.0.1 > ping_out.log || \ 73 tst_brkm TFAIL "No response from MC hosts to ping -c2 "\ 74 "-I $(tst_ipaddr) 224.0.0.1" 75 fi 76 77 grep -q $(tst_ipaddr) ping_out.log 78 if [ $? -ne 0 ]; then 79 cat ping_out.log 80 tst_brkm TFAIL "Local host did not respond to ping -c2 "\ 81 "-I $(tst_iface) 224.0.0.1" 82 fi 83 84 tst_resm TPASS "Test Successful" 85 tst_exit 86} 87 88do_cleanup() 89{ 90 [ "$knob_changed" ] && sysctl -q ${knob}=1 91 tst_rmdir 92} 93 94. tst_net.sh 95setup 96do_test 97