Skip to content

Fix search response port preservation for name-server (gateway) replies#3781

Merged
kasemir merged 1 commit intoControlSystemStudio:masterfrom
george-mcintyre:fix/pva-search-response-port
Apr 15, 2026
Merged

Fix search response port preservation for name-server (gateway) replies#3781
kasemir merged 1 commit intoControlSystemStudio:masterfrom
george-mcintyre:fix/pva-search-response-port

Conversation

@george-mcintyre
Copy link
Copy Markdown
Contributor

Problem

When a name server / gateway returns a search response containing 0.0.0.0:port, the SearchResponseHandler (TCP path) replaced both the IP address and the port with the remote address of the TCP connection. This correctly resolved the wildcard IP, but silently discarded the server's advertised port.

In a gateway scenario where the name server listens on port 5175 (plain PVA) but the actual data server listens on TLS port 5075, the response arrived with 0.0.0.0:5075. After the replacement, the client connected to port 5175 (the name server's port) instead of 5075 (the data server's TLS port), causing the connection to fail or land on the wrong service.

The UDP handler already handled this case correctly by only replacing the IP when the address is a wildcard, leaving the port untouched.

Fix

Align the TCP search response handler with the UDP handler: when the response address is a wildcard (0.0.0.0 / ::), substitute only the IP portion from the remote connection address; preserve the port from the search response.

Files Changed

  • core/pva/src/main/java/org/epics/pva/client/SearchResponseHandler.java

@sonarqubecloud
Copy link
Copy Markdown

@kasemir kasemir merged commit 4758e68 into ControlSystemStudio:master Apr 15, 2026
2 of 3 checks passed
@george-mcintyre george-mcintyre deleted the fix/pva-search-response-port branch April 16, 2026 00:12
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