Skip to content

Expose the UDP peer address through socket.opened - #8825

Merged
krplata merged 1 commit into
mainfrom
krystian/udp-ingress-remote-address
Nov 24, 2026
Merged

krplata merged 1 commit into
mainfrom
krystian/udp-ingress-remote-address

Conversation

@krplata

@krplata krplata commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

When request metadata includes a client address, pass it to the UDP socket so the connect() handler can read the peer IP and port from (await socket.opened).remoteAddress.

@krplata krplata self-assigned this Nov 23, 2026
@krplata
krplata requested review from a team as code owners November 23, 2026 11:41
@github-actions

github-actions Bot commented Nov 23, 2026 •

Copy link
Copy Markdown

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@krplata

krplata commented Nov 23, 2026

Copy link
Copy Markdown
Contributor Author

I have read the CLA Document and I hereby sign the CLA

@clanky-the-clanker clanky-the-clanker Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Superseded by the review of 5e8e2b40.

This review, of 54841749

💬 Approved with comments — The change is correct and tested. The only comment is an optional SUGGESTION about documenting that clientAddress is read once.

Findings: 1 suggestion (1 is an inline comment on the diff)

The decision is advisory: this review is a comment and never approves, blocks or requests changes on the pull request.


📋 Code Quality: 💬 1 suggestion

The change is correct and has an end-to-end test; one optional design suggestion.

Recommendation: 💬 Optional Nits

  • [SUGGESTION] clientAddress is a public, mutable field that every reader moves out of (src/workerd/io/io-context.h:148)
View full review

The client address now lives on IncomingRequest and reaches both the TCP connect() path and the UDP socket.opened.remoteAddress. The new constructor parameter defaults to kj::none, so existing callers still compile. The Rust listener passes peer.to_string(), which has the same ip:port format as the TCP path.

There is one optional suggestion: clientAddress is a public mutable field that each reader moves out of, so a second reader would get none.


✅ All other checks passed

📝 Documentation: ✅ LGTM

No documentation issues found.


Reviewed commit: 54841749

Comment thread src/workerd/io/io-context.h Resolved
github-actions Bot added a commit that referenced this pull request Nov 23, 2026
@krplata
krplata force-pushed the krystian/udp-ingress-remote-address branch 2 times, most recently from 70f055a to 5e8e2b4 Compare November 23, 2026 12:04

@clanky-the-clanker clanky-the-clanker Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Superseded by the review of 1f851d95.

This review, of 5e8e2b40

✅ Approved — The change is correct and tested, and the one suggestion from the last review is resolved; no new issues found.

The decision is advisory: this review is a comment and never approves, blocks or requests changes on the pull request.


✅ All checks passed

📋 Code Quality: ✅ LGTM

The client address goes from WorkerEntrypoint into IncomingRequest, and the TCP and UDP connect paths each move it out once. The member declaration order matches the initializer list. The Rust listener's address format matches the TCP path, and the new test asserts the exact peer address. The earlier note about the consumed field is resolved by the new comment on clientAddress.


📝 Documentation: ✅ LGTM

No documentation issues found.


Reviewed commit: 5e8e2b40

When request metadata includes a client address, pass it to the UDP
socket so the connect() handler can read the peer IP and port from
(await socket.opened).remoteAddress.
@krplata
krplata force-pushed the krystian/udp-ingress-remote-address branch from 5e8e2b4 to 1f851d9 Compare November 24, 2026 09:32

@clanky-the-clanker clanky-the-clanker Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Approved — The change is correct and has a test that checks the exact peer address. No issues were found, and nothing has changed since the last approved review.

The decision is advisory: this review is a comment and never approves, blocks or requests changes on the pull request.


✅ All checks passed

🔒 Security: ✅ LGTM

No security issues found.


📋 Code Quality: ✅ LGTM

  • Address handoff: clientAddress goes from WorkerEntrypoint into IncomingRequest. The TCP connect path and the UDP path each move it out exactly once.
  • connectUdp signature: the change is applied in the header, the implementation and the only caller.
  • Member order: the order of members in IncomingRequest matches the initializer list.
  • UDP listener: udp.rs passes peer.to_string() as the client address.
  • Test: the new test asserts the exact peer address.

📝 Documentation: ✅ LGTM

No documentation issues found.


Reviewed commit: 1f851d95

@krplata
krplata merged commit 0a41136 into main Nov 24, 2026
36 of 38 checks passed
@krplata
krplata deleted the krystian/udp-ingress-remote-address branch November 24, 2026 10:21
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.

2 participants