Skip to content

fix: allow fragmentation for inbound UDP replies - #2161

Open
pengwk wants to merge 1 commit into
shadowsocks:masterfrom
pengwk:fix/inbound-udp-fragmentation
Open

fix: allow fragmentation for inbound UDP replies#2161
pengwk wants to merge 1 commit into
shadowsocks:masterfrom
pengwk:fix/inbound-udp-fragmentation

Conversation

@pengwk

@pengwk pengwk commented Jul 26, 2026

Copy link
Copy Markdown

Summary

  • honor the existing outbound_udp_allow_fragmentation option on inbound UDP listener sockets
  • propagate global and per-server settings, including manager mode
  • preserve the current default and cover Unix and Windows
  • add a Linux regression test for IP_MTU_DISCOVER

Problem

The UDP relay sends encrypted responses back to clients through its inbound listener socket. That socket always enabled DF, even when outbound_udp_allow_fragmentation was set. A near-MTU target response can grow after encryption and then fail with EMSGSIZE on the client-facing send path.

This change reuses the existing option instead of adding another configuration knob, making it apply to both UDP relay directions.

Verification

  • Linux: cargo test -p shadowsocks --test udp --no-default-features --features aead-cipher-2022 (4 passed)
  • Linux: cargo check -p shadowsocks-service --no-default-features --features server,aead-cipher-2022
  • Real relay path: a 1472-byte UDP response failed before the change and passed 10/10 after it with fragmentation enabled

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant