forked from puppetlabs/puppetlabs-stdlib
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(MODULES-3980) Fix ipv4 regex validator
This also updates all ipv4 tests to use the same test data for better comparability. Closes puppetlabs#676, puppetlabs#679 Fix-Originally-By: Nate Potter <nathaniel.potter@intel.com>
- Loading branch information
Showing
6 changed files
with
62 additions
and
52 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
module SharedData | ||
IPV4_PATTERNS = [ | ||
'0.0.0.0', | ||
'1.2.3.4', | ||
'10.10.10.10', | ||
'127.0.0.1', | ||
'192.88.99.0', | ||
'194.232.104.150', | ||
'224.0.0.0', | ||
'244.24.24.24', | ||
'255.255.255.255', | ||
'8.8.8.8', | ||
'8.8.8.8/0', | ||
'8.8.8.8/16', | ||
'8.8.8.8/255.255.0.0', | ||
'8.8.8.8/32', | ||
] | ||
IPV4_NEGATIVE_PATTERNS = [ | ||
'', | ||
'0.0.0.0.0', | ||
'0.0.0.256', | ||
'0.0.0', | ||
'1.2.3.4.5', | ||
'1.2.3', | ||
'10.010.10.10', | ||
'2001:0db8:85a3:0000:0000:8a2e:0370:73342001:0db8:85a3:0000:0000:8a2e:0370:7334', | ||
'4.4.4', | ||
'77', | ||
'9999.9999.9999.9999', | ||
'affe::beef', | ||
'nope', | ||
] | ||
end |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
# Emulate the validate_ipv4_address and is_ipv4_address functions | ||
type Stdlib::Compat::Ipv4 = Pattern[/^(\d+)\.(\d+)\.(\d+)\.(\d+)$/] | ||
type Stdlib::Compat::Ipv4 = Pattern[/^((([0-9](?!\d)|[1-9][0-9](?!\d)|1[0-9]{2}(?!\d)|2[0-4][0-9](?!\d)|25[0-5](?!\d))[.]?){4})(\/((([0-9](?!\d)|[1-9][0-9](?!\d)|1[0-9]{2}(?!\d)|2[0-4][0-9](?!\d)|25[0-5](?!\d))[.]?){4}|[0-9]+))?$/] |