#!/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/RRAdvertisedPreference.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',
na => 'Send Neighbor Advertisement',
na_other => 'Send Neighbor Advertisement another PE',
na_other1 => 'Send Neighbor Advertisement another PE1',
dhcp_sol => 'Recv DHCP Solicit message w/o Option Request option',
dhcp_sol_any => 'Recv DHCP Solicit message',
dhcp_adv_pref1 => 'Send DHCP Advertise message w/ preference 200',
dhcp_adv_pref2 => 'Send DHCP Advertise message w/ preference 100',
dhcp_adv_pref3 => 'Send DHCP Advertise message w/ preference 1',
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_rep => 'Send DHCP Reply message',
);
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:fffd::";
$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
");
$irt = $pd::SOL_TIMEOUT;
$mrt = $pd::SOL_MAX_RT;
$rt = 0;
$msgtyp = $pd::SOLICIT;
$rt = pdRetransmitTimer($irt, $mrt, $rt);
$vcpp = pdSetVCPP($pd::SOLICIT, $delegateprefix, $preferredlifetime, $validlifetime,
$maxcount, @sid_duid_time, @sid_link_addr, %ret);
vCPP($vcpp);
vSend($IF, dhcp_adv_pref3, dhcp_adv_pref1, dhcp_adv_pref2);
%ret = vRecv($IF, $rt, 0, 0, dhcp_req, dhcp_req_any, dhcp_req_any1, dhcp_req_any2);
$title{$idx}="
$pktdesc{'dhcp_req'} | exp:sending DHCP Request message | ";
if ($ret{recvFrame} eq 'dhcp_req' || $ret{recvFrame} eq 'dhcp_req_any' ||
$ret{recvFrame} eq 'dhcp_req_any1'|| $ret{recvFrame} eq 'dhcp_req_any2') {
$title{$idx}.="result:sent DHCP Request message | ";
$result{$idx}=$V6evalTool::exitPass;
vLogHTML("OK: sent DHCP Request message to the Server with high preference value
");
}
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);
%ret = vRecv($IF, $wait_time/2, 0, ns);
if($ret{status} == 0) {
vSend($IF, na);
}
}
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
RRAdvertisedPreference.seq - Requesting Router chooses PE based on preference value of Preference option
=end html
=head1 TARGET
Router for DHCP client
=head1 SYNOPSIS
=begin html
RRAdvertisedPreference.seq [-tooloption ...] -pkt RRAdvertisedPreference.def -tooloption : v6eval tool option
=end html
=head1 TOPOLOGY
=begin html
TN TN1 TN2
| | | ISP site
--+----+---+---+------- Link0
|
NUT Host
| | Customer site
-------+-------+------- Link1 3ffe:501:fffd:XXXX::/64
| TN (Preference 1) |
Link-local |
fe80::200:ff:fe00:a2a2 |
| Ether |
00:00:00:00:a2:a2 |
| Delegate Prefix |
3ffe:501:fffd:: |
| Prefix Length |
48 |
| TN1 (Preference 200) |
Link-local |
fe80::200:ff:fe00:a0a0 |
| Ether |
00:00:00:00:a0:a0 |
| Delegate Prefix |
3ffe:501:fffd:: |
| Prefix Length |
48 |
| TN2 (Preference 100) |
Link-local |
fe80::200:ff:fe00:a1a1 |
| Ether |
00:00:00:00:a1:a1 |
| Delegate Prefix |
3ffe:501:fffd:: |
| 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 messages | |
| with Preference option | |
| containing preference | |
| value: 1 | |
| | |
|-------------------------->| |
| DHCP Advertise messages | |
| with Preference option | |
| containing preference | |
| value: 200 | |
| | |
|-------------------------->| |
| DHCP Advertise messages | |
| with Preference option | |
| containing preference | |
| value: 100 | |
| | |
|<--------------------------| |
| Judgment #1 | |
| DHCP Request message | |
| using SID with preference| |
| value: 200 | |
| | |
|-------------------------->| |
| DHCP Reply message | |
| | |
| | |
v v v
1. Send DHCP Advertise messages with preference value 1
2. Send DHCP Advertise messages with preference value 200
3. Send DHCP Advertise messages with preference value 100
4. Wait DHCP Request message using SID of the server which has transmitted the preference value 200.
5. Send DHCP Reply message
Addresses
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 1
| Src |
fe80::200:ff:fe00:a2a2 |
| Dst |
NUT link-local address |
Advertise message 2, Reply message
| Src |
fe80::200:ff:fe00:a0a0 |
| Dst |
NUT link-local address |
Advertise message 3
| 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 1, 2 and 3 include preference option.
As for the message, Server Identifier Option differ.
DHCP Advertise message 1 with Preference option including pref-value 1
| 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:a2:a2 |
| Preference Option |
| |
pref-value |
1 |
| 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:fffd:: |
DHCP Advertise message 2 with Preference option including pref-value 200
| 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 |
| Preference Option |
| |
pref-value |
200 |
| 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:fffd:: |
DHCP Advertise message 3 with Preference option including pref-value 100
| 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 |
100 |
| 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:fffd:: |
DHCP Request message with IA_PD option including TN1s DUID
| 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:a0:a0 |
| 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:fffd:: |
| Elapsed Time Option (MUST) |
| |
elapsed-time |
ANY |
| Option Request Option (Optional) |
DHCP Reply message with IA_PD option including IA_Prefix option
| 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:a0:a0 |
| 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:fffd:: |
=end html
=head1 JUDGEMENT
=begin html
1. Requesting Router chooses SID of the server which has transmitted the preference value 200.
=end html
=head1 TERMINATION
N/A
=head1 REFERENCE
=begin html
draft-ietf-dhc-dhcpv6-opt-prefix-delegation-01.txt
10. Delegating Router Solicitation
The requesting router locates and selects a delegating router in the
same way as described in section "DHCP Server Solicitation" of the
DHCP specification [6]. The details of the solicitation process are
described in this section.
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.
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.
=head1 SEE ALSO
perldoc V6evalTool
=cut