diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/core/hle/service/nifm/nifm.cpp | 47 |
1 files changed, 21 insertions, 26 deletions
diff --git a/src/core/hle/service/nifm/nifm.cpp b/src/core/hle/service/nifm/nifm.cpp index 0a53c0c81..183bd48ce 100644 --- a/src/core/hle/service/nifm/nifm.cpp +++ b/src/core/hle/service/nifm/nifm.cpp | |||
| @@ -352,38 +352,33 @@ private: | |||
| 352 | LOG_WARNING(Service_NIFM, "(STUBBED) called"); | 352 | LOG_WARNING(Service_NIFM, "(STUBBED) called"); |
| 353 | 353 | ||
| 354 | struct IpConfigInfo { | 354 | struct IpConfigInfo { |
| 355 | IpAddressSetting ip_address_setting; | 355 | IpAddressSetting ip_address_setting{}; |
| 356 | DnsSetting dns_setting; | 356 | DnsSetting dns_setting{}; |
| 357 | }; | 357 | }; |
| 358 | static_assert(sizeof(IpConfigInfo) == sizeof(IpAddressSetting) + sizeof(DnsSetting), | 358 | static_assert(sizeof(IpConfigInfo) == sizeof(IpAddressSetting) + sizeof(DnsSetting), |
| 359 | "IpConfigInfo has incorrect size."); | 359 | "IpConfigInfo has incorrect size."); |
| 360 | 360 | ||
| 361 | IpConfigInfo ip_config_info{ | 361 | const auto net_iface = Network::GetSelectedNetworkInterface(); |
| 362 | .ip_address_setting{ | ||
| 363 | .is_automatic{true}, | ||
| 364 | .current_address{0, 0, 0, 0}, | ||
| 365 | .subnet_mask{255, 255, 255, 0}, | ||
| 366 | .gateway{192, 168, 1, 1}, | ||
| 367 | }, | ||
| 368 | .dns_setting{ | ||
| 369 | .is_automatic{true}, | ||
| 370 | .primary_dns{1, 1, 1, 1}, | ||
| 371 | .secondary_dns{1, 0, 0, 1}, | ||
| 372 | }, | ||
| 373 | }; | ||
| 374 | 362 | ||
| 375 | const auto iface = Network::GetSelectedNetworkInterface(); | 363 | const IpConfigInfo ip_config_info = [&net_iface] { |
| 376 | if (iface) { | 364 | if (!net_iface) { |
| 377 | ip_config_info.ip_address_setting = | 365 | return IpConfigInfo{}; |
| 378 | IpAddressSetting{.is_automatic{true}, | 366 | } |
| 379 | .current_address{Network::TranslateIPv4(iface->ip_address)}, | ||
| 380 | .subnet_mask{Network::TranslateIPv4(iface->subnet_mask)}, | ||
| 381 | .gateway{Network::TranslateIPv4(iface->gateway)}}; | ||
| 382 | 367 | ||
| 383 | } else { | 368 | return IpConfigInfo{ |
| 384 | LOG_ERROR(Service_NIFM, | 369 | .ip_address_setting{ |
| 385 | "Couldn't get host network configuration info, using default values"); | 370 | .is_automatic{true}, |
| 386 | } | 371 | .current_address{Network::TranslateIPv4(net_iface->ip_address)}, |
| 372 | .subnet_mask{Network::TranslateIPv4(net_iface->subnet_mask)}, | ||
| 373 | .gateway{Network::TranslateIPv4(net_iface->gateway)}, | ||
| 374 | }, | ||
| 375 | .dns_setting{ | ||
| 376 | .is_automatic{true}, | ||
| 377 | .primary_dns{1, 1, 1, 1}, | ||
| 378 | .secondary_dns{1, 0, 0, 1}, | ||
| 379 | }, | ||
| 380 | }; | ||
| 381 | }(); | ||
| 387 | 382 | ||
| 388 | IPC::ResponseBuilder rb{ctx, 2 + (sizeof(IpConfigInfo) + 3) / sizeof(u32)}; | 383 | IPC::ResponseBuilder rb{ctx, 2 + (sizeof(IpConfigInfo) + 3) / sizeof(u32)}; |
| 389 | rb.Push(ResultSuccess); | 384 | rb.Push(ResultSuccess); |