/testing/guestbin/swan-prep
west #
 ipsec start
Redirecting to: [initsystem]
west #
 ../../guestbin/wait-until-pluto-started
west #
 ipsec whack --impair revival
west #
 ipsec whack --impair suppress-retransmits
west #
 ipsec auto --add west
002 "west": added IKEv2 connection
west #
 # iptables -A INPUT -s 192.1.2.23 -j LOG --log-prefix "east all"
west #
 # iptables -A INPUT -m u32 --u32 '0x6&0xFF=0x11' -j LOG --log-prefix  "udp log"
west #
 # iptables -A INPUT -m u32 --u32 '0x6 & 0xFF = 0x11 && 0x30 & 0xFFFFFFFF = 0x0:0x8' -j LOG --log-prefix  "ike"
west #
 # Drop the second IPsec rekey message, which is IKE Message ID: 4
west #
 # Message ID : 0 = IKE_INIT, 1 = IKE_AUTH, 2 = REKEY (First one let it go)
west #
 # 3 : DELETE, 4 = REKEY (DROP)
west #
 # iptables -A INPUT -m u32 --u32 '0x6 & 0xFF = 0x11 && 0x30 & 0xFFFFFFFF = 0x4' -j LOG --log-prefix  "ike"
west #
 iptables -A INPUT -m u32 --u32 '0x6 & 0xFF = 0x11 && 0x30 & 0xFFFFFFFF = 0x4' -j DROP
west #
 sleep 4
west #
 echo "initdone"
initdone
west #
 ipsec auto --status | grep west
000 "west": 192.1.2.45<192.1.2.45>[@west]...192.1.2.23<192.1.2.23>[@east]; unrouted; eroute owner: #0
000 "west":     oriented; my_ip=unset; their_ip=unset; my_updown=ipsec _updown;
000 "west":   xauth us:none, xauth them:none,  my_username=[any]; their_username=[any]
000 "west":   our auth:secret, their auth:secret
000 "west":   modecfg info: us:none, them:none, modecfg policy:push, dns:unset, domains:unset, cat:unset;
000 "west":   sec_label:unset;
000 "west":   ike_life: 28800s; ipsec_life: 28800s; replay_window: 32; rekey_margin: 540s; rekey_fuzz: 100%; keyingtries: 0;
000 "west":   retransmit-interval: 9999ms; retransmit-timeout: 99s; iketcp:no; iketcp-port:4500;
000 "west":   initial-contact:no; cisco-unity:no; fake-strongswan:no; send-vendorid:no; send-no-esp-tfc:no;
000 "west":   policy: IKEv2+PSK+ENCRYPT+TUNNEL+PFS+IKE_FRAG_ALLOW+ESN_NO;
000 "west":   v2-auth-hash-policy: none;
000 "west":   conn_prio: 32,32; interface: eth1; metric: 0; mtu: unset; sa_prio:auto; sa_tfc:none;
000 "west":   nflog-group: unset; mark: unset; vti-iface:unset; vti-routing:no; vti-shared:no; nic-offload:auto;
000 "west":   our idtype: ID_FQDN; our id=@west; their idtype: ID_FQDN; their id=@east
000 "west":   dpd: action:hold; delay:0; timeout:0; nat-t: encaps:auto; nat_keepalive:yes; ikev1_natt:both
000 "west":   newest ISAKMP SA: #0; newest IPsec SA: #0; conn serial: $1;
west #
 ipsec auto --up west
1v2 "west" #1: initiating IKEv2 connection
1v2 "west" #1: sent IKE_SA_INIT request
1v2 "west" #1: sent IKE_AUTH request {cipher=AES_GCM_16_256 integ=n/a prf=HMAC_SHA2_512 group=MODP2048}
003 "west" #1: established IKE SA; authenticated using authby=secret and peer ID_FQDN '@east'
004 "west" #2: established Child SA; IPsec tunnel [192.1.2.45-192.1.2.45:0-65535 0] -> [192.1.2.23-192.1.2.23:0-65535 0] {ESP=>0xESPESP <0xESPESP xfrm=AES_GCM_16_256-NONE NATOA=none NATD=none DPD=passive}
west #
 # ../../guestbin/ping-once.sh ...?
west #
 taskset 0x3 ping -n -q -w 3 -c 2 192.1.2.23
PING 192.1.2.23 (192.1.2.23) 56(84) bytes of data.
--- 192.1.2.23 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time XXXX
rtt min/avg/max/mdev = 0.XXX/0.XXX/0.XXX/0.XXX ms
west #
 ipsec trafficstatus
006 #2: "west", type=ESP, add_time=1234567890, inBytes=168, outBytes=168, id='@east'
west #
 # this rekey, 1 #3, should succeed
west #
 ipsec whack --rekey-ipsec --name west
002 "west" #3: initiating rekey to replace Child SA #2
1v2 "west" #3: sent CREATE_CHILD_SA request to rekey IPsec SA
002 "west" #3: rekeyed #2 STATE_V2_REKEY_CHILD_I1 and expire it remaining life XXs
004 "west" #3: established Child SA; IPsec tunnel [192.1.2.45-192.1.2.45:0-65535 0] -> [192.1.2.23-192.1.2.23:0-65535 0] {ESP=>0xESPESP <0xESPESP xfrm=AES_GCM_16_256-NONE-MODP2048 NATOA=none NATD=none DPD=passive}
002 "west" #2: deleting established Child SA using IKE SA #1
005 "west" #2: ESP traffic information: in=168B out=168B
west #
 sleep 15
west #
 # this rekey, 2 #4, should fail creating an unacknowledged message and dead lock
west #
 ipsec whack --rekey-ipsec --name west
002 "west" #4: initiating rekey to replace Child SA #3
1v2 "west" #4: sent CREATE_CHILD_SA request to rekey IPsec SA
031 "west" #1: STATE_V2_ESTABLISHED_IKE_SA: 60 second timeout exceeded after 0 retransmits.  No response (or no acceptable response) to our IKEv2 message
002 "west" #1: liveness action - putting connection into hold
002 "west" #4: deleting state (STATE_V2_REKEY_CHILD_I1) and NOT sending notification
003 "west" #4: ERROR: netlink response for Del SA esp.ESPSPIi@192.1.2.45 included errno 3: No such process
005 "west" #3: ESP traffic information: in=0B out=0B
002 "west" #1: deleting state (STATE_V2_ESTABLISHED_IKE_SA) and sending notification
002 "west" #1: IMPAIR: skipping revival of connection that is supposed to remain up
west #
 # this rekey, 3 #5, message will not be sent, #1.#5
west #
 ipsec whack --rekey-ipsec --name west
002 connection does not have Child SA
west #
 # there should be one hit
west #
 grep "next initiator blocked by outstanding" OUTPUT/west.pluto.log | sed -e 's/\(.*\ |\)//' | sort -u
west #
 ipsec status | grep STATE_
west #
 echo done
done
west #
 ipsec whack --trafficstatus
west #
 # policies and state should be multiple
west #
 
