Skip to content

optimize(mtu): Set lowest MTU among bound interfaces to dae0/dae0peer #827

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

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

jschwinger233
Copy link
Member

Background

0.5 -> 0.6 引入 dae0 有个被忽视的变化——mtu 可能被缩小了,因为 dae0/dae0peer mtu 被硬编码为 1500. 这可能导致了 #509.

考虑 0.5 的 lan 劫持流量场景,假如 lan interface mtu 是 9000,那么被劫持流量的 tcp 握手协商 mss 为 9000 (9000-tcphdr-iphdr, 不要在意细节),最终能有 9000 大包到达 lan;但是 0.6 由于 dae0peer mtu 1500,导致握手 mss 协商为 1500,最终 tcp 会拆成小包抵达 lan。这不仅导致性能有所下降,而且触发了 tls 嗅探的 bug (#555).

这个 pr 尝试修复这种现象,让 dae0/dae0peer mtu 设置到 min(lan_interfaces..., wan_interfaces...) ,这样保底 1500,但允许 >1500 的 mtu。

理论上 wan 代理不受 dae0/dae0peer mtu 影响,因为有 gso。

扩大 mtu 是一件容易崩坏的事情,多测测再合并。

Checklist

Full Changelogs

  • [Implement ...]

Issue Reference

Closes #509

Test Result

@jschwinger233 jschwinger233 requested a review from a team as a code owner May 29, 2025 09:26
@jschwinger233 jschwinger233 marked this pull request as draft May 29, 2025 09:52
@jschwinger233
Copy link
Member Author

要做 newlinkCallback 动态更新 mtu 😟 先 draft 之后再改

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[更新]升级到0.6.0rc1版本后无法代理
1 participant