1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-28 01:47:34 +00:00

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 <timonkruiper@gmail.com>
This commit is contained in:
Andrew Kaster 2022-07-04 17:51:49 -06:00 committed by Andreas Kling
parent 136b779a64
commit 579eb7cf41

View file

@ -36,12 +36,15 @@ private:
Name m_hostname; Name m_hostname;
static constexpr sockaddr_in mdns_addr { 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) // htons(5353)
0xe914, .sin_port = 0xe914,
// 224.0.0.251 // 224.0.0.251
{ 0xfb0000e0 }, .sin_addr = { 0xfb0000e0 },
{ 0 } .sin_zero = { 0 }
}; };
}; };