#!/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/RRRequest.seq,v 1.4 2003/06/11 09:31:14 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_unicast => 'Recv Neighbor Solicitation', ns_other => 'Recv Neighbor Solicitation', ns_unicast_other => 'Recv Neighbor Solicitation', na => 'Send Neighbor Advertisement', rs => 'Send Router Solicitation', ra => 'Recv Router Advertisement', ra1 => 'Recv Router Advertisement including mtu option', ra2 => 'Recv Router Advertisement including multiple prefix information', ra3 => 'Recv Router Advertisement including mtu option and multiple prefix information', 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_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', ); 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:fffb::"; $preferredlifetime="80"; $validlifetime="120"; # $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("Client sent DHCP Solicit message
"); vLogHTML("OK
"); $irt = $pd::SOL_TIMEOUT; $mrt = $pd::SOL_MAX_RT; $rt = 0; $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_pref1, dhcp_adv_pref2); vLogHTML("Test
"); $title{$idx}="$pktdesc{'dhcp_req'}exp:sending DHCP Request message"; %ret = vRecv($IF, $rt, 0, 0, ns, ns_unicast, dhcp_req, dhcp_req_any, dhcp_req_any1, dhcp_req_any2); if ($ret{recvFrame} eq 'ns' || $ret{recvFrame} eq 'ns_unicast') { vSend($IF, na); %ret = vRecv($IF, $rt, 0, 0, dhcp_req, dhcp_req_any, dhcp_req_any1,, dhcp_req_any1); } if ($ret{status} == 0) { $rt0 = time(); $irt = $pd::REQ_TIMEOUT; $mrt = $pd::REQ_MAX_RT; $rt = 0; $count = 1; $title{$idx}.="result:sent DHCP Request message, count $count"; $result{$idx}=$V6evalTool::exitPass; vLogHTML("Retransmition timeout: $rt, Retransmit count: $count
"); vLogHTML("OK
"); $idx++; $count++; } else{ vLogHTML("Cannot receive DHCP Request message
"); vLogHTML('NG'); pdAsyncWait() || exit $V6evalTool::exitFatal; exit $V6evalTool::exitFail; } $title{$idx}="$pktdesc{'dhcp_request'}exp:sending DHCP Request message again"; $mrd = 0; $mrc = $pd::REQ_MAX_RC; while(1){ $rt = pdRetransmitTimer($irt, $mrt, $rt); %ret = vRecv($IF, $rt+1, 0, 0, ns, ns_unicast, dhcp_req, dhcp_req_any, dhcp_req_any1, dhcp_req_any2); if ($ret{recvFrame} eq 'ns' || $ret{recvFrame} eq 'ns_unicast'){ vSend($IF, na); %ret = vRecv($IF, $rt, 0, 0, dhcp_req, dhcp_req_any, dhcp_req_any1, dhcp_req_any2); } $title{$idx}="DHCP Request/Reply message exchange is continued"; $title{$idx}.="exp:sending DHCP Request message again"; if ($ret{recvFrame} eq 'dhcp_req' || $ret{recvFrame} eq 'dhcp_req_any' || $ret{recvFrame} eq 'dhcp_req_any1' || $ret{recvFrame} eq 'dhcp_req_any2'){ $rt1 = time(); $expect = $rt; $rt = ($rt1 - $rt0); $rt0 = $rt1; vLogHTML("Client sent DHCP Request message again.
"); vLogHTML("Retransmition timeout: $rt, Retransmit count: $count
"); if( $rt > $expect){ vLogHTML("Retransmition timeout is over expected timeout: $expect
"); $result{$idx}=$V6evalTool::exitWarn; vLogHTML("Warn
"); }else{ $result{$idx}=$V6evalTool::exitPass; vLogHTML("OK
"); } $title{$idx}.="result:sent DHCP Request message again, count $count"; $idx++; } else{ $title{$idx}.="result:NOT sent DHCP Request message again"; $result{$idx}=$V6evalTool::exitFail; vLogHTML("Client terminate DHCP Request/Reply message exchange
"); vLogHTML("NG
"); $idx++; last; } if ($count == $mrc){ vLogHTML("Maximum retransmit count REQ_MAX_RC: $mrc is reached,
"); vLogHTML("Request/Reply message exchange is terminated.
"); $count++; last; } $count++; } $rt = pdRetransmitTimer($irt, $mrt, $rt); %ret = vRecv($IF, $rt, 0, 0, dhcp_req, dhcp_req_any, dhcp_req_any1, dhcp_req_any2, dhcp_req_other, dhcp_req_any_other, dhcp_req_any1_other, dhcp_req_any2_other, dhcp_sol, dhcp_sol_any); $title{$idx}="If the message exchange fails, the client takes an action based on the client's local policy."; $title{$idx}.="exp:Client takes an action"; if ($ret{recvFrame} eq 'dhcp_req' || $ret{recvFrame} eq 'dhcp_req_any' || $ret{recvFrame} eq 'dhcp_req_any1' || $ret{recvFrame} eq 'dhcp_req_any2'){ $rt1 = time(); $rt = ($rt1 - $rt0); vLogHTML("Receive DHCP Request message again
"); vLogHTML("Retransmition timeout: $rt, Retransmit count: $count
"); vLogHTML("More DHCP Request messages than REQ_MAX_MRC($mrc) times were received.
"); $title{$idx}.="result:sent DHCP Request message again"; $result{$idx}=$V6evalTool::exitFail; vLogHTML("NG
"); } elsif ($ret{recvFrame} eq 'dhcp_req_other' || $ret{recvFrame} eq 'dhcp_req_any_other' || $ret{recvFrame} eq 'dhcp_req_any1_other' || $ret{recvFrame} eq 'dhcp_req_any2_other'){ $title{$idx}.="result:sent DHCP Request message to TN1s DUID"; $result{$idx}=$V6evalTool::exitPass; vLogHTML("Client sent DHCP Request message to TN1s DUID
"); vLogHTML("OK
"); } elsif ($ret{recvFrame} eq 'dhcp_sol' || $ret{recvFrame} eq 'dhcp_sol_any'){ $title{$idx}.="result:sent DHCP Solicit message"; $result{$idx}=$V6evalTool::exitPass; vLogHTML("Client initiate the server discovery process
"); vLogHTML("OK
"); } else{ $title{$idx}.="result: terminate the configuration process"; $result{$idx}=$V6evalTool::exitPass; vLogHTML("Client terminated the configuration process
"); vLogHTML("OK
"); } } else{ vLogHTML('Cannot receive DHCP Solicit message
'); vLogHTML('NG'); pdAsyncWait() || exit $V6evalTool::exitFatal; exit $V6evalTool::exitFail; } pdAsyncWait() || exit $V6evalTool::exitFatal; # # # @col=('PTN', 'EXP', 'RESULT'); pdPrintSummaryHTML("*** Test Summary: PE vs CPE ***", @col, %title, %result, $idx); # # # exit $exit_rtn; ###################################################################### __END__ =head1 NAME RRRequest.seq - Requesting Router transmit Request messages to populate IA_PD with delegated prefix =head1 TARGET Router for DHCP client =head1 SYNOPSIS =begin html   RRRequest.seq [-tooloption ...] -pkt RRRequest.def -tooloption : v6eval tool option =end html =head1 TOPOLOGY =begin html
   TN       TN1
    |        |            ISP site
  --+----+---+----------- Link0   
         |
        NUT     Host
         |       |        Customer site
  -------+-------+------- Link1 3ffe:501:fffb:XXXX::/64
TN (Preference 200) Link-local fe80::200:ff:fe00:a0a0
Ether 00:00:00:00:a0:a0
Delegate Prefix 3ffe:501:fffb::
Prefix Length 48
TN1 (Preference 100) Link-local fe80::200:ff:fe00:a1a1
Ether 00:00:00:00:a1:a1
Delegate Prefix 3ffe:501:fffb::
Prefix Length 48
Host Link-local fe80::200:ff:fe00:101
ether 00:00:00:00:01:01
=end html =head1 INITIALIZATION =begin html
  1. NUT sets up Prefix Delegation.
  2. NUT sets up Router Advertisement to the interface by the side of downstream.

Tester as Server          Target as Client        Tester as Host
    |                           |                           |
    |<--------------------------|                           |
    |   DHCP Solicit message    |                           |
    |                           |                           |
    |-------------------------->|                           |
    |   DHCP Advertise messages |                           |
    |   with Preference option  |                           |
    |   containing preference   |                           |
    |   value: 200              |                           |
    |                           |                           |
    |-------------------------->|                           |
    |   DHCP Advertise messages |                           |
    |   with Preference option  |                           |
    |   containing preference   |                           |
    |   value: 100              |                           |
    |                           |                           |

1. Wait DHCP Solicit message 2. Send DHCP Advertise messages with preference value 200 3. Send DHCP Advertise messages with preference value 100
Addresses
Solicit message
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
UDP Ports
Clients listen for DHCP messages on UDP port 546 Server listen for DHCP messages on UDP port 547
DHCP Messages
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)

DHCP Advertise message 1 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 40
  T2 64
  IA_PD Prefix Option
    Code 34 (TBD)
    preferred-lifetime 80
    valid-lifetime 120
    prefix-length 48
    IPv6 prefix 3ffe:501:fffb::

DHCP Advertise message 2 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::
=end html =head1 TEST PROCEDURE =begin html
Tester as PE              Target as CPE             Tester as client
    |                           |                           |
    |<--------------------------|                           |
    |   Judgment #1             |                           |
    |   DHCP Request message    |                           |
    |                           |                           |
    |           :               |                           |
    |   Judgment #2             |                           |
    |  Contining REQ_MAX_RC(10) |                           |
    |   times                   |                           |
    |           :               |                           |
    |                           |                           |
    |<--------------------------|                           |
    |   Judgment #3             |                           |
    |   DHCP Request message    |                           |
    |   to TN1's DUID           |                           |
    |        or                 |                           |
    |   DHCP Solicit message    |                           |
    |                           |                           |
    |                           |                           |
    v                           v

1. Wait until receiving DHCP Request message REQ_MAX_RC(10) times. 2. NUT takes an action based on the client's local policy. - Select another server from a list of servers known to the client; for example, servers that responded with an Advertise message - Initiate the server discovery process described in section 17 - Terminate the configuration process and report failure
Addresses
Request 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 Messages
DHCP Request message with IA_PD option including TNs 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:fffb::
Elapsed Time Option (MUST)
  elapsed-time ANY
Option Request Option (Optional)

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: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:fffb::
Elapsed Time Option (MUST)
  elapsed-time ANY
Option Request Option (Optional)

DHCP Solicit message is same above.
=end html =head1 JUDGEMENT =begin html

  1. DHCP Request message is recieved

  2. DHCP Request message is received to REQ_MAX_RC(10) times.

  3. NUT takes an action based on the client's local policy.
=end html =head1 TERMINATION N/A =head1 REFERENCE =begin html
draft-ietf-dhc-dhcpv6-opt-prefix-delegation-01.txt

11. Requesting router initiated prefix delegation
A requesting router uses the same message exchanges as described in section "DHCP Client-Initiated Configuration Exchange" of the DHCP specification [6] to obtain or update prefix(es) from a delegating router. The requesting router and the delegating router use the IA_PD Prefix option to exchange information about prefix(es) in much the same way IA Address options are used for assigned addresses.
11.1 Requesting router behaviour
The requesting router uses a Request message to populate IA_PDs with prefixes. The requesting router includes one or more IA_PD options in the Request message. The delegating router then returns the prefixes for the IA_PDs to the requesting router in IA_PD options in a Reply message.

draft-ietf-dhc-dhcpv6-28.txt
14. Reliability of Client Initiated Message Exchanges
see the retransmission mechanism
15. Message Validation
15.4. Request Message
Clients MUST discard any received Request messages.
Servers MUST discard any received Request message that meet any of the following conditions:
- the message does not include a Server Identifier option
- the contents of the Server Identifier option do not match the server's DUID
- the message does not include a Client Identifier option
18. DHCP Client-Initiated Configuration Exchange
A client initiates a message exchange with a server or servers to acquire or update configuration information of interest. The client may initiate the configuration exchange as part of the operating system configuration process, when requested to do so by the application layer, when required by Stateless Address Autoconfiguration or as required to extend the lifetime of an address (Renew and Rebind messages).
18.1. Client Behavior
A client uses Request, Renew, Rebind, Release and Decline messages during the normal life cycle of addresses. It uses Confirm to validate addresses when it may have moved to a new link. It uses Information-Request messages when it needs configuration information but no addresses.
If the client has a source address of sufficient scope that can be used by the server as a return address and the client has received a Server Unicast option (section 22.12) from the server, the client SHOULD unicast any Request, Renew, Release and Decline messages to the server.
DISCUSSION:
Use of unicast may avoid delays due to relaying of messages by relay agents as well as avoid overhead and duplicate responses by servers due to delivery of client messages to multiple servers. Requiring the client to relay all DHCP messages through a relay agent enables the inclusion of relay agent options in all messages sent by the client. The server should enable the use of unicast only when relay agent options will not be used.
18.1.1. Creation and Transmission of Request Messages
The client uses a Request message to populate IAs with addresses and obtain other configuration information. The client includes one or more IA options in the Request message. The server then returns addresses and other information about the IAs to the client in IA options in a Reply message.
The client generates a transaction ID and inserts this value in the "transaction-id" field.
The client places the identifier of the destination server in a Server Identifier option.
The client MUST include a Client Identifier option to identify itself to the server. The client adds any other appropriate options, including one or more IA options (if the client is requesting that the server assign it some network addresses).
The client MUST include an Option Request option (see section 22.7) to indicate the options the client is interested in receiving. The client MAY include options with data values as hints to the server about parameter values the client would like to have returned.
The client includes a Reconfigure Accept option (see section indicating whether or not the client is willing to accept Reconfigure messages from the server.
The client transmits the message according to section 14, using the following parameters:
IRT REQ_TIMEOUT
MRT REQ_MAX_RT
MRC REQ_MAX_RC
MRD 0
If the message exchange fails, the client takes an action based on the client's local policy. Examples of actions the client might take include:
- Select another server from a list of servers known to the client; for example, servers that responded with an Advertise message
- Initiate the server discovery process described in section 17
- Terminate the configuration process and report failure
5.5. Transmission and Retransmission Parameters
This section presents a table of values used to describe the message transmission behavior of clients and servers.
Parameter Default Description ------------------------------------- REQ_TIMEOUT 1 sec Initial Request timeout REQ_MAX_RT 30 secs Max Request timeout value REQ_MAX_RC 10 Max Request retry attempts
24.2. DHCP Message Types
IANA is requested to record the following message types (defined in section 5.3). IANA is requested to maintain a registry of DHCP
REQUEST 3
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. Request * * * * * * Status Rap. User Vendor Vendor Inter. Recon. Recon. Code Comm. Class Class Spec. ID Msg. Accept Request * * * *
=end html =head1 SEE ALSO perldoc V6evalTool =cut