alice::swanctl --list-sas --raw 2> /dev/null::mobike.*state=ESTABLISHED local-host=PH_IP_ALICE local-port=4500 local-id=alice@strongswan.org remote-host=PH_IP_SUN remote-port=4500 remote-id=sun.strongswan.org.*protocol=ESP encap=yes spi-in.*local-ts=\[10.3.0.3/32] remote-ts=\[10.2.0.0/16]::YES
sun::  swanctl --list-sas --raw 2> /dev/null::mobike.*state=ESTABLISHED local-host=PH_IP_SUN local-port=4500 local-id=sun.strongswan.org remote-host=PH_IP_MOON remote-port=1... remote-id=alice@strongswan.org.*protocol=ESP encap=yes spi-in.*local-ts=\[10.2.0.0/16] remote-ts=\[10.3.0.3/32]::YES
alice::ping -c 1 PH_IP_BOB::64 bytes from PH_IP_BOB: icmp_.eq=1::YES
bob::  ping -c 1 10.3.0.3::64 bytes from 10.3.0.3: icmp_.eq=1::YES
# wait until one DPD has been exchanged, as we can't detect changed NAT mappings
# with the NAT-D payloads from IKE_SA_INIT as we changed the ports with IKE_AUTH
alice::sleep 6::No output expected::NO
# simulate a restart of the NAT router, bob won't be able to ping
moon::iptables -t nat -F
moon::iptables -t nat -A POSTROUTING -o eth0 -s 10.1.0.0/16 -p udp -j SNAT --to-source PH_IP_MOON:5000-5100
moon::conntrack -F
bob::ping -c 1 -W 1 10.3.0.3::64 bytes from 10.3.0.3: icmp_.eq=1::NO
# wait until the next DPD detects the changed NAT mapping and updates the endpoints
alice::sleep 6::No output expected::NO
alice::cat /var/log/daemon.log::sending DPD request::YES
alice::cat /var/log/daemon.log::detected changes in NAT mappings, initiating MOBIKE update::YES
sun::  cat /var/log/daemon.log::remote endpoint changed from PH_IP_MOON\[1...] to PH_IP_MOON\[5...]::YES
alice::swanctl --list-sas --raw 2> /dev/null::mobike.*state=ESTABLISHED local-host=PH_IP_ALICE local-port=4500 local-id=alice@strongswan.org remote-host=PH_IP_SUN remote-port=4500 remote-id=sun.strongswan.org.*protocol=ESP encap=yes spi-in.*local-ts=\[10.3.0.3/32] remote-ts=\[10.2.0.0/16]::YES
sun::  swanctl --list-sas --raw 2> /dev/null::mobike.*state=ESTABLISHED local-host=PH_IP_SUN local-port=4500 local-id=sun.strongswan.org remote-host=PH_IP_MOON remote-port=5... remote-id=alice@strongswan.org.*protocol=ESP encap=yes spi-in.*local-ts=\[10.2.0.0/16] remote-ts=\[10.3.0.3/32]::YES
alice::ping -c 1 PH_IP_BOB::64 bytes from PH_IP_BOB: icmp_.eq=1::YES
bob::  ping -c 1 10.3.0.3::64 bytes from 10.3.0.3: icmp_.eq=1::YES
moon::tcpdump::moon.strongswan.org.*sun.strongswan.org.*: UDP-encap: ESP.*::4
moon::tcpdump::sun.strongswan.org.*moon.strongswan.org.*: UDP-encap: ESP.*::5
bob::tcpdump::10.3.0.3.*bob.strongswan.org.*ICMP echo request::2
bob::tcpdump::bob.strongswan.org.*10.3.0.3.*ICMP echo reply::2
bob::tcpdump::bob.strongswan.org.*10.3.0.3.*ICMP echo request::3
bob::tcpdump::10.3.0.3.*bob.strongswan.org.*ICMP echo reply::2
