Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Value Range for IPv6 CIDRs #1235

Merged
merged 1 commit into from
Jun 30, 2017
Merged

Fix Value Range for IPv6 CIDRs #1235

merged 1 commit into from
Jun 30, 2017

Conversation

DavidTPate
Copy link
Contributor

Fix how we handle CIDRs for IPv6 so that we are allowing up to 128 for the CIDR.

Fixes #1232

@DavidTPate DavidTPate added the bug Bug or defect label Jun 30, 2017
@DavidTPate DavidTPate self-assigned this Jun 30, 2017
@@ -29,12 +41,14 @@ internals.Ip.createIpRegex = function (versions, cidr) {
for (let i = 0; i < versions.length; ++i) {
const version = versions[i];
if (!regex) {
regex = '^(?:' + internals.Ip.versions[version];
regex = '^(?:' + internals.Ip.versions[version] + internals.Ip.cidrs[version][cidr];
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caught a bug here where it was creating an incorrectly large RegExp by appending to the string twice for each version supported. It's not really much of a performance gain for the validation phase, but does provide us with some gains in the compilation phase of the RegExp.

@DavidTPate DavidTPate changed the title Fix Value Range for IPv6 Fix Value Range for IPv6 CIDRs Jun 30, 2017
@Marsup Marsup added this to the 11.0.0 milestone Jun 30, 2017
@DavidTPate DavidTPate merged commit 80c3d24 into hapijs:master Jun 30, 2017
@DavidTPate DavidTPate deleted the issue-1232 branch June 30, 2017 19:13
@lock
Copy link

lock bot commented Jan 9, 2020

This thread has been automatically locked due to inactivity. Please open a new issue for related bugs or questions following the new issue template instructions.

@lock lock bot locked as resolved and limited conversation to collaborators Jan 9, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Bug or defect
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ipv6 string with mask between 33 and 128 are rejected.
2 participants