#!/usr/bin/perl
#
# Copyright (C) 2003, 2004, 2005 Yokogawa Electric Corporation,
# INTAP(Interoperability Technology Association
# for Information Processing, 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/pd/RRAdvertisedStatusCode.seq,v 1.4 2003/06/11 09:31:13 ozoe Exp $
#
######################################################################
BEGIN { $V6evalTool::TestVersion = '$Name: REL_2_1_2 $ '; }
use V6evalTool;
use pd;
%pktdesc = (
echo_request => 'Send Echo Request (Link-Local Address)',
echo_reply => 'Recv Echo Reply (Link-Local Address)',
ns => 'Recv Neighbor Solicitation',
ns_other => 'Recv Neighbor Solicitation to other Server',
na => 'Send Neighbor Advertisement',
dhcp_sol => 'Recv DHCP Solicit message w/o Option Request option',
dhcp_sol_any => 'Recv DHCP Solicit message',
dhcp_adv_status => 'Send DHCP Advertise message w/ Status Code option (NoPrefixAvail)',
dhcp_adv_other => 'Send DHCP Advertise message from other Server',
dhcp_req => 'Recv DHCP Request message w/o Option Request option',
dhcp_req_any => 'Recv DHCP Request message',
dhcp_req_any1 => 'Recv DHCP Request message w/o Option Request and IA_PD prefix option',
dhcp_req_any2 => 'Recv DHCP Request message w/o IA_PD prefix option',
dhcp_req_other => 'Recv DHCP Request message sending to other Server w/o Option Request option',
dhcp_req_any_other => 'Recv DHCP Request message sending to other Server',
dhcp_req_any1_other => 'Recv DHCP Request message sending to other Server w/o Option Request and IA_PD prefix option',
dhcp_req_any2_other => 'Recv DHCP Request message sending to other Server w/o IA_PD prefix option',
dhcp_rep_other => 'Send DHCP Reply message from other Server',
);
pdOptions(@ARGV);
# The following generate debugging messages.
$pd::debug=$pdOpt_v|$pdOpt_vv;
# You can specifies debug options to a remote control program.
# If you want to know more detail, please see the following:
# - V6evalTool.pm: perldoc V6evalTool
# - V6evalRemote.pm: perldoc V6evalRemote
$pd::remote_debug="-o1" if $pdOpt_vv;
#
#
$IF = Link0;
$IF1 = Link1;
$exit_rtn=$V6evalTool::exitPass;
$idx=0;
$wait_ras=$pd::MIN_DELAY_BETWEEN_RAS+1;
#
#
$delegateprefix="3ffe:501:fffc::";
$preferredlifetime="600";
$validlifetime="1200";
#
$wait_time=16;
$maxcount = 4;
# time is Jan 1, 2000 (UTC), modulo 2^32
$t64 = time() - 946684800;
foreach($count = 0; $count < $maxcount; $count++){
$sid_duid_time[$count] = ($t64 & 0xffffffff);
$t64 = $t64 + 86400; #1 day after
}
@sid_link_addr = (
"00:00:00:00:a0:a0",
"00:00:00:00:a1:a1",
"00:00:00:00:a2:a2",
"00:00:00:00:a3:a3",
);
#
#
#
$type=$V6evalTool::NutDef{Type};
if($type eq host) {
vLogHTML("This test is for the router only
");
exit $V6evalTool::exitRouterOnly;
}
$type=$V6evalTool::NutDef{Type};
if($type ne router) {
vLogHTML(pdErrmsg("ERROR: $V6evalTool::NutDef{Type}: ".
"Unknown target type
"));
exit $V6evalTool::exitFail;
}
#
#
#
vLogHTML("Initialization
");
vLogHTML("Trying to setup NUT
");
pdStartDefaultRA() || exit $V6evalTool::exitFail;
pdStopDHCP6Client() || exit $V6evalTool::exitFail;
$vcpp = pdSetVCPP($pd::INITIAL, $delegateprefix, 0, 0,
$maxcount, @sid_duid_time, @sid_link_addr, %ret);
vCPP($vcpp);
#
pdStartDHCP6Client() || exit $V6evalTool::exitFail;
#
vCapture($IF);
#
#
%ret = vRecv($IF, $wait_time, 0, 0, dhcp_sol, dhcp_sol_any);
if($ret{status} != 0) {
vLogHTML('No response from NUT, Configuration Problem ?
');
vLogHTML('NG');
pdAsyncWait() || exit $V6evalTool::exitFatal;
exit $V6evalTool::exitFail;
}
if($ret{status} == 0) {
vLogHTML("OK: Receive DHCP Solicit message
");
$vcpp = pdSetVCPP($pd::SOLICIT, $delegateprefix, $preferredlifetime, $validlifetime,
$maxcount, @sid_duid_time, @sid_link_addr, %ret);
vCPP($vcpp);
vLogHTML("Test
");
vLogHTML("Receipt of Advertise Messages
");
vSend($IF, dhcp_adv_status);
%ret = vRecv($IF, $wait_time/2, 0, 0, dhcp_sol, dhcp_sol_any,
dhcp_req, dhcp_req_any, dhcp_req_any1, dhcp_req_any2);
if ($ret{recvFrame} eq 'dhcp_sol' ||
$ret{recvFrame} eq 'dhcp_sol_any'){
$title{$idx}="
$pktdesc{'dhcp_sol'} | exp:ignore received DHCP Advertise message, and sending DHCP Solicit message | ";
$title{$idx}.="result:sent DHCP Solicit message | ";
$result{$idx}=$V6evalTool::exitPass;
vLogHTML("OK: NUT ignore previous DHCP advertise message.
");
$idx++;
}
elsif ($ret{recvFrame} eq 'dhcp_req' || $ret{recvFrame} eq 'dhcp_req_any' ||
$ret{recvFrame} eq 'dhcp_req_any1'|| $ret{recvFrame} eq 'dhcp_req_any2'){
vLogHTML('Received DHCP Request message
');
vLogHTML('NUT MUST ignore DHCP Adv message include NoPrefixAvail Status Code Option
');
vLogHTML('NG');
pdAsyncWait() || exit $V6evalTool::exitFatal;
exit $V6evalTool::exitFail;
}
else{
vLogHTML('unknown packet received
');
pdAsyncWait() || exit $V6evalTool::exitFatal;
exit $V6evalTool::exitFail;
}
$vcpp = pdSetVCPP($pd::SOLICIT, $delegateprefix, $preferredlifetime, $validlifetime,
$maxcount, @sid_duid_time, @sid_link_addr, %ret);
vCPP($vcpp);
vSend($IF, dhcp_adv_other);
%ret = vRecv($IF, $wait_time/2, 0, ns_other, dhcp_req_other, dhcp_req_any_other,
dhcp_req_any1_other, dhcp_req_any2_other);
if ($ret{recvFrame} eq 'ns_other') {
vSend($IF, na_other);
%ret = vRecv($IF, 5, 0, dhcp_req_other, dhcp_req_any_other,
dhcp_req_any1_other, dhcp_req_any2_other);
}
$title{$idx}="$pktdesc{'dhcp_req_other'} | exp:sending DHCP Request message | ";
if ($ret{status} == 0) {
$title{$idx}.="result:sent DHCP Requet message | ";
$result{$idx}=$V6evalTool::exitPass;
vLogHTML("OK
");
}
else{
vLogHTML('Cannot receive DHCP Request message
');
vLogHTML('NG');
pdAsyncWait() || exit $V6evalTool::exitFatal;
exit $V6evalTool::exitFail;
}
$vcpp = pdSetVCPP($pd::REQUEST, $delegateprefix, $preferredlifetime, $validlifetime,
$maxcount, @sid_duid_time, @sid_link_addr, %ret);
vCPP($vcpp);
vSend($IF, dhcp_rep_other);
%ret = vRecv($IF, $wait_time/2, 0, ns_other);
if($ret{status} == 0) {
vSend($IF, na_other);
}
}
else{
vLogHTML('Cannot receive DHCP Solicit message
');
vLogHTML('NG');
pdAsyncWait() || exit $V6evalTool::exitFatal;
exit $V6evalTool::exitFail;
}
pdAsyncWait() || exit $V6evalTool::exitFatal;
vSleep($wait_time);
#
#
#
@col=('PTN', 'EXP', 'RESULT');
pdPrintSummaryHTML("*** Test Summary: PE vs CPE ***", @col,
%title, %result, $idx);
#
#
#
exit $exit_rtn;
######################################################################
__END__
=head1 NAME
=begin html
RRAdvertisedStatusCode.seq - Requesting Router has received advertise message with Status Code option NoPrefixAvail
=end html
=head1 TARGET
Router for DHCP client
=head1 SYNOPSIS
=begin html
RRAdvertisedStatusCode.seq [-tooloption ...] -pkt RRAdvertisedStatusCode.def -tooloption : v6eval tool option
=end html
=head1 TOPOLOGY
=begin html
TN TN1
| | ISP site
--+----+-------+------- Link0
|
NUT Host
| | Customer site
-------+-------+------- Link1 3ffe:501:fffc:XXXX::/64
| TN |
Link-local |
fe80::200:ff:fe00:a0a0 |
| Ether |
00:00:00:00:a0:a0 |
| Delegate Prefix |
3ffe:501:fffc:: |
| Prefix Length |
48 |
| TN1 (other server) |
Link-local |
fe80::200:ff:fe00:a1a1 |
| Ether |
00:00:00:00:a1:a1 |
| Delegate Prefix |
3ffe:501:fffc:: |
| Prefix Length |
48 |
| Host |
Link-local |
fe80::200:ff:fe00:101 |
| ether |
00:00:00:00:01:01 |
=end html
=head1 INITIALIZATION
=begin html
- NUT sets up Prefix Delegation.
Tester as Server Target as Client Tester as Host
| | |
|<--------------------------| |
| DHCP Solicit message | |
| | |
1. Wait DHCP Solicit message
Addresse
Solicit messages
| Src |
NUT link-local address |
| Dst |
All_DHCP_Relay_Agents_and_Servers |
All_DHCP_Relay_Agents_and_Servers FF02::1:2
UDP Ports
Clients listen for DHCP messages on UDP port 546
Server listen for DHCP messages on UDP port 547
DHCP Message
DHCP Solicit message
| msg-type |
SOLICIT(1) |
| transaction-id |
The transaction ID for this message exchange |
| options |
| Client Identifier Option (MUST) |
| IA_PD Option (MUST) |
| |
Code |
33 (TBD) |
| |
IAID |
The unique identifier which client specified |
| |
T1 |
ANY |
| |
T2 |
ANY |
| Elapsed Time Option (MUST) |
| |
elapsed-time |
ANY |
| Option Request Option (Optional) |
=end html
=head1 TEST PROCEDURE
=begin html
Tester as Server Target as Client Tester as Host
| | |
|-------------------------->| |
| DHCP Advertise message | |
| w/ Status Code option | |
| NoPrefixAvail | |
| | |
|<--------------------------| |
| Judgment #1 | |
| DHCP Solicit message | |
| | |
|-------------------------->| |
| DHCP Advertise message | |
| from other server | |
| | |
|<--------------------------| |
| Judgment #2 | |
| DHCP Request message | |
| to other server | |
| | |
|-------------------------->| |
| DHCP Reply message | |
| from other server | |
| | |
v v v
1. Send DHCP Advertise message with Status Code option NoPrefixAvail
2. Wait DHCP Solicit message again
3. Send DHCP Advertise message from other server
4. Wait DHCP Request message sending to other server
5. Send DHCP Reply message from other server
Addresses
Solicit, Request messages
| Src |
NUT link-local address |
| Dst |
All_DHCP_Relay_Agents_and_Servers |
All_DHCP_Relay_Agents_and_Servers FF02::1:2
Advertise message
| Src |
fe80::200:ff:fe00:a0a0 |
| Dst |
NUT link-local address |
Advertise, Reply message from other server
| Src |
fe80::200:ff:fe00:a1a1 |
| Dst |
NUT link-local address |
UDP Ports
Clients listen for DHCP messages on UDP port 546
Server listen for DHCP messages on UDP port 547
DHCP Messages
DHCP Advertise message with Status Code option including NoPrefixAvail
| msg-type |
ADVERTISE(2) |
| transaction-id |
The same transaction ID previous message |
| options |
| Client Identifier Option |
| Server Identifier Option |
| |
DUID Contents type |
1 Link-layer address plus time |
| |
hardware type |
1 Ether |
| |
time |
Time which the server included |
| |
link-layer address |
00:00:00:00:a0:a0 |
| Status Code Option |
| |
status-code |
6 NoPrefixAvail (TBD) |
| |
status-message |
0x56, 0x56, 0x56, 0x56, 0x56, 0x56, 0x56, 0x56 |
DHCP Solicit message
Same above
DHCP Advertise message from other server
| msg-type |
ADVERTISE(2) |
| transaction-id |
The same transaction ID previous message |
| options |
| Client Identifier Option |
| Server Identifier Option |
| |
DUID Contents type |
1 Link-layer address plus time |
| |
hardware type |
1 Ether |
| |
time |
Time which the server included |
| |
link-layer address |
00:00:00:00:a1:a1 |
| Preference Option |
| |
pref-value |
255 |
| IA_PD Option |
| |
Code |
33 (TBD) |
| |
IAID |
Unique identifier which client specified |
| |
T1 |
300 |
| |
T2 |
480 |
| |
IA_PD Prefix Option |
| |
|
Code |
34 (TBD) |
| |
|
preferred-lifetime |
600 |
| |
|
valid-lifetime |
1200 |
| |
|
prefix-length |
48 |
| |
|
IPv6 prefix |
3ffe:501:fffc:: |
DHCP Request message to other server
| msg-type |
REQUEST(3) |
| transaction-id |
The transaction ID for this message exchange |
| options |
| Client Identifier Option (MUST) |
| Server Identifier Option (MUST) |
| |
DUID Contents type |
1 Link-layer address plus time |
| |
hardware type |
1 Ether |
| |
time |
Time which the server included |
| |
link-layer address |
00:00:00:00:a1:a1 |
| IA_PD Option (MUST) |
| |
Code |
33 (TBD) |
| |
IAID |
Unique identifier which client specified |
| |
T1 |
ANY |
| |
T2 |
ANY |
| |
IA_PD Prefix Option (Optional) |
| |
|
Code |
34 (TBD) |
| |
|
preferred-lifetime |
ANY |
| |
|
valid-lifetime |
ANY |
| |
|
prefix-length |
48 |
| |
|
IPv6 prefix |
3ffe:501:fffc:: |
| Elapsed Time Option (MUST) |
| |
elapsed-time |
ANY |
| Option Request Option (Optional) |
DHCP Reply message from other server
| msg-type |
REPLY(7) |
| transaction-id |
The same transaction ID previous message |
| options |
| Client Identifier Option |
| Server Identifier Option |
| |
DUID Contents type |
1 Link-layer address plus time |
| |
hardware type |
1 Ether |
| |
time |
Time which the server included |
| |
link-layer address |
00:00:00:00:a1:a1 |
| IA_PD Option |
| |
Code |
33 (TBD) |
| |
IAID |
Unique identifier which client specified |
| |
T1 |
300 |
| |
T2 |
480 |
| |
IA_PD Prefix Option |
| |
|
Code |
34 (TBD) |
| |
|
preferred-lifetime |
600 |
| |
|
valid-lifetime |
1200 |
| |
|
prefix-length |
48 |
| |
|
IPv6 prefix |
3ffe:501:fffc:: |
=end html
=head1 JUDGEMENT
=begin html
1. NUT ignore DHCP Advertise message with Status Code option NoPrefixAvail. DHCP Solicit message is recieved again.
2. DHCP Request message is recieved sending to other server.
=end html
=head1 TERMINATION
N/A
=head1 REFERENCE
=begin html
draft-ietf-dhc-dhcpv6-opt-prefix-delegation-01.txt
10. Delegating Router Solicitation
10.1 Requesting router behaviour
The requesting router creates and transmits a Solicit message as
described in sections "Creation of Solicit Messages" and
"Transmission of Solicit Messages" of the DHCP specification [6].
The requesting router creates an IA_PD and assigns it an IAID. The
requesting router MUST include the IA_PD option in the Solicit
message.
The requesting router processes any received Advertise messages as
described in section "Receipt of Advertise Messages" in the DHCP
specification [6]. The requesting router MAY choose to consider the
presence of advertised prefixes in its decision about which
delegating router to respond to.
The requesting router MUST ignore any Advertise message that includes
a Status Code option containing the value NoPrefixAvail, with the
exception that the requesting router MAY display the associated
status message to the user.
15. IANA Considerations
IANA is requested to assign option codes to these options from the
option-code space as defined in section "DHCPv6 Options" of the
DHCPv6 specification [6].
IANA is requested to assign a status code to the NoPrefixAvail status
code from the status-code space as defined in section "Status Codes"
of the DHCPv6 specification [6].
draft-ietf-dhc-dhcpv6-28.txt
17. DHCP Server Solicitation
17.1. Client Behavior
17.1.3. Receipt of Advertise Messages
The client MUST ignore any Advertise message that includes a Status
Code option containing the value NoAddrsAvail, with the exception
that the client MAY display the associated status message to the
user.
Upon receipt of one or more valid Advertise messages, the client
selects one or more Advertise messages based upon the following
criteria.
- Those Advertise messages with the highest server preference value
are preferred over all other Advertise messages.
- Within a group of Advertise messages with the same server
preference value, a client MAY select those servers whose
Advertise messages advertise information of interest to the
client. For example, the client may choose a server that
returned an advertisement with configuration options of interest
to the client.
- The client MAY choose a less-preferred server if that server has
a better set of advertised parameters, such as the available
addresses advertised in IAs.
Once a client has selected Advertise message(s), the client will
typically store information about each server, such as server
preference value, addresses advertised, when the advertisement was
received, and so on.
If the client needs to select an alternate server in the case that a
chosen server does not respond, the client chooses the next server
according to the criteria given above.
A. Appearance of Options in Message Types
The following table indicates with a "*" the options are allowed in
each DHCP message type:
Client Server IA_NA Option Pref Time Relay Auth. Server
ID ID IA_TA Request Msg. Unica.
Solicit * * * * *
Advert. * * * * * *
Request * * * * * *
Reply * * * * * * *
Status Rap. User Vendor Vendor Inter. Recon. Recon.
Code Comm. Class Class Spec. ID Msg. Accept
Solicit * * * * *
Advert. * * * * *
Request * * * *
Reply * * * * * *
=end html
=head1 SEE ALSO
perldoc V6evalTool
=cut