mirror of
https://github.com/RGBCube/serenity
synced 2025-06-29 21:42:07 +00:00
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.
This commit is contained in:
parent
f008156dbf
commit
ae470ec955
11 changed files with 73 additions and 9 deletions
|
@ -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());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue