-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Add Ipv6Addr::is_benchmarking
#86434
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
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next
Next commit
Add
Ipv6Addr::is_benchmarking
- Loading branch information
commit e2d6334191917c9c78f27aadb19722511cad3f47
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 |
---|---|---|
|
@@ -475,21 +475,22 @@ fn ipv6_properties() { | |
assert_eq!(&ip!($s).octets(), octets); | ||
assert_eq!(Ipv6Addr::from(*octets), ip!($s)); | ||
|
||
let unspecified: u16 = 1 << 0; | ||
let loopback: u16 = 1 << 1; | ||
let unique_local: u16 = 1 << 2; | ||
let global: u16 = 1 << 3; | ||
let unicast_link_local: u16 = 1 << 4; | ||
let unicast_global: u16 = 1 << 7; | ||
let documentation: u16 = 1 << 8; | ||
let multicast_interface_local: u16 = 1 << 9; | ||
let multicast_link_local: u16 = 1 << 10; | ||
let multicast_realm_local: u16 = 1 << 11; | ||
let multicast_admin_local: u16 = 1 << 12; | ||
let multicast_site_local: u16 = 1 << 13; | ||
let multicast_organization_local: u16 = 1 << 14; | ||
let multicast_global: u16 = 1 << 15; | ||
let multicast: u16 = multicast_interface_local | ||
let unspecified: u32 = 1 << 0; | ||
let loopback: u32 = 1 << 1; | ||
let unique_local: u32 = 1 << 2; | ||
let global: u32 = 1 << 3; | ||
let unicast_link_local: u32 = 1 << 4; | ||
let unicast_global: u32 = 1 << 7; | ||
let documentation: u32 = 1 << 8; | ||
let benchmarking: u32 = 1 << 16; | ||
let multicast_interface_local: u32 = 1 << 9; | ||
let multicast_link_local: u32 = 1 << 10; | ||
let multicast_realm_local: u32 = 1 << 11; | ||
let multicast_admin_local: u32 = 1 << 12; | ||
let multicast_site_local: u32 = 1 << 13; | ||
let multicast_organization_local: u32 = 1 << 14; | ||
let multicast_global: u32 = 1 << 15; | ||
let multicast: u32 = multicast_interface_local | ||
| multicast_admin_local | ||
| multicast_global | ||
| multicast_link_local | ||
|
@@ -532,6 +533,11 @@ fn ipv6_properties() { | |
} else { | ||
assert!(!ip!($s).is_documentation()); | ||
} | ||
if ($mask & benchmarking) == benchmarking { | ||
assert!(ip!($s).is_benchmarking()); | ||
} else { | ||
assert!(!ip!($s).is_benchmarking()); | ||
} | ||
if ($mask & multicast) != 0 { | ||
assert!(ip!($s).multicast_scope().is_some()); | ||
assert!(ip!($s).is_multicast()); | ||
|
@@ -570,20 +576,21 @@ fn ipv6_properties() { | |
} | ||
} | ||
|
||
let unspecified: u16 = 1 << 0; | ||
let loopback: u16 = 1 << 1; | ||
let unique_local: u16 = 1 << 2; | ||
let global: u16 = 1 << 3; | ||
let unicast_link_local: u16 = 1 << 4; | ||
let unicast_global: u16 = 1 << 7; | ||
let documentation: u16 = 1 << 8; | ||
let multicast_interface_local: u16 = 1 << 9; | ||
let multicast_link_local: u16 = 1 << 10; | ||
let multicast_realm_local: u16 = 1 << 11; | ||
let multicast_admin_local: u16 = 1 << 12; | ||
let multicast_site_local: u16 = 1 << 13; | ||
let multicast_organization_local: u16 = 1 << 14; | ||
let multicast_global: u16 = 1 << 15; | ||
let unspecified: u32 = 1 << 0; | ||
let loopback: u32 = 1 << 1; | ||
let unique_local: u32 = 1 << 2; | ||
let global: u32 = 1 << 3; | ||
let unicast_link_local: u32 = 1 << 4; | ||
let unicast_global: u32 = 1 << 7; | ||
let documentation: u32 = 1 << 8; | ||
let benchmarking: u32 = 1 << 16; | ||
let multicast_interface_local: u32 = 1 << 9; | ||
let multicast_link_local: u32 = 1 << 10; | ||
let multicast_realm_local: u32 = 1 << 11; | ||
let multicast_admin_local: u32 = 1 << 12; | ||
let multicast_site_local: u32 = 1 << 13; | ||
let multicast_organization_local: u32 = 1 << 14; | ||
let multicast_global: u32 = 1 << 15; | ||
|
||
check!("::", &[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], unspecified); | ||
|
||
|
@@ -679,6 +686,12 @@ fn ipv6_properties() { | |
documentation | ||
); | ||
|
||
check!( | ||
"2001:2::ac32:23ff:21", | ||
&[0x20, 1, 0, 2, 0, 0, 0, 0, 0, 0, 0xac, 0x32, 0x23, 0xff, 0, 0x21], | ||
global | unicast_global | benchmarking | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same as above, benchmarking addresses should not actually be globally reachable. They do however have global unicast scope. |
||
); | ||
|
||
check!( | ||
"102:304:506:708:90a:b0c:d0e:f10", | ||
&[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16], | ||
|
@@ -885,6 +898,9 @@ fn ipv6_const() { | |
const IS_DOCUMENTATION: bool = IP_ADDRESS.is_documentation(); | ||
assert!(!IS_DOCUMENTATION); | ||
|
||
const IS_BENCHMARKING: bool = IP_ADDRESS.is_benchmarking(); | ||
assert!(!IS_BENCHMARKING); | ||
|
||
const IS_UNICAST_GLOBAL: bool = IP_ADDRESS.is_unicast_global(); | ||
assert!(!IS_UNICAST_GLOBAL); | ||
|
||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
More than 16 properties are now being checked, so the tag type is changed from
u16
tou32
. Alsobenchmarking
is assigned valuei << 16
, the order doesn't really matter, only that the value is distinct from the other tags.