dawei101 / shadowsocks-android-java

Shadowsocks android client, pure java version
Apache License 2.0
588 stars 284 forks source link

闪退:automatically created duplicate IP address : Fatal error: java.lang.IllegalStateException: command '74 interface fwmark rule add tun0' failed with '400 74 Failed to add fwmark rule (File exists)' #58

Open scShan opened 6 years ago

scShan commented 6 years ago

log 如下:

12-04 15:01:46.488 4965-4965/com.vm.shadowsocks I/System.out: [15:01:46] starting... 12-04 15:01:46.538 4965-4965/com.vm.shadowsocks I/System.out: [15:01:46] set shadowsocks/(http proxy) 12-04 15:01:46.768 4965-4965/com.vm.shadowsocks I/System.out: [15:01:46] Proxy is: ss://rc4-md5:123456@192.168.206.129/192.168.206.129:8989 12-04 15:01:46.778 4965-4965/com.vm.shadowsocks I/System.out: [15:01:46] Global mode is off 12-04 15:01:46.798 4965-4965/com.vm.shadowsocks I/System.out: [15:01:46] No Pre-App proxy, due to low Android version. 12-04 15:01:46.868 4965-5001/? W/System.err: java.lang.IllegalStateException: command '74 interface fwmark rule add tun0' failed with '400 74 Failed to add fwmark rule (File exists)' 12-04 15:01:46.868 4965-5001/? W/System.err: at android.os.Parcel.readException(Parcel.java:1473) 12-04 15:01:46.868 4965-5001/? W/System.err: at android.os.Parcel.readException(Parcel.java:1419) 12-04 15:01:46.868 4965-5001/? W/System.err: at android.net.IConnectivityManager$Stub$Proxy.establishVpn(IConnectivityManager.java:1555) 12-04 15:01:46.868 4965-5001/? W/System.err: at android.net.VpnService$Builder.establish(VpnService.java:471) 12-04 15:01:46.868 4965-5001/? W/System.err: at com.vm.shadowsocks.core.LocalVpnService.establishVPN(LocalVpnService.java:415) 12-04 15:01:46.868 4965-5001/? W/System.err: at com.vm.shadowsocks.core.LocalVpnService.runVPN(LocalVpnService.java:237) 12-04 15:01:46.868 4965-5001/? W/System.err: at com.vm.shadowsocks.core.LocalVpnService.run(LocalVpnService.java:220) 12-04 15:01:46.868 4965-5001/? W/System.err: at java.lang.Thread.run(Thread.java:841) 12-04 15:01:46.868 4965-4965/? I/System.out: [15:01:46] Fatal error: java.lang.IllegalStateException: command '74 interface fwmark rule add tun0' failed with '400 74 Failed to add fwmark rule (File exists)' 12-04 15:01:46.868 4965-4965/? I/System.out: [15:01:46] App terminated. 12-04 15:01:46.868 4965-4965/? I/System.out: [15:01:46] shadowsocksdisconnected 12-04 15:01:46.868 4965-5004/? W/System.err: java.nio.channels.ClosedSelectorException 12-04 15:01:46.868 4965-5004/? W/System.err: at java.nio.SelectorImpl.checkClosed(SelectorImpl.java:142) 12-04 15:01:46.868 4965-5004/? W/System.err: at java.nio.SelectorImpl.selectedKeys(SelectorImpl.java:291) 12-04 15:01:46.868 4965-5004/? W/System.err: at com.vm.shadowsocks.core.TcpProxyServer.run(TcpProxyServer.java:65) 12-04 15:01:46.868 4965-5004/? W/System.err: at java.lang.Thread.run(Thread.java:841) 12-04 15:01:46.868 4965-5004/? I/System.out: TcpServer thread exited. 12-04 15:01:46.868 4965-5005/? W/System.err: java.net.SocketException: Socket closed 12-04 15:01:46.868 4965-5005/? W/System.err: at libcore.io.Posix.recvfromBytes(Native Method) 12-04 15:01:46.868 4965-5005/? W/System.err: at libcore.io.Posix.recvfrom(Posix.java:141) 12-04 15:01:46.868 4965-5005/? W/System.err: at libcore.io.BlockGuardOs.recvfrom(BlockGuardOs.java:164) 12-04 15:01:46.868 4965-5005/? W/System.err: at libcore.io.IoBridge.recvfrom(IoBridge.java:506) 12-04 15:01:46.868 4965-5005/? W/System.err: at java.net.PlainDatagramSocketImpl.doRecv(PlainDatagramSocketImpl.java:161) 12-04 15:01:46.868 4965-5005/? W/System.err: at java.net.PlainDatagramSocketImpl.receive(PlainDatagramSocketImpl.java:169) 12-04 15:01:46.868 4965-5005/? W/System.err: at java.net.DatagramSocket.receive(DatagramSocket.java:250) 12-04 15:01:46.868 4965-5001/? I/AndroidRuntime: VM exiting with result code 0, cleanup skipped.

dawei101 commented 6 years ago

ss://rc4-md5:123456@192.168.206.129/192.168.206.129:8989

->

ss://rc4-md5:123456@192.168.206.129:8989

scShan commented 6 years ago

谢谢,actually, I filled only ss://rc4-md5:123456@192.168.206.129:8989 but in log,it shows duplicate /192.168.206.129:8989, how to fix?

scShan commented 6 years ago

@dawei101 verified again. when you put ss://rc4-md5:123456@192.168.206.129:8989 or any other IP address, the app terminated and showed ss://rc4-md5:123456@192.168.206.129/192.168.206.129:8989 in log.


12-05 09:45:32.248 4257-4257/com.vm.shadowsocks I/System.out: [09:45:32] LocalDnsProxy started. 12-05 09:45:32.248 4257-4257/com.vm.shadowsocks I/System.out: [09:45:32] set shadowsocks/(http proxy) 12-05 09:45:32.318 4257-4257/com.vm.shadowsocks I/System.out: [09:45:32] Proxy is: ss://rc4-md5:123456@192.168.0.1/192.168.0.1:8989 12-05 09:45:32.328 4257-4257/com.vm.shadowsocks I/System.out: [09:45:32] Global mode is off 12

scShan commented 6 years ago

If input the nonValid IP like 256.168.206.129, the duplicate IP dispear. When input localhost, the output is as follows:

12-05 10:24:45.468 7041-7041/com.vm.shadowsocks I/System.out: [10:24:45] Proxy is: ss://rc4-md5:123456@localhost/127.0.0.1:8989

scShan commented 6 years ago

@dawei101 How to fix it temperately?

scShan commented 6 years ago

The above crash happened on Android SDK 19; but runs fine with SDK25, there is another problem. The "Proxy is display" is the internal one not what I set

dawei101 commented 6 years ago

May be you should read codes a bit more to understand the principle.

10.8.0.2 is a virtual ip of your device, one virtual ip which is in same internal network, would be created when one destination connecting out

scShan commented 6 years ago

@dawei101 Thanks, I upgraded to SDK25 and runs OK in android7.1.

scShan commented 6 years ago

It's really a bug when runs at android 4.4.2

@dawei101 you mean when NOT( m_IpList >0), get 10.8.0.2 ? The display,which is not inline with setting is caused by wrong call --- getLocalIpAddress. myTestingfault. so the snap was removed.

dawei101 commented 6 years ago

I mean anytime the app should get an ip with 10.8.0.2 , I will focus on this issue when get time