After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 673636 - pushed route with net_gateway on wrong interface
pushed route with net_gateway on wrong interface
Status: RESOLVED OBSOLETE
Product: NetworkManager
Classification: Platform
Component: VPN: openvpn
0.9.x
Other Linux
: Normal normal
: ---
Assigned To: Dan Williams
NetworkManager maintainer(s)
Depends on:
Blocks:
 
 
Reported: 2012-04-06 12:12 UTC by launchpad
Modified: 2020-11-12 14:27 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
awful patch to circumvent issue (619 bytes, patch)
2013-04-29 23:23 UTC, edward.the.iv
needs-work Details | Review
debug log (3.84 KB, text/plain)
2013-04-29 23:37 UTC, edward.the.iv
  Details

Description launchpad 2012-04-06 12:12:07 UTC
When using push route on server side to bypass the vpn for a specific subnet :
push "route 1.2.3.0 255.255.255.0 net_gateway"

The network manager registers the route on tun0 instead of net_gateway interface :
NetworkManager[1149]: <info> Static Route: 1.2.3.0/24 Next Hop: 1.2.3.0

See the route in kernel :
1.2.3.0 192.168.0.1 255.255.255.0 UG 0 0 0 tun0

192.168.0.1 is on eth2
but route is registered on tun0
and traffic to 1.2.3.0/24 is sent to tun0 instead of eth2

When I launch openvpn in command line I get the correct route :
us=482299 PUSH: Received control message: 'PUSH_REPLY,redirect-gateway def1 bypass-dns bypass-dhcp,route 1.2.3.0 255.255.255.0 net_gateway,comp-lzo yes,route-gateway x.x.x.x,topology subnet,ping 10,ping-restart 120,ifconfig x.x.x.y 255.255.255.0'
us=490292 /sbin/route add -net 1.2.3.0 netmask 255.255.255.0 gw 192.168.0.1
and the route appears on eth2
1.2.3.0 192.168.0.1 255.255.255.0 UG 0 0 0 eth2
then traffic to 1.2.3.0/24 flows through eth2 as expected

Bug was first posted on https://bugs.launchpad.net/ubuntu/+source/network-manager-openvpn/+bug/974912 but it appears to be present on all distributions.
Comment 1 edward.the.iv 2013-04-29 23:22:22 UTC
I'm having this issue as well.  I'm on version 0.9.8.0

The route pushed with net_gateway as a gateway is pushed through tun0.  For some reason, another route is created on tun0 which causes me to lose all connectivity until I remove it or close the VPN.

Like the submitter, when I use openvpn directly, this issue does not occur, but I'm guessing that openVPN does the routes so it ends up working correctly, whereas with networkmanager-openvpn networkmanager handles the routes.
Comment 2 edward.the.iv 2013-04-29 23:23:42 UTC
Created attachment 242872 [details] [review]
awful patch to circumvent issue

This was what I had to apply to circumvent this issue - it does not create the routes at all if the gateway is the same as route_net_gateway
Comment 3 edward.the.iv 2013-04-29 23:37:21 UTC
Created attachment 242873 [details]
debug log

This is part of the debug log, with a lot of information removed.  Hopefully it wasn't too much to be of use.
Comment 4 Bert Driehuis 2015-01-27 23:51:38 UTC
The problem is that nm-openvpn-service doesn't actually use the information from the remote OpenVPN server as part of the "push route" data, which includes whether to use a local or a remote gateway. By not passing down that information, the interface to rtnl_route_add has to resort to trying to guess if an intermediate ("bridge") route is needed, and guesses wrong if a push route tries to poke a hole in another pushed route, by pushing a more-specific route tagged to be routed locally. The code then proceeds by setting a route to your default route through the tunnel, causing a catch-22.

I started to identify how many changes would be required to fix this, but I gave up for tonight.

The "awful patch" actually gets things limping along by ignoring the pushed exceptions, but only if they're trying to poke a /32 sized hole. The patch does not cleanly apply to the current code because a comment was moved around in the mean time.
Comment 5 André Klapper 2020-11-12 14:27:42 UTC
bugzilla.gnome.org is being shut down in favor of a GitLab instance. 
We are closing all old bug reports and feature requests in GNOME Bugzilla which have not seen updates for a long time.

If you still use NetworkManager and if you still see this bug / want this feature in a recent and supported version of NetworkManager, then please feel free to report it at https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/

Thank you for creating this report and we are sorry it could not be implemented (workforce and time is unfortunately limited).