From 579eb7cf419cefa02eb46429c092b6e3641273cb Mon Sep 17 00:00:00 2001 From: Andrew Kaster Date: Mon, 4 Jul 2022 17:51:49 -0600 Subject: [PATCH] LookupServer: Use designated initializers for sockaddr_in At least macOS has a non-standard sin_len field at the front of the struct that Linux and Serenity do not. On BSDs, the sin_len field must be initialized to the size of the structure. Co-Authored-By: Timon Kruiper --- Userland/Services/LookupServer/MulticastDNS.h | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/Userland/Services/LookupServer/MulticastDNS.h b/Userland/Services/LookupServer/MulticastDNS.h index ecf1b3a274..ff3ecfd2f3 100644 --- a/Userland/Services/LookupServer/MulticastDNS.h +++ b/Userland/Services/LookupServer/MulticastDNS.h @@ -36,12 +36,15 @@ private: Name m_hostname; static constexpr sockaddr_in mdns_addr { - AF_INET, +#ifdef AK_OS_BSD_GENERIC + .sin_len = sizeof(struct sockaddr_in), +#endif + .sin_family = AF_INET, // htons(5353) - 0xe914, + .sin_port = 0xe914, // 224.0.0.251 - { 0xfb0000e0 }, - { 0 } + .sin_addr = { 0xfb0000e0 }, + .sin_zero = { 0 } }; };