padrevirtual / 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

mgmt disconnect on "invalid mark" in block() function #3

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. connect to the vpn

What is the expected output? What do you see instead?
Expected: 
- gui shows full progress of the tunnel and says when it's connected

Now:
- after state "connecting" the GUI shows disconnected while the vpn is
still building up. This is because of a lost connection with the openvpn
management interface.

D/OpenVPN-DaemonMonitor[/sdcard/openvpn/imset-nopass.ovpn]-daemon-stdout( 
898): Sun Mar  7 10:19:56 2010 MANAGEMENT: Client connected from
127.0.0.1:10736
D/OpenVPN-DaemonMonitor[/sdcard/openvpn/imset-nopass.ovpn]-mgmt(  898):
>INFO:OpenVPN Management Interface Version 1 -- type 'help' for more info
V/OpenVPN-DaemonMonitor[/sdcard/openvpn/imset-nopass.ovpn]-mgmt(  898):
onState("1267953596,TCP_CONNECT,,,")
D/OpenVPN-Settings-getprop(  898): invoking external process:
/system/bin/sh -s -x
D/OpenVPN-Settings-getprop(  898): exec getprop net.dnschange
D/OpenVPN-Settings-getprop-stderr(  898): + exec getprop net.dnschange
D/OpenVPN-Settings-getprop-stdout(  898): 2
I/OpenVPN-Settings-getprop-stdout(  898): terminated
I/OpenVPN-Settings-getprop-stderr(  898): terminated
D/OpenVPN-DaemonMonitor[/sdcard/openvpn/imset-nopass.ovpn]-mgmt(  898):
=============> 0 == 2 resetting dns, leaving dns alone
D/OpenVPN-DaemonMonitor[/sdcard/openvpn/imset-nopass.ovpn]-mgmt(  898):
unknown state: TCP_CONNECT
D/OpenVPNDaemonEnabler(  898): Received OpenVPN network state changed from
Connecting to Unknown
E/OpenVPN-DaemonMonitor[/sdcard/openvpn/imset-nopass.ovpn]-mgmt(  898):
Lost connection to OpenVPN daemon
E/OpenVPN-DaemonMonitor[/sdcard/openvpn/imset-nopass.ovpn]-mgmt(  898):
java.io.IOException: Invalid Mark.
E/OpenVPN-DaemonMonitor[/sdcard/openvpn/imset-nopass.ovpn]-mgmt(  898):     at
java.io.BufferedReader.reset(BufferedReader.java:465)
E/OpenVPN-DaemonMonitor[/sdcard/openvpn/imset-nopass.ovpn]-mgmt(  898):     at
java.io.LineNumberReader.reset(LineNumberReader.java:237)
E/OpenVPN-DaemonMonitor[/sdcard/openvpn/imset-nopass.ovpn]-mgmt(  898):     at
de.schaeuffelhut.android.openvpn.service.ManagementThread.block(DaemonMonitor.ja
va:458)
E/OpenVPN-DaemonMonitor[/sdcard/openvpn/imset-nopass.ovpn]-mgmt(  898):     at
de.schaeuffelhut.android.openvpn.service.ManagementThread.monitor(DaemonMonitor.
java:426)
E/OpenVPN-DaemonMonitor[/sdcard/openvpn/imset-nopass.ovpn]-mgmt(  898):     at
de.schaeuffelhut.android.openvpn.service.ManagementThread.run(DaemonMonitor.java
:350)
D/OpenVPN-DaemonMonitor[/sdcard/openvpn/imset-nopass.ovpn]-daemon-stdout( 
898): Sun Mar  7 10:19:56 2010 MANAGEMENT: Client disconnected
D/OpenVPNDaemonEnabler(  898): Received OpenVPN network state changed from
Unknown to Unknown
D/OpenVPNDaemonEnabler(  898): Received OpenVPN daemon state changed from
Unknown to Disabled
D/OpenVPN-DaemonMonitor[/sdcard/openvpn/imset-nopass.ovpn]-mgmt(  898):
terminated
D/OpenVPN-DaemonMonitor[/sdcard/openvpn/imset-nopass.ovpn]-daemon-stdout( 
898): Sun Mar  7 10:19:57 2010 TCP connection established with
87.98.190.159:443
D/OpenVPN-DaemonMonitor[/sdcard/openvpn/imset-nopass.ovpn]-daemon-stdout( 
898): Sun Mar  7 10:19:57 2010 Socket Buffers: R=[87380->131072]
S=[16384->131072]
D/OpenVPN-DaemonMonitor[/sdcard/openvpn/imset-nopass.ovpn]-daemon-stdout( 
898): Sun Mar  7 10:19:57 2010 TCPv4_CLIENT link local: [undef]
D/OpenVPN-DaemonMonitor[/sdcard/openvpn/imset-nopass.ovpn]-daemon-stdout( 
898): Sun Mar  7 10:19:57 2010 TCPv4_CLIENT link remote: 87.98.190.159:443
D/OpenVPN-DaemonMonitor[/sdcard/openvpn/imset-nopass.ovpn]-daemon-stdout( 
898): Sun Mar  7 10:19:57 2010 MANAGEMENT: >STATE:1267953597,WAIT,,,
D/OpenVPN-DaemonMonito

Original issue reported on code.google.com by christophevandeplas@gmail.com on 7 Mar 2010 at 10:07

GoogleCodeExporter commented 8 years ago
Is it possible your openvpn ends a line with \r\n or somehow includes \r\n 
somewhere
in its output?
In this case the statement lnr.read() would probably read two characters and 
report
them as \n. This would invalidate the mark.
I changed the readLimit in lnr.mark to 2.
Fix is in repo, please test. 

Original comment by friedrich.schaeuffelhut on 8 Mar 2010 at 1:51

GoogleCodeExporter commented 8 years ago
Actually openvpn terminates each line on the mgmt interface with \r\n.
If for some reason the call to lnr.read hits a \r\n the mark would become 
invalid.
This would most likely happen if an empty line was reported by openvpn on the 
mgmt
interface.

Original comment by friedrich.schaeuffelhut on 8 Mar 2010 at 2:07

GoogleCodeExporter commented 8 years ago
Actually openvpn terminates each line on the mgmt interface with \r\n.
If for some reason the call to lnr.read hits a \r\n the mark would become 
invalid.
This would most likely happen if an empty line was reported by openvpn on the 
mgmt
interface.

Original comment by friedrich.schaeuffelhut on 8 Mar 2010 at 2:07

GoogleCodeExporter commented 8 years ago
Seems to work correctly again.
Thanks 

Original comment by christophevandeplas@gmail.com on 8 Mar 2010 at 5:56