This commit is contained in:
lizzie
2026-08-15 06:16:20 +00:00
parent b02db21e45
commit 63a5d74a32
2 changed files with 10 additions and 2 deletions
+5 -1
View File
@@ -522,8 +522,12 @@ std::pair<s32, Network::Errno> BSD::SocketImpl(Network::Domain domain, Network::
// TODO: rework this so proxy sockets can be done transparently? -- like what if i need
// to browse the internet while playing LDN or something stupid like that?
auto room_member = Network::GetRoomMember().lock();
if (protocol == Network::Protocol::ICMP || protocol == Network::Protocol::ICMPV6) {
if (0) {
// ...only unix has this issue it seems, ICMP works otherwise fine on win
#ifdef __unix__
} else if (protocol == Network::Protocol::ICMP || protocol == Network::Protocol::ICMPV6) {
descriptor.socket = std::make_shared<Network::IcmpSocket>();
#endif
} else if (room_member && room_member->IsConnected()) {
descriptor.socket = std::make_shared<Network::ProxySocket>();
} else {
+5 -1
View File
@@ -93,13 +93,17 @@ std::pair<s32, Errno> IcmpSocket::RecvFrom(int flags, std::span<u8> message, Net
LOG_DEBUG(Network, "(stubbed) called");
ASSERT(flags == 0);
ASSERT(message.size() < std::size_t((std::numeric_limits<int>::max)()));
#ifdef __unix__
#if !defined(__OPENORBIS__) && (defined(__FreeBSD__) || defined(__linux__))
if (addr) {
if (seq_ident.empty())
return {0, Errno::SUCCESS};
// PLEASE DON'T KILL ME, I SWEAR THIS IS LEGITIMATELY THE BEST WAY TO DO IT
// IF YOU OPEN socket() GOOGLE WILL STRAIGHT UP IP BAN YOU AFTER 2 HOURS
#ifdef __FreeBSD__
auto const cmd = fmt::format("ping -t 3 -o {}.{}.{}.{}", addr->ip[0], addr->ip[1], addr->ip[2], addr->ip[3]);
#elif defined(__linux__)
auto const cmd = fmt::format("ping -c 1 -W 3 {}.{}.{}.{}", addr->ip[0], addr->ip[1], addr->ip[2], addr->ip[3]);
#endif
if (::system(cmd.c_str()) == 0) {
std::vector<u8> data{
8,