ChaiBangkok / android-openvpn-settings

Automatically exported from code.google.com/p/android-openvpn-settings
GNU General Public License v3.0
0 stars 0 forks source link

Supplemental Changes of Network Cause OpenVPN to Restart #126

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
I noticed on some phones/ROM's the Market and/or Maps applications repeatedly 
cause openvpn-settings to restart openvpn connection, making vpn unusable. 
Those two applications seemingly did not change or break any network settings. 
So I tried to force stop openvpn-settings after vpn had been connected and then 
Market and Maps worked fine over VPN. A further examining of getprop and logs 
showed that net.dnsx.1334 was changed from empty to dns of rmnet0. There may be 
more similar supplemental changes I didn't notice but they were seemingly 
harmless to the vpn connection, however, openvpn-settings thought something 
changed and would restart openvpn and then other applications detected network 
changes, they would set net.dnsx.1334 again and then that went to a dead loop. 

Excerpt from logs, changes made by Maps:
D/ConnectivityService( 1334): setting net.dns1.1334 to xx.xx.xx.xx
D/ConnectivityService( 1334): setting net.dns2.1334 to xx.xx.xx.xx
D/ConnectivityService( 1334): setting net.dns3.1334 to xx.xx.xx.xx
D/ConnectivityService( 1334): setting net.dns4.1334 to xx.xx.xx.xx

Original issue reported on code.google.com by jac...@gmail.com on 4 Mar 2012 at 11:02

GoogleCodeExporter commented 9 years ago
It looks to be something else. Applications that use GPS such as Maps, GPS 
Status, Speedtest, etc. will repeatedly interrupt openvpn after openvpn 
reconnects. The Market application only interrupt openvpn once and after 
openvpn reconnects, Market will work fine. The latter issue, interrupting 
openvpn once or twice and then OK, seems to be common to different phones and 
not a big problem. However, the issue of GPS repeatedly interrupting openvpn 
seems to be specific to the LG Optomus 3D (running rooted stock GB). 

Original comment by jac...@gmail.com on 25 Mar 2012 at 3:14

GoogleCodeExporter commented 9 years ago
I found an application called "Feat VPN" which implements a virtual openvpn 
client. It is very robust and won't be interrupt by other applications such as 
the Market, Speedtest or GPS applications. It only reconnects when the 
connection is actually dropped. The implementation looks to be sound and does 
not have the DNS issue. 

Original comment by jac...@gmail.com on 25 Mar 2012 at 6:07

GoogleCodeExporter commented 9 years ago
While trying to run the VPN with scripts managed by Script Manager, I noticed 
that the onNetwork(change) script was triggered each time the GPS or Market 
were started, which indicated that the GPS or Market application triggered some 
network change event while apparently there was no crucial change to the 
network config. 

The only difference I noticed between running my scripts and running OpenVPN 
Settings was that the GPS application only triggered the onNetworkChange script 
once when staying within the GPS application, while the GPS application would 
repeatly interrupt OpenVPN Settings. It looks like OpenVPN Settings flushed 
some settings established by the GPS application when trying to reconnect, 
however, the GPS application then wanted to re-establish the settings which 
again triggered OpenVPN Settings to reconnect. 

The solution could be very simple. Just save the network config when the VPN is 
connected, and when there is a network change event received, try to compare 
the current config with the saved config. If there is no crucial change that 
could result in network malfunction, do not try to reconnect the VPN, or if a 
reconnection is necessary, do not flush those non-crucial changes made by other 
applications because this could result in a reconnection loop. 

BTW, this issue should be merged with issue 34. 

Original comment by jac...@gmail.com on 6 Apr 2012 at 6:24