summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSönke Holz <sholz8530@gmail.com>2021-08-12 22:15:48 +0200
committerSönke Holz <sholz8530@gmail.com>2021-08-12 22:15:48 +0200
commit21743daf38f19160baa2da0e939a4e945dd57228 (patch)
tree99b45f0de20ddfde64a25d9cb42d0f328c0858fc
parentconfiguration: add option to select network interface (diff)
downloadyuzu-21743daf38f19160baa2da0e939a4e945dd57228.tar
yuzu-21743daf38f19160baa2da0e939a4e945dd57228.tar.gz
yuzu-21743daf38f19160baa2da0e939a4e945dd57228.tar.bz2
yuzu-21743daf38f19160baa2da0e939a4e945dd57228.tar.lz
yuzu-21743daf38f19160baa2da0e939a4e945dd57228.tar.xz
yuzu-21743daf38f19160baa2da0e939a4e945dd57228.tar.zst
yuzu-21743daf38f19160baa2da0e939a4e945dd57228.zip
-rw-r--r--src/core/network/network.cpp6
-rw-r--r--src/core/network/network_interface.cpp8
2 files changed, 6 insertions, 8 deletions
diff --git a/src/core/network/network.cpp b/src/core/network/network.cpp
index 67ecf57bd..9a4ac7e83 100644
--- a/src/core/network/network.cpp
+++ b/src/core/network/network.cpp
@@ -13,13 +13,13 @@
#include <winsock2.h>
#include <ws2tcpip.h>
#elif YUZU_UNIX
+#include <arpa/inet.h>
#include <errno.h>
#include <fcntl.h>
#include <netdb.h>
#include <netinet/in.h>
#include <poll.h>
#include <sys/socket.h>
-#include <arpa/inet.h>
#include <unistd.h>
#else
#error "Unimplemented platform"
@@ -363,8 +363,8 @@ NetworkInstance::~NetworkInstance() {
std::optional<IPv4Address> GetHostIPv4Address() {
const std::string& selected_network_interface = Settings::values.network_interface.GetValue();
const auto network_interfaces = Network::GetAvailableNetworkInterfaces();
- ASSERT_MSG(network_interfaces.size() > 0, "GetAvailableNetworkInterfaces returned no interfaces");
-
+ ASSERT_MSG(network_interfaces.size() > 0,
+ "GetAvailableNetworkInterfaces returned no interfaces");
const auto res = std::ranges::find_if(network_interfaces,
[&selected_network_interface](const auto& interface) {
diff --git a/src/core/network/network_interface.cpp b/src/core/network/network_interface.cpp
index bba4c8b26..2b53682ea 100644
--- a/src/core/network/network_interface.cpp
+++ b/src/core/network/network_interface.cpp
@@ -12,9 +12,9 @@
#ifdef _WIN32
#include <iphlpapi.h>
#else
+#include <cerrno>
#include <ifaddrs.h>
#include <net/if.h>
-#include <cerrno>
#endif
namespace Network {
@@ -61,8 +61,7 @@ std::vector<NetworkInterface> GetAvailableNetworkInterfaces() {
result.push_back(NetworkInterface{
.name{Common::UTF16ToUTF8(std::wstring{current_address->FriendlyName})},
- .ip_address{ip_addr}
- });
+ .ip_address{ip_addr}});
}
} else {
LOG_ERROR(Network, "Failed to get network interfaces with GetAdaptersAddresses");
@@ -99,8 +98,7 @@ std::vector<NetworkInterface> GetAvailableNetworkInterfaces() {
result.push_back(NetworkInterface{
.name{ifa->ifa_name},
- .ip_address{std::bit_cast<struct sockaddr_in>(*ifa->ifa_addr).sin_addr}
- });
+ .ip_address{std::bit_cast<struct sockaddr_in>(*ifa->ifa_addr).sin_addr}});
}
freeifaddrs(ifaddr);