Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] unable to send packets on OpenWRT #254

Closed
2 tasks done
flakeforever opened this issue May 15, 2023 · 22 comments
Closed
2 tasks done

[Bug] unable to send packets on OpenWRT #254

flakeforever opened this issue May 15, 2023 · 22 comments
Labels
bug Something isn't working

Comments

@flakeforever
Copy link

Verify steps

  • Is this something you can debug and fix? Send a pull request! Bug fixes and documentation fixes are welcome.
  • I have searched on the issue tracker for a related issue.

Version

2.5.0

What OS are you seeing the problem on?

Other

Description

I have been using 2.4.1 before, and it worked well on my OpenWRT(21.02.3). So when I updated to 2.5.0, in the same environment, I didn't change anything, I just replaced the file, then the tun device only has TX data but no RX data.

So even though I have set the log at debug level, it has no more output.

2.4.1
2 4 1

2.5.0
2 5 0

I have briefly looked at the code, but it seems a bit complex to me. I would like to know where should I start if I want to investigate this issue myself.

Thank you, if someone could reply to me.

CLI or Config

No response

Logs

No response

How to Reproduce

No response

@flakeforever flakeforever changed the title [Bug] unable to send packets OpenWRT [Bug] unable to send packets on OpenWRT May 15, 2023
@xjasonlyu
Copy link
Owner

That's weird, v2.5.0 doesn't change anything on the tun side. Can you share your detailed configuration?

@flakeforever
Copy link
Author

Alright, thank you.

My config:
/usr/sbin/tun2socks -device tun://tun0 -proxy socks5://10.8.0.7:1080 -loglevel debug

That's all, perhaps the issue lies in some default parameters?

@xjasonlyu
Copy link
Owner

How about your route tables?

@flakeforever
Copy link
Author

flakeforever commented May 15, 2023

Here is:

ip rule add fwmark 100 lookup 100
ip route add default dev tun0 table 100
iptables -t mangle -A PREROUTING -s 192.168.10.128/26 -m set --match-set office-ip dst -j MARK --set-mark 100

So, the office-ip is an ip-set

@myloft
Copy link
Contributor

myloft commented May 17, 2023

I had the same problem on an ARMv7 OpenWRT device.

@xjasonlyu xjasonlyu added the bug Something isn't working label May 17, 2023
@Kot-nikot
Copy link

Also release 2.5.0 does not work on OpenWRT 22.03 mipsel architecture. Installed 2.4.1 works.

@xjasonlyu
Copy link
Owner

Wondering how should I debug this as I don’t have arm-based openwrt devices. ;-)

@myloft
Copy link
Contributor

myloft commented May 24, 2023

From my test, the backend proxy server has received the request and returned the data. I will test on an x86 openwrt device to confirm whether it is related to the architecture.

@myloft
Copy link
Contributor

myloft commented May 24, 2023

From my test, the backend proxy server has received the request and returned the data. I will test on an x86 openwrt device to confirm whether it is related to the architecture.

It works fine on an x86 openwrt device.

@Kot-nikot
Copy link

Kot-nikot commented May 25, 2023

Интересно, как мне отладить это, поскольку у меня нет устройств openwrt на базе рук. ;-)

does not work for me on ramips/mt7621 mipsle.

@xjasonlyu
Copy link
Owner

This issue should be fixed by 46c04db, welcome to try!

@flakeforever
Copy link
Author

flakeforever commented May 26, 2023

Hey bro, thank you for your work.

I compiled an exe and conducted tests. From the debug logs, I can see that it is able to parse some TCP protocols, but it still doesn't work correctly (it shows TCP connections, but cannot transmit data correctly).
test

I also did some tests today, and when I rolled back the version of golang.zx2c4.com/wireguard/tun to v0.0.0-20220318042302-193cf8d6a5d6 and edited tun_wireguard.go, it started working properly. I guess it might be an issue with this component?

These are my results, and I also hope that others can test it.

@xjasonlyu
Copy link
Owner

xjasonlyu commented May 26, 2023

Yes, it is related to the wireguard tun module. I have tested on linux and macos, and it works well. But I have not yet tested on Windows.

Theoretically, if it shows TCP connections, it should be fine.. But taking from your screenshot, it seems like you tested on a linux-based platform, then why would you compile an exe for it?

@flakeforever
Copy link
Author

Oh I mean it's an executable file, not .exe. :)
It does show some TCP connections initially, but I believe it might be blocking the threads, causing the data not to be transmitted correctly. When I forcefully shut it down, I can see some information.

DEBU[0123] [TCP] copy data for origin->remote: read tcp 142.251.220.110:443: operation aborted
DEBU[0123] [TCP] copy data for origin->remote: read tcp 104.244.42.193:443: operation aborted
DEBU[0123] [TCP] copy data for origin->remote: read tcp 13.251.235.250:443: operation aborted

@xjasonlyu
Copy link
Owner

Oh yes, these log messages are expected during shutdown stage.

@flakeforever
Copy link
Author

flakeforever commented May 26, 2023

After its initialization, it parsed some TCP connections, but these connections didn't finish. It wasn't until I forcibly terminated it.

INFO[0001] [TCP] 192.168.88.107:52626 <-> 142.251.220.110:443
INFO[0002] [TCP] 192.168.88.107:52629 <-> 104.244.42.193:443
INFO[0002] [TCP] 192.168.88.107:52630 <-> 104.244.42.193:443
INFO[0002] [TCP] 192.168.88.107:52631 <-> 104.244.42.193:443
INFO[0003] [TCP] 192.168.88.107:52637 <-> 13.251.235.250:443
INFO[0004] [TCP] 192.168.88.107:52638 <-> 104.244.42.2:443
INFO[0004] [TCP] 192.168.88.107:52639 <-> 104.244.42.2:443
INFO[0004] [TCP] 192.168.88.107:52640 <-> 104.244.42.2:443

DEBU[0123] [TCP] copy data for origin->remote: read tcp 142.251.220.110:443: operation aborted
DEBU[0123] [TCP] copy data for origin->remote: read tcp 104.244.42.193:443: operation aborted
DEBU[0123] [TCP] copy data for origin->remote: read tcp 13.251.235.250:443: operation aborted

@Kot-nikot
Copy link

I compiled the latest version of the package with yesterday's fixes for my linux mipsel platform:
tun2socks: ELF 32-bit LSB executable, MIPS, MIPS32 version 1 (SYSV), statically linked, Go BuildID=_a2qvyNQr2TsGApgkrYc/1HslD8tYyut90xLuuCH9/vs0I8gAVkClGIJVehn2Z/H_Sei_m7q3M2hukzwEWL, with debug_info, not stripped.

What do we have about the result:
The problem with data transfer is not solved. Some of the data passes through the tunnel and some does not.

INFO[0003] [TCP] 172.16.250.1:41708 <-> 157.240.205.34:443
INFO[0003] [TCP] 172.16.250.1:40764 <-> 157.240.205.63:443
INFO[0003] [TCP] 172.16.250.1:43832 <-> 31.13.65.50:80
DEBU[0075] [TCP] copy data for origin->remote: read tcp 31.13.65.50:80->172.16.250.1:43832: i/o timeout
DEBU[0130] [TCP] copy data for origin->remote: read tcp 157.240.205.63:443->172.16.250.1:40764: i/o timeout
DEBU[0333] [TCP] copy data for origin->remote: read tcp 157.240.205.34:443: operation timed out
DEBU[0393] [TCP] copy data for remote->origin: read tcp 100.81.8.82:38240->141.148.224.141:1234: i/o timeout

Accordingly, resources in the network are not available.

@netrixken
Copy link

can confirm, latest source code still has the issue (mt7621)

@xjasonlyu
Copy link
Owner

OK, I'll check it again.

xjasonlyu added a commit that referenced this issue May 30, 2023
Signed-off-by: xjasonlyu <xjasonlyu@gmail.com>
@xjasonlyu
Copy link
Owner

xjasonlyu commented May 30, 2023

Can anyone confirm this fix: 44ad654?

@Kot-nikot
Copy link

Checked. Everything seems to be working at first glance. I will continue to test. Thank you for your hard work.

@flakeforever
Copy link
Author

Okay, cool bro! I confirm that this issue has been resolved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants