diff options
| author | Léo Lam <leo@leolam.fr> | 2020-11-02 22:17:38 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-11-02 22:17:38 +0100 |
| commit | cbaf8f82ec768b6d76fbcb2f2088db22ad64a1fd (patch) | |
| tree | 7961c645df56be4960ab131b2d7b11387b6613e2 /Source/Core | |
| parent | 5b9cd831370649f17d64f67d821ea41223b32a6c (diff) | |
| parent | dd688f4eb001d93e815e857a09f07ab3a9a75816 (diff) | |
Merge pull request #9214 from OatmealDome/macos-bind
Top: Set port when connecting a socket to find the default interface
Diffstat (limited to 'Source/Core')
| -rw-r--r-- | Source/Core/Core/IOS/Network/IP/Top.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/Source/Core/Core/IOS/Network/IP/Top.cpp b/Source/Core/Core/IOS/Network/IP/Top.cpp index dfad83a9c7..41042fbf1d 100644 --- a/Source/Core/Core/IOS/Network/IP/Top.cpp +++ b/Source/Core/Core/IOS/Network/IP/Top.cpp @@ -223,8 +223,10 @@ static std::optional<DefaultInterface> GetSystemDefaultInterface() sockaddr_in addr{}; socklen_t length = sizeof(addr); addr.sin_family = AF_INET; - // The address is irrelevant -- no packet is actually sent. This just needs to be a public IP. + // The address and port are irrelevant -- no packet is actually sent. These just need to be set + // to a valid IP and port. addr.sin_addr.s_addr = inet_addr(8, 8, 8, 8); + addr.sin_port = htons(53); if (connect(sock, reinterpret_cast<const sockaddr*>(&addr), sizeof(addr)) == -1) return {}; if (getsockname(sock, reinterpret_cast<sockaddr*>(&addr), &length) == -1) |
