summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/core/hle/service/nifm/nifm.cpp5
-rw-r--r--src/core/network/network.cpp10
2 files changed, 11 insertions, 4 deletions
diff --git a/src/core/hle/service/nifm/nifm.cpp b/src/core/hle/service/nifm/nifm.cpp
index e742db48f..5ef574d20 100644
--- a/src/core/hle/service/nifm/nifm.cpp
+++ b/src/core/hle/service/nifm/nifm.cpp
@@ -354,10 +354,13 @@ private:
static_assert(sizeof(IpConfigInfo) == sizeof(IpAddressSetting) + sizeof(DnsSetting),
"IpConfigInfo has incorrect size.");
+ const auto [ipv4, error] = Network::GetHostIPv4Address();
+ ASSERT_MSG(error == Network::Errno::SUCCESS, "Couldn't get host IPv4 address");
+
const IpConfigInfo ip_config_info{
.ip_address_setting{
.is_automatic{true},
- .current_address{192, 168, 1, 100},
+ .current_address{ipv4},
.subnet_mask{255, 255, 255, 0},
.gateway{192, 168, 1, 1},
},
diff --git a/src/core/network/network.cpp b/src/core/network/network.cpp
index 375bc79ec..7b038041e 100644
--- a/src/core/network/network.cpp
+++ b/src/core/network/network.cpp
@@ -182,7 +182,7 @@ linger MakeLinger(bool enable, u32 linger_value) {
}
bool EnableNonBlock(int fd, bool enable) {
- int flags = fcntl(fd, F_GETFD);
+ int flags = fcntl(fd, F_GETFL);
if (flags == -1) {
return false;
}
@@ -191,7 +191,7 @@ bool EnableNonBlock(int fd, bool enable) {
} else {
flags &= ~O_NONBLOCK;
}
- return fcntl(fd, F_SETFD, flags) == 0;
+ return fcntl(fd, F_SETFL, flags) == 0;
}
Errno TranslateNativeError(int e) {
@@ -227,8 +227,12 @@ Errno GetAndLogLastError() {
#else
int e = errno;
#endif
+ const Errno err = TranslateNativeError(e);
+ if (err == Errno::AGAIN) {
+ return err;
+ }
LOG_ERROR(Network, "Socket operation error: {}", NativeErrorToString(e));
- return TranslateNativeError(e);
+ return err;
}
int TranslateDomain(Domain domain) {