xjasonlyu / tun2socks

tun2socks - powered by gVisor TCP/IP stack
https://github.com/xjasonlyu/tun2socks/wiki
GNU General Public License v3.0
3.14k stars 433 forks source link

[Feature] multi-cast filter #129

Closed solaris111 closed 2 years ago

solaris111 commented 2 years ago

Description

非常感谢!这个工具确实很有用。我搭了个试验环境,测试在IPV6环境下UDP报文的转发。测试发现,在tun接口up时会有大量的udp 组播报文(估计是windows 发现之类用途的)。这些报文对danted造成了严重干扰,在danted无法转发的情况下,这个工具会直接 发fin/ack。我估计您是出于性能考虑,所以没有过滤掉这些,如果可能还是过滤下比较好。PS,IPV6下UDP透传我只发现了这个工具和proxycap可以用,sstap、clash、go-tun2socks之流全挂了,代码里面bug太多。clash可能直接用的go-tun2socks甚至连udp associate协议都没搞明白。ps,yaml文件咋编写?

Is this feature related to a specific bug?

No response

Do you have a specific solution in mind?

No response

solaris111 commented 2 years ago

echo 的日志,当有组播报文时就不转发了: time="2022-05-14T09:18:24+08:00" level=info msg="[UDP] [fe80::d1dd:75eb:981b:aab1]:8000 --> [fc11::12]:7" time="2022-05-14T09:18:24+08:00" level=info msg="[UDP] [fe80::d1dd:75eb:981b:aab1]:8000 --> [fc11::12]:7" time="2022-05-14T09:18:24+08:00" level=info msg="[UDP] [fe80::d1dd:75eb:981b:aab1]:8000 <-- [fc11::12]:7" time="2022-05-14T09:18:24+08:00" level=info msg="[UDP] [fe80::d1dd:75eb:981b:aab1]:8000 <-- [fc11::12]:7" time="2022-05-14T09:18:24+08:00" level=info msg="[UDP] 169.254.32.230:5353 --> 224.0.0.251:5353" time="2022-05-14T09:18:24+08:00" level=info msg="[UDP] 169.254.32.230:5353 --> 224.0.0.251:5353" time="2022-05-14T09:18:24+08:00" level=info msg="[UDP] 169.254.32.230:5353 --> 224.0.0.251:5353" time="2022-05-14T09:18:24+08:00" level=info msg="[UDP] 169.254.32.230:5353 --> 224.0.0.251:5353" time="2022-05-14T09:18:24+08:00" level=info msg="[UDP] [fe80::e4d5:ee3a:e633:a2dd]:5353 --> [ff02::fb]:5353" time="2022-05-14T09:18:24+08:00" level=info msg="[UDP] 169.254.32.230:5353 --> 224.0.0.251:5353" time="2022-05-14T09:18:24+08:00" level=info msg="[UDP] [fe80::e4d5:ee3a:e633:a2dd]:5353 --> [ff02::fb]:5353" time="2022-05-14T09:18:24+08:00" level=info msg="[UDP] [fe80::e4d5:ee3a:e633:a2dd]:57064 --> [ff02::1:3]:5355" time="2022-05-14T09:18:24+08:00" level=info msg="[UDP] 169.254.32.230:5353 --> 224.0.0.251:5353" time="2022-05-14T09:18:24+08:00" level=info msg="[UDP] [fe80::e4d5:ee3a:e633:a2dd]:5353 --> [ff02::fb]:5353" time="2022-05-14T09:18:24+08:00" level=info msg="[UDP] 169.254.32.230:57064 --> 224.0.0.252:5355" time="2022-05-14T09:18:24+08:00" level=info msg="[UDP] 169.254.32.230:5353 --> 224.0.0.251:5353" time="2022-05-14T09:18:24+08:00" level=info msg="[UDP] [fe80::e4d5:ee3a:e633:a2dd]:5353 --> [ff02::fb]:5353" time="2022-05-14T09:18:24+08:00" level=info msg="[UDP] [fe80::e4d5:ee3a:e633:a2dd]:5353 --> [ff02::fb]:5353" time="2022-05-14T09:18:24+08:00" level=info msg="[UDP] [fe80::e4d5:ee3a:e633:a2dd]:5353 --> [ff02::fb]:5353" time="2022-05-14T09:18:24+08:00" level=info msg="[UDP] [fe80::e4d5:ee3a:e633:a2dd]:5353 --> [ff02::fb]:5353" time="2022-05-14T09:18:25+08:00" level=info msg="[UDP] [fe80::e4d5:ee3a:e633:a2dd]:8000 --> [fc11::12]:7" time="2022-05-14T09:18:25+08:00" level=info msg="[UDP] [fe80::e4d5:ee3a:e633:a2dd]:8000 <-- [fc11::12]:7"

solaris111 commented 2 years ago

用户程序提示连接断开

xjasonlyu commented 2 years ago

你是指的这个问题吗 https://github.com/xjasonlyu/tun2socks/issues/93

solaris111 commented 2 years ago

看了#93,但不仅仅是这样。启动我需要做实验的UDP流量后,当有新的组播报文发出后实验UDP流会中断,应用程序提示找不到资源。抓包的话,会看到在新的组播报文到达前,有主动发出的Fin报文,这可能意味着老的组播报文的TCP控制连接断开了。我想试试wintun的其他版本,但找不到资源

xjasonlyu commented 2 years ago

我没理解,UDP怎么发FIN?

arm64v8a commented 2 years ago

V2ray 也存在此类问题,socks 入站遇到组播报文会产生很多错误日志。所以希望在这里过滤一下。

https://github.com/arm64v8a/tun2socks/commit/1bc34964a1bfba13646b4b8f19495b1be37a5cce 写了一个选项,丢弃非 GlobalUnicast 地址的 UDP 包

如有需要,可开启 PR

xjasonlyu commented 2 years ago

V2ray 也存在此类问题,socks 入站遇到组播报文会产生很多错误日志。所以希望在这里过滤一下。

arm64v8a@1bc3496 写了一个选项,丢弃非 GlobalUnicast 地址的 UDP 包

如有需要,可开启 PR

多加一个这个选项似乎不错,但我觉得可以直接在core/udp里就把包丢了,比在tunnel里丢包更直接方便一点。

随时欢迎PR😁

github-actions[bot] commented 2 years ago

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days