Skip to content

Commit 954d11f

Browse files
committed
Modifie return type for ipaddr
Signed-off-by: carlosb1 <[email protected]>
1 parent 68c230b commit 954d11f

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

CHANGELOG.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ This project adheres to [Semantic Versioning](https://semver.org/).
1818

1919
### Changed
2020

21+
- Changed function `SockaddrIn::ip()` to return `net::Ipv4Addr`
22+
([#])(https://github.com/nix-rust/nix/pull/2xxx))
23+
2124
- The MSRV is now 1.69
2225
([#2144](https://github.com/nix-rust/nix/pull/2144))
2326

@@ -31,7 +34,7 @@ This project adheres to [Semantic Versioning](https://semver.org/).
3134
- `unistd::getpeereid`
3235

3336
([#2137](https://github.com/nix-rust/nix/pull/2137))
34-
37+
3538
- Changed `openat()` and `Dir::openat()`, now take optional `dirfd`s
3639
([#2139](https://github.com/nix-rust/nix/pull/2139))
3740

@@ -51,7 +54,7 @@ This project adheres to [Semantic Versioning](https://semver.org/).
5154

5255
- Added `F_GETPATH` FcntlFlags entry on Apple/NetBSD/DragonflyBSD for `::nix::fcntl`.
5356
([#2142](https://github.com/nix-rust/nix/pull/2142))
54-
57+
5558
- Added `Ipv6HopLimit` to `::nix::sys::socket::ControlMessage` for Linux,
5659
MacOS, FreeBSD, DragonflyBSD, Android, iOS and Haiku.
5760
([#2074](https://github.com/nix-rust/nix/pull/2074))

src/sys/socket/addr.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1006,8 +1006,8 @@ pub struct SockaddrIn(libc::sockaddr_in);
10061006
impl SockaddrIn {
10071007
/// Returns the IP address associated with this socket address, in native
10081008
/// endian.
1009-
pub const fn ip(&self) -> libc::in_addr_t {
1010-
u32::from_be(self.0.sin_addr.s_addr)
1009+
pub fn ip(&self) -> net::Ipv4Addr {
1010+
net::Ipv4Addr::from(addr.0.sin_addr.s_addr.to_ne_bytes())
10111011
}
10121012

10131013
/// Creates a new socket address from IPv4 octets and a port number.

0 commit comments

Comments
 (0)