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 socket address family checks #1736

Merged
merged 3 commits into from Jun 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Expand Up @@ -34,6 +34,9 @@ This project adheres to [Semantic Versioning](https://semver.org/).
- Enabled `SockaddrStorage::{as_link_addr, as_link_addr_mut}` for Linux-like
operating systems.
(#[1729](https://github.com/nix-rust/nix/pull/1729))
- Fixed `SockaddrLike::from_raw` implementations for `VsockAddr` and
`SysControlAddr`.
(#[1736](https://github.com/nix-rust/nix/pull/1736))

### Removed

Expand Down
4 changes: 2 additions & 2 deletions src/sys/socket/addr.rs
Expand Up @@ -2259,7 +2259,7 @@ pub mod sys_control {
return None;
}
}
if (*addr).sa_family as i32 != libc::AF_INET6 as i32 {
if (*addr).sa_family as i32 != libc::AF_SYSTEM as i32 {
return None;
}
Some(SysControlAddr(*(addr as *const libc::sockaddr_ctl)))
Expand Down Expand Up @@ -2566,7 +2566,7 @@ pub mod vsock {
return None;
}
}
if (*addr).sa_family as i32 != libc::AF_INET6 as i32 {
if (*addr).sa_family as i32 != libc::AF_VSOCK as i32 {
return None;
}
Some(VsockAddr(*(addr as *const libc::sockaddr_vm)))
Expand Down