Skip to content

server: skip IPv4 member CIDR for IPv6-only security group members - #14325

Open
wido wants to merge 1 commit into
apache:4.20from
wido:sg-skip-ipv6-only-member-null-ipv4
Open

wido wants to merge 1 commit into
apache:4.20from
wido:sg-skip-ipv6-only-member-null-ipv4

Conversation

@wido

@wido wido commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

Description

Found while reviewing #14037. When a security group rule references another security group, both SecurityGroupManagerImpl and SecurityGroupManagerImpl2 append /32 to the member's IPv4 address without checking it. For a member with an IPv6-only NIC this produces the CIDR null/32.

The KVM agent drops the invalid entry while parsing, but the management server should not generate it. Skip the IPv4 entry when the member has no IPv4 address.

Based on 4.20 on top of #14037.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)

Feature/Enhancement Scale or Bug Severity

Bug Severity

  • Trivial

How Has This Been Tested?

Unit tests for both implementations with an IPv6-only member, added to SecurityGroupManagerImplTest together with the two tests from #14037. They pass with the fix and fail without it.

@codecov

codecov Bot commented Oct 7, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 16.41%. Comparing base (376c1b4) to head (93879d0).

Additional details and impacted files
@@             Coverage Diff              @@
##               4.20   #14325      +/-   ##
============================================
- Coverage     16.41%   16.41%   -0.01%     
+ Complexity    13657    13656       -1     
============================================
  Files          5669     5669              
  Lines        501628   501627       -1     
  Branches      60942    60944       +2     
============================================
- Hits          82336    82320      -16     
- Misses       410064   410081      +17     
+ Partials       9228     9226       -2     
Flag Coverage Δ
uitests 4.16% <ø> (ø)
unittests 17.27% <100.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@wido
wido requested a review from DaanHoogland October 7, 2026 05:57
@wido

wido commented Oct 7, 2026

Copy link
Copy Markdown
Contributor Author

@DaanHoogland can you review? Small follow-up to #14037.

@weizhouapache

Copy link
Copy Markdown
Member

#14037 has been just merged into 4.20.
Could you rebase this with 4.20 too ? @wido

@wido
wido force-pushed the sg-skip-ipv6-only-member-null-ipv4 branch from 9620a88 to 75c502f Compare October 7, 2026 06:52
@wido
wido changed the base branch from main to 4.20 October 7, 2026 06:52
@wido

wido commented Oct 7, 2026

Copy link
Copy Markdown
Contributor Author

#14037 has been just merged into 4.20. Could you rebase this with 4.20 too ? @wido

Done! I thought this one was better for main, but 4.20 is fine with me as well

@weizhouapache

Copy link
Copy Markdown
Member

#14037 has been just merged into 4.20. Could you rebase this with 4.20 too ? @wido

Done! I thought this one was better for main, but 4.20 is fine with me as well

thanks @wido

I just noticed #14037 added two new test classes, any chance to move the new tests in #14037 and this PR into existing SecurityGroupManagerImplTest.java and SecurityGroupManagerImpl2Test.java ?

@weizhouapache weizhouapache left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

code lgtm

@DaanHoogland DaanHoogland left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

code looks good, but agree with the move of the tests @weizhouapache proposes

When a security group rule references another security group, the
member's IPv4 address is appended with /32 without checking whether the
member has one. An IPv6-only member therefore produces the CIDR
"null/32" in the generated ruleset.

Only add the IPv4 entry when the member has an IPv4 address, in both
SecurityGroupManagerImpl and SecurityGroupManagerImpl2.

The tests for this and for the /128 member CIDR from apache#14037 now live in
SecurityGroupManagerImplTest instead of four standalone test classes.

Found while reviewing apache#14037.
@wido
wido force-pushed the sg-skip-ipv6-only-member-null-ipv4 branch from 75c502f to 93879d0 Compare October 7, 2026 09:30
@wido

wido commented Oct 7, 2026

Copy link
Copy Markdown
Contributor Author

@weizhouapache done, all four tests are now in SecurityGroupManagerImplTest and the four standalone classes are gone. I did not use SecurityGroupManagerImpl2Test because it needs a live MySQL and is excluded in server/pom.xml, so tests in there never run. SecurityGroupManagerImplTest covers both implementations.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants