#!/usr/bin/perl # # $Copyright$ # # $Id: RTU_A_Out_2SA_SspiDipdst.seq,v 1.1.1.1 2000/10/31 22:38:52 sekiya Exp $ # ###################################################################### BEGIN { unshift(@INC, '../ipsec/'); $V6evalTool::TestVersion = '$Name: $ '; } use V6evalTool; use IPSEC; %pktdesc = ( ### TBD ); $IF0 = Link0; $IF1 = Link1; #----- check NUT type ipsecCheckNUT(router); #----- set SAD,SPD vLogHTML("*** Target initialization phase ***
"); ipsecClearAll(); ## SG1 vs NUT ipsecSetSAD( "src=$IPSEC::IPsecAddr{IPSEC_NUT_NET0_ADDR}" , "dst=$IPSEC::IPsecAddr{IPSEC_SG1_NET2_ADDR}" , "spi=0x1000" , "mode=tunnel" , "direction=out" , "protocol=ah" , "aalgo=hmac-md5" , "aalgokey=0123456789ABCDEF" , "nsrc=$IPSEC::IPsecAddr{IPSEC_NET1_ADDR}" , "ndst=$IPSEC::IPsecAddr{IPSEC_NET4_ADDR}" , ); ipsecSetSPD( "src=$IPSEC::IPsecAddr{IPSEC_NET1_ADDR}" , "dst=$IPSEC::IPsecAddr{IPSEC_NET4_ADDR}" , "upperspec=any" , "direction=out" , "protocol=ah" , "mode=tunnel" , "tsrc=$IPSEC::IPsecAddr{IPSEC_NUT_NET0_ADDR}" , "tdst=$IPSEC::IPsecAddr{IPSEC_SG1_NET2_ADDR}" , ); ## SG2 vs NUT ipsecSetSAD( "src=$IPSEC::IPsecAddr{IPSEC_NUT_NET0_ADDR}" , "dst=$IPSEC::IPsecAddr{IPSEC_SG2_NET2_ADDR}" , "spi=0x1000" , "mode=tunnel" , "direction=out" , "protocol=ah" , "aalgo=hmac-md5" , "aalgokey=foo0foo1foo2foo3" , "nsrc=$IPSEC::IPsecAddr{IPSEC_NET1_ADDR}" , "ndst=$IPSEC::IPsecAddr{IPSEC_NET6_ADDR}" , ); ipsecSetSPD( "src=$IPSEC::IPsecAddr{IPSEC_NET1_ADDR}" , "dst=$IPSEC::IPsecAddr{IPSEC_NET6_ADDR}" , "upperspec=any" , "direction=out" , "protocol=ah" , "mode=tunnel" , "tsrc=$IPSEC::IPsecAddr{IPSEC_NUT_NET0_ADDR}" , "tdst=$IPSEC::IPsecAddr{IPSEC_SG2_NET2_ADDR}" , ); ipsecEnable(); #====================================================================== vLogHTML("*** Target testing phase ***
"); vCapture($IF0); vCapture($IF1); # ====tunnel-1===> ($stat, %ret) = ipsecForwardEncap($IF1, $IF0, 'echo_reply_from_host1_net1_to_host1_net4_on_net1', 'ahtun_to_sg1_net2_echo_reply_from_host1_net1_to_host1_net4_on_net0'); if ($stat ne 'GOT_PACKET') { vLogHTML('TN received no encapuslated packet from NUT
'); ipsecExitFail(); } vLogHTML("TN received encapsulated packet from HOST1_NET1 to HOST1_NET4.
"); vLogHTML("Tunnel over 1st SA bundle is available.
"); # ====tunnel-2===> ($stat, %ret) = ipsecForwardEncap($IF1, $IF0, 'echo_reply_from_host1_net1_to_host1_net6_on_net1', 'ahtun_to_sg2_net2_echo_reply_from_host1_net1_to_host1_net6_on_net0'); if ($stat ne 'GOT_PACKET') { vLogHTML('TN received no encapuslated packet from NUT
'); ipsecExitFail(); } vLogHTML("TN received encapsulated packet from HOST1_NET1 to HOST1_NET6.
"); vLogHTML("Tunnel over 2nd SA bundle is available.
"); vLogHTML("Tunnel over coexisting two SA bundles are available.
"); ipsecExitPass(); ###################################################################### __END__ =head1 NAME RTU_A_Out_2SA_SspiDipdst - Router Tunnel Mode AH Outbound 2 SA selection, Same SPI, Different IPdst =head1 TARGET Router =head1 SYNOPSIS =begin html
  RTU_A_Out_2SA_SspiDipdst.seq [-tooloption ...] -pkt RTU_A_2SA_SspiDip.def
    -tooloption : v6eval tool option
  See also HTR_A_common.def and HTR_common.def
=end html =head1 INITIALIZATION =begin html

For details of Network Topology, see 00README

Set NUT's SAD and SPD as following:

                          (Link0)  (Link1)
            NET4   NET2      NET0   NET1
  HOST1_NET4 -- SG1 +- Router -- NUT -- HOST1_NET1
                 <==|=tunnel======= (SA1)
            NET6    |
  HOST1_NET6 -- SG2 +
                 <====tunnel======= (SA2)

Security Association Database (SAD) for SA1

source address NUT_NET0
destination address SG1_NET2
SPI 0x1000
mode tunnel
protocol AH
AH algorithm HMAC-MD5
ESP algorithm key 0123456789ABCDEF

Security Policy Database (SPD) for SA1

tunnel source address NUT_NET0
tunnel destination address SG1_NET2
source address NET1
destination address NET4
upper spec any
direction out
protocol AH
mode tunnel

Security Association Database (SAD) for SA2

source address NUT_NET0
destination address SG2_NET2
SPI 0x1000
mode tunnel
protocol AH
AH algorithm HMAC-MD5
AH algorithm key foo0foo1foo2foo3

Security Policy Database (SPD) for SA2

tunnel source address NUT_NET0
tunnel destination address SG2_NET2
source address NET1
destination address NET6
upper spec any
direction out
protocol AH
mode tunnel
=end html =head1 TEST PROCEDURE =begin html
 Tester                      Target                      Tester
              (Link0)                     (Link1)
   |                           |                           |
   |                           |<--------------------------|
   |                           |      ICMP Echo Reply      |
   |                           |       ToHost1Net4         |
   |                           |                           |
   |<--------------------------|                           |
   |      ICMP Echo Reply      |                           |
   |       ToHost1Net4         |                           |
   |        (using SA1)        |                           |
   |                           |                           |
   |                           |                           |
   |                           |<--------------------------|
   |                           |      ICMP Echo Reply      |
   |                           |       ToHost1Net6         |
   |                           |                           |
   |<--------------------------|                           |
   |      ICMP Echo Reply      |                           |
   |       ToHost1Net6         |                           |
   |        (using SA2)        |                           |
   |                           |                           |
   |                           |                           |
   v                           v                           v
  1. Send ICMP Echo Reply ToHost1Net4 to Link1
  2. Receive ICMP Echo Reply ToHost1Net4 using SA1 from Link0
  3. Send ICMP Echo Reply ToHost1Net6 to Link1
  4. Receive ICMP Echo Reply ToHost1Net6 using SA2 from Link0

ICMP Echo Reply ToHost1Net4 to Link1

IP Header Source Address HOST1_NET1
Destination Address HOST1_NET4
ICMP Type 129 (Echo Reply)

ICMP Echo Reply ToHost1Net4 using SA1 from Link0

IP Header Source Address NUT_NET0
Destination Address SG1_NET2
AH SPI 0x1000
Algorithm HMAC-MD5
Key 0123456789ABCDEF
IP Header Source Address HOST1_NET1
Destination Address HOST1_NET4
ICMP Type 129 (Echo Reply)

ICMP Echo Reply ToHost1Net6 to Link1

IP Header Source Address HOST1_NET1
Destination Address HOST1_NET6
ICMP Type 129 (Echo Reply)

ICMP Echo Reply ToHost1Net6 using SA2 from Link0

IP Header Source Address NUT_NET0
Destination Address SG2_NET2
AH SPI 0x1000
Algorithm HMAC-MD5
Key foo0foo1foo2foo3
IP Header Source Address HOST1_NET1
Destination Address HOST1_NET6
ICMP Type 129 (Echo Reply)
=end html =head1 JUDGEMENT PASS: Both ICMP Echo Reply (using SA1, SA2) received =head1 SEE ALSO perldoc V6evalTool =begin html
  IPSEC.html IPsec Test Common Utility
=end html =cut