Repository navigation
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fix incorrect destination metadata in traces of statelessly forwarded requests, including end-to-end ACKs for INVITE 200 OK responses.
Details
When a request arrives over connection A and is forwarded over connection B,
trace_slreq_out()currently passes the incoming tracing context directly totrace_msg_out().That context carries connection A's ID. When resolving the outgoing trace destination,
trace_msg_out()uses that connection's peer address, causing the trace to identify the caller instead of the callee.This affects tracing metadata only. The SIP request reaches the correct destination.
Solution
Copy the tracing context onto the stack and select the outgoing connection ID before generating the trace:
last_outgoing_tcp_id.The copy preserves the original context. The transport check matches the condition used by
msg_send()to reset the outgoing connection ID, avoiding stale TCP IDs for non-TCP transports such as SCTP.Validated with a real OpenSIPS build and loopback SIP peers, using a TCP caller and TCP/TLS callees:
The callee received the ACK in every case. Stateful BYE traces in dialog mode remained correct. The revised module compiled and linked successfully.
Testing was performed on Linux ARM64. UDP, WS/WSS and SCTP callees, NAT, PROXY protocol, and AMD64 were not exercised. Transport correlation was not independently verified from HEP chunks.
Compatibility
No configuration migration is required. SIP forwarding, trace instance selection, and caller/callee filtering are unchanged.
The change corrects outgoing trace destination and connection attribution while preserving the original tracing context.
Closing issues
Closes #4477