Wireguard reconnecting issue on routing change

Support requests about VPN Client Pro
Post Reply
bluemist
Posts: 4
Joined: Mon Nov 08, 2021 10:13 pm

Wireguard reconnecting issue on routing change

Post by bluemist »

Hello,

I signed up for 7 days trial on Android TV 10. Very nice app although it can be a bit too much for average user. I would suggest to make it less complicated. A click on profile should automatically connect (1 click connect / diconnect), details such as traffic, data downloaded could also be shown on the main page, instead of opening another window.

So what happens is that I sometimes change routing on the router itself to connect or disconnect to VPN. This is causing VPN Client Pro to not behave properly. It keeps reconnecting and cannot reconnect. If I manually disconnect and reconnect it is fine. If I do nothing, it will keep doing that forever until I disconnect VPN on the router - then it will eventually reconnect.

I have attached error log but I don't think there is anything valuable in it. You can try to reproduce the same steps on your end:
1. Connect Wireguard protocol on the app
2. Connect VPN on the router (this is different VPN than those setup on the app).
3. This will cause the app to try to reconnect with endless timeouts.
4. Disconnect app manually and connect. It will connect
OR
5. Disconnect VPN on the router, it will reconnect immediately.

Is it possible to fix it?

As there is no way to attach the log of txt file, please see it below:
https://d.pr/f/JGmREx
admin
Site Admin
Posts: 811
Joined: Fri Feb 15, 2019 4:04 pm
Contact:

Re: Wireguard reconnecting issue on routing change

Post by admin »

Hello,

thank you for the suggestions.

This behavior is by design, the app cannot detect the changes in the network topology, so if the remote server is unreachable it will keep retrying until the VPN is manually disconnected or the connection is established.
bluemist
Posts: 4
Joined: Mon Nov 08, 2021 10:13 pm

Re: Wireguard reconnecting issue on routing change

Post by bluemist »

admin wrote: Wed Nov 10, 2021 9:04 am Hello,

thank you for the suggestions.

This behavior is by design, the app cannot detect the changes in the network topology, so if the remote server is unreachable it will keep retrying until the VPN is manually disconnected or the connection is established.
I understand but there must be a way to fix it? Why not to implement a feature which will allow you to do a full reconnect (by fully disconnecting and reconnecting) e.g. after 5 unsuccessful reconnections? There should be some workarounds how to tackle this behaviour.
admin
Site Admin
Posts: 811
Joined: Fri Feb 15, 2019 4:04 pm
Contact:

Re: Wireguard reconnecting issue on routing change

Post by admin »

From the problem description it appears that your router is incorrectly handling the routing table cache.
When you start the VPN on the router, it appears that the router is unable to properly route the connections that were already established before the VPN started.
Then the problem should be solved on the router.
Have you tried checking for a firmware update?
bluemist
Posts: 4
Joined: Mon Nov 08, 2021 10:13 pm

Re: Wireguard reconnecting issue on routing change

Post by bluemist »

admin wrote: Wed Nov 10, 2021 9:49 am From the problem description it appears that your router is incorrectly handling the routing table cache.
When you start the VPN on the router, it appears that the router is unable to properly route the connections that were already established before the VPN started.
Then the problem should be solved on the router.
Have you tried checking for a firmware update?
Yes, I am running R9000 with latest FW. If what you are describing is true it would mean other apps or devices in the network would have the same issue but they don't. Neither the Android TV on which the VPN Client Pro is installed have any issues.

I see it as an issue with the app. In fact I saw this issue with other VPNs too, I think the reason is that nobody is simply handling such "topology change" properly (simply because it is not expected behaviour). To make it behave properly the app should simply run a FULL disconnect (same like manual disconnect) and try to connect e.g. 5 seconds later, instead of persistently trying to "reconnect" being within the same (old) networking "topology" that has changed and the app is unaware of it. There could be an option for it where default is "persistent reconnect" and another is do "fully disconnect" and "connect".

I am sure the way it is designed right now could be re-thought. I mean there are not many users that use VPN on the router or that use double VPN like in this case: 1st VPN on the router, 2nd VPN on the Android TV app. So obviously this is a rare issue but that doesn't mean it doesn't exist.

Any thoughts if you can address it?
admin
Site Admin
Posts: 811
Joined: Fri Feb 15, 2019 4:04 pm
Contact:

Re: Wireguard reconnecting issue on routing change

Post by admin »

This problem happens because the VPN is connected through the UDP protocol.
Normally this protocol is used to exchange only a few packets, but when it is used by a VPN the connection becomes persistent. This is why other apps don't have the same problem.

The WireGuard protocol also offers the ability to simultaneously connect to multiple remote servers. For this reason, when the VPN starts, only one UDP socket is opened and then it is reused for all configured remote servers.
The problem is that the router does not route packets correctly until the socket is closed and reopened. This causes the source port to change and this forces the router to open a new session which is routed correctly.

In any case, the problem is due to the way the router handles UDP sessions. When the VPN is established it should invalidate the old sessions in order to re-route them correctly.

As you have already mentioned, this problem affects a few users (at the moment only you) and moreover it is not due to a malfunction of the app, so I'm sorry but for the moment I don't think there are the conditions to change the app behavior.
bluemist
Posts: 4
Joined: Mon Nov 08, 2021 10:13 pm

Re: Wireguard reconnecting issue on routing change

Post by bluemist »

Thanks for your reply. I subscribed for annual subscription anyway to support development and hopefully one day you will come with some smart idea as to how this could be resolved. I can also say that that this issue does not happen for all VPNs once connected to the router, for some yes, for others not - I don't know why.
admin
Site Admin
Posts: 811
Joined: Fri Feb 15, 2019 4:04 pm
Contact:

Re: Wireguard reconnecting issue on routing change

Post by admin »

Thank you very much.
I will think about it...
Post Reply