#!/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/dd/DDWellKnown.seq,v 1.3 2003/04/22 04:04:44 akisada Exp $ # ######################################################################## BEGIN { $V6evalTool::TestVersion = '$Name: REL_2_1_2 $ '; } use V6evalTool; use dd; # Packet description %pktdesc = ( dadns_from_nut => 'Recv DAD Neighbor Solicitation', dadns_from_nut_GA0Tgt => 'Recv DAD Neighbor Solicitation whose target address is global address', ns_from_nut_solnode => 'Recv Neighbor Solicitation for address resolution', ns_from_nut => 'Recv Neighbor Solicitation for neighbor unreachability detection', na_to_nut_solnode => 'Send Neighbor Advertisement for address resolution', na_to_nut => 'Send Neighbor Advertisement for neighbor unreachability detection', rs_from_nut => 'Recv Router Solicitation', rs_from_nut_wSLL => 'Recv Router Solicitation with Source link-layer address option', ra_to_nut => 'Send Router Advertisement', dhcp_inforeq => 'Recv DHCP Information-Request message w/ Domain Name Server option', dhcp_inforeq_comb => 'Recv DHCP Information-Request message w/ Domain Name Server and Search List option', dhcp_rep => 'Send DHCP Reply message w/ Domain Name Server option', dhcp_rep_comb => 'Send DHCP Reply message w/ Domain Name Server and Search List option', dns_squery_wellknown => 'Recv DNS source query message to well-known address', dns_response => 'Send DNS response message', echo_request_from_nut => 'Recv Echo Request (Global Address)', echo_reply_to_nut => 'Send Echo Reply (Global Address)', ); # The following generate debugging messages. $dd::debug=$ddOpt_v|$ddOpt_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 $dd::remote_debug="-o1" if $ndOpt_vv; # # $IF=Link0; $idx=0; # # $ping_dst_addr = "test.tahi.org"; #ping6 from NUT to the host test.tahi.org. # # ############################################## #If wait dhcp information-request message #interave is short, please edit this parametor $wait_time=10; ############################################## $maxcount = 1; # 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", ); # # Type check # $type=$V6evalTool::NutDef{Type}; if($type eq router) { vLogHTML("This test is for the host only
"); exit $V6evalTool::exitHostOnly; } if($type ne host) { vLogHTML(ddErrmsg("ERROR: $V6evalTool::NutDef{Type}: ". "Unknown target type
")); exit $V6evalTool::exitFail; } # # Initialize NUT # vLogHTML("Target initialization
"); vLogHTML("Trying to setup NUT
"); ddSetInfoReqDHCP6Client() || exit $V6evalTool::exitFail; $ret = ddRebootAsync(); if ($ret) { vLogHTML('NG'); exit $V6evalTool::exitFatal; } # # Start capture buffer # vCapture($IF); # # LLA PHASE # Wait DAD NS from NUT or timeout # vLogHTML("TN wait DAD NS from NUT for $dd::wait_dadns [sec]
"); %ret1=vRecv($IF,$dd::wait_dadns,0,0,dadns_from_nut); if ($ret1{status} != 0){ vLogHTML("TN wait DAD NS from NUT for $dd::wait_dadns, but NUT had not transmit DAD NS
"); } else{ # # RA PHASE # vLogHTML("TN received DAD NS from NUT
"); vLogHTML("OK
"); } %ret2=vRecv($IF,$dd::wait_rs,0,0,rs_from_nut,rs_from_nut_wSLL); if ($ret2{status} != 0){ vLogHTML("Though TN had waited RS from NUT for $dd::wait_rs,
"); vLogHTML("NUT seems not to send RS
"); ddErrmsg(NG); }else{ vLogHTML("TN received RS from NUT
"); vLogHTML("OK
"); } vSend($IF, ra_to_nut); vLogHTML("TN sent RA (Prefix=Global)
"); # # Wait DAD NS from NUT or timeout # vLogHTML("TN wait DAD NS for Global address from NUT for $dd::wait_dadns_ra [sec]
"); %ret3=vRecv($IF,$dd::wait_dadns_ra,0,0,dadns_from_nut_GA0Tgt); if ($ret3{status} == 0){ vSleep($dd::RetransTimerSec); vLogHTML("NUT had not transmitted DAD NS for Global address.
"); vLogHTML("NUT assigned Global address to the interface.
"); vLogHTML("OK
"); } elsif ($ret3{status} != 0){ vLogHTML("NUT did not assign Global address.
"); ddErrmsg(NG); } # # Wait Information-Request from NUT # vLogHTML("Wait DNS Configuration Request Messages.
"); $vcpp = ddSetVCPP($dd::INITIAL, $dnsserver, $domainserchlist, $maxcount, @sid_duid_time, @sid_link_addr, %ret); vCPP($vcpp); %ret = vRecv($IF, $wait_time, 0, 0, dhcp_inforeq, dhcp_inforeq_comb); $rt0 = time(); $irt = $dd::INF_TIMEOUT; $mrt = $dd::INF_MAX_RT; $rt = 0; if($ret{status} == 0) { vLogHTML("TN received DHCP Information-request message
"); vLogHTML("OK
"); $vcpp = ddSetVCPP($dd::INFORMATIONREQUEST, $dnsserver, $domainserchlist, $maxcount, @sid_duid_time, @sid_link_addr, %ret); vCPP($vcpp); # if ($ret{recvFrame} eq 'dhcp_inforeq'){ # vSend($IF, dhcp_rep); # } # else{ # vSend($IF, dhcp_rep_comb); # } # # vLogHTML("TN sent DHCP Reply message
"); $dhcp=1; } else{ vLogHTML("TN dosen't any DNS configuration request message
"); vLogHTML("OK"); $dhcp=0; } $dt = 0; $mrd = 0; $count = 2; if($dhcp){ while(1){ $rt = ddRetransmitTimer($irt, $mrt, $rt); %ret = vRecv($IF, $rt, 0, 0, ns_from_nut_solnode, ns_from_nut, dhcp_inforeq, dhcp_inforeq_comb); if($ret{recvFrame} eq 'ns_from_nut_solnode') { $NUT_ADDR = $ret{$dd::FEM_SRC_ADDR}; $TGT_ADDR = $ret{$dd::FEM_NS_TGTADDR}; vCPP("-DNUT_ADDR=\\\"$NUT_ADDR\\\" -DTGT_ADDR=\\\"$TGT_ADDR\\\""); vSend($IF, na_to_nut_solnode); %ret=vRecv($IF, $wait_time, 0, 0, dhcp_inforeq, dhcp_inforeq_comb); } elsif($ret{recvFrame} eq 'ns_from_nut') { vSend($IF, na_to_nut); %ret=vRecv($IF, $wait_time, 0, 0, dhcp_inforeq, dhcp_inforeq_comb); } if($ret{status} == 0) { $rt1 = time(); $rt = ($rt1 - $rt0); $rt0 = $rt1; $dt = $dt + $rt; vLogHTML("Retransmition timeout: $rt, count: $count
"); } else{ vLogHTML("Information-Request/Reply message exchange was terminated.
"); vLogHTML("OK"); last; } $irt = $dd::INF_TIMEOUT; $mrt = $dd::INF_MAX_RT; $count++; } vSleep($wait_time*2); } # # Start test # vLogHTML("Test
"); # # ping6 from NUT to the host test.tahi.org # vLogHTML("NUT is sending ICMP Echo request message to host $ping_dst_addr
"); ddPing($ping_dst_addr) || exit $V6evalTool::exitFail; # # Receive standard query from NUT # $title{$idx}="$pktdesc{'dns_squery_wellknown'}exp:sending DNS source query message to well-known address"; vLogHTML("Wait standard query from NUT
"); %ret=vRecv($IF, $wait_time+5, 0, 1, ns_from_nut_solnode, ns_from_nut, dns_squery_wellknown); if($ret{status}==0) { if($ret{recvFrame} eq 'ns_from_nut_solnode') { $NUT_ADDR = $ret{$dd::FEM_SRC_ADDR}; $TGT_ADDR = $ret{$dd::FEM_NS_TGTADDR}; vCPP("-DNUT_ADDR=\\\"$NUT_ADDR\\\" -DTGT_ADDR=\\\"$TGT_ADDR\\\""); vSend($IF, na_to_nut_solnode); %ret=vRecv($IF, $wait_time, 0, 1, dns_squery); } elsif($ret{recvFrame} eq 'ns_from_nut') { vSend($IF, na_to_nut); %ret=vRecv($IF, $wait_time, 0, 1, dns_squery); } if($ret{status}==0) { vLogHTML("TN received DNS standard query message
"); vLogHTML("OK
"); $DNS_DST_ADDR = $ret{$dd::FEM_DST_ADDR}; $DNS_PORT = $ret{$dd::FEM_UDP . '.Hdr_UDP.SourcePort'}; $DNS_ID = $ret{$dd::FEM_UDP . '.Udp_DNS.Identifier'}; $RD_BIT = $ret{$dd::FEM_UDP . '.Udp_DNS.RD'}; print "DST: $DNS_DST_ADDR, PORT: $DNS_PORT, ID: $DNS_ID, RD: $RD_BIT\n" if $debug; vCPP("-DDNS_SRV_ADDR=\\\"$DNS_DST_ADDR\\\" -DDNS_PORT=$DNS_PORT -DDNS_ID=$DNS_ID -DRD_BIT=$RD_BIT"); %ret=vSend($IF, dns_response); vLogHTML("TN sent DNS response message
"); $title{$idx}.="result:sent DNS source query message"; $result{$idx}=$V6evalTool::exitPass; $idx++; } else{ vLogHTML("TN doesn't receive standard query
"); vLogHTML("NG"); ddAsyncWait() || exit $V6evalTool::exitFatal; exit $V6evalTool::exitFail; } } else{ vLogHTML("TN doesn't receive standard query
"); ddAsyncWait() || exit $V6evalTool::exitFatal; exit $V6evalTool::exitFail; } # # Receive ICMP echo request from NUT # $title{$idx}="$pktdesc{'echo_request_from_nut'}exp:sending ICMP Echo request message"; %ret=vRecv($IF, $wait_time/2, 0, 1, ns_from_nut_solnode, ns_from_nut, echo_request_from_nut); if($ret{status}==0) { if($ret{recvFrame} eq 'ns_from_nut_solnode'){ $NUT_ADDR = $ret{$dd::FEM_SRC_ADDR}; $TGT_ADDR = $ret{$dd::FEM_NS_TGTADDR}; vCPP("-DNUT_ADDR=\\\"$NUT_ADDR\\\" -DTGT_ADDR=\\\"$TGT_ADDR\\\""); vSend($IF, na_to_nut_solnode); %ret=vRecv($IF, $wait_time/2, 0, 1, echo_request_from_nut); } elsif($ret{recvFrame} eq 'ns_from_nut') { vSend($IF, na_to_nut); %ret=vRecv($IF, $wait_time/2, 0, 1, echo_request_from_nut); } if($ret{status}==0) { vLogHTML("TN received ICMP Echo request message
"); vLogHTML("OK
"); $PING_ID = $ret{$dd::FEM_ICMP . '.Identifier'}; $PING_SN = $ret{$dd::FEM_ICMP . '.SequenceNumber'}; $PING_DATA = $ret{$dd::FEM_ICMP . '.Payload.data'}; print "PING_ID: $PING_ID, PING_SN: $PING_SN, PING_DATA: $PING_DATA\n" if $debug; vCPP("-DPING_ID=$PING_ID -DPING_SN=$PING_SN -DPING_DATA=$PING_DATA"); vSend($IF, echo_reply_to_nut); %ret=vRecv($IF, $wait_time/2, 0, 1, ns_from_nut); if($ret{status}==0) { vSend($IF, na_to_nut); } vLogHTML("TN sent ICMP Echo reply message
"); $title{$idx}.="result:sent ICMP Echo request message"; $result{$idx}=$V6evalTool::exitPass; } else{ vLogHTML("TN doesn't receive echo request
"); vLogHTML("NG"); ddAsyncWait() || exit $V6evalTool::exitFatal; exit $V6evalTool::exitFail; } } else{ vLogHTML("TN doesn't receive echo request
"); vLogHTML("NG"); ddAsyncWait() || exit $V6evalTool::exitFatal; exit $V6evalTool::exitFail; } ddAsyncWait() || exit $V6evalTool::exitFatal; # # Log # @col=('PTN', 'EXP', 'RESULT'); ddPrintSummaryHTML("*** Test Summary: PE vs CPE ***", @col, %title, %result, $idx); # # # exit $exit_rtn; ######################################################################## __END__ =head1 NAME DDWellknown.seq - Three well known IPv6 site local addresses is used for recursive DNS server =head1 TARGET Host =head1 SYNOPSIS DDWellknown.seq [-tooloption ...] -pkt DDWellknown.def =head1 TOPOLOGY =begin html
   Host1
    |                     ISP site
  --+----+--------------- Link1 3ffe:501:ffff:101::/64
         |
        TN      NUT
         |       |        Customer site
  -------+-------+------- Link0 3ffe:501:ffff:100::/64
Host1 Global address 3ffe:501:ffff:101:200:ff:fe00:a1a1
TN
DNS Server
Link0 Link-local fe80::200:ff:fe00:a0a0
Global address 3ffe:501:ffff:100:200:ff:fe00:a0a0
Site-local address fec0:000:0000:ffff::1
  fec0:000:0000:ffff::2
  fec0:000:0000:ffff::3
Ether 00:00:00:00:a0:a0
NUT Link-local NUT link-local address
Global address NUT 3ffe:501:ffff:100: + NUT's MAC Addr
=end html =head1 INITIALIZATION =begin html
Tester as Server        Target as Client
    |                           |
    |<--------------------------|
    |   Router Solicitation     |
    |                           |
    |-------------------------->|
    |   Router Advertisement    |
    |                           |
    |<--------------------------|
    |  DNS Cofiguration request |
    |         or                |
    |  No DNS Config request    |
    |                           |
    |(------------------------>)|
    |  No Response message      |
    |                           |

1. Wait Router Solicitation 2. Send Router Advertisement 3. Wait DNS Cofiguration request message 4. No Response message
=end html =head1 TEST PROCEDURE =begin html
Tester as Server        Target as Client
    |                           |
    |           <---------------|
    |          ICMP Echo request|
    |          to test.tahi.org |
    |                           |
    |<--------------------------|
    |   Judgment #1             |
    | NUT send standard query   |
    | to the well known address |
    | for AAAA record of        |
    |  "test.tahi.org"          |
    |                           |
    |-------------------------->|
    |   DNS response            |
    |  for AAAA record of       |
    |  "test.tahi.org           |
    |                           |
    |<--------------------------|
    |   Judgment #2             |
    |   ICMP Echo request       |
    |   to test.tahi.org        |
    |                           |
    |-------------------------->|
    |   ICMP Echo reply         |
    |   from test.tahi.org      |
    |                           |
    v                           v

1. Wait DNS query to the well known address for AAAA record of "test.tahi.org" 2. Send DNS response for AAAA record of "test.tahi.org" 3. Wait Echo request to test.tahi.org 4. Send Echo reply from test.tahi.org
DNS query message
Destination address is one of fec0:000:0000:ffff::1, fec0:000:0000:ffff::2, fec0:000:0000:ffff::3
Header
  QR 0 (SQUERY)
  OPCODE 0 (SQUERY)
Question section
  QNAME test.tahi.org
  QTYPE 28 (IPv6 address)
  QCLASS 1 (Internet)

DNS standard query response message
Header
  QR 1 (RESPONSE)
  OPCODE 0 (SQUERY)
  AA 1 (Authoritative Answer)
Question section
  QNAME test.tahi.org
  QTYPE 28 (IPv6 address)
  QCLASS 1 (Internet)
Answer section
  RRs  
    NAME test.tahi.org
    TYPE 28 (IPv6 address)
    CLASS 1 (Internet)
    TTL 1800 (second)
    RDLENGTH 16
    RDATA 3ffe:501:ffff:101:200:ff:fe00:a2a2
=end html =head1 JUDGMENT =begin html

  1. DNS query messages is recieved to the site local address of either fec0:0000:0000:fff::1,
 fec0:0000:0000:fff::2 or fec0:0000:0000:fff::3.

  2. ICMP Echo Request is recieved
=end html =head1 TERMINATION N/A =head1 REFERENCE =begin html
draft-ietf-ipv6-dns-discovery-07.txt
6.1 Simple case, general purpose recursive DNS server

This example shows the case of a network that manages one recursive DNS server and a large number of nodes running DNS stub resolvers. The recursive DNS server is performing (and caching) all the recursive queries on behalf of the stub resolvers. The recursive DNS server is configured with an IPv6 address taken from the prefix delegated to the site and with the 3 well known addresses defined in this memo. The stub resolvers are either configured with the "real" IPv6 address of the recursive DNS server or with the well known site local unicast addresses defined in this memo.
-------------------------------------------- | | | --------------------- | | |DNS stub resolver | | | |configured with the| | | |"real" address of | | | |the recursive DNS | | | |server | | | --------------------- | | ----------- | | | |recursive| | | | |DNS |<---------- | | |server |<---------------- | | ----------- | | | ---------------------- | | |DNS stub resolver | | | |configured with 3 | | | |well known addresses| | | ---------------------- | | | --------------------------------------------
(The recursive DNS server is configured to listen both on its IPv6 address and on the well known address)
6.4 DNS forwarder with DHCPv6 interactions
b) other nodes simply send their DNS request to the reserved site local addresses.
------------- / | ---------- -------------- / customer | |ISP | |customer CPE| / site | |DNS |===========| DNS|====< | |resolver| <------|---forwarder|-----\----non DHCPv6| ---------- -------------- \ node | \ | ------------- (Internal nodes use the reserved site local unicast address.)
=end html =head1 SEE ALSO perldoc V6evalTool perldoc V6evalRemote =cut