Skip to content

Commit

Permalink
Use just stabilized is_unicast_link_local(). Bump MSRV 1.84.0
Browse files Browse the repository at this point in the history
  • Loading branch information
oherrala committed Jan 14, 2025
1 parent 5a466d8 commit 176c33f
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/rust_matrix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
- stable
- beta
- nightly
- 1.82.0 # MSRV
- 1.84.0 # MSRV

steps:
- name: Install dependencies
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ members = [
[workspace.package]
license = "MIT"
edition = "2021"
rust-version = "1.82.0" # MSRV
rust-version = "1.84.0" # MSRV
8 changes: 4 additions & 4 deletions luomu-common/src/ipaddr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,11 +141,11 @@ pub const fn is_valid_destination_ip6(ip: Ipv6Addr) -> bool {
// We've skipped handling "2001::/23 IETF Protocol Assignments [RFC2928]"
// since it's not valid with a footnote of "Unless allowed by a more
// specific allocation."
!(matches!(ip.segments(), [0, 0, 0, 0, 0, 0, 0, 0])
!(ip.is_unspecified()
|| ip.is_loopback()
|| matches!(ip.segments(), [0, 0, 0, 0, 0, 0xffff, _, _])
|| matches!(ip.segments(), [0x2001, 0xdb8, _, _, _, _, _, _])
|| (ip.segments()[0] == 0x3fff && ip.segments()[1] >> 12 == 0))
|| ((ip.segments()[0] == 0x3fff) && (ip.segments()[1] >> 12 == 0)))
}

/// Is this valid IPv6 forwardable address?
Expand All @@ -163,7 +163,7 @@ pub const fn is_valid_forwardable_ip6(ip: Ipv6Addr) -> bool {

// If the value of "Destination" is FALSE, the values of "Forwardable" and
// "Globally Reachable" must also be false.
!is_valid_destination_ip6(ip) && !(ip.segments()[0] & 0xffc0) == 0xfe80
is_valid_destination_ip6(ip) && !ip.is_unicast_link_local()
}

#[cfg(test)]
Expand Down Expand Up @@ -308,7 +308,7 @@ mod tests {
#[test]
fn test_is_valid_destination_ip4() {
for ip in yield_invalid_destination_ip4() {
assert!(!is_valid_destination_ip4(ip))
assert!(!is_valid_destination_ip4(ip), "invalid ip {ip}");
}
}

Expand Down

0 comments on commit 176c33f

Please sign in to comment.