#!/usr/bin/perl
#
# Copyright (C) 1999, 2000, 2001, 2002, 2003 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/HL_ZeroToRouter.seq,v 1.23 2003/04/23 12:44:27 ozoe Exp $
#
######################################################################
BEGIN {
$V6evalTool::TestVersion = '$Name: REL_2_1_1 $';
}
use V6evalTool;
if ($V6evalTool::NutDef{Type} ne 'router') {
vLogHTML("This test is for the router only
");
exit $V6evalTool::exitRouterOnly;
}
%pktdesc = (
echo_request_to_link0 => 'Send Echo Request to Link0 (Hop Limit 0)',
icmp_type3_code0 => 'Recv ICMP Error at Link0 (Time Exceeded, hop limit exceeded in transit)',
icmp_type3_code0_link1 => 'Recv ICMP Error at Link1 (Time Exceeded, hop limit exceeded in transit)',
ns_from_link0 => 'Recv Neighbor Solicitation from Link0 (Global Address)',
na_to_link0 => 'Send Neighbor Advertisement to Link0 (Global Address)',
);
$IF0 = Link0;
vCapture($IF0);
vSend($IF0, echo_request_to_link0);
%ret = vRecv($IF0, 5, 0, 0, ns_from_link0, icmp_type3_code0, icmp_type3_code0_link1);
if ($ret{status} != 0) {
vLogHTML('NG');
exit $V6evalTool::exitFail;
}
if ($ret{recvFrame} eq 'ns_from_link0') {
vSend($IF0, na_to_link0);
%ret = vRecv($IF0, 5, 0, 0, icmp_type3_code0, icmp_type3_code0_link1);
if ($ret{status} != 0) {
vLogHTML('NG');
exit $V6evalTool::exitFail;
}
}
if ($ret{recvFrame} eq 'icmp_type3_code0') {
vLogHTML('OK');
exit $V6evalTool::exitPass;
}
if ($ret{recvFrame} eq 'icmp_type3_code0_link1') {
vLogHTML('OK');
exit $V6evalTool::exitPass;
}
vLogHTML('NG');
exit $V6evalTool::exitFail;
######################################################################
__END__
=head1 NAME
HL_ZeroToRouter - check Hop Limit 0 to Router
=head1 TARGET
Router
=head1 SYNOPSIS
=begin html
HL_ZeroToRouter.seq [-tooloption ...] -pkt HL_ZeroToRouter.def -tooloption : v6eval tool option See also IH_Router.def=end html =head1 INITIALIZATION None =head1 TEST PROCEDURE Tester Target Tester (Link0) (Link1) | | | |-------------------------->| | | Echo Request to Link0 | | | | (no forwarding) | | | | |<--------------------------| | | Neighbor Solicitation | | | | | |-------------------------->| | | Neighbor Advertisement | | | | | |<--------------------------| | | ICMP Error at Link0 | | | or | | | ICMP Error at Link1 | | | | | v v v 1. Send Echo Request to Link0 2. Wait ICMP Error or NS from Link0 3. If NS received then send NA to Link0, and wait ICMP Error again 4. Receive ICMP Error Echo Request to Link0 Data is: IPv6 Header Version = 6 Traffic Class = 0 FlowLabel = 0 PayloadLength = 16 NextHeader = 58 (ICMP) HopLimit = 0 SourceAddress = Tester Global Address (Link0) DestinationAddress = Tester Global Address (Link1) ICMP Echo Request Type = 128 (Echo Request) Code = 0 Checksum = (auto) Identifier = 0xffff SequenceNumber = 1 PayloadData = {1,2,3,4,5,6,7,8} =head1 JUDGMENT PASS: ICMP Error at Link0 Received IPv6 Header Version = 6 Traffic Class = 0 FlowLabel = 0 PayloadLength = 16 NextHeader = 58 (ICMP) SourceAddress = Target Global Address (Link0) DestinationAddress = Tester Global Address (Link0) ICMP Error Type = 3 (Time Exceeded) Code = 0 (hop limit exceeded in transit) Checksum = (auto) PayloadData = (Echo Request) PASS: ICMP Error at Link1 Received IPv6 Header Version = 6 Traffic Class = 0 FlowLabel = 0 PayloadLength = 16 NextHeader = 58 (ICMP) SourceAddress = Target Global Address (Link1) DestinationAddress = Tester Global Address (Link0) ICMP Error Type = 3 (Time Exceeded) Code = 0 (hop limit exceeded in transit) Checksum = (auto) PayloadData = (Echo Request) =head1 REFERENCE RFC2460 3. IPv6 Header Format Hop Limit 8-bit unsigned integer. Decremented by 1 by each node that forwards the packet. The packet RFC2463 3.3 Time Exceeded Message ICMPv6 Fields: Type 3 Code 0 - hop limit exceeded in transit Description =begin html
If a router receives a packet with a Hop Limit of zero, or a router decrements a packet's Hop Limit to zero, it MUST discard the packet and send an ICMPv6 Time Exceeded message with Code 0 to the source of the packet. This indicates either a routing loop or too small an initial Hop Limit value.=end html =head1 SEE ALSO perldoc V6evalTool =cut