diff options
author | Andreas Kling <awesomekling@gmail.com> | 2019-05-20 20:33:03 +0200 |
---|---|---|
committer | Andreas Kling <awesomekling@gmail.com> | 2019-05-20 20:33:03 +0200 |
commit | ae470ec9558e5903ff68bd3cf95e1355e5a13c1c (patch) | |
tree | b80d21b27d1c1d7fe62d0f77db3766b07c5a2008 /Kernel/Net/LocalSocket.cpp | |
parent | f008156dbf30a892827f3b6bf7203680533b2eb9 (diff) | |
download | serenity-ae470ec9558e5903ff68bd3cf95e1355e5a13c1c.zip |
Kernel: Add getpeername() syscall, and fix getsockname() behavior.
We were copying the raw IPv4 addresses into the wrong part of sockaddr_in,
and we didn't set sa_family or sa_port.
Diffstat (limited to 'Kernel/Net/LocalSocket.cpp')
-rw-r--r-- | Kernel/Net/LocalSocket.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/Kernel/Net/LocalSocket.cpp b/Kernel/Net/LocalSocket.cpp index c6cf763b2f..17ee5fc2cf 100644 --- a/Kernel/Net/LocalSocket.cpp +++ b/Kernel/Net/LocalSocket.cpp @@ -24,7 +24,7 @@ LocalSocket::~LocalSocket() { } -bool LocalSocket::get_address(sockaddr* address, socklen_t* address_size) +bool LocalSocket::get_local_address(sockaddr* address, socklen_t* address_size) { // FIXME: Look into what fallback behavior we should have here. if (*address_size != sizeof(sockaddr_un)) @@ -34,6 +34,11 @@ bool LocalSocket::get_address(sockaddr* address, socklen_t* address_size) return true; } +bool LocalSocket::get_peer_address(sockaddr* address, socklen_t* address_size) +{ + return get_local_address(address, address_size); +} + KResult LocalSocket::bind(const sockaddr* address, socklen_t address_size) { ASSERT(!is_connected()); |