Skip to content

null-check public IP before the DNS/Source NAT guard in create - #14027

Open
nagaboinaramgopal wants to merge 1 commit into
apache:4.20from
nagaboinaramgopal:fix/lb-dns-port-npe
Open

null-check public IP before the DNS/Source NAT guard in create#14027
nagaboinaramgopal wants to merge 1 commit into
apache:4.20from
nagaboinaramgopal:fix/lb-dns-port-npe

Conversation

@nagaboinaramgopal

Copy link
Copy Markdown

Description

Description

createPublicLoadBalancerRule guards a special case for the DNS port before it
has resolved the public IP:

if (srcPortStart == DNS_PORT && ipVO.isSourceNat()) {

When the caller does not pass an explicit IP (ipAddrId is null), ipVO is null
at this point, so creating a load balancer rule on the DNS port throws a
NullPointerException instead of the normal validation error. Fixed by
null-checking ipVO before calling isSourceNat(), so the DNS/Source NAT branch
is skipped when there is no IP and the flow reaches the intended parameter
validation.

Types of changes

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

Feature/Enhancement Scale or Bug Severity

Bug Severity

  • Minor

How Has This Been Tested?

Added a unit test that creates a public load balancer rule on the DNS port with
no explicit IP and asserts it fails with a parameter validation error instead of
a NullPointerException. Also built the standard packages and deployed on a KVM
advanced zone.

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

clgtm

…ePublicLoadBalancerRule

createPublicLoadBalancerRule resolved ipVO only when an ipAddrId was supplied,
then at the port-53 check did (srcPortStart == DNS_PORT && ipVO.isSourceNat()).
For an elastic-LB rule created without an explicit IP (ipAddrId == null) the
system IP is allocated later, so ipVO was still null and creating a rule on
port 53 threw a NullPointerException. The ipVO == null validation only runs
further down.

Guard the check with ipVO != null so the DNS/Source NAT conflict test is
skipped when there is no IP yet; the flow then reaches the existing
can't-find-source-IP parameter error.

Adds a regression test creating a port-53 rule with a null ipAddrId
(NullPointerException before the fix).
@github-actions

github-actions Bot commented Sep 3, 2026

Copy link
Copy Markdown

This pull request has merge conflicts. Dear author, please fix the conflicts and sync your branch with the base branch.

@nagaboinaramgopal
nagaboinaramgopal changed the base branch from main to 4.20 September 3, 2026 17:53
@DaanHoogland

Copy link
Copy Markdown
Contributor

@blueorangutan package

@blueorangutan

Copy link
Copy Markdown

@DaanHoogland a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress.

@blueorangutan

Copy link
Copy Markdown

Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ el10 ✖️ debian ✔️ suse15. SL-JID 19096

@DaanHoogland DaanHoogland changed the title server: null-check public IP before the DNS/Source NAT guard in creat… null-check public IP before the DNS/Source NAT guard in create Sep 4, 2026
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.

4 participants