mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-01-10 08:09:26 +01:00
BBA/BuiltIn: Simplify HandleARP
This commit is contained in:
parent
7e9711d738
commit
bfc2d11891
@ -72,8 +72,10 @@ bool CEXIETHERNET::BuiltInBBAInterface::Activate()
|
|||||||
sf::IpAddress(m_local_ip).toInteger();
|
sf::IpAddress(m_local_ip).toInteger();
|
||||||
m_current_ip = htonl(ip);
|
m_current_ip = htonl(ip);
|
||||||
m_current_mac = Common::BitCastPtr<Common::MACAddress>(&m_eth_ref->mBbaMem[BBA_NAFR_PAR0]);
|
m_current_mac = Common::BitCastPtr<Common::MACAddress>(&m_eth_ref->mBbaMem[BBA_NAFR_PAR0]);
|
||||||
|
m_arp_table[m_current_ip] = m_current_mac;
|
||||||
m_router_ip = (m_current_ip & 0xFFFFFF) | 0x01000000;
|
m_router_ip = (m_current_ip & 0xFFFFFF) | 0x01000000;
|
||||||
m_router_mac = Common::GenerateMacAddress(Common::MACConsumer::BBA);
|
m_router_mac = Common::GenerateMacAddress(Common::MACConsumer::BBA);
|
||||||
|
m_arp_table[m_router_ip] = m_router_mac;
|
||||||
|
|
||||||
// clear all ref
|
// clear all ref
|
||||||
for (auto& ref : network_ref)
|
for (auto& ref : network_ref)
|
||||||
@ -128,19 +130,8 @@ void CEXIETHERNET::BuiltInBBAInterface::HandleARP(const Common::ARPPacket& packe
|
|||||||
{
|
{
|
||||||
const auto& [hwdata, arpdata] = packet;
|
const auto& [hwdata, arpdata] = packet;
|
||||||
Common::ARPPacket response(m_current_mac, m_router_mac);
|
Common::ARPPacket response(m_current_mac, m_router_mac);
|
||||||
|
response.arp_header = Common::ARPHeader(arpdata.target_ip, ResolveAddress(arpdata.target_ip),
|
||||||
if (arpdata.target_ip == m_current_ip)
|
m_current_ip, m_current_mac);
|
||||||
{
|
|
||||||
// game asked for himself, reply with his mac address
|
|
||||||
response.arp_header =
|
|
||||||
Common::ARPHeader(arpdata.target_ip, m_current_mac, m_current_ip, m_current_mac);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
response.arp_header = Common::ARPHeader(arpdata.target_ip, ResolveAddress(arpdata.target_ip),
|
|
||||||
m_current_ip, m_current_mac);
|
|
||||||
}
|
|
||||||
|
|
||||||
WriteToQueue(response.Build());
|
WriteToQueue(response.Build());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user