/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 4488458
* @summary IPv4 and IPv6 multicasting broken on Linux
*/
public class Test {
boolean failed = false;
count++;
try {
for (int i=0; i<2; i++) {
/* packets should be received */
for (int j=0; j<2; j++) {
p.setAddress(ia);
try {
} catch (SocketTimeoutException e) {
failed = true;
}
}
/*
* If there are multiple interface we might be a couple of
* copies still in our queue
*/
try {
while (true) {
}
} catch (SocketTimeoutException e) { }
/* packets should not be received */
p.setAddress(ia);
try {
failed = true;
} catch (SocketTimeoutException e) {
}
}
} catch (IOException ioe) {
failed = true;
}
if (failed) {
failures++;
} else {
}
}
/*
* Assume machine has IPv4 address
*/
doTest("224.80.80.80");
/*
* Check if IPv6 is enabled and the scope of the addresses
*/
boolean has_ipv6 = false;
boolean has_siteaddress = false;
boolean has_linklocaladdress = false;
boolean has_globaladdress = false;
while (nifs.hasMoreElements()) {
while (addrs.hasMoreElements()) {
if (ia instanceof Inet6Address) {
has_ipv6 = true;
if (!ia.isLinkLocalAddress() &&
!ia.isSiteLocalAddress() &&
!ia.isLoopbackAddress()) {
has_globaladdress = true;
}
}
}
}
/*
* If IPv6 is enabled perform multicast tests with various scopes
*/
if (has_ipv6) {
doTest("ff01::a");
}
if (has_linklocaladdress) {
doTest("ff02::a");
}
if (has_siteaddress) {
doTest("ff05::a");
}
if (has_globaladdress) {
doTest("ff0e::a");
}
}
t.allTests();
} else {
}
}
" test(s) failed.");
if (failures > 0) {
throw new Exception("Test failed - see log file for details");
}
}
}