shadowsocks / shadowsocks-rust

A Rust port of shadowsocks
https://shadowsocks.org/
MIT License
8.67k stars 1.18k forks source link

[Compatibility Issue] Tun protocol on R4S (OpenWRT with Linux 5.10) #744

Closed f4nff closed 2 years ago

f4nff commented 2 years ago

ifconfig

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:1469659 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1469659 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:4415232102 (4.1 GiB)  TX bytes:4415232102 (4.1 GiB)
tun1      Link encap:UNSPEC  HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
          inet addr:10.255.0.1  P-t-P:10.255.0.1  Mask:255.255.255.0
          inet6 addr: fe80::3acb:b23c:904b:8820/64 Scope:Link
          UP POINTOPOINT RUNNING NOARP MULTICAST  MTU:1500  Metric:1
          RX packets:11357 errors:0 dropped:0 overruns:0 frame:0
          TX packets:5053 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:500
          RX bytes:10395741 (9.9 MiB)  TX bytes:524849 (512.5 KiB)
root@OpenWrt:~/socks# ./sslocal --protocol tun -s "[::1]:8388" -m "aes-256-gcm" -k "hello-kitty" --o
utbound-bind-interface lo --tun-interface-name tun1
error: The argument 'LOCAL_ADDR' wasn't found
f4nff commented 2 years ago

当然有,如果没有,我怎么通过luci's进行控制?

f4nff commented 2 years ago
image
f4nff commented 2 years ago

https://downloads.openwrt.org/snapshots/targets/rockchip/armv8/openwrt-rockchip-armv8-friendlyarm_nanopi-r4s-ext4-sysupgrade.img.gz 9.3MB

https://github.com/DHDAXCW/NanoPi-R4S/releases 250MB

很显然,你的r4s版本是完整linux版本的openwrt,

zonyitoo commented 2 years ago

Did you tried to use ip and ifconfig? This is the way I can confirm that it is working as expected.

You can't make a conclusion by release size, the release in DHDAXCW includes many pre-compiled plugins. The kernel in openwrt-rockchip-armv8-friendlyarm_nanopi-r4s-ext4-sysupgrade.img.gz of course is a fully functional Linux Kernel.

f4nff commented 2 years ago

我建议你去刷一下 https://downloads.openwrt.org/snapshots/targets/rockchip/armv8/openwrt-rockchip-armv8-friendlyarm_nanopi-r4s-ext4-sysupgrade.img.gz


opkg update
opkg install luci
opkg install kmod-tun
opkg install vsftpd openssh-sftp-server
opkg install luci-i18n-base-zh-cn
opkg install coreutils-nohup
opkg install lsof
opkg install curl
opkg install mtr
opkg install iperf3
opkg install grep

这样就不用解释太多了。 相比较,udp泄露这个问题更严重。。。

f4nff commented 2 years ago

https://github.com/DHDAXCW/NanoPi-R4S/releases 这种版本,有太多鸡肋,很臃肿,我不喜欢使用这类固件。

zonyitoo commented 2 years ago

If the problem exists, then it should exists in any OpenWRT with Linux Kernel 5.10.

Again, I don't think the UDP association manager has any leak. Because it have been proven by many other users. If you want to see obvious memory drops, add --udp-max-associations 512 --udp-timeout 5. You don't need to keep 65536 associations because you are testing it with dns queries.

f4nff commented 2 years ago

--udp-max-associations 512 --udp-timeout 5 你说这些,我已经测试过了,问题依然存在, 我做了严格的对比测试, https://github.com/xjasonlyu/tun2socks/releases/tag/v2.3.2 功能一样的,就没有问题。

f4nff commented 2 years ago

你爱信不信,你刷个固件不过几分钟,就可以重现我所反馈的bug,你一直停留在自己的思维模式,并且肯定,不去质疑,沟通太累。

zonyitoo commented 2 years ago

I installed a OpenWRT with Kernel 5.10 from https://downloads.openwrt.org/snapshots/targets/x86/64/.

And configured with your provided /etc/config/network, started with ./sslocal --protocol tun -s "[::1]:8388" -m "aes-256-gcm" -k "hello-kitty" --outbound-bind-interface lo --tun-interface-name tun1 -U, and yes, everything works fine:

2022-01-11T18:05:28.134150979+00:00 INFO  shadowsocks local 1.12.6 build 2022-01-11T15:11:40.831565092+00:00
2022-01-11T18:05:28.137677001+00:00 INFO  shadowsocks tun device tun1, address 10.255.0.1, netmask 255.255.255.0, mtu 1500, mode tcp_and_udp

I won't try with my R4S because I don't want to mess up my network configuration in the mid-night. I tried on a x86_64 machine.

And I have already proved that your configuration is working in the official OpenWRT with Kernel 5.10. Maybe this only happen specifically in your openwrt-rockchip-armv8-friendlyarm_nanopi-r4s-ext4-sysupgrade.img.gz.

Confirmed working with:

curl --interface tun1 'http://www.baidu.com'

and saw logs on sslocal:

2022-01-11T18:15:26.868300239+00:00 TRACE [3171:139642979308304] [shadowsocks_service::local::tun] [TUN] received IP packet b"E\x00\x00<\x04\x1f@\x00@\x06k\x9f\n\xff\x00\x01\x0e\xd7\xb1\'\xbe\x8c\x00Pk\xc8}\x9a\x00\x00\x00\x00\xa0\x02\xfa\xf0\x08/\x00\x00\x02\x04\x05\xb4\x04\x02\x08\nh\x1ei\x85\x00\x00\x00\x00\x01\x03\x03\x06"
2022-01-11T18:15:26.868533982+00:00 TRACE [3171:139642979308304] [shadowsocks_service::local::tun::tcp] allocated tcp addr 10.255.0.11:6971 for 10.255.0.1:48780 -> 14.215.177.39:80
2022-01-11T18:15:26.869941988+00:00 TRACE [3171:139642979308304] [shadowsocks_service::local::tun::tcp] TCP 10.255.0.1:48780 -> 14.215.177.39:80 TcpHeader { source_port: 48780, destination_port: 80, sequence_number: 1808301466, acknowledgment_number: 0, data_offset: 10, ns: false, fin: false, syn: true, rst: false, psh: false, ack: false, urg: false, ece: false, cwr: false, window_size: 64240, checksum: 2095, urgent_pointer: 0, options: [MaximumSegmentSize(1460), SelectiveAcknowledgementPermitted, Timestamp(1746823557, 0), Noop, WindowScale(6)] }
.......

System version:

$ uname
Linux OpenWrt 5.10.90 #0 SMP Mon Jan 10 13:45:41 2022 x86_64 GNU/Linux

I will move on to test your provided UDP testing method.

f4nff commented 2 years ago

你安装的是5.10是x86的,我之前也有刷过x86的设备,跟ARM的有区别。 https://downloads.openwrt.org/snapshots/targets/rockchip/armv8/openwrt-rockchip-armv8-friendlyarm_nanopi-r4s-ext4-sysupgrade.img.gz 这个, /etc/config/network

./sslocal --protocol tun -s "[::1]:8388" -m "aes-256-gcm" -k "hello-kitty" --outbound-bind-interface lo --tun-interface-name tun1 -U

确定有问题,我已经测试了无数遍了, 我只能通过

sslocal --protocol tun -s "[::1]:8388" -m "aes-256-gcm" -k "hello-kitty" --outbound-bind-interface lo --tun-interface-name tun2 --tun-interface-address 10.55.0.1/24  -U 
ip route add default via 10.55.0.1 dev tun2 table 12

开启sslocal,但是通过/etc/config/network 的方式新建网卡,是不行的。

使用luci's来管理tun会更方便,更可控。

对于udp泄露,按照我的方式,很容易触发,很明显的问题。 但是udp高并发使用的场景很少,我敢肯定你们也没有并发进行测试过,大多都是充当客户端来用,如果有异常就重启了进程,这样就掩盖了问题真相。

zonyitoo commented 2 years ago

Well, I will need your help. Run strace on sslocal and see which syscall returns Resource Busy in your environment.

Well, UDP is used widely because of QUIC. We have deployed many sslocal and ssserver instances and didn't see any OOM errors in real life. Make conclusion carefully.

f4nff commented 2 years ago

Well, I will need your help. Run strace on sslocal and see which syscall returns Resource Busy in your environment.

这个具体怎么操作,我不知道呀,

Well, UDP is used widely because of QUIC. We have deployed many sslocal and ssserver instances and didn't see any OOM errors in real life. Make conclusion carefully.

udp泄露是我偶然发现的,正常使用我也没发现问题,但是并发测试之后,就出现了。

zonyitoo commented 2 years ago
opkg update && opkg install strace
strace ./sslocal --protocol tun -s "[::1]:8388" -m "aes-256-gcm" -k "hello-kitty" --outbound-bind-interface lo --tun-interface-name tun1 -U

udp泄露是我偶然发现的,正常使用我也没发现问题,但是并发测试之后,就出现了。

How long did you run the test? Does the memory usage keeps on that number after a long time if you keep the test running?

How to use that gddx BTW.

zonyitoo commented 2 years ago

If memory leak exists, then it should be able to reproduce everywhere. I would test it on my laptop with gddx.

f4nff commented 2 years ago

运行三十秒就可以了, 你需要编译dns.go 然后执行 dns.exe -sr gddx.txt -at google.com -sl 6

然后 cat /proc/sslocal-pid/status

f4nff commented 2 years ago

很神奇

root@OpenWrt:~/socks# ./sslocal --protocol tun -s "[::1]:8388" -m "aes-256-gcm" -k "hello-kitty" --o
utbound-bind-interface lo --tun-interface-name tun1 -U
2022-01-11T18:42:48.571458520+00:00 INFO  shadowsocks local 1.12.6 build 2022-01-11T08:37:48.571863424+00:00
2022-01-11T18:42:48.574399352+00:00 ERROR tun device doesn't have address, error: Address not available (os error 99), set it by tun_interface_address
thread 'main' panicked at 'create local: Custom { kind: Other, error: Io(Os { code: 99, kind: AddrNotAvailable, message: "Address not available" }) }', src/service/local.rs:763:51
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Aborted

我单独运行 ssloacl是不行的,但是运行: strace ./sslocal --protocol tun -s "[::1]:8388" -m "aes-256-gcm" -k "hello-kitty" --outbound-bind-interface lo --tun-interface-name tun1 -U

却正常跑起来了。

zonyitoo commented 2 years ago

This is why I said: the thing only happen in your specific image.

f4nff commented 2 years ago

这个需要你来解决这种特定环境,我只会测试,不会敲代码,

f4nff commented 2 years ago
root@OpenWrt:~/socks# strace ./sslocal --protocol tun -s "[::1]:8388" -m "aes-256-gcm" -k "hello-kit
ty" --outbound-bind-interface lo --tun-interface-name tun1 -U
execve("./sslocal", ["./sslocal", "--protocol", "tun", "-s", "[::1]:8388", "-m", "aes-256-gcm", "-k", "hello-kitty", "--outbound-bind-interface", "lo", "--tun-interface-name", "tun1", "-U"], 0xffffd224a8b8 /* 14 vars */) = 0
mmap(NULL, 1024, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xffffb9ae0000
set_tid_address(0x9b44a8)               = 5945
ppoll([{fd=0, events=0}, {fd=1, events=0}, {fd=2, events=0}], 3, {tv_sec=0, tv_nsec=0}, NULL, 8) = 0 (Timeout)
rt_sigaction(SIGPIPE, {sa_handler=SIG_IGN, sa_mask=[], sa_flags=SA_RESTORER|SA_RESTART, sa_restorer=0x84000c}, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0
rt_sigaction(SIGSEGV, NULL, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0
rt_sigprocmask(SIG_UNBLOCK, [RT_1 RT_2], NULL, 8) = 0
rt_sigaction(SIGSEGV, {sa_handler=0x7cccf4, sa_mask=[], sa_flags=SA_RESTORER|SA_ONSTACK|SA_SIGINFO, sa_restorer=0x84000c}, NULL, 8) = 0
rt_sigaction(SIGBUS, NULL, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0
rt_sigaction(SIGBUS, {sa_handler=0x7cccf4, sa_mask=[], sa_flags=SA_RESTORER|SA_ONSTACK|SA_SIGINFO, sa_restorer=0x84000c}, NULL, 8) = 0
sigaltstack(NULL, {ss_sp=NULL, ss_flags=SS_DISABLE, ss_size=0}) = 0
mmap(NULL, 16384, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS|MAP_STACK, -1, 0) = 0xffffb9adc000
mprotect(0xffffb9adc000, 4096, PROT_NONE) = 0
sigaltstack({ss_sp=0xffffb9add000, ss_flags=0, ss_size=12288}, NULL) = 0
brk(NULL)                               = 0x1e1c4000
brk(0x1e1c5000)                         = 0x1e1c5000
rt_sigprocmask(SIG_BLOCK, ~[RTMIN RT_1 RT_2], [], 8) = 0
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
getrandom("\x95\x5c\xaf\x5e\xe7\x27\xcc\x37\x2b\x90\x2d\xc6\x88\x46\x1e\x12", 16, GRND_NONBLOCK) = 16
brk(0x1e1c7000)                         = 0x1e1c7000
brk(0x1e1ca000)                         = 0x1e1ca000
brk(0x1e1cf000)                         = 0x1e1cf000
brk(0x1e1d9000)                         = 0x1e1d9000
getcwd("/root/socks", 512)              = 12
newfstatat(AT_FDCWD, "/root/socks/config.json", 0xfffffeee8660, 0) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/root/.config/shadowsocks-rust/config.json", 0xfffffeee8660, 0) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/root/.config/shadowsocks-rust/config.json", 0xfffffeee8660, 0) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/etc/xdg/shadowsocks-rust/config.json", 0xfffffeee8660, 0) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/etc/shadowsocks-rust/config.json", 0xfffffeee8660, 0) = -1 ENOENT (No such file or directory)
ioctl(2, TIOCGWINSZ, {ws_row=34, ws_col=100, ws_xpixel=0, ws_ypixel=0}) = 0
openat(AT_FDCWD, "/etc/localtime", O_RDONLY|O_NONBLOCK|O_LARGEFILE|O_CLOEXEC) = -1 ENOENT (No such file or directory)
write(2, "2022-01-11T18:52:34.909503328+00"..., 352022-01-11T18:52:34.909503328+00:00) = 35
write(2, " ", 1 )                        = 1
write(2, "\33[0;32m", 7)                = 7
write(2, "INFO", 4INFO)                     = 4
write(2, "\33[0m", 4)                   = 4
write(2, " ", 1 )                        = 1
write(2, " ", 1 )                        = 1
write(2, "shadowsocks local ", 18shadowsocks local )      = 18
write(2, "1.12.6", 61.12.6)                   = 6
write(2, " build ", 7 build )                  = 7
write(2, "2022-01-11T08:37:48.571863424+00"..., 352022-01-11T08:37:48.571863424+00:00) = 35
write(2, "\n", 1
)                       = 1
openat(AT_FDCWD, "/proc/self/cgroup", O_RDONLY|O_LARGEFILE|O_CLOEXEC) = 3
fcntl(3, F_SETFD, FD_CLOEXEC)           = 0
read(3, "0::/services/dropbear/instance1\n", 8192) = 32
read(3, "", 8192)                       = 0
close(3)                                = 0
sched_getaffinity(0, 128, [0, 1, 2, 3, 4, 5]) = 32
epoll_create1(EPOLL_CLOEXEC)            = 3
eventfd2(0, EFD_CLOEXEC|EFD_NONBLOCK)   = 4
epoll_ctl(3, EPOLL_CTL_ADD, 4, {events=EPOLLIN|EPOLLRDHUP|EPOLLET, data={u32=2147483648, u64=2147483648}}) = 0
fcntl(3, F_DUPFD_CLOEXEC, 3)            = 5
fcntl(5, F_SETFD, FD_CLOEXEC)           = 0
socketpair(AF_UNIX, SOCK_STREAM|SOCK_CLOEXEC|SOCK_NONBLOCK, 0, [6, 7]) = 0
fcntl(6, F_DUPFD_CLOEXEC, 0)            = 8
fcntl(8, F_SETFD, FD_CLOEXEC)           = 0
epoll_ctl(5, EPOLL_CTL_ADD, 8, {events=EPOLLIN|EPOLLOUT|EPOLLRDHUP|EPOLLET, data={u32=0, u64=0}}) = 0
rt_sigprocmask(SIG_UNBLOCK, [RT_1 RT_2], NULL, 8) = 0
mmap(NULL, 2109440, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xffffb98d9000
mprotect(0xffffb98db000, 2101248, PROT_READ|PROT_WRITE) = 0
rt_sigprocmask(SIG_BLOCK, ~[RTMIN RT_1 RT_2], [], 8) = 0
clone(child_stack=0xffffb9adb7d0, flags=CLONE_VM|CLONE_FS|CLONE_FILES|CLONE_SIGHAND|CLONE_THREAD|CLONE_SYSVSEM|CLONE_SETTLS|CLONE_PARENT_SETTID|CLONE_CHILD_CLEARTID|0x400000, parent_tid=[5946], tls=0xffffb9adb8e0, child_tidptr=0x9b44a8) = 5946
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
futex(0xffffb9adb910, FUTEX_WAKE_PRIVATE, 1) = 1
mmap(NULL, 2109440, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xffffb96d2000
mprotect(0xffffb96d4000, 2101248, PROT_READ|PROT_WRITE) = 0
rt_sigprocmask(SIG_BLOCK, ~[RTMIN RT_1 RT_2], [], 8) = 0
clone(child_stack=0xffffb98d47d0, flags=CLONE_VM|CLONE_FS|CLONE_FILES|CLONE_SIGHAND|CLONE_THREAD|CLONE_SYSVSEM|CLONE_SETTLS|CLONE_PARENT_SETTID|CLONE_CHILD_CLEARTID|0x400000, parent_tid=[5947], tls=0xffffb98d48e0, child_tidptr=0x9b44a8) = 5947
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
futex(0xffffb98d4910, FUTEX_WAKE_PRIVATE, 1) = 1
mmap(NULL, 2109440, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xffffb94cb000
mprotect(0xffffb94cd000, 2101248, PROT_READ|PROT_WRITE) = 0
rt_sigprocmask(SIG_BLOCK, ~[RTMIN RT_1 RT_2], [], 8) = 0
clone(child_stack=0xffffb96cd7d0, flags=CLONE_VM|CLONE_FS|CLONE_FILES|CLONE_SIGHAND|CLONE_THREAD|CLONE_SYSVSEM|CLONE_SETTLS|CLONE_PARENT_SETTID|CLONE_CHILD_CLEARTID|0x400000, parent_tid=[5948], tls=0xffffb96cd8e0, child_tidptr=0x9b44a8) = 5948
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
futex(0xffffb96cd910, FUTEX_WAKE_PRIVATE, 1) = 1
mmap(NULL, 2109440, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xffffb92c4000
mprotect(0xffffb92c6000, 2101248, PROT_READ|PROT_WRITE) = 0
rt_sigprocmask(SIG_BLOCK, ~[RTMIN RT_1 RT_2], [], 8) = 0
clone(child_stack=0xffffb94c67d0, flags=CLONE_VM|CLONE_FS|CLONE_FILES|CLONE_SIGHAND|CLONE_THREAD|CLONE_SYSVSEM|CLONE_SETTLS|CLONE_PARENT_SETTID|CLONE_CHILD_CLEARTID|0x400000, parent_tid=[5949], tls=0xffffb94c68e0, child_tidptr=0x9b44a8) = 5949
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
futex(0xffffb94c6910, FUTEX_WAKE_PRIVATE, 1) = 1
mmap(NULL, 2109440, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xffffb90bd000
mprotect(0xffffb90bf000, 2101248, PROT_READ|PROT_WRITE) = 0
rt_sigprocmask(SIG_BLOCK, ~[RTMIN RT_1 RT_2], [], 8) = 0
clone(child_stack=0xffffb92bf7d0, flags=CLONE_VM|CLONE_FS|CLONE_FILES|CLONE_SIGHAND|CLONE_THREAD|CLONE_SYSVSEM|CLONE_SETTLS|CLONE_PARENT_SETTID|CLONE_CHILD_CLEARTID|0x400000, parent_tid=[5950], tls=0xffffb92bf8e0, child_tidptr=0x9b44a8) = 5950
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
futex(0xffffb92bf910, FUTEX_WAKE_PRIVATE, 1) = 1
mmap(NULL, 2109440, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xffffb8eb6000
mprotect(0xffffb8eb8000, 2101248, PROT_READ|PROT_WRITE) = 0
rt_sigprocmask(SIG_BLOCK, ~[RTMIN RT_1 RT_2], [], 8) = 0
clone(child_stack=0xffffb90b87d0, flags=CLONE_VM|CLONE_FS|CLONE_FILES|CLONE_SIGHAND|CLONE_THREAD|CLONE_SYSVSEM|CLONE_SETTLS|CLONE_PARENT_SETTID|CLONE_CHILD_CLEARTID|0x400000, parent_tid=[5951], tls=0xffffb90b88e0, child_tidptr=0x9b44a8) = 5951
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
futex(0xffffb90b8910, FUTEX_WAKE_PRIVATE, 1) = 1
openat(AT_FDCWD, "/etc/resolv.conf", O_RDONLY|O_LARGEFILE|O_CLOEXEC) = 9
fcntl(9, F_SETFD, FD_CLOEXEC)           = 0
fstat(9, {st_mode=S_IFREG|0644, st_size=16, ...}) = 0
lseek(9, 0, SEEK_CUR)                   = 0
read(9, "# Interface wan\n", 16)        = 16
read(9, "", 32)                         = 0
uname({sysname="Linux", nodename="OpenWrt", ...}) = 0
close(9)                                = 0
openat(AT_FDCWD, "/etc/hosts", O_RDONLY|O_LARGEFILE|O_CLOEXEC) = 9
fcntl(9, F_SETFD, FD_CLOEXEC)           = 0
read(9, "127.0.0.1 localhost\n\n::1     loc"..., 8192) = 110
read(9, "", 8192)                       = 0
close(9)                                = 0
futex(0xffffb90b8910, FUTEX_WAKE_PRIVATE, 1) = 1
brk(0x1e1ea000)                         = 0x1e1ea000
brk(0x1e1fb000)                         = 0x1e1fb000
futex(0xffffb90b8910, FUTEX_WAKE_PRIVATE, 1) = 1
openat(AT_FDCWD, "/dev/net/tun", O_RDWR|O_LARGEFILE) = 12
ioctl(12, TUNSETIFF, 0xfffffeee7f30)    = 0
socket(AF_INET, SOCK_DGRAM, IPPROTO_IP) = 13
ioctl(13, SIOCGIFFLAGS, {ifr_name="tun1", ifr_flags=IFF_UP|IFF_POINTOPOINT|IFF_RUNNING|IFF_NOARP|IFF_MULTICAST}) = 0
ioctl(13, SIOCSIFFLAGS, {ifr_name="tun1", ifr_flags=IFF_UP|IFF_POINTOPOINT|IFF_RUNNING|IFF_NOARP|IFF_MULTICAST}) = 0
fcntl(12, F_GETFL)                      = 0x20002 (flags O_RDWR|O_LARGEFILE)
fcntl(12, F_SETFL, O_RDWR|O_NONBLOCK|O_LARGEFILE) = 0
epoll_ctl(5, EPOLL_CTL_ADD, 12, {events=EPOLLIN|EPOLLOUT|EPOLLRDHUP|EPOLLET, data={u32=1, u64=1}}) = 0
ioctl(13, SIOCGIFADDR, {ifr_name="tun1", ifr_addr={sa_family=AF_INET, sin_port=htons(0), sin_addr=inet_addr("10.255.0.1")}}) = 0
ioctl(13, SIOCGIFNETMASK, {ifr_name="tun1", ifr_netmask={sa_family=AF_INET, sin_port=htons(0), sin_addr=inet_addr("255.255.255.0")}}) = 0
socket(AF_INET, SOCK_STREAM|SOCK_CLOEXEC|SOCK_NONBLOCK, IPPROTO_IP) = 14
setsockopt(14, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
bind(14, {sa_family=AF_INET, sin_port=htons(0), sin_addr=inet_addr("10.255.0.1")}, 16) = 0
listen(14, 1024)                        = 0
epoll_ctl(5, EPOLL_CTL_ADD, 14, {events=EPOLLIN|EPOLLOUT|EPOLLRDHUP|EPOLLET, data={u32=2, u64=2}}) = 0
getsockname(14, {sa_family=AF_INET, sin_port=htons(44551), sin_addr=inet_addr("10.255.0.1")}, [128 => 16]) = 0
futex(0xffffb92bf910, FUTEX_WAKE_PRIVATE, 1) = 1
futex(0xffffb92bf910, FUTEX_WAKE_PRIVATE, 1) = 1
write(4, "\1\0\0\0\0\0\0\0", 8)         = 8
ioctl(13, SIOCGIFMTU, {ifr_name="tun1", ifr_mtu=1500}) = 0
ioctl(13, SIOCGIFADDR, {ifr_name="tun1", ifr_addr={sa_family=AF_INET, sin_port=htons(0), sin_addr=inet_addr("10.255.0.1")}}) = 0
ioctl(13, SIOCGIFNETMASK, {ifr_name="tun1", ifr_netmask={sa_family=AF_INET, sin_port=htons(0), sin_addr=inet_addr("255.255.255.0")}}) = 0
write(2, "2022-01-11T18:52:34.930761772+00"..., 352022-01-11T18:52:34.930761772+00:00) = 35
write(2, " ", 1 )                        = 1
write(2, "\33[0;32m", 7)                = 7
write(2, "INFO", 4INFO)                     = 4
write(2, "\33[0m", 4)                   = 4
write(2, " ", 1 )                        = 1
write(2, " ", 1 )                        = 1
write(2, "shadowsocks tun device ", 23shadowsocks tun device ) = 23
write(2, "tun1", 4tun1)                     = 4
write(2, ", address ", 10, address )              = 10
write(2, "10", 210)                       = 2
write(2, ".", 1.)                        = 1
write(2, "255", 3255)                      = 3
write(2, ".", 1.)                        = 1
write(2, "0", 10)                        = 1
write(2, ".", 1.)                        = 1
write(2, "1", 11)                        = 1
write(2, ", netmask ", 10, netmask )              = 10
write(2, "255", 3255)                      = 3
write(2, ".", 1.)                        = 1
write(2, "255", 3255)                      = 3
write(2, ".", 1.)                        = 1
write(2, "255", 3255)                      = 3
write(2, ".", 1.)                        = 1
write(2, "0", 10)                        = 1
write(2, ", mtu ", 6, mtu )                   = 6
write(2, "1500", 41500)                     = 4
write(2, ", mode ", 7, mode )                  = 7
write(2, "tcp_and_udp", 11tcp_and_udp)             = 11
write(2, "\n", 1
)                       = 1
read(12, "`\0\0\0\0$\0\1\376\200\0\0\0\0\0\0\364\330\275\ne\371@\212\377\2\0\0\0\0\0\0"..., 1500) = 76
read(12, 0x1e1ec120, 1500)              = -1 EAGAIN (Resource temporarily unavailable)
rt_sigaction(SIGTERM, NULL, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0
rt_sigaction(SIGTERM, {sa_handler=0x7a8ea4, sa_mask=[], sa_flags=SA_RESTORER|SA_RESTART|SA_SIGINFO, sa_restorer=0x84000c}, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0
rt_sigaction(SIGINT, NULL, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0
rt_sigaction(SIGINT, {sa_handler=0x7a8ea4, sa_mask=[], sa_flags=SA_RESTORER|SA_RESTART|SA_SIGINFO, sa_restorer=0x84000c}, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0
futex(0xffffb9ae0110, FUTEX_WAIT_PRIVATE, 1, NULL) = 0
read(12, "`\0\0\0\0$\0\1\376\200\0\0\0\0\0\0\364\330\275\ne\371@\212\377\2\0\0\0\0\0\0"..., 1500) = 76
read(12, 0x1e1ec120, 1500)              = -1 EAGAIN (Resource temporarily unavailable)
futex(0xffffb9ae0110, FUTEX_WAIT_PRIVATE, 1, NULL) = 0
read(12, "`\6\36\241\0 \6?\374\0\201\0\0\0\0\0\211J\324\276w\267\325S&\7\370\260@\7\10\27"..., 1500) = 72
getrandom(NULL, 0, GRND_NONBLOCK)       = 0
getrandom("\xbf\x9c\x7c\xbd\xd9\x11\x0d\x59\xab\x2a\x38\x2f\x2a\xbb\xae\xf7\x91\x48\x48\x1d\xb5\x86\x0a\x77\xf5\x42\x6e\x89\xa4\xd3\x09\xdf", 32, 0) = 32
write(2, "thread '", 8thread ')                 = 8
write(2, "main", 4main)                     = 4
write(2, "' panicked at '", 15' panicked at ')         = 15
write(2, "internal error: entered unreacha"..., 66internal error: entered unreachable code: modified saddr not match) = 66
write(2, "', ", 3', )                      = 3
write(2, "/project/crates/shadowsocks-serv"..., 56/project/crates/shadowsocks-service/src/local/tun/mod.rs) = 56
write(2, ":", 1:)                        = 1
write(2, "271", 3271)                      = 3
write(2, ":", 1:)                        = 1
write(2, "26", 226)                       = 2
write(2, "\n", 1
)                       = 1
write(2, "note: run with `RUST_BACKTRACE=1"..., 78note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
) = 78
rt_sigprocmask(SIG_BLOCK, ~[RTMIN RT_1 RT_2], [], 8) = 0
tkill(5945, SIGABRT)                    = 0
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
--- SIGABRT {si_signo=SIGABRT, si_code=SI_TKILL, si_pid=5945, si_uid=0} ---
+++ killed by SIGABRT +++
Aborted

但是我又发现了新的问题,

f4nff commented 2 years ago
image image

启用ipv6之后,sslocal就出现了闪退。

zonyitoo commented 2 years ago

https://github.com/shadowsocks/shadowsocks-rust/blob/379b71a6a9f39e64982524c78bbd1eff3aa99a2c/crates/shadowsocks-service/src/local/tun/mod.rs#L271

It receives a TCP packet with unrecognized src-addr, which was unexpected and should be an error. I could make it an soft error instead of panicking the whole process, but before that I have to reproduce it locally and see what exactly packet was received at that time.

If you can help, please add -vvv to enable verbose log and see what it was received from debug and trace log. Do not use strace because the output would become messy.

f4nff commented 2 years ago
root@OpenWrt:~# strace /root/socks/sslocal --protocol tun -s "[::1]:8188" -m "chacha20-ietf-poly1305
" -k "hello-kitty" --outbound-bind-interface lo --tun-interface-name tun1  -U --udp-timeout 60  --ud
p-max-associations 65535
execve("/root/socks/sslocal", ["/root/socks/sslocal", "--protocol", "tun", "-s", "[::1]:8188", "-m", "chacha20-ietf-poly1305", "-k", "hello-kitty", "--outbound-bind-interface", "lo", "--tun-interface-name", "tun1", "-U", "--udp-timeout", "60", "--udp-max-associations", "65535"], 0xffffeb50e2b8 /* 13 vars */) = 0
mmap(NULL, 1024, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xffffb7102000
set_tid_address(0x9b54a8)               = 11917
ppoll([{fd=0, events=0}, {fd=1, events=0}, {fd=2, events=0}], 3, {tv_sec=0, tv_nsec=0}, NULL, 8) = 0 (Timeout)
rt_sigaction(SIGPIPE, {sa_handler=SIG_IGN, sa_mask=[], sa_flags=SA_RESTORER|SA_RESTART, sa_restorer=0x8405ec}, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0
rt_sigaction(SIGSEGV, NULL, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0
rt_sigprocmask(SIG_UNBLOCK, [RT_1 RT_2], NULL, 8) = 0
rt_sigaction(SIGSEGV, {sa_handler=0x7cd2c4, sa_mask=[], sa_flags=SA_RESTORER|SA_ONSTACK|SA_SIGINFO, sa_restorer=0x8405ec}, NULL, 8) = 0
rt_sigaction(SIGBUS, NULL, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0
rt_sigaction(SIGBUS, {sa_handler=0x7cd2c4, sa_mask=[], sa_flags=SA_RESTORER|SA_ONSTACK|SA_SIGINFO, sa_restorer=0x8405ec}, NULL, 8) = 0
sigaltstack(NULL, {ss_sp=NULL, ss_flags=SS_DISABLE, ss_size=0}) = 0
mmap(NULL, 16384, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS|MAP_STACK, -1, 0) = 0xffffb70fe000
mprotect(0xffffb70fe000, 4096, PROT_NONE) = 0
sigaltstack({ss_sp=0xffffb70ff000, ss_flags=0, ss_size=12288}, NULL) = 0
brk(NULL)                               = 0xff07000
brk(0xff08000)                          = 0xff08000
rt_sigprocmask(SIG_BLOCK, ~[RTMIN RT_1 RT_2], [], 8) = 0
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
getrandom("\x71\x20\x53\xf0\xf0\x6d\x88\x8c\xdc\xaf\x23\xa9\x6d\xea\xe5\x76", 16, GRND_NONBLOCK) = 16
brk(0xff0a000)                          = 0xff0a000
brk(0xff0d000)                          = 0xff0d000
brk(0xff12000)                          = 0xff12000
brk(0xff1c000)                          = 0xff1c000
getcwd("/root", 512)                    = 6
newfstatat(AT_FDCWD, "/root/config.json", 0xffffdbe88d40, 0) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/root/.config/shadowsocks-rust/config.json", 0xffffdbe88d40, 0) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/root/.config/shadowsocks-rust/config.json", 0xffffdbe88d40, 0) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/etc/xdg/shadowsocks-rust/config.json", 0xffffdbe88d40, 0) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/etc/shadowsocks-rust/config.json", 0xffffdbe88d40, 0) = -1 ENOENT (No such file or directory)
ioctl(2, TIOCGWINSZ, {ws_row=34, ws_col=100, ws_xpixel=0, ws_ypixel=0}) = 0
openat(AT_FDCWD, "/etc/localtime", O_RDONLY|O_NONBLOCK|O_LARGEFILE|O_CLOEXEC) = -1 ENOENT (No such file or directory)
write(2, "2022-01-12T07:58:52.514670754+00"..., 352022-01-12T07:58:52.514670754+00:00) = 35
write(2, " ", 1 )                        = 1
write(2, "\33[0;32m", 7)                = 7
write(2, "INFO", 4INFO)                     = 4
write(2, "\33[0m", 4)                   = 4
write(2, " ", 1 )                        = 1
write(2, " ", 1 )                        = 1
write(2, "shadowsocks local ", 18shadowsocks local )      = 18
write(2, "1.12.6", 61.12.6)                   = 6
write(2, " build ", 7 build )                  = 7
write(2, "2022-01-12T06:29:26.341077238+00"..., 352022-01-12T06:29:26.341077238+00:00) = 35
write(2, "\n", 1
)                       = 1
openat(AT_FDCWD, "/proc/self/cgroup", O_RDONLY|O_LARGEFILE|O_CLOEXEC) = 3
fcntl(3, F_SETFD, FD_CLOEXEC)           = 0
read(3, "0::/services/dropbear/instance1\n", 8192) = 32
read(3, "", 8192)                       = 0
close(3)                                = 0
sched_getaffinity(0, 128, [0, 1, 2, 3, 4, 5]) = 32
epoll_create1(EPOLL_CLOEXEC)            = 3
eventfd2(0, EFD_CLOEXEC|EFD_NONBLOCK)   = 4
epoll_ctl(3, EPOLL_CTL_ADD, 4, {events=EPOLLIN|EPOLLRDHUP|EPOLLET, data={u32=2147483648, u64=2147483648}}) = 0
fcntl(3, F_DUPFD_CLOEXEC, 3)            = 5
fcntl(5, F_SETFD, FD_CLOEXEC)           = 0
socketpair(AF_UNIX, SOCK_STREAM|SOCK_CLOEXEC|SOCK_NONBLOCK, 0, [6, 7]) = 0
fcntl(6, F_DUPFD_CLOEXEC, 0)            = 8
fcntl(8, F_SETFD, FD_CLOEXEC)           = 0
epoll_ctl(5, EPOLL_CTL_ADD, 8, {events=EPOLLIN|EPOLLOUT|EPOLLRDHUP|EPOLLET, data={u32=0, u64=0}}) = 0
rt_sigprocmask(SIG_UNBLOCK, [RT_1 RT_2], NULL, 8) = 0
mmap(NULL, 2109440, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xffffb6efb000
mprotect(0xffffb6efd000, 2101248, PROT_READ|PROT_WRITE) = 0
rt_sigprocmask(SIG_BLOCK, ~[RTMIN RT_1 RT_2], [], 8) = 0
clone(child_stack=0xffffb70fd7d0, flags=CLONE_VM|CLONE_FS|CLONE_FILES|CLONE_SIGHAND|CLONE_THREAD|CLONE_SYSVSEM|CLONE_SETTLS|CLONE_PARENT_SETTID|CLONE_CHILD_CLEARTID|0x400000, parent_tid=[11918], tls=0xffffb70fd8e0, child_tidptr=0x9b54a8) = 11918
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
futex(0xffffb70fd910, FUTEX_WAKE_PRIVATE, 1) = 1
mmap(NULL, 2109440, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xffffb6cf4000
mprotect(0xffffb6cf6000, 2101248, PROT_READ|PROT_WRITE) = 0
rt_sigprocmask(SIG_BLOCK, ~[RTMIN RT_1 RT_2], [], 8) = 0
clone(child_stack=0xffffb6ef67d0, flags=CLONE_VM|CLONE_FS|CLONE_FILES|CLONE_SIGHAND|CLONE_THREAD|CLONE_SYSVSEM|CLONE_SETTLS|CLONE_PARENT_SETTID|CLONE_CHILD_CLEARTID|0x400000, parent_tid=[11919], tls=0xffffb6ef68e0, child_tidptr=0x9b54a8) = 11919
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
futex(0xffffb6ef6910, FUTEX_WAKE_PRIVATE, 1) = 1
mmap(NULL, 2109440, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xffffb6aed000
mprotect(0xffffb6aef000, 2101248, PROT_READ|PROT_WRITE) = 0
rt_sigprocmask(SIG_BLOCK, ~[RTMIN RT_1 RT_2], [], 8) = 0
clone(child_stack=0xffffb6cef7d0, flags=CLONE_VM|CLONE_FS|CLONE_FILES|CLONE_SIGHAND|CLONE_THREAD|CLONE_SYSVSEM|CLONE_SETTLS|CLONE_PARENT_SETTID|CLONE_CHILD_CLEARTID|0x400000, parent_tid=[11920], tls=0xffffb6cef8e0, child_tidptr=0x9b54a8) = 11920
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
futex(0xffffb6cef910, FUTEX_WAKE_PRIVATE, 1) = 1
mmap(NULL, 2109440, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xffffb68e6000
mprotect(0xffffb68e8000, 2101248, PROT_READ|PROT_WRITE) = 0
rt_sigprocmask(SIG_BLOCK, ~[RTMIN RT_1 RT_2], [], 8) = 0
clone(child_stack=0xffffb6ae87d0, flags=CLONE_VM|CLONE_FS|CLONE_FILES|CLONE_SIGHAND|CLONE_THREAD|CLONE_SYSVSEM|CLONE_SETTLS|CLONE_PARENT_SETTID|CLONE_CHILD_CLEARTID|0x400000, parent_tid=[11921], tls=0xffffb6ae88e0, child_tidptr=0x9b54a8) = 11921
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
futex(0xffffb6ae8910, FUTEX_WAKE_PRIVATE, 1) = 1
mmap(NULL, 2109440, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xffffb66df000
mprotect(0xffffb66e1000, 2101248, PROT_READ|PROT_WRITE) = 0
rt_sigprocmask(SIG_BLOCK, ~[RTMIN RT_1 RT_2], [], 8) = 0
clone(child_stack=0xffffb68e17d0, flags=CLONE_VM|CLONE_FS|CLONE_FILES|CLONE_SIGHAND|CLONE_THREAD|CLONE_SYSVSEM|CLONE_SETTLS|CLONE_PARENT_SETTID|CLONE_CHILD_CLEARTID|0x400000, parent_tid=[11922], tls=0xffffb68e18e0, child_tidptr=0x9b54a8) = 11922
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
futex(0xffffb68e1910, FUTEX_WAKE_PRIVATE, 1) = 1
mmap(NULL, 2109440, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xffffb64d8000
mprotect(0xffffb64da000, 2101248, PROT_READ|PROT_WRITE) = 0
rt_sigprocmask(SIG_BLOCK, ~[RTMIN RT_1 RT_2], [], 8) = 0
clone(child_stack=0xffffb66da7d0, flags=CLONE_VM|CLONE_FS|CLONE_FILES|CLONE_SIGHAND|CLONE_THREAD|CLONE_SYSVSEM|CLONE_SETTLS|CLONE_PARENT_SETTID|CLONE_CHILD_CLEARTID|0x400000, parent_tid=[11923], tls=0xffffb66da8e0, child_tidptr=0x9b54a8) = 11923
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
futex(0xffffb66da910, FUTEX_WAKE_PRIVATE, 1) = 1
openat(AT_FDCWD, "/etc/resolv.conf", O_RDONLY|O_LARGEFILE|O_CLOEXEC) = 9
fcntl(9, F_SETFD, FD_CLOEXEC)           = 0
fstat(9, {st_mode=S_IFREG|0644, st_size=16, ...}) = 0
lseek(9, 0, SEEK_CUR)                   = 0
read(9, "# Interface wan\n", 16)        = 16
read(9, "", 32)                         = 0
uname({sysname="Linux", nodename="OpenWrt", ...}) = 0
close(9)                                = 0
openat(AT_FDCWD, "/etc/hosts", O_RDONLY|O_LARGEFILE|O_CLOEXEC) = 9
fcntl(9, F_SETFD, FD_CLOEXEC)           = 0
read(9, "127.0.0.1 localhost\n\n::1     loc"..., 8192) = 110
read(9, "", 8192)                       = 0
close(9)                                = 0
futex(0xffffb66da910, FUTEX_WAKE_PRIVATE, 1) = 1
brk(0xff2d000)                          = 0xff2d000
brk(0xff3e000)                          = 0xff3e000
futex(0xffffb66da910, FUTEX_WAKE_PRIVATE, 1) = 1
openat(AT_FDCWD, "/dev/net/tun", O_RDWR|O_LARGEFILE) = 12
ioctl(12, TUNSETIFF, 0xffffdbe88610)    = 0
socket(AF_INET, SOCK_DGRAM, IPPROTO_IP) = 13
ioctl(13, SIOCGIFFLAGS, {ifr_name="tun1", ifr_flags=IFF_POINTOPOINT|IFF_NOARP|IFF_MULTICAST}) = 0
ioctl(13, SIOCSIFFLAGS, {ifr_name="tun1", ifr_flags=IFF_UP|IFF_POINTOPOINT|IFF_RUNNING|IFF_NOARP|IFF_MULTICAST}) = 0
fcntl(12, F_GETFL)                      = 0x20002 (flags O_RDWR|O_LARGEFILE)
fcntl(12, F_SETFL, O_RDWR|O_NONBLOCK|O_LARGEFILE) = 0
epoll_ctl(5, EPOLL_CTL_ADD, 12, {events=EPOLLIN|EPOLLOUT|EPOLLRDHUP|EPOLLET, data={u32=1, u64=1}}) = 0
ioctl(13, SIOCGIFADDR, {ifr_name="tun1", ifr_addr={sa_family=AF_INET, sin_port=htons(0), sin_addr=inet_addr("10.255.0.1")}}) = 0
ioctl(13, SIOCGIFNETMASK, {ifr_name="tun1", ifr_netmask={sa_family=AF_INET, sin_port=htons(0), sin_addr=inet_addr("255.255.255.0")}}) = 0
socket(AF_INET, SOCK_STREAM|SOCK_CLOEXEC|SOCK_NONBLOCK, IPPROTO_IP) = 14
setsockopt(14, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
bind(14, {sa_family=AF_INET, sin_port=htons(0), sin_addr=inet_addr("10.255.0.1")}, 16) = 0
listen(14, 1024)                        = 0
epoll_ctl(5, EPOLL_CTL_ADD, 14, {events=EPOLLIN|EPOLLOUT|EPOLLRDHUP|EPOLLET, data={u32=2, u64=2}}) = 0
getsockname(14, {sa_family=AF_INET, sin_port=htons(38939), sin_addr=inet_addr("10.255.0.1")}, [128 => 16]) = 0
futex(0xffffb66da910, FUTEX_WAKE_PRIVATE, 1) = 1
mmap(NULL, 2101248, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xffffb60cc000
futex(0xffffb66da910, FUTEX_WAKE_PRIVATE, 1) = 1
futex(0xffffb66da910, FUTEX_WAKE_PRIVATE, 1) = 1
ioctl(13, SIOCGIFMTU, {ifr_name="tun1", ifr_mtu=1500}) = 0
ioctl(13, SIOCGIFADDR, {ifr_name="tun1", ifr_addr={sa_family=AF_INET, sin_port=htons(0), sin_addr=inet_addr("10.255.0.1")}}) = 0
ioctl(13, SIOCGIFNETMASK, {ifr_name="tun1", ifr_netmask={sa_family=AF_INET, sin_port=htons(0), sin_addr=inet_addr("255.255.255.0")}}) = 0
write(2, "2022-01-12T07:58:52.536956250+00"..., 352022-01-12T07:58:52.536956250+00:00) = 35
write(2, " ", 1 )                        = 1
write(2, "\33[0;32m", 7)                = 7
write(2, "INFO", 4INFO)                     = 4
write(2, "\33[0m", 4)                   = 4
write(2, " ", 1 )                        = 1
write(2, " ", 1 )                        = 1
write(2, "shadowsocks tun device ", 23shadowsocks tun device ) = 23
write(2, "tun1", 4tun1)                     = 4
write(2, ", address ", 10, address )              = 10
write(2, "10", 210)                       = 2
write(2, ".", 1.)                        = 1
write(2, "255", 3255)                      = 3
write(2, ".", 1.)                        = 1
write(2, "0", 10)                        = 1
write(2, ".", 1.)                        = 1
write(2, "1", 11)                        = 1
write(2, ", netmask ", 10, netmask )              = 10
write(2, "255", 3255)                      = 3
write(2, ".", 1.)                        = 1
write(2, "255", 3255)                      = 3
write(2, ".", 1.)                        = 1
write(2, "255", 3255)                      = 3
write(2, ".", 1.)                        = 1
write(2, "0", 10)                        = 1
write(2, ", mtu ", 6, mtu )                   = 6
write(2, "1500", 41500)                     = 4
write(2, ", mode ", 7, mode )                  = 7
write(2, "tcp_and_udp", 11tcp_and_udp)             = 11
write(2, "\n", 1
)                       = 1
read(12, "`\0\0\0\0$\0\1\376\200\0\0\0\0\0\0\257\177\365_\355\264\304\313\377\2\0\0\0\0\0\0"..., 1500) = 76
read(12, 0xff1ee00, 1500)               = -1 EAGAIN (Resource temporarily unavailable)
rt_sigaction(SIGTERM, NULL, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0
rt_sigaction(SIGTERM, {sa_handler=0x7a9474, sa_mask=[], sa_flags=SA_RESTORER|SA_RESTART|SA_SIGINFO, sa_restorer=0x8405ec}, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0
rt_sigaction(SIGINT, NULL, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0
rt_sigaction(SIGINT, {sa_handler=0x7a9474, sa_mask=[], sa_flags=SA_RESTORER|SA_RESTART|SA_SIGINFO, sa_restorer=0x8405ec}, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0
futex(0xffffb7102110, FUTEX_WAIT_PRIVATE, 1, NULL) = 0
read(12, "`\0\0\0\0$\0\1\376\200\0\0\0\0\0\0\257\177\365_\355\264\304\313\377\2\0\0\0\0\0\0"..., 1500) = 76
read(12, 0xff1ee00, 1500)               = -1 EAGAIN (Resource temporarily unavailable)
futex(0xffffb7102110, FUTEX_WAIT_PRIVATE, 1, NULL) = 0
read(12, "`\0\0\0\0$\0\1\376\200\0\0\0\0\0\0\257\177\365_\355\264\304\313\377\2\0\0\0\0\0\0"..., 1500) = 76
read(12, 0xff1ee00, 1500)               = -1 EAGAIN (Resource temporarily unavailable)
futex(0xffffb7102110, FUTEX_WAIT_PRIVATE, 1, NULL) = 0
read(12, "`\0\0\0\0$\0\1\376\200\0\0\0\0\0\0\257\177\365_\355\264\304\313\377\2\0\0\0\0\0\0"..., 1500) = 76
read(12, 0xff1ee00, 1500)               = -1 EAGAIN (Resource temporarily unavailable)
futex(0xffffb7102110, FUTEX_WAIT_PRIVATE, 1, NULL) = 0
read(12, "E\0\0R~\263@\0?\6:\241\300\250\1dk\26U/\346\234\24f\1\3\364\35-g\346\203"..., 1500) = 82
read(12, 0xff1ee00, 1500)               = -1 EAGAIN (Resource temporarily unavailable)
futex(0xffffb7102110, FUTEX_WAIT_PRIVATE, 1, NULL) = 0
read(12, "`\f\265\274\0\25\6?\374\0\201\0\0\0\0\0\211J\324\276w\267\325S&\7\370\260@#\f\3"..., 1500) = 61
read(12, 0xff1ee00, 1500)               = -1 EAGAIN (Resource temporarily unavailable)
futex(0xffffb7102110, FUTEX_WAIT_PRIVATE, 1, NULL) = 0
read(12, "`\0\0\0\0(:\177\374\0\201\0\0\0\0\0\211J\324\276w\267\325S&\6G\0\0\0\0\0"..., 1500) = 80
read(12, 0xff1ee00, 1500)               = -1 EAGAIN (Resource temporarily unavailable)
futex(0xffffb7102110, FUTEX_WAIT_PRIVATE, 1, NULL) = 0
read(12, "E\0\0L\0\0@\0?\6\327]\300\250\1\366\219\220w\376\303\24g\305N=n\263\362\230q"..., 1500) = 76
read(12, 0xff1ee00, 1500)               = -1 EAGAIN (Resource temporarily unavailable)
futex(0xffffb7102110, FUTEX_WAIT_PRIVATE, 1, NULL) = 0
read(12, "`\0\0\0\0(:\177\374\0\201\0\0\0\0\0\211J\324\276w\267\325S&\6G\0\0\0\0\0"..., 1500) = 80
read(12, 0xff1ee00, 1500)               = -1 EAGAIN (Resource temporarily unavailable)
futex(0xffffb7102110, FUTEX_WAIT_PRIVATE, 1, NULL) = 0
read(12, "`\0\0\0\0(:\177\374\0\201\0\0\0\0\0\211J\324\276w\267\325S&\6G\0\0\0\0\0"..., 1500) = 80
read(12, 0xff1ee00, 1500)               = -1 EAGAIN (Resource temporarily unavailable)
futex(0xffffb7102110, FUTEX_WAIT_PRIVATE, 1, NULL) = 0
read(12, "`\0\0\0\0(:\177\374\0\201\0\0\0\0\0\211J\324\276w\267\325S&\6G\0\0\0\0\0"..., 1500) = 80
read(12, 0xff1ee00, 1500)               = -1 EAGAIN (Resource temporarily unavailable)
futex(0xffffb7102110, FUTEX_WAIT_PRIVATE, 1, NULL) = 0
read(12, "E\0\0)\3568@\0\177\6\2711\300\250\1\201\314O\305\353\226\31\1\273\364\2-$\336\5\27K"..., 1500) = 41
read(12, 0xff1ee00, 1500)               = -1 EAGAIN (Resource temporarily unavailable)
futex(0xffffb7102110, FUTEX_WAIT_PRIVATE, 1, NULL) = 0
read(12, "`\6X\275\0 \6?\374\0\201\0\0\0\0\0\211J\324\276w\267\325S&\6G\0\0\0\0\0"..., 1500) = 72
getrandom(NULL, 0, GRND_NONBLOCK)       = 0
getrandom("\x84\x1d\x60\xd0\x71\xbb\x69\xdb\xab\xec\xa9\x27\x53\x43\x8d\xc2\x5c\xd4\x66\xb7\x5a\xcd\xde\x2f\xeb\x1f\xab\xf2\x9b\x80\xc0\x5c", 32, 0) = 32
write(2, "thread '", 8thread ')                 = 8
write(2, "main", 4main)                     = 4
write(2, "' panicked at '", 15' panicked at ')         = 15
write(2, "internal error: entered unreacha"..., 478internal error: entered unreachable code: modified TCP saddr not match, addr: 10.255.0.9:17046, header: Version6(Ipv6Header { traffic_class: 0, flow_label: 415933, payload_length: 32, next_header: 6, hop_limit: 63, source: [252, 0, 129, 0, 0, 0, 0, 0, 137, 74, 212, 190, 119, 183, 213, 83], destination: [38, 6, 71, 0, 0, 0, 0, 0, 0, 0, 0, 0, 104, 16, 123, 96] }, Ipv6Extensions { hop_by_hop_options: None, destination_options: None, routing: None, fragment: None, auth: None })) = 478
write(2, "', ", 3', )                      = 3
write(2, "/project/crates/shadowsocks-serv"..., 56/project/crates/shadowsocks-service/src/local/tun/mod.rs) = 56
write(2, ":", 1:)                        = 1
write(2, "272", 3272)                      = 3
write(2, ":", 1:)                        = 1
write(2, "25", 225)                       = 2
write(2, "\n", 1
)                       = 1
write(2, "note: run with `RUST_BACKTRACE=1"..., 78note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
) = 78
rt_sigprocmask(SIG_BLOCK, ~[RTMIN RT_1 RT_2], [], 8) = 0
tkill(11917, SIGABRT)                   = 0
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
--- SIGABRT {si_signo=SIGABRT, si_code=SI_TKILL, si_pid=11917, si_uid=0} ---
+++ killed by SIGABRT +++
Aborted

ipv6 还是不行呀,

f4nff commented 2 years ago

/root/socks/sslocal --protocol tun -s "[::1]:8188" -m "chacha20-ietf-poly1305" -k "hello-kitty" --outbound-bind-interface lo --tun-interface-name tun1 -U --udp-timeout 60 --udp-max-associations 65535

r4s openwrt 还是无法执行运行。

zonyitoo commented 2 years ago

--tun-interface-address is not required anymore. IPv6 issue is fixed in the latest commit.

Resource Busy issue couldn't be reproduced.

UDP association memory leak couldn't be reproduced.