Skip to content

UUID's _arp_getnode does not account for omitted leading 0's in arp output on Darwin #101531

Open
@t-jonesy

Description

@t-jonesy

Bug report

UUID does not account for omitted leading 0's in arp output on Darwin, causing _arp_getnode to return an incorrect value.

ARP:

arp 172.17.0.3
pikvm.local.lan (172.17.0.3) at e4:5f:1:67:22:2a on en0 ifscope [ethernet]

Bugged Output:

>>> import uuid
>>> import os, socket
>>> socket.gethostbyname = lambda x: '172.17.0.3'
>>> mac = uuid._arp_getnode()
>>> mac
15693565600298
>>> hex(mac)
'0xe45f167222a'

Expected:

>>> mac
251096696562218
>>> hex(mac)
'0xe45f0167222a'

Your environment

  • CPython versions tested on: 3.10.9
  • Operating system and architecture: macOS 13.2 22D49 arm64

Linked PRs

Metadata

Metadata

Labels

OS-macstdlibPython modules in the Lib dirtype-bugAn unexpected behavior, bug, or error

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions