Skip to content

Commit b3ba2b5

Browse files
bors[bot]qwandor
andauthored
Merge #1736
1736: Fix socket address family checks r=rtzoeller a=qwandor The `SockaddrLike::from_raw` implementations for `VsockAddr` and `SysControlAddr` were checking against the wrong address family constant. This PR makes them consistent with the values matched against in `SockaddrStorage::from_raw`. Co-authored-by: Andrew Walbran <[email protected]>
2 parents 32d597b + ccf1b80 commit b3ba2b5

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ This project adheres to [Semantic Versioning](https://semver.org/).
3434
- Enabled `SockaddrStorage::{as_link_addr, as_link_addr_mut}` for Linux-like
3535
operating systems.
3636
(#[1729](https://github.com/nix-rust/nix/pull/1729))
37+
- Fixed `SockaddrLike::from_raw` implementations for `VsockAddr` and
38+
`SysControlAddr`.
39+
(#[1736](https://github.com/nix-rust/nix/pull/1736))
3740

3841
### Removed
3942

src/sys/socket/addr.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2259,7 +2259,7 @@ pub mod sys_control {
22592259
return None;
22602260
}
22612261
}
2262-
if (*addr).sa_family as i32 != libc::AF_INET6 as i32 {
2262+
if (*addr).sa_family as i32 != libc::AF_SYSTEM as i32 {
22632263
return None;
22642264
}
22652265
Some(SysControlAddr(*(addr as *const libc::sockaddr_ctl)))
@@ -2566,7 +2566,7 @@ pub mod vsock {
25662566
return None;
25672567
}
25682568
}
2569-
if (*addr).sa_family as i32 != libc::AF_INET6 as i32 {
2569+
if (*addr).sa_family as i32 != libc::AF_VSOCK as i32 {
25702570
return None;
25712571
}
25722572
Some(VsockAddr(*(addr as *const libc::sockaddr_vm)))

0 commit comments

Comments
 (0)