]> git.ipfire.org Git - thirdparty/strongswan.git/commit
ike-natd: Fake NAT situation or disable NAT-D if source IP is undetermined
authorTobias Brunner <tobias@strongswan.org>
Tue, 29 Jun 2021 14:11:51 +0000 (16:11 +0200)
committerTobias Brunner <tobias@strongswan.org>
Tue, 15 Feb 2022 15:09:26 +0000 (16:09 +0100)
commitaaa505dbf06f78d1b29fe179a8cf51bb12a625d1
tree95cef6e82910c34cb479b1b7090cb5e17c49aeb3
parentd6879ef984bf30e521a5db07dd9a070e4cc09644
ike-natd: Fake NAT situation or disable NAT-D if source IP is undetermined

This can happen if an IKE_SA is initiated to a static IP before DHCP is
done.  Instead of failing the initiation, we either fake a NAT situation
(for IPv4) or disable NAT-D (for IPv6 where NATs and UDP-encap are not
widely used or supported).

This also removes the old fallbacks to determine the source address(es).
A source address lookup is done in ike_sa_t::resolve_hosts() (wasn't the
case initially) and enumerating local IPs (which was added even earlier)
could still lead to issues if e.g. LAN addresses are available but the
WAN address that's later used is not yet (in which case only the responder
would detect a NAT and UDP-encap would be configured asymmetrically).

To force UDP-encap locally in case there is no actual NAT, we store this
as COND_NAT_HERE instead of COND_NAT_FAKE.  This ensures DPDs will contain
NAT-D notifies and we can later remove the state via MOBIKE.  We trigger
a MOBIKE update after such a DPD by registering a changed NAT mapping after
checking for a disappearing local NAT, which is very unlikely to happen
outside of a MOBIKE update (where that flag is not checked).
src/libcharon/sa/ikev2/tasks/ike_natd.c