eycorsican / go-tun2socks

A tun2socks implementation written in Go.
MIT License
1.31k stars 434 forks source link

mips版本无法使用 #39

Closed phoenixxie0 closed 5 years ago

phoenixxie0 commented 5 years ago

机器是网件3800,使用tun2socks-linux-mips.zip包里的文件,放到/usr/bin/里后,运行显示 -ash: tun2socks-linux-mips: not found 然后尝试使用ldd检查缺少什么库: root@OpenWrt:~# ldd /usr/bin/tun2socks-linux-mips /lib/ld.so.1 (0x77f2c000) libpthread.so.0 => /lib/ld.so.1 (0x77f2c000) libc.so.6 => /lib/ld.so.1 (0x77f2c000) Error loading shared library ld.so.1: No such file or directory (needed by /usr/bin/tun2socks-linux-mips) Error relocating /usr/bin/tun2socks-linux-mips: fprintf_chk: symbol not found Error relocating /usr/bin/tun2socks-linux-mips: __printf_chk: symbol not found Error relocating /usr/bin/tun2socks-linux-mips: vfprintf_chk: symbol not found

请问是什么问题呢?

eycorsican commented 5 years ago

你这路由应该是需要 softfloat的,但之前我做过测试,貌似是 Golang 并不支持 mips softfloat 上的 cgo 程序

phoenixxie0 commented 5 years ago

并不是softfloat的原因,是因为没有完全静态编译,还需要ligbcc的库,编译加入-static之后可以运行。目前尚未测试其他运行中的问题。

phoenixxie0 commented 5 years ago

在尝试使用IPv6的时候,出现以下错误,并自动退出 ` root@OpenWrt:~# /usr/local/bin/tun2socks -tunName tun0 -tunAddr [2001:470:f294:f944::1] -tunGw [2001:470:f294:f944::] -proxyServer 172.16.1.101:10098
2019/02/26 04:01:52 openning tun device 2019/02/26 04:01:52 ICMP packets will be delayed for 10ms 2019/02/26 04:01:52 Running tun2socks 2019/02/26 04:03:17 new proxy connection for target: tcp:104.244.42.1:443 2019/02/26 04:03:17 new proxy connection for target: tcp:192.229.237.96:443 2019/02/26 04:03:18 new proxy connection for target: tcp:104.244.42.194:443 2019/02/26 04:03:21 new proxy connection for target: tcp:104.244.43.131:443 2019/02/26 04:03:22 new proxy connection for target: tcp:192.229.232.217:443 2019/02/26 04:03:33 new proxy connection for target: tcp:172.217.160.68:443 2019/02/26 04:03:33 new proxy connection for target: tcp:203.208.40.47:80 2019/02/26 04:03:37 new proxy connection for target: tcp:[2404:6800:4012::200e]:80 Assertion "tcp_receive: wrong state" failed at line 1164 in tcp_in.c SIGABRT: abort PC=0xb7bd80 m=6 sigcode=4294967290

goroutine 0 [idle]: runtime: unknown pc 0xb7bd80 stack: frame={sp:0x6d9feab0, fp:0x0} stack=[0x6d1ff14c,0x6d9fed4c) 6d9fea30: 01383350 0040cdf0 <runtime.mallocgc+1384> 00659c6f <github.com/eycorsican/go-tun2socks/filter.(icmpFilter).Write.func1+167> 0018120d 6d9fea40: 00000002 00000000 00000000 00000000 6d9fea50: 0064c7d7 <github.com/eycorsican/go-tun2socks/core.newTCPConnection+291> 00177058 00000001 00538697 <net.parseIPv6Zone+107> 6d9fea60: 000cc4a8 00450524 <runtime.newstack+776> 00465653 <runtime.call16+147> 00056d01 6d9fea70: 01383350 00000000 00000000 00000000 6d9fea80: 0040308b <runtime.cgocallbackg+191> 00025968 00000001 0040d564 <runtime.newobject+76> 6d9fea90: 01390000 013919d4 6d9feb60 01390000 6d9feaa0: 01390000 0138f464 01390000 01390000 6d9feab0: <01390000 01390000 000008d8 00840b40 <v2ray.com/core/common/crypto.(AuthenticationWriter).seal+740> 6d9feac0: 00000047 000008d8 01383350 010ad728 6d9fead0: 00000000 000008d8 0043e10c <runtime.newproc1+568> 010ad728 6d9feae0: 00000047 010ad728 00000047 31313634 6d9feaf0: 010ad728 0043e18c <runtime.newproc1+696> 00000047 0043e0b4 <runtime.newproc1+480> 6d9feb00: 010ad728 00bc42b0 01332de0 00000047 6d9feb10: 00464504 <runtime.newproc.func1+96> 01832000 01920a80 01000001 6d9feb20: 00000000 00000000 6d9fec00 00e733df runtime: unknown pc 0xb7bd80 stack: frame={sp:0x6d9feab0, fp:0x0} stack=[0x6d1ff14c,0x6d9fed4c) 6d9fea30: 01383350 0040cdf0 <runtime.mallocgc+1384> 00659c6f <github.com/eycorsican/go-tun2socks/filter.(icmpFilter).Write.func1+167> 0018120d 6d9fea40: 00000002 00000000 00000000 00000000 6d9fea50: 0064c7d7 <github.com/eycorsican/go-tun2socks/core.newTCPConnection+291> 00177058 00000001 00538697 <net.parseIPv6Zone+107> 6d9fea60: 000cc4a8 00450524 <runtime.newstack+776> 00465653 <runtime.call16+147> 00056d01 6d9fea70: 01383350 00000000 00000000 00000000 6d9fea80: 0040308b <runtime.cgocallbackg+191> 00025968 00000001 0040d564 <runtime.newobject+76> 6d9fea90: 01390000 013919d4 6d9feb60 01390000 6d9feaa0: 01390000 0138f464 01390000 01390000 6d9feab0: <01390000 01390000 000008d8 00840b40 <v2ray.com/core/common/crypto.(AuthenticationWriter).seal+740> 6d9feac0: 00000047 000008d8 01383350 010ad728 6d9fead0: 00000000 000008d8 0043e10c <runtime.newproc1+568> 010ad728 6d9feae0: 00000047 010ad728 00000047 31313634 6d9feaf0: 010ad728 0043e18c <runtime.newproc1+696> 00000047 0043e0b4 <runtime.newproc1+480> 6d9feb00: 010ad728 00bc42b0 01332de0 00000047 6d9feb10: 00464504 <runtime.newproc.func1+96> 01832000 01920a80 01000001 6d9feb20: 00000000 00000000 6d9fec00 00e733df

goroutine 21 [syscall]: runtime.cgocall(0xb4d150, 0x1850f58, 0x3c07c0) /usr/local/go/src/runtime/cgocall.go:128 +0x64 fp=0x1850f40 sp=0x1850f28 pc=0x402f2c github.com/eycorsican/go-tun2socks/core._Cfunc_input(0x6e400510, 0x400510) _cgo_gotypes.go:344 +0x54 fp=0x1850f54 sp=0x1850f40 pc=0x6495a0 github.com/eycorsican/go-tun2socks/core.Input.func2(0x6e400510, 0x3c) /ext-go/1/src/github.com/eycorsican/go-tun2socks/core/input.go:27 +0x64 fp=0x1850f6c sp=0x1850f54 pc=0x64fac0 github.com/eycorsican/go-tun2socks/core.Input(0x18307c0, 0x3c, 0x3c, 0x1923b00, 0x19207e0, 0x1381540) /ext-go/1/src/github.com/eycorsican/go-tun2socks/core/input.go:27 +0xac fp=0x1850f90 sp=0x1850f6c pc=0x64b2d0 github.com/eycorsican/go-tun2socks/core.(lwipStack).Write(0x180ed48, 0x18307c0, 0x3c, 0x3c, 0x48, 0x0, 0x0) /ext-go/1/src/github.com/eycorsican/go-tun2socks/core/lwip.go:89 +0x4c fp=0x1850fac sp=0x1850f90 pc=0x64b664 github.com/eycorsican/go-tun2socks/filter.(icmpFilter).Write.func1(0x180c3b0, 0x18307c0, 0x3c, 0x3c) /ext-go/1/src/github.com/eycorsican/go-tun2socks/filter/icmp.go:26 +0xa8 fp=0x1850fdc sp=0x1850fac pc=0x659c70 runtime.goexit() /usr/local/go/src/runtime/asm_mipsx.s:660 +0x4 fp=0x1850fdc sp=0x1850fdc pc=0x46759c created by github.com/eycorsican/go-tun2socks/filter.(*icmpFilter).Write /ext-go/1/src/github.com/eycorsican/go-tun2socks/filter/icmp.go:24 +0xfc

goroutine 1 [chan receive]: main.main() /ext-go/1/src/github.com/eycorsican/go-tun2socks/cmd/tun2socks/main.go:179 +0xc88

goroutine 5 [syscall]: os/signal.signal_recv(0x0) /usr/local/go/src/runtime/sigqueue.go:139 +0x118 os/signal.loop() /usr/local/go/src/os/signal/signal_unix.go:23 +0x34 created by os/signal.init.0 /usr/local/go/src/os/signal/signal_unix.go:29 +0x50

goroutine 7 [chan receive]: github.com/eycorsican/go-tun2socks/core.NewLWIPStack.func5() /ext-go/1/src/github.com/eycorsican/go-tun2socks/core/lwip.go:74 +0x44 created by github.com/eycorsican/go-tun2socks/core.NewLWIPStack /ext-go/1/src/github.com/eycorsican/go-tun2socks/core/lwip.go:71 +0x138

goroutine 8 [chan receive]: github.com/eycorsican/go-tun2socks/proxy.(*DNSCache).cleanUp(0x1908520) /ext-go/1/src/github.com/eycorsican/go-tun2socks/proxy/dns_cache.go:43 +0x284 created by github.com/eycorsican/go-tun2socks/proxy.NewDNSCache /ext-go/1/src/github.com/eycorsican/go-tun2socks/proxy/dns_cache.go:28 +0x90

goroutine 9 [syscall]: syscall.Syscall(0xfa3, 0x3, 0x1916000, 0x5dc, 0x191f960, 0x1000000, 0x4a71d8) /usr/local/go/src/syscall/asm_linux_mipsx.s:17 +0x10 syscall.read(0x3, 0x1916000, 0x5dc, 0x5dc, 0x191f960, 0x0, 0x0) /usr/local/go/src/syscall/zsyscall_linux_mips.go:732 +0x60 syscall.Read(0x3, 0x1916000, 0x5dc, 0x5dc, 0x48, 0x0, 0x0) /usr/local/go/src/syscall/syscall_unix.go:172 +0x54 internal/poll.(FD).Read(0x185d2c0, 0x1916000, 0x5dc, 0x5dc, 0x0, 0x0, 0x0) /usr/local/go/src/internal/poll/fd_unix.go:165 +0x120 os.(File).read(0x180ed38, 0x1916000, 0x5dc, 0x5dc, 0x184ff08, 0x184ff0c, 0x10) /usr/local/go/src/os/file_unix.go:249 +0x5c os.(File).Read(0x180ed38, 0x1916000, 0x5dc, 0x5dc, 0x48, 0x48, 0x182e320) /usr/local/go/src/os/file.go:108 +0x6c github.com/eycorsican/go-tun2socks/tun.(tunDev).Read(0x1908480, 0x1916000, 0x5dc, 0x5dc, 0x48, 0x0, 0x0) /ext-go/1/src/github.com/eycorsican/go-tun2socks/tun/tun_linux.go:108 +0x58 io.copyBuffer(0x6e5e5078, 0x180c3b0, 0x6e5e5090, 0x1908480, 0x1916000, 0x5dc, 0x5dc, 0xca9300, 0xcddba0, 0x0, ...) /usr/local/go/src/io/io.go:402 +0x10c io.CopyBuffer(0x6e5e5078, 0x180c3b0, 0x6e5e5090, 0x1908480, 0x1916000, 0x5dc, 0x5dc, 0x0, 0x0, 0x0, ...) /usr/local/go/src/io/io.go:375 +0x7c main.main.func2(0x6e5e5078, 0x180c3b0, 0xe4e5e0, 0x1908480) /ext-go/1/src/github.com/eycorsican/go-tun2socks/cmd/tun2socks/main.go:169 +0xc8 created by main.main /ext-go/1/src/github.com/eycorsican/go-tun2socks/cmd/tun2socks/main.go:168 +0xb90

goroutine 12 [IO wait]: internal/poll.runtime_pollWait(0x6e5e4f40, 0x72, 0x4a8404) /usr/local/go/src/runtime/netpoll.go:173 +0x60 internal/poll.(pollDesc).wait(0x1824334, 0x72, 0xffffff, 0xe4bac0, 0x1333e64) /usr/local/go/src/internal/poll/fd_poll_runtime.go:85 +0xc4 internal/poll.(pollDesc).waitRead(0x1824334, 0x928000, 0x800, 0x800) /usr/local/go/src/internal/poll/fd_poll_runtime.go:90 +0x4c internal/poll.(FD).Read(0x1824320, 0x1928000, 0x800, 0x800, 0x0, 0x0, 0x0) /usr/local/go/src/internal/poll/fd_unix.go:169 +0x190 net.(netFD).Read(0x1824320, 0x1928000, 0x800, 0x800, 0x33, 0x0, 0x0) /usr/local/go/src/net/fd_unix.go:202 +0x58 net.(conn).Read(0x180ee00, 0x1928000, 0x800, 0x800, 0x0, 0x0, 0x0) /usr/local/go/src/net/net.go:177 +0x70 io.copyBuffer(0x6e5e50d8, 0x1924900, 0xe49dc0, 0x180ee00, 0x1928000, 0x800, 0x800, 0xca9480, 0xd51060, 0x18, ...) /usr/local/go/src/io/io.go:402 +0x10c io.CopyBuffer(0x6e5e50d8, 0x1924900, 0xe49dc0, 0x180ee00, 0x1928000, 0x800, 0x800, 0x800, 0x616e3c, 0x185b7ec, ...) /usr/local/go/src/io/io.go:375 +0x7c github.com/eycorsican/go-tun2socks/proxy/socks.(tcpHandler).fetchInput(0x19084e0, 0xe549a0, 0x1924900, 0xe49dc0, 0x180ee00) /ext-go/1/src/github.com/eycorsican/go-tun2socks/proxy/socks/tcp.go:43 +0x100 created by github.com/eycorsican/go-tun2socks/proxy/socks.(*tcpHandler).Connect /ext-go/1/src/github.com/eycorsican/go-tun2socks/proxy/socks/tcp.go:72 +0x288

goroutine 13 [IO wait]: internal/poll.runtime_pollWait(0x6e5e4ec0, 0x72, 0x4a8404) /usr/local/go/src/runtime/netpoll.go:173 +0x60 internal/poll.(pollDesc).wait(0x1824384, 0x72, 0xffffff, 0xe4bac0, 0x1333e64) /usr/local/go/src/internal/poll/fd_poll_runtime.go:85 +0xc4 internal/poll.(pollDesc).waitRead(0x1824384, 0x928800, 0x800, 0x800) /usr/local/go/src/internal/poll/fd_poll_runtime.go:90 +0x4c internal/poll.(FD).Read(0x1824370, 0x1928800, 0x800, 0x800, 0x0, 0x0, 0x0) /usr/local/go/src/internal/poll/fd_unix.go:169 +0x190 net.(netFD).Read(0x1824370, 0x1928800, 0x800, 0x800, 0x29a, 0x0, 0x0) /usr/local/go/src/net/fd_unix.go:202 +0x58 net.(conn).Read(0x180ef40, 0x1928800, 0x800, 0x800, 0x0, 0x0, 0x0) /usr/local/go/src/net/net.go:177 +0x70 io.copyBuffer(0x6e5e50d8, 0x1924a80, 0xe49dc0, 0x180ef40, 0x1928800, 0x800, 0x800, 0xca9480, 0xd51060, 0x18, ...) /usr/local/go/src/io/io.go:402 +0x10c io.CopyBuffer(0x6e5e50d8, 0x1924a80, 0xe49dc0, 0x180ef40, 0x1928800, 0x800, 0x800, 0x800, 0x0, 0x0, ...) /usr/local/go/src/io/io.go:375 +0x7c github.com/eycorsican/go-tun2socks/proxy/socks.(tcpHandler).fetchInput(0x19084e0, 0xe549a0, 0x1924a80, 0xe49dc0, 0x180ef40) /ext-go/1/src/github.com/eycorsican/go-tun2socks/proxy/socks/tcp.go:43 +0x100 created by github.com/eycorsican/go-tun2socks/proxy/socks.(*tcpHandler).Connect /ext-go/1/src/github.com/eycorsican/go-tun2socks/proxy/socks/tcp.go:72 +0x288

goroutine 14 [IO wait]: internal/poll.runtime_pollWait(0x6e5e4e40, 0x72, 0x4a8404) /usr/local/go/src/runtime/netpoll.go:173 +0x60 internal/poll.(pollDesc).wait(0x18243d4, 0x72, 0xffffff, 0xe4bac0, 0x1333e64) /usr/local/go/src/internal/poll/fd_poll_runtime.go:85 +0xc4 internal/poll.(pollDesc).waitRead(0x18243d4, 0x929000, 0x800, 0x800) /usr/local/go/src/internal/poll/fd_poll_runtime.go:90 +0x4c internal/poll.(FD).Read(0x18243c0, 0x1929000, 0x800, 0x800, 0x0, 0x0, 0x0) /usr/local/go/src/internal/poll/fd_unix.go:169 +0x190 net.(netFD).Read(0x18243c0, 0x1929000, 0x800, 0x800, 0x51, 0x0, 0x0) /usr/local/go/src/net/fd_unix.go:202 +0x58 net.(conn).Read(0x180f040, 0x1929000, 0x800, 0x800, 0x0, 0x0, 0x0) /usr/local/go/src/net/net.go:177 +0x70 io.copyBuffer(0x6e5e50d8, 0x1924c00, 0xe49dc0, 0x180f040, 0x1929000, 0x800, 0x800, 0xca9480, 0xd51060, 0x18, ...) /usr/local/go/src/io/io.go:402 +0x10c io.CopyBuffer(0x6e5e50d8, 0x1924c00, 0xe49dc0, 0x180f040, 0x1929000, 0x800, 0x800, 0x800, 0x0, 0x0, ...) /usr/local/go/src/io/io.go:375 +0x7c github.com/eycorsican/go-tun2socks/proxy/socks.(tcpHandler).fetchInput(0x19084e0, 0xe549a0, 0x1924c00, 0xe49dc0, 0x180f040) /ext-go/1/src/github.com/eycorsican/go-tun2socks/proxy/socks/tcp.go:43 +0x100 created by github.com/eycorsican/go-tun2socks/proxy/socks.(*tcpHandler).Connect /ext-go/1/src/github.com/eycorsican/go-tun2socks/proxy/socks/tcp.go:72 +0x288

goroutine 15 [IO wait]: internal/poll.runtime_pollWait(0x6e5e4dc0, 0x72, 0x4a8404) /usr/local/go/src/runtime/netpoll.go:173 +0x60 internal/poll.(pollDesc).wait(0x1824424, 0x72, 0xffffff, 0xe4bac0, 0x1333e64) /usr/local/go/src/internal/poll/fd_poll_runtime.go:85 +0xc4 internal/poll.(pollDesc).waitRead(0x1824424, 0x929800, 0x800, 0x800) /usr/local/go/src/internal/poll/fd_poll_runtime.go:90 +0x4c internal/poll.(FD).Read(0x1824410, 0x1929800, 0x800, 0x800, 0x0, 0x0, 0x0) /usr/local/go/src/internal/poll/fd_unix.go:169 +0x190 net.(netFD).Read(0x1824410, 0x1929800, 0x800, 0x800, 0xb4, 0x0, 0x0) /usr/local/go/src/net/fd_unix.go:202 +0x58 net.(conn).Read(0x180f5e0, 0x1929800, 0x800, 0x800, 0x0, 0x0, 0x0) /usr/local/go/src/net/net.go:177 +0x70 io.copyBuffer(0x6e5e50d8, 0x1924f80, 0xe49dc0, 0x180f5e0, 0x1929800, 0x800, 0x800, 0xca9480, 0xd51060, 0x18, ...) /usr/local/go/src/io/io.go:402 +0x10c io.CopyBuffer(0x6e5e50d8, 0x1924f80, 0xe49dc0, 0x180f5e0, 0x1929800, 0x800, 0x800, 0x800, 0x0, 0x0, ...) /usr/local/go/src/io/io.go:375 +0x7c github.com/eycorsican/go-tun2socks/proxy/socks.(tcpHandler).fetchInput(0x19084e0, 0xe549a0, 0x1924f80, 0xe49dc0, 0x180f5e0) /ext-go/1/src/github.com/eycorsican/go-tun2socks/proxy/socks/tcp.go:43 +0x100 created by github.com/eycorsican/go-tun2socks/proxy/socks.(*tcpHandler).Connect /ext-go/1/src/github.com/eycorsican/go-tun2socks/proxy/socks/tcp.go:72 +0x288

goroutine 16 [IO wait]: internal/poll.runtime_pollWait(0x6e5e4d40, 0x72, 0x4a8404) /usr/local/go/src/runtime/netpoll.go:173 +0x60 internal/poll.(pollDesc).wait(0x1824474, 0x72, 0xffffff, 0xe4bac0, 0x1333e64) /usr/local/go/src/internal/poll/fd_poll_runtime.go:85 +0xc4 internal/poll.(pollDesc).waitRead(0x1824474, 0x932000, 0x800, 0x800) /usr/local/go/src/internal/poll/fd_poll_runtime.go:90 +0x4c internal/poll.(FD).Read(0x1824460, 0x1932000, 0x800, 0x800, 0x0, 0x0, 0x0) /usr/local/go/src/internal/poll/fd_unix.go:169 +0x190 net.(netFD).Read(0x1824460, 0x1932000, 0x800, 0x800, 0x16e, 0x0, 0x0) /usr/local/go/src/net/fd_unix.go:202 +0x58 net.(conn).Read(0x180f8f0, 0x1932000, 0x800, 0x800, 0x0, 0x0, 0x0) /usr/local/go/src/net/net.go:177 +0x70 io.copyBuffer(0x6e5e50d8, 0x1925080, 0xe49dc0, 0x180f8f0, 0x1932000, 0x800, 0x800, 0xca9480, 0xd51060, 0x18, ...) /usr/local/go/src/io/io.go:402 +0x10c io.CopyBuffer(0x6e5e50d8, 0x1925080, 0xe49dc0, 0x180f8f0, 0x1932000, 0x800, 0x800, 0x800, 0x0, 0x0, ...) /usr/local/go/src/io/io.go:375 +0x7c github.com/eycorsican/go-tun2socks/proxy/socks.(tcpHandler).fetchInput(0x19084e0, 0xe549a0, 0x1925080, 0xe49dc0, 0x180f8f0) /ext-go/1/src/github.com/eycorsican/go-tun2socks/proxy/socks/tcp.go:43 +0x100 created by github.com/eycorsican/go-tun2socks/proxy/socks.(*tcpHandler).Connect /ext-go/1/src/github.com/eycorsican/go-tun2socks/proxy/socks/tcp.go:72 +0x288

goroutine 19 [IO wait]: internal/poll.runtime_pollWait(0x6e5e4c40, 0x72, 0x4a8404) /usr/local/go/src/runtime/netpoll.go:173 +0x60 internal/poll.(pollDesc).wait(0x1824514, 0x72, 0xffffff, 0xe4bac0, 0x1333e64) /usr/local/go/src/internal/poll/fd_poll_runtime.go:85 +0xc4 internal/poll.(pollDesc).waitRead(0x1824514, 0x933000, 0x800, 0x800) /usr/local/go/src/internal/poll/fd_poll_runtime.go:90 +0x4c internal/poll.(FD).Read(0x1824500, 0x1933000, 0x800, 0x800, 0x0, 0x0, 0x0) /usr/local/go/src/internal/poll/fd_unix.go:169 +0x190 net.(netFD).Read(0x1824500, 0x1933000, 0x800, 0x800, 0x2c1, 0x0, 0x0) /usr/local/go/src/net/fd_unix.go:202 +0x58 net.(conn).Read(0x19449d0, 0x1933000, 0x800, 0x800, 0x0, 0x0, 0x0) /usr/local/go/src/net/net.go:177 +0x70 io.copyBuffer(0x6e5e50d8, 0x1925d40, 0xe49dc0, 0x19449d0, 0x1933000, 0x800, 0x800, 0xca9480, 0xd51060, 0x18, ...) /usr/local/go/src/io/io.go:402 +0x10c io.CopyBuffer(0x6e5e50d8, 0x1925d40, 0xe49dc0, 0x19449d0, 0x1933000, 0x800, 0x800, 0x800, 0x0, 0x0, ...) /usr/local/go/src/io/io.go:375 +0x7c github.com/eycorsican/go-tun2socks/proxy/socks.(tcpHandler).fetchInput(0x19084e0, 0xe549a0, 0x1925d40, 0xe49dc0, 0x19449d0) /ext-go/1/src/github.com/eycorsican/go-tun2socks/proxy/socks/tcp.go:43 +0x100 created by github.com/eycorsican/go-tun2socks/proxy/socks.(*tcpHandler).Connect /ext-go/1/src/github.com/eycorsican/go-tun2socks/proxy/socks/tcp.go:72 +0x288

goroutine 23 [semacquire]: sync.runtime_SemacquireMutex(0x13932cc, 0x776d7c) /usr/local/go/src/runtime/sema.go:71 +0x4c sync.(Mutex).Lock(0x13932c8) /usr/local/go/src/sync/mutex.go:134 +0x16c github.com/eycorsican/go-tun2socks/core.Input(0x182e320, 0x48, 0x48, 0x1923b90, 0x19209a0, 0x1381540) /ext-go/1/src/github.com/eycorsican/go-tun2socks/core/input.go:26 +0x9c github.com/eycorsican/go-tun2socks/core.(lwipStack).Write(0x180ed48, 0x182e320, 0x48, 0x48, 0x48e, 0x0, 0x0) /ext-go/1/src/github.com/eycorsican/go-tun2socks/core/lwip.go:89 +0x4c github.com/eycorsican/go-tun2socks/filter.(icmpFilter).Write.func1(0x180c3b0, 0x182e320, 0x48, 0x48) /ext-go/1/src/github.com/eycorsican/go-tun2socks/filter/icmp.go:26 +0xa8 created by github.com/eycorsican/go-tun2socks/filter.(icmpFilter).Write /ext-go/1/src/github.com/eycorsican/go-tun2socks/filter/icmp.go:24 +0xfc

goroutine 24 [IO wait]: internal/poll.runtime_pollWait(0x6e5e4cc0, 0x72, 0x4a8404) /usr/local/go/src/runtime/netpoll.go:173 +0x60 internal/poll.(pollDesc).wait(0x1824564, 0x72, 0xffffff, 0xe4bac0, 0x1333e64) /usr/local/go/src/internal/poll/fd_poll_runtime.go:85 +0xc4 internal/poll.(pollDesc).waitRead(0x1824564, 0x932800, 0x800, 0x800) /usr/local/go/src/internal/poll/fd_poll_runtime.go:90 +0x4c internal/poll.(FD).Read(0x1824550, 0x1932800, 0x800, 0x800, 0x0, 0x0, 0x0) /usr/local/go/src/internal/poll/fd_unix.go:169 +0x190 net.(netFD).Read(0x1824550, 0x1932800, 0x800, 0x800, 0x19207e0, 0x480d64, 0xca93c0) /usr/local/go/src/net/fd_unix.go:202 +0x58 net.(conn).Read(0x1944a90, 0x1932800, 0x800, 0x800, 0x0, 0x0, 0x0) /usr/local/go/src/net/net.go:177 +0x70 io.copyBuffer(0x6e5e50d8, 0x194a180, 0xe49dc0, 0x1944a90, 0x1932800, 0x800, 0x800, 0xca9480, 0xd51060, 0x18, ...) /usr/local/go/src/io/io.go:402 +0x10c io.CopyBuffer(0x6e5e50d8, 0x194a180, 0xe49dc0, 0x1944a90, 0x1932800, 0x800, 0x800, 0x800, 0x3c, 0x48, ...) /usr/local/go/src/io/io.go:375 +0x7c github.com/eycorsican/go-tun2socks/proxy/socks.(tcpHandler).fetchInput(0x19084e0, 0xe549a0, 0x194a180, 0xe49dc0, 0x1944a90) /ext-go/1/src/github.com/eycorsican/go-tun2socks/proxy/socks/tcp.go:43 +0x100 created by github.com/eycorsican/go-tun2socks/proxy/socks.(*tcpHandler).Connect /ext-go/1/src/github.com/eycorsican/go-tun2socks/proxy/socks/tcp.go:72 +0x288

r0 0x0 r1 0x1 r2 0x0 r3 0x6da067c0 r4 0x9f8 r5 0x9fd r6 0x6 r7 0x0 r8 0x0 r9 0x8300f460 r10 0x1 r11 0x7b8fd r12 0x1018cb r13 0x4d500000 r14 0x0 r15 0x31313634 r16 0x6da067c0 r17 0x13919d4 r18 0x6d9feb60 r19 0x1390000 r20 0x1390000 r21 0x138f464 r22 0x1390000 r23 0x1390000 r24 0x2 r25 0xb7bd40 r26 0x0 r27 0x0 r28 0x1383350 r29 0x6d9feab0 r30 0x1390000 r31 0xb7c0ec pc 0xb7bd80 link 0xb7c0ec lo 0x0 hi 0x0 root@OpenWrt:~# /usr/local/bin/tun2socks -tunName tun0 -proxyType socks -proxyServer 172.16.1.101:10098 -h Usage of /usr/local/bin/tun2socks: -applog Enable app logging (V2Ray and SOCKS5 handler) -delayICMP int Delay ICMP packets for a short period of time, in milliseconds (default 10) -disableDNSCache Disable DNS cache (SOCKS5 and Shadowsocks handler) -dnsServer string DNS resolvers for TUN interface (only take effect on Windows) (default "114.114.114.114,223.5.5.5") -gateway string The gateway adrress of your default network, set this to enable dynamic routing, and root/admin privileges may also required for using dynamic routing (V2Ray only) -proxyCipher string Cipher used for Shadowsocks proxy, available ciphers: AEAD_AES_128_GCM AEAD_AES_192_GCM AEAD_AES_256_GCM AEAD_CHACHA20_POLY1305 AES-128-CFB AES-128-CTR AES-192-CFB AES-192-CTR AES-256-CFB AES-256-CTR CHACHA20-IETF XCHACHA20 (default "AEAD_CHACHA20_POLY1305") -proxyPassword string Password used for Shadowsocks proxy -proxyServer string Proxy server address (host:port) for socks and Shadowsocks proxies (default "1.2.3.4:1087") -proxyType string Proxy handler type: socks, shadowsocks, v2ray (default "socks") -sniffingType string Enable domain sniffing for specific kind of traffic in v2ray (default "http,tls") -tunAddr string TUN interface address (default "240.0.0.2") -tunGw string TUN interface gateway (default "240.0.0.1") -tunMask string TUN interface netmask, as for IPv6, it's the prefixlen (default "255.255.255.0") -tunName string TUN interface name (default "tun1") -udpTimeout duration Set timeout for UDP proxy connections in socks and Shadowsocks (default 1m0s) -vconfig string Config file for v2ray, in JSON format, and note that routing in v2ray could not violate routes in the routing table (default "config.json") root@OpenWrt:~# /usr/local/bin/tun2socks -tunName tun0 -tunAddr [2001:470:f294:f944::1] -tunGw [2001:470:f294:f944::] -tunMask [2001:470:f294:f944::] -proxyServe r 172.16.1.101:10098
2019/02/26 04:04:47 openning tun device 2019/02/26 04:04:47 ICMP packets will be delayed for 10ms 2019/02/26 04:04:47 Running tun2socks 2019/02/26 04:04:50 new proxy connection for target: tcp:[2404:6800:4012::200e]:80 Assertion "tcp_receive: wrong state" failed at line 1164 in tcp_in.c SIGABRT: abort PC=0xb7bd80 m=5 sigcode=4294967290

goroutine 0 [idle]: runtime: unknown pc 0xb7bd80 stack: frame={sp:0x6e4feab0, fp:0x0} stack=[0x6dcff14c,0x6e4fed4c) 6e4fea30: 01383350 00000001 0064b2cf <github.com/eycorsican/go-tun2socks/core.Input+171> 00175f87 6e4fea40: 00000003 004032bf <runtime.cgocallbackg1+387> 00025a5b 00000000 6e4fea50: 00000000 00000000 00000000 0040308b <runtime.cgocallbackg+191> 6e4fea60: 00025968 00450524 <runtime.newstack+776> 00659c6f <github.com/eycorsican/go-tun2socks/filter.(icmpFilter).Write.func1+167> 0018120d 6e4fea70: 01383350 0053871b <net.parseIPv6+75> 000cc62c 00000000 6e4fea80: 0053fdc3 <net.(Resolver).LookupIPAddr+315> 000cf8da 00000000 0064959f <github.com/eycorsican/go-tun2socks/core._Cfunc_input+83> 6e4fea90: 01390000 013919d4 6e4feb60 01390000 6e4feaa0: 01390000 0138f464 01390000 01390000 6e4feab0: <01390000 01390000 000008d8 00000000 6e4feac0: 00000047 000008d8 01383350 010ad728 6e4fead0: 00000000 000008d8 0043e10c <runtime.newproc1+568> 010ad728 6e4feae0: 00000047 010ad728 00000047 31313634 6e4feaf0: 010ad728 0043e18c <runtime.newproc1+696> 00000047 0043e0b4 <runtime.newproc1+480> 6e4feb00: 010ad728 00bc42b0 01332de0 00000047 6e4feb10: 00464504 <runtime.newproc.func1+96> 01c32000 01d1a460 01000001 6e4feb20: 00000000 00000000 6e4fec00 00e733df runtime: unknown pc 0xb7bd80 stack: frame={sp:0x6e4feab0, fp:0x0} stack=[0x6dcff14c,0x6e4fed4c) 6e4fea30: 01383350 00000001 0064b2cf <github.com/eycorsican/go-tun2socks/core.Input+171> 00175f87 6e4fea40: 00000003 004032bf <runtime.cgocallbackg1+387> 00025a5b 00000000 6e4fea50: 00000000 00000000 00000000 0040308b <runtime.cgocallbackg+191> 6e4fea60: 00025968 00450524 <runtime.newstack+776> 00659c6f <github.com/eycorsican/go-tun2socks/filter.(icmpFilter).Write.func1+167> 0018120d 6e4fea70: 01383350 0053871b <net.parseIPv6+75> 000cc62c 00000000 6e4fea80: 0053fdc3 <net.(Resolver).LookupIPAddr+315> 000cf8da 00000000 0064959f <github.com/eycorsican/go-tun2socks/core._Cfunc_input+83> 6e4fea90: 01390000 013919d4 6e4feb60 01390000 6e4feaa0: 01390000 0138f464 01390000 01390000 6e4feab0: <01390000 01390000 000008d8 00000000 6e4feac0: 00000047 000008d8 01383350 010ad728 6e4fead0: 00000000 000008d8 0043e10c <runtime.newproc1+568> 010ad728 6e4feae0: 00000047 010ad728 00000047 31313634 6e4feaf0: 010ad728 0043e18c <runtime.newproc1+696> 00000047 0043e0b4 <runtime.newproc1+480> 6e4feb00: 010ad728 00bc42b0 01332de0 00000047 6e4feb10: 00464504 <runtime.newproc.func1+96> 01c32000 01d1a460 01000001 6e4feb20: 00000000 00000000 6e4fec00 00e733df

goroutine 12 [syscall]: runtime.cgocall(0xb4d150, 0x1c4ff58, 0x3c0600) /usr/local/go/src/runtime/cgocall.go:128 +0x64 fp=0x1c4ff40 sp=0x1c4ff28 pc=0x402f2c github.com/eycorsican/go-tun2socks/core._Cfunc_input(0x6db00708, 0xb00708) _cgo_gotypes.go:344 +0x54 fp=0x1c4ff54 sp=0x1c4ff40 pc=0x6495a0 github.com/eycorsican/go-tun2socks/core.Input.func2(0x6db00708, 0x3c) /ext-go/1/src/github.com/eycorsican/go-tun2socks/core/input.go:27 +0x64 fp=0x1c4ff6c sp=0x1c4ff54 pc=0x64fac0 github.com/eycorsican/go-tun2socks/core.Input(0x1c30600, 0x3c, 0x3c, 0x1c74d20, 0x1d1a380, 0x1381540) /ext-go/1/src/github.com/eycorsican/go-tun2socks/core/input.go:27 +0xac fp=0x1c4ff90 sp=0x1c4ff6c pc=0x64b2d0 github.com/eycorsican/go-tun2socks/core.(lwipStack).Write(0x1c0ed48, 0x1c30600, 0x3c, 0x3c, 0x48, 0x0, 0x0) /ext-go/1/src/github.com/eycorsican/go-tun2socks/core/lwip.go:89 +0x4c fp=0x1c4ffac sp=0x1c4ff90 pc=0x64b664 github.com/eycorsican/go-tun2socks/filter.(icmpFilter).Write.func1(0x1c0c3b0, 0x1c30600, 0x3c, 0x3c) /ext-go/1/src/github.com/eycorsican/go-tun2socks/filter/icmp.go:26 +0xa8 fp=0x1c4ffdc sp=0x1c4ffac pc=0x659c70 runtime.goexit() /usr/local/go/src/runtime/asm_mipsx.s:660 +0x4 fp=0x1c4ffdc sp=0x1c4ffdc pc=0x46759c created by github.com/eycorsican/go-tun2socks/filter.(*icmpFilter).Write /ext-go/1/src/github.com/eycorsican/go-tun2socks/filter/icmp.go:24 +0xfc

goroutine 1 [chan receive]: main.main() /ext-go/1/src/github.com/eycorsican/go-tun2socks/cmd/tun2socks/main.go:179 +0xc88

goroutine 5 [syscall]: os/signal.signal_recv(0x0) /usr/local/go/src/runtime/sigqueue.go:139 +0x118 os/signal.loop() /usr/local/go/src/os/signal/signal_unix.go:23 +0x34 created by os/signal.init.0 /usr/local/go/src/os/signal/signal_unix.go:29 +0x50

goroutine 7 [chan receive]: github.com/eycorsican/go-tun2socks/core.NewLWIPStack.func5() /ext-go/1/src/github.com/eycorsican/go-tun2socks/core/lwip.go:74 +0x44 created by github.com/eycorsican/go-tun2socks/core.NewLWIPStack /ext-go/1/src/github.com/eycorsican/go-tun2socks/core/lwip.go:71 +0x138

goroutine 8 [chan receive]: github.com/eycorsican/go-tun2socks/proxy.(*DNSCache).cleanUp(0x1d00500) /ext-go/1/src/github.com/eycorsican/go-tun2socks/proxy/dns_cache.go:43 +0x284 created by github.com/eycorsican/go-tun2socks/proxy.NewDNSCache /ext-go/1/src/github.com/eycorsican/go-tun2socks/proxy/dns_cache.go:28 +0x90

goroutine 9 [syscall]: syscall.Syscall(0xfa3, 0x3, 0x1d10000, 0x5dc, 0x1d00460, 0x1000000, 0x4a71d8) /usr/local/go/src/syscall/asm_linux_mipsx.s:17 +0x10 syscall.read(0x3, 0x1d10000, 0x5dc, 0x5dc, 0x1d00460, 0x0, 0x0) /usr/local/go/src/syscall/zsyscall_linux_mips.go:732 +0x60 syscall.Read(0x3, 0x1d10000, 0x5dc, 0x5dc, 0x48, 0x0, 0x0) /usr/local/go/src/syscall/syscall_unix.go:172 +0x54 internal/poll.(FD).Read(0x1c5d2c0, 0x1d10000, 0x5dc, 0x5dc, 0x0, 0x0, 0x0) /usr/local/go/src/internal/poll/fd_unix.go:165 +0x120 os.(File).read(0x1c0ed38, 0x1d10000, 0x5dc, 0x5dc, 0x1c3ff08, 0x1c3ff0c, 0x10) /usr/local/go/src/os/file_unix.go:249 +0x5c os.(File).Read(0x1c0ed38, 0x1d10000, 0x5dc, 0x5dc, 0x48, 0x48, 0x1c2e320) /usr/local/go/src/os/file.go:108 +0x6c github.com/eycorsican/go-tun2socks/tun.(tunDev).Read(0x1d00480, 0x1d10000, 0x5dc, 0x5dc, 0x48, 0x0, 0x0) /ext-go/1/src/github.com/eycorsican/go-tun2socks/tun/tun_linux.go:108 +0x58 io.copyBuffer(0x6e61a078, 0x1c0c3b0, 0x6e61a090, 0x1d00480, 0x1d10000, 0x5dc, 0x5dc, 0xca9300, 0xcddba0, 0x0, ...) /usr/local/go/src/io/io.go:402 +0x10c io.CopyBuffer(0x6e61a078, 0x1c0c3b0, 0x6e61a090, 0x1d00480, 0x1d10000, 0x5dc, 0x5dc, 0x0, 0x0, 0x0, ...) /usr/local/go/src/io/io.go:375 +0x7c main.main.func2(0x6e61a078, 0x1c0c3b0, 0xe4e5e0, 0x1d00480) /ext-go/1/src/github.com/eycorsican/go-tun2socks/cmd/tun2socks/main.go:169 +0xc8 created by main.main /ext-go/1/src/github.com/eycorsican/go-tun2socks/cmd/tun2socks/main.go:168 +0xb90

goroutine 14 [IO wait]: internal/poll.runtime_pollWait(0x6e619f40, 0x72, 0x4a8404) /usr/local/go/src/runtime/netpoll.go:173 +0x60 internal/poll.(pollDesc).wait(0x1c86294, 0x72, 0xffffff, 0xe4bac0, 0x1333e64) /usr/local/go/src/internal/poll/fd_poll_runtime.go:85 +0xc4 internal/poll.(pollDesc).waitRead(0x1c86294, 0xd2e000, 0x800, 0x800) /usr/local/go/src/internal/poll/fd_poll_runtime.go:90 +0x4c internal/poll.(FD).Read(0x1c86280, 0x1d2e000, 0x800, 0x800, 0x0, 0x0, 0x0) /usr/local/go/src/internal/poll/fd_unix.go:169 +0x190 net.(netFD).Read(0x1c86280, 0x1d2e000, 0x800, 0x800, 0x24c410, 0x480d64, 0xca93c0) /usr/local/go/src/net/fd_unix.go:202 +0x58 net.(conn).Read(0x1c0ede8, 0x1d2e000, 0x800, 0x800, 0x0, 0x0, 0x0) /usr/local/go/src/net/net.go:177 +0x70 io.copyBuffer(0x6e61a120, 0x1c5d880, 0xe49dc0, 0x1c0ede8, 0x1d2e000, 0x800, 0x800, 0xca9480, 0xd51060, 0x18, ...) /usr/local/go/src/io/io.go:402 +0x10c io.CopyBuffer(0x6e61a120, 0x1c5d880, 0xe49dc0, 0x1c0ede8, 0x1d2e000, 0x800, 0x800, 0x800, 0x48e, 0x48e, ...) /usr/local/go/src/io/io.go:375 +0x7c github.com/eycorsican/go-tun2socks/proxy/socks.(tcpHandler).fetchInput(0x1d004c0, 0xe549a0, 0x1c5d880, 0xe49dc0, 0x1c0ede8) /ext-go/1/src/github.com/eycorsican/go-tun2socks/proxy/socks/tcp.go:43 +0x100 created by github.com/eycorsican/go-tun2socks/proxy/socks.(*tcpHandler).Connect /ext-go/1/src/github.com/eycorsican/go-tun2socks/proxy/socks/tcp.go:72 +0x288

goroutine 15 [runnable]: time.Sleep(0x0, 0x989680) /usr/local/go/src/runtime/time.go:105 +0x190 github.com/eycorsican/go-tun2socks/filter.(icmpFilter).Write.func1(0x1c0c3b0, 0x1c2e320, 0x48, 0x48) /ext-go/1/src/github.com/eycorsican/go-tun2socks/filter/icmp.go:25 +0x74 created by github.com/eycorsican/go-tun2socks/filter.(icmpFilter).Write /ext-go/1/src/github.com/eycorsican/go-tun2socks/filter/icmp.go:24 +0xfc

r0 0x0 r1 0x1 r2 0x0 r3 0x6e5067c0 r4 0xa6d r5 0xa71 r6 0x6 r7 0x0 r8 0x1 r9 0x10 r10 0x0 r11 0xe74bfc r12 0xffffffff r13 0x1476d803 r14 0x21f975 r15 0x4f521a18 r16 0x6e5067c0 r17 0x13919d4 r18 0x6e4feb60 r19 0x1390000 r20 0x1390000 r21 0x138f464 r22 0x1390000 r23 0x1390000 r24 0x0 r25 0xb7bd40 r26 0x0 r27 0x0 r28 0x1383350 r29 0x6e4feab0 r30 0x1390000 r31 0xb7c0ec pc 0xb7bd80 link 0xb7c0ec lo 0x0 hi 0x0 root@OpenWrt:~# /usr/local/bin/tun2socks -tunName tun0 -tunAddr [2001:470:f294:f944::1] -tunGw [2001:470:f294:f944::] -tunMask [2001:470:f294:f944::] -proxyServe r 172.16.1.101:10098
2019/02/26 04:04:55 openning tun device 2019/02/26 04:04:55 ICMP packets will be delayed for 10ms 2019/02/26 04:04:55 Running tun2socks 2019/02/26 04:04:59 new proxy connection for target: tcp:[2404:6800:4012::200e]:80 2019/02/26 04:06:02 new proxy connection for target: tcp:104.244.42.193:443 2019/02/26 04:06:03 new proxy connection for target: tcp:192.229.237.96:443 2019/02/26 04:06:04 new proxy connection for target: tcp:104.244.42.2:443 2019/02/26 04:06:06 new proxy connection for target: tcp:104.244.43.131:443 2019/02/26 04:06:07 new proxy connection for target: tcp:192.229.232.217:443 2019/02/26 04:07:07 new proxy connection for target: tcp:[2404:6800:4012::200e]:80 Assertion "tcp_receive: wrong state" failed at line 1164 in tcp_in.c SIGABRT: abort PC=0xb7bd80 m=9 sigcode=4294967290

goroutine 0 [idle]: runtime: unknown pc 0xb7bd80 stack: frame={sp:0x6c1feab0, fp:0x0} stack=[0x6b9ff14c,0x6c1fed4c) 6c1fea30: 01383350 00000002 00538697 <net.parseIPv6Zone+107> 000cc4a8 6c1fea40: 00000002 00000000 00000000 00000000 6c1fea50: 0064fabf <github.com/eycorsican/go-tun2socks/core.Input.func2+99> 0017979d 00000001 00000000 6c1fea60: 00000000 00450524 <runtime.newstack+776> 0044dd97 <runtime.makeslice+27> 0004ac77 6c1fea70: 01383350 0064f467 <github.com/eycorsican/go-tun2socks/core.ParseTCPAddr+819> 0017933b 00000009 6c1fea80: 00659c6f <github.com/eycorsican/go-tun2socks/filter.(icmpFilter).Write.func1+167> 0018120d 00000002 0053db27 <net.(Resolver).internetAddrList+1911> 6c1fea90: 01390000 013919d4 6c1feb60 01390000 6c1feaa0: 01390000 0138f464 01390000 01390000 6c1feab0: <01390000 01390000 000008d8 00000000 6c1feac0: 00000047 000008d8 01383350 010ad728 6c1fead0: 00000000 000008d8 0043e10c <runtime.newproc1+568> 010ad728 6c1feae0: 00000047 010ad728 00000047 31313634 6c1feaf0: 010ad728 0043e18c <runtime.newproc1+696> 00000047 0043e0b4 <runtime.newproc1+480> 6c1feb00: 010ad728 00bc42b0 01332de0 00000047 6c1feb10: 00464504 <runtime.newproc.func1+96> 01c32000 01d1a8c0 01000001 6c1feb20: 00000000 0040b408 <runtime.notewakeup+104> 6c1fec00 00e733df runtime: unknown pc 0xb7bd80 stack: frame={sp:0x6c1feab0, fp:0x0} stack=[0x6b9ff14c,0x6c1fed4c) 6c1fea30: 01383350 00000002 00538697 <net.parseIPv6Zone+107> 000cc4a8 6c1fea40: 00000002 00000000 00000000 00000000 6c1fea50: 0064fabf <github.com/eycorsican/go-tun2socks/core.Input.func2+99> 0017979d 00000001 00000000 6c1fea60: 00000000 00450524 <runtime.newstack+776> 0044dd97 <runtime.makeslice+27> 0004ac77 6c1fea70: 01383350 0064f467 <github.com/eycorsican/go-tun2socks/core.ParseTCPAddr+819> 0017933b 00000009 6c1fea80: 00659c6f <github.com/eycorsican/go-tun2socks/filter.(icmpFilter).Write.func1+167> 0018120d 00000002 0053db27 <net.(Resolver).internetAddrList+1911> 6c1fea90: 01390000 013919d4 6c1feb60 01390000 6c1feaa0: 01390000 0138f464 01390000 01390000 6c1feab0: <01390000 01390000 000008d8 00000000 6c1feac0: 00000047 000008d8 01383350 010ad728 6c1fead0: 00000000 000008d8 0043e10c <runtime.newproc1+568> 010ad728 6c1feae0: 00000047 010ad728 00000047 31313634 6c1feaf0: 010ad728 0043e18c <runtime.newproc1+696> 00000047 0043e0b4 <runtime.newproc1+480> 6c1feb00: 010ad728 00bc42b0 01332de0 00000047 6c1feb10: 00464504 <runtime.newproc.func1+96> 01c32000 01d1a8c0 01000001 6c1feb20: 00000000 0040b408 <runtime.notewakeup+104> 6c1fec00 00e733df

goroutine 25 [syscall]: runtime.cgocall(0xb4d150, 0x1c50f58, 0x3c0840) /usr/local/go/src/runtime/cgocall.go:128 +0x64 fp=0x1c50f40 sp=0x1c50f28 pc=0x402f2c github.com/eycorsican/go-tun2socks/core._Cfunc_input(0x17c5650, 0x7c5650) _cgo_gotypes.go:344 +0x54 fp=0x1c50f54 sp=0x1c50f40 pc=0x6495a0 github.com/eycorsican/go-tun2socks/core.Input.func2(0x17c5650, 0x3c) /ext-go/1/src/github.com/eycorsican/go-tun2socks/core/input.go:27 +0x64 fp=0x1c50f6c sp=0x1c50f54 pc=0x64fac0 github.com/eycorsican/go-tun2socks/core.Input(0x1c30840, 0x3c, 0x3c, 0x1d4d050, 0x1d1a7e0, 0x1381540) /ext-go/1/src/github.com/eycorsican/go-tun2socks/core/input.go:27 +0xac fp=0x1c50f90 sp=0x1c50f6c pc=0x64b2d0 github.com/eycorsican/go-tun2socks/core.(lwipStack).Write(0x1c0ed48, 0x1c30840, 0x3c, 0x3c, 0x48, 0x0, 0x0) /ext-go/1/src/github.com/eycorsican/go-tun2socks/core/lwip.go:89 +0x4c fp=0x1c50fac sp=0x1c50f90 pc=0x64b664 github.com/eycorsican/go-tun2socks/filter.(icmpFilter).Write.func1(0x1c0c3b0, 0x1c30840, 0x3c, 0x3c) /ext-go/1/src/github.com/eycorsican/go-tun2socks/filter/icmp.go:26 +0xa8 fp=0x1c50fdc sp=0x1c50fac pc=0x659c70 runtime.goexit() /usr/local/go/src/runtime/asm_mipsx.s:660 +0x4 fp=0x1c50fdc sp=0x1c50fdc pc=0x46759c created by github.com/eycorsican/go-tun2socks/filter.(*icmpFilter).Write /ext-go/1/src/github.com/eycorsican/go-tun2socks/filter/icmp.go:24 +0xfc

goroutine 1 [chan receive]: main.main() /ext-go/1/src/github.com/eycorsican/go-tun2socks/cmd/tun2socks/main.go:179 +0xc88

goroutine 5 [syscall]: os/signal.signal_recv(0x0) /usr/local/go/src/runtime/sigqueue.go:139 +0x118 os/signal.loop() /usr/local/go/src/os/signal/signal_unix.go:23 +0x34 created by os/signal.init.0 /usr/local/go/src/os/signal/signal_unix.go:29 +0x50

goroutine 7 [chan receive]: github.com/eycorsican/go-tun2socks/core.NewLWIPStack.func5() /ext-go/1/src/github.com/eycorsican/go-tun2socks/core/lwip.go:74 +0x44 created by github.com/eycorsican/go-tun2socks/core.NewLWIPStack /ext-go/1/src/github.com/eycorsican/go-tun2socks/core/lwip.go:71 +0x138

goroutine 8 [chan receive]: github.com/eycorsican/go-tun2socks/proxy.(*DNSCache).cleanUp(0x1d00500) /ext-go/1/src/github.com/eycorsican/go-tun2socks/proxy/dns_cache.go:43 +0x284 created by github.com/eycorsican/go-tun2socks/proxy.NewDNSCache /ext-go/1/src/github.com/eycorsican/go-tun2socks/proxy/dns_cache.go:28 +0x90

goroutine 9 [runnable]: syscall.Syscall(0xfa3, 0x3, 0x1d10000, 0x5dc, 0x48, 0x2, 0x0) /usr/local/go/src/syscall/asm_linux_mipsx.s:17 +0x10 syscall.read(0x3, 0x1d10000, 0x5dc, 0x5dc, 0x1d00460, 0x0, 0x0) /usr/local/go/src/syscall/zsyscall_linux_mips.go:732 +0x60 syscall.Read(0x3, 0x1d10000, 0x5dc, 0x5dc, 0x0, 0x0, 0x1000000) /usr/local/go/src/syscall/syscall_unix.go:172 +0x54 internal/poll.(FD).Read(0x1c5d2c0, 0x1d10000, 0x5dc, 0x5dc, 0x0, 0x0, 0x0) /usr/local/go/src/internal/poll/fd_unix.go:165 +0x120 os.(File).read(0x1c0ed38, 0x1d10000, 0x5dc, 0x5dc, 0x1c4ff08, 0x1c4ff0c, 0x10) /usr/local/go/src/os/file_unix.go:249 +0x5c os.(File).Read(0x1c0ed38, 0x1d10000, 0x5dc, 0x5dc, 0x48e, 0x48e, 0x1d4e000) /usr/local/go/src/os/file.go:108 +0x6c github.com/eycorsican/go-tun2socks/tun.(tunDev).Read(0x1d00480, 0x1d10000, 0x5dc, 0x5dc, 0x48e, 0x0, 0x0) /ext-go/1/src/github.com/eycorsican/go-tun2socks/tun/tun_linux.go:108 +0x58 io.copyBuffer(0x6e570078, 0x1c0c3b0, 0x6e570090, 0x1d00480, 0x1d10000, 0x5dc, 0x5dc, 0xca9300, 0xcddba0, 0x0, ...) /usr/local/go/src/io/io.go:402 +0x10c io.CopyBuffer(0x6e570078, 0x1c0c3b0, 0x6e570090, 0x1d00480, 0x1d10000, 0x5dc, 0x5dc, 0x0, 0x0, 0x0, ...) /usr/local/go/src/io/io.go:375 +0x7c main.main.func2(0x6e570078, 0x1c0c3b0, 0xe4e5e0, 0x1d00480) /ext-go/1/src/github.com/eycorsican/go-tun2socks/cmd/tun2socks/main.go:169 +0xc8 created by main.main /ext-go/1/src/github.com/eycorsican/go-tun2socks/cmd/tun2socks/main.go:168 +0xb90

goroutine 19 [IO wait]: internal/poll.runtime_pollWait(0x6e56fec0, 0x72, 0x4a8404) /usr/local/go/src/runtime/netpoll.go:173 +0x60 internal/poll.(pollDesc).wait(0x1c86384, 0x72, 0xffffff, 0xe4bac0, 0x1333e64) /usr/local/go/src/internal/poll/fd_poll_runtime.go:85 +0xc4 internal/poll.(pollDesc).waitRead(0x1c86384, 0xd2c800, 0x800, 0x800) /usr/local/go/src/internal/poll/fd_poll_runtime.go:90 +0x4c internal/poll.(FD).Read(0x1c86370, 0x1d2c800, 0x800, 0x800, 0x0, 0x0, 0x0) /usr/local/go/src/internal/poll/fd_unix.go:169 +0x190 net.(netFD).Read(0x1c86370, 0x1d2c800, 0x800, 0x800, 0x29f, 0x0, 0x0) /usr/local/go/src/net/fd_unix.go:202 +0x58 net.(conn).Read(0x1c0efe8, 0x1d2c800, 0x800, 0x800, 0x0, 0x0, 0x0) /usr/local/go/src/net/net.go:177 +0x70 io.copyBuffer(0x6e5700d8, 0x1d33a00, 0xe49dc0, 0x1c0efe8, 0x1d2c800, 0x800, 0x800, 0xca9480, 0xd51060, 0x18, ...) /usr/local/go/src/io/io.go:402 +0x10c io.CopyBuffer(0x6e5700d8, 0x1d33a00, 0xe49dc0, 0x1c0efe8, 0x1d2c800, 0x800, 0x800, 0x800, 0x3c, 0x3c, ...) /usr/local/go/src/io/io.go:375 +0x7c github.com/eycorsican/go-tun2socks/proxy/socks.(tcpHandler).fetchInput(0x1d004c0, 0xe549a0, 0x1d33a00, 0xe49dc0, 0x1c0efe8) /ext-go/1/src/github.com/eycorsican/go-tun2socks/proxy/socks/tcp.go:43 +0x100 created by github.com/eycorsican/go-tun2socks/proxy/socks.(*tcpHandler).Connect /ext-go/1/src/github.com/eycorsican/go-tun2socks/proxy/socks/tcp.go:72 +0x288

goroutine 18 [IO wait]: internal/poll.runtime_pollWait(0x6e56ff40, 0x72, 0x4a8404) /usr/local/go/src/runtime/netpoll.go:173 +0x60 internal/poll.(pollDesc).wait(0x1c86334, 0x72, 0xffffff, 0xe4bac0, 0x1333e64) /usr/local/go/src/internal/poll/fd_poll_runtime.go:85 +0xc4 internal/poll.(pollDesc).waitRead(0x1c86334, 0xd2c000, 0x800, 0x800) /usr/local/go/src/internal/poll/fd_poll_runtime.go:90 +0x4c internal/poll.(FD).Read(0x1c86320, 0x1d2c000, 0x800, 0x800, 0x0, 0x0, 0x0) /usr/local/go/src/internal/poll/fd_unix.go:169 +0x190 net.(netFD).Read(0x1c86320, 0x1d2c000, 0x800, 0x800, 0x115, 0x0, 0x0) /usr/local/go/src/net/fd_unix.go:202 +0x58 net.(conn).Read(0x1c0eea8, 0x1d2c000, 0x800, 0x800, 0x0, 0x0, 0x0) /usr/local/go/src/net/net.go:177 +0x70 io.copyBuffer(0x6e5700d8, 0x1d33900, 0xe49dc0, 0x1c0eea8, 0x1d2c000, 0x800, 0x800, 0xca9480, 0xd51060, 0x18, ...) /usr/local/go/src/io/io.go:402 +0x10c io.CopyBuffer(0x6e5700d8, 0x1d33900, 0xe49dc0, 0x1c0eea8, 0x1d2c000, 0x800, 0x800, 0x800, 0x616e3c, 0x1c5b7ec, ...) /usr/local/go/src/io/io.go:375 +0x7c github.com/eycorsican/go-tun2socks/proxy/socks.(tcpHandler).fetchInput(0x1d004c0, 0xe549a0, 0x1d33900, 0xe49dc0, 0x1c0eea8) /ext-go/1/src/github.com/eycorsican/go-tun2socks/proxy/socks/tcp.go:43 +0x100 created by github.com/eycorsican/go-tun2socks/proxy/socks.(*tcpHandler).Connect /ext-go/1/src/github.com/eycorsican/go-tun2socks/proxy/socks/tcp.go:72 +0x288

goroutine 20 [IO wait]: internal/poll.runtime_pollWait(0x6e56fe40, 0x72, 0x4a8404) /usr/local/go/src/runtime/netpoll.go:173 +0x60 internal/poll.(pollDesc).wait(0x1c863d4, 0x72, 0xffffff, 0xe4bac0, 0x1333e64) /usr/local/go/src/internal/poll/fd_poll_runtime.go:85 +0xc4 internal/poll.(pollDesc).waitRead(0x1c863d4, 0xd2d000, 0x800, 0x800) /usr/local/go/src/internal/poll/fd_poll_runtime.go:90 +0x4c internal/poll.(FD).Read(0x1c863c0, 0x1d2d000, 0x800, 0x800, 0x0, 0x0, 0x0) /usr/local/go/src/internal/poll/fd_unix.go:169 +0x190 net.(netFD).Read(0x1c863c0, 0x1d2d000, 0x800, 0x800, 0x68, 0x0, 0x0) /usr/local/go/src/net/fd_unix.go:202 +0x58 net.(conn).Read(0x1c0f0f0, 0x1d2d000, 0x800, 0x800, 0x0, 0x0, 0x0) /usr/local/go/src/net/net.go:177 +0x70 io.copyBuffer(0x6e5700d8, 0x1d33b80, 0xe49dc0, 0x1c0f0f0, 0x1d2d000, 0x800, 0x800, 0xca9480, 0xd51060, 0x18, ...) /usr/local/go/src/io/io.go:402 +0x10c io.CopyBuffer(0x6e5700d8, 0x1d33b80, 0xe49dc0, 0x1c0f0f0, 0x1d2d000, 0x800, 0x800, 0x800, 0x0, 0x0, ...) /usr/local/go/src/io/io.go:375 +0x7c github.com/eycorsican/go-tun2socks/proxy/socks.(tcpHandler).fetchInput(0x1d004c0, 0xe549a0, 0x1d33b80, 0xe49dc0, 0x1c0f0f0) /ext-go/1/src/github.com/eycorsican/go-tun2socks/proxy/socks/tcp.go:43 +0x100 created by github.com/eycorsican/go-tun2socks/proxy/socks.(*tcpHandler).Connect /ext-go/1/src/github.com/eycorsican/go-tun2socks/proxy/socks/tcp.go:72 +0x288

goroutine 21 [IO wait]: internal/poll.runtime_pollWait(0x6e56fdc0, 0x72, 0x4a8404) /usr/local/go/src/runtime/netpoll.go:173 +0x60 internal/poll.(pollDesc).wait(0x1c86424, 0x72, 0xffffff, 0xe4bac0, 0x1333e64) /usr/local/go/src/internal/poll/fd_poll_runtime.go:85 +0xc4 internal/poll.(pollDesc).waitRead(0x1c86424, 0xd2d800, 0x800, 0x800) /usr/local/go/src/internal/poll/fd_poll_runtime.go:90 +0x4c internal/poll.(FD).Read(0x1c86410, 0x1d2d800, 0x800, 0x800, 0x0, 0x0, 0x0) /usr/local/go/src/internal/poll/fd_unix.go:169 +0x190 net.(netFD).Read(0x1c86410, 0x1d2d800, 0x800, 0x800, 0x28f, 0x0, 0x0) /usr/local/go/src/net/fd_unix.go:202 +0x58 net.(conn).Read(0x1c0f670, 0x1d2d800, 0x800, 0x800, 0x0, 0x0, 0x0) /usr/local/go/src/net/net.go:177 +0x70 io.copyBuffer(0x6e5700d8, 0x1d33ec0, 0xe49dc0, 0x1c0f670, 0x1d2d800, 0x800, 0x800, 0xca9480, 0xd51060, 0x18, ...) /usr/local/go/src/io/io.go:402 +0x10c io.CopyBuffer(0x6e5700d8, 0x1d33ec0, 0xe49dc0, 0x1c0f670, 0x1d2d800, 0x800, 0x800, 0x800, 0x0, 0x0, ...) /usr/local/go/src/io/io.go:375 +0x7c github.com/eycorsican/go-tun2socks/proxy/socks.(tcpHandler).fetchInput(0x1d004c0, 0xe549a0, 0x1d33ec0, 0xe49dc0, 0x1c0f670) /ext-go/1/src/github.com/eycorsican/go-tun2socks/proxy/socks/tcp.go:43 +0x100 created by github.com/eycorsican/go-tun2socks/proxy/socks.(*tcpHandler).Connect /ext-go/1/src/github.com/eycorsican/go-tun2socks/proxy/socks/tcp.go:72 +0x288

goroutine 22 [IO wait]: internal/poll.runtime_pollWait(0x6e56fd40, 0x72, 0x4a8404) /usr/local/go/src/runtime/netpoll.go:173 +0x60 internal/poll.(pollDesc).wait(0x1c86474, 0x72, 0xffffff, 0xe4bac0, 0x1333e64) /usr/local/go/src/internal/poll/fd_poll_runtime.go:85 +0xc4 internal/poll.(pollDesc).waitRead(0x1c86474, 0xd38000, 0x800, 0x800) /usr/local/go/src/internal/poll/fd_poll_runtime.go:90 +0x4c internal/poll.(FD).Read(0x1c86460, 0x1d38000, 0x800, 0x800, 0x0, 0x0, 0x0) /usr/local/go/src/internal/poll/fd_unix.go:169 +0x190 net.(netFD).Read(0x1c86460, 0x1d38000, 0x800, 0x800, 0x525, 0x0, 0x0) /usr/local/go/src/net/fd_unix.go:202 +0x58 net.(conn).Read(0x1c0fc50, 0x1d38000, 0x800, 0x800, 0x0, 0x0, 0x0) /usr/local/go/src/net/net.go:177 +0x70 io.copyBuffer(0x6e5700d8, 0x1d33fc0, 0xe49dc0, 0x1c0fc50, 0x1d38000, 0x800, 0x800, 0xca9480, 0xd51060, 0x18, ...) /usr/local/go/src/io/io.go:402 +0x10c io.CopyBuffer(0x6e5700d8, 0x1d33fc0, 0xe49dc0, 0x1c0fc50, 0x1d38000, 0x800, 0x800, 0x800, 0x0, 0x0, ...) /usr/local/go/src/io/io.go:375 +0x7c github.com/eycorsican/go-tun2socks/proxy/socks.(tcpHandler).fetchInput(0x1d004c0, 0xe549a0, 0x1d33fc0, 0xe49dc0, 0x1c0fc50) /ext-go/1/src/github.com/eycorsican/go-tun2socks/proxy/socks/tcp.go:43 +0x100 created by github.com/eycorsican/go-tun2socks/proxy/socks.(*tcpHandler).Connect /ext-go/1/src/github.com/eycorsican/go-tun2socks/proxy/socks/tcp.go:72 +0x288

goroutine 27 [runnable]: github.com/eycorsican/go-tun2socks/proxy/socks.(tcpHandler).fetchInput(0x1d004c0, 0xe549a0, 0x1d4bc00, 0xe49dc0, 0x1d44cb0) /ext-go/1/src/github.com/eycorsican/go-tun2socks/proxy/socks/tcp.go:33 created by github.com/eycorsican/go-tun2socks/proxy/socks.(tcpHandler).Connect /ext-go/1/src/github.com/eycorsican/go-tun2socks/proxy/socks/tcp.go:72 +0x288

r0 0x0 r1 0x1 r2 0x0 r3 0x6c2067c0 r4 0xac0 r5 0xac9 r6 0x6 r7 0x0 r8 0x1 r9 0x10 r10 0x1d46240 r11 0x1c2c000 r12 0x80 r13 0x1f r14 0x80000000 r15 0x81 r16 0x6c2067c0 r17 0x13919d4 r18 0x6c1feb60 r19 0x1390000 r20 0x1390000 r21 0x138f464 r22 0x1390000 r23 0x1390000 r24 0x0 r25 0xb7bd40 r26 0x0 r27 0x0 r28 0x1383350 r29 0x6c1feab0 r30 0x1390000 r31 0xb7c0ec pc 0xb7bd80 link 0xb7c0ec lo 0x0 hi 0x0 `

eycorsican commented 5 years ago

这个错误可以用固定步骤重现吗?

phoenixxie0 commented 5 years ago

可以用固定步骤重现,出现在我两台不同平台的openwrt路由器上,一台是mips,我之前是认为mips的问题,之后转到x64平台上,然后出现同样的错误。但是在debian或者ubuntu上没有发现这个问题

eycorsican commented 5 years ago

可以试下编译这个分支:https://github.com/eycorsican/go-tun2socks/tree/fix-tcp-wrong-state

phoenixxie0 commented 5 years ago

编译了,发现在mips平台上能运行,也能够转发IPv6,但是有个小问题,tracert -d 的时候只有一跳。

eycorsican commented 5 years ago

只有一跳是因为 icmp 包没法代理,没有代理协议支持,icmp 只是在本地回应。

这个issue 先不要关,目前的修复并不太好,可以的话后面继续帮测一下。

phoenixxie0 commented 5 years ago

还有一个问题就是这个commit无法使用make xbuild 会出错。

phoenixxie0 commented 5 years ago

使用 make xbuild编译的时候出现以下错误

Checking for required docker image karalabe/xgo-latest... found.
Cross compiling github.com/eycorsican/go-tun2socks/cmd/tun2socks...
Building locally github.com/eycorsican/go-tun2socks/cmd/tun2socks...
Assembling toolchain for android-16/arm...
Bootstrapping android-16/arm...
Compiling for android-16/arm...
# github.com/eycorsican/go-tun2socks/cmd/tun2socks
/usr/local/go/pkg/tool/linux_amd64/link: running arm-linux-androideabi-gcc failed: exit status 1
/usr/arm-linux-androideabi-4.9/bin/../lib/gcc/arm-linux-androideabi/4.9/../../../../arm-linux-androideabi/bin/ld: error: cannot find -llog
/tmp/go-link-677653451/000056.o:gcc_android.c:function fatalf: error: undefined reference to '__android_log_vprint'
collect2: error: ld returned 1 exit status

2019/03/01 23:15:27 Failed to cross compile package: exit status 2.
Makefile:99: recipe for target 'xbuild' failed
make: *** [xbuild] Error 1
eycorsican commented 5 years ago

@xseven007 针对 ipv6 的问题再测下最新的 commit ,还是在那个分支上。

你发的这个编译错误估计是环境问题,travis build 是通过的。

eycorsican commented 5 years ago

最新的 travis build 也失败了,目测是 xgo 那边更新镜像出问题,等他们修复或者用旧版的镜像吧

phoenixxie0 commented 5 years ago

好像只是Android的不能编译,其他的没什么问题。还有一个疑问就是,体积问题,是不是把v2的ctl也包含进去了?

eycorsican commented 5 years ago

android 你试下去掉 -static,然后编译前执行下 go clean -cache。用了 v2 体积就这么大,你不用 v2 的话可以编译一个不含 v2 的版本 make clean && make nov2

phoenixxie0 commented 5 years ago

去掉-static之后可以编译android了,希望能够有选项进行编译,类似nov2这样的,加入static,noss,这样的,可以让使用者选择性的编译模块。也可以方便移植到嵌入式设备,例如openwrt之类的。

phoenixxie0 commented 5 years ago

nov2版本刚刚编译了,通过修改makefile里参数的形式静态编译之后,在mips设备上的启动速度明显比原来快很多,内存使用也得到了改善,大概减少了一半。

eycorsican commented 5 years ago

@xseven007 现在可以改下 Makefile 让只编译 socks(不包含 dns 缓存),在我机器上编译后的大小是 2.9M