Conversation
Windows GetNameInfo() appends the zone/scope identifier (e.g. "%6") to link-local IPv6 addresses (fe80::/10) in their string form, because sin6_scope_id is the interface index for link-local addresses (per Microsoft docs: "fe80::208:74ff:feda:625c%5"). ModSecurity's IP-match parser rejects addresses containing a zone suffix, causing "IPmatch: bad IPv6 specification" and rule processing failures (e.g. id=905110) for clients connecting from link-local IPv6. Strip the "%<zone>" suffix from the textual IP passed to ModSecurity in GetIpAddr(). The binary address (sin6_addr) used for the actual socket is unaffected, and the zone id is irrelevant for IP matching.
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Advanced Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
There was a problem hiding this comment.
🟢 Approval recommended
The reviewed change addresses the stated parsing issue without unresolved blocking concerns.
Pull request overview
Fixes IIS IPv6 link-local client IP parsing by removing Windows zone identifiers before ModSecurity matching.
Changes:
- Adds
string.hforstrchr. - Strips
%zonesuffixes from IPv6 address strings.
File summaries
| File | Description |
|---|---|
iis/mymodule.cpp |
Normalizes IPv6 client IP strings before ModSecurity processing. |
Review details
- Files reviewed: 1/1 changed files
- Comments generated: 0
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.



Summary
Windows GetNameInfo() appends the zone/scope identifier (e.g. "%6") to
link-local IPv6 addresses (fe80::/10) in their string form, because
sin6_scope_id is the interface index for link-local addresses.
ModSecurity's IP-match parser rejects addresses containing a zone suffix,
causing "IPmatch: bad IPv6 specification" and rule processing failures
(e.g. id=905110) for clients connecting from link-local IPv6.
Root cause
iis/mymodule.cpp — GetIpAddr() builds the client IP string consumed as
REMOTE_ADDR / client_ip. The "%" suffix makes the address
unparseable by ModSecurity's IP matcher.
Fix
Strip the "%" suffix from the textual IP in GetIpAddr() for
AF_INET6. The binary address (sin6_addr) carried by CopySockAddr() is
unaffected, and the zone id is irrelevant for IP matching. Added
#include <string.h> for strchr().
Fixes #3630