nm-l2tp / NetworkManager-l2tp

L2TP and L2TP/IPsec support for NetworkManager
GNU General Public License v2.0
486 stars 83 forks source link

service: determine correct local IP address for IPSec #215

Closed araujorm closed 9 months ago

araujorm commented 9 months ago

The ipsec %defaultroute keyword is used to have Strongswan/Libreswan use the local address of the default route network interface at the point of startup or configuration reload. It's probably a fair bet that this would be the interface used to connect to the VPN gateway, but that's not guaranteed. To support the latter, determine the IP address directly by connecting to the gateway and using the getsockname(2) system call to derive the local socket address.

Adapted from: https://github.com/katalix/NetworkManager-l2tp/commit/2d1720e17ddf9b7a7d02399e6a1eacb747080cd8 Credits to https://github.com/katalix and https://github.com/tomparkin for the original work.

araujorm commented 9 months ago

Please check if the commit message is fine, mainly if the credits are properly mentioned.

dkosovic commented 9 months ago

I can confirm the author of the original work is okay with the way the credits are mentioned.

Thanks for the pull request.