classification
Title: _ipconfig_getnode incorrectly selects a DUID as a MAC address
Type: behavior Stage: resolved
Components: Library (Lib), Windows Versions: Python 3.8, Python 3.7, Python 3.6, Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: miss-islington, paul.moore, serhiy.storchaka, steve.dower, tim.golden, zach.ware, zeffron
Priority: normal Keywords: patch

Created on 2018-05-16 16:20 by zeffron, last changed 2018-05-21 12:43 by serhiy.storchaka. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 6922 merged zeffron, 2018-05-16 21:27
PR 7011 merged miss-islington, 2018-05-20 15:04
PR 7014 merged serhiy.storchaka, 2018-05-20 15:21
PR 7015 merged serhiy.storchaka, 2018-05-20 15:25
Messages (6)
msg316831 - (view) Author: Zvi Effron (zeffron) * Date: 2018-05-16 16:20
The function _ipconfig_getnode() in the uuid module can incorrectly pick up an IPv6 DUID instead of a MAC address due to not validating an exact match for the regular expression. The following output from `ipconfig /all` on my machine can be used to illustrate the problem:
```
C:\Users\viz_s>ipconfig /all

Windows IP Configuration

   Host Name . . . . . . . . . . . . : DESKTOP-UOHALF9
   Primary Dns Suffix  . . . . . . . :
   Node Type . . . . . . . . . . . . : Hybrid
   IP Routing Enabled. . . . . . . . : No
   WINS Proxy Enabled. . . . . . . . : No

Ethernet adapter vEthernet (Default Switch):

   Connection-specific DNS Suffix  . :
   Description . . . . . . . . . . . : Hyper-V Virtual Ethernet Adapter
   Physical Address. . . . . . . . . : 02-15-0B-EF-A2-34
   DHCP Enabled. . . . . . . . . . . : Yes
   Autoconfiguration Enabled . . . . : Yes
   Link-local IPv6 Address . . . . . : fe80::d8b5:2fbd:4d82:2e95%12(Preferred)
   IPv4 Address. . . . . . . . . . . : 192.168.125.17(Preferred)
   Subnet Mask . . . . . . . . . . . : 255.255.255.240
   Default Gateway . . . . . . . . . :
   DHCPv6 IAID . . . . . . . . . . . : 452990301
   DHCPv6 Client DUID. . . . . . . . : 00-01-00-01-1F-5A-B1-27-98-5F-D3-C5-71-45
   DNS Servers . . . . . . . . . . . : fec0:0:0:ffff::1%1
                                       fec0:0:0:ffff::2%1
                                       fec0:0:0:ffff::3%1
   NetBIOS over Tcpip. . . . . . . . : Disabled

Ethernet adapter vEthernet (DockerNAT):

   Connection-specific DNS Suffix  . :
   Description . . . . . . . . . . . : Hyper-V Virtual Ethernet Adapter #2
   Physical Address. . . . . . . . . : 00-15-5D-00-0D-1C
   DHCP Enabled. . . . . . . . . . . : No
   Autoconfiguration Enabled . . . . : Yes
   Link-local IPv6 Address . . . . . : fe80::a8b0:4970:fe5c:7ad8%20(Preferred)
   IPv4 Address. . . . . . . . . . . : 10.0.75.1(Preferred)
   Subnet Mask . . . . . . . . . . . : 255.255.255.0
   Default Gateway . . . . . . . . . :
   DNS Servers . . . . . . . . . . . : fec0:0:0:ffff::1%1
                                       fec0:0:0:ffff::2%1
                                       fec0:0:0:ffff::3%1
   NetBIOS over Tcpip. . . . . . . . : Enabled

Ethernet adapter Npcap Loopback Adapter:

   Connection-specific DNS Suffix  . :
   Description . . . . . . . . . . . : Npcap Loopback Adapter
   Physical Address. . . . . . . . . : 02-00-4C-4F-4F-50
   DHCP Enabled. . . . . . . . . . . : Yes
   Autoconfiguration Enabled . . . . : Yes
   Link-local IPv6 Address . . . . . : fe80::c07f:d604:86b:87e0%26(Preferred)
   Autoconfiguration IPv4 Address. . : 169.254.135.224(Preferred)
   Subnet Mask . . . . . . . . . . . : 255.255.0.0
   Default Gateway . . . . . . . . . :
   DHCPv6 IAID . . . . . . . . . . . : 771883084
   DHCPv6 Client DUID. . . . . . . . : 00-01-00-01-1F-5A-B1-27-98-5F-D3-C5-71-45
   DNS Servers . . . . . . . . . . . : fec0:0:0:ffff::1%1
                                       fec0:0:0:ffff::2%1
                                       fec0:0:0:ffff::3%1
   NetBIOS over Tcpip. . . . . . . . : Enabled

Wireless LAN adapter Local Area Connection* 2:

   Media State . . . . . . . . . . . : Media disconnected
   Connection-specific DNS Suffix  . :
   Description . . . . . . . . . . . : Microsoft Wi-Fi Direct Virtual Adapter
   Physical Address. . . . . . . . . : 9A-5F-D3-C5-70-44
   DHCP Enabled. . . . . . . . . . . : Yes
   Autoconfiguration Enabled . . . . : Yes

Wireless LAN adapter Local Area Connection* 12:

   Media State . . . . . . . . . . . : Media disconnected
   Connection-specific DNS Suffix  . :
   Description . . . . . . . . . . . : Microsoft Wi-Fi Direct Virtual Adapter #2
   Physical Address. . . . . . . . . : 9A-5F-D3-C5-75-44
   DHCP Enabled. . . . . . . . . . . : Yes
   Autoconfiguration Enabled . . . . : Yes

Wireless LAN adapter Wi-Fi:

   Connection-specific DNS Suffix  . :
   Description . . . . . . . . . . . : Marvell AVASTAR Wireless-AC Network Controller
   Physical Address. . . . . . . . . : 98-5F-D3-C5-71-45
   DHCP Enabled. . . . . . . . . . . : Yes
   Autoconfiguration Enabled . . . . : Yes
   Link-local IPv6 Address . . . . . : fe80::f183:815e:4914:dfa%21(Preferred)
   IPv4 Address. . . . . . . . . . . : 100.69.161.39(Preferred)
   Subnet Mask . . . . . . . . . . . : 255.255.0.0
   Lease Obtained. . . . . . . . . . : Wednesday, May 16, 2018 8:51:32 AM
   Lease Expires . . . . . . . . . . : Wednesday, May 16, 2018 9:51:31 AM
   Default Gateway . . . . . . . . . : 100.69.0.5
   DHCP Server . . . . . . . . . . . : 100.69.0.6
   DHCPv6 IAID . . . . . . . . . . . : 144203731
   DHCPv6 Client DUID. . . . . . . . : 00-01-00-01-1F-5A-B1-27-98-5F-D3-C5-71-45
   DNS Servers . . . . . . . . . . . : 100.69.0.5
   NetBIOS over Tcpip. . . . . . . . : Enabled
```
msg317174 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2018-05-20 15:03
New changeset c66c342cb42ab8a88884527ddfe3a5086bc06316 by Serhiy Storchaka (CtrlZvi) in branch 'master':
bpo-33542: Ignore DUID in uuid.get_node on Windows. (GH-6922)
https://github.com/python/cpython/commit/c66c342cb42ab8a88884527ddfe3a5086bc06316
msg317181 - (view) Author: miss-islington (miss-islington) Date: 2018-05-20 15:40
New changeset 073eca39a55b86ec7dd7a437ac0c910751a60ace by Miss Islington (bot) in branch '3.7':
bpo-33542: Ignore DUID in uuid.get_node on Windows. (GH-6922)
https://github.com/python/cpython/commit/073eca39a55b86ec7dd7a437ac0c910751a60ace
msg317204 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2018-05-20 22:50
New changeset ea9a0994cd0f4bd37799b045c34097eb21662b3d by Serhiy Storchaka in branch '2.7':
[2.7] bpo-33542: Ignore DUID in uuid.get_node on Windows. (GH-6922) (GH-7015)
https://github.com/python/cpython/commit/ea9a0994cd0f4bd37799b045c34097eb21662b3d
msg317231 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2018-05-21 12:20
New changeset e9e2fd75ccbc6e9a5221cf3525e39e9d042d843f by Serhiy Storchaka in branch '3.6':
[3.6] bpo-33542: Ignore DUID in uuid.get_node on Windows. (GH-6922) (GH-7014)
https://github.com/python/cpython/commit/e9e2fd75ccbc6e9a5221cf3525e39e9d042d843f
msg317232 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2018-05-21 12:43
Thank you for your contribution Zvi!
History
Date User Action Args
2018-05-21 12:43:15serhiy.storchakasetstatus: open -> closed
versions: + Python 2.7
messages: + msg317232

resolution: fixed
stage: patch review -> resolved
2018-05-21 12:20:57serhiy.storchakasetmessages: + msg317231
2018-05-20 22:50:36serhiy.storchakasetmessages: + msg317204
2018-05-20 15:40:13miss-islingtonsetnosy: + miss-islington
messages: + msg317181
2018-05-20 15:25:05serhiy.storchakasetpull_requests: + pull_request6665
2018-05-20 15:21:16serhiy.storchakasetpull_requests: + pull_request6664
2018-05-20 15:04:34miss-islingtonsetpull_requests: + pull_request6661
2018-05-20 15:03:27serhiy.storchakasetnosy: + serhiy.storchaka
messages: + msg317174
2018-05-16 21:27:28zeffronsetkeywords: + patch
stage: patch review
pull_requests: + pull_request6592
2018-05-16 16:20:56zeffroncreate