#!/usr/bin/perl
#
# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005 Yokogawa Electric Corporation,
# IPA (Information-technology Promotion Agency, Japan).
# All rights reserved.
#
# Redistribution and use of this software in source and binary forms, with
# or without modification, are permitted provided that the following
# conditions and disclaimer are agreed and accepted by the user:
#
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# 3. Neither the names of the copyrighters, the name of the project which
# is related to this software (hereinafter referred to as "project") nor
# the names of the contributors may be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# 4. No merchantable use may be permitted without prior written
# notification to the copyrighters. However, using this software for the
# purpose of testing or evaluating any products including merchantable
# products may be permitted without any notification to the copyrighters.
#
#
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHTERS, THE PROJECT AND
# CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING
# BUT NOT LIMITED THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
# FOR A PARTICULAR PURPOSE, ARE DISCLAIMED. IN NO EVENT SHALL THE
# COPYRIGHTERS, THE PROJECT OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
# INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT,STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
# THE POSSIBILITY OF SUCH DAMAGE.
#
# $TAHI: ct/spec/RH_BadHdrExtLen.seq,v 1.6 2001/10/05 06:39:18 masaxmasa Exp $
#
######################################################################
BEGIN {
$V6evalTool::TestVersion = '$Name: REL_2_1_2 $';
}
use V6evalTool;
if($V6evalTool::NutDef{Type} ne 'router') {
vLogHTML("This test is for the router only
");
exit $V6evalTool::exitRouterOnly;
}
%pktdesc = (
echo_request_on_link0 => 'Send Echo Request (Link0)',
echo_request_on_link1 => 'Recv Echo Request (Link1)',
echo_request_off_link0 => 'Recv Echo Request (from Link0 to Link1) (Link0)',
echo_request_off_link1 => 'Recv Echo Request (from Link0 to Link1) (Link1)',
echo_request_ex_to_link0 => 'Send Echo Request (Routing Header) (Link0)',
echo_request_ex_to_link1 => 'Recv Echo Request (Routing Header) (Link1)',
echo_request_badex_to_link0 => 'Send Echo Request (Routing Header with bad Hdr Ext Len) (Link0)',
echo_reply_on_link0 => 'Recv Echo Reply (Link0)',
echo_reply_on_link1 => 'Recv Echo Reply (Link1)',
unicast_ns_global_link0 => 'Recv Multicast Neighbor Solicitation - global (Link0)',
multicast_ns_global_link0 => 'Recv Multicast Neighbor Solicitation - global (Link0)',
multicast_ns_global_link1 => 'Recv Multicast Neighbor Solicitation - global (Link1)',
multicast_ns_linklocal_link0 => 'Recv Multicast Neighbor Solicitation - link-local (Link0)',
multicast_ns_linklocal_link1 => 'Recv Multicast Neighbor Solicitation - link-local (Link1)',
na_global_link0 => 'Send Neighbor Advertisement - global (Link0)',
na_global_link1 => 'Send Neighbor Advertisement - global (Link1)',
na_linklocal_link0 => 'Send Neighbor Advertisement - link-local (Link0)',
na_linklocal_link1 => 'Send Neighbor Advertisement - link-local (Link1)',
);
######################################################################
$IF0 = Link0;
$IF1 = Link1;
vCapture($IF0);
vCapture($IF1);
vLogHTML(' -- Test Preparation (Link0) --');
vSend($IF0, echo_request_on_link0);
%ret = vRecv($IF0, 5, 0, 0, multicast_ns_global_link0, multicast_ns_linklocal_link0, unicast_ns_global_link0, echo_reply_on_link0);
if($ret{status} != 0) {
vLogHTML('No response from NUT (Link0)
');
goto fail;
}
if($ret{recvFrame} eq 'multicast_ns_global_link0') {
vSend($IF0, na_global_link0);
%ret = vRecv($IF0, 5, 0, 0, echo_reply_on_link0);
if($ret{status} != 0) {
vLogHTML('Cannot receive Echo Reply (Link0)
');
goto fail;
}
}
if($ret{recvFrame} eq 'multicast_ns_linklocal_link0') {
vSend($IF0, na_linklocal_link0);
%ret = vRecv($IF0, 5, 0, 0, echo_reply_on_link0);
if($ret{status} != 0) {
vLogHTML('Cannot receive Echo Reply (Link0)
');
goto fail;
}
}
if($ret{recvFrame} eq 'unicast_ns_global_link0') {
vSend($IF0, na_global_link0);
%ret = vRecv($IF0, 5, 0, 0, echo_reply_on_link0);
if($ret{status} != 0) {
vLogHTML('Cannot receive Echo Reply (Link0)
');
goto fail;
}
}
if($ret{recvFrame} eq 'echo_reply_on_link0') {
vLogHTML('Receive Echo Reply (Link0)
');
vLogHTML('OK');
}
######################################################################
vClear($IF0);
vClear($IF1);
vLogHTML(' -- Test Preparation (Link1) --');
vSend($IF1, echo_request_on_link1);
%ret = vRecv($IF1, 5, 0, 0, multicast_ns_global_link1, multicast_ns_linklocal_link1, unicast_ns_global_link1, echo_reply_on_link1);
if($ret{status} != 0) {
vLogHTML('No response from NUT (Link1)
');
goto fail;
}
if($ret{recvFrame} eq 'multicast_ns_global_link1') {
vSend($IF1, na_global_link1);
%ret = vRecv($IF1, 5, 0, 0, echo_reply_on_link1);
if($ret{status} != 0) {
vLogHTML('Cannot receive Echo Reply (Link1)
');
goto fail;
}
}
if($ret{recvFrame} eq 'multicast_ns_linklocal_link1') {
vSend($IF1, na_linklocal_link1);
%ret = vRecv($IF1, 5, 0, 0, echo_reply_on_link1);
if($ret{status} != 0) {
vLogHTML('Cannot receive Echo Reply (Link1)
');
goto fail;
}
}
if($ret{recvFrame} eq 'unicast_ns_global_link1') {
vSend($IF1, na_global_link1);
%ret = vRecv($IF1, 5, 0, 0, echo_reply_on_link1);
if($ret{status} != 0) {
vLogHTML('Cannot receive Echo Reply (Link1)
');
goto fail;
}
}
if($ret{recvFrame} eq 'echo_reply_on_link1') {
vLogHTML('Receive Echo Reply (Link1)
');
vLogHTML('OK');
}
######################################################################
vSend($IF0, na_global_link0);
vLogHTML('Make NCE certainly (Link0)');
vSend($IF1, na_global_link1);
vLogHTML('Make NCE certainly (Link1)');
vClear($IF0);
vClear($IF1);
vLogHTML(' -- Test Preparation (ICMPv6 Echo) --');
vSend($IF0, echo_request_off_link0);
%ret = vRecv($IF1, 5, 0, 0, echo_request_off_link1);
if($ret{status} != 0) {
vLogHTML('No response from NUT (Link1)
');
goto fail;
}
if($ret{recvFrame} eq 'echo_request_off_link1') {
vLogHTML('Receive Echo Request (Link1)
');
vLogHTML('OK');
}
######################################################################
vSend($IF0, na_global_link0);
vLogHTML('Make NCE certainly (Link0)');
vSend($IF1, na_global_link1);
vLogHTML('Make NCE certainly (Link1)');
vClear($IF0);
vClear($IF1);
vLogHTML(' -- Test Preparation (ICMPv6 Echo, Routing Header) --');
vSend($IF0, echo_request_ex_to_link0);
%ret = vRecv($IF1, 5, 0, 0, echo_request_ex_to_link1);
if($ret{status} != 0) {
vLogHTML('No response from NUT (Link1)
');
goto fail;
}
if($ret{recvFrame} eq 'echo_request_ex_to_link1') {
vLogHTML('Receive Echo Request (Link1)
');
vLogHTML('OK');
}
######################################################################
vSend($IF0, na_global_link0);
vLogHTML('Make NCE certainly (Link0)');
vSend($IF1, na_global_link1);
vLogHTML('Make NCE certainly (Link1)');
vClear($IF0);
vClear($IF1);
vLogHTML(' -- Test --');
vSend($IF0, echo_request_badex_to_link0);
vRecv($IF1, 5, 0, 0);
######################################################################
vSend($IF0, na_global_link0);
vLogHTML('Make NCE certainly (Link0)');
vSend($IF1, na_global_link1);
vLogHTML('Make NCE certainly (Link1)');
vClear($IF0);
vClear($IF1);
vLogHTML(' -- Check --');
vSend($IF0, echo_request_off_link0);
%ret = vRecv($IF1, 5, 0, 0, echo_request_off_link1);
if($ret{status} != 0) {
vLogHTML('No response from NUT (Link1)
');
goto fail;
}
if($ret{recvFrame} eq 'echo_request_off_link1') {
vLogHTML('Receive Echo Request (Link1)
');
goto pass;
}
goto fail;
######################################################################
pass:
vLogHTML('OK');
exit $V6evalTool::exitPass;
fail:
vLogHTML('NG');
exit $V6evalTool::exitFail;
######################################################################
__END__
=head1 NAME
RH_BadHdrExtLen - Bad Hdr Ext Len in Routing Header
=head1 TARGET
Router
=head1 SYNOPSIS
=begin html
RH_BadHdrExtLen.seq [-tooloption ...] -pkt RH_BadHdrExtLen.def
-tooloption : v6eval tool option
=end html
=head1 INITIALIZATION
1. Check Link0 Global Address Reachability
2. Check Link1 Global Address Reachability
3. Check Global Address Reachability (from Link0 to Link1)
4. Check support of Routing Header
=head1 TEST PROCEDURE
1. Send bad Echo Request (Link0)
2. Wait 5 sec.
3. Send Echo Request (Link0)
4. If NS received then send NA, and wait Echo Reply again (Link1)
5. Receive Echo Request (Link1)
Test Topology is:
H2
|
Link3 ---------+---------+---------- 3ffe:501:ffff:103::/64
|
R3
|
Link2 ---------+---------+---------- 3ffe:501:ffff:102::/64
|
R2(TN)
|
Link1 ---------+---------+---------- 3ffe:501:ffff:101::/64
|
R1(NUT)
|
Link0 ---------+---------+---------- 3ffe:501:ffff:100::/64
|
H1 (TN)
Bad Echo Request Data is:
IPv6 Header
Version = 6
Traffic Class = 0
FlowLabel = 0
PayloadLength = 72
NextHeader = 43 (Routing Header)
HopLimit = 64
SourceAddress = H1 - Tester Global Address (Link0)
DestinationAddress = R1 (Link0) - Target Global Address (Link0)
Routing Header
NextHeader = 58 (ICMPv6)
HeaderExtLength = 100 (It' bad. True value is 6.)
RoutingType = 0
SegmentsLeft = 3
Reserved = 0
Address = R2 (Link1) - Tester Global Address (Link1)
Address = R3 (Link2)
Address = H2
ICMPv6 Echo Request
Type = 128 (Echo Request)
Code = 0
Checksum = (auto)
Identifier = 0
SequenceNumber = 0
PayloadData = {1, 2, 3, 4, 5, 6, 7, 8}
=head1 JUDGMENT
PASS : echo reply packet received.
FAIL : don't received echo reply packet.
=head1 SEE ALSO
perldoc V6evalTool
=cut