server: null-check public IP before the DNS/Source NAT guard in creat… - #14027
Open
nagaboinaramgopal wants to merge 1 commit into
Open
server: null-check public IP before the DNS/Source NAT guard in creat…#14027nagaboinaramgopal wants to merge 1 commit into
nagaboinaramgopal wants to merge 1 commit into
Conversation
…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).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Description
createPublicLoadBalancerRuleguards a special case for the DNS port before ithas resolved the public IP:
When the caller does not pass an explicit IP (
ipAddrIdis null),ipVOis nullat 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
ipVObefore callingisSourceNat(), so the DNS/Source NAT branchis skipped when there is no IP and the flow reaches the intended parameter
validation.
Types of changes
Feature/Enhancement Scale or Bug Severity
Bug Severity
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.