Skip to content

SNMP: Improve parsing of OIDs containing IP addresses#2419

Open
rousskov wants to merge 1 commit into
squid-cache:masterfrom
measurement-factory:SQUID-111-SNMP-oid-address-size
Open

SNMP: Improve parsing of OIDs containing IP addresses#2419
rousskov wants to merge 1 commit into
squid-cache:masterfrom
measurement-factory:SQUID-111-SNMP-oid-address-size

Conversation

@rousskov
Copy link
Copy Markdown
Contributor

Broken since 2007 commit cc192b5 made a false "4 or 16" assumption,
possibly influenced by bad assumptions in earlier client_Inst() code.

Also improved const-correctness to get fixed oid2addr() code to compile.

Broken since 2007 commit cc192b5 made a false "4 or 16" assumption,
possibly influenced by bad assumptions in earlier client_Inst() code.

Also improved const-correctness to get fixed oid2addr() code to compile.
Comment thread src/snmp_core.cc
if ( size == sizeof(struct in_addr) )
cp = (u_char *) &(i4addr.s_addr);
else
else if ( size == sizeof(struct in6_addr) )
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It would be better to use i6addr variable instead of guessing its type inside sizeof(), but that would break symmetry with the above IPv4 code unless we introduce more out-of-scope polishing changes.

I also duplicated odd if line formatting to keep IPv4 and IPv6 code as similar as possible without introducing even more changes.

@rousskov rousskov added the S-could-use-an-approval An approval may speed this PR merger (but is not required) label May 11, 2026
@yadij yadij added M-cleared-for-merge https://github.com/measurement-factory/anubis#pull-request-labels backport-to-v7 maintainer has approved these changes for v7 backporting and removed S-could-use-an-approval An approval may speed this PR merger (but is not required) labels May 13, 2026
squid-anubis pushed a commit that referenced this pull request May 13, 2026
Broken since 2007 commit cc192b5 made a false "4 or 16" assumption,
possibly influenced by bad assumptions in earlier client_Inst() code.

Also improved const-correctness to get fixed oid2addr() code to compile.
@squid-anubis squid-anubis added the M-waiting-staging-checks https://github.com/measurement-factory/anubis#pull-request-labels label May 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport-to-v7 maintainer has approved these changes for v7 backporting M-cleared-for-merge https://github.com/measurement-factory/anubis#pull-request-labels M-waiting-staging-checks https://github.com/measurement-factory/anubis#pull-request-labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants