You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by "nagaboinaramgopal (via GitHub)" <gi...@apache.org> on 2026/09/01 16:46:53 UTC
[PR] server: null-check public IP before the DNS/Source NAT guard in creat… [cloudstack]
nagaboinaramgopal opened a new pull request, #14027:
URL: https://github.com/apache/cloudstack/pull/14027
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
- [x] Bug fix (non-breaking change which fixes an issue)
### Feature/Enhancement Scale or Bug Severity
#### Bug Severity
- [x] 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.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] server: null-check public IP before the DNS/Source NAT guard in create [cloudstack]
Posted by "DaanHoogland (via GitHub)" <gi...@apache.org>.
DaanHoogland commented on PR #14027:
URL: https://github.com/apache/cloudstack/pull/14027#issuecomment-5568852974
> please ignore my previous approval
>
> * We have never encountered an NPE caused by this line of code.
> * I suggest throwing an exception if the ipVO object is null.
>
> cc @DaanHoogland
@nagaboinaramgopal , can you agree with @weizhouapache , or do you have a scenario where you want to skip checking the network services and continue?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] server: null-check public IP before the DNS/Source NAT guard in create [cloudstack]
Posted by "blueorangutan (via GitHub)" <gi...@apache.org>.
blueorangutan commented on PR #14027:
URL: https://github.com/apache/cloudstack/pull/14027#issuecomment-5575180709
Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ el10 ✔️ debian ✔️ suse15. SL-JID 19141
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] server: null-check public IP before the DNS/Source NAT guard in create [cloudstack]
Posted by "DaanHoogland (via GitHub)" <gi...@apache.org>.
DaanHoogland commented on PR #14027:
URL: https://github.com/apache/cloudstack/pull/14027#issuecomment-5583960782
@blueorangutan test
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] server: null-check public IP before the DNS/Source NAT guard in create [cloudstack]
Posted by "blueorangutan (via GitHub)" <gi...@apache.org>.
blueorangutan commented on PR #14027:
URL: https://github.com/apache/cloudstack/pull/14027#issuecomment-5584712310
<b>[SF] Trillian Build Failed (tid-16925)<b/>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] server: null-check public IP before the DNS/Source NAT guard in create [cloudstack]
Posted by "blueorangutan (via GitHub)" <gi...@apache.org>.
blueorangutan commented on PR #14027:
URL: https://github.com/apache/cloudstack/pull/14027#issuecomment-5574737186
@weizhouapache 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.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] server: null-check public IP before the DNS/Source NAT guard in create [cloudstack]
Posted by "blueorangutan (via GitHub)" <gi...@apache.org>.
blueorangutan commented on PR #14027:
URL: https://github.com/apache/cloudstack/pull/14027#issuecomment-5595699373
<b>[SF] Trillian test result (tid-16929)</b>
Environment: kvm-ol8 (x2), zone: Advanced Networking with Mgmt server ol8
Total time taken: 54582 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr14027-t16929-kvm-ol8.zip
Smoke tests completed. 140 look OK, 1 have errors, 0 did not run
Only failed and skipped tests results shown below:
Test | Result | Time (s) | Test File
--- | --- | --- | ---
test_01_redundant_vpc_site2site_vpn | `Failure` | 469.08 | test_vpc_vpn.py
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] server: null-check public IP before the DNS/Source NAT guard in create [cloudstack]
Posted by "nagaboinaramgopal (via GitHub)" <gi...@apache.org>.
nagaboinaramgopal commented on PR #14027:
URL: https://github.com/apache/cloudstack/pull/14027#issuecomment-5574763767
> > > > please ignore my previous approval
> > > >
> > > > * We have never encountered an NPE caused by this line of code.
> > > > * I suggest throwing an exception if the ipVO object is null.
> > > >
> > > > cc @DaanHoogland
> > >
> > >
> > > @nagaboinaramgopal , can you agree with @weizhouapache , or do you have a scenario where you want to skip checking the network services and continue?
> >
> >
> > Thanks @weizhouapache @DaanHoogland There is a concrete scenario for skipping and continuing: an elastic LB rule, or any call without an `ipAddrId`, on port 53.
> > `ipVO` is only looked up when `ipAddrId != null` (a few lines above), so for elastic LB it is null at this line, and the system IP is assigned just below in the `off.isElasticLb() && ipVO == null` block. On the current line `ipVO.isSourceNat()` therefore throws a raw NPE before we ever reach that assignment.
> > On throwing instead of guarding: the null case is already handled loudly a few lines down, at `if (ipVO == null) throw new InvalidParameterValueException("Unable to create load balance rule; can't find/allocate source IP")`. So a genuinely unresolvable IP already gives the caller a clear error rather than an NPE. Throwing at this earlier line would instead break the elastic LB path, where `ipVO` is expected to be null here and is resolved immediately after.
> > That is why the change only guards the port 53 source-NAT check with `ipVO != null` and leaves the existing validation below to handle the null case. If you would rather it read more explicitly, an alternative is to move this port 53 check to just after that `ipVO == null` validation, so it always runs on a resolved IP and needs no guard. Happy to go either way.
>
> @nagaboinaramgopal I never tested elastic lb. If so, maybe it is better to prevent NPE only, instead of prevent null ipVO. looks ok to me . cc @DaanHoogland
Thanks @weizhouapache . That is exactly what the guard does here: it only prevents the NPE on this line and leaves the existing ipVO == null validation below to reject a genuinely unresolvable IP, so no behaviour change for the null case, just no raw NPE. Appreciate the review.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] server: null-check public IP before the DNS/Source NAT guard in create [cloudstack]
Posted by "weizhouapache (via GitHub)" <gi...@apache.org>.
weizhouapache commented on PR #14027:
URL: https://github.com/apache/cloudstack/pull/14027#issuecomment-5598881302
merging based on approvals
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] server: null-check public IP before the DNS/Source NAT guard in create [cloudstack]
Posted by "blueorangutan (via GitHub)" <gi...@apache.org>.
blueorangutan commented on PR #14027:
URL: https://github.com/apache/cloudstack/pull/14027#issuecomment-5583979050
@DaanHoogland a [SL] Trillian-Jenkins test job (ol8 mgmt + kvm-ol8) has been kicked to run smoke tests
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] server: null-check public IP before the DNS/Source NAT guard in create [cloudstack]
Posted by "weizhouapache (via GitHub)" <gi...@apache.org>.
weizhouapache commented on PR #14027:
URL: https://github.com/apache/cloudstack/pull/14027#issuecomment-5574715869
> > > please ignore my previous approval
> > >
> > > * We have never encountered an NPE caused by this line of code.
> > > * I suggest throwing an exception if the ipVO object is null.
> > >
> > > cc @DaanHoogland
> >
> > @nagaboinaramgopal , can you agree with @weizhouapache , or do you have a scenario where you want to skip checking the network services and continue?
>
> Thanks @weizhouapache @DaanHoogland There is a concrete scenario for skipping and continuing: an elastic LB rule, or any call without an `ipAddrId`, on port 53.
>
> `ipVO` is only looked up when `ipAddrId != null` (a few lines above), so for elastic LB it is null at this line, and the system IP is assigned just below in the `off.isElasticLb() && ipVO == null` block. On the current line `ipVO.isSourceNat()` therefore throws a raw NPE before we ever reach that assignment.
>
> On throwing instead of guarding: the null case is already handled loudly a few lines down, at `if (ipVO == null) throw new InvalidParameterValueException("Unable to create load balance rule; can't find/allocate source IP")`. So a genuinely unresolvable IP already gives the caller a clear error rather than an NPE. Throwing at this earlier line would instead break the elastic LB path, where `ipVO` is expected to be null here and is resolved immediately after.
>
> That is why the change only guards the port 53 source-NAT check with `ipVO != null` and leaves the existing validation below to handle the null case. If you would rather it read more explicitly, an alternative is to move this port 53 check to just after that `ipVO == null` validation, so it always runs on a resolved IP and needs no guard. Happy to go either way.
>
@nagaboinaramgopal
I never tested elastic lb. If so, maybe it is better to prevent NPE only, instead of prevent null ipVO.
looks ok to me . cc @DaanHoogland
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] server: null-check public IP before the DNS/Source NAT guard in create [cloudstack]
Posted by "nagaboinaramgopal (via GitHub)" <gi...@apache.org>.
nagaboinaramgopal commented on PR #14027:
URL: https://github.com/apache/cloudstack/pull/14027#issuecomment-5573699092
> > please ignore my previous approval
> >
> > * We have never encountered an NPE caused by this line of code.
> > * I suggest throwing an exception if the ipVO object is null.
> >
> > cc @DaanHoogland
>
> @nagaboinaramgopal , can you agree with @weizhouapache , or do you have a scenario where you want to skip checking the network services and continue?
Thanks @weizhouapache @DaanHoogland There is a concrete scenario for skipping and continuing: an elastic LB rule, or any call without an `ipAddrId`, on port 53.
`ipVO` is only looked up when `ipAddrId != null` (a few lines above), so for elastic LB it is null at this line, and the system IP is assigned just below in the `off.isElasticLb() && ipVO == null` block. On the current line `ipVO.isSourceNat()` therefore throws a raw NPE before we ever reach that assignment.
On throwing instead of guarding: the null case is already handled loudly a few lines down, at `if (ipVO == null) throw new InvalidParameterValueException("Unable to create load balance rule; can't find/allocate source IP")`. So a genuinely unresolvable IP already gives the caller a clear error rather than an NPE. Throwing at this earlier line would instead break the elastic LB path, where `ipVO` is expected to be null here and is resolved immediately after.
That is why the change only guards the port 53 source-NAT check with `ipVO != null` and leaves the existing validation below to handle the null case. If you would rather it read more explicitly, an alternative is to move this port 53 check to just after that `ipVO == null` validation, so it always runs on a resolved IP and needs no guard. Happy to go either way.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] server: null-check public IP before the DNS/Source NAT guard in creat… [cloudstack]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #14027:
URL: https://github.com/apache/cloudstack/pull/14027#issuecomment-5529718919
This pull request has merge conflicts. Dear author, please fix the conflicts and sync your branch with the base branch.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] server: null-check public IP before the DNS/Source NAT guard in create [cloudstack]
Posted by "weizhouapache (via GitHub)" <gi...@apache.org>.
weizhouapache commented on PR #14027:
URL: https://github.com/apache/cloudstack/pull/14027#issuecomment-5574723331
@blueorangutan package
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] server: null-check public IP before the DNS/Source NAT guard in create [cloudstack]
Posted by "weizhouapache (via GitHub)" <gi...@apache.org>.
weizhouapache commented on PR #14027:
URL: https://github.com/apache/cloudstack/pull/14027#issuecomment-5566724382
please ignore my previous approval
- We have never encountered an NPE caused by this line of code.
- I suggest throwing an exception if the ipVO object is null.
cc @DaanHoogland
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] server: null-check public IP before the DNS/Source NAT guard in creat… [cloudstack]
Posted by "blueorangutan (via GitHub)" <gi...@apache.org>.
blueorangutan commented on PR #14027:
URL: https://github.com/apache/cloudstack/pull/14027#issuecomment-5531564810
Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ el10 ✖️ debian ✔️ suse15. SL-JID 19096
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] server: null-check public IP before the DNS/Source NAT guard in create [cloudstack]
Posted by "weizhouapache (via GitHub)" <gi...@apache.org>.
weizhouapache merged PR #14027:
URL: https://github.com/apache/cloudstack/pull/14027
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] server: null-check public IP before the DNS/Source NAT guard in creat… [cloudstack]
Posted by "blueorangutan (via GitHub)" <gi...@apache.org>.
blueorangutan commented on PR #14027:
URL: https://github.com/apache/cloudstack/pull/14027#issuecomment-5530617142
@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.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] server: null-check public IP before the DNS/Source NAT guard in creat… [cloudstack]
Posted by "DaanHoogland (via GitHub)" <gi...@apache.org>.
DaanHoogland commented on PR #14027:
URL: https://github.com/apache/cloudstack/pull/14027#issuecomment-5530603694
@blueorangutan package
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] server: null-check public IP before the DNS/Source NAT guard in create [cloudstack]
Posted by "codecov[bot] (via GitHub)" <gi...@apache.org>.
codecov[bot] commented on PR #14027:
URL: https://github.com/apache/cloudstack/pull/14027#issuecomment-5584042492
## [Codecov](https://app.codecov.io/gh/apache/cloudstack/pull/14027?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
:white_check_mark: All modified and coverable lines are covered by tests.
:white_check_mark: Project coverage is 4.14%. Comparing base ([`3a79799`](https://app.codecov.io/gh/apache/cloudstack/commit/3a797993f3a117940c23d821af533b7b726c6b8b?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)) to head ([`bac2cd6`](https://app.codecov.io/gh/apache/cloudstack/commit/bac2cd69152838501385e8573a6591b736b004ca?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
:warning: Report is 1 commits behind head on 4.20.
> :exclamation: There is a different number of reports uploaded between BASE (3a79799) and HEAD (bac2cd6). Click for more details.
>
> <details><summary>HEAD has 1 upload less than BASE</summary>
>
>| Flag | BASE (3a79799) | HEAD (bac2cd6) |
>|------|------|------|
>|unittests|1|0|
></details>
<details><summary>Additional details and impacted files</summary>
```diff
@@ Coverage Diff @@
## 4.20 #14027 +/- ##
=============================================
- Coverage 16.34% 4.14% -12.21%
=============================================
Files 5669 405 -5264
Lines 501405 33069 -468336
Branches 60907 5903 -55004
=============================================
- Hits 81975 1370 -80605
+ Misses 410246 31523 -378723
+ Partials 9184 176 -9008
```
| [Flag](https://app.codecov.io/gh/apache/cloudstack/pull/14027/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | |
|---|---|---|
| [uitests](https://app.codecov.io/gh/apache/cloudstack/pull/14027/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `4.14% <ø> (ø)` | |
| [unittests](https://app.codecov.io/gh/apache/cloudstack/pull/14027/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#carryforward-flags-in-the-pull-request-comment) to find out more.
</details>
[:umbrella: View full report in Codecov by Harness](https://app.codecov.io/gh/apache/cloudstack/pull/14027?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
:loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
<details><summary> :rocket: New features to boost your workflow: </summary>
- :snowflake: [Test Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests, report on failures, and find test suite problems.
- :package: [JS Bundle Analysis](https://docs.codecov.com/docs/javascript-bundle-analysis): Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org