Skip to content

Conversation

@nddq
Copy link
Member

@nddq nddq commented Nov 4, 2025

This patch fixes the operator precedence compilation warning when evaluating whether a packet is a SYN-ACK. This fix then introduced a stack size too large error, in which this patch also fixed by passing ct_keys by pointers instead of value to the helper functions.

Description

Please provide a brief description of the changes made in this pull request.

Related Issue

If this pull request is related to any issue, please mention it here. Additionally, make sure that the issue is assigned to you before submitting this pull request.

Checklist

  • I have read the contributing documentation.
  • I signed and signed-off the commits (git commit -S -s ...). See this documentation on signing commits.
  • I have correctly attributed the author(s) of the code.
  • I have tested the changes locally.
  • I have followed the project's style guidelines.
  • I have updated the documentation, if necessary.
  • I have added tests, if applicable.

Screenshots (if applicable) or Testing Completed

Please add any relevant screenshots or GIFs to showcase the changes made.

Additional Notes

Add any additional notes or context about the pull request here.


Please refer to the CONTRIBUTING.md file for more information on how to contribute to this project.

error

This patch fixes the operator precedence compilation warning when
evaluating whether a packet is a SYN-ACK. This fix then introduced a
stack size too large error, in which this patch also fixed by passing
ct_keys by pointers instead of value to the help functions.

Signed-off-by: Quang Nguyen <[email protected]>
@nddq nddq requested a review from a team as a code owner November 4, 2025 21:17
@nddq nddq requested review from matmerr and rbtr November 4, 2025 21:17
Copy link
Member

@timraymond timraymond left a comment

Choose a reason for hiding this comment

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

All of the swapping of values -> pointers look fine to me (I assume the conditionals are NPE guards demanded by the verifier). Just one question left.

// We have a SYN, we set `is_reply` to false and we provide `key`
return _ct_create_new_tcp_connection(p, key, observation_point, false);
} else if(tcp_handshake == TCP_SYN|TCP_ACK) {
} else if(tcp_handshake == (TCP_SYN|TCP_ACK)) {
Copy link
Member

Choose a reason for hiding this comment

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

Just want to call out what I think is the actual operator precedence problem. My guess is that previously this was being evaluated like (tcp_handshake == TCP_SYN) | TCP_ACK which is obviously wrong written that way, but less so given the way it was written previously. The proposed change should correct it to asserting that the handshake is a SYNACK, correct @nddq ?

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.

3 participants