Skip to content

[fix]: Chunked cloud firewall rules of only 1 addr type result in empty rule and failed updates - #620

Merged
AshleyDumaine merged 3 commits into
linode:mainfrom
wbh1:fix/firewall-empty-address-rule
Sep 1, 2026
Merged

[fix]: Chunked cloud firewall rules of only 1 addr type result in empty rule and failed updates#620
AshleyDumaine merged 3 commits into
linode:mainfrom
wbh1:fix/firewall-empty-address-rule

Conversation

@wbh1

@wbh1 wbh1 commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

General:

  • Have you removed all sensitive information, including but not limited to access keys and passwords?
  • Have you checked to ensure there aren't other open or closed Pull Requests for the same bug/feature/question?

Pull Request Guidelines:

  1. Does your submission pass tests?
  2. Have you added tests?
  3. Are you addressing a single feature in this PR?
  4. Are your commits atomic, addressing one change per commit?
  5. Are you following the conventions of the language?
  6. Have you saved your large formatting changes for a different PR, so we can focus on your work?
  7. Have you explained your rationale for why this feature is needed?
  8. Have you linked your PR to an open issue

Description

tl;dr — if you have a large firewall that exceeds the 255 address limit and kicks in the chunking logic, if that large firewall rule contains only 1 address type (i.e. all IPv4 or all IPv6) then the CCM still tries to add an empty rule for the address type.

This does the dumb, simple thing of just checking the length of the rules for each addr type before chunking them.

Example with a big rule of only IPv4 addrs:

 I0831 16:54:33.298782   37901 firewalls.go:305] Firewall label 'ACCEPT-platform-components-gateway-istio' is too long. Stripping to
 'ACCEPT-platform-components-gatew'
 inbound rules: 3
 rule 0: IPv4=255 IPv6=0
 rule 1: IPv4=9 IPv6=0
 rule 2: IPv4=0 IPv6=0

@github-actions github-actions Bot added the bugfix for any bug fixes in the changelog. label Aug 31, 2026
@wbh1
wbh1 temporarily deployed to prod-external August 31, 2026 21:21 — with GitHub Actions Inactive
@wbh1
wbh1 temporarily deployed to prod-external August 31, 2026 21:21 — with GitHub Actions Inactive
@codecov

codecov Bot commented Aug 31, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 75.91%. Comparing base (602a9e1) to head (615d382).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #620      +/-   ##
==========================================
+ Coverage   75.89%   75.91%   +0.01%     
==========================================
  Files          18       18              
  Lines        2809     2811       +2     
==========================================
+ Hits         2132     2134       +2     
  Misses        464      464              
  Partials      213      213              

☔ 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.

@AshleyDumaine

Copy link
Copy Markdown
Contributor

This does the dumb, simple thing of just checking the length of the rules for each addr type before chunking them.

While this change works, I'm thinking we'll want to fix chunkIPs to actually return nil if the length of the ips is zero instead of just adding the checks here. WDYT?

wbh1 added 2 commits September 1, 2026 09:12
processACL created an empty inbound rule for the IP family with no
addresses when the other family exceeded maxIPsPerFirewall, because
chunkIPs returns a single chunk for an empty slice. Only chunk and
emit rules for a family that actually has addresses.
Strengthen TestProcessACLNoEmptyRuleForMissingFamily to assert the exact
expected grouping for 256 addresses (two inbound rules with chunk sizes
255 and 1) instead of only checking for absent empty-address rules.

Convert the test to table-driven form and add a symmetric IPv6-only
case so the IPv4-empty guard in processACL is directly exercised, not
just the IPv6-empty guard covered by the IPv4-only case.
@wbh1
wbh1 force-pushed the fix/firewall-empty-address-rule branch from e467f35 to 9135a64 Compare September 1, 2026 13:12
@wbh1

wbh1 commented Sep 1, 2026

Copy link
Copy Markdown
Contributor Author

While this change works, I'm thinking we'll want to fix chunkIPs to actually return nil if the length of the ips is zero instead of just adding the checks here. WDYT?

Good point — I switched the approach so that chunkIPs will return nil when called using an empty slice as the arg to the function.

@AshleyDumaine
AshleyDumaine merged commit ee0c593 into linode:main Sep 1, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugfix for any bug fixes in the changelog.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants