Skip to content

udp_proxy: populate upstream host and address info for access logs#45583

Open
IssaAbuKalbein wants to merge 1 commit into
envoyproxy:mainfrom
IssaAbuKalbein:udp-tunneling-attempted-hosts
Open

udp_proxy: populate upstream host and address info for access logs#45583
IssaAbuKalbein wants to merge 1 commit into
envoyproxy:mainfrom
IssaAbuKalbein:udp-tunneling-attempted-hosts

Conversation

@IssaAbuKalbein

Copy link
Copy Markdown
Contributor

Commit Message: udp_proxy: populate upstream host and address info for access logs

Additional Description:
The UDP proxy did not populate all upstream information on the session StreamInfo that access loggers expect, so several %UPSTREAM_*% access log formatters were always empty for UDP sessions, unlike TCP proxy. This PR fixes two distinct gaps:

  1. Non-tunneling UDP → UDP path (UDP listeners not logging upstream information #44153): the upstream local and remote addresses were never set, so %UPSTREAM_LOCAL_ADDRESS% and %UPSTREAM_REMOTE_ADDRESS% (and their _WITHOUT_PORT / port variants) were always empty. The remote address is now recorded when the upstream host is selected in createUpstream(), and the local address once the socket is bound after the first datagram is sent upstream in writeUpstream().

  2. Tunneling (UDP-over-HTTP) path: the attempted-upstream-host tracking added in formatter: add access log formatters for tracking upstream hosts and connection IDs attempted #43215 (HTTP router, TCP proxy and the non-tunneling UDP path) was not wired into TunnelingConnectionPoolImpl, so %UPSTREAM_HOSTS_ATTEMPTED% / %UPSTREAM_HOST_NAMES_ATTEMPTED_WITHOUT_PORT% were always empty for tunneled sessions even though %UPSTREAM_HOST% was populated. addUpstreamHostAttempted() is now called alongside setUpstreamHost() on both pool ready and pool failure.

Risk Level: Low (only adds population of existing StreamInfo upstream fields; no behavior change to the data path).
Testing: Added unit tests in udp_proxy_filter_test covering both paths (UdpProxyFilterTest.UpstreamAddressAccessLog, and upstreamHostsAttempted() assertions in TunnelingConnectionPoolImplTest.PoolReady / PoolFailure).
Docs Changes: N/A
Release Notes: Added (two changelogs/current/bug_fixes entries).
Fixes #44153

@IssaAbuKalbein IssaAbuKalbein force-pushed the udp-tunneling-attempted-hosts branch 2 times, most recently from b41cb0e to bda303b Compare June 12, 2026 08:20
The UDP proxy did not populate all upstream information on the session
StreamInfo that access loggers expect, so several %UPSTREAM_*% access log
formatters were always empty for UDP sessions, unlike TCP proxy. This change
fixes two distinct gaps:

1. Non-tunneling UDP -> UDP path (envoyproxy#44153): the upstream local and remote
   addresses were never set, so %UPSTREAM_LOCAL_ADDRESS% and
   %UPSTREAM_REMOTE_ADDRESS% (and their _WITHOUT_PORT / port variants) were
   always empty. The remote address is now recorded when the upstream host is
   selected in createUpstream(), and the local address once the socket is bound
   after the first datagram is sent upstream in writeUpstream().

2. Tunneling (UDP-over-HTTP) path: the attempted-upstream-host tracking added
   in envoyproxy#43215 (HTTP router, TCP proxy and the non-tunneling UDP path) was not
   wired into TunnelingConnectionPoolImpl, so %UPSTREAM_HOSTS_ATTEMPTED% /
   %UPSTREAM_HOST_NAMES_ATTEMPTED_WITHOUT_PORT% were always empty for tunneled
   sessions even though %UPSTREAM_HOST% was populated. addUpstreamHostAttempted()
   is now called alongside setUpstreamHost() on both pool ready and pool failure.

Adds unit test coverage for both paths in udp_proxy_filter_test.

Fixes envoyproxy#44153.
Follow-up to envoyproxy#43215.

Signed-off-by: Issa Abu Kalbein <iabukalbein@microsoft.com>
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.

UDP listeners not logging upstream information

1 participant