sockets/network: relax SockAddrIn len check and fix port byte-order to avoid SSBU crashes

- Accept SockAddrIn len in [6, sizeof] and warn instead of asserting to handle libnx/SSBU quirks
- Ensure TranslateFromSockAddrIn sets sin_port via htons(uint16_t) for consistent network byte-order
- Prevents assertion crashes and reduces “Broken pipe” error spam observed in Frozen's SSBU logs

Signed-off-by: Zephyron <zephyron@citron-emu.org>
This commit is contained in:
Zephyron
2025-08-11 20:59:44 +10:00
parent 96dd82ea3b
commit 85324599a6
2 changed files with 10 additions and 2 deletions

View File

@@ -91,7 +91,8 @@ sockaddr TranslateFromSockAddrIn(SockAddrIn input) {
break;
}
result.sin_port = htons(input.portno);
// input.portno is already in host byte order in our abstraction. Ensure network order here.
result.sin_port = htons(static_cast<uint16_t>(input.portno));
auto& ip = result.sin_addr.S_un.S_un_b;
ip.s_b1 = input.ip[0];