| 377 | } |
| 378 | |
| 379 | void PCAPAdapter::SetMACBridgedSend(NetPacket* pkt) |
| 380 | { |
| 381 | EthernetFrameEditor frame(pkt); |
| 382 | if (frame.GetProtocol() == static_cast<u16>(EtherType::IPv4)) // IP |
| 383 | { |
| 384 | PayloadPtrEditor* payload = frame.GetPayload(); |
| 385 | IP_Packet ippkt(payload->data, payload->GetLength()); |
| 386 | ps2IP = ippkt.sourceIP; |
| 387 | } |
| 388 | if (frame.GetProtocol() == static_cast<u16>(EtherType::ARP)) // ARP |
| 389 | { |
| 390 | ARP_PacketEditor arpPkt(frame.GetPayload()); |
| 391 | ps2IP = *(IP_Address*)arpPkt.SenderProtocolAddress(); |
| 392 | *(MAC_Address*)arpPkt.SenderHardwareAddress() = hostMAC; |
| 393 | } |
| 394 | frame.SetSourceMAC(hostMAC); |
| 395 | } |
| 396 | |
| 397 | /* |
| 398 | * Strips the Frame Check Sequence if we manage to capture it. |
nothing calls this directly
no test coverage detected