Skip to content

SS2022 proxy: Correct interrupt behavior and UDP conn change - #7143

Merged
RPRX merged 2 commits into
mainfrom
ss2022
Oct 14, 2026
Merged

RPRX merged 2 commits into
mainfrom
ss2022

Conversation

@Fangliding

Copy link
Copy Markdown
Member

忘了加defer interrupt了 还有名字和其他协议同步了一下
顺便还有之前关于UDP转发的一行改动我记得改了不知道最后为啥没P上来 可能关机的时候忘记保存了

@ChownYourLife

Copy link
Copy Markdown
Contributor

My name is not in the commit!

@ChownYourLife

Copy link
Copy Markdown
Contributor

pls make it co-authored

@Fangliding
Fangliding force-pushed the ss2022 branch 2 times, most recently from a589bb4 to f29e8c8 Compare October 14, 2026 07:28
@svlavr

svlavr commented Oct 14, 2026

Copy link
Copy Markdown
Contributor

When the SessionID changes on the same UDP socket, link still belongs to the first session. EnsureLink is skipped for the new session, and UpdateConn calls s.timer.Update() with a nil timer, causing a panic.

I'd call EnsureLink for the current packet's session; it already reuses that session's link. A timer != nil check would only hide the panic—the packet would still go through the first session's link.

@svlavr

svlavr commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

For example, a client closes its UDP socket and opens a new one with the same source IP:port but a new SessionID. The server's udpWorker finds the existing udpConn by the source endpoint and continues the same processUDP loop. So one processUDP invocation cannot be assumed to always correspond to one SS2022 SessionID.

SIP022 §3.2.4 requires servers to route packets by client SessionID rather than source address. An existing session can continue from a different source endpoint, while the same IP:port can later be reused by a new session.

@Fangliding

Copy link
Copy Markdown
Member Author

Yes, I accidentally mistook it for a socket with only one session. when I want to optimize too much func call before

@RPRX RPRX changed the title SS2022: Correct interrupt behavior and UDP conn change SS2022 proxy: Correct interrupt behavior and UDP conn change Oct 14, 2026
@RPRX
RPRX merged commit 0888beb into main Oct 14, 2026
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.

4 participants