Froxlor
Froxlor copied to clipboard
Add validation for special IP 0.0.0.0 and 0.0.0.0/0.0.0.0 + test
Description
IP validation sorts out any "reserved" IP. That's a good thing because we do not want e.g. to DHCP bind to broadcasts IPs. But there are some special cases that are filtered out by FILTER_FLAG_NO_RES_RANGE:
- Using 0.0.0.0 in "Ports and IPs" to create a Port listening on any IP
- Using 0.0.0.0/0.0.0.0 e.g. for MySQL to allow access to any IP
(Personally, I have only use case 1 but since It's quite similar, I added the other too).
Type of change
Please delete options that are not relevant.
- [ ] Bug fix (non-breaking change which fixes an issue)
- [X] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
- [ ] This change requires a documentation update
How Has This Been Tested?
I have manually tested that creating a port with IP 0.0.0.0 works as expected. I have added Tests into ValidationTests for both use cases.
Checklist:
- [x] I have performed a self-review of my own code
- [x] I have commented my code, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation -> No idea where to document it exactly, it's just a minor fix/enhancement
- [?] My changes generate no new warnings -> How to test?
- [x] I have added tests that prove my fix is effective or that my feature works
- [X] New and existing unit tests pass locally with my changes
Edit: Here's my travis error: https://travis-ci.org/micw/Froxlor/requests?requestId=190174624 But it should build now on travis automatically due to merge request
Codecov Report
Merging #760 into master will increase coverage by
<.01%. The diff coverage is100%.
@@ Coverage Diff @@
## master #760 +/- ##
============================================
+ Coverage 32.73% 32.74% +<.01%
- Complexity 5610 5613 +3
============================================
Files 107 107
Lines 15484 15486 +2
============================================
+ Hits 5069 5071 +2
Misses 10415 10415
| Impacted Files | Coverage Δ | Complexity Δ | |
|---|---|---|---|
| lib/Froxlor/Validate/Validate.php | 96.07% <100%> (+0.07%) |
60 <0> (+3) |
:arrow_up: |
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact),ø = not affected,? = missing dataPowered by Codecov. Last update 35ecdfa...044a6aa. Read the comment docs.
Allowing 0.0.0.0 as ip for domains will surely break DNS...