Skip to content

Fix check for globally routable IPv4 address #24343

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

Merged
merged 1 commit into from
Apr 15, 2015
Merged

Fix check for globally routable IPv4 address #24343

merged 1 commit into from
Apr 15, 2015

Conversation

achanda
Copy link
Contributor

@achanda achanda commented Apr 12, 2015

  • Adds two more functions for broadcast address and special
    address classes reserved for documentation
  • Modifies the globally routable IP check to include these
    new functions

Fixes #24314

@rust-highfive
Copy link
Contributor

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @alexcrichton (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. The way Github handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

Please see CONTRIBUTING.md for more information.

@alexcrichton
Copy link
Member

Thanks! Could you add some tests for these as well?

@alexcrichton
Copy link
Member

That'll work, but it's more conventional to put unit tests at the end of the module itself, so feel free to add something like this to the end of the module:

#[cfg(test)]
mod tests {
    #[test]
    fn foo() { /* ... */ }
}

@achanda
Copy link
Contributor Author

achanda commented Apr 13, 2015

@alexcrichton sorry, I deleted my earlier comment by mistake. I found existing tests for ip.rs in src/libstd/net/addr.rs, which looks like a wrong place for those tests. I think I will do this, add tests for the new methods in addr.rs and the move related tests to ip.rs in a separate commit. That way we do not clutter this commit. Let me know if this sounds good to you.

@alexcrichton
Copy link
Member

Sounds great to me, thanks for the drive-by cleanup!

- Adds two more functions for broadcast address and special
  address classes reserved for documentation
- Modifies the globally routable IP check to include these
  new functions

Fixes #24314
@achanda
Copy link
Contributor Author

achanda commented Apr 13, 2015

@alexcrichton this passes tests on my local machine. Please check.

@alexcrichton
Copy link
Member

@bors: r+ f60f4b7

Thanks!

@achanda
Copy link
Contributor Author

achanda commented Apr 14, 2015

@alexcrichton How will this PR be merged? I did not see any job being run for this PR in buildbot. Do I need to do something else? Sorry, still new here :)

@alexcrichton
Copy link
Member

Ah right, this is now in the queue and when it reaches the top @bors will comment that it's being tested. After that @bors will comment with the test results afterwards.

@achanda
Copy link
Contributor Author

achanda commented Apr 14, 2015

👍

alexcrichton added a commit to alexcrichton/rust that referenced this pull request Apr 14, 2015
- Adds two more functions for broadcast address and special
  address classes reserved for documentation
- Modifies the globally routable IP check to include these
  new functions

Fixes rust-lang#24314
@bors bors merged commit f60f4b7 into rust-lang:master Apr 15, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Some special IP addresses are being wrongly detected as globally routable
4 participants