Skip to content

Commit

Permalink
Merge #948
Browse files Browse the repository at this point in the history
948: socket: add AF_UNSPEC to AddressFamily r=asomers a=levex

Hi!

I work on a [crate](https://github.com/levex/network-bridge-rs) where it would make sense to use `AF_UNSPEC` in place of `AF_INET`, since that's the API most bridge libraries use. Unfortunately, it seems that `nix` is missing a representation for `AF_UNSPEC`. This PR adds `Unspec` to `AddressFamily`, so we can now represent `AF_UNSPEC`.

Co-authored-by: Levente Kurusa <lkurusa@acm.org>
  • Loading branch information
bors[bot] and levex committed Oct 15, 2018
2 parents d5aec34 + a75bcfe commit 175be51
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).
([#930](https://github.com/nix-rust/nix/pull/930))
- Added `futimens` and `utimesat` wrappers ([#944](https://github.com/nix-rust/nix/pull/944))
and a `utimes` wrapper ([#946](https://github.com/nix-rust/nix/pull/946)).
- Added `AF_UNSPEC` wrapper to `AddressFamily` ([#948](https://github.com/nix-rust/nix/pull/948))

### Changed
- Increased required Rust version to 1.22.1/
Expand Down
3 changes: 3 additions & 0 deletions src/sys/socket/addr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,9 @@ pub enum AddressFamily {
target_os = "netbsd",
target_os = "openbsd"))]
Natm = libc::AF_NATM,
/// Unspecified address family, (see [`getaddrinfo(3)`](http://man7.org/linux/man-pages/man3/getaddrinfo.3.html))
#[cfg(any(target_os = "android", target_os = "linux"))]
Unspec = libc::AF_UNSPEC,
}

impl AddressFamily {
Expand Down

0 comments on commit 175be51

Please sign in to comment.