Skip to content

Conversation

A13501350
Copy link

what

  • Replacing the WSAAddressToString and manual string parsing approach with the GetNameInfo function for IP address retrieval.
  • Adding proper support for both IPv4 and IPv6 address families in the CopySockAddr function.

why

The original implementation incorrectly assumed all addresses were IPv4, causing failures when processing IPv6 connections.

references

…tionality

Refactor the `GetIpAddr` function to use `GetNameInfo` for IP address retrieval, enhancing IPv6 compatibility.
Optimize the `CopySockAddr` function to correctly handle IPv4 and IPv6 addresses and port information.
(Implementation based on mujiansu's work in issue owasp-modsecurity#1988)
Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
C Maintainability Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

@airween
Copy link
Member

airween commented Sep 24, 2025

Hi @A13501350,

thanks for this PR.

Unfortunately SonarCloud found some errors. I reviewed them and seems like those are not critical and easy to fix them. Could you take a look at them? See the SonarCloud check line or this link.

@A13501350
Copy link
Author

Yeah. The fixes themselves are straightforward, but implementing them would introduce changes that differ from the existing code in terms of features and style.

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