/testing/guestbin/swan-prep
north #
 ip link set ipsec2 down 2>/dev/null && ip link del ipsec2 2>/dev/null
north #
 ip link set ipsec3 down 2>/dev/null && ip link del ipsec3 2>/dev/null
north #
 ipsec start
Redirecting to: [initsystem]
north #
 /testing/pluto/bin/wait-until-pluto-started
north #
 ipsec auto --add north-east
002 added connection description "north-east"
north #
 ipsec auto --add north-west
002 added connection description "north-west"
north #
 echo "initdone"
initdone
north #
 ipsec auto --up north-west
1v2 "north-west" #1: initiating IKEv2 IKE SA
1v2 "north-west" #1: STATE_PARENT_I1: sent v2I1, expected v2R1
1v2 "north-west" #2: STATE_PARENT_I2: sent v2I2, expected v2R2 {auth=IKEv2 cipher=AES_GCM_16_256 integ=n/a prf=HMAC_SHA2_512 group=MODP2048}
002 "north-west" #2: IKEv2 mode peer ID is ID_FQDN: '@west'
003 "north-west" #2: Authenticated using authby=secret
002 "north-west" #2: route-client output: leftsubet == rightsubnet = 0.0.0.0/0 can not add route
002 "north-west" #2: negotiated connection [0.0.0.0-255.255.255.255:0-65535 0] -> [0.0.0.0-255.255.255.255:0-65535 0]
004 "north-west" #2: STATE_V2_IPSEC_I: IPsec SA established tunnel mode {ESP=>0xESPESP <0xESPESP xfrm=AES_GCM_16_256-NONE NATOA=none NATD=none DPD=passive}
north #
 ip -s link show ipsec2
X: ipsec2@eth1: <NOARP,UP,LOWER_UP> mtu 1500 state UNKNOWN
    RX: bytes  packets  errors  dropped overrun mcast   
    0          0        0       0       0       0       
    TX: bytes  packets  errors  dropped carrier collsns 
    0          0        0       0       0       0       
north #
 ip route add 192.0.1.0/24 dev ipsec2
north #
 ping -w 4 -c 4 192.0.1.254
PING 192.0.1.254 (192.0.1.254) 56(84) bytes of data.
64 bytes from 192.0.1.254: icmp_seq=1 ttl=64 time=0.XXX ms
64 bytes from 192.0.1.254: icmp_seq=2 ttl=64 time=0.XXX ms
64 bytes from 192.0.1.254: icmp_seq=3 ttl=64 time=0.XXX ms
64 bytes from 192.0.1.254: icmp_seq=4 ttl=64 time=0.XXX ms
--- 192.0.1.254 ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time XXXX
rtt min/avg/max/mdev = 0.XXX/0.XXX/0.XXX/0.XXX ms
north #
 ip -s link show ipsec2
X: ipsec2@eth1: <NOARP,UP,LOWER_UP> mtu 1500 state UNKNOWN
    RX: bytes  packets  errors  dropped overrun mcast   
    336        4        0       0       0       0       
    TX: bytes  packets  errors  dropped carrier collsns 
    336        4        0       0       0       0       
north #
 ipsec trafficstatus
006 #2: "north-west", type=ESP, add_time=1234567890, inBytes=336, outBytes=336, id='@west'
north #
 # second connection will fail
north #
 ipsec auto --up north-east
1v2 "north-east" #3: initiating IKEv2 IKE SA
1v2 "north-east" #3: STATE_PARENT_I1: sent v2I1, expected v2R1
1v2 "north-east" #4: STATE_PARENT_I2: sent v2I2, expected v2R2 {auth=IKEv2 cipher=AES_GCM_16_256 integ=n/a prf=HMAC_SHA2_512 group=MODP2048}
002 "north-east" #4: IKEv2 mode peer ID is ID_FQDN: '@east'
003 "north-east" #4: Authenticated using authby=secret
002 "north-east" #4: negotiated connection [0.0.0.0-255.255.255.255:0-65535 0] -> [0.0.0.0-255.255.255.255:0-65535 0]
004 "north-east" #4: STATE_V2_IPSEC_I: IPsec SA established tunnel mode {ESP=>0xESPESP <0xESPESP xfrm=AES_GCM_16_256-NONE NATOA=none NATD=none DPD=passive}
north #
 ip -s link show ipsec2
X: ipsec2@eth1: <NOARP,UP,LOWER_UP> mtu 1500 state UNKNOWN
    RX: bytes  packets  errors  dropped overrun mcast   
    336        4        0       0       0       0       
    TX: bytes  packets  errors  dropped carrier collsns 
    336        4        0       0       0       0       
north #
 ip route add 192.0.2.0/24 dev ipsec3
north #
 ping -w 4 -c 4 192.0.2.254
PING 192.0.2.254 (192.0.2.254) 56(84) bytes of data.
64 bytes from 192.0.2.254: icmp_seq=1 ttl=64 time=0.XXX ms
64 bytes from 192.0.2.254: icmp_seq=2 ttl=64 time=0.XXX ms
64 bytes from 192.0.2.254: icmp_seq=3 ttl=64 time=0.XXX ms
64 bytes from 192.0.2.254: icmp_seq=4 ttl=64 time=0.XXX ms
--- 192.0.2.254 ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time XXXX
rtt min/avg/max/mdev = 0.XXX/0.XXX/0.XXX/0.XXX ms
north #
 ip -s link show ipsec3
X: ipsec3@eth1: <NOARP,UP,LOWER_UP> mtu 1500 state UNKNOWN
    RX: bytes  packets  errors  dropped overrun mcast   
    336        4        0       0       0       0       
    TX: bytes  packets  errors  dropped carrier collsns 
    336        4        0       0       0       0       
north #
 ipsec trafficstatus
006 #4: "north-east", type=ESP, add_time=1234567890, inBytes=336, outBytes=336, id='@east'
006 #2: "north-west", type=ESP, add_time=1234567890, inBytes=336, outBytes=336, id='@west'
north #
 echo "initdone"
initdone
north #
 ipsec whack --trafficstatus
006 #4: "north-east", type=ESP, add_time=1234567890, inBytes=336, outBytes=336, id='@east'
006 #2: "north-west", type=ESP, add_time=1234567890, inBytes=336, outBytes=336, id='@west'
north #
 ../bin/check-for-core.sh
north #
 if [ -f /sbin/ausearch ]; then ausearch -r -m avc -ts recent ; fi

