/testing/guestbin/swan-prep --46
west #
 # confirm that the network is alive
west #
 ../../guestbin/wait-until-alive -I 192.0.1.254 192.0.2.254
destination -I 192.0.1.254 192.0.2.254 is alive
west #
 # ensure that clear text does not get through
west #
 iptables -A INPUT -i eth1 -s 192.0.2.0/24 -j DROP
west #
 iptables -I INPUT -m policy --dir in --pol ipsec -j ACCEPT
west #
 # confirm clear text does not get through
west #
 ../../guestbin/ping-once.sh --down -I 192.0.1.254 192.0.2.254
down
west #
 ipsec start
Redirecting to: [initsystem]
west #
 ../../guestbin/wait-until-pluto-started
west #
 ipsec auto --add westnet-eastnet-ikev2
"westnet-eastnet-ikev2": added IKEv2 connection
west #
 echo "initdone"
initdone
west #
 ipsec auto --up westnet-eastnet-ikev2
"westnet-eastnet-ikev2" #1: initiating IKEv2 connection to 2001:db8:1:2::23 using UDP
"westnet-eastnet-ikev2" #1: sent IKE_SA_INIT request to [2001:db8:1:2::23]:UDP/500
"westnet-eastnet-ikev2" #1: processed IKE_SA_INIT response from [2001:db8:1:2::23]:UDP/500 {cipher=3DES_CBC_192 integ=HMAC_SHA1_96 prf=HMAC_SHA1 group=MODP2048}, initiating IKE_AUTH
"westnet-eastnet-ikev2" #1: sent IKE_AUTH request to [2001:db8:1:2::23]:UDP/500
"westnet-eastnet-ikev2" #1: initiator established IKE SA; authenticated peer using authby=secret and ID_FQDN '@east'
"westnet-eastnet-ikev2" #2: initiator established Child SA using #1; IPsec tunnel [2001:db8:0:1::/64===2001:db8:0:2::/64] {ESP=>0xESPESP <0xESPESP xfrm=AES_CBC_256-HMAC_SHA1_96 IPCOMP=>0xESPESP <0xESPESP DPD=passive}
west #
 # First ping is regular ESP since ping is too small to compress.  This
west #
 # oddly shows up as 0 packets and 4 packets on ipcomp.
west #
 ../../guestbin/ping-once.sh --up --small -I 2001:db8:0:1::254 2001:db8:0:2::254
up
west #
 ip -o -s xfrm state|grep "proto comp" | sed "s/^\(.*\)\(lifetime current:.*\)\(add .*$\)/\2/"
lifetime current:\	  60(bytes), 1(packets)\	  
lifetime current:\	  0(bytes), 0(packets)\	  
west #
 # Finally, a packet that is both larger than the MTU and compression
west #
 # friendly.  This then shows up as 4 packets and 8 packets on ipcomp.
west #
 ../../guestbin/ping-once.sh --up --large -I 2001:db8:0:1::254 2001:db8:0:2::254
up
west #
 ip -o -s xfrm state|grep "proto comp" | sed "s/^\(.*\)\(lifetime current:.*\)\(add .*$\)/\2/"
lifetime current:\	  8356(bytes), 7(packets)\	  
lifetime current:\	  8296(bytes), 6(packets)\	  
west #
 # mangled traffic status
west #
 ipsec whack --trafficstatus | sed -e 's/Bytes=\([0-9]\)[0-9][0-9],/Bytes=\1nn,/g'
#2: "westnet-eastnet-ikev2", type=ESP, add_time=1234567890, inBytes=3nn, outBytes=3nn, maxBytes=2^63B, id='@east'
west #
 # should see ipcomp entries
west #
 ../../guestbin/ipsec-kernel-state.sh
src 2001:db8:1:2::45 dst 2001:db8:1:2::23
	proto esp spi 0xSPISPI reqid REQID mode transport
	replay-window 0 
	auth-trunc hmac(sha1) 0xHASHKEY 96
	enc cbc(aes) 0xENCKEY
	lastused YYYY-MM-DD HH:MM:SS
	anti-replay esn context:
	 seq-hi 0x0, seq 0xXX, oseq-hi 0x0, oseq 0xXX
	 replay_window 128, bitmap-length 4
	 00000000 00000000 00000000 XXXXXXXX 
	sel src ::/0 dst ::/0 
src 2001:db8:1:2::45 dst 2001:db8:1:2::23
	proto comp spi 0xSPISPI reqid REQID mode tunnel
	replay-window 0 flag af-unspec
	comp deflate 
	lastused YYYY-MM-DD HH:MM:SS
src 2001:db8:1:2::45 dst 2001:db8:1:2::23
	proto 41 spi 0xSPISPI reqid 0 mode tunnel
	replay-window 0 
src 2001:db8:1:2::23 dst 2001:db8:1:2::45
	proto esp spi 0xSPISPI reqid REQID mode transport
	replay-window 0 
	auth-trunc hmac(sha1) 0xHASHKEY 96
	enc cbc(aes) 0xENCKEY
	lastused YYYY-MM-DD HH:MM:SS
	anti-replay esn context:
	 seq-hi 0x0, seq 0xXX, oseq-hi 0x0, oseq 0xXX
	 replay_window 128, bitmap-length 4
	 00000000 00000000 00000000 XXXXXXXX 
	sel src ::/0 dst ::/0 
src 2001:db8:1:2::23 dst 2001:db8:1:2::45
	proto comp spi 0xSPISPI reqid REQID mode tunnel
	replay-window 0 flag af-unspec
	comp deflate 
	lastused YYYY-MM-DD HH:MM:SS
src 2001:db8:1:2::23 dst 2001:db8:1:2::45
	proto 41 spi 0xSPISPI reqid 0 mode tunnel
	replay-window 0 
	lastused YYYY-MM-DD HH:MM:SS
west #
 ip xfrm policy
src 2001:db8:0:1::/64 dst 2001:db8:0:2::/64 
	dir out priority PRIORITY ptype main 
	tmpl src 2001:db8:1:2::45 dst 2001:db8:1:2::23
		proto comp reqid REQID mode tunnel
	tmpl src :: dst ::
		proto esp reqid REQID mode transport
src 2001:db8:0:2::/64 dst 2001:db8:0:1::/64 
	dir fwd priority PRIORITY ptype main 
	tmpl src 2001:db8:1:2::23 dst 2001:db8:1:2::45
		proto comp reqid REQID mode tunnel
		level use 
	tmpl src :: dst ::
		proto esp reqid REQID mode transport
src 2001:db8:0:2::/64 dst 2001:db8:0:1::/64 
	dir in priority PRIORITY ptype main 
	tmpl src 2001:db8:1:2::23 dst 2001:db8:1:2::45
		proto comp reqid REQID mode tunnel
		level use 
	tmpl src :: dst ::
		proto esp reqid REQID mode transport
src ::/0 dst ::/0 
	socket out priority 0 ptype main 
src ::/0 dst ::/0 
	socket in priority 0 ptype main 
src ::/0 dst ::/0 
	socket out priority 0 ptype main 
src ::/0 dst ::/0 
	socket in priority 0 ptype main 
src ::/0 dst ::/0 
	socket out priority 0 ptype main 
src ::/0 dst ::/0 
	socket in priority 0 ptype main 
src ::/0 dst ::/0 
	socket out priority 0 ptype main 
src ::/0 dst ::/0 
	socket in priority 0 ptype main 
src ::/0 dst ::/0 
	socket out priority 0 ptype main 
src ::/0 dst ::/0 
	socket in priority 0 ptype main 
src ::/0 dst ::/0 
	socket out priority 0 ptype main 
src ::/0 dst ::/0 
	socket in priority 0 ptype main 
src 0.0.0.0/0 dst 0.0.0.0/0 
	socket out priority 0 ptype main 
src 0.0.0.0/0 dst 0.0.0.0/0 
	socket in priority 0 ptype main 
src 0.0.0.0/0 dst 0.0.0.0/0 
	socket out priority 0 ptype main 
src 0.0.0.0/0 dst 0.0.0.0/0 
	socket in priority 0 ptype main 
src 0.0.0.0/0 dst 0.0.0.0/0 
	socket out priority 0 ptype main 
src 0.0.0.0/0 dst 0.0.0.0/0 
	socket in priority 0 ptype main 
src 0.0.0.0/0 dst 0.0.0.0/0 
	socket out priority 0 ptype main 
src 0.0.0.0/0 dst 0.0.0.0/0 
	socket in priority 0 ptype main 
src 0.0.0.0/0 dst 0.0.0.0/0 
	socket out priority 0 ptype main 
src 0.0.0.0/0 dst 0.0.0.0/0 
	socket in priority 0 ptype main 
src 0.0.0.0/0 dst 0.0.0.0/0 
	socket out priority 0 ptype main 
src 0.0.0.0/0 dst 0.0.0.0/0 
	socket in priority 0 ptype main 
src ::/0 dst ::/0 proto ipv6-icmp type 135 
	dir out priority PRIORITY ptype main 
src ::/0 dst ::/0 proto ipv6-icmp type 135 
	dir fwd priority PRIORITY ptype main 
src ::/0 dst ::/0 proto ipv6-icmp type 135 
	dir in priority PRIORITY ptype main 
src ::/0 dst ::/0 proto ipv6-icmp type 136 
	dir out priority PRIORITY ptype main 
src ::/0 dst ::/0 proto ipv6-icmp type 136 
	dir fwd priority PRIORITY ptype main 
src ::/0 dst ::/0 proto ipv6-icmp type 136 
	dir in priority PRIORITY ptype main 
west #
 
