/testing/guestbin/swan-prep --x509
Preparing X.509 files
road #
 certutil -D -n east -d sql:/etc/ipsec.d
road #
 cp road-ikev2-oe.conf /etc/ipsec.d/ikev2-oe.conf
road #
 cp policies/* /etc/ipsec.d/policies/
road #
 echo "192.1.2.0/24"  >> /etc/ipsec.d/policies/private-or-clear
road #
 echo "192.1.3.0/24"  >> /etc/ipsec.d/policies/private
road #
 echo "192.1.4.66/32"  >> /etc/ipsec.d/policies/private-or-clear
road #
 # scan every 10s
road #
 ipsec pluto --config /etc/ipsec.conf --expire-shunt-interval 10
road #
 ../../guestbin/wait-until-pluto-started
road #
 # give OE policies time to load
road #
 ../../guestbin/wait-for.sh --match 'loaded 13' -- ipsec auto --status
000 Total IPsec connections: loaded 13, active 0
road #
 echo "initdone"
initdone
road #
 #sleep 30; # enable to get time to attach ip xfrm monitor
road #
 # trigger a private-or-clear and check for shunt and shunt expiry
road #
 ../../guestbin/ping-once.sh --forget -I 192.1.3.209 192.1.2.23
fired and forgotten
road #
 # wait on OE to start: should show nothing in shuntstatus (shunt is
road #
 # not bare, but with conn), should show up in xfrm policy and show
road #
 # partial STATE
road #
 ../../guestbin/wait-for.sh --match '#1:.*sent IKE_SA_INIT request' -- ipsec status
000 #1: "private-or-clear#192.1.2.0/24"[1] ...192.1.2.23:500 STATE_V2_PARENT_I1 (sent IKE_SA_INIT request); RETRANSMIT in XXs; idle;
road #
 ipsec whack --shuntstatus
000 Bare Shunt list:
000  
road #
 ip -o xfrm pol | grep 192.1.2.23
src 192.1.3.209/32 dst 192.1.2.23/32 \	dir out priority 3129279 ptype main \
road #
 # wait on OE to fail: should show pass in shuntstatus and xfrm policy
road #
 # and without partial STATE
road #
 ../../guestbin/wait-for.sh --match oe-failing -- ipsec shuntstatus
000 192.1.3.209/32 -0-> 192.1.2.23/32 => %pass 0    oe-failing
road #
 ip -o xfrm pol | grep 192.1.2.23
src 192.1.3.209/32 dst 192.1.2.23/32 \	dir out priority 3129279 ptype main \
road #
 ipsec status | grep STATE_ || true
road #
 # wait on OE shunt to expire: should show no more shunts for
road #
 # 192.1.2.23, no xfrm policy and no STATE's
road #
 ../../guestbin/wait-for.sh --timeout 60 --no-match oe-failing -- ipsec shuntstatus
road #
 ip -o xfrm pol | grep 192.1.2.23 || true
road #
 ipsec status | grep STATE_ || true
road #
 # repeat test with a hold shunt - but it really shouldn't matter
road #
 # trigger a private and check for shunt and shunt expiry
road #
 ../../guestbin/ping-once.sh --forget -I 192.1.3.209 192.1.3.46
fired and forgotten
road #
 # wait on OE to start: should show nothing in shuntstatus (shunt is
road #
 # not bare, but with conn), should show nothing in xfrm policy because
road #
 # SPI_HOLD (drop) is a no-op for XFRM as the larval state causes it
road #
 # already and should show show partial STATE
road #
 ../../guestbin/wait-for.sh --match '#2:.*sent IKE_SA_INIT request' -- ipsec status
000 #2: "private#192.1.3.0/24"[1] ...192.1.3.46:500 STATE_V2_PARENT_I1 (sent IKE_SA_INIT request); RETRANSMIT in XXs; idle;
road #
 ipsec whack --shuntstatus
000 Bare Shunt list:
000  
road #
 ip -o xfrm pol | grep 192.1.3.46 || true
road #
 # wait for OE to fail: should show pass in shuntstatus and xfrm policy
road #
 # and without partial STATE
road #
 ../../guestbin/wait-for.sh --match oe-failing -- ipsec shuntstatus
000 192.1.3.209/32 -0-> 192.1.3.46/32 => %drop 0    oe-failing
road #
 ip -o xfrm pol | grep 192.1.3.46 || true
road #
 ipsec status | grep STATE_ || true
road #
 # wait for failing shunt to expire: should show no more shunts for
road #
 # 192.1.3.46, no xfrm policy and no STATE's
road #
 ../../guestbin/wait-for.sh --timeout 60 --no-match oe-failing -- ipsec shuntstatus
road #
 ip -o xfrm pol | grep 192.1.3.46 || true
road #
 ipsec status | grep STATE_ || true
road #
 
