From 683aecaaece708e5935c0fe83ef2425ec607f404 Mon Sep 17 00:00:00 2001 From: Daiyuu Nobori Date: Sun, 22 Apr 2018 18:24:29 +0900 Subject: [PATCH 1/2] Improving the compliance of Virtual Network Adapters with the local address bit of the MAC address rule. When installing a new device driver of the Virtual Network Driver card, we changed the initial random MAC address from 00-AC-xx-xx-xx-xx to 5E-xx-xx-xx-xx-xx. This realizes the compliance with the local address bit of the MAC address rule. --- src/Cedar/Client.c | 2 +- src/Cedar/Virtual.c | 12 ++++++------ src/Mayaqua/Microsoft.c | 12 ++++++------ 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/Cedar/Client.c b/src/Cedar/Client.c index a5eaaf2c..7d8ca00b 100644 --- a/src/Cedar/Client.c +++ b/src/Cedar/Client.c @@ -431,7 +431,7 @@ void CiChangeAllVLanMacAddress(CLIENT *c) RPC_CLIENT_ENUM_VLAN_ITEM *e = t.Items[i]; UCHAR mac[6]; - if (StrToMac(mac, e->MacAddress) && mac[1] == 0xAC) + if (StrToMac(mac, e->MacAddress) && ((mac[0] == 0x00 && mac[1] == 0xAC) || (mac[0] = 0x5E))) { char *name = e->DeviceName; RPC_CLIENT_SET_VLAN s; diff --git a/src/Cedar/Virtual.c b/src/Cedar/Virtual.c index f3ea20c3..af9f65e7 100644 --- a/src/Cedar/Virtual.c +++ b/src/Cedar/Virtual.c @@ -10306,12 +10306,12 @@ void GenMacAddress(UCHAR *mac) Hash(hash, b->Buf, b->Size, true); // Generate a MAC address - mac[0] = 0x00; - mac[1] = 0xAC; // AC hurray - mac[2] = hash[0]; - mac[3] = hash[1]; - mac[4] = hash[2]; - mac[5] = hash[3]; + mac[0] = 0x5E; + mac[1] = hash[0]; + mac[2] = hash[1]; + mac[3] = hash[2]; + mac[4] = hash[3]; + mac[5] = hash[4]; FreeBuf(b); } diff --git a/src/Mayaqua/Microsoft.c b/src/Mayaqua/Microsoft.c index 6d6b9039..7c6d351a 100644 --- a/src/Mayaqua/Microsoft.c +++ b/src/Mayaqua/Microsoft.c @@ -10509,12 +10509,12 @@ void MsGenMacAddress(UCHAR *mac) Hash(hash, hash_src, sizeof(hash_src), true); - mac[0] = 0x00; - mac[1] = 0xAC; - mac[2] = hash[0]; - mac[3] = hash[1]; - mac[4] = hash[2]; - mac[5] = hash[3]; + mac[0] = 0x5E; + mac[1] = hash[0]; + mac[2] = hash[1]; + mac[3] = hash[2]; + mac[4] = hash[3]; + mac[5] = hash[4]; } // Finish the driver installation From 8230f164573e0c37db4007f57e39ffd917a280e8 Mon Sep 17 00:00:00 2001 From: Daiyuu Nobori Date: Mon, 23 Apr 2018 10:09:34 +0900 Subject: [PATCH 2/2] Fix a typo. --- src/Cedar/Client.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Cedar/Client.c b/src/Cedar/Client.c index 7d8ca00b..1fa85db9 100644 --- a/src/Cedar/Client.c +++ b/src/Cedar/Client.c @@ -431,7 +431,7 @@ void CiChangeAllVLanMacAddress(CLIENT *c) RPC_CLIENT_ENUM_VLAN_ITEM *e = t.Items[i]; UCHAR mac[6]; - if (StrToMac(mac, e->MacAddress) && ((mac[0] == 0x00 && mac[1] == 0xAC) || (mac[0] = 0x5E))) + if (StrToMac(mac, e->MacAddress) && ((mac[0] == 0x00 && mac[1] == 0xAC) || (mac[0] == 0x5E))) { char *name = e->DeviceName; RPC_CLIENT_SET_VLAN s;