optimize(mtu): Set lowest MTU among bound interfaces to dae0/dae0peer #827
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Issue Reference
Closes #509
Test Result