mirror of https://github.com/PCSX2/pcsx2.git
DEV9: Generate unique MAC for TAP, much like pcap backend does
This commit is contained in:
parent
5f2441e832
commit
bae445d9d2
|
@ -197,10 +197,19 @@ vector<tap_adapter>* GetTapAdapters()
|
|||
return tap_nic;
|
||||
}
|
||||
|
||||
static int TAPGetMACAddress(HANDLE handle, u8* addr)
|
||||
{
|
||||
DWORD len = 0;
|
||||
|
||||
return DeviceIoControl(handle, TAP_IOCTL_GET_MAC,
|
||||
addr, 6,
|
||||
addr, 6, &len, NULL);
|
||||
}
|
||||
|
||||
//Set the connection status
|
||||
static int TAPSetStatus(HANDLE handle, int status)
|
||||
{
|
||||
unsigned long len = 0;
|
||||
DWORD len = 0;
|
||||
|
||||
return DeviceIoControl(handle, TAP_IOCTL_SET_MEDIA_STATUS,
|
||||
&status, sizeof(status),
|
||||
|
@ -275,6 +284,18 @@ TAPAdapter::TAPAdapter()
|
|||
|
||||
cancel = CreateEvent(NULL, TRUE, FALSE, NULL);
|
||||
|
||||
u8 hostMAC[6];
|
||||
u8 newMAC[6];
|
||||
|
||||
TAPGetMACAddress(htap, hostMAC);
|
||||
memcpy(newMAC, ps2MAC, 6);
|
||||
|
||||
//Lets take the hosts last 2 bytes to make it unique on Xlink
|
||||
newMAC[5] = hostMAC[4];
|
||||
newMAC[4] = hostMAC[5];
|
||||
|
||||
SetMACAddress(newMAC);
|
||||
|
||||
isActive = true;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue