diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt index e53d8f50..ef1894a1 100644 --- a/source/CMakeLists.txt +++ b/source/CMakeLists.txt @@ -35,6 +35,7 @@ set(SOURCE_FILES Tfe/tfesupp.cpp Tfe/NetworkBackend.cpp Tfe/PCapBackend.cpp + Tfe/IPRaw.cpp Debugger/Debug.cpp Debugger/Debugger_Help.cpp @@ -124,6 +125,7 @@ set(HEADER_FILES Tfe/tfesupp.h Tfe/NetworkBackend.h Tfe/PCapBackend.h + Tfe/IPRaw.h Uthernet1.h Uthernet2.h diff --git a/source/linux/network/slirp2.cpp b/source/linux/network/slirp2.cpp index 43048085..eea3289f 100644 --- a/source/linux/network/slirp2.cpp +++ b/source/linux/network/slirp2.cpp @@ -200,4 +200,15 @@ bool SlirpBackend::isValid() return true; } +void SlirpBackend::getMACAddress(const uint32_t address, MACAddress & mac) +{ + // a bit of a hack, I've found out that slirp uses + /* emulated hosts use the MAC addr 52:55:IP:IP:IP:IP */ + // https://gitlab.freedesktop.org/slirp/libslirp/-/blob/bf917b89d64f57d9302aba4b2f027ea68fb78c13/src/slirp.c#L78 + mac.address[0] = 0x52; + mac.address[1] = 0x55; + uint32_t * ptr = reinterpret_cast(mac.address + 2); + *ptr = address; +} + #endif diff --git a/source/linux/network/slirp2.h b/source/linux/network/slirp2.h index 4d9684ea..c00658e8 100644 --- a/source/linux/network/slirp2.h +++ b/source/linux/network/slirp2.h @@ -30,6 +30,8 @@ public: void update(const ULONG nExecutedCycles) override; bool isValid() override; + void getMACAddress(const uint32_t address, MACAddress & mac) override; + void sendToGuest(const uint8_t *pkt, int pkt_len); int addPoll(const int fd, const int events);