mirror of
https://git.eden-emu.dev/eden-emu/eden
synced 2026-06-27 14:16:04 +02:00
wa
This commit is contained in:
parent
5d748c5157
commit
6fa4f30e3f
1 changed files with 5 additions and 2 deletions
|
|
@ -111,7 +111,7 @@ std::vector<Network::NetworkInterface> GetAvailableNetworkInterfaces() {
|
||||||
#else
|
#else
|
||||||
|
|
||||||
std::vector<Network::NetworkInterface> GetAvailableNetworkInterfaces() {
|
std::vector<Network::NetworkInterface> GetAvailableNetworkInterfaces() {
|
||||||
#if defined(__ANDROID__) || defined(__linux__)
|
#if defined(__ANDROID__) || defined(__linux__) || defined(__APPLE__) || defined(__managarm__)
|
||||||
struct ifaddrs* ifaddr = nullptr;
|
struct ifaddrs* ifaddr = nullptr;
|
||||||
if (getifaddrs(&ifaddr) != 0) {
|
if (getifaddrs(&ifaddr) != 0) {
|
||||||
LOG_ERROR(Network, "getifaddrs: {}", std::strerror(errno));
|
LOG_ERROR(Network, "getifaddrs: {}", std::strerror(errno));
|
||||||
|
|
@ -126,7 +126,7 @@ std::vector<Network::NetworkInterface> GetAvailableNetworkInterfaces() {
|
||||||
u32 flags;
|
u32 flags;
|
||||||
};
|
};
|
||||||
std::vector<RoutingEntry> routes{};
|
std::vector<RoutingEntry> routes{};
|
||||||
#if defined(__ANDROID__)
|
#if defined(__ANDROID__) || defined(__APPLE__)
|
||||||
// Even through Linux based, we can't reliably obtain routing information from there :(
|
// Even through Linux based, we can't reliably obtain routing information from there :(
|
||||||
// macOS not Linux based and would murder us if we attempt to access /proc
|
// macOS not Linux based and would murder us if we attempt to access /proc
|
||||||
#else
|
#else
|
||||||
|
|
@ -146,7 +146,10 @@ std::vector<Network::NetworkInterface> GetAvailableNetworkInterfaces() {
|
||||||
std::vector<Network::NetworkInterface> ifaces;
|
std::vector<Network::NetworkInterface> ifaces;
|
||||||
for (auto ifa = ifaddr; ifa != nullptr; ifa = ifa->ifa_next) {
|
for (auto ifa = ifaddr; ifa != nullptr; ifa = ifa->ifa_next) {
|
||||||
if (ifa->ifa_addr == nullptr || ifa->ifa_netmask == nullptr /* Have a netmask and address */
|
if (ifa->ifa_addr == nullptr || ifa->ifa_netmask == nullptr /* Have a netmask and address */
|
||||||
|
// Apple hates human beings so lets pretend all families are fine
|
||||||
|
#if !defined(__APPLE__) && !defined(__managarm__)
|
||||||
|| ifa->ifa_addr->sa_family != AF_INET /* Must be of kind AF_INET */
|
|| ifa->ifa_addr->sa_family != AF_INET /* Must be of kind AF_INET */
|
||||||
|
#endif
|
||||||
|| (ifa->ifa_flags & IFF_UP) == 0 || (ifa->ifa_flags & IFF_LOOPBACK) != 0) /* Not loopback */
|
|| (ifa->ifa_flags & IFF_UP) == 0 || (ifa->ifa_flags & IFF_LOOPBACK) != 0) /* Not loopback */
|
||||||
continue;
|
continue;
|
||||||
// Just use 0 as the gateway address if not found OR routes are empty :)
|
// Just use 0 as the gateway address if not found OR routes are empty :)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue